diff --git a/.atom/atom.coffee b/.atom/atom.coffee deleted file mode 100644 index 462e010ec..000000000 --- a/.atom/atom.coffee +++ /dev/null @@ -1,8 +0,0 @@ -requireExtension 'autocomplete' -requireExtension 'strip-trailing-whitespace' -requireExtension 'fuzzy-finder' -requireExtension 'tree-view' -requireExtension 'command-panel' -requireExtension 'keybindings-view' -requireExtension 'snippets' -requireExtension 'status-bar' diff --git a/.atom/snippets/coffee.snippets b/.atom/snippets/coffee.snippets deleted file mode 100644 index 57b3e3980..000000000 --- a/.atom/snippets/coffee.snippets +++ /dev/null @@ -1,34 +0,0 @@ -snippet de "Describe block" -describe "${1:description}", -> - ${2:body} -endsnippet - -snippet i "It block" -it "$1", -> - $2 -endsnippet - -snippet be "Before each" -beforeEach -> - $1 -endsnippet - -snippet ex "Expectation" -expect($1).to$2 -endsnippet - -snippet log "Console log" -console.log $1 -endsnippet - -snippet ra "Range array" -[[$1, $2], [$3, $4]] -endsnippet - -snippet pt "Point array" -[$1, $2] -endsnippet - -snippet spy "Jasmine spy" -jasmine.createSpy("${1:description}")$2 -endsnippet diff --git a/.gitignore b/.gitignore index 040269f62..242ef1393 100644 --- a/.gitignore +++ b/.gitignore @@ -1,22 +1,2 @@ -# Xcode -build/* -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -*.xcworkspace -!default.xcworkspace -xcuserdata -profile -*.moved-aside .DS_Store -tags -atom-build -pkg - -# Eclipse -.project +.svn diff --git a/.pairs b/.pairs deleted file mode 100644 index be6f30427..000000000 --- a/.pairs +++ /dev/null @@ -1,9 +0,0 @@ -pairs: - ns: Nathan Sobo; nathan - cj: Corey Johnson; cj - dg: David Graham; dgraham - ks: Kevin Sawicki; kevin -email: - domain: github.com -#global: true - diff --git a/AUTHORS.txt b/AUTHORS.txt new file mode 100644 index 000000000..de57b19ec --- /dev/null +++ b/AUTHORS.txt @@ -0,0 +1,26 @@ +# This file is an addendum to the Chromium AUTHORS file. +# Names should be added to this file like so: +# Name or Organization + +Marshall Greenblatt +Jamie Kirkpatrick +Johan Lindström +Igor Pavlov +Yanko Yankov +Emerick Rogul +Valve Corporation +Anthony Taranto +Joe Andrieu +Keith Poole +Aviv Rind +Michael Kaminski +ADInstruments Ltd. +Gus Verdun +Joinerysoft Ltd. +Johan Björk +Dmitry Azaraev +David Xue +Russell (Rusty) Richards +Brian Power +Corey Lucier +Mihai Tica diff --git a/Atom-Linux/.gitignore b/Atom-Linux/.gitignore deleted file mode 100644 index 3e2d8a8e3..000000000 --- a/Atom-Linux/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/atom -*.o diff --git a/Atom-Linux/Makefile b/Atom-Linux/Makefile deleted file mode 100644 index 77a042faa..000000000 --- a/Atom-Linux/Makefile +++ /dev/null @@ -1,93 +0,0 @@ -INSTALLDIR=/usr/share/atom - -CXXFLAGS := -Werror \ - -pthread \ - -fno-exceptions \ - -fno-strict-aliasing \ - -Wall \ - -Wno-unused-parameter \ - -Wno-missing-field-initializers \ - -fvisibility=hidden \ - -pipe \ - -fPIC \ - -pthread \ - -D_REENTRANT \ - -I/usr/include/gtk-2.0 \ - -I/usr/lib/gtk-2.0/include \ - -I/usr/include/atk-1.0 \ - -I/usr/include/cairo \ - -I/usr/include/pango-1.0 \ - -I/usr/include/gio-unix-2.0/ \ - -I/usr/include/glib-2.0 \ - -I/usr/include/openssl \ - -I/usr/lib/glib-2.0/include \ - -I../cef \ - -O2 \ - -fno-ident \ - -fdata-sections \ - -ffunction-sections \ - -fno-rtti \ - -fno-threadsafe-statics \ - -fvisibility-inlines-hidden \ - -Wsign-compare - -LDFLAGS := -pthread \ - -Wl,-z,noexecstack \ - -fPIC \ - -Llib \ - -Wl,-O1 \ - -Wl,--as-needed \ - -Wl,--gc-sections \ - -Wl,-rpath=$(INSTALLDIR) - -LIBS := -lX11 \ - -lgtk-x11-2.0 \ - -lgdk-x11-2.0 \ - -latk-1.0 \ - -lgio-2.0 \ - -lpangoft2-1.0 \ - -lgdk_pixbuf-2.0 \ - -lm \ - -lpangocairo-1.0 \ - -lcairo \ - -lpango-1.0 \ - -lgobject-2.0 \ - -lgmodule-2.0 \ - -lgthread-2.0 \ - -lrt \ - -lglib-2.0 \ - -lssl \ - -lcrypto \ - -lcef \ - -lcef_dll_wrapper \ - -lonig - -SOURCES=atom.cpp native_handler.cpp client_handler.cpp onig_regexp_extension.cpp io_utils.cpp -OBJECTS=$(SOURCES:.cpp=.o) - -all: - g++ $(CXXFLAGS) -c $(SOURCES) - g++ -o atom $(OBJECTS) $(LDFLAGS) $(LIBS) - -clean: - rm -rf atom *.o - -install: - mkdir -p $(INSTALLDIR) - cp atom $(INSTALLDIR) - cp chrome.pak $(INSTALLDIR) - cp -R locales $(INSTALLDIR) - cp atom.png $(INSTALLDIR) - cp lib/libcef.so $(INSTALLDIR) - cp lib/libcef_dll_wrapper.a $(INSTALLDIR) - cp -R ../src $(INSTALLDIR) - cp -R ../static $(INSTALLDIR) - 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 - -spec-install: install - cp -R ../spec $(INSTALLDIR) diff --git a/Atom-Linux/atom.cpp b/Atom-Linux/atom.cpp deleted file mode 100644 index 3457166fc..000000000 --- a/Atom-Linux/atom.cpp +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -#include -#include -#include -#include "atom.h" -#include "include/cef_app.h" -#include "include/cef_browser.h" -#include "include/cef_frame.h" -#include "include/cef_runnable.h" -#include "client_handler.h" -#include "onig_regexp_extension.h" -#include "io_utils.h" - -char* szWorkingDir; // The current working directory - -const char* szPath; // The folder the application is in - -const char* szPathToOpen; // The file to open - -CefRefPtr g_handler; - -void AppGetSettings(CefSettings& settings, CefRefPtr& app) { - CefString(&settings.cache_path) = ""; - CefString(&settings.user_agent) = ""; - CefString(&settings.product_version) = ""; - CefString(&settings.locale) = ""; - CefString(&settings.log_file) = ""; - CefString(&settings.javascript_flags) = ""; - - settings.log_severity = LOGSEVERITY_ERROR; - settings.local_storage_quota = 0; - settings.session_storage_quota = 0; -} - -void destroy(void) { - CefQuitMessageLoop(); -} - -void TerminationSignalHandler(int signatl) { - destroy(); -} - -// WebViewDelegate::TakeFocus in the test webview delegate. -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); - } - - return TRUE; -} - -int main(int argc, char *argv[]) { - szWorkingDir = get_current_dir_name(); - if (szWorkingDir == NULL) - return -1; - - std::string appDir = io_util_app_directory(); - if (appDir.empty()) - return -1; - - szPath = appDir.c_str(); - - std::string pathToOpen; - if (argc >= 2) { - if (argv[1][0] != '/') { - pathToOpen.append(szWorkingDir); - pathToOpen.append("/"); - pathToOpen.append(argv[1]); - } else - pathToOpen.append(argv[1]); - } else - pathToOpen.append(szWorkingDir); - szPathToOpen = pathToOpen.c_str(); - - GtkWidget* window; - - gtk_init(&argc, &argv); - - CefSettings settings; - CefRefPtr app; - - AppGetSettings(settings, app); - CefInitialize(settings, app); - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(window), "atom"); - gtk_window_set_default_size(GTK_WINDOW(window), 800, 600); - gtk_window_maximize(GTK_WINDOW(window)); - - g_signal_connect(window, "focus", G_CALLBACK(&HandleFocus), NULL); - - GtkWidget* vbox = gtk_vbox_new(FALSE, 0); - - g_signal_connect(G_OBJECT(window), "destroy", - G_CALLBACK(gtk_widget_destroyed), &window); - g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL); - - // Create the handler. - g_handler = new ClientHandler(); - g_handler->SetMainHwnd(vbox); - g_handler->SetWindow(window); - - new OnigRegexpExtension(); - - // Create the browser view. - CefWindowInfo window_info; - CefBrowserSettings browserSettings; - - window_info.SetAsChild(vbox); - - std::string path = io_utils_real_app_path("/index.html"); - if (path.empty()) - return -1; - - std::string resolved("file://"); - resolved.append(path); - - CefBrowser::CreateBrowserSync(window_info, - static_cast >(g_handler), resolved, browserSettings); - - gtk_container_add(GTK_CONTAINER(window), vbox); - gtk_widget_show_all(GTK_WIDGET(window)); - - GdkPixbuf *pixbuf; - GError *error = NULL; - std::string iconPath; - iconPath.append(szPath); - iconPath.append("/atom.png"); - pixbuf = gdk_pixbuf_new_from_file(iconPath.c_str(), &error); - if (pixbuf) - gtk_window_set_icon(GTK_WINDOW(window), pixbuf); - - // Install an signal handler so we clean up after ourselves. - signal(SIGINT, TerminationSignalHandler); - signal(SIGTERM, TerminationSignalHandler); - - CefRunMessageLoop(); - - CefShutdown(); - - return 0; -} - -// Global functions - -std::string AppGetWorkingDirectory() { - return szWorkingDir; -} - -std::string AppPath() { - return szPath; -} - -std::string PathToOpen() { - return szPathToOpen; -} diff --git a/Atom-Linux/atom.h b/Atom-Linux/atom.h deleted file mode 100644 index 7172fabd3..000000000 --- a/Atom-Linux/atom.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef ATOM_H_ -#define ATOM_H_ -#pragma once - -#include -#include "include/cef_base.h" - -class CefApp; -class CefBrowser; -class CefCommandLine; - -// Returns the main browser window instance. -CefRefPtr AppGetBrowser(); - -// Returns the main application window handle. -CefWindowHandle AppGetMainHwnd(); - -// Returns the application working directory. -std::string AppGetWorkingDirectory(); - -// Returns the application's path. -std::string AppPath(); - -// Returns the initial path to open. -std::string PathToOpen(); - -// Returns the application settings -void AppGetSettings(CefSettings& settings, CefRefPtr& app); - -#endif diff --git a/Atom-Linux/atom.png b/Atom-Linux/atom.png deleted file mode 100644 index b77e76777..000000000 Binary files a/Atom-Linux/atom.png and /dev/null differ diff --git a/Atom-Linux/chrome.pak b/Atom-Linux/chrome.pak deleted file mode 100644 index 51266259d..000000000 Binary files a/Atom-Linux/chrome.pak and /dev/null differ diff --git a/Atom-Linux/client_handler.cpp b/Atom-Linux/client_handler.cpp deleted file mode 100644 index 7794d6ad2..000000000 --- a/Atom-Linux/client_handler.cpp +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -#include "client_handler.h" -#include -#include -#include -#include -#include "include/cef_browser.h" -#include "include/cef_frame.h" -#include "atom.h" -#include "native_handler.h" -#include "atom.h" -#include -#include - -ClientHandler::ClientHandler() : - m_MainHwnd(NULL), m_BrowserHwnd(NULL) { - m_nativeHandler = new NativeHandler(); -} - -ClientHandler::~ClientHandler() { -} - -void ClientHandler::OnAfterCreated(CefRefPtr browser) { - REQUIRE_UI_THREAD(); - - AutoLock lock_scope(this); - if (!m_Browser.get()) { - // We need to keep the main child window, but not popup windows - m_Browser = browser; - m_BrowserHwnd = browser->GetWindowHandle(); - } -} - -bool ClientHandler::DoClose(CefRefPtr browser) { - REQUIRE_UI_THREAD(); - - if (m_BrowserHwnd == browser->GetWindowHandle()) { - // Since the main window contains the browser window, we need to close - // the parent window instead of the browser window. - CloseMainWindow(); - - // Return true here so that we can skip closing the browser window - // in this pass. (It will be destroyed due to the call to close - // the parent above.) - return true; - } - - // A popup browser window is not contained in another window, so we can let - // these windows close by themselves. - return false; -} - -void ClientHandler::OnBeforeClose(CefRefPtr browser) { - REQUIRE_UI_THREAD(); - - if (m_BrowserHwnd == browser->GetWindowHandle()) { - // Free the browser pointer so that the browser can be destroyed - m_Browser = NULL; - } -} - -void ClientHandler::OnLoadStart(CefRefPtr browser, - CefRefPtr frame) { - REQUIRE_UI_THREAD(); - - if (m_BrowserHwnd == browser->GetWindowHandle() && frame->IsMain()) { - CefRefPtr context = frame->GetV8Context(); - CefRefPtr global = context->GetGlobal(); - context->Enter(); - - CefRefPtr windowNumber = CefV8Value::CreateInt(0); - global->SetValue("$windowNumber", windowNumber, V8_PROPERTY_ATTRIBUTE_NONE); - - std::string path; - if (m_nativeHandler && !m_nativeHandler->path.empty()) - path = m_nativeHandler->path; - else - path.append(PathToOpen()); - - CefRefPtr pathToOpen = CefV8Value::CreateString(path); - global->SetValue("$pathToOpen", pathToOpen, V8_PROPERTY_ATTRIBUTE_NONE); - - m_nativeHandler->window = window; - m_nativeHandler->path = path; - - CefRefPtr atom = CefV8Value::CreateObject(NULL, NULL); - global->SetValue("atom", atom, V8_PROPERTY_ATTRIBUTE_NONE); - - CefRefPtr loadPath = CefV8Value::CreateString(AppPath()); - atom->SetValue("loadPath", loadPath, V8_PROPERTY_ATTRIBUTE_NONE); - - CefRefPtr bootstrapScript = CefV8Value::CreateString( - "single-window-bootstrap"); - global->SetValue("$bootstrapScript", bootstrapScript, - V8_PROPERTY_ATTRIBUTE_NONE); - - context->Exit(); - } -} - -void ClientHandler::OnLoadEnd(CefRefPtr browser, - CefRefPtr frame, int httpStatusCode) { - REQUIRE_UI_THREAD(); - -} - -bool ClientHandler::OnLoadError(CefRefPtr browser, - CefRefPtr frame, ErrorCode errorCode, const CefString& failedUrl, - CefString& errorText) { - REQUIRE_UI_THREAD(); - - if (errorCode == ERR_CACHE_MISS) { - // Usually caused by navigating to a page with POST data via back or - // forward buttons. - errorText = "Expired Form Data" - "

Expired Form Data

" - "

Your form request has expired. " - "Click reload to re-submit the form data.

" - ""; - } else { - // All other messages. - std::stringstream ss; - ss << "Load Failed" - "

Load Failed

" - "

Load of URL " << std::string(failedUrl) - << " failed with error code " << static_cast(errorCode) - << ".

" - ""; - errorText = ss.str(); - } - - return false; -} - -void ClientHandler::OnNavStateChange(CefRefPtr browser, - bool canGoBack, bool canGoForward) { - //Intentionally left blank -} - -bool ClientHandler::OnConsoleMessage(CefRefPtr browser, - const CefString& message, const CefString& source, int line) { - REQUIRE_UI_THREAD(); - std::cout << std::string(message) << std::endl; - return false; -} - -void ClientHandler::OnFocusedNodeChanged(CefRefPtr browser, - CefRefPtr frame, CefRefPtr node) { - 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; -} - -void ClientHandler::SetMainHwnd(CefWindowHandle hwnd) { - AutoLock lock_scope(this); - m_MainHwnd = hwnd; -} - -// ClientHandler::ClientLifeSpanHandler implementation -bool ClientHandler::OnBeforePopup(CefRefPtr parentBrowser, - const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, - const CefString& url, CefRefPtr& client, - CefBrowserSettings& settings) { - REQUIRE_UI_THREAD(); - - return false; -} - -void ClientHandler::OnAddressChange(CefRefPtr browser, - CefRefPtr frame, const CefString& url) { - //Intentionally left blank -} - -void ClientHandler::OnTitleChange(CefRefPtr browser, - const CefString& title) { - REQUIRE_UI_THREAD(); - - std::string titleStr(title); - - size_t inHomeDir; - std::string home = getenv("HOME"); - inHomeDir = titleStr.find(home); - if (inHomeDir == 0) { - titleStr = titleStr.substr(home.length()); - titleStr.insert(0, "~"); - } - - size_t lastSlash; - lastSlash = titleStr.rfind("/"); - - std::string formatted; - if (lastSlash != std::string::npos && lastSlash + 1 < titleStr.length()) { - formatted.append(titleStr, lastSlash + 1, titleStr.length() - lastSlash); - formatted.append(" ("); - formatted.append(titleStr, 0, lastSlash); - formatted.append(")"); - } else - formatted.append(titleStr); - formatted.append(" - atom"); - - GtkWidget* window = gtk_widget_get_ancestor( - GTK_WIDGET(browser->GetWindowHandle()), GTK_TYPE_WINDOW); - gtk_window_set_title(GTK_WINDOW(window), formatted.c_str()); -} - -void ClientHandler::SendNotification(NotificationType type) { - // TODO(port): Implement this method. -} - -void ClientHandler::CloseMainWindow() { - // TODO(port): Close main window. -} diff --git a/Atom-Linux/client_handler.h b/Atom-Linux/client_handler.h deleted file mode 100644 index c45dba015..000000000 --- a/Atom-Linux/client_handler.h +++ /dev/null @@ -1,155 +0,0 @@ -#ifndef CLIENT_HANDLER_H_ -#define CLIENT_HANDLER_H_ -#pragma once - -#include -#include -#include "include/cef_client.h" -#include "util.h" -#include "native_handler.h" - -// ClientHandler implementation. -class ClientHandler: public CefClient, - public CefLifeSpanHandler, - public CefLoadHandler, - public CefDisplayHandler, - public CefFocusHandler, - public CefKeyboardHandler, - public CefPrintHandler, - public CefV8ContextHandler, - public CefDragHandler { -public: - ClientHandler(); - virtual ~ClientHandler(); - - // CefClient methods - virtual CefRefPtr GetLifeSpanHandler() OVERRIDE { - return this; - } - virtual CefRefPtr GetLoadHandler() OVERRIDE { - return this; - } - virtual CefRefPtr GetDisplayHandler() OVERRIDE { - return this; - } - 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, - const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, - const CefString& url, CefRefPtr& client, - CefBrowserSettings& settings) OVERRIDE; - virtual void OnAfterCreated(CefRefPtr browser) OVERRIDE; - virtual bool DoClose(CefRefPtr browser) OVERRIDE; - virtual void OnBeforeClose(CefRefPtr browser) OVERRIDE; - - // CefLoadHandler methods - virtual void OnLoadStart(CefRefPtr browser, - CefRefPtr frame) OVERRIDE; - virtual void OnLoadEnd(CefRefPtr browser, - CefRefPtr frame, int httpStatusCode) OVERRIDE; - virtual bool OnLoadError(CefRefPtr browser, - CefRefPtr frame, ErrorCode errorCode, - const CefString& failedUrl, CefString& errorText) OVERRIDE; - - // CefDisplayHandler methods - virtual void OnNavStateChange(CefRefPtr browser, bool canGoBack, - bool canGoForward) OVERRIDE; - virtual void OnAddressChange(CefRefPtr browser, - CefRefPtr frame, const CefString& url) OVERRIDE; - virtual void OnTitleChange(CefRefPtr browser, - const CefString& title) OVERRIDE; - virtual bool OnConsoleMessage(CefRefPtr browser, - const CefString& message, const CefString& source, int line) OVERRIDE; - - // CefFocusHandler methods. - 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() { - return m_MainHwnd; - } - void SetEditHwnd(CefWindowHandle hwnd); - - CefRefPtr GetBrowser() { - return m_Browser; - } - CefWindowHandle GetBrowserHwnd() { - return m_BrowserHwnd; - } - - enum NotificationType { - NOTIFY_CONSOLE_MESSAGE - }; - void SendNotification(NotificationType type); - void CloseMainWindow(); - -protected: - - GtkWidget* window; - - CefRefPtr m_nativeHandler; - - // The child browser window - CefRefPtr m_Browser; - - // The main frame window handle - CefWindowHandle m_MainHwnd; - - // The child browser window handle - CefWindowHandle m_BrowserHwnd; - - // The edit window handle - CefWindowHandle m_EditHwnd; - - // Support for logging. - std::string m_LogFile; - - // Include the default reference counting implementation. -IMPLEMENT_REFCOUNTING(ClientHandler) - ; - // Include the default locking implementation. -IMPLEMENT_LOCKING(ClientHandler) - ; -}; - -#endif diff --git a/Atom-Linux/io_utils.cpp b/Atom-Linux/io_utils.cpp deleted file mode 100644 index 494c00fff..000000000 --- a/Atom-Linux/io_utils.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "io_utils.h" -#include "atom.h" -#include -#include -#include - -#define BUFFER_SIZE 8192 - -using namespace std; - -int io_utils_read(string path, string* output) { - int fd = open(path.c_str(), O_RDONLY); - if (fd <= 0) - return 0; - - char buffer[BUFFER_SIZE]; - unsigned int bytesRead = 0; - unsigned int totalRead = 0; - while ((bytesRead = read(fd, buffer, BUFFER_SIZE)) > 0) { - output->append(buffer, 0, bytesRead); - totalRead += bytesRead; - } - close(fd); - return totalRead; -} - -string io_utils_real_app_path(string relativePath) { - string path = AppPath() + relativePath; - char* realPath = realpath(path.c_str(), NULL); - if (realPath != NULL) { - string realAppPath(realPath); - free(realPath); - return realAppPath; - } else - return ""; -} - -string io_util_app_directory() { - char path[BUFFER_SIZE]; - if (readlink("/proc/self/exe", path, BUFFER_SIZE) < 2) - return ""; - - string appPath(path); - unsigned int lastSlash = appPath.rfind("/"); - if (lastSlash != string::npos) - return appPath.substr(0, lastSlash); - else - return appPath; -} \ No newline at end of file diff --git a/Atom-Linux/io_utils.h b/Atom-Linux/io_utils.h deleted file mode 100644 index f01a25e16..000000000 --- a/Atom-Linux/io_utils.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef IO_UTILS_H_ -#define IO_UTILS_H_ -#pragma once - -#include - -/** - * Read file at path and append to output string - */ -int io_utils_read(std::string path, std::string* output); - -/** - * Get realpath for given path that is relative to the app path - */ -std::string io_utils_real_app_path(std::string relativePath); - -/** - * Get path to directory where atom app resides - */ -std::string io_util_app_directory(); - -#endif diff --git a/Atom-Linux/lib/libcef.so b/Atom-Linux/lib/libcef.so deleted file mode 100755 index f6e77b31f..000000000 Binary files a/Atom-Linux/lib/libcef.so and /dev/null differ diff --git a/Atom-Linux/lib/libcef_dll_wrapper.a b/Atom-Linux/lib/libcef_dll_wrapper.a deleted file mode 100644 index c0c1e53dc..000000000 Binary files a/Atom-Linux/lib/libcef_dll_wrapper.a and /dev/null differ diff --git a/Atom-Linux/locales/en-US.pak b/Atom-Linux/locales/en-US.pak deleted file mode 100644 index 00fc0cba9..000000000 Binary files a/Atom-Linux/locales/en-US.pak and /dev/null differ diff --git a/Atom-Linux/native_handler.cpp b/Atom-Linux/native_handler.cpp deleted file mode 100644 index 4ed2dd25a..000000000 --- a/Atom-Linux/native_handler.cpp +++ /dev/null @@ -1,527 +0,0 @@ -#include "native_handler.h" -#include "include/cef_base.h" -#include "include/cef_runnable.h" -#include "client_handler.h" -#include "io_utils.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define BUFFER_SIZE 8192 - -using namespace std; - -void *NotifyWatchersCallback(void* pointer) { - NativeHandler* handler = (NativeHandler*) pointer; - handler->NotifyWatchers(); - return NULL; -} - -void ExecuteWatchCallback(NotifyContext notifyContext) { - map callbacks = - notifyContext.callbacks[notifyContext.descriptor]; - map::iterator callback; - for (callback = callbacks.begin(); callback != callbacks.end(); callback++) { - CallbackContext callbackContext = callback->second; - CefRefPtr context = callbackContext.context; - CefRefPtr function = callbackContext.function; - - context->Enter(); - - CefV8ValueList args; - CefRefPtr retval; - CefRefPtr e; - args.push_back(callbackContext.eventTypes); - function->ExecuteFunction(function, args, retval, e, true); - - context->Exit(); - } -} - -NativeHandler::NativeHandler() : - CefV8Handler() { - string nativePath = io_utils_real_app_path("/src/stdlib/native-handler.js"); - if (!nativePath.empty()) { - string extensionCode; - if (io_utils_read(nativePath, &extensionCode) > 0) - CefRegisterExtension("v8/native-handler", extensionCode, this); - } - - notifyFd = inotify_init(); - if (notifyFd != -1) - g_thread_create_full(NotifyWatchersCallback, this, 0, true, false, - G_THREAD_PRIORITY_NORMAL, NULL); -} - -void NativeHandler::NotifyWatchers() { - char buffer[BUFFER_SIZE]; - ssize_t bufferRead; - size_t eventSize; - ssize_t bufferIndex; - struct inotify_event *event; - bufferRead = read(notifyFd, buffer, BUFFER_SIZE); - while (bufferRead > 0) { - bufferIndex = 0; - while (bufferIndex < bufferRead) { - event = (struct inotify_event *) &buffer[bufferIndex]; - eventSize = offsetof (struct inotify_event, name) + event->len; - - NotifyContext context; - context.descriptor = event->wd; - context.callbacks = pathCallbacks; - CefPostTask(TID_UI, - NewCefRunnableFunction(&ExecuteWatchCallback, context)); - - bufferIndex += eventSize; - } - bufferRead = read(notifyFd, buffer, BUFFER_SIZE); - } -} - -void NativeHandler::Exists(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception) { - string path = arguments[0]->GetStringValue().ToString(); - struct stat statInfo; - int result = stat(path.c_str(), &statInfo); - retval = CefV8Value::CreateBool(result == 0); -} - -void NativeHandler::Read(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception) { - string path = arguments[0]->GetStringValue().ToString(); - string value; - io_utils_read(path, &value); - retval = CefV8Value::CreateString(value); -} - -void NativeHandler::Absolute(const CefString& name, - CefRefPtr object, const CefV8ValueList& arguments, - CefRefPtr& retval, CefString& exception) { - string path = arguments[0]->GetStringValue().ToString(); - string relativePath; - if (path[0] != '~') - relativePath.append(path); - else { - relativePath.append(getenv("HOME")); - relativePath.append(path, 1, path.length() - 1); - } - - vector < string > segments; - char allSegments[relativePath.length() + 1]; - strcpy(allSegments, relativePath.c_str()); - const char* segment; - for (segment = strtok(allSegments, "/"); segment; - segment = strtok(NULL, "/")) { - if (strcmp(segment, ".") == 0) - continue; - if (strcmp(segment, "..") == 0) { - if (segments.empty()) { - retval = CefV8Value::CreateString("/"); - return; - } - segments.pop_back(); - } else - segments.push_back(segment); - } - - string absolutePath; - unsigned int i; - for (i = 0; i < segments.size(); i++) { - absolutePath.append("/"); - absolutePath.append(segments.at(i)); - } - retval = CefV8Value::CreateString(absolutePath); -} - -void ListDirectory(string path, vector* paths, bool recursive) { - dirent **children; - int childrenCount = scandir(path.c_str(), &children, 0, alphasort); - struct stat statInfo; - int result; - - for (int i = 0; i < childrenCount; i++) { - if (strcmp(children[i]->d_name, ".") == 0 - || strcmp(children[i]->d_name, "..") == 0) { - free(children[i]); - continue; - } - string entryPath(path + "/" + children[i]->d_name); - paths->push_back(entryPath); - if (recursive) { - result = stat(entryPath.c_str(), &statInfo); - if (result == 0 && S_ISDIR(statInfo.st_mode)) - ListDirectory(entryPath, paths, recursive); - } - free(children[i]); - } - free(children); -} - -void DeleteContents(string path) { - dirent **children; - const char* dirPath = path.c_str(); - int childrenCount = scandir(dirPath, &children, 0, alphasort); - struct stat statInfo; - - for (int i = 0; i < childrenCount; i++) { - if (strcmp(children[i]->d_name, ".") == 0 - || strcmp(children[i]->d_name, "..") == 0) { - free(children[i]); - continue; - } - - string entryPath(path + "/" + children[i]->d_name); - if (stat(entryPath.c_str(), &statInfo) != 0) { - free(children[i]); - continue; - } - - if (S_ISDIR(statInfo.st_mode)) - DeleteContents(entryPath); - else if (S_ISREG(statInfo.st_mode)) - remove(entryPath.c_str()); - } - free(children); - rmdir(dirPath); -} - -void NativeHandler::List(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception) { - string path = arguments[0]->GetStringValue().ToString(); - bool recursive = arguments[1]->GetBoolValue(); - vector < string > *paths = new vector; - ListDirectory(path, paths, recursive); - - retval = CefV8Value::CreateArray(); - for (uint i = 0; i < paths->size(); i++) - retval->SetValue(i, CefV8Value::CreateString(paths->at(i))); - free (paths); -} - -void NativeHandler::IsFile(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception) { - string path = arguments[0]->GetStringValue().ToString(); - struct stat statInfo; - int result = stat(path.c_str(), &statInfo); - retval = CefV8Value::CreateBool(result == 0 && S_ISREG(statInfo.st_mode)); -} - -void NativeHandler::IsDirectory(const CefString& name, - CefRefPtr object, const CefV8ValueList& arguments, - CefRefPtr& retval, CefString& exception) { - string path = arguments[0]->GetStringValue().ToString(); - struct stat statInfo; - int result = stat(path.c_str(), &statInfo); - retval = CefV8Value::CreateBool(result == 0 && S_ISDIR(statInfo.st_mode)); -} - -void NativeHandler::OpenDialog(const CefString& name, - CefRefPtr object, const CefV8ValueList& arguments, - CefRefPtr& retval, CefString& exception) { - GtkWidget *dialog; - dialog = gtk_file_chooser_dialog_new("Open File", GTK_WINDOW(window), - GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); - if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { - char *filename; - filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); - retval = CefV8Value::CreateString(filename); - g_free(filename); - } else - retval = CefV8Value::CreateNull(); - - gtk_widget_destroy(dialog); -} - -void NativeHandler::Open(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception) { - path = arguments[0]->GetStringValue().ToString(); - CefV8Context::GetCurrentContext()->GetBrowser()->Reload(); -} - -void NativeHandler::Write(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception) { - string path = arguments[0]->GetStringValue().ToString(); - string content = arguments[1]->GetStringValue().ToString(); - - ofstream file; - file.open(path.c_str()); - file << content; - file.close(); -} - -void NativeHandler::WriteToPasteboard(const CefString& name, - CefRefPtr object, const CefV8ValueList& arguments, - CefRefPtr& retval, CefString& exception) { - string content = arguments[0]->GetStringValue().ToString(); - GtkClipboard* clipboard = gtk_clipboard_get_for_display( - gdk_display_get_default(), GDK_NONE); - gtk_clipboard_set_text(clipboard, content.c_str(), content.length()); - gtk_clipboard_store(clipboard); -} - -void NativeHandler::ReadFromPasteboard(const CefString& name, - CefRefPtr object, const CefV8ValueList& arguments, - CefRefPtr& retval, CefString& exception) { - GtkClipboard* clipboard = gtk_clipboard_get_for_display( - gdk_display_get_default(), GDK_NONE); - char* content = gtk_clipboard_wait_for_text(clipboard); - retval = CefV8Value::CreateString(content); -} - -void NativeHandler::AsyncList(const CefString& name, - CefRefPtr object, const CefV8ValueList& arguments, - CefRefPtr& retval, CefString& exception) { - string path = arguments[0]->GetStringValue().ToString(); - bool recursive = arguments[1]->GetBoolValue(); - vector < string > *paths = new vector; - ListDirectory(path, paths, recursive); - - CefRefPtr callbackPaths = CefV8Value::CreateArray(); - 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); - if (e) - exception = e->GetMessage(); - free (paths); -} - -void NativeHandler::MakeDirectory(const CefString& name, - CefRefPtr object, const CefV8ValueList& arguments, - CefRefPtr& retval, CefString& exception) { - string content = arguments[0]->GetStringValue().ToString(); - mkdir(content.c_str(), S_IRWXU); -} - -void NativeHandler::Move(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception) { - string from = arguments[0]->GetStringValue().ToString(); - string to = arguments[1]->GetStringValue().ToString(); - rename(from.c_str(), to.c_str()); -} - -void NativeHandler::Remove(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception) { - string pathArgument = arguments[0]->GetStringValue().ToString(); - const char* path = pathArgument.c_str(); - - struct stat statInfo; - if (stat(path, &statInfo) != 0) - return; - - if (S_ISREG(statInfo.st_mode)) - remove(path); - else if (S_ISDIR(statInfo.st_mode)) - DeleteContents(pathArgument); -} - -void NativeHandler::Alert(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception) { - CefRefPtr buttonNamesAndCallbacks; - if (arguments.size() < 3) - buttonNamesAndCallbacks = CefV8Value::CreateArray(); - else - buttonNamesAndCallbacks = arguments[2]; - - GtkWidget *dialog; - dialog = gtk_dialog_new_with_buttons("atom", GTK_WINDOW(window), - GTK_DIALOG_DESTROY_WITH_PARENT, NULL); - for (int i = 0; i < buttonNamesAndCallbacks->GetArrayLength(); i++) { - string title = - buttonNamesAndCallbacks->GetValue(i)->GetValue(0)->GetStringValue().ToString(); - gtk_dialog_add_button(GTK_DIALOG(dialog), title.c_str(), i); - } - gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); - - string dialogMessage(arguments[0]->GetStringValue().ToString()); - dialogMessage.append("\n\n"); - dialogMessage.append(arguments[1]->GetStringValue().ToString()); - GtkWidget *label; - label = gtk_label_new(dialogMessage.c_str()); - - GtkWidget *contentArea; - contentArea = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); - gtk_container_add(GTK_CONTAINER(contentArea), label); - - gtk_widget_show_all(dialog); - int result = gtk_dialog_run(GTK_DIALOG(dialog)); - if (result >= 0) { - CefRefPtr callback = - buttonNamesAndCallbacks->GetValue(result)->GetValue(1); - CefV8ValueList args; - CefRefPtr e; - callback->ExecuteFunction(callback, args, retval, e, true); - if (e) - exception = e->GetMessage(); - } - gtk_widget_destroy(dialog); -} - -void NativeHandler::WatchPath(const CefString& name, - CefRefPtr object, const CefV8ValueList& arguments, - CefRefPtr& retval, CefString& exception) { - string path = arguments[0]->GetStringValue().ToString(); - int descriptor = inotify_add_watch(notifyFd, path.c_str(), - IN_ALL_EVENTS & ~(IN_CLOSE | IN_OPEN | IN_ACCESS)); - if (descriptor == -1) - return; - - CallbackContext callbackContext; - callbackContext.context = CefV8Context::GetCurrentContext(); - callbackContext.function = arguments[1]; - CefRefPtr eventTypes = CefV8Value::CreateObject(NULL, NULL); - eventTypes->SetValue("modified", CefV8Value::CreateBool(true), - V8_PROPERTY_ATTRIBUTE_NONE); - callbackContext.eventTypes = eventTypes; - - stringstream idStream; - idStream << "counter"; - idStream << idCounter; - string id = idStream.str(); - idCounter++; - pathDescriptors[path] = descriptor; - pathCallbacks[descriptor][id] = callbackContext; - retval = CefV8Value::CreateString(id); -} - -void NativeHandler::UnwatchPath(const CefString& name, - CefRefPtr object, const CefV8ValueList& arguments, - CefRefPtr& retval, CefString& exception) { - string path = arguments[0]->GetStringValue().ToString(); - - int descriptor = pathDescriptors[path]; - if (descriptor == -1) - return; - - map callbacks = pathCallbacks[descriptor]; - string id = arguments[1]->GetStringValue().ToString(); - callbacks.erase(id); - if (callbacks.empty()) - inotify_rm_watch(notifyFd, descriptor); -} - -void NativeHandler::Digest(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception) { - string path = arguments[0]->GetStringValue().ToString(); - - int fd = open(path.c_str(), O_RDONLY); - if (fd < 0) - return; - - const EVP_MD *md; - OpenSSL_add_all_digests(); - md = EVP_get_digestbyname("md5"); - if (!md) - return; - - EVP_MD_CTX context; - EVP_MD_CTX_init(&context); - EVP_DigestInit_ex(&context, md, NULL); - - char buffer[BUFFER_SIZE]; - int r; - while ((r = read(fd, buffer, sizeof buffer)) > 0) - EVP_DigestUpdate(&context, buffer, r); - close(fd); - - unsigned char value[EVP_MAX_MD_SIZE]; - unsigned int length; - EVP_DigestFinal_ex(&context, value, &length); - EVP_MD_CTX_cleanup(&context); - - stringstream md5; - char hex[3]; - for (uint i = 0; i < length; i++) { - sprintf(hex, "%02x", value[i]); - md5 << hex; - } - retval = CefV8Value::CreateString(md5.str()); -} - -void NativeHandler::LastModified(const CefString& name, - CefRefPtr object, const CefV8ValueList& arguments, - CefRefPtr& retval, CefString& exception) { - string path = arguments[0]->GetStringValue().ToString(); - struct stat statInfo; - if (stat(path.c_str(), &statInfo) == 0) { - CefTime time(statInfo.st_mtime); - retval = CefV8Value::CreateDate(time); - } -} - -bool NativeHandler::Execute(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception) { - if (name == "exists") - Exists(name, object, arguments, retval, exception); - else if (name == "read") - Read(name, object, arguments, retval, exception); - else if (name == "absolute") - Absolute(name, object, arguments, retval, exception); - else if (name == "list") - List(name, object, arguments, retval, exception); - else if (name == "isFile") - 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 == "openDialog") - OpenDialog(name, object, arguments, retval, exception); - else if (name == "open") - Open(name, object, arguments, retval, exception); - else if (name == "write") - Write(name, object, arguments, retval, exception); - else if (name == "writeToPasteboard") - WriteToPasteboard(name, object, arguments, retval, exception); - else if (name == "readFromPasteboard") - ReadFromPasteboard(name, object, arguments, retval, exception); - else if (name == "asyncList") - AsyncList(name, object, arguments, retval, exception); - else if (name == "makeDirectory") - MakeDirectory(name, object, arguments, retval, exception); - else if (name == "move") - Move(name, object, arguments, retval, exception); - else if (name == "remove") - Remove(name, object, arguments, retval, exception); - else if (name == "alert") - Alert(name, object, arguments, retval, exception); - else if (name == "watchPath") - WatchPath(name, object, arguments, retval, exception); - else if (name == "unwatchPath") - UnwatchPath(name, object, arguments, retval, exception); - else if (name == "md5ForPath") - Digest(name, object, arguments, retval, exception); - else if (name == "getPlatform") - retval = CefV8Value::CreateString("linux"); - else if (name == "lastModified") - LastModified(name, object, arguments, retval, exception); - else - cout << "Unhandled -> " + name.ToString() << " : " - << arguments[0]->GetStringValue().ToString() << endl; - return true; -} diff --git a/Atom-Linux/native_handler.h b/Atom-Linux/native_handler.h deleted file mode 100644 index 7af1826bc..000000000 --- a/Atom-Linux/native_handler.h +++ /dev/null @@ -1,128 +0,0 @@ -#ifndef NATIVE_HANDLER_H_ -#define NATIVE_HANDLER_H_ - -#include "include/cef_base.h" -#include "include/cef_v8.h" -#include -#include - -struct CallbackContext { - CefRefPtr context; - CefRefPtr function; - CefRefPtr eventTypes; -}; - -struct NotifyContext { - int descriptor; - std::map > callbacks; -}; - -class NativeHandler: public CefV8Handler { -public: - NativeHandler(); - - GtkWidget* window; - - std::string path; - - virtual bool Execute(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void NotifyWatchers(); - -IMPLEMENT_REFCOUNTING(NativeHandler) - ; - -private: - - int notifyFd; - - unsigned long int idCounter; - - std::map > pathCallbacks; - - std::map pathDescriptors; - - void Exists(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void Read(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void Absolute(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void List(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void AsyncList(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void IsFile(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void IsDirectory(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void OpenDialog(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void Open(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void Write(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void WriteToPasteboard(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void ReadFromPasteboard(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void MakeDirectory(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void Move(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void Remove(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void Alert(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void WatchPath(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void UnwatchPath(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void Digest(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - - void LastModified(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); -}; - -#endif diff --git a/Atom-Linux/onig_regexp_extension.cpp b/Atom-Linux/onig_regexp_extension.cpp deleted file mode 100644 index 686fe9f2f..000000000 --- a/Atom-Linux/onig_regexp_extension.cpp +++ /dev/null @@ -1,185 +0,0 @@ -#include "onig_regexp_extension.h" -#include "include/cef_base.h" -#include "include/cef_runnable.h" -#include -#include -#include -#include "io_utils.h" - -using namespace std; - -class OnigRegexpUserData: public CefBase { -public: - OnigRegexpUserData(CefRefPtr source) { - OnigErrorInfo error; - string input = source->GetStringValue().ToString(); - int length = input.length(); - UChar* pattern = (UChar*) input.c_str(); - int code = onig_new(®ex, pattern, pattern + length, - ONIG_OPTION_SINGLELINE, ONIG_ENCODING_UTF8, ONIG_SYNTAX_DEFAULT, - &error); - if (code != ONIG_NORMAL) { - char errorText[ONIG_MAX_ERROR_MESSAGE_LEN]; - onig_error_code_to_str((OnigUChar*) errorText, code, &error); - cout << errorText << " for pattern: " << input << endl; - } - } - - ~OnigRegexpUserData() { - onig_free(regex); - } - - OnigRegion* SearchRegion(string input, int index) { - if (!regex) - return NULL; - - OnigRegion* region = onig_region_new(); - UChar* search = (UChar*) input.c_str(); - unsigned char* start = search + index; - unsigned char* end = search + input.length(); - int code = onig_search(regex, search, end, start, end, region, - ONIG_OPTION_NONE); - if (code >= 0) - return region; - else { - onig_region_free(region, 1); - return NULL; - } - } - - CefRefPtr Search(CefRefPtr argument, - CefRefPtr index) { - string input = argument->GetStringValue().ToString(); - OnigRegion* region = SearchRegion(input, index->GetIntValue()); - if (!region) - return CefV8Value::CreateNull(); - - CefRefPtr indices; - CefRefPtr resultArray = CefV8Value::CreateArray(); - CefRefPtr indicesArray = CefV8Value::CreateArray(); - for (int i = 0; i < region->num_regs; i++) { - int begin = region->beg[i]; - int end = region->end[i]; - resultArray->SetValue(i, - CefV8Value::CreateString(input.substr(begin, end - begin))); - indicesArray->SetValue(i, CefV8Value::CreateInt(begin)); - } - resultArray->SetValue("index", CefV8Value::CreateInt(region->beg[0]), - V8_PROPERTY_ATTRIBUTE_NONE); - resultArray->SetValue("indices", indicesArray, V8_PROPERTY_ATTRIBUTE_NONE); - onig_region_free(region, 1); - return resultArray; - } - - CefRefPtr Test(CefRefPtr argument, - CefRefPtr index) { - OnigRegion* region = SearchRegion(argument->GetStringValue().ToString(), - index->GetIntValue()); - CefRefPtr text = CefV8Value::CreateBool(region != NULL); - if (region) - onig_region_free(region, 1); - return text; - } - - CefRefPtr GetCaptureIndices(CefRefPtr argument, - CefRefPtr index) { - OnigRegion* region = SearchRegion(argument->GetStringValue().ToString(), - index->GetIntValue()); - CefRefPtr indices; - if (region) { - indices = BuildCaptureIndices(region); - onig_region_free(region, 1); - } else - indices = CefV8Value::CreateNull(); - return indices; - } - - CefRefPtr BuildCaptureIndices(OnigRegion *region) { - CefRefPtr array = CefV8Value::CreateArray(); - int i = 0; - for (int index = 0; index < region->num_regs; index++) { - int begin = region->beg[index]; - int end = region->end[index]; - if (end - begin <= 0) - continue; - array->SetValue(i++, CefV8Value::CreateInt(index)); - array->SetValue(i++, CefV8Value::CreateInt(begin)); - array->SetValue(i++, CefV8Value::CreateInt(end)); - } - - return array; - } - - CefRefPtr CaptureCount() { - if (regex) - return CefV8Value::CreateInt(onig_number_of_captures(regex)); - else - return CefV8Value::CreateInt(0); - } - - regex_t* regex; - -IMPLEMENT_REFCOUNTING(OnigRegexpUserData) - ; -} -; - -OnigRegexpExtension::OnigRegexpExtension() : - CefV8Handler() { - string realFilePath = io_utils_real_app_path( - "/src/stdlib/onig-reg-exp-extension.js"); - if (!realFilePath.empty()) { - string extensionCode; - if (io_utils_read(realFilePath, &extensionCode) > 0) - CefRegisterExtension("v8/oniguruma", extensionCode, this); - } -} - -bool OnigRegexpExtension::Execute(const CefString& name, - CefRefPtr object, const CefV8ValueList& arguments, - CefRefPtr& retval, CefString& exception) { - if (name == "getCaptureIndices") { - CefRefPtr string = arguments[0]; - CefRefPtr index = - arguments.size() > 1 ? arguments[1] : CefV8Value::CreateInt(0); - OnigRegexpUserData *userData = - (OnigRegexpUserData *) object->GetUserData().get(); - retval = userData->GetCaptureIndices(string, index); - return true; - } - - if (name == "search") { - CefRefPtr string = arguments[0]; - CefRefPtr index = - arguments.size() > 1 ? arguments[1] : CefV8Value::CreateInt(0); - OnigRegexpUserData *userData = - (OnigRegexpUserData *) object->GetUserData().get(); - retval = userData->Search(string, index); - return true; - } - - if (name == "test") { - CefRefPtr string = arguments[0]; - CefRefPtr index = - arguments.size() > 1 ? arguments[1] : CefV8Value::CreateInt(0); - OnigRegexpUserData *userData = - (OnigRegexpUserData *) object->GetUserData().get(); - retval = userData->Test(string, index); - return true; - } - - if (name == "buildOnigRegExp") { - CefRefPtr userData = new OnigRegexpUserData(arguments[0]); - retval = CefV8Value::CreateObject(userData, NULL); - return true; - } - - if (name == "getCaptureCount") { - OnigRegexpUserData *userData = - (OnigRegexpUserData *) object->GetUserData().get(); - retval = userData->CaptureCount(); - return true; - } - - return false; -} diff --git a/Atom-Linux/onig_regexp_extension.h b/Atom-Linux/onig_regexp_extension.h deleted file mode 100644 index 0d30ac157..000000000 --- a/Atom-Linux/onig_regexp_extension.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef ONIG_REGEXP_EXTENSION_H_ -#define ONIG_REGEXP_EXTENSION_H_ - -#include "include/cef_base.h" -#include "include/cef_v8.h" - -class OnigRegexpExtension: public CefV8Handler { - -public: - OnigRegexpExtension(); - - virtual bool Execute(const CefString& name, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception); - -IMPLEMENT_REFCOUNTING(OnigRegexpExtension) - ; - -}; - -#endif diff --git a/Atom-Linux/util.h b/Atom-Linux/util.h deleted file mode 100644 index 51f371d82..000000000 --- a/Atom-Linux/util.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -#ifndef UTIL_H_ -#define UTIL_H_ -#pragma once - -#include "include/cef_task.h" - -#include // NOLINT(build/include_order) -#ifndef NDEBUG -#define ASSERT(condition) if (!(condition)) { assert(false); } -#else -#define ASSERT(condition) ((void)0) -#endif - -#define REQUIRE_UI_THREAD() ASSERT(CefCurrentlyOn(TID_UI)); -#define REQUIRE_IO_THREAD() ASSERT(CefCurrentlyOn(TID_IO)); -#define REQUIRE_FILE_THREAD() ASSERT(CefCurrentlyOn(TID_FILE)); - -#endif diff --git a/Atom.xcodeproj/project.pbxproj b/Atom.xcodeproj/project.pbxproj deleted file mode 100644 index 350c950fb..000000000 --- a/Atom.xcodeproj/project.pbxproj +++ /dev/null @@ -1,1317 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 0415A1FE1524EC8A0075C91C /* atom.icns in Resources */ = {isa = PBXBuildFile; fileRef = 0415A1FD1524EC8A0075C91C /* atom.icns */; }; - 0446DB6315C73BDA006756AF /* CocoaOniguruma.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0446DB6215C73BDA006756AF /* CocoaOniguruma.framework */; }; - 0446DB6515C73BF4006756AF /* CocoaOniguruma.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 0446DB6215C73BDA006756AF /* CocoaOniguruma.framework */; }; - 0472D16515A26C9400F7AD9A /* ffmpegsumo.so in Resources */ = {isa = PBXBuildFile; fileRef = 0472D16315A26C9400F7AD9A /* ffmpegsumo.so */; }; - 0472D16615A26C9400F7AD9A /* libcef.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 0472D16415A26C9400F7AD9A /* libcef.dylib */; }; - 0472D16715A26CCC00F7AD9A /* ffmpegsumo.so in Copy Required Chrome Frameworks */ = {isa = PBXBuildFile; fileRef = 0472D16315A26C9400F7AD9A /* ffmpegsumo.so */; }; - 0472D16815A26CCE00F7AD9A /* libcef.dylib in Copy Required Chrome Frameworks */ = {isa = PBXBuildFile; fileRef = 0472D16415A26C9400F7AD9A /* libcef.dylib */; }; - 0472D1E015A26D7600F7AD9A /* README-TRANSFER.txt in Resources */ = {isa = PBXBuildFile; fileRef = 0472D1DB15A26D7600F7AD9A /* README-TRANSFER.txt */; }; - 0472D25D15A26D8100F7AD9A /* app_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D1E415A26D8100F7AD9A /* app_cpptoc.cc */; }; - 0472D25E15A26D8100F7AD9A /* client_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D1E715A26D8100F7AD9A /* client_cpptoc.cc */; }; - 0472D25F15A26D8100F7AD9A /* content_filter_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D1E915A26D8100F7AD9A /* content_filter_cpptoc.cc */; }; - 0472D26015A26D8100F7AD9A /* cookie_visitor_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D1EB15A26D8100F7AD9A /* cookie_visitor_cpptoc.cc */; }; - 0472D26115A26D8100F7AD9A /* display_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D1EE15A26D8100F7AD9A /* display_handler_cpptoc.cc */; }; - 0472D26215A26D8100F7AD9A /* domevent_listener_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D1F015A26D8100F7AD9A /* domevent_listener_cpptoc.cc */; }; - 0472D26315A26D8100F7AD9A /* domvisitor_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D1F215A26D8100F7AD9A /* domvisitor_cpptoc.cc */; }; - 0472D26415A26D8100F7AD9A /* download_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D1F415A26D8100F7AD9A /* download_handler_cpptoc.cc */; }; - 0472D26515A26D8100F7AD9A /* drag_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D1F615A26D8100F7AD9A /* drag_handler_cpptoc.cc */; }; - 0472D26615A26D8100F7AD9A /* find_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D1F815A26D8100F7AD9A /* find_handler_cpptoc.cc */; }; - 0472D26715A26D8100F7AD9A /* focus_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D1FA15A26D8100F7AD9A /* focus_handler_cpptoc.cc */; }; - 0472D26815A26D8100F7AD9A /* jsdialog_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D1FC15A26D8100F7AD9A /* jsdialog_handler_cpptoc.cc */; }; - 0472D26915A26D8100F7AD9A /* keyboard_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D1FE15A26D8100F7AD9A /* keyboard_handler_cpptoc.cc */; }; - 0472D26A15A26D8100F7AD9A /* life_span_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D20015A26D8100F7AD9A /* life_span_handler_cpptoc.cc */; }; - 0472D26B15A26D8100F7AD9A /* load_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D20215A26D8100F7AD9A /* load_handler_cpptoc.cc */; }; - 0472D26C15A26D8100F7AD9A /* menu_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D20415A26D8100F7AD9A /* menu_handler_cpptoc.cc */; }; - 0472D26D15A26D8100F7AD9A /* permission_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D20615A26D8100F7AD9A /* permission_handler_cpptoc.cc */; }; - 0472D26E15A26D8100F7AD9A /* print_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D20815A26D8100F7AD9A /* print_handler_cpptoc.cc */; }; - 0472D26F15A26D8100F7AD9A /* proxy_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D20A15A26D8100F7AD9A /* proxy_handler_cpptoc.cc */; }; - 0472D27015A26D8100F7AD9A /* read_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D20C15A26D8100F7AD9A /* read_handler_cpptoc.cc */; }; - 0472D27115A26D8100F7AD9A /* render_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D20E15A26D8100F7AD9A /* render_handler_cpptoc.cc */; }; - 0472D27215A26D8100F7AD9A /* request_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D21015A26D8100F7AD9A /* request_handler_cpptoc.cc */; }; - 0472D27315A26D8100F7AD9A /* resource_bundle_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D21215A26D8100F7AD9A /* resource_bundle_handler_cpptoc.cc */; }; - 0472D27415A26D8100F7AD9A /* scheme_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D21415A26D8100F7AD9A /* scheme_handler_cpptoc.cc */; }; - 0472D27515A26D8100F7AD9A /* scheme_handler_factory_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D21615A26D8100F7AD9A /* scheme_handler_factory_cpptoc.cc */; }; - 0472D27615A26D8100F7AD9A /* storage_visitor_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D21815A26D8100F7AD9A /* storage_visitor_cpptoc.cc */; }; - 0472D27715A26D8100F7AD9A /* task_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D21A15A26D8100F7AD9A /* task_cpptoc.cc */; }; - 0472D27815A26D8100F7AD9A /* v8accessor_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D21C15A26D8100F7AD9A /* v8accessor_cpptoc.cc */; }; - 0472D27915A26D8100F7AD9A /* v8context_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D21E15A26D8100F7AD9A /* v8context_handler_cpptoc.cc */; }; - 0472D27A15A26D8100F7AD9A /* v8handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D22015A26D8100F7AD9A /* v8handler_cpptoc.cc */; }; - 0472D27B15A26D8100F7AD9A /* web_urlrequest_client_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D22215A26D8100F7AD9A /* web_urlrequest_client_cpptoc.cc */; }; - 0472D27C15A26D8100F7AD9A /* write_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D22415A26D8100F7AD9A /* write_handler_cpptoc.cc */; }; - 0472D27D15A26D8100F7AD9A /* browser_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D22815A26D8100F7AD9A /* browser_ctocpp.cc */; }; - 0472D27E15A26D8100F7AD9A /* command_line_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D22A15A26D8100F7AD9A /* command_line_ctocpp.cc */; }; - 0472D27F15A26D8100F7AD9A /* cookie_manager_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D22C15A26D8100F7AD9A /* cookie_manager_ctocpp.cc */; }; - 0472D28015A26D8100F7AD9A /* domdocument_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D22F15A26D8100F7AD9A /* domdocument_ctocpp.cc */; }; - 0472D28115A26D8100F7AD9A /* domevent_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D23115A26D8100F7AD9A /* domevent_ctocpp.cc */; }; - 0472D28215A26D8100F7AD9A /* domnode_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D23315A26D8100F7AD9A /* domnode_ctocpp.cc */; }; - 0472D28315A26D8100F7AD9A /* drag_data_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D23515A26D8100F7AD9A /* drag_data_ctocpp.cc */; }; - 0472D28415A26D8100F7AD9A /* frame_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D23715A26D8100F7AD9A /* frame_ctocpp.cc */; }; - 0472D28515A26D8100F7AD9A /* post_data_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D23915A26D8100F7AD9A /* post_data_ctocpp.cc */; }; - 0472D28615A26D8100F7AD9A /* post_data_element_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D23B15A26D8100F7AD9A /* post_data_element_ctocpp.cc */; }; - 0472D28715A26D8100F7AD9A /* request_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D23D15A26D8100F7AD9A /* request_ctocpp.cc */; }; - 0472D28815A26D8100F7AD9A /* response_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D23F15A26D8100F7AD9A /* response_ctocpp.cc */; }; - 0472D28915A26D8100F7AD9A /* scheme_handler_callback_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D24115A26D8100F7AD9A /* scheme_handler_callback_ctocpp.cc */; }; - 0472D28A15A26D8100F7AD9A /* stream_reader_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D24315A26D8100F7AD9A /* stream_reader_ctocpp.cc */; }; - 0472D28B15A26D8100F7AD9A /* stream_writer_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D24515A26D8100F7AD9A /* stream_writer_ctocpp.cc */; }; - 0472D28C15A26D8100F7AD9A /* v8context_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D24715A26D8100F7AD9A /* v8context_ctocpp.cc */; }; - 0472D28D15A26D8100F7AD9A /* v8exception_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D24915A26D8100F7AD9A /* v8exception_ctocpp.cc */; }; - 0472D28E15A26D8100F7AD9A /* v8value_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D24B15A26D8100F7AD9A /* v8value_ctocpp.cc */; }; - 0472D28F15A26D8100F7AD9A /* web_plugin_info_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D24D15A26D8100F7AD9A /* web_plugin_info_ctocpp.cc */; }; - 0472D29015A26D8100F7AD9A /* web_urlrequest_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D24F15A26D8100F7AD9A /* web_urlrequest_ctocpp.cc */; }; - 0472D29115A26D8100F7AD9A /* xml_reader_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D25115A26D8100F7AD9A /* xml_reader_ctocpp.cc */; }; - 0472D29215A26D8100F7AD9A /* zip_reader_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D25315A26D8100F7AD9A /* zip_reader_ctocpp.cc */; }; - 0472D29315A26D8100F7AD9A /* transfer_util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0472D25515A26D8100F7AD9A /* transfer_util.cpp */; }; - 0472D29415A26D8100F7AD9A /* cef_byte_read_handler.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D25815A26D8100F7AD9A /* cef_byte_read_handler.cc */; }; - 0472D29515A26D8100F7AD9A /* cef_xml_object.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D25915A26D8100F7AD9A /* cef_xml_object.cc */; }; - 0472D29615A26D8100F7AD9A /* cef_zip_archive.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D25A15A26D8100F7AD9A /* cef_zip_archive.cc */; }; - 0472D29715A26D8100F7AD9A /* libcef_dll_wrapper.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D25B15A26D8100F7AD9A /* libcef_dll_wrapper.cc */; }; - 0472D29815A26D8100F7AD9A /* libcef_dll_wrapper2.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0472D25C15A26D8100F7AD9A /* libcef_dll_wrapper2.cc */; }; - 0487C91714FED5360045E5E3 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0487C91614FED5360045E5E3 /* Cocoa.framework */; }; - 0487C93814FED5FB0045E5E3 /* ClientWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0487C93414FED5FB0045E5E3 /* ClientWindow.xib */; }; - 0487C93A14FED5FB0045E5E3 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0487C93614FED5FB0045E5E3 /* MainMenu.xib */; }; - 0487CD9414FEE1330045E5E3 /* Atom.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0487C93D14FED6090045E5E3 /* Atom.mm */; }; - 0487CD9514FEE1340045E5E3 /* AtomController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0487C93F14FED6090045E5E3 /* AtomController.mm */; }; - 0487CD9614FEE1360045E5E3 /* client_handler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0487C94114FED6090045E5E3 /* client_handler.mm */; }; - 0487CD9714FEE1380045E5E3 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0487C94214FED6090045E5E3 /* main.mm */; }; - 0487CD9814FEE13B0045E5E3 /* native_handler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0487C94414FED6090045E5E3 /* native_handler.mm */; }; - 0487CDA014FEE1DA0045E5E3 /* liblibcef_wrapper.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0487CC8114FEDF990045E5E3 /* liblibcef_wrapper.a */; }; - 0487D15F14FEE7880045E5E3 /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = 0487D15E14FEE7880045E5E3 /* Resources */; }; - 0487D16014FEE78E0045E5E3 /* Resources in Copy Chrome Resources */ = {isa = PBXBuildFile; fileRef = 0487D15E14FEE7880045E5E3 /* Resources */; }; - 048A2FC7154870DC0051715C /* PathWatcher.mm in Sources */ = {isa = PBXBuildFile; fileRef = 048A2FC6154870DC0051715C /* PathWatcher.mm */; }; - 04E1DDDD152A0941001A9D07 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04E1DDDC152A0941001A9D07 /* Sparkle.framework */; }; - 04E1DDDF152A09C3001A9D07 /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 04E1DDDC152A0941001A9D07 /* Sparkle.framework */; }; - EC800C1B15C72378007FD3CB /* OnigRegexpExtension.mm in Sources */ = {isa = PBXBuildFile; fileRef = EC800C1A15C72378007FD3CB /* OnigRegexpExtension.mm */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 0487CD6914FEE0BE0045E5E3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0487C90914FED5360045E5E3 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0487CC8014FEDF990045E5E3; - remoteInfo = libcef_wrapper; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 0487CD9914FEE1500045E5E3 /* Copy Required Chrome Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "$(EXECUTABLE_FOLDER_PATH)"; - dstSubfolderSpec = 16; - files = ( - 0472D16715A26CCC00F7AD9A /* ffmpegsumo.so in Copy Required Chrome Frameworks */, - 0472D16815A26CCE00F7AD9A /* libcef.dylib in Copy Required Chrome Frameworks */, - ); - name = "Copy Required Chrome Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; - 0487CD9C14FEE17D0045E5E3 /* Copy Chrome Resources */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 12; - dstPath = "$(CONTENTS_FOLDER_PATH)"; - dstSubfolderSpec = 16; - files = ( - 0487D16014FEE78E0045E5E3 /* Resources in Copy Chrome Resources */, - ); - name = "Copy Chrome Resources"; - runOnlyForDeploymentPostprocessing = 0; - }; - 04E1DDDE152A09A8001A9D07 /* Copy Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - 04E1DDDF152A09C3001A9D07 /* Sparkle.framework in Copy Frameworks */, - 0446DB6515C73BF4006756AF /* CocoaOniguruma.framework in Copy Frameworks */, - ); - name = "Copy Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 0415A1FD1524EC8A0075C91C /* atom.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = atom.icns; path = ../atom.icns; sourceTree = ""; }; - 042180E614FF080D00DF25EA /* BrowserDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BrowserDelegate.h; sourceTree = ""; }; - 0446DB6215C73BDA006756AF /* CocoaOniguruma.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CocoaOniguruma.framework; path = frameworks/CocoaOniguruma.framework; sourceTree = ""; }; - 0472D16315A26C9400F7AD9A /* ffmpegsumo.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; name = ffmpegsumo.so; path = frameworks/ffmpegsumo.so; sourceTree = ""; }; - 0472D16415A26C9400F7AD9A /* libcef.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcef.dylib; path = frameworks/libcef.dylib; sourceTree = ""; }; - 0472D16B15A26D7600F7AD9A /* cef_app_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_app_capi.h; sourceTree = ""; }; - 0472D16C15A26D7600F7AD9A /* cef_base_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_base_capi.h; sourceTree = ""; }; - 0472D16D15A26D7600F7AD9A /* cef_browser_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_browser_capi.h; sourceTree = ""; }; - 0472D16E15A26D7600F7AD9A /* cef_client_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_client_capi.h; sourceTree = ""; }; - 0472D16F15A26D7600F7AD9A /* cef_command_line_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_command_line_capi.h; sourceTree = ""; }; - 0472D17015A26D7600F7AD9A /* cef_content_filter_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_content_filter_capi.h; sourceTree = ""; }; - 0472D17115A26D7600F7AD9A /* cef_cookie_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_cookie_capi.h; sourceTree = ""; }; - 0472D17215A26D7600F7AD9A /* cef_display_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_display_handler_capi.h; sourceTree = ""; }; - 0472D17315A26D7600F7AD9A /* cef_dom_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_dom_capi.h; sourceTree = ""; }; - 0472D17415A26D7600F7AD9A /* cef_download_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_download_handler_capi.h; sourceTree = ""; }; - 0472D17515A26D7600F7AD9A /* cef_drag_data_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_drag_data_capi.h; sourceTree = ""; }; - 0472D17615A26D7600F7AD9A /* cef_drag_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_drag_handler_capi.h; sourceTree = ""; }; - 0472D17715A26D7600F7AD9A /* cef_find_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_find_handler_capi.h; sourceTree = ""; }; - 0472D17815A26D7600F7AD9A /* cef_focus_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_focus_handler_capi.h; sourceTree = ""; }; - 0472D17915A26D7600F7AD9A /* cef_frame_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_frame_capi.h; sourceTree = ""; }; - 0472D17A15A26D7600F7AD9A /* cef_jsdialog_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_jsdialog_handler_capi.h; sourceTree = ""; }; - 0472D17B15A26D7600F7AD9A /* cef_keyboard_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_keyboard_handler_capi.h; sourceTree = ""; }; - 0472D17C15A26D7600F7AD9A /* cef_life_span_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_life_span_handler_capi.h; sourceTree = ""; }; - 0472D17D15A26D7600F7AD9A /* cef_load_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_load_handler_capi.h; sourceTree = ""; }; - 0472D17E15A26D7600F7AD9A /* cef_menu_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_menu_handler_capi.h; sourceTree = ""; }; - 0472D17F15A26D7600F7AD9A /* cef_nplugin_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_nplugin_capi.h; sourceTree = ""; }; - 0472D18015A26D7600F7AD9A /* cef_origin_whitelist_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_origin_whitelist_capi.h; sourceTree = ""; }; - 0472D18115A26D7600F7AD9A /* cef_permission_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_permission_handler_capi.h; sourceTree = ""; }; - 0472D18215A26D7600F7AD9A /* cef_print_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_print_handler_capi.h; sourceTree = ""; }; - 0472D18315A26D7600F7AD9A /* cef_proxy_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_proxy_handler_capi.h; sourceTree = ""; }; - 0472D18415A26D7600F7AD9A /* cef_render_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_render_handler_capi.h; sourceTree = ""; }; - 0472D18515A26D7600F7AD9A /* cef_request_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_request_capi.h; sourceTree = ""; }; - 0472D18615A26D7600F7AD9A /* cef_request_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_request_handler_capi.h; sourceTree = ""; }; - 0472D18715A26D7600F7AD9A /* cef_resource_bundle_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_resource_bundle_handler_capi.h; sourceTree = ""; }; - 0472D18815A26D7600F7AD9A /* cef_response_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_response_capi.h; sourceTree = ""; }; - 0472D18915A26D7600F7AD9A /* cef_scheme_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_scheme_capi.h; sourceTree = ""; }; - 0472D18A15A26D7600F7AD9A /* cef_storage_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_storage_capi.h; sourceTree = ""; }; - 0472D18B15A26D7600F7AD9A /* cef_stream_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_stream_capi.h; sourceTree = ""; }; - 0472D18C15A26D7600F7AD9A /* cef_task_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_task_capi.h; sourceTree = ""; }; - 0472D18D15A26D7600F7AD9A /* cef_url_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_url_capi.h; sourceTree = ""; }; - 0472D18E15A26D7600F7AD9A /* cef_v8_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_v8_capi.h; sourceTree = ""; }; - 0472D18F15A26D7600F7AD9A /* cef_v8context_handler_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_v8context_handler_capi.h; sourceTree = ""; }; - 0472D19015A26D7600F7AD9A /* cef_web_plugin_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_web_plugin_capi.h; sourceTree = ""; }; - 0472D19115A26D7600F7AD9A /* cef_web_urlrequest_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_web_urlrequest_capi.h; sourceTree = ""; }; - 0472D19215A26D7600F7AD9A /* cef_xml_reader_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_xml_reader_capi.h; sourceTree = ""; }; - 0472D19315A26D7600F7AD9A /* cef_zip_reader_capi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_zip_reader_capi.h; sourceTree = ""; }; - 0472D19415A26D7600F7AD9A /* cef_app.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_app.h; sourceTree = ""; }; - 0472D19515A26D7600F7AD9A /* cef_application_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_application_mac.h; sourceTree = ""; }; - 0472D19615A26D7600F7AD9A /* cef_base.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_base.h; sourceTree = ""; }; - 0472D19715A26D7600F7AD9A /* cef_browser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_browser.h; sourceTree = ""; }; - 0472D19815A26D7600F7AD9A /* cef_client.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_client.h; sourceTree = ""; }; - 0472D19915A26D7600F7AD9A /* cef_command_line.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_command_line.h; sourceTree = ""; }; - 0472D19A15A26D7600F7AD9A /* cef_content_filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_content_filter.h; sourceTree = ""; }; - 0472D19B15A26D7600F7AD9A /* cef_cookie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_cookie.h; sourceTree = ""; }; - 0472D19C15A26D7600F7AD9A /* cef_display_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_display_handler.h; sourceTree = ""; }; - 0472D19D15A26D7600F7AD9A /* cef_dom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_dom.h; sourceTree = ""; }; - 0472D19E15A26D7600F7AD9A /* cef_download_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_download_handler.h; sourceTree = ""; }; - 0472D19F15A26D7600F7AD9A /* cef_drag_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_drag_data.h; sourceTree = ""; }; - 0472D1A015A26D7600F7AD9A /* cef_drag_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_drag_handler.h; sourceTree = ""; }; - 0472D1A115A26D7600F7AD9A /* cef_find_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_find_handler.h; sourceTree = ""; }; - 0472D1A215A26D7600F7AD9A /* cef_focus_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_focus_handler.h; sourceTree = ""; }; - 0472D1A315A26D7600F7AD9A /* cef_frame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_frame.h; sourceTree = ""; }; - 0472D1A415A26D7600F7AD9A /* cef_jsdialog_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_jsdialog_handler.h; sourceTree = ""; }; - 0472D1A515A26D7600F7AD9A /* cef_keyboard_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_keyboard_handler.h; sourceTree = ""; }; - 0472D1A615A26D7600F7AD9A /* cef_life_span_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_life_span_handler.h; sourceTree = ""; }; - 0472D1A715A26D7600F7AD9A /* cef_load_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_load_handler.h; sourceTree = ""; }; - 0472D1A815A26D7600F7AD9A /* cef_menu_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_menu_handler.h; sourceTree = ""; }; - 0472D1A915A26D7600F7AD9A /* cef_nplugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_nplugin.h; sourceTree = ""; }; - 0472D1AA15A26D7600F7AD9A /* cef_origin_whitelist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_origin_whitelist.h; sourceTree = ""; }; - 0472D1AB15A26D7600F7AD9A /* cef_permission_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_permission_handler.h; sourceTree = ""; }; - 0472D1AC15A26D7600F7AD9A /* cef_print_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_print_handler.h; sourceTree = ""; }; - 0472D1AD15A26D7600F7AD9A /* cef_proxy_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_proxy_handler.h; sourceTree = ""; }; - 0472D1AE15A26D7600F7AD9A /* cef_render_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_render_handler.h; sourceTree = ""; }; - 0472D1AF15A26D7600F7AD9A /* cef_request.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_request.h; sourceTree = ""; }; - 0472D1B015A26D7600F7AD9A /* cef_request_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_request_handler.h; sourceTree = ""; }; - 0472D1B115A26D7600F7AD9A /* cef_resource_bundle_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_resource_bundle_handler.h; sourceTree = ""; }; - 0472D1B215A26D7600F7AD9A /* cef_response.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_response.h; sourceTree = ""; }; - 0472D1B315A26D7600F7AD9A /* cef_runnable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_runnable.h; sourceTree = ""; }; - 0472D1B415A26D7600F7AD9A /* cef_scheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_scheme.h; sourceTree = ""; }; - 0472D1B515A26D7600F7AD9A /* cef_storage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_storage.h; sourceTree = ""; }; - 0472D1B615A26D7600F7AD9A /* cef_stream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_stream.h; sourceTree = ""; }; - 0472D1B715A26D7600F7AD9A /* cef_task.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_task.h; sourceTree = ""; }; - 0472D1B815A26D7600F7AD9A /* cef_url.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_url.h; sourceTree = ""; }; - 0472D1B915A26D7600F7AD9A /* cef_v8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_v8.h; sourceTree = ""; }; - 0472D1BA15A26D7600F7AD9A /* cef_v8context_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_v8context_handler.h; sourceTree = ""; }; - 0472D1BB15A26D7600F7AD9A /* cef_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_version.h; sourceTree = ""; }; - 0472D1BC15A26D7600F7AD9A /* cef_web_plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_web_plugin.h; sourceTree = ""; }; - 0472D1BD15A26D7600F7AD9A /* cef_web_urlrequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_web_urlrequest.h; sourceTree = ""; }; - 0472D1BE15A26D7600F7AD9A /* cef_xml_reader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_xml_reader.h; sourceTree = ""; }; - 0472D1BF15A26D7600F7AD9A /* cef_zip_reader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_zip_reader.h; sourceTree = ""; }; - 0472D1C115A26D7600F7AD9A /* cef_build.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_build.h; sourceTree = ""; }; - 0472D1C215A26D7600F7AD9A /* cef_export.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_export.h; sourceTree = ""; }; - 0472D1C315A26D7600F7AD9A /* cef_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_mac.h; sourceTree = ""; }; - 0472D1C415A26D7600F7AD9A /* cef_nplugin_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_nplugin_types.h; sourceTree = ""; }; - 0472D1C515A26D7600F7AD9A /* cef_ptr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_ptr.h; sourceTree = ""; }; - 0472D1C615A26D7600F7AD9A /* cef_string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_string.h; sourceTree = ""; }; - 0472D1C715A26D7600F7AD9A /* cef_string_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_string_list.h; sourceTree = ""; }; - 0472D1C815A26D7600F7AD9A /* cef_string_map.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_string_map.h; sourceTree = ""; }; - 0472D1C915A26D7600F7AD9A /* cef_string_multimap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_string_multimap.h; sourceTree = ""; }; - 0472D1CA15A26D7600F7AD9A /* cef_string_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_string_types.h; sourceTree = ""; }; - 0472D1CB15A26D7600F7AD9A /* cef_string_wrappers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_string_wrappers.h; sourceTree = ""; }; - 0472D1CC15A26D7600F7AD9A /* cef_time.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_time.h; sourceTree = ""; }; - 0472D1CD15A26D7600F7AD9A /* cef_tuple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_tuple.h; sourceTree = ""; }; - 0472D1CE15A26D7600F7AD9A /* cef_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_types.h; sourceTree = ""; }; - 0472D1CF15A26D7600F7AD9A /* cef_types_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_types_mac.h; sourceTree = ""; }; - 0472D1D015A26D7600F7AD9A /* cef_types_wrappers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_types_wrappers.h; sourceTree = ""; }; - 0472D1D215A26D7600F7AD9A /* basictypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = basictypes.h; sourceTree = ""; }; - 0472D1D315A26D7600F7AD9A /* build_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = build_config.h; sourceTree = ""; }; - 0472D1D415A26D7600F7AD9A /* npapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = npapi.h; sourceTree = ""; }; - 0472D1D515A26D7600F7AD9A /* npapi_extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = npapi_extensions.h; sourceTree = ""; }; - 0472D1D615A26D7600F7AD9A /* npfunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = npfunctions.h; sourceTree = ""; }; - 0472D1D715A26D7600F7AD9A /* nphostapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nphostapi.h; sourceTree = ""; }; - 0472D1D815A26D7600F7AD9A /* npruntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = npruntime.h; sourceTree = ""; }; - 0472D1D915A26D7600F7AD9A /* nptypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nptypes.h; sourceTree = ""; }; - 0472D1DA15A26D7600F7AD9A /* port.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = port.h; sourceTree = ""; }; - 0472D1DB15A26D7600F7AD9A /* README-TRANSFER.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "README-TRANSFER.txt"; sourceTree = ""; }; - 0472D1DD15A26D7600F7AD9A /* cef_byte_read_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_byte_read_handler.h; sourceTree = ""; }; - 0472D1DE15A26D7600F7AD9A /* cef_xml_object.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_xml_object.h; sourceTree = ""; }; - 0472D1DF15A26D7600F7AD9A /* cef_zip_archive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_zip_archive.h; sourceTree = ""; }; - 0472D1E215A26D8100F7AD9A /* cef_logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cef_logging.h; sourceTree = ""; }; - 0472D1E415A26D8100F7AD9A /* app_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = app_cpptoc.cc; sourceTree = ""; }; - 0472D1E515A26D8100F7AD9A /* app_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = app_cpptoc.h; sourceTree = ""; }; - 0472D1E615A26D8100F7AD9A /* base_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = base_cpptoc.h; sourceTree = ""; }; - 0472D1E715A26D8100F7AD9A /* client_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = client_cpptoc.cc; sourceTree = ""; }; - 0472D1E815A26D8100F7AD9A /* client_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = client_cpptoc.h; sourceTree = ""; }; - 0472D1E915A26D8100F7AD9A /* content_filter_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = content_filter_cpptoc.cc; sourceTree = ""; }; - 0472D1EA15A26D8100F7AD9A /* content_filter_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = content_filter_cpptoc.h; sourceTree = ""; }; - 0472D1EB15A26D8100F7AD9A /* cookie_visitor_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cookie_visitor_cpptoc.cc; sourceTree = ""; }; - 0472D1EC15A26D8100F7AD9A /* cookie_visitor_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cookie_visitor_cpptoc.h; sourceTree = ""; }; - 0472D1ED15A26D8100F7AD9A /* cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpptoc.h; sourceTree = ""; }; - 0472D1EE15A26D8100F7AD9A /* display_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = display_handler_cpptoc.cc; sourceTree = ""; }; - 0472D1EF15A26D8100F7AD9A /* display_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = display_handler_cpptoc.h; sourceTree = ""; }; - 0472D1F015A26D8100F7AD9A /* domevent_listener_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = domevent_listener_cpptoc.cc; sourceTree = ""; }; - 0472D1F115A26D8100F7AD9A /* domevent_listener_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = domevent_listener_cpptoc.h; sourceTree = ""; }; - 0472D1F215A26D8100F7AD9A /* domvisitor_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = domvisitor_cpptoc.cc; sourceTree = ""; }; - 0472D1F315A26D8100F7AD9A /* domvisitor_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = domvisitor_cpptoc.h; sourceTree = ""; }; - 0472D1F415A26D8100F7AD9A /* download_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = download_handler_cpptoc.cc; sourceTree = ""; }; - 0472D1F515A26D8100F7AD9A /* download_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = download_handler_cpptoc.h; sourceTree = ""; }; - 0472D1F615A26D8100F7AD9A /* drag_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = drag_handler_cpptoc.cc; sourceTree = ""; }; - 0472D1F715A26D8100F7AD9A /* drag_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = drag_handler_cpptoc.h; sourceTree = ""; }; - 0472D1F815A26D8100F7AD9A /* find_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = find_handler_cpptoc.cc; sourceTree = ""; }; - 0472D1F915A26D8100F7AD9A /* find_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = find_handler_cpptoc.h; sourceTree = ""; }; - 0472D1FA15A26D8100F7AD9A /* focus_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = focus_handler_cpptoc.cc; sourceTree = ""; }; - 0472D1FB15A26D8100F7AD9A /* focus_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = focus_handler_cpptoc.h; sourceTree = ""; }; - 0472D1FC15A26D8100F7AD9A /* jsdialog_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsdialog_handler_cpptoc.cc; sourceTree = ""; }; - 0472D1FD15A26D8100F7AD9A /* jsdialog_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsdialog_handler_cpptoc.h; sourceTree = ""; }; - 0472D1FE15A26D8100F7AD9A /* keyboard_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = keyboard_handler_cpptoc.cc; sourceTree = ""; }; - 0472D1FF15A26D8100F7AD9A /* keyboard_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = keyboard_handler_cpptoc.h; sourceTree = ""; }; - 0472D20015A26D8100F7AD9A /* life_span_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = life_span_handler_cpptoc.cc; sourceTree = ""; }; - 0472D20115A26D8100F7AD9A /* life_span_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = life_span_handler_cpptoc.h; sourceTree = ""; }; - 0472D20215A26D8100F7AD9A /* load_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = load_handler_cpptoc.cc; sourceTree = ""; }; - 0472D20315A26D8100F7AD9A /* load_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = load_handler_cpptoc.h; sourceTree = ""; }; - 0472D20415A26D8100F7AD9A /* menu_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = menu_handler_cpptoc.cc; sourceTree = ""; }; - 0472D20515A26D8100F7AD9A /* menu_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = menu_handler_cpptoc.h; sourceTree = ""; }; - 0472D20615A26D8100F7AD9A /* permission_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = permission_handler_cpptoc.cc; sourceTree = ""; }; - 0472D20715A26D8100F7AD9A /* permission_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = permission_handler_cpptoc.h; sourceTree = ""; }; - 0472D20815A26D8100F7AD9A /* print_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = print_handler_cpptoc.cc; sourceTree = ""; }; - 0472D20915A26D8100F7AD9A /* print_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = print_handler_cpptoc.h; sourceTree = ""; }; - 0472D20A15A26D8100F7AD9A /* proxy_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = proxy_handler_cpptoc.cc; sourceTree = ""; }; - 0472D20B15A26D8100F7AD9A /* proxy_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = proxy_handler_cpptoc.h; sourceTree = ""; }; - 0472D20C15A26D8100F7AD9A /* read_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = read_handler_cpptoc.cc; sourceTree = ""; }; - 0472D20D15A26D8100F7AD9A /* read_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = read_handler_cpptoc.h; sourceTree = ""; }; - 0472D20E15A26D8100F7AD9A /* render_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = render_handler_cpptoc.cc; sourceTree = ""; }; - 0472D20F15A26D8100F7AD9A /* render_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = render_handler_cpptoc.h; sourceTree = ""; }; - 0472D21015A26D8100F7AD9A /* request_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = request_handler_cpptoc.cc; sourceTree = ""; }; - 0472D21115A26D8100F7AD9A /* request_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = request_handler_cpptoc.h; sourceTree = ""; }; - 0472D21215A26D8100F7AD9A /* resource_bundle_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = resource_bundle_handler_cpptoc.cc; sourceTree = ""; }; - 0472D21315A26D8100F7AD9A /* resource_bundle_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resource_bundle_handler_cpptoc.h; sourceTree = ""; }; - 0472D21415A26D8100F7AD9A /* scheme_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_handler_cpptoc.cc; sourceTree = ""; }; - 0472D21515A26D8100F7AD9A /* scheme_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scheme_handler_cpptoc.h; sourceTree = ""; }; - 0472D21615A26D8100F7AD9A /* scheme_handler_factory_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_handler_factory_cpptoc.cc; sourceTree = ""; }; - 0472D21715A26D8100F7AD9A /* scheme_handler_factory_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scheme_handler_factory_cpptoc.h; sourceTree = ""; }; - 0472D21815A26D8100F7AD9A /* storage_visitor_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = storage_visitor_cpptoc.cc; sourceTree = ""; }; - 0472D21915A26D8100F7AD9A /* storage_visitor_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = storage_visitor_cpptoc.h; sourceTree = ""; }; - 0472D21A15A26D8100F7AD9A /* task_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = task_cpptoc.cc; sourceTree = ""; }; - 0472D21B15A26D8100F7AD9A /* task_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = task_cpptoc.h; sourceTree = ""; }; - 0472D21C15A26D8100F7AD9A /* v8accessor_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = v8accessor_cpptoc.cc; sourceTree = ""; }; - 0472D21D15A26D8100F7AD9A /* v8accessor_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = v8accessor_cpptoc.h; sourceTree = ""; }; - 0472D21E15A26D8100F7AD9A /* v8context_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = v8context_handler_cpptoc.cc; sourceTree = ""; }; - 0472D21F15A26D8100F7AD9A /* v8context_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = v8context_handler_cpptoc.h; sourceTree = ""; }; - 0472D22015A26D8100F7AD9A /* v8handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = v8handler_cpptoc.cc; sourceTree = ""; }; - 0472D22115A26D8100F7AD9A /* v8handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = v8handler_cpptoc.h; sourceTree = ""; }; - 0472D22215A26D8100F7AD9A /* web_urlrequest_client_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = web_urlrequest_client_cpptoc.cc; sourceTree = ""; }; - 0472D22315A26D8100F7AD9A /* web_urlrequest_client_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = web_urlrequest_client_cpptoc.h; sourceTree = ""; }; - 0472D22415A26D8100F7AD9A /* write_handler_cpptoc.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = write_handler_cpptoc.cc; sourceTree = ""; }; - 0472D22515A26D8100F7AD9A /* write_handler_cpptoc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = write_handler_cpptoc.h; sourceTree = ""; }; - 0472D22715A26D8100F7AD9A /* base_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = base_ctocpp.h; sourceTree = ""; }; - 0472D22815A26D8100F7AD9A /* browser_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = browser_ctocpp.cc; sourceTree = ""; }; - 0472D22915A26D8100F7AD9A /* browser_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = browser_ctocpp.h; sourceTree = ""; }; - 0472D22A15A26D8100F7AD9A /* command_line_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = command_line_ctocpp.cc; sourceTree = ""; }; - 0472D22B15A26D8100F7AD9A /* command_line_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = command_line_ctocpp.h; sourceTree = ""; }; - 0472D22C15A26D8100F7AD9A /* cookie_manager_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cookie_manager_ctocpp.cc; sourceTree = ""; }; - 0472D22D15A26D8100F7AD9A /* cookie_manager_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cookie_manager_ctocpp.h; sourceTree = ""; }; - 0472D22E15A26D8100F7AD9A /* ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ctocpp.h; sourceTree = ""; }; - 0472D22F15A26D8100F7AD9A /* domdocument_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = domdocument_ctocpp.cc; sourceTree = ""; }; - 0472D23015A26D8100F7AD9A /* domdocument_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = domdocument_ctocpp.h; sourceTree = ""; }; - 0472D23115A26D8100F7AD9A /* domevent_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = domevent_ctocpp.cc; sourceTree = ""; }; - 0472D23215A26D8100F7AD9A /* domevent_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = domevent_ctocpp.h; sourceTree = ""; }; - 0472D23315A26D8100F7AD9A /* domnode_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = domnode_ctocpp.cc; sourceTree = ""; }; - 0472D23415A26D8100F7AD9A /* domnode_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = domnode_ctocpp.h; sourceTree = ""; }; - 0472D23515A26D8100F7AD9A /* drag_data_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = drag_data_ctocpp.cc; sourceTree = ""; }; - 0472D23615A26D8100F7AD9A /* drag_data_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = drag_data_ctocpp.h; sourceTree = ""; }; - 0472D23715A26D8100F7AD9A /* frame_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = frame_ctocpp.cc; sourceTree = ""; }; - 0472D23815A26D8100F7AD9A /* frame_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = frame_ctocpp.h; sourceTree = ""; }; - 0472D23915A26D8100F7AD9A /* post_data_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = post_data_ctocpp.cc; sourceTree = ""; }; - 0472D23A15A26D8100F7AD9A /* post_data_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = post_data_ctocpp.h; sourceTree = ""; }; - 0472D23B15A26D8100F7AD9A /* post_data_element_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = post_data_element_ctocpp.cc; sourceTree = ""; }; - 0472D23C15A26D8100F7AD9A /* post_data_element_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = post_data_element_ctocpp.h; sourceTree = ""; }; - 0472D23D15A26D8100F7AD9A /* request_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = request_ctocpp.cc; sourceTree = ""; }; - 0472D23E15A26D8100F7AD9A /* request_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = request_ctocpp.h; sourceTree = ""; }; - 0472D23F15A26D8100F7AD9A /* response_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = response_ctocpp.cc; sourceTree = ""; }; - 0472D24015A26D8100F7AD9A /* response_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = response_ctocpp.h; sourceTree = ""; }; - 0472D24115A26D8100F7AD9A /* scheme_handler_callback_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_handler_callback_ctocpp.cc; sourceTree = ""; }; - 0472D24215A26D8100F7AD9A /* scheme_handler_callback_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scheme_handler_callback_ctocpp.h; sourceTree = ""; }; - 0472D24315A26D8100F7AD9A /* stream_reader_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = stream_reader_ctocpp.cc; sourceTree = ""; }; - 0472D24415A26D8100F7AD9A /* stream_reader_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stream_reader_ctocpp.h; sourceTree = ""; }; - 0472D24515A26D8100F7AD9A /* stream_writer_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = stream_writer_ctocpp.cc; sourceTree = ""; }; - 0472D24615A26D8100F7AD9A /* stream_writer_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stream_writer_ctocpp.h; sourceTree = ""; }; - 0472D24715A26D8100F7AD9A /* v8context_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = v8context_ctocpp.cc; sourceTree = ""; }; - 0472D24815A26D8100F7AD9A /* v8context_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = v8context_ctocpp.h; sourceTree = ""; }; - 0472D24915A26D8100F7AD9A /* v8exception_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = v8exception_ctocpp.cc; sourceTree = ""; }; - 0472D24A15A26D8100F7AD9A /* v8exception_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = v8exception_ctocpp.h; sourceTree = ""; }; - 0472D24B15A26D8100F7AD9A /* v8value_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = v8value_ctocpp.cc; sourceTree = ""; }; - 0472D24C15A26D8100F7AD9A /* v8value_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = v8value_ctocpp.h; sourceTree = ""; }; - 0472D24D15A26D8100F7AD9A /* web_plugin_info_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = web_plugin_info_ctocpp.cc; sourceTree = ""; }; - 0472D24E15A26D8100F7AD9A /* web_plugin_info_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = web_plugin_info_ctocpp.h; sourceTree = ""; }; - 0472D24F15A26D8100F7AD9A /* web_urlrequest_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = web_urlrequest_ctocpp.cc; sourceTree = ""; }; - 0472D25015A26D8100F7AD9A /* web_urlrequest_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = web_urlrequest_ctocpp.h; sourceTree = ""; }; - 0472D25115A26D8100F7AD9A /* xml_reader_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xml_reader_ctocpp.cc; sourceTree = ""; }; - 0472D25215A26D8100F7AD9A /* xml_reader_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xml_reader_ctocpp.h; sourceTree = ""; }; - 0472D25315A26D8100F7AD9A /* zip_reader_ctocpp.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = zip_reader_ctocpp.cc; sourceTree = ""; }; - 0472D25415A26D8100F7AD9A /* zip_reader_ctocpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zip_reader_ctocpp.h; sourceTree = ""; }; - 0472D25515A26D8100F7AD9A /* transfer_util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = transfer_util.cpp; sourceTree = ""; }; - 0472D25615A26D8100F7AD9A /* transfer_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = transfer_util.h; sourceTree = ""; }; - 0472D25815A26D8100F7AD9A /* cef_byte_read_handler.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cef_byte_read_handler.cc; sourceTree = ""; }; - 0472D25915A26D8100F7AD9A /* cef_xml_object.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cef_xml_object.cc; sourceTree = ""; }; - 0472D25A15A26D8100F7AD9A /* cef_zip_archive.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cef_zip_archive.cc; sourceTree = ""; }; - 0472D25B15A26D8100F7AD9A /* libcef_dll_wrapper.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libcef_dll_wrapper.cc; sourceTree = ""; }; - 0472D25C15A26D8100F7AD9A /* libcef_dll_wrapper2.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libcef_dll_wrapper2.cc; sourceTree = ""; }; - 0487C91214FED5360045E5E3 /* Atom.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Atom.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 0487C91614FED5360045E5E3 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; - 0487C91914FED5360045E5E3 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; - 0487C91A14FED5360045E5E3 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; - 0487C91B14FED5360045E5E3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 0487C93414FED5FB0045E5E3 /* ClientWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ClientWindow.xib; sourceTree = ""; }; - 0487C93514FED5FB0045E5E3 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 0487C93614FED5FB0045E5E3 /* MainMenu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainMenu.xib; sourceTree = ""; }; - 0487C93C14FED6090045E5E3 /* Atom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Atom.h; sourceTree = ""; }; - 0487C93D14FED6090045E5E3 /* Atom.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Atom.mm; sourceTree = ""; }; - 0487C93E14FED6090045E5E3 /* AtomController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomController.h; sourceTree = ""; }; - 0487C93F14FED6090045E5E3 /* AtomController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AtomController.mm; sourceTree = ""; }; - 0487C94014FED6090045E5E3 /* client_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = client_handler.h; sourceTree = ""; }; - 0487C94114FED6090045E5E3 /* client_handler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = client_handler.mm; sourceTree = ""; }; - 0487C94214FED6090045E5E3 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; - 0487C94314FED6090045E5E3 /* native_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = native_handler.h; sourceTree = ""; }; - 0487C94414FED6090045E5E3 /* native_handler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = native_handler.mm; sourceTree = ""; }; - 0487CC8114FEDF990045E5E3 /* liblibcef_wrapper.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblibcef_wrapper.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 0487D15E14FEE7880045E5E3 /* Resources */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Resources; sourceTree = ""; }; - 048A2FC5154870DC0051715C /* PathWatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PathWatcher.h; sourceTree = ""; }; - 048A2FC6154870DC0051715C /* PathWatcher.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PathWatcher.mm; sourceTree = ""; }; - 04E1DDDC152A0941001A9D07 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = frameworks/Sparkle.framework; sourceTree = ""; }; - 04F21A2615644AC10083F6D4 /* ResourceConfig.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ResourceConfig.xcconfig; sourceTree = ""; }; - EC800C1815C72301007FD3CB /* OnigRegexpExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OnigRegexpExtension.h; sourceTree = ""; }; - EC800C1A15C72378007FD3CB /* OnigRegexpExtension.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OnigRegexpExtension.mm; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 0487C90F14FED5360045E5E3 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 0487CDA014FEE1DA0045E5E3 /* liblibcef_wrapper.a in Frameworks */, - 0487C91714FED5360045E5E3 /* Cocoa.framework in Frameworks */, - 04E1DDDD152A0941001A9D07 /* Sparkle.framework in Frameworks */, - 0472D16615A26C9400F7AD9A /* libcef.dylib in Frameworks */, - 0446DB6315C73BDA006756AF /* CocoaOniguruma.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0487CC7E14FEDF990045E5E3 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 042180E71500266500DF25EA /* cef */ = { - isa = PBXGroup; - children = ( - 0472D1E115A26D8100F7AD9A /* libcef_dll */, - 0472D16915A26D7500F7AD9A /* include */, - ); - name = cef; - path = Atom; - sourceTree = ""; - }; - 0472D16915A26D7500F7AD9A /* include */ = { - isa = PBXGroup; - children = ( - 0472D16A15A26D7600F7AD9A /* capi */, - 0472D19415A26D7600F7AD9A /* cef_app.h */, - 0472D19515A26D7600F7AD9A /* cef_application_mac.h */, - 0472D19615A26D7600F7AD9A /* cef_base.h */, - 0472D19715A26D7600F7AD9A /* cef_browser.h */, - 0472D19815A26D7600F7AD9A /* cef_client.h */, - 0472D19915A26D7600F7AD9A /* cef_command_line.h */, - 0472D19A15A26D7600F7AD9A /* cef_content_filter.h */, - 0472D19B15A26D7600F7AD9A /* cef_cookie.h */, - 0472D19C15A26D7600F7AD9A /* cef_display_handler.h */, - 0472D19D15A26D7600F7AD9A /* cef_dom.h */, - 0472D19E15A26D7600F7AD9A /* cef_download_handler.h */, - 0472D19F15A26D7600F7AD9A /* cef_drag_data.h */, - 0472D1A015A26D7600F7AD9A /* cef_drag_handler.h */, - 0472D1A115A26D7600F7AD9A /* cef_find_handler.h */, - 0472D1A215A26D7600F7AD9A /* cef_focus_handler.h */, - 0472D1A315A26D7600F7AD9A /* cef_frame.h */, - 0472D1A415A26D7600F7AD9A /* cef_jsdialog_handler.h */, - 0472D1A515A26D7600F7AD9A /* cef_keyboard_handler.h */, - 0472D1A615A26D7600F7AD9A /* cef_life_span_handler.h */, - 0472D1A715A26D7600F7AD9A /* cef_load_handler.h */, - 0472D1A815A26D7600F7AD9A /* cef_menu_handler.h */, - 0472D1A915A26D7600F7AD9A /* cef_nplugin.h */, - 0472D1AA15A26D7600F7AD9A /* cef_origin_whitelist.h */, - 0472D1AB15A26D7600F7AD9A /* cef_permission_handler.h */, - 0472D1AC15A26D7600F7AD9A /* cef_print_handler.h */, - 0472D1AD15A26D7600F7AD9A /* cef_proxy_handler.h */, - 0472D1AE15A26D7600F7AD9A /* cef_render_handler.h */, - 0472D1AF15A26D7600F7AD9A /* cef_request.h */, - 0472D1B015A26D7600F7AD9A /* cef_request_handler.h */, - 0472D1B115A26D7600F7AD9A /* cef_resource_bundle_handler.h */, - 0472D1B215A26D7600F7AD9A /* cef_response.h */, - 0472D1B315A26D7600F7AD9A /* cef_runnable.h */, - 0472D1B415A26D7600F7AD9A /* cef_scheme.h */, - 0472D1B515A26D7600F7AD9A /* cef_storage.h */, - 0472D1B615A26D7600F7AD9A /* cef_stream.h */, - 0472D1B715A26D7600F7AD9A /* cef_task.h */, - 0472D1B815A26D7600F7AD9A /* cef_url.h */, - 0472D1B915A26D7600F7AD9A /* cef_v8.h */, - 0472D1BA15A26D7600F7AD9A /* cef_v8context_handler.h */, - 0472D1BB15A26D7600F7AD9A /* cef_version.h */, - 0472D1BC15A26D7600F7AD9A /* cef_web_plugin.h */, - 0472D1BD15A26D7600F7AD9A /* cef_web_urlrequest.h */, - 0472D1BE15A26D7600F7AD9A /* cef_xml_reader.h */, - 0472D1BF15A26D7600F7AD9A /* cef_zip_reader.h */, - 0472D1C015A26D7600F7AD9A /* internal */, - 0472D1DC15A26D7600F7AD9A /* wrapper */, - ); - name = include; - path = cef/include; - sourceTree = SOURCE_ROOT; - }; - 0472D16A15A26D7600F7AD9A /* capi */ = { - isa = PBXGroup; - children = ( - 0472D16B15A26D7600F7AD9A /* cef_app_capi.h */, - 0472D16C15A26D7600F7AD9A /* cef_base_capi.h */, - 0472D16D15A26D7600F7AD9A /* cef_browser_capi.h */, - 0472D16E15A26D7600F7AD9A /* cef_client_capi.h */, - 0472D16F15A26D7600F7AD9A /* cef_command_line_capi.h */, - 0472D17015A26D7600F7AD9A /* cef_content_filter_capi.h */, - 0472D17115A26D7600F7AD9A /* cef_cookie_capi.h */, - 0472D17215A26D7600F7AD9A /* cef_display_handler_capi.h */, - 0472D17315A26D7600F7AD9A /* cef_dom_capi.h */, - 0472D17415A26D7600F7AD9A /* cef_download_handler_capi.h */, - 0472D17515A26D7600F7AD9A /* cef_drag_data_capi.h */, - 0472D17615A26D7600F7AD9A /* cef_drag_handler_capi.h */, - 0472D17715A26D7600F7AD9A /* cef_find_handler_capi.h */, - 0472D17815A26D7600F7AD9A /* cef_focus_handler_capi.h */, - 0472D17915A26D7600F7AD9A /* cef_frame_capi.h */, - 0472D17A15A26D7600F7AD9A /* cef_jsdialog_handler_capi.h */, - 0472D17B15A26D7600F7AD9A /* cef_keyboard_handler_capi.h */, - 0472D17C15A26D7600F7AD9A /* cef_life_span_handler_capi.h */, - 0472D17D15A26D7600F7AD9A /* cef_load_handler_capi.h */, - 0472D17E15A26D7600F7AD9A /* cef_menu_handler_capi.h */, - 0472D17F15A26D7600F7AD9A /* cef_nplugin_capi.h */, - 0472D18015A26D7600F7AD9A /* cef_origin_whitelist_capi.h */, - 0472D18115A26D7600F7AD9A /* cef_permission_handler_capi.h */, - 0472D18215A26D7600F7AD9A /* cef_print_handler_capi.h */, - 0472D18315A26D7600F7AD9A /* cef_proxy_handler_capi.h */, - 0472D18415A26D7600F7AD9A /* cef_render_handler_capi.h */, - 0472D18515A26D7600F7AD9A /* cef_request_capi.h */, - 0472D18615A26D7600F7AD9A /* cef_request_handler_capi.h */, - 0472D18715A26D7600F7AD9A /* cef_resource_bundle_handler_capi.h */, - 0472D18815A26D7600F7AD9A /* cef_response_capi.h */, - 0472D18915A26D7600F7AD9A /* cef_scheme_capi.h */, - 0472D18A15A26D7600F7AD9A /* cef_storage_capi.h */, - 0472D18B15A26D7600F7AD9A /* cef_stream_capi.h */, - 0472D18C15A26D7600F7AD9A /* cef_task_capi.h */, - 0472D18D15A26D7600F7AD9A /* cef_url_capi.h */, - 0472D18E15A26D7600F7AD9A /* cef_v8_capi.h */, - 0472D18F15A26D7600F7AD9A /* cef_v8context_handler_capi.h */, - 0472D19015A26D7600F7AD9A /* cef_web_plugin_capi.h */, - 0472D19115A26D7600F7AD9A /* cef_web_urlrequest_capi.h */, - 0472D19215A26D7600F7AD9A /* cef_xml_reader_capi.h */, - 0472D19315A26D7600F7AD9A /* cef_zip_reader_capi.h */, - ); - path = capi; - sourceTree = ""; - }; - 0472D1C015A26D7600F7AD9A /* internal */ = { - isa = PBXGroup; - children = ( - 0472D1C115A26D7600F7AD9A /* cef_build.h */, - 0472D1C215A26D7600F7AD9A /* cef_export.h */, - 0472D1C315A26D7600F7AD9A /* cef_mac.h */, - 0472D1C415A26D7600F7AD9A /* cef_nplugin_types.h */, - 0472D1C515A26D7600F7AD9A /* cef_ptr.h */, - 0472D1C615A26D7600F7AD9A /* cef_string.h */, - 0472D1C715A26D7600F7AD9A /* cef_string_list.h */, - 0472D1C815A26D7600F7AD9A /* cef_string_map.h */, - 0472D1C915A26D7600F7AD9A /* cef_string_multimap.h */, - 0472D1CA15A26D7600F7AD9A /* cef_string_types.h */, - 0472D1CB15A26D7600F7AD9A /* cef_string_wrappers.h */, - 0472D1CC15A26D7600F7AD9A /* cef_time.h */, - 0472D1CD15A26D7600F7AD9A /* cef_tuple.h */, - 0472D1CE15A26D7600F7AD9A /* cef_types.h */, - 0472D1CF15A26D7600F7AD9A /* cef_types_mac.h */, - 0472D1D015A26D7600F7AD9A /* cef_types_wrappers.h */, - 0472D1D115A26D7600F7AD9A /* npapi */, - ); - path = internal; - sourceTree = ""; - }; - 0472D1D115A26D7600F7AD9A /* npapi */ = { - isa = PBXGroup; - children = ( - 0472D1D215A26D7600F7AD9A /* basictypes.h */, - 0472D1D315A26D7600F7AD9A /* build_config.h */, - 0472D1D415A26D7600F7AD9A /* npapi.h */, - 0472D1D515A26D7600F7AD9A /* npapi_extensions.h */, - 0472D1D615A26D7600F7AD9A /* npfunctions.h */, - 0472D1D715A26D7600F7AD9A /* nphostapi.h */, - 0472D1D815A26D7600F7AD9A /* npruntime.h */, - 0472D1D915A26D7600F7AD9A /* nptypes.h */, - 0472D1DA15A26D7600F7AD9A /* port.h */, - 0472D1DB15A26D7600F7AD9A /* README-TRANSFER.txt */, - ); - path = npapi; - sourceTree = ""; - }; - 0472D1DC15A26D7600F7AD9A /* wrapper */ = { - isa = PBXGroup; - children = ( - 0472D1DD15A26D7600F7AD9A /* cef_byte_read_handler.h */, - 0472D1DE15A26D7600F7AD9A /* cef_xml_object.h */, - 0472D1DF15A26D7600F7AD9A /* cef_zip_archive.h */, - ); - path = wrapper; - sourceTree = ""; - }; - 0472D1E115A26D8100F7AD9A /* libcef_dll */ = { - isa = PBXGroup; - children = ( - 0472D1E215A26D8100F7AD9A /* cef_logging.h */, - 0472D1E315A26D8100F7AD9A /* cpptoc */, - 0472D22615A26D8100F7AD9A /* ctocpp */, - 0472D25515A26D8100F7AD9A /* transfer_util.cpp */, - 0472D25615A26D8100F7AD9A /* transfer_util.h */, - 0472D25715A26D8100F7AD9A /* wrapper */, - ); - name = libcef_dll; - path = cef/libcef_dll; - sourceTree = SOURCE_ROOT; - }; - 0472D1E315A26D8100F7AD9A /* cpptoc */ = { - isa = PBXGroup; - children = ( - 0472D1E415A26D8100F7AD9A /* app_cpptoc.cc */, - 0472D1E515A26D8100F7AD9A /* app_cpptoc.h */, - 0472D1E615A26D8100F7AD9A /* base_cpptoc.h */, - 0472D1E715A26D8100F7AD9A /* client_cpptoc.cc */, - 0472D1E815A26D8100F7AD9A /* client_cpptoc.h */, - 0472D1E915A26D8100F7AD9A /* content_filter_cpptoc.cc */, - 0472D1EA15A26D8100F7AD9A /* content_filter_cpptoc.h */, - 0472D1EB15A26D8100F7AD9A /* cookie_visitor_cpptoc.cc */, - 0472D1EC15A26D8100F7AD9A /* cookie_visitor_cpptoc.h */, - 0472D1ED15A26D8100F7AD9A /* cpptoc.h */, - 0472D1EE15A26D8100F7AD9A /* display_handler_cpptoc.cc */, - 0472D1EF15A26D8100F7AD9A /* display_handler_cpptoc.h */, - 0472D1F015A26D8100F7AD9A /* domevent_listener_cpptoc.cc */, - 0472D1F115A26D8100F7AD9A /* domevent_listener_cpptoc.h */, - 0472D1F215A26D8100F7AD9A /* domvisitor_cpptoc.cc */, - 0472D1F315A26D8100F7AD9A /* domvisitor_cpptoc.h */, - 0472D1F415A26D8100F7AD9A /* download_handler_cpptoc.cc */, - 0472D1F515A26D8100F7AD9A /* download_handler_cpptoc.h */, - 0472D1F615A26D8100F7AD9A /* drag_handler_cpptoc.cc */, - 0472D1F715A26D8100F7AD9A /* drag_handler_cpptoc.h */, - 0472D1F815A26D8100F7AD9A /* find_handler_cpptoc.cc */, - 0472D1F915A26D8100F7AD9A /* find_handler_cpptoc.h */, - 0472D1FA15A26D8100F7AD9A /* focus_handler_cpptoc.cc */, - 0472D1FB15A26D8100F7AD9A /* focus_handler_cpptoc.h */, - 0472D1FC15A26D8100F7AD9A /* jsdialog_handler_cpptoc.cc */, - 0472D1FD15A26D8100F7AD9A /* jsdialog_handler_cpptoc.h */, - 0472D1FE15A26D8100F7AD9A /* keyboard_handler_cpptoc.cc */, - 0472D1FF15A26D8100F7AD9A /* keyboard_handler_cpptoc.h */, - 0472D20015A26D8100F7AD9A /* life_span_handler_cpptoc.cc */, - 0472D20115A26D8100F7AD9A /* life_span_handler_cpptoc.h */, - 0472D20215A26D8100F7AD9A /* load_handler_cpptoc.cc */, - 0472D20315A26D8100F7AD9A /* load_handler_cpptoc.h */, - 0472D20415A26D8100F7AD9A /* menu_handler_cpptoc.cc */, - 0472D20515A26D8100F7AD9A /* menu_handler_cpptoc.h */, - 0472D20615A26D8100F7AD9A /* permission_handler_cpptoc.cc */, - 0472D20715A26D8100F7AD9A /* permission_handler_cpptoc.h */, - 0472D20815A26D8100F7AD9A /* print_handler_cpptoc.cc */, - 0472D20915A26D8100F7AD9A /* print_handler_cpptoc.h */, - 0472D20A15A26D8100F7AD9A /* proxy_handler_cpptoc.cc */, - 0472D20B15A26D8100F7AD9A /* proxy_handler_cpptoc.h */, - 0472D20C15A26D8100F7AD9A /* read_handler_cpptoc.cc */, - 0472D20D15A26D8100F7AD9A /* read_handler_cpptoc.h */, - 0472D20E15A26D8100F7AD9A /* render_handler_cpptoc.cc */, - 0472D20F15A26D8100F7AD9A /* render_handler_cpptoc.h */, - 0472D21015A26D8100F7AD9A /* request_handler_cpptoc.cc */, - 0472D21115A26D8100F7AD9A /* request_handler_cpptoc.h */, - 0472D21215A26D8100F7AD9A /* resource_bundle_handler_cpptoc.cc */, - 0472D21315A26D8100F7AD9A /* resource_bundle_handler_cpptoc.h */, - 0472D21415A26D8100F7AD9A /* scheme_handler_cpptoc.cc */, - 0472D21515A26D8100F7AD9A /* scheme_handler_cpptoc.h */, - 0472D21615A26D8100F7AD9A /* scheme_handler_factory_cpptoc.cc */, - 0472D21715A26D8100F7AD9A /* scheme_handler_factory_cpptoc.h */, - 0472D21815A26D8100F7AD9A /* storage_visitor_cpptoc.cc */, - 0472D21915A26D8100F7AD9A /* storage_visitor_cpptoc.h */, - 0472D21A15A26D8100F7AD9A /* task_cpptoc.cc */, - 0472D21B15A26D8100F7AD9A /* task_cpptoc.h */, - 0472D21C15A26D8100F7AD9A /* v8accessor_cpptoc.cc */, - 0472D21D15A26D8100F7AD9A /* v8accessor_cpptoc.h */, - 0472D21E15A26D8100F7AD9A /* v8context_handler_cpptoc.cc */, - 0472D21F15A26D8100F7AD9A /* v8context_handler_cpptoc.h */, - 0472D22015A26D8100F7AD9A /* v8handler_cpptoc.cc */, - 0472D22115A26D8100F7AD9A /* v8handler_cpptoc.h */, - 0472D22215A26D8100F7AD9A /* web_urlrequest_client_cpptoc.cc */, - 0472D22315A26D8100F7AD9A /* web_urlrequest_client_cpptoc.h */, - 0472D22415A26D8100F7AD9A /* write_handler_cpptoc.cc */, - 0472D22515A26D8100F7AD9A /* write_handler_cpptoc.h */, - ); - path = cpptoc; - sourceTree = ""; - }; - 0472D22615A26D8100F7AD9A /* ctocpp */ = { - isa = PBXGroup; - children = ( - 0472D22715A26D8100F7AD9A /* base_ctocpp.h */, - 0472D22815A26D8100F7AD9A /* browser_ctocpp.cc */, - 0472D22915A26D8100F7AD9A /* browser_ctocpp.h */, - 0472D22A15A26D8100F7AD9A /* command_line_ctocpp.cc */, - 0472D22B15A26D8100F7AD9A /* command_line_ctocpp.h */, - 0472D22C15A26D8100F7AD9A /* cookie_manager_ctocpp.cc */, - 0472D22D15A26D8100F7AD9A /* cookie_manager_ctocpp.h */, - 0472D22E15A26D8100F7AD9A /* ctocpp.h */, - 0472D22F15A26D8100F7AD9A /* domdocument_ctocpp.cc */, - 0472D23015A26D8100F7AD9A /* domdocument_ctocpp.h */, - 0472D23115A26D8100F7AD9A /* domevent_ctocpp.cc */, - 0472D23215A26D8100F7AD9A /* domevent_ctocpp.h */, - 0472D23315A26D8100F7AD9A /* domnode_ctocpp.cc */, - 0472D23415A26D8100F7AD9A /* domnode_ctocpp.h */, - 0472D23515A26D8100F7AD9A /* drag_data_ctocpp.cc */, - 0472D23615A26D8100F7AD9A /* drag_data_ctocpp.h */, - 0472D23715A26D8100F7AD9A /* frame_ctocpp.cc */, - 0472D23815A26D8100F7AD9A /* frame_ctocpp.h */, - 0472D23915A26D8100F7AD9A /* post_data_ctocpp.cc */, - 0472D23A15A26D8100F7AD9A /* post_data_ctocpp.h */, - 0472D23B15A26D8100F7AD9A /* post_data_element_ctocpp.cc */, - 0472D23C15A26D8100F7AD9A /* post_data_element_ctocpp.h */, - 0472D23D15A26D8100F7AD9A /* request_ctocpp.cc */, - 0472D23E15A26D8100F7AD9A /* request_ctocpp.h */, - 0472D23F15A26D8100F7AD9A /* response_ctocpp.cc */, - 0472D24015A26D8100F7AD9A /* response_ctocpp.h */, - 0472D24115A26D8100F7AD9A /* scheme_handler_callback_ctocpp.cc */, - 0472D24215A26D8100F7AD9A /* scheme_handler_callback_ctocpp.h */, - 0472D24315A26D8100F7AD9A /* stream_reader_ctocpp.cc */, - 0472D24415A26D8100F7AD9A /* stream_reader_ctocpp.h */, - 0472D24515A26D8100F7AD9A /* stream_writer_ctocpp.cc */, - 0472D24615A26D8100F7AD9A /* stream_writer_ctocpp.h */, - 0472D24715A26D8100F7AD9A /* v8context_ctocpp.cc */, - 0472D24815A26D8100F7AD9A /* v8context_ctocpp.h */, - 0472D24915A26D8100F7AD9A /* v8exception_ctocpp.cc */, - 0472D24A15A26D8100F7AD9A /* v8exception_ctocpp.h */, - 0472D24B15A26D8100F7AD9A /* v8value_ctocpp.cc */, - 0472D24C15A26D8100F7AD9A /* v8value_ctocpp.h */, - 0472D24D15A26D8100F7AD9A /* web_plugin_info_ctocpp.cc */, - 0472D24E15A26D8100F7AD9A /* web_plugin_info_ctocpp.h */, - 0472D24F15A26D8100F7AD9A /* web_urlrequest_ctocpp.cc */, - 0472D25015A26D8100F7AD9A /* web_urlrequest_ctocpp.h */, - 0472D25115A26D8100F7AD9A /* xml_reader_ctocpp.cc */, - 0472D25215A26D8100F7AD9A /* xml_reader_ctocpp.h */, - 0472D25315A26D8100F7AD9A /* zip_reader_ctocpp.cc */, - 0472D25415A26D8100F7AD9A /* zip_reader_ctocpp.h */, - ); - path = ctocpp; - sourceTree = ""; - }; - 0472D25715A26D8100F7AD9A /* wrapper */ = { - isa = PBXGroup; - children = ( - 0472D25815A26D8100F7AD9A /* cef_byte_read_handler.cc */, - 0472D25915A26D8100F7AD9A /* cef_xml_object.cc */, - 0472D25A15A26D8100F7AD9A /* cef_zip_archive.cc */, - 0472D25B15A26D8100F7AD9A /* libcef_dll_wrapper.cc */, - 0472D25C15A26D8100F7AD9A /* libcef_dll_wrapper2.cc */, - ); - path = wrapper; - sourceTree = ""; - }; - 0487C90714FED5360045E5E3 = { - isa = PBXGroup; - children = ( - 0487C91C14FED5360045E5E3 /* Atom */, - 042180E71500266500DF25EA /* cef */, - 0487C91514FED5360045E5E3 /* frameworks */, - 0487C91314FED5360045E5E3 /* Products */, - ); - sourceTree = ""; - }; - 0487C91314FED5360045E5E3 /* Products */ = { - isa = PBXGroup; - children = ( - 0487C91214FED5360045E5E3 /* Atom.app */, - 0487CC8114FEDF990045E5E3 /* liblibcef_wrapper.a */, - ); - name = Products; - sourceTree = ""; - }; - 0487C91514FED5360045E5E3 /* frameworks */ = { - isa = PBXGroup; - children = ( - 0446DB6215C73BDA006756AF /* CocoaOniguruma.framework */, - 0472D16315A26C9400F7AD9A /* ffmpegsumo.so */, - 0472D16415A26C9400F7AD9A /* libcef.dylib */, - 04E1DDDC152A0941001A9D07 /* Sparkle.framework */, - 0487C91614FED5360045E5E3 /* Cocoa.framework */, - 0487C91814FED5360045E5E3 /* Other Frameworks */, - ); - name = frameworks; - sourceTree = ""; - }; - 0487C91814FED5360045E5E3 /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - 0487C91914FED5360045E5E3 /* AppKit.framework */, - 0487C91A14FED5360045E5E3 /* CoreData.framework */, - 0487C91B14FED5360045E5E3 /* Foundation.framework */, - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - 0487C91C14FED5360045E5E3 /* Atom */ = { - isa = PBXGroup; - children = ( - 0487C91D14FED5360045E5E3 /* Supporting Files */, - 0487C93B14FED6090045E5E3 /* src */, - ); - path = Atom; - sourceTree = ""; - }; - 0487C91D14FED5360045E5E3 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 0487D15E14FEE7880045E5E3 /* Resources */, - 0487C93414FED5FB0045E5E3 /* ClientWindow.xib */, - 0487C93614FED5FB0045E5E3 /* MainMenu.xib */, - 0487C93514FED5FB0045E5E3 /* Info.plist */, - 0415A1FD1524EC8A0075C91C /* atom.icns */, - 04F21A2615644AC10083F6D4 /* ResourceConfig.xcconfig */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 0487C93B14FED6090045E5E3 /* src */ = { - isa = PBXGroup; - children = ( - 0487C94214FED6090045E5E3 /* main.mm */, - 0487C93C14FED6090045E5E3 /* Atom.h */, - 0487C93D14FED6090045E5E3 /* Atom.mm */, - 0487C93E14FED6090045E5E3 /* AtomController.h */, - 0487C93F14FED6090045E5E3 /* AtomController.mm */, - 042180E614FF080D00DF25EA /* BrowserDelegate.h */, - 048A2FC5154870DC0051715C /* PathWatcher.h */, - 048A2FC6154870DC0051715C /* PathWatcher.mm */, - 0487C94014FED6090045E5E3 /* client_handler.h */, - 0487C94114FED6090045E5E3 /* client_handler.mm */, - 0487C94314FED6090045E5E3 /* native_handler.h */, - 0487C94414FED6090045E5E3 /* native_handler.mm */, - EC800C1815C72301007FD3CB /* OnigRegexpExtension.h */, - EC800C1A15C72378007FD3CB /* OnigRegexpExtension.mm */, - ); - path = src; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 0487C91114FED5360045E5E3 /* Atom */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0487C93014FED5370045E5E3 /* Build configuration list for PBXNativeTarget "Atom" */; - buildPhases = ( - 0487CD9914FEE1500045E5E3 /* Copy Required Chrome Frameworks */, - 0487CD9C14FEE17D0045E5E3 /* Copy Chrome Resources */, - 04E1DDDE152A09A8001A9D07 /* Copy Frameworks */, - 0487C90E14FED5360045E5E3 /* Sources */, - 0487C90F14FED5360045E5E3 /* Frameworks */, - 0487C91014FED5360045E5E3 /* Resources */, - 0487CDA114FEE1F30045E5E3 /* Postbuild "Change Mach-O Flags" */, - 0487CDA214FEE1F50045E5E3 /* Postbuild "Strip If Needed" */, - 0487CDA314FEE1F80045E5E3 /* Compile and Bundle CoffeeScript */, - ); - buildRules = ( - ); - dependencies = ( - 0487CD6A14FEE0BE0045E5E3 /* PBXTargetDependency */, - ); - name = Atom; - productName = Atom; - productReference = 0487C91214FED5360045E5E3 /* Atom.app */; - productType = "com.apple.product-type.application"; - }; - 0487CC8014FEDF990045E5E3 /* libcef_wrapper */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0487CC8214FEDF990045E5E3 /* Build configuration list for PBXNativeTarget "libcef_wrapper" */; - buildPhases = ( - 0487CC7D14FEDF990045E5E3 /* Sources */, - 0487CC7E14FEDF990045E5E3 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = libcef_wrapper; - productName = libcef_wrapper; - productReference = 0487CC8114FEDF990045E5E3 /* liblibcef_wrapper.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0487C90914FED5360045E5E3 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0420; - }; - buildConfigurationList = 0487C90C14FED5360045E5E3 /* Build configuration list for PBXProject "Atom" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 0487C90714FED5360045E5E3; - productRefGroup = 0487C91314FED5360045E5E3 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 0487C91114FED5360045E5E3 /* Atom */, - 0487CC8014FEDF990045E5E3 /* libcef_wrapper */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 0487C91014FED5360045E5E3 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0487C93814FED5FB0045E5E3 /* ClientWindow.xib in Resources */, - 0487C93A14FED5FB0045E5E3 /* MainMenu.xib in Resources */, - 0487D15F14FEE7880045E5E3 /* Resources in Resources */, - 0415A1FE1524EC8A0075C91C /* atom.icns in Resources */, - 0472D16515A26C9400F7AD9A /* ffmpegsumo.so in Resources */, - 0472D1E015A26D7600F7AD9A /* README-TRANSFER.txt in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 0487CDA114FEE1F30045E5E3 /* Postbuild "Change Mach-O Flags" */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", - ); - name = "Postbuild \"Change Mach-O Flags\""; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "exec cef/tools/change_mach_o_flags_from_xcode.sh\nexit 1\n"; - showEnvVarsInLog = 0; - }; - 0487CDA214FEE1F50045E5E3 /* Postbuild "Strip If Needed" */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", - ); - name = "Postbuild \"Strip If Needed\""; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "exec cef/tools/strip_from_xcode\nexit 1\n"; - showEnvVarsInLog = 0; - }; - 0487CDA314FEE1F80045E5E3 /* Compile and Bundle CoffeeScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Compile and Bundle CoffeeScript"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "rake copy-files-to-bundle\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 0487C90E14FED5360045E5E3 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0487CD9414FEE1330045E5E3 /* Atom.mm in Sources */, - 0487CD9514FEE1340045E5E3 /* AtomController.mm in Sources */, - 0487CD9614FEE1360045E5E3 /* client_handler.mm in Sources */, - 0487CD9714FEE1380045E5E3 /* main.mm in Sources */, - 0487CD9814FEE13B0045E5E3 /* native_handler.mm in Sources */, - 048A2FC7154870DC0051715C /* PathWatcher.mm in Sources */, - EC800C1B15C72378007FD3CB /* OnigRegexpExtension.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0487CC7D14FEDF990045E5E3 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0472D25D15A26D8100F7AD9A /* app_cpptoc.cc in Sources */, - 0472D25E15A26D8100F7AD9A /* client_cpptoc.cc in Sources */, - 0472D25F15A26D8100F7AD9A /* content_filter_cpptoc.cc in Sources */, - 0472D26015A26D8100F7AD9A /* cookie_visitor_cpptoc.cc in Sources */, - 0472D26115A26D8100F7AD9A /* display_handler_cpptoc.cc in Sources */, - 0472D26215A26D8100F7AD9A /* domevent_listener_cpptoc.cc in Sources */, - 0472D26315A26D8100F7AD9A /* domvisitor_cpptoc.cc in Sources */, - 0472D26415A26D8100F7AD9A /* download_handler_cpptoc.cc in Sources */, - 0472D26515A26D8100F7AD9A /* drag_handler_cpptoc.cc in Sources */, - 0472D26615A26D8100F7AD9A /* find_handler_cpptoc.cc in Sources */, - 0472D26715A26D8100F7AD9A /* focus_handler_cpptoc.cc in Sources */, - 0472D26815A26D8100F7AD9A /* jsdialog_handler_cpptoc.cc in Sources */, - 0472D26915A26D8100F7AD9A /* keyboard_handler_cpptoc.cc in Sources */, - 0472D26A15A26D8100F7AD9A /* life_span_handler_cpptoc.cc in Sources */, - 0472D26B15A26D8100F7AD9A /* load_handler_cpptoc.cc in Sources */, - 0472D26C15A26D8100F7AD9A /* menu_handler_cpptoc.cc in Sources */, - 0472D26D15A26D8100F7AD9A /* permission_handler_cpptoc.cc in Sources */, - 0472D26E15A26D8100F7AD9A /* print_handler_cpptoc.cc in Sources */, - 0472D26F15A26D8100F7AD9A /* proxy_handler_cpptoc.cc in Sources */, - 0472D27015A26D8100F7AD9A /* read_handler_cpptoc.cc in Sources */, - 0472D27115A26D8100F7AD9A /* render_handler_cpptoc.cc in Sources */, - 0472D27215A26D8100F7AD9A /* request_handler_cpptoc.cc in Sources */, - 0472D27315A26D8100F7AD9A /* resource_bundle_handler_cpptoc.cc in Sources */, - 0472D27415A26D8100F7AD9A /* scheme_handler_cpptoc.cc in Sources */, - 0472D27515A26D8100F7AD9A /* scheme_handler_factory_cpptoc.cc in Sources */, - 0472D27615A26D8100F7AD9A /* storage_visitor_cpptoc.cc in Sources */, - 0472D27715A26D8100F7AD9A /* task_cpptoc.cc in Sources */, - 0472D27815A26D8100F7AD9A /* v8accessor_cpptoc.cc in Sources */, - 0472D27915A26D8100F7AD9A /* v8context_handler_cpptoc.cc in Sources */, - 0472D27A15A26D8100F7AD9A /* v8handler_cpptoc.cc in Sources */, - 0472D27B15A26D8100F7AD9A /* web_urlrequest_client_cpptoc.cc in Sources */, - 0472D27C15A26D8100F7AD9A /* write_handler_cpptoc.cc in Sources */, - 0472D27D15A26D8100F7AD9A /* browser_ctocpp.cc in Sources */, - 0472D27E15A26D8100F7AD9A /* command_line_ctocpp.cc in Sources */, - 0472D27F15A26D8100F7AD9A /* cookie_manager_ctocpp.cc in Sources */, - 0472D28015A26D8100F7AD9A /* domdocument_ctocpp.cc in Sources */, - 0472D28115A26D8100F7AD9A /* domevent_ctocpp.cc in Sources */, - 0472D28215A26D8100F7AD9A /* domnode_ctocpp.cc in Sources */, - 0472D28315A26D8100F7AD9A /* drag_data_ctocpp.cc in Sources */, - 0472D28415A26D8100F7AD9A /* frame_ctocpp.cc in Sources */, - 0472D28515A26D8100F7AD9A /* post_data_ctocpp.cc in Sources */, - 0472D28615A26D8100F7AD9A /* post_data_element_ctocpp.cc in Sources */, - 0472D28715A26D8100F7AD9A /* request_ctocpp.cc in Sources */, - 0472D28815A26D8100F7AD9A /* response_ctocpp.cc in Sources */, - 0472D28915A26D8100F7AD9A /* scheme_handler_callback_ctocpp.cc in Sources */, - 0472D28A15A26D8100F7AD9A /* stream_reader_ctocpp.cc in Sources */, - 0472D28B15A26D8100F7AD9A /* stream_writer_ctocpp.cc in Sources */, - 0472D28C15A26D8100F7AD9A /* v8context_ctocpp.cc in Sources */, - 0472D28D15A26D8100F7AD9A /* v8exception_ctocpp.cc in Sources */, - 0472D28E15A26D8100F7AD9A /* v8value_ctocpp.cc in Sources */, - 0472D28F15A26D8100F7AD9A /* web_plugin_info_ctocpp.cc in Sources */, - 0472D29015A26D8100F7AD9A /* web_urlrequest_ctocpp.cc in Sources */, - 0472D29115A26D8100F7AD9A /* xml_reader_ctocpp.cc in Sources */, - 0472D29215A26D8100F7AD9A /* zip_reader_ctocpp.cc in Sources */, - 0472D29315A26D8100F7AD9A /* transfer_util.cpp in Sources */, - 0472D29415A26D8100F7AD9A /* cef_byte_read_handler.cc in Sources */, - 0472D29515A26D8100F7AD9A /* cef_xml_object.cc in Sources */, - 0472D29615A26D8100F7AD9A /* cef_zip_archive.cc in Sources */, - 0472D29715A26D8100F7AD9A /* libcef_dll_wrapper.cc in Sources */, - 0472D29815A26D8100F7AD9A /* libcef_dll_wrapper2.cc in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 0487CD6A14FEE0BE0045E5E3 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0487CC8014FEDF990045E5E3 /* libcef_wrapper */; - targetProxy = 0487CD6914FEE0BE0045E5E3 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 0487C92E14FED5370045E5E3 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_WARN_CXX0X_EXTENSIONS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_INLINES_ARE_PRIVATE_EXTERN = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "LOAD_RESOURCES_FROM_DIR=\"\\\"$LOAD_RESOURCES_FROM_DIR\\\"\"", - "\"ENABLE_REMOTING=1\"", - "\"ENABLE_P2P_APIS=1\"", - "\"ENABLE_CONFIGURATION_POLICY\"", - "\"ENABLE_INPUT_SPEECH\"", - "\"ENABLE_NOTIFICATIONS\"", - "\"ENABLE_GPU=1\"", - "\"ENABLE_EGLIMAGE=1\"", - "\"ENABLE_REGISTER_PROTOCOL_HANDLER=1\"", - "\"USING_CEF_SHARED\"", - "\"__STDC_FORMAT_MACROS\"", - NDEBUG, - "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", - "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_THREADSAFE_STATICS = NO; - GCC_VERSION = ""; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; - SDKROOT = macosx; - }; - name = Debug; - }; - 0487C92F14FED5370045E5E3 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_WARN_CXX0X_EXTENSIONS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_INLINES_ARE_PRIVATE_EXTERN = YES; - GCC_OPTIMIZATION_LEVEL = 3; - GCC_PREPROCESSOR_DEFINITIONS = ( - "\"CHROMIUM_BUILD\"", - "\"ENABLE_REMOTING=1\"", - "\"ENABLE_P2P_APIS=1\"", - "\"ENABLE_CONFIGURATION_POLICY\"", - "\"ENABLE_INPUT_SPEECH\"", - "\"ENABLE_NOTIFICATIONS\"", - "\"ENABLE_GPU=1\"", - "\"ENABLE_EGLIMAGE=1\"", - "\"ENABLE_REGISTER_PROTOCOL_HANDLER=1\"", - "\"USING_CEF_SHARED\"", - "\"__STDC_FORMAT_MACROS\"", - "\"NDEBUG\"", - "\"NVALGRIND\"", - "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", - ); - GCC_THREADSAFE_STATICS = NO; - GCC_VERSION = ""; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; - SDKROOT = macosx; - }; - name = Release; - }; - 0487C93114FED5370045E5E3 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 04F21A2615644AC10083F6D4 /* ResourceConfig.xcconfig */; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"/Users/corey/Library/Developer/Xcode/DerivedData/Sparkle-ftepbhaguzgxioeogeexiypemrim/Build/Products/Debug\"", - "\"$(SRCROOT)\"", - "\"$(SRCROOT)/frameworks\"", - ); - GCC_CW_ASM_SYNTAX = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_CPP_EXCEPTIONS = NO; - GCC_ENABLE_CPP_RTTI = NO; - GCC_ENABLE_PASCAL_STRINGS = NO; - GCC_OBJC_CALL_CXX_CDTORS = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - HEADER_SEARCH_PATHS = "\"$(SRCROOT)/cef\""; - INFOPLIST_FILE = Atom/Info.plist; - LIBRARY_SEARCH_PATHS = ( - "$(SDKROOT)/System/Library/Frameworks", - "\"$(SRCROOT)/frameworks\"", - "\"$(SDKROOT)/usr/lib/system\"", - ); - OTHER_CFLAGS = ( - "-fno-strict-aliasing", - "-fstack-protector-all", - ); - OTHER_LDFLAGS = ( - "-Wl,-search_paths_first", - "-Wl,-ObjC", - "-Wl,-pie", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - USE_HEADERMAP = NO; - WARNING_CFLAGS = ( - "-Wall", - "-Wendif-labels", - "-Wextra", - "-Wno-unused-parameter", - "-Wno-missing-field-initializers", - ); - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - 0487C93214FED5370045E5E3 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEAD_CODE_STRIPPING = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"/Users/corey/Library/Developer/Xcode/DerivedData/Sparkle-ftepbhaguzgxioeogeexiypemrim/Build/Products/Debug\"", - "\"$(SRCROOT)\"", - "\"$(SRCROOT)/frameworks\"", - ); - GCC_CW_ASM_SYNTAX = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_CPP_EXCEPTIONS = NO; - GCC_ENABLE_CPP_RTTI = NO; - GCC_ENABLE_PASCAL_STRINGS = NO; - GCC_OBJC_CALL_CXX_CDTORS = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - HEADER_SEARCH_PATHS = "\"$(SRCROOT)/cef\""; - INFOPLIST_FILE = Atom/Info.plist; - LIBRARY_SEARCH_PATHS = ( - "$(SDKROOT)/System/Library/Frameworks", - "\"$(SRCROOT)/frameworks\"", - "\"$(SDKROOT)/usr/lib/system\"", - ); - OTHER_CFLAGS = "-fno-strict-aliasing"; - OTHER_LDFLAGS = ( - "-Wl,-search_paths_first", - "-Wl,-ObjC", - "-Wl,-pie", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - USE_HEADERMAP = NO; - WARNING_CFLAGS = ( - "-Wall", - "-Wendif-labels", - "-Wextra", - "-Wno-unused-parameter", - "-Wno-missing-field-initializers", - ); - WRAPPER_EXTENSION = app; - }; - name = Release; - }; - 0487CC8314FEDF990045E5E3 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_WARN_CXX0X_EXTENSIONS = NO; - EXECUTABLE_PREFIX = lib; - GCC_CW_ASM_SYNTAX = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_CPP_EXCEPTIONS = NO; - GCC_ENABLE_CPP_RTTI = NO; - GCC_ENABLE_PASCAL_STRINGS = NO; - GCC_OBJC_CALL_CXX_CDTORS = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - HEADER_SEARCH_PATHS = "\"$(SRCROOT)/cef\""; - ONLY_ACTIVE_ARCH = YES; - OTHER_CFLAGS = ( - "-fno-strict-aliasing", - "-fstack-protector-all", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - USE_HEADERMAP = NO; - WARNING_CFLAGS = ( - "-Wall", - "-Wendif-labels", - "-Wextra", - "-Wno-unused-parameter", - "-Wno-missing-field-initializers", - ); - }; - name = Debug; - }; - 0487CC8414FEDF990045E5E3 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_WARN_CXX0X_EXTENSIONS = NO; - EXECUTABLE_PREFIX = lib; - GCC_CW_ASM_SYNTAX = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_CPP_EXCEPTIONS = NO; - GCC_ENABLE_CPP_RTTI = NO; - GCC_ENABLE_PASCAL_STRINGS = NO; - GCC_OBJC_CALL_CXX_CDTORS = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - HEADER_SEARCH_PATHS = "\"$(SRCROOT)/cef\""; - OTHER_CFLAGS = ( - "-fno-strict-aliasing", - "-fstack-protector-all", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - USE_HEADERMAP = NO; - WARNING_CFLAGS = ( - "-Wall", - "-Wendif-labels", - "-Wextra", - "-Wno-unused-parameter", - "-Wno-missing-field-initializers", - ); - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 0487C90C14FED5360045E5E3 /* Build configuration list for PBXProject "Atom" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0487C92E14FED5370045E5E3 /* Debug */, - 0487C92F14FED5370045E5E3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0487C93014FED5370045E5E3 /* Build configuration list for PBXNativeTarget "Atom" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0487C93114FED5370045E5E3 /* Debug */, - 0487C93214FED5370045E5E3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0487CC8214FEDF990045E5E3 /* Build configuration list for PBXNativeTarget "libcef_wrapper" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0487CC8314FEDF990045E5E3 /* Debug */, - 0487CC8414FEDF990045E5E3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0487C90914FED5360045E5E3 /* Project object */; -} diff --git a/Atom.xcodeproj/xcshareddata/xcschemes/atom-debug-test.xcscheme b/Atom.xcodeproj/xcshareddata/xcschemes/atom-debug-test.xcscheme deleted file mode 100644 index 0e7d1aa86..000000000 --- a/Atom.xcodeproj/xcshareddata/xcschemes/atom-debug-test.xcscheme +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Atom.xcodeproj/xcshareddata/xcschemes/atom-debug.xcscheme b/Atom.xcodeproj/xcshareddata/xcschemes/atom-debug.xcscheme deleted file mode 100644 index b7620e646..000000000 --- a/Atom.xcodeproj/xcshareddata/xcschemes/atom-debug.xcscheme +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Atom.xcodeproj/xcshareddata/xcschemes/atom-release.xcscheme b/Atom.xcodeproj/xcshareddata/xcschemes/atom-release.xcscheme deleted file mode 100644 index 9740ad880..000000000 --- a/Atom.xcodeproj/xcshareddata/xcschemes/atom-release.xcscheme +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Atom/ClientWindow.xib b/Atom/ClientWindow.xib deleted file mode 100644 index bc44e6c72..000000000 --- a/Atom/ClientWindow.xib +++ /dev/null @@ -1,285 +0,0 @@ - - - - 1070 - 11E53 - 2182 - 1138.47 - 569.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 2182 - - - YES - NSCustomView - NSWindowTemplate - NSView - NSCustomObject - NSSplitView - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - AtomController - - - FirstResponder - - - NSApplication - - - 15 - 2 - {{1706, 426}, {699, 805}} - 540017664 - - NSWindow - - - - - 256 - - YES - - - 274 - - YES - - - 256 - {699, 805} - - - - _NS:11 - NSView - - - {699, 805} - - - - _NS:9 - 2 - - - {699, 805} - - - - - {{0, 0}, {2560, 1418}} - {10000000000000, 10000000000000} - NO - - - - - YES - - - window - - - - 3 - - - - webView - - - - 9 - - - - splitView - - - - 10 - - - - - YES - - 0 - - YES - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 1 - - - YES - - - - - - 2 - - - YES - - - - - - 5 - - - YES - - - - - - 6 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 1.IBNSWindowAutoPositionCentersHorizontal - 1.IBNSWindowAutoPositionCentersVertical - 1.IBPluginDependency - 1.IBWindowTemplateEditedContentRect - 1.NSWindowTemplate.visibleAtLaunch - 2.IBPluginDependency - 5.IBPluginDependency - 6.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - com.apple.InterfaceBuilder.CocoaPlugin - {{357, 418}, {480, 270}} - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - - - - YES - - - - - 10 - - - - YES - - AtomController - NSWindowController - - YES - - YES - devToolsView - splitView - webView - - - YES - NSView - NSSplitView - NSView - - - - YES - - YES - devToolsView - splitView - webView - - - YES - - devToolsView - NSView - - - splitView - NSSplitView - - - webView - NSView - - - - - IBProjectSource - ./Classes/AtomController.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - diff --git a/Atom/Info.plist b/Atom/Info.plist deleted file mode 100755 index bc17243e9..000000000 --- a/Atom/Info.plist +++ /dev/null @@ -1,42 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDisplayName - Atom - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleGetInfoString - - CFBundleIconFile - atom.icns - CFBundleIdentifier - com.github.atom-osx - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 0.0.1 - CFBundleSignature - ???? - CFBundleVersion - 0.0.1 - LSApplicationCategoryType - public.app-category.developer-tools - NSHumanReadableCopyright - GitHub Inc. - NSMainNibFile - MainMenu - NSPrincipalClass - Atom - SUFeedURL - https://speakeasy.githubapp.com/apps/com.github.atom-osx/appcast.xml - SUPublicDSAKeyFile - dsa_pub.pem - - diff --git a/Atom/MainMenu.xib b/Atom/MainMenu.xib deleted file mode 100755 index 5498459d3..000000000 --- a/Atom/MainMenu.xib +++ /dev/null @@ -1,297 +0,0 @@ - - - - 1050 - 11C74 - 1938 - 1138.23 - 567.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 1938 - - - YES - NSUserDefaultsController - NSMenu - NSMenuItem - NSCustomObject - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - ClientApplication - - - FirstResponder - - - Atom - - - AMainMenu - - YES - - - Atom - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - Atom - - YES - - - Run Specs - s - 1835008 - 2147483647 - - - - - - Run Benchmarks - b - 1835008 - 2147483647 - - - - - - Quit - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - _NSMainMenu - - - YES - - - SUUpdater - - - - - YES - - - delegate - - - - 440 - - - - stop: - - - - 447 - - - - runSpecs: - - - - 449 - - - - runBenchmarks: - - - - 452 - - - - - YES - - 0 - - YES - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - YES - - - - MainMenu - - - 56 - - - YES - - - - - - 57 - - - YES - - - - - - - - 58 - - - - - 389 - - - - - 441 - - - - - 450 - - - - - 453 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 29.IBPluginDependency - 389.IBPluginDependency - 441.IBPluginDependency - 450.IBPluginDependency - 453.IBPluginDependency - 56.IBPluginDependency - 57.IBPluginDependency - 58.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - - - - YES - - - - - 453 - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - - - YES - {9, 8} - {7, 2} - - - - diff --git a/Atom/ResourceConfig.xcconfig b/Atom/ResourceConfig.xcconfig deleted file mode 100644 index 338820c2c..000000000 --- a/Atom/ResourceConfig.xcconfig +++ /dev/null @@ -1 +0,0 @@ -LOAD_RESOURCES_FROM_DIR=$PROJECT_DIR \ No newline at end of file diff --git a/Atom/Resources/aliasCursor.png b/Atom/Resources/aliasCursor.png deleted file mode 100644 index d33d7e98f..000000000 Binary files a/Atom/Resources/aliasCursor.png and /dev/null differ diff --git a/Atom/Resources/am.lproj/locale.pak b/Atom/Resources/am.lproj/locale.pak deleted file mode 100644 index 2a2c297e1..000000000 Binary files a/Atom/Resources/am.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/ar.lproj/locale.pak b/Atom/Resources/ar.lproj/locale.pak deleted file mode 100644 index ee33da505..000000000 Binary files a/Atom/Resources/ar.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/bg.lproj/locale.pak b/Atom/Resources/bg.lproj/locale.pak deleted file mode 100644 index 12c319ee8..000000000 Binary files a/Atom/Resources/bg.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/bn.lproj/locale.pak b/Atom/Resources/bn.lproj/locale.pak deleted file mode 100644 index 7ab9457cb..000000000 Binary files a/Atom/Resources/bn.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/ca.lproj/locale.pak b/Atom/Resources/ca.lproj/locale.pak deleted file mode 100644 index 83b5ab17a..000000000 Binary files a/Atom/Resources/ca.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/cellCursor.png b/Atom/Resources/cellCursor.png deleted file mode 100644 index 5c616c47b..000000000 Binary files a/Atom/Resources/cellCursor.png and /dev/null differ diff --git a/Atom/Resources/chrome.pak b/Atom/Resources/chrome.pak deleted file mode 100644 index e6bcdc36a..000000000 Binary files a/Atom/Resources/chrome.pak and /dev/null differ diff --git a/Atom/Resources/contextMenuCursor.png b/Atom/Resources/contextMenuCursor.png deleted file mode 100644 index ae100c7ea..000000000 Binary files a/Atom/Resources/contextMenuCursor.png and /dev/null differ diff --git a/Atom/Resources/copyCursor.png b/Atom/Resources/copyCursor.png deleted file mode 100644 index 33be332bb..000000000 Binary files a/Atom/Resources/copyCursor.png and /dev/null differ diff --git a/Atom/Resources/cs.lproj/locale.pak b/Atom/Resources/cs.lproj/locale.pak deleted file mode 100644 index ebef97f6b..000000000 Binary files a/Atom/Resources/cs.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/da.lproj/locale.pak b/Atom/Resources/da.lproj/locale.pak deleted file mode 100644 index ef08a52b6..000000000 Binary files a/Atom/Resources/da.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/de.lproj/locale.pak b/Atom/Resources/de.lproj/locale.pak deleted file mode 100644 index 2f9bfadc6..000000000 Binary files a/Atom/Resources/de.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/deleteButton.png b/Atom/Resources/deleteButton.png deleted file mode 100644 index 67e2240c5..000000000 Binary files a/Atom/Resources/deleteButton.png and /dev/null differ diff --git a/Atom/Resources/deleteButton.tiff b/Atom/Resources/deleteButton.tiff deleted file mode 100644 index bf4347ef6..000000000 Binary files a/Atom/Resources/deleteButton.tiff and /dev/null differ diff --git a/Atom/Resources/deleteButton@2x.png b/Atom/Resources/deleteButton@2x.png deleted file mode 100644 index e6046d475..000000000 Binary files a/Atom/Resources/deleteButton@2x.png and /dev/null differ diff --git a/Atom/Resources/deleteButtonPressed.png b/Atom/Resources/deleteButtonPressed.png deleted file mode 100644 index 2dbd13df4..000000000 Binary files a/Atom/Resources/deleteButtonPressed.png and /dev/null differ diff --git a/Atom/Resources/deleteButtonPressed.tiff b/Atom/Resources/deleteButtonPressed.tiff deleted file mode 100644 index 6232484d6..000000000 Binary files a/Atom/Resources/deleteButtonPressed.tiff and /dev/null differ diff --git a/Atom/Resources/deleteButtonPressed@2x.png b/Atom/Resources/deleteButtonPressed@2x.png deleted file mode 100644 index 3c999a7db..000000000 Binary files a/Atom/Resources/deleteButtonPressed@2x.png and /dev/null differ diff --git a/Atom/Resources/eastResizeCursor.png b/Atom/Resources/eastResizeCursor.png deleted file mode 100644 index 9c1592e5d..000000000 Binary files a/Atom/Resources/eastResizeCursor.png and /dev/null differ diff --git a/Atom/Resources/eastWestResizeCursor.png b/Atom/Resources/eastWestResizeCursor.png deleted file mode 100644 index f43202ef5..000000000 Binary files a/Atom/Resources/eastWestResizeCursor.png and /dev/null differ diff --git a/Atom/Resources/el.lproj/locale.pak b/Atom/Resources/el.lproj/locale.pak deleted file mode 100644 index 2d2bb8658..000000000 Binary files a/Atom/Resources/el.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/en.lproj/locale.pak b/Atom/Resources/en.lproj/locale.pak deleted file mode 100644 index 00fc0cba9..000000000 Binary files a/Atom/Resources/en.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/en_GB.lproj/locale.pak b/Atom/Resources/en_GB.lproj/locale.pak deleted file mode 100644 index ffae444d5..000000000 Binary files a/Atom/Resources/en_GB.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/es.lproj/locale.pak b/Atom/Resources/es.lproj/locale.pak deleted file mode 100644 index 079101de5..000000000 Binary files a/Atom/Resources/es.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/es_419.lproj/locale.pak b/Atom/Resources/es_419.lproj/locale.pak deleted file mode 100644 index 189e40133..000000000 Binary files a/Atom/Resources/es_419.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/et.lproj/locale.pak b/Atom/Resources/et.lproj/locale.pak deleted file mode 100644 index 347d29553..000000000 Binary files a/Atom/Resources/et.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/fa.lproj/locale.pak b/Atom/Resources/fa.lproj/locale.pak deleted file mode 100644 index 8e7b1015d..000000000 Binary files a/Atom/Resources/fa.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/fi.lproj/locale.pak b/Atom/Resources/fi.lproj/locale.pak deleted file mode 100644 index 84beb4bfd..000000000 Binary files a/Atom/Resources/fi.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/fil.lproj/locale.pak b/Atom/Resources/fil.lproj/locale.pak deleted file mode 100644 index 7df4fbeec..000000000 Binary files a/Atom/Resources/fil.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/fr.lproj/locale.pak b/Atom/Resources/fr.lproj/locale.pak deleted file mode 100644 index 81da33676..000000000 Binary files a/Atom/Resources/fr.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/gu.lproj/locale.pak b/Atom/Resources/gu.lproj/locale.pak deleted file mode 100644 index 59372ed47..000000000 Binary files a/Atom/Resources/gu.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/he.lproj/locale.pak b/Atom/Resources/he.lproj/locale.pak deleted file mode 100644 index 08266e4f8..000000000 Binary files a/Atom/Resources/he.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/helpCursor.png b/Atom/Resources/helpCursor.png deleted file mode 100644 index 6828d6a4d..000000000 Binary files a/Atom/Resources/helpCursor.png and /dev/null differ diff --git a/Atom/Resources/hi.lproj/locale.pak b/Atom/Resources/hi.lproj/locale.pak deleted file mode 100644 index 560ff5719..000000000 Binary files a/Atom/Resources/hi.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/hr.lproj/locale.pak b/Atom/Resources/hr.lproj/locale.pak deleted file mode 100644 index 36a837c81..000000000 Binary files a/Atom/Resources/hr.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/hu.lproj/locale.pak b/Atom/Resources/hu.lproj/locale.pak deleted file mode 100644 index 3ccdadcd9..000000000 Binary files a/Atom/Resources/hu.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/id.lproj/locale.pak b/Atom/Resources/id.lproj/locale.pak deleted file mode 100644 index 0379f7901..000000000 Binary files a/Atom/Resources/id.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/inputSpeech.png b/Atom/Resources/inputSpeech.png deleted file mode 100644 index 8a5c469da..000000000 Binary files a/Atom/Resources/inputSpeech.png and /dev/null differ diff --git a/Atom/Resources/inputSpeech.tiff b/Atom/Resources/inputSpeech.tiff deleted file mode 100644 index 11ba12959..000000000 Binary files a/Atom/Resources/inputSpeech.tiff and /dev/null differ diff --git a/Atom/Resources/it.lproj/locale.pak b/Atom/Resources/it.lproj/locale.pak deleted file mode 100644 index ae7391676..000000000 Binary files a/Atom/Resources/it.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/ja.lproj/locale.pak b/Atom/Resources/ja.lproj/locale.pak deleted file mode 100644 index 9f017d514..000000000 Binary files a/Atom/Resources/ja.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/kn.lproj/locale.pak b/Atom/Resources/kn.lproj/locale.pak deleted file mode 100644 index aeebfbd9b..000000000 Binary files a/Atom/Resources/kn.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/ko.lproj/locale.pak b/Atom/Resources/ko.lproj/locale.pak deleted file mode 100644 index 4efeafba7..000000000 Binary files a/Atom/Resources/ko.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/linkCursor.png b/Atom/Resources/linkCursor.png deleted file mode 100644 index e5e274936..000000000 Binary files a/Atom/Resources/linkCursor.png and /dev/null differ diff --git a/Atom/Resources/lt.lproj/locale.pak b/Atom/Resources/lt.lproj/locale.pak deleted file mode 100644 index 7f46ba25a..000000000 Binary files a/Atom/Resources/lt.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/lv.lproj/locale.pak b/Atom/Resources/lv.lproj/locale.pak deleted file mode 100644 index c1909e0c9..000000000 Binary files a/Atom/Resources/lv.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/missingImage.png b/Atom/Resources/missingImage.png deleted file mode 100644 index 5c24d20c2..000000000 Binary files a/Atom/Resources/missingImage.png and /dev/null differ diff --git a/Atom/Resources/missingImage.tiff b/Atom/Resources/missingImage.tiff deleted file mode 100644 index bfde916ea..000000000 Binary files a/Atom/Resources/missingImage.tiff and /dev/null differ diff --git a/Atom/Resources/missingImage@2x.png b/Atom/Resources/missingImage@2x.png deleted file mode 100644 index 6573d1747..000000000 Binary files a/Atom/Resources/missingImage@2x.png and /dev/null differ diff --git a/Atom/Resources/ml.lproj/locale.pak b/Atom/Resources/ml.lproj/locale.pak deleted file mode 100644 index 232fa0df1..000000000 Binary files a/Atom/Resources/ml.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/moveCursor.png b/Atom/Resources/moveCursor.png deleted file mode 100644 index 4ca8d7037..000000000 Binary files a/Atom/Resources/moveCursor.png and /dev/null differ diff --git a/Atom/Resources/mr.lproj/locale.pak b/Atom/Resources/mr.lproj/locale.pak deleted file mode 100644 index efb781326..000000000 Binary files a/Atom/Resources/mr.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/ms.lproj/locale.pak b/Atom/Resources/ms.lproj/locale.pak deleted file mode 100644 index c4726ea56..000000000 Binary files a/Atom/Resources/ms.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/nb.lproj/locale.pak b/Atom/Resources/nb.lproj/locale.pak deleted file mode 100644 index 5a2710652..000000000 Binary files a/Atom/Resources/nb.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/nl.lproj/locale.pak b/Atom/Resources/nl.lproj/locale.pak deleted file mode 100644 index 84b2ba641..000000000 Binary files a/Atom/Resources/nl.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/noDropCursor.png b/Atom/Resources/noDropCursor.png deleted file mode 100644 index 54463fc0c..000000000 Binary files a/Atom/Resources/noDropCursor.png and /dev/null differ diff --git a/Atom/Resources/noneCursor.png b/Atom/Resources/noneCursor.png deleted file mode 100644 index bd1ff356f..000000000 Binary files a/Atom/Resources/noneCursor.png and /dev/null differ diff --git a/Atom/Resources/northEastResizeCursor.png b/Atom/Resources/northEastResizeCursor.png deleted file mode 100644 index 0e8963907..000000000 Binary files a/Atom/Resources/northEastResizeCursor.png and /dev/null differ diff --git a/Atom/Resources/northEastSouthWestResizeCursor.png b/Atom/Resources/northEastSouthWestResizeCursor.png deleted file mode 100644 index 9904c7b61..000000000 Binary files a/Atom/Resources/northEastSouthWestResizeCursor.png and /dev/null differ diff --git a/Atom/Resources/northResizeCursor.png b/Atom/Resources/northResizeCursor.png deleted file mode 100644 index 0d020dbab..000000000 Binary files a/Atom/Resources/northResizeCursor.png and /dev/null differ diff --git a/Atom/Resources/northSouthResizeCursor.png b/Atom/Resources/northSouthResizeCursor.png deleted file mode 100644 index 92400e919..000000000 Binary files a/Atom/Resources/northSouthResizeCursor.png and /dev/null differ diff --git a/Atom/Resources/northWestResizeCursor.png b/Atom/Resources/northWestResizeCursor.png deleted file mode 100644 index 6723f614a..000000000 Binary files a/Atom/Resources/northWestResizeCursor.png and /dev/null differ diff --git a/Atom/Resources/northWestSouthEastResizeCursor.png b/Atom/Resources/northWestSouthEastResizeCursor.png deleted file mode 100644 index b8de34ce7..000000000 Binary files a/Atom/Resources/northWestSouthEastResizeCursor.png and /dev/null differ diff --git a/Atom/Resources/nullPlugin.png b/Atom/Resources/nullPlugin.png deleted file mode 100644 index a4195f67d..000000000 Binary files a/Atom/Resources/nullPlugin.png and /dev/null differ diff --git a/Atom/Resources/nullPlugin@2x.png b/Atom/Resources/nullPlugin@2x.png deleted file mode 100644 index ccc40188a..000000000 Binary files a/Atom/Resources/nullPlugin@2x.png and /dev/null differ diff --git a/Atom/Resources/panIcon.png b/Atom/Resources/panIcon.png deleted file mode 100644 index 4ca8d7037..000000000 Binary files a/Atom/Resources/panIcon.png and /dev/null differ diff --git a/Atom/Resources/pl.lproj/locale.pak b/Atom/Resources/pl.lproj/locale.pak deleted file mode 100644 index dc266dcfa..000000000 Binary files a/Atom/Resources/pl.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/progressCursor.png b/Atom/Resources/progressCursor.png deleted file mode 100644 index 25d702143..000000000 Binary files a/Atom/Resources/progressCursor.png and /dev/null differ diff --git a/Atom/Resources/pt_BR.lproj/locale.pak b/Atom/Resources/pt_BR.lproj/locale.pak deleted file mode 100644 index 92ef1bc41..000000000 Binary files a/Atom/Resources/pt_BR.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/pt_PT.lproj/locale.pak b/Atom/Resources/pt_PT.lproj/locale.pak deleted file mode 100644 index 985253960..000000000 Binary files a/Atom/Resources/pt_PT.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/ro.lproj/locale.pak b/Atom/Resources/ro.lproj/locale.pak deleted file mode 100644 index c1d813037..000000000 Binary files a/Atom/Resources/ro.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/ru.lproj/locale.pak b/Atom/Resources/ru.lproj/locale.pak deleted file mode 100644 index 092d1bc8e..000000000 Binary files a/Atom/Resources/ru.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/sk.lproj/locale.pak b/Atom/Resources/sk.lproj/locale.pak deleted file mode 100644 index 6bbcb4b3c..000000000 Binary files a/Atom/Resources/sk.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/sl.lproj/locale.pak b/Atom/Resources/sl.lproj/locale.pak deleted file mode 100644 index c1531bd3c..000000000 Binary files a/Atom/Resources/sl.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/southEastResizeCursor.png b/Atom/Resources/southEastResizeCursor.png deleted file mode 100644 index 415aa633b..000000000 Binary files a/Atom/Resources/southEastResizeCursor.png and /dev/null differ diff --git a/Atom/Resources/southResizeCursor.png b/Atom/Resources/southResizeCursor.png deleted file mode 100644 index 60cf722d1..000000000 Binary files a/Atom/Resources/southResizeCursor.png and /dev/null differ diff --git a/Atom/Resources/southWestResizeCursor.png b/Atom/Resources/southWestResizeCursor.png deleted file mode 100644 index 8dc5cdc58..000000000 Binary files a/Atom/Resources/southWestResizeCursor.png and /dev/null differ diff --git a/Atom/Resources/sr.lproj/locale.pak b/Atom/Resources/sr.lproj/locale.pak deleted file mode 100644 index a40b832a9..000000000 Binary files a/Atom/Resources/sr.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/sv.lproj/locale.pak b/Atom/Resources/sv.lproj/locale.pak deleted file mode 100644 index 2c9ca481f..000000000 Binary files a/Atom/Resources/sv.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/sw.lproj/locale.pak b/Atom/Resources/sw.lproj/locale.pak deleted file mode 100644 index d25471ba3..000000000 Binary files a/Atom/Resources/sw.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/ta.lproj/locale.pak b/Atom/Resources/ta.lproj/locale.pak deleted file mode 100644 index bcaf24918..000000000 Binary files a/Atom/Resources/ta.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/te.lproj/locale.pak b/Atom/Resources/te.lproj/locale.pak deleted file mode 100644 index 1cb71d11e..000000000 Binary files a/Atom/Resources/te.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/textAreaResizeCorner.png b/Atom/Resources/textAreaResizeCorner.png deleted file mode 100644 index 66105dbcd..000000000 Binary files a/Atom/Resources/textAreaResizeCorner.png and /dev/null differ diff --git a/Atom/Resources/textAreaResizeCorner.tiff b/Atom/Resources/textAreaResizeCorner.tiff deleted file mode 100644 index 5eeab606a..000000000 Binary files a/Atom/Resources/textAreaResizeCorner.tiff and /dev/null differ diff --git a/Atom/Resources/textAreaResizeCorner@2x.png b/Atom/Resources/textAreaResizeCorner@2x.png deleted file mode 100644 index 7d26fbc42..000000000 Binary files a/Atom/Resources/textAreaResizeCorner@2x.png and /dev/null differ diff --git a/Atom/Resources/th.lproj/locale.pak b/Atom/Resources/th.lproj/locale.pak deleted file mode 100644 index 74aee32d3..000000000 Binary files a/Atom/Resources/th.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/tr.lproj/locale.pak b/Atom/Resources/tr.lproj/locale.pak deleted file mode 100644 index f7778c9c4..000000000 Binary files a/Atom/Resources/tr.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/uk.lproj/locale.pak b/Atom/Resources/uk.lproj/locale.pak deleted file mode 100644 index 8cf655451..000000000 Binary files a/Atom/Resources/uk.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/urlIcon.png b/Atom/Resources/urlIcon.png deleted file mode 100644 index 53cb35451..000000000 Binary files a/Atom/Resources/urlIcon.png and /dev/null differ diff --git a/Atom/Resources/verticalTextCursor.png b/Atom/Resources/verticalTextCursor.png deleted file mode 100644 index 0f2877ccc..000000000 Binary files a/Atom/Resources/verticalTextCursor.png and /dev/null differ diff --git a/Atom/Resources/vi.lproj/locale.pak b/Atom/Resources/vi.lproj/locale.pak deleted file mode 100644 index 2443a0394..000000000 Binary files a/Atom/Resources/vi.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/waitCursor.png b/Atom/Resources/waitCursor.png deleted file mode 100644 index 91412b818..000000000 Binary files a/Atom/Resources/waitCursor.png and /dev/null differ diff --git a/Atom/Resources/westResizeCursor.png b/Atom/Resources/westResizeCursor.png deleted file mode 100644 index 544439adc..000000000 Binary files a/Atom/Resources/westResizeCursor.png and /dev/null differ diff --git a/Atom/Resources/zh_CN.lproj/locale.pak b/Atom/Resources/zh_CN.lproj/locale.pak deleted file mode 100644 index c160b4631..000000000 Binary files a/Atom/Resources/zh_CN.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/zh_TW.lproj/locale.pak b/Atom/Resources/zh_TW.lproj/locale.pak deleted file mode 100644 index 5eaa3ec17..000000000 Binary files a/Atom/Resources/zh_TW.lproj/locale.pak and /dev/null differ diff --git a/Atom/Resources/zoomInCursor.png b/Atom/Resources/zoomInCursor.png deleted file mode 100644 index feec9bcbb..000000000 Binary files a/Atom/Resources/zoomInCursor.png and /dev/null differ diff --git a/Atom/Resources/zoomOutCursor.png b/Atom/Resources/zoomOutCursor.png deleted file mode 100644 index f4a954e32..000000000 Binary files a/Atom/Resources/zoomOutCursor.png and /dev/null differ diff --git a/Atom/src/Atom.h b/Atom/src/Atom.h deleted file mode 100755 index 5fe3729e7..000000000 --- a/Atom/src/Atom.h +++ /dev/null @@ -1,22 +0,0 @@ -#import "BrowserDelegate.h" -#import "include/cef_base.h" -#import "include/cef_application_mac.h" - -class ClientHandler; - -@class AtomController; - -@interface Atom : NSApplication { - NSWindow *_hiddenWindow; - BOOL handlingSendEvent_; - CefRefPtr _clientHandler; -} - -- (void)open:(NSString *)path; -- (IBAction)runSpecs:(id)sender; -- (IBAction)runBenchmarks:(id)sender; - -@end - -// Returns the application settings based on command line arguments. -void AppGetSettings(CefSettings& settings); diff --git a/Atom/src/Atom.mm b/Atom/src/Atom.mm deleted file mode 100755 index c83f724d3..000000000 --- a/Atom/src/Atom.mm +++ /dev/null @@ -1,160 +0,0 @@ -#import "Atom.h" -#import "include/cef_base.h" -#import "AtomController.h" - -#import "native_handler.h" -#import "OnigRegexpExtension.h" -#import "client_handler.h" -#import "include/cef_app.h" - -@interface Atom () -- (CefRefPtr)atomContext; -@end - -// Provide the CefAppProtocol implementation required by CEF. -@implementation Atom - -+ (id)sharedApplication { - id atomApp = [super sharedApplication]; - - CefSettings settings; - AppGetSettings(settings); - - CefRefPtr app; - CefInitialize(settings, app); - - return atomApp; -} - -- (void)dealloc { - [_hiddenWindow release]; - [super dealloc]; -} - -- (BOOL)isHandlingSendEvent { - return handlingSendEvent_; -} - -- (void)setHandlingSendEvent:(BOOL)handlingSendEvent { - handlingSendEvent_ = handlingSendEvent; -} - -- (void)sendEvent:(NSEvent*)event { - CefScopedSendingEvent sendingEventScoper; - - if ([[self mainMenu] performKeyEquivalent:event]) return; - - if (_clientHandler && ![self keyWindow] && [event type] == NSKeyDown) { - [_hiddenWindow makeKeyAndOrderFront:self]; - [_hiddenWindow sendEvent:event]; - } - else { - [super sendEvent:event]; - } -} - -- (void)createAtomContext { - _clientHandler = new ClientHandler(self); - - CefWindowInfo window_info; - _hiddenWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 0, 0) styleMask:nil backing:nil defer:YES]; - window_info.SetAsChild([_hiddenWindow contentView], 0, 0, 0, 0); - - CefBrowserSettings settings; - NSURL *resourceDirURL = [[NSBundle mainBundle] resourceURL]; - NSString *indexURLString = [[resourceDirURL URLByAppendingPathComponent:@"index.html"] absoluteString]; - CefBrowser::CreateBrowser(window_info, _clientHandler.get(), [indexURLString UTF8String], settings); -} - -- (void)open:(NSString *)path { - [[AtomController alloc] initWithPath:path atomContext:[self atomContext]]; -} - -- (IBAction)runSpecs:(id)sender { - [[AtomController alloc] initSpecsWithAtomContext:[self atomContext]]; -} - -- (IBAction)runBenchmarks:(id)sender { - [[AtomController alloc] initBenchmarksWithAtomContext:[self atomContext]]; -} - -- (void)modifyJavaScript:(void(^)(CefRefPtr, CefRefPtr))callback { - CefRefPtr context = _clientHandler->GetBrowser()->GetMainFrame()->GetV8Context(); - CefRefPtr global = context->GetGlobal(); - - context->Enter(); - - callback(context, global); - - context->Exit(); -} - -- (CefRefPtr)atomContext { - return _clientHandler->GetBrowser()->GetMainFrame()->GetV8Context(); -} - -- (void)applicationWillFinishLaunching:(NSNotification *)notification { - new NativeHandler(); - new OnigRegexpExtension(); - - [self createAtomContext]; -} - -- (void)applicationWillTerminate:(NSNotification *)aNotification { - CefShutdown(); -} - -#pragma mark BrowserDelegate - -- (void)loadStart { - [self modifyJavaScript:^(CefRefPtr context, CefRefPtr global) { - CefRefPtr bootstrapScript = CefV8Value::CreateString("atom-bootstrap"); - global->SetValue("$bootstrapScript", bootstrapScript, V8_PROPERTY_ATTRIBUTE_NONE); - - CefRefPtr atom = CefV8Value::CreateObject(NULL, NULL); - global->SetValue("atom", atom, V8_PROPERTY_ATTRIBUTE_NONE); - - -#ifdef LOAD_RESOURCES_FROM_DIR - char path[] = LOAD_RESOURCES_FROM_DIR; -#else - const char *path = [[[NSBundle mainBundle] resourcePath] UTF8String]; -#endif - - CefRefPtr loadPath = CefV8Value::CreateString(path); - atom->SetValue("loadPath", loadPath, V8_PROPERTY_ATTRIBUTE_NONE); - }]; -} - -- (void)loadEnd { - if ([[[NSProcessInfo processInfo] arguments] containsObject:@"--headless"]) { - [self modifyJavaScript:^(CefRefPtr context, CefRefPtr global) { - CefRefPtr atom = context->GetGlobal()->GetValue("atom"); - atom->SetValue("headless", CefV8Value::CreateBool(YES), V8_PROPERTY_ATTRIBUTE_NONE); - }]; - } - - if ([[[NSProcessInfo processInfo] arguments] containsObject:@"--benchmark"]) { - [self runBenchmarks:self]; - } - - if ([[[NSProcessInfo processInfo] arguments] containsObject:@"--test"]) { - [self runSpecs:self]; - } -} - -@end - -// Returns the application settings based on command line arguments. -void AppGetSettings(CefSettings& settings) { - CefString(&settings.cache_path) = ""; - CefString(&settings.user_agent) = ""; - CefString(&settings.product_version) = ""; - CefString(&settings.locale) = ""; - CefString(&settings.log_file) = ""; - CefString(&settings.javascript_flags) = ""; - - settings.log_severity = LOGSEVERITY_ERROR; - settings.local_storage_quota = 0; - settings.session_storage_quota = 0; -} diff --git a/Atom/src/AtomController.h b/Atom/src/AtomController.h deleted file mode 100644 index 71c566bc9..000000000 --- a/Atom/src/AtomController.h +++ /dev/null @@ -1,37 +0,0 @@ -#import - -#import "BrowserDelegate.h" -#import "include/cef_base.h" -#import "include/cef_v8.h" - -class ClientHandler; - -@interface AtomController : NSWindowController { - NSSplitView *_splitView; - NSView *_webView; - NSView *_devToolsView; - NSString *_bootstrapScript; - NSString *_pathToOpen; - bool _runningSpecs; - - CefRefPtr _atomContext; - CefRefPtr _clientHandler; -} - -- (id)initWithBootstrapScript:(NSString *)bootstrapScript atomContext:(CefRefPtr) context; -- (id)initWithPath:(NSString *)path atomContext:(CefRefPtr)atomContext; -- (id)initSpecsWithAtomContext:(CefRefPtr)atomContext; -- (id)initBenchmarksWithAtomContext:(CefRefPtr)atomContext; - -- (void)createBrowser; -- (void)showDevTools; -- (void)toggleDevTools; - -@property (nonatomic, retain) IBOutlet NSSplitView *splitView; -@property (nonatomic, retain) IBOutlet NSView *webView; -@property (nonatomic, retain) IBOutlet NSView *devToolsView; - -@end - -// Returns the application browser settings based on command line arguments. -void AppGetBrowserSettings(CefBrowserSettings& settings); diff --git a/Atom/src/AtomController.mm b/Atom/src/AtomController.mm deleted file mode 100644 index e34e91ac5..000000000 --- a/Atom/src/AtomController.mm +++ /dev/null @@ -1,236 +0,0 @@ -#import "AtomController.h" - -#import "include/cef_base.h" -#import "client_handler.h" -#import "PathWatcher.h" - -@implementation AtomController - -@synthesize splitView=_splitView; -@synthesize webView=_webView; -@synthesize devToolsView=_devToolsView; - -- (void)dealloc { - [_bootstrapScript release]; - [_splitView release]; - [_webView release]; - [_devToolsView release]; - [_pathToOpen release]; - - [super dealloc]; -} - -- (id)initWithBootstrapScript:(NSString *)bootstrapScript atomContext:(CefRefPtr)atomContext { - self = [super initWithWindowNibName:@"ClientWindow"]; - _bootstrapScript = [bootstrapScript retain]; - _atomContext = atomContext; - - [self.window makeKeyAndOrderFront:nil]; - [self createBrowser]; - - return self; -} - -- (id)initWithPath:(NSString *)path atomContext:(CefRefPtr)atomContext { - _pathToOpen = [path retain]; - return [self initWithBootstrapScript:@"window-bootstrap" atomContext:atomContext]; -} - -- (id)initSpecsWithAtomContext:(CefRefPtr)atomContext { - _runningSpecs = true; - return [self initWithBootstrapScript:@"spec-bootstrap" atomContext:atomContext]; -} - -- (id)initBenchmarksWithAtomContext:(CefRefPtr)atomContext { - return [self initWithBootstrapScript:@"benchmark-bootstrap" atomContext:atomContext]; -} - -- (void)windowDidLoad { - [self.window setDelegate:self]; - [self.window setReleasedWhenClosed:NO]; -} - -- (void)createBrowser { - _clientHandler = new ClientHandler(self); - - CefWindowInfo window_info; - CefBrowserSettings settings; - - AppGetBrowserSettings(settings); - - window_info.SetAsChild(self.webView, 0, 0, self.webView.bounds.size.width, self.webView.bounds.size.height); - - NSURL *resourceDirURL = [[NSBundle mainBundle] resourceURL]; - NSString *indexURLString = [[resourceDirURL URLByAppendingPathComponent:@"index.html"] absoluteString]; - CefBrowser::CreateBrowser(window_info, _clientHandler.get(), [indexURLString UTF8String], settings); -} - -- (void)showDevTools { - if (!_devToolsView) { - [self toggleDevTools]; - } -} - -- (void)toggleDevTools { - if (_devToolsView) { - [_devToolsView removeFromSuperview]; - [_devToolsView release]; - _devToolsView = nil; - [self focusWindow]; - } - else if (_clientHandler && _clientHandler->GetBrowser()) { - NSRect frame = NSMakeRect(0, 0, _splitView.frame.size.height, _splitView.frame.size.height); - _devToolsView = [[NSView alloc] initWithFrame:frame]; - [_splitView addSubview:_devToolsView]; - _clientHandler->GetBrowser()->ShowDevTools(); - } - - [_splitView adjustSubviews]; -} - -- (void)focusWindow { - CefRefPtr context = _clientHandler->GetBrowser()->GetMainFrame()->GetV8Context(); - CefRefPtr global = context->GetGlobal(); - - context->Enter(); - CefRefPtr retval; - CefRefPtr exception; - CefV8ValueList arguments; - global->GetValue("focus")->ExecuteFunction(global, arguments, retval, exception, true); - context->Exit(); -} - -#pragma mark BrowserDelegate -- (void)loadStart { - CefRefPtr context = _clientHandler->GetBrowser()->GetMainFrame()->GetV8Context(); - CefRefPtr global = context->GetGlobal(); - - context->Enter(); - - CefRefPtr windowNumber = CefV8Value::CreateInt(self.window.windowNumber); - global->SetValue("$windowNumber", windowNumber, V8_PROPERTY_ATTRIBUTE_NONE); - - CefRefPtr bootstrapScript = CefV8Value::CreateString([_bootstrapScript UTF8String]); - global->SetValue("$bootstrapScript", bootstrapScript, V8_PROPERTY_ATTRIBUTE_NONE); - - CefRefPtr pathToOpen = _pathToOpen ? CefV8Value::CreateString([_pathToOpen UTF8String]) : CefV8Value::CreateNull(); - global->SetValue("$pathToOpen", pathToOpen, V8_PROPERTY_ATTRIBUTE_NONE); - - global->SetValue("atom", _atomContext->GetGlobal()->GetValue("atom"), V8_PROPERTY_ATTRIBUTE_NONE); - - context->Exit(); -} - -- (bool)keyEventOfType:(cef_handler_keyevent_type_t)type code:(int)code modifiers:(int)modifiers isSystemKey:(bool)isSystemKey isAfterJavaScript:(bool)isAfterJavaScript { - if (isAfterJavaScript) { - if (type == KEYEVENT_RAWKEYDOWN && modifiers == KEY_META && code == 'R') { - CefRefPtr context = _clientHandler->GetBrowser()->GetMainFrame()->GetV8Context(); - CefRefPtr global = context->GetGlobal(); - - context->Enter(); - CefRefPtr retval; - CefRefPtr exception; - CefV8ValueList arguments; - - global->GetValue("reload")->ExecuteFunction(global, arguments, retval, exception, true); - if (exception.get()) { - _clientHandler->GetBrowser()->ReloadIgnoreCache(); - } - context->Exit(); - - return YES; - } - if (type == KEYEVENT_RAWKEYDOWN && modifiers == (KEY_META | KEY_ALT) && code == 'I') { - [self toggleDevTools]; - return YES; - } - } - - return NO; -} - -#pragma mark NSWindowDelegate -- (void)windowDidResignMain:(NSNotification *)notification { - if (_clientHandler && _clientHandler->GetBrowser() && !_runningSpecs) { - _clientHandler->GetBrowser()->SendFocusEvent(false); - } -} - -- (void)windowDidBecomeMain:(NSNotification *)notification { - if (_clientHandler && _clientHandler->GetBrowser()) { - _clientHandler->GetBrowser()->SendFocusEvent(true); - } -} - -- (BOOL)windowShouldClose:(id)window { - CefRefPtr context = _clientHandler->GetBrowser()->GetMainFrame()->GetV8Context(); - CefRefPtr global = context->GetGlobal(); - - context->Enter(); - - CefRefPtr atom = context->GetGlobal()->GetValue("atom"); - - CefRefPtr retval; - CefRefPtr exception; - CefV8ValueList arguments; - arguments.push_back(global); - - atom->GetValue("windowClosed")->ExecuteFunction(atom, arguments, retval, exception, true); - - context->Exit(); - - _clientHandler->GetBrowser()->CloseDevTools(); - - _atomContext = NULL; - _clientHandler = NULL; - - [self autorelease]; - - return YES; -} - -@end - -// Returns the application browser settings based on command line arguments. -void AppGetBrowserSettings(CefBrowserSettings& settings) { - CefString(&settings.default_encoding) = ""; - CefString(&settings.user_style_sheet_location) = ""; - - settings.drag_drop_disabled = false; - settings.load_drops_disabled = false; - settings.history_disabled = false; - settings.remote_fonts_disabled = false; - settings.encoding_detector_enabled = false; - settings.javascript_disabled = false; - settings.javascript_open_windows_disallowed = false; - settings.javascript_close_windows_disallowed = false; - settings.javascript_access_clipboard_disallowed = false; - settings.dom_paste_disabled = false; - settings.caret_browsing_enabled = false; - settings.java_disabled = true; - settings.plugins_disabled = true; - settings.universal_access_from_file_urls_allowed = true; - settings.file_access_from_file_urls_allowed = false; - settings.web_security_disabled = true; - settings.xss_auditor_enabled = false; - settings.image_load_disabled = false; - settings.shrink_standalone_images_to_fit = false; - settings.site_specific_quirks_disabled = false; - settings.text_area_resize_disabled = false; - settings.page_cache_disabled = false; - settings.tab_to_links_disabled = false; - settings.hyperlink_auditing_disabled = false; - settings.user_style_sheet_enabled = false; - settings.author_and_user_styles_disabled = false; - settings.local_storage_disabled = false; - settings.databases_disabled = false; - settings.application_cache_disabled = false; - settings.webgl_disabled = false; - settings.accelerated_compositing_enabled = true; - settings.threaded_compositing_enabled = true; - settings.accelerated_layers_disabled = false; - settings.accelerated_video_disabled = false; - settings.accelerated_2d_canvas_disabled = false; - settings.accelerated_plugins_disabled = false; - settings.developer_tools_disabled = false; -} diff --git a/Atom/src/BrowserDelegate.h b/Atom/src/BrowserDelegate.h deleted file mode 100644 index 1082461b9..000000000 --- a/Atom/src/BrowserDelegate.h +++ /dev/null @@ -1,12 +0,0 @@ -#import -#import "include/cef_base.h" - -@protocol BrowserDelegate - -@optional -- (void)afterCreated; -- (void)loadStart; -- (void)loadEnd; -- (bool)keyEventOfType:(cef_handler_keyevent_type_t)type code:(int)code modifiers:(int)modifiers isSystemKey:(bool)isSystemKey isAfterJavaScript:(bool)isAfterJavaScript; - -@end diff --git a/Atom/src/OnigRegexpExtension.h b/Atom/src/OnigRegexpExtension.h deleted file mode 100644 index db177a33e..000000000 --- a/Atom/src/OnigRegexpExtension.h +++ /dev/null @@ -1,17 +0,0 @@ -#import -#import "include/cef_base.h" -#import "include/cef_v8.h" - -class OnigRegexpExtension : public CefV8Handler { -public: - OnigRegexpExtension(); - - virtual bool Execute(const CefString& name, - CefRefPtr object, - const CefV8ValueList& arguments, - CefRefPtr& retval, - CefString& exception) OVERRIDE; - - // Provide the reference counting implementation for this class. - IMPLEMENT_REFCOUNTING(OnigRegexpExtension); -}; diff --git a/Atom/src/OnigRegexpExtension.mm b/Atom/src/OnigRegexpExtension.mm deleted file mode 100644 index 489202daa..000000000 --- a/Atom/src/OnigRegexpExtension.mm +++ /dev/null @@ -1,123 +0,0 @@ -#import "OnigRegexpExtension.h" -#import "include/cef_base.h" -#import "include/cef_v8.h" -#import "CocoaOniguruma/OnigRegexp.h" -#import -#import - -extern NSString *stringFromCefV8Value(const CefRefPtr& value); - -class OnigRegexpUserData : public CefBase { -public: - OnigRegexpUserData(CefRefPtr source) { - NSString *sourceString = [NSString stringWithUTF8String:source->GetStringValue().ToString().c_str()]; - m_regex = [[OnigRegexp compile:sourceString] retain]; - } - - ~OnigRegexpUserData() { - [m_regex release]; - } - - CefRefPtr Search(CefRefPtr string, CefRefPtr index) { - OnigResult *result = [m_regex search:stringFromCefV8Value(string) start:index->GetIntValue()]; - - if ([result count] == 0) return CefV8Value::CreateNull(); - - CefRefPtr resultArray = CefV8Value::CreateArray(); - CefRefPtr indicesArray = CefV8Value::CreateArray(); - - for (int i = 0; i < [result count]; i++) { - resultArray->SetValue(i, CefV8Value::CreateString([[result stringAt:i] UTF8String])); - indicesArray->SetValue(i, CefV8Value::CreateInt([result locationAt:i])); - } - - resultArray->SetValue("index", CefV8Value::CreateInt([result locationAt:0]), V8_PROPERTY_ATTRIBUTE_NONE); - resultArray->SetValue("indices", indicesArray, V8_PROPERTY_ATTRIBUTE_NONE); - - return resultArray; - } - - CefRefPtr Test(CefRefPtr string, CefRefPtr index) { - OnigResult *result = [m_regex search:stringFromCefV8Value(string) start:index->GetIntValue()]; - return CefV8Value::CreateBool(result); - } - - CefRefPtr GetCaptureIndices(CefRefPtr string, CefRefPtr index) { - OnigResult *result = [m_regex search:stringFromCefV8Value(string) start:index->GetIntValue()]; - if ([result count] == 0) return CefV8Value::CreateNull(); - return BuildCaptureIndices(result); - } - - CefRefPtr BuildCaptureIndices(OnigResult *result) { - CefRefPtr array = CefV8Value::CreateArray(); - int i = 0; - - int resultCount = [result count]; - for (int index = 0; index < resultCount; index++) { - int captureLength = [result lengthAt:index]; - if (captureLength == 0) continue; - int captureStart = [result locationAt:index]; - array->SetValue(i++, CefV8Value::CreateInt(index)); - array->SetValue(i++, CefV8Value::CreateInt(captureStart)); - array->SetValue(i++, CefV8Value::CreateInt(captureStart + captureLength)); - } - - return array; - } - - CefRefPtr CaptureCount() { - return CefV8Value::CreateInt([m_regex captureCount]); - } - - OnigRegexp *m_regex; - - IMPLEMENT_REFCOUNTING(OnigRegexpUserData); -}; - -OnigRegexpExtension::OnigRegexpExtension() : CefV8Handler() { - NSString *filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"src/stdlib/onig-reg-exp-extension.js"]; - NSString *extensionCode = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil]; - CefRegisterExtension("v8/oniguruma", [extensionCode UTF8String], this); -} - -bool OnigRegexpExtension::Execute(const CefString& name, - CefRefPtr object, - const CefV8ValueList& arguments, - CefRefPtr& retval, - CefString& exception) { - - if (name == "getCaptureIndices") { - CefRefPtr string = arguments[0]; - CefRefPtr index = arguments.size() > 1 ? arguments[1] : CefV8Value::CreateInt(0); - OnigRegexpUserData *userData = (OnigRegexpUserData *)object->GetUserData().get(); - retval = userData->GetCaptureIndices(string, index); - return true; - } - else if (name == "search") { - CefRefPtr string = arguments[0]; - CefRefPtr index = arguments.size() > 1 ? arguments[1] : CefV8Value::CreateInt(0); - OnigRegexpUserData *userData = (OnigRegexpUserData *)object->GetUserData().get(); - retval = userData->Search(string, index); - return true; - } - else if (name == "test") { - CefRefPtr string = arguments[0]; - CefRefPtr index = arguments.size() > 1 ? arguments[1] : CefV8Value::CreateInt(0); - OnigRegexpUserData *userData = (OnigRegexpUserData *)object->GetUserData().get(); - retval = userData->Test(string, index); - return true; - } - else if (name == "buildOnigRegExp") { - CefRefPtr userData = new OnigRegexpUserData(arguments[0]); - retval = CefV8Value::CreateObject(userData, NULL); - return true; - } - else if (name == "getCaptureCount") { - OnigRegexpUserData *userData = (OnigRegexpUserData *)object->GetUserData().get(); - retval = userData->CaptureCount(); - return true; - } - - return false; -} - diff --git a/Atom/src/PathWatcher.h b/Atom/src/PathWatcher.h deleted file mode 100644 index 88e98693b..000000000 --- a/Atom/src/PathWatcher.h +++ /dev/null @@ -1,24 +0,0 @@ -#import "include/cef_base.h" -#import "include/cef_v8.h" -#import - -typedef void (^WatchCallback)(NSString *, NSString *); - -@interface PathWatcher : NSObject { - int _kq; - CefRefPtr _context; - NSMutableDictionary *_fileDescriptorsByPath; - NSMutableDictionary *_callbacksByFileDescriptor; - - bool _keepWatching; -} - -+ (PathWatcher *)pathWatcherForContext:(CefRefPtr)context; -+ (void)removePathWatcherForContext:(CefRefPtr)context; - -- (id)initWithContext:(CefRefPtr)context; -- (NSString *)watchPath:(NSString *)path callback:(WatchCallback)callback; -- (void)unwatchPath:(NSString *)path callbackId:(NSString *)callbackId error:(NSError **)error; - - -@end diff --git a/Atom/src/PathWatcher.mm b/Atom/src/PathWatcher.mm deleted file mode 100644 index 67667eebc..000000000 --- a/Atom/src/PathWatcher.mm +++ /dev/null @@ -1,272 +0,0 @@ -#import "PathWatcher.h" - -#import -#import -#import -#import - -static NSMutableArray *gPathWatchers; - -@interface PathWatcher () -- (bool)usesContext:(CefRefPtr)context; -- (void)watchFileDescriptor:(int)fd; -- (NSString *)watchPath:(NSString *)path callback:(WatchCallback)callback callbackId:(NSString *)callbackId; -- (void)stopWatching; -- (void)reassignFileDescriptor:(NSNumber *)fdNumber from:(NSString *)path to:(NSString *)newPath; -- (bool)isAtomicWrite:(struct kevent)event path:(NSString *)path; -@end - -@implementation PathWatcher - -+ (PathWatcher *)pathWatcherForContext:(CefRefPtr)context { - if (!gPathWatchers) gPathWatchers = [[NSMutableArray alloc] init]; - - PathWatcher *pathWatcher = nil; - for (PathWatcher *p in gPathWatchers) { - if ([p usesContext:context]) { - pathWatcher = p; - break; - } - } - - if (!pathWatcher) { - pathWatcher = [[[PathWatcher alloc] initWithContext:context] autorelease]; - [gPathWatchers addObject:pathWatcher]; - } - - return pathWatcher; -} - -+ (void)removePathWatcherForContext:(CefRefPtr)context { - PathWatcher *pathWatcher = nil; - for (PathWatcher *p in gPathWatchers) { - if ([p usesContext:context]) { - pathWatcher = p; - break; - } - } - - if (pathWatcher) { - [pathWatcher stopWatching]; - [gPathWatchers removeObject:pathWatcher]; - } - -} - -- (void)dealloc { - close(_kq); - for (NSNumber *fdNumber in [_callbacksByFileDescriptor allKeys]) { - close([fdNumber intValue]); - } - [_callbacksByFileDescriptor release]; - _context = nil; - [super dealloc]; -} - -- (id)initWithContext:(CefRefPtr)context { - self = [super init]; - - _keepWatching = YES; - _callbacksByFileDescriptor = [[NSMutableDictionary alloc] init]; - _fileDescriptorsByPath = [[NSMutableDictionary alloc] init]; - _kq = kqueue(); - _context = context; - - if (_kq == -1) { - [NSException raise:@"PathWatcher" format:@"Could not create kqueue"]; - } - - [self performSelectorInBackground:@selector(watch) withObject:NULL]; - return self; -} - -- (bool)usesContext:(CefRefPtr)context { - return _context->IsSame(context); -} - -- (void)stopWatching { - [self unwatchAll]; - _keepWatching = false; -} - -- (NSString *)watchPath:(NSString *)path callback:(WatchCallback)callback { - NSString *callbackId = [[NSProcessInfo processInfo] globallyUniqueString]; - return [self watchPath:path callback:callback callbackId:callbackId]; -} - -- (NSString *)watchPath:(NSString *)path callback:(WatchCallback)callback callbackId:(NSString *)callbackId { - path = [path stringByStandardizingPath]; - - @synchronized(self) { - NSNumber *fdNumber = [_fileDescriptorsByPath objectForKey:path]; - if (!fdNumber) { - int fd = open([path fileSystemRepresentation], O_EVTONLY, 0); - if (fd < 0) return nil; - [self watchFileDescriptor:fd]; - - fdNumber = [NSNumber numberWithInt:fd]; - [_fileDescriptorsByPath setObject:fdNumber forKey:path]; - } - - NSMutableDictionary *callbacks = [_callbacksByFileDescriptor objectForKey:fdNumber]; - if (!callbacks) { - callbacks = [NSMutableDictionary dictionary]; - [_callbacksByFileDescriptor setObject:callbacks forKey:fdNumber]; - } - - [callbacks setObject:callback forKey:callbackId]; - } - - return callbackId; -} - -- (void)unwatchPath:(NSString *)path callbackId:(NSString *)callbackId error:(NSError **)error { - path = [path stringByStandardizingPath]; - - @synchronized(self) { - NSNumber *fdNumber = [_fileDescriptorsByPath objectForKey:path]; - if (!fdNumber) { - NSString *message = [NSString stringWithFormat:@"Trying to unwatch %@, which we aren't watching", path]; - NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:message, NSLocalizedDescriptionKey, nil]; - if (error) { - NSError *e = [NSError errorWithDomain:@"PathWatcher" code:0 userInfo:userInfo]; - *error = e; - } - return; - } - - NSMutableDictionary *callbacks = [_callbacksByFileDescriptor objectForKey:fdNumber]; - if (!callbacks) return; - - if (callbackId) { - [callbacks removeObjectForKey:callbackId]; - } - else { - [callbacks removeAllObjects]; - } - - if (callbacks.count == 0) { - close([fdNumber intValue]); - [_callbacksByFileDescriptor removeObjectForKey:fdNumber]; - [_fileDescriptorsByPath removeObjectForKey:path]; - } - } -} - -- (void)unwatchAll { - @synchronized(self) { - NSArray *paths = [_fileDescriptorsByPath allKeys]; - for (NSString *path in paths) { - [self unwatchPath:path callbackId:nil error:nil]; - } - } -} - -- (void)watchFileDescriptor:(int)fd { - struct timespec timeout = { 0, 0 }; - struct kevent event; - int filter = EVFILT_VNODE; - int flags = EV_ADD | EV_ENABLE | EV_CLEAR; - int filterFlags = NOTE_WRITE | NOTE_DELETE | NOTE_RENAME; - EV_SET(&event, fd, filter, flags, filterFlags, 0, 0); - kevent(_kq, &event, 1, NULL, 0, &timeout); -} - -- (NSString *)pathForFileDescriptor:(NSNumber *)fdNumber { - @synchronized(self) { - for (NSString *path in _fileDescriptorsByPath) { - if ([[_fileDescriptorsByPath objectForKey:path] isEqual:fdNumber]) { - return path; - } - } - } - - return nil; -} - -- (bool)isAtomicWrite:(struct kevent)event path:(NSString *)path { - if (!event.fflags & NOTE_DELETE) return NO; - [NSThread sleepForTimeInterval:0.01]; // HACK: Git deletes files only to create them again later. This is the cheap way of dealing with that - NSFileManager *fm = [NSFileManager defaultManager]; - return [fm fileExistsAtPath:path]; -} - -- (void)reassignFileDescriptor:(NSNumber *)fdNumber from:(NSString *)path to:(NSString *)newPath { - @synchronized(self) { - bool notWatchingFd = [_fileDescriptorsByPath valueForKey:path] == nil; - if (notWatchingFd) return; - - [_fileDescriptorsByPath removeObjectForKey:path]; - [_fileDescriptorsByPath setObject:fdNumber forKey:newPath]; - } -} - -- (void)updatePath:(NSString *)path forFileDescriptor:(NSNumber *)fdNumber { - // The path associated with the fd been updated. Remove references to old fd - // and make sure the path and callbacks are linked with new fd. - @synchronized(self) { - NSDictionary *callbacks = [NSDictionary dictionaryWithDictionary:[_callbacksByFileDescriptor objectForKey:fdNumber]]; - [self unwatchPath:path callbackId:nil error:nil]; - for (NSString *callbackId in [callbacks allKeys]) { - [self watchPath:path callback:[callbacks objectForKey:callbackId] callbackId:callbackId]; - } - } -} - -- (void)watch { - struct kevent event; - struct timespec timeout = { 5, 0 }; // 5 seconds timeout. - - while (_keepWatching) { - @autoreleasepool { - int numberOfEvents = kevent(_kq, NULL, 0, &event, 1, &timeout); - - if (numberOfEvents < 0) { - NSLog(@"PathWatcher: error %d", numberOfEvents); - } - if (numberOfEvents == 0) { - continue; - } - - NSNumber *fdNumber = [NSNumber numberWithInt:event.ident]; - NSString *eventFlag = nil; - NSString *path = [[[self pathForFileDescriptor:fdNumber] retain] autorelease]; - NSString *newPath = nil; - - if (event.fflags & NOTE_WRITE) { - eventFlag = @"contents-change"; - } - else if ([self isAtomicWrite:event path:path]) { - eventFlag = @"contents-change"; - [self updatePath:path forFileDescriptor:fdNumber]; - } - else if (event.fflags & NOTE_DELETE) { - eventFlag = @"remove"; - } - else if (event.fflags & NOTE_RENAME) { - eventFlag = @"move"; - char pathBuffer[MAXPATHLEN]; - fcntl((int)event.ident, F_GETPATH, &pathBuffer); - newPath = [NSString stringWithUTF8String:pathBuffer]; - } - - NSDictionary *callbacks; - @synchronized(self) { - callbacks = [NSDictionary dictionaryWithDictionary:[_callbacksByFileDescriptor objectForKey:fdNumber]]; - } - - dispatch_sync(dispatch_get_main_queue(), ^{ - for (NSString *key in callbacks) { - WatchCallback callback = [callbacks objectForKey:key]; - callback(eventFlag, newPath ? newPath : path); - } - }); - - if (event.fflags & NOTE_RENAME) { - [self reassignFileDescriptor:fdNumber from:path to:newPath]; - } - } - } -} - -@end diff --git a/Atom/src/client_handler.h b/Atom/src/client_handler.h deleted file mode 100755 index a95f666a6..000000000 --- a/Atom/src/client_handler.h +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -#ifndef _CLIENT_HANDLER_H -#define _CLIENT_HANDLER_H - -#import "include/cef_base.h" -#import "include/cef_client.h" - -@class AtomController; - -// ClientHandler implementation. -class ClientHandler : public CefClient, - public CefLifeSpanHandler, - public CefLoadHandler, - public CefRequestHandler, - public CefDisplayHandler, - public CefFocusHandler, - public CefKeyboardHandler, - public CefPrintHandler, - public CefV8ContextHandler, - public CefDragHandler -{ -public: - ClientHandler(id delegate); - virtual ~ClientHandler(); - - // CefClient methods - virtual CefRefPtr GetLifeSpanHandler() OVERRIDE - { return this; } - virtual CefRefPtr GetLoadHandler() OVERRIDE - { return this; } - virtual CefRefPtr GetRequestHandler() OVERRIDE - { return this; } - virtual CefRefPtr GetDisplayHandler() OVERRIDE - { return this; } - 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 void OnAfterCreated(CefRefPtr browser) OVERRIDE; - virtual bool DoClose(CefRefPtr browser) OVERRIDE; - virtual void OnBeforeClose(CefRefPtr browser) OVERRIDE; - - // CefLoadHandler methods - virtual bool OnBeforePopup(CefRefPtr parentBrowser, - const CefPopupFeatures& popupFeatures, - CefWindowInfo& windowInfo, - const CefString& url, - CefRefPtr& client, - CefBrowserSettings& settings) OVERRIDE; - virtual void OnLoadStart(CefRefPtr browser, - CefRefPtr frame) OVERRIDE; - virtual void OnLoadEnd(CefRefPtr browser, - CefRefPtr frame, - int httpStatusCode) OVERRIDE; - virtual bool OnLoadError(CefRefPtr browser, - CefRefPtr frame, - ErrorCode errorCode, - const CefString& failedUrl, - CefString& errorText) OVERRIDE; - - // CefRequestHandler methods - virtual bool OnBeforeResourceLoad(CefRefPtr browser, - CefRefPtr request, - CefString& redirectUrl, - CefRefPtr& resourceStream, - CefRefPtr response, - int loadFlags) OVERRIDE; - - - // CefDisplayHandler methods - virtual void OnNavStateChange(CefRefPtr browser, - bool canGoBack, - bool canGoForward) OVERRIDE; - virtual void OnTitleChange(CefRefPtr browser, - const CefString& title) OVERRIDE; - - // CefFocusHandler methods. - virtual void OnFocusedNodeChanged(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr node) OVERRIDE; - - virtual bool OnConsoleMessage(CefRefPtr browser, - const CefString& message, - const CefString& source, - int line) OVERRIDE; - - // CefKeyboardHandler methods. - virtual bool OnKeyEvent(CefRefPtr browser, - KeyEventType type, - int code, - int modifiers, - bool isSystemKey, - bool isAfterJavaScript) OVERRIDE; - - // CefV8ContextHandler methods - virtual void OnContextCreated(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr context) OVERRIDE; - virtual void OnContextReleased(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; - - CefRefPtr GetBrowser() { return m_Browser; } - CefWindowHandle GetBrowserHwnd() { return m_BrowserHwnd; } - -protected: - // The child browser window - CefRefPtr m_Browser; - - // The main frame window handle - CefWindowHandle m_MainHwnd; - - // The child browser window handle - CefWindowHandle m_BrowserHwnd; - - id m_delegate; - - // Include the default reference counting implementation. - IMPLEMENT_REFCOUNTING(ClientHandler); - // Include the default locking implementation. - IMPLEMENT_LOCKING(ClientHandler); -}; - -#endif // _CLIENT_HANDLER_H diff --git a/Atom/src/client_handler.mm b/Atom/src/client_handler.mm deleted file mode 100755 index 2b501aba5..000000000 --- a/Atom/src/client_handler.mm +++ /dev/null @@ -1,238 +0,0 @@ -#import "include/cef_base.h" -#import "client_handler.h" -#import "AtomController.h" -#import "PathWatcher.h" - -#import -#import -#import -#import -#import -#import - -#ifndef NDEBUG -#define ASSERT(condition) if(!(condition)) { assert(false); } -#else -#define ASSERT(condition) ((void)0) -#endif - -#define REQUIRE_UI_THREAD() ASSERT(CefCurrentlyOn(TID_UI)); -#define REQUIRE_IO_THREAD() ASSERT(CefCurrentlyOn(TID_IO)); -#define REQUIRE_FILE_THREAD() ASSERT(CefCurrentlyOn(TID_FILE)); - -ClientHandler::ClientHandler(id delegate) - : m_MainHwnd(NULL), - m_BrowserHwnd(NULL) -{ - m_delegate = delegate; -} - -ClientHandler::~ClientHandler() -{ -} - - -void ClientHandler::OnAfterCreated(CefRefPtr browser) -{ - REQUIRE_UI_THREAD(); - - AutoLock lock_scope(this); - if(!m_Browser.get()) - { - // We need to keep the main child window, but not popup windows - m_Browser = browser; - m_BrowserHwnd = browser->GetWindowHandle(); - - if ([m_delegate respondsToSelector:@selector(afterCreated)]) { - [m_delegate afterCreated]; - } - } -} - -bool ClientHandler::DoClose(CefRefPtr browser) -{ - REQUIRE_UI_THREAD(); - - return false; -} - -void ClientHandler::OnBeforeClose(CefRefPtr browser) -{ - REQUIRE_UI_THREAD(); - - if(m_BrowserHwnd == browser->GetWindowHandle()) { - // Free the browser pointer so that the browser can be destroyed - m_Browser = NULL; - } -} - -bool ClientHandler::OnBeforePopup(CefRefPtr parentBrowser, - const CefPopupFeatures& popupFeatures, - CefWindowInfo& windowInfo, - const CefString& url, - CefRefPtr& client, - CefBrowserSettings& settings) { - - AtomController *atomController = [[NSApp keyWindow] windowController]; - [atomController showDevTools]; - windowInfo.SetAsChild(atomController.devToolsView, 0, 0, atomController.devToolsView.frame.size.width, atomController.devToolsView.frame.size.height); - - return false; -} - -void ClientHandler::OnLoadStart(CefRefPtr browser, - CefRefPtr frame) -{ - REQUIRE_UI_THREAD(); - - if ([m_delegate respondsToSelector:@selector(loadStart)]) { - [m_delegate loadStart]; - } - -} - -void ClientHandler::OnLoadEnd(CefRefPtr browser, - CefRefPtr frame, - int httpStatusCode) -{ - REQUIRE_UI_THREAD(); - - - if ([m_delegate respondsToSelector:@selector(loadEnd)]) { - [m_delegate loadEnd]; - } - -} - -bool ClientHandler::OnLoadError(CefRefPtr browser, - CefRefPtr frame, - ErrorCode errorCode, - const CefString& failedUrl, - CefString& errorText) -{ - REQUIRE_UI_THREAD(); - - if(errorCode == ERR_CACHE_MISS) { - // Usually caused by navigating to a page with POST data via back or - // forward buttons. - errorText = "Expired Form Data" - "

Expired Form Data

" - "

Your form request has expired. " - "Click reload to re-submit the form data.

" - ""; - } else { - // All other messages. - std::stringstream ss; - ss << "Load Failed" - "

Load Failed

" - "

Load of URL " << std::string(failedUrl) << - " failed with error code " << static_cast(errorCode) << - ".

" - ""; - errorText = ss.str(); - } - - return false; -} - -void ClientHandler::OnNavStateChange(CefRefPtr browser, - bool canGoBack, - bool canGoForward) -{ - REQUIRE_UI_THREAD(); -} - - -void ClientHandler::OnFocusedNodeChanged(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr node) -{ - REQUIRE_UI_THREAD(); - -} - -bool ClientHandler::OnKeyEvent(CefRefPtr browser, - KeyEventType type, - int code, - int modifiers, - bool isSystemKey, - bool isAfterJavaScript) -{ - REQUIRE_UI_THREAD(); - - if ([m_delegate respondsToSelector:@selector(keyEventOfType:code:modifiers:isSystemKey:isAfterJavaScript:)]) { - return [m_delegate keyEventOfType:type code:code modifiers:modifiers isSystemKey:isSystemKey isAfterJavaScript:isAfterJavaScript]; - } - else { - return false; - } -} - -void ClientHandler::OnContextCreated(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr context) -{ - REQUIRE_UI_THREAD(); -} - -void ClientHandler::OnContextReleased(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr context) { - REQUIRE_UI_THREAD(); - [PathWatcher removePathWatcherForContext:context]; -} - -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; -} - -bool ClientHandler::OnBeforeResourceLoad(CefRefPtr browser, - CefRefPtr request, - CefString& redirectUrl, - CefRefPtr& resourceStream, - CefRefPtr response, - int loadFlags) -{ - REQUIRE_IO_THREAD(); - - return false; -} - -void ClientHandler::OnTitleChange(CefRefPtr browser, - const CefString& title) -{ - REQUIRE_UI_THREAD(); - - // Set the frame window title bar - NSView* view = (NSView*)browser->GetWindowHandle(); - NSWindow* window = [view window]; - std::string titleStr(title); - NSString* str = [NSString stringWithUTF8String:titleStr.c_str()]; - [window setTitle:str]; -} - -bool ClientHandler::OnConsoleMessage(CefRefPtr browser, - const CefString& message, - const CefString& source, - int line) -{ - REQUIRE_UI_THREAD(); - - std::cout << std::string(message) << "\n"; - - return true; -} diff --git a/Atom/src/main.mm b/Atom/src/main.mm deleted file mode 100644 index 7132546f7..000000000 --- a/Atom/src/main.mm +++ /dev/null @@ -1,22 +0,0 @@ -#import - -#include "include/cef_base.h" -#include "include/cef_app.h" - -int main(int argc, char* argv[]) { - @autoreleasepool { - NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; - Class principalClass = NSClassFromString([infoDictionary objectForKey:@"NSPrincipalClass"]); - NSApplication *application = [principalClass sharedApplication]; - - NSString *mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"]; - NSNib *mainNib = [[NSNib alloc] initWithNibNamed:mainNibName bundle:[NSBundle mainBundle]]; - [mainNib instantiateNibWithOwner:application topLevelObjects:nil]; - - // Run the application message loop. - CefRunMessageLoop(); - - // Don't put anything below this line because it won't be executed. - return 0; - } -} diff --git a/Atom/src/native_handler.h b/Atom/src/native_handler.h deleted file mode 100644 index 86c875312..000000000 --- a/Atom/src/native_handler.h +++ /dev/null @@ -1,19 +0,0 @@ -#import -#import "include/cef_base.h" -#import "include/cef_v8.h" - -class NativeHandler : public CefV8Handler { -public: - NativeHandler(); - - CefRefPtr m_object; - - virtual bool Execute(const CefString& name, - CefRefPtr object, - const CefV8ValueList& arguments, - CefRefPtr& retval, - CefString& exception) OVERRIDE; - - // Provide the reference counting implementation for this class. - IMPLEMENT_REFCOUNTING(NativeHandler); -}; diff --git a/Atom/src/native_handler.mm b/Atom/src/native_handler.mm deleted file mode 100644 index d891189ab..000000000 --- a/Atom/src/native_handler.mm +++ /dev/null @@ -1,523 +0,0 @@ -#import "native_handler.h" -#import "include/cef_base.h" -#import "Atom.h" -#import "AtomController.h" -#import "client_handler.h" -#import "PathWatcher.h" -#import -#import -#import - -#import - -#define MY_EXCEPTION_TRY @try { -#define MY_EXCEPTION_HANDLE } @catch (NSException *localException) {} - -NSString *stringFromCefV8Value(const CefRefPtr& value) { - std::string cc_value = value->GetStringValue().ToString(); - return [NSString stringWithUTF8String:cc_value.c_str()]; -} - -void throwException(const CefRefPtr& global, CefRefPtr& exception, NSString *message) { - CefV8ValueList arguments; - CefRefPtr retval; - CefRefPtr e; - - message = [message stringByAppendingFormat:@"\n%s", exception->GetMessage().ToString().c_str()]; - arguments.push_back(CefV8Value::CreateString(std::string([message UTF8String], [message lengthOfBytesUsingEncoding:NSUTF8StringEncoding]))); - - CefRefPtr console = global->GetValue("console"); - console->GetValue("error")->ExecuteFunction(console, arguments, retval, e, false); -} - -NativeHandler::NativeHandler() : CefV8Handler() { - NSString *filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"src/stdlib/native-handler.js"]; - NSString *extensionCode = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil]; - CefRegisterExtension("v8/native-handler", [extensionCode UTF8String], this); -} - -bool NativeHandler::Execute(const CefString& name, - CefRefPtr object, - const CefV8ValueList& arguments, - CefRefPtr& retval, - CefString& exception) { - if (name == "exists") { - NSString *path = stringFromCefV8Value(arguments[0]); - bool exists = [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:nil]; - retval = CefV8Value::CreateBool(exists); - - return true; - } - else if (name == "read") { - NSString *path = stringFromCefV8Value(arguments[0]); - - NSError *error = nil; - NSString *contents = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; - - if (error) { - exception = [[error localizedDescription] UTF8String]; - } - else { - retval = CefV8Value::CreateString([contents UTF8String]); - } - - return true; - } - else if (name == "write") { - NSString *path = stringFromCefV8Value(arguments[0]); - NSString *content = stringFromCefV8Value(arguments[1]); - - NSFileManager *fm = [NSFileManager defaultManager]; - - // Create parent directories if they don't exist - BOOL exists = [fm fileExistsAtPath:[path stringByDeletingLastPathComponent] isDirectory:nil]; - if (!exists) { - [fm createDirectoryAtPath:[path stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:nil]; - } - - NSError *error = nil; - BOOL success = [content writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:&error]; - - if (error) { - exception = [[error localizedDescription] UTF8String]; - } - else if (!success) { - std::string exception = "Cannot write to '"; - exception += [path UTF8String]; - exception += "'"; - } - - return true; - } - else if (name == "absolute") { - NSString *path = stringFromCefV8Value(arguments[0]); - - path = [path stringByStandardizingPath]; - if ([path characterAtIndex:0] == '/') { - retval = CefV8Value::CreateString([path UTF8String]); - } - - return true; - } - else if (name == "list") { - NSString *path = stringFromCefV8Value(arguments[0]); - bool recursive = arguments[1]->GetBoolValue(); - - NSFileManager *fm = [NSFileManager defaultManager]; - NSArray *relativePaths = nil; - NSError *error = nil; - - if (recursive) { - relativePaths = [fm subpathsOfDirectoryAtPath:path error:&error]; - } - else { - relativePaths = [fm contentsOfDirectoryAtPath:path error:&error]; - } - - if (error) { - exception = [[error localizedDescription] UTF8String]; - } - else { - retval = CefV8Value::CreateArray(); - for (NSUInteger i = 0; i < relativePaths.count; i++) { - NSString *relativePath = [relativePaths objectAtIndex:i]; - NSString *fullPath = [path stringByAppendingPathComponent:relativePath]; - retval->SetValue(i, CefV8Value::CreateString([fullPath UTF8String])); - } - } - - return true; - } - else if (name == "isDirectory") { - NSString *path = stringFromCefV8Value(arguments[0]); - - BOOL isDir = false; - BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDir]; - retval = CefV8Value::CreateBool(exists && isDir); - - return true; - } - else if (name == "isFile") { - NSString *path = stringFromCefV8Value(arguments[0]); - - BOOL isDir = false; - BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDir]; - retval = CefV8Value::CreateBool(exists && !isDir); - - return true; - } - else if (name == "remove") { - NSString *path = stringFromCefV8Value(arguments[0]); - - NSError *error = nil; - [[NSFileManager defaultManager] removeItemAtPath:path error:&error]; - - if (error) { - exception = [[error localizedDescription] UTF8String]; - } - - return true; - } - else if (name == "asyncList") { - NSString *path = stringFromCefV8Value(arguments[0]); - bool recursive = arguments[1]->GetBoolValue(); - - NSFileManager *fm = [NSFileManager defaultManager]; - NSArray *relativePaths = nil; - NSError *error = nil; - - if (recursive) { - relativePaths = [fm subpathsOfDirectoryAtPath:path error:&error]; - } - else { - relativePaths = [fm contentsOfDirectoryAtPath:path error:&error]; - } - - if (error) { - exception = [[error localizedDescription] UTF8String]; - } - else { - CefRefPtr paths = CefV8Value::CreateArray(); - for (NSUInteger i = 0; i < relativePaths.count; i++) { - NSString *relativePath = [relativePaths objectAtIndex:i]; - NSString *fullPath = [path stringByAppendingPathComponent:relativePath]; - paths->SetValue(i, CefV8Value::CreateString([fullPath UTF8String])); - } - - CefV8ValueList args; - args.push_back(paths); - CefRefPtr e; - arguments[2]->ExecuteFunction(arguments[2], args, retval, e, true); - if (e) exception = e->GetMessage(); - } - - return true; - } - else if (name == "alert") { - NSString *message = stringFromCefV8Value(arguments[0]); - NSString *detailedMessage = stringFromCefV8Value(arguments[1]); - - CefRefPtr buttonNamesAndCallbacks; - if (arguments.size() < 3) { - buttonNamesAndCallbacks = CefV8Value::CreateArray(); - } - else { - buttonNamesAndCallbacks = arguments[2]; - } - - NSAlert *alert = [[[NSAlert alloc] init] autorelease]; - [alert setMessageText:message]; - [alert setInformativeText:detailedMessage]; - - for (int i = 0; i < buttonNamesAndCallbacks->GetArrayLength(); i++) { - std::string title = buttonNamesAndCallbacks->GetValue(i)->GetValue(0)->GetStringValue().ToString(); - NSString *buttonTitle = [NSString stringWithUTF8String:title.c_str()]; - NSButton *button = [alert addButtonWithTitle:buttonTitle]; - [button setTag:i]; - } - - NSUInteger buttonTag = [alert runModal]; - - if (buttonNamesAndCallbacks->GetArrayLength() == 0) { // No button title if there were no buttons specified. - return true; - } - - CefRefPtr callback = buttonNamesAndCallbacks->GetValue(buttonTag)->GetValue(1); - CefV8ValueList args; - CefRefPtr e; - callback->ExecuteFunction(callback, args, retval, e, true); - if (e) exception = e->GetMessage(); - - return true; - } - else if (name == "writeToPasteboard") { - NSString *text = stringFromCefV8Value(arguments[0]); - - NSPasteboard *pb = [NSPasteboard generalPasteboard]; - [pb declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] owner:nil]; - [pb setString:text forType:NSStringPboardType]; - - return true; - } - else if (name == "readFromPasteboard") { - NSPasteboard *pb = [NSPasteboard generalPasteboard]; - NSArray *results = [pb readObjectsForClasses:[NSArray arrayWithObjects:[NSString class], nil] options:nil]; - if (results) { - retval = CefV8Value::CreateString([[results objectAtIndex:0] UTF8String]); - } - - return true; - } - else if (name == "openDialog") { - NSOpenPanel *panel = [NSOpenPanel openPanel]; - [panel setCanChooseDirectories:YES]; - if ([panel runModal] == NSFileHandlingPanelOKButton) { - NSURL *url = [[panel URLs] lastObject]; - retval = CefV8Value::CreateString([[url path] UTF8String]); - } - else { - retval = CefV8Value::CreateNull(); - } - - return true; - } - else if (name == "open") { - NSString *path = stringFromCefV8Value(arguments[0]); - [NSApp open:path]; - - return true; - } - else if (name == "newWindow") { - [(Atom *)NSApp open:nil]; - - return true; - } - else if (name == "saveDialog") { - NSSavePanel *panel = [NSSavePanel savePanel]; - if ([panel runModal] == NSFileHandlingPanelOKButton) { - NSURL *url = [panel URL]; - retval = CefV8Value::CreateString([[url path] UTF8String]); - } - else { - return CefV8Value::CreateNull(); - } - - return true; - } - else if (name == "quit") { - [NSApp terminate:nil]; - return true; - } - else if (name == "showDevTools") { - CefV8Context::GetCurrentContext()->GetBrowser()->ShowDevTools(); - return true; - } - else if (name == "toggleDevTools") { - [[[NSApp keyWindow] windowController] toggleDevTools]; - return true; - } - else if (name == "exit") { - int exitStatus = 0; - if (arguments.size() > 0) exitStatus = arguments[0]->GetIntValue(); - - exit(exitStatus); - return true; - } - else if (name == "watchPath") { - NSString *path = stringFromCefV8Value(arguments[0]); - CefRefPtr function = arguments[1]; - - CefRefPtr context = CefV8Context::GetCurrentContext(); - - WatchCallback callback = ^(NSString *eventType, NSString *path) { - context->Enter(); - - CefV8ValueList args; - CefRefPtr retval; - CefRefPtr e; - - args.push_back(CefV8Value::CreateString(std::string([eventType UTF8String], [eventType lengthOfBytesUsingEncoding:NSUTF8StringEncoding]))); - args.push_back(CefV8Value::CreateString(std::string([path UTF8String], [path lengthOfBytesUsingEncoding:NSUTF8StringEncoding]))); - function->ExecuteFunction(function, args, retval, e, true); - - context->Exit(); - }; - - PathWatcher *pathWatcher = [PathWatcher pathWatcherForContext:CefV8Context::GetCurrentContext()]; - NSString *watchId = [pathWatcher watchPath:path callback:[[callback copy] autorelease]]; - if (watchId) { - retval = CefV8Value::CreateString([watchId UTF8String]); - } - else { - exception = std::string("Failed to watch path '") + std::string([path UTF8String]) + std::string("' (it may not exist)"); - } - - return true; - } - else if (name == "unwatchPath") { - NSString *path = stringFromCefV8Value(arguments[0]); - NSString *callbackId = stringFromCefV8Value(arguments[1]); - NSError *error = nil; - PathWatcher *pathWatcher = [PathWatcher pathWatcherForContext:CefV8Context::GetCurrentContext()]; - [pathWatcher unwatchPath:path callbackId:callbackId error:&error]; - - if (error) { - exception = [[error localizedDescription] UTF8String]; - } - - return true; - } - else if (name == "makeDirectory") { - NSString *path = stringFromCefV8Value(arguments[0]); - NSFileManager *fm = [NSFileManager defaultManager]; - NSError *error = nil; - [fm createDirectoryAtPath:path withIntermediateDirectories:NO attributes:nil error:&error]; - - if (error) { - exception = [[error localizedDescription] UTF8String]; - } - - return true; - } - else if (name == "move") { - NSString *sourcePath = stringFromCefV8Value(arguments[0]); - NSString *targetPath = stringFromCefV8Value(arguments[1]); - NSFileManager *fm = [NSFileManager defaultManager]; - - NSError *error = nil; - [fm moveItemAtPath:sourcePath toPath:targetPath error:&error]; - - if (error) { - exception = [[error localizedDescription] UTF8String]; - } - - return true; - } - else if (name == "moveToTrash") { - NSString *sourcePath = stringFromCefV8Value(arguments[0]); - bool success = [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation - source:[sourcePath stringByDeletingLastPathComponent] - destination:@"" - files:[NSArray arrayWithObject:[sourcePath lastPathComponent]] - tag:nil]; - - if (!success) { - std::string exception = "Can not move "; - exception += [sourcePath UTF8String]; - exception += " to trash."; - } - - return true; - } - else if (name == "reload") { - CefV8Context::GetCurrentContext()->GetBrowser()->ReloadIgnoreCache(); - } - else if (name == "lastModified") { - NSString *path = stringFromCefV8Value(arguments[0]); - NSFileManager *fm = [NSFileManager defaultManager]; - - NSError *error = nil; - NSDictionary *attributes = [fm attributesOfItemAtPath:path error:&error]; - - if (error) { - exception = [[error localizedDescription] UTF8String]; - } - - NSDate *lastModified = [attributes objectForKey:NSFileModificationDate]; - retval = CefV8Value::CreateDate(CefTime([lastModified timeIntervalSince1970])); - return true; - } - else if (name == "md5ForPath") { - NSString *path = stringFromCefV8Value(arguments[0]); - unsigned char outputData[CC_MD5_DIGEST_LENGTH]; - - NSData *inputData = [[NSData alloc] initWithContentsOfFile:path]; - CC_MD5([inputData bytes], [inputData length], outputData); - [inputData release]; - - NSMutableString *hash = [[NSMutableString alloc] init]; - - for (NSUInteger i = 0; i < CC_MD5_DIGEST_LENGTH; i++) { - [hash appendFormat:@"%02x", outputData[i]]; - } - - retval = CefV8Value::CreateString([hash UTF8String]); - return true; - } - else if (name == "exec") { - NSString *command = stringFromCefV8Value(arguments[0]); - CefRefPtr options = arguments[1]; - CefRefPtr callback = arguments[2]; - - NSTask *task = [[NSTask alloc] init]; - [task setLaunchPath:@"/bin/sh"]; - [task setStandardInput:[NSFileHandle fileHandleWithNullDevice]]; - [task setArguments:[NSArray arrayWithObjects:@"-l", @"-c", command, nil]]; - - NSPipe *stdout = [NSPipe pipe]; - NSPipe *stderr = [NSPipe pipe]; - [task setStandardOutput:stdout]; - [task setStandardError:stderr]; - - CefRefPtr context = CefV8Context::GetCurrentContext(); - void (^outputHandle)(NSFileHandle *fileHandle, CefRefPtr function) = nil; - void (^taskTerminatedHandle)() = nil; - - outputHandle = ^(NSFileHandle *fileHandle, CefRefPtr function) { - context->Enter(); - - NSData *data = [fileHandle availableData]; - NSString *contents = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - - CefV8ValueList args; - CefRefPtr retval = CefV8Value::CreateBool(YES); - CefRefPtr e; - - args.push_back(CefV8Value::CreateString(std::string([contents UTF8String], [contents lengthOfBytesUsingEncoding:NSUTF8StringEncoding]))); - function->ExecuteFunction(function, args, retval, e, false); - - if (e.get()) { - throwException(context->GetGlobal(), e, @"Error thrown in OutputHandle"); - } - - [contents release]; - context->Exit(); - }; - - taskTerminatedHandle = ^() { - context->Enter(); - NSString *output = [[NSString alloc] initWithData:[[stdout fileHandleForReading] readDataToEndOfFile] encoding:NSUTF8StringEncoding]; - NSString *errorOutput = [[NSString alloc] initWithData:[[task.standardError fileHandleForReading] readDataToEndOfFile] encoding:NSUTF8StringEncoding]; - - CefV8ValueList args; - CefRefPtr retval; - CefRefPtr e; - - args.push_back(CefV8Value::CreateInt([task terminationStatus])); - args.push_back(CefV8Value::CreateString([output UTF8String])); - args.push_back(CefV8Value::CreateString([errorOutput UTF8String])); - - callback->ExecuteFunction(callback, args, retval, e, false); - - if (e.get()) { - throwException(context->GetGlobal(), e, @"Error thrown in TaskTerminatedHandle"); - } - - context->Exit(); - - stdout.fileHandleForReading.writeabilityHandler = nil; - stderr.fileHandleForReading.writeabilityHandler = nil; - }; - - task.terminationHandler = ^(NSTask *) { - dispatch_sync(dispatch_get_main_queue(), taskTerminatedHandle); - }; - - CefRefPtr stdoutFunction = options->GetValue("stdout"); - if (stdoutFunction->IsFunction()) { - stdout.fileHandleForReading.writeabilityHandler = ^(NSFileHandle *fileHandle) { - dispatch_sync(dispatch_get_main_queue(), ^() { - outputHandle(fileHandle, stdoutFunction); - }); - }; - } - - CefRefPtr stderrFunction = options->GetValue("stderr"); - if (stderrFunction->IsFunction()) { - stderr.fileHandleForReading.writeabilityHandler = ^(NSFileHandle *fileHandle) { - dispatch_sync(dispatch_get_main_queue(), ^() { - outputHandle(fileHandle, stderrFunction); - }); - }; - } - - [task launch]; - - return true; - } - else if (name == "getPlatform") { - retval = CefV8Value::CreateString("mac"); - return true; - } - return false; -}; \ No newline at end of file diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt new file mode 100644 index 000000000..3e6458c5b --- /dev/null +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -0,0 +1,20 @@ +# The Chromium Embedded Framework (CEF) project is built on top of the Chromium +# project source tree. Chromium should be updated to the URL and revision listed +# below before building CEF. Chromium compatibility information for older CEF +# revisions is available by viewing this file's change history. +# +# To configure a specific Chromium URL: +# gclient config chromium_url +# +# To update to a specific Chromium revision: +# gclient sync --revision src@chromium_revision --jobs 8 --force +# +# This file is integrated with the CEF Automation Tool. See the +# tools/automate/automate.README.txt file for more information. +# +# For general gclient usage information visit: +# http://dev.chromium.org/developers/how-tos/get-the-code + +{ + 'release_url': 'http://src.chromium.org/svn/releases/21.0.1180.18', +} diff --git a/DEPS b/DEPS new file mode 100644 index 000000000..0a7dc22e3 --- /dev/null +++ b/DEPS @@ -0,0 +1,7 @@ +hooks = [ + { + # A change to a .gyp, .gypi, or to GYP itself should run the generator. + "pattern": ".", + "action": ["python", "src/cef/tools/gclient_hook.py"], + }, +] diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 000000000..52812e171 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,29 @@ +// Copyright (c) 2008-2012 Marshall A. Greenblatt. Portions Copyright (c) +// 2006-2009 Google Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md deleted file mode 100644 index d5ef7e210..000000000 --- a/README.md +++ /dev/null @@ -1,100 +0,0 @@ -# Atom — Futuristic Text Editing -## Be forwarned: Atom is pre-alpha software! - - -## Building from source - -1. Get [xcode 4.2 or above](http://itunes.apple.com/us/app/xcode/id448457090?mt=12) - -2. Install CoffeeScript http://coffeescript.org/ -``` -brew install nodejs -curl https://npmjs.org/install.sh | sh -npm i -g coffee-script -``` - -3. `git clone git@github.com:github/atom.git` - -4. `cd atom` - -5. `rake run` - - -## Setup Your ~/.atom Directory -An example .atom directory can be found at the root of the source tree - -## Basic Keyboard shortcuts -Atom doesn't have much in the way of menus yet. Use these keyboard shortcuts to -explore features. - -`cmd-o` : open file/directory - -`cmd-n` : new window - -`cmd-t` : open fuzzy file finder - -`cmd-:` : open command prompt - -`cmd-f` : open command prompt with / - -`cmd-g` : repeat the last search - -`cmd-r` : reload the current window - -`cmd-alt-ctrl-s` : run specs - -`cmd-alt-arrows` : split screen in direction of arrow - -`cmd-alt-w` : toggle word wrap - -`cmd-alt-f` : fold selected lines - -Most default OS X keybindings also work. - -## Init Script - -Atom will require `~/.atom/atom.coffee` whenever a window is opened or reloaded if it is present in your -home directory. This is a rudimentary jumping off point for your own customizations. - -## Command Panel - -A partial implementation of the [Sam command language](http://man.cat-v.org/plan_9/1/sam) - -*Examples* - -`,` selects entire file - -`1,4` selects lines 1-4 - -`/pattern` selects the first match after the cursor/selection - -`s/pattern/replacement` replace first text matching pattern in current selection - -`s/pattern/replacement/g` replace all text matching pattern in current selection - -`,s/pattern/replacement/g` replace all text matching pattern in file - -`1,4s/pattern/replacement` replace all text matching pattern in lines 1-4 - -`x/pattern` selects all matches in the current selections - -`,x/pattern` selects all matches in the file - -`,x/pattern1/ x/pattern2` "structural regex" - selects all matches of pattern2 inside matches of pattern1 - -## Key Bindings - -Atom has a CSS based key binding scheme. We will add a nicer loading mechanism, but for now you can bind -keys by calling `window.keymap.bindKeys` with a CSS selector and a hash of key-pattern -> event mappings. - -```coffeescript -window.keymap.bindKeys '.editor' - 'ctrl-p': 'party-time' - 'ctrl-q': 'open-dialog-q' -``` - -When a keypress matches a pattern on an element that matches the selector, it will be translated to the -named event, which will bubble up the DOM from the site of the keypress. Extension code can listen for -the named event and react to it. - - diff --git a/Rakefile b/Rakefile deleted file mode 100644 index 50fe978ed..000000000 --- a/Rakefile +++ /dev/null @@ -1,124 +0,0 @@ -require 'fileutils' - -$ATOM_ARGS = [] - -ENV['PATH'] = "#{ENV['PATH']}:/usr/local/bin/" -BUILD_DIR = 'atom-build' -mkdir_p BUILD_DIR - -desc "Build Atom via `xcodebuild`" -task :build => :"verify-prerequisites" do - output = `xcodebuild -scheme atom-release SYMROOT=#{BUILD_DIR}` - if $?.exitstatus != 0 - $stderr.puts "Error #{$?.exitstatus}:\n#{output}" - exit($?.exitstatus) - end -end - -desc "Clean build Atom via `xcodebuild`" -task :clean do - output = `xcodebuild clean SYMROOT=#{BUILD_DIR}` - rm_rf BUILD_DIR -end - -desc "Create the Atom.app for distribution" -task :package => :build do - if path = application_path() - FileUtils.rm_rf "pkg" - FileUtils.mkdir_p "pkg" - FileUtils.cp_r path, "pkg/" - `cd pkg && zip -r atom.zip .` - else - exit(1) - end -end - -desc "Run Atom" -task :run => :build do - if path = binary_path() - exitstatus = system "#{path} #{$ATOM_ARGS.join(' ')} 2> /dev/null" - exit(exitstatus) - else - exit(1) - end -end - -desc "Run the specs" -task :test => :clean do - $ATOM_ARGS.push "--test", "--headless" - Rake::Task["run"].invoke -end - -desc "Run the benchmarks" -task :benchmark do - $ATOM_ARGS.push "--benchmark", "--headless" - Rake::Task["run"].invoke -end - -desc "Copy files to bundle and compile CoffeeScripts" -task :"copy-files-to-bundle" => :"verify-prerequisites" do - project_dir = ENV['PROJECT_DIR'] || '.' - built_dir = ENV['BUILT_PRODUCTS_DIR'] || '.' - contents_dir = ENV['CONTENTS_FOLDER_PATH'].to_s - - dest = File.join(built_dir, contents_dir, "Resources") - - %w(static index.html).each do |dir| - rm_rf File.join(dest, dir) - cp_r dir, File.join(dest, dir) - end - - if ENV['LOAD_RESOURCES_FROM_DIR'] - sh "coffee -c -o #{dest}/src/stdlib src/stdlib/require.coffee" - cp "src/stdlib/onig-reg-exp-extension.js", "#{dest}/src/stdlib" - cp "src/stdlib/native-handler.js", "#{dest}/src/stdlib" - else - %w(src static vendor spec benchmark bundles themes).each do |dir| - rm_rf File.join(dest, dir) - cp_r dir, File.join(dest, dir) - end - - sh "coffee -c #{dest}/src #{dest}/vendor #{dest}/spec #{dest}/benchmark" - end -end - -desc "Remove any 'fit' or 'fdescribe' focus directives from the specs" -task :nof do - system %{find . -name *spec.coffee | xargs sed -E -i "" "s/f+(it|describe) +(['\\"])/\\1 \\2/g"} -end - -task :"verify-prerequisites" do - `hash coffee` - if not $?.success? - abort "error: coffee is required but it's not installed - " + - "http://coffeescript.org/ - (try `npm i -g coffee-script`)" - end -end - -def application_path - applications = FileList["#{BUILD_DIR}/**/Atom.app"] - if applications.size == 0 - $stderr.puts "No Atom application found in directory `#{BUILD_DIR}`" - elsif applications.size > 1 - $stderr.puts "Multiple Atom applications found \n\t" + applications.join("\n\t") - else - return applications.first - end - - return nil -end - -def binary_path - if app_path = application_path() - binary_path = "#{app_path}/Contents/MacOS/Atom" - if File.exists?(binary_path) - return binary_path - else - $stderr.puts "Executable `#{app_path}` not found." - end - end - - return nil -end - - diff --git a/apk_test.gypi b/apk_test.gypi new file mode 100644 index 000000000..83f88b4b0 --- /dev/null +++ b/apk_test.gypi @@ -0,0 +1,57 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This file is meant to be included into a target to provide a rule +# to build APK based test suites. +# +# To use this, create a gyp target with the following form: +# { +# 'target_name': 'test_suite_name_apk', +# 'type': 'none', +# 'variables': { +# 'test_suite_name': 'test_suite_name', # string +# 'input_shlib_path' : '/path/to/test_suite.so', # string +# 'input_jars_paths': ['/path/to/test_suite.jar', ... ], # list +# }, +# 'includes': ['path/to/this/gypi/file'], +# } +# + +{ + 'target_conditions': [ + ['_toolset == "target"', { + 'conditions': [ + ['OS == "android" and gtest_target_type == "shared_library"', { + 'actions': [{ + 'action_name': 'apk_<(test_suite_name)', + 'message': 'Building <(test_suite_name) test apk.', + 'inputs': [ + '<(DEPTH)/testing/android/AndroidManifest.xml', + '<(DEPTH)/testing/android/generate_native_test.py', + '<(input_shlib_path)', + '<@(input_jars_paths)', + ], + 'outputs': [ + '<(PRODUCT_DIR)/<(test_suite_name)_apk/<(test_suite_name)-debug.apk', + ], + 'action': [ + '<(DEPTH)/testing/android/generate_native_test.py', + '--native_library', + '<(input_shlib_path)', + '--jars', + '"<@(input_jars_paths)"', + '--output', + '<(PRODUCT_DIR)/<(test_suite_name)_apk', + '--app_abi', + '<(android_app_abi)', + '--ant-args', + '-DPRODUCT_DIR=<(ant_build_out)', + '--ant-compile' + ], + }], + }], # 'OS == "android" and gtest_target_type == "shared_library" + ], # conditions + }], + ], # target_conditions +} diff --git a/atom.gyp b/atom.gyp new file mode 100644 index 000000000..1acbe566e --- /dev/null +++ b/atom.gyp @@ -0,0 +1,371 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +{ + 'variables': { + 'pkg-config': 'pkg-config', + 'chromium_code': 1, + }, + 'includes': [ + # Bring in the source file lists. + 'cef_paths2.gypi', + ], + 'targets': [ + { + 'target_name': 'Atom', + 'type': 'executable', + 'mac_bundle': 1, + 'msvs_guid': 'D22C6F51-AA2D-457C-B579-6C97A96C724D', + 'dependencies': [ + 'libcef_dll_wrapper', + ], + 'defines': [ + 'USING_CEF_SHARED', + ], + 'include_dirs': [ + '.', + 'atom', + ], + 'sources': [ + '<@(includes_common)', + '<@(includes_wrapper)', + 'atom/cefclient/cefclient.cpp', + 'atom/cefclient/cefclient.h', + 'atom/cefclient/binding_test.cpp', + 'atom/cefclient/binding_test.h', + 'atom/cefclient/client_app.cpp', + 'atom/cefclient/client_app.h', + 'atom/cefclient/client_app_delegates.cpp', + 'atom/cefclient/client_handler.cpp', + 'atom/cefclient/client_handler.h', + 'atom/cefclient/client_renderer.cpp', + 'atom/cefclient/client_renderer.h', + 'atom/cefclient/client_switches.cpp', + 'atom/cefclient/client_switches.h', + 'atom/cefclient/dom_test.cpp', + 'atom/cefclient/dom_test.h', + 'atom/cefclient/res/binding.html', + 'atom/cefclient/res/dialogs.html', + 'atom/cefclient/res/domaccess.html', + 'atom/cefclient/res/localstorage.html', + 'atom/cefclient/res/logo.png', + 'atom/cefclient/res/xmlhttprequest.html', + 'atom/cefclient/resource_util.h', + 'atom/cefclient/scheme_test.cpp', + 'atom/cefclient/scheme_test.h', + 'atom/cefclient/string_util.cpp', + 'atom/cefclient/string_util.h', + 'atom/cefclient/util.h', + ], + 'mac_bundle_resources': [ + 'atom/cefclient/mac/Atom.icns', + 'atom/cefclient/mac/English.lproj/InfoPlist.strings', + 'atom/cefclient/mac/English.lproj/MainMenu.xib', + 'atom/cefclient/mac/Info.plist', + 'atom/cefclient/res/binding.html', + 'atom/cefclient/res/dialogs.html', + 'atom/cefclient/res/domaccess.html', + 'atom/cefclient/res/localstorage.html', + 'atom/cefclient/res/logo.png', + 'atom/cefclient/res/xmlhttprequest.html', + ], + 'mac_bundle_resources!': [ + # TODO(mark): Come up with a fancier way to do this (mac_info_plist?) + # that automatically sets the correct INFOPLIST_FILE setting and adds + # the file to a source group. + 'atom/cefclient/mac/Info.plist', + ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'atom/cefclient/mac/Info.plist', + # Necessary to avoid an "install_name_tool: changing install names or + # rpaths can't be redone" error. + 'OTHER_LDFLAGS': ['-Wl,-headerpad_max_install_names'], + }, + 'conditions': [ + ['OS=="win" and win_use_allocator_shim==1', { + 'dependencies': [ + '<(DEPTH)/base/allocator/allocator.gyp:allocator', + ], + }], + ['OS=="win"', { + 'configurations': { + 'Debug_Base': { + 'msvs_settings': { + 'VCLinkerTool': { + 'LinkIncremental': '<(msvs_large_module_debug_link_mode)', + }, + }, + }, + }, + 'msvs_settings': { + 'VCLinkerTool': { + # Set /SUBSYSTEM:WINDOWS. + 'SubSystem': '2', + 'EntryPointSymbol' : 'wWinMainCRTStartup', + }, + }, + 'link_settings': { + 'libraries': [ + '-lcomctl32.lib', + '-lshlwapi.lib', + '-lrpcrt4.lib', + ], + }, + 'sources': [ + '<@(includes_win)', + '<@(cefclient_sources_win)', + ], + }], + ['OS == "win" or (toolkit_uses_gtk == 1 and selinux == 0)', { + 'dependencies': [ + '<(DEPTH)/sandbox/sandbox.gyp:sandbox', + ], + }], + ['toolkit_uses_gtk == 1', { + 'dependencies': [ + '<(DEPTH)/build/linux/system.gyp:gtk', + ], + }], + [ 'OS=="mac"', { + 'product_name': 'Atom', + 'dependencies': [ + 'AtomHelperApp', + ], + 'copies': [ + { + # Add library dependencies to the bundle. + 'destination': '<(PRODUCT_DIR)/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/', + 'files': [ + 'cef/libcef.dylib', + 'cef/ffmpegsumo.so', + ], + }, + { + # Add the helper app. + 'destination': '<(PRODUCT_DIR)/Atom.app/Contents/Frameworks', + 'files': [ + '<(PRODUCT_DIR)/Atom Helper.app', + ], + }, + ], + 'postbuilds': [ + { + 'postbuild_name': 'Fix Framework Link', + 'action': [ + 'install_name_tool', + '-change', + '@executable_path/libcef.dylib', + '@executable_path/../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}' + ], + }, + { + 'postbuild_name': 'Create Resources Directory In Bundle', + 'action': [ + 'mkdir', + '-p', + '${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources' + ], + }, + { + 'postbuild_name': 'Copy Pack File', + 'action': [ + 'cp', + '-f', + 'cef/cef.pak', + '${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/cef.pak' + ], + }, + { + 'postbuild_name': 'Copy WebCore Resources', + 'action': [ + 'cp', + '-Rf', + '${BUILT_PRODUCTS_DIR}/../../third_party/WebKit/Source/WebCore/Resources/', + '${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/' + ], + }, + { + # Modify the Info.plist as needed. + 'postbuild_name': 'Tweak Info.plist', + 'action': ['../build/mac/tweak_info_plist.py', + '--svn=1'], + }, + { + # This postbuid step is responsible for creating the following + # helpers: + # + # cefclient Helper EH.app and cefclient Helper NP.app are created + # from cefclient Helper.app. + # + # The EH helper is marked for an executable heap. The NP helper + # is marked for no PIE (ASLR). + 'postbuild_name': 'Make More Helpers', + 'action': [ + '../build/mac/make_more_helpers.sh', + 'Frameworks', + 'Atom', + ], + }, + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/AppKit.framework', + ], + }, + 'sources': [ + 'include/cef_application_mac.h', + 'include/internal/cef_mac.h', + 'include/internal/cef_types_mac.h', + 'atom/cefclient/cefclient_mac.mm', + 'atom/cefclient/client_handler_mac.mm', + 'atom/cefclient/resource_util_mac.mm', + ], + }], + [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + 'sources': [ + '<@(includes_linux)', + '<@(cefclient_sources_linux)', + ], + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/files', + 'files': [ + '<@(cefclient_bundle_resources_linux)', + ], + }, + ], + }], + ], + }, + { + 'target_name': 'libcef_dll_wrapper', + 'type': 'static_library', + 'msvs_guid': 'A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9', + 'dependencies': [ ], + 'defines': [ + 'USING_CEF_SHARED', + ], + 'include_dirs': [ + '.', + ], + 'sources': [ + '<@(includes_common)', + '<@(includes_capi)', + '<@(includes_wrapper)', + '<@(libcef_dll_wrapper_sources_common)', + ], + 'link_settings': { + 'libraries': [ + 'cef/libcef.dylib', + ], + }, + }, + ], + 'conditions': [ + ['os_posix==1 and OS!="mac" and OS!="android" and gcc_version==46', { + 'target_defaults': { + # Disable warnings about c++0x compatibility, as some names (such + # as nullptr) conflict with upcoming c++0x types. + 'cflags_cc': ['-Wno-c++0x-compat'], + }, + }], + ['OS=="mac"', { + 'targets': [ + { + 'target_name': 'AtomHelperApp', + 'type': 'executable', + 'variables': { 'enable_wexit_time_destructors': 1, }, + 'product_name': 'Atom Helper', + 'mac_bundle': 1, + 'dependencies': [ + 'libcef_dll_wrapper', + ], + 'defines': [ + 'USING_CEF_SHARED', + ], + 'include_dirs': [ + '.', + 'atom' + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/AppKit.framework', + ], + }, + 'sources': [ + 'atom/cefclient/binding_test.cpp', + 'atom/cefclient/binding_test.h', + 'atom/cefclient/client_app.cpp', + 'atom/cefclient/client_app.h', + 'atom/cefclient/client_app_delegates.cpp', + 'atom/cefclient/client_handler.cpp', + 'atom/cefclient/client_handler.h', + 'atom/cefclient/client_handler_mac.mm', + 'atom/cefclient/client_renderer.cpp', + 'atom/cefclient/client_renderer.h', + 'atom/cefclient/client_switches.cpp', + 'atom/cefclient/client_switches.h', + 'atom/cefclient/dom_test.cpp', + 'atom/cefclient/dom_test.h', + 'atom/cefclient/process_helper_mac.cpp', + 'atom/cefclient/resource_util.h', + 'atom/cefclient/resource_util_mac.mm', + 'atom/cefclient/scheme_test.cpp', + 'atom/cefclient/scheme_test.h', + 'atom/cefclient/string_util.cpp', + 'atom/cefclient/string_util.h', + 'atom/cefclient/util.h', + ], + # TODO(mark): Come up with a fancier way to do this. It should only + # be necessary to list helper-Info.plist once, not the three times it + # is listed here. + 'mac_bundle_resources!': [ + 'atom/cefclient/mac/helper-Info.plist', + ], + # TODO(mark): For now, don't put any resources into this app. Its + # resources directory will be a symbolic link to the browser app's + # resources directory. + 'mac_bundle_resources/': [ + ['exclude', '.*'], + ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'atom/cefclient/mac/helper-Info.plist', + # Necessary to avoid an "install_name_tool: changing install names or + # rpaths can't be redone" error. + 'OTHER_LDFLAGS': ['-Wl,-headerpad_max_install_names'], + }, + 'postbuilds': [ + { + # The framework defines its load-time path + # (DYLIB_INSTALL_NAME_BASE) relative to the main executable + # (chrome). A different relative path needs to be used in + # cefclient_helper_app. + 'postbuild_name': 'Fix Framework Link', + 'action': [ + 'install_name_tool', + '-change', + '@executable_path/libcef.dylib', + '@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}' + ], + }, + { + # Modify the Info.plist as needed. The script explains why this + # is needed. This is also done in the chrome and chrome_dll + # targets. In this case, --breakpad=0, --keystone=0, and --svn=0 + # are used because Breakpad, Keystone, and Subversion keys are + # never placed into the helper. + 'postbuild_name': 'Tweak Info.plist', + 'action': ['./chromium/build/mac/tweak_info_plist.py', + '--breakpad=0', + '--keystone=0', + '--svn=0'], + }, + ], + }, # target cefclient_helper_app + ], + }], # OS=="mac" + ], +} diff --git a/atom.icns b/atom.icns deleted file mode 100644 index f3beba809..000000000 Binary files a/atom.icns and /dev/null differ diff --git a/atom.xcodeproj/project.pbxproj b/atom.xcodeproj/project.pbxproj new file mode 100644 index 000000000..6937eebaa --- /dev/null +++ b/atom.xcodeproj/project.pbxproj @@ -0,0 +1,2081 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXAggregateTarget section */ + 6528CFCB61FA1061980980AE /* All */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 72C03118553CDFF86825B100 /* Build configuration list for PBXAggregateTarget "All" */; + buildPhases = ( + ); + dependencies = ( + 214AE437B79B44838E8059D6 /* PBXTargetDependency */, + 5F21A94BBCC21CF3166DD251 /* PBXTargetDependency */, + EEFD0410DD19F76A53FE0D85 /* PBXTargetDependency */, + ); + name = All; + productName = All; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 00E95FD43813F2E09369A617 /* geolocation_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0F9D8C500A024D6886EF4B53 /* geolocation_handler_cpptoc.cc */; }; + 02A8A10DE7A3CDA0AC607E61 /* client_renderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D37851B41429592E37B3A9C8 /* client_renderer.cpp */; }; + 0411700BFF66FD0D5DA623A7 /* urlrequest_client_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = B769C4454E88CAE69D8E9BDA /* urlrequest_client_cpptoc.cc */; }; + 09A0D0BBDF01567A72A3FADA /* browser_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = AD8D830C8B484B028BF3F0B4 /* browser_ctocpp.cc */; }; + 09E0B767262945659A9152A5 /* urlrequest_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 569ACE130A89E1EA0BCA08A4 /* urlrequest_ctocpp.cc */; }; + 0DBFD3159E4FF78DEA4C431A /* read_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = F005091550289905B4B6096C /* read_handler_cpptoc.cc */; }; + 0FA37E812C1B34F007E17193 /* cefclient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F611B99AD296ADD51058D742 /* cefclient.cpp */; }; + 11C3B98FA9A36B5557ECD732 /* load_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 358E48B5A4F72C9DC84BE229 /* load_handler_cpptoc.cc */; }; + 133CAA9CAC2FE868BE693DD7 /* request_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 430255B1D74762D49D56B2EB /* request_ctocpp.cc */; }; + 15145332E67F5241AC10DB0F /* domdocument_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = EB18CE2A00D7F993711EEB5C /* domdocument_ctocpp.cc */; }; + 15673286F479E3DD72228B1A /* life_span_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = F10AAEDAA9C5C041F45DA56D /* life_span_handler_cpptoc.cc */; }; + 170B1FA5A1142DC30B53984E /* client_app.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BBB7B4779BFA5A28D25157CD /* client_app.cpp */; }; + 18D042626F69B3FA86BD2DCB /* client_switches.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD6704225845420F697A458B /* client_switches.cpp */; }; + 19A26FF9657D61EB4DFAEF24 /* scheme_handler_factory_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = E324492DA04785C9FE6025E3 /* scheme_handler_factory_cpptoc.cc */; }; + 1AD956029A63FD7FBC5F5632 /* client_renderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D37851B41429592E37B3A9C8 /* client_renderer.cpp */; }; + 1B635AD6DDE5A30ABA0BFBF9 /* cef_zip_archive.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8A45DBAD18F986EB8323B132 /* cef_zip_archive.cc */; }; + 1B94D97D87C3D4F18B1FD364 /* libcef_dll_wrapper.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2FB0A2A624D8FBF3E2ED27E2 /* libcef_dll_wrapper.a */; }; + 1E4F3FE3D3277C8BB8170687 /* client_app_delegates.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD4CBC09BA3E54E2FC80A782 /* client_app_delegates.cpp */; }; + 1EBCB6D242C49767F095AF4F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 709C7A8894CFC53DB4A6904A /* InfoPlist.strings */; }; + 2208650753998BDD85A8065E /* domvisitor_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = EA6CDBF6F227A0F1049AB0D0 /* domvisitor_cpptoc.cc */; }; + 22277E6C4F42801F78F8CBE6 /* callback_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = CCCD14801A9D76CA3A2D5F36 /* callback_ctocpp.cc */; }; + 271DA0CAA64B7F04BA9E4B43 /* libcef.dylib in Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/ */ = {isa = PBXBuildFile; fileRef = DB44B0B1D0D1A4A204C4D721 /* libcef.dylib */; }; + 28710911A945A80641BB1E89 /* string_util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E864251A0EFEB6D92262433F /* string_util.cpp */; }; + 2B05EA77E07F07EE3DBE61D8 /* xmlhttprequest.html in Resources */ = {isa = PBXBuildFile; fileRef = F18A1AF7B2FFBF8C0B6E03C2 /* xmlhttprequest.html */; }; + 2B079CADF001CEF6EA895D7A /* write_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = F021D8DC9B5B46E1D2F55B8F /* write_handler_cpptoc.cc */; }; + 2E62CE142B79EAF1AAC74978 /* binding.html in Resources */ = {isa = PBXBuildFile; fileRef = AB158A494CD29727C3ABF79E /* binding.html */; }; + 2FC328FB9CC4E7B01E57F2C3 /* domaccess.html in Resources */ = {isa = PBXBuildFile; fileRef = 5BF839B43E5EB6CE6945DAB3 /* domaccess.html */; }; + 3152E6C88B608AF03BCB1246 /* transfer_util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C9ECB41E85597AC94A57D250 /* transfer_util.cpp */; }; + 31FDA34AC3060D049E996FFC /* libcef.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D2141D4332C19847EB87AAF /* libcef.dylib */; }; + 324201CAE107029E9117596E /* string_visitor_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 1907F9480DB53A3F0DF752E0 /* string_visitor_cpptoc.cc */; }; + 33F807F17A3BB533AA71FE3A /* cefclient_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0A395E31D08AFE54DF364BD8 /* cefclient_mac.mm */; }; + 364BBD351E096D832CE3CD3E /* download_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = E6E5D3276CEA77BB22BAF8E2 /* download_handler_cpptoc.cc */; }; + 3B101F19E46A070BC92A6A2C /* scheme_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBF5A644FD4803A78E68D422 /* scheme_test.cpp */; }; + 3CB3F4DBB7E5842B82AA6414 /* v8exception_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = E0E0A1FD0CC05EFA6D420C91 /* v8exception_ctocpp.cc */; }; + 3F141663B10B4FA301E02078 /* Atom.icns in Resources */ = {isa = PBXBuildFile; fileRef = E28F7B19EBBEAB5154036B43 /* Atom.icns */; }; + 3F6FFF06AD7FFF8429B3F86E /* resource_util_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0E810717DC2D77F1B065D6F1 /* resource_util_mac.mm */; }; + 421E3C2957F2926C67F3BDAF /* resource_bundle_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 486EAD58F64C7354BD9BF7FB /* resource_bundle_handler_cpptoc.cc */; }; + 43BB0852EABA2A47EC0D30E0 /* browser_host_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = BF1CA77DAAAF3D26C1644B16 /* browser_host_ctocpp.cc */; }; + 4687097498D68F7CB4B0C7CE /* client_handler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83366F559D651D3D6F010552 /* client_handler.cpp */; }; + 4AD0A8D32E9E2CD7A0857CBA /* binding_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE6C330A0416CE0C5AFB966 /* binding_test.cpp */; }; + 4F94179933CAB59CD02A8980 /* web_plugin_info_visitor_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 105882DA63C11BAE1FD15912 /* web_plugin_info_visitor_cpptoc.cc */; }; + 51DF03C4EB5CEE3E836797E0 /* frame_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = EB8E59A89E8B84BE29BA7365 /* frame_ctocpp.cc */; }; + 529A0E7E66F130A3CB0C644F /* menu_model_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4A8CEF7B36A3F4506ACF6472 /* menu_model_ctocpp.cc */; }; + 52FC0543953215E4AC8FC058 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D065F97F8D63F8168D14CB4 /* AppKit.framework */; }; + 549270133CF8C9BFA2EFBE00 /* v8context_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 893A0C7893C498FA927E3760 /* v8context_ctocpp.cc */; }; + 56442AC773E63B38653C15E6 /* task_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = F3072F2897B0C489C1C07F03 /* task_cpptoc.cc */; }; + 5A0F54485B7CFAFB74334C25 /* domevent_listener_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = BC50E1057B487F5AF0A0F7C3 /* domevent_listener_cpptoc.cc */; }; + 5CED6B5C63885CCCC95BAC86 /* resource_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 398F992B145AB9252FF50298 /* resource_handler_cpptoc.cc */; }; + 5E4105277D71C5C621AF29A5 /* cookie_manager_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = F9FAD86D0106486D9F6CAB64 /* cookie_manager_ctocpp.cc */; }; + 5E6F00EDF431379070796D90 /* client_handler_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5667E7216525A0A996EC0E21 /* client_handler_mac.mm */; }; + 61752187080D3C206DE3E18B /* keyboard_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3635E480B7F9DCC771B002FE /* keyboard_handler_cpptoc.cc */; }; + 627C11FA24E1849F26B785E8 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D065F97F8D63F8168D14CB4 /* AppKit.framework */; }; + 62A632B5663B48182897B179 /* jsdialog_callback_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = A9E34E227A6522EE9E6B678B /* jsdialog_callback_ctocpp.cc */; }; + 63C64D70146434E02484F8FD /* proxy_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3BBE685CEE22005DFB009944 /* proxy_handler_cpptoc.cc */; }; + 67AD4BCBE68FFCCD556D15CD /* post_data_element_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5DB23C963556513BD246C81 /* post_data_element_ctocpp.cc */; }; + 6842068D6DF732A88809F3F6 /* v8value_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4270EEC8527C3500CD8AEF91 /* v8value_ctocpp.cc */; }; + 6D73CFE9F308026324A40C06 /* client_handler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83366F559D651D3D6F010552 /* client_handler.cpp */; }; + 6DBE3711789F0A14747FAC10 /* web_plugin_info_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = F95FCF0F4C19634D3E55434B /* web_plugin_info_ctocpp.cc */; }; + 72D17F1E14EC8DA56C960EF1 /* app_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 786557A77F668A536C47DCF0 /* app_cpptoc.cc */; }; + 754D3ADCCC459959D2D70FC5 /* browser_process_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 2ECC93253B64FA1FDC8657F7 /* browser_process_handler_cpptoc.cc */; }; + 7701E6A4EAFA8986B5AF76A2 /* cef_stream_resource_handler.cc in Sources */ = {isa = PBXBuildFile; fileRef = B8EAF503154E387DF3DA1E8B /* cef_stream_resource_handler.cc */; }; + 78E03FF294CB4ED999B2CDCB /* client_app.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BBB7B4779BFA5A28D25157CD /* client_app.cpp */; }; + 79886EEA116D709E65484076 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5E8EB8112AD7378AB11B0371 /* MainMenu.xib */; }; + 79A3432EAB7B2EE6553AEFBF /* v8handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4B0B8688FBBBD4FB20FF627C /* v8handler_cpptoc.cc */; }; + 7B70944055CD6F3EA2F64445 /* dom_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 698E4D82D5A48BEEF72A0A78 /* dom_test.cpp */; }; + 7EA6572C1CFD7CC0992F238F /* cef_xml_object.cc in Sources */ = {isa = PBXBuildFile; fileRef = 068180596E1A7AE276161E91 /* cef_xml_object.cc */; }; + 816F8353FBE1427B20ECC45C /* request_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 54D1146F7F37B195FF73CC6F /* request_handler_cpptoc.cc */; }; + 81735F5DF5FAA9B0E578FF45 /* download_item_callback_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8395F3CBAB1C065B5FC4D68F /* download_item_callback_ctocpp.cc */; }; + 83293B5CD12DEC2D565A0E93 /* stream_writer_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = F253D00D10507AAA89CADA4D /* stream_writer_ctocpp.cc */; }; + 8460BC9DE73453374D3C7924 /* context_menu_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = E8BCE9ACB05D6D608EDA2EA6 /* context_menu_handler_cpptoc.cc */; }; + 8496F057C81E15B08C9A307D /* libcef_dll_wrapper2.cc in Sources */ = {isa = PBXBuildFile; fileRef = C9B9D5EE0AE765BA2CE95E3D /* libcef_dll_wrapper2.cc */; }; + 863A1083DB4E22AEBC66C97F /* string_util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E864251A0EFEB6D92262433F /* string_util.cpp */; }; + 87EBCA5235655B2DCFEF9BEF /* list_value_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 637D5B7F9B843EDCC06D30B6 /* list_value_ctocpp.cc */; }; + 8A29BFA8BC7BCA864909F61A /* response_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5E1C59AD3074023FEA140CAE /* response_ctocpp.cc */; }; + 8B34033ECA389CAAE4C21F09 /* libcef_dll_wrapper.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5295DF3ECB3172EF8C45B6AF /* libcef_dll_wrapper.cc */; }; + 8C038B7C92E5F83FCD39C22C /* download_item_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 6267CFABF3CD48619F3796BA /* download_item_ctocpp.cc */; }; + 8ED45603734FF298D5A86CCB /* process_helper_mac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C64674A62F450A50FBA9A0D /* process_helper_mac.cpp */; }; + 91AAB6A4FE38F100BC6212A2 /* stream_reader_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 236A9AFABFE62BD05ECA7AC8 /* stream_reader_ctocpp.cc */; }; + 96FC4FB613623784F993EB5D /* ffmpegsumo.so in Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/ */ = {isa = PBXBuildFile; fileRef = 7EA912CBF5992E4D8B48341B /* ffmpegsumo.so */; }; + 99BD65EC1D299C7A5839878E /* display_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = F4C42A3074E03DCFD88F44EC /* display_handler_cpptoc.cc */; }; + 9FC2F3DDA9E97E574DD03D8C /* client_switches.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD6704225845420F697A458B /* client_switches.cpp */; }; + 9FE8A3BB5F2A63163ED1124A /* resource_util_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0E810717DC2D77F1B065D6F1 /* resource_util_mac.mm */; }; + A0DC7D175117A2CAD96FFA95 /* cef_byte_read_handler.cc in Sources */ = {isa = PBXBuildFile; fileRef = DC8B2A92CEC7E64CC3EA346C /* cef_byte_read_handler.cc */; }; + A28583954F42BECA67E45F88 /* context_menu_params_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 2654257A86558F3BB511B5D7 /* context_menu_params_ctocpp.cc */; }; + ACB5998C08FD5B93FF74EFF6 /* v8accessor_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9B382AA034A74CA4A0F0ED4C /* v8accessor_cpptoc.cc */; }; + AE1BF53099A3BD9A346B6DF5 /* render_process_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 695177EC316540831C8F3F00 /* render_process_handler_cpptoc.cc */; }; + B433E882FE6B08DE560430A0 /* xml_reader_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = E44783BC61DF5362B9B7D2E3 /* xml_reader_ctocpp.cc */; }; + BA39FFA42A6E19E730A5E153 /* libcef_dll_wrapper.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2FB0A2A624D8FBF3E2ED27E2 /* libcef_dll_wrapper.a */; }; + C25713D6504475F37B8701C6 /* dialogs.html in Resources */ = {isa = PBXBuildFile; fileRef = 93757D2FC350BDDA2B7DA2AA /* dialogs.html */; }; + C27355E012FD831EFAFD5B33 /* localstorage.html in Resources */ = {isa = PBXBuildFile; fileRef = 270356D0402AF64F58C09A86 /* localstorage.html */; }; + C2A11A61A2F7BD60C4A06277 /* jsdialog_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 98D2D165BC2E660B7652215F /* jsdialog_handler_cpptoc.cc */; }; + C3E86714DDDBFCC30336D587 /* cookie_visitor_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 499F1DDC05B0F3CD78CBF72A /* cookie_visitor_cpptoc.cc */; }; + C6AF304B63F791077EC72BCF /* client_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7D89FD25CF94866A4852937A /* client_cpptoc.cc */; }; + CEF1C8881C9380BBFE2D21BA /* before_download_callback_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = CD3FF6074AD4BDA915DED7AF /* before_download_callback_ctocpp.cc */; }; + CF64C364C6DD7EBF3EA64F58 /* post_data_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 75C95F266AED00470BF37EF4 /* post_data_ctocpp.cc */; }; + D4D96F4CFCB979857AFDBB7F /* dictionary_value_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5CD903CA81B3E37C1E1601F4 /* dictionary_value_ctocpp.cc */; }; + D6A819E465A0B3E4E171A5C3 /* process_message_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4F0353741BADA8DFB2DCE465 /* process_message_ctocpp.cc */; }; + D6B1E73FE24E3857FB3DC184 /* domnode_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 87C649445F024DF09ABB2872 /* domnode_ctocpp.cc */; }; + D7A75FBB2D0EA6CEC1E0C9F3 /* dom_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 698E4D82D5A48BEEF72A0A78 /* dom_test.cpp */; }; + D7DA3B9EB95866126BE6BA10 /* geolocation_callback_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 6C9690FDEB71C11417E53A4B /* geolocation_callback_ctocpp.cc */; }; + E0334AD65F9088008666B4CE /* scheme_registrar_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = E1FB3405663B7FFD60B261B1 /* scheme_registrar_ctocpp.cc */; }; + E280513DCC533F1DBCFDE02F /* domevent_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BEAA9DF3DA999ACBC7DD157 /* domevent_ctocpp.cc */; }; + E437E9E330D43D1AD7FDF4A8 /* zip_reader_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 71F5EAC5A8C1A4D69A063D85 /* zip_reader_ctocpp.cc */; }; + E82153D991127DE8653FCF3E /* auth_callback_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = 8D30B30E682FB390D76925BE /* auth_callback_ctocpp.cc */; }; + ED515C2B0AD945A8722A3E5D /* client_app_delegates.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD4CBC09BA3E54E2FC80A782 /* client_app_delegates.cpp */; }; + EE400221E261BAB5D6B01B49 /* scheme_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBF5A644FD4803A78E68D422 /* scheme_test.cpp */; }; + EF735B2D99313921B0ECF8C7 /* libcef.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D2141D4332C19847EB87AAF /* libcef.dylib */; }; + F0E8A79713BED0E6BCAAD144 /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 906B192A29657F64CA00B012 /* logo.png */; }; + F32730ACB338E2925802F38A /* binding_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE6C330A0416CE0C5AFB966 /* binding_test.cpp */; }; + F5994138581214A3C847B2EE /* client_handler_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5667E7216525A0A996EC0E21 /* client_handler_mac.mm */; }; + F7BA33A02E2FE83494AB1F86 /* binary_value_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = EC24F09DA2C73A96ACF68EC2 /* binary_value_ctocpp.cc */; }; + F9089958C667FA701B60A32E /* command_line_ctocpp.cc in Sources */ = {isa = PBXBuildFile; fileRef = B692459F28B6D01109142B44 /* command_line_ctocpp.cc */; }; + FDD6A5248B951968CE69C9C2 /* focus_handler_cpptoc.cc in Sources */ = {isa = PBXBuildFile; fileRef = CDF90D14742F6A20AEFE7EDC /* focus_handler_cpptoc.cc */; }; + FEF240AA0E5EC80F59D9C38F /* Atom Helper.app in Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks */ = {isa = PBXBuildFile; fileRef = 00B48B83D4C1A30985ED9D96 /* Atom Helper.app */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 350428BEC361E5AA8CD3FA78 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 249C7F80AA72F9C3805358CE /* Project object */; + proxyType = 1; + remoteGlobalIDString = 440934281E3BAF0A1212AEAE; + remoteInfo = libcef_dll_wrapper; + }; + 3861ED6C205164C5E77DF6E6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 249C7F80AA72F9C3805358CE /* Project object */; + proxyType = 1; + remoteGlobalIDString = 440934281E3BAF0A1212AEAE; + remoteInfo = libcef_dll_wrapper; + }; + 45B8C357631C4C10D69440B8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 249C7F80AA72F9C3805358CE /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5FE7B7DEE9B72A21F35CC0E6; + remoteInfo = AtomHelperApp; + }; + 76471E84EFE6CA6091AD77E4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 249C7F80AA72F9C3805358CE /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5FE7B7DEE9B72A21F35CC0E6; + remoteInfo = AtomHelperApp; + }; + A88AEA00A41452E816A72704 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 249C7F80AA72F9C3805358CE /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3049F5DBF2E857E3D2CA729A; + remoteInfo = Atom; + }; + AB718239C5E2B2E8F0154E6F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 249C7F80AA72F9C3805358CE /* Project object */; + proxyType = 1; + remoteGlobalIDString = 440934281E3BAF0A1212AEAE; + remoteInfo = libcef_dll_wrapper; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 2F00E8F3A83BEBC717B6C56E /* Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/ */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/"; + dstSubfolderSpec = 16; + files = ( + 271DA0CAA64B7F04BA9E4B43 /* libcef.dylib in Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/ */, + 96FC4FB613623784F993EB5D /* ffmpegsumo.so in Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/ */, + ); + name = "Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/"; + runOnlyForDeploymentPostprocessing = 0; + }; + 5C150FDFAECC241747EEEC7F /* Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = Atom.app/Contents/Frameworks; + dstSubfolderSpec = 16; + files = ( + FEF240AA0E5EC80F59D9C38F /* Atom Helper.app in Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks */, + ); + name = "Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 00B48B83D4C1A30985ED9D96 /* Atom Helper.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = "Atom Helper.app"; sourceTree = ""; }; + 01758CA4E4707A8029D8D828 /* scheme_handler_factory_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scheme_handler_factory_cpptoc.h; sourceTree = ""; }; + 052A279D62054B5D4F316669 /* cef_keyboard_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_keyboard_handler.h; sourceTree = ""; }; + 0576E6EBDDE217379E2D8079 /* cef_origin_whitelist.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_origin_whitelist.h; sourceTree = ""; }; + 068180596E1A7AE276161E91 /* cef_xml_object.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cef_xml_object.cc; sourceTree = ""; }; + 068A8887F3A556A03A933AFF /* menu_model_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_model_ctocpp.h; sourceTree = ""; }; + 07575805286188F831B80447 /* cef_resource_bundle_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_resource_bundle_handler.h; sourceTree = ""; }; + 0819D447DA2713C09BF050C1 /* cef_jsdialog_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_jsdialog_handler_capi.h; sourceTree = ""; }; + 085527C54F2DAA1B70DAA2A7 /* cef_byte_read_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_byte_read_handler.h; sourceTree = ""; }; + 090DDA0AEEE9282FDCB8F1CF /* cef_callback.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_callback.h; sourceTree = ""; }; + 0A29B87DF8618E540E42B8BD /* cef_proxy_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_proxy_handler.h; sourceTree = ""; }; + 0A395E31D08AFE54DF364BD8 /* cefclient_mac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = cefclient_mac.mm; sourceTree = ""; }; + 0B3CEEB1D8E5DC4006A547F7 /* cef_browser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_browser.h; sourceTree = ""; }; + 0E810717DC2D77F1B065D6F1 /* resource_util_mac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = resource_util_mac.mm; sourceTree = ""; }; + 0F9D8C500A024D6886EF4B53 /* geolocation_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = geolocation_handler_cpptoc.cc; sourceTree = ""; }; + 105882DA63C11BAE1FD15912 /* web_plugin_info_visitor_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = web_plugin_info_visitor_cpptoc.cc; sourceTree = ""; }; + 10B3AD86DFC4040DA9FA3F93 /* cef_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_types.h; sourceTree = ""; }; + 11E9E4AD9813732A4D18CB23 /* cef_display_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_display_handler.h; sourceTree = ""; }; + 122633611F6EB2360EFA038F /* v8accessor_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8accessor_cpptoc.h; sourceTree = ""; }; + 1340D17D0D9F3A9DE2848744 /* cef_xml_reader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_xml_reader.h; sourceTree = ""; }; + 135FE356E2151DAA229B9959 /* cef_urlrequest_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_urlrequest_capi.h; sourceTree = ""; }; + 184AA0143161D3E0BC6B2AB6 /* cef_ptr.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_ptr.h; sourceTree = ""; }; + 1907F9480DB53A3F0DF752E0 /* string_visitor_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = string_visitor_cpptoc.cc; sourceTree = ""; }; + 1BA88A6476B2497181946973 /* cef_life_span_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_life_span_handler_capi.h; sourceTree = ""; }; + 1C69A3492889C721A4E547D4 /* response_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = response_ctocpp.h; sourceTree = ""; }; + 1C76D781600C6639F7A3D73D /* cef_cookie.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_cookie.h; sourceTree = ""; }; + 1D7DA121668CBD8628C82A46 /* zip_reader_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = zip_reader_ctocpp.h; sourceTree = ""; }; + 1E802C7E46A0D7272A8ED474 /* urlrequest_client_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = urlrequest_client_cpptoc.h; sourceTree = ""; }; + 1FE4FC55BE3AF9FC7670543F /* cef_zip_archive.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_zip_archive.h; sourceTree = ""; }; + 1FF63EEEE51B0ECB1033166D /* cef_browser_process_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_browser_process_handler_capi.h; sourceTree = ""; }; + 2055BA1BE251D831FE186144 /* cef_string_visitor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_visitor.h; sourceTree = ""; }; + 20BA95CD301C4EE963BC00CC /* cef_zip_reader_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_zip_reader_capi.h; sourceTree = ""; }; + 22A91D67B9CE101D31B1C73A /* client_switches.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = client_switches.h; sourceTree = ""; }; + 236A9AFABFE62BD05ECA7AC8 /* stream_reader_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = stream_reader_ctocpp.cc; sourceTree = ""; }; + 24A2D6DCABDA956EBDC193CB /* resource_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resource_util.h; sourceTree = ""; }; + 26080C2E868907EFAF033C38 /* cef_resource_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_resource_handler.h; sourceTree = ""; }; + 260F6C59A29DD45FF7CD36DE /* client_app.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = client_app.h; sourceTree = ""; }; + 2654257A86558F3BB511B5D7 /* context_menu_params_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = context_menu_params_ctocpp.cc; sourceTree = ""; }; + 26734663172A3B270B5B0879 /* cef_download_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_download_handler.h; sourceTree = ""; }; + 270356D0402AF64F58C09A86 /* localstorage.html */ = {isa = PBXFileReference; lastKnownFileType = text; path = localstorage.html; sourceTree = ""; }; + 279820DCB537D61B9D0F587A /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; + 28D2DC9B0106AAF4CA4B84F4 /* cef_string_map.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_map.h; sourceTree = ""; }; + 2AD744DD1B85BD8516679128 /* geolocation_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = geolocation_handler_cpptoc.h; sourceTree = ""; }; + 2BB5E71FE9C81B2F576744B6 /* cef_url.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_url.h; sourceTree = ""; }; + 2D0723B21B19924B7FA5BEEE /* binding_test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = binding_test.h; sourceTree = ""; }; + 2D83F8CAE45B8B1FB90A23D7 /* focus_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = focus_handler_cpptoc.h; sourceTree = ""; }; + 2DFE6F8215B17EFF152F8C1B /* cef_callback_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_callback_capi.h; sourceTree = ""; }; + 2E321B166C7FF52B007DB6B2 /* cef_string_visitor_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_visitor_capi.h; sourceTree = ""; }; + 2ECC93253B64FA1FDC8657F7 /* browser_process_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_process_handler_cpptoc.cc; sourceTree = ""; }; + 2FB0A2A624D8FBF3E2ED27E2 /* libcef_dll_wrapper.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcef_dll_wrapper.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 30A0A3F4096B60BECEC1D6CE /* client_renderer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = client_renderer.h; sourceTree = ""; }; + 30D1F73815E34D7F64E3C302 /* urlrequest_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = urlrequest_ctocpp.h; sourceTree = ""; }; + 31578271D9FD9AE272B4C26D /* cef_dom_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_dom_capi.h; sourceTree = ""; }; + 319A2682FFABA5BCC5947828 /* browser_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_ctocpp.h; sourceTree = ""; }; + 320061C02736EEAD2E137069 /* cef_task_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_task_capi.h; sourceTree = ""; }; + 327CB8AF62FB360E3EF03984 /* request_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = request_handler_cpptoc.h; sourceTree = ""; }; + 357BDAE5839F6609CD06E042 /* post_data_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = post_data_ctocpp.h; sourceTree = ""; }; + 358E48B5A4F72C9DC84BE229 /* load_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = load_handler_cpptoc.cc; sourceTree = ""; }; + 3635E480B7F9DCC771B002FE /* keyboard_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = keyboard_handler_cpptoc.cc; sourceTree = ""; }; + 37FCEDA6FBF91DD9FB19752F /* cef_menu_model_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_menu_model_capi.h; sourceTree = ""; }; + 383DCF65D16AF076A1A6D9C3 /* v8exception_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8exception_ctocpp.h; sourceTree = ""; }; + 398F992B145AB9252FF50298 /* resource_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = resource_handler_cpptoc.cc; sourceTree = ""; }; + 3B292D7A1F0C57AC14BA98C0 /* binary_value_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = binary_value_ctocpp.h; sourceTree = ""; }; + 3BBE685CEE22005DFB009944 /* proxy_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = proxy_handler_cpptoc.cc; sourceTree = ""; }; + 3C3FB6A391FA0AADA4CE72D6 /* cef_response_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_response_capi.h; sourceTree = ""; }; + 3C92FB9F51FFD31BAFD8A1DF /* cef_stream.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_stream.h; sourceTree = ""; }; + 3D587326CCEE28CB243803D9 /* dom_test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dom_test.h; sourceTree = ""; }; + 40E95073528BADA34C926730 /* cef_base_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_base_capi.h; sourceTree = ""; }; + 41CE65C927368225FAC99B28 /* cef_context_menu_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_context_menu_handler.h; sourceTree = ""; }; + 4270EEC8527C3500CD8AEF91 /* v8value_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8value_ctocpp.cc; sourceTree = ""; }; + 430255B1D74762D49D56B2EB /* request_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = request_ctocpp.cc; sourceTree = ""; }; + 4420EC4C97F8E9842004EE33 /* cef_request_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_request_handler_capi.h; sourceTree = ""; }; + 45C2F15C21F64A758140BA76 /* list_value_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = list_value_ctocpp.h; sourceTree = ""; }; + 468287BEF04CAF9D533EA43F /* cef_runnable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_runnable.h; sourceTree = ""; }; + 486EAD58F64C7354BD9BF7FB /* resource_bundle_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = resource_bundle_handler_cpptoc.cc; sourceTree = ""; }; + 490630812B1F8404E54A4428 /* cookie_manager_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cookie_manager_ctocpp.h; sourceTree = ""; }; + 49301B0EC8CC7BE756FC916E /* release_impl_official.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = release_impl_official.gypi; path = chromium/build/internal/release_impl_official.gypi; sourceTree = ""; }; + 499F1DDC05B0F3CD78CBF72A /* cookie_visitor_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cookie_visitor_cpptoc.cc; sourceTree = ""; }; + 49BE5978F6A9FFB5D54D598C /* cef_time.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_time.h; sourceTree = ""; }; + 49F642037524E666E0922E01 /* cef_web_plugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_web_plugin.h; sourceTree = ""; }; + 4A8CEF7B36A3F4506ACF6472 /* menu_model_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = menu_model_ctocpp.cc; sourceTree = ""; }; + 4B0B8688FBBBD4FB20FF627C /* v8handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8handler_cpptoc.cc; sourceTree = ""; }; + 4BF9EEDD8615E0FCB0FEAE36 /* v8context_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8context_ctocpp.h; sourceTree = ""; }; + 4C10B2F19305A73D6882810E /* cef_command_line.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_command_line.h; sourceTree = ""; }; + 4D3C925FBC108873A0BAB6D7 /* cef_download_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_download_handler_capi.h; sourceTree = ""; }; + 4EBF1A8A50CC76BCFD2B9815 /* cef_client_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_client_capi.h; sourceTree = ""; }; + 4F0353741BADA8DFB2DCE465 /* process_message_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = process_message_ctocpp.cc; sourceTree = ""; }; + 508CF0A2D8680B2081F0FFA2 /* client_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = client_handler.h; sourceTree = ""; }; + 5295DF3ECB3172EF8C45B6AF /* libcef_dll_wrapper.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = libcef_dll_wrapper.cc; sourceTree = ""; }; + 52CE80D0037E0804C258764B /* cef_export.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_export.h; sourceTree = ""; }; + 52F07ED1649486775E0077B3 /* read_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = read_handler_cpptoc.h; sourceTree = ""; }; + 5459FDCB74FDBB0C926F4228 /* dictionary_value_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dictionary_value_ctocpp.h; sourceTree = ""; }; + 54CC5E90A8296ECF4F7224A1 /* cef_browser_process_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_browser_process_handler.h; sourceTree = ""; }; + 54D1146F7F37B195FF73CC6F /* request_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = request_handler_cpptoc.cc; sourceTree = ""; }; + 54D6325E4527C748E4D3E98A /* cef_v8.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_v8.h; sourceTree = ""; }; + 5667E7216525A0A996EC0E21 /* client_handler_mac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = client_handler_mac.mm; sourceTree = ""; }; + 569ACE130A89E1EA0BCA08A4 /* urlrequest_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = urlrequest_ctocpp.cc; sourceTree = ""; }; + 57106C8999970BFBFF1B3F43 /* resource_bundle_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resource_bundle_handler_cpptoc.h; sourceTree = ""; }; + 5768C5E2156E03BE517890FC /* proxy_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = proxy_handler_cpptoc.h; sourceTree = ""; }; + 583D4CCE212AE5487DF70A8D /* cef_download_item.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_download_item.h; sourceTree = ""; }; + 58AFC197A969BA55ED1C9C05 /* cef_types_wrappers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_types_wrappers.h; sourceTree = ""; }; + 5AA3472CBB09D07756D7DF4D /* download_item_callback_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = download_item_callback_ctocpp.h; sourceTree = ""; }; + 5AC85876C5B3BD87D9F96217 /* cef_tuple.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_tuple.h; sourceTree = ""; }; + 5B60E47B25F43EE43E246051 /* before_download_callback_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = before_download_callback_ctocpp.h; sourceTree = ""; }; + 5BF839B43E5EB6CE6945DAB3 /* domaccess.html */ = {isa = PBXFileReference; lastKnownFileType = text; path = domaccess.html; sourceTree = ""; }; + 5C551292013082C6E9CDC76E /* cef_string_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_types.h; sourceTree = ""; }; + 5C64674A62F450A50FBA9A0D /* process_helper_mac.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = process_helper_mac.cpp; sourceTree = ""; }; + 5C9574A105E12DCD8645068C /* post_data_element_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = post_data_element_ctocpp.h; sourceTree = ""; }; + 5CD903CA81B3E37C1E1601F4 /* dictionary_value_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = dictionary_value_ctocpp.cc; sourceTree = ""; }; + 5D5A55E9CE0779FAE7B0FADD /* cef_string.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string.h; sourceTree = ""; }; + 5E1C59AD3074023FEA140CAE /* response_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = response_ctocpp.cc; sourceTree = ""; }; + 5E2BC07C5D4DB0E4F9B48062 /* cef_cookie_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_cookie_capi.h; sourceTree = ""; }; + 5EDBC5792F4176E098BAD6D2 /* cef_process_util_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_process_util_capi.h; sourceTree = ""; }; + 5FBEC7A3CE8F7311AF34D670 /* download_item_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = download_item_ctocpp.h; sourceTree = ""; }; + 626591AA7B2232990F6F8ED7 /* browser_host_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_host_ctocpp.h; sourceTree = ""; }; + 6267CFABF3CD48619F3796BA /* download_item_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = download_item_ctocpp.cc; sourceTree = ""; }; + 62B07B07B01AED7652F059B7 /* cef_resource_bundle_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_resource_bundle_handler_capi.h; sourceTree = ""; }; + 62C1085BCE7A14E9136E167D /* cef_request.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_request.h; sourceTree = ""; }; + 63494703C086EE8EE25A180D /* cef_proxy_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_proxy_handler_capi.h; sourceTree = ""; }; + 637D5B7F9B843EDCC06D30B6 /* list_value_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = list_value_ctocpp.cc; sourceTree = ""; }; + 6558ED36C3D4CC4DD65183CE /* cef_paths.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_paths.gypi; sourceTree = ""; }; + 689E55F177BB1C6BACBCBD8F /* domdocument_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domdocument_ctocpp.h; sourceTree = ""; }; + 695177EC316540831C8F3F00 /* render_process_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = render_process_handler_cpptoc.cc; sourceTree = ""; }; + 698E4D82D5A48BEEF72A0A78 /* dom_test.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = dom_test.cpp; sourceTree = ""; }; + 69959C2D204F5C6A0E42F702 /* cef_string_multimap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_multimap.h; sourceTree = ""; }; + 6BEF619FB0C7B8993DE26F3A /* cef_string_wrappers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_wrappers.h; sourceTree = ""; }; + 6C9690FDEB71C11417E53A4B /* geolocation_callback_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = geolocation_callback_ctocpp.cc; sourceTree = ""; }; + 6F92CD2E5C5EBED534D2B058 /* life_span_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = life_span_handler_cpptoc.h; sourceTree = ""; }; + 6FDE90CED1D1795F47E60247 /* cef_geolocation_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_geolocation_handler.h; sourceTree = ""; }; + 704BC5A8C74FE5EC68D5BBF7 /* cef_zip_reader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_zip_reader.h; sourceTree = ""; }; + 708ACC86A347568E7B3823AC /* cef_geolocation_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_geolocation_handler_capi.h; sourceTree = ""; }; + 71F5EAC5A8C1A4D69A063D85 /* zip_reader_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = zip_reader_ctocpp.cc; sourceTree = ""; }; + 72509FE4DE249832DE53DAE1 /* jsdialog_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsdialog_handler_cpptoc.h; sourceTree = ""; }; + 729FF19BD6118496803CAECC /* resource_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resource_handler_cpptoc.h; sourceTree = ""; }; + 72D134DE9E5D1F61D9BA5236 /* cef_scheme.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_scheme.h; sourceTree = ""; }; + 74C2A349C6C5FFC3490EF830 /* cef_application_mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_application_mac.h; sourceTree = ""; }; + 7536FC15793B4CCA9783B6EF /* cef_life_span_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_life_span_handler.h; sourceTree = ""; }; + 75B16F433649BE46EB00E581 /* cef_values.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_values.h; sourceTree = ""; }; + 75C95F266AED00470BF37EF4 /* post_data_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = post_data_ctocpp.cc; sourceTree = ""; }; + 7608E47DFBF0AF580C5C7E8F /* release_defaults.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = release_defaults.gypi; path = chromium/build/internal/release_defaults.gypi; sourceTree = ""; }; + 773FB3CE83F8665C7ED19FBB /* cookie_visitor_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cookie_visitor_cpptoc.h; sourceTree = ""; }; + 786557A77F668A536C47DCF0 /* app_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = app_cpptoc.cc; sourceTree = ""; }; + 7881DE6BF224EF34BD57ED98 /* client_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = client_cpptoc.h; sourceTree = ""; }; + 79F98B38E0AE1DB8E0AD2402 /* cef_browser_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_browser_capi.h; sourceTree = ""; }; + 7A5F9C66C80ADB11505D54C4 /* scheme_registrar_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scheme_registrar_ctocpp.h; sourceTree = ""; }; + 7B0E80A5E402FF1FC51F6085 /* cef_string_list.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_list.h; sourceTree = ""; }; + 7B8F5BF297FF266FA77CE962 /* callback_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = callback_ctocpp.h; sourceTree = ""; }; + 7BEAA9DF3DA999ACBC7DD157 /* domevent_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domevent_ctocpp.cc; sourceTree = ""; }; + 7D065F97F8D63F8168D14CB4 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + 7D89FD25CF94866A4852937A /* client_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_cpptoc.cc; sourceTree = ""; }; + 7DBD5D7BD4B0536332702BCF /* Atom.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Atom.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 7DE15228D47B269D29FC8247 /* cef_command_line_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_command_line_capi.h; sourceTree = ""; }; + 7EA912CBF5992E4D8B48341B /* ffmpegsumo.so */ = {isa = PBXFileReference; lastKnownFileType = text; path = ffmpegsumo.so; sourceTree = ""; }; + 7ED28596FFF0D314E403E6A9 /* cef_path_util_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_path_util_capi.h; sourceTree = ""; }; + 80E9717C7D5211851C2CE39F /* cef_pack_resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_pack_resources.h; sourceTree = ""; }; + 83366F559D651D3D6F010552 /* client_handler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_handler.cpp; sourceTree = ""; }; + 8395F3CBAB1C065B5FC4D68F /* download_item_callback_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = download_item_callback_ctocpp.cc; sourceTree = ""; }; + 842BCCC3D466FC51F95A0474 /* command_line_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = command_line_ctocpp.h; sourceTree = ""; }; + 852F0B0FD262BCEDD965AE1D /* domevent_listener_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domevent_listener_cpptoc.h; sourceTree = ""; }; + 86AA35B67750BC9110E9352A /* cef_origin_whitelist_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_origin_whitelist_capi.h; sourceTree = ""; }; + 87703506DF957435CFA185CD /* cef_pack_strings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_pack_strings.h; sourceTree = ""; }; + 878DFA2003A77C20C1D032F8 /* cef_load_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_load_handler_capi.h; sourceTree = ""; }; + 87C649445F024DF09ABB2872 /* domnode_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domnode_ctocpp.cc; sourceTree = ""; }; + 8810BA43BD12FE1FB467D1BD /* process_message_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = process_message_ctocpp.h; sourceTree = ""; }; + 893A0C7893C498FA927E3760 /* v8context_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8context_ctocpp.cc; sourceTree = ""; }; + 8A45DBAD18F986EB8323B132 /* cef_zip_archive.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cef_zip_archive.cc; sourceTree = ""; }; + 8A89D8548E0234F8D3A325E1 /* web_plugin_info_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = web_plugin_info_ctocpp.h; sourceTree = ""; }; + 8B3C0420A46E8680DCB5ADD5 /* cef_response.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_response.h; sourceTree = ""; }; + 8D2141D4332C19847EB87AAF /* libcef.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcef.dylib; path = cef/libcef.dylib; sourceTree = ""; }; + 8D30B30E682FB390D76925BE /* auth_callback_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = auth_callback_ctocpp.cc; sourceTree = ""; }; + 8D4F75751DD08217C3C03145 /* cef_stream_resource_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_stream_resource_handler.h; sourceTree = ""; }; + 8D8551450A19A27CCB161E0C /* cef_render_process_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_render_process_handler.h; sourceTree = ""; }; + 8EC4D647359C00749A0AA03B /* string_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = string_util.h; sourceTree = ""; }; + 8F12A500F34D259488C40450 /* jsdialog_callback_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsdialog_callback_ctocpp.h; sourceTree = ""; }; + 8FFFBA46C9B0679311CF9C9B /* cefclient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cefclient.h; sourceTree = ""; }; + 9028CC75378531EB6A3F58FA /* cef_process_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_process_util.h; sourceTree = ""; }; + 906B192A29657F64CA00B012 /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo.png; sourceTree = ""; }; + 90F2FA2FBA8C499723B1EA60 /* frame_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = frame_ctocpp.h; sourceTree = ""; }; + 91758947E32C4496EF85035A /* cef_display_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_display_handler_capi.h; sourceTree = ""; }; + 927441CD07FFDEB32F5005FE /* cef_client.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_client.h; sourceTree = ""; }; + 9311E25B2B10FE02E280BE48 /* cef_jsdialog_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_jsdialog_handler.h; sourceTree = ""; }; + 933C345C45AA687EAC2CA1B0 /* atom.gyp */ = {isa = PBXFileReference; lastKnownFileType = text; path = atom.gyp; sourceTree = ""; }; + 935918F97E5C224406D12650 /* cef_build.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_build.h; sourceTree = ""; }; + 93757D2FC350BDDA2B7DA2AA /* dialogs.html */ = {isa = PBXFileReference; lastKnownFileType = text; path = dialogs.html; sourceTree = ""; }; + 93DE02637357AE14D634C44F /* cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cpptoc.h; sourceTree = ""; }; + 9490C082FB5369BA1D8C3A2D /* cef_process_message_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_process_message_capi.h; sourceTree = ""; }; + 95E1C61DFA6C0F3A2F186AA5 /* context_menu_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = context_menu_handler_cpptoc.h; sourceTree = ""; }; + 980F3C74815281AC191F1E57 /* cef_menu_model.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_menu_model.h; sourceTree = ""; }; + 98BD40AA2AFAC0DCEEDC51DE /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 98D2D165BC2E660B7652215F /* jsdialog_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = jsdialog_handler_cpptoc.cc; sourceTree = ""; }; + 9B382AA034A74CA4A0F0ED4C /* v8accessor_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8accessor_cpptoc.cc; sourceTree = ""; }; + 9C8D32ACB19E824AD0796E73 /* cef_download_item_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_download_item_capi.h; sourceTree = ""; }; + 9CA1997A7B8553B2C66A3928 /* web_plugin_info_visitor_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = web_plugin_info_visitor_cpptoc.h; sourceTree = ""; }; + 9D34CDF87E6F0B075486B14A /* release.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = release.gypi; path = chromium/build/release.gypi; sourceTree = ""; }; + 9D89C747FF4770EA92F9239D /* cef_frame_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_frame_capi.h; sourceTree = ""; }; + 9FA3277A78C52DD06F5F4EF5 /* cef_keyboard_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_keyboard_handler_capi.h; sourceTree = ""; }; + 9FDF7EEE33DF8E4B5375DC9B /* cef_app.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_app.h; sourceTree = ""; }; + 9FE2507F90F280D04E80E322 /* domvisitor_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domvisitor_cpptoc.h; sourceTree = ""; }; + A11A0782DAF4C69891B9E611 /* cef_render_process_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_render_process_handler_capi.h; sourceTree = ""; }; + A221A24DAEDF11F34E3AABE5 /* xml_reader_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xml_reader_ctocpp.h; sourceTree = ""; }; + A2D63CF770ED8E34553DBF6C /* filename_rules.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = filename_rules.gypi; path = chromium/build/filename_rules.gypi; sourceTree = ""; }; + A483AD212B5AB40F2C412200 /* cef_mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_mac.h; sourceTree = ""; }; + A849982774F76181E7F48FF6 /* cef_frame.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_frame.h; sourceTree = ""; }; + A8BCFE1A06453AF782644C43 /* app_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = app_cpptoc.h; sourceTree = ""; }; + A9E34E227A6522EE9E6B678B /* jsdialog_callback_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = jsdialog_callback_ctocpp.cc; sourceTree = ""; }; + AA3C7CE3246813F6A1F1B54F /* cef_stream_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_stream_capi.h; sourceTree = ""; }; + AABBEE2898789D96A231F0B1 /* cef_request_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_request_capi.h; sourceTree = ""; }; + AB158A494CD29727C3ABF79E /* binding.html */ = {isa = PBXFileReference; lastKnownFileType = text; path = binding.html; sourceTree = ""; }; + AB28CDD02B169844A3228175 /* context_menu_params_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = context_menu_params_ctocpp.h; sourceTree = ""; }; + AB8891B754FA3202B85CA58D /* cef_xml_object.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_xml_object.h; sourceTree = ""; }; + ABC384700091709CE2FF17AA /* v8value_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8value_ctocpp.h; sourceTree = ""; }; + ACF828AB18879B9CDF894195 /* common.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = common.gypi; path = chromium/build/common.gypi; sourceTree = ""; }; + AD45453EA501977150108164 /* cef_version.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_version.h; sourceTree = ""; }; + AD8D830C8B484B028BF3F0B4 /* browser_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_ctocpp.cc; sourceTree = ""; }; + AEF976394C83C300776D3BF6 /* transfer_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = transfer_util.h; sourceTree = ""; }; + B20195CC59EBF0814C6BB71F /* cef_paths2.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_paths2.gypi; sourceTree = ""; }; + B2CD0678D8A220F73E3877BE /* cef_focus_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_focus_handler.h; sourceTree = ""; }; + B5201070306320A0A7575E83 /* geolocation_callback_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = geolocation_callback_ctocpp.h; sourceTree = ""; }; + B5DB23C963556513BD246C81 /* post_data_element_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = post_data_element_ctocpp.cc; sourceTree = ""; }; + B692459F28B6D01109142B44 /* command_line_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = command_line_ctocpp.cc; sourceTree = ""; }; + B769C4454E88CAE69D8E9BDA /* urlrequest_client_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = urlrequest_client_cpptoc.cc; sourceTree = ""; }; + B82B8F1FA5642ADE9FDC58B1 /* cef_context_menu_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_context_menu_handler_capi.h; sourceTree = ""; }; + B8EAF503154E387DF3DA1E8B /* cef_stream_resource_handler.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cef_stream_resource_handler.cc; sourceTree = ""; }; + BA7C5FFE957632FC1677C633 /* util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; + BBB7B4779BFA5A28D25157CD /* client_app.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_app.cpp; sourceTree = ""; }; + BBD5E5A7F8D5A1D0C21032F7 /* cef_app_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_app_capi.h; sourceTree = ""; }; + BC50E1057B487F5AF0A0F7C3 /* domevent_listener_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domevent_listener_cpptoc.cc; sourceTree = ""; }; + BCE6C330A0416CE0C5AFB966 /* binding_test.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = binding_test.cpp; sourceTree = ""; }; + BDC045223B97CF2E94A14393 /* cef_base.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_base.h; sourceTree = ""; }; + BF1CA77DAAAF3D26C1644B16 /* browser_host_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_host_ctocpp.cc; sourceTree = ""; }; + BF1E18104D3540917EFEFE50 /* release_impl.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = release_impl.gypi; path = chromium/build/internal/release_impl.gypi; sourceTree = ""; }; + BFB55C7C3A1B9FBEF86498D1 /* load_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = load_handler_cpptoc.h; sourceTree = ""; }; + BFCD51C9A26781C7ED9D74E3 /* base_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = base_ctocpp.h; sourceTree = ""; }; + C28296745440EACC2BBC5E77 /* cef_logging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_logging.h; sourceTree = ""; }; + C33FDD6722853DC0ABF83783 /* cef_resource_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_resource_handler_capi.h; sourceTree = ""; }; + C9B9D5EE0AE765BA2CE95E3D /* libcef_dll_wrapper2.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = libcef_dll_wrapper2.cc; sourceTree = ""; }; + C9D386C18404AB8E5F32DB68 /* cef.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef.gypi; sourceTree = ""; }; + C9ECB41E85597AC94A57D250 /* transfer_util.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = transfer_util.cpp; sourceTree = ""; }; + CACE02D20E88064BE93B074D /* domnode_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domnode_ctocpp.h; sourceTree = ""; }; + CBBBD6A779FDD95564640CAE /* domevent_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domevent_ctocpp.h; sourceTree = ""; }; + CCAA53FFD7E2DFD55D51A7A8 /* display_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = display_handler_cpptoc.h; sourceTree = ""; }; + CCCD14801A9D76CA3A2D5F36 /* callback_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = callback_ctocpp.cc; sourceTree = ""; }; + CD3FF6074AD4BDA915DED7AF /* before_download_callback_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = before_download_callback_ctocpp.cc; sourceTree = ""; }; + CDF90D14742F6A20AEFE7EDC /* focus_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = focus_handler_cpptoc.cc; sourceTree = ""; }; + D19B227DF14576316F9B70FA /* cef_scheme_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_scheme_capi.h; sourceTree = ""; }; + D295B1AB379CE7E01B77027B /* cef_dom.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_dom.h; sourceTree = ""; }; + D2B60C8EC5D55F9BC60AEE16 /* cef_values_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_values_capi.h; sourceTree = ""; }; + D37851B41429592E37B3A9C8 /* client_renderer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_renderer.cpp; sourceTree = ""; }; + D43501ADA833D77B37F619F8 /* write_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = write_handler_cpptoc.h; sourceTree = ""; }; + D49975CE7A97C65C314FD66D /* cef_xml_reader_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_xml_reader_capi.h; sourceTree = ""; }; + D4C1A5A51B9F1028A71A88B9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D5255DBEBD397188B233A231 /* scheme_test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scheme_test.h; sourceTree = ""; }; + D57DF37F0571556934A8C97E /* browser_process_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_process_handler_cpptoc.h; sourceTree = ""; }; + D5AAF3B20A8154CF656F2B95 /* auth_callback_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = auth_callback_ctocpp.h; sourceTree = ""; }; + DAB818E7FCF815438C618284 /* cef_task.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_task.h; sourceTree = ""; }; + DAC41BC67FAE62BC392AA9F8 /* keyboard_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = keyboard_handler_cpptoc.h; sourceTree = ""; }; + DB44B0B1D0D1A4A204C4D721 /* libcef.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libcef.dylib; sourceTree = ""; }; + DB518174682570C6EDD8C8D3 /* cef_url_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_url_capi.h; sourceTree = ""; }; + DC8B2A92CEC7E64CC3EA346C /* cef_byte_read_handler.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cef_byte_read_handler.cc; sourceTree = ""; }; + DD6704225845420F697A458B /* client_switches.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_switches.cpp; sourceTree = ""; }; + DE68BBE23816C0B20D7AF986 /* ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ctocpp.h; sourceTree = ""; }; + DF00ED2CAADFA1AB8A11A9B1 /* download_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = download_handler_cpptoc.h; sourceTree = ""; }; + DF4EBBE541EBF140B56F80A6 /* task_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = task_cpptoc.h; sourceTree = ""; }; + E0E0A1FD0CC05EFA6D420C91 /* v8exception_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8exception_ctocpp.cc; sourceTree = ""; }; + E1FB3405663B7FFD60B261B1 /* scheme_registrar_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_registrar_ctocpp.cc; sourceTree = ""; }; + E28F7B19EBBEAB5154036B43 /* Atom.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Atom.icns; sourceTree = ""; }; + E324492DA04785C9FE6025E3 /* scheme_handler_factory_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_handler_factory_cpptoc.cc; sourceTree = ""; }; + E44783BC61DF5362B9B7D2E3 /* xml_reader_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = xml_reader_ctocpp.cc; sourceTree = ""; }; + E6E5D3276CEA77BB22BAF8E2 /* download_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = download_handler_cpptoc.cc; sourceTree = ""; }; + E735FC4B9DAD056A2ED1A471 /* cef_load_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_load_handler.h; sourceTree = ""; }; + E864251A0EFEB6D92262433F /* string_util.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = string_util.cpp; sourceTree = ""; }; + E87735D8572F78C83B65A3BE /* base_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = base_cpptoc.h; sourceTree = ""; }; + E8BCE9ACB05D6D608EDA2EA6 /* context_menu_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = context_menu_handler_cpptoc.cc; sourceTree = ""; }; + E9E5A75B2A0A225244F1297A /* v8handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8handler_cpptoc.h; sourceTree = ""; }; + EA6CDBF6F227A0F1049AB0D0 /* domvisitor_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domvisitor_cpptoc.cc; sourceTree = ""; }; + EB18CE2A00D7F993711EEB5C /* domdocument_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domdocument_ctocpp.cc; sourceTree = ""; }; + EB8E59A89E8B84BE29BA7365 /* frame_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = frame_ctocpp.cc; sourceTree = ""; }; + EBF5A644FD4803A78E68D422 /* scheme_test.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_test.cpp; sourceTree = ""; }; + EC24F09DA2C73A96ACF68EC2 /* binary_value_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = binary_value_ctocpp.cc; sourceTree = ""; }; + EFDBBC75060253CABE351E3A /* stream_reader_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stream_reader_ctocpp.h; sourceTree = ""; }; + F005091550289905B4B6096C /* read_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = read_handler_cpptoc.cc; sourceTree = ""; }; + F021D8DC9B5B46E1D2F55B8F /* write_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = write_handler_cpptoc.cc; sourceTree = ""; }; + F076BC5AF6E9D25E8668BFE9 /* string_visitor_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = string_visitor_cpptoc.h; sourceTree = ""; }; + F10AAEDAA9C5C041F45DA56D /* life_span_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = life_span_handler_cpptoc.cc; sourceTree = ""; }; + F18A1AF7B2FFBF8C0B6E03C2 /* xmlhttprequest.html */ = {isa = PBXFileReference; lastKnownFileType = text; path = xmlhttprequest.html; sourceTree = ""; }; + F253D00D10507AAA89CADA4D /* stream_writer_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = stream_writer_ctocpp.cc; sourceTree = ""; }; + F3072F2897B0C489C1C07F03 /* task_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = task_cpptoc.cc; sourceTree = ""; }; + F3EFAAF395C01B193EC2565B /* cef_focus_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_focus_handler_capi.h; sourceTree = ""; }; + F4C42A3074E03DCFD88F44EC /* display_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = display_handler_cpptoc.cc; sourceTree = ""; }; + F5AB8BF20DCFAC72A2C83BC0 /* cef_path_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_path_util.h; sourceTree = ""; }; + F611B99AD296ADD51058D742 /* cefclient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cefclient.cpp; sourceTree = ""; }; + F911DFCEF7937FB01ADD7DD4 /* Atom Helper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Atom Helper.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + F955AE763163316A3B7E889F /* request_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = request_ctocpp.h; sourceTree = ""; }; + F95FCF0F4C19634D3E55434B /* web_plugin_info_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = web_plugin_info_ctocpp.cc; sourceTree = ""; }; + F9FAD86D0106486D9F6CAB64 /* cookie_manager_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cookie_manager_ctocpp.cc; sourceTree = ""; }; + FAF26B72CF0F80FB521FECB8 /* render_process_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = render_process_handler_cpptoc.h; sourceTree = ""; }; + FBFC8F31C85032792E803CC8 /* cef_v8_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_v8_capi.h; sourceTree = ""; }; + FC00B66B870E48CDE3A076A1 /* cef_process_message.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_process_message.h; sourceTree = ""; }; + FD4CBC09BA3E54E2FC80A782 /* client_app_delegates.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_app_delegates.cpp; sourceTree = ""; }; + FD71AEDC4163189833F052FA /* cef_request_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_request_handler.h; sourceTree = ""; }; + FE0E005CB8EE8E11C7633B9D /* stream_writer_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stream_writer_ctocpp.h; sourceTree = ""; }; + FEC7E23C100568286B6E0E08 /* cef_types_mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_types_mac.h; sourceTree = ""; }; + FF15EBCC1B426B16C9FE9F7B /* cef_urlrequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_urlrequest.h; sourceTree = ""; }; + FF278930FC0F7363B339923C /* cef_web_plugin_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_web_plugin_capi.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9BF671516DA8A740B7BC6BC2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + BA39FFA42A6E19E730A5E153 /* libcef_dll_wrapper.a in Frameworks */, + 52FC0543953215E4AC8FC058 /* AppKit.framework in Frameworks */, + EF735B2D99313921B0ECF8C7 /* libcef.dylib in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D19A2A0806CA8935DCFCF39E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FE8FD131D637E2399A2C748C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1B94D97D87C3D4F18B1FD364 /* libcef_dll_wrapper.a in Frameworks */, + 627C11FA24E1849F26B785E8 /* AppKit.framework in Frameworks */, + 31FDA34AC3060D049E996FFC /* libcef.dylib in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 02555932F78868889BD51AA7 /* libcef_dll */ = { + isa = PBXGroup; + children = ( + 643A3E5F57B2F17486258A2D /* cpptoc */, + BF8C6780A5E4EF81DB895471 /* ctocpp */, + 675E6D2F1BCBFF91720D6BC8 /* wrapper */, + C28296745440EACC2BBC5E77 /* cef_logging.h */, + C9ECB41E85597AC94A57D250 /* transfer_util.cpp */, + AEF976394C83C300776D3BF6 /* transfer_util.h */, + ); + path = libcef_dll; + sourceTree = ""; + }; + 06875A3480F5AF5F56C9049D /* cef */ = { + isa = PBXGroup; + children = ( + 7EA912CBF5992E4D8B48341B /* ffmpegsumo.so */, + DB44B0B1D0D1A4A204C4D721 /* libcef.dylib */, + ); + path = cef; + sourceTree = ""; + }; + 10F626399AF9036C3E8C384D /* atom/cefclient */ = { + isa = PBXGroup; + children = ( + 8F095689F6F93B120398471F /* mac */, + 3BA1D8A9530906C825A5C78B /* res */, + BCE6C330A0416CE0C5AFB966 /* binding_test.cpp */, + 2D0723B21B19924B7FA5BEEE /* binding_test.h */, + F611B99AD296ADD51058D742 /* cefclient.cpp */, + 8FFFBA46C9B0679311CF9C9B /* cefclient.h */, + 0A395E31D08AFE54DF364BD8 /* cefclient_mac.mm */, + BBB7B4779BFA5A28D25157CD /* client_app.cpp */, + 260F6C59A29DD45FF7CD36DE /* client_app.h */, + FD4CBC09BA3E54E2FC80A782 /* client_app_delegates.cpp */, + 83366F559D651D3D6F010552 /* client_handler.cpp */, + 508CF0A2D8680B2081F0FFA2 /* client_handler.h */, + 5667E7216525A0A996EC0E21 /* client_handler_mac.mm */, + D37851B41429592E37B3A9C8 /* client_renderer.cpp */, + 30A0A3F4096B60BECEC1D6CE /* client_renderer.h */, + DD6704225845420F697A458B /* client_switches.cpp */, + 22A91D67B9CE101D31B1C73A /* client_switches.h */, + 698E4D82D5A48BEEF72A0A78 /* dom_test.cpp */, + 3D587326CCEE28CB243803D9 /* dom_test.h */, + 5C64674A62F450A50FBA9A0D /* process_helper_mac.cpp */, + 24A2D6DCABDA956EBDC193CB /* resource_util.h */, + 0E810717DC2D77F1B065D6F1 /* resource_util_mac.mm */, + EBF5A644FD4803A78E68D422 /* scheme_test.cpp */, + D5255DBEBD397188B233A231 /* scheme_test.h */, + E864251A0EFEB6D92262433F /* string_util.cpp */, + 8EC4D647359C00749A0AA03B /* string_util.h */, + BA7C5FFE957632FC1677C633 /* util.h */, + ); + path = atom/cefclient; + sourceTree = ""; + }; + 11D0E955790457F7BEAA3C94 /* Build */ = { + isa = PBXGroup; + children = ( + 933C345C45AA687EAC2CA1B0 /* atom.gyp */, + C9D386C18404AB8E5F32DB68 /* cef.gypi */, + 6558ED36C3D4CC4DD65183CE /* cef_paths.gypi */, + B20195CC59EBF0814C6BB71F /* cef_paths2.gypi */, + ACF828AB18879B9CDF894195 /* common.gypi */, + A2D63CF770ED8E34553DBF6C /* filename_rules.gypi */, + 9D34CDF87E6F0B075486B14A /* release.gypi */, + 7608E47DFBF0AF580C5C7E8F /* release_defaults.gypi */, + BF1E18104D3540917EFEFE50 /* release_impl.gypi */, + 49301B0EC8CC7BE756FC916E /* release_impl_official.gypi */, + ); + name = Build; + sourceTree = ""; + }; + 279DD4A6E66C17C04B2A01F4 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 7D065F97F8D63F8168D14CB4 /* AppKit.framework */, + 8D2141D4332C19847EB87AAF /* libcef.dylib */, + ); + name = Frameworks; + sourceTree = ""; + }; + 3BA1D8A9530906C825A5C78B /* res */ = { + isa = PBXGroup; + children = ( + AB158A494CD29727C3ABF79E /* binding.html */, + 93757D2FC350BDDA2B7DA2AA /* dialogs.html */, + 5BF839B43E5EB6CE6945DAB3 /* domaccess.html */, + 270356D0402AF64F58C09A86 /* localstorage.html */, + 906B192A29657F64CA00B012 /* logo.png */, + F18A1AF7B2FFBF8C0B6E03C2 /* xmlhttprequest.html */, + ); + path = res; + sourceTree = ""; + }; + 43C211543CE85EC76E214B18 = { + isa = PBXGroup; + children = ( + C03348F2E8B675B0BBDE3C51 /* Source */, + 279DD4A6E66C17C04B2A01F4 /* Frameworks */, + EAE13C948F9AACF14FE4CEA5 /* Products */, + 11D0E955790457F7BEAA3C94 /* Build */, + ); + sourceTree = ""; + }; + 51ED0A9864B76144B65C2CAF /* include */ = { + isa = PBXGroup; + children = ( + B30B3EADEA4D69B7FFE035B8 /* capi */, + 974FDA2CF62FBF6A9E5E707B /* internal */, + 6A0B7DC2D5774ED2FBD8B0D6 /* wrapper */, + 9FDF7EEE33DF8E4B5375DC9B /* cef_app.h */, + 74C2A349C6C5FFC3490EF830 /* cef_application_mac.h */, + BDC045223B97CF2E94A14393 /* cef_base.h */, + 0B3CEEB1D8E5DC4006A547F7 /* cef_browser.h */, + 54CC5E90A8296ECF4F7224A1 /* cef_browser_process_handler.h */, + 090DDA0AEEE9282FDCB8F1CF /* cef_callback.h */, + 927441CD07FFDEB32F5005FE /* cef_client.h */, + 4C10B2F19305A73D6882810E /* cef_command_line.h */, + 41CE65C927368225FAC99B28 /* cef_context_menu_handler.h */, + 1C76D781600C6639F7A3D73D /* cef_cookie.h */, + 11E9E4AD9813732A4D18CB23 /* cef_display_handler.h */, + D295B1AB379CE7E01B77027B /* cef_dom.h */, + 26734663172A3B270B5B0879 /* cef_download_handler.h */, + 583D4CCE212AE5487DF70A8D /* cef_download_item.h */, + B2CD0678D8A220F73E3877BE /* cef_focus_handler.h */, + A849982774F76181E7F48FF6 /* cef_frame.h */, + 6FDE90CED1D1795F47E60247 /* cef_geolocation_handler.h */, + 9311E25B2B10FE02E280BE48 /* cef_jsdialog_handler.h */, + 052A279D62054B5D4F316669 /* cef_keyboard_handler.h */, + 7536FC15793B4CCA9783B6EF /* cef_life_span_handler.h */, + E735FC4B9DAD056A2ED1A471 /* cef_load_handler.h */, + 980F3C74815281AC191F1E57 /* cef_menu_model.h */, + 0576E6EBDDE217379E2D8079 /* cef_origin_whitelist.h */, + 80E9717C7D5211851C2CE39F /* cef_pack_resources.h */, + 87703506DF957435CFA185CD /* cef_pack_strings.h */, + F5AB8BF20DCFAC72A2C83BC0 /* cef_path_util.h */, + FC00B66B870E48CDE3A076A1 /* cef_process_message.h */, + 9028CC75378531EB6A3F58FA /* cef_process_util.h */, + 0A29B87DF8618E540E42B8BD /* cef_proxy_handler.h */, + 8D8551450A19A27CCB161E0C /* cef_render_process_handler.h */, + 62C1085BCE7A14E9136E167D /* cef_request.h */, + FD71AEDC4163189833F052FA /* cef_request_handler.h */, + 07575805286188F831B80447 /* cef_resource_bundle_handler.h */, + 26080C2E868907EFAF033C38 /* cef_resource_handler.h */, + 8B3C0420A46E8680DCB5ADD5 /* cef_response.h */, + 468287BEF04CAF9D533EA43F /* cef_runnable.h */, + 72D134DE9E5D1F61D9BA5236 /* cef_scheme.h */, + 3C92FB9F51FFD31BAFD8A1DF /* cef_stream.h */, + 2055BA1BE251D831FE186144 /* cef_string_visitor.h */, + DAB818E7FCF815438C618284 /* cef_task.h */, + 2BB5E71FE9C81B2F576744B6 /* cef_url.h */, + FF15EBCC1B426B16C9FE9F7B /* cef_urlrequest.h */, + 54D6325E4527C748E4D3E98A /* cef_v8.h */, + 75B16F433649BE46EB00E581 /* cef_values.h */, + AD45453EA501977150108164 /* cef_version.h */, + 49F642037524E666E0922E01 /* cef_web_plugin.h */, + 1340D17D0D9F3A9DE2848744 /* cef_xml_reader.h */, + 704BC5A8C74FE5EC68D5BBF7 /* cef_zip_reader.h */, + ); + path = include; + sourceTree = ""; + }; + 643A3E5F57B2F17486258A2D /* cpptoc */ = { + isa = PBXGroup; + children = ( + 786557A77F668A536C47DCF0 /* app_cpptoc.cc */, + A8BCFE1A06453AF782644C43 /* app_cpptoc.h */, + E87735D8572F78C83B65A3BE /* base_cpptoc.h */, + 2ECC93253B64FA1FDC8657F7 /* browser_process_handler_cpptoc.cc */, + D57DF37F0571556934A8C97E /* browser_process_handler_cpptoc.h */, + 7D89FD25CF94866A4852937A /* client_cpptoc.cc */, + 7881DE6BF224EF34BD57ED98 /* client_cpptoc.h */, + E8BCE9ACB05D6D608EDA2EA6 /* context_menu_handler_cpptoc.cc */, + 95E1C61DFA6C0F3A2F186AA5 /* context_menu_handler_cpptoc.h */, + 499F1DDC05B0F3CD78CBF72A /* cookie_visitor_cpptoc.cc */, + 773FB3CE83F8665C7ED19FBB /* cookie_visitor_cpptoc.h */, + 93DE02637357AE14D634C44F /* cpptoc.h */, + F4C42A3074E03DCFD88F44EC /* display_handler_cpptoc.cc */, + CCAA53FFD7E2DFD55D51A7A8 /* display_handler_cpptoc.h */, + BC50E1057B487F5AF0A0F7C3 /* domevent_listener_cpptoc.cc */, + 852F0B0FD262BCEDD965AE1D /* domevent_listener_cpptoc.h */, + EA6CDBF6F227A0F1049AB0D0 /* domvisitor_cpptoc.cc */, + 9FE2507F90F280D04E80E322 /* domvisitor_cpptoc.h */, + E6E5D3276CEA77BB22BAF8E2 /* download_handler_cpptoc.cc */, + DF00ED2CAADFA1AB8A11A9B1 /* download_handler_cpptoc.h */, + CDF90D14742F6A20AEFE7EDC /* focus_handler_cpptoc.cc */, + 2D83F8CAE45B8B1FB90A23D7 /* focus_handler_cpptoc.h */, + 0F9D8C500A024D6886EF4B53 /* geolocation_handler_cpptoc.cc */, + 2AD744DD1B85BD8516679128 /* geolocation_handler_cpptoc.h */, + 98D2D165BC2E660B7652215F /* jsdialog_handler_cpptoc.cc */, + 72509FE4DE249832DE53DAE1 /* jsdialog_handler_cpptoc.h */, + 3635E480B7F9DCC771B002FE /* keyboard_handler_cpptoc.cc */, + DAC41BC67FAE62BC392AA9F8 /* keyboard_handler_cpptoc.h */, + F10AAEDAA9C5C041F45DA56D /* life_span_handler_cpptoc.cc */, + 6F92CD2E5C5EBED534D2B058 /* life_span_handler_cpptoc.h */, + 358E48B5A4F72C9DC84BE229 /* load_handler_cpptoc.cc */, + BFB55C7C3A1B9FBEF86498D1 /* load_handler_cpptoc.h */, + 3BBE685CEE22005DFB009944 /* proxy_handler_cpptoc.cc */, + 5768C5E2156E03BE517890FC /* proxy_handler_cpptoc.h */, + F005091550289905B4B6096C /* read_handler_cpptoc.cc */, + 52F07ED1649486775E0077B3 /* read_handler_cpptoc.h */, + 695177EC316540831C8F3F00 /* render_process_handler_cpptoc.cc */, + FAF26B72CF0F80FB521FECB8 /* render_process_handler_cpptoc.h */, + 54D1146F7F37B195FF73CC6F /* request_handler_cpptoc.cc */, + 327CB8AF62FB360E3EF03984 /* request_handler_cpptoc.h */, + 486EAD58F64C7354BD9BF7FB /* resource_bundle_handler_cpptoc.cc */, + 57106C8999970BFBFF1B3F43 /* resource_bundle_handler_cpptoc.h */, + 398F992B145AB9252FF50298 /* resource_handler_cpptoc.cc */, + 729FF19BD6118496803CAECC /* resource_handler_cpptoc.h */, + E324492DA04785C9FE6025E3 /* scheme_handler_factory_cpptoc.cc */, + 01758CA4E4707A8029D8D828 /* scheme_handler_factory_cpptoc.h */, + 1907F9480DB53A3F0DF752E0 /* string_visitor_cpptoc.cc */, + F076BC5AF6E9D25E8668BFE9 /* string_visitor_cpptoc.h */, + F3072F2897B0C489C1C07F03 /* task_cpptoc.cc */, + DF4EBBE541EBF140B56F80A6 /* task_cpptoc.h */, + B769C4454E88CAE69D8E9BDA /* urlrequest_client_cpptoc.cc */, + 1E802C7E46A0D7272A8ED474 /* urlrequest_client_cpptoc.h */, + 9B382AA034A74CA4A0F0ED4C /* v8accessor_cpptoc.cc */, + 122633611F6EB2360EFA038F /* v8accessor_cpptoc.h */, + 4B0B8688FBBBD4FB20FF627C /* v8handler_cpptoc.cc */, + E9E5A75B2A0A225244F1297A /* v8handler_cpptoc.h */, + 105882DA63C11BAE1FD15912 /* web_plugin_info_visitor_cpptoc.cc */, + 9CA1997A7B8553B2C66A3928 /* web_plugin_info_visitor_cpptoc.h */, + F021D8DC9B5B46E1D2F55B8F /* write_handler_cpptoc.cc */, + D43501ADA833D77B37F619F8 /* write_handler_cpptoc.h */, + ); + path = cpptoc; + sourceTree = ""; + }; + 675E6D2F1BCBFF91720D6BC8 /* wrapper */ = { + isa = PBXGroup; + children = ( + DC8B2A92CEC7E64CC3EA346C /* cef_byte_read_handler.cc */, + B8EAF503154E387DF3DA1E8B /* cef_stream_resource_handler.cc */, + 068180596E1A7AE276161E91 /* cef_xml_object.cc */, + 8A45DBAD18F986EB8323B132 /* cef_zip_archive.cc */, + 5295DF3ECB3172EF8C45B6AF /* libcef_dll_wrapper.cc */, + C9B9D5EE0AE765BA2CE95E3D /* libcef_dll_wrapper2.cc */, + ); + path = wrapper; + sourceTree = ""; + }; + 6A0B7DC2D5774ED2FBD8B0D6 /* wrapper */ = { + isa = PBXGroup; + children = ( + 085527C54F2DAA1B70DAA2A7 /* cef_byte_read_handler.h */, + 8D4F75751DD08217C3C03145 /* cef_stream_resource_handler.h */, + AB8891B754FA3202B85CA58D /* cef_xml_object.h */, + 1FE4FC55BE3AF9FC7670543F /* cef_zip_archive.h */, + ); + path = wrapper; + sourceTree = ""; + }; + 6A323577E3B7E40577C3BBF9 /* BUILT_PRODUCTS_DIR */ = { + isa = PBXGroup; + children = ( + 00B48B83D4C1A30985ED9D96 /* Atom Helper.app */, + ); + name = BUILT_PRODUCTS_DIR; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 8F095689F6F93B120398471F /* mac */ = { + isa = PBXGroup; + children = ( + E28F7B19EBBEAB5154036B43 /* Atom.icns */, + D4C1A5A51B9F1028A71A88B9 /* Info.plist */, + 709C7A8894CFC53DB4A6904A /* InfoPlist.strings */, + 5E8EB8112AD7378AB11B0371 /* MainMenu.xib */, + ); + path = mac; + sourceTree = ""; + }; + 974FDA2CF62FBF6A9E5E707B /* internal */ = { + isa = PBXGroup; + children = ( + 935918F97E5C224406D12650 /* cef_build.h */, + 52CE80D0037E0804C258764B /* cef_export.h */, + A483AD212B5AB40F2C412200 /* cef_mac.h */, + 184AA0143161D3E0BC6B2AB6 /* cef_ptr.h */, + 5D5A55E9CE0779FAE7B0FADD /* cef_string.h */, + 7B0E80A5E402FF1FC51F6085 /* cef_string_list.h */, + 28D2DC9B0106AAF4CA4B84F4 /* cef_string_map.h */, + 69959C2D204F5C6A0E42F702 /* cef_string_multimap.h */, + 5C551292013082C6E9CDC76E /* cef_string_types.h */, + 6BEF619FB0C7B8993DE26F3A /* cef_string_wrappers.h */, + 49BE5978F6A9FFB5D54D598C /* cef_time.h */, + 5AC85876C5B3BD87D9F96217 /* cef_tuple.h */, + 10B3AD86DFC4040DA9FA3F93 /* cef_types.h */, + FEC7E23C100568286B6E0E08 /* cef_types_mac.h */, + 58AFC197A969BA55ED1C9C05 /* cef_types_wrappers.h */, + ); + path = internal; + sourceTree = ""; + }; + B30B3EADEA4D69B7FFE035B8 /* capi */ = { + isa = PBXGroup; + children = ( + BBD5E5A7F8D5A1D0C21032F7 /* cef_app_capi.h */, + 40E95073528BADA34C926730 /* cef_base_capi.h */, + 79F98B38E0AE1DB8E0AD2402 /* cef_browser_capi.h */, + 1FF63EEEE51B0ECB1033166D /* cef_browser_process_handler_capi.h */, + 2DFE6F8215B17EFF152F8C1B /* cef_callback_capi.h */, + 4EBF1A8A50CC76BCFD2B9815 /* cef_client_capi.h */, + 7DE15228D47B269D29FC8247 /* cef_command_line_capi.h */, + B82B8F1FA5642ADE9FDC58B1 /* cef_context_menu_handler_capi.h */, + 5E2BC07C5D4DB0E4F9B48062 /* cef_cookie_capi.h */, + 91758947E32C4496EF85035A /* cef_display_handler_capi.h */, + 31578271D9FD9AE272B4C26D /* cef_dom_capi.h */, + 4D3C925FBC108873A0BAB6D7 /* cef_download_handler_capi.h */, + 9C8D32ACB19E824AD0796E73 /* cef_download_item_capi.h */, + F3EFAAF395C01B193EC2565B /* cef_focus_handler_capi.h */, + 9D89C747FF4770EA92F9239D /* cef_frame_capi.h */, + 708ACC86A347568E7B3823AC /* cef_geolocation_handler_capi.h */, + 0819D447DA2713C09BF050C1 /* cef_jsdialog_handler_capi.h */, + 9FA3277A78C52DD06F5F4EF5 /* cef_keyboard_handler_capi.h */, + 1BA88A6476B2497181946973 /* cef_life_span_handler_capi.h */, + 878DFA2003A77C20C1D032F8 /* cef_load_handler_capi.h */, + 37FCEDA6FBF91DD9FB19752F /* cef_menu_model_capi.h */, + 86AA35B67750BC9110E9352A /* cef_origin_whitelist_capi.h */, + 7ED28596FFF0D314E403E6A9 /* cef_path_util_capi.h */, + 9490C082FB5369BA1D8C3A2D /* cef_process_message_capi.h */, + 5EDBC5792F4176E098BAD6D2 /* cef_process_util_capi.h */, + 63494703C086EE8EE25A180D /* cef_proxy_handler_capi.h */, + A11A0782DAF4C69891B9E611 /* cef_render_process_handler_capi.h */, + AABBEE2898789D96A231F0B1 /* cef_request_capi.h */, + 4420EC4C97F8E9842004EE33 /* cef_request_handler_capi.h */, + 62B07B07B01AED7652F059B7 /* cef_resource_bundle_handler_capi.h */, + C33FDD6722853DC0ABF83783 /* cef_resource_handler_capi.h */, + 3C3FB6A391FA0AADA4CE72D6 /* cef_response_capi.h */, + D19B227DF14576316F9B70FA /* cef_scheme_capi.h */, + AA3C7CE3246813F6A1F1B54F /* cef_stream_capi.h */, + 2E321B166C7FF52B007DB6B2 /* cef_string_visitor_capi.h */, + 320061C02736EEAD2E137069 /* cef_task_capi.h */, + DB518174682570C6EDD8C8D3 /* cef_url_capi.h */, + 135FE356E2151DAA229B9959 /* cef_urlrequest_capi.h */, + FBFC8F31C85032792E803CC8 /* cef_v8_capi.h */, + D2B60C8EC5D55F9BC60AEE16 /* cef_values_capi.h */, + FF278930FC0F7363B339923C /* cef_web_plugin_capi.h */, + D49975CE7A97C65C314FD66D /* cef_xml_reader_capi.h */, + 20BA95CD301C4EE963BC00CC /* cef_zip_reader_capi.h */, + ); + path = capi; + sourceTree = ""; + }; + BF8C6780A5E4EF81DB895471 /* ctocpp */ = { + isa = PBXGroup; + children = ( + 8D30B30E682FB390D76925BE /* auth_callback_ctocpp.cc */, + D5AAF3B20A8154CF656F2B95 /* auth_callback_ctocpp.h */, + BFCD51C9A26781C7ED9D74E3 /* base_ctocpp.h */, + CD3FF6074AD4BDA915DED7AF /* before_download_callback_ctocpp.cc */, + 5B60E47B25F43EE43E246051 /* before_download_callback_ctocpp.h */, + EC24F09DA2C73A96ACF68EC2 /* binary_value_ctocpp.cc */, + 3B292D7A1F0C57AC14BA98C0 /* binary_value_ctocpp.h */, + AD8D830C8B484B028BF3F0B4 /* browser_ctocpp.cc */, + 319A2682FFABA5BCC5947828 /* browser_ctocpp.h */, + BF1CA77DAAAF3D26C1644B16 /* browser_host_ctocpp.cc */, + 626591AA7B2232990F6F8ED7 /* browser_host_ctocpp.h */, + CCCD14801A9D76CA3A2D5F36 /* callback_ctocpp.cc */, + 7B8F5BF297FF266FA77CE962 /* callback_ctocpp.h */, + B692459F28B6D01109142B44 /* command_line_ctocpp.cc */, + 842BCCC3D466FC51F95A0474 /* command_line_ctocpp.h */, + 2654257A86558F3BB511B5D7 /* context_menu_params_ctocpp.cc */, + AB28CDD02B169844A3228175 /* context_menu_params_ctocpp.h */, + F9FAD86D0106486D9F6CAB64 /* cookie_manager_ctocpp.cc */, + 490630812B1F8404E54A4428 /* cookie_manager_ctocpp.h */, + DE68BBE23816C0B20D7AF986 /* ctocpp.h */, + 5CD903CA81B3E37C1E1601F4 /* dictionary_value_ctocpp.cc */, + 5459FDCB74FDBB0C926F4228 /* dictionary_value_ctocpp.h */, + EB18CE2A00D7F993711EEB5C /* domdocument_ctocpp.cc */, + 689E55F177BB1C6BACBCBD8F /* domdocument_ctocpp.h */, + 7BEAA9DF3DA999ACBC7DD157 /* domevent_ctocpp.cc */, + CBBBD6A779FDD95564640CAE /* domevent_ctocpp.h */, + 87C649445F024DF09ABB2872 /* domnode_ctocpp.cc */, + CACE02D20E88064BE93B074D /* domnode_ctocpp.h */, + 8395F3CBAB1C065B5FC4D68F /* download_item_callback_ctocpp.cc */, + 5AA3472CBB09D07756D7DF4D /* download_item_callback_ctocpp.h */, + 6267CFABF3CD48619F3796BA /* download_item_ctocpp.cc */, + 5FBEC7A3CE8F7311AF34D670 /* download_item_ctocpp.h */, + EB8E59A89E8B84BE29BA7365 /* frame_ctocpp.cc */, + 90F2FA2FBA8C499723B1EA60 /* frame_ctocpp.h */, + 6C9690FDEB71C11417E53A4B /* geolocation_callback_ctocpp.cc */, + B5201070306320A0A7575E83 /* geolocation_callback_ctocpp.h */, + A9E34E227A6522EE9E6B678B /* jsdialog_callback_ctocpp.cc */, + 8F12A500F34D259488C40450 /* jsdialog_callback_ctocpp.h */, + 637D5B7F9B843EDCC06D30B6 /* list_value_ctocpp.cc */, + 45C2F15C21F64A758140BA76 /* list_value_ctocpp.h */, + 4A8CEF7B36A3F4506ACF6472 /* menu_model_ctocpp.cc */, + 068A8887F3A556A03A933AFF /* menu_model_ctocpp.h */, + 75C95F266AED00470BF37EF4 /* post_data_ctocpp.cc */, + 357BDAE5839F6609CD06E042 /* post_data_ctocpp.h */, + B5DB23C963556513BD246C81 /* post_data_element_ctocpp.cc */, + 5C9574A105E12DCD8645068C /* post_data_element_ctocpp.h */, + 4F0353741BADA8DFB2DCE465 /* process_message_ctocpp.cc */, + 8810BA43BD12FE1FB467D1BD /* process_message_ctocpp.h */, + 430255B1D74762D49D56B2EB /* request_ctocpp.cc */, + F955AE763163316A3B7E889F /* request_ctocpp.h */, + 5E1C59AD3074023FEA140CAE /* response_ctocpp.cc */, + 1C69A3492889C721A4E547D4 /* response_ctocpp.h */, + E1FB3405663B7FFD60B261B1 /* scheme_registrar_ctocpp.cc */, + 7A5F9C66C80ADB11505D54C4 /* scheme_registrar_ctocpp.h */, + 236A9AFABFE62BD05ECA7AC8 /* stream_reader_ctocpp.cc */, + EFDBBC75060253CABE351E3A /* stream_reader_ctocpp.h */, + F253D00D10507AAA89CADA4D /* stream_writer_ctocpp.cc */, + FE0E005CB8EE8E11C7633B9D /* stream_writer_ctocpp.h */, + 569ACE130A89E1EA0BCA08A4 /* urlrequest_ctocpp.cc */, + 30D1F73815E34D7F64E3C302 /* urlrequest_ctocpp.h */, + 893A0C7893C498FA927E3760 /* v8context_ctocpp.cc */, + 4BF9EEDD8615E0FCB0FEAE36 /* v8context_ctocpp.h */, + E0E0A1FD0CC05EFA6D420C91 /* v8exception_ctocpp.cc */, + 383DCF65D16AF076A1A6D9C3 /* v8exception_ctocpp.h */, + 4270EEC8527C3500CD8AEF91 /* v8value_ctocpp.cc */, + ABC384700091709CE2FF17AA /* v8value_ctocpp.h */, + F95FCF0F4C19634D3E55434B /* web_plugin_info_ctocpp.cc */, + 8A89D8548E0234F8D3A325E1 /* web_plugin_info_ctocpp.h */, + E44783BC61DF5362B9B7D2E3 /* xml_reader_ctocpp.cc */, + A221A24DAEDF11F34E3AABE5 /* xml_reader_ctocpp.h */, + 71F5EAC5A8C1A4D69A063D85 /* zip_reader_ctocpp.cc */, + 1D7DA121668CBD8628C82A46 /* zip_reader_ctocpp.h */, + ); + path = ctocpp; + sourceTree = ""; + }; + C03348F2E8B675B0BBDE3C51 /* Source */ = { + isa = PBXGroup; + children = ( + 6A323577E3B7E40577C3BBF9 /* BUILT_PRODUCTS_DIR */, + 10F626399AF9036C3E8C384D /* atom/cefclient */, + 06875A3480F5AF5F56C9049D /* cef */, + 51ED0A9864B76144B65C2CAF /* include */, + 02555932F78868889BD51AA7 /* libcef_dll */, + ); + name = Source; + sourceTree = ""; + }; + EAE13C948F9AACF14FE4CEA5 /* Products */ = { + isa = PBXGroup; + children = ( + 7DBD5D7BD4B0536332702BCF /* Atom.app */, + 2FB0A2A624D8FBF3E2ED27E2 /* libcef_dll_wrapper.a */, + F911DFCEF7937FB01ADD7DD4 /* Atom Helper.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 3049F5DBF2E857E3D2CA729A /* Atom */ = { + isa = PBXNativeTarget; + buildConfigurationList = 32D038632668003D3557078B /* Build configuration list for PBXNativeTarget "Atom" */; + buildPhases = ( + 5C150FDFAECC241747EEEC7F /* Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks */, + 2F00E8F3A83BEBC717B6C56E /* Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/ */, + CA791959B87C0946C4984F2E /* Resources */, + 0AB53E937FA08F668692794C /* Sources */, + FE8FD131D637E2399A2C748C /* Frameworks */, + B888ADFDA624AF2312CB8CE8 /* Postbuild "Fix Framework Link" */, + 0CD6EE443F9F1D92E04CE1E7 /* Postbuild "Create Resources Directory In Bundle" */, + 61B260848F264118E2824C1A /* Postbuild "Copy Pack File" */, + 841DE9C40027CDA59A8289E9 /* Postbuild "Copy WebCore Resources" */, + 7BE284A001BB8A27463E9F08 /* Postbuild "Tweak Info.plist" */, + F3B3262ADF34F171A6ABA502 /* Postbuild "Make More Helpers" */, + 9B3BDA26CD623B34622C3BC3 /* Postbuild "Change Mach-O Flags" */, + EB4F858D348472C4DE8EAE75 /* Postbuild "Strip If Needed" */, + ); + buildRules = ( + ); + dependencies = ( + 3FCB4654CB6D810ADD2522BE /* PBXTargetDependency */, + 2B4B5A55E644CCFE6B05D72A /* PBXTargetDependency */, + ); + name = Atom; + productName = Atom; + productReference = 7DBD5D7BD4B0536332702BCF /* Atom.app */; + productType = "com.apple.product-type.application"; + }; + 440934281E3BAF0A1212AEAE /* libcef_dll_wrapper */ = { + isa = PBXNativeTarget; + buildConfigurationList = 96B5FA75C2CA46F616A4D283 /* Build configuration list for PBXNativeTarget "libcef_dll_wrapper" */; + buildPhases = ( + B556D4EFAF494A5954882107 /* Sources */, + D19A2A0806CA8935DCFCF39E /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = libcef_dll_wrapper; + productName = cef_dll_wrapper; + productReference = 2FB0A2A624D8FBF3E2ED27E2 /* libcef_dll_wrapper.a */; + productType = "com.apple.product-type.library.static"; + }; + 5FE7B7DEE9B72A21F35CC0E6 /* AtomHelperApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 491F6EF221487AA86AB00112 /* Build configuration list for PBXNativeTarget "AtomHelperApp" */; + buildPhases = ( + F5AF0F1ABFFCD6D69D78650F /* Sources */, + 9BF671516DA8A740B7BC6BC2 /* Frameworks */, + 1E8F711365CFA88241E35625 /* Postbuild "Fix Framework Link" */, + D1BB7FBE6C9D9E837C64B48B /* Postbuild "Tweak Info.plist" */, + DF08B3FD33F7C23543C77933 /* Postbuild "Change Mach-O Flags" */, + AC29BFA4F2DEEAAFEC8E4E30 /* Postbuild "Strip If Needed" */, + ); + buildRules = ( + ); + dependencies = ( + FD2900EE9062ACA4D0D93DDF /* PBXTargetDependency */, + ); + name = AtomHelperApp; + productName = "Atom Helper"; + productReference = F911DFCEF7937FB01ADD7DD4 /* Atom Helper.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 249C7F80AA72F9C3805358CE /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + }; + buildConfigurationList = 1E8344E18D52B70AB40388D9 /* Build configuration list for PBXProject "atom" */; + compatibilityVersion = "Xcode 3.2"; + hasScannedForEncodings = 1; + mainGroup = 43C211543CE85EC76E214B18; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6528CFCB61FA1061980980AE /* All */, + 3049F5DBF2E857E3D2CA729A /* Atom */, + 440934281E3BAF0A1212AEAE /* libcef_dll_wrapper */, + 5FE7B7DEE9B72A21F35CC0E6 /* AtomHelperApp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + CA791959B87C0946C4984F2E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3F141663B10B4FA301E02078 /* Atom.icns in Resources */, + 1EBCB6D242C49767F095AF4F /* InfoPlist.strings in Resources */, + 79886EEA116D709E65484076 /* MainMenu.xib in Resources */, + 2E62CE142B79EAF1AAC74978 /* binding.html in Resources */, + C25713D6504475F37B8701C6 /* dialogs.html in Resources */, + 2FC328FB9CC4E7B01E57F2C3 /* domaccess.html in Resources */, + C27355E012FD831EFAFD5B33 /* localstorage.html in Resources */, + F0E8A79713BED0E6BCAAD144 /* logo.png in Resources */, + 2B05EA77E07F07EE3DBE61D8 /* xmlhttprequest.html in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 0CD6EE443F9F1D92E04CE1E7 /* Postbuild "Create Resources Directory In Bundle" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Create Resources Directory In Bundle\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec mkdir -p \"${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 1E8F711365CFA88241E35625 /* Postbuild "Fix Framework Link" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Fix Framework Link\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec install_name_tool -change @executable_path/libcef.dylib \"@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib\" \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 61B260848F264118E2824C1A /* Postbuild "Copy Pack File" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Copy Pack File\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec cp -f cef/cef.pak \"${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/cef.pak\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 7BE284A001BB8A27463E9F08 /* Postbuild "Tweak Info.plist" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Tweak Info.plist\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/tweak_info_plist.py \"--svn=1\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 841DE9C40027CDA59A8289E9 /* Postbuild "Copy WebCore Resources" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Copy WebCore Resources\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec cp -Rf \"${BUILT_PRODUCTS_DIR}/../../third_party/WebKit/Source/WebCore/Resources/\" \"${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 9B3BDA26CD623B34622C3BC3 /* Postbuild "Change Mach-O Flags" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Change Mach-O Flags\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec chromium/build/mac/change_mach_o_flags_from_xcode.sh\nexit 1\n"; + showEnvVarsInLog = 0; + }; + AC29BFA4F2DEEAAFEC8E4E30 /* Postbuild "Strip If Needed" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Strip If Needed\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec chromium/build/mac/strip_from_xcode\nexit 1\n"; + showEnvVarsInLog = 0; + }; + B888ADFDA624AF2312CB8CE8 /* Postbuild "Fix Framework Link" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Fix Framework Link\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec install_name_tool -change @executable_path/libcef.dylib \"@executable_path/../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib\" \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + D1BB7FBE6C9D9E837C64B48B /* Postbuild "Tweak Info.plist" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Tweak Info.plist\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ./chromium/build/mac/tweak_info_plist.py \"--breakpad=0\" \"--keystone=0\" \"--svn=0\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + DF08B3FD33F7C23543C77933 /* Postbuild "Change Mach-O Flags" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Change Mach-O Flags\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec chromium/build/mac/change_mach_o_flags_from_xcode.sh\nexit 1\n"; + showEnvVarsInLog = 0; + }; + EB4F858D348472C4DE8EAE75 /* Postbuild "Strip If Needed" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Strip If Needed\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec chromium/build/mac/strip_from_xcode\nexit 1\n"; + showEnvVarsInLog = 0; + }; + F3B3262ADF34F171A6ABA502 /* Postbuild "Make More Helpers" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Make More Helpers\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/make_more_helpers.sh Frameworks Atom\nexit 1\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 0AB53E937FA08F668692794C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0FA37E812C1B34F007E17193 /* cefclient.cpp in Sources */, + F32730ACB338E2925802F38A /* binding_test.cpp in Sources */, + 170B1FA5A1142DC30B53984E /* client_app.cpp in Sources */, + ED515C2B0AD945A8722A3E5D /* client_app_delegates.cpp in Sources */, + 4687097498D68F7CB4B0C7CE /* client_handler.cpp in Sources */, + 02A8A10DE7A3CDA0AC607E61 /* client_renderer.cpp in Sources */, + 18D042626F69B3FA86BD2DCB /* client_switches.cpp in Sources */, + 7B70944055CD6F3EA2F64445 /* dom_test.cpp in Sources */, + 3B101F19E46A070BC92A6A2C /* scheme_test.cpp in Sources */, + 28710911A945A80641BB1E89 /* string_util.cpp in Sources */, + 33F807F17A3BB533AA71FE3A /* cefclient_mac.mm in Sources */, + F5994138581214A3C847B2EE /* client_handler_mac.mm in Sources */, + 9FE8A3BB5F2A63163ED1124A /* resource_util_mac.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B556D4EFAF494A5954882107 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3152E6C88B608AF03BCB1246 /* transfer_util.cpp in Sources */, + A0DC7D175117A2CAD96FFA95 /* cef_byte_read_handler.cc in Sources */, + 7701E6A4EAFA8986B5AF76A2 /* cef_stream_resource_handler.cc in Sources */, + 7EA6572C1CFD7CC0992F238F /* cef_xml_object.cc in Sources */, + 1B635AD6DDE5A30ABA0BFBF9 /* cef_zip_archive.cc in Sources */, + 8B34033ECA389CAAE4C21F09 /* libcef_dll_wrapper.cc in Sources */, + 8496F057C81E15B08C9A307D /* libcef_dll_wrapper2.cc in Sources */, + 72D17F1E14EC8DA56C960EF1 /* app_cpptoc.cc in Sources */, + E82153D991127DE8653FCF3E /* auth_callback_ctocpp.cc in Sources */, + CEF1C8881C9380BBFE2D21BA /* before_download_callback_ctocpp.cc in Sources */, + F7BA33A02E2FE83494AB1F86 /* binary_value_ctocpp.cc in Sources */, + 09A0D0BBDF01567A72A3FADA /* browser_ctocpp.cc in Sources */, + 43BB0852EABA2A47EC0D30E0 /* browser_host_ctocpp.cc in Sources */, + 754D3ADCCC459959D2D70FC5 /* browser_process_handler_cpptoc.cc in Sources */, + 22277E6C4F42801F78F8CBE6 /* callback_ctocpp.cc in Sources */, + C6AF304B63F791077EC72BCF /* client_cpptoc.cc in Sources */, + F9089958C667FA701B60A32E /* command_line_ctocpp.cc in Sources */, + 8460BC9DE73453374D3C7924 /* context_menu_handler_cpptoc.cc in Sources */, + A28583954F42BECA67E45F88 /* context_menu_params_ctocpp.cc in Sources */, + 5E4105277D71C5C621AF29A5 /* cookie_manager_ctocpp.cc in Sources */, + C3E86714DDDBFCC30336D587 /* cookie_visitor_cpptoc.cc in Sources */, + 15145332E67F5241AC10DB0F /* domdocument_ctocpp.cc in Sources */, + E280513DCC533F1DBCFDE02F /* domevent_ctocpp.cc in Sources */, + 5A0F54485B7CFAFB74334C25 /* domevent_listener_cpptoc.cc in Sources */, + D6B1E73FE24E3857FB3DC184 /* domnode_ctocpp.cc in Sources */, + 2208650753998BDD85A8065E /* domvisitor_cpptoc.cc in Sources */, + D4D96F4CFCB979857AFDBB7F /* dictionary_value_ctocpp.cc in Sources */, + 99BD65EC1D299C7A5839878E /* display_handler_cpptoc.cc in Sources */, + 364BBD351E096D832CE3CD3E /* download_handler_cpptoc.cc in Sources */, + 8C038B7C92E5F83FCD39C22C /* download_item_ctocpp.cc in Sources */, + 81735F5DF5FAA9B0E578FF45 /* download_item_callback_ctocpp.cc in Sources */, + FDD6A5248B951968CE69C9C2 /* focus_handler_cpptoc.cc in Sources */, + 51DF03C4EB5CEE3E836797E0 /* frame_ctocpp.cc in Sources */, + D7DA3B9EB95866126BE6BA10 /* geolocation_callback_ctocpp.cc in Sources */, + 00E95FD43813F2E09369A617 /* geolocation_handler_cpptoc.cc in Sources */, + 62A632B5663B48182897B179 /* jsdialog_callback_ctocpp.cc in Sources */, + C2A11A61A2F7BD60C4A06277 /* jsdialog_handler_cpptoc.cc in Sources */, + 61752187080D3C206DE3E18B /* keyboard_handler_cpptoc.cc in Sources */, + 15673286F479E3DD72228B1A /* life_span_handler_cpptoc.cc in Sources */, + 87EBCA5235655B2DCFEF9BEF /* list_value_ctocpp.cc in Sources */, + 11C3B98FA9A36B5557ECD732 /* load_handler_cpptoc.cc in Sources */, + 529A0E7E66F130A3CB0C644F /* menu_model_ctocpp.cc in Sources */, + CF64C364C6DD7EBF3EA64F58 /* post_data_ctocpp.cc in Sources */, + 67AD4BCBE68FFCCD556D15CD /* post_data_element_ctocpp.cc in Sources */, + D6A819E465A0B3E4E171A5C3 /* process_message_ctocpp.cc in Sources */, + 63C64D70146434E02484F8FD /* proxy_handler_cpptoc.cc in Sources */, + 0DBFD3159E4FF78DEA4C431A /* read_handler_cpptoc.cc in Sources */, + AE1BF53099A3BD9A346B6DF5 /* render_process_handler_cpptoc.cc in Sources */, + 133CAA9CAC2FE868BE693DD7 /* request_ctocpp.cc in Sources */, + 816F8353FBE1427B20ECC45C /* request_handler_cpptoc.cc in Sources */, + 421E3C2957F2926C67F3BDAF /* resource_bundle_handler_cpptoc.cc in Sources */, + 5CED6B5C63885CCCC95BAC86 /* resource_handler_cpptoc.cc in Sources */, + 8A29BFA8BC7BCA864909F61A /* response_ctocpp.cc in Sources */, + 19A26FF9657D61EB4DFAEF24 /* scheme_handler_factory_cpptoc.cc in Sources */, + E0334AD65F9088008666B4CE /* scheme_registrar_ctocpp.cc in Sources */, + 91AAB6A4FE38F100BC6212A2 /* stream_reader_ctocpp.cc in Sources */, + 83293B5CD12DEC2D565A0E93 /* stream_writer_ctocpp.cc in Sources */, + 324201CAE107029E9117596E /* string_visitor_cpptoc.cc in Sources */, + 56442AC773E63B38653C15E6 /* task_cpptoc.cc in Sources */, + 09E0B767262945659A9152A5 /* urlrequest_ctocpp.cc in Sources */, + 0411700BFF66FD0D5DA623A7 /* urlrequest_client_cpptoc.cc in Sources */, + ACB5998C08FD5B93FF74EFF6 /* v8accessor_cpptoc.cc in Sources */, + 549270133CF8C9BFA2EFBE00 /* v8context_ctocpp.cc in Sources */, + 3CB3F4DBB7E5842B82AA6414 /* v8exception_ctocpp.cc in Sources */, + 79A3432EAB7B2EE6553AEFBF /* v8handler_cpptoc.cc in Sources */, + 6842068D6DF732A88809F3F6 /* v8value_ctocpp.cc in Sources */, + 6DBE3711789F0A14747FAC10 /* web_plugin_info_ctocpp.cc in Sources */, + 4F94179933CAB59CD02A8980 /* web_plugin_info_visitor_cpptoc.cc in Sources */, + 2B079CADF001CEF6EA895D7A /* write_handler_cpptoc.cc in Sources */, + B433E882FE6B08DE560430A0 /* xml_reader_ctocpp.cc in Sources */, + E437E9E330D43D1AD7FDF4A8 /* zip_reader_ctocpp.cc in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F5AF0F1ABFFCD6D69D78650F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4AD0A8D32E9E2CD7A0857CBA /* binding_test.cpp in Sources */, + 78E03FF294CB4ED999B2CDCB /* client_app.cpp in Sources */, + 1E4F3FE3D3277C8BB8170687 /* client_app_delegates.cpp in Sources */, + 6D73CFE9F308026324A40C06 /* client_handler.cpp in Sources */, + 5E6F00EDF431379070796D90 /* client_handler_mac.mm in Sources */, + 1AD956029A63FD7FBC5F5632 /* client_renderer.cpp in Sources */, + 9FC2F3DDA9E97E574DD03D8C /* client_switches.cpp in Sources */, + D7A75FBB2D0EA6CEC1E0C9F3 /* dom_test.cpp in Sources */, + 8ED45603734FF298D5A86CCB /* process_helper_mac.cpp in Sources */, + 3F6FFF06AD7FFF8429B3F86E /* resource_util_mac.mm in Sources */, + EE400221E261BAB5D6B01B49 /* scheme_test.cpp in Sources */, + 863A1083DB4E22AEBC66C97F /* string_util.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 214AE437B79B44838E8059D6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3049F5DBF2E857E3D2CA729A /* Atom */; + targetProxy = A88AEA00A41452E816A72704 /* PBXContainerItemProxy */; + }; + 2B4B5A55E644CCFE6B05D72A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5FE7B7DEE9B72A21F35CC0E6 /* AtomHelperApp */; + targetProxy = 45B8C357631C4C10D69440B8 /* PBXContainerItemProxy */; + }; + 3FCB4654CB6D810ADD2522BE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 440934281E3BAF0A1212AEAE /* libcef_dll_wrapper */; + targetProxy = 350428BEC361E5AA8CD3FA78 /* PBXContainerItemProxy */; + }; + 5F21A94BBCC21CF3166DD251 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 440934281E3BAF0A1212AEAE /* libcef_dll_wrapper */; + targetProxy = 3861ED6C205164C5E77DF6E6 /* PBXContainerItemProxy */; + }; + EEFD0410DD19F76A53FE0D85 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5FE7B7DEE9B72A21F35CC0E6 /* AtomHelperApp */; + targetProxy = 76471E84EFE6CA6091AD77E4 /* PBXContainerItemProxy */; + }; + FD2900EE9062ACA4D0D93DDF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 440934281E3BAF0A1212AEAE /* libcef_dll_wrapper */; + targetProxy = AB718239C5E2B2E8F0154E6F /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 5E8EB8112AD7378AB11B0371 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 279820DCB537D61B9D0F587A /* English */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; + 709C7A8894CFC53DB4A6904A /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 98BD40AA2AFAC0DCEEDC51DE /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 1ED884F4BDE643552E7077BA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/chromium/third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + atom, + ); + INFOPLIST_FILE = atom/cefclient/mac/Info.plist; + LDPLUSPLUS = "$(SOURCE_ROOT)/chromium/third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/System/Library/Frameworks", + cef, + ); + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = Atom; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + WRAPPER_PREFIX = ""; + }; + name = Release; + }; + 69099531298F379EC871E528 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/chromium/third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + EXECUTABLE_PREFIX = lib; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = .; + LDPLUSPLUS = "$(SOURCE_ROOT)/chromium/third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + PRODUCT_NAME = cef_dll_wrapper; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Debug; + }; + 715F920175957697BA83F006 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = All; + }; + name = Debug; + }; + 7A0B07F5238E33ED30B328AC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/chromium/third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + EXECUTABLE_PREFIX = lib; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = .; + LDPLUSPLUS = "$(SOURCE_ROOT)/chromium/third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + PRODUCT_NAME = cef_dll_wrapper; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Release; + }; + 8CDA3F82DA1E45FDF9DEA8A5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/chromium/third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + atom, + ); + INFOPLIST_FILE = atom/cefclient/mac/Info.plist; + LDPLUSPLUS = "$(SOURCE_ROOT)/chromium/third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/System/Library/Frameworks", + cef, + ); + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = Atom; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + WRAPPER_PREFIX = ""; + }; + name = Debug; + }; + 8F12A2CD0D83E7D7D57A56E2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/chromium/third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + atom, + ); + INFOPLIST_FILE = "atom/cefclient/mac/helper-Info.plist"; + LDPLUSPLUS = "$(SOURCE_ROOT)/chromium/third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/System/Library/Frameworks", + cef, + ); + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = "Atom Helper"; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + "-Wexit-time-destructors", + ); + WRAPPER_PREFIX = ""; + }; + name = Release; + }; + 9F1B8673912562A338D8A754 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = All; + }; + name = Release; + }; + AC8EA56E403A39FFC649C876 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + INTERMEDIATE_DIR = "$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)"; + SDKROOT = macosx10.6; + SHARED_INTERMEDIATE_DIR = "$(SYMROOT)/DerivedSources/$(CONFIGURATION)"; + SYMROOT = chromium/xcodebuild; + }; + name = Release; + }; + AFF9027A491B0AD9A34D88BC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + INTERMEDIATE_DIR = "$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)"; + SDKROOT = macosx10.6; + SHARED_INTERMEDIATE_DIR = "$(SYMROOT)/DerivedSources/$(CONFIGURATION)"; + SYMROOT = chromium/xcodebuild; + }; + name = Debug; + }; + CC1498915314FE38FBBB995B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/chromium/third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + atom, + ); + INFOPLIST_FILE = "atom/cefclient/mac/helper-Info.plist"; + LDPLUSPLUS = "$(SOURCE_ROOT)/chromium/third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/System/Library/Frameworks", + cef, + ); + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = "Atom Helper"; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + "-Wexit-time-destructors", + ); + WRAPPER_PREFIX = ""; + }; + name = Debug; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1E8344E18D52B70AB40388D9 /* Build configuration list for PBXProject "atom" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + AFF9027A491B0AD9A34D88BC /* Debug */, + AC8EA56E403A39FFC649C876 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 32D038632668003D3557078B /* Build configuration list for PBXNativeTarget "Atom" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8CDA3F82DA1E45FDF9DEA8A5 /* Debug */, + 1ED884F4BDE643552E7077BA /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 491F6EF221487AA86AB00112 /* Build configuration list for PBXNativeTarget "AtomHelperApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CC1498915314FE38FBBB995B /* Debug */, + 8F12A2CD0D83E7D7D57A56E2 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 72C03118553CDFF86825B100 /* Build configuration list for PBXAggregateTarget "All" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 715F920175957697BA83F006 /* Debug */, + 9F1B8673912562A338D8A754 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 96B5FA75C2CA46F616A4D283 /* Build configuration list for PBXNativeTarget "libcef_dll_wrapper" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 69099531298F379EC871E528 /* Debug */, + 7A0B07F5238E33ED30B328AC /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = 249C7F80AA72F9C3805358CE /* Project object */; +} diff --git a/atom.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/atom.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..9643d3194 --- /dev/null +++ b/atom.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/atom.xcodeproj/project.xcworkspace/xcuserdata/nathansobo.xcuserdatad/UserInterfaceState.xcuserstate b/atom.xcodeproj/project.xcworkspace/xcuserdata/nathansobo.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 000000000..48c635da5 Binary files /dev/null and b/atom.xcodeproj/project.xcworkspace/xcuserdata/nathansobo.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/atom.xcodeproj/project.xcworkspace/xcuserdata/nathansobo.xcuserdatad/WorkspaceSettings.xcsettings b/atom.xcodeproj/project.xcworkspace/xcuserdata/nathansobo.xcuserdatad/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..a8f611267 --- /dev/null +++ b/atom.xcodeproj/project.xcworkspace/xcuserdata/nathansobo.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildLocationStyle + UseTargetSettings + + diff --git a/atom.xcodeproj/xcuserdata/nathansobo.xcuserdatad/xcschemes/All.xcscheme b/atom.xcodeproj/xcuserdata/nathansobo.xcuserdatad/xcschemes/All.xcscheme new file mode 100644 index 000000000..5f9839132 --- /dev/null +++ b/atom.xcodeproj/xcuserdata/nathansobo.xcuserdatad/xcschemes/All.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/atom.xcodeproj/xcuserdata/nathansobo.xcuserdatad/xcschemes/Atom.xcscheme b/atom.xcodeproj/xcuserdata/nathansobo.xcuserdatad/xcschemes/Atom.xcscheme new file mode 100644 index 000000000..c269cd109 --- /dev/null +++ b/atom.xcodeproj/xcuserdata/nathansobo.xcuserdatad/xcschemes/Atom.xcscheme @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/atom.xcodeproj/xcuserdata/nathansobo.xcuserdatad/xcschemes/AtomHelperApp.xcscheme b/atom.xcodeproj/xcuserdata/nathansobo.xcuserdatad/xcschemes/AtomHelperApp.xcscheme new file mode 100644 index 000000000..d4740a91f --- /dev/null +++ b/atom.xcodeproj/xcuserdata/nathansobo.xcuserdatad/xcschemes/AtomHelperApp.xcscheme @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Atom.xcodeproj/xcshareddata/xcschemes/libcef_dll_wrapper.xcscheme b/atom.xcodeproj/xcuserdata/nathansobo.xcuserdatad/xcschemes/libcef_dll_wrapper.xcscheme similarity index 87% rename from Atom.xcodeproj/xcshareddata/xcschemes/libcef_dll_wrapper.xcscheme rename to atom.xcodeproj/xcuserdata/nathansobo.xcuserdatad/xcschemes/libcef_dll_wrapper.xcscheme index a6ed5e475..b7fd8b939 100644 --- a/Atom.xcodeproj/xcshareddata/xcschemes/libcef_dll_wrapper.xcscheme +++ b/atom.xcodeproj/xcuserdata/nathansobo.xcuserdatad/xcschemes/libcef_dll_wrapper.xcscheme @@ -1,6 +1,5 @@ + ReferencedContainer = "container:atom.xcodeproj"> @@ -32,7 +31,7 @@ + + + + SchemeUserState + + All.xcscheme + + orderHint + 2 + + Atom.xcscheme + + orderHint + 3 + + AtomHelperApp.xcscheme + + orderHint + 1 + + libcef_dll_wrapper.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 3049F5DBF2E857E3D2CA729A + + primary + + + 440934281E3BAF0A1212AEAE + + primary + + + 5FE7B7DEE9B72A21F35CC0E6 + + primary + + + 6528CFCB61FA1061980980AE + + primary + + + + + diff --git a/atom/cefclient/binding_test.cpp b/atom/cefclient/binding_test.cpp new file mode 100644 index 000000000..e3efa23f2 --- /dev/null +++ b/atom/cefclient/binding_test.cpp @@ -0,0 +1,104 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/binding_test.h" + +#include +#include + +#include "include/wrapper/cef_stream_resource_handler.h" +#include "cefclient/resource_util.h" + +namespace binding_test { + +namespace { + +const char* kTestUrl = "http://tests/binding"; +const char* kMessageName = "binding_test"; + +// Handle messages in the browser process. +class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate { + public: + ProcessMessageDelegate() { + } + + // From ClientHandler::ProcessMessageDelegate. + virtual bool OnProcessMessageReceived( + CefRefPtr handler, + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) OVERRIDE { + std::string message_name = message->GetName(); + if (message_name == kMessageName) { + // Handle the message. + std::string result; + + CefRefPtr args = message->GetArgumentList(); + if (args->GetSize() > 0 && args->GetType(0) == VTYPE_STRING) { + // Our result is a reverse of the original message. + result = args->GetString(0); + std::reverse(result.begin(), result.end()); + } else { + result = "Invalid request"; + } + + // Send the result back to the render process. + CefRefPtr response = + CefProcessMessage::Create(kMessageName); + response->GetArgumentList()->SetString(0, result); + browser->SendProcessMessage(PID_RENDERER, response); + + return true; + } + + return false; + } + + IMPLEMENT_REFCOUNTING(ProcessMessageDelegate); +}; + +// Handle resource loading in the browser process. +class RequestDelegate: public ClientHandler::RequestDelegate { + public: + RequestDelegate() { + } + + // From ClientHandler::RequestDelegate. + virtual CefRefPtr GetResourceHandler( + CefRefPtr handler, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request) OVERRIDE { + std::string url = request->GetURL(); + if (url == kTestUrl) { + // Show the binding contents + CefRefPtr stream = + GetBinaryResourceReader("binding.html"); + ASSERT(stream.get()); + return new CefStreamResourceHandler("text/html", stream); + } + + return NULL; + } + + IMPLEMENT_REFCOUNTING(RequestDelegate); +}; + +} // namespace + +void CreateProcessMessageDelegates( + ClientHandler::ProcessMessageDelegateSet& delegates) { + delegates.insert(new ProcessMessageDelegate); +} + +void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates) { + delegates.insert(new RequestDelegate); +} + +void RunTest(CefRefPtr browser) { + // Load the test URL. + browser->GetMainFrame()->LoadURL(kTestUrl); +} + +} // namespace binding_test diff --git a/atom/cefclient/binding_test.h b/atom/cefclient/binding_test.h new file mode 100644 index 000000000..3412fa2a1 --- /dev/null +++ b/atom/cefclient/binding_test.h @@ -0,0 +1,24 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_BINDING_TEST_H_ +#define CEF_TESTS_CEFCLIENT_BINDING_TEST_H_ +#pragma once + +#include "cefclient/client_app.h" +#include "cefclient/client_handler.h" + +namespace binding_test { + +// Delegate creation. Called from ClientApp and ClientHandler. +void CreateProcessMessageDelegates( + ClientHandler::ProcessMessageDelegateSet& delegates); +void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates); + +// Run the test. +void RunTest(CefRefPtr browser); + +} // namespace binding_test + +#endif // CEF_TESTS_CEFCLIENT_BINDING_TEST_H_ diff --git a/atom/cefclient/cefclient.cpp b/atom/cefclient/cefclient.cpp new file mode 100644 index 000000000..caa0683f5 --- /dev/null +++ b/atom/cefclient/cefclient.cpp @@ -0,0 +1,336 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/cefclient.h" +#include +#include +#include +#include +#include "include/cef_app.h" +#include "include/cef_browser.h" +#include "include/cef_command_line.h" +#include "include/cef_frame.h" +#include "include/cef_runnable.h" +#include "include/cef_web_plugin.h" +#include "cefclient/client_handler.h" +#include "cefclient/client_switches.h" +#include "cefclient/string_util.h" +#include "cefclient/util.h" + +namespace { + +// Return the int representation of the specified string. +int GetIntValue(const CefString& str) { + if (str.empty()) + return 0; + + std::string stdStr = str; + return atoi(stdStr.c_str()); +} + +} // namespace + +CefRefPtr g_handler; +CefRefPtr g_command_line; + +CefRefPtr AppGetBrowser() { + if (!g_handler.get()) + return NULL; + return g_handler->GetBrowser(); +} + +CefWindowHandle AppGetMainHwnd() { + if (!g_handler.get()) + return NULL; + return g_handler->GetMainHwnd(); +} + +void AppInitCommandLine(int argc, const char* const* argv) { + g_command_line = CefCommandLine::CreateCommandLine(); +#if defined(OS_WIN) + g_command_line->InitFromString(::GetCommandLineW()); +#else + g_command_line->InitFromArgv(argc, argv); +#endif +} + +// Returns the application command line object. +CefRefPtr AppGetCommandLine() { + return g_command_line; +} + +// Returns the application settings based on command line arguments. +void AppGetSettings(CefSettings& settings, CefRefPtr app) { + ASSERT(app.get()); + ASSERT(g_command_line.get()); + if (!g_command_line.get()) + return; + + CefString str; + +#if defined(OS_WIN) + settings.multi_threaded_message_loop = + g_command_line->HasSwitch(cefclient::kMultiThreadedMessageLoop); +#endif + + CefString(&settings.cache_path) = + g_command_line->GetSwitchValue(cefclient::kCachePath); + + // Retrieve command-line proxy configuration, if any. + bool has_proxy = false; + cef_proxy_type_t proxy_type = PROXY_TYPE_DIRECT; + CefString proxy_config; + + if (g_command_line->HasSwitch(cefclient::kProxyType)) { + std::string str = g_command_line->GetSwitchValue(cefclient::kProxyType); + if (str == cefclient::kProxyType_Direct) { + has_proxy = true; + proxy_type = PROXY_TYPE_DIRECT; + } else if (str == cefclient::kProxyType_Named || + str == cefclient::kProxyType_Pac) { + proxy_config = g_command_line->GetSwitchValue(cefclient::kProxyConfig); + if (!proxy_config.empty()) { + has_proxy = true; + proxy_type = (str == cefclient::kProxyType_Named? + PROXY_TYPE_NAMED:PROXY_TYPE_PAC_STRING); + } + } + } + + if (has_proxy) { + // Provide a ClientApp instance to handle proxy resolution. + app->SetProxyConfig(proxy_type, proxy_config); + } +} + +// Returns the application browser settings based on command line arguments. +void AppGetBrowserSettings(CefBrowserSettings& settings) { + ASSERT(g_command_line.get()); + if (!g_command_line.get()) + return; + + settings.remote_fonts_disabled = + g_command_line->HasSwitch(cefclient::kRemoteFontsDisabled); + + CefString(&settings.default_encoding) = + g_command_line->GetSwitchValue(cefclient::kDefaultEncoding); + + settings.encoding_detector_enabled = + g_command_line->HasSwitch(cefclient::kEncodingDetectorEnabled); + settings.javascript_disabled = + g_command_line->HasSwitch(cefclient::kJavascriptDisabled); + settings.javascript_open_windows_disallowed = + g_command_line->HasSwitch(cefclient::kJavascriptOpenWindowsDisallowed); + settings.javascript_close_windows_disallowed = + g_command_line->HasSwitch(cefclient::kJavascriptCloseWindowsDisallowed); + settings.javascript_access_clipboard_disallowed = + g_command_line->HasSwitch( + cefclient::kJavascriptAccessClipboardDisallowed); + settings.dom_paste_disabled = + g_command_line->HasSwitch(cefclient::kDomPasteDisabled); + settings.caret_browsing_enabled = + g_command_line->HasSwitch(cefclient::kCaretBrowsingDisabled); + settings.java_disabled = + g_command_line->HasSwitch(cefclient::kJavaDisabled); + settings.plugins_disabled = + g_command_line->HasSwitch(cefclient::kPluginsDisabled); + settings.universal_access_from_file_urls_allowed = + g_command_line->HasSwitch(cefclient::kUniversalAccessFromFileUrlsAllowed); + settings.file_access_from_file_urls_allowed = + g_command_line->HasSwitch(cefclient::kFileAccessFromFileUrlsAllowed); + settings.web_security_disabled = + g_command_line->HasSwitch(cefclient::kWebSecurityDisabled); + settings.xss_auditor_enabled = + g_command_line->HasSwitch(cefclient::kXssAuditorEnabled); + settings.image_load_disabled = + g_command_line->HasSwitch(cefclient::kImageLoadingDisabled); + settings.shrink_standalone_images_to_fit = + g_command_line->HasSwitch(cefclient::kShrinkStandaloneImagesToFit); + settings.site_specific_quirks_disabled = + g_command_line->HasSwitch(cefclient::kSiteSpecificQuirksDisabled); + settings.text_area_resize_disabled = + g_command_line->HasSwitch(cefclient::kTextAreaResizeDisabled); + settings.page_cache_disabled = + g_command_line->HasSwitch(cefclient::kPageCacheDisabled); + settings.tab_to_links_disabled = + g_command_line->HasSwitch(cefclient::kTabToLinksDisabled); + settings.hyperlink_auditing_disabled = + g_command_line->HasSwitch(cefclient::kHyperlinkAuditingDisabled); + settings.user_style_sheet_enabled = + g_command_line->HasSwitch(cefclient::kUserStyleSheetEnabled); + + CefString(&settings.user_style_sheet_location) = + g_command_line->GetSwitchValue(cefclient::kUserStyleSheetLocation); + + settings.author_and_user_styles_disabled = + g_command_line->HasSwitch(cefclient::kAuthorAndUserStylesDisabled); + settings.local_storage_disabled = + g_command_line->HasSwitch(cefclient::kLocalStorageDisabled); + settings.databases_disabled = + g_command_line->HasSwitch(cefclient::kDatabasesDisabled); + settings.application_cache_disabled = + g_command_line->HasSwitch(cefclient::kApplicationCacheDisabled); + settings.webgl_disabled = + g_command_line->HasSwitch(cefclient::kWebglDisabled); + settings.accelerated_compositing_disabled = + g_command_line->HasSwitch(cefclient::kAcceleratedCompositingDisabled); + settings.accelerated_layers_disabled = + g_command_line->HasSwitch(cefclient::kAcceleratedLayersDisabled); + settings.accelerated_video_disabled = + g_command_line->HasSwitch(cefclient::kAcceleratedVideoDisabled); + settings.accelerated_2d_canvas_disabled = + g_command_line->HasSwitch(cefclient::kAcceledated2dCanvasDisabled); + settings.accelerated_painting_enabled = + g_command_line->HasSwitch(cefclient::kAcceleratedPaintingEnabled); + settings.accelerated_filters_enabled = + g_command_line->HasSwitch(cefclient::kAcceleratedFiltersEnabled); + settings.accelerated_plugins_disabled = + g_command_line->HasSwitch(cefclient::kAcceleratedPluginsDisabled); + settings.developer_tools_disabled = + g_command_line->HasSwitch(cefclient::kDeveloperToolsDisabled); + settings.fullscreen_enabled = + g_command_line->HasSwitch(cefclient::kFullscreenEnabled); +} + +void RunGetSourceTest(CefRefPtr browser) { + class Visitor : public CefStringVisitor { + public: + explicit Visitor(CefRefPtr browser) : browser_(browser) {} + virtual void Visit(const CefString& string) OVERRIDE { + std::string source = StringReplace(string, "<", "<"); + source = StringReplace(source, ">", ">"); + std::stringstream ss; + ss << "Source:
" << source << "
"; + browser_->GetMainFrame()->LoadString(ss.str(), "http://tests/getsource"); + } + private: + CefRefPtr browser_; + IMPLEMENT_REFCOUNTING(Visitor); + }; + + browser->GetMainFrame()->GetSource(new Visitor(browser)); +} + +void RunGetTextTest(CefRefPtr browser) { + class Visitor : public CefStringVisitor { + public: + explicit Visitor(CefRefPtr browser) : browser_(browser) {} + virtual void Visit(const CefString& string) OVERRIDE { + std::string text = StringReplace(string, "<", "<"); + text = StringReplace(text, ">", ">"); + std::stringstream ss; + ss << "Text:
" << text << "
"; + browser_->GetMainFrame()->LoadString(ss.str(), "http://tests/gettext"); + } + private: + CefRefPtr browser_; + IMPLEMENT_REFCOUNTING(Visitor); + }; + + browser->GetMainFrame()->GetText(new Visitor(browser)); +} + +void RunRequestTest(CefRefPtr browser) { + // Create a new request + CefRefPtr request(CefRequest::Create()); + + // Set the request URL + request->SetURL("http://tests/request"); + + // Add post data to the request. The correct method and content- + // type headers will be set by CEF. + CefRefPtr postDataElement(CefPostDataElement::Create()); + std::string data = "arg1=val1&arg2=val2"; + postDataElement->SetToBytes(data.length(), data.c_str()); + CefRefPtr postData(CefPostData::Create()); + postData->AddElement(postDataElement); + request->SetPostData(postData); + + // Add a custom header + CefRequest::HeaderMap headerMap; + headerMap.insert( + std::make_pair("X-My-Header", "My Header Value")); + request->SetHeaderMap(headerMap); + + // Load the request + browser->GetMainFrame()->LoadRequest(request); +} + +void RunPopupTest(CefRefPtr browser) { + browser->GetMainFrame()->ExecuteJavaScript( + "window.open('http://www.google.com');", "about:blank", 0); +} + +void RunDialogTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL("http://tests/dialogs"); +} + +void RunPluginInfoTest(CefRefPtr browser) { + class Visitor : public CefWebPluginInfoVisitor { + public: + explicit Visitor(CefRefPtr browser) + : browser_(browser) { + html_ = "Plugin Info Test" + "\nInstalled plugins:"; + } + ~Visitor() { + html_ += "\n"; + + // Load the html in the browser. + browser_->GetMainFrame()->LoadString(html_, "http://tests/plugin_info"); + } + + virtual bool Visit(CefRefPtr info, int count, int total) + OVERRIDE { + html_ += "\n

Name: " + info->GetName().ToString() + + "\n
Description: " + info->GetDescription().ToString() + + "\n
Version: " + info->GetVersion().ToString() + + "\n
Path: " + info->GetPath().ToString(); + return true; + } + + private: + std::string html_; + CefRefPtr browser_; + IMPLEMENT_REFCOUNTING(Visitor); + }; + + CefVisitWebPluginInfo(new Visitor(browser)); +} + +void RunLocalStorageTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL("http://tests/localstorage"); +} + +void RunAccelerated2DCanvasTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL( + "http://mudcu.be/labs/JS1k/BreathingGalaxies.html"); +} + +void RunAcceleratedLayersTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL( + "http://webkit.org/blog-files/3d-transforms/poster-circle.html"); +} + +void RunWebGLTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL( + "http://webglsamples.googlecode.com/hg/field/field.html"); +} + +void RunHTML5VideoTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL( + "http://www.youtube.com/watch?v=siOHh0uzcuY&html5=True"); +} + +void RunXMLHTTPRequestTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL("http://tests/xmlhttprequest"); +} + +void RunDragDropTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL("http://html5demos.com/drag"); +} + +void RunGeolocationTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL("http://html5demos.com/geo"); +} diff --git a/atom/cefclient/cefclient.h b/atom/cefclient/cefclient.h new file mode 100644 index 000000000..cd01401f2 --- /dev/null +++ b/atom/cefclient/cefclient.h @@ -0,0 +1,58 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_H_ +#define CEF_TESTS_CEFCLIENT_CEFCLIENT_H_ +#pragma once + +#include +#include "include/cef_base.h" +#include "cefclient/client_app.h" + +class CefApp; +class CefBrowser; +class CefCommandLine; + +// Returns the main browser window instance. +CefRefPtr AppGetBrowser(); + +// Returns the main application window handle. +CefWindowHandle AppGetMainHwnd(); + +// Returns the application working directory. +std::string AppGetWorkingDirectory(); + +// Initialize the application command line. +void AppInitCommandLine(int argc, const char* const* argv); + +// Returns the application command line object. +CefRefPtr AppGetCommandLine(); + +// Returns the application settings based on command line arguments. +void AppGetSettings(CefSettings& settings, CefRefPtr app); + +// Returns the application browser settings based on command line arguments. +void AppGetBrowserSettings(CefBrowserSettings& settings); + +// Implementations for various tests. +void RunGetSourceTest(CefRefPtr browser); +void RunGetTextTest(CefRefPtr browser); +void RunRequestTest(CefRefPtr browser); +void RunPopupTest(CefRefPtr browser); +void RunDialogTest(CefRefPtr browser); +void RunPluginInfoTest(CefRefPtr browser); +void RunLocalStorageTest(CefRefPtr browser); +void RunAccelerated2DCanvasTest(CefRefPtr browser); +void RunAcceleratedLayersTest(CefRefPtr browser); +void RunWebGLTest(CefRefPtr browser); +void RunHTML5VideoTest(CefRefPtr browser); +void RunXMLHTTPRequestTest(CefRefPtr browser); +void RunDragDropTest(CefRefPtr browser); +void RunGeolocationTest(CefRefPtr browser); + +#if defined(OS_WIN) +void RunTransparentPopupTest(CefRefPtr browser); +#endif + +#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_H_ diff --git a/atom/cefclient/cefclient.rc b/atom/cefclient/cefclient.rc new file mode 100644 index 000000000..c56c72659 --- /dev/null +++ b/atom/cefclient/cefclient.rc @@ -0,0 +1,172 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Binary +// + +IDS_BINDING BINARY "res\\binding.html" +IDS_DIALOGS BINARY "res\\dialogs.html" +IDS_LOGO BINARY "res\\logo.png" +IDS_LOGOBALL BINARY "res\\logoball.png" +IDS_LOCALSTORAGE BINARY "res\\localstorage.html" +IDS_XMLHTTPREQUEST BINARY "res\\xmlhttprequest.html" +IDS_DOMACCESS BINARY "res\\domaccess.html" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_CEFCLIENT ICON "res\cefclient.ico" +IDI_SMALL ICON "res\small.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_CEFCLIENT MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END + POPUP "&Help" + BEGIN + MENUITEM "&About ...", IDM_ABOUT + END + POPUP "Tests" + BEGIN + MENUITEM "Get Source", ID_TESTS_GETSOURCE + MENUITEM "Get Text", ID_TESTS_GETTEXT + MENUITEM "Popup Window", ID_TESTS_POPUP + MENUITEM "Request", ID_TESTS_REQUEST + MENUITEM "Scheme Handler", ID_TESTS_SCHEME_HANDLER + MENUITEM "JavaScript Binding", ID_TESTS_BINDING + MENUITEM "JavaScript Dialogs", ID_TESTS_DIALOGS + MENUITEM "Plugin Info", ID_TESTS_PLUGIN_INFO + MENUITEM "DOM Access", ID_TESTS_DOM_ACCESS + MENUITEM "Local Storage", ID_TESTS_LOCALSTORAGE + MENUITEM "XMLHttpRequest", ID_TESTS_XMLHTTPREQUEST + MENUITEM "Accelerated 2D Canvas", ID_TESTS_ACCELERATED2DCANVAS + MENUITEM "Accelerated Layers", ID_TESTS_ACCELERATEDLAYERS + MENUITEM "WebGL", ID_TESTS_WEBGL + MENUITEM "HTML5 Video", ID_TESTS_HTML5VIDEO + MENUITEM "Drag && Drop", ID_TESTS_DRAGDROP + MENUITEM "Geolocation", ID_TESTS_GEOLOCATION + MENUITEM "Zoom In", ID_TESTS_ZOOM_IN + MENUITEM "Zoom Out", ID_TESTS_ZOOM_OUT + MENUITEM "Zoom Reset", ID_TESTS_ZOOM_RESET + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_CEFCLIENT ACCELERATORS +BEGIN + "?", IDM_ABOUT, ASCII, ALT + "/", IDM_ABOUT, ASCII, ALT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG 22, 17, 230, 75 +STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "System" +BEGIN + ICON IDI_CEFCLIENT,IDC_MYICON,14,9,16,16 + LTEXT "cefclient Version 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX + LTEXT "Copyright (C) 2008",IDC_STATIC,49,20,119,8 + DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_APP_TITLE "cefclient" + IDC_CEFCLIENT "CEFCLIENT" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/atom/cefclient/cefclient_gtk.cpp b/atom/cefclient/cefclient_gtk.cpp new file mode 100644 index 000000000..118862711 --- /dev/null +++ b/atom/cefclient/cefclient_gtk.cpp @@ -0,0 +1,408 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include +#include +#include +#include +#include "cefclient/cefclient.h" +#include "include/cef_app.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "include/cef_runnable.h" +#include "cefclient/binding_test.h" +#include "cefclient/client_handler.h" +#include "cefclient/dom_test.h" +#include "cefclient/scheme_test.h" +#include "cefclient/string_util.h" + +char szWorkingDir[512]; // The current working directory + +// The global ClientHandler reference. +extern CefRefPtr g_handler; + +void destroy(void) { + CefQuitMessageLoop(); +} + +void TerminationSignalHandler(int signatl) { + destroy(); +} + +// Callback for Debug > Get Source... menu item. +gboolean GetSourceActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunGetSourceTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Get Source... menu item. +gboolean GetTextActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunGetTextTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Request... menu item. +gboolean RequestActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunRequestTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Local Storage... menu item. +gboolean LocalStorageActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunLocalStorageTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > XMLHttpRequest... menu item. +gboolean XMLHttpRequestActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunXMLHTTPRequestTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Scheme Handler... menu item. +gboolean SchemeHandlerActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + scheme_test::RunTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > JavaScript Binding... menu item. +gboolean BindingActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + binding_test::RunTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Plugin Info... menu item. +gboolean PluginInfoActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunPluginInfoTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > DOM Access... menu item. +gboolean DOMAccessActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + dom_test::RunTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Popup Window... menu item. +gboolean PopupWindowActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunPopupTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Accelerated 2D Canvas... menu item. +gboolean Accelerated2DCanvasActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunAccelerated2DCanvasTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Accelerated Layers... menu item. +gboolean AcceleratedLayersActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunAcceleratedLayersTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > WebGL... menu item. +gboolean WebGLActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunWebGLTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > HTML5 Video... menu item. +gboolean HTML5VideoActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunHTML5VideoTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > HTML5 Drag & Drop... menu item. +gboolean HTML5DragDropActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunDragDropTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + + +// Callback for Debug > Zoom In... menu item. +gboolean ZoomInActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) { + CefRefPtr browser = g_handler->GetBrowser(); + browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() + 0.5); + } + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Zoom Out... menu item. +gboolean ZoomOutActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) { + CefRefPtr browser = g_handler->GetBrowser(); + browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() - 0.5); + } + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Zoom Reset... menu item. +gboolean ZoomResetActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) { + CefRefPtr browser = g_handler->GetBrowser(); + browser->GetHost()->SetZoomLevel(0.0); + } + + return FALSE; // Don't stop this message. +} + +// Callback for when you click the back button. +void BackButtonClicked(GtkButton* button) { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->GoBack(); +} + +// Callback for when you click the forward button. +void ForwardButtonClicked(GtkButton* button) { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->GoForward(); +} + +// Callback for when you click the stop button. +void StopButtonClicked(GtkButton* button) { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->StopLoad(); +} + +// Callback for when you click the reload button. +void ReloadButtonClicked(GtkButton* button) { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->Reload(); +} + +// Callback for when you press enter in the URL box. +void URLEntryActivate(GtkEntry* entry) { + if (!g_handler.get() || !g_handler->GetBrowserId()) + return; + + const gchar* url = gtk_entry_get_text(entry); + g_handler->GetBrowser()->GetMainFrame()->LoadURL(std::string(url).c_str()); +} + +// GTK utility functions ---------------------------------------------- + +GtkWidget* AddMenuEntry(GtkWidget* menu_widget, const char* text, + GCallback callback) { + GtkWidget* entry = gtk_menu_item_new_with_label(text); + g_signal_connect(entry, "activate", callback, NULL); + gtk_menu_shell_append(GTK_MENU_SHELL(menu_widget), entry); + return entry; +} + +GtkWidget* CreateMenu(GtkWidget* menu_bar, const char* text) { + GtkWidget* menu_widget = gtk_menu_new(); + GtkWidget* menu_header = gtk_menu_item_new_with_label(text); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_header), menu_widget); + gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), menu_header); + return menu_widget; +} + +GtkWidget* CreateMenuBar() { + GtkWidget* menu_bar = gtk_menu_bar_new(); + GtkWidget* debug_menu = CreateMenu(menu_bar, "Tests"); + + AddMenuEntry(debug_menu, "Get Source", + G_CALLBACK(GetSourceActivated)); + AddMenuEntry(debug_menu, "Get Text", + G_CALLBACK(GetTextActivated)); + AddMenuEntry(debug_menu, "Request", + G_CALLBACK(RequestActivated)); + AddMenuEntry(debug_menu, "Local Storage", + G_CALLBACK(LocalStorageActivated)); + AddMenuEntry(debug_menu, "XMLHttpRequest", + G_CALLBACK(XMLHttpRequestActivated)); + AddMenuEntry(debug_menu, "Scheme Handler", + G_CALLBACK(SchemeHandlerActivated)); + AddMenuEntry(debug_menu, "JavaScript Binding", + G_CALLBACK(BindingActivated)); + AddMenuEntry(debug_menu, "Plugin Info", + G_CALLBACK(PluginInfoActivated)); + AddMenuEntry(debug_menu, "DOM Access", + G_CALLBACK(DOMAccessActivated)); + AddMenuEntry(debug_menu, "Popup Window", + G_CALLBACK(PopupWindowActivated)); + AddMenuEntry(debug_menu, "Accelerated 2D Canvas", + G_CALLBACK(Accelerated2DCanvasActivated)); + AddMenuEntry(debug_menu, "Accelerated Layers", + G_CALLBACK(AcceleratedLayersActivated)); + AddMenuEntry(debug_menu, "WebGL", + G_CALLBACK(WebGLActivated)); + AddMenuEntry(debug_menu, "HTML5 Video", + G_CALLBACK(HTML5VideoActivated)); + AddMenuEntry(debug_menu, "HTML5 Drag & Drop", + G_CALLBACK(HTML5DragDropActivated)); + AddMenuEntry(debug_menu, "Zoom In", + G_CALLBACK(ZoomInActivated)); + AddMenuEntry(debug_menu, "Zoom Out", + G_CALLBACK(ZoomOutActivated)); + AddMenuEntry(debug_menu, "Zoom Reset", + G_CALLBACK(ZoomResetActivated)); + return menu_bar; +} + +// WebViewDelegate::TakeFocus in the test webview delegate. +static gboolean HandleFocus(GtkWidget* widget, + GdkEventFocus* focus) { + if (g_handler.get() && g_handler->GetBrowserId()) { + // Give focus to the browser window. + g_handler->GetBrowser()->GetHost()->SetFocus(true); + } + + return TRUE; +} + +int main(int argc, char* argv[]) { + CefMainArgs main_args(argc, argv); + CefRefPtr app(new ClientApp); + + // Execute the secondary process, if any. + int exit_code = CefExecuteProcess(main_args, app.get()); + if (exit_code >= 0) + return exit_code; + + if (!getcwd(szWorkingDir, sizeof (szWorkingDir))) + return -1; + + GtkWidget* window; + + gtk_init(&argc, &argv); + + // Parse command line arguments. + AppInitCommandLine(argc, argv); + + CefSettings settings; + + // Populate the settings based on command line arguments. + AppGetSettings(settings, app); + + // Initialize CEF. + CefInitialize(main_args, settings, app.get()); + + // Register the scheme handler. + scheme_test::InitTest(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_default_size(GTK_WINDOW(window), 800, 600); + + g_signal_connect(window, "focus", G_CALLBACK(&HandleFocus), NULL); + + GtkWidget* vbox = gtk_vbox_new(FALSE, 0); + + GtkWidget* menu_bar = CreateMenuBar(); + + gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 0); + + GtkWidget* toolbar = gtk_toolbar_new(); + // Turn off the labels on the toolbar buttons. + gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); + + GtkToolItem* back = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK); + g_signal_connect(back, "clicked", + G_CALLBACK(BackButtonClicked), NULL); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), back, -1 /* append */); + + GtkToolItem* forward = gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD); + g_signal_connect(forward, "clicked", + G_CALLBACK(ForwardButtonClicked), NULL); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), forward, -1 /* append */); + + GtkToolItem* reload = gtk_tool_button_new_from_stock(GTK_STOCK_REFRESH); + g_signal_connect(reload, "clicked", + G_CALLBACK(ReloadButtonClicked), NULL); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), reload, -1 /* append */); + + GtkToolItem* stop = gtk_tool_button_new_from_stock(GTK_STOCK_STOP); + g_signal_connect(stop, "clicked", + G_CALLBACK(StopButtonClicked), NULL); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), stop, -1 /* append */); + + GtkWidget* m_editWnd = gtk_entry_new(); + g_signal_connect(G_OBJECT(m_editWnd), "activate", + G_CALLBACK(URLEntryActivate), NULL); + + GtkToolItem* tool_item = gtk_tool_item_new(); + gtk_container_add(GTK_CONTAINER(tool_item), m_editWnd); + gtk_tool_item_set_expand(tool_item, TRUE); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), tool_item, -1); // append + + gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); + + g_signal_connect(G_OBJECT(window), "destroy", + G_CALLBACK(gtk_widget_destroyed), &window); + g_signal_connect(G_OBJECT(window), "destroy", + G_CALLBACK(destroy), NULL); + + // Create the handler. + g_handler = new ClientHandler(); + g_handler->SetMainHwnd(vbox); + g_handler->SetEditHwnd(m_editWnd); + g_handler->SetButtonHwnds(GTK_WIDGET(back), GTK_WIDGET(forward), + GTK_WIDGET(reload), GTK_WIDGET(stop)); + + // Create the browser view. + CefWindowInfo window_info; + CefBrowserSettings browserSettings; + + // Populate the settings based on command line arguments. + AppGetBrowserSettings(browserSettings); + + window_info.SetAsChild(vbox); + + CefBrowserHost::CreateBrowserSync( + window_info, g_handler.get(), + g_handler->GetStartupURL(), browserSettings); + + gtk_container_add(GTK_CONTAINER(window), vbox); + gtk_widget_show_all(GTK_WIDGET(window)); + + // Install an signal handler so we clean up after ourselves. + signal(SIGINT, TerminationSignalHandler); + signal(SIGTERM, TerminationSignalHandler); + + CefRunMessageLoop(); + + CefShutdown(); + + return 0; +} + +// Global functions + +std::string AppGetWorkingDirectory() { + return szWorkingDir; +} diff --git a/atom/cefclient/cefclient_mac.mm b/atom/cefclient/cefclient_mac.mm new file mode 100644 index 000000000..b4c17da3d --- /dev/null +++ b/atom/cefclient/cefclient_mac.mm @@ -0,0 +1,542 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#include +#include "cefclient/cefclient.h" +#include "include/cef_app.h" +#import "include/cef_application_mac.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "include/cef_runnable.h" +#include "cefclient/binding_test.h" +#include "cefclient/client_handler.h" +#include "cefclient/dom_test.h" +#include "cefclient/resource_util.h" +#include "cefclient/scheme_test.h" +#include "cefclient/string_util.h" + +// The global ClientHandler reference. +extern CefRefPtr g_handler; + +char szWorkingDir[512]; // The current working directory + +// Sizes for URL bar layout +#define BUTTON_HEIGHT 22 +#define BUTTON_WIDTH 72 +#define BUTTON_MARGIN 8 +#define URLBAR_HEIGHT 32 + +// Content area size for newly created windows. +const int kWindowWidth = 800; +const int kWindowHeight = 600; + +// Memory AutoRelease pool. +static NSAutoreleasePool* g_autopool = nil; + +// Provide the CefAppProtocol implementation required by CEF. +@interface ClientApplication : NSApplication { +@private + BOOL handlingSendEvent_; +} +@end + +@implementation ClientApplication +- (BOOL)isHandlingSendEvent { + return handlingSendEvent_; +} + +- (void)setHandlingSendEvent:(BOOL)handlingSendEvent { + handlingSendEvent_ = handlingSendEvent; +} + +- (void)sendEvent:(NSEvent*)event { + CefScopedSendingEvent sendingEventScoper; + [super sendEvent:event]; +} +@end + + +// Receives notifications from controls and the browser window. Will delete +// itself when done. +@interface ClientWindowDelegate : NSObject +- (IBAction)goBack:(id)sender; +- (IBAction)goForward:(id)sender; +- (IBAction)reload:(id)sender; +- (IBAction)stopLoading:(id)sender; +- (IBAction)takeURLStringValueFrom:(NSTextField *)sender; +- (void)alert:(NSString*)title withMessage:(NSString*)message; +- (void)notifyConsoleMessage:(id)object; +- (void)notifyDownloadComplete:(id)object; +- (void)notifyDownloadError:(id)object; +@end + +@implementation ClientWindowDelegate + +- (IBAction)goBack:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->GoBack(); +} + +- (IBAction)goForward:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->GoForward(); +} + +- (IBAction)reload:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->Reload(); +} + +- (IBAction)stopLoading:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->StopLoad(); +} + +- (IBAction)takeURLStringValueFrom:(NSTextField *)sender { + if (!g_handler.get() || !g_handler->GetBrowserId()) + return; + + NSString *url = [sender stringValue]; + + // if it doesn't already have a prefix, add http. If we can't parse it, + // just don't bother rather than making things worse. + NSURL* tempUrl = [NSURL URLWithString:url]; + if (tempUrl && ![tempUrl scheme]) + url = [@"http://" stringByAppendingString:url]; + + std::string urlStr = [url UTF8String]; + g_handler->GetBrowser()->GetMainFrame()->LoadURL(urlStr); +} + +- (void)alert:(NSString*)title withMessage:(NSString*)message { + NSAlert *alert = [NSAlert alertWithMessageText:title + defaultButton:@"OK" + alternateButton:nil + otherButton:nil + informativeTextWithFormat:message]; + [alert runModal]; +} + +- (void)notifyConsoleMessage:(id)object { + std::stringstream ss; + ss << "Console messages will be written to " << g_handler->GetLogFile(); + NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())]; + [self alert:@"Console Messages" withMessage:str]; +} + +- (void)notifyDownloadComplete:(id)object { + std::stringstream ss; + ss << "File \"" << g_handler->GetLastDownloadFile() << + "\" downloaded successfully."; + NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())]; + [self alert:@"File Download" withMessage:str]; +} + +- (void)notifyDownloadError:(id)object { + std::stringstream ss; + ss << "File \"" << g_handler->GetLastDownloadFile() << + "\" failed to download."; + NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())]; + [self alert:@"File Download" withMessage:str]; +} + +- (void)windowDidBecomeKey:(NSNotification*)notification { + if (g_handler.get() && g_handler->GetBrowserId()) { + // Give focus to the browser window. + g_handler->GetBrowser()->GetHost()->SetFocus(true); + } +} + +// Called when the window is about to close. Perform the self-destruction +// sequence by getting rid of the window. By returning YES, we allow the window +// to be removed from the screen. +- (BOOL)windowShouldClose:(id)window { + // Try to make the window go away. + [window autorelease]; + + // Clean ourselves up after clearing the stack of anything that might have the + // window on it. + [self performSelectorOnMainThread:@selector(cleanup:) + withObject:window + waitUntilDone:NO]; + + return YES; +} + +// Deletes itself. +- (void)cleanup:(id)window { + [self release]; +} + +@end + + +NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) { + NSButton* button = [[[NSButton alloc] initWithFrame:*rect] autorelease]; + [button setTitle:title]; + [button setBezelStyle:NSSmallSquareBezelStyle]; + [button setAutoresizingMask:(NSViewMaxXMargin | NSViewMinYMargin)]; + [parent addSubview:button]; + rect->origin.x += BUTTON_WIDTH; + return button; +} + +// Receives notifications from the application. Will delete itself when done. +@interface ClientAppDelegate : NSObject +- (void)createApp:(id)object; +- (IBAction)testGetSource:(id)sender; +- (IBAction)testGetText:(id)sender; +- (IBAction)testRequest:(id)sender; +- (IBAction)testLocalStorage:(id)sender; +- (IBAction)testXMLHttpRequest:(id)sender; +- (IBAction)testSchemeHandler:(id)sender; +- (IBAction)testBinding:(id)sender; +- (IBAction)testDialogs:(id)sender; +- (IBAction)testPluginInfo:(id)sender; +- (IBAction)testDOMAccess:(id)sender; +- (IBAction)testPopupWindow:(id)sender; +- (IBAction)testAccelerated2DCanvas:(id)sender; +- (IBAction)testAcceleratedLayers:(id)sender; +- (IBAction)testWebGL:(id)sender; +- (IBAction)testHTML5Video:(id)sender; +- (IBAction)testDragDrop:(id)sender; +- (IBAction)testZoomIn:(id)sender; +- (IBAction)testZoomOut:(id)sender; +- (IBAction)testZoomReset:(id)sender; +@end + +@implementation ClientAppDelegate + +// Create the application on the UI thread. +- (void)createApp:(id)object { + [NSApplication sharedApplication]; + [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; + + // Set the delegate for application events. + [NSApp setDelegate:self]; + + // Add the Tests menu. + NSMenu* menubar = [NSApp mainMenu]; + NSMenuItem *testItem = [[[NSMenuItem alloc] initWithTitle:@"Tests" + action:nil + keyEquivalent:@""] autorelease]; + NSMenu *testMenu = [[[NSMenu alloc] initWithTitle:@"Tests"] autorelease]; + [testMenu addItemWithTitle:@"Get Source" + action:@selector(testGetSource:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Get Text" + action:@selector(testGetText:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Popup Window" + action:@selector(testPopupWindow:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Request" + action:@selector(testRequest:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Scheme Handler" + action:@selector(testSchemeHandler:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"JavaScript Binding" + action:@selector(testBinding:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"JavaScript Dialogs" + action:@selector(testDialogs:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Plugin Info" + action:@selector(testPluginInfo:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"DOM Access" + action:@selector(testDOMAccess:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Local Storage" + action:@selector(testLocalStorage:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"XMLHttpRequest" + action:@selector(testXMLHttpRequest:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Accelerated 2D Canvas" + action:@selector(testAccelerated2DCanvas:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Accelerated Layers" + action:@selector(testAcceleratedLayers:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"WebGL" + action:@selector(testWebGL:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"HTML5 Video" + action:@selector(testHTML5Video:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Drag & Drop" + action:@selector(testDragDrop:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Zoom In" + action:@selector(testZoomIn:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Zoom Out" + action:@selector(testZoomOut:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Zoom Reset" + action:@selector(testZoomReset:) + keyEquivalent:@""]; + [testItem setSubmenu:testMenu]; + [menubar addItem:testItem]; + + // Create the delegate for control and browser window events. + ClientWindowDelegate* delegate = [[ClientWindowDelegate alloc] init]; + + // Create the main application window. + NSRect screen_rect = [[NSScreen mainScreen] visibleFrame]; + NSRect window_rect = { {0, screen_rect.size.height - kWindowHeight}, + {kWindowWidth, kWindowHeight} }; + NSWindow* mainWnd = [[UnderlayOpenGLHostingWindow alloc] + initWithContentRect:window_rect + styleMask:(NSTitledWindowMask | + NSClosableWindowMask | + NSMiniaturizableWindowMask | + NSResizableWindowMask ) + backing:NSBackingStoreBuffered + defer:NO]; + [mainWnd setTitle:@"cefclient"]; + [mainWnd setDelegate:delegate]; + + // Rely on the window delegate to clean us up rather than immediately + // releasing when the window gets closed. We use the delegate to do + // everything from the autorelease pool so the window isn't on the stack + // during cleanup (ie, a window close from javascript). + [mainWnd setReleasedWhenClosed:NO]; + + NSView* contentView = [mainWnd contentView]; + + // Create the buttons. + NSRect button_rect = [contentView bounds]; + button_rect.origin.y = window_rect.size.height - URLBAR_HEIGHT + + (URLBAR_HEIGHT - BUTTON_HEIGHT) / 2; + button_rect.size.height = BUTTON_HEIGHT; + button_rect.origin.x += BUTTON_MARGIN; + button_rect.size.width = BUTTON_WIDTH; + + NSButton* button = MakeButton(&button_rect, @"Back", contentView); + [button setTarget:delegate]; + [button setAction:@selector(goBack:)]; + + button = MakeButton(&button_rect, @"Forward", contentView); + [button setTarget:delegate]; + [button setAction:@selector(goForward:)]; + + button = MakeButton(&button_rect, @"Reload", contentView); + [button setTarget:delegate]; + [button setAction:@selector(reload:)]; + + button = MakeButton(&button_rect, @"Stop", contentView); + [button setTarget:delegate]; + [button setAction:@selector(stopLoading:)]; + + // Create the URL text field. + button_rect.origin.x += BUTTON_MARGIN; + button_rect.size.width = [contentView bounds].size.width - + button_rect.origin.x - BUTTON_MARGIN; + NSTextField* editWnd = [[NSTextField alloc] initWithFrame:button_rect]; + [contentView addSubview:editWnd]; + [editWnd setAutoresizingMask:(NSViewWidthSizable | NSViewMinYMargin)]; + [editWnd setTarget:delegate]; + [editWnd setAction:@selector(takeURLStringValueFrom:)]; + [[editWnd cell] setWraps:NO]; + [[editWnd cell] setScrollable:YES]; + + // Create the handler. + g_handler = new ClientHandler(); + g_handler->SetMainHwnd(contentView); + g_handler->SetEditHwnd(editWnd); + + // Create the browser view. + CefWindowInfo window_info; + CefBrowserSettings settings; + + // Populate the settings based on command line arguments. + AppGetBrowserSettings(settings); + + window_info.SetAsChild(contentView, 0, 0, kWindowWidth, kWindowHeight); + CefBrowserHost::CreateBrowser(window_info, g_handler.get(), + g_handler->GetStartupURL(), settings); + + // Show the window. + [mainWnd makeKeyAndOrderFront: nil]; + + // Size the window. + NSRect r = [mainWnd contentRectForFrameRect:[mainWnd frame]]; + r.size.width = kWindowWidth; + r.size.height = kWindowHeight + URLBAR_HEIGHT; + [mainWnd setFrame:[mainWnd frameRectForContentRect:r] display:YES]; +} + +- (IBAction)testGetSource:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunGetSourceTest(g_handler->GetBrowser()); +} + +- (IBAction)testGetText:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunGetTextTest(g_handler->GetBrowser()); +} + +- (IBAction)testRequest:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunRequestTest(g_handler->GetBrowser()); +} + +- (IBAction)testLocalStorage:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunLocalStorageTest(g_handler->GetBrowser()); +} + +- (IBAction)testXMLHttpRequest:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunXMLHTTPRequestTest(g_handler->GetBrowser()); +} + +- (IBAction)testSchemeHandler:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + scheme_test::RunTest(g_handler->GetBrowser()); +} + +- (IBAction)testBinding:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + binding_test::RunTest(g_handler->GetBrowser()); +} + +- (IBAction)testDialogs:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunDialogTest(g_handler->GetBrowser()); +} + +- (IBAction)testPluginInfo:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunPluginInfoTest(g_handler->GetBrowser()); +} + +- (IBAction)testDOMAccess:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + dom_test::RunTest(g_handler->GetBrowser()); +} + +- (IBAction)testPopupWindow:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunPopupTest(g_handler->GetBrowser()); +} + +- (IBAction)testAccelerated2DCanvas:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunAccelerated2DCanvasTest(g_handler->GetBrowser()); +} + +- (IBAction)testAcceleratedLayers:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunAcceleratedLayersTest(g_handler->GetBrowser()); +} + +- (IBAction)testWebGL:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunWebGLTest(g_handler->GetBrowser()); +} + +- (IBAction)testHTML5Video:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunHTML5VideoTest(g_handler->GetBrowser()); +} + +- (IBAction)testDragDrop:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunDragDropTest(g_handler->GetBrowser()); +} + +- (IBAction)testZoomIn:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) { + CefRefPtr browser = g_handler->GetBrowser(); + browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() + 0.5); + } +} + +- (IBAction)testZoomOut:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) { + CefRefPtr browser = g_handler->GetBrowser(); + browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() - 0.5); + } +} + +- (IBAction)testZoomReset:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) { + CefRefPtr browser = g_handler->GetBrowser(); + browser->GetHost()->SetZoomLevel(0.0); + } +} + + +// Sent by the default notification center immediately before the application +// terminates. +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Shut down CEF. + g_handler = NULL; + CefShutdown(); + + [self release]; + + // Release the AutoRelease pool. + [g_autopool release]; +} + +@end + + +int main(int argc, char* argv[]) { + CefMainArgs main_args(argc, argv); + CefRefPtr app(new ClientApp); + + // Execute the secondary process, if any. + int exit_code = CefExecuteProcess(main_args, app.get()); + if (exit_code >= 0) + return exit_code; + + // Retrieve the current working directory. + getcwd(szWorkingDir, sizeof(szWorkingDir)); + + // Initialize the AutoRelease pool. + g_autopool = [[NSAutoreleasePool alloc] init]; + + // Initialize the ClientApplication instance. + [ClientApplication sharedApplication]; + + // Parse command line arguments. + AppInitCommandLine(argc, argv); + + CefSettings settings; + + // Populate the settings based on command line arguments. + AppGetSettings(settings, app); + + // Initialize CEF. + CefInitialize(main_args, settings, app.get()); + + // Register the scheme handler. + scheme_test::InitTest(); + + // Create the application delegate and window. + NSObject* delegate = [[ClientAppDelegate alloc] init]; + [delegate performSelectorOnMainThread:@selector(createApp:) withObject:nil + waitUntilDone:NO]; + + // Run the application message loop. + CefRunMessageLoop(); + + // Don't put anything below this line because it won't be executed. + return 0; +} + + +// Global functions + +std::string AppGetWorkingDirectory() { + return szWorkingDir; +} diff --git a/atom/cefclient/cefclient_win.cpp b/atom/cefclient/cefclient_win.cpp new file mode 100644 index 000000000..a380d9ce2 --- /dev/null +++ b/atom/cefclient/cefclient_win.cpp @@ -0,0 +1,546 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/cefclient.h" +#include +#include +#include +#include +#include +#include +#include "include/cef_app.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "include/cef_runnable.h" +#include "cefclient/binding_test.h" +#include "cefclient/client_handler.h" +#include "cefclient/dom_test.h" +#include "cefclient/resource.h" +#include "cefclient/scheme_test.h" +#include "cefclient/string_util.h" + +#define MAX_LOADSTRING 100 +#define MAX_URL_LENGTH 255 +#define BUTTON_WIDTH 72 +#define URLBAR_HEIGHT 24 + +// Global Variables: +HINSTANCE hInst; // current instance +TCHAR szTitle[MAX_LOADSTRING]; // The title bar text +TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name +char szWorkingDir[MAX_PATH]; // The current working directory + +// Forward declarations of functions included in this code module: +ATOM MyRegisterClass(HINSTANCE hInstance); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); + +// The global ClientHandler reference. +extern CefRefPtr g_handler; + +#if defined(OS_WIN) +// Add Common Controls to the application manifest because it's required to +// support the default tooltip implementation. +#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length) +#endif + +// Program entry point function. +int APIENTRY wWinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) { + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + CefMainArgs main_args(hInstance); + CefRefPtr app(new ClientApp); + + // Execute the secondary process, if any. + int exit_code = CefExecuteProcess(main_args, app.get()); + if (exit_code >= 0) + return exit_code; + + // Retrieve the current working directory. + if (_getcwd(szWorkingDir, MAX_PATH) == NULL) + szWorkingDir[0] = 0; + + // Parse command line arguments. The passed in values are ignored on Windows. + AppInitCommandLine(0, NULL); + + CefSettings settings; + + // Populate the settings based on command line arguments. + AppGetSettings(settings, app); + + // Initialize CEF. + CefInitialize(main_args, settings, app.get()); + + // Register the scheme handler. + scheme_test::InitTest(); + + HACCEL hAccelTable; + + // Initialize global strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + LoadString(hInstance, IDC_CEFCLIENT, szWindowClass, MAX_LOADSTRING); + MyRegisterClass(hInstance); + + // Perform application initialization + if (!InitInstance (hInstance, nCmdShow)) + return FALSE; + + hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_CEFCLIENT)); + + int result = 0; + + if (!settings.multi_threaded_message_loop) { + // Run the CEF message loop. This function will block until the application + // recieves a WM_QUIT message. + CefRunMessageLoop(); + } else { + MSG msg; + + // Run the application message loop. + while (GetMessage(&msg, NULL, 0, 0)) { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + result = static_cast(msg.wParam); + } + + // Shut down CEF. + CefShutdown(); + + return result; +} + +// +// FUNCTION: MyRegisterClass() +// +// PURPOSE: Registers the window class. +// +// COMMENTS: +// +// This function and its usage are only necessary if you want this code +// to be compatible with Win32 systems prior to the 'RegisterClassEx' +// function that was added to Windows 95. It is important to call this +// function so that the application will get 'well formed' small icons +// associated with it. +// +ATOM MyRegisterClass(HINSTANCE hInstance) { + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_CEFCLIENT)); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = MAKEINTRESOURCE(IDC_CEFCLIENT); + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); + + return RegisterClassEx(&wcex); +} + +// +// FUNCTION: InitInstance(HINSTANCE, int) +// +// PURPOSE: Saves instance handle and creates main window +// +// COMMENTS: +// +// In this function, we save the instance handle in a global variable and +// create and display the main program window. +// +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { + HWND hWnd; + + hInst = hInstance; // Store instance handle in our global variable + + hWnd = CreateWindow(szWindowClass, szTitle, + WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, CW_USEDEFAULT, 0, + CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); + + if (!hWnd) + return FALSE; + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +// Change the zoom factor on the UI thread. +static void ModifyZoom(CefRefPtr browser, double delta) { + if (CefCurrentlyOn(TID_UI)) { + browser->GetHost()->SetZoomLevel( + browser->GetHost()->GetZoomLevel() + delta); + } else { + CefPostTask(TID_UI, NewCefRunnableFunction(ModifyZoom, browser, delta)); + } +} + +// +// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) +// +// PURPOSE: Processes messages for the main window. +// +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, + LPARAM lParam) { + static HWND backWnd = NULL, forwardWnd = NULL, reloadWnd = NULL, + stopWnd = NULL, editWnd = NULL; + static WNDPROC editWndOldProc = NULL; + + // Static members used for the find dialog. + static FINDREPLACE fr; + static WCHAR szFindWhat[80] = {0}; + static WCHAR szLastFindWhat[80] = {0}; + static bool findNext = false; + static bool lastMatchCase = false; + + int wmId, wmEvent; + PAINTSTRUCT ps; + HDC hdc; + + if (hWnd == editWnd) { + // Callback for the edit window + switch (message) { + case WM_CHAR: + if (wParam == VK_RETURN && g_handler.get()) { + // When the user hits the enter key load the URL + CefRefPtr browser = g_handler->GetBrowser(); + wchar_t strPtr[MAX_URL_LENGTH+1] = {0}; + *((LPWORD)strPtr) = MAX_URL_LENGTH; + LRESULT strLen = SendMessage(hWnd, EM_GETLINE, 0, (LPARAM)strPtr); + if (strLen > 0) { + strPtr[strLen] = 0; + browser->GetMainFrame()->LoadURL(strPtr); + } + + return 0; + } + } + + return (LRESULT)CallWindowProc(editWndOldProc, hWnd, message, wParam, + lParam); + } else { + // Callback for the main window + switch (message) { + case WM_CREATE: { + // Create the single static handler class instance + g_handler = new ClientHandler(); + g_handler->SetMainHwnd(hWnd); + + // Create the child windows used for navigation + RECT rect; + int x = 0; + + GetClientRect(hWnd, &rect); + + backWnd = CreateWindow(L"BUTTON", L"Back", + WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON + | WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT, + hWnd, (HMENU) IDC_NAV_BACK, hInst, 0); + x += BUTTON_WIDTH; + + forwardWnd = CreateWindow(L"BUTTON", L"Forward", + WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON + | WS_DISABLED, x, 0, BUTTON_WIDTH, + URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_FORWARD, + hInst, 0); + x += BUTTON_WIDTH; + + reloadWnd = CreateWindow(L"BUTTON", L"Reload", + WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON + | WS_DISABLED, x, 0, BUTTON_WIDTH, + URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_RELOAD, + hInst, 0); + x += BUTTON_WIDTH; + + stopWnd = CreateWindow(L"BUTTON", L"Stop", + WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON + | WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT, + hWnd, (HMENU) IDC_NAV_STOP, hInst, 0); + x += BUTTON_WIDTH; + + editWnd = CreateWindow(L"EDIT", 0, + WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | + ES_AUTOVSCROLL | ES_AUTOHSCROLL| WS_DISABLED, + x, 0, rect.right - BUTTON_WIDTH * 4, + URLBAR_HEIGHT, hWnd, 0, hInst, 0); + + // Assign the edit window's WNDPROC to this function so that we can + // capture the enter key + editWndOldProc = + reinterpret_cast(GetWindowLongPtr(editWnd, GWLP_WNDPROC)); + SetWindowLongPtr(editWnd, GWLP_WNDPROC, + reinterpret_cast(WndProc)); + g_handler->SetEditHwnd(editWnd); + g_handler->SetButtonHwnds(backWnd, forwardWnd, reloadWnd, stopWnd); + + rect.top += URLBAR_HEIGHT; + + CefWindowInfo info; + CefBrowserSettings settings; + + // Populate the settings based on command line arguments. + AppGetBrowserSettings(settings); + + // Initialize window info to the defaults for a child window + info.SetAsChild(hWnd, rect); + + // Creat the new child browser window + CefBrowserHost::CreateBrowser(info, g_handler.get(), + g_handler->GetStartupURL(), settings); + + return 0; + } + + case WM_COMMAND: { + CefRefPtr browser; + if (g_handler.get()) + browser = g_handler->GetBrowser(); + + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + // Parse the menu selections: + switch (wmId) { + case IDM_ABOUT: + DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); + return 0; + case IDM_EXIT: + DestroyWindow(hWnd); + return 0; + case ID_WARN_CONSOLEMESSAGE: + if (g_handler.get()) { + std::wstringstream ss; + ss << L"Console messages will be written to " + << std::wstring(CefString(g_handler->GetLogFile())); + MessageBox(hWnd, ss.str().c_str(), L"Console Messages", + MB_OK | MB_ICONINFORMATION); + } + return 0; + case ID_WARN_DOWNLOADCOMPLETE: + case ID_WARN_DOWNLOADERROR: + if (g_handler.get()) { + std::wstringstream ss; + ss << L"File \"" << + std::wstring(CefString(g_handler->GetLastDownloadFile())) << + L"\" "; + + if (wmId == ID_WARN_DOWNLOADCOMPLETE) + ss << L"downloaded successfully."; + else + ss << L"failed to download."; + + MessageBox(hWnd, ss.str().c_str(), L"File Download", + MB_OK | MB_ICONINFORMATION); + } + return 0; + case IDC_NAV_BACK: // Back button + if (browser.get()) + browser->GoBack(); + return 0; + case IDC_NAV_FORWARD: // Forward button + if (browser.get()) + browser->GoForward(); + return 0; + case IDC_NAV_RELOAD: // Reload button + if (browser.get()) + browser->Reload(); + return 0; + case IDC_NAV_STOP: // Stop button + if (browser.get()) + browser->StopLoad(); + return 0; + case ID_TESTS_GETSOURCE: // Test the GetSource function + if (browser.get()) + RunGetSourceTest(browser); + return 0; + case ID_TESTS_GETTEXT: // Test the GetText function + if (browser.get()) + RunGetTextTest(browser); + return 0; + case ID_TESTS_POPUP: // Test a popup window + if (browser.get()) + RunPopupTest(browser); + return 0; + case ID_TESTS_REQUEST: // Test a request + if (browser.get()) + RunRequestTest(browser); + return 0; + case ID_TESTS_SCHEME_HANDLER: // Test the scheme handler + if (browser.get()) + scheme_test::RunTest(browser); + return 0; + case ID_TESTS_BINDING: // Test JavaScript binding + if (browser.get()) + binding_test::RunTest(browser); + return 0; + case ID_TESTS_DIALOGS: // Test JavaScript dialogs + if (browser.get()) + RunDialogTest(browser); + return 0; + case ID_TESTS_PLUGIN_INFO: // Test plugin info + if (browser.get()) + RunPluginInfoTest(browser); + return 0; + case ID_TESTS_DOM_ACCESS: // Test DOM access + if (browser.get()) + dom_test::RunTest(browser); + return 0; + case ID_TESTS_LOCALSTORAGE: // Test localStorage + if (browser.get()) + RunLocalStorageTest(browser); + return 0; + case ID_TESTS_ACCELERATED2DCANVAS: // Test accelerated 2d canvas + if (browser.get()) + RunAccelerated2DCanvasTest(browser); + return 0; + case ID_TESTS_ACCELERATEDLAYERS: // Test accelerated layers + if (browser.get()) + RunAcceleratedLayersTest(browser); + return 0; + case ID_TESTS_WEBGL: // Test WebGL + if (browser.get()) + RunWebGLTest(browser); + return 0; + case ID_TESTS_HTML5VIDEO: // Test HTML5 video + if (browser.get()) + RunHTML5VideoTest(browser); + return 0; + case ID_TESTS_XMLHTTPREQUEST: // Test XMLHttpRequest + if (browser.get()) + RunXMLHTTPRequestTest(browser); + return 0; + case ID_TESTS_DRAGDROP: // Test drag & drop + if (browser.get()) + RunDragDropTest(browser); + return 0; + case ID_TESTS_GEOLOCATION: // Test geolocation + if (browser.get()) + RunGeolocationTest(browser); + return 0; + case ID_TESTS_ZOOM_IN: + if (browser.get()) + ModifyZoom(browser, 0.5); + return 0; + case ID_TESTS_ZOOM_OUT: + if (browser.get()) + ModifyZoom(browser, -0.5); + return 0; + case ID_TESTS_ZOOM_RESET: + if (browser.get()) + browser->GetHost()->SetZoomLevel(0.0); + return 0; + } + break; + } + + case WM_PAINT: + hdc = BeginPaint(hWnd, &ps); + EndPaint(hWnd, &ps); + return 0; + + case WM_SETFOCUS: + if (g_handler.get() && g_handler->GetBrowser()) { + // Pass focus to the browser window + CefWindowHandle hwnd = + g_handler->GetBrowser()->GetHost()->GetWindowHandle(); + if (hwnd) + PostMessage(hwnd, WM_SETFOCUS, wParam, NULL); + } + return 0; + + case WM_SIZE: + // Minimizing resizes the window to 0x0 which causes our layout to go all + // screwy, so we just ignore it. + if (wParam != SIZE_MINIMIZED && g_handler.get() && + g_handler->GetBrowser()) { + CefWindowHandle hwnd = + g_handler->GetBrowser()->GetHost()->GetWindowHandle(); + if (hwnd) { + // Resize the browser window and address bar to match the new frame + // window size + RECT rect; + GetClientRect(hWnd, &rect); + rect.top += URLBAR_HEIGHT; + + int urloffset = rect.left + BUTTON_WIDTH * 4; + + HDWP hdwp = BeginDeferWindowPos(1); + hdwp = DeferWindowPos(hdwp, editWnd, NULL, urloffset, + 0, rect.right - urloffset, URLBAR_HEIGHT, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, hwnd, NULL, + rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, + SWP_NOZORDER); + EndDeferWindowPos(hdwp); + } + } + break; + + case WM_ERASEBKGND: + if (g_handler.get() && g_handler->GetBrowser()) { + CefWindowHandle hwnd = + g_handler->GetBrowser()->GetHost()->GetWindowHandle(); + if (hwnd) { + // Dont erase the background if the browser window has been loaded + // (this avoids flashing) + return 0; + } + } + break; + + case WM_CLOSE: + if (g_handler.get()) { + CefRefPtr browser = g_handler->GetBrowser(); + if (browser.get()) { + // Let the browser window know we are about to destroy it. + browser->GetHost()->ParentWindowWillClose(); + } + } + break; + + case WM_DESTROY: + // The frame window has exited + PostQuitMessage(0); + return 0; + } + + return DefWindowProc(hWnd, message, wParam, lParam); + } +} + +// Message handler for about box. +INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { + UNREFERENCED_PARAMETER(lParam); + switch (message) { + case WM_INITDIALOG: + return (INT_PTR)TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { + EndDialog(hDlg, LOWORD(wParam)); + return (INT_PTR)TRUE; + } + break; + } + return (INT_PTR)FALSE; +} + + +// Global functions + +std::string AppGetWorkingDirectory() { + return szWorkingDir; +} diff --git a/atom/cefclient/client_app.cpp b/atom/cefclient/client_app.cpp new file mode 100644 index 000000000..b6a26d150 --- /dev/null +++ b/atom/cefclient/client_app.cpp @@ -0,0 +1,346 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +// This file is shared by cefclient and cef_unittests so don't include using +// a qualified path. +#include "client_app.h" // NOLINT(build/include) + +#include + +#include "include/cef_cookie.h" +#include "include/cef_process_message.h" +#include "include/cef_task.h" +#include "include/cef_v8.h" +#include "util.h" // NOLINT(build/include) + +namespace { + +// Forward declarations. +void SetList(CefRefPtr source, CefRefPtr target); +void SetList(CefRefPtr source, CefRefPtr target); + +// Transfer a V8 value to a List index. +void SetListValue(CefRefPtr list, int index, + CefRefPtr value) { + if (value->IsArray()) { + CefRefPtr new_list = CefListValue::Create(); + SetList(value, new_list); + list->SetList(index, new_list); + } else if (value->IsString()) { + list->SetString(index, value->GetStringValue()); + } else if (value->IsBool()) { + list->SetBool(index, value->GetBoolValue()); + } else if (value->IsInt()) { + list->SetInt(index, value->GetIntValue()); + } else if (value->IsDouble()) { + list->SetDouble(index, value->GetDoubleValue()); + } +} + +// Transfer a V8 array to a List. +void SetList(CefRefPtr source, CefRefPtr target) { + ASSERT(source->IsArray()); + + int arg_length = source->GetArrayLength(); + if (arg_length == 0) + return; + + // Start with null types in all spaces. + target->SetSize(arg_length); + + for (int i = 0; i < arg_length; ++i) + SetListValue(target, i, source->GetValue(i)); +} + +// Transfer a List value to a V8 array index. +void SetListValue(CefRefPtr list, int index, + CefRefPtr value) { + CefRefPtr new_value; + + CefValueType type = value->GetType(index); + switch (type) { + case VTYPE_LIST: { + CefRefPtr list = value->GetList(index); + new_value = CefV8Value::CreateArray(list->GetSize()); + SetList(list, new_value); + } break; + case VTYPE_BOOL: + new_value = CefV8Value::CreateBool(value->GetBool(index)); + break; + case VTYPE_DOUBLE: + new_value = CefV8Value::CreateDouble(value->GetDouble(index)); + break; + case VTYPE_INT: + new_value = CefV8Value::CreateInt(value->GetInt(index)); + break; + case VTYPE_STRING: + new_value = CefV8Value::CreateString(value->GetString(index)); + break; + default: + break; + } + + if (new_value.get()) { + list->SetValue(index, new_value); + } else { + list->SetValue(index, CefV8Value::CreateNull()); + } +} + +// Transfer a List to a V8 array. +void SetList(CefRefPtr source, CefRefPtr target) { + ASSERT(target->IsArray()); + + int arg_length = source->GetSize(); + if (arg_length == 0) + return; + + for (int i = 0; i < arg_length; ++i) + SetListValue(target, i, source); +} + + +// Handles the native implementation for the client_app extension. +class ClientAppExtensionHandler : public CefV8Handler { + public: + explicit ClientAppExtensionHandler(CefRefPtr client_app) + : client_app_(client_app) { + } + + virtual bool Execute(const CefString& name, + CefRefPtr object, + const CefV8ValueList& arguments, + CefRefPtr& retval, + CefString& exception) { + bool handled = false; + + if (name == "sendMessage") { + // Send a message to the browser process. + if ((arguments.size() == 1 || arguments.size() == 2) && + arguments[0]->IsString()) { + CefRefPtr browser = + CefV8Context::GetCurrentContext()->GetBrowser(); + ASSERT(browser.get()); + + CefString name = arguments[0]->GetStringValue(); + if (!name.empty()) { + CefRefPtr message = + CefProcessMessage::Create(name); + + // Translate the arguments, if any. + if (arguments.size() == 2 && arguments[1]->IsArray()) + SetList(arguments[1], message->GetArgumentList()); + + browser->SendProcessMessage(PID_BROWSER, message); + handled = true; + } + } + } else if (name == "setMessageCallback") { + // Set a message callback. + if (arguments.size() == 2 && arguments[0]->IsString() && + arguments[1]->IsFunction()) { + std::string name = arguments[0]->GetStringValue(); + CefRefPtr context = CefV8Context::GetCurrentContext(); + int browser_id = context->GetBrowser()->GetIdentifier(); + client_app_->SetMessageCallback(name, browser_id, context, + arguments[1]); + handled = true; + } + } else if (name == "removeMessageCallback") { + // Remove a message callback. + if (arguments.size() == 1 && arguments[0]->IsString()) { + std::string name = arguments[0]->GetStringValue(); + CefRefPtr context = CefV8Context::GetCurrentContext(); + int browser_id = context->GetBrowser()->GetIdentifier(); + bool removed = client_app_->RemoveMessageCallback(name, browser_id); + retval = CefV8Value::CreateBool(removed); + handled = true; + } + } + + if (!handled) + exception = "Invalid method arguments"; + + return true; + } + + private: + CefRefPtr client_app_; + + IMPLEMENT_REFCOUNTING(ClientAppExtensionHandler); +}; + +} // namespace + + +ClientApp::ClientApp() + : proxy_type_(PROXY_TYPE_DIRECT) { + CreateRenderDelegates(render_delegates_); + + // Default schemes that support cookies. + cookieable_schemes_.push_back("http"); + cookieable_schemes_.push_back("https"); +} + +void ClientApp::SetMessageCallback(const std::string& message_name, + int browser_id, + CefRefPtr context, + CefRefPtr function) { + ASSERT(CefCurrentlyOn(TID_RENDERER)); + + callback_map_.insert( + std::make_pair(std::make_pair(message_name, browser_id), + std::make_pair(context, function))); +} + +bool ClientApp::RemoveMessageCallback(const std::string& message_name, + int browser_id) { + ASSERT(CefCurrentlyOn(TID_RENDERER)); + + CallbackMap::iterator it = + callback_map_.find(std::make_pair(message_name, browser_id)); + if (it != callback_map_.end()) { + callback_map_.erase(it); + return true; + } + + return false; +} + +void ClientApp::OnContextInitialized() { + // Register cookieable schemes with the global cookie manager. + CefRefPtr manager = CefCookieManager::GetGlobalManager(); + ASSERT(manager.get()); + manager->SetSupportedSchemes(cookieable_schemes_); +} + +void ClientApp::GetProxyForUrl(const CefString& url, + CefProxyInfo& proxy_info) { + proxy_info.proxyType = proxy_type_; + if (!proxy_config_.empty()) + CefString(&proxy_info.proxyList) = proxy_config_; +} + +void ClientApp::OnWebKitInitialized() { + // Register the client_app extension. + std::string app_code = + "var app;" + "if (!app)" + " app = {};" + "(function() {" + " app.sendMessage = function(name, arguments) {" + " native function sendMessage();" + " return sendMessage(name, arguments);" + " };" + " app.setMessageCallback = function(name, callback) {" + " native function setMessageCallback();" + " return setMessageCallback(name, callback);" + " };" + " app.removeMessageCallback = function(name) {" + " native function removeMessageCallback();" + " return removeMessageCallback(name);" + " };" + "})();"; + CefRegisterExtension("v8/app", app_code, + new ClientAppExtensionHandler(this)); + + // Execute delegate callbacks. + RenderDelegateSet::iterator it = render_delegates_.begin(); + for (; it != render_delegates_.end(); ++it) + (*it)->OnWebKitInitialized(this); +} + +void ClientApp::OnContextCreated(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) { + // Execute delegate callbacks. + RenderDelegateSet::iterator it = render_delegates_.begin(); + for (; it != render_delegates_.end(); ++it) + (*it)->OnContextCreated(this, browser, frame, context); +} + +void ClientApp::OnContextReleased(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) { + // Execute delegate callbacks. + RenderDelegateSet::iterator it = render_delegates_.begin(); + for (; it != render_delegates_.end(); ++it) + (*it)->OnContextReleased(this, browser, frame, context); + + // Remove any JavaScript callbacks registered for the context that has been + // released. + if (!callback_map_.empty()) { + CallbackMap::iterator it = callback_map_.begin(); + for (; it != callback_map_.end();) { + if (it->second.first->IsSame(context)) + callback_map_.erase(it++); + else + ++it; + } + } +} + +void ClientApp::OnFocusedNodeChanged(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr node) { + // Execute delegate callbacks. + RenderDelegateSet::iterator it = render_delegates_.begin(); + for (; it != render_delegates_.end(); ++it) + (*it)->OnFocusedNodeChanged(this, browser, frame, node); +} + +bool ClientApp::OnProcessMessageReceived( + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) { + ASSERT(source_process == PID_BROWSER); + + bool handled = false; + + // Execute delegate callbacks. + RenderDelegateSet::iterator it = render_delegates_.begin(); + for (; it != render_delegates_.end() && !handled; ++it) { + handled = (*it)->OnProcessMessageReceived(this, browser, source_process, + message); + } + + if (handled) + return true; + + // Execute the registered JavaScript callback if any. + if (!callback_map_.empty()) { + CefString message_name = message->GetName(); + CallbackMap::const_iterator it = callback_map_.find( + std::make_pair(message_name.ToString(), + browser->GetIdentifier())); + if (it != callback_map_.end()) { + // Enter the context. + it->second.first->Enter(); + + CefV8ValueList arguments; + + // First argument is the message name. + arguments.push_back(CefV8Value::CreateString(message_name)); + + // Second argument is the list of message arguments. + CefRefPtr list = message->GetArgumentList(); + CefRefPtr args = CefV8Value::CreateArray(list->GetSize()); + SetList(list, args); + arguments.push_back(args); + + // Execute the callback. + CefRefPtr retval = + it->second.second->ExecuteFunction(NULL, arguments); + if (retval.get()) { + if (retval->IsBool()) + handled = retval->GetBoolValue(); + } + + // Exit the context. + it->second.first->Exit(); + } + } + + return handled; +} diff --git a/atom/cefclient/client_app.h b/atom/cefclient/client_app.h new file mode 100644 index 000000000..2a5e955aa --- /dev/null +++ b/atom/cefclient/client_app.h @@ -0,0 +1,157 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_CLIENT_APP_H_ +#define CEF_TESTS_CEFCLIENT_CLIENT_APP_H_ +#pragma once + +#include +#include +#include +#include +#include +#include "include/cef_app.h" + +class ClientApp : public CefApp, + public CefBrowserProcessHandler, + public CefProxyHandler, + public CefRenderProcessHandler { + public: + // Interface for renderer delegates. All RenderDelegates must be returned via + // CreateRenderDelegates. Do not perform work in the RenderDelegate + // constructor. + class RenderDelegate : public virtual CefBase { + public: + // Called when WebKit is initialized. Used to register V8 extensions. + virtual void OnWebKitInitialized(CefRefPtr app) { + }; + + // Called when a V8 context is created. Used to create V8 window bindings + // and set message callbacks. RenderDelegates should check for unique URLs + // to avoid interfering with each other. + virtual void OnContextCreated(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) { + }; + + // Called when a V8 context is released. Used to clean up V8 window + // bindings. RenderDelegates should check for unique URLs to avoid + // interfering with each other. + virtual void OnContextReleased(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) { + }; + + // Called when the focused node in a frame has changed. + virtual void OnFocusedNodeChanged(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr node) { + } + + // Called when a process message is received. Return true if the message was + // handled and should not be passed on to other handlers. RenderDelegates + // should check for unique message names to avoid interfering with each + // other. + virtual bool OnProcessMessageReceived( + CefRefPtr app, + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) { + return false; + } + }; + + typedef std::set > RenderDelegateSet; + + ClientApp(); + + // Set the proxy configuration. Should only be called during initialization. + void SetProxyConfig(cef_proxy_type_t proxy_type, + const CefString& proxy_config) { + proxy_type_ = proxy_type; + proxy_config_ = proxy_config; + } + + // Set a JavaScript callback for the specified |message_name| and |browser_id| + // combination. Will automatically be removed when the associated context is + // released. Callbacks can also be set in JavaScript using the + // app.setMessageCallback function. + void SetMessageCallback(const std::string& message_name, + int browser_id, + CefRefPtr context, + CefRefPtr function); + + // Removes the JavaScript callback for the specified |message_name| and + // |browser_id| combination. Returns true if a callback was removed. Callbacks + // can also be removed in JavaScript using the app.removeMessageCallback + // function. + bool RemoveMessageCallback(const std::string& message_name, + int browser_id); + + private: + // Creates all of the RenderDelegate objects. Implemented in + // client_app_delegates. + static void CreateRenderDelegates(RenderDelegateSet& delegates); + + // Registers custom schemes. Implemented in client_app_delegates. + static void RegisterCustomSchemes(CefRefPtr registrar, + std::vector& cookiable_schemes); + + // CefApp methods. + virtual void OnRegisterCustomSchemes( + CefRefPtr registrar) OVERRIDE { + RegisterCustomSchemes(registrar, cookieable_schemes_); + } + virtual CefRefPtr GetBrowserProcessHandler() + OVERRIDE { return this; } + virtual CefRefPtr GetRenderProcessHandler() + OVERRIDE { return this; } + + // CefBrowserProcessHandler methods. + virtual CefRefPtr GetProxyHandler() OVERRIDE { return this; } + virtual void OnContextInitialized(); + + // CefProxyHandler methods. + virtual void GetProxyForUrl(const CefString& url, + CefProxyInfo& proxy_info) OVERRIDE; + + // CefRenderProcessHandler methods. + virtual void OnWebKitInitialized() OVERRIDE; + virtual void OnContextCreated(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) OVERRIDE; + virtual void OnContextReleased(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) OVERRIDE; + virtual void OnFocusedNodeChanged(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr node) OVERRIDE; + virtual bool OnProcessMessageReceived( + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) OVERRIDE; + + // Proxy configuration. + cef_proxy_type_t proxy_type_; + CefString proxy_config_; + + // Map of message callbacks. + typedef std::map, + std::pair, CefRefPtr > > + CallbackMap; + CallbackMap callback_map_; + + // Set of supported RenderDelegates. + RenderDelegateSet render_delegates_; + + // Schemes that will be registered with the global cookie manager. + std::vector cookieable_schemes_; + + IMPLEMENT_REFCOUNTING(ClientApp); +}; + +#endif // CEF_TESTS_CEFCLIENT_CLIENT_APP_H_ diff --git a/atom/cefclient/client_app_delegates.cpp b/atom/cefclient/client_app_delegates.cpp new file mode 100644 index 000000000..84a76a8dc --- /dev/null +++ b/atom/cefclient/client_app_delegates.cpp @@ -0,0 +1,21 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/client_app.h" +#include "cefclient/client_renderer.h" +#include "cefclient/dom_test.h" +#include "cefclient/scheme_test.h" + +// static +void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) { + client_renderer::CreateRenderDelegates(delegates); + dom_test::CreateRenderDelegates(delegates); +} + +// static +void ClientApp::RegisterCustomSchemes( + CefRefPtr registrar, + std::vector& cookiable_schemes) { + scheme_test::RegisterCustomSchemes(registrar, cookiable_schemes); +} diff --git a/atom/cefclient/client_handler.cpp b/atom/cefclient/client_handler.cpp new file mode 100644 index 000000000..e65bd98d3 --- /dev/null +++ b/atom/cefclient/client_handler.cpp @@ -0,0 +1,526 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/client_handler.h" +#include +#include +#include +#include +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "include/cef_path_util.h" +#include "include/cef_process_util.h" +#include "include/cef_runnable.h" +#include "include/wrapper/cef_stream_resource_handler.h" +#include "cefclient/binding_test.h" +#include "cefclient/cefclient.h" +#include "cefclient/client_renderer.h" +#include "cefclient/client_switches.h" +#include "cefclient/dom_test.h" +#include "cefclient/resource_util.h" +#include "cefclient/string_util.h" + + +// Custom menu command Ids. +enum client_menu_ids { + CLIENT_ID_SHOW_DEVTOOLS = MENU_ID_USER_FIRST, + CLIENT_ID_TESTMENU_SUBMENU, + CLIENT_ID_TESTMENU_CHECKITEM, + CLIENT_ID_TESTMENU_RADIOITEM1, + CLIENT_ID_TESTMENU_RADIOITEM2, + CLIENT_ID_TESTMENU_RADIOITEM3, +}; + +ClientHandler::ClientHandler() + : m_MainHwnd(NULL), + m_BrowserId(0), + m_EditHwnd(NULL), + m_BackHwnd(NULL), + m_ForwardHwnd(NULL), + m_StopHwnd(NULL), + m_ReloadHwnd(NULL), + m_bFocusOnEditableField(false) { + CreateProcessMessageDelegates(process_message_delegates_); + CreateRequestDelegates(request_delegates_); + + // Read command line settings. + CefRefPtr command_line = + CefCommandLine::GetGlobalCommandLine(); + + if (command_line->HasSwitch(cefclient::kUrl)) + m_StartupURL = command_line->GetSwitchValue(cefclient::kUrl); + if (m_StartupURL.empty()) + m_StartupURL = "http://www.google.com/"; + + m_bExternalDevTools = command_line->HasSwitch(cefclient::kExternalDevTools); +} + +ClientHandler::~ClientHandler() { +} + +bool ClientHandler::OnProcessMessageReceived( + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) { + // Check for messages from the client renderer. + std::string message_name = message->GetName(); + if (message_name == client_renderer::kFocusedNodeChangedMessage) { + // A message is sent from ClientRenderDelegate to tell us whether the + // currently focused DOM node is editable. Use of |m_bFocusOnEditableField| + // is redundant with CefKeyEvent.focus_on_editable_field in OnPreKeyEvent + // but is useful for demonstration purposes. + m_bFocusOnEditableField = message->GetArgumentList()->GetBool(0); + return true; + } + + bool handled = false; + + // Execute delegate callbacks. + ProcessMessageDelegateSet::iterator it = process_message_delegates_.begin(); + for (; it != process_message_delegates_.end() && !handled; ++it) { + handled = (*it)->OnProcessMessageReceived(this, browser, source_process, + message); + } + + return handled; +} + +void ClientHandler::OnBeforeContextMenu( + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr params, + CefRefPtr model) { + if ((params->GetTypeFlags() & (CM_TYPEFLAG_PAGE | CM_TYPEFLAG_FRAME)) != 0) { + // Add a separator if the menu already has items. + if (model->GetCount() > 0) + model->AddSeparator(); + + // Add a "Show DevTools" item to all context menus. + model->AddItem(CLIENT_ID_SHOW_DEVTOOLS, "&Show DevTools"); + + CefString devtools_url = browser->GetHost()->GetDevToolsURL(true); + if (devtools_url.empty() || + m_OpenDevToolsURLs.find(devtools_url) != m_OpenDevToolsURLs.end()) { + // Disable the menu option if DevTools isn't enabled or if a window is + // already open for the current URL. + model->SetEnabled(CLIENT_ID_SHOW_DEVTOOLS, false); + } + + // Test context menu features. + BuildTestMenu(model); + } +} + +bool ClientHandler::OnContextMenuCommand( + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr params, + int command_id, + EventFlags event_flags) { + switch (command_id) { + case CLIENT_ID_SHOW_DEVTOOLS: + ShowDevTools(browser); + return true; + default: // Allow default handling, if any. + return ExecuteTestMenu(command_id); + } +} + +void ClientHandler::OnLoadingStateChange(CefRefPtr browser, + bool isLoading, + bool canGoBack, + bool canGoForward) { + REQUIRE_UI_THREAD(); + SetLoading(isLoading); + SetNavState(canGoBack, canGoForward); +} + +bool ClientHandler::OnConsoleMessage(CefRefPtr browser, + const CefString& message, + const CefString& source, + int line) { + REQUIRE_UI_THREAD(); + + bool first_message; + std::string logFile; + + { + AutoLock lock_scope(this); + + first_message = m_LogFile.empty(); + if (first_message) { + std::stringstream ss; + ss << AppGetWorkingDirectory(); +#if defined(OS_WIN) + ss << "\\"; +#else + ss << "/"; +#endif + ss << "console.log"; + m_LogFile = ss.str(); + } + logFile = m_LogFile; + } + + FILE* file = fopen(logFile.c_str(), "a"); + if (file) { + std::stringstream ss; + ss << "Message: " << std::string(message) << "\r\nSource: " << + std::string(source) << "\r\nLine: " << line << + "\r\n-----------------------\r\n"; + fputs(ss.str().c_str(), file); + fclose(file); + + if (first_message) + SendNotification(NOTIFY_CONSOLE_MESSAGE); + } + + return false; +} + +void ClientHandler::OnBeforeDownload( + CefRefPtr browser, + CefRefPtr download_item, + const CefString& suggested_name, + CefRefPtr callback) { + REQUIRE_UI_THREAD(); + // Continue the download and show the "Save As" dialog. + callback->Continue(GetDownloadPath(suggested_name), true); +} + +void ClientHandler::OnDownloadUpdated( + CefRefPtr browser, + CefRefPtr download_item, + CefRefPtr callback) { + REQUIRE_UI_THREAD(); + if (download_item->IsComplete()) { + SetLastDownloadFile(download_item->GetFullPath()); + SendNotification(NOTIFY_DOWNLOAD_COMPLETE); + } +} + +void ClientHandler::OnRequestGeolocationPermission( + CefRefPtr browser, + const CefString& requesting_url, + int request_id, + CefRefPtr callback) { + // Allow geolocation access from all websites. + callback->Continue(true); +} + +bool ClientHandler::OnPreKeyEvent(CefRefPtr browser, + const CefKeyEvent& event, + CefEventHandle os_event, + bool* is_keyboard_shortcut) { + ASSERT(m_bFocusOnEditableField == event.focus_on_editable_field); + if (!event.focus_on_editable_field && event.windows_key_code == 0x20) { + // Special handling for the space character when an input element does not + // have focus. Handling the event in OnPreKeyEvent() keeps the event from + // being processed in the renderer. If we instead handled the event in the + // OnKeyEvent() method the space key would cause the window to scroll in + // addition to showing the alert box. + if (event.type == KEYEVENT_RAWKEYDOWN) { + browser->GetMainFrame()->ExecuteJavaScript( + "alert('You pressed the space bar!');", "", 0); + } + return true; + } + + return false; +} + +void ClientHandler::OnAfterCreated(CefRefPtr browser) { + REQUIRE_UI_THREAD(); + + AutoLock lock_scope(this); + if (!m_Browser.get()) { + // We need to keep the main child window, but not popup windows + m_Browser = browser; + m_BrowserId = browser->GetIdentifier(); + } +} + +bool ClientHandler::DoClose(CefRefPtr browser) { + REQUIRE_UI_THREAD(); + + 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(); + + // Return true here so that we can skip closing the browser window + // in this pass. (It will be destroyed due to the call to close + // the parent above.) + return true; + } + + // A popup browser window is not contained in another window, so we can let + // these windows close by themselves. + return false; +} + +void ClientHandler::OnBeforeClose(CefRefPtr browser) { + REQUIRE_UI_THREAD(); + + 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); + } +} + +void ClientHandler::OnLoadStart(CefRefPtr browser, + CefRefPtr frame) { + REQUIRE_UI_THREAD(); + + if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { + // We've just started loading a page + SetLoading(true); + } +} + +void ClientHandler::OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) { + REQUIRE_UI_THREAD(); + + if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { + // We've just finished loading a page + SetLoading(false); + + // Continue the DOM test. + if (frame->GetURL() == dom_test::kTestUrl) + dom_test::OnLoadEnd(browser); + } +} + +void ClientHandler::OnLoadError(CefRefPtr browser, + CefRefPtr frame, + ErrorCode errorCode, + const CefString& errorText, + const CefString& failedUrl) { + REQUIRE_UI_THREAD(); + + // Don't display an error for downloaded files. + if (errorCode == ERR_ABORTED) + return; + + // Don't display an error for external protocols that we allow the OS to + // handle. See OnProtocolExecution(). + if (errorCode == ERR_UNKNOWN_URL_SCHEME) { + std::string urlStr = frame->GetURL(); + if (urlStr.find("spotify:") == 0) + return; + } + + // Display a load error message. + std::stringstream ss; + ss << "

Failed to load URL " << std::string(failedUrl) << + " with error " << std::string(errorText) << " (" << errorCode << + ").

"; + frame->LoadString(ss.str(), failedUrl); +} + +void ClientHandler::OnRenderProcessTerminated(CefRefPtr browser, + TerminationStatus status) { + // Load the startup URL if that's not the website that we terminated on. + CefRefPtr frame = browser->GetMainFrame(); + std::string url = frame->GetURL(); + std::transform(url.begin(), url.end(), url.begin(), tolower); + + std::string startupURL = GetStartupURL(); + if (url.find(startupURL) != 0) + frame->LoadURL(startupURL); +} + +CefRefPtr ClientHandler::GetResourceHandler( + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request) { + std::string url = request->GetURL(); + if (url == "http://tests/request") { + // Show the request contents + std::string dump; + DumpRequestContents(request, dump); + CefRefPtr stream = + CefStreamReader::CreateForData( + static_cast(const_cast(dump.c_str())), + dump.size()); + ASSERT(stream.get()); + return new CefStreamResourceHandler("text/plain", stream); + } else if (url == "http://tests/dialogs") { + // Show the dialogs contents + CefRefPtr stream = + GetBinaryResourceReader("dialogs.html"); + ASSERT(stream.get()); + return new CefStreamResourceHandler("text/html", stream); + } else if (url == dom_test::kTestUrl) { + // Show the domaccess contents + CefRefPtr stream = + GetBinaryResourceReader("domaccess.html"); + ASSERT(stream.get()); + return new CefStreamResourceHandler("text/html", stream); + } else if (url == "http://tests/localstorage") { + // Show the localstorage contents + CefRefPtr stream = + GetBinaryResourceReader("localstorage.html"); + ASSERT(stream.get()); + return new CefStreamResourceHandler("text/html", stream); + } else if (url == "http://tests/xmlhttprequest") { + // Show the xmlhttprequest contents + CefRefPtr stream = + GetBinaryResourceReader("xmlhttprequest.html"); + ASSERT(stream.get()); + return new CefStreamResourceHandler("text/html", stream); + } + + CefRefPtr handler; + + // Execute delegate callbacks. + RequestDelegateSet::iterator it = request_delegates_.begin(); + for (; it != request_delegates_.end() && !handler.get(); ++it) + handler = (*it)->GetResourceHandler(this, browser, frame, request); + + return handler; +} + +void ClientHandler::OnProtocolExecution(CefRefPtr browser, + const CefString& url, + bool& allow_os_execution) { + std::string urlStr = url; + + // Allow OS execution of Spotify URIs. + if (urlStr.find("spotify:") == 0) + allow_os_execution = true; +} + +void ClientHandler::SetMainHwnd(CefWindowHandle hwnd) { + AutoLock lock_scope(this); + m_MainHwnd = hwnd; +} + +void ClientHandler::SetEditHwnd(CefWindowHandle hwnd) { + AutoLock lock_scope(this); + m_EditHwnd = hwnd; +} + +void ClientHandler::SetButtonHwnds(CefWindowHandle backHwnd, + CefWindowHandle forwardHwnd, + CefWindowHandle reloadHwnd, + CefWindowHandle stopHwnd) { + AutoLock lock_scope(this); + m_BackHwnd = backHwnd; + m_ForwardHwnd = forwardHwnd; + m_ReloadHwnd = reloadHwnd; + m_StopHwnd = stopHwnd; +} + +std::string ClientHandler::GetLogFile() { + AutoLock lock_scope(this); + return m_LogFile; +} + +void ClientHandler::SetLastDownloadFile(const std::string& fileName) { + AutoLock lock_scope(this); + m_LastDownloadFile = fileName; +} + +std::string ClientHandler::GetLastDownloadFile() { + AutoLock lock_scope(this); + return m_LastDownloadFile; +} + +void ClientHandler::ShowDevTools(CefRefPtr browser) { + std::string devtools_url = browser->GetHost()->GetDevToolsURL(true); + if (!devtools_url.empty()) { + if (m_bExternalDevTools) { + // Open DevTools in an external browser window. + LaunchExternalBrowser(devtools_url); + } else if (m_OpenDevToolsURLs.find(devtools_url) == + m_OpenDevToolsURLs.end()) { + // Open DevTools in a popup window. + m_OpenDevToolsURLs.insert(devtools_url); + browser->GetMainFrame()->ExecuteJavaScript( + "window.open('" + devtools_url + "');", "about:blank", 0); + } + } +} + +// static +void ClientHandler::LaunchExternalBrowser(const std::string& url) { + if (CefCurrentlyOn(TID_PROCESS_LAUNCHER)) { + // Retrieve the current executable path. + CefString file_exe; + if (!CefGetPath(PK_FILE_EXE, file_exe)) + return; + + // Create the command line. + CefRefPtr command_line = + CefCommandLine::CreateCommandLine(); + command_line->SetProgram(file_exe); + command_line->AppendSwitchWithValue(cefclient::kUrl, url); + + // Launch the process. + CefLaunchProcess(command_line); + } else { + // Execute on the PROCESS_LAUNCHER thread. + CefPostTask(TID_PROCESS_LAUNCHER, + NewCefRunnableFunction(&ClientHandler::LaunchExternalBrowser, url)); + } +} + +// static +void ClientHandler::CreateProcessMessageDelegates( + ProcessMessageDelegateSet& delegates) { + // Create the binding test delegates. + binding_test::CreateProcessMessageDelegates(delegates); +} + +// static +void ClientHandler::CreateRequestDelegates(RequestDelegateSet& delegates) { + // Create the binding test delegates. + binding_test::CreateRequestDelegates(delegates); +} + +void ClientHandler::BuildTestMenu(CefRefPtr model) { + if (model->GetCount() > 0) + model->AddSeparator(); + + // Build the sub menu. + CefRefPtr submenu = + model->AddSubMenu(CLIENT_ID_TESTMENU_SUBMENU, "Context Menu Test"); + submenu->AddCheckItem(CLIENT_ID_TESTMENU_CHECKITEM, "Check Item"); + submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM1, "Radio Item 1", 0); + submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM2, "Radio Item 2", 0); + submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM3, "Radio Item 3", 0); + + // Check the check item. + if (m_TestMenuState.check_item) + submenu->SetChecked(CLIENT_ID_TESTMENU_CHECKITEM, true); + + // Check the selected radio item. + submenu->SetChecked( + CLIENT_ID_TESTMENU_RADIOITEM1 + m_TestMenuState.radio_item, true); +} + +bool ClientHandler::ExecuteTestMenu(int command_id) { + if (command_id == CLIENT_ID_TESTMENU_CHECKITEM) { + // Toggle the check item. + m_TestMenuState.check_item ^= 1; + return true; + } else if (command_id >= CLIENT_ID_TESTMENU_RADIOITEM1 && + command_id <= CLIENT_ID_TESTMENU_RADIOITEM3) { + // Store the selected radio item. + m_TestMenuState.radio_item = (command_id - CLIENT_ID_TESTMENU_RADIOITEM1); + return true; + } + + // Allow default handling to proceed. + return false; +} diff --git a/atom/cefclient/client_handler.h b/atom/cefclient/client_handler.h new file mode 100644 index 000000000..52c04e618 --- /dev/null +++ b/atom/cefclient/client_handler.h @@ -0,0 +1,283 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_ +#define CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_ +#pragma once + +#include +#include +#include +#include "include/cef_client.h" +#include "cefclient/util.h" + + +// Define this value to redirect all popup URLs to the main application browser +// window. +// #define TEST_REDIRECT_POPUP_URLS + + +// ClientHandler implementation. +class ClientHandler : public CefClient, + public CefContextMenuHandler, + public CefDisplayHandler, + public CefDownloadHandler, + public CefGeolocationHandler, + public CefKeyboardHandler, + public CefLifeSpanHandler, + public CefLoadHandler, + public CefRequestHandler { + public: + // Interface for process message delegates. Do not perform work in the + // RenderDelegate constructor. + class ProcessMessageDelegate : public virtual CefBase { + public: + // Called when a process message is received. Return true if the message was + // handled and should not be passed on to other handlers. + // ProcessMessageDelegates should check for unique message names to avoid + // interfering with each other. + virtual bool OnProcessMessageReceived( + CefRefPtr handler, + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) { + return false; + } + }; + + typedef std::set > + ProcessMessageDelegateSet; + + // Interface for request handler delegates. Do not perform work in the + // RequestDelegate constructor. + class RequestDelegate : public virtual CefBase { + public: + // Called to retrieve a resource handler. + virtual CefRefPtr GetResourceHandler( + CefRefPtr handler, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request) { + return NULL; + } + }; + + typedef std::set > RequestDelegateSet; + + ClientHandler(); + virtual ~ClientHandler(); + + // CefClient methods + virtual CefRefPtr GetContextMenuHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetDisplayHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetDownloadHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetGeolocationHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetKeyboardHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetLifeSpanHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetLoadHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetRequestHandler() OVERRIDE { + return this; + } + virtual bool OnProcessMessageReceived(CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) + OVERRIDE; + + // CefContextMenuHandler methods + virtual void OnBeforeContextMenu(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr params, + CefRefPtr model) OVERRIDE; + virtual bool OnContextMenuCommand(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr params, + int command_id, + EventFlags event_flags) OVERRIDE; + + // CefDisplayHandler methods + virtual void OnLoadingStateChange(CefRefPtr browser, + bool isLoading, + bool canGoBack, + bool canGoForward) OVERRIDE; + virtual void OnAddressChange(CefRefPtr browser, + CefRefPtr frame, + const CefString& url) OVERRIDE; + virtual void OnTitleChange(CefRefPtr browser, + const CefString& title) OVERRIDE; + virtual bool OnConsoleMessage(CefRefPtr browser, + const CefString& message, + const CefString& source, + int line) OVERRIDE; + + // CefDownloadHandler methods + virtual void OnBeforeDownload( + CefRefPtr browser, + CefRefPtr download_item, + const CefString& suggested_name, + CefRefPtr callback) OVERRIDE; + virtual void OnDownloadUpdated( + CefRefPtr browser, + CefRefPtr download_item, + CefRefPtr callback) OVERRIDE; + + // CefGeolocationHandler methods + virtual void OnRequestGeolocationPermission( + CefRefPtr browser, + const CefString& requesting_url, + int request_id, + CefRefPtr callback) OVERRIDE; + + // CefKeyboardHandler methods + virtual bool OnPreKeyEvent(CefRefPtr browser, + const CefKeyEvent& event, + CefEventHandle os_event, + bool* is_keyboard_shortcut) OVERRIDE; + + // CefLifeSpanHandler methods + virtual void OnAfterCreated(CefRefPtr browser) OVERRIDE; + virtual bool DoClose(CefRefPtr browser) OVERRIDE; + virtual void OnBeforeClose(CefRefPtr browser) OVERRIDE; + + // CefLoadHandler methods + virtual void OnLoadStart(CefRefPtr browser, + CefRefPtr frame) OVERRIDE; + virtual void OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) OVERRIDE; + virtual void OnLoadError(CefRefPtr browser, + CefRefPtr frame, + ErrorCode errorCode, + const CefString& errorText, + const CefString& failedUrl) OVERRIDE; + virtual void OnRenderProcessTerminated(CefRefPtr browser, + TerminationStatus status) OVERRIDE; + + // CefRequestHandler methods + virtual CefRefPtr GetResourceHandler( + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request) OVERRIDE; + virtual void OnProtocolExecution(CefRefPtr browser, + const CefString& url, + bool& allow_os_execution) OVERRIDE; + + void SetMainHwnd(CefWindowHandle hwnd); + CefWindowHandle GetMainHwnd() { return m_MainHwnd; } + void SetEditHwnd(CefWindowHandle hwnd); + void SetButtonHwnds(CefWindowHandle backHwnd, + CefWindowHandle forwardHwnd, + CefWindowHandle reloadHwnd, + CefWindowHandle stopHwnd); + + CefRefPtr GetBrowser() { return m_Browser; } + int GetBrowserId() { return m_BrowserId; } + + std::string GetLogFile(); + + void SetLastDownloadFile(const std::string& fileName); + std::string GetLastDownloadFile(); + + // Send a notification to the application. Notifications should not block the + // caller. + enum NotificationType { + NOTIFY_CONSOLE_MESSAGE, + NOTIFY_DOWNLOAD_COMPLETE, + NOTIFY_DOWNLOAD_ERROR, + }; + void SendNotification(NotificationType type); + void CloseMainWindow(); + + void ShowDevTools(CefRefPtr browser); + + // Returns the startup URL. + std::string GetStartupURL() { return m_StartupURL; } + + // Create an external browser window that loads the specified URL. + static void LaunchExternalBrowser(const std::string& url); + + protected: + void SetLoading(bool isLoading); + void SetNavState(bool canGoBack, bool canGoForward); + + // Create all of ProcessMessageDelegate objects. + static void CreateProcessMessageDelegates( + ProcessMessageDelegateSet& delegates); + + // Create all of RequestDelegateSet objects. + static void CreateRequestDelegates(RequestDelegateSet& delegates); + + // Test context menu creation. + void BuildTestMenu(CefRefPtr model); + bool ExecuteTestMenu(int command_id); + struct TestMenuState { + TestMenuState() : check_item(true), radio_item(0) {} + bool check_item; + int radio_item; + } m_TestMenuState; + + // Returns the full download path for the specified file, or an empty path to + // use the default temp directory. + std::string GetDownloadPath(const std::string& file_name); + + // The child browser window + CefRefPtr m_Browser; + + // The main frame window handle + CefWindowHandle m_MainHwnd; + + // The child browser id + int m_BrowserId; + + // The edit window handle + CefWindowHandle m_EditHwnd; + + // The button window handles + CefWindowHandle m_BackHwnd; + CefWindowHandle m_ForwardHwnd; + CefWindowHandle m_StopHwnd; + CefWindowHandle m_ReloadHwnd; + + // Support for logging. + std::string m_LogFile; + + // Support for downloading files. + std::string m_LastDownloadFile; + + // True if an editable field currently has focus. + bool m_bFocusOnEditableField; + + // Registered delegates. + ProcessMessageDelegateSet process_message_delegates_; + RequestDelegateSet request_delegates_; + + // If true DevTools will be opened in an external browser window. + bool m_bExternalDevTools; + + // List of open DevTools URLs if not using an external browser window. + std::set m_OpenDevToolsURLs; + + // The startup URL. + std::string m_StartupURL; + + // Include the default reference counting implementation. + IMPLEMENT_REFCOUNTING(ClientHandler); + // Include the default locking implementation. + IMPLEMENT_LOCKING(ClientHandler); +}; + +#endif // CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_ diff --git a/atom/cefclient/client_handler_gtk.cpp b/atom/cefclient/client_handler_gtk.cpp new file mode 100644 index 000000000..a35b04e61 --- /dev/null +++ b/atom/cefclient/client_handler_gtk.cpp @@ -0,0 +1,63 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include +#include +#include "cefclient/client_handler.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" + +void ClientHandler::OnAddressChange(CefRefPtr browser, + CefRefPtr frame, + const CefString& url) { + REQUIRE_UI_THREAD(); + + if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { + // Set the edit window text + std::string urlStr(url); + gtk_entry_set_text(GTK_ENTRY(m_EditHwnd), urlStr.c_str()); + } +} + +void ClientHandler::OnTitleChange(CefRefPtr browser, + const CefString& title) { + REQUIRE_UI_THREAD(); + + GtkWidget* window = gtk_widget_get_ancestor( + GTK_WIDGET(browser->GetHost()->GetWindowHandle()), + GTK_TYPE_WINDOW); + std::string titleStr(title); + gtk_window_set_title(GTK_WINDOW(window), titleStr.c_str()); +} + +void ClientHandler::SendNotification(NotificationType type) { + // TODO(port): Implement this method. +} + +void ClientHandler::SetLoading(bool isLoading) { + if (isLoading) + gtk_widget_set_sensitive(GTK_WIDGET(m_StopHwnd), true); + else + gtk_widget_set_sensitive(GTK_WIDGET(m_StopHwnd), false); +} + +void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) { + if (canGoBack) + gtk_widget_set_sensitive(GTK_WIDGET(m_BackHwnd), true); + else + gtk_widget_set_sensitive(GTK_WIDGET(m_BackHwnd), false); + + if (canGoForward) + gtk_widget_set_sensitive(GTK_WIDGET(m_ForwardHwnd), true); + else + gtk_widget_set_sensitive(GTK_WIDGET(m_ForwardHwnd), false); +} + +void ClientHandler::CloseMainWindow() { + // TODO(port): Close main window. +} + +std::string ClientHandler::GetDownloadPath(const std::string& file_name) { + return std::string(); +} diff --git a/atom/cefclient/client_handler_mac.mm b/atom/cefclient/client_handler_mac.mm new file mode 100644 index 000000000..fba1ddd2c --- /dev/null +++ b/atom/cefclient/client_handler_mac.mm @@ -0,0 +1,74 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#import + +#include "cefclient/client_handler.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "cefclient/cefclient.h" + +void ClientHandler::OnAddressChange(CefRefPtr browser, + CefRefPtr frame, + const CefString& url) { + REQUIRE_UI_THREAD(); + + if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { + // Set the edit window text + NSTextField* textField = (NSTextField*)m_EditHwnd; + std::string urlStr(url); + NSString* str = [NSString stringWithUTF8String:urlStr.c_str()]; + [textField setStringValue:str]; + } +} + +void ClientHandler::OnTitleChange(CefRefPtr browser, + const CefString& title) { + REQUIRE_UI_THREAD(); + + // Set the frame window title bar + NSView* view = (NSView*)browser->GetHost()->GetWindowHandle(); + NSWindow* window = [view window]; + std::string titleStr(title); + NSString* str = [NSString stringWithUTF8String:titleStr.c_str()]; + [window setTitle:str]; +} + +void ClientHandler::SendNotification(NotificationType type) { + SEL sel = nil; + switch(type) { + case NOTIFY_CONSOLE_MESSAGE: + sel = @selector(notifyConsoleMessage:); + break; + case NOTIFY_DOWNLOAD_COMPLETE: + sel = @selector(notifyDownloadComplete:); + break; + case NOTIFY_DOWNLOAD_ERROR: + sel = @selector(notifyDownloadError:); + break; + } + + if (sel == nil) + return; + + NSWindow* window = [AppGetMainHwnd() window]; + NSObject* delegate = [window delegate]; + [delegate performSelectorOnMainThread:sel withObject:nil waitUntilDone:NO]; +} + +void ClientHandler::SetLoading(bool isLoading) { + // TODO(port): Change button status. +} + +void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) { + // TODO(port): Change button status. +} + +void ClientHandler::CloseMainWindow() { + // TODO(port): Close window +} + +std::string ClientHandler::GetDownloadPath(const std::string& file_name) { + return std::string(); +} diff --git a/atom/cefclient/client_handler_win.cpp b/atom/cefclient/client_handler_win.cpp new file mode 100644 index 000000000..fe9944255 --- /dev/null +++ b/atom/cefclient/client_handler_win.cpp @@ -0,0 +1,86 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/client_handler.h" + +#include +#include +#include + +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "cefclient/resource.h" + +void ClientHandler::OnAddressChange(CefRefPtr browser, + CefRefPtr frame, + const CefString& url) { + REQUIRE_UI_THREAD(); + + if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { + // Set the edit window text + SetWindowText(m_EditHwnd, std::wstring(url).c_str()); + } +} + +void ClientHandler::OnTitleChange(CefRefPtr browser, + const CefString& title) { + REQUIRE_UI_THREAD(); + + // Set the frame window title bar + CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle(); + if (m_BrowserId == browser->GetIdentifier()) { + // The frame window will be the parent of the browser window + hwnd = GetParent(hwnd); + } + SetWindowText(hwnd, std::wstring(title).c_str()); +} + +void ClientHandler::SendNotification(NotificationType type) { + UINT id; + switch (type) { + case NOTIFY_CONSOLE_MESSAGE: + id = ID_WARN_CONSOLEMESSAGE; + break; + case NOTIFY_DOWNLOAD_COMPLETE: + id = ID_WARN_DOWNLOADCOMPLETE; + break; + case NOTIFY_DOWNLOAD_ERROR: + id = ID_WARN_DOWNLOADERROR; + break; + default: + return; + } + PostMessage(m_MainHwnd, WM_COMMAND, id, 0); +} + +void ClientHandler::SetLoading(bool isLoading) { + ASSERT(m_EditHwnd != NULL && m_ReloadHwnd != NULL && m_StopHwnd != NULL); + EnableWindow(m_EditHwnd, TRUE); + EnableWindow(m_ReloadHwnd, !isLoading); + EnableWindow(m_StopHwnd, isLoading); +} + +void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) { + ASSERT(m_BackHwnd != NULL && m_ForwardHwnd != NULL); + EnableWindow(m_BackHwnd, canGoBack); + EnableWindow(m_ForwardHwnd, canGoForward); +} + +void ClientHandler::CloseMainWindow() { + ::PostMessage(m_MainHwnd, WM_CLOSE, 0, 0); +} + +std::string ClientHandler::GetDownloadPath(const std::string& file_name) { + TCHAR szFolderPath[MAX_PATH]; + std::string path; + + // Save the file in the user's "My Documents" folder. + if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, + NULL, 0, szFolderPath))) { + path = CefString(szFolderPath); + path += "\\" + file_name; + } + + return path; +} diff --git a/atom/cefclient/client_renderer.cpp b/atom/cefclient/client_renderer.cpp new file mode 100644 index 000000000..17b5a43f3 --- /dev/null +++ b/atom/cefclient/client_renderer.cpp @@ -0,0 +1,52 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/client_renderer.h" + +#include +#include + +#include "include/cef_dom.h" +#include "cefclient/util.h" + +namespace client_renderer { + +const char kFocusedNodeChangedMessage[] = "ClientRenderer.FocusedNodeChanged"; + +namespace { + +class ClientRenderDelegate : public ClientApp::RenderDelegate { + public: + ClientRenderDelegate() + : last_node_is_editable_(false) { + } + + virtual void OnFocusedNodeChanged(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr node) OVERRIDE { + bool is_editable = (node.get() && node->IsEditable()); + if (is_editable != last_node_is_editable_) { + // Notify the browser of the change in focused element type. + last_node_is_editable_ = is_editable; + CefRefPtr message = + CefProcessMessage::Create(kFocusedNodeChangedMessage); + message->GetArgumentList()->SetBool(0, is_editable); + browser->SendProcessMessage(PID_BROWSER, message); + } + } + + private: + bool last_node_is_editable_; + + IMPLEMENT_REFCOUNTING(ClientRenderDelegate); +}; + +} // namespace + +void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates) { + delegates.insert(new ClientRenderDelegate); +} + +} // namespace client_renderer diff --git a/atom/cefclient/client_renderer.h b/atom/cefclient/client_renderer.h new file mode 100644 index 000000000..37b08408d --- /dev/null +++ b/atom/cefclient/client_renderer.h @@ -0,0 +1,22 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_CLIENT_RENDERER_H_ +#define CEF_TESTS_CEFCLIENT_CLIENT_RENDERER_H_ +#pragma once + +#include "include/cef_base.h" +#include "cefclient/client_app.h" + +namespace client_renderer { + +// Message sent when the focused node changes. +extern const char kFocusedNodeChangedMessage[]; + +// Create the render delegate. +void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates); + +} // namespace client_renderer + +#endif // CEF_TESTS_CEFCLIENT_CLIENT_RENDERER_H_ diff --git a/atom/cefclient/client_switches.cpp b/atom/cefclient/client_switches.cpp new file mode 100644 index 000000000..a65f179f2 --- /dev/null +++ b/atom/cefclient/client_switches.cpp @@ -0,0 +1,71 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +// This file is shared by cefclient and cef_unittests so don't include using +// a qualified path. +#include "client_switches.h" // NOLINT(build/include) + +namespace cefclient { + +const char kUrl[] = "url"; +const char kExternalDevTools[] = "external-devtools"; + +// CefSettings attributes. +const char kMultiThreadedMessageLoop[] = "multi-threaded-message-loop"; +const char kCachePath[] = "cache-path"; + +// CefBrowserSettings attributes. +const char kRemoteFontsDisabled[] = "remote-fonts-disabled"; +const char kDefaultEncoding[] = "default-encoding"; +const char kEncodingDetectorEnabled[] = "encoding-detector-enabled"; +const char kJavascriptDisabled[] = "javascript-disabled"; +const char kJavascriptOpenWindowsDisallowed[] = + "javascript-open-windows-disallowed"; +const char kJavascriptCloseWindowsDisallowed[] = + "javascript-close-windows-disallowed"; +const char kJavascriptAccessClipboardDisallowed[] = + "javascript-access-clipboard-disallowed"; +const char kDomPasteDisabled[] = "dom-paste-disabled"; +const char kCaretBrowsingDisabled[] = "caret-browsing-enabled"; +const char kJavaDisabled[] = "java-disabled"; +const char kPluginsDisabled[] = "plugins-disabled"; +const char kUniversalAccessFromFileUrlsAllowed[] = + "universal-access-from-file-urls-allowed"; +const char kFileAccessFromFileUrlsAllowed[] = + "file-access-from-file-urls-allowed"; +const char kWebSecurityDisabled[] = "web-security-disabled"; +const char kXssAuditorEnabled[] = "xss-auditor-enabled"; +const char kImageLoadingDisabled[] = "image-load-disabled"; +const char kShrinkStandaloneImagesToFit[] = "shrink-standalone-images-to-fit"; +const char kSiteSpecificQuirksDisabled[] = "site-specific-quirks-disabled"; +const char kTextAreaResizeDisabled[] = "text-area-resize-disabled"; +const char kPageCacheDisabled[] = "page-cache-disabled"; +const char kTabToLinksDisabled[] = "tab-to-links-disabled"; +const char kHyperlinkAuditingDisabled[] = "hyperlink-auditing-disabled"; +const char kUserStyleSheetEnabled[] = "user-style-sheet-enabled"; +const char kUserStyleSheetLocation[] = "user-style-sheet-location"; +const char kAuthorAndUserStylesDisabled[] = "author-and-user-styles-disabled"; +const char kLocalStorageDisabled[] = "local-storage-disabled"; +const char kDatabasesDisabled[] = "databases-disabled"; +const char kApplicationCacheDisabled[] = "application-cache-disabled"; +const char kWebglDisabled[] = "webgl-disabled"; +const char kAcceleratedCompositingDisabled[] = + "accelerated-compositing-disabled"; +const char kAcceleratedLayersDisabled[] = "accelerated-layers-disabled"; +const char kAcceleratedVideoDisabled[] = "accelerated-video-disabled"; +const char kAcceledated2dCanvasDisabled[] = "accelerated-2d-canvas-disabled"; +const char kAcceleratedPaintingEnabled[] = "accelerated-painting-enabled"; +const char kAcceleratedFiltersEnabled[] = "accelerated-filters-enabled"; +const char kAcceleratedPluginsDisabled[] = "accelerated-plugins-disabled"; +const char kDeveloperToolsDisabled[] = "developer-tools-disabled"; +const char kFullscreenEnabled[] = "fullscreen-enabled"; + +// Other attributes. +const char kProxyType[] = "proxy-type"; +const char kProxyType_Direct[] = "direct"; +const char kProxyType_Named[] = "named"; +const char kProxyType_Pac[] = "pac"; +const char kProxyConfig[] = "proxy-config"; + +} // namespace cefclient diff --git a/atom/cefclient/client_switches.h b/atom/cefclient/client_switches.h new file mode 100644 index 000000000..8a9751721 --- /dev/null +++ b/atom/cefclient/client_switches.h @@ -0,0 +1,69 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +// Defines all of the command line switches used by cefclient. + +#ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_ +#define CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_ +#pragma once + +namespace cefclient { + +extern const char kUrl[]; +extern const char kExternalDevTools[]; + +// CefSettings attributes. +extern const char kMultiThreadedMessageLoop[]; +extern const char kCachePath[]; + +// CefBrowserSettings attributes. +extern const char kRemoteFontsDisabled[]; +extern const char kDefaultEncoding[]; +extern const char kEncodingDetectorEnabled[]; +extern const char kJavascriptDisabled[]; +extern const char kJavascriptOpenWindowsDisallowed[]; +extern const char kJavascriptCloseWindowsDisallowed[]; +extern const char kJavascriptAccessClipboardDisallowed[]; +extern const char kDomPasteDisabled[]; +extern const char kCaretBrowsingDisabled[]; +extern const char kJavaDisabled[]; +extern const char kPluginsDisabled[]; +extern const char kUniversalAccessFromFileUrlsAllowed[]; +extern const char kFileAccessFromFileUrlsAllowed[]; +extern const char kWebSecurityDisabled[]; +extern const char kXssAuditorEnabled[]; +extern const char kImageLoadingDisabled[]; +extern const char kShrinkStandaloneImagesToFit[]; +extern const char kSiteSpecificQuirksDisabled[]; +extern const char kTextAreaResizeDisabled[]; +extern const char kPageCacheDisabled[]; +extern const char kTabToLinksDisabled[]; +extern const char kHyperlinkAuditingDisabled[]; +extern const char kUserStyleSheetEnabled[]; +extern const char kUserStyleSheetLocation[]; +extern const char kAuthorAndUserStylesDisabled[]; +extern const char kLocalStorageDisabled[]; +extern const char kDatabasesDisabled[]; +extern const char kApplicationCacheDisabled[]; +extern const char kWebglDisabled[]; +extern const char kAcceleratedCompositingDisabled[]; +extern const char kAcceleratedLayersDisabled[]; +extern const char kAcceleratedVideoDisabled[]; +extern const char kAcceledated2dCanvasDisabled[]; +extern const char kAcceleratedPaintingEnabled[]; +extern const char kAcceleratedFiltersEnabled[]; +extern const char kAcceleratedPluginsDisabled[]; +extern const char kDeveloperToolsDisabled[]; +extern const char kFullscreenEnabled[]; + +// Other attributes. +extern const char kProxyType[]; +extern const char kProxyType_Direct[]; +extern const char kProxyType_Named[]; +extern const char kProxyType_Pac[]; +extern const char kProxyConfig[]; + +} // namespace cefclient + +#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_ diff --git a/atom/cefclient/dom_test.cpp b/atom/cefclient/dom_test.cpp new file mode 100644 index 000000000..5002d6394 --- /dev/null +++ b/atom/cefclient/dom_test.cpp @@ -0,0 +1,139 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/dom_test.h" + +#include +#include + +#include "include/cef_dom.h" +#include "cefclient/util.h" + +namespace dom_test { + +const char kTestUrl[] = "http://tests/domaccess"; + +namespace { + +const char* kMessageName = "DOMTest.Message"; + +class ClientDOMEventListener : public CefDOMEventListener { + public: + ClientDOMEventListener() { + } + + virtual void HandleEvent(CefRefPtr event) OVERRIDE { + CefRefPtr document = event->GetDocument(); + ASSERT(document.get()); + + std::stringstream ss; + + CefRefPtr button = event->GetTarget(); + ASSERT(button.get()); + std::string buttonValue = button->GetElementAttribute("value"); + ss << "You clicked the " << buttonValue.c_str() << " button. "; + + if (document->HasSelection()) { + std::string startName, endName; + + // Determine the start name by first trying to locate the "id" attribute + // and then defaulting to the tag name. + { + CefRefPtr node = document->GetSelectionStartNode(); + if (!node->IsElement()) + node = node->GetParent(); + if (node->IsElement() && node->HasElementAttribute("id")) + startName = node->GetElementAttribute("id"); + else + startName = node->GetName(); + } + + // Determine the end name by first trying to locate the "id" attribute + // and then defaulting to the tag name. + { + CefRefPtr node = document->GetSelectionEndNode(); + if (!node->IsElement()) + node = node->GetParent(); + if (node->IsElement() && node->HasElementAttribute("id")) + endName = node->GetElementAttribute("id"); + else + endName = node->GetName(); + } + + ss << "The selection is from " << + startName.c_str() << ":" << document->GetSelectionStartOffset() << + " to " << + endName.c_str() << ":" << document->GetSelectionEndOffset(); + } else { + ss << "Nothing is selected."; + } + + // Update the description. + CefRefPtr desc = document->GetElementById("description"); + ASSERT(desc.get()); + CefRefPtr text = desc->GetFirstChild(); + ASSERT(text.get()); + ASSERT(text->IsText()); + text->SetValue(ss.str()); + } + + IMPLEMENT_REFCOUNTING(ClientDOMEventListener); +}; + +class ClientDOMVisitor : public CefDOMVisitor { + public: + ClientDOMVisitor() { + } + + virtual void Visit(CefRefPtr document) OVERRIDE { + // Register a click listener for the button. + CefRefPtr button = document->GetElementById("button"); + ASSERT(button.get()); + button->AddEventListener("click", new ClientDOMEventListener(), false); + } + + IMPLEMENT_REFCOUNTING(ClientDOMVisitor); +}; + +class DOMRenderDelegate : public ClientApp::RenderDelegate { + public: + DOMRenderDelegate() { + } + + virtual bool OnProcessMessageReceived( + CefRefPtr app, + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) OVERRIDE { + if (message->GetName() == kMessageName) { + // Visit the DOM to attach the event listener. + browser->GetMainFrame()->VisitDOM(new ClientDOMVisitor); + return true; + } + + return false; + } + + private: + IMPLEMENT_REFCOUNTING(DOMRenderDelegate); +}; + +} // namespace + +void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates) { + delegates.insert(new DOMRenderDelegate); +} + +void RunTest(CefRefPtr browser) { + // Load the test URL. + browser->GetMainFrame()->LoadURL(kTestUrl); +} + +void OnLoadEnd(CefRefPtr browser) { + // Send a message to the render process to continue the test setup. + browser->SendProcessMessage(PID_RENDERER, + CefProcessMessage::Create(kMessageName)); +} + +} // namespace dom_test diff --git a/atom/cefclient/dom_test.h b/atom/cefclient/dom_test.h new file mode 100644 index 000000000..0bcee1749 --- /dev/null +++ b/atom/cefclient/dom_test.h @@ -0,0 +1,28 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_DOM_TEST_H_ +#define CEF_TESTS_CEFCLIENT_DOM_TEST_H_ +#pragma once + +#include "include/cef_base.h" +#include "cefclient/client_app.h" + +namespace dom_test { + +// The DOM test URL. +extern const char kTestUrl[]; + +// Create the render delegate. +void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates); + +// Run the test. +void RunTest(CefRefPtr browser); + +// Continue the test after the page has loaded. +void OnLoadEnd(CefRefPtr browser); + +} // namespace dom_test + +#endif // CEF_TESTS_CEFCLIENT_DOM_TEST_H_ diff --git a/atom/cefclient/mac/Atom.icns b/atom/cefclient/mac/Atom.icns new file mode 100644 index 000000000..f36742de2 Binary files /dev/null and b/atom/cefclient/mac/Atom.icns differ diff --git a/atom/cefclient/mac/English.lproj/InfoPlist.strings b/atom/cefclient/mac/English.lproj/InfoPlist.strings new file mode 100644 index 000000000..fe2abe11b --- /dev/null +++ b/atom/cefclient/mac/English.lproj/InfoPlist.strings @@ -0,0 +1,3 @@ +/* Localized versions of Info.plist keys */ + +NSHumanReadableCopyright = "© Chromium Embedded Framework Authors, 2010"; diff --git a/atom/cefclient/mac/English.lproj/MainMenu.xib b/atom/cefclient/mac/English.lproj/MainMenu.xib new file mode 100644 index 000000000..45af54898 --- /dev/null +++ b/atom/cefclient/mac/English.lproj/MainMenu.xib @@ -0,0 +1,1981 @@ + + + + 1050 + 11E2620 + 2182 + 1138.47 + 569.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 2182 + + + YES + NSUserDefaultsController + NSMenu + NSMenuItem + NSCustomObject + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + Atom + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + Atom + + YES + + + About Atom + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide Atom + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit Atom + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + Save As… + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + Show Spelling… + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 1048576 + 2147483647 + + + submenuAction: + + Format + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Show Colors + C + 1179648 + 2147483647 + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + Atom Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + YES + + + + + YES + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + orderFrontColorPanel: + + + + 361 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + terminate: + + + + 369 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + + YES + + 0 + + YES + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 299 + + + YES + + + + + + 300 + + + YES + + + + + + + 344 + + + + + 345 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 389 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 106.IBPluginDependency + 111.IBPluginDependency + 112.IBPluginDependency + 124.IBPluginDependency + 125.IBPluginDependency + 126.IBPluginDependency + 129.IBPluginDependency + 130.IBPluginDependency + 131.IBPluginDependency + 134.IBPluginDependency + 136.IBPluginDependency + 143.IBPluginDependency + 144.IBPluginDependency + 145.IBPluginDependency + 149.IBPluginDependency + 150.IBPluginDependency + 19.IBPluginDependency + 195.IBPluginDependency + 196.IBPluginDependency + 197.IBPluginDependency + 198.IBPluginDependency + 199.IBPluginDependency + 200.IBPluginDependency + 201.IBPluginDependency + 202.IBPluginDependency + 203.IBPluginDependency + 204.IBPluginDependency + 205.IBPluginDependency + 206.IBPluginDependency + 207.IBPluginDependency + 208.IBPluginDependency + 209.IBPluginDependency + 210.IBPluginDependency + 211.IBPluginDependency + 212.IBPluginDependency + 213.IBPluginDependency + 214.IBPluginDependency + 215.IBPluginDependency + 216.IBPluginDependency + 217.IBPluginDependency + 218.IBPluginDependency + 219.IBPluginDependency + 220.IBPluginDependency + 221.IBPluginDependency + 23.IBPluginDependency + 236.IBPluginDependency + 239.IBPluginDependency + 24.IBPluginDependency + 29.IBPluginDependency + 295.IBPluginDependency + 296.IBPluginDependency + 297.IBPluginDependency + 298.IBPluginDependency + 299.IBPluginDependency + 300.IBPluginDependency + 344.IBPluginDependency + 345.IBPluginDependency + 346.IBPluginDependency + 348.IBPluginDependency + 349.IBPluginDependency + 350.IBPluginDependency + 351.IBPluginDependency + 354.IBPluginDependency + 389.IBPluginDependency + 5.IBPluginDependency + 56.IBPluginDependency + 57.IBPluginDependency + 58.IBPluginDependency + 72.IBPluginDependency + 73.IBPluginDependency + 74.IBPluginDependency + 75.IBPluginDependency + 77.IBPluginDependency + 78.IBPluginDependency + 79.IBPluginDependency + 80.IBPluginDependency + 81.IBPluginDependency + 82.IBPluginDependency + 83.IBPluginDependency + 92.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + + + + + YES + + + + + 439 + + + + YES + + NSDocument + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + id + id + id + id + id + id + + + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + + printDocument: + id + + + revertDocumentToSaved: + id + + + runPageLayout: + id + + + saveDocument: + id + + + saveDocumentAs: + id + + + saveDocumentTo: + id + + + + + IBProjectSource + ./Classes/NSDocument.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + 3 + + YES + + YES + NSMenuCheckmark + NSMenuMixedState + + + YES + {11, 11} + {10, 3} + + + + diff --git a/atom/cefclient/mac/Info.plist b/atom/cefclient/mac/Info.plist new file mode 100644 index 000000000..777aa3de3 --- /dev/null +++ b/atom/cefclient/mac/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + Atom.icns + CFBundleIdentifier + com.github.Atom + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/atom/cefclient/mac/helper-Info.plist b/atom/cefclient/mac/helper-Info.plist new file mode 100644 index 000000000..7e9038ad7 --- /dev/null +++ b/atom/cefclient/mac/helper-Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${EXECUTABLE_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.github.Atom.helper + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + LSFileQuarantineEnabled + + LSMinimumSystemVersion + 10.5.0 + LSUIElement + 1 + NSSupportsAutomaticGraphicsSwitching + + + diff --git a/atom/cefclient/process_helper_mac.cpp b/atom/cefclient/process_helper_mac.cpp new file mode 100644 index 000000000..7354b036a --- /dev/null +++ b/atom/cefclient/process_helper_mac.cpp @@ -0,0 +1,27 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "include/cef_app.h" + +// This file is shared by cefclient and cef_unittests so don't include using +// a qualified path. +#include "client_app.h" // NOLINT(build/include) + +// Stub implementations. +std::string AppGetWorkingDirectory() { + return std::string(); +} +CefWindowHandle AppGetMainHwnd() { + return NULL; +} + +// Process entry point. +int main(int argc, char* argv[]) { + CefMainArgs main_args(argc, argv); + + CefRefPtr app(new ClientApp); + + // Execute the secondary process. + return CefExecuteProcess(main_args, app); +} diff --git a/atom/cefclient/res/binding.html b/atom/cefclient/res/binding.html new file mode 100644 index 000000000..edb1f4a00 --- /dev/null +++ b/atom/cefclient/res/binding.html @@ -0,0 +1,27 @@ + + +Binding Test + + + + +
+Message: +
+
You should see the reverse of your message below: +
+
+ + diff --git a/atom/cefclient/res/cefclient.ico b/atom/cefclient/res/cefclient.ico new file mode 100644 index 000000000..d551aa3aa Binary files /dev/null and b/atom/cefclient/res/cefclient.ico differ diff --git a/atom/cefclient/res/dialogs.html b/atom/cefclient/res/dialogs.html new file mode 100644 index 000000000..1bce8e475 --- /dev/null +++ b/atom/cefclient/res/dialogs.html @@ -0,0 +1,45 @@ + + +Dialog Test + + + +
+Click a button to show the associated dialog type. +
+
+
+

+
+ + diff --git a/atom/cefclient/res/domaccess.html b/atom/cefclient/res/domaccess.html new file mode 100644 index 000000000..68ff69647 --- /dev/null +++ b/atom/cefclient/res/domaccess.html @@ -0,0 +1,13 @@ + + +

Select some portion of the below page content and click the "Describe Selection" button. The selected region will then be described below.

+

This is p1

+

This is p2

+

This is p3

+

This is p4

+
+ +

The description will appear here.

+
+ + diff --git a/atom/cefclient/res/localstorage.html b/atom/cefclient/res/localstorage.html new file mode 100644 index 000000000..a794305b7 --- /dev/null +++ b/atom/cefclient/res/localstorage.html @@ -0,0 +1,24 @@ + + + +Click the "Add Line" button to add a line or the "Clear" button to clear.
+This data will persist across sessions if a cache path was specified.
+ + +
+ + + diff --git a/atom/cefclient/res/logo.png b/atom/cefclient/res/logo.png new file mode 100644 index 000000000..41dd728df Binary files /dev/null and b/atom/cefclient/res/logo.png differ diff --git a/atom/cefclient/res/logoball.png b/atom/cefclient/res/logoball.png new file mode 100644 index 000000000..ef115ca07 Binary files /dev/null and b/atom/cefclient/res/logoball.png differ diff --git a/atom/cefclient/res/small.ico b/atom/cefclient/res/small.ico new file mode 100644 index 000000000..d551aa3aa Binary files /dev/null and b/atom/cefclient/res/small.ico differ diff --git a/atom/cefclient/res/xmlhttprequest.html b/atom/cefclient/res/xmlhttprequest.html new file mode 100644 index 000000000..638c63c82 --- /dev/null +++ b/atom/cefclient/res/xmlhttprequest.html @@ -0,0 +1,19 @@ + + + +
+URL: +
+
+
+ + diff --git a/atom/cefclient/resource.h b/atom/cefclient/resource.h new file mode 100644 index 000000000..dd6988e3b --- /dev/null +++ b/atom/cefclient/resource.h @@ -0,0 +1,69 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by cefclient.rc +// +#define BINARY 256 +#define IDC_MYICON 2 +#define IDD_CEFCLIENT_DIALOG 102 +#define IDS_APP_TITLE 103 +#define IDD_ABOUTBOX 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDI_CEFCLIENT 107 +#define IDI_SMALL 108 +#define IDC_CEFCLIENT 109 +#define IDR_MAINFRAME 128 +#define IDC_NAV_BACK 200 +#define IDC_NAV_FORWARD 201 +#define IDC_NAV_RELOAD 202 +#define IDC_NAV_STOP 203 +#define ID_WARN_CONSOLEMESSAGE 32000 +#define ID_WARN_DOWNLOADCOMPLETE 32001 +#define ID_WARN_DOWNLOADERROR 32002 +#define ID_TESTS_GETSOURCE 32760 +#define ID_TESTS_GETTEXT 32761 +#define ID_TESTS_POPUP 32762 +#define ID_TESTS_REQUEST 32763 +#define ID_TESTS_SCHEME_HANDLER 32764 +#define ID_TESTS_LOCALSTORAGE 32765 +#define ID_TESTS_ACCELERATED2DCANVAS 32766 +#define ID_TESTS_ACCELERATEDLAYERS 32767 +#define ID_TESTS_WEBGL 32768 +#define ID_TESTS_HTML5VIDEO 32769 +#define ID_TESTS_XMLHTTPREQUEST 32770 +#define ID_TESTS_DRAGDROP 32771 +#define ID_TESTS_GEOLOCATION 32772 +#define ID_TESTS_BINDING 32773 +#define ID_TESTS_DIALOGS 32774 +#define ID_TESTS_PLUGIN_INFO 32775 +#define ID_TESTS_DOM_ACCESS 32776 +#define ID_TESTS_ZOOM_IN 32777 +#define ID_TESTS_ZOOM_OUT 32778 +#define ID_TESTS_ZOOM_RESET 32779 +#define IDC_STATIC -1 +#define IDS_BINDING 1000 +#define IDS_DIALOGS 1001 +#define IDS_LOGO 1002 +#define IDS_LOGOBALL 1003 +#define IDS_LOCALSTORAGE 1004 +#define IDS_XMLHTTPREQUEST 1005 +#define IDS_DOMACCESS 1006 + +// Avoid files associated with MacOS +#define _X86_ + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 130 +#define _APS_NEXT_COMMAND_VALUE 32774 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/atom/cefclient/resource_util.h b/atom/cefclient/resource_util.h new file mode 100644 index 000000000..c382196f4 --- /dev/null +++ b/atom/cefclient/resource_util.h @@ -0,0 +1,32 @@ +// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_ +#define CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_ +#pragma once + +#include "include/cef_base.h" + +class CefStreamReader; + +#if defined(OS_WIN) + +#include "cefclient/resource.h" + +// Load a resource of type BINARY +bool LoadBinaryResource(int binaryId, DWORD &dwSize, LPBYTE &pBytes); +CefRefPtr GetBinaryResourceReader(int binaryId); + +#elif defined(OS_MACOSX) || defined(OS_POSIX) + +#include // NOLINT(build/include_order) + +// Load the resource with the specified name. +bool LoadBinaryResource(const char* resource_name, std::string& resource_data); + +#endif + +CefRefPtr GetBinaryResourceReader(const char* resource_name); + +#endif // CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_ diff --git a/atom/cefclient/resource_util_linux.cpp b/atom/cefclient/resource_util_linux.cpp new file mode 100644 index 000000000..66b46267d --- /dev/null +++ b/atom/cefclient/resource_util_linux.cpp @@ -0,0 +1,67 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "cefclient/resource_util.h" +#include +#include +#include "include/cef_stream.h" +#include "cefclient/util.h" + +bool GetResourceDir(std::string& dir) { + char buff[1024]; + + // Retrieve the executable path. + ssize_t len = readlink("/proc/self/exe", buff, sizeof(buff)-1); + if (len == -1) + return false; + + buff[len] = 0; + + // Remove the executable name from the path. + char* pos = strrchr(buff, '/'); + if (!pos) + return false; + + // Add "files" to the path. + strcpy(pos+1, "files"); // NOLINT(runtime/printf) + dir = std::string(buff); + return true; +} + +bool LoadBinaryResource(const char* resource_name, std::string& resource_data) { + std::string path; + if (!GetResourceDir(path)) + return false; + + path.append("/"); + path.append(resource_name); + + FILE* f = fopen(path.c_str(), "rb"); + if (!f) + return false; + + size_t bytes_read; + char buff[1024*8]; + + do { + bytes_read = fread(buff, 1, sizeof(buff)-1, f); + if (bytes_read > 0) + resource_data.append(buff, bytes_read); + } while (bytes_read > 0); + + fclose(f); + return true; +} + +CefRefPtr GetBinaryResourceReader(const char* resource_name) { + std::string path; + if (!GetResourceDir(path)) + return NULL; + + path.append("/"); + path.append(resource_name); + + return CefStreamReader::CreateForFile(path); +} diff --git a/atom/cefclient/resource_util_mac.mm b/atom/cefclient/resource_util_mac.mm new file mode 100644 index 000000000..98cfd8605 --- /dev/null +++ b/atom/cefclient/resource_util_mac.mm @@ -0,0 +1,97 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#include +#include +#include "cefclient/resource_util.h" +#include "include/cef_stream.h" +#include "cefclient/util.h" + +namespace { + +bool AmIBundled() { + // Implementation adapted from Chromium's base/mac/foundation_util.mm + ProcessSerialNumber psn = {0, kCurrentProcess}; + + FSRef fsref; + OSStatus pbErr; + if ((pbErr = GetProcessBundleLocation(&psn, &fsref)) != noErr) { + ASSERT(false); + return false; + } + + FSCatalogInfo info; + OSErr fsErr; + if ((fsErr = FSGetCatalogInfo(&fsref, kFSCatInfoNodeFlags, &info, + NULL, NULL, NULL)) != noErr) { + ASSERT(false); + return false; + } + + return (info.nodeFlags & kFSNodeIsDirectoryMask); +} + +bool GetResourceDir(std::string& dir) { + // Implementation adapted from Chromium's base/base_path_mac.mm + if (AmIBundled()) { + // Retrieve the executable directory. + uint32_t pathSize = 0; + _NSGetExecutablePath(NULL, &pathSize); + if (pathSize > 0) { + dir.resize(pathSize); + _NSGetExecutablePath(const_cast(dir.c_str()), &pathSize); + } + + // Trim executable name up to the last separator + std::string::size_type last_separator = dir.find_last_of("/"); + dir.resize(last_separator); + dir.append("/../Resources"); + return true; + } else { + // TODO: Provide unbundled path + ASSERT(false); + return false; + } +} + +bool ReadFileToString(const char* path, std::string& data) { + // Implementation adapted from base/file_util.cc + FILE* file = fopen(path, "rb"); + if (!file) + return false; + + char buf[1 << 16]; + size_t len; + while ((len = fread(buf, 1, sizeof(buf), file)) > 0) + data.append(buf, len); + fclose(file); + + return true; +} + +} // namespace + +bool LoadBinaryResource(const char* resource_name, std::string& resource_data) { + std::string path; + if (!GetResourceDir(path)) + return false; + + path.append("/"); + path.append(resource_name); + + return ReadFileToString(path.c_str(), resource_data); +} + +CefRefPtr GetBinaryResourceReader(const char* resource_name) { + std::string path; + if (!GetResourceDir(path)) + return NULL; + + path.append("/"); + path.append(resource_name); + + return CefStreamReader::CreateForFile(path); +} diff --git a/atom/cefclient/resource_util_win.cpp b/atom/cefclient/resource_util_win.cpp new file mode 100644 index 000000000..8482ac954 --- /dev/null +++ b/atom/cefclient/resource_util_win.cpp @@ -0,0 +1,64 @@ +// Copyright (c) 2008-2009 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/resource_util.h" +#include "include/cef_stream.h" +#include "include/wrapper/cef_byte_read_handler.h" +#include "cefclient/util.h" + +#if defined(OS_WIN) + +bool LoadBinaryResource(int binaryId, DWORD &dwSize, LPBYTE &pBytes) { + extern HINSTANCE hInst; + HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(binaryId), + MAKEINTRESOURCE(256)); + if (hRes) { + HGLOBAL hGlob = LoadResource(hInst, hRes); + if (hGlob) { + dwSize = SizeofResource(hInst, hRes); + pBytes = (LPBYTE)LockResource(hGlob); + if (dwSize > 0 && pBytes) + return true; + } + } + + return false; +} + +CefRefPtr GetBinaryResourceReader(int binaryId) { + DWORD dwSize; + LPBYTE pBytes; + + if (LoadBinaryResource(binaryId, dwSize, pBytes)) { + return CefStreamReader::CreateForHandler( + new CefByteReadHandler(pBytes, dwSize, NULL)); + } + + ASSERT(FALSE); // The resource should be found. + return NULL; +} + +CefRefPtr GetBinaryResourceReader(const char* resource_name) { + // Map of resource labels to BINARY id values. + static struct _resource_map { + char* name; + int id; + } resource_map[] = { + {"binding.html", IDS_BINDING}, + {"dialogs.html", IDS_DIALOGS}, + {"domaccess.html", IDS_DOMACCESS}, + {"localstorage.html", IDS_LOCALSTORAGE}, + {"xmlhttprequest.html", IDS_XMLHTTPREQUEST}, + }; + + for (int i = 0; i < sizeof(resource_map)/sizeof(_resource_map); ++i) { + if (!strcmp(resource_map[i].name, resource_name)) + return GetBinaryResourceReader(resource_map[i].id); + } + + ASSERT(FALSE); // The resource should be found. + return NULL; +} + +#endif // OS_WIN diff --git a/atom/cefclient/scheme_test.cpp b/atom/cefclient/scheme_test.cpp new file mode 100644 index 000000000..ee33a4389 --- /dev/null +++ b/atom/cefclient/scheme_test.cpp @@ -0,0 +1,182 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/scheme_test.h" +#include +#include +#include "include/cef_browser.h" +#include "include/cef_callback.h" +#include "include/cef_frame.h" +#include "include/cef_resource_handler.h" +#include "include/cef_response.h" +#include "include/cef_request.h" +#include "include/cef_scheme.h" +#include "cefclient/resource_util.h" +#include "cefclient/string_util.h" +#include "cefclient/util.h" + +#if defined(OS_WIN) +#include "cefclient/resource.h" +#endif + +namespace scheme_test { + +namespace { + +// Implementation of the schema handler for client:// requests. +class ClientSchemeHandler : public CefResourceHandler { + public: + ClientSchemeHandler() : offset_(0) {} + + virtual bool ProcessRequest(CefRefPtr request, + CefRefPtr callback) + OVERRIDE { + REQUIRE_IO_THREAD(); + + bool handled = false; + + AutoLock lock_scope(this); + + std::string url = request->GetURL(); + if (strstr(url.c_str(), "handler.html") != NULL) { + // Build the response html + data_ = "Client Scheme Handler" + "This contents of this page page are served by the " + "ClientSchemeHandler class handling the client:// protocol." + "
You should see an image:" + "
";
+
+      // Output a string representation of the request
+      std::string dump;
+      DumpRequestContents(request, dump);
+      data_.append(dump);
+
+      data_.append("

Try the test form:" + "
" + "" + "" + "" + "
"); + + handled = true; + + // Set the resulting mime type + mime_type_ = "text/html"; + } else if (strstr(url.c_str(), "client.png") != NULL) { + // Load the response image +#if defined(OS_WIN) + DWORD dwSize; + LPBYTE pBytes; + if (LoadBinaryResource(IDS_LOGO, dwSize, pBytes)) { + data_ = std::string(reinterpret_cast(pBytes), dwSize); + handled = true; + // Set the resulting mime type + mime_type_ = "image/jpg"; + } +#elif defined(OS_MACOSX) || defined(OS_LINUX) + if (LoadBinaryResource("logo.png", data_)) { + handled = true; + // Set the resulting mime type + mime_type_ = "image/png"; + } +#else +#error "Unsupported platform" +#endif + } + + if (handled) { + // Indicate the headers are available. + callback->Continue(); + return true; + } + + return false; + } + + virtual void GetResponseHeaders(CefRefPtr response, + int64& response_length, + CefString& redirectUrl) OVERRIDE { + REQUIRE_IO_THREAD(); + + ASSERT(!data_.empty()); + + response->SetMimeType(mime_type_); + response->SetStatus(200); + + // Set the resulting response length + response_length = data_.length(); + } + + virtual void Cancel() OVERRIDE { + REQUIRE_IO_THREAD(); + } + + virtual bool ReadResponse(void* data_out, + int bytes_to_read, + int& bytes_read, + CefRefPtr callback) + OVERRIDE { + REQUIRE_IO_THREAD(); + + bool has_data = false; + bytes_read = 0; + + AutoLock lock_scope(this); + + if (offset_ < data_.length()) { + // Copy the next block of data into the buffer. + int transfer_size = + std::min(bytes_to_read, static_cast(data_.length() - offset_)); + memcpy(data_out, data_.c_str() + offset_, transfer_size); + offset_ += transfer_size; + + bytes_read = transfer_size; + has_data = true; + } + + return has_data; + } + + private: + std::string data_; + std::string mime_type_; + size_t offset_; + + IMPLEMENT_REFCOUNTING(ClientSchemeHandler); + IMPLEMENT_LOCKING(ClientSchemeHandler); +}; + +// Implementation of the factory for for creating schema handlers. +class ClientSchemeHandlerFactory : public CefSchemeHandlerFactory { + public: + // Return a new scheme handler instance to handle the request. + virtual CefRefPtr Create(CefRefPtr browser, + CefRefPtr frame, + const CefString& scheme_name, + CefRefPtr request) + OVERRIDE { + REQUIRE_IO_THREAD(); + return new ClientSchemeHandler(); + } + + IMPLEMENT_REFCOUNTING(ClientSchemeHandlerFactory); +}; + +} // namespace + +void RegisterCustomSchemes(CefRefPtr registrar, + std::vector& cookiable_schemes) { + registrar->AddCustomScheme("client", true, false, false); +} + +void InitTest() { + CefRegisterSchemeHandlerFactory("client", "tests", + new ClientSchemeHandlerFactory()); +} + +void RunTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL("client://tests/handler.html"); +} + +} // namespace scheme_test diff --git a/atom/cefclient/scheme_test.h b/atom/cefclient/scheme_test.h new file mode 100644 index 000000000..724843a92 --- /dev/null +++ b/atom/cefclient/scheme_test.h @@ -0,0 +1,29 @@ +// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_ +#define CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_ +#pragma once + +#include +#include "include/cef_base.h" + +class CefBrowser; +class CefSchemeRegistrar; + +namespace scheme_test { + +// Register the scheme. +void RegisterCustomSchemes(CefRefPtr registrar, + std::vector& cookiable_schemes); + +// Create the scheme handler. +void InitTest(); + +// Run the test. +void RunTest(CefRefPtr browser); + +} // namespace scheme_test + +#endif // CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_ diff --git a/atom/cefclient/string_util.cpp b/atom/cefclient/string_util.cpp new file mode 100644 index 000000000..ebeca5c03 --- /dev/null +++ b/atom/cefclient/string_util.cpp @@ -0,0 +1,74 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/string_util.h" +#include +#include +#include "include/cef_request.h" + +void DumpRequestContents(CefRefPtr request, std::string& str) { + std::stringstream ss; + + ss << "URL: " << std::string(request->GetURL()); + ss << "\nMethod: " << std::string(request->GetMethod()); + + CefRequest::HeaderMap headerMap; + request->GetHeaderMap(headerMap); + if (headerMap.size() > 0) { + ss << "\nHeaders:"; + CefRequest::HeaderMap::const_iterator it = headerMap.begin(); + for (; it != headerMap.end(); ++it) { + ss << "\n\t" << std::string((*it).first) << ": " << + std::string((*it).second); + } + } + + CefRefPtr postData = request->GetPostData(); + if (postData.get()) { + CefPostData::ElementVector elements; + postData->GetElements(elements); + if (elements.size() > 0) { + ss << "\nPost Data:"; + CefRefPtr element; + CefPostData::ElementVector::const_iterator it = elements.begin(); + for (; it != elements.end(); ++it) { + element = (*it); + if (element->GetType() == PDE_TYPE_BYTES) { + // the element is composed of bytes + ss << "\n\tBytes: "; + if (element->GetBytesCount() == 0) { + ss << "(empty)"; + } else { + // retrieve the data. + size_t size = element->GetBytesCount(); + char* bytes = new char[size]; + element->GetBytes(size, bytes); + ss << std::string(bytes, size); + delete [] bytes; + } + } else if (element->GetType() == PDE_TYPE_FILE) { + ss << "\n\tFile: " << std::string(element->GetFile()); + } + } + } + } + + str = ss.str(); +} + +std::string StringReplace(const std::string& str, const std::string& from, + const std::string& to) { + std::string result = str; + std::string::size_type pos = 0; + std::string::size_type from_len = from.length(); + std::string::size_type to_len = to.length(); + do { + pos = result.find(from, pos); + if (pos != std::string::npos) { + result.replace(pos, from_len, to); + pos += to_len; + } + } while (pos != std::string::npos); + return result; +} diff --git a/atom/cefclient/string_util.h b/atom/cefclient/string_util.h new file mode 100644 index 000000000..c43e6f210 --- /dev/null +++ b/atom/cefclient/string_util.h @@ -0,0 +1,21 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_STRING_UTIL_H_ +#define CEF_TESTS_CEFCLIENT_STRING_UTIL_H_ +#pragma once + +#include +#include "include/cef_base.h" + +class CefRequest; + +// Dump the contents of the request into a string. +void DumpRequestContents(CefRefPtr request, std::string& str); + +// Replace all instances of |from| with |to| in |str|. +std::string StringReplace(const std::string& str, const std::string& from, + const std::string& to); + +#endif // CEF_TESTS_CEFCLIENT_STRING_UTIL_H_ diff --git a/atom/cefclient/util.h b/atom/cefclient/util.h new file mode 100644 index 000000000..ba0305c1c --- /dev/null +++ b/atom/cefclient/util.h @@ -0,0 +1,37 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_UTIL_H_ +#define CEF_TESTS_CEFCLIENT_UTIL_H_ +#pragma once + +#include "include/cef_task.h" + +#if defined(OS_WIN) + +#include // NOLINT(build/include_order) + +#ifndef NDEBUG +#define ASSERT(condition) if (!(condition)) { DebugBreak(); } +#else +#define ASSERT(condition) ((void)0) +#endif + +#else // !OS_WIN + +#include // NOLINT(build/include_order) + +#ifndef NDEBUG +#define ASSERT(condition) if (!(condition)) { assert(false); } +#else +#define ASSERT(condition) ((void)0) +#endif + +#endif // !OS_WIN + +#define REQUIRE_UI_THREAD() ASSERT(CefCurrentlyOn(TID_UI)); +#define REQUIRE_IO_THREAD() ASSERT(CefCurrentlyOn(TID_IO)); +#define REQUIRE_FILE_THREAD() ASSERT(CefCurrentlyOn(TID_FILE)); + +#endif // CEF_TESTS_CEFCLIENT_UTIL_H_ diff --git a/atom_create_projects.sh b/atom_create_projects.sh new file mode 100755 index 000000000..e21e6a887 --- /dev/null +++ b/atom_create_projects.sh @@ -0,0 +1,2 @@ +#!/bin/sh +python tools/gyp_cef atom.gyp -I cef.gypi --depth=./chromium diff --git a/benchmark/benchmark-bootstrap.coffee b/benchmark/benchmark-bootstrap.coffee deleted file mode 100644 index 03e221b9f..000000000 --- a/benchmark/benchmark-bootstrap.coffee +++ /dev/null @@ -1,4 +0,0 @@ -{runSpecSuite} = require 'jasmine-helper' - -document.title = "Benchmark Suite" -runSpecSuite("benchmark-suite", true) diff --git a/benchmark/benchmark-helper.coffee b/benchmark/benchmark-helper.coffee deleted file mode 100644 index 9ccb4dfb2..000000000 --- a/benchmark/benchmark-helper.coffee +++ /dev/null @@ -1,143 +0,0 @@ -nakedLoad 'jasmine-jquery' -$ = require 'jquery' -_ = require 'underscore' -Keymap = require 'keymap' -Point = require 'point' -RootView = require 'root-view' -Project = require 'project' -TextMateBundle = require 'text-mate-bundle' -TextMateTheme = require 'text-mate-theme' - -require 'window' - -requireStylesheet "jasmine.css" -TextMateBundle.loadAll() -TextMateTheme.loadAll() - -RootView.prototype.loadUserConfiguration = -> - -keymap = new Keymap -keymap.bindDefaultKeys() -$(window).on 'keydown', (e) -> keymap.handleKeyEvent(e) -keymap.bindKeys '*', - 'meta-w': 'close' - 'alt-meta-i': 'show-console' -$(document).on 'close', -> window.close() -$(document).on 'show-console', -> $native.showDevTools() - -defaultCount = 100 -window.pbenchmark = (args...) -> window.benchmark(args..., profile: true) -window.fbenchmark = (args...) -> window.benchmark(args..., focused: true) -window.fpbenchmark = (args...) -> window.benchmark(args..., profile: true, focused: true) -window.pfbenchmark = window.fpbenchmark - -window.benchmarkFixturesProject = new Project(require.resolve 'benchmark/fixtures') - -window.benchmark = (args...) -> - description = args.shift() - if typeof args[0] is 'number' - count = args.shift() - else - count = defaultCount - [fn, options] = args - { profile, focused } = (options ? {}) - - $native.showDevTools() if profile - method = if focused then fit else it - method description, -> - total = measure -> - console.profile(description) if profile - _.times count, fn - console.profileEnd(description) if profile - avg = total / count - - fullname = @getFullName().replace(/\s|\.$/g, "") - report = "#{fullname}: #{total} / #{count} = #{avg}ms" - console.log(report) - - if atom.headless - url = "https://github.com/_stats" - data = [type: 'timing', metric: "atom.#{fullname}", ms: avg] - $.ajax url, - async: false - data: JSON.stringify(data) - error: (args...) -> - console.log "Failed to send atom.#{fullname}\n#{JSON.stringify(args)}" - -window.measure = (fn) -> - start = new Date().getTime() - fn() - new Date().getTime() - start - -window.waitsForPromise = (fn) -> - window.waitsFor (moveOn) -> - fn().done(moveOn) - -window.eventPropertiesForPattern = (pattern) -> - [modifiers..., key] = pattern.split '-' - - modifiers.push 'shift' if key == key.toUpperCase() and key.toUpperCase() != key.toLowerCase() - charCode = key.toUpperCase().charCodeAt 0 - - isNamedKey = key.length > 1 - if isNamedKey - keyIdentifier = key - else - keyIdentifier = "U+00" + charCode.toString(16) - - ctrlKey: 'ctrl' in modifiers - altKey: 'alt' in modifiers - shiftKey: 'shift' in modifiers - metaKey: 'meta' in modifiers - which: charCode - originalEvent: - keyIdentifier: keyIdentifier - -window.keydownEvent = (pattern, properties={}) -> - event = $.Event "keydown", _.extend(eventPropertiesForPattern(pattern), properties) - # event.keystroke = (new Keymap).keystrokeStringForEvent(event) - event - -window.clickEvent = (properties={}) -> - $.Event "click", properties - -window.mouseEvent = (type, properties) -> - if properties.point - {point, editor} = properties - {top, left} = @pagePixelPositionForPoint(editor, point) - properties.pageX = left + 1 - properties.pageY = top + 1 - properties.originalEvent ?= {detail: 1} - $.Event type, properties - -window.mousedownEvent = (properties={}) -> - window.mouseEvent('mousedown', properties) - -window.mousemoveEvent = (properties={}) -> - window.mouseEvent('mousemove', properties) - -window.pagePixelPositionForPoint = (editor, point) -> - point = Point.fromObject point - top = editor.lines.offset().top + point.row * editor.lineHeight - left = editor.lines.offset().left + point.column * editor.charWidth - editor.lines.scrollLeft() - { top, left } - -window.setEditorWidthInChars = (editor, widthInChars, charWidth=editor.charWidth) -> - editor.width(charWidth * widthInChars + editor.lines.position().left) - -$.fn.resultOfTrigger = (type) -> - event = $.Event(type) - this.trigger(event) - event.result - -$.fn.enableKeymap = -> - @on 'keydown', (e) => window.keymap.handleKeyEvent(e) - -$.fn.attachToDom = -> - $('#jasmine-content').append(this) - -$.fn.textInput = (data) -> - event = document.createEvent 'TextEvent' - event.initTextEvent('textInput', true, true, window, data) - this.each -> this.dispatchEvent(event) - diff --git a/benchmark/benchmark-suite.coffee b/benchmark/benchmark-suite.coffee deleted file mode 100644 index 3a68627b0..000000000 --- a/benchmark/benchmark-suite.coffee +++ /dev/null @@ -1,104 +0,0 @@ -require 'benchmark-helper' -fs = require 'fs' -$ = require 'jquery' -TokenizedBuffer = require 'tokenized-buffer' -TextMateBundle = require 'text-mate-bundle' - -describe "editor.", -> - editor = null - - beforeEach -> - window.rootViewParentSelector = '#jasmine-content' - window.startup() - rootView.project.setPath(require.resolve('benchmark/fixtures')) - editor = rootView.getActiveEditor() - - afterEach -> - $(window).off 'beforeunload' - window.shutdown() - delete atom.rootViewStates[$windowNumber] - - describe "opening-buffers.", -> - benchmark "300-line-file.", -> - buffer = rootView.project.bufferForPath('medium.coffee') - - describe "empty-file.", -> - benchmark "insert-delete", -> - editor.insertText('x') - editor.backspace() - - describe "300-line-file.", -> - beforeEach -> - editor.edit rootView.project.buildEditSessionForPath('medium.coffee') - - describe "at-begining.", -> - benchmark "insert-delete", -> - editor.insertText('x') - editor.backspace() - - benchmark "insert-delete-rehighlight", -> - editor.insertText('"') - editor.backspace() - - describe "at-end.", -> - beforeEach -> - editor.moveCursorToBottom() - - benchmark "insert-delete", -> - editor.insertText('"') - editor.backspace() - - describe "9000-line-file.", -> - benchmark "opening.", 5, -> - editor.edit rootView.project.buildEditSessionForPath('huge.js') - - describe "after-opening.", -> - beforeEach -> - editor.edit rootView.project.buildEditSessionForPath('huge.js') - - benchmark "moving-to-eof.", 1, -> - editor.moveCursorToBottom() - - describe "on-first-line.", -> - benchmark "inserting-newline", 5, -> - editor.insertNewline() - - describe "on-last-visible-line.", -> - beforeEach -> - editor.setCursorScreenPosition([editor.getLastVisibleScreenRow(), 0]) - - benchmark "move-down-and-scroll", 300, -> - editor.trigger 'move-down' - - describe "at-eof.", -> - endPosition = null - - beforeEach -> - editor.moveCursorToBottom() - endPosition = editor.getCursorScreenPosition() - - benchmark "move-to-beginning-of-word", -> - editor.moveCursorToBeginningOfWord() - editor.setCursorScreenPosition(endPosition) - -describe "TokenizedBuffer.", -> - describe "coffee-script-grammar.", -> - [languageMode, buffer] = [] - - beforeEach -> - editSession = benchmarkFixturesProject.buildEditSessionForPath('medium.coffee') - { languageMode, buffer } = editSession - - benchmark "construction", -> - new TokenizedBuffer(buffer, { languageMode, tabText: ' '}) - -describe "OnigRegExp.", -> - [regex, line] = [] - - beforeEach -> - line = " l.comment_matcher = new RegExp('^\\s*' + l.symbol + '\\s?')" - regex = TextMateBundle.grammarForFileName('medium.coffee').initialRule.regex - - benchmark ".getCaptureTree", 10000, -> - regex.getCaptureIndices(line, 22) - diff --git a/benchmark/fixtures/huge.js b/benchmark/fixtures/huge.js deleted file mode 100644 index 0b1562f14..000000000 --- a/benchmark/fixtures/huge.js +++ /dev/null @@ -1,9245 +0,0 @@ -/*! - * jQuery JavaScript Library v1.7.1 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon Nov 21 21:11:03 2011 -0500 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context ? context.ownerDocument || context : document ); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.7.1", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.add( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.fireWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).off( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery.Callbacks( "once memory" ); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - // A crude way of determining if an object is a window - isWindow: function( obj ) { - return obj && typeof obj === "object" && "setInterval" in obj; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array, i ) { - var len; - - if ( array ) { - if ( indexOf ) { - return indexOf.call( array, elem, i ); - } - - len = array.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in array && array[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, key, value, exec, fn, pass ) { - var length = elems.length; - - // Setting many attributes - if ( typeof key === "object" ) { - for ( var k in key ) { - jQuery.access( elems, k, key[k], exec, fn, value ); - } - return elems; - } - - // Setting one attribute - if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = !pass && exec && jQuery.isFunction(value); - - for ( var i = 0; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - - return elems; - } - - // Getting an attribute - return length ? fn( elems[0], key ) : undefined; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -// String to Object flags format cache -var flagsCache = {}; - -// Convert String-formatted flags into Object-formatted ones and store in cache -function createFlags( flags ) { - var object = flagsCache[ flags ] = {}, - i, length; - flags = flags.split( /\s+/ ); - for ( i = 0, length = flags.length; i < length; i++ ) { - object[ flags[i] ] = true; - } - return object; -} - -/* - * Create a callback list using the following parameters: - * - * flags: an optional list of space-separated flags that will change how - * the callback list behaves - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible flags: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( flags ) { - - // Convert flags from String-formatted to Object-formatted - // (we check in cache first) - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; - - var // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = [], - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Add one or several callbacks to the list - add = function( args ) { - var i, - length, - elem, - type, - actual; - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - // Inspect recursively - add( elem ); - } else if ( type === "function" ) { - // Add if not in unique mode and callback is not in - if ( !flags.unique || !self.has( elem ) ) { - list.push( elem ); - } - } - } - }, - // Fire callbacks - fire = function( context, args ) { - args = args || []; - memory = !flags.memory || [ context, args ]; - firing = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { - memory = true; // Mark as halted - break; - } - } - firing = false; - if ( list ) { - if ( !flags.once ) { - if ( stack && stack.length ) { - memory = stack.shift(); - self.fireWith( memory[ 0 ], memory[ 1 ] ); - } - } else if ( memory === true ) { - self.disable(); - } else { - list = []; - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - var length = list.length; - add( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away, unless previous - // firing was halted (stopOnFalse) - } else if ( memory && memory !== true ) { - firingStart = length; - fire( memory[ 0 ], memory[ 1 ] ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - var args = arguments, - argIndex = 0, - argLength = args.length; - for ( ; argIndex < argLength ; argIndex++ ) { - for ( var i = 0; i < list.length; i++ ) { - if ( args[ argIndex ] === list[ i ] ) { - // Handle firingIndex and firingLength - if ( firing ) { - if ( i <= firingLength ) { - firingLength--; - if ( i <= firingIndex ) { - firingIndex--; - } - } - } - // Remove the element - list.splice( i--, 1 ); - // If we have some unicity property then - // we only need to do this once - if ( flags.unique ) { - break; - } - } - } - } - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - if ( list ) { - var i = 0, - length = list.length; - for ( ; i < length; i++ ) { - if ( fn === list[ i ] ) { - return true; - } - } - } - return false; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory || memory === true ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( stack ) { - if ( firing ) { - if ( !flags.once ) { - stack.push( [ context, args ] ); - } - } else if ( !( flags.once && memory ) ) { - fire( context, args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!memory; - } - }; - - return self; -}; - - - - -var // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - - Deferred: function( func ) { - var doneList = jQuery.Callbacks( "once memory" ), - failList = jQuery.Callbacks( "once memory" ), - progressList = jQuery.Callbacks( "memory" ), - state = "pending", - lists = { - resolve: doneList, - reject: failList, - notify: progressList - }, - promise = { - done: doneList.add, - fail: failList.add, - progress: progressList.add, - - state: function() { - return state; - }, - - // Deprecated - isResolved: doneList.fired, - isRejected: failList.fired, - - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); - return this; - }, - always: function() { - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); - return this; - }, - pipe: function( fnDone, fnFail, fnProgress ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ], - progress: [ fnProgress, "notify" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - obj = promise; - } else { - for ( var key in promise ) { - obj[ key ] = promise[ key ]; - } - } - return obj; - } - }, - deferred = promise.promise({}), - key; - - for ( key in lists ) { - deferred[ key ] = lists[ key ].fire; - deferred[ key + "With" ] = lists[ key ].fireWith; - } - - // Handle state - deferred.done( function() { - state = "resolved"; - }, failList.disable, progressList.lock ).fail( function() { - state = "rejected"; - }, doneList.disable, progressList.lock ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = sliceDeferred.call( arguments, 0 ), - i = 0, - length = args.length, - pValues = new Array( length ), - count = length, - pCount = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(), - promise = deferred.promise(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - deferred.resolveWith( deferred, args ); - } - }; - } - function progressFunc( i ) { - return function( value ) { - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - deferred.notifyWith( promise, pValues ); - }; - } - if ( length > 1 ) { - for ( ; i < length; i++ ) { - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return promise; - } -}); - - - - -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - marginDiv, - fragment, - tds, - events, - eventName, - i, - isSupported, - div = document.createElement( "div" ), - documentElement = document.documentElement; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - div.innerHTML = ""; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = marginDiv = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - conMarginTop, ptlm, vb, style, html, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"; - vb = "visibility:hidden;border:0;"; - style = "style='" + ptlm + "border:5px solid #000;padding:0;'"; - html = "
" + - "" + - "
"; - - container = document.createElement("div"); - container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
t
"; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Figure out if the W3C box model works as expected - div.innerHTML = ""; - div.style.width = div.style.paddingLeft = "1px"; - jQuery.boxModel = support.boxModel = div.offsetWidth === 2; - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = ""; - div.innerHTML = "
"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); - } - - div.style.cssText = ptlm + vb; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - body.removeChild( container ); - div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, attr, name, - data = null; - - if ( typeof key === "undefined" ) { - if ( this.length ) { - data = jQuery.data( this[0] ); - - if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { - attr = this[0].attributes; - for ( var i = 0, l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( this[0], name, data[ name ] ); - } - } - jQuery._data( this[0], "parsedAttrs", true ); - } - } - - return data; - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - // Try to fetch any internally stored data first - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - data = dataAttr( this[0], key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - - } else { - return this.each(function() { - var self = jQuery( this ), - args = [ parts[0], value ]; - - self.triggerHandler( "setData" + parts[1] + "!", args ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + parts[1] + "!", args ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? parseFloat( data ) : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise(); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.attr ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.prop ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - - // See #9699 for explanation of this approach (setting first, then removal) - jQuery.attr( elem, name, "" ); - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( rboolean.test( name ) && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, - rhoverHack = /\bhover(\.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Determine handlers that should run if there are delegated events - // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on.call( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

"; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
"; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.POS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( elem.parentNode.firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /", "" ], - legend: [ 1, "
", "
" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - col: [ 2, "", "
" ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and -HTML - puts <<-HTML - - -
#{documentation}
-HTML - html_footer - TextMate.exit_show_html -elsif mode == 'js' then - documentation = `#{e_sh RI_EXE} -T -f plain #{e_sh term}` \ - rescue "

ri Command Error.

" - - if documentation =~ /\A(?:\s*More than one method matched|-+\s+Multiple choices)/ - methods = documentation.split(/\n[ \t]*\n/).last. - strip.split(/(?:,\s*|\n)/).map { |m| m[/\S+/] }.compact - documentation = ">> #{methods.join(' ')}" - else - documentation = htmlize_ri_output(documentation, term) - end - - puts documentation -end diff --git a/bundles/ruby.tmbundle/Support/bin/make_destructive.rb b/bundles/ruby.tmbundle/Support/bin/make_destructive.rb deleted file mode 100644 index 153f20876..000000000 --- a/bundles/ruby.tmbundle/Support/bin/make_destructive.rb +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env ruby - -require "escape" - -CURSOR = [0xFFFC].pack("U").freeze -line = STDIN.read -begin - line[ENV["TM_LINE_INDEX"].to_i, 0] = CURSOR -rescue - exit -end - -line.sub!(/\b(chomp|chop|collect|compact|delete|downcase|exit|flatten|gsub|lstrip|map|next|reject|reverse|rstrip|slice|sort|squeeze|strip|sub|succs|swapcase|tr|tr_s|uniq|upcase)\b(?!\!)/, "\\1!") - -line = e_sn(line) -line.sub!(CURSOR, "$0") - -print line diff --git a/bundles/ruby.tmbundle/Support/bin/snippet_paren.rb b/bundles/ruby.tmbundle/Support/bin/snippet_paren.rb deleted file mode 100755 index 6b4bbbd39..000000000 --- a/bundles/ruby.tmbundle/Support/bin/snippet_paren.rb +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby -wKU - -minimize = ENV["TM_MINIMIZE_PARENS"].to_s =~ /\byes\b/i - -case ARGV.shift.to_s =~ /\bend\b/i ? :end : :start -when :start - print(minimize ? " " : "(") -when :end - print ")" unless minimize -end diff --git a/bundles/ruby.tmbundle/Support/lib/ruby_requires.rb b/bundles/ruby.tmbundle/Support/lib/ruby_requires.rb deleted file mode 100644 index c589000a6..000000000 --- a/bundles/ruby.tmbundle/Support/lib/ruby_requires.rb +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env ruby - -$: << "#{ENV['TM_SUPPORT_PATH']}/lib" if ENV.has_key?('TM_SUPPORT_PATH') -require "escape" - -module RubyRequires - module_function - - def build_requires( code, libs ) - libs.reject { |lib| code =~ /require\s*(['"])#{lib}\1/ }. - map { |lib| "require \"#{lib}\"\n" }.join - end - - def place_requires( code, new_reqs ) - return code unless new_reqs =~ /\S/ - - code.dup.sub!(/(?:^[ \t]*require\s*(['"]).+?\1.*\n)+/, "\\&#{new_reqs}") || - code.sub(/\A(?:\s*(?:#.*)?\n)*/, "\\&#{new_reqs}\n") - end - - def add_requires( code, reqs ) - new_reqs = build_requires(code, reqs) - code = place_requires(code, new_reqs) - e_sn(code) - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/README b/bundles/ruby.tmbundle/Support/vendor/README deleted file mode 100644 index 8f9654a7c..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/README +++ /dev/null @@ -1,3 +0,0 @@ -Please remember that anything in this directory has a license of its own. - -These projects need to be chosen carefully, after ensuring that there license allows them to be bundled with TextMate, and all changes must comply with the project license. diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/CHANGES b/bundles/ruby.tmbundle/Support/vendor/rcodetools/CHANGES deleted file mode 100644 index 0b102fece..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/CHANGES +++ /dev/null @@ -1,70 +0,0 @@ -rcodetools history -================== -User-visible changes since 0.8.5 --------------------------------- -* Fix DATA and __END__ handling in xmpfilter --tempfile (windows) - -User-visible changes since 0.8.4 --------------------------------- -* OOPS, added missing files. - -User-visible changes since 0.8.0 --------------------------------- -* xmpfilter: fixed multi-line annotation bugs - -User-visible changes since 0.7.0 --------------------------------- -* Support Ruby 1.9! -* xmpfilter: multi-line annotation -* xmpfilter --expectations generates expectations by Jay Fields -* anything-rcodetools.el: new elisp -* --tmpfile, --tempfile: use temporary file instead of open3 on un*x -* rcodetools.el: smarter xmpfilter-command -* rcodetools.el: rct-fork interface -* rct-fork: require 'rubygems' initially -* rct-fork: more stable - -User-visible changes since 0.5.0 --------------------------------- -* "test-driven completion" (TDC) support for Emacs and vim (see README.TDC) -* --test (-t), --filename options for rct-complete and rct-doc, allowing to - specify the test to be run for 100% accurate completion/documentation in the - corresponding implementation -* ruby-toggle-file: finds the test file corresponding to a given - implementation and vice versa -* rct-fork, rct-fork-client: allow to eliminate the overhead due to library - loading (esp. useful for Rails) -* rbtest: executes unit tests in a single Ruby script -* --fork, --rbtest, --detect-rbtest supported by several commands -* xmpfilter's --spec now autodetects the RSpec version and generates - specifications with the appropriate syntax - -User-visible changes since 0.4.1 --------------------------------- -* --dev: adds project directories to $: -* --completion-class-info: list completion candidates and class info -* display completion candidates with description, both in emacs - and vim (using the menu+preview window). - -User-visible changes since 0.4.0 --------------------------------- -* rct-meth-args: implemented -I -* many bug fixes - -xmpfilter was integrated into rcodetools as of 0.4.0. - -xmpfilter history -================= -User-visible changes since 0.3.1 (2006-10-17) -* implemented --debug -* --[no]-warnings -* --cd working_dir -* --rails -* --no-poetry -* more intelligent assertions: try to find which local variables hold the - values compared against in assertions/expectations -* editor-independent completion (-C, --completion-emacs, --completion-vim) -* quick method/class reference with -D (--refe, --ri*) - -User-visible changes since 0.3.0 (2006-10-16) -* xmpfilter.rb --spec works on win32 too diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README b/bundles/ruby.tmbundle/Support/vendor/rcodetools/README deleted file mode 100644 index 036373fc4..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README +++ /dev/null @@ -1,98 +0,0 @@ - - rcodetools http://eigenclass.org/hiki.rb?rcodetools - Copyright (c) 2005-2007 Mauricio Fernandez http://eigenclass.org - Copyright (c) 2006-2008 rubikitch http://www.rubyist.net/~rubikitch/ -Use and distribution subject to the terms of the Ruby license. - -= Overview -rcodetools is a collection of Ruby code manipulation tools. -It includes xmpfilter and editor-independent Ruby development helper tools, -as well as emacs and vim interfaces. - -Currently, rcodetools comprises: -* xmpfilter: Automagic Test::Unit assertions/RSpec expectations and code annotations -* rct-complete: Accurate method/class/constant etc. completions -* rct-doc: Document browsing and code navigator -* rct-meth-args: Precise method info (meta-prog. aware) and TAGS generation -* rct-fork: Pre-load heavy library(Rails etc) and speed up rct-complete/rct-doc (server) -* rct-fork-client: Run Ruby programs from state the rct-fork server has -* ruby-toggle-file: Toggle implementation file and test file -* rbtest: Embedded Test::Unit for small scripts - -See also README.xmpfilter. - -Originally rct-complete and rct-doc were subcommands of xmpfilter. -Actually they use xmpfilter's code heavily. -But the relationship between xmpfilter (annotation) and completion/doc is not -intuitive, so I (rubikitch) split it into separate executables. - -= Usage -xmpfilter, rct-complete and rct-doc take its input from stdin and write to -stdout. They can run in several modes; see - xmpfilter -h - rct-complete -h - rct-doc -h - rct-meth-args -h - rct-fork -h - rct-fork-client -h - ruby-toggle-file -h - rbtest -h -README.emacs and README.vim describe how to use rcodetools from your editor. - -= Accurate Completion Internal and Caveat -rct-complete and rct-doc use xmpfilter engine, ie they get runtime information by executing code. -In Ruby (dynamic languages), type of any expressions except literals cannot be known without actually executing code. -Moreover Ruby has open classes and singleton methods. -Rcodetools asks `ruby' run-time informations, so we can get very accurate informations. -Completion and document browsing are essentially identical operations, -they both need the object value in question. -Therefore we discuss completion. - -rct-complete does: -(1) replaces target line with completion magic - (it calculates methods the target object has). -(2) executes modified script. -(3) once the control reaches completion magic, modified script exits. -(4) outputs in specified format. (list candidates, EmacsLisp...) - -But this methodology has two big drawbacks, side-effects and inability to get any informations of uncovered code! - -An extreme side-effect example: - File.unlink a_file - File. <- - -If you call rct-complete, it removes a_file (sends a mail, accesses DB ...). -So you must be careful to use, especially at TOPLEVEL. -I (rubikitch) often experiment at TOPLEVEL with rcodetools, I NEVER use irb(sh) since rcodetools! - -An uncovered code example: - def foo - 1. <- - end - -If the code does not call foo, we cannot do any completions. - -Useless eh? But we already have a way to elude the drawbacks, test scripts (unit tests)! -Test scripts are self-enclosed and expected to be executed, so side-effects are not problem. -Moreover tests call methods we write. -Because Ruby's Test::Unit has an ability to test only one test method, we can do lightning-fast completion. -Let's call it Test-Driven Completion (TDC). - -To support TDC, rct-complete has -t option. -With -t, it concatenate modified script and test/unit code. -If the control does not reach target line, test/unit code calls the line. - -How do we select test script and test method? -The editor selects recently selected buffer of test script as test script of TDC, -because the test-infected tend to go and return between test script and implementation script. -It considers files matching /test.*\.rb/ as test script. -It selects test method at the cursor position. - -TDC adds roles of test scripts. -Enjoy TDC magic! - -See also README.TDC. - - -= License -rcodetools is licensed under the same terms as Ruby. diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.TDC b/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.TDC deleted file mode 100644 index 5a413dab0..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.TDC +++ /dev/null @@ -1,158 +0,0 @@ - -= Overview - -Ruby is very dynamic language, therefore it is impossible to do -accurate completion without executing script. While executing script -from start to cursor point is often dangerous, executing unit test -script covering current point is SAFE. I call this methodology -`Test-Driven Completion' (TDC). - -As I have already stated in README, browsing documentation of method -(rct-doc) is almost identical operation to completion. This -discussion is applicable to rct-doc. - -= Why TDD Is Needed - -In the following code snippet: - - File.unlink a_file - File. <- - -If you complete after `File.', rct-complete actually deletes a_file. -Normally it is unpleasant. -In real-life development, side-effect is inevitable. - -In the foo method which are not called: - - def foo - 1. <- - end - -If the code does not call foo, rct-complete cannot do any completions. -Before TDC, if you want to do completion in methods, you have to write -method call and remove it after completion. Too useless!! - -= Messianic Unit Test Script - -Recently Test-Driven Development (TDD) is widespread. Many developers -write unit tests. Fortunately Ruby's unit tester, Test::Unit, is -sophisticated enough to test one test method. Unit tests are -self-enclosed: they must tear down resources, so executing unit tests -are SAFE. TDC uses unit test to do completion. - -= TDC Methodology - -(1) Switch to unit test script. -(2) Write a test for target method. -(3) Switch to implementation script. -(4) You can write target method WITH COMPLETION! -(5) Back to (1) - -TDC methodology is almost identical to TDD. TDC is very easy for TDDers. - -= TDC With Example - -For simplicity, suppose that you are unfamiliar with Time class and -you want to write a method to format date string. - -The directory structure and file contents is following: - - /tmp/mylib0/ - /tmp/mylib0/lib/ - mylib0.rb - /tmp/mylib0/test/ - test_mylib0.rb - - List: mylib0.rb - # contrived example of long-runtime method - def mysleep(x) - sleep x - end - - def mytime(tm) - - end - - - List: test_mylib0.rb - require 'test/unit' - require 'mylib0' - class TestMylib0 < Test::Unit::TestCase - def test_0_mysleep - s = Time.now - mysleep 3.0 - e = Time.now - assert_in_delta 3.0, e-s, 0.01 - end - - def test_1_mytime - - end - end - -These sample files are in demo/ directory. - - -== Switch to unit test script. - -TDC starts with writing unit test as TDD does. -Open test_mylib0.rb. - -== Write a test for target method. - -Suppose that you want to write mytime method and test_1_mytime test -method, and that you want to experiment Time class first (before -forming an assertion). - -In TDC, you do not have to write an assertion first: just write only a -method call. If you are familiar with Time class, you are free to -write an assertion, of course. - - def test_1_mytime - mytime(Time.now) - end - -At this time, the cursor position is in test_1_mytime test method. - -== Switch to implementation script. - -Open mylib0.rb with the `ruby-toggle-file' script. For example, in Emacs use -the `ruby-toggle-buffer' command, and in vim the t (by default -\t) binding. Since in TDD/TDC you often switch between the test and the -implementation, it is much handier than typing the filename manually. - -The rct-complete uses latest-selected test script as TDC test script -and test method at cursor position as TDC test method. In this case, -test_mylib0.rb is TDC test script and test_1_mytime is TDC test -method. If the cursor position of test_mylib0.rb is at the top, -rct-complete executes whole test methods in test_mylib0.rb. Therefore -latency of completion is longer. - -== You can write target method WITH COMPLETION! - -Fill mytime method. - - def mytime(tm) - tm. - end - -Do completion after `tm.'. Here! Your editor is listing methods `tm' -accepts!! If your editor has help-on-candidate mechanism (eg. Emacs + -Icicles), you would see documentation of each listed method. - -Then you find `Time#strftime' method. Type `str' and do completion. - - def mytime(tm) - tm.strftime - end - -Usage is... use `rct-doc' (in Emacs, `rct-ri') after `strftime'. - -After you are familiar with Time class, switch to test script and write assertions. - -= When Modifying Another Method - -If you want to modify already-written method, setting cursor position -of corresponding test script to corresponding test method is better. -It tells rct-complete new test script and test method, so you can do -completion in the new method. diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.emacs b/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.emacs deleted file mode 100644 index c3acff5d3..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.emacs +++ /dev/null @@ -1,75 +0,0 @@ - -rcodetools.el allows you to run rcodetools on a buffer. - -To eval the sexp, type C-e C-x C-e; `end-of-line' and `eval-last-sexp'. - -installation -============ - -If you use RI document feature, you must install ri-emacs first. - http://rubyforge.org/projects/ri-emacs/ - -If you feel RI and ri-emacs.rb startup is SLOW, you want to install FastRI. -FastRI offers ri-emacs compatible layer, so you can use it with ri-ruby.el. - http://eigenclass.org/hiki.rb?fastri - -Copy rcodetools.el to the appropriate directory, which is in load-path. -Then require it. - (require 'rcodetools) - -If you use icicles copy icicles-rcodetools.el too. -Then require it. - (require 'icicles-rcodetools) -It provides wonderful `help on candidate' feature, RI document on each candidate during completion. - -If you use anything.el copy anything-rcodetools.el too. -Then require it. - (require 'anything-rcodetools) -RI document on each candidate during completion. - -anything-show-completion.el shows selection (mehod) in buffer for completion. -It is available in: - http://www.emacswiki.org/cgi-bin/wiki/download/anything-show-completion.el - -I think anything-rcodetools is more convenient than icicles-rcodetools. -I'm addicted to anything! - http://www.emacswiki.org/cgi-bin/wiki/Anything - -xmpfilter on buffer -=================== - -# [EVAL IT] (describe-function 'xmp) - -If you want to add => marks, call comment-dwim twice. - -# [EVAL IT] (describe-function 'comment-dwim) - -method/class/constant completion -================================ - -# [EVAL IT] (describe-function 'rct-complete-symbol) - -If you use icicles-rcodetools or anything-rcodetools, you can browse RI document -for selected candidate by typing C-M-RET (icicles) or C-z (anything. -It is wonderful icicles and anything feature!! - -show RI document / jump to the definition -========================================= - -# [EVAL IT] (describe-function 'rct-ri) - -By default rct-ri asks for a TAGS file, which is generated by tag generator like rtags. -If there is a TAGS file, this command jumps to the definition of current method. -If use do not use this feature, evaluate: - (setq rct-find-tag-if-available nil) - -# [EVAL IT] (describe-variable 'rct-find-tag-if-available) - -speed-up xmpfilter and completion -================================= - -# [EVAL IT] (describe-function 'rct-fork) -# [EVAL IT] (describe-function 'rct-fork-kill) - -M-x rct-fork pre-loads heavy libraries (like rails). -You need not every time wait for loading them anymore! diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.ja b/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.ja deleted file mode 100644 index 7a321169f..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.ja +++ /dev/null @@ -1,84 +0,0 @@ - - rcodetools http://eigenclass.org/hiki.rb?rcodetools - Copyright (c) 2005-2007 Mauricio Fernandez http://eigenclass.org - Copyright (c) 2006-2008 rubikitch http://www.rubyist.net/~rubikitch/ -Use and distribution subject to the terms of the Ruby license. - -= -rcodetools Ruby Υɤ򰷤ġ뷲Ǥ -rcodetools ˤ xmpfilter ȥǥ˰¸ʤȯٱġ뤬ޤޤƤޤ -Emacs Vim Υ󥿡եѰդƤޤ - -* xmpfilter: Test::Unit assert* / RSpec should* ư -* rct-complete: ٥᥽å̾饹̾̾䴰 -* rct-doc: ɥȻȡɥʥӥ -* rct-meth-args: ٥᥽åɾꥹȡTAGS ե -* rct-fork: Rails Ť饤֥ͽɤ䴰®ʥС -* rct-fork-client: rct-fork Фݻ֤ Ruby ץȤ¹Ԥ -* ruby-toggle-file: ƥȥץȤȼץȤڤ괹 -* rbtest: ϥץȤΤ Test::Unit - - -= Ȥ - -== -ͤɽԤ # => äޤ - - a, b = "foo", "baz" - a + b # => - a.size # => - -xmpfilter ̤ȲΤ褦˼ͤɽƤޤ - - a, b = "foo", "baz" - a + b # => "foobaz" - a.size # => 3 - - -== Test::Unit assert ʸ - -ǤˤǤäƤץΥƥȥץȤ񤯤ΤݤǤ͡ - - def test_insertion - @o.insert "bar" - @o.insert "baz" - @o.size # => - @o.last # => - @o.first # => - @o.complex_computation # => - @o.last(2) # => - end - -xmpfilter-u ץˤ֤ڸƤޤ - - def test_insertion - @o.insert "bar" - @o.insert "baz" - assert_equal(2, @o.size) - assert_equal("baz", @o.last) - assert_equal("bar", @o.first) - assert_in_delta(3.14159265358979, @o.complex_computation, 0.0001) - assert_equal(["baz", "bar"], @o.last(2)) - end - -RSpec ˤĤƤƱͤΤȤǤޤ-s ץ - -== 䴰ɥȻ - -ưˤ륹꡼󥷥åȤ򸫤Ƥ - -http://eigenclass.org/hiki.rb?rcodetools-screenshots - -== ܤȤ --h ץĤȻѲǽʥץɽޤ - - xmpfilter -h - rct-complete -h - rct-doc -h - rct-meth-args -h - rct-fork -h - rct-fork-client -h - ruby-toggle-file -h - rbtest -h - -README.emacs README.vim ˥ǥǤλȤܤ񤤤Ƥޤ diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.method_analysis b/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.method_analysis deleted file mode 100644 index 53a482d05..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.method_analysis +++ /dev/null @@ -1,13 +0,0 @@ - -method_analyzer.rb can be used to gather precise information about the exact -methods called in your code, allowing you to explore it better with rct-doc -(see README.emacs and README.vim for more information). This requires high -code coverage, since it can only record such data when the code is executed. - -rct-meth-args can be used to generate fairly complete TAGS files. It operates -by loading the specified files and tracking method definitions; therefore, it -is meta-programming aware, unlike other implementations. - -You can use them conveniently by adding the code shown in -Rakefile.method_analysis to your Rakefile. - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.vim b/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.vim deleted file mode 100644 index ea7c7c59f..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.vim +++ /dev/null @@ -1,111 +0,0 @@ - -Copy rcodetools.vim to your plugin directory (typically $HOME/.vim/plugin) in -order to enable accurate code completion, quick RI execution and exact tag -jumping. - -Switching between implementation and test files -=============================================== -The t binding (by default \t) will call ruby-toggle-file to -switch from test to implementation and vice versa. Moreover, when you switch -from the test to the implementation, rcodetools will remember which test -you were editing (based on the cursor position), and call it as needed for -advanced code completion or precise RI documentation, as documented below. - -The actual binding can be changed in your .vimrc as follows: - let g:RCT_toggle_binding="" " use ^X^T to go test <=> implementation - -Code completion -=============== -rcodetools.vim redefines user-defined completion for Ruby programs, so you can -use the intelligent, 100%-accurate completion with in insert mode. -Note that this runs the code to obtain the exact candidate list. - -If you've set completeopt to menu,preview then rcodetools.vim can display -information about the completion candidates. The menu will show the synopsis -as given in the RI documentation, and the preview window will contain the full -RI documentation. - -This functionality relies on fri for quick lookups. It can be enabled by setting - - let g:rct_completion_use_fri = 1 " 0 by default (disabled) - -in your .vimrc (don't forget to run fastri-server too). -Obtaining the documentation for many candidates can be slow, so you can set -the threshold above which additional documentation will not be shown with - - " 20 by default, about a couple secs max wait on a normal machine - let g:rct_completion_info_max_len = 20 - -Quick RI documentation and exact tag jumping -============================================ -When you're editing a Ruby file, will jump to the definition of the -chosen element if found in the TAGS file; otherwise, it will call RI and show -the documentation in a new window. -You can specify the RI executable to use by adding something like - let g:RCT_ri_cmd = "ri -T -f plain " -to your .vimrc. (rcodetools.vim also honors b:RCT_RI_cmd and w:RCT_RI_cmd if set). -By default, "fri -f plain " will be used. fri (FastRI) is an improved RI -documentation browser, which features more intelligent search modes, gem -integration, vastly better performance... You can find it at -http://eigenclass.org/hiki.rb?fastri and it's also available in gem format -gem install fastri - -If you want to call RI for the word the cursor is on (instead of jumping to -the definition if found), you can use this binding: - r (\r by default if you haven't changed your localleader) -You can specify another binding in your .vimrc as follows: - let g:RCT_ri_binding="" " use ^X^R to call vim on current word - -Using xmpfilter -=============== -xmpfilter takes code from stdin and outputs to stdout so you can filter -your code with ! as usual. - -If you use xmpfilter often, you might want to use mappings like the -following, which allow you to: -* add annotations -* expand assertions -* insert/remove # => markers - - - -" plain annotations -map !xmpfilter -a -nmap V -imap a - -" Test::Unit assertions; use -s to generate RSpec expectations instead -map !xmpfilter -u -nmap V -imap a - -" Annotate the full buffer -" I actually prefer ggVG to %; it's a sort of poor man's visual bell -nmap mzggVG!xmpfilter -a'z -imap - -" assertions -nmap mzggVG!xmpfilter -u'z -imap a - -" Add # => markers -vmap !xmpfilter -m -nmap V -imap a - -" Remove # => markers -vmap ms:call RemoveRubyEval() -nmap V -imap a - - -function! RemoveRubyEval() range - let begv = a:firstline - let endv = a:lastline - normal Hmt - set lz - execute ":" . begv . "," . endv . 's/\s*# \(=>\|!!\).*$//e' - normal 'tzt`s - set nolz - redraw -endfunction diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.xmpfilter b/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.xmpfilter deleted file mode 100644 index 1ea49dcb9..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/README.xmpfilter +++ /dev/null @@ -1,287 +0,0 @@ - -xmpfilter http://eigenclass.org/hiki.rb?xmpfilter -Copyright (c) 2005-2008 Mauricio Fernandez http://eigenclass.org - rubikitch -Use and distribution subject to the terms of the Ruby license. - -Overview -======== -xmpfilter is a small tool that can be used to -* generate Test::Unit assertions, RSpec expectations and - expectations blocks semi-automatically -* annotate source code with intermediate results (a bit like irb - --simple-prompt but only for the lines explicitly marked with # =>) - Very useful for example code (such as postings to ruby-talk). - -Usage -===== -xmpfilter takes its input from stdin and writes to stdout. It can run in -several modes (annotation, Test::Unit assertion expansion, RSpec expectation -generation, expectations expectations generation, marker insertion); see - xmpfilter -h -README.emacs and README.vim describe how to use xmpfilter from your editor. - -Example: code annotation -======================== -Just add "# =>" markers to the lines whose values you want to be shown: - - a, b = "foo", "baz" - a + b # => - a.size # => - -will be expanded to (in one keypress in a decent editor, see README.emacs and -README.vim) - - a, b = "foo", "baz" - a + b # => "foobaz" - a.size # => 3 - -This saves much cut&pasting when you're posting to ruby-list/ruby-talk/ruby-core -(We use it all the time). - - -Example: multi-line code annotation -=================================== -Just add "# =>" markers to the next lines whose values you want to be shown with pp: - -a = ["1111111111111111111111111111111111111111111111111111", 123334324234242342, - 1332333333,6,8 ] -1 # => -a -# => - -will be expanded to (in one keypress in a decent editor, see README.emacs and -README.vim) - -a = ["1111111111111111111111111111111111111111111111111111", 123334324234242342, - 1332333333,6,8 ] -1 # => 1 -a -# => ["1111111111111111111111111111111111111111111111111111", -# 123334324234242342, -# 1332333333, -# 6, -# 8] - - -Example: assertion generation -============================= - -xmpfilter can generate assertions based on the current behavior of the code -to be tested (iow. the current behavior is assumed to be correct and is used -to generate assertions which won't be modified by further runs of -xmpfilter), making it quite useful for regression testing. - -Imagine you have a ComplexClass you want to test. You might start with - - class TestComplexClass < Test::Unit::TestCase - def setup; @o = ComplexClass.new("foo", false) end - end - -and then want to add some tests: - - def test_insertion - @o.insert "bar" - @o.insert "baz" - # ... assertions here - end - -At this point, you want to add several assertions to verify that the values -returned by @o.size, @o.last, @o.first, @o.complex_computation and @o.last(2) -are correct. You can just write the following and feed the file to -xmpfilter in -u mode (the # => markers can also be inserted by -xmpfilter, see README.vim for more information: - - def test_insertion - @o.insert "bar" - @o.insert "baz" - @o.size # => - @o.last # => - @o.first # => - @o.complex_computation # => - @o.last(2) # => - end - -xmpfilter will run the test and remember what happened in each marked line, -and then rewrite the code so that it looks for instance like - - def test_insertion - @o.insert "bar" - @o.insert "baz" - assert_equal(2, @o.size) - assert_equal("baz", @o.last) - assert_equal("bar", @o.first) - assert_in_delta(3.14159265358979, @o.complex_computation, 0.0001) - assert_equal(["baz", "bar"], @o.last(2)) - end - -As you can see, it can save some typing. - -You can edit the generated assertions as you want: xmpfilter will not -modify lines without the "# =>" marker. xmpfilter can be used repeatedly as -you add more assertions. Imagine you want to verify that @o.last(3) raises an -ArgumentError. You can simply add one line marked with # => : - - ... - assert_in_delta(3.14159265358979, @o.complex_computation, 0.0001) - assert_equal(["baz", "bar"], @o.last(2)) - @o.last(3) # => - end - -and have it expanded by xmpfilter: - - ... - assert_in_delta(3.14159265358979, @o.complex_computation, 0.0001) - assert_equal(["baz", "bar"], @o.last(2)) - assert_raise(ArgumentError){ @o.last(3) } - end - - -Example: RSpec expectations -=========================== -Here's some code before and after filtering it with xmpfilter: - - class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 - end - - context "Testing xmpfilter's expectation expansion" do - setup do - @o = X.new - end - - specify "Should expand should_equal expectations" do - @o.foo(true) # => - @o.foo(true).a # => - @o.foo(false) # => - end - - specify "Should expand should_raise expectations" do - @o.bar # => - end - - specify "Should expand should_be_nil expectations" do - @o.baz # => - end - - specify "Should expand correct expectations for complex values" do - @o.babar # => - end - - specify "Should expand should_be_close expectations" do - @o.fubar(10) # => - end - end - - -after piping it to xmpfilter -s: - - class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 # !> already initialized constant A - end - - context "Testing xmpfilter's expectation expansion" do - setup do - @o = X.new - end - - specify "Should expand should_equal expectations" do - (@o.foo(true)).should_be_a_kind_of X::Y - (@o.foo(true).inspect).should_equal "#" - (@o.foo(true).a).should_equal 2 - (@o.foo(false)).should_equal 2 - end - - specify "Should expand should_raise expectations" do - lambda{(@o.bar)}.should_raise RuntimeError - end - - specify "Should expand should_be_nil expectations" do - (@o.baz).should_be_nil - end - - specify "Should expand correct expectations for complex values" do - (@o.babar).should_equal [1, 2] - end - - specify "Should expand should_be_close expectations" do - (@o.fubar(10)).should_be_close(101.0, 0.0001) - end - end - - -Example: expectations expectations -================================== -Expectations is a light-weight unit testing framework by Jay Fields. -(http://expectations.rubyforge.org) - -Here's some code before and after filtering it with xmpfilter: - - require 'rubygems' - require 'expectations' - - S = Struct.new :a - Expectations do - 1 + 1 # => - "a".length # => - [][1] # => - 1.hoge # => - 1.1 + 1.0 # => - S.new(1) # => - end - -after piping it to xmpfilter --expectations: - - require 'rubygems' - require 'expectations' - - S = Struct.new :a - Expectations do - expect 2 do - 1 + 1 - end - - expect 1 do - "a".length - end - - expect nil do - [][1] - end - - expect NoMethodError do - 1.hoge - end - - expect 2.0999..2.1001 do - 1.1 + 1.0 - end - - expect S do - S.new(1) - end - - expect "#" do - S.new(1).inspect - end - - end - - -License -======= -xmpfilter is licensed under the same terms as Ruby. diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/Rakefile b/bundles/ruby.tmbundle/Support/vendor/rcodetools/Rakefile deleted file mode 100644 index 7d2c227f8..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/Rakefile +++ /dev/null @@ -1,121 +0,0 @@ - -PKG_REVISION = ".0" - -$:.unshift "lib" if File.directory? "lib" -require 'rcodetools/xmpfilter' -require 'rake/testtask' -include Rcodetools -RCT_VERSION = XMPFilter::VERSION - -desc "Run the unit tests in pure-Ruby mode ." -Rake::TestTask.new(:test) do |t| - t.test_files = FileList['test/test*.rb'] - t.verbose = true -end - -begin - require 'rcov/rcovtask' - desc "Run rcov." - Rcov::RcovTask.new do |t| - t.rcov_opts << "--xrefs" # comment to disable cross-references - t.test_files = FileList['test/test_*.rb'].to_a - ["test/test_functional.rb"] - t.verbose = true - end - - desc "Save current coverage state for later comparisons." - Rcov::RcovTask.new(:rcovsave) do |t| - t.rcov_opts << "--save" - t.test_files = FileList['test/test_*.rb'].to_a - ["test/test_functional.rb"] - t.verbose = true - end -rescue LoadError - # rcov is not installed -end -task :default => :test - - -#{{{ Package tasks -PKG_FILES = FileList[ - "bin/xmpfilter", "bin/rct-*", "bin/ruby-toggle-file", "bin/rbtest", -"lib/**/*.rb", -"CHANGES", "rcodetools.*", "icicles-rcodetools.el", "anything-rcodetools.el", -"README", "README.*", "THANKS", -"Rakefile", "Rakefile.method_analysis", -"setup.rb", -"test/**/*.rb","test/**/*.taf" -] - -begin - require 'rake/gempackagetask' - Spec = Gem::Specification.new do |s| - s.name = "rcodetools" - s.version = RCT_VERSION + PKG_REVISION - s.summary = "rcodetools is a collection of Ruby code manipulation tools" - s.description = <, "Mauricio Fernandez" } - s.homepage = "http://eigenclass.org/hiki.rb?rcodetools" - s.bindir = "bin" - s.executables = %w[rct-complete rct-doc xmpfilter rct-meth-args] - s.has_rdoc = true - s.extra_rdoc_files = %w[README] - s.rdoc_options << "--main" << "README" << "--title" << 'rcodetools' - s.test_files = Dir["test/test_*.rb"] - s.post_install_message = < [:test] - Rake::GemPackageTask.new(Spec) do |p| - p.need_tar_gz = true - end - -rescue LoadError - # RubyGems not installed -end - -desc "install by setup.rb" -task :install do - sh "sudo ruby setup.rb install" -end - -desc "release in rubyforge (package is created)" -task :release_only do - sh "rubyforge login" - sh "rubyforge add_release rcodetools rcodetools #{RCT_VERSION} pkg/rcodetools-#{RCT_VERSION}.0.tar.gz " - sh "rubyforge add_file rcodetools rcodetools #{RCT_VERSION} pkg/rcodetools-#{RCT_VERSION}.0.gem " -end - -desc "release in rubyforge" -task :release => [:package, :release_only] - -# vim: set sw=2 ft=ruby: diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/Rakefile.method_analysis b/bundles/ruby.tmbundle/Support/vendor/rcodetools/Rakefile.method_analysis deleted file mode 100644 index 1dc8e0414..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/Rakefile.method_analysis +++ /dev/null @@ -1,30 +0,0 @@ - -# Rake tasks to generate TAGS and gather method analysis information. -# See README.method_analysis for more information. - -## my standard Rakefile -task :tags => "TAGS" - -desc "Generate method_analysis by ruby -rmethod_analyzer." -task :analyze => [:_prepare_method_analyze, :tags] do - at_exit { sh "ls -l method_analysis" } -end - -task :_prepare_method_analyze do - ENV['METHOD_ANALYZER_FORMAT']="marshal" - sh "rm -f method_analysis" - puts "generating method_analysis" -end - -## application-specific Rakefile (RTtool) -task :analyze do - sh "ruby -Ilib -rmethod_analyzer test/test.rb" - sh "ruby -Ilib -rmethod_analyzer test/test-rt2html-lib.rb" - sh "ruby -Ilib -rmethod_analyzer test/test-rtparser.rb" -end - -file "TAGS" => FileList["lib/rt/*.rb"] do - sh "rct-meth-args -t lib/rt/*.rb > TAGS" -end - - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/THANKS b/bundles/ruby.tmbundle/Support/vendor/rcodetools/THANKS deleted file mode 100644 index 0ed1e3763..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/THANKS +++ /dev/null @@ -1,11 +0,0 @@ -Some names forgotten, tell me if you care :) -- mfp - -rubikitch -* expanded xmp3.rb (a previous version of xmpfilter.rb) to support RSpec expectations -* wrote the elisp magic to use xmpfilter.rb with emacs -* made the 100% accurate, editor-independent completion system -[rubikitch took xmpfilter and turned it into the much more powerful -rcodetools, so there are way too many things to list them here :)] - -Adagios -* found & fixed problem with rcodetools.vim plugin on win32 diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/anything-rcodetools.el b/bundles/ruby.tmbundle/Support/vendor/rcodetools/anything-rcodetools.el deleted file mode 100644 index e21a743de..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/anything-rcodetools.el +++ /dev/null @@ -1,151 +0,0 @@ -;;; anything-rcodetools.el --- accurate Ruby method completion with anything -;; $Id: anything-rcodetools.el,v 1.13 2009/04/20 16:25:37 rubikitch Exp $ - -;;; Copyright (c) 2007 rubikitch - -;; Author: rubikitch -;; URL: http://www.emacswiki.org/cgi-bin/wiki/download/anything-rcodetools.el - -;;; Use and distribution subject to the terms of the Ruby license. - -;;; Commentary: - -;; (0) You need rcodetools, anything.el and FastRI. Note that you do not have to -;; configure anything.el if you use anything.el for this package. -;; (1) You need to add to .emacs: -;; (require 'anything) -;; (require 'anything-rcodetools) -;; ;; Command to get all RI entries. -;; (setq rct-get-all-methods-command "PAGER=cat fri -l") -;; ;; See docs -;; (define-key anything-map "\C-z" 'anything-execute-persistent-action) - -;;; Commands: -;; -;; Below are complete command list: -;; -;; -;;; Customizable Options: -;; -;; Below are customizable option list: -;; - -;;; History: - -;; $Log: anything-rcodetools.el,v $ -;; Revision 1.13 2009/04/20 16:25:37 rubikitch -;; Set anything-samewindow to nil -;; -;; Revision 1.12 2009/04/18 10:12:02 rubikitch -;; Adjust to change of `use-anything-show-completion' -;; -;; Revision 1.11 2009/04/17 20:21:47 rubikitch -;; * require anything -;; * require anything-show-completion.el if available -;; -;; Revision 1.10 2009/04/17 20:11:03 rubikitch -;; removed old code -;; -;; Revision 1.9 2009/04/17 20:07:52 rubikitch -;; * use --completion-emacs-anything option -;; * New implementation of `anything-c-source-complete-ruby-all' -;; -;; Revision 1.8 2009/04/15 10:25:25 rubikitch -;; Set `anything-execute-action-at-once-if-one' t -;; -;; Revision 1.7 2009/04/15 10:24:23 rubikitch -;; regexp bug fix -;; -;; Revision 1.6 2008/01/14 17:59:34 rubikitch -;; * uniform format (anything-c-source-complete-ruby, anything-c-source-complete-ruby-all) -;; * rename command: anything-c-ri -> anything-rct-ri -;; -;; Revision 1.5 2008/01/13 17:54:04 rubikitch -;; anything-current-buffer advice. -;; -;; Revision 1.4 2008/01/08 14:47:34 rubikitch -;; Added (require 'rcodetools). -;; Revised commentary. -;; -;; Revision 1.3 2008/01/04 09:32:29 rubikitch -;; *** empty log message *** -;; -;; Revision 1.2 2008/01/04 09:21:23 rubikitch -;; fixed typo -;; -;; Revision 1.1 2008/01/04 09:21:05 rubikitch -;; Initial revision -;; - -;;; Code: - -(require 'anything) -(require 'rcodetools) -(when (require 'anything-show-completion nil t) - (use-anything-show-completion 'rct-complete-symbol--anything - '(length pattern))) - -(defun anything-rct-ri (meth) - (ri (get-text-property 0 'desc meth))) - -(defun anything-rct-complete (meth) - (save-excursion - (set-buffer anything-current-buffer) - (search-backward pattern) - (delete-char (length pattern))) - (insert meth)) - -(setq rct-complete-symbol-function 'rct-complete-symbol--anything) -(defvar anything-c-source-complete-ruby - '((name . "Ruby Method Completion") - (candidates . rct-method-completion-table) - (init - . (lambda () - (condition-case x - (rct-exec-and-eval rct-complete-command-name "--completion-emacs-anything") - ((error) (setq rct-method-completion-table nil))))) - (action - ("Completion" . anything-rct-complete) - ("RI" . anything-rct-ri)) - (volatile) - (persistent-action . anything-rct-ri))) - -(defvar rct-get-all-methods-command "PAGER=cat fri -l") -(defvar anything-c-source-complete-ruby-all - '((name . "Ruby Method Completion (ALL)") - (init - . (lambda () - (unless (anything-candidate-buffer) - (with-current-buffer (anything-candidate-buffer 'global) - (call-process-shell-command rct-get-all-methods-command nil t) - (goto-char 1) - (while (re-search-forward "^.+[:#.]\\([^:#.]+\\)$" nil t) - (replace-match "\\1\t[\\&]")))))) - (candidates-in-buffer - . (lambda () - (let ((anything-pattern (format "^%s.*%s" (regexp-quote pattern) anything-pattern))) - (anything-candidates-in-buffer)))) - (display-to-real - . (lambda (line) - (if (string-match "\t\\[\\(.+\\)\\]$" line) - (propertize (substring line 0 (match-beginning 0)) - 'desc (match-string 1 line)) - line))) - (action - ("Completion" . anything-rct-complete) - ("RI" . anything-rct-ri)) - (persistent-action . anything-rct-ri))) - - -(defun rct-complete-symbol--anything () - (interactive) - (let ((anything-execute-action-at-once-if-one t) - anything-samewindow) - (anything '(anything-c-source-complete-ruby - anything-c-source-complete-ruby-all)))) - -(provide 'anything-rcodetools) - -;; How to save (DO NOT REMOVE!!) -;; (emacswiki-post "anything-rcodetools.el") -;;; install-elisp.el ends here diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/bin/rbtest b/bundles/ruby.tmbundle/Support/vendor/rcodetools/bin/rbtest deleted file mode 100755 index ab51c9425..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/bin/rbtest +++ /dev/null @@ -1,266 +0,0 @@ -#! /usr/local/bin/ruby18 -# Copyright (c) 2006-2007 rubikitch -# -# Use and distribution subject to the terms of the Ruby license. - -USAGE = <<'XXX' -Usage: rbtest SCRIPT [-S RUBY_INTERPRETER] [Test::Unit OPTIONS] -Usage: rbtest [-h] [--help] [--example] - -I am rbtest, embedded Test::Unit executor for one-file scripts. -Splitting a small script into many files (executables, libraries and tests) is cumbersome. -And it is handy to put unit tests near implementations like D language, which has -built-in unittest keyword. - -Embedded Test::Unit is simpler than vanilla Test::Unit. -You do not have to define a Test::Unit::TestCase subclass, -it is automagically defined and executed by me. -Embedded Test::Unit uses =begin/=end comment blocks. - -"=begin TEST_METHOD_NAME" blocks define test methods, eg. "=begin test_foo". -"=begin rbtest" blocks define utility methods and setup/teardown methods. - -Of course, you MUST use "if __FILE__ ==$0" idiom to split executable and class/method/function. - -I am also an real-life example of rbtest usage. -Issue: - rbtest --example -to show me. - - -options: - -h, --help Print usage. - -S RUBY_INTERPRETER Use Ruby interpreter RUBY_INTERPRETER. - --example Print this file. - --output Print internally-generated test script (for debug). -XXX - - -def first_test(script_filename) - "require 'test/unit';" + - "load '#{script_filename}';" + - "class TestByRbtest < Test::Unit::TestCase;" -end - -=begin rbtest -def setup -end - -def unindent(s) - s.lines.map{|x| x[1..-1]}.join -end -=end - -=begin test_script_to_test_script -# indent is needed to avoid syntax error. -script = < http://eigenclass.org -# 2006-2007 rubikitch http://www.rubyist.net/~rubikitch/ -# -# Use and distribution subject to the same conditions as Ruby. - -require 'rcodetools/options' -include Rcodetools -$VERBOSE = nil -$__method_args_off = true - -if ARGV.empty? or ARGV.include? '-h' or ARGV.include? '--help' - puts < [ ...] - --Idirectory specify $LOAD_PATH directory (same as ruby) ---dev Add this project's bin/ and lib/ to $LOAD_PATH. - A directory that has Rakefile is considered as project base direcotry. --i omit instance methods defined in classes --m omit instance methods defined in modules --c omit class methods - --n print the filename and line number with output lines --t generate TAGS output ---summarize summary output sorted by method name - -The given files will be #require()d in order. -Examples: - rct-meth-args complex - rct-meth-args thread - rct-meth-args -c rubygems -EOF - exit # ' -end - -def debugprint(*args) - $stderr.puts(*args) if $DEBUG -end - -module MethodArgs - MAX_ARGS = 20 - - private - def needed_args(arity) - arity >= 0 ? arity : arity.abs - 1 - end - - def with_tracer - begin - set_trace_func @__trace_func - yield - ensure - set_trace_func nil - end - end - - module LineContents - # usage: Contents[filename][lineno] - Contents = Hash.new{ |h,k| - sum = 0 - # Unshift is needed because lineno starts with 1. - h[k] = File.readlines(k).map{ |line| [line.chomp, sum+=line.length] }.unshift nil - } - def content - Contents[filename][lineno.to_i][0] rescue "" - end - - def byte - Contents[filename][lineno.to_i-1][1] rescue 0 - end - - def arg_desc - # TODO - desc = content[ /\((.+)\)/] - desc.gsub!(/(\S),(\S)/, '\1, \2') - desc.gsub!(/(\S)=(\S)/, '\1 = \2') - desc - end - - FileNameCache = Hash.new{ |h,k| h[k] = File.expand_path(k) } - def full_filename - FileNameCache[filename] - end - end - - class Location < Struct.new(:filename, :lineno) - include LineContents - end - - class Printer - def method_info(io, x) - prefix = x[:location] ? "#{x[:location].filename}:#{x[:location].lineno}:" : "" - io.puts "#{prefix}#{x[:fullname]}#{x[:arg_desc]}" unless x[:klass].to_s == "" - end - - def included_location(io, x) - x[:callsite] and io.print "#{x[:callsite].filename}:#{x[:callsite].lineno}:" - io.puts([ x[:comment], x[:mod], x[:flag], x[:self] ].join(" ")) - end - end - - class SummarizePrinter - def initialize - @hash = Hash.new - at_exit { print_result } - end - - def method_info(io, x) - @io = io - prefix = x[:location] ? "#{x[:location].filename}:#{x[:location].lineno}:" : "" - (@hash[x[:meth]]||=[]) << "#{prefix}#{x[:fullname]}#{x[:arg_desc]}" unless x[:klass].to_s == "" - end - - def included_location(io, x) - # not implemented - end - - def print_result - @hash.keys.sort.each do |meth| - @io.puts meth - @hash[meth].each do |line| - @io.puts line - end - @io.puts - end - end - end - - class TagsPrinter - def initialize - @previous_filename = "" - end - - def output_filename(filename) - if @previous_filename != filename - @previous_filename = filename - puts "\cl" - puts "#{filename},0" - end - end - - def method_info(io, x) - return unless x[:location] - output_filename x[:location].full_filename - io.puts "#{x[:location].content}::#{x[:fullname]}#{x[:location].lineno},#{x[:location].byte}" - end - - def included_location(io, x) - return unless x[:callsite] - output_filename x[:callsite].full_filename - io.puts "#{x[:callsite].content}::#{x[:mod]}#{x[:callsite].lineno},#{x[:callsite].byte}" - end - end - - def _print_method_info(klass, is_singleton, meth, arg_desc=nil, location=nil, with_location=$__with_location, printer=$__printer) - arg_desc ||= "(...)" - arg_desc = " " + arg_desc unless arg_desc.empty? - flag = is_singleton ? "." : "#" - x = { :arg_desc => arg_desc, :klass => klass, - :meth => meth.to_s, - :fullname => [klass, flag, meth].join, - :location => with_location && location, - } - printer.method_info $>, x - end - - def output_attr_info(klass, object, meth, is_singleton, location) - arg_desc = meth.to_s =~ /=$/ ? "(value)" : "" - _print_method_info klass, is_singleton, meth, arg_desc, location - end - - def output_method_info(klass, object, meth, is_singleton = false, by_attr = nil, by_define_method = nil) - return if $__method_args_off - file = line = params = values = nil - location = nil - begin - unless %w[initialize].include?(meth.to_s) - if is_singleton - return if class << klass; private_instance_methods(true) end.include?(meth.to_s) - else - return if class << object; private_instance_methods(true) end.include?(meth.to_s) - end - end - rescue TypeError # no virtual class - end - - arity = is_singleton ? object.method(meth).arity : klass.instance_method(meth).arity - @__trace_func = lambda{|event, file, line, id, binding, classname| - begin - debugprint "!EVENT: #{event} #{classname}##{id}, #{file} #{line}" - debugprint "(#{self} #{meth})" - if event[/call/] && classname == self && id == meth - location = Location.new(file, line) if event == 'call' - debugprint "EVENT: #{event} #{classname}##{id}" - throw :done - end - rescue Exception - nil # rcov workaround - end - } - if by_define_method - _print_method_info klass, is_singleton, meth, nil, by_define_method - return - end - - if by_attr - output_attr_info klass, object, meth, is_singleton, by_attr - return - end - - catch(:done) do - begin - with_tracer { object.send(meth, *(0...needed_args(arity))) } - rescue Exception - nil # rcov workaround - end - end - - arg_desc = location.arg_desc - - _print_method_info klass, is_singleton, meth, arg_desc, location - rescue Exception - debugprint "GOT EXCEPTION while processing #{klass} #{meth}" - debugprint $!.class - debugprint $!.message - debugprint $!.backtrace - _print_method_info klass, is_singleton, meth, nil, location - ensure - set_trace_func(nil) - end -end - -class Object - include MethodArgs -end - -class Module - class CallSite # compatible with Location - include MethodArgs::LineContents - def initialize(caller_string) - @filename, @lineno, @in = caller_string.split(/:/) - end - attr_reader :filename, :lineno - end - - def _method_defined_with(ivar, caller, &block) - begin - instance_variable_set(ivar, caller) - yield - ensure - instance_variable_set(ivar, false) - end - end - - def with_attr(caller, &block) - _method_defined_with :@by_attr, caller, &block - end - - def with_define_method(caller, &block) - _method_defined_with :@by_define_method, caller, &block - end - - [ :attr, :attr_reader, :attr_writer, :attr_accessor ].each do |meth| - attr = instance_method(meth) - define_method(meth) do |*args| - with_attr(CallSite.new(caller(1)[0])){ attr.bind(self).call(*args) } - end - end - - alias :__define_method_orig :define_method - def define_method(*args, &body) - with_define_method(CallSite.new(caller(1)[0])){ __define_method_orig(*args, &body) } - end - -end - -new_args = [] -omissions = {} -$__with_location = false -$__printer = Printer.new -i_opt_p = false - -ARGV.each do |arg| - case arg - when "-n"; $__with_location = true - when "-t"; $__printer = TagsPrinter.new; $__with_location = true - when "--summarize"; $__printer = SummarizePrinter.new - when /-I(.+)$/; $:.unshift $1 - when "-I"; i_opt_p = true - when "--dev"; OptionHandler.auto_include_paths($:, Dir.pwd) - when /^-.$/; omissions[$&] = true - else - if i_opt_p - $:.unshift arg - i_opt_p = false - else - new_args << arg - end - end -end - -ARGV.replace new_args - -class Object - ALLOCATOR = Hash.new{|h,k| h[k] = k.allocate }.merge(Fixnum=>1, - Bignum=>10000000000000000, - Float=>1.1, - Symbol=>:method_args_tmp, - Binding=>binding, - UnboundMethod=>instance_method(:object_id), - Method=>method(:object_id), - Proc=>lambda{}, - Continuation=>callcc{|c|c}, - Thread=>Thread.new{}, - FalseClass=>false, - TrueClass=>true, - NilClass=>nil, - Struct=>Struct.new(:a).new(1)) - -# ABSTRACT_CLASSES = %w[Digest::Base ] - def self.method_added(meth) -# if ABSTRACT_CLASSES.include? self.to_s -# _print_method_info self, false, meth -# return -# end - begin - o = ALLOCATOR[self] - rescue Exception # for abstract classes - nil - end - output_method_info(self, o, meth, false, @by_attr, @by_define_method) - end -end unless omissions["-i"] - -class Module - method_added = instance_method(:method_added) - define_method(:method_added) do |meth| - begin - if instance_of? Module - o = Object.new - o.extend(self) - output_method_info(self, o, meth, false, @by_attr, @by_define_method) - end - method_added.bind(self).call(meth) - rescue Exception - _print_method_info self, false, meth - end - end -end unless omissions["-m"] - - -class Class - def singleton_method_added(meth) - by_attr = class << self; @by_attr; end - by_define_method = class << self; @by_define_method; end - output_method_info(self, self, meth, true, by_attr, by_define_method) - rescue Exception - _print_method_info self, true, meth - end -end unless omissions["-c"] - -#### include / extend -class Module - def _print_included_location(mod, caller_string, comment, flag, with_location=$__with_location, printer=$__printer) - if caller_string # nil when the class is defined by C - x = { :comment => comment, :mod => mod, :flag => flag, :self => self, - :callsite => with_location && CallSite.new(caller_string) - } - printer.included_location $>, x - end - end - - undef_method :included - def included(mod) - _print_included_location mod, caller(0)[1], "include", "<=" - end - - undef_method :extended - def extended(mod) - _print_included_location mod, caller(0)[1], "extend", "<-" if Module === mod - end -end - -#### inheritance -class Class - undef :inherited - def inherited(klass, caller_level=0) - _print_included_location klass, caller(caller_level)[1], "class", "<" unless self == Object - end -end - -#### Struct inspection -class << Struct - def to_s - orig = super - if orig =~ /" : "" - else - orig - end - end - - def inherited(klass) - if self == Struct - @inherited_delay = lambda{ super(klass, 3) } - else - super(klass, 1) - end - end - - @@struct_initializing = false - def method_added(meth) - super unless @@struct_initializing - end - - orig_new = instance_method(:new) - define_method(:new) do |*args| - begin - @@struct_initializing = true - orig_new.bind(self).call(*args) - ensure - @@struct_initializing = false - @inherited_delay[] - end - end - -end - -$__method_args_off = false - -ARGV.each{|x| - begin - require x - rescue LoadError - load x - end -} - -$__method_args_off = true -# END { puts "zzzz OK" } diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/bin/ruby-toggle-file b/bundles/ruby.tmbundle/Support/vendor/rcodetools/bin/ruby-toggle-file deleted file mode 100644 index 9adccc929..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/bin/ruby-toggle-file +++ /dev/null @@ -1,26 +0,0 @@ -#! /usr/local/bin/ruby18 -require 'ruby_toggle_file' -require 'optparse' - -USAGE = < markers.") do - klass = XMPAddMarkers - end - - opts.handle_interpreter options - - opts.separator "" - opts.separator "Specific options:" - opts.on("-l N", "--min-line-length N", Integer, "Align markers to N spaces.") do |min_codeline_size| - options[:min_codeline_size] = min_codeline_size - end - opts.on("--rails", "Setting appropriate for Rails.", - "(no warnings, find working directory,", - " Test::Unit assertions)") do - require 'rcodetools/xmptestunitfilter' - options[:warnings] = false - klass = XMPTestUnitFilter - rails_settings = true - end - opts.on("--[no-]poetry", "Whether to use extra parentheses.", - "(default: use them)") do |poetry_p| - options[:use_parentheses] = !poetry_p - end - opts.on("--[no-]warnings", "Whether to add warnings (# !>).", - "(default: enabled)") {|warnings_p| options[:warnings] = warnings_p } - opts.on("-q", "--quiet", "Supress standard output.") do - options[:output_stdout] = false - end - - opts.handle_misc options -end - -set_extra_opts options -opts.parse!(ARGV) - -if rails_settings && !options[:wd] - if File.exist? ARGF.path - options[:wd] = File.dirname(ARGF.path) - elsif File.exist? "test/unit" - options[:wd] = "test/unit" - elsif File.exist? "unit" - options[:wd] = "unit" - end -end -targetcode = ARGF.read -Dir.chdir options[:wd] if options[:wd] - -if XMPFilter.detect_rbtest(targetcode, options) - require 'rcodetools/xmptestunitfilter' - klass = XMPTestUnitFilter -end - -# Do the job. dispatched by klass. -puts klass.run(targetcode, options) diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/icicles-rcodetools.el b/bundles/ruby.tmbundle/Support/vendor/rcodetools/icicles-rcodetools.el deleted file mode 100644 index a6de2ca6e..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/icicles-rcodetools.el +++ /dev/null @@ -1,35 +0,0 @@ -;;; icicles-rcodetools.el -- accurate completion with icicles - -;;; Copyright (c) 2006-2007 rubikitch -;;; -;;; Use and distribution subject to the terms of the Ruby license. - -(require 'icicles) -(require 'rcodetools) - -(setq rct-complete-symbol-function 'rct-complete-symbol--icicles) -(icicle-define-command rct-complete-symbol--icicles - "Perform ruby method and class completion on the text around point with icicles. -C-M-RET shows RI documentation on each candidate. -See also `rct-interactive'." - - (lambda (result) - (save-excursion - (search-backward pattern) - (setq beg (point))) - (delete-region beg end) - (insert result)) ;/function - "rct-complete: " ;prompt - rct-method-completion-table - nil nil pattern nil nil nil - ((end (point)) beg - (icicle-list-join-string "\t") - (icicle-list-use-nth-parts '(1)) - (icicle-point-position-in-candidate 'input-end) - pattern klass alist - (icicle-candidate-help-fn - (lambda (result) - (ri (cdr (assoc result alist)))))) ;bindings - (rct-exec-and-eval rct-complete-command-name "--completion-emacs-icicles")) - -(provide 'icicles-rcodetools) diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/method_analyzer.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/method_analyzer.rb deleted file mode 100644 index 4f71cc274..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/method_analyzer.rb +++ /dev/null @@ -1,107 +0,0 @@ -class Module - remove_method :attr_reader - def attr_reader(*names) - names.each do |name| - module_eval "def #{name}() @#{name} end" - end - end - remove_method :attr_writer - def attr_writer(*names) - names.each do |name| - module_eval "def #{name}=(x) @#{name}=x end" - end - end - remove_method :attr_accessor - def attr_accessor(*names) - attr_reader(*names) - attr_writer(*names) - end - remove_method :attr - def attr(name, writer=false) - attr_reader name - attr_writer name if writer - end -end - - -module MethodAnalyzer - @@methods = Hash.new{ |h,k| h[k] = Hash.new{ |h,k| h[k] = []} } - @@whereis = [] - @@expand_path = Hash.new{ |h,k| h[k] = File.expand_path(k)} - - def self.trace_func(event, file, line, id, binding, klass, *rest) - return if file == __FILE__ - return if (event != 'call' and event != 'c-call') - return if klass == Class and id == :inherited - return if klass == Module and id == :method_added - return if klass == Kernel and id == :singleton_method_added - saved_crit = Thread.critical - Thread.critical = true - - the_self = eval("self",binding) - flag = Class === the_self ? "." : "#" - #klass = klass == Kernel ? Object : klass - fullname = "#{klass}#{flag}#{id}" - file.replace @@expand_path[file] - if event == 'call' - @@whereis << [file, line, fullname] if file !~ /\(eval\)$/ - file, line, rest = caller(4)[0].split(/:/) - file.replace @@expand_path[file] # DRY - p caller(0) if $DEBUG - line = line.to_i - end - @@methods[file][line] << fullname if event =~ /call/ - - Thread.critical = saved_crit - end - - def self.at_exit__output_marshal - at_exit do - set_trace_func nil - dbfile = "method_analysis" - old = Marshal.load(File.read(dbfile)) rescue {} - open(dbfile, "wb") do |io| - # Because Marshal.dump cannot handle hashes with default_proc - @@methods.default = nil - @@methods.each_value{ |v| v.default=nil; v.each_value{ |vv| vv.uniq! } } - Marshal.dump(@@methods.merge(old), io) - end - end - end - - - def self.at_exit__output_text - at_exit do - set_trace_func nil - puts "method fullnames" - @@methods.sort.each do |file, lines| - lines.sort.each do |line, methods| - printf "%s:%s:%s\n", file, line, methods.uniq.join(" ") - end - end - - puts - puts "method definitions" - @@whereis.sort.uniq.each do |file, line, fullname | - printf "%s:%s:%s\n", file, line, fullname - end - - end - end - - def self.set_at_exit - case ENV['METHOD_ANALYZER_FORMAT'] - when 'marshal' - at_exit__output_marshal - else - at_exit__output_text - end - end - - set_at_exit - set_trace_func method(:trace_func).to_proc -end - -if __FILE__ == $0 - load "./test/data/method_analyzer-data.rb" -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/compat.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/compat.rb deleted file mode 100644 index 13e50832b..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/compat.rb +++ /dev/null @@ -1,14 +0,0 @@ -if RUBY_VERSION >= "1.9" - class String - alias :each :each_line - include Enumerable - end - - module Enumerable - alias :enum_with_index :each_with_index - end - - class Array - alias :to_s :join - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/completion.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/completion.rb deleted file mode 100644 index ccc936a3c..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/completion.rb +++ /dev/null @@ -1,406 +0,0 @@ -# Nearly 100% accurate completion for any editors!! -# by rubikitch - -require 'rcodetools/xmpfilter' -require 'enumerator' - -module Rcodetools - -# Common routines for XMPCompletionFilter/XMPDocFilter -module ProcessParticularLine - def fill_literal!(expr) - [ "\"", "'", "`" ].each do |q| - expr.gsub!(/#{q}(.+)#{q}/){ '"' + "x"*$1.length + '"' } - end - expr.gsub!(/(%([wWqQxrs])?(\W))(.+?)\3/){ - percent = $2 == 'x' ? '%'+$3 : $1 # avoid executing shell command - percent + "x"*$4.length + $3 - } - [ %w[( )], %w[{ }], %w![ ]!, %w[< >] ].each do |b,e| - rb, re = [b,e].map{ |x| Regexp.quote(x)} - expr.gsub!(/(%([wWqQxrs])?(#{rb}))(.+)#{re}/){ - percent = $2 == 'x' ? '%'+$3 : $1 # avoid executing shell command - percent + "x"*$4.length + e - } - end - end - - module ExpressionExtension - attr_accessor :eval_string - attr_accessor :meth - end - OPERATOR_CHARS = '\|^&<>=~\+\-\*\/%\[' - def set_expr_and_postfix!(expr, column, ®exp) - expr.extend ExpressionExtension - - @postfix = "" - expr_orig = expr.clone - column ||= expr.length - last_char = expr[column-1] - expr.replace expr[ regexp[column] ] - debugprint "expr_orig=#{expr_orig}", "expr(sliced)=#{expr}" - right_stripped = Regexp.last_match.post_match - _handle_do_end right_stripped - aref_or_aset = aref_or_aset? right_stripped, last_char - debugprint "aref_or_aset=#{aref_or_aset.inspect}" - set_last_word! expr, aref_or_aset - fill_literal! expr_orig - _handle_brackets expr_orig, expr - expr << aref_or_aset if aref_or_aset - _handle_keywords expr_orig, column - debugprint "expr(processed)=#{expr}" - expr - end - - def _handle_do_end(right_stripped) - right_stripped << "\n" - n_do = right_stripped.scan(/[\s\)]do\s/).length - n_end = right_stripped.scan(/\bend\b/).length - @postfix = ";begin" * (n_do - n_end) - end - - def _handle_brackets(expr_orig, expr) - [ %w[{ }], %w[( )], %w![ ]! ].each do |left, right| - n_left = expr_orig.count(left) - expr.count(left) - n_right = expr_orig.count(right) - expr.count(right) - n = n_left - n_right - @postfix << ";#{left}" * n if n >= 0 - end - end - - def _handle_keywords(expr_orig, column) - %w[if unless while until for].each do |keyw| - pos = expr_orig.index(/\b#{keyw}\b/) - @postfix << ";begin" if pos and pos < column # if * xxx - - pos = expr_orig.index(/;\s*#{keyw}\b/) - @postfix << ";begin" if pos and column < pos # * ; if xxx - end - end - - def aref_or_aset?(right_stripped, last_char) - if last_char == ?[ - case right_stripped - when /\]\s*=/ then "[]=" - when /\]/ then "[]" - end - end - end - - def set_last_word!(expr, aref_or_aset=nil) - debugprint "expr(before set_last_word)=#{expr}" - if aref_or_aset - opchars = "" - else - opchars = expr.slice!(/\s*[#{OPERATOR_CHARS}]+$/) - debugprint "expr(strip opchars)=#{expr}" - end - - expr.replace(if expr =~ /[\"\'\`]$/ # String operations - "''" - else - fill_literal! expr - phrase = current_phrase(expr) - if aref_or_aset - expr.eval_string = expr[0..-2] - expr.meth = aref_or_aset - elsif phrase.match( /^(.+)\.(.*)$/ ) - expr.eval_string, expr.meth = $1, $2 - elsif opchars != '' - expr - end - debugprint "expr.eval_string=#{expr.eval_string}", "expr.meth=#{expr.meth}" - phrase - end << (opchars || '')) # ` font-lock hack - debugprint "expr(after set_last_word)=#{expr}" - end - - def current_phrase(expr) - paren_level = 0 - start = 0 - (expr.length-1).downto(0) do |i| - c = expr[i,1] - if c =~ /[\)\}\]]/ - paren_level += 1 - next - end - if paren_level > 0 - next if c =~ /[, ]/ - else - break (start = i+1) if c =~ /[ ,\(\{\[]/ - end - if c =~ /[\(\{\[]/ - paren_level -= 1 - break (start = i+1) if paren_level < 0 - end - end - expr[start..-1] - end - - def add_BEGIN - <\\Z] )[1].sub(/\\A.*?\\((.*?)\\)(.*)\\Z/){ "\#{$1}\#{$2}" }.sub(/##/) { "\#{$1}." } - #{result} = #{v}.to_s + ".new" if #{result} == 'Class#new' and #{v}.private_method_defined?(:initialize) - #{result} = "Object#" + #{meth} if #{result} =~ /^Kernel#/ and Kernel.instance_methods(false).map{|x| x.to_s}.include? #{meth} - #{result} -EOC - end - -end - -# Nearly 100% accurate completion for any editors!! -# by rubikitch -class XMPCompletionFilter < XMPFilter - include ProcessParticularLine - - class << self - attr_accessor :candidates_with_description_flag - end - @candidates_with_description_flag = false - - # String completion begins with this. - attr :prefix - - def self.run(code, opts) - new(opts).completion_code(code, opts[:lineno], opts[:column]) - end - - def magic_help_code(recv, meth) - oneline_ize __magic_help_code("#{VAR}_result", recv, meth) - end - - def methods_map_code(recv) - # delimiter is \0 - m = "#{VAR}_m" - mhc = magic_help_code((recv), m) - %Q[map{|%s| "\#{%s}\\0" + %s}] % [m, m, mhc] - end - - def split_method_info(minfo) - minfo.split(/\0/,2) - end - - def prepare_line(expr, column) - set_expr_and_postfix!(expr, column){|c| /^.{#{c}}/ } - @prefix = expr - case expr - when /^\$\w*$/ # global variable - __prepare_line 'nil', 'global_variables', '%n' - when /^@@\w*$/ # class variable - __prepare_line 'nil', 'Module === self ? class_variables : self.class.class_variables', '%n' - when /^@\w*$/ # instance variable - __prepare_line 'nil', 'instance_variables', '%n' - when /^([A-Z].*)::([^.]*)$/ # nested constants / class methods - @prefix = $2 - __prepare_line $1, "#$1.constants | #$1.methods(true)", - %Q[#$1.constants + #$1.methods(true).#{methods_map_code($1)}] - when /^[A-Z]\w*$/ # normal constants - __prepare_line 'nil', 'Module.constants', '%n' - when /^(.*::.+)\.(.*)$/ # toplevel class methods - @prefix = $2 - __prepare_line $1, "#$1.methods", - %Q[%n.#{methods_map_code($1)}] - when /^(::.+)::(.*)$/ # toplevel nested constants - @prefix = $2 - __prepare_line $1, "#$1.constants | #$1.methods", - %Q[#$1.constants + #$1.methods.#{methods_map_code($1)}] - when /^::(.*)/ # toplevel constant - @prefix = $1 - __prepare_line 'nil', 'Object.constants', '%n' - when /^(:[^:.]*)$/ # symbol - __prepare_line 'nil', 'Symbol.all_symbols.map{|s| ":" + s.id2name}', '%n' - when /\.([^.]*)$/ # method call - @prefix = $1 - recv = Regexp.last_match.pre_match - __prepare_line recv, "(#{recv}).methods(true)", - %Q[%n.#{methods_map_code(recv)}] - else # bare words - __prepare_line 'self', "methods | private_methods | local_variables | self.class.constants", - %Q[(methods | private_methods).#{methods_map_code('self')} + local_variables | self.class.constants] - end - end - - def __prepare_line(recv, all_completion_expr, all_completion_expr_verbose) - if self.class.candidates_with_description_flag - ___prepare_line(recv, all_completion_expr_verbose.gsub(/%n/, '('+all_completion_expr+')')) - else - ___prepare_line(recv, all_completion_expr) - end - - end - - def ___prepare_line(recv, all_completion_expr) - v = "#{VAR}" - rcv = "#{VAR}_recv" - idx = 1 - oneline_ize(< " + #{rcv}.to_s + " " + #{v}.join(" ")) || #{v} -exit -EOC - end - - def candidates_with_class(code, lineno, column=nil) - klass, methods = runtime_data_with_class(code, lineno, column) rescue ["", ""] - raise NoCandidates, "No candidates." if methods.nil? or methods.empty? - [klass, methods.split(/ /).sort] - end - - # Array of completion candidates. - class NoCandidates < RuntimeError; end - def candidates(code, lineno, column=nil) - candidates_with_class(code, lineno, column)[1] - end - - # Completion code for editors. - def completion_code(code, lineno, column=nil) - candidates(code, lineno, column).join("\n") rescue "\n" - end -end - -# for debugging XMPCompletionEmacsFilter -class XMPCompletionVerboseFilter < XMPCompletionFilter - @candidates_with_description_flag = true -end - -class XMPCompletionClassInfoFilter < XMPCompletionFilter - @candidates_with_description_flag = true - - def completion_code(code, lineno, column=nil) - candidates(code, lineno, column).join("\n").tr("\0", "\t") - rescue NoCandidates - "" - end -end - -class XMPCompletionEmacsFilter < XMPCompletionFilter - @candidates_with_description_flag = true - - def completion_code(code, lineno, column=nil) - elisp = "(progn\n" - table = "(setq rct-method-completion-table '(" - alist = "(setq alist '(" - begin - candidates(code, lineno, column).sort.each do |minfo| - meth, description = split_method_info(minfo) - table << format('("%s") ', meth) - alist << format('("%s\\t[%s]") ', meth, description) - end - table << "))\n" - alist << "))\n" - rescue Exception => err - return error_code(err) - end - elisp << table << alist - elisp << %Q[(setq pattern "#{prefix}")\n] - elisp << %Q[(try-completion pattern rct-method-completion-table nil)\n] - elisp << ")" # /progn - end - - def error_code(err) - case err - when NoCandidates - %Q[(error "#{err.message}")] - else - %Q[(error "#{err.message}\n#{err.backtrace.join("\n")}")] - end - - end -end - -class XMPCompletionEmacsIciclesFilter < XMPCompletionEmacsFilter - @candidates_with_description_flag = true - - def completion_code(code, lineno, column=nil) - elisp = "(progn\n" - table = "(setq rct-method-completion-table '(" - help_alist = "(setq alist '(" - - begin - klass, cands = candidates_with_class(code, lineno, column) - cands.sort.each do |minfo| - meth, description = split_method_info(minfo) - table << format('("%s\\t[%s]") ', meth, description) - help_alist << format('("%s" . "%s")', meth, description) - end - table << "))\n" - help_alist << "))\n" - rescue Exception => err - return error_code(err) - end - elisp << table << help_alist - elisp << %Q[(setq pattern "#{prefix}")\n] - elisp << %Q[(setq klass "#{klass}")\n] - elisp << ")" # /progn - end -end - -class XMPCompletionEmacsAnythingFilter < XMPCompletionEmacsFilter - @candidates_with_description_flag = true - - def completion_code(code, lineno, column=nil) - elisp = "(progn\n" - table = "(setq rct-method-completion-table `(" - - begin - klass, cands = candidates_with_class(code, lineno, column) - cands.sort.each do |minfo| - meth, description = split_method_info(minfo) - table << format('("%s\\t[%s]" . ,(propertize "%s" \'desc "%s")) ', - meth, description, meth, description) - end - table << "))\n" - rescue Exception => err - return error_code(err) - end - elisp << table - elisp << %Q[(setq pattern "#{prefix}")\n] - elisp << %Q[(setq klass "#{klass}")\n] - elisp << ")" # /progn - end -end - -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/doc.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/doc.rb deleted file mode 100644 index 9a3e752db..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/doc.rb +++ /dev/null @@ -1,168 +0,0 @@ -require 'rcodetools/completion' -# Call Ri for any editors!! -# by rubikitch -module Rcodetools - -class XMPDocFilter < XMPFilter - include ProcessParticularLine - - def initialize(opts = {}) - super - @filename = opts[:filename] - extend UseMethodAnalyzer if opts[:use_method_analyzer] - end - - def self.run(code, opts) - new(opts).doc(code, opts[:lineno], opts[:column]) - end - - def prepare_line(expr, column) - set_expr_and_postfix!(expr, column){|c| - withop_re = /^.{#{c-1}}[#{OPERATOR_CHARS}]+/ - if expr =~ withop_re - withop_re - else - /^.{#{c}}[\w#{OPERATOR_CHARS}]*/ - end - } - recv = expr - - # When expr already knows receiver and method, - return(__prepare_line :recv => expr.eval_string, :meth => expr.meth) if expr.eval_string - - case expr - when /^(?:::)?([A-Z].*)(?:::|\.)(.*)$/ # nested constants / class methods - __prepare_line :klass => $1, :meth_or_constant => $2 - when /^(?:::)?[A-Z]/ # normal constants - __prepare_line :klass => expr - when /\.([^.]*)$/ # method call - __prepare_line :recv => Regexp.last_match.pre_match, :meth => $1 - when /^(.+)(\[\]=?)$/ # [], []= - __prepare_line :recv => $1, :meth => $2 - when /[#{OPERATOR_CHARS}]+$/ # operator - __prepare_line :recv => Regexp.last_match.pre_match, :meth => $& - else # bare words - __prepare_line :recv => "self", :meth => expr - end - end - - def __prepare_line(x) - v = "#{VAR}" - result = "#{VAR}_result" - klass = "#{VAR}_klass" - flag = "#{VAR}_flag" - which_methods = "#{VAR}_methods" - ancestor_class = "#{VAR}_ancestor_class" - idx = 1 - recv = x[:recv] || x[:klass] || raise(ArgumentError, "need :recv or :klass") - meth = x[:meth_or_constant] || x[:meth] - debugprint "recv=#{recv}", "meth=#{meth}" - if meth - # imported from fastri/MagicHelp - code = <<-EOC -#{v} = (#{recv}) -$stderr.print("#{MARKER}[#{idx}] => " + #{v}.class.to_s + " ") - -if Module === #{v} and '#{meth}' =~ /^[A-Z]/ and #{v}.const_defined?('#{meth}') - #{result} = #{v}.to_s + "::#{meth}" -else - #{__magic_help_code result, v, meth.dump} -end - -$stderr.puts(#{result}) -exit - EOC - else - code = <<-EOC -#{v} = (#{recv}) -$stderr.print("#{MARKER}[#{idx}] => " + #{v}.class.to_s + " ") -$stderr.puts(#{v}.to_s) -exit - EOC - end - oneline_ize(code) - end - - # overridable by module - def _doc(code, lineno, column) - end - - def doc(code, lineno, column=nil) - _doc(code, lineno, column) or runtime_data(code, lineno, column).to_s - end - - module UseMethodAnalyzer - METHOD_ANALYSIS = "method_analysis" - def have_method_analysis - File.file? METHOD_ANALYSIS - end - - def find_method_analysis - here = Dir.pwd - oldpwd = here - begin - while ! have_method_analysis - Dir.chdir("..") - if Dir.pwd == here - return nil # not found - end - here = Dir.pwd - end - ensure - Dir.chdir oldpwd - end - yield(File.join(here, METHOD_ANALYSIS)) - end - - def _doc(code, lineno, column=nil) - find_method_analysis do |ma_file| - methods = open(ma_file, "rb"){ |f| Marshal.load(f)} - line = File.readlines(@filename)[lineno-1] - current_method = line[ /^.{#{column}}\w*/][ /\w+[\?!]?$/ ].sub(/:+/,'') - filename = @filename # FIXME - begin - methods[filename][lineno].grep(Regexp.new(Regexp.quote(current_method)))[0] - rescue NoMethodError - raise "doc/method_analyzer:cannot find #{current_method}" - end - - end - end - end - -end - -# ReFe is so-called `Japanese Ri'. -class XMPReFeFilter < XMPDocFilter - def doc(code, lineno, column=nil) - "refe '#{super}'" - end -end - -class XMPRiFilter < XMPDocFilter - def doc(code, lineno, column=nil) - "ri '#{super.sub(/\./, '::')}'" - end -end - -class XMPRiEmacsFilter < XMPDocFilter - def doc(code, lineno, column=nil) - begin - %!(rct-find-tag-or-ri "#{super}")! - rescue Exception => err - return %Q[(error "#{err.message}")] - end - end -end - -class XMPRiVimFilter < XMPDocFilter - def doc(code, lineno, column=nil) - begin - %{call RCT_find_tag_or_ri("#{super}")} - rescue Exception => err - return %Q[echo #{err.message.inspect}] - end - end -end - -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/fork.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/fork.rb deleted file mode 100644 index 87fc2645c..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/fork.rb +++ /dev/null @@ -1,210 +0,0 @@ -## Rcodetools version of ruby_fork -# -# Based on ruby_fork.rb by Ryan Davis, Eric Hodel, Zen Spider Software -# -# (The MIT License) -# -# Copyright (c) 2006 Ryan Davis, Eric Hodel, Zen Spider Software -# 2007 rubikitch -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -require 'optparse' -require 'socket' -require 'rcodetools/fork_config' - -module Rcodetools -module Fork - - USAGE_HELP = < [], - :code => [], - :extra_paths => [], - :port => PORT, - } - - def self.add_env_args(opts, settings) - opts.separator '' - opts.separator 'Process environment options:' - - opts.separator '' - opts.on('-e CODE', 'Execute CODE in parent process.', - 'May be specified multiple times.') do |code| - settings[:code] << code - end - - opts.separator '' - opts.on('-I DIRECTORY', 'Adds DIRECTORY to $LOAD_PATH.', - 'May be specified multiple times.') do |dir| - settings[:extra_paths] << dir - end - - opts.separator '' - opts.on('-r LIBRARY', 'Require LIBRARY in the parent process.', - 'May be specified multiple times.') do |lib| - settings[:requires] << lib - end - end - - def self.parse_client_args(args) - settings = Marshal.load Marshal.dump(DEFAULT_SETTINGS) - - opts = OptionParser.new do |opts| - opts.banner = "Usage: #{$0} [options]\n#{USAGE_HELP}" - - opts.separator '' - opts.on('-p', '--port PORT', - 'Listen for connections on PORT.', - "Default: #{settings[:port]}") do |port| - settings[:port] = port.to_i - end - - opts.separator '' - opts.on('-h', '--help', 'You\'re looking at it.') do - $stderr.puts opts - exit 1 - end - - add_env_args opts, settings - end - - opts.parse! args - - return settings - end - - def self.parse_server_args(args) - settings = Marshal.load Marshal.dump(DEFAULT_SETTINGS) - - opts = OptionParser.new do |opts| - opts.banner = "Usage: #{$0} [options]\n#{USAGE_HELP}" - - opts.separator '' - opts.on('-p', '--port PORT', - 'Listen for connections on PORT.', - "Default: #{settings[:port]}") do |port| - settings[:port] = port.to_i - end - - opts.separator '' - opts.on('-h', '--help', 'You\'re looking at it.') do - $stderr.puts opts - exit 1 - end - - add_env_args opts, settings - end - - opts.parse! args - - return settings - end - - def self.start_client(args = ARGV) - trap 'INT' do exit 1 end # Exit gracefully - - settings = parse_client_args args - - args = Marshal.dump [settings, ARGV] - - socket = TCPSocket.new 'localhost', settings[:port] - - socket.puts args.length - socket.write args - socket.close_write - end - - def self.start_server(args = ARGV) - begin - require 'rubygems' - rescue LoadError - end - write_pwd - settings = parse_server_args args - setup_environment settings - - server = TCPServer.new 'localhost', settings[:port] - - $stderr.puts "#{$0} Running as PID #{$$} on #{settings[:port]}" - - loop do - Thread.new server.accept do |socket| - begin - args_length = socket.gets.to_i - args = socket.read args_length - settings, argv = Marshal.load args - fork do - ARGV.replace argv - setup_environment settings - socket.close - end - socket.close # close my copy. - rescue => e - socket.close if socket - end - end - end - rescue Interrupt, SystemExit - File.unlink PWD_FILE - rescue Exception => e - File.unlink PWD_FILE - puts "Failed to catch #{e.class}:#{e.message}" - puts "\t#{e.backtrace.join "\n\t"}" - end - - def self.setup_environment(settings) - settings[:extra_paths].map! { |dir| dir.split ':' } - settings[:extra_paths].flatten! - settings[:extra_paths].each { |dir| $:.unshift dir } - - begin - settings[:requires].each { |file| require file } - settings[:code].each { |code| eval code, TOPLEVEL_BINDING } - rescue Exception - $@.reject! {|s| s =~ %r!rcodetools/fork\.rb!} - raise - end - end - -end - -end - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/fork_config.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/fork_config.rb deleted file mode 100644 index e22b4cd1f..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/fork_config.rb +++ /dev/null @@ -1,26 +0,0 @@ - -module Rcodetools - -module Fork - PORT = 9085 - # Contains $PWD of rct-fork server. Exists only while running. - PWD_FILE = File.expand_path "~/.rct-fork.pwd" - - def self.chdir_fork_directory - if run? - Dir.chdir File.read(PWD_FILE) - else - raise "rct-fork is not running." - end - end - - def self.write_pwd - open(PWD_FILE, "w"){|f| f.print Dir.pwd } - end - - def self.run? - File.file? PWD_FILE - end -end - -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/options.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/options.rb deleted file mode 100644 index 8ba920986..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/options.rb +++ /dev/null @@ -1,136 +0,0 @@ -require 'optparse' - -module Rcodetools -# Domain specific OptionParser extensions -module OptionHandler - def set_banner - self.banner = "Usage: #{$0} [options] [inputfile] [-- cmdline args]" - end - - def handle_position(options) - separator "" - separator "Position options:" - on("--line=LINE", "Current line number.") do |n| - options[:lineno] = n.to_i - end - on("--column=COLUMN", "Current column number in BYTE.") do |n| - options[:column] = n.to_i - end - on("-t TEST", "--test=TEST", - "Execute test script. ", - "TEST is TESTSCRIPT, TESTSCRIPT@TESTMETHOD, or TESTSCRIPT@LINENO.", - "You must specify --filename option.") do |t| - options[:test_script], options[:test_method] = t.split(/@/) - end - on("--filename=FILENAME", "Filename of standard input.") do |f| - options[:filename] = f - end - end - - def handle_interpreter(options) - separator "" - separator "Interpreter options:" - on("-S FILE", "--interpreter FILE", "Use interpreter FILE.") do |interpreter| - options[:interpreter] = interpreter - end - on("-I PATH", "Add PATH to $LOAD_PATH") do |path| - options[:include_paths] << path - end - on("--dev", "Add this project's bin/ and lib/ to $LOAD_PATH.", - "A directory with a Rakefile is considered a project base directory.") do - auto_include_paths(options[:include_paths], Dir.pwd) - end - on("-r LIB", "Require LIB before execution.") do |lib| - options[:libs] << lib - end - on("-e EXPR", "--eval=EXPR", "--stub=EXPR", "Evaluate EXPR after execution.") do |expr| - options[:evals] << expr - end - on("--fork", "Use rct-fork-client if rct-fork is running.") do - options[:detect_rct_fork] = true - end - on("--rbtest", "Use rbtest.") do - options[:use_rbtest] = true - end - on("--detect-rbtest", "Use rbtest if '=begin test_*' blocks exist.") do - options[:detect_rbtest] = true - end - end - - def handle_misc(options) - separator "" - separator "Misc options:" - on("--cd DIR", "Change working directory to DIR.") do |dir| - options[:wd] = dir - end - on("--debug", "Write transformed source code to xmp-tmp.PID.rb.") do - options[:dump] = "xmp-tmp.#{Process.pid}.rb" - end - on("--tmpfile", "--tempfile", "Use tmpfile instead of open3. (non-windows)") do - options[:execute_ruby_tmpfile] = true - end - on("-w N", "--width N", Integer, "Set width of multi-line annotation. (xmpfilter only)") do |width| - options[:width] = width - end - separator "" - on("-h", "--help", "Show this message") do - puts self - exit - end - on("-v", "--version", "Show version information") do - puts "#{File.basename($0)} #{XMPFilter::VERSION}" - exit - end - end - - def auto_include_paths(include_paths, pwd) - if pwd =~ %r!^(.+)/(lib|bin)! - include_paths.unshift("#$1/lib").unshift("#$1/bin") - elsif File.file? "#{pwd}/Rakefile" or File.file? "#{pwd}/rakefile" - include_paths.unshift("#{pwd}/lib").unshift("#{pwd}/bin") - end - end - module_function :auto_include_paths - -end - -def set_extra_opts(options) - if idx = ARGV.index("--") - options[:options] = ARGV[idx+1..-1] - ARGV.replace ARGV[0...idx] - else - options[:options] = [] - end -end - -def check_opts(options) - if options[:test_script] - unless options[:filename] - $stderr.puts "You must specify --filename as well as -t(--test)." - exit 1 - end - end -end - -DEFAULT_OPTIONS = { - :interpreter => "ruby", - :options => ["hoge"], - :min_codeline_size => 50, - :width => 79, - :libs => [], - :evals => [], - :include_paths => [], - :dump => nil, - :wd => nil, - :warnings => true, - :use_parentheses => true, - :column => nil, - :output_stdout => true, - :test_script => nil, - :test_method => nil, - :detect_rct_fork => false, - :use_rbtest => false, - :detect_rbtest => false, - :execute_ruby_tmpfile => false, - } -end # /Rcodetools diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/xmpfilter.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/xmpfilter.rb deleted file mode 100755 index a174b5180..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/xmpfilter.rb +++ /dev/null @@ -1,379 +0,0 @@ -#!/usr/bin/env ruby -# Copyright (c) 2005-2008 Mauricio Fernandez http://eigenclass.org -# rubikitch -# Use and distribution subject to the terms of the Ruby license. - -# This is needed regexps cannot match with invalid-encoding strings. -# xmpfilter is unaware of script encoding. -Encoding.default_external = "ASCII-8BIT" if RUBY_VERSION >= "1.9" - -ENV['HOME'] ||= "#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}" -require 'rcodetools/fork_config' -require 'rcodetools/compat' -require 'tmpdir' - -module Rcodetools - -class XMPFilter - VERSION = "0.8.7" - - MARKER = "!XMP#{Time.new.to_i}_#{Process.pid}_#{rand(1000000)}!" - XMP_RE = Regexp.new("^" + Regexp.escape(MARKER) + '\[([0-9]+)\] (=>|~>|==>) (.*)') - VAR = "_xmp_#{Time.new.to_i}_#{Process.pid}_#{rand(1000000)}" - WARNING_RE = /.*:([0-9]+): warning: (.*)/ - - RuntimeData = Struct.new(:results, :exceptions, :bindings) - - INITIALIZE_OPTS = {:interpreter => "ruby", :options => [], :libs => [], - :include_paths => [], :warnings => true, - :use_parentheses => true} - - def windows? - /win|mingw/ =~ RUBY_PLATFORM && /darwin/ !~ RUBY_PLATFORM - end - - Interpreter = Struct.new(:options, :execute_method, :accept_debug, :accept_include_paths, :chdir_proc) - INTERPRETER_RUBY = Interpreter.new(["-w"], - :execute_ruby, true, true, nil) - INTERPRETER_RBTEST = Interpreter.new(["-S", "rbtest"], - :execute_script, false, false, nil) - INTERPRETER_FORK = Interpreter.new(["-S", "rct-fork-client"], - :execute_tmpfile, false, true, - lambda { Fork::chdir_fork_directory }) - - def self.detect_rbtest(code, opts) - opts[:use_rbtest] ||= (opts[:detect_rbtest] and code =~ /^=begin test./) ? true : false - end - - # The processor (overridable) - def self.run(code, opts) - new(opts).annotate(code) - end - - def initialize(opts = {}) - options = INITIALIZE_OPTS.merge opts - @interpreter_info = INTERPRETER_RUBY - @interpreter = options[:interpreter] - @options = options[:options] - @libs = options[:libs] - @evals = options[:evals] || [] - @include_paths = options[:include_paths] - @output_stdout = options[:output_stdout] - @dump = options[:dump] - @warnings = options[:warnings] - @parentheses = options[:use_parentheses] - @ignore_NoMethodError = options[:ignore_NoMethodError] - test_script = options[:test_script] - test_method = options[:test_method] - filename = options[:filename] - @execute_ruby_tmpfile = options[:execute_ruby_tmpfile] - @postfix = "" - @stdin_path = nil - @width = options[:width] - - initialize_rct_fork if options[:detect_rct_fork] - initialize_rbtest if options[:use_rbtest] - initialize_for_test_script test_script, test_method, filename if test_script and !options[:use_rbtest] - end - - def initialize_rct_fork - if Fork::run? - @interpreter_info = INTERPRETER_FORK - end - end - - def initialize_rbtest - @interpreter_info = INTERPRETER_RBTEST - end - - def initialize_for_test_script(test_script, test_method, filename) - test_script.replace File.expand_path(test_script) - filename.replace File.expand_path(filename) - unless test_script == filename - basedir = common_path(test_script, filename) - relative_filename = filename[basedir.length+1 .. -1].sub(%r!^lib/!, '') - @evals << %Q!$LOADED_FEATURES << #{relative_filename.dump}! - @evals << safe_require_code('test/unit') - @evals << %Q!load #{test_script.dump}! - end - test_method = get_test_method_from_lineno(test_script, test_method.to_i) if test_method =~ /^\d/ - @evals << %Q!Test::Unit::AutoRunner.run(false, nil, ["-n", #{test_method.dump}])! if test_method - end - - def get_test_method_from_lineno(filename, lineno) - lines = File.readlines(filename) - (lineno-1).downto(0) do |i| - if lines[i] =~ /^ *def *(test_[A-Za-z0-9?!_]+)$/ - return $1 - end - end - nil - end - - def common_path(a, b) - (a.split(File::Separator) & b.split(File::Separator)).join(File::Separator) - end - - def add_markers(code, min_codeline_size = 50) - maxlen = code.map{|x| x.size}.max - maxlen = [min_codeline_size, maxlen + 2].max - ret = "" - code.each do |l| - l = l.chomp.gsub(/ # (=>|!>).*/, "").gsub(/\s*$/, "") - ret << (l + " " * (maxlen - l.size) + " # =>\n") - end - ret - end - - SINGLE_LINE_RE = /^(?!(?:\s+|(?:\s*#.+)?)# ?=>)(.*) # ?=>.*/ - MULTI_LINE_RE = /^(.*)\n(( *)# ?=>.*(?:\n|\z))(?: *# .*\n)*/ - def annotate(code) - idx = 0 - code = code.gsub(/ # !>.*/, '') - newcode = code.gsub(SINGLE_LINE_RE){ prepare_line($1, idx += 1) } - newcode.gsub!(MULTI_LINE_RE){ prepare_line($1, idx += 1, true)} - File.open(@dump, "w"){|f| f.puts newcode} if @dump - execute(newcode) do |stdout, stderr| - output = stderr.readlines - runtime_data = extract_data(output) - idx = 0 - annotated = code.gsub(SINGLE_LINE_RE) { |l| - expr = $1 - if /^\s*#/ =~ l - l - else - annotated_line(l, expr, runtime_data, idx += 1) - end - } - annotated.gsub!(/ # !>.*/, '') - annotated.gsub!(/# (>>|~>)[^\n]*\n/m, ""); - annotated.gsub!(MULTI_LINE_RE) { |l| - annotated_multi_line(l, $1, $3, runtime_data, idx += 1) - } - ret = final_decoration(annotated, output) - if @output_stdout and (s = stdout.read) != "" - ret << s.inject(""){|s,line| s + "# >> #{line}".chomp + "\n" } - end - ret - end - end - - def annotated_line(line, expression, runtime_data, idx) - "#{expression} # => " + (runtime_data.results[idx].map{|x| x[1]} || []).join(", ") - end - - def annotated_multi_line(line, expression, indent, runtime_data, idx) - pretty = (runtime_data.results[idx].map{|x| x[1]} || []).join(", ") - first, *rest = pretty.to_a - rest.inject("#{expression}\n#{indent}# => #{first || "\n"}") {|s, l| s << "#{indent}# " << l } - end - - def prepare_line_annotation(expr, idx, multi_line=false) - v = "#{VAR}" - blocal = "__#{VAR}" - blocal2 = "___#{VAR}" - lastmatch = "____#{VAR}" - if multi_line - pp = safe_require_code "pp" - result = "((begin; #{lastmatch} = $~; PP.pp(#{v}, '', #{@width-5}).gsub(/\\r?\\n/, 'PPPROTECT'); ensure; $~ = #{lastmatch} end))" - else - pp = '' - result = "#{v}.inspect" - end - oneline_ize(<<-EOF).chomp -#{pp} -#{v} = (#{expr}) -$stderr.puts("#{MARKER}[#{idx}] => " + #{v}.class.to_s + " " + #{result}) || begin - $stderr.puts local_variables - local_variables.each{|#{blocal}| - #{blocal2} = eval(#{blocal}) - if #{v} == #{blocal2} && #{blocal} != %#{expr}.strip - $stderr.puts("#{MARKER}[#{idx}] ==> " + #{blocal}) - elsif [#{blocal2}] == #{v} - $stderr.puts("#{MARKER}[#{idx}] ==> [" + #{blocal} + "]") - end - } - nil -rescue Exception - nil -end || #{v} - EOF - - end - alias_method :prepare_line, :prepare_line_annotation - - def safe_require_code(lib) - oldverbose = "$#{VAR}_old_verbose" - "#{oldverbose} = $VERBOSE; $VERBOSE = false; require '#{lib}'; $VERBOSE = #{oldverbose}" - end - private :safe_require_code - - def execute_ruby(code) - meth = (windows? or @execute_ruby_tmpfile) ? :execute_tmpfile : :execute_popen - __send__ meth, code - end - - def split_shbang(script) - ary = script.each_line.to_a - if ary[0] =~ /^#!/ and ary[1] =~ /^#.*coding/ - [ary[0..1], ary[2..-1]] - elsif ary[0] =~ /^#!|^#.*coding/ - [[ary[0]], ary[1..-1]] - else - [[], ary] - end - end - private :split_shbang - - def execute_tmpfile(code) - ios = %w[_ stdin stdout stderr] - stdin, stdout, stderr = (1..3).map do |i| - fname = if $DEBUG - "xmpfilter.tmpfile_#{ios[i]}.rb" - else - "xmpfilter.tmpfile_#{Process.pid}-#{i}.rb" - end - f = File.open(fname, "w+") - f - end - # stdin.puts code - # stdin.close - shbang_magic_comment, rest = split_shbang(code) - @stdin_path = File.expand_path stdin.path - stdin.print shbang_magic_comment - stdin.print <<-EOF.map{|l| l.strip}.join(";") - $stdout.reopen('#{File.expand_path(stdout.path)}', 'w') - $stderr.reopen('#{File.expand_path(stderr.path)}', 'w') - $0 = '#{File.expand_path(stdin.path)}' - ARGV.replace(#{@options.inspect}) - END { #{@evals.join(";")} } - EOF - stdin.print ";#{rest}" - - debugprint "execute command = #{(interpreter_command << stdin.path).join ' '}" - stdin.close - oldpwd = Dir.pwd - @interpreter_info.chdir_proc and @interpreter_info.chdir_proc.call - system(*(interpreter_command << stdin.path)) - Dir.chdir oldpwd - [stdout, stderr] - end - - def execute_popen(code) - require 'open3' - stdin, stdout, stderr = Open3::popen3(*interpreter_command) - stdin.puts code - @evals.each{|x| stdin.puts x } unless @evals.empty? - stdin.close - [stdout, stderr] - end - - def execute_script(code) - path = File.expand_path("xmpfilter.tmpfile_#{Process.pid}.rb", Dir.tmpdir) - File.open(path, "w"){|f| f.puts code} - at_exit { File.unlink path if File.exist? path} - stdout_path, stderr_path = (1..2).map do |i| - fname = "xmpfilter.tmpfile_#{Process.pid}-#{i}.rb" - File.expand_path(fname, Dir.tmpdir) - end - args = *(interpreter_command << %["#{path}"] << "2>" << - %["#{stderr_path}"] << ">" << %["#{stdout_path}"]) - system(args.join(" ")) - - [stdout_path, stderr_path].map do |fullname| - f = File.open(fullname, "r") - # at_exit { - # f.close unless f.closed? - # File.unlink fullname if File.exist? fullname - # } - f - end - end - - def execute(code) - stdout, stderr = __send__ @interpreter_info.execute_method, code - if block_given? - begin - yield stdout, stderr - ensure - for out in [stdout, stderr] - path = out.path rescue nil - out.close -# File.unlink path if path - end - end - else - [stdout, stderr] - end - end - - def interpreter_command - # BUG interpreter option arguments containing space are not - # accepted. But it seems to be rare case. - r = @interpreter.split + @interpreter_info.options - r << "-d" if $DEBUG and @interpreter_info.accept_debug - r << "-I#{@include_paths.join(":")}" if @interpreter_info.accept_include_paths and !@include_paths.empty? - @libs.each{|x| r << "-r#{x}" } unless @libs.empty? - (r << "-").concat @options unless @options.empty? - r - end - - def extract_data(output) - results = Hash.new{|h,k| h[k] = []} - exceptions = Hash.new{|h,k| h[k] = []} - bindings = Hash.new{|h,k| h[k] = []} - output.grep(XMP_RE).each do |line| - result_id, op, result = XMP_RE.match(line).captures - case op - when "=>" - klass, value = /(\S+)\s+(.*)/.match(result).captures - results[result_id.to_i] << [klass, value.gsub(/PPPROTECT/, "\n")] - when "~>" - exceptions[result_id.to_i] << result - when "==>" - bindings[result_id.to_i] << result unless result.index(VAR) - end - end - RuntimeData.new(results, exceptions, bindings) - end - - def final_decoration(code, output) - warnings = {} - output.join.grep(WARNING_RE).map do |x| - md = WARNING_RE.match(x) - warnings[md[1].to_i] = md[2] - end - idx = 0 - ret = code.map do |line| - w = warnings[idx+=1] - if @warnings - w ? (line.chomp + " # !> #{w}") : line - else - line - end - end - output = output.reject{|x| /^-:[0-9]+: warning/.match(x)} - if exception = /^-e?:[0-9]+:.*|^(?!!XMP)[^\n]+:[0-9]+:in .*/m.match(output.join) - err = exception[0] - err.gsub!(Regexp.union(@stdin_path), '-') if @stdin_path - ret << err.map{|line| "# ~> " + line } - end - ret - end - - def oneline_ize(code) - "((" + code.gsub(/\r?\n|\r/, ';') + "));#{@postfix}\n" - end - - def debugprint(*args) - $stderr.puts(*args) if $DEBUG - end -end # clas XMPFilter - -class XMPAddMarkers < XMPFilter - def self.run(code, opts) - new(opts).add_markers(code, opts[:min_codeline_size]) - end -end - -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/xmptestunitfilter.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/xmptestunitfilter.rb deleted file mode 100644 index e3fe395f2..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/lib/rcodetools/xmptestunitfilter.rb +++ /dev/null @@ -1,314 +0,0 @@ -require 'rcodetools/xmpfilter' - -module Rcodetools - -FLOAT_TOLERANCE = 0.0001 -class XMPTestUnitFilter < XMPFilter - def initialize(opts = {}) - super - @output_stdout = false - mod = @parentheses ? :WithParentheses : :Poetry - extend self.class.const_get(mod) unless opts[:_no_extend_module] - end - - private - def annotated_line(line, expression, runtime_data, idx) - indent = /^\s*/.match(line)[0] - assertions(expression.strip, runtime_data, idx).map{|x| indent + x}.join("\n") - end - - def prepare_line(expr, idx) - basic_eval = prepare_line_annotation(expr, idx) - %|begin; #{basic_eval}; rescue Exception; $stderr.puts("#{MARKER}[#{idx}] ~> " + $!.class.to_s); end| - end - - def assertions(expression, runtime_data, index) - exceptions = runtime_data.exceptions - ret = [] - - unless (vars = runtime_data.bindings[index]).empty? - vars.each{|var| ret << equal_assertion(var, expression) } - end - if !(wanted = runtime_data.results[index]).empty? || !exceptions[index] - case (wanted[0][1] rescue 1) - when "nil" - ret.concat nil_assertion(expression) - else - case wanted.size - when 1 - ret.concat _value_assertions(wanted[0], expression) - else - # discard values from multiple runs - ret.concat(["#xmpfilter: WARNING!! extra values ignored"] + - _value_assertions(wanted[0], expression)) - end - end - else - ret.concat raise_assertion(expression, exceptions, index) - end - - ret - end - - OTHER = Class.new - def _value_assertions(klass_value_txt_pair, expression) - klass_txt, value_txt = klass_value_txt_pair - value = eval(value_txt) || OTHER.new - # special cases - value = nil if value_txt.strip == "nil" - value = false if value_txt.strip == "false" - value_assertions klass_txt, value_txt, value, expression - rescue Exception - return object_assertions(klass_txt, value_txt, expression) - end - - def raise_assertion(expression, exceptions, index) - ["assert_raise(#{exceptions[index][0]}){#{expression}}"] - end - - module WithParentheses - def nil_assertion(expression) - ["assert_nil(#{expression})"] - end - - def value_assertions(klass_txt, value_txt, value, expression) - case value - when Float - ["assert_in_delta(#{value.inspect}, #{expression}, #{FLOAT_TOLERANCE})"] - when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass - ["assert_equal(#{value_txt}, #{expression})"] - else - object_assertions(klass_txt, value_txt, expression) - end - end - - def object_assertions(klass_txt, value_txt, expression) - [ "assert_kind_of(#{klass_txt}, #{expression})", - "assert_equal(#{value_txt.inspect}, #{expression}.inspect)" ] - end - - def equal_assertion(expected, actual) - "assert_equal(#{expected}, #{actual})" - end - end - - module Poetry - def nil_assertion(expression) - ["assert_nil #{expression}"] - end - - def value_assertions(klass_txt, value_txt, value, expression) - case value - when Float - ["assert_in_delta #{value.inspect}, #{expression}, #{FLOAT_TOLERANCE}"] - when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass - ["assert_equal #{value_txt}, #{expression}"] - else - object_assertions klass_txt, value_txt, expression - end - end - - def object_assertions(klass_txt, value_txt, expression) - [ "assert_kind_of #{klass_txt}, #{expression} ", - "assert_equal #{value_txt.inspect}, #{expression}.inspect" ] - end - - def equal_assertion(expected, actual) - "assert_equal #{expected}, #{actual}" - end - end -end - -class XMPRSpecFilter < XMPTestUnitFilter - def initialize(x={}) - super(x.merge(:_no_extend_module => true)) - load_rspec - specver = (Spec::VERSION::STRING rescue "1.0.0") - api_module = specver >= "0.8.0" ? NewAPI : OldAPI - @interpreter_info.execute_method = :execute_script - mod = @parentheses ? :WithParentheses : :Poetry - extend api_module.const_get(mod) - extend api_module - end - - private - def load_rspec - begin - require 'spec/version' - rescue LoadError - require 'rubygems' - begin - require 'spec/version' - rescue LoadError # if rspec isn't available, use most recent conventions - end - end - end - -# alias :execute :execute_script - - def interpreter_command - [@interpreter] + @libs.map{|x| "-r#{x}"} - end - - module NewAPI - def raise_assertion(expression, exceptions, index) - ["lambda{#{expression}}.should raise_error(#{exceptions[index][0]})"] - end - - module WithParentheses - def nil_assertion(expression) - ["(#{expression}).should be_nil"] - end - - def value_assertions(klass_txt, value_txt, value, expression) - case value - when Float - ["(#{expression}).should be_close(#{value.inspect}, #{FLOAT_TOLERANCE})"] - when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass - ["(#{expression}).should == (#{value_txt})"] - else - object_assertions klass_txt, value_txt, expression - end - end - - def object_assertions(klass_txt, value_txt, expression) - [ "(#{expression}).should be_a_kind_of(#{klass_txt})", - "(#{expression}.inspect).should == (#{value_txt.inspect})" ] - end - - def equal_assertion(expected, actual) - "(#{actual}).should == (#{expected})" - end - end - - module Poetry - def nil_assertion(expression) - ["#{expression}.should be_nil"] - end - - def value_assertions(klass_txt, value_txt, value, expression) - case value - when Float - ["#{expression}.should be_close(#{value.inspect}, #{FLOAT_TOLERANCE})"] - when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass - ["#{expression}.should == #{value_txt}"] - else - object_assertions klass_txt, value_txt, expression - end - end - - def object_assertions(klass_txt, value_txt, expression) - [ "#{expression}.should be_a_kind_of(#{klass_txt})", - "#{expression}.inspect.should == #{value_txt.inspect}" ] - end - - def equal_assertion(expected, actual) - "#{actual}.should == #{expected}" - end - end - end - - module OldAPI - # old rspec, use deprecated syntax - def raise_assertion(expression, exceptions, index) - ["lambda{#{expression}}.should_raise_error(#{exceptions[index][0]})"] - end - - module WithParentheses - def nil_assertion(expression) - ["(#{expression}).should_be_nil"] - end - - def value_assertions(klass_txt, value_txt, value, expression) - case value - when Float - ["(#{expression}).should_be_close(#{value.inspect}, #{FLOAT_TOLERANCE})"] - when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass - ["(#{expression}).should_equal(#{value_txt})"] - else - object_assertions klass_txt, value_txt, expression - end - end - - def object_assertions(klass_txt, value_txt, expression) - [ "(#{expression}).should_be_a_kind_of(#{klass_txt})", - "(#{expression}.inspect).should_equal(#{value_txt.inspect})" ] - end - - def equal_assertion(expected, actual) - "(#{actual}).should_equal(#{expected})" - end - end - - module Poetry - def nil_assertion(expression) - ["#{expression}.should_be_nil"] - end - - def value_assertions(klass_txt, value_txt, value, expression) - case value - when Float - ["#{expression}.should_be_close #{value.inspect}, #{FLOAT_TOLERANCE}"] - when Numeric, String, Hash, Array, Regexp, TrueClass, FalseClass, Symbol, NilClass - ["#{expression}.should_equal #{value_txt}"] - else - object_assertions klass_txt, value_txt, expression - end - end - - def object_assertions(klass_txt, value_txt, expression) - [ "#{expression}.should_be_a_kind_of #{klass_txt}", - "#{expression}.inspect.should_equal #{value_txt.inspect}" ] - end - - def equal_assertion(expected, actual) - "#{actual}.should_equal #{expected}" - end - end - end - - -end - -class XMPExpectationsFilter < XMPTestUnitFilter - def initialize(x={}) - super(x.merge(:_no_extend_module => true)) - @warnings = false - end - - def expectation(expected, actual) - < 'unit', 'controllers' => 'functional' } - RAILS_TESTNAME2MVC = RAILS_MVC2TESTNAME.invert - def test_file_00_rails(implementation, basedir, dir, node) # rails - if m = %r!app/(models|controllers)/(.+)\.rb$!.match(implementation) - "%stest/%s/%s_test.rb" % [ m.pre_match, RAILS_MVC2TESTNAME[m[1]], m[2] ] - end - end - - def test_file_05_rails_lib(implementation, basedir, dir, node) - if basedir and File.directory?( File.join(basedir, "app") ) - "#{basedir}test/unit/test_#{node}.rb" - end - end - - def test_file_10_no_match(implementation, basedir, dir, node) - if [basedir, dir, node].all?{|x| x.nil?} - "#{File.dirname(implementation)}/test_#{File.basename(implementation)}" - end - end - - def test_file_20_simple(implementation, basedir, dir, node) # test/test_NODE.rb - exist "#{basedir}test/test_#{node}.rb" - end - - def test_file_30_flat(implementation, basedir, dir, node) # lib/XXX/NODE.rb -> test/test_NODE.rb - exist "#{basedir}test/test_#{node}.rb" if dir - end - - def test_file_99_autotest_default(implementation, basedir, dir, node) # lib/XXX/NODE.rb -> test/XXX/test_NODE.rb - "#{basedir}test/#{dir}test_#{node}.rb" - end - - def implementation_file_00_rails(test, basedir, dir, node) - if m = %r!test/(unit|functional)/(.+)_test.rb$!.match(test) - "%sapp/%s/%s.rb" % [ m.pre_match, RAILS_TESTNAME2MVC[m[1]], m[2] ] - end - end - - def implementation_file_10_no_match(test, basename, dir, node) - if dir == nil and node == nil and test =~ %r!/test_(.+)\.rb$! - test.sub("/test_", "/") - end - end - - def implementation_file_20(test, basedir, dir, node) - exist("#{basedir}lib/#{dir}#{node}.rb") - end - - def implementation_file_30_flat(test, basedir, dir, node) - Dir[ "#{basedir}lib/**/#{node}.rb" ].first - end - - def implementation_file_99_default(test, basedir, dir, node) - "#{basedir}lib/#{dir}#{node}.rb" - end - -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/license.txt b/bundles/ruby.tmbundle/Support/vendor/rcodetools/license.txt deleted file mode 100644 index e2eb45cde..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/license.txt +++ /dev/null @@ -1,8 +0,0 @@ - - rcodetools http://eigenclass.org/hiki.rb?rcodetools - Copyright (c) 2005-2007 Mauricio Fernandez http://eigenclass.org - Copyright (c) 2006-2008 rubikitch http://www.rubyist.net/~rubikitch/ -Use and distribution subject to the terms of the Ruby license. - -= License -rcodetools is licensed under the same terms as Ruby. diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.el b/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.el deleted file mode 100644 index e5c90af96..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.el +++ /dev/null @@ -1,430 +0,0 @@ -;;; rcodetools.el -- annotation / accurate completion / browsing documentation - -;;; Copyright (c) 2006-2008 rubikitch -;;; -;;; Use and distribution subject to the terms of the Ruby license. - -(defvar xmpfilter-command-name "ruby -S xmpfilter --dev --fork --detect-rbtest" - "The xmpfilter command name.") -(defvar rct-doc-command-name "ruby -S rct-doc --dev --fork --detect-rbtest" - "The rct-doc command name.") -(defvar rct-complete-command-name "ruby -S rct-complete --dev --fork --detect-rbtest" - "The rct-complete command name.") -(defvar ruby-toggle-file-command-name "ruby -S ruby-toggle-file" - "The ruby-toggle-file command name.") -(defvar rct-fork-command-name "ruby -S rct-fork") -(defvar rct-option-history nil) ;internal -(defvar rct-option-local nil) ;internal -(make-variable-buffer-local 'rct-option-local) -(defvar rct-debug nil - "If non-nil, output debug message into *Messages*.") -;; (setq rct-debug t) - -(defadvice comment-dwim (around rct-hack activate) - "If comment-dwim is successively called, add => mark." - (if (and (eq major-mode 'ruby-mode) - (eq last-command 'comment-dwim) - ;; TODO =>check - ) - (insert "=>") - ad-do-it)) -;; To remove this advice. -;; (progn (ad-disable-advice 'comment-dwim 'around 'rct-hack) (ad-update 'comment-dwim)) - -(defun rct-current-line () - "Return the vertical position of point..." - (+ (count-lines (point-min) (point)) - (if (= (current-column) 0) 1 0))) - -(defun rct-save-position (proc) - "Evaluate proc with saving current-line/current-column/window-start." - (let ((line (rct-current-line)) - (col (current-column)) - (wstart (window-start))) - (funcall proc) - (goto-char (point-min)) - (forward-line (1- line)) - (move-to-column col) - (set-window-start (selected-window) wstart))) - -(defun rct-interactive () - "All the rcodetools-related commands with prefix args read rcodetools' common option. And store option into buffer-local variable." - (list - (let ((option (or rct-option-local ""))) - (if current-prefix-arg - (setq rct-option-local - (read-from-minibuffer "rcodetools option: " option nil nil 'rct-option-history)) - option)))) - -(defun rct-shell-command (command &optional buffer) - "Replacement for `(shell-command-on-region (point-min) (point-max) command buffer t' because of encoding problem." - (let ((input-rb (concat (make-temp-name "xmptmp-in") ".rb")) - (output-rb (concat (make-temp-name "xmptmp-out") ".rb")) - (coding-system-for-read buffer-file-coding-system)) - (write-region (point-min) (point-max) input-rb nil 'nodisp) - (shell-command - (rct-debuglog (format "%s %s > %s" command input-rb output-rb)) - t " *rct-error*") - (with-current-buffer (or buffer (current-buffer)) - (insert-file-contents output-rb nil nil nil t)) - (delete-file input-rb) - (delete-file output-rb))) - -(defvar xmpfilter-command-function 'xmpfilter-command) -(defun xmp (&optional option) - "Run xmpfilter for annotation/test/spec on whole buffer. -See also `rct-interactive'. " - (interactive (rct-interactive)) - (rct-save-position - (lambda () - (rct-shell-command (funcall xmpfilter-command-function option))))) - -(defun xmpfilter-command (&optional option) - "The xmpfilter command line, DWIM." - (setq option (or option "")) - (flet ((in-block (beg-re) - (save-excursion - (goto-char (point-min)) - (when (re-search-forward beg-re nil t) - (let ((s (point)) e) - (when (re-search-forward "^end\n" nil t) - (setq e (point)) - (goto-char s) - (re-search-forward "# => *$" e t))))))) - (cond ((in-block "^class.+< Test::Unit::TestCase$") - (format "%s --unittest %s" xmpfilter-command-name option)) - ((in-block "^\\(describe\\|context\\).+do$") - (format "%s --spec %s" xmpfilter-command-name option)) - (t - (format "%s %s" xmpfilter-command-name option))))) - -;;;; Completion -(defvar rct-method-completion-table nil) ;internal -(defvar rct-complete-symbol-function 'rct-complete-symbol--normal - "Function to use rct-complete-symbol.") -;; (setq rct-complete-symbol-function 'rct-complete-symbol--icicles) -(defvar rct-use-test-script t - "Whether rct-complete/rct-doc use test scripts.") - -(defun rct-complete-symbol (&optional option) - "Perform ruby method and class completion on the text around point. -This command only calls a function according to `rct-complete-symbol-function'. -See also `rct-interactive', `rct-complete-symbol--normal', and `rct-complete-symbol--icicles'." - (interactive (rct-interactive)) - (call-interactively rct-complete-symbol-function)) - -(defun rct-complete-symbol--normal (&optional option) - "Perform ruby method and class completion on the text around point. -See also `rct-interactive'." - (interactive (rct-interactive)) - (let ((end (point)) beg - pattern alist - completion) - (setq completion (rct-try-completion)) ; set also pattern / completion - (save-excursion - (search-backward pattern) - (setq beg (point))) - (cond ((eq completion t) ;sole completion - (message "%s" "Sole completion")) - ((null completion) ;no completions - (message "Can't find completion for \"%s\"" pattern) - (ding)) - ((not (string= pattern completion)) ;partial completion - (delete-region beg end) ;delete word - (insert completion) - (message "")) - (t - (message "Making completion list...") - (with-output-to-temp-buffer "*Completions*" - (display-completion-list - (all-completions pattern alist))) - (message "Making completion list...%s" "done"))))) - -;; (define-key ruby-mode-map "\M-\C-i" 'rct-complete-symbol) - -(defun rct-debuglog (logmsg) - "if `rct-debug' is non-nil, output LOGMSG into *Messages*. Returns LOGMSG." - (if rct-debug - (message "%s" logmsg)) - logmsg) - -(defun rct-exec-and-eval (command opt) - "Execute rct-complete/rct-doc and evaluate the output." - (let ((eval-buffer (get-buffer-create " *rct-eval*"))) - ;; copy to temporary buffer to do completion at non-EOL. - (rct-shell-command - (format "%s %s %s --line=%d --column=%d %s" - command opt (or rct-option-local "") - (rct-current-line) - ;; specify column in BYTE - (string-bytes - (encode-coding-string - (buffer-substring (point-at-bol) (point)) - buffer-file-coding-system)) - (if rct-use-test-script (rct-test-script-option-string) "")) - eval-buffer) - (message "") - (eval (with-current-buffer eval-buffer - (goto-char 1) - (unwind-protect - (read (current-buffer)) - (unless rct-debug (kill-buffer eval-buffer))))))) - -(defun rct-test-script-option-string () - (if (null buffer-file-name) - "" - (let ((test-buf (rct-find-test-script-buffer)) - (bfn buffer-file-name) - bfn2 t-opt test-filename) - (if (and test-buf - (setq bfn2 (buffer-local-value 'buffer-file-name test-buf)) - (file-exists-p bfn2)) - ;; pass test script's filename and lineno - (with-current-buffer test-buf - (setq t-opt (format "%s@%s" buffer-file-name (rct-current-line))) - (format "-t %s --filename=%s" t-opt bfn)) - "")))) - -(require 'cl) - -(defun rct-find-test-script-buffer (&optional buffer-list) - "Find the latest used Ruby test script buffer." - (setq buffer-list (or buffer-list (buffer-list))) - (dolist (buf buffer-list) - (with-current-buffer buf - (if (and buffer-file-name (string-match "test.*\.rb$" buffer-file-name)) - (return buf))))) - -;; (defun rct-find-test-method (buffer) -;; "Find test method on point on BUFFER." -;; (with-current-buffer buffer -;; (save-excursion -;; (forward-line 1) -;; (if (re-search-backward "^ *def *\\(test_[A-Za-z0-9?!_]+\\)" nil t) -;; (match-string 1))))) - -(defun rct-try-completion () - "Evaluate the output of rct-complete." - (rct-exec-and-eval rct-complete-command-name "--completion-emacs")) - -;;;; TAGS or Ri -(autoload 'ri "ri-ruby" nil t) -(defvar rct-find-tag-if-available t - "If non-nil and the method location is in TAGS, go to the location instead of show documentation.") -(defun rct-ri (&optional option) - "Browse Ri document at the point. -If `rct-find-tag-if-available' is non-nil, search the definition using TAGS. - -See also `rct-interactive'. " - (interactive (rct-interactive)) - (rct-exec-and-eval - rct-doc-command-name - (concat "--ri-emacs --use-method-analyzer " - (if (buffer-file-name) - (concat "--filename=" (buffer-file-name)) - "")))) - -(defun rct-find-tag-or-ri (fullname) - (if (not rct-find-tag-if-available) - (ri fullname) - (condition-case err - (let () - (visit-tags-table-buffer) - (find-tag-in-order (concat "::" fullname) 'search-forward '(tag-exact-match-p) nil "containing" t)) - (error - (ri fullname))))) - -;;;; -(defun ruby-toggle-buffer () - "Open a related file to the current buffer. test<=>impl." - (interactive) - (find-file (shell-command-to-string - (format "%s %s" ruby-toggle-file-command-name buffer-file-name)))) - -;;;; rct-fork support -(defun rct-fork (options) - "Run rct-fork. -Rct-fork makes xmpfilter and completion MUCH FASTER because it pre-loads heavy libraries. -When rct-fork is running, the mode-line indicates it to avoid unnecessary run. -To kill rct-fork process, use \\[rct-fork-kill]. -" - (interactive (list - (read-string "rct-fork options (-e CODE -I LIBDIR -r LIB): " - (rct-fork-default-options)))) - (rct-fork-kill) - (rct-fork-minor-mode 1) - (start-process-shell-command - "rct-fork" "*rct-fork*" rct-fork-command-name options)) - -(defun rct-fork-default-options () - "Default options for rct-fork by collecting requires." - (mapconcat - (lambda (lib) (format "-r %s" lib)) - (save-excursion - (goto-char (point-min)) - (loop while (re-search-forward "\\ ['\"]\\([^'\"]+\\)['\"]" nil t) - collect (match-string-no-properties 1))) - " ")) - -(defun rct-fork-kill () - "Kill rct-fork process invoked by \\[rct-fork]." - (interactive) - (when rct-fork-minor-mode - (rct-fork-minor-mode -1) - (interrupt-process "rct-fork"))) -(define-minor-mode rct-fork-minor-mode - "This minor mode is turned on when rct-fork is run. -It is nothing but an indicator." - :lighter " " :global t) - -;;;; unit tests -(when (and (fboundp 'expectations)) - (require 'ruby-mode) - (require 'el-mock nil t) - (expectations - (desc "comment-dwim advice") - (expect "# =>" - (with-temp-buffer - (ruby-mode) - (setq last-command nil) - (call-interactively 'comment-dwim) - (setq last-command 'comment-dwim) - (call-interactively 'comment-dwim) - (buffer-string))) - (expect (regexp "^1 +# =>") - (with-temp-buffer - (ruby-mode) - (insert "1") - (setq last-command nil) - (call-interactively 'comment-dwim) - (setq last-command 'comment-dwim) - (call-interactively 'comment-dwim) - (buffer-string))) - - (desc "rct-current-line") - (expect 1 - (with-temp-buffer - (rct-current-line))) - (expect 1 - (with-temp-buffer - (insert "1") - (rct-current-line))) - (expect 2 - (with-temp-buffer - (insert "1\n") - (rct-current-line))) - (expect 2 - (with-temp-buffer - (insert "1\n2") - (rct-current-line))) - - (desc "rct-save-position") - (expect (mock (set-window-start * 7) => nil) - (stub window-start => 7) - (with-temp-buffer - (insert "abcdef\nghi") - (rct-save-position #'ignore))) - (expect 2 - (with-temp-buffer - (stub window-start => 1) - (stub set-window-start => nil) - (insert "abcdef\nghi") - (rct-save-position #'ignore) - (rct-current-line))) - (expect 3 - (with-temp-buffer - (stub window-start => 1) - (stub set-window-start => nil) - (insert "abcdef\nghi") - (rct-save-position #'ignore) - (current-column))) - - (desc "rct-interactive") - (expect '("read") - (let ((current-prefix-arg t)) - (stub read-from-minibuffer => "read") - (rct-interactive))) - (expect '("-S ruby19") - (let ((current-prefix-arg nil) - (rct-option-local "-S ruby19")) - (stub read-from-minibuffer => "read") - (rct-interactive))) - (expect '("") - (let ((current-prefix-arg nil) - (rct-option-local)) - (stub read-from-minibuffer => "read") - (rct-interactive))) - - (desc "rct-shell-command") - (expect "1+1 # => 2\n" - (with-temp-buffer - (insert "1+1 # =>\n") - (rct-shell-command "xmpfilter") - (buffer-string))) - - (desc "xmp") - - (desc "xmpfilter-command") - (expect "xmpfilter --rails" - (let ((xmpfilter-command-name "xmpfilter")) - (with-temp-buffer - (insert "class TestFoo < Test::Unit::TestCase\n") - (xmpfilter-command "--rails")))) - (expect "xmpfilter " - (let ((xmpfilter-command-name "xmpfilter")) - (with-temp-buffer - (insert "context 'foo' do\n") - (xmpfilter-command)))) - (expect "xmpfilter " - (let ((xmpfilter-command-name "xmpfilter")) - (with-temp-buffer - (insert "describe Array do\n") - (xmpfilter-command)))) - (expect "xmpfilter --unittest --rails" - (let ((xmpfilter-command-name "xmpfilter")) - (with-temp-buffer - (insert "class TestFoo < Test::Unit::TestCase\n" - " def test_0\n" - " 1 + 1 # =>\n" - " end\n" - "end\n") - (xmpfilter-command "--rails")))) - (expect "xmpfilter --spec " - (let ((xmpfilter-command-name "xmpfilter")) - (with-temp-buffer - (insert "context 'foo' do\n" - " specify \"foo\" do\n" - " 1 + 1 # =>\n" - " end\n" - "end\n") - (xmpfilter-command)))) - (expect "xmpfilter --spec " - (let ((xmpfilter-command-name "xmpfilter")) - (with-temp-buffer - (insert "describe Array do\n" - " it \"foo\" do\n" - " [1] + [1] # =>\n" - " end\n" - "end\n") - (xmpfilter-command)))) - (expect "xmpfilter " - (let ((xmpfilter-command-name "xmpfilter")) - (with-temp-buffer - (insert "1 + 2\n") - (xmpfilter-command)))) - - (desc "rct-fork") - (expect t - (stub start-process-shell-command => t) - (stub interrupt-process => t) - (rct-fork "-r activesupport") - rct-fork-minor-mode) - (expect nil - (stub start-process-shell-command => t) - (stub interrupt-process => t) - (rct-fork "-r activesupport") - (rct-fork-kill) - rct-fork-minor-mode) - )) - -(provide 'rcodetools) diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.elc b/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.elc deleted file mode 100644 index a5c67c0ed..000000000 Binary files a/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.elc and /dev/null differ diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.gif b/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.gif deleted file mode 100644 index 7c35fe78d..000000000 Binary files a/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.gif and /dev/null differ diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.sxmp b/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.sxmp deleted file mode 100644 index a81418acd..000000000 Binary files a/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.sxmp and /dev/null differ diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.vim b/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.vim deleted file mode 100644 index 0796f007d..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/rcodetools.vim +++ /dev/null @@ -1,173 +0,0 @@ -" Copyright (C) 2006 Mauricio Fernandez -" rcodetools support plugin -" - -if exists("loaded_rcodetools") - finish -endif - -let loaded_rcodetools = 1 -let s:save_cpo = &cpo -set cpo&vim - -"{{{ set s:sid - -map xx xx -let s:sid = maparg("xx") -unmap xx -let s:sid = substitute(s:sid, 'xx', '', '') - -"{{{ function: s:spellgetoption(name, default) -" grab a user-specified option to override the default provided. options are -" searched in the window, buffer, then global spaces. -function! s:GetOption(name, default) - if exists("w:{&filetype}_" . a:name) - execute "return w:{&filetype}_".a:name - elseif exists("w:" . a:name) - execute "return w:".a:name - elseif exists("b:{&filetype}_" . a:name) - execute "return b:{&filetype}_".a:name - elseif exists("b:" . a:name) - execute "return b:".a:name - elseif exists("g:{&filetype}_" . a:name) - execute "return g:{&filetype}_".a:name - elseif exists("g:" . a:name) - execute "return g:".a:name - else - return a:default - endif -endfunction - -"{{{ IsOptionSet -function! s:IsOptionSet(name) - let bogus_val = "df hdsoi3y98 hjsdfhdkj" - return s:GetOption(a:name, bogus_val) == bogus_val ? 0 : 1 -endfunction - - -"{{{ RCT_completion function - -let s:last_test_file = "" -let s:last_test_lineno = 0 - -let s:rct_completion_col = 0 -let s:rct_tmpfile = "" - -function! RCT_command_with_test_options(cmd) - if s:last_test_file != "" - return a:cmd . - \ "-" . "-filename='" . expand("%:p") . "' " . - \ "-t '" . s:last_test_file . "@" . s:last_test_lineno . "' " - endif - return a:cmd -endfunction - -function! RCT_completion(findstart, base) - if a:findstart - let s:rct_completion_col = col('.') - 1 - let s:rct_tmpfile = "tmp-rcodetools" . strftime("Y-%m-%d-%H-%M-%S.rb") - silent exec ":w " . s:rct_tmpfile - return strridx(getline('.'), '.', col('.')) + 1 - else - let line = line('.') - let column = s:rct_completion_col - - let command = "rct-complete --completion-class-info --dev --fork --line=" . - \ line . " --column=" . column . " " - let command = RCT_command_with_test_options(command) . s:rct_tmpfile - - let data = split(system(command), '\n') - - for dline in data - let parts = split(dline, "\t") - let name = get(parts, 0) - let selector = get(parts, 1) - echo name - echo selector - if s:GetOption('rct_completion_use_fri', 0) && s:GetOption('rct_completion_info_max_len', 20) >= len(data) - let fri_data = system('fri -f plain ' . "'" . selector . "'" . ' 2>/dev/null') - call complete_add({'word': name, - \ 'menu': get(split(fri_data), 2, ''), - \ 'info': fri_data } ) - else - call complete_add(name) - endif - if complete_check() - break - endif - endfor - - call delete(s:rct_tmpfile) - return [] - endif -endfunction - -"{{{ ri functions - -function! RCT_new_ri_window() - execute "new" - execute "set bufhidden=delete buftype=nofile noswapfile nobuflisted" - execute 'nmap 2u' - execute 'nmap :call' . s:sid . 'RCT_execute_ri(expand(""))' -endfunction - -function! RCT_execute_ri(query_term) - silent %delete _ - let term = matchstr(a:query_term, '\v[^,.;]+') - let cmd = s:GetOption("RCT_ri_cmd", "fri -f plain ") - let text = system(cmd . "'" . term . "'") - call append(0, split(text, "\n")) - normal gg -endfunction - -function! RCT_find_tag_or_ri(fullname) - " rubikitch: modified for rtags-compatible tags - let tagname = '::' . a:fullname - let tagresults = taglist(tagname) - if len(tagresults) != 0 - execute "tjump " . tagname - else - call RCT_new_ri_window() - call RCT_execute_ri(a:fullname) - endif -endfunction - -function! RCT_smart_ri() - let tmpfile = "tmp-rcodetools" . strftime("Y-%m-%d-%H-%M-%S.rb") - silent exec ":w " . tmpfile - - let line = line('.') - let column = col('.') - 1 - let command = "rct-doc --ri-vim --line=" . line . " --column=" . column . " " - let command = RCT_command_with_test_options(command) . tmpfile - "let term = matchstr(system(command), "\\v[^\n]+") - exec system(command) - call delete(tmpfile) - "call RCT_find_tag_or_ri(term) -endfunction - -function! RCT_ruby_toggle() - let curr_file = expand("%:p") - let cmd = "ruby -S ruby-toggle-file " . curr_file - if match(curr_file, '\v_test|test_') != -1 - let s:last_test_file = curr_file - let s:last_test_lineno = line(".") - endif - let dest = system(cmd) - silent exec ":w" - exec ("edit " . dest) - silent! normal g; -endfunction - -"{{{ bindings and au - -if v:version >= 700 - execute "au Filetype ruby setlocal completefunc=" . s:sid . "RCT_completion" -endif -execute 'au Filetype ruby nmap :exec "call ' . - \ 'RCT_find_tag_or_ri(''" . expand("") . "'')"' -execute 'au Filetype ruby nmap ' . s:GetOption("RCT_ri_binding", "r") . - \ ' :call ' . s:sid . 'RCT_smart_ri()' -execute 'au Filetype ruby nmap ' . s:GetOption("RCT_toggle_binding", "t") . - \ ' :call ' . s:sid . 'RCT_ruby_toggle()' -let &cpo = s:save_cpo diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/setup.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/setup.rb deleted file mode 100644 index 424a5f37c..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/setup.rb +++ /dev/null @@ -1,1585 +0,0 @@ -# -# setup.rb -# -# Copyright (c) 2000-2005 Minero Aoki -# -# This program is free software. -# You can distribute/modify this program under the terms of -# the GNU LGPL, Lesser General Public License version 2.1. -# - -unless Enumerable.method_defined?(:map) # Ruby 1.4.6 - module Enumerable - alias map collect - end -end - -unless File.respond_to?(:read) # Ruby 1.6 - def File.read(fname) - open(fname) {|f| - return f.read - } - end -end - -unless Errno.const_defined?(:ENOTEMPTY) # Windows? - module Errno - class ENOTEMPTY - # We do not raise this exception, implementation is not needed. - end - end -end - -def File.binread(fname) - open(fname, 'rb') {|f| - return f.read - } -end - -# for corrupted Windows' stat(2) -def File.dir?(path) - File.directory?((path[-1,1] == '/') ? path : path + '/') -end - - -class ConfigTable - - include Enumerable - - def initialize(rbconfig) - @rbconfig = rbconfig - @items = [] - @table = {} - # options - @install_prefix = nil - @config_opt = nil - @verbose = true - @no_harm = false - end - - attr_accessor :install_prefix - attr_accessor :config_opt - - attr_writer :verbose - - def verbose? - @verbose - end - - attr_writer :no_harm - - def no_harm? - @no_harm - end - - def [](key) - lookup(key).resolve(self) - end - - def []=(key, val) - lookup(key).set val - end - - def names - @items.map {|i| i.name } - end - - def each(&block) - @items.each(&block) - end - - def key?(name) - @table.key?(name) - end - - def lookup(name) - @table[name] or setup_rb_error "no such config item: #{name}" - end - - def add(item) - @items.push item - @table[item.name] = item - end - - def remove(name) - item = lookup(name) - @items.delete_if {|i| i.name == name } - @table.delete_if {|name, i| i.name == name } - item - end - - def load_script(path, inst = nil) - if File.file?(path) - MetaConfigEnvironment.new(self, inst).instance_eval File.read(path), path - end - end - - def savefile - '.config' - end - - def load_savefile - begin - File.foreach(savefile()) do |line| - k, v = *line.split(/=/, 2) - self[k] = v.strip - end - rescue Errno::ENOENT - setup_rb_error $!.message + "\n#{File.basename($0)} config first" - end - end - - def save - @items.each {|i| i.value } - File.open(savefile(), 'w') {|f| - @items.each do |i| - f.printf "%s=%s\n", i.name, i.value if i.value? and i.value - end - } - end - - def load_standard_entries - standard_entries(@rbconfig).each do |ent| - add ent - end - end - - def standard_entries(rbconfig) - c = rbconfig - - rubypath = File.join(c['bindir'], c['ruby_install_name'] + c['EXEEXT']) - - major = c['MAJOR'].to_i - minor = c['MINOR'].to_i - teeny = c['TEENY'].to_i - version = "#{major}.#{minor}" - - # ruby ver. >= 1.4.4? - newpath_p = ((major >= 2) or - ((major == 1) and - ((minor >= 5) or - ((minor == 4) and (teeny >= 4))))) - - if c['rubylibdir'] - # V > 1.6.3 - libruby = "#{c['prefix']}/lib/ruby" - librubyver = c['rubylibdir'] - librubyverarch = c['archdir'] - siteruby = c['sitedir'] - siterubyver = c['sitelibdir'] - siterubyverarch = c['sitearchdir'] - elsif newpath_p - # 1.4.4 <= V <= 1.6.3 - libruby = "#{c['prefix']}/lib/ruby" - librubyver = "#{c['prefix']}/lib/ruby/#{version}" - librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}" - siteruby = c['sitedir'] - siterubyver = "$siteruby/#{version}" - siterubyverarch = "$siterubyver/#{c['arch']}" - else - # V < 1.4.4 - libruby = "#{c['prefix']}/lib/ruby" - librubyver = "#{c['prefix']}/lib/ruby/#{version}" - librubyverarch = "#{c['prefix']}/lib/ruby/#{version}/#{c['arch']}" - siteruby = "#{c['prefix']}/lib/ruby/#{version}/site_ruby" - siterubyver = siteruby - siterubyverarch = "$siterubyver/#{c['arch']}" - end - parameterize = lambda {|path| - path.sub(/\A#{Regexp.quote(c['prefix'])}/, '$prefix') - } - - if arg = c['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg } - makeprog = arg.sub(/'/, '').split(/=/, 2)[1] - else - makeprog = 'make' - end - - [ - ExecItem.new('installdirs', 'std/site/home', - 'std: install under libruby; site: install under site_ruby; home: install under $HOME')\ - {|val, table| - case val - when 'std' - table['rbdir'] = '$librubyver' - table['sodir'] = '$librubyverarch' - when 'site' - table['rbdir'] = '$siterubyver' - table['sodir'] = '$siterubyverarch' - when 'home' - setup_rb_error '$HOME was not set' unless ENV['HOME'] - table['prefix'] = ENV['HOME'] - table['rbdir'] = '$libdir/ruby' - table['sodir'] = '$libdir/ruby' - end - }, - PathItem.new('prefix', 'path', c['prefix'], - 'path prefix of target environment'), - PathItem.new('bindir', 'path', parameterize.call(c['bindir']), - 'the directory for commands'), - PathItem.new('libdir', 'path', parameterize.call(c['libdir']), - 'the directory for libraries'), - PathItem.new('datadir', 'path', parameterize.call(c['datadir']), - 'the directory for shared data'), - PathItem.new('mandir', 'path', parameterize.call(c['mandir']), - 'the directory for man pages'), - PathItem.new('sysconfdir', 'path', parameterize.call(c['sysconfdir']), - 'the directory for system configuration files'), - PathItem.new('localstatedir', 'path', parameterize.call(c['localstatedir']), - 'the directory for local state data'), - PathItem.new('libruby', 'path', libruby, - 'the directory for ruby libraries'), - PathItem.new('librubyver', 'path', librubyver, - 'the directory for standard ruby libraries'), - PathItem.new('librubyverarch', 'path', librubyverarch, - 'the directory for standard ruby extensions'), - PathItem.new('siteruby', 'path', siteruby, - 'the directory for version-independent aux ruby libraries'), - PathItem.new('siterubyver', 'path', siterubyver, - 'the directory for aux ruby libraries'), - PathItem.new('siterubyverarch', 'path', siterubyverarch, - 'the directory for aux ruby binaries'), - PathItem.new('rbdir', 'path', '$siterubyver', - 'the directory for ruby scripts'), - PathItem.new('sodir', 'path', '$siterubyverarch', - 'the directory for ruby extentions'), - PathItem.new('rubypath', 'path', rubypath, - 'the path to set to #! line'), - ProgramItem.new('rubyprog', 'name', rubypath, - 'the ruby program using for installation'), - ProgramItem.new('makeprog', 'name', makeprog, - 'the make program to compile ruby extentions'), - SelectItem.new('shebang', 'all/ruby/never', 'ruby', - 'shebang line (#!) editing mode'), - BoolItem.new('without-ext', 'yes/no', 'no', - 'does not compile/install ruby extentions') - ] - end - private :standard_entries - - def load_multipackage_entries - multipackage_entries().each do |ent| - add ent - end - end - - def multipackage_entries - [ - PackageSelectionItem.new('with', 'name,name...', '', 'ALL', - 'package names that you want to install'), - PackageSelectionItem.new('without', 'name,name...', '', 'NONE', - 'package names that you do not want to install') - ] - end - private :multipackage_entries - - ALIASES = { - 'std-ruby' => 'librubyver', - 'stdruby' => 'librubyver', - 'rubylibdir' => 'librubyver', - 'archdir' => 'librubyverarch', - 'site-ruby-common' => 'siteruby', # For backward compatibility - 'site-ruby' => 'siterubyver', # For backward compatibility - 'bin-dir' => 'bindir', - 'bin-dir' => 'bindir', - 'rb-dir' => 'rbdir', - 'so-dir' => 'sodir', - 'data-dir' => 'datadir', - 'ruby-path' => 'rubypath', - 'ruby-prog' => 'rubyprog', - 'ruby' => 'rubyprog', - 'make-prog' => 'makeprog', - 'make' => 'makeprog' - } - - def fixup - ALIASES.each do |ali, name| - @table[ali] = @table[name] - end - @items.freeze - @table.freeze - @options_re = /\A--(#{@table.keys.join('|')})(?:=(.*))?\z/ - end - - def parse_opt(opt) - m = @options_re.match(opt) or setup_rb_error "config: unknown option #{opt}" - m.to_a[1,2] - end - - def dllext - @rbconfig['DLEXT'] - end - - def value_config?(name) - lookup(name).value? - end - - class Item - def initialize(name, template, default, desc) - @name = name.freeze - @template = template - @value = default - @default = default - @description = desc - end - - attr_reader :name - attr_reader :description - - attr_accessor :default - alias help_default default - - def help_opt - "--#{@name}=#{@template}" - end - - def value? - true - end - - def value - @value - end - - def resolve(table) - @value.gsub(%r<\$([^/]+)>) { table[$1] } - end - - def set(val) - @value = check(val) - end - - private - - def check(val) - setup_rb_error "config: --#{name} requires argument" unless val - val - end - end - - class BoolItem < Item - def config_type - 'bool' - end - - def help_opt - "--#{@name}" - end - - private - - def check(val) - return 'yes' unless val - case val - when /\Ay(es)?\z/i, /\At(rue)?\z/i then 'yes' - when /\An(o)?\z/i, /\Af(alse)\z/i then 'no' - else - setup_rb_error "config: --#{@name} accepts only yes/no for argument" - end - end - end - - class PathItem < Item - def config_type - 'path' - end - - private - - def check(path) - setup_rb_error "config: --#{@name} requires argument" unless path - path[0,1] == '$' ? path : File.expand_path(path) - end - end - - class ProgramItem < Item - def config_type - 'program' - end - end - - class SelectItem < Item - def initialize(name, selection, default, desc) - super - @ok = selection.split('/') - end - - def config_type - 'select' - end - - private - - def check(val) - unless @ok.include?(val.strip) - setup_rb_error "config: use --#{@name}=#{@template} (#{val})" - end - val.strip - end - end - - class ExecItem < Item - def initialize(name, selection, desc, &block) - super name, selection, nil, desc - @ok = selection.split('/') - @action = block - end - - def config_type - 'exec' - end - - def value? - false - end - - def resolve(table) - setup_rb_error "$#{name()} wrongly used as option value" - end - - undef set - - def evaluate(val, table) - v = val.strip.downcase - unless @ok.include?(v) - setup_rb_error "invalid option --#{@name}=#{val} (use #{@template})" - end - @action.call v, table - end - end - - class PackageSelectionItem < Item - def initialize(name, template, default, help_default, desc) - super name, template, default, desc - @help_default = help_default - end - - attr_reader :help_default - - def config_type - 'package' - end - - private - - def check(val) - unless File.dir?("packages/#{val}") - setup_rb_error "config: no such package: #{val}" - end - val - end - end - - class MetaConfigEnvironment - def initialize(config, installer) - @config = config - @installer = installer - end - - def config_names - @config.names - end - - def config?(name) - @config.key?(name) - end - - def bool_config?(name) - @config.lookup(name).config_type == 'bool' - end - - def path_config?(name) - @config.lookup(name).config_type == 'path' - end - - def value_config?(name) - @config.lookup(name).config_type != 'exec' - end - - def add_config(item) - @config.add item - end - - def add_bool_config(name, default, desc) - @config.add BoolItem.new(name, 'yes/no', default ? 'yes' : 'no', desc) - end - - def add_path_config(name, default, desc) - @config.add PathItem.new(name, 'path', default, desc) - end - - def set_config_default(name, default) - @config.lookup(name).default = default - end - - def remove_config(name) - @config.remove(name) - end - - # For only multipackage - def packages - raise '[setup.rb fatal] multi-package metaconfig API packages() called for single-package; contact application package vendor' unless @installer - @installer.packages - end - - # For only multipackage - def declare_packages(list) - raise '[setup.rb fatal] multi-package metaconfig API declare_packages() called for single-package; contact application package vendor' unless @installer - @installer.packages = list - end - end - -end # class ConfigTable - - -# This module requires: #verbose?, #no_harm? -module FileOperations - - def mkdir_p(dirname, prefix = nil) - dirname = prefix + File.expand_path(dirname) if prefix - $stderr.puts "mkdir -p #{dirname}" if verbose? - return if no_harm? - - # Does not check '/', it's too abnormal. - dirs = File.expand_path(dirname).split(%r<(?=/)>) - if /\A[a-z]:\z/i =~ dirs[0] - disk = dirs.shift - dirs[0] = disk + dirs[0] - end - dirs.each_index do |idx| - path = dirs[0..idx].join('') - Dir.mkdir path unless File.dir?(path) - end - end - - def rm_f(path) - $stderr.puts "rm -f #{path}" if verbose? - return if no_harm? - force_remove_file path - end - - def rm_rf(path) - $stderr.puts "rm -rf #{path}" if verbose? - return if no_harm? - remove_tree path - end - - def remove_tree(path) - if File.symlink?(path) - remove_file path - elsif File.dir?(path) - remove_tree0 path - else - force_remove_file path - end - end - - def remove_tree0(path) - Dir.foreach(path) do |ent| - next if ent == '.' - next if ent == '..' - entpath = "#{path}/#{ent}" - if File.symlink?(entpath) - remove_file entpath - elsif File.dir?(entpath) - remove_tree0 entpath - else - force_remove_file entpath - end - end - begin - Dir.rmdir path - rescue Errno::ENOTEMPTY - # directory may not be empty - end - end - - def move_file(src, dest) - force_remove_file dest - begin - File.rename src, dest - rescue - File.open(dest, 'wb') {|f| - f.write File.binread(src) - } - File.chmod File.stat(src).mode, dest - File.unlink src - end - end - - def force_remove_file(path) - begin - remove_file path - rescue - end - end - - def remove_file(path) - File.chmod 0777, path - File.unlink path - end - - def install(from, dest, mode, prefix = nil) - $stderr.puts "install #{from} #{dest}" if verbose? - return if no_harm? - - realdest = prefix ? prefix + File.expand_path(dest) : dest - realdest = File.join(realdest, File.basename(from)) if File.dir?(realdest) - str = File.binread(from) - if diff?(str, realdest) - verbose_off { - rm_f realdest if File.exist?(realdest) - } - File.open(realdest, 'wb') {|f| - f.write str - } - File.chmod mode, realdest - - File.open("#{objdir_root()}/InstalledFiles", 'a') {|f| - if prefix - f.puts realdest.sub(prefix, '') - else - f.puts realdest - end - } - end - end - - def diff?(new_content, path) - return true unless File.exist?(path) - new_content != File.binread(path) - end - - def command(*args) - $stderr.puts args.join(' ') if verbose? - system(*args) or raise RuntimeError, - "system(#{args.map{|a| a.inspect }.join(' ')}) failed" - end - - def ruby(*args) - command config('rubyprog'), *args - end - - def make(task = nil) - command(*[config('makeprog'), task].compact) - end - - def extdir?(dir) - File.exist?("#{dir}/MANIFEST") or File.exist?("#{dir}/extconf.rb") - end - - def files_of(dir) - Dir.open(dir) {|d| - return d.select {|ent| File.file?("#{dir}/#{ent}") } - } - end - - DIR_REJECT = %w( . .. CVS SCCS RCS CVS.adm .svn ) - - def directories_of(dir) - Dir.open(dir) {|d| - return d.select {|ent| File.dir?("#{dir}/#{ent}") } - DIR_REJECT - } - end - -end - - -# This module requires: #srcdir_root, #objdir_root, #relpath -module HookScriptAPI - - def get_config(key) - @config[key] - end - - alias config get_config - - # obsolete: use metaconfig to change configuration - def set_config(key, val) - @config[key] = val - end - - # - # srcdir/objdir (works only in the package directory) - # - - def curr_srcdir - "#{srcdir_root()}/#{relpath()}" - end - - def curr_objdir - "#{objdir_root()}/#{relpath()}" - end - - def srcfile(path) - "#{curr_srcdir()}/#{path}" - end - - def srcexist?(path) - File.exist?(srcfile(path)) - end - - def srcdirectory?(path) - File.dir?(srcfile(path)) - end - - def srcfile?(path) - File.file?(srcfile(path)) - end - - def srcentries(path = '.') - Dir.open("#{curr_srcdir()}/#{path}") {|d| - return d.to_a - %w(. ..) - } - end - - def srcfiles(path = '.') - srcentries(path).select {|fname| - File.file?(File.join(curr_srcdir(), path, fname)) - } - end - - def srcdirectories(path = '.') - srcentries(path).select {|fname| - File.dir?(File.join(curr_srcdir(), path, fname)) - } - end - -end - - -class ToplevelInstaller - - Version = '3.4.1' - Copyright = 'Copyright (c) 2000-2005 Minero Aoki' - - TASKS = [ - [ 'all', 'do config, setup, then install' ], - [ 'config', 'saves your configurations' ], - [ 'show', 'shows current configuration' ], - [ 'setup', 'compiles ruby extentions and others' ], - [ 'install', 'installs files' ], - [ 'test', 'run all tests in test/' ], - [ 'clean', "does `make clean' for each extention" ], - [ 'distclean',"does `make distclean' for each extention" ] - ] - - def ToplevelInstaller.invoke - config = ConfigTable.new(load_rbconfig()) - config.load_standard_entries - config.load_multipackage_entries if multipackage? - config.fixup - klass = (multipackage?() ? ToplevelInstallerMulti : ToplevelInstaller) - klass.new(File.dirname($0), config).invoke - end - - def ToplevelInstaller.multipackage? - File.dir?(File.dirname($0) + '/packages') - end - - def ToplevelInstaller.load_rbconfig - if arg = ARGV.detect {|arg| /\A--rbconfig=/ =~ arg } - ARGV.delete(arg) - load File.expand_path(arg.split(/=/, 2)[1]) - $".push 'rbconfig.rb' - else - require 'rbconfig' - end - ::Config::CONFIG - end - - def initialize(ardir_root, config) - @ardir = File.expand_path(ardir_root) - @config = config - # cache - @valid_task_re = nil - end - - def config(key) - @config[key] - end - - def inspect - "#<#{self.class} #{__id__()}>" - end - - def invoke - run_metaconfigs - case task = parsearg_global() - when nil, 'all' - parsearg_config - init_installers - exec_config - exec_setup - exec_install - else - case task - when 'config', 'test' - ; - when 'clean', 'distclean' - @config.load_savefile if File.exist?(@config.savefile) - else - @config.load_savefile - end - __send__ "parsearg_#{task}" - init_installers - __send__ "exec_#{task}" - end - end - - def run_metaconfigs - @config.load_script "#{@ardir}/metaconfig" - end - - def init_installers - @installer = Installer.new(@config, @ardir, File.expand_path('.')) - end - - # - # Hook Script API bases - # - - def srcdir_root - @ardir - end - - def objdir_root - '.' - end - - def relpath - '.' - end - - # - # Option Parsing - # - - def parsearg_global - while arg = ARGV.shift - case arg - when /\A\w+\z/ - setup_rb_error "invalid task: #{arg}" unless valid_task?(arg) - return arg - when '-q', '--quiet' - @config.verbose = false - when '--verbose' - @config.verbose = true - when '--help' - print_usage $stdout - exit 0 - when '--version' - puts "#{File.basename($0)} version #{Version}" - exit 0 - when '--copyright' - puts Copyright - exit 0 - else - setup_rb_error "unknown global option '#{arg}'" - end - end - nil - end - - def valid_task?(t) - valid_task_re() =~ t - end - - def valid_task_re - @valid_task_re ||= /\A(?:#{TASKS.map {|task,desc| task }.join('|')})\z/ - end - - def parsearg_no_options - unless ARGV.empty? - task = caller(0).first.slice(%r<`parsearg_(\w+)'>, 1) - setup_rb_error "#{task}: unknown options: #{ARGV.join(' ')}" - end - end - - alias parsearg_show parsearg_no_options - alias parsearg_setup parsearg_no_options - alias parsearg_test parsearg_no_options - alias parsearg_clean parsearg_no_options - alias parsearg_distclean parsearg_no_options - - def parsearg_config - evalopt = [] - set = [] - @config.config_opt = [] - while i = ARGV.shift - if /\A--?\z/ =~ i - @config.config_opt = ARGV.dup - break - end - name, value = *@config.parse_opt(i) - if @config.value_config?(name) - @config[name] = value - else - evalopt.push [name, value] - end - set.push name - end - evalopt.each do |name, value| - @config.lookup(name).evaluate value, @config - end - # Check if configuration is valid - set.each do |n| - @config[n] if @config.value_config?(n) - end - end - - def parsearg_install - @config.no_harm = false - @config.install_prefix = '' - while a = ARGV.shift - case a - when '--no-harm' - @config.no_harm = true - when /\A--prefix=/ - path = a.split(/=/, 2)[1] - path = File.expand_path(path) unless path[0,1] == '/' - @config.install_prefix = path - else - setup_rb_error "install: unknown option #{a}" - end - end - end - - def print_usage(out) - out.puts 'Typical Installation Procedure:' - out.puts " $ ruby #{File.basename $0} config" - out.puts " $ ruby #{File.basename $0} setup" - out.puts " # ruby #{File.basename $0} install (may require root privilege)" - out.puts - out.puts 'Detailed Usage:' - out.puts " ruby #{File.basename $0} " - out.puts " ruby #{File.basename $0} [] []" - - fmt = " %-24s %s\n" - out.puts - out.puts 'Global options:' - out.printf fmt, '-q,--quiet', 'suppress message outputs' - out.printf fmt, ' --verbose', 'output messages verbosely' - out.printf fmt, ' --help', 'print this message' - out.printf fmt, ' --version', 'print version and quit' - out.printf fmt, ' --copyright', 'print copyright and quit' - out.puts - out.puts 'Tasks:' - TASKS.each do |name, desc| - out.printf fmt, name, desc - end - - fmt = " %-24s %s [%s]\n" - out.puts - out.puts 'Options for CONFIG or ALL:' - @config.each do |item| - out.printf fmt, item.help_opt, item.description, item.help_default - end - out.printf fmt, '--rbconfig=path', 'rbconfig.rb to load',"running ruby's" - out.puts - out.puts 'Options for INSTALL:' - out.printf fmt, '--no-harm', 'only display what to do if given', 'off' - out.printf fmt, '--prefix=path', 'install path prefix', '' - out.puts - end - - # - # Task Handlers - # - - def exec_config - @installer.exec_config - @config.save # must be final - end - - def exec_setup - @installer.exec_setup - end - - def exec_install - @installer.exec_install - end - - def exec_test - @installer.exec_test - end - - def exec_show - @config.each do |i| - printf "%-20s %s\n", i.name, i.value if i.value? - end - end - - def exec_clean - @installer.exec_clean - end - - def exec_distclean - @installer.exec_distclean - end - -end # class ToplevelInstaller - - -class ToplevelInstallerMulti < ToplevelInstaller - - include FileOperations - - def initialize(ardir_root, config) - super - @packages = directories_of("#{@ardir}/packages") - raise 'no package exists' if @packages.empty? - @root_installer = Installer.new(@config, @ardir, File.expand_path('.')) - end - - def run_metaconfigs - @config.load_script "#{@ardir}/metaconfig", self - @packages.each do |name| - @config.load_script "#{@ardir}/packages/#{name}/metaconfig" - end - end - - attr_reader :packages - - def packages=(list) - raise 'package list is empty' if list.empty? - list.each do |name| - raise "directory packages/#{name} does not exist"\ - unless File.dir?("#{@ardir}/packages/#{name}") - end - @packages = list - end - - def init_installers - @installers = {} - @packages.each do |pack| - @installers[pack] = Installer.new(@config, - "#{@ardir}/packages/#{pack}", - "packages/#{pack}") - end - with = extract_selection(config('with')) - without = extract_selection(config('without')) - @selected = @installers.keys.select {|name| - (with.empty? or with.include?(name)) \ - and not without.include?(name) - } - end - - def extract_selection(list) - a = list.split(/,/) - a.each do |name| - setup_rb_error "no such package: #{name}" unless @installers.key?(name) - end - a - end - - def print_usage(f) - super - f.puts 'Inluded packages:' - f.puts ' ' + @packages.sort.join(' ') - f.puts - end - - # - # Task Handlers - # - - def exec_config - run_hook 'pre-config' - each_selected_installers {|inst| inst.exec_config } - run_hook 'post-config' - @config.save # must be final - end - - def exec_setup - run_hook 'pre-setup' - each_selected_installers {|inst| inst.exec_setup } - run_hook 'post-setup' - end - - def exec_install - run_hook 'pre-install' - each_selected_installers {|inst| inst.exec_install } - run_hook 'post-install' - end - - def exec_test - run_hook 'pre-test' - each_selected_installers {|inst| inst.exec_test } - run_hook 'post-test' - end - - def exec_clean - rm_f @config.savefile - run_hook 'pre-clean' - each_selected_installers {|inst| inst.exec_clean } - run_hook 'post-clean' - end - - def exec_distclean - rm_f @config.savefile - run_hook 'pre-distclean' - each_selected_installers {|inst| inst.exec_distclean } - run_hook 'post-distclean' - end - - # - # lib - # - - def each_selected_installers - Dir.mkdir 'packages' unless File.dir?('packages') - @selected.each do |pack| - $stderr.puts "Processing the package `#{pack}' ..." if verbose? - Dir.mkdir "packages/#{pack}" unless File.dir?("packages/#{pack}") - Dir.chdir "packages/#{pack}" - yield @installers[pack] - Dir.chdir '../..' - end - end - - def run_hook(id) - @root_installer.run_hook id - end - - # module FileOperations requires this - def verbose? - @config.verbose? - end - - # module FileOperations requires this - def no_harm? - @config.no_harm? - end - -end # class ToplevelInstallerMulti - - -class Installer - - FILETYPES = %w( bin lib ext data conf man ) - - include FileOperations - include HookScriptAPI - - def initialize(config, srcroot, objroot) - @config = config - @srcdir = File.expand_path(srcroot) - @objdir = File.expand_path(objroot) - @currdir = '.' - end - - def inspect - "#<#{self.class} #{File.basename(@srcdir)}>" - end - - def noop(rel) - end - - # - # Hook Script API base methods - # - - def srcdir_root - @srcdir - end - - def objdir_root - @objdir - end - - def relpath - @currdir - end - - # - # Config Access - # - - # module FileOperations requires this - def verbose? - @config.verbose? - end - - # module FileOperations requires this - def no_harm? - @config.no_harm? - end - - def verbose_off - begin - save, @config.verbose = @config.verbose?, false - yield - ensure - @config.verbose = save - end - end - - # - # TASK config - # - - def exec_config - exec_task_traverse 'config' - end - - alias config_dir_bin noop - alias config_dir_lib noop - - def config_dir_ext(rel) - extconf if extdir?(curr_srcdir()) - end - - alias config_dir_data noop - alias config_dir_conf noop - alias config_dir_man noop - - def extconf - ruby "#{curr_srcdir()}/extconf.rb", *@config.config_opt - end - - # - # TASK setup - # - - def exec_setup - exec_task_traverse 'setup' - end - - def setup_dir_bin(rel) - files_of(curr_srcdir()).each do |fname| - update_shebang_line "#{curr_srcdir()}/#{fname}" - end - end - - alias setup_dir_lib noop - - def setup_dir_ext(rel) - make if extdir?(curr_srcdir()) - end - - alias setup_dir_data noop - alias setup_dir_conf noop - alias setup_dir_man noop - - def update_shebang_line(path) - return if no_harm? - return if config('shebang') == 'never' - old = Shebang.load(path) - if old - $stderr.puts "warning: #{path}: Shebang line includes too many args. It is not portable and your program may not work." if old.args.size > 1 - new = new_shebang(old) - return if new.to_s == old.to_s - else - return unless config('shebang') == 'all' - new = Shebang.new(config('rubypath')) - end - $stderr.puts "updating shebang: #{File.basename(path)}" if verbose? - open_atomic_writer(path) {|output| - File.open(path, 'rb') {|f| - f.gets if old # discard - output.puts new.to_s - output.print f.read - } - } - end - - def new_shebang(old) - if /\Aruby/ =~ File.basename(old.cmd) - Shebang.new(config('rubypath'), old.args) - elsif File.basename(old.cmd) == 'env' and old.args.first == 'ruby' - Shebang.new(config('rubypath'), old.args[1..-1]) - else - return old unless config('shebang') == 'all' - Shebang.new(config('rubypath')) - end - end - - def open_atomic_writer(path, &block) - tmpfile = File.basename(path) + '.tmp' - begin - File.open(tmpfile, 'wb', &block) - File.rename tmpfile, File.basename(path) - ensure - File.unlink tmpfile if File.exist?(tmpfile) - end - end - - class Shebang - def Shebang.load(path) - line = nil - File.open(path) {|f| - line = f.gets - } - return nil unless /\A#!/ =~ line - parse(line) - end - - def Shebang.parse(line) - cmd, *args = *line.strip.sub(/\A\#!/, '').split(' ') - new(cmd, args) - end - - def initialize(cmd, args = []) - @cmd = cmd - @args = args - end - - attr_reader :cmd - attr_reader :args - - def to_s - "#! #{@cmd}" + (@args.empty? ? '' : " #{@args.join(' ')}") - end - end - - # - # TASK install - # - - def exec_install - rm_f 'InstalledFiles' - exec_task_traverse 'install' - end - - def install_dir_bin(rel) - install_files targetfiles(), "#{config('bindir')}/#{rel}", 0755 - end - - def install_dir_lib(rel) - install_files libfiles(), "#{config('rbdir')}/#{rel}", 0644 - end - - def install_dir_ext(rel) - return unless extdir?(curr_srcdir()) - install_files rubyextentions('.'), - "#{config('sodir')}/#{File.dirname(rel)}", - 0555 - end - - def install_dir_data(rel) - install_files targetfiles(), "#{config('datadir')}/#{rel}", 0644 - end - - def install_dir_conf(rel) - # FIXME: should not remove current config files - # (rename previous file to .old/.org) - install_files targetfiles(), "#{config('sysconfdir')}/#{rel}", 0644 - end - - def install_dir_man(rel) - install_files targetfiles(), "#{config('mandir')}/#{rel}", 0644 - end - - def install_files(list, dest, mode) - mkdir_p dest, @config.install_prefix - list.each do |fname| - install fname, dest, mode, @config.install_prefix - end - end - - def libfiles - glob_reject(%w(*.y *.output), targetfiles()) - end - - def rubyextentions(dir) - ents = glob_select("*.#{@config.dllext}", targetfiles()) - if ents.empty? - setup_rb_error "no ruby extention exists: 'ruby #{$0} setup' first" - end - ents - end - - def targetfiles - mapdir(existfiles() - hookfiles()) - end - - def mapdir(ents) - ents.map {|ent| - if File.exist?(ent) - then ent # objdir - else "#{curr_srcdir()}/#{ent}" # srcdir - end - } - end - - # picked up many entries from cvs-1.11.1/src/ignore.c - JUNK_FILES = %w( - core RCSLOG tags TAGS .make.state - .nse_depinfo #* .#* cvslog.* ,* .del-* *.olb - *~ *.old *.bak *.BAK *.orig *.rej _$* *$ - - *.org *.in .* - ) - - def existfiles - glob_reject(JUNK_FILES, (files_of(curr_srcdir()) | files_of('.'))) - end - - def hookfiles - %w( pre-%s post-%s pre-%s.rb post-%s.rb ).map {|fmt| - %w( config setup install clean ).map {|t| sprintf(fmt, t) } - }.flatten - end - - def glob_select(pat, ents) - re = globs2re([pat]) - ents.select {|ent| re =~ ent } - end - - def glob_reject(pats, ents) - re = globs2re(pats) - ents.reject {|ent| re =~ ent } - end - - GLOB2REGEX = { - '.' => '\.', - '$' => '\$', - '#' => '\#', - '*' => '.*' - } - - def globs2re(pats) - /\A(?:#{ - pats.map {|pat| pat.gsub(/[\.\$\#\*]/) {|ch| GLOB2REGEX[ch] } }.join('|') - })\z/ - end - - # - # TASK test - # - - TESTDIR = 'test' - - def exec_test - unless File.directory?('test') - $stderr.puts 'no test in this package' if verbose? - return - end - $stderr.puts 'Running tests...' if verbose? - begin - require 'test/unit' - rescue LoadError - setup_rb_error 'test/unit cannot loaded. You need Ruby 1.8 or later to invoke this task.' - end - runner = Test::Unit::AutoRunner.new(true) - runner.to_run << TESTDIR - runner.run - end - - # - # TASK clean - # - - def exec_clean - exec_task_traverse 'clean' - rm_f @config.savefile - rm_f 'InstalledFiles' - end - - alias clean_dir_bin noop - alias clean_dir_lib noop - alias clean_dir_data noop - alias clean_dir_conf noop - alias clean_dir_man noop - - def clean_dir_ext(rel) - return unless extdir?(curr_srcdir()) - make 'clean' if File.file?('Makefile') - end - - # - # TASK distclean - # - - def exec_distclean - exec_task_traverse 'distclean' - rm_f @config.savefile - rm_f 'InstalledFiles' - end - - alias distclean_dir_bin noop - alias distclean_dir_lib noop - - def distclean_dir_ext(rel) - return unless extdir?(curr_srcdir()) - make 'distclean' if File.file?('Makefile') - end - - alias distclean_dir_data noop - alias distclean_dir_conf noop - alias distclean_dir_man noop - - # - # Traversing - # - - def exec_task_traverse(task) - run_hook "pre-#{task}" - FILETYPES.each do |type| - if type == 'ext' and config('without-ext') == 'yes' - $stderr.puts 'skipping ext/* by user option' if verbose? - next - end - traverse task, type, "#{task}_dir_#{type}" - end - run_hook "post-#{task}" - end - - def traverse(task, rel, mid) - dive_into(rel) { - run_hook "pre-#{task}" - __send__ mid, rel.sub(%r[\A.*?(?:/|\z)], '') - directories_of(curr_srcdir()).each do |d| - traverse task, "#{rel}/#{d}", mid - end - run_hook "post-#{task}" - } - end - - def dive_into(rel) - return unless File.dir?("#{@srcdir}/#{rel}") - - dir = File.basename(rel) - Dir.mkdir dir unless File.dir?(dir) - prevdir = Dir.pwd - Dir.chdir dir - $stderr.puts '---> ' + rel if verbose? - @currdir = rel - yield - Dir.chdir prevdir - $stderr.puts '<--- ' + rel if verbose? - @currdir = File.dirname(rel) - end - - def run_hook(id) - path = [ "#{curr_srcdir()}/#{id}", - "#{curr_srcdir()}/#{id}.rb" ].detect {|cand| File.file?(cand) } - return unless path - begin - instance_eval File.read(path), path, 1 - rescue - raise if $DEBUG - setup_rb_error "hook #{path} failed:\n" + $!.message - end - end - -end # class Installer - - -class SetupError < StandardError; end - -def setup_rb_error(msg) - raise SetupError, msg -end - -if $0 == __FILE__ - begin - ToplevelInstaller.invoke - rescue SetupError - raise if $DEBUG - $stderr.puts $!.message - $stderr.puts "Try 'ruby #{$0} --help' for detailed usage." - exit 1 - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/attic/test_run.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/attic/test_run.rb deleted file mode 100644 index 37d83d5a5..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/attic/test_run.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'test/unit' -require 'rcodetools/xmpfilter' -require 'rcodetools/xmptestunitfilter' -require 'rcodetools/completion' -require 'rcodetools/doc' -require 'rcodetools/options' -require 'stringio' - -class TestRun < Test::Unit::TestCase - include Rcodetools - DIR = File.expand_path(File.dirname(__FILE__)) - - tests = { - :simple_annotation => {:klass => XMPFilter}, - :unit_test => {:klass => XMPTestUnitFilter}, - :rspec => {:klass => XMPRSpecFilter, :interpreter => "spec"}, - :rspec_poetry => {:klass => XMPRSpecFilter, :interpreter => "spec", :use_parentheses => false}, - :no_warnings => {:klass => XMPFilter, :warnings => false}, - :bindings => {:klass => XMPTestUnitFilter, :use_parentheses => false}, - :unit_test_poetry => {:klass => XMPTestUnitFilter, :use_parentheses => false}, - :add_markers => {:klass => XMPAddMarkers}, - - :completion => {:klass => XMPCompletionFilter, :lineno => 1}, - :completion_emacs => {:klass => XMPCompletionEmacsFilter, :lineno => 1}, - :completion_emacs_icicles => {:klass => XMPCompletionEmacsIciclesFilter, :lineno => 1}, - :completion_class_info => {:klass => XMPCompletionClassInfoFilter, :lineno => 1}, - :completion_class_info_no_candidates => {:klass => XMPCompletionClassInfoFilter, :lineno => 1}, - - :doc => {:klass => XMPDocFilter, :lineno => 1}, - :refe => {:klass => XMPReFeFilter, :lineno => 1}, - :ri => {:klass => XMPRiFilter, :lineno => 1}, - :ri_emacs => {:klass => XMPRiEmacsFilter, :lineno => 1}, - :ri_vim => {:klass => XMPRiVimFilter, :lineno => 1}, - - } - tests.each_pair do |test, opts| - define_method("test_#{test}") do - inputfile = "#{DIR}/data/#{test}-input.rb" - outputfile = "#{DIR}/data/#{test}-output.rb" - sio = StringIO.new - sio.puts opts[:klass].run(File.read(inputfile), DEFAULT_OPTIONS.merge(opts)) - assert_equal(File.read(outputfile), sio.string) - end - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/add_markers-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/add_markers-input.rb deleted file mode 100644 index 33a508e45..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/add_markers-input.rb +++ /dev/null @@ -1,2 +0,0 @@ -1+1 -2+3 diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/add_markers-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/add_markers-output.rb deleted file mode 100644 index fe8fd61b4..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/add_markers-output.rb +++ /dev/null @@ -1,2 +0,0 @@ -1+1 # => -2+3 # => diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/bindings-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/bindings-input.rb deleted file mode 100644 index 90e97e27a..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/bindings-input.rb +++ /dev/null @@ -1,26 +0,0 @@ - -require 'test/unit' - -class TestFoo < Test::Unit::TestCase - def setup - @o = [] - end - - def test_foo - a = 1 - b = a - b # => - end - - def test_arr - last = 1 - @o << last - @o.last # => - end - - def test_bar - a = b = c = 1 - d = a - d # => - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/bindings-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/bindings-output.rb deleted file mode 100644 index cbea3c07c..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/bindings-output.rb +++ /dev/null @@ -1,31 +0,0 @@ - -require 'test/unit' - -class TestFoo < Test::Unit::TestCase - def setup - @o = [] - end - - def test_foo - a = 1 - b = a - assert_equal a, b - assert_equal 1, b - end - - def test_arr - last = 1 - @o << last - assert_equal last, @o.last - assert_equal 1, @o.last - end - - def test_bar - a = b = c = 1 - d = a - assert_equal a, d - assert_equal b, d - assert_equal c, d - assert_equal 1, d - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion-input.rb deleted file mode 100644 index 2dcaa3f08..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion-input.rb +++ /dev/null @@ -1 +0,0 @@ -Array.new(3).uni diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion-output.rb deleted file mode 100644 index 9546ff3ac..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion-output.rb +++ /dev/null @@ -1,2 +0,0 @@ -uniq -uniq! diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_class_info-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_class_info-input.rb deleted file mode 100644 index 6ea236464..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_class_info-input.rb +++ /dev/null @@ -1 +0,0 @@ -Array.new(3).s \ No newline at end of file diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_class_info-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_class_info-output.rb deleted file mode 100644 index 8c604b3c0..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_class_info-output.rb +++ /dev/null @@ -1,10 +0,0 @@ -select Array#select -send Object#send -shift Array#shift -singleton_methods Object#singleton_methods -size Array#size -slice Array#slice -slice! Array#slice! -sort Array#sort -sort! Array#sort! -sort_by Enumerable#sort_by diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_class_info_no_candidates-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_class_info_no_candidates-input.rb deleted file mode 100644 index 4666cc05c..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_class_info_no_candidates-input.rb +++ /dev/null @@ -1 +0,0 @@ -Array.new(3).nonexisten \ No newline at end of file diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_class_info_no_candidates-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_class_info_no_candidates-output.rb deleted file mode 100644 index 8b1378917..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_class_info_no_candidates-output.rb +++ /dev/null @@ -1 +0,0 @@ - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_detect_rbtest-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_detect_rbtest-input.rb deleted file mode 100755 index c4d92ca63..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_detect_rbtest-input.rb +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby -=begin test_bar -assert_equal "BAR", bar("bar") -=end -def bar(s) - s.upca -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_detect_rbtest-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_detect_rbtest-output.rb deleted file mode 100644 index c3d421a75..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_detect_rbtest-output.rb +++ /dev/null @@ -1,2 +0,0 @@ -upcase -upcase! diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_detect_rbtest2-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_detect_rbtest2-input.rb deleted file mode 100644 index 2dcaa3f08..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_detect_rbtest2-input.rb +++ /dev/null @@ -1 +0,0 @@ -Array.new(3).uni diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_detect_rbtest2-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_detect_rbtest2-output.rb deleted file mode 100644 index 9546ff3ac..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_detect_rbtest2-output.rb +++ /dev/null @@ -1,2 +0,0 @@ -uniq -uniq! diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_emacs-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_emacs-input.rb deleted file mode 100644 index 2dcaa3f08..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_emacs-input.rb +++ /dev/null @@ -1 +0,0 @@ -Array.new(3).uni diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_emacs-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_emacs-output.rb deleted file mode 100644 index c83366a11..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_emacs-output.rb +++ /dev/null @@ -1,6 +0,0 @@ -(progn -(setq rct-method-completion-table '(("uniq") ("uniq!") )) -(setq alist '(("uniq\t[Array#uniq]") ("uniq!\t[Array#uniq!]") )) -(setq pattern "uni") -(try-completion pattern rct-method-completion-table nil) -) diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_emacs_icicles-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_emacs_icicles-input.rb deleted file mode 100644 index aa062b7f9..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_emacs_icicles-input.rb +++ /dev/null @@ -1 +0,0 @@ -1.div diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_emacs_icicles-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_emacs_icicles-output.rb deleted file mode 100644 index e4747ae36..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_emacs_icicles-output.rb +++ /dev/null @@ -1,6 +0,0 @@ -(progn -(setq rct-method-completion-table '(("div\t[Fixnum#div]") ("divmod\t[Fixnum#divmod]") )) -(setq alist '(("div" . "Fixnum#div")("divmod" . "Fixnum#divmod"))) -(setq pattern "div") -(setq klass "Fixnum") -) diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_in_method-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_in_method-input.rb deleted file mode 100644 index 164408012..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_in_method-input.rb +++ /dev/null @@ -1,3 +0,0 @@ -def fooz - [].lengt -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_in_method-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_in_method-output.rb deleted file mode 100644 index 7f5e3b64d..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_in_method-output.rb +++ /dev/null @@ -1 +0,0 @@ -length diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_in_method-test.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_in_method-test.rb deleted file mode 100644 index 1edef979e..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_in_method-test.rb +++ /dev/null @@ -1,6 +0,0 @@ -require 'test/unit' -class TestFooz < Test::Unit::TestCase - def test_fooz - assert_equal(0, fooz) - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_rbtest-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_rbtest-input.rb deleted file mode 100755 index c4d92ca63..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_rbtest-input.rb +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby -=begin test_bar -assert_equal "BAR", bar("bar") -=end -def bar(s) - s.upca -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_rbtest-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_rbtest-output.rb deleted file mode 100644 index c3d421a75..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/completion_rbtest-output.rb +++ /dev/null @@ -1,2 +0,0 @@ -upcase -upcase! diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc-input.rb deleted file mode 100644 index 624aca755..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc-input.rb +++ /dev/null @@ -1 +0,0 @@ -[].length diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc-output.rb deleted file mode 100644 index ca542dbcc..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc-output.rb +++ /dev/null @@ -1 +0,0 @@ -Array#length diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_detect_rbtest-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_detect_rbtest-input.rb deleted file mode 100644 index 624aca755..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_detect_rbtest-input.rb +++ /dev/null @@ -1 +0,0 @@ -[].length diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_detect_rbtest-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_detect_rbtest-output.rb deleted file mode 100644 index ca542dbcc..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_detect_rbtest-output.rb +++ /dev/null @@ -1 +0,0 @@ -Array#length diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_detect_rbtest2-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_detect_rbtest2-input.rb deleted file mode 100755 index bf97ffe15..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_detect_rbtest2-input.rb +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby -=begin test_bar -assert_equal "BAR", bar("bar") -=end -def bar(s) - s.upcase -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_detect_rbtest2-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_detect_rbtest2-output.rb deleted file mode 100644 index 579185024..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_detect_rbtest2-output.rb +++ /dev/null @@ -1 +0,0 @@ -String#upcase diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_rbtest-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_rbtest-input.rb deleted file mode 100755 index bf97ffe15..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_rbtest-input.rb +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env ruby -=begin test_bar -assert_equal "BAR", bar("bar") -=end -def bar(s) - s.upcase -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_rbtest-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_rbtest-output.rb deleted file mode 100644 index 579185024..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/doc_rbtest-output.rb +++ /dev/null @@ -1 +0,0 @@ -String#upcase diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/no_warnings-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/no_warnings-input.rb deleted file mode 100644 index 514e18c0d..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/no_warnings-input.rb +++ /dev/null @@ -1,3 +0,0 @@ -A = 1 -A = 1 -p (1) diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/no_warnings-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/no_warnings-output.rb deleted file mode 100644 index 27a723858..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/no_warnings-output.rb +++ /dev/null @@ -1,4 +0,0 @@ -A = 1 -A = 1 -p (1) -# >> 1 diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/refe-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/refe-input.rb deleted file mode 100644 index 624aca755..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/refe-input.rb +++ /dev/null @@ -1 +0,0 @@ -[].length diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/refe-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/refe-output.rb deleted file mode 100644 index 8653c3d4b..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/refe-output.rb +++ /dev/null @@ -1 +0,0 @@ -refe 'Array#length' diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri-input.rb deleted file mode 100644 index 624aca755..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri-input.rb +++ /dev/null @@ -1 +0,0 @@ -[].length diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri-output.rb deleted file mode 100644 index f1ba49e61..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri-output.rb +++ /dev/null @@ -1 +0,0 @@ -ri 'Array#length' diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri_emacs-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri_emacs-input.rb deleted file mode 100644 index 624aca755..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri_emacs-input.rb +++ /dev/null @@ -1 +0,0 @@ -[].length diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri_emacs-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri_emacs-output.rb deleted file mode 100644 index 5f7389fb3..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri_emacs-output.rb +++ /dev/null @@ -1 +0,0 @@ -(rct-find-tag-or-ri "Array#length") diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri_vim-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri_vim-input.rb deleted file mode 100644 index 624aca755..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri_vim-input.rb +++ /dev/null @@ -1 +0,0 @@ -[].length diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri_vim-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri_vim-output.rb deleted file mode 100644 index 8e71a9a5c..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/ri_vim-output.rb +++ /dev/null @@ -1 +0,0 @@ -call RCT_find_tag_or_ri("Array#length") diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/rspec-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/rspec-input.rb deleted file mode 100644 index c57b23c47..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/rspec-input.rb +++ /dev/null @@ -1,48 +0,0 @@ - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 -end - - -describe "xmpfilter's expectation expansion" do - before do - @o = X.new - end - - it "should expand should == expectations" do - @o.foo(true) # => - @o.foo(true).a # => - @o.foo(false) # => - end - - it "should expand should raise_error expectations" do - @o.bar # => - end - - it "should expand should be_nil expectations" do - @o.baz # => - end - - it "should expand correct expectations for complex values" do - @o.babar # => - end - - it "should expand should be_close expectations" do - @o.fubar(10) # => - end -end - -describe "xmpfilter's automagic binding detection" do - it "should expand should == expectations" do - a = b = c = 1 - d = a - d # => - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/rspec-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/rspec-output.rb deleted file mode 100644 index 00abb887b..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/rspec-output.rb +++ /dev/null @@ -1,52 +0,0 @@ - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 # !> already initialized constant A -end - - -describe "xmpfilter's expectation expansion" do - before do - @o = X.new - end - - it "should expand should == expectations" do - (@o.foo(true)).should be_a_kind_of(X::Y) - (@o.foo(true).inspect).should == ("#") - (@o.foo(true).a).should == (2) - (@o.foo(false)).should == (2) - end - - it "should expand should raise_error expectations" do - lambda{@o.bar}.should raise_error(RuntimeError) - end - - it "should expand should be_nil expectations" do - (@o.baz).should be_nil - end - - it "should expand correct expectations for complex values" do - (@o.babar).should == ([1, 2]) - end - - it "should expand should be_close expectations" do - (@o.fubar(10)).should be_close(101.0, 0.0001) - end -end - -describe "xmpfilter's automagic binding detection" do - it "should expand should == expectations" do - a = b = c = 1 - d = a - (d).should == (a) - (d).should == (b) - (d).should == (c) - (d).should == (1) - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/rspec_poetry-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/rspec_poetry-input.rb deleted file mode 100644 index c57b23c47..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/rspec_poetry-input.rb +++ /dev/null @@ -1,48 +0,0 @@ - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 -end - - -describe "xmpfilter's expectation expansion" do - before do - @o = X.new - end - - it "should expand should == expectations" do - @o.foo(true) # => - @o.foo(true).a # => - @o.foo(false) # => - end - - it "should expand should raise_error expectations" do - @o.bar # => - end - - it "should expand should be_nil expectations" do - @o.baz # => - end - - it "should expand correct expectations for complex values" do - @o.babar # => - end - - it "should expand should be_close expectations" do - @o.fubar(10) # => - end -end - -describe "xmpfilter's automagic binding detection" do - it "should expand should == expectations" do - a = b = c = 1 - d = a - d # => - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/rspec_poetry-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/rspec_poetry-output.rb deleted file mode 100644 index 907b30535..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/rspec_poetry-output.rb +++ /dev/null @@ -1,52 +0,0 @@ - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 # !> already initialized constant A -end - - -describe "xmpfilter's expectation expansion" do - before do - @o = X.new - end - - it "should expand should == expectations" do - @o.foo(true).should be_a_kind_of(X::Y) - @o.foo(true).inspect.should == "#" - @o.foo(true).a.should == 2 - @o.foo(false).should == 2 - end - - it "should expand should raise_error expectations" do - lambda{@o.bar}.should raise_error(RuntimeError) - end - - it "should expand should be_nil expectations" do - @o.baz.should be_nil - end - - it "should expand correct expectations for complex values" do - @o.babar.should == [1, 2] - end - - it "should expand should be_close expectations" do - @o.fubar(10).should be_close(101.0, 0.0001) - end -end - -describe "xmpfilter's automagic binding detection" do - it "should expand should == expectations" do - a = b = c = 1 - d = a - d.should == a - d.should == b - d.should == c - d.should == 1 - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/simple_annotation-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/simple_annotation-input.rb deleted file mode 100644 index e4eb38504..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/simple_annotation-input.rb +++ /dev/null @@ -1,8 +0,0 @@ - -a = 1 -10.times do |i| - i ** 2 # => - a += i -end -A = 1 -A = 1 diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/simple_annotation-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/simple_annotation-output.rb deleted file mode 100644 index 41cd4c0cd..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/simple_annotation-output.rb +++ /dev/null @@ -1,8 +0,0 @@ - -a = 1 -10.times do |i| - i ** 2 # => 0, 1, 4, 9, 16, 25, 36, 49, 64, 81 - a += i -end -A = 1 -A = 1 # !> already initialized constant A diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test-input.rb deleted file mode 100644 index d9d02cdcd..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test-input.rb +++ /dev/null @@ -1,50 +0,0 @@ - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 - def difftype() [1, "s"] end -end - - -require 'test/unit' -class Test_X < Test::Unit::TestCase - def setup - @o = X.new - end - - def test_foo - @o.foo(true) # => - @o.foo(true).a # => - @o.foo(false) # => - end - - def test_bar - @o.bar # => - end - - def test_baz - @o.baz # => - end - - def test_babar - @o.babar # => - end - - def test_fubar - @o.fubar(10) # => - end - - def test_difftype - for x in @o.difftype - x # => - end - end - -end - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test-output.rb deleted file mode 100644 index 49f4e6314..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test-output.rb +++ /dev/null @@ -1,52 +0,0 @@ - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 # !> already initialized constant A - def difftype() [1, "s"] end -end - - -require 'test/unit' -class Test_X < Test::Unit::TestCase - def setup - @o = X.new - end - - def test_foo - assert_kind_of(X::Y, @o.foo(true)) - assert_equal("#", @o.foo(true).inspect) - assert_equal(2, @o.foo(true).a) - assert_equal(2, @o.foo(false)) - end - - def test_bar - assert_raise(RuntimeError){@o.bar} - end - - def test_baz - assert_nil(@o.baz) - end - - def test_babar - assert_equal([1, 2], @o.babar) - end - - def test_fubar - assert_in_delta(101.0, @o.fubar(10), 0.0001) - end - - def test_difftype - for x in @o.difftype - #xmpfilter: WARNING!! extra values ignored - assert_equal(1, x) - end - end - -end - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_detect_rbtest-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_detect_rbtest-input.rb deleted file mode 100644 index d9d02cdcd..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_detect_rbtest-input.rb +++ /dev/null @@ -1,50 +0,0 @@ - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 - def difftype() [1, "s"] end -end - - -require 'test/unit' -class Test_X < Test::Unit::TestCase - def setup - @o = X.new - end - - def test_foo - @o.foo(true) # => - @o.foo(true).a # => - @o.foo(false) # => - end - - def test_bar - @o.bar # => - end - - def test_baz - @o.baz # => - end - - def test_babar - @o.babar # => - end - - def test_fubar - @o.fubar(10) # => - end - - def test_difftype - for x in @o.difftype - x # => - end - end - -end - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_detect_rbtest-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_detect_rbtest-output.rb deleted file mode 100644 index 49f4e6314..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_detect_rbtest-output.rb +++ /dev/null @@ -1,52 +0,0 @@ - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 # !> already initialized constant A - def difftype() [1, "s"] end -end - - -require 'test/unit' -class Test_X < Test::Unit::TestCase - def setup - @o = X.new - end - - def test_foo - assert_kind_of(X::Y, @o.foo(true)) - assert_equal("#", @o.foo(true).inspect) - assert_equal(2, @o.foo(true).a) - assert_equal(2, @o.foo(false)) - end - - def test_bar - assert_raise(RuntimeError){@o.bar} - end - - def test_baz - assert_nil(@o.baz) - end - - def test_babar - assert_equal([1, 2], @o.babar) - end - - def test_fubar - assert_in_delta(101.0, @o.fubar(10), 0.0001) - end - - def test_difftype - for x in @o.difftype - #xmpfilter: WARNING!! extra values ignored - assert_equal(1, x) - end - end - -end - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_detect_rbtest2-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_detect_rbtest2-input.rb deleted file mode 100644 index afb6ebba2..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_detect_rbtest2-input.rb +++ /dev/null @@ -1,6 +0,0 @@ -=begin test_bar -bar("bar") # => -=end -def bar(s) - s.upcase -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_detect_rbtest2-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_detect_rbtest2-output.rb deleted file mode 100644 index 67ac1d924..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_detect_rbtest2-output.rb +++ /dev/null @@ -1,6 +0,0 @@ -=begin test_bar -assert_equal("BAR", bar("bar")) -=end -def bar(s) - s.upcase -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_poetry-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_poetry-input.rb deleted file mode 100644 index d9d02cdcd..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_poetry-input.rb +++ /dev/null @@ -1,50 +0,0 @@ - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 - def difftype() [1, "s"] end -end - - -require 'test/unit' -class Test_X < Test::Unit::TestCase - def setup - @o = X.new - end - - def test_foo - @o.foo(true) # => - @o.foo(true).a # => - @o.foo(false) # => - end - - def test_bar - @o.bar # => - end - - def test_baz - @o.baz # => - end - - def test_babar - @o.babar # => - end - - def test_fubar - @o.fubar(10) # => - end - - def test_difftype - for x in @o.difftype - x # => - end - end - -end - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_poetry-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_poetry-output.rb deleted file mode 100644 index 6278c2553..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_poetry-output.rb +++ /dev/null @@ -1,52 +0,0 @@ - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 # !> already initialized constant A - def difftype() [1, "s"] end -end - - -require 'test/unit' -class Test_X < Test::Unit::TestCase - def setup - @o = X.new - end - - def test_foo - assert_kind_of X::Y, @o.foo(true) - assert_equal "#", @o.foo(true).inspect - assert_equal 2, @o.foo(true).a - assert_equal 2, @o.foo(false) - end - - def test_bar - assert_raise(RuntimeError){@o.bar} - end - - def test_baz - assert_nil @o.baz - end - - def test_babar - assert_equal [1, 2], @o.babar - end - - def test_fubar - assert_in_delta 101.0, @o.fubar(10), 0.0001 - end - - def test_difftype - for x in @o.difftype - #xmpfilter: WARNING!! extra values ignored - assert_equal 1, x - end - end - -end - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_rbtest-input.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_rbtest-input.rb deleted file mode 100644 index afb6ebba2..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_rbtest-input.rb +++ /dev/null @@ -1,6 +0,0 @@ -=begin test_bar -bar("bar") # => -=end -def bar(s) - s.upcase -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_rbtest-output.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_rbtest-output.rb deleted file mode 100644 index 67ac1d924..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/attic/unit_test_rbtest-output.rb +++ /dev/null @@ -1,6 +0,0 @@ -=begin test_bar -assert_equal("BAR", bar("bar")) -=end -def bar(s) - s.upcase -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/method_analyzer-data.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/method_analyzer-data.rb deleted file mode 100644 index 82fca088e..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/method_analyzer-data.rb +++ /dev/null @@ -1,33 +0,0 @@ - -class A - def A.foo - 1 - end - - def a - 1+1 - end -end -class B < A - def initialize - end - attr_accessor :bb - - def b - "a".length - end -end -tm = Time.now -[tm.year, tm.month, tm.day] << 0 -a = A.new -a.a -b = B.new -b.a -b.b -[b.a,b.b] -z = b.a + b.b -A.foo -B.foo -b.bb=1 -b.bb - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/method_args.data.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/method_args.data.rb deleted file mode 100644 index b95fa8337..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/method_args.data.rb +++ /dev/null @@ -1,106 +0,0 @@ -# method_args.data.rb -class FixedArgsMethods - def self.singleton(a1) end - def initialize(arg) end - def f(a1) end - def b(a1,&block) end - define_method(:defmethod) {|a1|} - attr_accessor :by_attr_accessor - attr :by_attr_false - attr :by_attr_true, true - attr_reader :by_attr_reader_1, :by_attr_reader_2 - attr_writer :by_attr_writer - def private_meth(x) end - private :private_meth - class << self - attr_accessor :singleton_attr_accessor - define_method(:singleton_defmethod){|a2|} - end -end - -module VariableArgsMethods - def s(a1,*splat) end - def sb(a1,*splat, &block) end - def d(a1,default=nil) end - def ds(a1,default=nil,*splat) end - def dsb(a1,default=nil,*splat,&block) end - def db(a1,default=nil,&block) end -end - -class Fixnum - def method_in_Fixnum(arg1, arg2) end - def self.singleton_method_in_Fixnum(arg1, arg2) end -end -class Bignum - def method_in_Bignum(arg1, arg2) end -end -class Float - def method_in_Float(arg1, arg2) end -end -class Symbol - def method_in_Symbol(arg1, arg2) end -end -class Binding - def method_in_Binding(arg1, arg2) end -end -class UnboundMethod - def method_in_UnboundMethod(arg1, arg2) end -end -class Method - def method_in_Method(arg1, arg2) end -end -class Proc - def method_in_Proc(arg1, arg2) end -end -class Continuation - def method_in_Continuation(arg1, arg2) end -end -class Thread - def method_in_Thread(arg1, arg2) end -end -# FIXME mysterious -# class FalseClass -# def method_in_FalseClass(arg1, arg2) end -# end -class TrueClass - def method_in_TrueClass(arg1, arg2) end -end -class NilClass - def method_in_NilClass(arg1, arg2) end -end -class Struct - def method_in_Struct(arg1, arg2) end -end - -require 'digest' -class Digest::Base - def method_in_Digest_Base(arg1, arg2) end -end - -class AnAbstractClass - $__method_args_off = true - def self.allocate - raise NotImplementedError, "#{self} is an abstract class." - end - $__method_args_off = false - - def method_in_AnAbstractClass(arg1, arg2) - end - -end - -class AClass - include VariableArgsMethods - extend VariableArgsMethods -end - -class ASubClass < AClass -end - -StructA = Struct.new :a, :b -class SubclassOfStructA < StructA - attr :method_in_b -end -class StructSubclass < Struct.new(:c) - attr :method_in_c -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete-TDC/completion_in_method__testmethod.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete-TDC/completion_in_method__testmethod.taf deleted file mode 100644 index dfa125677..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete-TDC/completion_in_method__testmethod.taf +++ /dev/null @@ -1,17 +0,0 @@ -========== -completion_in_method__testmethod -========== -rct-complete --filename %s --line 2 -t %s@test_fooz -========== -def fooz - [].lengt -end -========== -length -========== -require 'test/unit' -class TestFooz < Test::Unit::TestCase - def test_fooz - assert_equal(0, fooz) - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete-TDC/completion_in_method__testscript.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete-TDC/completion_in_method__testscript.taf deleted file mode 100644 index f2de8add1..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete-TDC/completion_in_method__testscript.taf +++ /dev/null @@ -1,17 +0,0 @@ -========== -completion_in_method__testscript -========== -rct-complete --filename %s --line 2 -t %s -========== -def fooz - [].lengt -end -========== -length -========== -require 'test/unit' -class TestFooz < Test::Unit::TestCase - def test_fooz - assert_equal(0, fooz) - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete-TDC/completion_in_method__wrong_testmethod.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete-TDC/completion_in_method__wrong_testmethod.taf deleted file mode 100644 index 989c1f492..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete-TDC/completion_in_method__wrong_testmethod.taf +++ /dev/null @@ -1,17 +0,0 @@ -========== -completion_in_method__wrong_testmethod -========== -rct-complete --filename %s --line 2 -t %s@test_NOT_FOUND -========== -def fooz - [].lengt -end -========== - -========== -require 'test/unit' -class TestFooz < Test::Unit::TestCase - def test_fooz - assert_equal(0, fooz) - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion.taf deleted file mode 100644 index de08a22cf..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion.taf +++ /dev/null @@ -1,9 +0,0 @@ -========== -completion -========== -rct-complete -C --line=1 -========== -Array.new(3).uni -========== -uniq -uniq! diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_class_info.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_class_info.taf deleted file mode 100644 index 40d82fc9f..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_class_info.taf +++ /dev/null @@ -1,9 +0,0 @@ -========== -completion_class_info -========== -rct-complete --completion-class-info --line=1 -========== -Array.new(3).sl -========== -slice Array#slice -slice! Array#slice! diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_class_info_no_candidates.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_class_info_no_candidates.taf deleted file mode 100644 index f4e8959bc..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_class_info_no_candidates.taf +++ /dev/null @@ -1,8 +0,0 @@ -========== -completion_class_info_no_candidates -========== -rct-complete --completion-class-info --line=1 -========== -Array.new(3).nonexisten -========== - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_detect_rbtest.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_detect_rbtest.taf deleted file mode 100644 index e5405568d..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_detect_rbtest.taf +++ /dev/null @@ -1,15 +0,0 @@ -========== -completion_detect_rbtest -========== -rct-complete --detect-rbtest --line=6 -========== -#!/usr/bin/env ruby -=begin test_bar -assert_equal "BAR", bar("bar") -=end -def bar(s) - s.upca -end -========== -upcase -upcase! diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_detect_rbtest2.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_detect_rbtest2.taf deleted file mode 100644 index 49eaf171c..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_detect_rbtest2.taf +++ /dev/null @@ -1,9 +0,0 @@ -========== -completion_detect_rbtest2 -========== -rct-complete --detect-rbtest --line=1 -========== -Array.new(3).uni -========== -uniq -uniq! diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_emacs.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_emacs.taf deleted file mode 100644 index 9282ad09d..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_emacs.taf +++ /dev/null @@ -1,13 +0,0 @@ -========== -completion_emacs -========== -rct-complete --completion-emacs --line=1 -========== -Array.new(3).uni -========== -(progn -(setq rct-method-completion-table '(("uniq") ("uniq!") )) -(setq alist '(("uniq\t[Array#uniq]") ("uniq!\t[Array#uniq!]") )) -(setq pattern "uni") -(try-completion pattern rct-method-completion-table nil) -) diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_emacs_icicles.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_emacs_icicles.taf deleted file mode 100644 index 324a1cfa8..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_emacs_icicles.taf +++ /dev/null @@ -1,13 +0,0 @@ -========== -completion_emacs_icicles -========== -rct-complete --completion-emacs-icicles --line=1 -========== -1.div -========== -(progn -(setq rct-method-completion-table '(("div\t[Fixnum#div]") ("divmod\t[Fixnum#divmod]") )) -(setq alist '(("div" . "Fixnum#div")("divmod" . "Fixnum#divmod"))) -(setq pattern "div") -(setq klass "Fixnum") -) diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_rbtest.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_rbtest.taf deleted file mode 100644 index e8c6cbe62..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-complete/completion_rbtest.taf +++ /dev/null @@ -1,15 +0,0 @@ -========== -completion_rbtest -========== -rct-complete --rbtest --line=6 -========== -#!/usr/bin/env ruby -=begin test_bar -assert_equal "BAR", bar("bar") -=end -def bar(s) - s.upca -end -========== -upcase -upcase! diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/doc.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/doc.taf deleted file mode 100644 index aa017f636..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/doc.taf +++ /dev/null @@ -1,8 +0,0 @@ -========== -doc -========== -rct-doc -D --line=1 -========== -[].length -========== -Array#length diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/doc_detect_rbtest.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/doc_detect_rbtest.taf deleted file mode 100644 index 28ac60836..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/doc_detect_rbtest.taf +++ /dev/null @@ -1,8 +0,0 @@ -========== -doc_detect_rbtest -========== -rct-doc --detect-rbtest --line=1 -========== -[].length -========== -Array#length diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/doc_detect_rbtest2.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/doc_detect_rbtest2.taf deleted file mode 100644 index 043bea94d..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/doc_detect_rbtest2.taf +++ /dev/null @@ -1,14 +0,0 @@ -========== -doc_detect_rbtest2 -========== -rct-doc --detect-rbtest --line=6 -========== -#!/usr/bin/env ruby -=begin test_bar -assert_equal "BAR", bar("bar") -=end -def bar(s) - s.upcase -end -========== -String#upcase diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/doc_rbtest.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/doc_rbtest.taf deleted file mode 100644 index 7da58ce76..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/doc_rbtest.taf +++ /dev/null @@ -1,14 +0,0 @@ -========== -doc_rbtest -========== -rct-doc --rbtest --line=6 -========== -#!/usr/bin/env ruby -=begin test_bar -assert_equal "BAR", bar("bar") -=end -def bar(s) - s.upcase -end -========== -String#upcase diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/refe.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/refe.taf deleted file mode 100644 index 6f074037d..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/refe.taf +++ /dev/null @@ -1,8 +0,0 @@ -========== -refe -========== -rct-doc --refe --line=1 -========== -[].length -========== -refe 'Array#length' diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/ri.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/ri.taf deleted file mode 100644 index 02f27d6a1..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/ri.taf +++ /dev/null @@ -1,8 +0,0 @@ -========== -ri -========== -rct-doc --ri --line=1 -========== -[].length -========== -ri 'Array#length' diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/ri_emacs.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/ri_emacs.taf deleted file mode 100644 index b41c7e373..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/ri_emacs.taf +++ /dev/null @@ -1,8 +0,0 @@ -========== -ri_emacs -========== -rct-doc --ri-emacs --line=1 -========== -[].length -========== -(rct-find-tag-or-ri "Array#length") diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/ri_vim.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/ri_vim.taf deleted file mode 100644 index 11413ce40..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/rct-doc/ri_vim.taf +++ /dev/null @@ -1,8 +0,0 @@ -========== -ri_vim -========== -rct-doc --ri-vim --line=1 -========== -[].length -========== -call RCT_find_tag_or_ri("Array#length") diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/sample_test_script.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/sample_test_script.rb deleted file mode 100644 index b368a8ca2..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/sample_test_script.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'test/unit' -class TestSample < Test::Unit::TestCase - def test_sample0 - assert(true) - end - - def test_sample1 - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/add_markers.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/add_markers.taf deleted file mode 100644 index 88e846131..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/add_markers.taf +++ /dev/null @@ -1,10 +0,0 @@ -========== -add_markers -========== -xmpfilter -m -========== -1+1 -2+3 -========== -1+1 # => -2+3 # => diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/bindings.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/bindings.taf deleted file mode 100644 index bcd30560d..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/bindings.taf +++ /dev/null @@ -1,63 +0,0 @@ -========== -bindings -========== -xmpfilter --poetry -u -========== - -require 'test/unit' - -class TestFoo < Test::Unit::TestCase - def setup - @o = [] - end - - def test_foo - a = 1 - b = a - b # => - end - - def test_arr - last = 1 - @o << last - @o.last # => - end - - def test_bar - a = b = c = 1 - d = a - d # => - end -end -========== - -require 'test/unit' - -class TestFoo < Test::Unit::TestCase - def setup - @o = [] - end - - def test_foo - a = 1 - b = a - assert_equal a, b - assert_equal 1, b - end - - def test_arr - last = 1 - @o << last - assert_equal last, @o.last - assert_equal 1, @o.last - end - - def test_bar - a = b = c = 1 - d = a - assert_equal a, d - assert_equal b, d - assert_equal c, d - assert_equal 1, d - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/comment_out.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/comment_out.taf deleted file mode 100644 index 2520e79d7..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/comment_out.taf +++ /dev/null @@ -1,22 +0,0 @@ -========== -comment_out -========== -xmpfilter -========== - -# 1 # => -# 1 # => 2 -1 # => 12 -1 -# # => -# 1 -# # => -========== - -# 1 # => -# 1 # => 2 -1 # => 1 -1 -# # => -# 1 -# # => diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/exception.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/exception.taf deleted file mode 100644 index 3918c2e4d..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/exception.taf +++ /dev/null @@ -1,14 +0,0 @@ -========== -exception -========== -xmpfilter -========== -def foo - raise NameError, "ERR!!" rescue $@ # => -end -foo -========== -def foo - raise NameError, "ERR!!" rescue $@ # => ["-:2:in `foo'", "-:4"] -end -foo diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/expectations.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/expectations.taf deleted file mode 100644 index ad244d7ea..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/expectations.taf +++ /dev/null @@ -1,54 +0,0 @@ -========== -expectations -========== -xmpfilter --expectations -========== - -require 'rubygems' -require 'expectations' - -S = Struct.new :a -Expectations do - 1 + 1 # => - "a".length # => - [][1] # => - 1.hoge # => - 1.1 + 1.0 # => - S.new(1) # => -end -========== - -require 'rubygems' -require 'expectations' - -S = Struct.new :a -Expectations do - expect 2 do - 1 + 1 - end - - expect 1 do - "a".length - end - - expect nil do - [][1] - end - - expect NoMethodError do - 1.hoge - end - - expect 2.0999..2.1001 do - 1.1 + 1.0 - end - - expect S do - S.new(1) - end - - expect "#" do - S.new(1).inspect - end - -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/last_match.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/last_match.taf deleted file mode 100644 index 56a086384..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/last_match.taf +++ /dev/null @@ -1,18 +0,0 @@ -========== -last_match -========== -xmpfilter -========== - -md = "abc".match(/(.)(.)./) -1 -# => -[$1, $2] # => -$1 # => -========== - -md = "abc".match(/(.)(.)./) -1 -# => 1 -[$1, $2] # => ["a", "b"] -$1 # => "a" diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/mult.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/mult.rb deleted file mode 100644 index fa9025a07..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/mult.rb +++ /dev/null @@ -1,9 +0,0 @@ -a = ["1111111111111111111111111111111111111111111111111111", 123334324234242342, - 1332333333,6,8 ] -1 # => 1 -a -# => ["1111111111111111111111111111111111111111111111111111", -# 123334324234242342, -# 1332333333, -# 6, -# 8] diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_1.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_1.taf deleted file mode 100644 index 63a0a053d..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_1.taf +++ /dev/null @@ -1,22 +0,0 @@ -========== -multi_line_annotation_1 -========== -xmpfilter -========== - -1+2 # => -a = ["1111111111111111111111111111111111111111111111111111", 123334324234242342, - 1332333333 ] -1+2 # => -a -# => -========== - -1+2 # => 3 -a = ["1111111111111111111111111111111111111111111111111111", 123334324234242342, - 1332333333 ] -1+2 # => 3 -a -# => ["1111111111111111111111111111111111111111111111111111", -# 123334324234242342, -# 1332333333] diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_2.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_2.taf deleted file mode 100644 index d5027dbdf..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_2.taf +++ /dev/null @@ -1,24 +0,0 @@ -========== -multi_line_annotation_2 -========== -xmpfilter -========== - -1+2 # => 32 -a = ["1111111111111111111111111111111111111111111111111111", 123334324234242342, - 55555555 ] -1+2 # => 300 -a -# => ["1111111111111111111111111111111111111111111111111111", -# 123334324234242342, -# 1332333333] -========== - -1+2 # => 3 -a = ["1111111111111111111111111111111111111111111111111111", 123334324234242342, - 55555555 ] -1+2 # => 3 -a -# => ["1111111111111111111111111111111111111111111111111111", -# 123334324234242342, -# 55555555] diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_3.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_3.taf deleted file mode 100644 index 2b5efef34..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_3.taf +++ /dev/null @@ -1,20 +0,0 @@ -========== -multi_line_annotation_3 -========== -xmpfilter -========== - -a = ["1111111111111111111111111111111111111111111111111111", 123334324234242342, - 1332333333 ] -a -# => -1 # => -========== - -a = ["1111111111111111111111111111111111111111111111111111", 123334324234242342, - 1332333333 ] -a -# => ["1111111111111111111111111111111111111111111111111111", -# 123334324234242342, -# 1332333333] -1 # => 1 diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_4.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_4.taf deleted file mode 100644 index e8adac712..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_4.taf +++ /dev/null @@ -1,22 +0,0 @@ -========== -multi_line_annotation_4 -========== -xmpfilter -========== - -a = ["1111111111111111111111111111111111111111111111111111", 123334324234242342, - 55555555 ] -a -# => ["1111111111111111111111111111111111111111111111111111", -# 123334324234242342, -# 1332333333] -# not removed -========== - -a = ["1111111111111111111111111111111111111111111111111111", 123334324234242342, - 55555555 ] -a -# => ["1111111111111111111111111111111111111111111111111111", -# 123334324234242342, -# 55555555] -# not removed diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_5.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_5.taf deleted file mode 100644 index af0cb8460..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_5.taf +++ /dev/null @@ -1,34 +0,0 @@ -========== -multi_line_annotation_5 -========== -xmpfilter -========== - -def test - a = ["1111111111111111111111111111111111111111111111111111", 123334324234242342, - 55555555 ] - a - # => ["", - # 123334324234242342, - # 1332333333] - a - # => - # not removed -end -test -========== - -def test - a = ["1111111111111111111111111111111111111111111111111111", 123334324234242342, - 55555555 ] - a - # => ["1111111111111111111111111111111111111111111111111111", - # 123334324234242342, - # 55555555] - a - # => ["1111111111111111111111111111111111111111111111111111", - # 123334324234242342, - # 55555555] - # not removed -end -test diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_6.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_6.taf deleted file mode 100644 index 24c48e2b0..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_6.taf +++ /dev/null @@ -1,12 +0,0 @@ -========== -multi_line_annotation_6 -========== -xmpfilter -========== - -1 + 2 # !> warning -# => -========== - -1 + 2 -# => 3 diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_7.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_7.taf deleted file mode 100644 index 21ed1daec..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/multi_line_annotation_7.taf +++ /dev/null @@ -1,23 +0,0 @@ -========== -multi_line_annotation_7 -========== -xmpfilter -========== - -[1,2] -# => -raise -[3,4] -# => -[5,6] -# => -========== - -[1,2] -# => [1, 2] -raise -[3,4] -# => -[5,6] -# => -# ~> -:2: unhandled exception diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/no_warnings.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/no_warnings.taf deleted file mode 100644 index 76cf8b021..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/no_warnings.taf +++ /dev/null @@ -1,13 +0,0 @@ -========== -no_warnings -========== -xmpfilter --no-warnings -========== -A = 1 -A = 1 -p (1) -========== -A = 1 -A = 1 -p (1) -# >> 1 diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/nospace.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/nospace.taf deleted file mode 100644 index bb71aeae4..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/nospace.taf +++ /dev/null @@ -1,16 +0,0 @@ -========== -nospace_annotation -========== -xmpfilter -========== - -1 #=> -2 #=> 2 -3 -#=> -========== - -1 # => 1 -2 # => 2 -3 -# => 3 diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/rspec.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/rspec.taf deleted file mode 100644 index 6c3a3d666..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/rspec.taf +++ /dev/null @@ -1,106 +0,0 @@ -========== -rspec -========== -xmpfilter -s -========== - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 -end - - -describe "xmpfilter's expectation expansion" do - before do - @o = X.new - end - - it "should expand should == expectations" do - @o.foo(true) # => - @o.foo(true).a # => - @o.foo(false) # => - end - - it "should expand should raise_error expectations" do - @o.bar # => - end - - it "should expand should be_nil expectations" do - @o.baz # => - end - - it "should expand correct expectations for complex values" do - @o.babar # => - end - - it "should expand should be_close expectations" do - @o.fubar(10) # => - end -end - -describe "xmpfilter's automagic binding detection" do - it "should expand should == expectations" do - a = b = c = 1 - d = a - d # => - end -end -========== - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 # !> already initialized constant A -end - - -describe "xmpfilter's expectation expansion" do - before do - @o = X.new - end - - it "should expand should == expectations" do - (@o.foo(true)).should be_a_kind_of(X::Y) - (@o.foo(true).inspect).should == ("#") - (@o.foo(true).a).should == (2) - (@o.foo(false)).should == (2) - end - - it "should expand should raise_error expectations" do - lambda{@o.bar}.should raise_error(RuntimeError) - end - - it "should expand should be_nil expectations" do - (@o.baz).should be_nil - end - - it "should expand correct expectations for complex values" do - (@o.babar).should == ([1, 2]) - end - - it "should expand should be_close expectations" do - (@o.fubar(10)).should be_close(101.0, 0.0001) - end -end - -describe "xmpfilter's automagic binding detection" do - it "should expand should == expectations" do - a = b = c = 1 - d = a - (d).should == (a) - (d).should == (b) - (d).should == (c) - (d).should == (1) - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/rspec_poetry.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/rspec_poetry.taf deleted file mode 100644 index 0bcd6859a..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/rspec_poetry.taf +++ /dev/null @@ -1,106 +0,0 @@ -========== -rspec_poetry -========== -xmpfilter -s --poetry -========== - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 -end - - -describe "xmpfilter's expectation expansion" do - before do - @o = X.new - end - - it "should expand should == expectations" do - @o.foo(true) # => - @o.foo(true).a # => - @o.foo(false) # => - end - - it "should expand should raise_error expectations" do - @o.bar # => - end - - it "should expand should be_nil expectations" do - @o.baz # => - end - - it "should expand correct expectations for complex values" do - @o.babar # => - end - - it "should expand should be_close expectations" do - @o.fubar(10) # => - end -end - -describe "xmpfilter's automagic binding detection" do - it "should expand should == expectations" do - a = b = c = 1 - d = a - d # => - end -end -========== - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 # !> already initialized constant A -end - - -describe "xmpfilter's expectation expansion" do - before do - @o = X.new - end - - it "should expand should == expectations" do - @o.foo(true).should be_a_kind_of(X::Y) - @o.foo(true).inspect.should == "#" - @o.foo(true).a.should == 2 - @o.foo(false).should == 2 - end - - it "should expand should raise_error expectations" do - lambda{@o.bar}.should raise_error(RuntimeError) - end - - it "should expand should be_nil expectations" do - @o.baz.should be_nil - end - - it "should expand correct expectations for complex values" do - @o.babar.should == [1, 2] - end - - it "should expand should be_close expectations" do - @o.fubar(10).should be_close(101.0, 0.0001) - end -end - -describe "xmpfilter's automagic binding detection" do - it "should expand should == expectations" do - a = b = c = 1 - d = a - d.should == a - d.should == b - d.should == c - d.should == 1 - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/simple_annotation.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/simple_annotation.taf deleted file mode 100644 index 9aa82d54b..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/simple_annotation.taf +++ /dev/null @@ -1,22 +0,0 @@ -========== -simple_annotation -========== -xmpfilter -========== - -a = 1 -10.times do |i| - i ** 2 # => - a += i -end -A = 1 -A = 1 -========== - -a = 1 -10.times do |i| - i ** 2 # => 0, 1, 4, 9, 16, 25, 36, 49, 64, 81 - a += i -end -A = 1 -A = 1 # !> already initialized constant A diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test.taf deleted file mode 100644 index 662ae861b..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test.taf +++ /dev/null @@ -1,108 +0,0 @@ -========== -unit_test -========== -xmpfilter -u -========== - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 - def difftype() [1, "s"] end -end - - -require 'test/unit' -class Test_X < Test::Unit::TestCase - def setup - @o = X.new - end - - def test_foo - @o.foo(true) # => - @o.foo(true).a # => - @o.foo(false) # => - end - - def test_bar - @o.bar # => - end - - def test_baz - @o.baz # => - end - - def test_babar - @o.babar # => - end - - def test_fubar - @o.fubar(10) # => - end - - def test_difftype - for x in @o.difftype - x # => - end - end - -end - -========== - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 # !> already initialized constant A - def difftype() [1, "s"] end -end - - -require 'test/unit' -class Test_X < Test::Unit::TestCase - def setup - @o = X.new - end - - def test_foo - assert_kind_of(X::Y, @o.foo(true)) - assert_equal("#", @o.foo(true).inspect) - assert_equal(2, @o.foo(true).a) - assert_equal(2, @o.foo(false)) - end - - def test_bar - assert_raise(RuntimeError){@o.bar} - end - - def test_baz - assert_nil(@o.baz) - end - - def test_babar - assert_equal([1, 2], @o.babar) - end - - def test_fubar - assert_in_delta(101.0, @o.fubar(10), 0.0001) - end - - def test_difftype - for x in @o.difftype - #xmpfilter: WARNING!! extra values ignored - assert_equal(1, x) - end - end - -end - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test_detect_rbtest.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test_detect_rbtest.taf deleted file mode 100644 index 7cc5893e7..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test_detect_rbtest.taf +++ /dev/null @@ -1,108 +0,0 @@ -========== -unit_test_detect_rbtest -========== -xmpfilter -u --detect-rbtest -========== - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 - def difftype() [1, "s"] end -end - - -require 'test/unit' -class Test_X < Test::Unit::TestCase - def setup - @o = X.new - end - - def test_foo - @o.foo(true) # => - @o.foo(true).a # => - @o.foo(false) # => - end - - def test_bar - @o.bar # => - end - - def test_baz - @o.baz # => - end - - def test_babar - @o.babar # => - end - - def test_fubar - @o.fubar(10) # => - end - - def test_difftype - for x in @o.difftype - x # => - end - end - -end - -========== - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 # !> already initialized constant A - def difftype() [1, "s"] end -end - - -require 'test/unit' -class Test_X < Test::Unit::TestCase - def setup - @o = X.new - end - - def test_foo - assert_kind_of(X::Y, @o.foo(true)) - assert_equal("#", @o.foo(true).inspect) - assert_equal(2, @o.foo(true).a) - assert_equal(2, @o.foo(false)) - end - - def test_bar - assert_raise(RuntimeError){@o.bar} - end - - def test_baz - assert_nil(@o.baz) - end - - def test_babar - assert_equal([1, 2], @o.babar) - end - - def test_fubar - assert_in_delta(101.0, @o.fubar(10), 0.0001) - end - - def test_difftype - for x in @o.difftype - #xmpfilter: WARNING!! extra values ignored - assert_equal(1, x) - end - end - -end - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test_detect_rbtest2.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test_detect_rbtest2.taf deleted file mode 100644 index 219b4a996..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test_detect_rbtest2.taf +++ /dev/null @@ -1,18 +0,0 @@ -========== -unit_test_detect_rbtest2 -========== -xmpfilter --detect-rbtest -========== -=begin test_bar -bar("bar") # => -=end -def bar(s) - s.upcase -end -========== -=begin test_bar -assert_equal("BAR", bar("bar")) -=end -def bar(s) - s.upcase -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test_poetry.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test_poetry.taf deleted file mode 100644 index b7c24902f..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test_poetry.taf +++ /dev/null @@ -1,108 +0,0 @@ -========== -unit_test_poetry -========== -xmpfilter -u --poetry -========== - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 - def difftype() [1, "s"] end -end - - -require 'test/unit' -class Test_X < Test::Unit::TestCase - def setup - @o = X.new - end - - def test_foo - @o.foo(true) # => - @o.foo(true).a # => - @o.foo(false) # => - end - - def test_bar - @o.bar # => - end - - def test_baz - @o.baz # => - end - - def test_babar - @o.babar # => - end - - def test_fubar - @o.fubar(10) # => - end - - def test_difftype - for x in @o.difftype - x # => - end - end - -end - -========== - -class X - Y = Struct.new(:a) - def foo(b); b ? Y.new(2) : 2 end - def bar; raise "No good" end - def baz; nil end - def fubar(x); x ** 2.0 + 1 end - def babar; [1,2] end - A = 1 - A = 1 # !> already initialized constant A - def difftype() [1, "s"] end -end - - -require 'test/unit' -class Test_X < Test::Unit::TestCase - def setup - @o = X.new - end - - def test_foo - assert_kind_of X::Y, @o.foo(true) - assert_equal "#", @o.foo(true).inspect - assert_equal 2, @o.foo(true).a - assert_equal 2, @o.foo(false) - end - - def test_bar - assert_raise(RuntimeError){@o.bar} - end - - def test_baz - assert_nil @o.baz - end - - def test_babar - assert_equal [1, 2], @o.babar - end - - def test_fubar - assert_in_delta 101.0, @o.fubar(10), 0.0001 - end - - def test_difftype - for x in @o.difftype - #xmpfilter: WARNING!! extra values ignored - assert_equal 1, x - end - end - -end - diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test_rbtest.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test_rbtest.taf deleted file mode 100644 index 622f11828..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/unit_test_rbtest.taf +++ /dev/null @@ -1,18 +0,0 @@ -========== -unit_test_rbtest -========== -xmpfilter -u --rbtest -========== -=begin test_bar -bar("bar") # => -=end -def bar(s) - s.upcase -end -========== -=begin test_bar -assert_equal("BAR", bar("bar")) -=end -def bar(s) - s.upcase -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/width.taf b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/width.taf deleted file mode 100644 index 4fa436e02..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/data/xmpfilter/width.taf +++ /dev/null @@ -1,16 +0,0 @@ -========== -width -========== -xmpfilter -w 15 -========== - -a = ["abcdefg", 12345, Object] -a -# => -========== - -a = ["abcdefg", 12345, Object] -a -# => ["abcdefg", -# 12345, -# Object] diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/test_completion.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/test_completion.rb deleted file mode 100644 index fce0fef1c..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/test_completion.rb +++ /dev/null @@ -1,674 +0,0 @@ -$: << ".." << "../lib" -require 'rcodetools/completion' -require 'test/unit' - -class TestXMPCompletionFilter < Test::Unit::TestCase - include Rcodetools - def doit(code, lineno, column=nil, options={}) - xmp = XMPCompletionFilter.new options - xmp.candidates(code, lineno, column).sort - end - - def test_complete_method__simple - assert_equal(["length"], doit('"a".lengt', 1)) - assert_equal(["length"], doit('`echo a`.lengt', 1)) - end - - def test_complete_method__in_arg - assert_equal(["length"], doit('print("a".lengt)', 1, 15)) - assert_equal(["length"], doit("print('a'.lengt)", 1, 15)) - assert_equal(["length"], doit("((a, b = 1 + 'a'.lengt))", 1, 22)) - end - - def test_complete_method__in_method - assert_equal(["length"], doit(<true)) - module X - xx # normally NoMethodError - module_funct - end -EOC - end - - # drawback of ignore_NoMethodError - def test_with_or_without_ignore_NoMethodError - code = <true) - end - end - - def test__syntax_error - assert_raise(ProcessParticularLine::NewCodeError) do - doit(< == === =~ > >= < <= << >> - + - * / % ** ~ - ].each do |op| - ancestors_re = Fixnum.ancestors.map{|x|x.to_s}.join('|') - assert_match(/^#{ancestors_re}##{Regexp.quote(op)}$/, doit("1 #{op} 2",1,2)) - end - end - - def test_aref_aset__Array - assert_equal("Array#[]", doit("[0][ 0 ]",1,4)) - assert_equal("Array#[]=", doit("[0][ 0 ]=10",1,4)) - assert_equal("Array#[]", doit("[0][0]",1,4)) - assert_equal("Array#[]=", doit("[0][0]=10",1,4)) - end - - def test_aref_aset__Object - assert_equal("Array#[]", doit("Array.new(3)[ 0 ]",1,13)) - assert_equal("Array#[]=", doit("Array.new(3)[ 0 ]=10",1,13)) - assert_equal("Array#[]", doit("Array.new(3)[0]",1,13)) - assert_equal("Array#[]=", doit("Array.new(3)[0]=10",1,13)) - end - - def test_aref_aset__Fixnum - assert_equal("Fixnum#[]", doit("0[ 0 ]",1,2)) - assert_equal("Fixnum#[]", doit("0[0]",1,2)) - end - - def test_aref_aset__String - assert_equal("String#[]", doit("'a' + '[0]'[ 0 ]",1,12)) - assert_equal("String#[]", doit("'[0]'[ 0 ]",1,6)) - assert_equal("String#[]=", doit("'0'[ 0 ]=10",1,4)) - assert_equal("String#[]", doit("'[0]'[0]",1,6)) - assert_equal("String#[]=", doit("'0'[0]=10",1,4)) - end - - def test_phrase - assert_equal("Array#uniq", doit('Array.new(3).uniq',1)) - assert_equal("Array#uniq", doit('Array.new(3).to_a.uniq',1)) - assert_equal("Array#uniq", doit('Array.new(3).map{|x| x.to_i}.uniq',1)) - assert_equal("Array#uniq", doit('[][0,(1+1)].uniq',1)) - end - - def test_percent__String - assert_equal("String#length", doit('%!foo!.length',1)) - assert_equal("String#length", doit('%q!foo!.length',1)) - assert_equal("String#length", doit('%Q!foo!.length',1)) - assert_equal("String#length", doit('%x!foo!.length',1)) - - assert_equal("String#length", doit('%{foo}.length',1)) - assert_equal("String#length", doit('%q{foo}.length',1)) - assert_equal("String#length", doit('%q!(!.length',1)) - assert_equal("String#length", doit('%Q!(!.length',1)) - assert_equal("String#length", doit('%x!(!.length',1)) - assert_equal("String#length", doit('%x{(}.length',1)) - - assert_equal("String#length", doit('%{f(o)o}.length',1)) - assert_equal("String#length", doit('%{f{o}o}.length',1)) - assert_equal("String#length", doit('(%{f{o}o}+%!}x!).length',1)) - end - - def test_percent__Array - assert_equal("Array#length", doit('%w!foo!.length',1)) - assert_equal("Array#length", doit('%W!foo!.length',1)) - - assert_equal("Array#length", doit('%w{foo}.length',1)) - assert_equal("Array#length", doit('%W{foo}.length',1)) - assert_equal("Array#length", doit('%w!(!.length',1)) - assert_equal("Array#length", doit('%W!(!.length',1)) - assert_equal("Array#length", doit('%w{(}.length',1)) - - assert_equal("Array#length", doit('%w{f(o)o}.length',1)) - assert_equal("Array#length", doit('%w{f{o}o}.length',1)) - assert_equal("Array#length", doit('(%W{f{o}o}+%w!}x!).length',1)) - end - - def test_percent__Regexp - assert_equal("Regexp#kcode", doit('%r!foo!.kcode',1)) - assert_equal("Regexp#kcode", doit('%r{foo}.kcode',1)) - assert_equal("Regexp#kcode", doit('%r!(!.kcode',1)) - assert_equal("Regexp#kcode", doit('%r[(].kcode',1)) - assert_equal("Regexp#kcode", doit('%r.kcode',1)) - end - - def test_percent__Symbol - assert_equal("Symbol#id2name", doit('%s!foo!.id2name',1)) - assert_equal("Symbol#id2name", doit('%s{foo}.id2name',1)) - assert_equal("Symbol#id2name", doit('%s!(!.id2name',1)) - assert_equal("Symbol#id2name", doit('%s{(}.id2name',1)) - assert_equal("Symbol#id2name", doit('%s(f(o)o).id2name',1)) - end - - def test_bare_word__with_NoMethodError - assert_equal("Module#module_function", doit(<true)) - module X - xx # normally NoMethodError - module_function - end -EOC - end - - def test__syntax_error - assert_raise(ProcessParticularLine::NewCodeError) do - doit(< < Struct -method_args.data.rb:101:class SubclassOfStructA < StructA -method_args.data.rb:102:SubclassOfStructA#method_in_b -method_args.data.rb:104:class < Struct -method_args.data.rb:104:class StructSubclass < -method_args.data.rb:105:StructSubclass#method_in_c -XXX - - # To avoid dependency of pwd. - module StripDir - def strip_dir! - slice! %r!^.*/! - self - end - end - - @@expected.each do |line| - begin - file_lineno_klass_meth, rest = line.split(/\s+/,2) - if file_lineno_klass_meth =~ /:/ - file, lineno, klass_meth = file_lineno_klass_meth.split(/:/) - klass_meth = rest if %w[class include extend].include? klass_meth - else # filename/lineno is unknown - klass_meth = file_lineno_klass_meth - end - - test_method_name = "test_" + klass_meth - define_method(test_method_name) do - actual = @@result.grep(/#{klass_meth}/)[0].extend(StripDir).strip_dir! - assert_equal line, actual - end - rescue Exception - end - end - - def test_all_tests - assert_equal @@expected.length, @@result.length, @@result.join("\n") - end - - def test_without_n_option - first_line = "FixedArgsMethods.singleton (a1)" - command_output = `ruby '#{SCRIPT}' '#{DATAFILE}'` - assert_match(/\A#{Regexp.quote(first_line)}\n/, command_output) - end -end - - -class TestTAGS < Test::Unit::TestCase - include MethodArgsScriptConfig - - @@TAGS = `ruby '#{SCRIPT}' -t '#{DATAFILE}'` - def test_filename - # check whether full path is passed. - assert_match %r!^\cl\n/.+method_args.data.rb,\d!, @@TAGS - end - - def test_singleton_method - # including line/byte test - assert @@TAGS.include?(" def self.singleton(a1) end::FixedArgsMethods.singleton3,45") - end - - def test_instance_method - assert @@TAGS.include?(" def initialize(arg) end::FixedArgsMethods#initialize4,74") - end - - def test_include - assert_match(/^ include VariableArgsMethods::AClass/, @@TAGS) - end - - def test_extend - assert_match(/^ extend VariableArgsMethods::AClass/, @@TAGS) - end - - def test_inheritance - assert_match(/^class ASubClass < AClass::ASubClass/, @@TAGS) - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/test_options.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/test_options.rb deleted file mode 100644 index 8751516f2..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/test_options.rb +++ /dev/null @@ -1,33 +0,0 @@ -$: << ".." << "../lib" -require 'rcodetools/options' -require 'test/unit' -require 'tmpdir' -require 'fileutils' - -class TestOptionHandler < Test::Unit::TestCase - include Rcodetools - include OptionHandler - - def include_paths_check - options = { :include_paths => [] } - auto_include_paths options[:include_paths], Dir.pwd - assert options[:include_paths].include?("#{@basedir}/lib") - assert options[:include_paths].include?("#{@basedir}/bin") - end - - def test_auto_include_paths - Dir.chdir(Dir.tmpdir) do - begin - FileUtils.mkdir_p ["project", "project/lib/project", "project/bin", "project/share"] - open("project/Rakefile","w"){} - @basedir = File.expand_path "project" - Dir.chdir("project/lib/project/") { include_paths_check } - Dir.chdir("project/lib/") { include_paths_check } - Dir.chdir("project/bin/") { include_paths_check } - Dir.chdir("project/") { include_paths_check } - ensure - FileUtils.rm_rf "project" - end - end - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/test_ruby_toggle_file.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/test_ruby_toggle_file.rb deleted file mode 100644 index e7960f9a3..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/test_ruby_toggle_file.rb +++ /dev/null @@ -1,174 +0,0 @@ -require 'fileutils' -require 'test/unit' -require 'ruby_toggle_file' -require 'tmpdir' - -class TestRubyToggleFile < Test::Unit::TestCase - WORK_DIR = "#{Dir.tmpdir}/zdsfwfwejiotest".freeze - FileUtils.rm_rf WORK_DIR - - def teardown - FileUtils.rm_rf WORK_DIR - end - - def create(*files) - for file in files.map{|f| _(f) } - FileUtils.mkpath(File.dirname(file)) - open(file,"w"){} - end - end - - def _(path) # make full path - WORK_DIR + "/" + path - end - - ########################################################################### - # naming convention # - # test_METHOD__EXISTP__IMPLEMENTDIR_TESTDIR # - ########################################################################### - def test_test_file__exist__lib_test - create "lib/zero.rb", "test/test_zero.rb" - rtf = RubyToggleFile.new - assert_equal _("test/test_zero.rb"), rtf.ruby_toggle_file(_("lib/zero.rb")) - end - - def test_test_file__exist__libone_testone - create "lib/one/one.rb", "test/one/test_one.rb" - rtf = RubyToggleFile.new - assert_equal _("test/one/test_one.rb"), rtf.ruby_toggle_file(_("lib/one/one.rb")) - end - - def test_test_file__exist__libtwo_test - create "lib/two/two.rb", "test/test_two.rb" - rtf = RubyToggleFile.new - assert_equal _("test/test_two.rb"), rtf.ruby_toggle_file(_("lib/two/two.rb")) - end - - def test_test_file__exist__top_test - create "three.rb", "test_three.rb" - rtf = RubyToggleFile.new - assert_equal _("test_three.rb"), rtf.ruby_toggle_file(_("three.rb")) - end - - def test_test_file__not_exist__top - create "four.rb" - rtf = RubyToggleFile.new - assert_equal _("test_four.rb"), rtf.ruby_toggle_file(_("four.rb")) - end - - def test_test_file__not_exist__lib - create "lib/five.rb" - rtf = RubyToggleFile.new - assert_equal _("test/test_five.rb"), rtf.ruby_toggle_file(_("lib/five.rb")) - end - - def test_test_file__not_exist__libsixsix - create "lib/six/six/six.rb" - rtf = RubyToggleFile.new - assert_equal _("test/six/six/test_six.rb"), rtf.ruby_toggle_file(_("lib/six/six/six.rb")) - end - - def test_implementation_file__exist__lib_test - create "lib/zero.rb", "test/test_zero.rb" - rtf = RubyToggleFile.new - assert_equal _("lib/zero.rb"), rtf.ruby_toggle_file(_("test/test_zero.rb")) - end - - def test_implementation_file__exist__libone_testone - create "lib/one/one.rb", "test/one/test_one.rb" - rtf = RubyToggleFile.new - assert_equal _("lib/one/one.rb"), rtf.ruby_toggle_file(_("test/one/test_one.rb")) - end - - def test_implementation_file__exist__libtwo_test - create "lib/two/two.rb", "test/test_two.rb" - rtf = RubyToggleFile.new - assert_equal _("lib/two/two.rb"), rtf.ruby_toggle_file(_("test/test_two.rb")) - end - - def test_implementation_file__exist__top_test - create "three.rb", "test_three.rb" - rtf = RubyToggleFile.new - assert_equal _("three.rb"), rtf.ruby_toggle_file(_("test_three.rb")) - end - - def test_implementation_file__not_exist__none_top - create "test_seven.rb" - rtf = RubyToggleFile.new - assert_equal _("seven.rb"), rtf.ruby_toggle_file(_("test_seven.rb")) - end - - def test_implementation_file__not_exist__none_test - create "test/test_eight.rb" - rtf = RubyToggleFile.new - assert_equal _("lib/eight.rb"), rtf.ruby_toggle_file(_("test/test_eight.rb")) - end - - def test_implementation_file__not_exist__none_testninenine - create "test/nine/nine/nine.rb" - rtf = RubyToggleFile.new - assert_equal _("lib/nine/nine/nine.rb"), rtf.ruby_toggle_file(_("test/nine/nine/test_nine.rb")) - end - - ########################################################################### - # Rails test # - ########################################################################### - def test_test_file__rails_controllers - create "app/controllers/c.rb", "test/functional/c_test.rb" - rtf = RubyToggleFile.new - assert_equal _("test/functional/c_test.rb"), rtf.ruby_toggle_file(_("app/controllers/c.rb")) - end - - def test_test_file__rails_models - create "app/models/m.rb", "test/unit/m_test.rb" - rtf = RubyToggleFile.new - assert_equal _("test/unit/m_test.rb"), rtf.ruby_toggle_file(_("app/models/m.rb")) - end - - def test_test_file__rails_lib - create "lib/l.rb", "test/unit/test_l.rb", "app/models/m.rb" - rtf = RubyToggleFile.new - assert_equal _("test/unit/test_l.rb"), rtf.ruby_toggle_file(_("lib/l.rb")) - end - - - def test_implementation_file__rails_controllers - create "app/controllers/c.rb", "test/functional/c_test.rb" - rtf = RubyToggleFile.new - assert_equal _("app/controllers/c.rb"), rtf.ruby_toggle_file(_("test/functional/c_test.rb")) - end - - def test_implementation_file__rails_models - create "app/models/m.rb", "test/unit/m_test.rb" - rtf = RubyToggleFile.new - assert_equal _("app/models/m.rb"), rtf.ruby_toggle_file(_("test/unit/m_test.rb")) - end - - def test_implementation_file__rails_lib - create "lib/l.rb", "test/unit/test_l.rb", "app/models/m.rb" - rtf = RubyToggleFile.new - assert_equal _("lib/l.rb"), rtf.ruby_toggle_file(_("test/unit/test_l.rb")) - end -end - - -class TestRunHooksWithArgsUntilSuccess < Test::Unit::TestCase - def m001(x) nil end - private - def m002(x) false end - def m003(x) 100*x end - def m004(x) 200 end - - public - def test_run_hooks_with_args_until_success__m003 - assert_equal 1000, run_hooks_with_args_until_success(/^m\d+$/, 10) - end - - def test_run_hooks_with_args_until_success__m001 - assert_nil run_hooks_with_args_until_success(/^m001$/, 10) - end - - def test_run_hooks_with_args_until_success__m004 - assert_equal 200, run_hooks_with_args_until_success(/^m004$/, 10) - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/test_xmpfilter.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/test_xmpfilter.rb deleted file mode 100644 index 0ed9aa6b8..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/test_xmpfilter.rb +++ /dev/null @@ -1,221 +0,0 @@ - -require 'test/unit' -$: << ".." << "../lib" -require "rcodetools/xmpfilter" -require 'rubygems' -require 'mocha' - -class TestXMPFilter < Test::Unit::TestCase - include Rcodetools - def test_extract_data__results - marker = XMPFilter::MARKER - str = <<-EOF -#{marker}[1] => Fixnum 42 -#{marker}[1] => Fixnum 0 -#{marker}[1] ==> var -#{marker}[1] ==> var2 -#{marker}[4] ==> var3 -#{marker}[2] ~> some exception -#{marker}[10] => Fixnum 42 - EOF - xmp = XMPFilter.new - data = xmp.extract_data(str) - assert_equal([[1, [["Fixnum", "42"], ["Fixnum", "0"]]], [10, [["Fixnum", "42"]]]], data.results.sort) - end - - def test_extract_data__exceptions - marker = XMPFilter::MARKER - str = <<-EOF -#{marker}[1] => Fixnum 42 -#{marker}[1] => Fixnum 0 -#{marker}[1] ==> var -#{marker}[1] ==> var2 -#{marker}[4] ==> var3 -#{marker}[2] ~> some exception -#{marker}[10] => Fixnum 42 - EOF - xmp = XMPFilter.new - data = xmp.extract_data(str) - assert_equal([[2, ["some exception"]]], data.exceptions.sort) - end - - def test_extract_data__bindings - marker = XMPFilter::MARKER - str = <<-EOF -#{marker}[1] => Fixnum 42 -#{marker}[1] => Fixnum 0 -#{marker}[1] ==> var -#{marker}[1] ==> var2 -#{marker}[4] ==> var3 -#{marker}[2] ~> some exception -#{marker}[10] => Fixnum 42 - EOF - xmp = XMPFilter.new - data = xmp.extract_data(str) - assert_equal([[1, ["var", "var2"]], [4, ["var3"]]], data.bindings.sort) - end - - def test_interpreter_command - xmp = XMPFilter.new(:interpreter=>"ruby", :detect_rct_fork => false) - assert_equal(%w[ruby -w], xmp.interpreter_command) - end - - def test_interpreter_command_detect_rct_fork - Fork.stubs(:run?).returns true - xmp = XMPFilter.new(:interpreter=>"ruby", :detect_rct_fork => true) - assert_equal(%w[ruby -S rct-fork-client], xmp.interpreter_command) - end - - def test_interpreter_command_use_rbtest - xmp = XMPFilter.new(:interpreter=>"ruby", :use_rbtest => true) - assert_equal(%w[ruby -S rbtest], xmp.interpreter_command) - end - - def test_initialize__test_script_1 - XMPFilter.any_instance.stubs(:safe_require_code).returns("require 'test/unit'") - xmp = XMPFilter.new(:test_script=>"/path/to/test/test_ruby_toggle_file.rb", - :test_method=>"test_implementation_file_file_exist", - :filename=>"/path/to/lib/ruby_toggle_file.rb") - - evals_expected = [ - %q!$LOADED_FEATURES << "ruby_toggle_file.rb"!, - %q!require 'test/unit'!, - %q!load "/path/to/test/test_ruby_toggle_file.rb"!, - %q!Test::Unit::AutoRunner.run(false, nil, ["-n", "test_implementation_file_file_exist"])! - ] - assert_equal evals_expected, xmp.instance_variable_get(:@evals) - end - - def test_initialize__test_script_2 - XMPFilter.any_instance.stubs(:safe_require_code).returns("require 'test/unit'") - xmp = XMPFilter.new(:test_script=>"/path/to/test_ruby_toggle_file.rb", - :test_method=>"test_implementation_file_file_exist", - :filename=>"/path/to/ruby_toggle_file.rb") - - evals_expected = [ - %q!$LOADED_FEATURES << "ruby_toggle_file.rb"!, - %q!require 'test/unit'!, - %q!load "/path/to/test_ruby_toggle_file.rb"!, - %q!Test::Unit::AutoRunner.run(false, nil, ["-n", "test_implementation_file_file_exist"])! - ] - assert_equal evals_expected, xmp.instance_variable_get(:@evals) - end - - def test_initialize__test_script_3 - test_script = File.join(File.dirname(__FILE__), "data/sample_test_script.rb") - filename = File.join(File.dirname(__FILE__), "data/sample.rb") - XMPFilter.any_instance.stubs(:safe_require_code).returns("require 'test/unit'") - xmp = XMPFilter.new(:test_script=>test_script, :test_method=>"4", :filename=>filename) - - evals_expected = [ - %q!$LOADED_FEATURES << "sample.rb"!, - %q!require 'test/unit'!, - %Q!load #{test_script.dump}!, - %q!Test::Unit::AutoRunner.run(false, nil, ["-n", "test_sample0"])! - ] - assert_equal evals_expected, xmp.instance_variable_get(:@evals) - end - - def test_initialize__test_script__filename_eq_test_script - test_script = File.join(File.dirname(__FILE__), "data/sample_test_script.rb") - filename = test_script - xmp = XMPFilter.new(:test_script=>test_script, :test_method=>"4", :filename=>filename) - - evals_expected = [ - %q!Test::Unit::AutoRunner.run(false, nil, ["-n", "test_sample0"])! - ] - assert_equal evals_expected, xmp.instance_variable_get(:@evals) - end - - def test_get_test_method_from_lineno - file = File.join(File.dirname(__FILE__), "data/sample_test_script.rb") - xmp = XMPFilter.new - assert_equal("test_sample0", xmp.get_test_method_from_lineno(file, 4)) - assert_equal("test_sample1", xmp.get_test_method_from_lineno(file, 7)) - assert_equal("test_sample1", xmp.get_test_method_from_lineno(file, 8)) - assert_equal(nil, xmp.get_test_method_from_lineno(file, 1)) - end - - # Use methods to avoid confusing syntax highlighting - def beg() "=begin" end - def ed() "=end" end - - def test_s_detect_rbtest_1 - rbtest_script_1 = < true} - assert_equal true, XMPFilter.detect_rbtest(rbtest_script_1, opts) - assert_equal true, opts[:use_rbtest] - opts = {:detect_rbtest => false} - assert_equal false, XMPFilter.detect_rbtest(rbtest_script_1, opts) - assert_equal false, opts[:use_rbtest] - opts = {:detect_rbtest => false, :use_rbtest => true} - assert_equal true, XMPFilter.detect_rbtest(rbtest_script_1, opts) - assert_equal true, opts[:use_rbtest] - end - - def test_s_detect_rbtest_2 - rbtest_script_2 = < true} - assert_equal true, XMPFilter.detect_rbtest(rbtest_script_2, opts) - assert_equal true, opts[:use_rbtest] - opts = {:detect_rbtest => false} - assert_equal false, XMPFilter.detect_rbtest(rbtest_script_2, opts) - assert_equal false, opts[:use_rbtest] - end - - def test_s_detect_rbtest_3 - no_rbtest_script = < true} - assert_equal false, XMPFilter.detect_rbtest(no_rbtest_script, opts) - assert_equal false, opts[:use_rbtest] - opts = {:detect_rbtest => false} - assert_equal false, XMPFilter.detect_rbtest(no_rbtest_script, opts) - assert_equal false, opts[:use_rbtest] - end - -end - -class TestTempScript < Test::Unit::TestCase - def test(script) - Rcodetools::XMPFilter.new.__send__(:split_shbang,script) - end - - def test_none - assert_equal [[], ["1\n"]], test(< -arr.last # \=> -EOF - ANNOTATION_VAR_INFERENCE_OUTPUT = <]\", arr.inspect) -assert_equal(x, arr.last) -assert_kind_of(X, arr.last) -assert_equal(\"#\", arr.last.inspect) -EOF - - def test_annotation_var_inference - xmp = XMPTestUnitFilter.new - assert_equal(ANNOTATION_VAR_INFERENCE_OUTPUT, - xmp.annotate(ANNOTATION_VAR_INFERENCE_INPUT).join("")) - end - - def test_equality_assertions - xmp = XMPTestUnitFilter.new - assert_equal(["a = 1\n", "assert_equal(1, a)"], xmp.annotate("a = 1\na # \=>")) - assert_equal(["a = {1,2}\n", "assert_equal({1=>2}, a)"], - xmp.annotate("a = {1,2}\na # \=>")) - assert_equal(["a = [1,2]\n", "assert_equal([1, 2], a)"], - xmp.annotate("a = [1,2]\na # \=>")) - assert_equal(["a = 'foo'\n", "assert_equal(\"foo\", a)"], - xmp.annotate("a = 'foo'\na # \=>")) - assert_equal(["a = 1.0\n", "assert_in_delta(1.0, a, 0.0001)"], - xmp.annotate("a = 1.0\na # \=>")) - end - - def test_raise_assertion - code = < -EOF - xmp = XMPTestUnitFilter.new - assert_equal(["class NoGood < Exception; end\n", - "assert_raise(NoGood){raise NoGood}\n"], xmp.annotate(code)) - end - - def test_assert_nil - xmp = XMPTestUnitFilter.new - assert_equal(["a = nil\n", "assert_nil(a)"], xmp.annotate("a = nil\na # \=>")) - end - - def test_poetry_mode - code = < -a = 1.0 -a # \=> -raise "foo" # \=> -a = nil -a # \=> -EOF - output = < false) - assert_equal(output, xmp.annotate(code).join) - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/tmp_functional.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/tmp_functional.rb deleted file mode 100644 index 339fdfc2b..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/tmp_functional.rb +++ /dev/null @@ -1,162 +0,0 @@ -require 'test/unit' - -module TestFunctional - DIR = File.expand_path(File.dirname(__FILE__)) - LIBDIR = File.expand_path(DIR + '/../lib') - - module DefineFunctionalTests - def define_functional_tests(bin, exec, tests) - tests.each_pair do |test, opts| - define_method("test_#{test}") do - - output = `ruby -I#{LIBDIR} #{exec} #{opts.join(" ")} #{DIR}/data/#{test}-input.rb` - outputfile = "#{DIR}/data/#{test}-output.rb" - taffile = "#{DIR}/data/#{bin}/#{test}.taf" - open(taffile, "w") do |f| - f.puts "==========" - f.puts test - f.puts "==========" - f.puts bin + " " + opts.join(" ") - f.puts "==========" - f.puts File.read("#{DIR}/data/#{test}-input.rb") - f.puts "==========" - f.puts File.read("#{DIR}/data/#{test}-output.rb") - end -# assert_equal(File.read(outputfile), output) - end - end - end - end - - class TestXmpfilter < Test::Unit::TestCase - extend DefineFunctionalTests - tests = { - :simple_annotation => [], :unit_test => ["-u"], :rspec => ["-s"], - :no_warnings => ["--no-warnings"], :bindings => ["--poetry", "-u"], - :add_markers => ["-m"], :unit_test_rbtest => ["-u", "--rbtest"], - :unit_test_detect_rbtest => ["-u", "--detect-rbtest"], - :unit_test_detect_rbtest2 => ["--detect-rbtest"], - } - define_functional_tests "xmpfilter", File.expand_path(DIR + '/../bin/xmpfilter'), tests - end - - class TestRctComplete < Test::Unit::TestCase - extend DefineFunctionalTests - tests = { - :completion_rbtest => [ "--rbtest", "--line=6" ], - :completion_detect_rbtest => [ "--detect-rbtest", "--line=6" ], - :completion_detect_rbtest2 => [ "--detect-rbtest", "--line=1" ], - } - define_functional_tests "rct-complete", File.expand_path(DIR + '/../bin/rct-complete'), tests - end - - class TestRctDoc < Test::Unit::TestCase - extend DefineFunctionalTests - tests = { - :doc_rbtest => [ "--rbtest", "--line=6" ], - :doc_detect_rbtest => [ "--detect-rbtest", "--line=1" ], - :doc_detect_rbtest2 => [ "--detect-rbtest", "--line=6" ], - } - define_functional_tests "rct-doc", File.expand_path(DIR + '/../bin/rct-doc'), tests - end - - - # Other tests are in test_run.rb - class TestRctCompleteTDC < Test::Unit::TestCase - test = :completion_in_method - inputfile = "#{DIR}/data/#{test}-input.rb" - outputfile = "#{DIR}/data/#{test}-output.rb" - test_script = "#{DIR}/data/#{test}-test.rb" - common_opts = ["--filename #{inputfile}", "--line 2"] - right_output = File.read(outputfile) - wrong_output = "\n" - - tests = { - :completion_in_method__testscript => - [ common_opts + ["-t #{test_script}"], right_output ], - :completion_in_method__testmethod => - [ common_opts + ["-t #{test_script}@test_fooz"], right_output ], - :completion_in_method__wrong_testmethod => - [ common_opts + ["-t #{test_script}@test_NOT_FOUND"], wrong_output ], - } - exec = File.expand_path(DIR + '/../bin/rct-complete') -# tests.each_pair do |test, (opts, expected)| -# define_method("test_#{test}") do -# output = `ruby -I#{LIBDIR} #{exec} #{opts.join(" ")} #{inputfile}` - -# taffile = "#{DIR}/data/#{bin}/#{test}.taf" -# open(taffile, "w") do |f| -# f.puts "==========" -# f.puts test -# f.puts "==========" -# f.puts bin + " " + opts.join(" ") -# f.puts "==========" -# f.puts File.read("#{DIR}/data/#{test}-input.rb") -# f.puts "==========" -# f.puts File.read("#{DIR}/data/#{test}-output.rb") -# end -# end -# end - - test=:completion_in_method__testscript - define_method("test_#{test}") do - taffile = "#{DIR}/data/rct-complete-TDC/completion_in_method__testscript.taf" - open(taffile, "w") do |f| - opts = tests[test] - f.puts "==========" - f.puts test - f.puts "==========" - f.puts "rct-complete " + opts.join(" ") - f.puts "==========" - test0 = :completion_in_method - f.puts File.read("#{DIR}/data/#{test0}-input.rb") - f.puts "==========" - f.puts File.read("#{DIR}/data/#{test0}-output.rb") - f.puts "==========" - f.puts File.read("#{DIR}/data/#{test0}-test.rb") - end - - end - - test=:completion_in_method__testmethod - define_method("test_#{test}") do - taffile = "#{DIR}/data/rct-complete-TDC/completion_in_method__testmethod.taf" - open(taffile, "w") do |f| - opts = tests[test] - f.puts "==========" - f.puts test - f.puts "==========" - f.puts "rct-complete " + opts.join(" ") - f.puts "==========" - test0 = :completion_in_method - f.puts File.read("#{DIR}/data/#{test0}-input.rb") - f.puts "==========" - f.puts File.read("#{DIR}/data/#{test0}-output.rb") - f.puts "==========" - f.puts File.read("#{DIR}/data/#{test0}-test.rb") - end - - end - - test=:completion_in_method__wrong_testmethod - define_method("test_#{test}") do - taffile = "#{DIR}/data/rct-complete-TDC/completion_in_method__wrong_testmethod.taf" - open(taffile, "w") do |f| - opts = tests[test] - f.puts "==========" - f.puts test - f.puts "==========" - f.puts "rct-complete " + opts.join(" ") - f.puts "==========" - test0 = :completion_in_method - f.puts File.read("#{DIR}/data/#{test0}-input.rb") - f.puts "==========" - f.puts - f.puts "==========" - f.puts File.read("#{DIR}/data/#{test0}-test.rb") - end - - end - - end -end diff --git a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/tmp_run.rb b/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/tmp_run.rb deleted file mode 100644 index b3bed0d01..000000000 --- a/bundles/ruby.tmbundle/Support/vendor/rcodetools/test/tmp_run.rb +++ /dev/null @@ -1,66 +0,0 @@ -require 'test/unit' -require 'rcodetools/xmpfilter' -require 'rcodetools/xmptestunitfilter' -require 'rcodetools/completion' -require 'rcodetools/doc' -require 'rcodetools/options' -require 'stringio' - -class TestRun < Test::Unit::TestCase - include Rcodetools - DIR = File.expand_path(File.dirname(__FILE__)) - - tests = { -# :rspec_poetry => {:klass => XMPRSpecFilter, :interpreter => "spec", :use_parentheses => false}, - :rspec_poetry => ["xmpfilter", "-s --poetry"], -# :unit_test_poetry => {:klass => XMPTestUnitFilter, :use_parentheses => false}, - :unit_test_poetry => ["xmpfilter", "-u --poetry"], - -# :completion => {:klass => XMPCompletionFilter, :lineno => 1}, - :completion => ["rct-complete", "-C --line=1"], -# :completion_emacs => {:klass => XMPCompletionEmacsFilter, :lineno => 1}, - :completion_emacs => ["rct-complete", "--completion-emacs --line=1"], -# :completion_emacs_icicles => {:klass => XMPCompletionEmacsIciclesFilter, :lineno => 1}, - :completion_emacs_icicles => ["rct-complete","--completion-emacs-icicles --line=1"], -# :completion_class_info => {:klass => XMPCompletionClassInfoFilter, :lineno => 1}, - :completion_class_info => ["rct-complete", "--completion-class-info --line=1"], -# :completion_class_info_no_candidates => {:klass => XMPCompletionClassInfoFilter, :lineno => 1}, - :completion_class_info_no_candidates => ["rct-complete", "--completion-class-info --line=1"], - -# :doc => {:klass => XMPDocFilter, :lineno => 1}, -# :refe => {:klass => XMPReFeFilter, :lineno => 1}, -# :ri => {:klass => XMPRiFilter, :lineno => 1}, -# :ri_emacs => {:klass => XMPRiEmacsFilter, :lineno => 1}, -# :ri_vim => {:klass => XMPRiVimFilter, :lineno => 1}, - :doc => ["rct-doc", "-D --line=1"], - :refe => ["rct-doc", "--refe --line=1"], - :ri => ["rct-doc", "--ri --line=1"], - :ri_emacs => ["rct-doc", "--ri-emacs --line=1"], - :ri_vim => ["rct-doc", "--ri-vim --line=1"], - - } - DIR = File.expand_path(File.dirname(__FILE__)) - LIBDIR = File.expand_path(DIR + '/../lib') - - tests.each_pair do |test, (bin,opts)| - define_method("test_#{test}") do - inputfile = "#{DIR}/data/#{test}-input.rb" - outputfile = "#{DIR}/data/#{test}-output.rb" - -# exec = File.expand_path(DIR + '/../bin/xmpfilter') -# output = `ruby -I#{LIBDIR} #{exec} #{opts} #{DIR}/data/#{test}-input.rb` -# outputfile = "#{DIR}/data/#{test}-output.rb" - taffile = "#{DIR}/data/#{bin}/#{test}.taf" - open(taffile, "w") do |f| - f.puts "==========" - f.puts test - f.puts "==========" - f.puts bin + " " + opts - f.puts "==========" - f.puts File.read("#{DIR}/data/#{test}-input.rb") - f.puts "==========" - f.puts File.read("#{DIR}/data/#{test}-output.rb") - end - end - end -end diff --git a/bundles/ruby.tmbundle/Syntaxes/Ruby.plist b/bundles/ruby.tmbundle/Syntaxes/Ruby.plist deleted file mode 100644 index 8070bb973..000000000 --- a/bundles/ruby.tmbundle/Syntaxes/Ruby.plist +++ /dev/null @@ -1,2853 +0,0 @@ - - - - - comment - - TODO: unresolved issues - - text: - "p << end - print me! - end" - symptoms: - not recognized as a heredoc - solution: - there is no way to distinguish perfectly between the << operator and the start - of a heredoc. Currently, we require assignment to recognize a heredoc. More - refinement is possible. - • Heredocs with indented terminators (<<-) are always distinguishable, however. - • Nested heredocs are not really supportable at present - - text: - print <<-'THERE' - This is single quoted. - The above used #{Time.now} - THERE - symtoms: - From Programming Ruby p306; should be a non-interpolated heredoc. - - text: - "a\332a" - symptoms: - '\332' is not recognized as slash3.. which should be octal 332. - solution: - plain regexp.. should be easy. - - text: - val?(a):p(b) - val?'a':'b' - symptoms: - ':p' is recognized as a symbol.. its 2 things ':' and 'p'. - :'b' has same problem. - solution: - ternary operator rule, precedence stuff, symbol rule. - but also consider 'a.b?(:c)' ?? - - fileTypes - - rb - rbx - rjs - Rakefile - rake - cgi - fcgi - gemspec - irbrc - capfile - - firstLineMatch - ^#!/.*\bruby - foldingStartMarker - (?x)^ - (\s*+ - (module|class|def(?!.*\bend\s*$) - |unless|if - |case - |begin - |for|while|until - |^=begin - |( "(\\.|[^"])*+" # eat a double quoted string - | '(\\.|[^'])*+' # eat a single quoted string - | [^#"'] # eat all but comments and strings - )* - ( \s (do|begin|case) - | (?<!\$)[-+=&|*/~%^<>~] \s*+ (if|unless) - ) - )\b - (?! [^;]*+ ; .*? \bend\b ) - |( "(\\.|[^"])*+" # eat a double quoted string - | '(\\.|[^'])*+' # eat a single quoted string - | [^#"'] # eat all but comments and strings - )* - ( \{ (?! [^}]*+ \} ) - | \[ (?! [^\]]*+ \] ) - ) - ).*$ - | [#] .*? \(fold\) \s*+ $ # Sune’s special marker - - foldingStopMarker - (?x) - ( (^|;) \s*+ end \s*+ ([#].*)? $ - | (^|;) \s*+ end \. .* $ - | ^ \s*+ [}\]] ,? \s*+ ([#].*)? $ - | [#] .*? \(end\) \s*+ $ # Sune’s special marker - | ^=end - ) - keyEquivalent - ^~R - name - Ruby - patterns - - - captures - - 1 - - name - keyword.control.class.ruby - - 2 - - name - entity.name.type.class.ruby - - 4 - - name - entity.other.inherited-class.ruby - - 5 - - name - punctuation.separator.inheritance.ruby - - 6 - - name - variable.other.object.ruby - - 7 - - name - punctuation.definition.variable.ruby - - - match - ^\s*(class)\s+(([.a-zA-Z0-9_:]+(\s*(<)\s*[.a-zA-Z0-9_:]+)?)|((<<)\s*[.a-zA-Z0-9_:]+)) - name - meta.class.ruby - - - captures - - 1 - - name - keyword.control.module.ruby - - 2 - - name - entity.name.type.module.ruby - - 3 - - name - entity.other.inherited-class.module.first.ruby - - 4 - - name - punctuation.separator.inheritance.ruby - - 5 - - name - entity.other.inherited-class.module.second.ruby - - 6 - - name - punctuation.separator.inheritance.ruby - - 7 - - name - entity.other.inherited-class.module.third.ruby - - 8 - - name - punctuation.separator.inheritance.ruby - - - match - ^\s*(module)\s+(([A-Z]\w*(::))?([A-Z]\w*(::))?([A-Z]\w*(::))*[A-Z]\w*) - name - meta.module.ruby - - - comment - else if is a common mistake carried over from other languages. it works if you put in a second end, but it’s never what you want. - match - (?<!\.)\belse(\s)+if\b - name - invalid.deprecated.ruby - - - comment - everything being a reserved word, not a value and needing a 'end' is a.. - match - (?<!\.)\b(BEGIN|begin|case|class|else|elsif|END|end|ensure|for|if|in|module|rescue|then|unless|until|when|while)\b(?![?!]) - name - keyword.control.ruby - - - comment - contextual smart pair support for block parameters - match - (?<!\.)\bdo\b\s* - name - keyword.control.start-block.ruby - - - comment - contextual smart pair support - match - (?<=\{)(\s+) - name - meta.syntax.ruby.start-block - - - comment - as above, just doesn't need a 'end' and does a logic operation - match - (?<!\.)\b(and|not|or)\b - name - keyword.operator.logical.ruby - - - comment - just as above but being not a logical operation - match - (?<!\.)\b(alias|alias_method|break|next|redo|retry|return|super|undef|yield)\b(?![?!])|\bdefined\?|\bblock_given\? - name - keyword.control.pseudo-method.ruby - - - match - \b(nil|true|false)\b(?![?!]) - name - constant.language.ruby - - - match - \b(__(FILE|LINE)__|self)\b(?![?!]) - name - variable.language.ruby - - - comment - everything being a method but having a special function is a.. - match - \b(initialize|new|loop|include|extend|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|module_function|public|protected)\b(?![?!]) - name - keyword.other.special-method.ruby - - - begin - \b(require|gem)\b - captures - - 1 - - name - keyword.other.special-method.ruby - - - end - $|(?=#) - name - meta.require.ruby - patterns - - - include - $self - - - - - captures - - 1 - - name - punctuation.definition.variable.ruby - - - match - (@)[a-zA-Z_]\w* - name - variable.other.readwrite.instance.ruby - - - captures - - 1 - - name - punctuation.definition.variable.ruby - - - match - (@@)[a-zA-Z_]\w* - name - variable.other.readwrite.class.ruby - - - captures - - 1 - - name - punctuation.definition.variable.ruby - - - match - (\$)[a-zA-Z_]\w* - name - variable.other.readwrite.global.ruby - - - captures - - 1 - - name - punctuation.definition.variable.ruby - - - match - (\$)(!|@|&|`|'|\+|\d+|~|=|/|\\|,|;|\.|<|>|_|\*|\$|\?|:|"|-[0adFiIlpv]) - name - variable.other.readwrite.global.pre-defined.ruby - - - begin - \b(ENV)\[ - beginCaptures - - 1 - - name - variable.other.constant.ruby - - - end - \] - name - meta.environment-variable.ruby - patterns - - - include - $self - - - - - match - \b[A-Z]\w*(?=((\.|::)[A-Za-z]|\[)) - name - support.class.ruby - - - match - \b[A-Z]\w*\b - name - variable.other.constant.ruby - - - begin - (?x) - (?=def\b) # an optimization to help Oniguruma fail fast - (?<=^|\s)(def)\s+ # the def keyword - ( (?>[a-zA-Z_]\w*(?>\.|::))? # a method name prefix - (?>[a-zA-Z_]\w*(?>[?!]|=(?!>))? # the method name - |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method - \s*(\() # the openning parenthesis for arguments - - beginCaptures - - 1 - - name - keyword.control.def.ruby - - 2 - - name - entity.name.function.ruby - - 3 - - name - punctuation.definition.parameters.ruby - - - comment - the method pattern comes from the symbol pattern, see there for a explaination - contentName - variable.parameter.function.ruby - end - \) - endCaptures - - 0 - - name - punctuation.definition.parameters.ruby - - - name - meta.function.method.with-arguments.ruby - patterns - - - include - $self - - - - - begin - (?x) - (?=def\b) # an optimization to help Oniguruma fail fast - (?<=^|\s)(def)\s+ # the def keyword - ( (?>[a-zA-Z_]\w*(?>\.|::))? # a method name prefix - (?>[a-zA-Z_]\w*(?>[?!]|=(?!>))? # the method name - |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method - [ \t] # the space separating the arguments - (?=[ \t]*[^\s#;]) # make sure arguments and not a comment follow - - beginCaptures - - 1 - - name - keyword.control.def.ruby - - 2 - - name - entity.name.function.ruby - - - comment - same as the previous rule, but without parentheses around the arguments - contentName - variable.parameter.function.ruby - end - $ - name - meta.function.method.with-arguments.ruby - patterns - - - include - $self - - - - - captures - - 1 - - name - keyword.control.def.ruby - - 3 - - name - entity.name.function.ruby - - - comment - the optional name is just to catch the def also without a method-name - match - (?x) - (?=def\b) # an optimization to help Oniguruma fail fast - (?<=^|\s)(def)\b # the def keyword - ( \s+ # an optional group of whitespace followed by… - ( (?>[a-zA-Z_]\w*(?>\.|::))? # a method name prefix - (?>[a-zA-Z_]\w*(?>[?!]|=(?!>))? # the method name - |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) )? # …or an operator method - - name - meta.function.method.without-arguments.ruby - - - match - \b(0[xX]\h(?>_?\h)*|\d(?>_?\d)*(\.(?![^[:space:][:digit:]])(?>_?\d)*)?([eE][-+]?\d(?>_?\d)*)?|0[bB][01]+)\b - name - constant.numeric.ruby - - - begin - :' - captures - - 0 - - name - punctuation.definition.constant.ruby - - - end - ' - name - constant.other.symbol.single-quoted.ruby - patterns - - - match - \\['\\] - name - constant.character.escape.ruby - - - - - begin - :" - captures - - 0 - - name - punctuation.definition.constant.ruby - - - end - " - name - constant.other.symbol.double-quoted.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - comment - Needs higher precidence than regular expressions. - match - (?<!\()/= - name - keyword.operator.assignment.augmented.ruby - - - begin - ' - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - single quoted string (does not allow interpolation) - end - ' - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.single.ruby - patterns - - - match - \\'|\\\\ - name - constant.character.escape.ruby - - - - - begin - " - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - double quoted string (allows for interpolation) - end - " - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.double.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - ` - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allows for interpolation) - end - ` - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - %x\{ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \} - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_curly_i - - - - - begin - %x\[ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \] - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_brackets_i - - - - - begin - %x\< - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \> - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_ltgt_i - - - - - begin - %x\( - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \) - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_parens_i - - - - - begin - %x([^\w]) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \1 - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?x) - (?: - ^ # beginning of line - | (?<= # or look-behind on: - [=>~(?:\[,|&;] - | [\s;]if\s # keywords - | [\s;]elsif\s - | [\s;]while\s - | [\s;]unless\s - | [\s;]when\s - | [\s;]assert_match\s - | [\s;]or\s # boolean opperators - | [\s;]and\s - | [\s;]not\s - | [\s.]index\s # methods - | [\s.]scan\s - | [\s.]sub\s - | [\s.]sub!\s - | [\s.]gsub\s - | [\s.]gsub!\s - | [\s.]match\s - ) - | (?<= # or a look-behind with line anchor: - ^when\s # duplication necessary due to limits of regex - | ^if\s - | ^elsif\s - | ^while\s - | ^unless\s - ) - ) - \s*((/))(?![*+{}?]) - - captures - - 1 - - name - string.regexp.classic.ruby - - 2 - - name - punctuation.definition.string.ruby - - - comment - regular expressions (normal) - we only start a regexp if the character before it (excluding whitespace) - is what we think is before a regexp - - contentName - string.regexp.classic.ruby - end - ((/[eimnosux]*)) - patterns - - - include - #regex_sub - - - - - begin - %r\{ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - regular expressions (literal) - end - \}[eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.regexp.mod-r.ruby - patterns - - - include - #regex_sub - - - include - #nest_curly_r - - - - - begin - %r\[ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - regular expressions (literal) - end - \][eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.regexp.mod-r.ruby - patterns - - - include - #regex_sub - - - include - #nest_brackets_r - - - - - begin - %r\( - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - regular expressions (literal) - end - \)[eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.regexp.mod-r.ruby - patterns - - - include - #regex_sub - - - include - #nest_parens_r - - - - - begin - %r\< - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - regular expressions (literal) - end - \>[eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.regexp.mod-r.ruby - patterns - - - include - #regex_sub - - - include - #nest_ltgt_r - - - - - begin - %r([^\w]) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - regular expressions (literal) - end - \1[eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.regexp.mod-r.ruby - patterns - - - include - #regex_sub - - - - - begin - %[QWSR]?\( - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal capable of interpolation () - end - \) - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.other.literal.upper.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_parens_i - - - - - begin - %[QWSR]?\[ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal capable of interpolation [] - end - \] - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.other.literal.upper.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_brackets_i - - - - - begin - %[QWSR]?\< - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal capable of interpolation <> - end - \> - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.other.literal.upper.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_ltgt_i - - - - - begin - %[QWSR]?\{ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal capable of interpolation -- {} - end - \} - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.double.ruby.mod - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_curly_i - - - - - begin - %[QWSR]([^\w]) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal capable of interpolation -- wildcard - end - \1 - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.other.literal.upper.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - %([^\w\s=]) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal capable of interpolation -- wildcard - end - \1 - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.other.literal.other.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - %[qws]\( - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal incapable of interpolation -- () - end - \) - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.other.literal.lower.ruby - patterns - - - match - \\\)|\\\\ - name - constant.character.escape.ruby - - - include - #nest_parens - - - - - begin - %[qws]\< - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal incapable of interpolation -- <> - end - \> - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.other.literal.lower.ruby - patterns - - - match - \\\>|\\\\ - name - constant.character.escape.ruby - - - include - #nest_ltgt - - - - - begin - %[qws]\[ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal incapable of interpolation -- [] - end - \] - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.other.literal.lower.ruby - patterns - - - match - \\\]|\\\\ - name - constant.character.escape.ruby - - - include - #nest_brackets - - - - - begin - %[qws]\{ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal incapable of interpolation -- {} - end - \} - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.other.literal.lower.ruby - patterns - - - match - \\\}|\\\\ - name - constant.character.escape.ruby - - - include - #nest_curly - - - - - begin - %[qws]([^\w]) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal incapable of interpolation -- wildcard - end - \1 - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.other.literal.lower.ruby - patterns - - - comment - Cant be named because its not neccesarily an escape. - match - \\. - - - - - captures - - 1 - - name - punctuation.definition.constant.ruby - - - comment - symbols - match - (?<!:)(:)(?>[a-zA-Z_]\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?|@@?[a-zA-Z_]\w*) - name - constant.other.symbol.ruby - - - captures - - 1 - - name - punctuation.definition.constant.ruby - - - comment - symbols - match - (?>[a-zA-Z_]\w*(?>[?!])?)(:)(?!:) - name - constant.other.symbol.ruby.19syntax - - - begin - ^=begin - captures - - 0 - - name - punctuation.definition.comment.ruby - - - comment - multiline comments - end - ^=end - name - comment.block.documentation.ruby - - - captures - - 1 - - name - punctuation.definition.comment.ruby - - - match - (?:^[ \t]+)?(#).*$\n? - name - comment.line.number-sign.ruby - - - comment - - matches questionmark-letters. - - examples (1st alternation = hex): - ?\x1 ?\x61 - - examples (2nd alternation = octal): - ?\0 ?\07 ?\017 - - examples (3rd alternation = escaped): - ?\n ?\b - - examples (4th alternation = meta-ctrl): - ?\C-a ?\M-a ?\C-\M-\C-\M-a - - examples (4th alternation = normal): - ?a ?A ?0 - ?* ?" ?( - ?. ?# - - - the negative lookbehind prevents against matching - p(42.tainted?) - - match - (?<!\w)\?(\\(x\h{1,2}(?!\h)\b|0[0-7]{0,2}(?![0-7])\b|[^x0MC])|(\\[MC]-)+\w|[^\s\\]) - name - constant.numeric.ruby - - - begin - ^__END__\n - captures - - 0 - - name - string.unquoted.program-block.ruby - - - comment - __END__ marker - contentName - text.plain - end - (?=not)impossible - patterns - - - begin - (?=<?xml|<(?i:html\b)|!DOCTYPE (?i:html\b)) - end - (?=not)impossible - name - text.html.embedded.ruby - patterns - - - include - text.html.basic - - - - - - - begin - (?><<-("?)((?:[_\w]+_|)HTML)\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - heredoc with embedded HTML and indented terminator - contentName - text.html.embedded.ruby - end - \s*\2$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.embedded.html.ruby - patterns - - - include - #heredoc - - - include - text.html.basic - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?><<-("?)((?:[_\w]+_|)SQL)\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - heredoc with embedded SQL and indented terminator - contentName - text.sql.embedded.ruby - end - \s*\2$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.embedded.sql.ruby - patterns - - - include - #heredoc - - - include - source.sql - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?><<-("?)((?:[_\w]+_|)CSS)\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - heredoc with embedded css and intented terminator - contentName - text.css.embedded.ruby - end - \s*\2$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.embedded.css.ruby - patterns - - - include - #heredoc - - - include - source.css - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?><<-("?)((?:[_\w]+_|)CPP)\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - heredoc with embedded c++ and intented terminator - contentName - text.c++.embedded.ruby - end - \s*\2$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.embedded.cplusplus.ruby - patterns - - - include - #heredoc - - - include - source.c++ - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?><<-("?)((?:[_\w]+_|)C)\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - heredoc with embedded c++ and intented terminator - contentName - text.c.embedded.ruby - end - \s*\2$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.embedded.c.ruby - patterns - - - include - #heredoc - - - include - source.c - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?><<-("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - heredoc with embedded javascript and intented terminator - contentName - text.js.embedded.ruby - end - \s*\2$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.embedded.js.ruby - patterns - - - include - #heredoc - - - include - source.js - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?><<-("?)((?:[_\w]+_|)JQUERY)\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - heredoc with embedded javascript and intented terminator - contentName - text.js.jquery.embedded.ruby - end - \s*\2$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.embedded.js.jquery.ruby - patterns - - - include - #heredoc - - - include - source.js.jquery - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?><<-("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - heredoc with embedded shell and intented terminator - contentName - text.shell.embedded.ruby - end - \s*\2$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.embedded.shell.ruby - patterns - - - include - #heredoc - - - include - source.shell - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?><<-("?)((?:[_\w]+_|)RUBY)\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - heredoc with embedded ruby and intented terminator - contentName - text.ruby.embedded.ruby - end - \s*\2$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.embedded.ruby.ruby - patterns - - - include - #heredoc - - - include - source.ruby - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?>\=\s*<<(\w+)) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - end - ^\1$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.heredoc.ruby - patterns - - - include - #heredoc - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?><<-(\w+)) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - heredoc with indented terminator - end - \s*\1$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.heredoc.ruby - patterns - - - include - #heredoc - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?<=\{|do|\{\s|do\s)(\|) - captures - - 1 - - name - punctuation.separator.variable.ruby - - - end - (\|) - patterns - - - match - [_a-zA-Z][_a-zA-Z0-9]* - name - variable.other.block.ruby - - - match - , - name - punctuation.separator.variable.ruby - - - - - match - => - name - punctuation.separator.key-value - - - match - <<=|%=|&=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|<< - name - keyword.operator.assignment.augmented.ruby - - - match - <=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?<=[ \t])\? - name - keyword.operator.comparison.ruby - - - match - (?<=[ \t])!+|\bnot\b|&&|\band\b|\|\||\bor\b|\^ - name - keyword.operator.logical.ruby - - - match - (%|&|\*\*|\*|\+|\-|/) - name - keyword.operator.arithmetic.ruby - - - match - = - name - keyword.operator.assignment.ruby - - - match - \||~|>> - name - keyword.operator.other.ruby - - - match - : - name - punctuation.separator.other.ruby - - - match - \; - name - punctuation.separator.statement.ruby - - - match - , - name - punctuation.separator.object.ruby - - - match - \.|:: - name - punctuation.separator.method.ruby - - - match - \{|\} - name - punctuation.section.scope.ruby - - - match - \[|\] - name - punctuation.section.array.ruby - - - match - \(|\) - name - punctuation.section.function.ruby - - - repository - - escaped_char - - match - \\(?:[0-7]{1,3}|x[\da-fA-F]{1,2}|.) - name - constant.character.escape.ruby - - heredoc - - begin - ^<<-?\w+ - end - $ - patterns - - - include - $self - - - - interpolated_ruby - - patterns - - - captures - - 0 - - name - punctuation.section.embedded.ruby - - 1 - - name - source.ruby.embedded.source.empty - - - match - #\{(\}) - name - source.ruby.embedded.source - - - begin - #\{ - captures - - 0 - - name - punctuation.section.embedded.ruby - - - end - \} - name - source.ruby.embedded.source - patterns - - - include - #nest_curly_and_self - - - include - $self - - - - - captures - - 1 - - name - punctuation.definition.variable.ruby - - - match - (#@)[a-zA-Z_]\w* - name - variable.other.readwrite.instance.ruby - - - captures - - 1 - - name - punctuation.definition.variable.ruby - - - match - (#@@)[a-zA-Z_]\w* - name - variable.other.readwrite.class.ruby - - - captures - - 1 - - name - punctuation.definition.variable.ruby - - - match - (#\$)[a-zA-Z_]\w* - name - variable.other.readwrite.global.ruby - - - - nest_brackets - - begin - \[ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \] - patterns - - - include - #nest_brackets - - - - nest_brackets_i - - begin - \[ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \] - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_brackets_i - - - - nest_brackets_r - - begin - \[ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \] - patterns - - - include - #regex_sub - - - include - #nest_brackets_r - - - - nest_curly - - begin - \{ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \} - patterns - - - include - #nest_curly - - - - nest_curly_and_self - - patterns - - - begin - \{ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \} - patterns - - - include - #nest_curly_and_self - - - - - include - $self - - - - nest_curly_i - - begin - \{ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \} - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_curly_i - - - - nest_curly_r - - begin - \{ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \} - patterns - - - include - #regex_sub - - - include - #nest_curly_r - - - - nest_ltgt - - begin - \< - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \> - patterns - - - include - #nest_ltgt - - - - nest_ltgt_i - - begin - \< - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \> - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_ltgt_i - - - - nest_ltgt_r - - begin - \< - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \> - patterns - - - include - #regex_sub - - - include - #nest_ltgt_r - - - - nest_parens - - begin - \( - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \) - patterns - - - include - #nest_parens - - - - nest_parens_i - - begin - \( - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \) - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_parens_i - - - - nest_parens_r - - begin - \( - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \) - patterns - - - include - #regex_sub - - - include - #nest_parens_r - - - - regex_sub - - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - captures - - 1 - - name - punctuation.definition.arbitrary-repitition.ruby - - 3 - - name - punctuation.definition.arbitrary-repitition.ruby - - - match - (\{)\d+(,\d+)?(\}) - name - string.regexp.arbitrary-repitition.ruby - - - begin - \[(?:\^?\])? - captures - - 0 - - name - punctuation.definition.character-class.ruby - - - end - \] - name - string.regexp.character-class.ruby - patterns - - - include - #escaped_char - - - - - begin - \( - captures - - 0 - - name - punctuation.definition.group.ruby - - - end - \) - name - string.regexp.group.ruby - patterns - - - include - #regex_sub - - - - - captures - - 1 - - name - punctuation.definition.comment.ruby - - - comment - We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags. - match - (?<=^|\s)(#)\s[[a-zA-Z0-9,. \t?!-][^\x{00}-\x{7F}]]*$ - name - comment.line.number-sign.ruby - - - - - scopeName - source.ruby - uuid - E00B62AC-6B1C-11D9-9B1F-000D93589AF6 - - diff --git a/bundles/ruby.tmbundle/Tests/division_ambiguity.rb b/bundles/ruby.tmbundle/Tests/division_ambiguity.rb deleted file mode 100644 index a20e52a46..000000000 --- a/bundles/ruby.tmbundle/Tests/division_ambiguity.rb +++ /dev/null @@ -1,88 +0,0 @@ -# purpose: -# exercise constructs with division -# -# division itself 84 / 2 -# regexp /pattern/ -# -# -# - -def test(*obj) - p(*obj) -end -a, b = 4, 2 - -# ------------------------------------------- -# -# Testarea for division -# -# ------------------------------------------- - -# singleline numbers -test(84 / 2) - -# singleline symbols -test(a / b) - -# singleline symbols -test(a / b / 3) - - -test(Float(42) / Float(5)) - -# multiline with symbols -=begin # invalid -test(a -/ b) -=end - -# multiline with symbols -test(a / -b) - - -# ------------------------------------------- -# -# Testarea for regexp -# -# ------------------------------------------- - -# singleline -test( // ) -test( /abc/ ) -test( /a\/bc/ ) -test [/^F../] -p 'Foobar'[/^F../] -p '42' =~ /42/ -test(nil && /\\/ =~ '\\') -test(nil || /\\/ =~ '\\') -test(nil and /\\/ =~ '\\') -test(nil or /\\/ =~ '\\') -test(/a/x) -test(/x/.match('abx').to_s) -test((/x/).match('abx').to_s) -test(/a/,/b/,/c/) -test(/a/x,/b/x,/c/m) - - -# multiline -test( / -pattern -/x ) - - -# multiline -test( -/r -eg -e/x -) - -# multiline -test( -/1/,/2/,/3/ -) - -# regexp after keyword -res = case 'test';when /t..t/:1;else 0;end -test(res) \ No newline at end of file diff --git a/bundles/ruby.tmbundle/Tests/modulo_ambiguity1.rb b/bundles/ruby.tmbundle/Tests/modulo_ambiguity1.rb deleted file mode 100644 index 2b1b9f717..000000000 --- a/bundles/ruby.tmbundle/Tests/modulo_ambiguity1.rb +++ /dev/null @@ -1,76 +0,0 @@ -# purpose: -# exercise constructs with modulo -# -# modulo in math data%2 -# literals %(a b), %W[1 2] -# -# -# - -def test(v) - p v -end - -x, y = 42, 33 - - -# ------------------------------------------- -# -# Testarea for modulo -# -# ------------------------------------------- - -# value % value -test( 3%2 ) -test( 3 % 2 ) -test( 1234%(666) ) -test( (1234)%666 ) - -# var % value -test( x%2 ) -test( x%666 ) -test( x%(42) ) -test( x%-42-3 ) -test( x%+42+3 ) - -# value % var -test( 666%x ) -test( (42+4+2)%x ) - -# var % var -test( x % y ) -test( x%y ) - -# ------------------------------------------- -# -# Testarea for literals -# -# ------------------------------------------- - -# literal with nothing -test( %(a b c) ) -test( %(1 2 (3 4)) ) -test( %{TM rocks} ) - -# literal with 'w' -test( %W(1 2 3) ) -test( %W[1 2 3] ) -test( %W{1 2 3} ) -test( %W<1 2 3> ) - -# literal with 'w' (multiline) -test(%w(a -b)) - -# literal with 'q' -test( %q(1 2 3) ) -test( %Q(1 2 3) ) - -# literal with custom -test( %q"1 2 3" ) -test( %q'1 2 3' ) -test( %q#1 2 3# ) -test( %?X.tainted? ) -test( %q/1 2 3/ ) -test( %q|1 2 3| ) -test( %q\1 2 3\ ) diff --git a/bundles/ruby.tmbundle/Tests/questionmark_ambiguity1.rb b/bundles/ruby.tmbundle/Tests/questionmark_ambiguity1.rb deleted file mode 100644 index d571673fa..000000000 --- a/bundles/ruby.tmbundle/Tests/questionmark_ambiguity1.rb +++ /dev/null @@ -1,160 +0,0 @@ -# purpose: -# exercise constructs with questionmark -# -# numeric letters ?x -# ternary operator condition ? case1 : case2 -# -# -# - -def test(v) - puts "#{v.inspect} => #{v.chr}" -end -def z(v) - v -end - - - -# ------------------------------------------- -# -# Testarea for numeric letters -# -# ------------------------------------------- - -# begin of line -test( -?x) - -# normal letters -test( ?a ) -test( ?A ) -test( ?0 ) - -# misc symbols -test( ?* ) -test( ?**2 ) -test( ?: ) -test( ?) ) -test( ?( ) -test( ?' ) # im a comment, not a string -test( ?" ) # im a comment, not a string -test( ?/ ) # im a comment, not a regexp - -# symbol '.' -test( ?..succ ) -p ?...?..succ # im a .. range -p ?....?..succ # im a ... range -#p ?.....?..succ # invalid - -# symbol '#' -test( ?# ); p 'im not a comment' - -# space ' ' -#test( ? ) # invalid - -# tab ' ' -#test( ? ) # invalid - - -# symbol '?' -test( ?? ) -test(??) - -# symbol '\\' -test( ?\\ ) - -# escaped as hex -#test( ?\x ) # invalid -test( ?\x1 ) -test( ?\x61 ) -#test( ?\x612 ) # invalid -test( ?\X ) # valid.. but is not hex -#test( ?\X11 ) # invalid - -# escaped as octal -test( ?\0 ) -test( ?\07 ) -test( ?\017 ) -#test( ?\0173 ) # invalid -#test( ?\08 ) # invalid -#test( ?\09 ) # invalid -#test( ?\0a ) # invalid -test( ?\1 ) -test( ?\7 ) -test( ?\a ) -test( ?\f ) - -# standard escapings -test( ?\n ) # newline -test( ?\b ) # backspace - -# escaped misc letters/symbols -test( ?\8 ) -test( ?\9 ) -test( ?\_ ) - -# ctrl/meta escaped -test( ?\C-a ) -test( ?\C-g ) -test( ?\C-x ) -test( ?\C-A ) -test( ?\C-G ) -test( ?\c ) -test( ?\m ) -#test( ?\c-a ) # invalid -#test( ?\C ) # invalid -#test( ?\M ) # invalid -test( ?\M-a ) -test( ?\M-\C-a ) -test( ?\C-\C-\M-a ) -test( ?\C-\M-a ) -test( ?\C-\M-\M-a ) -test( ?\C-\M-\C-\M-a ) - -# misc tests -p 'abc'.include?(?z) - - - -# ------------------------------------------- -# -# Testarea for ternary operator -# -# ------------------------------------------- -a, b, val = 42, 24, true -p(val ? 0 : 2) - -p [ - val ? (a) : z(b) , - val ? 'a' : 'b' -] - - - - -# ------------------------------------------- -# -# Testarea for ternary operator and numeric letter -# -# ------------------------------------------- -p [ - -# very ugly -true ???:?? , -true ???:?: , -true ??::?: , -] - - - -# ------------------------------------------- -# -# Testarea for neiter ternary operator nor numeric letter -# -# ------------------------------------------- - -# not letters.. the questionmark is part of the methodname -p(42.tainted?, 42.frozen?) - - diff --git a/bundles/ruby.tmbundle/Tests/rubylexer/COPYING b/bundles/ruby.tmbundle/Tests/rubylexer/COPYING deleted file mode 100644 index b124cf581..000000000 --- a/bundles/ruby.tmbundle/Tests/rubylexer/COPYING +++ /dev/null @@ -1,510 +0,0 @@ - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations -below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it -becomes a de-facto standard. To achieve this, non-free programs must -be allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control -compilation and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at least - three years, to give the same user the materials specified in - Subsection 6a, above, for a charge no more than the cost of - performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply, and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License -may add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms -of the ordinary General Public License). - - To apply these terms, attach the following notices to the library. -It is safest to attach them to the start of each source file to most -effectively convey the exclusion of warranty; and each file should -have at least the "copyright" line and a pointer to where the full -notice is found. - - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or -your school, if any, to sign a "copyright disclaimer" for the library, -if necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James - Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/bundles/ruby.tmbundle/Tests/rubylexer/g.rb b/bundles/ruby.tmbundle/Tests/rubylexer/g.rb deleted file mode 100644 index 16df18d19..000000000 --- a/bundles/ruby.tmbundle/Tests/rubylexer/g.rb +++ /dev/null @@ -1,14 +0,0 @@ -j=9;def i(n) [n ?"d" : "e" , n] end - -p(i ?") -p(j ?"d" : "e") - -def g(x=nil) x end -def gg(x=nil) g x end -p(gg :x) -p(g :y) -g=9 -p(gg :z) -# g :w #error - - diff --git a/bundles/ruby.tmbundle/Tests/rubylexer/newsyntax.rb b/bundles/ruby.tmbundle/Tests/rubylexer/newsyntax.rb deleted file mode 100644 index 2d06fe082..000000000 --- a/bundles/ruby.tmbundle/Tests/rubylexer/newsyntax.rb +++ /dev/null @@ -1,18 +0,0 @@ - -x, (*), z = [:x, :y, :z] -p x -p z - -x, (*y), z = [:x, :y, :z] -p x -p y -p z - -p($/ = ' '; Array( "i'm in your house" )) - -class Foou - public - def [] x=-100,&y=nil; p x; 100 end -end -p Foou.new.[]?9 #value -p Foou.new.[] ?9 #value diff --git a/bundles/ruby.tmbundle/Tests/rubylexer/p.rb b/bundles/ruby.tmbundle/Tests/rubylexer/p.rb deleted file mode 100644 index 90df69671..000000000 --- a/bundles/ruby.tmbundle/Tests/rubylexer/p.rb +++ /dev/null @@ -1,1122 +0,0 @@ -p(String *Class) -class String -class Class -end -end -#def String(x) x.to_s end #it's already built-in. duh! -def String.*(right) [self,right] end -def String.<<(right) [self,:<<,right] end -def String./(right) [self,:/,right] end -def String.[](right) [self,:[],right] end -p(String::Class) -p(String:: Class) -p(String ::Class) -p(String :: Class) -p(String< p -end - -q=9 -Q=99 - -p:p8 -false ? p: p8 -p :p8 -false ? p : p8 - -false ? q:p8 -false ? q: p8 -false ? q :p8 -false ? q : p8 - -#false ? Q:p8 #gives ruby indigestion -false ? Q: p8 -#false ? Q :p8 #gives ruby indigestion -false ? Q : p8 - -p?:p8 -false ? p?: p8 -p? :p8 -false ? p? : p8 - -P?:p8 -false ? P?: p8 -P? :p8 -false ? P? : p8 - -self.[]:p8 -false ? self.[]: p8 -self.[] :p8 -false ? self.[] : p8 - -self.<=>:p8 -false ? self.<=>: p8 -self.<=> :p8 -false ? self.<=> : p8 - -self <=>:p8 -#false ? self <=>: p8 #gives ruby indigestion -self <=> :p8 -#false ? self <=> : p8 #gives ruby indigestion -end - -p <2) - p(p >2) - p(p> 2) - p(p > 2) - -end - -module M34 - p(p~6) - p(p ~6) - p(p~ 6) - p(p ~ 6) - p(p*[1]) - p(p *[1]) - p(p* [1]) - p(p * [1]) - p(p&proc{}) - p(p &proc{}) - p(p& proc{}) - p(p & proc{}) - p(p !1) - p(p ?1) - p(p ! 1) - p(p ? 1 : 6) - p(p@a) - p(p @a) -# p(p@ a) #wont -# p(p @ a) #work - - p(p#a -) - p(p #a -) - p(p# a -) - p(p # a -) - p(p$a) - p(p $a) -# p(p$ a) #wont -# p(p $ a) #work - p(p%Q{:foo}) - p(p %Q{:foo}) - p(p% Q{:foo}) - p(p % Q{:foo}) - p(p^6) - p(p ^6) - p(p^ 6) - p(p ^ 6) - p(p&7) - p(p &proc{7}) - p(p& 7) - p(p & 7) - p(p(2)) - p(p (2)) - p(p( 2)) - p(p ( 2)) - p(p(p)) - p(p()) - p(p (p)) - p(p ()) - p(p ( p)) - p(p ( )) - p(p( p)) - p(p( )) - p(p) - p((p)) - p(p ) - p((p )) - p((p p)) - p((p p,p)) - p((p p)) - p((p p,p)) - p(p-0) - p(p -1) - p(p- 0) - p(p - 0) - p(p+9) - p(p +9) - p(p+ 9) - p(p + 9) - p(p[1]) - p(p [1]) - p(p[ 1]) - p(p [ 1]) - p(p{1}) - p(p {1}) - p(p{ 1}) - p(p { 1}) - p(p/1) - p(p /22/) - p(p/ 1) - p(p / 22) - p(p._) - p(p ._) - p(p. _) - p(p . _) - p(p:f) - p(p :f) - p(false ? p: f) - p(false ? p : f) - p((p;1)) - p((p ;1)) - p((p; 1)) - p((p ; 1)) - p(p<1) - p(p <1) - p(p< 1) - p(p < 1) - p(p<<1) - p(p <<1) -foobar -1 - p(p<< 1) - p(p << 1) - p(p'j') - p(p 'j') - p(p' j') - p(p ' j') - p(p"k") - p(p "k") - p(p" k") - p(p " k") - p(p|4) - p(p |4) - p(p| 4) - p(p | 4) - p(p>2) - p(p >2) - p(p> 2) - p(p > 2) - -end - - -def bob(x) x end -def bill(x) x end -p(bob %(22)) -for bob in [100] do p(bob %(22)) end -p(bob %(22)) -def %(n) to_s+"%#{n}" end -p(bill %(22)) -begin sdjkfsjkdfsd; rescue Object => bill; p(bill %(22)) end -p(bill %(22)) -undef % - -class Object - -public :` -def `(s) - print "bq: #{s}\n" -end -end - -69.`('what a world') - -79::`('what a word') - -p :` - -p{} -p {} -a=5 -p p +5 -p a +5 - -def nil.+(x) ~x end -def nil.[](*x) [x] end -p( p + 5 ) -p( p +5 ) -p( p+5 ) -p( p[] ) -p( p [] ) -p( p [ ] ) -class NilClass; undef +,[] end - -class Foou - public - def [] x=-100,&y; p x; 100 end -end -a0=8 -p Foou.new.[]!false #value -p Foou.new.[] !false #value -p Foou.new.[]~9 #value -p Foou.new.[] ~9 #value -p Foou.new.[]-9 #op -p Foou.new.[]+9 #op -p Foou.new.[] -9 #value -p Foou.new.[] +9 #value -p Foou.new.[]<<9 #op -p Foou.new.[] <<9 #value -foobar -9 -p Foou.new.[]%9 #op -p Foou.new.[]/9 #op -p Foou.new.[] %(9) #value -p Foou.new.[] /9/ #value -p Foou.new.[]$9 #value -p Foou.new.[]a0 #value -p Foou.new.[] $9 #value -p Foou.new.[] a0 #value -p Foou.new.[]{9} #lambda (op) -p Foou.new.[] {9} #lambda (op) - -if p then p end - -p({:foo=>:bar}) #why does this work? i'd think that ':foo=' would be 1 token -p EMPTY = 0 -p BLACK = 1 -p WHITE = - BLACK - - a=b=c=0 - a ? b:c - a ?b:c - - p(a ? b:c) - p(a ?b:c) - - -p~4 -p:f -p(~4){} -p(:f){} -h={} -h.default=:foo - -p def (h="foobar").default= v; p @v=v;v end -p h - -p h.default=:b - -x, (*y) = [:x, :y, :z] -p x -p y - -x, *y = [:x, :y, :z] -p x -p y - -x, * = [:x, :y, :z] -p x - - - -p Array("foo\nbar") - - - -p +(4) -p -(4) - -p :'\\' - -class Foop - def Foop.bar a,b - p a,b - end -end -Foop.bar 1,2 -Foop::bar 3,4 - - -class Foop - def Foop::baz a,b - p :baz,a,b - end -end -Foop.baz 5,6 -Foop::baz 7,8 - - - -without_creating=widgetname=nil - if without_creating && !widgetname #foo - fail ArgumentError, - "if set 'without_creating' to true, need to define 'widgetname'" - end - - - -=begin disable for now - -#class, module, and def should temporarily hide local variables -def mopsdfjskdf arg; arg*2 end -mopsdfjskdf=5 - class C - p mopsdfjskdf %(3) #calls method - end - -module M - p mopsdfjskdf %(4) #calls method -end - - def d - p mopsdfjskdf %(5) #calls method - end -p d -p mopsdfjskdf %(6) #reads variable -p proc{mopsdfjskdf %(7)}[] #reads variable - -#fancy symbols not supported yet -p %s{symbol} -=end - -#multiple assignment test -proc { - a,b,c,d,e,f,g,h,i,j,k=1,2,3,4,5,6,7,8,9,10,11 - p(b %(c)) - p(a %(c)) - p(k %(c)) - p(p %(c)) -}.call - - -=begin disable for now -p "#{<~m) - -p <(foo=100)} - p( foo %(5)) -}.call - - -p "#{<"PMK:njs;d| - -foobar0 - -p "#{<"PMK:njs;d| - -foobar1 -}" - -def foo(a=<>|\|\||\&\&)=|\&\&|\|\|)/) -p(:%) -p( { :class => class_=0}) -p cls_name = {}[:class] - - -p foo -p "#{$!.class}" -p :p -p(:p) -p(:"[]") -p :"[]" -p("\\") -p(/\\/) -p(/[\\]/) -p 0x80 -p ?p -p 0.1 -p 0.8 -p 0.9 -p(-1) -p %/p/ -p %Q[
  • ] -i=99 -p %Q[
  • #{i[0]+i[1]+(i[2])}\n] -p(:side=>:top) -p %w[a b c - d e f] -p %w[a b c\n - d e f] -p %w[\\] -p %w[\]] -p :+ -p 99 / 3 - -a=99;b=3 -p 1+(a / b) -p %Q[\"] -p %Q[ some [nested] text] - -if false - formatter.format_element(element) do - amrita_expand_and_format1(element, context, formatter) - end -end -if false - ret = <<-END - @@parts_template = #{template.to_ruby} - def parts_template - @@parts_template - end - - #{c.const_def_src.join("\n")} - def amrita_expand_and_format(element, context, formatter) - if element.tagname_symbol == :span and element.attrs.size == 0 - amrita_expand_and_format1(element, context, formatter) - else - formatter.format_element(element) do - amrita_expand_and_format1(element, context, formatter) - end - end - end - - def amrita_expand_and_format1(element, context, formatter) - #{method_src} - end - END - j=55 -end - -p ' -' -p '\n' -p " -" -p "\n" -p %w/ -/ -p %w/\n/ - -p %W/ -/ -p %W/\n/ -p(/ -/) -p(/\n/) -p proc { - p ` - ` - p `\n` -} - - - -p(%r[foo]i) -#breakpoint -p <:b), {:a=>:b} #=> true - assert_ene Reg(:a=>:b), {:a=>:c} #=> false - assert_ene Reg(:a=>:b), {} #=> false - h={} - h.default=:b - assert_eee Reg(:a=>:b), h #=> true - - assert_eee Reg(/^(a|b)$/=>33), {"a"=>33} #=> true - assert_eee Reg(/^(a|b)$/=>33), {"b"=>33} #=> true - assert_ene Reg(/^(a|b)$/=>33), {"a"=>133} #=> false - assert_ene Reg(/^(a|b)$/=>33), {"b"=>133} #=> false - - assert_ene Reg(/^(a|b)$/=>33), {"c"=>33} #=> false - - assert_eee Reg(/^(a|b)$/=>33), {"a"=>33,"b"=>33} #=> true - assert_ene Reg(/^(a|b)$/=>33), {"a"=>33,"b"=>133} #=> false - assert_ene Reg(/^(a|b)$/=>33), {"a"=>133,"b"=>33} #=> false - assert_ene Reg(/^(a|b)$/=>33), {"a"=>133,"b"=>133} #=> false - - - assert_eee Reg("a"=>33)|{"b"=>33}, {"a"=>33,"b"=>33} #=> true - assert_eee Reg("a"=>33)|{"b"=>33}, {"a"=>33,"b"=>133} #=> true - assert_ene Reg("a"=>33)|{"b"=>33}, {"a"=>133,"b"=>33} #=> false - assert_ene Reg("a"=>33)|{"b"=>33}, {"a"=>133,"b"=>133} #=> false - - assert_eee Reg("a"=>33)|{"b"=>33}, {"b"=>33} #=> true - - assert_eee Reg(:a.reg|:b => 44), {:a => 44} #=> true - assert_eee Reg(:a.reg|:b => 44), {:b => 44} #=> true - assert_ene Reg(:a.reg|:b => 44), {:a => 144} #=> false - assert_ene Reg(:a.reg|:b => 44), {:b => 144} #=> false - - print "\n" - end - - def assert_eee(left,right,message='assert_eee failed') - assert( - left===right, - message+" left=#{left.inspect} right=#{right.inspect}" - ) - print ".";$stdout.flush - end - - def assert_ene(left,right,message='assert_ene failed') - assert( - !(left===right), - message+" left=#{left.inspect} right=#{right.inspect}" - ) - print ",";$stdout.flush - end -end -end - srand;seed=srand - - opts=GetoptLong.new(["--seed", "-s", GetoptLong::REQUIRED_ARGUMENT]) - opts.each{|opt,arg| - opt=='--seed' or raise :impossible - seed=arg - } - - print "random seed is #{seed}\n" - srand seed - - -TC_Reg.test_reg diff --git a/bundles/ruby.tmbundle/Tests/rubylexer/w.rb b/bundles/ruby.tmbundle/Tests/rubylexer/w.rb deleted file mode 100644 index 56de46332..000000000 --- a/bundles/ruby.tmbundle/Tests/rubylexer/w.rb +++ /dev/null @@ -1,22 +0,0 @@ -p %r{\/$} -p %r~~m - -p [].push *[1,2,3] -p /\n/ - -$a=1 -@b=2 -@@c=3 -p(/\#$a \#@b \#@@c \#{$a+@b+@@c}/) - - -class Foo -attr :foo,true -end -f=Foo.new -p f.foo -p f.foo=9 -p f.foo =19 -p f.foo= 29 -p f.foo = 39 -p f.foo diff --git a/bundles/ruby.tmbundle/Tests/test1.rb b/bundles/ruby.tmbundle/Tests/test1.rb deleted file mode 100644 index 98a0965ba..000000000 --- a/bundles/ruby.tmbundle/Tests/test1.rb +++ /dev/null @@ -1,302 +0,0 @@ -# Ruby syntax test file for stuff we've gotten wrong in the past or are currently getting wrong - -######### -#basics - -module samwi_78se - - class mysuperclassofdoom < someotherclass - - end -end - -class gallo_way8 < kni9_ght - - def sl_9ay(beast) - - end - - #These shouldn't capture the leading space before it - def my_method_of_doom(args) - 'yay' - rescue - 'whatever' - ensure - 'something else' - end - - def my_method_of_doom(args);'yay';rescue;'whatever';ensure;'something else';end - - #The indent here should not be broken - -end - - -def hot?(cold) - -end - -def w00t! - - unless l33t - sysbeep - end - -end - -########### -# method names - -# method names can be keywords and should not be highlighted if they appear as explicit method invocations -br = m.end(0) + b1 -x, y = b2vxay(m.begin(0) + b1) -stream.next -self.class - - -# keyword.operator - -var1 == var2 -var1 === var2 -var1 =~ var2 -var1 = var2 -var1 * var2 -var1 - var2 -var1 + var2 -var1 % var2 -var1 ^ var2 -var1 & var2 -var1 * var2 - -# Method -u.whatever + 'something' -u.whatever + ('something') -u.whatever +( 'something') -u.whatever+ 'something' -u.whatever+ ('something') -u.whatever+( 'something') - -u.whatever = 'something' -u.whatever = ('something') -u.whatever =( 'something') -u.whatever= 'something' -u.whatever= ('something') -u.whatever=( 'something') - -u.whatever = 12345 -u.whatever = (12345) -u.whatever =( 12345) -u.whatever= 12345 -u.whatever= (12345) -u.whatever=( 12345) -u.whatever =12345 -u.whatever=12345 - -u.whatever == 'something' -u.whatever == ('something') -u.whatever ==( 'something') -u.whatever== 'something' -u.whatever== ('something') -u.whatever==( 'something') - -u.whatever === 'something' -u.whatever === ('something') -u.whatever ===( 'something') -u.whatever=== 'something' -u.whatever=== ('something') -u.whatever===( 'something') - -u.password = 'something' -u.password = ('something') -u.password =( 'something') -u.password= 'something' -u.password= ('something') -u.password=( 'something') - -u.abort_on_exception = 'something' -u.abort_on_exception = ('something') -u.abort_on_exception =( 'something') -u.abort_on_exception= 'something' -u.abort_on_exception= ('something') -u.abort_on_exception=( 'something') - -u.success ? 'something' : 'something else' -u.success ? ('something') : ('something else') -u.success ?( 'something') :( 'something else') #?( shouldn't be scoped as constant.numeric -u.success? 'something' : 'something else' -u.success? ('something') : ('something else') -u.success?( 'something') :( 'something else') - -# Function -whatever = 'something' -whatever = ('something') -whatever =( 'something') -whatever= 'something' -whatever= ('something') -whatever=( 'something') - -password = 'something' -password = ('something') -password =( 'something') -password= 'something' -password= ('something') -password=( 'something') - - -# this Totally kills Ruby Experimental ATM (Mon Jan 29 10:38:00 EST 2007) - -fred( )fred() -fred( ) fred() -fred( ).fred() -fred() .fred() -fred.fred() - -# /kills - -# method calls no dot or round brackets -puts "shmoo" -foo {} -foo bar - -# Regular Variables -foo -bar -foo = 1 -foo = bar - - -############ -# numbers - -data += 0.chr -99.downto(0) - -0.9 # number -0.A # method invocation (0 -> A) -0.A() # method invocation (0 -> A) -0xCAFEBABE022409ad802046 # hex -23402 # integer -4.232 # decimal - - -########### -# strings - -'hello #{42} wor\'knjkld' # no interpolation or escapes except for slash-single-quote - -# double quoted string (allows for interpolation): -"hello #{42} world" #-> "hello 42 world" -"hello #@ivar world" #-> "hello 42 world" -"hello #@@cvar world" #-> "hello 42 world" -"hello #$gvar world" #-> "hello 42 world" - -'hello #@ivar world' -'hello #@@cvar world' -'hello #$gvar world' - -# escapes -"hello #$gvar \"world" #-> "hello 42 \"world" - -# execute string (allows for interpolation): -%x{ls #{dir}} #-> ".\n..\nREADME\nmain.rb" -`ls #{dir}` #-> ".\n..\nREADME\nmain.rb" - -%Q{dude #{hey}} -%Q!dude#{hey}! -%W(dude#{hey}) -%q!dude#{hey}! -%s{dude#{hey}} -%w{dude#{hey}} -%{woah#{hey}} -% woah#{hey} - -# mod operator should not be interpreted as a string operator -# (space as delimiter is legal Ruby: '% string ' => "string") -if (data.size % 2) == 1 -line << ('%3s ' % str) - - -########### -# regexp - -/matchmecaseinsensitive/i -/matchme/ -/ matchme / -%r{matchme} - -32/23 #division, not regexp - -32 / 32 #division, not regexp - -gsub!(/ +/, '') #regexp, not division - -########### -# symbols - -:BIG :aBC :AbC9 :symb :_asd :_9sd :__= :f00bar :abc! - :abc? :abc= :<< :< :>> :> :<=> :<= :>= :% :* :** - :+ :- :& :| :~ :=~ :== :=== :` :[]= :[] :/ :-@ - :+@ :@aaa :@@bbb - -# else clause of ternary logic should not highlight as symbol -val?(a):p(b) -val?'a':'b' -M[1]?(a+b):p(c+d) - -val ? (a) : p(b) -val ? 'a' : 'b' -M[1] ? (a+b) : p(c+d) - -# but we must also account for ? in method names -thing.fred?(:someone) -thing.fred? :someone -thing.fred? thing2, :someone - -begin = {"(?=\\w)\\s*\\?:"} - - -############ -#literal capable of interpolation: -%W(a b#{42}c) #-> ["a", "b42c"] -%W(ab c\nd \\\)ef) - -%(#{42}) #-> "42" - - -############ -# multiline comments - -=begin -stuff here -... def must_not_highlight_keywords_in_comments end; -stuff here too -=end - - -############ -#literal incapable of interpolation -%w(a b#{42}c) #-> ["a", "b#{42}c"]############ -%w(ab c\nd \\\)ef) # heredoc tests - -append << not_heredoc - -heredoc = < - - - - contactEmailRot13 - wnzrf@tenlcebqhpgvbaf.arg - contactName - James Edward Gray II - deleted - - 3988A501-119E-4C0E-A584-C5E75FC2D6C6 - 8C102BE9-6E49-11D9-A933-000D93589AF6 - EE5F1AE5-6C02-11D9-92BA-0011242E4184 - 8394EDEF-87E8-11D9-A6A3-000D93589AF6 - BE3B3E5E-733E-11D9-A833-000A95A89C98 - 66708792-62C3-11D9-B8CF-000D93589AF6 - 667089D2-62C3-11D9-B8CF-000D93589AF6 - 667080D9-62C3-11D9-B8CF-000D93589AF6 - 667081DE-62C3-11D9-B8CF-000D93589AF6 - 66708259-62C3-11D9-B8CF-000D93589AF6 - 66708052-62C3-11D9-B8CF-000D93589AF6 - 6670881E-62C3-11D9-B8CF-000D93589AF6 - 7990EE60-C850-4779-A8C0-7FD2C853B99B - - description - Support for the <a href="http://www.ruby-lang.org/">Ruby</a> programming language. - mainMenu - - excludedItems - - E5158F94-CC52-4424-A495-14EF9272653F - EEE6D060-C5A0-400D-A2E0-0835013C5365 - 76FCF165-54CB-4213-BC55-BD60B9C6A3EC - 6519CB08-8326-4B77-A251-54722FFBFC1F - 835FAAC6-5431-436C-998B-241F7226B99B - A83F68A9-F751-4BB4-AE16-56812878C16A - 47D203ED-EB9B-4653-A07B-A897800CEB76 - - items - - 35222962-C50D-4D58-A6AE-71E7AD980BE4 - 5289EE40-86B8-11D9-A8D4-000A95E13C98 - ------------------------------------ - 63F3B3B7-CBE2-426B-B551-657733F3868B - 6EA7AE06-3EA9-497D-A6DE-732DE43DA6E9 - ------------------------------------ - 8646378E-91F5-4771-AC7C-43FC49A93576 - EE5F19BA-6C02-11D9-92BA-0011242E4184 - ------------------------------------ - EE5F1FB2-6C02-11D9-92BA-0011242E4184 - FBFC214F-B019-4967-95D2-028F374A3221 - 88BC3896-DC39-4307-A271-21D33340F15A - ------------------------------------ - 9FB64639-F776-499B-BA6F-BB45F86F80FD - 7F79BC8D-8A4F-4570-973B-05DFEC25747F - B297E4B8-A8FF-49CE-B9C4-6D4911724D43 - FDFABCB9-DF58-4469-AE11-5407A4FF4D70 - ------------------------------------ - A1433C73-A475-4B9F-8B46-E182C588ED7D - D52AE6E7-DB75-46C9-94B0-F90B186BE1B2 - B32BD8CF-903E-42D9-B1D3-44F88F262134 - F120CD22-35C0-4E41-8F12-E3C41E04DAB3 - A2A5E4B3-D9C6-4C49-B4CB-8090D615485E - D94AD09E-ADF4-47C9-8236-C7B38B44804E - 803A6BDF-D74A-4B69-AFF0-98B824AB478D - 2765038A-1CFC-4BBD-B19C-6EB2B400D528 - C03F02B1-8BE3-49F5-B983-48C1BDE2657C - - submenus - - 1BE427C6-0071-4BFF-8CDA-1DC13534E7D8 - - items - - 931DD73E-615E-476E-9B0D-8341023AE730 - DAA69A0C-FC1E-4509-9931-DFFB38B4D6AE - 2DDB6FE0-6111-4C40-A149-8E67E76F8272 - - name - Format - - 2765038A-1CFC-4BBD-B19C-6EB2B400D528 - - items - - 2DBEE50B-3097-4A57-AB48-3586CF392D8B - 0BA2B2F1-E767-4A03-9791-0AC0183251F1 - B46D35B8-5DEB-4C10-A110-BA1965A2EB9C - 97054C4D-E4A3-45B1-9C00-B82DBCB30CAD - - name - Idioms - - 33312F8F-A75F-49E5-AC1B-B65944C1309C - - items - - 8021944C-CEA4-4983-8D1C-78D18D4004A1 - 2514FC26-468C-4D08-A788-494A444C4286 - ------------------------------------ - 66802933-B49F-479B-9DF9-1D898FF1FA90 - - name - Strings - - 42D15F0C-0A45-4580-944E-20229EB8C92E - - items - - 9E0B4D4B-2956-4B3A-800A-3D8CE54E66BF - BA9440C9-36C3-4031-BB61-67B581D5B179 - ------------------------------------ - B0CE57EC-FB2E-4482-8CCE-448DC2588715 - - name - Ordering - - 607DFBB6-D4BD-46B1-A221-698CC657143B - - items - - DAE6A754-D906-4763-B816-CE67125CEF08 - ------------------------------------ - 263C94DC-63CF-4BA3-9692-C5582CA8F1AB - 6021BBDC-4AAD-447B-A0C2-A4BB31721558 - 3DDB99C4-486D-4C11-A217-5680FDD8EC19 - FD010022-E0E7-44DB-827F-33F7D9310DA2 - - name - Arrays - - 6EA7AE06-3EA9-497D-A6DE-732DE43DA6E9 - - items - - 1AD6A138-2E89-4D6A-AB3F-416BF9CE968D - ------------------------------------ - 1BE427C6-0071-4BFF-8CDA-1DC13534E7D8 - ------------------------------------ - 05984208-D559-4C04-A69C-2019361A985A - BF4CA9F1-51CD-48D4-8357-852234F59046 - ------------------------------------ - ED6368FB-A11D-4622-9F42-7879481094F1 - - name - RDoc - - 803A6BDF-D74A-4B69-AFF0-98B824AB478D - - items - - 0CB48BCA-3F6E-4AE0-85BC-08A1D2508216 - 20AAD0BC-075D-4EC0-9057-E3E5E62C4125 - ------------------------------------ - 5AE7CFB4-418E-4E00-AD76-06DB755EE876 - 5B46ECFD-23A4-4F0C-9951-F64C19C72C2B - 46BF99AD-E172-4D49-BCF7-072F4730E1D9 - ------------------------------------ - 9460392B-C036-4A76-A5AE-1191F10E4B1B - 3BA6762A-BB6B-489E-8006-F30F386AEF48 - 2C07D4E7-D74F-4AE4-82BE-B0BA82247AFA - 8343ACF4-EEB7-44B5-B835-94826466D4D5 - ------------------------------------ - F6BF907E-FDF7-4D9B-9E57-BE159561349D - B904D4AA-D15D-48A4-8EB2-563BAF489332 - CC300D44-6C3F-4F6C-A8AB-86F5A2DC57CF - - name - Serialization - - 8D131E43-1245-410B-A7D8-E00222CE5412 - - items - - 07D1F987-7CDB-4EAD-B64A-27A93051700E - A3B9B76B-2BC5-425C-AB24-9FAAFC375798 - 5DA9E1E8-2C54-420A-9B84-B040A1AF2B9E - 669A86AD-936F-4EDA-8E4E-6863804072DA - 6C6B9849-9631-49FF-A9F9-F0E94A1512C5 - 1F72122A-35AD-4BA1-AA01-889A10319666 - E23FE534-8061-4828-98A5-46270B6910B0 - 197709C5-8382-4A59-B6D7-31A0CC0F23B7 - 9D9E7BA3-8C5D-4532-83EA-326358C2F5BB - 98182B9E-7C61-4824-BE4C-9CD69C816037 - CB03D11A-7204-48D0-92C1-E109034403E7 - 52B8BF63-F09E-4789-8407-06168A8AE666 - B79B9DAB-ABEF-44F6-BF7E-635E7BA11DFD - 4E409AA4-E7D4-46B7-A4E9-E32F992B33E9 - - name - Searching and Selection - - 9E56B46B-80D0-4397-91B1-E5BEF5FF2811 - - items - - ECBA4CA0-275F-460E-85BE-E82FEA2E2B26 - 338EC03D-3FF4-4435-94E8-1CEF20CEC75D - 7E084412-80E6-4B70-8092-C03D1ECE4CD2 - FDD73070-6D32-4301-A86A-C55B77C3D8ED - EC73D5CC-5F05-46B9-A6F4-82037E4A38C9 - 3C04589C-5127-478E-97B3-CA7DD2EA7ECD - 689120C9-AB40-4081-8268-9362E00FA4A0 - E54F7077-3C33-4B53-A4F7-21E16132D3AD - 02913388-EE8E-4C55-AC94-94F3D751F47E - 7A3CECED-452B-438E-A5C6-95B6BDC43243 - 825B721D-4367-4DF7-98C0-F005695DF9E3 - CD748479-D2A4-4AB5-95BD-4C89512BA210 - 844DBD70-BC23-4FBF-9C18-F4A610239DF2 - 1DD13CF5-39C0-4F10-B655-56DACEBC7F94 - F3C5F719-EF03-4FF7-A777-4A8402FE3B6B - ------------------------------------ - B563E0D7-513D-49B4-9733-1B04A6F25A74 - ------------------------------------ - 5A3754FC-43A3-462B-AB42-E3E951872E6F - BFB65D1C-62F1-485D-8A67-3E5A2E55107C - BD4CFD7B-1AC0-4569-9BDA-FD491F41F4E6 - - name - Each Element - - A1433C73-A475-4B9F-8B46-E182C588ED7D - - items - - 0275EF39-9357-408F-AF20-79E415CA9504 - ------------------------------------ - 0F940CBC-2173-49FF-B6FD-98A62863F8F2 - 667083EE-62C3-11D9-B8CF-000D93589AF6 - 48D8E498-C9A5-4B1B-9A18-71A5860276FB - 4E9A7A73-875C-11D9-897C-000393CBCE2E - 6670835F-62C3-11D9-B8CF-000D93589AF6 - 667082E6-62C3-11D9-B8CF-000D93589AF6 - CD1609FA-47DA-4EE4-9C5B-5C56D953F5B1 - F53E098D-D08E-4CE2-990A-B0BD70E60614 - D121FC61-96A4-4B8F-8709-280EDA876FF3 - 488B387C-50C0-4B2D-9260-5A7E7EAF9B42 - ------------------------------------ - E7A3BCF6-3594-453A-945D-4C5D81631CBF - B37B0E21-1B49-494A-BA56-367CF18DD0B2 - 451A0596-1F72-4AFB-AF2F-45900FABB0F7 - ------------------------------------ - A05CBDD6-845D-45EB-94FB-F8787F5456BE - B2C3ADE8-E19E-4B87-9C6C-593D490114C7 - 97DE939B-D243-4D5C-B953-1C9090912E7C - 33969819-62C5-4E03-B824-C2337205F364 - 34FEBB9F-73CD-4DD4-A0A3-1CF2A5E3DE78 - E16D24D2-CC7E-4786-BE0B-1725FC865D78 - 21C0D711-F32A-4665-AA0D-B136F9DD3945 - 49D69DEC-6991-49F4-8D9B-BA60BFDD3D17 - - name - Declarations - - A2A5E4B3-D9C6-4C49-B4CB-8090D615485E - - items - - 418F1817-255F-430A-B09A-222964ED66A7 - ------------------------------------ - 8F594E5E-6F46-4E98-B5FB-1C8F3BA9828F - 50C56AC8-48F3-42A0-AF10-8164464AFAEF - 397FA09F-A30F-4EE4-920C-318D5004EE97 - ------------------------------------ - 332AA973-AA71-48CB-AEE9-1D71E11019AC - 8EBBB26F-980E-404E-8366-74E5772298F6 - 678BDB83-FBBD-4E8E-BE0B-E1A98AECB247 - A4E89D97-D5ED-48BB-B5FF-1BFB79211FCD - ------------------------------------ - 8CEF9711-88D5-4202-AFB9-29EF4EFD25C1 - C3C48948-4F49-484E-A8DE-DEB44723099E - 209D5D73-7A77-4931-A158-3FB6D5B48A88 - - name - Files - - A2F24A2E-6791-4005-8E32-5D436AB075DB - - items - - 4991BB86-736E-4758-B9B2-E4FA90B9368F - 36853A11-0307-4AE7-B835-7CE6358717A5 - 206D54AF-E67A-4DF0-B7F4-3D42FEB81685 - 51954118-81D7-42B6-9A10-BE23D8B9FFE2 - ------------------------------------ - 567E3D18-BF2B-4379-8927-2777EC9F495E - - name - Counting - - B32BD8CF-903E-42D9-B1D3-44F88F262134 - - items - - 59E811FF-E722-46BE-8938-04713612FABB - ------------------------------------ - 855FC4EF-7B1E-48EE-AD4E-5ECB8ED79D1C - 4B72C5C3-6CA7-41AC-B2F9-51DEA25D469E - ------------------------------------ - 21E75321-0CF7-45E8-A297-BCC7C0DDDD15 - - name - Blocks - - B37B0E21-1B49-494A-BA56-367CF18DD0B2 - - items - - A150C2D8-25B3-4339-BC92-8A0160A70486 - 3D383096-A03F-4EF8-9060-3C727045AB34 - D7A7D3C9-1714-4C50-8CC0-D83A03883E8F - ------------------------------------ - AAD5D511-6BE7-41DA-8F2B-1593A48FBB08 - 6C9D6B3D-D8E9-4606-9534-577C8D21FFF6 - ------------------------------------ - 58FDEA60-10AF-4C49-AA09-29B77030DB25 - 7F46C90A-595B-4B83-A4F7-058F63CE4218 - ------------------------------------ - 7C6E88FA-CA0E-4110-8C75-A94E54286A75 - 4E9D15B5-65D6-4A9A-9DEC-DE041D68C06F - 87D5F8AD-8DA6-4AED-A0D8-B51CAC980445 - C44ED391-614F-4BA2-BB0F-87668EEA9954 - 4A6EFD6B-88E2-4822-AD48-03460EDBC796 - ------------------------------------ - 988C8AEF-FC71-4455-9C4F-9338C05685A4 - ------------------------------------ - 7BC1E159-0C90-4B0D-8808-80165C11F59C - - name - Methods - - C03F02B1-8BE3-49F5-B983-48C1BDE2657C - - items - - 569C9822-8C41-4907-94C7-1A8A0031B66D - ------------------------------------ - 05EE1046-5ED7-48F5-8693-1F066163B2F4 - A7BF14E6-59B1-42E5-8755-8A72BF13685E - - name - Rake - - D52AE6E7-DB75-46C9-94B0-F90B186BE1B2 - - items - - 607DFBB6-D4BD-46B1-A221-698CC657143B - A2F24A2E-6791-4005-8E32-5D436AB075DB - 9E56B46B-80D0-4397-91B1-E5BEF5FF2811 - 42D15F0C-0A45-4580-944E-20229EB8C92E - 8D131E43-1245-410B-A7D8-E00222CE5412 - 33312F8F-A75F-49E5-AC1B-B65944C1309C - - name - Iterators - - D94AD09E-ADF4-47C9-8236-C7B38B44804E - - items - - 31D1F145-33AB-4441-BA11-4D1C46928C4C - 00F66D41-25AF-4597-B67D-E540965A5222 - 5297FD0C-98B1-4514-BBD1-1516810BECA6 - ------------------------------------ - B32C147D-44A6-478A-9D5D-189D7831E9A7 - 43A61A22-6BEE-4997-961C-1CDE739C05FE - A243E96F-DC21-4AA0-B340-13A7674F6AFF - 429D0EF5-580D-4166-8F79-713DE96B77F1 - 0E831E03-67E1-4357-8323-C60685C23C4F - 671F05E2-D9CC-485E-BB1B-B13EF20FAC65 - 4C79256C-480A-459C-BDE8-BB0D972811DB - 79FEC3CC-2A40-4611-9A85-ECDB22FE0701 - 711ED6C3-0F18-41FB-9A7D-3094BB319A85 - A072BB1E-1DD1-45D3-9346-8CA3BA21B364 - 1B925A4D-8EE4-442B-9254-293599F5717F - 68B21F6F-5D89-41FA-A19C-F29C2F912B4E - 82F8EEE0-2452-411E-8102-7BFDDBCA2E72 - 09A11FDA-49FC-4466-8787-8D1D5D111A89 - 29340695-E426-4F77-8CF7-C59360A549F4 - F91C25EC-EC76-498B-BFB5-FDA8F57C5875 - 7850AD5C-A90D-4E2C-A931-EADFF8D3D9A3 - 05655BD8-23C6-445F-BFD1-420BF25C3030 - 33639D7A-BD8C-4396-9C44-307B8AC87C9E - ------------------------------------ - DB457094-1AC9-4856-AEFC-43A9576B6775 - B186BAC0-D981-41AC-B8F4-34BAD2BC4EE6 - F46A4687-E52D-40D2-9072-C215645EDBC6 - ------------------------------------ - C649F945-DAB8-4DA2-B73C-2EFF9D7D34F3 - 942F20E2-C40A-44B8-A3F2-99AAC68CB534 - 1C60D589-DD46-4109-90CA-6B34AEA2F298 - - name - Tests - - E7A3BCF6-3594-453A-945D-4C5D81631CBF - - items - - BF487539-8085-4FF4-8601-1AD20FABAEDC - 83EED068-8C1C-4BAF-9893-902DC00616AB - 0CCBE04E-F4E2-4E55-9506-7DE67ACF8388 - 05DFF82C-5A29-4EBD-93FE-C165FFFB5EA8 - E98FB8F9-7302-431D-8BF2-275A68A6126C - 121B334B-2AA6-4E9A-A8B8-BF93B627982B - AFE1D078-EA16-45F5-AD8A-FAC1B523D861 - C7AAAE45-487A-4B61-8962-D47675AAC05F - ------------------------------------ - 2B73EC5F-06D2-460C-A14F-6FA05AFCF0CC - 0E85EC81-2FAB-4648-B590-119CC1BB6E41 - A71A18CF-2D71-4BFF-AA0C-D9B8C59BC4EB - - name - Classes and Modules - - F120CD22-35C0-4E41-8F12-E3C41E04DAB3 - - items - - E16EE658-1CA0-4950-954B-B962E50B754F - ------------------------------------ - 840B9C4C-7037-4C3B-9028-EB9DC75EDB3E - B9E3A6DF-875D-11D9-897C-000393CBCE2E - ------------------------------------ - F4EEB2B6-07D8-402F-8FC3-79B7308D2576 - - name - Hashes - - - - name - Ruby - ordering - - 35222962-C50D-4D58-A6AE-71E7AD980BE4 - 5289EE40-86B8-11D9-A8D4-000A95E13C98 - 63F3B3B7-CBE2-426B-B551-657733F3868B - 1AD6A138-2E89-4D6A-AB3F-416BF9CE968D - 931DD73E-615E-476E-9B0D-8341023AE730 - DAA69A0C-FC1E-4509-9931-DFFB38B4D6AE - 2DDB6FE0-6111-4C40-A149-8E67E76F8272 - BF4CA9F1-51CD-48D4-8357-852234F59046 - 8646378E-91F5-4771-AC7C-43FC49A93576 - EE5F19BA-6C02-11D9-92BA-0011242E4184 - 76FCF165-54CB-4213-BC55-BD60B9C6A3EC - EE5F1FB2-6C02-11D9-92BA-0011242E4184 - FBFC214F-B019-4967-95D2-028F374A3221 - 9FB64639-F776-499B-BA6F-BB45F86F80FD - 7F79BC8D-8A4F-4570-973B-05DFEC25747F - B297E4B8-A8FF-49CE-B9C4-6D4911724D43 - 835FAAC6-5431-436C-998B-241F7226B99B - 0275EF39-9357-408F-AF20-79E415CA9504 - 59E811FF-E722-46BE-8938-04713612FABB - F4EEB2B6-07D8-402F-8FC3-79B7308D2576 - 97054C4D-E4A3-45B1-9C00-B82DBCB30CAD - 569C9822-8C41-4907-94C7-1A8A0031B66D - 6519CB08-8326-4B77-A251-54722FFBFC1F - 47D203ED-EB9B-4653-A07B-A897800CEB76 - C122CD92-DDBE-4869-9C7A-CC2B254C9411 - 121B334B-2AA6-4E9A-A8B8-BF93B627982B - 58FDEA60-10AF-4C49-AA09-29B77030DB25 - 33969819-62C5-4E03-B824-C2337205F364 - 7E084412-80E6-4B70-8092-C03D1ECE4CD2 - EC73D5CC-5F05-46B9-A6F4-82037E4A38C9 - 825B721D-4367-4DF7-98C0-F005695DF9E3 - BFB65D1C-62F1-485D-8A67-3E5A2E55107C - C649F945-DAB8-4DA2-B73C-2EFF9D7D34F3 - 5AE7CFB4-418E-4E00-AD76-06DB755EE876 - 9460392B-C036-4A76-A5AE-1191F10E4B1B - 2C07D4E7-D74F-4AE4-82BE-B0BA82247AFA - F6BF907E-FDF7-4D9B-9E57-BE159561349D - E5158F94-CC52-4424-A495-14EF9272653F - A83F68A9-F751-4BB4-AE16-56812878C16A - 05984208-D559-4C04-A69C-2019361A985A - ED6368FB-A11D-4622-9F42-7879481094F1 - 88BC3896-DC39-4307-A271-21D33340F15A - FDFABCB9-DF58-4469-AE11-5407A4FF4D70 - 0F940CBC-2173-49FF-B6FD-98A62863F8F2 - 667083EE-62C3-11D9-B8CF-000D93589AF6 - 48D8E498-C9A5-4B1B-9A18-71A5860276FB - 4E9A7A73-875C-11D9-897C-000393CBCE2E - 7BC1E159-0C90-4B0D-8808-80165C11F59C - 6670835F-62C3-11D9-B8CF-000D93589AF6 - 667082E6-62C3-11D9-B8CF-000D93589AF6 - CD1609FA-47DA-4EE4-9C5B-5C56D953F5B1 - F53E098D-D08E-4CE2-990A-B0BD70E60614 - D121FC61-96A4-4B8F-8709-280EDA876FF3 - 488B387C-50C0-4B2D-9260-5A7E7EAF9B42 - BF487539-8085-4FF4-8601-1AD20FABAEDC - 83EED068-8C1C-4BAF-9893-902DC00616AB - 0CCBE04E-F4E2-4E55-9506-7DE67ACF8388 - 05DFF82C-5A29-4EBD-93FE-C165FFFB5EA8 - E98FB8F9-7302-431D-8BF2-275A68A6126C - AFE1D078-EA16-45F5-AD8A-FAC1B523D861 - C7AAAE45-487A-4B61-8962-D47675AAC05F - 2B73EC5F-06D2-460C-A14F-6FA05AFCF0CC - 0E85EC81-2FAB-4648-B590-119CC1BB6E41 - A71A18CF-2D71-4BFF-AA0C-D9B8C59BC4EB - A150C2D8-25B3-4339-BC92-8A0160A70486 - 3D383096-A03F-4EF8-9060-3C727045AB34 - D7A7D3C9-1714-4C50-8CC0-D83A03883E8F - AAD5D511-6BE7-41DA-8F2B-1593A48FBB08 - 6C9D6B3D-D8E9-4606-9534-577C8D21FFF6 - 7F46C90A-595B-4B83-A4F7-058F63CE4218 - 7C6E88FA-CA0E-4110-8C75-A94E54286A75 - 87D5F8AD-8DA6-4AED-A0D8-B51CAC980445 - 4E9D15B5-65D6-4A9A-9DEC-DE041D68C06F - C44ED391-614F-4BA2-BB0F-87668EEA9954 - 4A6EFD6B-88E2-4822-AD48-03460EDBC796 - 988C8AEF-FC71-4455-9C4F-9338C05685A4 - 451A0596-1F72-4AFB-AF2F-45900FABB0F7 - A05CBDD6-845D-45EB-94FB-F8787F5456BE - B2C3ADE8-E19E-4B87-9C6C-593D490114C7 - 97DE939B-D243-4D5C-B953-1C9090912E7C - 34FEBB9F-73CD-4DD4-A0A3-1CF2A5E3DE78 - E16D24D2-CC7E-4786-BE0B-1725FC865D78 - 21C0D711-F32A-4665-AA0D-B136F9DD3945 - 49D69DEC-6991-49F4-8D9B-BA60BFDD3D17 - DAE6A754-D906-4763-B816-CE67125CEF08 - 263C94DC-63CF-4BA3-9692-C5582CA8F1AB - 6021BBDC-4AAD-447B-A0C2-A4BB31721558 - 3DDB99C4-486D-4C11-A217-5680FDD8EC19 - FD010022-E0E7-44DB-827F-33F7D9310DA2 - 4991BB86-736E-4758-B9B2-E4FA90B9368F - 36853A11-0307-4AE7-B835-7CE6358717A5 - 206D54AF-E67A-4DF0-B7F4-3D42FEB81685 - 51954118-81D7-42B6-9A10-BE23D8B9FFE2 - 567E3D18-BF2B-4379-8927-2777EC9F495E - ECBA4CA0-275F-460E-85BE-E82FEA2E2B26 - 338EC03D-3FF4-4435-94E8-1CEF20CEC75D - FDD73070-6D32-4301-A86A-C55B77C3D8ED - 3C04589C-5127-478E-97B3-CA7DD2EA7ECD - 689120C9-AB40-4081-8268-9362E00FA4A0 - E54F7077-3C33-4B53-A4F7-21E16132D3AD - 02913388-EE8E-4C55-AC94-94F3D751F47E - 7A3CECED-452B-438E-A5C6-95B6BDC43243 - CD748479-D2A4-4AB5-95BD-4C89512BA210 - 844DBD70-BC23-4FBF-9C18-F4A610239DF2 - 1DD13CF5-39C0-4F10-B655-56DACEBC7F94 - F3C5F719-EF03-4FF7-A777-4A8402FE3B6B - B563E0D7-513D-49B4-9733-1B04A6F25A74 - 5A3754FC-43A3-462B-AB42-E3E951872E6F - BD4CFD7B-1AC0-4569-9BDA-FD491F41F4E6 - 9E0B4D4B-2956-4B3A-800A-3D8CE54E66BF - BA9440C9-36C3-4031-BB61-67B581D5B179 - B0CE57EC-FB2E-4482-8CCE-448DC2588715 - 07D1F987-7CDB-4EAD-B64A-27A93051700E - A3B9B76B-2BC5-425C-AB24-9FAAFC375798 - 5DA9E1E8-2C54-420A-9B84-B040A1AF2B9E - 669A86AD-936F-4EDA-8E4E-6863804072DA - 6C6B9849-9631-49FF-A9F9-F0E94A1512C5 - 1F72122A-35AD-4BA1-AA01-889A10319666 - E23FE534-8061-4828-98A5-46270B6910B0 - 197709C5-8382-4A59-B6D7-31A0CC0F23B7 - 9D9E7BA3-8C5D-4532-83EA-326358C2F5BB - 98182B9E-7C61-4824-BE4C-9CD69C816037 - CB03D11A-7204-48D0-92C1-E109034403E7 - 52B8BF63-F09E-4789-8407-06168A8AE666 - B79B9DAB-ABEF-44F6-BF7E-635E7BA11DFD - 4E409AA4-E7D4-46B7-A4E9-E32F992B33E9 - 8021944C-CEA4-4983-8D1C-78D18D4004A1 - 2514FC26-468C-4D08-A788-494A444C4286 - 66802933-B49F-479B-9DF9-1D898FF1FA90 - 855FC4EF-7B1E-48EE-AD4E-5ECB8ED79D1C - 4B72C5C3-6CA7-41AC-B2F9-51DEA25D469E - 21E75321-0CF7-45E8-A297-BCC7C0DDDD15 - E16EE658-1CA0-4950-954B-B962E50B754F - 840B9C4C-7037-4C3B-9028-EB9DC75EDB3E - B9E3A6DF-875D-11D9-897C-000393CBCE2E - 418F1817-255F-430A-B09A-222964ED66A7 - 8F594E5E-6F46-4E98-B5FB-1C8F3BA9828F - 50C56AC8-48F3-42A0-AF10-8164464AFAEF - 397FA09F-A30F-4EE4-920C-318D5004EE97 - 332AA973-AA71-48CB-AEE9-1D71E11019AC - 8EBBB26F-980E-404E-8366-74E5772298F6 - 678BDB83-FBBD-4E8E-BE0B-E1A98AECB247 - A4E89D97-D5ED-48BB-B5FF-1BFB79211FCD - 8CEF9711-88D5-4202-AFB9-29EF4EFD25C1 - C3C48948-4F49-484E-A8DE-DEB44723099E - 209D5D73-7A77-4931-A158-3FB6D5B48A88 - 31D1F145-33AB-4441-BA11-4D1C46928C4C - 00F66D41-25AF-4597-B67D-E540965A5222 - 5297FD0C-98B1-4514-BBD1-1516810BECA6 - B32C147D-44A6-478A-9D5D-189D7831E9A7 - 43A61A22-6BEE-4997-961C-1CDE739C05FE - A243E96F-DC21-4AA0-B340-13A7674F6AFF - 429D0EF5-580D-4166-8F79-713DE96B77F1 - 0E831E03-67E1-4357-8323-C60685C23C4F - 671F05E2-D9CC-485E-BB1B-B13EF20FAC65 - 4C79256C-480A-459C-BDE8-BB0D972811DB - 79FEC3CC-2A40-4611-9A85-ECDB22FE0701 - 711ED6C3-0F18-41FB-9A7D-3094BB319A85 - A072BB1E-1DD1-45D3-9346-8CA3BA21B364 - 1B925A4D-8EE4-442B-9254-293599F5717F - 68B21F6F-5D89-41FA-A19C-F29C2F912B4E - 82F8EEE0-2452-411E-8102-7BFDDBCA2E72 - 09A11FDA-49FC-4466-8787-8D1D5D111A89 - 29340695-E426-4F77-8CF7-C59360A549F4 - F91C25EC-EC76-498B-BFB5-FDA8F57C5875 - 7850AD5C-A90D-4E2C-A931-EADFF8D3D9A3 - 05655BD8-23C6-445F-BFD1-420BF25C3030 - 33639D7A-BD8C-4396-9C44-307B8AC87C9E - DB457094-1AC9-4856-AEFC-43A9576B6775 - B186BAC0-D981-41AC-B8F4-34BAD2BC4EE6 - F46A4687-E52D-40D2-9072-C215645EDBC6 - 942F20E2-C40A-44B8-A3F2-99AAC68CB534 - 1C60D589-DD46-4109-90CA-6B34AEA2F298 - 0CB48BCA-3F6E-4AE0-85BC-08A1D2508216 - 20AAD0BC-075D-4EC0-9057-E3E5E62C4125 - 5B46ECFD-23A4-4F0C-9951-F64C19C72C2B - 46BF99AD-E172-4D49-BCF7-072F4730E1D9 - 3BA6762A-BB6B-489E-8006-F30F386AEF48 - 8343ACF4-EEB7-44B5-B835-94826466D4D5 - B904D4AA-D15D-48A4-8EB2-563BAF489332 - CC300D44-6C3F-4F6C-A8AB-86F5A2DC57CF - 2DBEE50B-3097-4A57-AB48-3586CF392D8B - 0BA2B2F1-E767-4A03-9791-0AC0183251F1 - B46D35B8-5DEB-4C10-A110-BA1965A2EB9C - 05EE1046-5ED7-48F5-8693-1F066163B2F4 - A7BF14E6-59B1-42E5-8755-8A72BF13685E - EEE6D060-C5A0-400D-A2E0-0835013C5365 - E00B62AC-6B1C-11D9-9B1F-000D93589AF6 - 1D26F26C-C6F7-434F-84F8-FEE895372E8A - 6FEAF60F-F0F3-4618-9259-DE93285F50D1 - 92E190C9-A861-4025-92D4-D6B5A24C22D4 - A5D50494-EB97-48DE-A2BE-322DF52A7A7A - 6D75102B-6E51-4360-8F12-BE12327B6AE6 - AEDD6A5F-417F-4177-8589-B07518ACA9DE - 1A7701FA-D866-498C-AD4C-7846538DB535 - - uuid - 467B298F-6227-11D9-BFB1-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Commands/Convert to ASCII.plist b/bundles/text.tmbundle/Commands/Convert to ASCII.plist deleted file mode 100644 index d892bbcaa..000000000 --- a/bundles/text.tmbundle/Commands/Convert to ASCII.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - beforeRunningCommand - nop - command - iconv -c -f utf-8 -t ASCII//TRANSLIT - fallbackInput - word - input - selection - name - Transliterate Word / Selection to ASCII - output - replaceSelectedText - uuid - 3AA8A593-6E4C-11D9-91AF-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Commands/Convert to hex.plist b/bundles/text.tmbundle/Commands/Convert to hex.plist deleted file mode 100644 index 50466cd70..000000000 --- a/bundles/text.tmbundle/Commands/Convert to hex.plist +++ /dev/null @@ -1,23 +0,0 @@ - - - - - beforeRunningCommand - nop - command - #!/usr/bin/env ruby -wKU -print STDIN.read.unpack("U*").map { |e| sprintf('0x%02x', e) }.join(' ') - fallbackInput - character - input - selection - keyEquivalent - ^X - name - Convert Character / Selection to Hex - output - replaceSelectedText - uuid - 7C9736B2-B851-11D9-B05D-00039369B986 - - diff --git a/bundles/text.tmbundle/Commands/Copy Matching Lines into New Document.tmCommand b/bundles/text.tmbundle/Commands/Copy Matching Lines into New Document.tmCommand deleted file mode 100644 index 63a8a4326..000000000 --- a/bundles/text.tmbundle/Commands/Copy Matching Lines into New Document.tmCommand +++ /dev/null @@ -1,37 +0,0 @@ - - - - - beforeRunningCommand - nop - bundleUUID - B7BC3FFD-6E4B-11D9-91AF-000D93589AF6 - command - res=$(ruby -rui -e"print TextMate::UI.request_string(:title => 'Filter Matching Lines', :prompt => 'Enter a pattern:', :button1 => 'Filter', :button2 => 'Cancel').to_s") - -[[ -z "$res" ]] && exit_discard -export pattern="$res" - -# This could be done with grep, but Python's RE is closer to oniguruma -"${TM_PYTHON:-python}" -c ' -import sys, os, re, traceback -try: - pattern = re.compile(os.environ["pattern"]) -except re.error, e: - sys.stderr.write("Invalid pattern: %s" % e) - sys.exit(1) -for line in sys.stdin: - if pattern.search(line): - sys.stdout.write(line) -' || exit_show_tool_tip - - input - selection - name - Copy Matching Lines into New Document - output - openAsNewDocument - uuid - 965DF29E-4EBD-457A-9A61-56D920C35F72 - - diff --git a/bundles/text.tmbundle/Commands/Copy Non-Matching Lines into New Document.tmCommand b/bundles/text.tmbundle/Commands/Copy Non-Matching Lines into New Document.tmCommand deleted file mode 100644 index b97dcc881..000000000 --- a/bundles/text.tmbundle/Commands/Copy Non-Matching Lines into New Document.tmCommand +++ /dev/null @@ -1,37 +0,0 @@ - - - - - beforeRunningCommand - nop - bundleUUID - B7BC3FFD-6E4B-11D9-91AF-000D93589AF6 - command - res=$(ruby -rui -e"print TextMate::UI.request_string(:title => 'Filter Non-Matching Lines', :prompt => 'Enter a pattern:', :button1 => 'Filter', :button2 => 'Cancel').to_s") - -[[ -z "$res" ]] && exit_discard -export pattern="$res" - -# This could be done with grep, but Python's RE is closer to oniguruma -"${TM_PYTHON:-python}" -c ' -import sys, os, re, traceback -try: - pattern = re.compile(os.environ["pattern"]) -except re.error, e: - sys.stderr.write("Invalid pattern: %s" % e) - sys.exit(1) -for line in sys.stdin: - if not pattern.search(line): - sys.stdout.write(line) -' || exit_show_tool_tip - - input - selection - name - Copy Non-Matching Lines into New Document - output - openAsNewDocument - uuid - 8109F2C2-FF63-46F7-83F3-D2318290FC11 - - diff --git a/bundles/text.tmbundle/Commands/Decrypt selection.plist b/bundles/text.tmbundle/Commands/Decrypt selection.plist deleted file mode 100644 index 1cfeace9e..000000000 --- a/bundles/text.tmbundle/Commands/Decrypt selection.plist +++ /dev/null @@ -1,32 +0,0 @@ - - - - - beforeRunningCommand - nop - command - get_pw () { - ruby -rui -e"print TextMate::UI.request_secure_string(:title => 'Decrypt AES 128 Encrypted Text', :prompt => '$1', :button1 => '$2', :button2 => 'Cancel').to_s" -} - -pw=$(get_pw 'What is the password?' Decrypt) -[[ -z "$pw" ]] && exit_discard - -if ! openssl enc -d -aes128 -base64 -pass "pass:$pw"; then - exit_show_tool_tip -fi - - fallbackInput - document - input - selection - keyEquivalent - ^@E - name - AES Decrypt Document / Selection With Password… - output - replaceSelectedText - uuid - 4B22577B-BC8E-11D9-8946-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Commands/Distill Document : Selection.tmCommand b/bundles/text.tmbundle/Commands/Distill Document : Selection.tmCommand deleted file mode 100644 index 13a4b72fe..000000000 --- a/bundles/text.tmbundle/Commands/Distill Document : Selection.tmCommand +++ /dev/null @@ -1,43 +0,0 @@ - - - - - beforeRunningCommand - nop - bundleUUID - B7BC3FFD-6E4B-11D9-91AF-000D93589AF6 - command - res=$(ruby -rui -e"print TextMate::UI.request_string(:title => 'Distill Text', :prompt => 'Enter a pattern:', :button1 => 'Filter', :button2 => 'Cancel').to_s") - -[[ -z "$res" ]] && exit_discard -export pattern="$res" - -# This could be done with grep, but Python's RE is closer to oniguruma -"${TM_PYTHON:-python}" -c ' -import sys, os, re, traceback -try: - pattern = re.compile(os.environ["pattern"]) -except re.error, e: - sys.stderr.write("Invalid pattern: %s" % e) - sys.exit(1) -mate = "\"%s/bin/mate\" -a" % os.environ["TM_SUPPORT_PATH"] -pb = os.popen(mate, "w") -for line in sys.stdin: - if pattern.search(line): - pb.write(line) - else: - sys.stdout.write(line) -pb.close() -' || exit_show_tool_tip - - - input - selection - name - Distill Document / Selection - output - replaceSelectedText - uuid - DA5AD0D9-F7C0-4010-9FDC-FF01B0434F9A - - diff --git a/bundles/text.tmbundle/Commands/Duplicate Line.plist b/bundles/text.tmbundle/Commands/Duplicate Line.plist deleted file mode 100644 index dbdef7157..000000000 --- a/bundles/text.tmbundle/Commands/Duplicate Line.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - beforeRunningCommand - nop - command - #!/usr/bin/env ruby -wKU - -# If there’s a selection, output that twice (as a snippet) -# leaving the duplicate as the new selected text. -# Otherwise split the current line around the caret and -# output “right, left” to duplicate the line, leaving the -# caret in the same place on the new line - -require File.join(ENV["TM_SUPPORT_PATH"], "lib/exit_codes.rb") -require File.join(ENV["TM_SUPPORT_PATH"], "lib/escape.rb") - -if ENV['TM_SELECTED_TEXT'] != nil - TextMate.exit_insert_snippet(e_sn(ENV['TM_SELECTED_TEXT']) + "${0:" + e_snp(ENV['TM_SELECTED_TEXT']) + "}") -else - col = ENV['TM_LINE_INDEX'].to_i - TextMate.exit_insert_text(ENV['TM_CURRENT_LINE'][col..-1] + "\n" + ENV['TM_CURRENT_LINE'][0...col]) -end - fallbackInput - none - input - selection - keyEquivalent - ^D - name - Duplicate Line / Selection - output - afterSelectedText - uuid - C46A9DBC-0B06-49DF-838B-491B529ECF22 - - diff --git a/bundles/text.tmbundle/Commands/Encrypt selection.plist b/bundles/text.tmbundle/Commands/Encrypt selection.plist deleted file mode 100644 index d44587104..000000000 --- a/bundles/text.tmbundle/Commands/Encrypt selection.plist +++ /dev/null @@ -1,33 +0,0 @@ - - - - - beforeRunningCommand - nop - command - get_pw () { - ruby -rui -e"print TextMate::UI.request_secure_string(:title => 'Encrypt Text With AES 128', :prompt => '$1', :button1 => '$2', :button2 => 'Cancel').to_s" -} -pw1=$(get_pw 'What password should be used?' Continue) -[[ -z "$pw1" ]] && exit_discard -pw2=$(get_pw 'Enter password again to verify.' Encrypt) - -if [[ "$pw1" == "$pw2" ]]; - then openssl enc -e -aes128 -base64 -pass "pass:$pw1" - else exit_show_tool_tip 'Password mismatch! Please play again.' -fi - - fallbackInput - document - input - selection - keyEquivalent - ^@E - name - AES Encrypt Document / Selection With Password… - output - replaceSelectedText - uuid - D39DC176-BC8D-11D9-8946-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Commands/Enumerate Lines.plist b/bundles/text.tmbundle/Commands/Enumerate Lines.plist deleted file mode 100644 index 162a37937..000000000 --- a/bundles/text.tmbundle/Commands/Enumerate Lines.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - beforeRunningCommand - nop - command - cat -n|expand -8 - fallbackInput - document - input - selection - keyEquivalent - - name - Add Line Numbers to Document / Selection - output - replaceSelectedText - uuid - 8085013F-8DEA-11D9-B421-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Commands/Open Current URL.plist b/bundles/text.tmbundle/Commands/Open Current URL.plist deleted file mode 100644 index b563a0d51..000000000 --- a/bundles/text.tmbundle/Commands/Open Current URL.plist +++ /dev/null @@ -1,25 +0,0 @@ - - - - - beforeRunningCommand - nop - command - open "$(cat)" - - fallbackInput - scope - input - selection - keyEquivalent -  - name - Open Current URL - output - discard - scope - markup.underline.link - markup.underline.link.relative - uuid - 5A08E461-05CC-4C03-9DC8-BF118594EA3E - - diff --git a/bundles/text.tmbundle/Commands/Randomize Lines in Document : Selection.tmCommand b/bundles/text.tmbundle/Commands/Randomize Lines in Document : Selection.tmCommand deleted file mode 100644 index 528aba117..000000000 --- a/bundles/text.tmbundle/Commands/Randomize Lines in Document : Selection.tmCommand +++ /dev/null @@ -1,18 +0,0 @@ - - - - - beforeRunningCommand - nop - command - ruby -pe'$_ = (rand * 100000000).round.to_s + "\t" + $_'|sort|cut -f2- - input - selection - name - Randomize Lines in Document / Selection - output - replaceSelectedText - uuid - 90291A6E-34F6-4FD5-BA82-6BB6FB4DD492 - - diff --git a/bundles/text.tmbundle/Commands/Sort & Uniq.plist b/bundles/text.tmbundle/Commands/Sort & Uniq.plist deleted file mode 100644 index 08e43318a..000000000 --- a/bundles/text.tmbundle/Commands/Sort & Uniq.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - beforeRunningCommand - nop - command - sort -f|uniq - input - selection - keyEquivalent - - name - Sort Lines & Remove Duplicates - output - replaceSelectedText - uuid - 3010E2A8-6E4F-11D9-A18D-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Commands/Sort.plist b/bundles/text.tmbundle/Commands/Sort.plist deleted file mode 100644 index bb6a20929..000000000 --- a/bundles/text.tmbundle/Commands/Sort.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - beforeRunningCommand - nop - command - sort -f - fallbackInput - document - input - selection - keyEquivalent - - name - Sort Lines in Document / Selection - output - replaceSelectedText - uuid - 273853DF-6E4F-11D9-A18D-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Commands/Speak Document : Selection.tmCommand b/bundles/text.tmbundle/Commands/Speak Document : Selection.tmCommand deleted file mode 100644 index 297cc2f8a..000000000 --- a/bundles/text.tmbundle/Commands/Speak Document : Selection.tmCommand +++ /dev/null @@ -1,18 +0,0 @@ - - - - - beforeRunningCommand - nop - command - say `echo "$TM_SELECTED_TEXT"` & - input - selection - name - Speak Document / Selection - output - discard - uuid - D26BEEE3-7439-4B7E-AD9D-9A144CDC5873 - - diff --git a/bundles/text.tmbundle/Commands/Strip non-printables.plist b/bundles/text.tmbundle/Commands/Strip non-printables.plist deleted file mode 100644 index 792398628..000000000 --- a/bundles/text.tmbundle/Commands/Strip non-printables.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - beforeRunningCommand - nop - command - perl -pe 's/[^\t\n\x20-\xFF]|\x7F|\xC2[\x80-\x9F]//g' - fallbackInput - document - input - selection - name - Remove Unprintable Characters in Document / Selection - output - replaceSelectedText - uuid - BEC25DC3-6E4B-11D9-91AF-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Commands/Strip trailing spaces.plist b/bundles/text.tmbundle/Commands/Strip trailing spaces.plist deleted file mode 100644 index dda9a4559..000000000 --- a/bundles/text.tmbundle/Commands/Strip trailing spaces.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - beforeRunningCommand - nop - command - perl -pe 's/[\t ]+$//g' - fallbackInput - document - input - selection - name - Remove Trailing Spaces in Document / Selection - output - replaceSelectedText - uuid - 0F8C1F78-6E4C-11D9-91AF-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Commands/Word Count.plist b/bundles/text.tmbundle/Commands/Word Count.plist deleted file mode 100644 index 9f6af2d55..000000000 --- a/bundles/text.tmbundle/Commands/Word Count.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - beforeRunningCommand - nop - command - #!/usr/bin/env ruby -wKU - -def pretty(number) - number.to_s.gsub(/\d{1,3}(?=\d{3}+(?!\d))/, '\0,') -end - -counts = `wc -lwc`.scan(/\d+/) -counts[0] = counts[0].to_i + 1 # increase one to the line count - -%w[ line word byte ].each do |unit| - cnt = counts.shift - plural = cnt.to_i != 1 ? 's' : '' - printf("%11.11s %s%s\n", pretty(cnt), unit, plural) -end - - fallbackInput - document - input - selection - keyEquivalent - ^N - name - Statistics for Document / Selection (Word Count) - output - showAsTooltip - uuid - AA202E76-8A0A-11D9-B85D-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Macros/Delete Line.plist b/bundles/text.tmbundle/Macros/Delete Line.plist deleted file mode 100644 index 52645b1c9..000000000 --- a/bundles/text.tmbundle/Macros/Delete Line.plist +++ /dev/null @@ -1,25 +0,0 @@ - - - - - commands - - - command - selectHardLine: - - - command - deleteBackward: - - - keyEquivalent - ^K - name - Delete Line - scopeType - local - uuid - FB8960DB-AA2E-11D9-8E27-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Macros/Delete to Beginning of Line.tmMacro b/bundles/text.tmbundle/Macros/Delete to Beginning of Line.tmMacro deleted file mode 100644 index f2c5dc42e..000000000 --- a/bundles/text.tmbundle/Macros/Delete to Beginning of Line.tmMacro +++ /dev/null @@ -1,19 +0,0 @@ - - - - - commands - - - command - deleteToBeginningOfLine: - - - keyEquivalent - @ - name - Delete to Beginning of Line - uuid - F22BEB71-2DE3-4183-BB10-0199CC328169 - - diff --git a/bundles/text.tmbundle/Macros/EOL + . + LF.plist b/bundles/text.tmbundle/Macros/EOL + . + LF.plist deleted file mode 100644 index 696d519cd..000000000 --- a/bundles/text.tmbundle/Macros/EOL + . + LF.plist +++ /dev/null @@ -1,31 +0,0 @@ - - - - - commands - - - command - moveToEndOfParagraph: - - - argument - . - command - insertText: - - - command - insertNewline: - - - keyEquivalent - $@ - name - Move to EOL and Insert "." + LF - scope - text - uuid - E86C9A77-5B48-43C6-A712-A61B616269E6 - - diff --git a/bundles/text.tmbundle/Macros/EOL + ..plist b/bundles/text.tmbundle/Macros/EOL + ..plist deleted file mode 100644 index 811816a32..000000000 --- a/bundles/text.tmbundle/Macros/EOL + ..plist +++ /dev/null @@ -1,29 +0,0 @@ - - - - - commands - - - command - moveToEndOfParagraph: - - - argument - . - command - insertText: - - - keyEquivalent - ~@ - name - Move to EOL and Insert “.” - scope - text - scopeType - local - uuid - 80CC504F-B13B-11D9-B41F-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Macros/Join Lines.plist b/bundles/text.tmbundle/Macros/Join Lines.plist deleted file mode 100644 index 3787bca54..000000000 --- a/bundles/text.tmbundle/Macros/Join Lines.plist +++ /dev/null @@ -1,46 +0,0 @@ - - - - - commands - - - argument - - action - findNext - findInProjectIgnoreCase - - findInProjectRegularExpression - - findString - $\n\s* - ignoreCase - - regularExpression - - replaceAllScope - document - replaceString - key - wrapAround - - - command - findWithOptions: - - - command - deleteForward: - - - keyEquivalent - ^J - name - Join Line With Next - scopeType - local - uuid - 3D7504EE-B927-4D3D-A3CC-BFB189027EE7 - - diff --git a/bundles/text.tmbundle/Preferences/Markup style: Bold.plist b/bundles/text.tmbundle/Preferences/Markup style: Bold.plist deleted file mode 100644 index 5a63bd8b7..000000000 --- a/bundles/text.tmbundle/Preferences/Markup style: Bold.plist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - name - Style: Bold - scope - markup.bold - settings - - bold - 1 - - uuid - A088E2CA-03E7-4A8C-855C-AC954E739D6D - - diff --git a/bundles/text.tmbundle/Preferences/Markup style: Italic.plist b/bundles/text.tmbundle/Preferences/Markup style: Italic.plist deleted file mode 100644 index 9ea3216d3..000000000 --- a/bundles/text.tmbundle/Preferences/Markup style: Italic.plist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - name - Style: Italic - scope - markup.italic - settings - - italic - 1 - - uuid - 2EE6D01F-50BC-434B-BE45-54D29CACB3E0 - - diff --git a/bundles/text.tmbundle/Preferences/Markup style: Underline.plist b/bundles/text.tmbundle/Preferences/Markup style: Underline.plist deleted file mode 100644 index 11a01ca40..000000000 --- a/bundles/text.tmbundle/Preferences/Markup style: Underline.plist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - name - Style: Underline - scope - markup.underline - settings - - underline - 1 - - uuid - 4CCD8369-40E4-422A-ABE7-C32F3721AFEF - - diff --git a/bundles/text.tmbundle/Preferences/Miscellaneous.plist b/bundles/text.tmbundle/Preferences/Miscellaneous.plist deleted file mode 100644 index 04ffaf9d8..000000000 --- a/bundles/text.tmbundle/Preferences/Miscellaneous.plist +++ /dev/null @@ -1,65 +0,0 @@ - - - - - name - Miscellaneous - settings - - highlightPairs - - - ( - ) - - - { - } - - - [ - ] - - - - - - - - - - - smartTypingPairs - - - " - " - - - ( - ) - - - { - } - - - [ - ] - - - - - - - - - - - unIndentedLinePattern - ^\s*$ - - uuid - 3E8C2307-8175-4A58-BE07-785713D5837A - - diff --git a/bundles/text.tmbundle/Preferences/Spell checking.plist b/bundles/text.tmbundle/Preferences/Spell checking.plist deleted file mode 100644 index 3ef7e991a..000000000 --- a/bundles/text.tmbundle/Preferences/Spell checking.plist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - name - Spell Checking: Disable - scope - markup.underline.link, markup.raw - settings - - spellChecking - 0 - - uuid - 613405D5-67B6-4281-94C9-9148E54C66FB - - diff --git a/bundles/text.tmbundle/Snippets/010 Copyright.plist b/bundles/text.tmbundle/Snippets/010 Copyright.plist deleted file mode 100644 index 3d43183c1..000000000 --- a/bundles/text.tmbundle/Snippets/010 Copyright.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - content - (c) Copyright `date +%Y` $TM_FULLNAME. All Rights Reserved. - name - Copyright Notice - tabTrigger - c) - uuid - BC8B89E4-5F16-11D9-B9C3-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Snippets/Conitnue bullet.plist b/bundles/text.tmbundle/Snippets/Conitnue bullet.plist deleted file mode 100644 index 4704f7906..000000000 --- a/bundles/text.tmbundle/Snippets/Conitnue bullet.plist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - content - -• - keyEquivalent -  - name - Continue Bullet - scope - meta.bullet-point - uuid - C30BA263-B10E-11D9-9975-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Snippets/Conitnue light bullet.plist b/bundles/text.tmbundle/Snippets/Conitnue light bullet.plist deleted file mode 100644 index 2c0cd2a80..000000000 --- a/bundles/text.tmbundle/Snippets/Conitnue light bullet.plist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - content - - keyEquivalent -  - name - Continue Light Bullet - scope - meta.bullet-point.light - uuid - EA149DAB-B10E-11D9-9975-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Snippets/Conitnue star bullet.plist b/bundles/text.tmbundle/Snippets/Conitnue star bullet.plist deleted file mode 100644 index 81dc40471..000000000 --- a/bundles/text.tmbundle/Snippets/Conitnue star bullet.plist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - content - -* - keyEquivalent -  - name - Continue Star Bullet - scope - meta.bullet-point.star - uuid - B5E22191-B151-11D9-85C9-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Snippets/Insert ISO date.plist b/bundles/text.tmbundle/Snippets/Insert ISO date.plist deleted file mode 100644 index c2b2f79b8..000000000 --- a/bundles/text.tmbundle/Snippets/Insert ISO date.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - content - `date +%Y-%m-%d` - name - Current Date — YYYY-MM-DD - tabTrigger - isoD - uuid - C9CAF012-6E50-11D9-AA12-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Snippets/Lorem ipsum.plist b/bundles/text.tmbundle/Snippets/Lorem ipsum.plist deleted file mode 100644 index a30cff0d4..000000000 --- a/bundles/text.tmbundle/Snippets/Lorem ipsum.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - content - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. - name - Lorem ipsum - tabTrigger - lorem - uuid - BA9A2B17-DA89-49A5-809B-AC7510C24625 - - diff --git a/bundles/text.tmbundle/Syntaxes/Plain text.plist b/bundles/text.tmbundle/Syntaxes/Plain text.plist deleted file mode 100644 index 58f61d336..000000000 --- a/bundles/text.tmbundle/Syntaxes/Plain text.plist +++ /dev/null @@ -1,83 +0,0 @@ - - - - - fileTypes - - txt - - keyEquivalent - ^~P - name - Plain Text - patterns - - - captures - - 1 - - name - punctuation.definition.item.text - - - match - ^\s*(•).*$\n? - name - meta.bullet-point.strong.text - - - captures - - 1 - - name - punctuation.definition.item.text - - - match - ^\s*(·).*$\n? - name - meta.bullet-point.light.text - - - captures - - 1 - - name - punctuation.definition.item.text - - - match - ^\s*(\*).*$\n? - name - meta.bullet-point.star.text - - - begin - ^([ \t]*)(?=\S) - contentName - meta.paragraph.text - end - ^(?!\1(?=\S)) - patterns - - - match - (?x) - ( (https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt)://|mailto:) - [-:@a-zA-Z0-9_.,~%+/?=&#]+(?<![.,?:]) - - name - markup.underline.link.text - - - - - scopeName - text.plain - uuid - 3130E4FA-B10E-11D9-9F75-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Templates/Empty file/info.plist b/bundles/text.tmbundle/Templates/Empty file/info.plist deleted file mode 100644 index 5b2b2ffb5..000000000 --- a/bundles/text.tmbundle/Templates/Empty file/info.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - command - touch "$TM_NEW_FILE" - isDefault - 1 - name - Empty File - uuid - 2D3AFF01-6DFB-11D9-91EB-000D93589AF6 - - diff --git a/bundles/text.tmbundle/Templates/From Clipboard/info.plist b/bundles/text.tmbundle/Templates/From Clipboard/info.plist deleted file mode 100644 index 54da778e6..000000000 --- a/bundles/text.tmbundle/Templates/From Clipboard/info.plist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - command - if [[ ! -f "$TM_NEW_FILE" ]]; then - __CF_USER_TEXT_ENCODING=$UID:0x8000100:0x8000100 \ - pbpaste > "$TM_NEW_FILE" | tr '\r' '\n' -fi - extension - txt - name - From Clipboard - uuid - 1D357AB2-687A-4C74-AADE-6AE6684E97DC - - diff --git a/bundles/text.tmbundle/info.plist b/bundles/text.tmbundle/info.plist deleted file mode 100644 index 13b08e097..000000000 --- a/bundles/text.tmbundle/info.plist +++ /dev/null @@ -1,139 +0,0 @@ - - - - - contactEmailRot13 - gz-ohaqyrf@znpebzngrf.pbz - contactName - Allan Odgaard - deleted - - CF8570E4-389B-4928-8908-BF3B6A5E8422 - - description - The text bundle has a lot of support for plain text and is a requisite for working with text. - mainMenu - - excludedItems - - 5A08E461-05CC-4C03-9DC8-BF118594EA3E - C30BA263-B10E-11D9-9975-000D93589AF6 - EA149DAB-B10E-11D9-9975-000D93589AF6 - B5E22191-B151-11D9-85C9-000D93589AF6 - 80CC504F-B13B-11D9-B41F-000D93589AF6 - E86C9A77-5B48-43C6-A712-A61B616269E6 - F22BEB71-2DE3-4183-BB10-0199CC328169 - - items - - 818D10A3-F827-424A-BCBF-6DC6CB62966A - DAF7B200-5B75-4999-BBC3-D1ADD64E1FA1 - 172F6528-7561-44FC-BFAD-A06C645D5AFB - 4D6C0A7A-263C-4E2E-B2F2-1FA912E14490 - ------------------------------------ - FB8960DB-AA2E-11D9-8E27-000D93589AF6 - C46A9DBC-0B06-49DF-838B-491B529ECF22 - 3D7504EE-B927-4D3D-A3CC-BFB189027EE7 - ------------------------------------ - 8085013F-8DEA-11D9-B421-000D93589AF6 - AA202E76-8A0A-11D9-B85D-000D93589AF6 - ------------------------------------ - BC8B89E4-5F16-11D9-B9C3-000D93589AF6 - C9CAF012-6E50-11D9-AA12-000D93589AF6 - BA9A2B17-DA89-49A5-809B-AC7510C24625 - D26BEEE3-7439-4B7E-AD9D-9A144CDC5873 - - submenus - - 172F6528-7561-44FC-BFAD-A06C645D5AFB - - items - - DA5AD0D9-F7C0-4010-9FDC-FF01B0434F9A - 965DF29E-4EBD-457A-9A61-56D920C35F72 - 8109F2C2-FF63-46F7-83F3-D2318290FC11 - - name - Filtering - - 4D6C0A7A-263C-4E2E-B2F2-1FA912E14490 - - items - - 273853DF-6E4F-11D9-A18D-000D93589AF6 - 3010E2A8-6E4F-11D9-A18D-000D93589AF6 - ------------------------------------ - 90291A6E-34F6-4FD5-BA82-6BB6FB4DD492 - - name - Sorting - - 818D10A3-F827-424A-BCBF-6DC6CB62966A - - items - - 7C9736B2-B851-11D9-B05D-00039369B986 - 0F8C1F78-6E4C-11D9-91AF-000D93589AF6 - BEC25DC3-6E4B-11D9-91AF-000D93589AF6 - 3AA8A593-6E4C-11D9-91AF-000D93589AF6 - - name - Converting / Stripping - - DAF7B200-5B75-4999-BBC3-D1ADD64E1FA1 - - items - - D39DC176-BC8D-11D9-8946-000D93589AF6 - 4B22577B-BC8E-11D9-8946-000D93589AF6 - - name - Encryption - - - - name - Text - ordering - - 8085013F-8DEA-11D9-B421-000D93589AF6 - D39DC176-BC8D-11D9-8946-000D93589AF6 - 4B22577B-BC8E-11D9-8946-000D93589AF6 - 7C9736B2-B851-11D9-B05D-00039369B986 - C46A9DBC-0B06-49DF-838B-491B529ECF22 - 5A08E461-05CC-4C03-9DC8-BF118594EA3E - 0F8C1F78-6E4C-11D9-91AF-000D93589AF6 - BEC25DC3-6E4B-11D9-91AF-000D93589AF6 - 273853DF-6E4F-11D9-A18D-000D93589AF6 - 3010E2A8-6E4F-11D9-A18D-000D93589AF6 - 90291A6E-34F6-4FD5-BA82-6BB6FB4DD492 - AA202E76-8A0A-11D9-B85D-000D93589AF6 - 3AA8A593-6E4C-11D9-91AF-000D93589AF6 - D26BEEE3-7439-4B7E-AD9D-9A144CDC5873 - 965DF29E-4EBD-457A-9A61-56D920C35F72 - 8109F2C2-FF63-46F7-83F3-D2318290FC11 - DA5AD0D9-F7C0-4010-9FDC-FF01B0434F9A - FB8960DB-AA2E-11D9-8E27-000D93589AF6 - 3D7504EE-B927-4D3D-A3CC-BFB189027EE7 - 80CC504F-B13B-11D9-B41F-000D93589AF6 - E86C9A77-5B48-43C6-A712-A61B616269E6 - F22BEB71-2DE3-4183-BB10-0199CC328169 - C30BA263-B10E-11D9-9975-000D93589AF6 - EA149DAB-B10E-11D9-9975-000D93589AF6 - B5E22191-B151-11D9-85C9-000D93589AF6 - BC8B89E4-5F16-11D9-B9C3-000D93589AF6 - C9CAF012-6E50-11D9-AA12-000D93589AF6 - BA9A2B17-DA89-49A5-809B-AC7510C24625 - 3130E4FA-B10E-11D9-9F75-000D93589AF6 - 3E8C2307-8175-4A58-BE07-785713D5837A - 613405D5-67B6-4281-94C9-9148E54C66FB - A088E2CA-03E7-4A8C-855C-AC954E739D6D - 2EE6D01F-50BC-434B-BE45-54D29CACB3E0 - 4CCD8369-40E4-422A-ABE7-C32F3721AFEF - 2D3AFF01-6DFB-11D9-91EB-000D93589AF6 - 1D357AB2-687A-4C74-AADE-6AE6684E97DC - - uuid - B7BC3FFD-6E4B-11D9-91AF-000D93589AF6 - - diff --git a/cef.gypi b/cef.gypi new file mode 100644 index 000000000..c3f8cce3d --- /dev/null +++ b/cef.gypi @@ -0,0 +1,22 @@ +# Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +{ + 'variables': { + 'conditions': [ + # Directory for CEF source files. + [ 'OS=="win"', { + 'cef_directory' : '"; }; + 006E2641277922A5B3C03BC2 /* adm_writer_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = adm_writer_unittest.py; sourceTree = ""; }; + 007F191CDADBB6B9DE99848F /* before_download_callback_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = before_download_callback_ctocpp.cc; sourceTree = ""; }; + 00A3A60B85CDFEDACAEEB519 /* cookie_manager_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cookie_manager_impl.cc; sourceTree = ""; }; + 00FF2D290B6BA4D912A7885D /* app_locale_settings_gu.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_gu.pak; sourceTree = ""; }; + 01B79CB85CA6B558D2FF8CA1 /* cef_zip_archive.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cef_zip_archive.cc; sourceTree = ""; }; + 01C9A4CE5FB2EEC5EAA9CD29 /* process_message_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = process_message_unittest.cc; sourceTree = ""; }; + 0214004821A34E16FAA98C37 /* browser_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_impl.cc; sourceTree = ""; }; + 02193627E8FF79BCD0817B49 /* cef_web_plugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_web_plugin.h; sourceTree = ""; }; + 021AAB8AF92012BFE87C320D /* resource_bundle_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = resource_bundle_handler_cpptoc.cc; sourceTree = ""; }; + 021BD3DBAAA1DBFB8232B9C5 /* v8handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8handler_ctocpp.cc; sourceTree = ""; }; + 02943212AED67FDE1DE8A754 /* webkit_strings_fil.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_fil.pak; sourceTree = ""; }; + 029D01F5660890E5E63D2E00 /* download_item_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = download_item_ctocpp.cc; sourceTree = ""; }; + 02C3921F366D7D841D6667B0 /* uk */ = {isa = PBXFileReference; lastKnownFileType = text; name = uk; path = uk.lproj/locale.pak; sourceTree = ""; }; + 037D7D3E4B2DD1EF60ED4BEA /* browser_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_ctocpp.h; sourceTree = ""; }; + 03993E37BA0957D7AD5851EE /* cef_client.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_client.h; sourceTree = ""; }; + 03C4C78B8596116BFD2BEED2 /* ro */ = {isa = PBXFileReference; lastKnownFileType = text; name = ro; path = ro.lproj/locale.pak; sourceTree = ""; }; + 03E168B20BA32B8A31F1C5C0 /* cef_geolocation_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_geolocation_handler.h; sourceTree = ""; }; + 048991D7CE055E48525043FB /* cef_origin_whitelist_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_origin_whitelist_capi.h; sourceTree = ""; }; + 0493FA7D04E9DD460B094B27 /* request_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = request_handler_cpptoc.h; sourceTree = ""; }; + 04CFE5D5BE80944DAD609635 /* app_locale_settings_de.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_de.pak; sourceTree = ""; }; + 0514C79670E149EB872D2C1C /* webkit_strings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = webkit_strings.h; sourceTree = ""; }; + 0518EC34271437784B0CF75D /* app_locale_settings_zh-CN.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "app_locale_settings_zh-CN.pak"; sourceTree = ""; }; + 054D552370799D9F7EACC73A /* ui_strings_tr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_tr.pak; sourceTree = ""; }; + 059C98513FBDA8371C6B5F9D /* client_handler_mac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = client_handler_mac.mm; sourceTree = ""; }; + 0651D00FD6E7F704270E6F29 /* jsoncpp.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = jsoncpp.xcodeproj; path = ../third_party/jsoncpp/jsoncpp.xcodeproj; sourceTree = SOURCE_ROOT; }; + 065F518B3E8F22E177526086 /* cef_jsdialog_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_jsdialog_handler.h; sourceTree = ""; }; + 06C15E96A6E8E4C3CBE2895B /* browser_process_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_process_handler_ctocpp.cc; sourceTree = ""; }; + 06CFB89D4546843303928D46 /* dom_node_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = dom_node_impl.cc; sourceTree = ""; }; + 074D7464D208F959F4EFA456 /* system_wrappers.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = system_wrappers.xcodeproj; path = ../third_party/webrtc/system_wrappers/source/system_wrappers.xcodeproj; sourceTree = SOURCE_ROOT; }; + 07A39F219A616F191160FF50 /* url_request_context_proxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = url_request_context_proxy.h; sourceTree = ""; }; + 07B50631033A1D31193C99F0 /* fil */ = {isa = PBXFileReference; lastKnownFileType = text; name = fil; path = fil.lproj/locale.pak; sourceTree = ""; }; + 07D01593D99A6D465EBF7CCC /* cefclient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cefclient.cpp; sourceTree = ""; }; + 084B8EA24DF5DF1571DE7137 /* structure.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = structure.py; sourceTree = ""; }; + 08623EC0BFEEA2B84E7943FF /* dictionary_value_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = dictionary_value_ctocpp.cc; sourceTree = ""; }; + 0896A4568A6EF547A818E252 /* ssl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ssl.xcodeproj; path = ../net/third_party/nss/ssl.xcodeproj; sourceTree = SOURCE_ROOT; }; + 08E26B4DF6F60A58CE5BCAD8 /* app_locale_settings_nb.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_nb.pak; sourceTree = ""; }; + 08F481D420D2BEFAA309844B /* webkit_strings_sk.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_sk.pak; sourceTree = ""; }; + 090865B9B17F24959C44BA28 /* make_pack_header.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = make_pack_header.py; sourceTree = ""; }; + 0937034213F2744D0E0E7317 /* app_locale_settings_uk.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_uk.pak; sourceTree = ""; }; + 093E2FE093BECFD41D5335CE /* template_writer_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = template_writer_unittest.py; sourceTree = ""; }; + 0A2108D276F821F2D9E1EA10 /* domevent_listener_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domevent_listener_ctocpp.cc; sourceTree = ""; }; + 0A252C48128C7984A5A7D199 /* sudden_motion_sensor.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = sudden_motion_sensor.xcodeproj; path = ../third_party/sudden_motion_sensor/sudden_motion_sensor.xcodeproj; sourceTree = SOURCE_ROOT; }; + 0A93C66579AABB2144A11281 /* app_locale_settings_he.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_he.pak; sourceTree = ""; }; + 0AD75F3C85B1E8E79017CEB8 /* doc_writer.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = doc_writer.py; sourceTree = ""; }; + 0B156A4CFECFA1AB636989F5 /* util.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = util.py; sourceTree = ""; }; + 0B1FA47E3643C52A9B849A79 /* xmb.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = xmb.py; sourceTree = ""; }; + 0B24DFC2B43AF06D76BD63EC /* scheme_handler_factory_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scheme_handler_factory_ctocpp.h; sourceTree = ""; }; + 0BB13BD19ADF478AB8D63F81 /* cef_keyboard_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_keyboard_handler_capi.h; sourceTree = ""; }; + 0BCDC6DD2A853EE361074F3C /* libcef_dll_wrapper2.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = libcef_dll_wrapper2.cc; sourceTree = ""; }; + 0BF4B487406238588B1E2E2F /* binding_test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = binding_test.h; sourceTree = ""; }; + 0BF739A5B1C2AA176439A5F6 /* pseudo_rtl.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = pseudo_rtl.py; sourceTree = ""; }; + 0C2AFED1006ACC3B5DEA1B3A /* render_process_observer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = render_process_observer.h; sourceTree = ""; }; + 0CDB496FCE74889BECC786AC /* webkit_chromium_resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = webkit_chromium_resources.h; sourceTree = ""; }; + 0CE409DD2BCB2D7EA19F1BE4 /* test_handler.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = test_handler.cc; sourceTree = ""; }; + 0D452EDDF4C4CC7A41ADA11A /* cef_web_plugin_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_web_plugin_capi.h; sourceTree = ""; }; + 0D9C96436871C7AC09C92FBE /* resource_map.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = resource_map.py; sourceTree = ""; }; + 0DB4E599ACA1FF50AEA38D24 /* url_request_context_getter_proxy.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = url_request_context_getter_proxy.cc; sourceTree = ""; }; + 0DCA45E5487FDB9C815839B1 /* application_mac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = application_mac.mm; sourceTree = ""; }; + 0DD56C161B0CA9D5F9D7C0CE /* cef_request.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_request.h; sourceTree = ""; }; + 0E111B6033380EFB8FAD197A /* cef_menu_model.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_menu_model.h; sourceTree = ""; }; + 0E7E7A3D338D3815128F4FE1 /* ui_strings_ja.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_ja.pak; sourceTree = ""; }; + 0EF3CF486BE3B15A5E526722 /* grit.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = grit.py; sourceTree = ""; }; + 0F027973D0ADA67E74793587 /* ui_strings_sv.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_sv.pak; sourceTree = ""; }; + 0F17041FB76E0352E317070D /* ui_strings_sr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_sr.pak; sourceTree = ""; }; + 0F8D9EF32570C0C4F5E10D71 /* domdocument_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domdocument_cpptoc.h; sourceTree = ""; }; + 0F9E48B2C38027DC3F74C4AC /* stream_reader_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = stream_reader_cpptoc.cc; sourceTree = ""; }; + 100EB023F2DA2005C72B04F3 /* ui_strings_el.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_el.pak; sourceTree = ""; }; + 10128A219805A7294C6801D1 /* xml_reader_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xml_reader_impl.h; sourceTree = ""; }; + 1037A328AAB20BB9F7CAE553 /* client_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = client_ctocpp.h; sourceTree = ""; }; + 106433B6C1D2BC480CCB7ED5 /* ui_strings_nb.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_nb.pak; sourceTree = ""; }; + 1094CFA6EF2DE7E52C584CD3 /* menu_creator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_creator.h; sourceTree = ""; }; + 109971241DE89588510AC552 /* cef_message_generator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_message_generator.h; sourceTree = ""; }; + 10FB137FABDB2510091F240E /* libyuv.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libyuv.xcodeproj; path = ../third_party/libyuv/libyuv.xcodeproj; sourceTree = SOURCE_ROOT; }; + 111B057CA2C89F67064CCB20 /* urlrequest_client_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = urlrequest_client_ctocpp.cc; sourceTree = ""; }; + 112B6763C9E7B43E077673E3 /* display_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = display_handler_ctocpp.cc; sourceTree = ""; }; + 11705C7906E226312AA63C1E /* interface.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = interface.py; sourceTree = ""; }; + 1193F2D58AEF3615DD79DEF7 /* Platform.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Platform.xcodeproj; path = ../third_party/WebKit/Source/Platform/Platform.gyp/Platform.xcodeproj; sourceTree = SOURCE_ROOT; }; + 11F7C69A218B1F1D26564618 /* stream_writer_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = stream_writer_cpptoc.cc; sourceTree = ""; }; + 120B6AF524D6BA1589FD601A /* cef_download_item.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_download_item.h; sourceTree = ""; }; + 12AAC7C7476E3B69B743F399 /* dom_document_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dom_document_impl.h; sourceTree = ""; }; + 12B6B25CD0AC0FEF0C37C56B /* cef_mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_mac.h; sourceTree = ""; }; + 12E42A64F19E4B183A87E741 /* el */ = {isa = PBXFileReference; lastKnownFileType = text; name = el; path = el.lproj/locale.pak; sourceTree = ""; }; + 13A0D9C589E6C9B796C7A4D8 /* transl2tc.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = transl2tc.py; sourceTree = ""; }; + 13DA98F0EC61DC95C724F028 /* writer_configuration.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = writer_configuration.py; sourceTree = ""; }; + 14BDBB48FBFCED5C56A3D384 /* context_menu_params_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = context_menu_params_impl.cc; sourceTree = ""; }; + 14C68B169971C62D93A299B5 /* ui_strings_en-US.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "ui_strings_en-US.pak"; sourceTree = ""; }; + 14ECE7D63EFCCBEE9F988D9C /* client_handler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_handler.cpp; sourceTree = ""; }; + 151A694232221A890E2EBE2B /* auth_callback_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = auth_callback_cpptoc.cc; sourceTree = ""; }; + 154A354AA505CD72DDB2EFA9 /* domevent_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domevent_cpptoc.cc; sourceTree = ""; }; + 155206012707A590F898972B /* binary_value_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = binary_value_ctocpp.cc; sourceTree = ""; }; + 1565CFD5145C22BAC85C3EEE /* base.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = base.xcodeproj; path = ../base/base.xcodeproj; sourceTree = SOURCE_ROOT; }; + 159546C2D7977EF25EFA7B40 /* common_video.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = common_video.xcodeproj; path = ../third_party/webrtc/common_video/common_video.xcodeproj; sourceTree = SOURCE_ROOT; }; + 15CC340E227772893CA2AFEB /* list_value_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = list_value_cpptoc.cc; sourceTree = ""; }; + 15D1A25A73657683C2B5B1A2 /* resource_bundle_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = resource_bundle_handler_ctocpp.cc; sourceTree = ""; }; + 160697CEA26EA817C61CEF0B /* cef_pack_resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_pack_resources.h; sourceTree = ""; }; + 173C4B63EE1C5DE552933F98 /* menu_creator_runner_mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_creator_runner_mac.h; sourceTree = ""; }; + 174958AFC1DC000B4DFCAAB5 /* application_mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = application_mac.h; sourceTree = ""; }; + 177DBE23FF52BC4B6AA97A61 /* clique_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = clique_unittest.py; sourceTree = ""; }; + 17D3CBDD52BE57CF73F313AD /* ui_strings_cs.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_cs.pak; sourceTree = ""; }; + 17FE54DB3FAE1BF5BF29F441 /* es */ = {isa = PBXFileReference; lastKnownFileType = text; name = es; path = es.lproj/locale.pak; sourceTree = ""; }; + 1801E857339C7B5A3EB69624 /* domevent_listener_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domevent_listener_cpptoc.h; sourceTree = ""; }; + 189D9B41955B28070345E46F /* app_locale_settings_fa.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_fa.pak; sourceTree = ""; }; + 18CB17F5F89FE2DD4775C8D8 /* webkit_strings_ta.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_ta.pak; sourceTree = ""; }; + 18F5B503F5681FCA9989BC95 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; }; + 1974FF0ADD0407E965545E45 /* he */ = {isa = PBXFileReference; lastKnownFileType = text; name = he; path = he.lproj/locale.pak; sourceTree = ""; }; + 199B54DD78FCFB3099B5300F /* webkit_strings_ja.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_ja.pak; sourceTree = ""; }; + 19D9BDEED72B2D29E3858E3E /* menu_from_parts.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = menu_from_parts.py; sourceTree = ""; }; + 1A5CFC73A744B2F9E3DBEC2E /* cef_browser_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_browser_capi.h; sourceTree = ""; }; + 1A64382F7B0B236D969E4800 /* client_switches.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = client_switches.h; sourceTree = ""; }; + 1AF072F4E95AF8E70575FDC6 /* en */ = {isa = PBXFileReference; lastKnownFileType = text; name = en; path = en.lproj/locale.pak; sourceTree = ""; }; + 1B2DDB258AEDB8CF0321091C /* app_locale_settings_zh-TW.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "app_locale_settings_zh-TW.pak"; sourceTree = ""; }; + 1B34D9CA1FF0A85F4E51BE1F /* load_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = load_handler_ctocpp.h; sourceTree = ""; }; + 1B4EEB952256F5695BBE679E /* template_formatter.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = template_formatter.py; sourceTree = ""; }; + 1B7235D5B6CB67E3830DF992 /* app_locale_settings_hi.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_hi.pak; sourceTree = ""; }; + 1C025E27C1B803BE216F4F86 /* ipc.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ipc.xcodeproj; path = ../ipc/ipc.xcodeproj; sourceTree = SOURCE_ROOT; }; + 1C1D2B476CB71FED19A90525 /* nss.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = nss.xcodeproj; path = ../third_party/nss/nss.xcodeproj; sourceTree = SOURCE_ROOT; }; + 1C275EF161AD18A51486855F /* client_app.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = client_app.h; sourceTree = ""; }; + 1C5196D5A93468A76CA3C7F1 /* hi */ = {isa = PBXFileReference; lastKnownFileType = text; name = hi; path = hi.lproj/locale.pak; sourceTree = ""; }; + 1C5AE824CF8FB2E013C771FB /* resource_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = resource_handler_cpptoc.cc; sourceTree = ""; }; + 1C6366E363E4421EDFB9EB05 /* menu_creator_runner_mac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = menu_creator_runner_mac.mm; sourceTree = ""; }; + 1C834CCB1E55E906499F26DE /* id */ = {isa = PBXFileReference; lastKnownFileType = text; name = id; path = id.lproj/locale.pak; sourceTree = ""; }; + 1C8EB17A5EB1BE9AF0E29160 /* cef_resources.grd */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_resources.grd; sourceTree = ""; }; + 1CCEA731C691044D678F8B9D /* scheme_registrar_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_registrar_cpptoc.cc; sourceTree = ""; }; + 1D9B27BE6DA55ACB43ED477A /* context_menu_params_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = context_menu_params_ctocpp.cc; sourceTree = ""; }; + 1DBB070EBD1333BBE5C68D1C /* crypto.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = crypto.xcodeproj; path = ../crypto/crypto.xcodeproj; sourceTree = SOURCE_ROOT; }; + 1E9256FD015F259D83BC5F28 /* __init__.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = ""; }; + 1EB03115DE936B3FC248AB72 /* before_download_callback_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = before_download_callback_ctocpp.h; sourceTree = ""; }; + 1EB563F48D15B2AA41F39E0B /* command_line_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = command_line_unittest.cc; sourceTree = ""; }; + 1EEBC9008E31713FA7F05FC9 /* jsdialog_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsdialog_handler_cpptoc.h; sourceTree = ""; }; + 1F32D37DE39EA6518CBF7A97 /* main_delegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = main_delegate.h; sourceTree = ""; }; + 1F637E97023288AC42336958 /* urlrequest_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = urlrequest_ctocpp.cc; sourceTree = ""; }; + 1FF3A7904AAC029FCC596CCB /* v8_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8_impl.h; sourceTree = ""; }; + 2000433F0589FE061FBFC7B7 /* event_disposition.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = event_disposition.h; sourceTree = ""; }; + 201DD4C6FAF3E4CE86D37388 /* cef_paths.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_paths.gypi; sourceTree = ""; }; + 208F10822055563A9A88F9CB /* cef_unittests Helper.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = "cef_unittests Helper.app"; sourceTree = ""; }; + 208F7C728B9FBF8EA807E1E8 /* webkit_strings_mr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_mr.pak; sourceTree = ""; }; + 20B9C1471565555B56117D65 /* response_manager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = response_manager.h; sourceTree = ""; }; + 20BA4A45C8E834D3CBD09AD1 /* render_urlrequest_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = render_urlrequest_impl.h; sourceTree = ""; }; + 20F593B2668252D45B5FC494 /* focus_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = focus_handler_cpptoc.h; sourceTree = ""; }; + 217AE35B8A9BA24CD3E26EFA /* Atom.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Atom.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 21B00D3F02764EF9434371B9 /* stream_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = stream_impl.cc; sourceTree = ""; }; + 21CD3E93FEA7E8ABD82BFBAF /* devtools_resources.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = devtools_resources.xcodeproj; path = ../content/browser/debugger/devtools_resources.xcodeproj; sourceTree = SOURCE_ROOT; }; + 22912DF4A93A53C0E7D2C576 /* scheme_handler_factory_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_handler_factory_ctocpp.cc; sourceTree = ""; }; + 2362E106BA358E24CDBFA2D3 /* ui_strings_fr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_fr.pak; sourceTree = ""; }; + 2402718FB1781B628D8E9890 /* gpu.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = gpu.xcodeproj; path = ../gpu/gpu.xcodeproj; sourceTree = SOURCE_ROOT; }; + 24048A9014E601FAE7887602 /* cef_app.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_app.h; sourceTree = ""; }; + 24479F1AE7EB2CCF6878BC67 /* urlrequest_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = urlrequest_unittest.cc; sourceTree = ""; }; + 24579E9B79C662488A6C4DA6 /* geolocation_callback_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = geolocation_callback_ctocpp.cc; sourceTree = ""; }; + 2486CD197F535BFE0E1F6A78 /* NSString+Utils.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSString+Utils.mm"; sourceTree = ""; }; + 24B5217D196DBD2A39619EED /* policy_template_generator_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = policy_template_generator_unittest.py; sourceTree = ""; }; + 255110884F82A5FF3A20FA2D /* chrome_html.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = chrome_html.py; sourceTree = ""; }; + 258191CFC8F133D6A1577F7E /* geolocation_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = geolocation_handler_ctocpp.h; sourceTree = ""; }; + 25B6EE578237AB8259011D6C /* webkit_strings_kn.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_kn.pak; sourceTree = ""; }; + 25EEC66C5B03F5672152ACCB /* all.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = all.xcodeproj; path = "../third_party/v8-i18n/build/all.xcodeproj"; sourceTree = SOURCE_ROOT; }; + 261D817CE1958F87B4F02BF4 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; + 262BD76496AAB06FA64AC8A7 /* task_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = task_impl.cc; sourceTree = ""; }; + 26467F2D5FE71216BABF0212 /* cef_zip_reader_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_zip_reader_capi.h; sourceTree = ""; }; + 26FED33C81845F6E153FDFC0 /* cef_strings_te.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_te.pak; sourceTree = ""; }; + 27A7579E4514158F63A538E1 /* dom_test.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = dom_test.cpp; sourceTree = ""; }; + 27F20B4EA7E219C534D26F81 /* cef_string_visitor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_visitor.h; sourceTree = ""; }; + 2887799486DC2264974AAA31 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text; name = ar; path = ar.lproj/locale.pak; sourceTree = ""; }; + 28A442512D6FDA74492B0849 /* context_menu_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = context_menu_handler_ctocpp.h; sourceTree = ""; }; + 28BCD824953EF6C08B5C9158 /* cef_path_util_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_path_util_capi.h; sourceTree = ""; }; + 28E1959412BAB2B5F1226BCD /* cef_scheme.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_scheme.h; sourceTree = ""; }; + 28ECA57957568EE70BAF8F09 /* cef_strings_am.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_am.pak; sourceTree = ""; }; + 29166ED0F0896A7EB34736BD /* webkit_strings_pl.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_pl.pak; sourceTree = ""; }; + 298E681B338969706F4D6E75 /* cef_geolocation_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_geolocation_handler_capi.h; sourceTree = ""; }; + 29F76CC8AE36885C4BFA2891 /* cef_menu_model_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_menu_model_capi.h; sourceTree = ""; }; + 2A3EC5E90DB5938F169F8A1C /* ui_strings_da.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_da.pak; sourceTree = ""; }; + 2A80AEB3699E699F41429EC0 /* grit_target.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = grit_target.gypi; path = ../build/grit_target.gypi; sourceTree = ""; }; + 2AA359A707FDEBCD53258B83 /* domnode_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domnode_cpptoc.cc; sourceTree = ""; }; + 2AA818CBAF5F61D7A21B18D7 /* expat.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = expat.xcodeproj; path = ../third_party/expat/expat.xcodeproj; sourceTree = SOURCE_ROOT; }; + 2B63F6058224C1F0584B9A68 /* app_locale_settings_fr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_fr.pak; sourceTree = ""; }; + 2BB627122277A2433EBFB9E3 /* v8accessor_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8accessor_cpptoc.cc; sourceTree = ""; }; + 2BDFA0D019DB383FCBE2863E /* gtest.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = gtest.xcodeproj; path = ../testing/gtest.xcodeproj; sourceTree = SOURCE_ROOT; }; + 2BE5DEB2BA0ECEB7B1A7BEC0 /* keyboard_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = keyboard_handler_cpptoc.h; sourceTree = ""; }; + 2C46051D65EF1F90D34F4D23 /* cef_load_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_load_handler_capi.h; sourceTree = ""; }; + 2C5DCA0E34DEC39C40C17F5C /* values_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = values_impl.cc; sourceTree = ""; }; + 2C62ACF1F0A549F0A2051AB8 /* process_message_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = process_message_cpptoc.h; sourceTree = ""; }; + 2D0218D9DF2BD9D2F1CC3768 /* content_resources.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = content_resources.pak; sourceTree = ""; }; + 2D1746EDD846025A7BBCF1F5 /* resource_context.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = resource_context.cc; sourceTree = ""; }; + 2D7ECB9F3062F8D36F88D925 /* cookie_visitor_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cookie_visitor_ctocpp.h; sourceTree = ""; }; + 2D953328A837658D8BC680C6 /* libjingle.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libjingle.xcodeproj; path = ../third_party/libjingle/libjingle.xcodeproj; sourceTree = SOURCE_ROOT; }; + 2DA4661D161001F0020E73D6 /* string_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = string_unittest.cc; sourceTree = ""; }; + 2DD425A12F28FEF717511181 /* cef_proxy_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_proxy_handler.h; sourceTree = ""; }; + 2DF0099F0EE8FE9B392AACC4 /* zlib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = zlib.xcodeproj; path = ../third_party/zlib/zlib.xcodeproj; sourceTree = SOURCE_ROOT; }; + 2E81A09EA187C5ABA0594B81 /* cef_byte_read_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_byte_read_handler.h; sourceTree = ""; }; + 2EB9F9BD145BFF7BA721058A /* navigate_params.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = navigate_params.h; sourceTree = ""; }; + 2EC90772970F0A499BBC2294 /* grit_action.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = grit_action.gypi; path = ../build/grit_action.gypi; sourceTree = ""; }; + 2F4E80723D53CD819926DBBC /* ms */ = {isa = PBXFileReference; lastKnownFileType = text; name = ms; path = ms.lproj/locale.pak; sourceTree = ""; }; + 2F9C3E04A4E35C45B630AEC3 /* v8accessor_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8accessor_ctocpp.h; sourceTree = ""; }; + 2F9D1C00603D4F8A5C80D756 /* ui_strings_id.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_id.pak; sourceTree = ""; }; + 2FA8C86FE90064CC6AD204B8 /* webkit_strings_de.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_de.pak; sourceTree = ""; }; + 2FF25DEDFC25519FC2068EB6 /* resize.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = resize.py; sourceTree = ""; }; + 308A839E957D36AE47662CB5 /* ui_strings_ko.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_ko.pak; sourceTree = ""; }; + 30CDEE9DE8D28F6CEA27CE6B /* resource_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resource_handler_cpptoc.h; sourceTree = ""; }; + 316413852D2E429AB85DC6BE /* reg_writer_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = reg_writer_unittest.py; sourceTree = ""; }; + 31C96610709A0280F2673DD6 /* cef_life_span_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_life_span_handler_capi.h; sourceTree = ""; }; + 3211D990A0868E4DA5F05C37 /* v8accessor_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8accessor_cpptoc.h; sourceTree = ""; }; + 3289C0F1EBDFDB24A36905AC /* cef_origin_whitelist.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_origin_whitelist.h; sourceTree = ""; }; + 32E78C47B68A966E2251645E /* cef_cookie.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_cookie.h; sourceTree = ""; }; + 33191A3C80EE9FADC9681AC1 /* app_locale_settings_hu.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_hu.pak; sourceTree = ""; }; + 33332EA2AC04ED29DEF2B062 /* txt.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = txt.py; sourceTree = ""; }; + 334689EC756D47C76DABB010 /* libvpx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libvpx.xcodeproj; path = ../third_party/libvpx/libvpx.xcodeproj; sourceTree = SOURCE_ROOT; }; + 335ADC702C533D5F128D5BA7 /* common.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = common.gypi; path = ../build/common.gypi; sourceTree = ""; }; + 335F63827821FB9FB71D0599 /* cefclient.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = cefclient.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33D2D9A353D54120D3468266 /* gl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = gl.xcodeproj; path = ../ui/gl/gl.xcodeproj; sourceTree = SOURCE_ROOT; }; + 33DD50DB2E11BEE14F91DCCE /* webkit_strings_pt-PT.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "webkit_strings_pt-PT.pak"; sourceTree = ""; }; + 3421E2BBB3DF1070D5E4BD87 /* context_menu_params_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = context_menu_params_cpptoc.h; sourceTree = ""; }; + 343398266DEB232FF344BE97 /* grit_runner.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = grit_runner.py; sourceTree = ""; }; + 34342431CF0B291A417AB3DC /* dom_document_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = dom_document_impl.cc; sourceTree = ""; }; + 348B64EB025FFE2A7337DC68 /* xmlhttprequest.html */ = {isa = PBXFileReference; lastKnownFileType = text; path = xmlhttprequest.html; sourceTree = ""; }; + 3498BD423E02FABE1EE83BB8 /* devtools_scheme_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = devtools_scheme_handler.h; sourceTree = ""; }; + 34C9C80A8A51D6228A02CE15 /* ffmpeg.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ffmpeg.xcodeproj; path = ../third_party/ffmpeg/ffmpeg.xcodeproj; sourceTree = SOURCE_ROOT; }; + 34E7B06FC2654047E51AA435 /* v8handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8handler_cpptoc.h; sourceTree = ""; }; + 34F700726B1ECBCC4D64D776 /* reg_writer.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = reg_writer.py; sourceTree = ""; }; + 3555939C4755250EAA5AE2D0 /* libcef_static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcef_static.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 356E1B48A82563540725E857 /* cef_strings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_strings.h; sourceTree = ""; }; + 35FBEC5C8B25A9F051B48A4D /* context_menu_params_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = context_menu_params_ctocpp.h; sourceTree = ""; }; + 3640DD4BA47FFCE38CB2153D /* cef_stream.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_stream.h; sourceTree = ""; }; + 36997FB0DD94284E4BB95802 /* plist_helper.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = plist_helper.py; sourceTree = ""; }; + 36A2BF77DDB0DD644017E2CE /* app_locale_settings_es.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_es.pak; sourceTree = ""; }; + 36E584D217689689EE7C0B2E /* client_renderer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_renderer.cpp; sourceTree = ""; }; + 36EE862F886D7E5F8DD66BF6 /* ui.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ui.xcodeproj; path = ../ui/ui.xcodeproj; sourceTree = SOURCE_ROOT; }; + 373AC737314C99FC380A2C27 /* resource_context.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resource_context.h; sourceTree = ""; }; + 37477D39B7F50223303252D7 /* cef_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_types.h; sourceTree = ""; }; + 3756CB6513E7539C28E1EAC8 /* resource_request_job.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = resource_request_job.cc; sourceTree = ""; }; + 378DA12B5CDE121479554F64 /* lazy_re_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = lazy_re_unittest.py; sourceTree = ""; }; + 37E8B79CC806BBF17FDB37C0 /* browser_main.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_main.cc; sourceTree = ""; }; + 37EEED859E375D03300DA2E2 /* response_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = response_ctocpp.cc; sourceTree = ""; }; + 380B3BF381D78DB573A92FDA /* ui_strings_uk.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_uk.pak; sourceTree = ""; }; + 3825964A1CB210151CB59E5A /* zip_reader_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = zip_reader_impl.h; sourceTree = ""; }; + 38290CC3CE5D634568EF6050 /* cef_strings_en-GB.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "cef_strings_en-GB.pak"; sourceTree = ""; }; + 387E6456D80AA7C58C2C2D83 /* app_locale_settings_en-US.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "app_locale_settings_en-US.pak"; sourceTree = ""; }; + 38A059AD263AA05F79A8D5E8 /* structure_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = structure_unittest.py; sourceTree = ""; }; + 394C924B399DD9EB11D4EA90 /* binary_value_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = binary_value_cpptoc.h; sourceTree = ""; }; + 394ED20393908DD4847D413E /* __init__.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = ""; }; + 39D2CC1ED178EB7C430ACCF4 /* webkit_strings_sv.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_sv.pak; sourceTree = ""; }; + 39E8E123C0A0556E41BB6D24 /* ui_strings_pt-PT.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "ui_strings_pt-PT.pak"; sourceTree = ""; }; + 3A045FCB7D7264E8890109A5 /* cef_ptr.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_ptr.h; sourceTree = ""; }; + 3A9A1DB9915BB6FD0AB526A1 /* browser_settings.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_settings.cc; sourceTree = ""; }; + 3AE54F845BE947BBE2F671CD /* include.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = include.py; sourceTree = ""; }; + 3B15E335C3E87027FF66D749 /* cefclient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cefclient.h; sourceTree = ""; }; + 3BAFE6C07BA55E84B964C109 /* cef_context_menu_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_context_menu_handler_capi.h; sourceTree = ""; }; + 3BD182E8FB7A3E22134DF860 /* event_disposition.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = event_disposition.cc; sourceTree = ""; }; + 3BF77612B9FEC6BF25A6058B /* v8handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8handler_ctocpp.h; sourceTree = ""; }; + 3C04F16E9C7F9976C62C5507 /* cef_strings_hr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_hr.pak; sourceTree = ""; }; + 3C39C0CA9179567B35023165 /* app_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = app_ctocpp.cc; sourceTree = ""; }; + 3C71276E1976DF076B0A55B4 /* ui_strings_zh-CN.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "ui_strings_zh-CN.pak"; sourceTree = ""; }; + 3C894B3DABF6A17A1BA3CB68 /* cef_base_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_base_capi.h; sourceTree = ""; }; + 3CD3016562E16F98BD1F566B /* clique.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = clique.py; sourceTree = ""; }; + 3D04DBAC9593A9461C8ACB56 /* app_locale_settings_da.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_da.pak; sourceTree = ""; }; + 3D3157B668F5872BF7A22811 /* command_buffer.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = command_buffer.xcodeproj; path = ../gpu/command_buffer/command_buffer.xcodeproj; sourceTree = SOURCE_ROOT; }; + 3D51C5F18F401B6CDA5A660F /* context_menu_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = context_menu_handler_ctocpp.cc; sourceTree = ""; }; + 3D62F86A77EE5E930F24F3B3 /* domvisitor_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domvisitor_cpptoc.cc; sourceTree = ""; }; + 3D8C3734F4BDB05000A0B9BC /* doc_writer_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = doc_writer_unittest.py; sourceTree = ""; }; + 3DB9E8B5EE2C9759E6EA76F6 /* cef_client_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_client_capi.h; sourceTree = ""; }; + 3E0E0DB9439B50E58A406601 /* ui_strings_ru.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_ru.pak; sourceTree = ""; }; + 3E3D7C67B9F21F228D244464 /* sqlite.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = sqlite.xcodeproj; path = ../third_party/sqlite/sqlite.xcodeproj; sourceTree = SOURCE_ROOT; }; + 3E5A0154F0820BB645B7B043 /* write_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = write_handler_ctocpp.h; sourceTree = ""; }; + 3E5C4D7D7C3CBCEF72F2384A /* newgrd.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = newgrd.py; sourceTree = ""; }; + 3ED85DBA0FE48F4029D02617 /* cef_display_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_display_handler_capi.h; sourceTree = ""; }; + 3F39DB28B8AD57286FA171CB /* urlrequest_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = urlrequest_ctocpp.h; sourceTree = ""; }; + 3F3E5D65FBA53AD358596510 /* cef_task_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_task_capi.h; sourceTree = ""; }; + 40084DD23D8A663A21AFEE0F /* cookie_manager_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cookie_manager_ctocpp.cc; sourceTree = ""; }; + 403DF4C0E5AB39FF055E4392 /* v8handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8handler_cpptoc.cc; sourceTree = ""; }; + 40EA4C2F8133B05D9D7E5A83 /* gmock.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = gmock.xcodeproj; path = ../testing/gmock.xcodeproj; sourceTree = SOURCE_ROOT; }; + 411B7B4E82F9CE8BCDB26F59 /* http_header_utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = http_header_utils.h; sourceTree = ""; }; + 4167C920D1424F0634762262 /* cef_strings_lt.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_lt.pak; sourceTree = ""; }; + 420F3C36CE7631034364E422 /* __init__.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = ""; }; + 421637DBD3560D81535E4C3A /* WTF.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = WTF.xcodeproj; path = ../third_party/WebKit/Source/WTF/WTF.gyp/WTF.xcodeproj; sourceTree = SOURCE_ROOT; }; + 4250DE201EE11DF56C6BA191 /* load_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = load_handler_ctocpp.cc; sourceTree = ""; }; + 426A81ACD2839880C079F32B /* unit.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = unit.py; sourceTree = ""; }; + 427D3A7ABEF53DE52685F32F /* libcups.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcups.dylib; path = usr/lib/libcups.dylib; sourceTree = SDKROOT; }; + 42B0A821229EFB10F968E57F /* util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; + 42BA615544865FC9F7795548 /* icu.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = icu.xcodeproj; path = ../third_party/icu/icu.xcodeproj; sourceTree = SOURCE_ROOT; }; + 42DE707AD9ECC0C360C2142A /* webkit_strings_fr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_fr.pak; sourceTree = ""; }; + 42F5E5FEA30EA64D92C39B72 /* auth_callback_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = auth_callback_cpptoc.h; sourceTree = ""; }; + 4335E893FC259036D8785066 /* content_resources.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = content_resources.xcodeproj; path = ../content/content_resources.xcodeproj; sourceTree = SOURCE_ROOT; }; + 43FC311667CE29FE323BFE5D /* PRESUBMIT.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = PRESUBMIT.py; sourceTree = ""; }; + 44382DD411BD299BDE154EDF /* ui_strings_et.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_et.pak; sourceTree = ""; }; + 44541A478EE0F105D27F1AF0 /* cef_strings_ta.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_ta.pak; sourceTree = ""; }; + 448DDF4F4E28EDFB07CFE568 /* preprocess_interface.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = preprocess_interface.py; sourceTree = ""; }; + 44A723FB55027DB9CEDE41A6 /* ui_strings_fa.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_fa.pak; sourceTree = ""; }; + 44DFD12329D6AF141C7803A7 /* webkit_strings_bg.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_bg.pak; sourceTree = ""; }; + 452131F0A02F514C887367A8 /* webkit_strings_te.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_te.pak; sourceTree = ""; }; + 4529EA2982A94B6A373FEBF8 /* auth_callback_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = auth_callback_ctocpp.cc; sourceTree = ""; }; + 4591B1B97998120F52F85520 /* rc_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = rc_unittest.py; sourceTree = ""; }; + 45B1C90753578D3F409B5445 /* scheme_handler_factory_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scheme_handler_factory_cpptoc.h; sourceTree = ""; }; + 45D4A61412E9D1F5B0824C4E /* muppet_strings_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = muppet_strings_unittest.py; sourceTree = ""; }; + 461BAAD82F8AB804176FDFE3 /* leveldatabase.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = leveldatabase.xcodeproj; path = ../third_party/leveldatabase/leveldatabase.xcodeproj; sourceTree = SOURCE_ROOT; }; + 46281DC2D06840820B4EC4AC /* cef_strings_cs.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_cs.pak; sourceTree = ""; }; + 46B44C3D02C7D9175C39DEC6 /* callback_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = callback_cpptoc.cc; sourceTree = ""; }; + 46D7068EB7F17F74723CA1B7 /* cookie_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cookie_unittest.cc; sourceTree = ""; }; + 46E883C7AF1E84BD492C9DFC /* xml_formatted_writer.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = xml_formatted_writer.py; sourceTree = ""; }; + 47601D042653DA09EF8A0C8B /* localstorage.html */ = {isa = PBXFileReference; lastKnownFileType = text; path = localstorage.html; sourceTree = ""; }; + 476478BD89A27581DFA1369F /* cef_pack_strings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_pack_strings.h; sourceTree = ""; }; + 476BDAB24D957D6802BC97D8 /* app_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = app_cpptoc.cc; sourceTree = ""; }; + 47A2DB909734C51FF232F713 /* focus_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = focus_handler_ctocpp.cc; sourceTree = ""; }; + 47F9DE33B3520A33631E64E7 /* process_message_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = process_message_ctocpp.cc; sourceTree = ""; }; + 48431A857D81049FAA37A88E /* js_map_format.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = js_map_format.py; sourceTree = ""; }; + 486CCA5D23871D838C4679B9 /* cef_render_process_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_render_process_handler.h; sourceTree = ""; }; + 486DAB7574B9E13840732E6D /* rc.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = rc.py; sourceTree = ""; }; + 48F9EEAD7EF4135C5C8BC961 /* webkit_strings_es.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_es.pak; sourceTree = ""; }; + 49AEA50476542BABAA469E49 /* event_utils.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = event_utils.mm; sourceTree = ""; }; + 49B228FEAE0E4BFBA9BB2266 /* download_manager_delegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = download_manager_delegate.h; sourceTree = ""; }; + 49C23F1EF21BEFFF47923163 /* client_app_delegates.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_app_delegates.cpp; sourceTree = ""; }; + 4A8F5A7994245C71941FF80A /* sv */ = {isa = PBXFileReference; lastKnownFileType = text; name = sv; path = sv.lproj/locale.pak; sourceTree = ""; }; + 4AAF21B270EDC337AAB2A1BC /* response_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = response_ctocpp.h; sourceTree = ""; }; + 4AC4CE6DD815BB901C3108F5 /* stream_reader_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stream_reader_ctocpp.h; sourceTree = ""; }; + 4AFA6ADB70815EFEBB45B818 /* stream_reader_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stream_reader_cpptoc.h; sourceTree = ""; }; + 4B4010CB2AD4974D4C8F8DC8 /* cef_app_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_app_capi.h; sourceTree = ""; }; + 4B5ADD9D75499F753CF4B5C6 /* plist_strings_writer.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = plist_strings_writer.py; sourceTree = ""; }; + 4B66B0B8539132668FAF09E6 /* interface.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = interface.py; sourceTree = ""; }; + 4BBD9CB783AC852918EFEAAD /* cef_types_wrappers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_types_wrappers.h; sourceTree = ""; }; + 4BFBD85606BCD5295F158F56 /* webkit_strings_zh-CN.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "webkit_strings_zh-CN.pak"; sourceTree = ""; }; + 4C2E0E8BAE74F157CF8DE872 /* release.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = release.gypi; path = ../build/release.gypi; sourceTree = ""; }; + 4D235103EA04209B53D185B3 /* cef_strings_it.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_it.pak; sourceTree = ""; }; + 4DB1B86AAC941216FCA32E15 /* browser_main_mac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = browser_main_mac.mm; sourceTree = ""; }; + 4E2E4DD63F79536D568A7268 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; }; + 4EB85F5F7EB3A7B3221230A6 /* ppapi.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ppapi.xcodeproj; path = ../ppapi/ppapi.xcodeproj; sourceTree = SOURCE_ROOT; }; + 4EFD9E6CCD9D5AE5E19CBE7B /* app_locale_settings_en-GB.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "app_locale_settings_en-GB.pak"; sourceTree = ""; }; + 4EFE292D06E344DCCB3F36DA /* ca */ = {isa = PBXFileReference; lastKnownFileType = text; name = ca; path = ca.lproj/locale.pak; sourceTree = ""; }; + 4F0955093BC13E5E2267CBBC /* cef_download_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_download_handler.h; sourceTree = ""; }; + 4F303C29F3D1E527A63C3797 /* media.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = media.xcodeproj; path = ../media/media.xcodeproj; sourceTree = SOURCE_ROOT; }; + 4F41E3D04AC393353B1EF8B1 /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 4F44FF29D7C26F262CD730CA /* download_manager_delegate.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = download_manager_delegate.cc; sourceTree = ""; }; + 4F477F6CB38631F10E929F69 /* url_network_delegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = url_network_delegate.h; sourceTree = ""; }; + 4F81A5C061994A3CF973DCD9 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + 4FB77434E9211D828D8900D7 /* cefclient.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = cefclient.icns; sourceTree = ""; }; + 4FD83B3E31064A685C29F6A0 /* url_request_context_getter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = url_request_context_getter.h; sourceTree = ""; }; + 4FF6DCE2C8423908E6D32EFA /* v8exception_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8exception_ctocpp.h; sourceTree = ""; }; + 50066846B94BBDC728831F61 /* cef_browser_process_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_browser_process_handler_capi.h; sourceTree = ""; }; + 500B6AC913CA493D51567061 /* cef_task.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_task.h; sourceTree = ""; }; + 50120FB7D2C144CF82F14F53 /* interface.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = interface.py; sourceTree = ""; }; + 5060C2094E2CEBD78D98E36F /* webkit_strings_hr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_hr.pak; sourceTree = ""; }; + 5077ADEACE5517E5F138A071 /* th */ = {isa = PBXFileReference; lastKnownFileType = text; name = th; path = th.lproj/locale.pak; sourceTree = ""; }; + 50904314745D75720421875B /* disposition_utils.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = disposition_utils.cc; sourceTree = ""; }; + 50B64687B1239AFA23F8E464 /* cef_string_visitor_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_visitor_capi.h; sourceTree = ""; }; + 50DA499BC7B870350F0B702F /* menu_controller.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_controller.h; sourceTree = ""; }; + 50FDEBC89683ECEDA4ADB6A8 /* app_locale_settings_th.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_th.pak; sourceTree = ""; }; + 51010D89047ECE793711047F /* tracker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tracker.h; sourceTree = ""; }; + 511DFC813E6674C7EA914805 /* javascript_dialog_creator.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = javascript_dialog_creator.cc; sourceTree = ""; }; + 511EC264157FFCCDE8CCC1C2 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + 518172B054CD1F54D77451B4 /* time_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = time_util.h; sourceTree = ""; }; + 51AE0CA1355F7A0775D3A1D0 /* browser_host_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_host_impl.cc; sourceTree = ""; }; + 51EE88270035C12D12B0B3A7 /* rc2grd_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = rc2grd_unittest.py; sourceTree = ""; }; + 51FCD3E7D567DF1A48B76769 /* base_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = base_cpptoc.h; sourceTree = ""; }; + 521CF1A5BF607EC6D5628149 /* __init__.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = ""; }; + 5232F8242937DE8B5E28F994 /* browser_main.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_main.h; sourceTree = ""; }; + 523BF7F077DA578B4191F087 /* cef_strings_mr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_mr.pak; sourceTree = ""; }; + 5243D729B37F95262AC8F6FD /* urlrequest_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = urlrequest_impl.cc; sourceTree = ""; }; + 5254CA911DB271FD83811B90 /* devtools_discovery_page.html */ = {isa = PBXFileReference; lastKnownFileType = text; path = devtools_discovery_page.html; sourceTree = ""; }; + 52AC11600DD3A1C9B6499C87 /* jsdialog_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = jsdialog_unittest.cc; sourceTree = ""; }; + 52D6F3198D44B31AF5068E98 /* html_inline.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = html_inline.py; sourceTree = ""; }; + 5323D57C484D43060D172B7C /* focus_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = focus_handler_ctocpp.h; sourceTree = ""; }; + 53488D368BB9562703A75203 /* cef_strings_nb.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_nb.pak; sourceTree = ""; }; + 5400F37F18ACCCBFE7562D10 /* string_multimap_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = string_multimap_impl.cc; sourceTree = ""; }; + 541553E5FE02113AC639ECD1 /* main_delegate.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main_delegate.cc; sourceTree = ""; }; + 5443183CF36A8753D44E27DB /* domnode_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domnode_cpptoc.h; sourceTree = ""; }; + 54A6B02FA001B6569F481D8F /* adml_writer_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = adml_writer_unittest.py; sourceTree = ""; }; + 54E670EE54F4600111F1A3BE /* menu_model_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = menu_model_ctocpp.cc; sourceTree = ""; }; + 55CC2E6AF87F44E121C68ABE /* buildinfo.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = buildinfo.py; sourceTree = ""; }; + 55DB375A3CC916F84D8CCE4A /* v8.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = v8.xcodeproj; path = ../v8/tools/gyp/v8.xcodeproj; sourceTree = SOURCE_ROOT; }; + 55E5C055CA03407284B1E92C /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; }; + 55ED39C002EBB5CCD16E0BA3 /* ui_strings_lv.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_lv.pak; sourceTree = ""; }; + 5613ACDDE51DE1A506D91AE5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 561BF6A655EF750B0F26C0F7 /* jsdialog_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = jsdialog_handler_ctocpp.cc; sourceTree = ""; }; + 565D44D754C3A2BDA29B7E25 /* scheme_test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scheme_test.h; sourceTree = ""; }; + 567A85368C6CF8CF07878874 /* webkit_strings_es-419.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "webkit_strings_es-419.pak"; sourceTree = ""; }; + 57660E666F3E2F8437F136E7 /* cef_command_line_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_command_line_capi.h; sourceTree = ""; }; + 577E4529B37A372EC7982CCD /* cef_strings_zh-CN.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "cef_strings_zh-CN.pak"; sourceTree = ""; }; + 57A26B6D62FCA51F8C4DC37D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 57A73EB7B742ECF9233F5E3C /* client_renderer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = client_renderer.h; sourceTree = ""; }; + 57DAB1E10A9A44D749F451E2 /* webkit_strings_hu.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_hu.pak; sourceTree = ""; }; + 585D881341ADB1E66C55A49C /* ui_strings_de.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_de.pak; sourceTree = ""; }; + 585DEF23D9BFD4D198D6EA33 /* ui_strings_ml.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_ml.pak; sourceTree = ""; }; + 586069E4DE0F00ABACB87AEF /* web_plugin_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = web_plugin_impl.cc; sourceTree = ""; }; + 588E6DF15E9D2FF032287599 /* devtools_resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = devtools_resources.h; sourceTree = ""; }; + 58E1C7A6EE126C2D92CE13DD /* download_manager_delegate_mac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = download_manager_delegate_mac.mm; sourceTree = ""; }; + 58EAA82466055251156313DB /* cefclient Helper.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = "cefclient Helper.app"; sourceTree = ""; }; + 59794A1EE30CB19313E4C75C /* cef_xml_reader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_xml_reader.h; sourceTree = ""; }; + 59C38FB9F040D2D6A36C9F79 /* v8value_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8value_ctocpp.h; sourceTree = ""; }; + 59EAB9E13038989009194B97 /* webkit_chromium_resources.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_chromium_resources.pak; sourceTree = ""; }; + 5A208C2BA07A723EA111E6FE /* response_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = response_impl.h; sourceTree = ""; }; + 5AD9CBEEB6751780A250053B /* command_line_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = command_line_ctocpp.h; sourceTree = ""; }; + 5B6A2744649C07D4164F6649 /* resource_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = resource_handler_ctocpp.cc; sourceTree = ""; }; + 5B71AA10477E9E5993D8F79B /* ru */ = {isa = PBXFileReference; lastKnownFileType = text; name = ru; path = ru.lproj/locale.pak; sourceTree = ""; }; + 5BBDA43E2EEAC35BBC7E9207 /* cef_process_message_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_process_message_capi.h; sourceTree = ""; }; + 5BD5BBF7DBC575DC17C35D72 /* cef_xml_object.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_xml_object.h; sourceTree = ""; }; + 5BE98613E89F29801EBFFEC3 /* webkit_strings_nb.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_nb.pak; sourceTree = ""; }; + 5C73B895D250886CB5582389 /* domaccess.html */ = {isa = PBXFileReference; lastKnownFileType = text; path = domaccess.html; sourceTree = ""; }; + 5C92D3A27E73BD53BB4E2F25 /* menu_creator.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = menu_creator.cc; sourceTree = ""; }; + 5CE0453C5A2622362B584F68 /* scheme_registrar_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_registrar_impl.cc; sourceTree = ""; }; + 5D0959B70633F8D90C216DDF /* ui_strings_en-GB.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "ui_strings_en-GB.pak"; sourceTree = ""; }; + 5D8769F23C7A85537ACD9C04 /* webkit_strings_id.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_id.pak; sourceTree = ""; }; + 5D9B72F98520D246C6C638AD /* skeleton_gatherer.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = skeleton_gatherer.py; sourceTree = ""; }; + 5DA409E878B3995C3EB7E55B /* modules.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = modules.xcodeproj; path = ../third_party/webrtc/modules/modules.xcodeproj; sourceTree = SOURCE_ROOT; }; + 5E15A40C287847BB8E1910B1 /* message.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = message.py; sourceTree = ""; }; + 5E3EFC4ADFF566FEB0AAE6E4 /* resource_util_mac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = resource_util_mac.mm; sourceTree = ""; }; + 5E46501D71E2CB64BE224B5D /* dom_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = dom_unittest.cc; sourceTree = ""; }; + 5E7E4D55681ECE4B05F2414C /* data_pack_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = data_pack_unittest.py; sourceTree = ""; }; + 5EB77B80F2135DA9BDEE4387 /* cef_context_menu_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_context_menu_handler.h; sourceTree = ""; }; + 5F1F81C6FC28B3E39FC17988 /* xml_reader_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = xml_reader_cpptoc.cc; sourceTree = ""; }; + 5F2B2BFABAAE633D56780C3F /* command_line_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = command_line_impl.cc; sourceTree = ""; }; + 5F4B6A88DBE351CE983397EB /* scheme_handler_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_handler_unittest.cc; sourceTree = ""; }; + 5F71AEFBBD062CE8E4B035CD /* string_visitor_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = string_visitor_cpptoc.cc; sourceTree = ""; }; + 5F7BB33A9B300F224F9555C9 /* cef_v8_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_v8_capi.h; sourceTree = ""; }; + 5FA82BA0F4237B9D72F3F4AB /* context.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = context.cc; sourceTree = ""; }; + 5FAC99DFA973BEE73C9D81E9 /* webkit_strings_ro.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_ro.pak; sourceTree = ""; }; + 60094E2013060E84B9F0A442 /* request_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = request_impl.h; sourceTree = ""; }; + 604AD17ACC7B9777DE1303D5 /* cef_resource_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_resource_handler_capi.h; sourceTree = ""; }; + 60500211E4E81B16B827F3A8 /* download_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = download_handler_ctocpp.h; sourceTree = ""; }; + 60BDE740DC8E69DC493B2F84 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = text; name = zh_CN; path = zh_CN.lproj/locale.pak; sourceTree = ""; }; + 60D541BCDBD964C84437C645 /* string_types_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = string_types_impl.cc; sourceTree = ""; }; + 60FDBC13FBB130A5982C0CC1 /* cef_unittests.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = cef_unittests.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 610B4D7BD43F5228DDA22ED7 /* cef_process_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_process_util.h; sourceTree = ""; }; + 617F27E76D033D2C52956AB8 /* web_plugin_info_visitor_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = web_plugin_info_visitor_ctocpp.h; sourceTree = ""; }; + 618CA731E5FCE115CCD258F3 /* app_locale_settings_mr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_mr.pak; sourceTree = ""; }; + 621075EE773DB9ADF51EEFAE /* app_locale_settings_ms.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_ms.pak; sourceTree = ""; }; + 621C08700150DEB6EBBBF8CC /* post_data_element_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = post_data_element_ctocpp.cc; sourceTree = ""; }; + 624D01F77B976B95E0FAC6E8 /* app_locale_settings_tr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_tr.pak; sourceTree = ""; }; + 62BD83A69788540F5493CC6D /* app_locale_settings_bn.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_bn.pak; sourceTree = ""; }; + 62D155EAC030B92E5833CC71 /* cs */ = {isa = PBXFileReference; lastKnownFileType = text; name = cs; path = cs.lproj/locale.pak; sourceTree = ""; }; + 62E38C90F6ACF232E9540430 /* cef_proxy_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_proxy_handler_capi.h; sourceTree = ""; }; + 63589532FDDE3888E6D68564 /* content.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = content.xcodeproj; path = ../content/content.xcodeproj; sourceTree = SOURCE_ROOT; }; + 639AAEAA42A9B69771AFDAE1 /* dom_test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dom_test.h; sourceTree = ""; }; + 63D5643A6EAC02B3D51EDFBB /* cef_zip_reader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_zip_reader.h; sourceTree = ""; }; + 641751712624080410E91CB3 /* count.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = count.py; sourceTree = ""; }; + 646366A7F1714B899E3340BA /* callback_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = callback_ctocpp.h; sourceTree = ""; }; + 648CCECC870023D06F575757 /* libresolv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libresolv.dylib; path = usr/lib/libresolv.dylib; sourceTree = SDKROOT; }; + 64D04DE76C59E3FB85DFA72C /* base_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = base_unittest.py; sourceTree = ""; }; + 64E0007CFC11C8A546F99276 /* v8context_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8context_cpptoc.cc; sourceTree = ""; }; + 6569C982849C795FA1D77C0D /* ui_strings_te.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_te.pak; sourceTree = ""; }; + 65EC939FBA72F086E83B5E67 /* cef_strings_fake-bidi.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "cef_strings_fake-bidi.pak"; sourceTree = ""; }; + 66321C17937EFD7899A0C371 /* request_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = request_ctocpp.h; sourceTree = ""; }; + 668C83DE4FD97FDAF9A1743C /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 6741F51DA01588D368B31427 /* hr */ = {isa = PBXFileReference; lastKnownFileType = text; name = hr; path = hr.lproj/locale.pak; sourceTree = ""; }; + 679EE00993C436A33C876FE8 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + 67E2346E369D700890BAC5F2 /* browser_message_filter.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_message_filter.cc; sourceTree = ""; }; + 6899516D68CBC48011638AA3 /* download_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = download_handler_cpptoc.cc; sourceTree = ""; }; + 68BC095520583C85894071BD /* grit_info.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = grit_info.py; sourceTree = ""; }; + 694DE4CBA4F0460BAAB3ACBB /* scons.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = scons.py; sourceTree = ""; }; + 696A201AD5DADB31D39F9821 /* app_locale_settings_kn.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_kn.pak; sourceTree = ""; }; + 698C6F90A03997EC66CFABA1 /* ffmpegsumo.so */ = {isa = PBXFileReference; lastKnownFileType = text; path = ffmpegsumo.so; sourceTree = ""; }; + 6991125C79C2BFE97903DCF9 /* sfntly.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = sfntly.xcodeproj; path = ../third_party/sfntly/sfntly.xcodeproj; sourceTree = SOURCE_ROOT; }; + 69C419E03B9AAA605E8ED2DA /* repack_locales.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = repack_locales.py; sourceTree = ""; }; + 69C916786797700DC9969DA2 /* ui_strings_pl.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_pl.pak; sourceTree = ""; }; + 6A120E36DD430329E402BAD5 /* sl */ = {isa = PBXFileReference; lastKnownFileType = text; name = sl; path = sl.lproj/locale.pak; sourceTree = ""; }; + 6A3B8076CA7CD96C8E25A966 /* openmax.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = openmax.xcodeproj; path = ../third_party/openmax/openmax.xcodeproj; sourceTree = SOURCE_ROOT; }; + 6A42142B50855298FBE0CB4E /* browser_host_impl_mac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = browser_host_impl_mac.mm; sourceTree = ""; }; + 6A5D0244576BE203CC940B0F /* cef_values.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_values.h; sourceTree = ""; }; + 6A8A5FC8599E16C4CE106A47 /* ots.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ots.xcodeproj; path = ../third_party/ots/ots.xcodeproj; sourceTree = SOURCE_ROOT; }; + 6AAF07370A423CF8AC644D16 /* lt */ = {isa = PBXFileReference; lastKnownFileType = text; name = lt; path = lt.lproj/locale.pak; sourceTree = ""; }; + 6ABBA458072A19A85269F56F /* test_suite_all.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = test_suite_all.py; sourceTree = ""; }; + 6B2EBA3530CDC6B770ADE84A /* cef_strings_sv.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_sv.pak; sourceTree = ""; }; + 6B3D4F2A31928792F3A97970 /* string_visitor_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = string_visitor_ctocpp.h; sourceTree = ""; }; + 6B5367A2A25C39A54B3D8E29 /* xml_reader_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = xml_reader_unittest.cc; sourceTree = ""; }; + 6B57B9E2B3A48DA03AE7AE74 /* disposition_utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = disposition_utils.h; sourceTree = ""; }; + 6BA5FC1DD74344A5BE308E65 /* cef_focus_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_focus_handler_capi.h; sourceTree = ""; }; + 6C06B951A9E79A8C04E770F1 /* request_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = request_unittest.cc; sourceTree = ""; }; + 6C401F20E3AC9FF553252DC8 /* javascript_dialog_creator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = javascript_dialog_creator.h; sourceTree = ""; }; + 6CDFE332A71B9843DDFC84A0 /* client_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = client_handler.h; sourceTree = ""; }; + 6CE1EC98D36F4A66660D5948 /* test_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = test_util.h; sourceTree = ""; }; + 6CEE8EFAD8AE1F9992935CB5 /* cef_browser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_browser.h; sourceTree = ""; }; + 6D19A7B6453E43B9F0979372 /* resource_dispatcher_host_delegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resource_dispatcher_host_delegate.h; sourceTree = ""; }; + 6D811744DC5B0D7A3138A2A8 /* webkit_strings_sw.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_sw.pak; sourceTree = ""; }; + 6DE552DE833DCAC5A7DF4BE7 /* es_419 */ = {isa = PBXFileReference; lastKnownFileType = text; name = es_419; path = es_419.lproj/locale.pak; sourceTree = ""; }; + 6DF28A5F1DB6F9C73A1E6F57 /* life_span_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = life_span_handler_cpptoc.cc; sourceTree = ""; }; + 6DFCAB3FE3A07471E7E8DF7A /* path_util_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = path_util_impl.cc; sourceTree = ""; }; + 6E2EF60B78CBC85EA7267E5B /* cef_urlrequest_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_urlrequest_capi.h; sourceTree = ""; }; + 6E33046A4EDB56251FF60662 /* libcef.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libcef.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 6E8884157B62992B4215B66A /* webkit_strings_ar.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_ar.pak; sourceTree = ""; }; + 6EBBB1D6E6BAD26E07BFF9F2 /* app_locale_settings_ta.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_ta.pak; sourceTree = ""; }; + 6EDDEACC058D3A3FC188F4BC /* post_data_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = post_data_ctocpp.cc; sourceTree = ""; }; + 6EE3CEA7D97DE0E4E9F7C92B /* urlrequest_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = urlrequest_cpptoc.cc; sourceTree = ""; }; + 6EFE5DB322697063C5273BB5 /* cef_paths2.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_paths2.gypi; sourceTree = ""; }; + 6F0E17598B497B0F9754066C /* c_format.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = c_format.py; sourceTree = ""; }; + 6F285D14138F575EB07E3D6B /* xmb_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = xmb_unittest.py; sourceTree = ""; }; + 6F607F245C208EB8A961B1F4 /* app_locale_settings_ro.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_ro.pak; sourceTree = ""; }; + 6FCE946FA0283D08BACC1771 /* misc_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = misc_unittest.py; sourceTree = ""; }; + 70459A5B49BE23629CC0DBC4 /* chrome_scaled_image.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = chrome_scaled_image.py; sourceTree = ""; }; + 705846BB8F452399EFCF2451 /* build_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = build_unittest.py; sourceTree = ""; }; + 7074163F5AAED437A99C2E10 /* life_span_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = life_span_handler_ctocpp.h; sourceTree = ""; }; + 710DB1EC856181BE60FC17CC /* list_value_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = list_value_ctocpp.h; sourceTree = ""; }; + 712BB594138FAD0EA6092CB9 /* scheme_test.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_test.cpp; sourceTree = ""; }; + 715EF92D9C1E94128B193C88 /* build.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = build.py; sourceTree = ""; }; + 71682F05AB957D4FB877358C /* speech_proto.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = speech_proto.xcodeproj; path = ../content/browser/speech/proto/speech_proto.xcodeproj; sourceTree = SOURCE_ROOT; }; + 718379D5B4EC037834401B14 /* menu_model_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_model_impl.h; sourceTree = ""; }; + 71CA3191CD43BF1BF3DDC918 /* thread_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = thread_util.h; sourceTree = ""; }; + 71F7F7EF3478453D96C1C5D7 /* cef_strings_sl.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_sl.pak; sourceTree = ""; }; + 72540D05FC3553AD383B2F3F /* list_value_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = list_value_ctocpp.cc; sourceTree = ""; }; + 726AD028360CE3C2B2DD85F5 /* preprocess_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = preprocess_unittest.py; sourceTree = ""; }; + 729A2C7E82535377AF318E1C /* ui_strings_sk.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_sk.pak; sourceTree = ""; }; + 72B1A066321F72C7B897FE4C /* buildinfo_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = buildinfo_unittest.py; sourceTree = ""; }; + 72C7E6EF7FA246FD7F6588CA /* io.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = io.py; sourceTree = ""; }; + 72F60CEAFFDEE60993320A54 /* misc.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = misc.py; sourceTree = ""; }; + 72FB6EEF729DD9BE4DE9913C /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; + 731F5270DCA0C5F127CDB37C /* response_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = response_impl.cc; sourceTree = ""; }; + 73467F9CB00DFEDF2093D88B /* pl */ = {isa = PBXFileReference; lastKnownFileType = text; name = pl; path = pl.lproj/locale.pak; sourceTree = ""; }; + 737E0164E14751345C26E7B7 /* tclib.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = tclib.py; sourceTree = ""; }; + 738990D27BC0E432A3588FAD /* webkit_resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = webkit_resources.h; sourceTree = ""; }; + 7400FF71541B599F6E09045A /* app_locale_settings_sl.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_sl.pak; sourceTree = ""; }; + 741FA37F8AA91FDCA7F7D0EF /* domevent_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domevent_cpptoc.h; sourceTree = ""; }; + 746B2C1A2751D807C992896A /* cef_callback_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_callback_capi.h; sourceTree = ""; }; + 748471578ED2BCF616FE627B /* cef_resource_bundle_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_resource_bundle_handler_capi.h; sourceTree = ""; }; + 74EF14161F0A734FCB88E4D8 /* da */ = {isa = PBXFileReference; lastKnownFileType = text; name = da; path = da.lproj/locale.pak; sourceTree = ""; }; + 750C4EE3154FC1DDFA918C65 /* menu_model_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_model_ctocpp.h; sourceTree = ""; }; + 7561B5E1D6E73275673FA6F4 /* pseudo.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = pseudo.py; sourceTree = ""; }; + 7569642FE0516CE15E0EB10B /* frame_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = frame_impl.cc; sourceTree = ""; }; + 75C5A31CBBB197ED3436E4F2 /* download_item_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = download_item_cpptoc.cc; sourceTree = ""; }; + 75D67087AD73BEE4616C28F1 /* scheme_registrar_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_registrar_ctocpp.cc; sourceTree = ""; }; + 7617F7356CF67916645EB77F /* cef_strings_pt-BR.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "cef_strings_pt-BR.pak"; sourceTree = ""; }; + 761F9B6F7D9C5D58B7800485 /* context.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = context.h; sourceTree = ""; }; + 7657BFF87514B88894C02714 /* zip_reader_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = zip_reader_ctocpp.h; sourceTree = ""; }; + 765F54EF5B25F19B12554C17 /* cookie_visitor_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cookie_visitor_cpptoc.h; sourceTree = ""; }; + 767F7EE6C0A57FDC0A2BCF1C /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = System/Library/Frameworks/QTKit.framework; sourceTree = SDKROOT; }; + 76E444CBCD615065EED446E0 /* webkit_strings_pt-BR.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "webkit_strings_pt-BR.pak"; sourceTree = ""; }; + 771A5322D55C430A25BFB6DE /* request_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = request_handler_cpptoc.cc; sourceTree = ""; }; + 77394B70985CB75AE307ED79 /* cef_resource_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_resource_handler.h; sourceTree = ""; }; + 77447207CC3EC0AF7BB29C8F /* cef_strings_tr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_tr.pak; sourceTree = ""; }; + 78A73BE9C6C0FCF92CB7CB09 /* domevent_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domevent_ctocpp.h; sourceTree = ""; }; + 78B16B5577F0099FE17A1B76 /* xtb_reader_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = xtb_reader_unittest.py; sourceTree = ""; }; + 78D08A88F7CD548C7B49CC11 /* cef_url.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_url.h; sourceTree = ""; }; + 79234382345BA3C64994D511 /* cef_tuple.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_tuple.h; sourceTree = ""; }; + 794985FF05FCCFB42BFAD90F /* cef_strings_vi.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_vi.pak; sourceTree = ""; }; + 796D220B79FC44A95CE17BDE /* te */ = {isa = PBXFileReference; lastKnownFileType = text; name = te; path = te.lproj/locale.pak; sourceTree = ""; }; + 79CF3557612C4997DAB1A862 /* allocator.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = allocator.xcodeproj; path = ../base/allocator/allocator.xcodeproj; sourceTree = SOURCE_ROOT; }; + 79CF4C48CC4458DFB82FF6A5 /* cef_strings_et.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_et.pak; sourceTree = ""; }; + 79D9F5E9B68280119AB412F5 /* post_data_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = post_data_ctocpp.h; sourceTree = ""; }; + 79DA1DA7F891159BACFC01F9 /* auth_callback_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = auth_callback_ctocpp.h; sourceTree = ""; }; + 7A7D3194355A8B0B087AB0F7 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text; name = ko; path = ko.lproj/locale.pak; sourceTree = ""; }; + 7AEB3EE43AF0938894DE8C2B /* web_plugin_info_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = web_plugin_info_cpptoc.cc; sourceTree = ""; }; + 7AF2CED60ABFFC142836AD41 /* app_locale_settings_ja.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_ja.pak; sourceTree = ""; }; + 7AF4BB98B58929D0BFDC2D3C /* webkit_strings_lt.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_lt.pak; sourceTree = ""; }; + 7AF867AA9FC440565FAC0950 /* webkit_strings_it.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_it.pak; sourceTree = ""; }; + 7B45BEE2E7E45FA556D3FC44 /* post_data_element_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = post_data_element_ctocpp.h; sourceTree = ""; }; + 7B65E2D31221886EBDF33C1E /* cef_render_process_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_render_process_handler_capi.h; sourceTree = ""; }; + 7B741C9DBC45EA55A3B1B633 /* test_suite.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = test_suite.cc; sourceTree = ""; }; + 7C28C9975417680D544A5BA4 /* libwebp.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libwebp.xcodeproj; path = ../third_party/libwebp/libwebp.xcodeproj; sourceTree = SOURCE_ROOT; }; + 7C75D1B55249E9B2D60AED98 /* cef_string_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_types.h; sourceTree = ""; }; + 7D4274E53C774448014738F7 /* chrome_html_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = chrome_html_unittest.py; sourceTree = ""; }; + 7DF1D2D0221960F8BFD30EEE /* binary_value_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = binary_value_ctocpp.h; sourceTree = ""; }; + 7E0D94AA2AA4A03F0193832B /* plist_writer.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = plist_writer.py; sourceTree = ""; }; + 7E9C21B18AE55F7B6C178E61 /* webkit_strings_ru.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_ru.pak; sourceTree = ""; }; + 7F1DCC53C9DB0A1C4F1ECE2C /* keyboard_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = keyboard_handler_ctocpp.cc; sourceTree = ""; }; + 7F495BA8C8C936D373D7924B /* process_message_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = process_message_impl.h; sourceTree = ""; }; + 7FCC66352C9D74203077F2BA /* http_header_utils.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = http_header_utils.cc; sourceTree = ""; }; + 7FF808AAC31F250C348EC7C4 /* cef_strings_id.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_id.pak; sourceTree = ""; }; + 806ECE12D0E1388D810EAFB6 /* cef_xml_reader_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_xml_reader_capi.h; sourceTree = ""; }; + 807894F2C9EC4212FB1BD2CB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 80945157DB28BE61632B1E36 /* resource_bundle_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resource_bundle_handler_ctocpp.h; sourceTree = ""; }; + 80E1D3C0C90A9611E57BDE85 /* tclib.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = tclib.py; sourceTree = ""; }; + 80FABF2C108132E99FF6CD2C /* filename_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = filename_unittest.py; sourceTree = ""; }; + 8105CA51505C648E67552EC4 /* download_item_callback_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = download_item_callback_ctocpp.h; sourceTree = ""; }; + 81083F64C1E316C4C7B97590 /* __init__.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = ""; }; + 8170973032F443C76652C300 /* cef_display_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_display_handler.h; sourceTree = ""; }; + 81B31A421FA8B15344436AA7 /* common_audio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = common_audio.xcodeproj; path = ../third_party/webrtc/common_audio/common_audio.xcodeproj; sourceTree = SOURCE_ROOT; }; + 81E23DC5D3BDCD65A0767A73 /* cef_runnable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_runnable.h; sourceTree = ""; }; + 8203F74736B14AD3D84B5215 /* resource_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resource_handler_ctocpp.h; sourceTree = ""; }; + 821F22742E14E5EBB9BD5C10 /* gu */ = {isa = PBXFileReference; lastKnownFileType = text; name = gu; path = gu.lproj/locale.pak; sourceTree = ""; }; + 82D9267508954B762CA4DA09 /* empty.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = empty.py; sourceTree = ""; }; + 82DACC558D6C9791E80B0D9A /* scheme_registrar_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scheme_registrar_impl.h; sourceTree = ""; }; + 832FB47A11CB7F9D7006944F /* context_menu_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = context_menu_handler_cpptoc.cc; sourceTree = ""; }; + 83813FFC96ED9BA50A4F2072 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = text; name = zh_TW; path = zh_TW.lproj/locale.pak; sourceTree = ""; }; + 83A8579EFC53B0B57F009E48 /* cef_string_wrappers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_wrappers.h; sourceTree = ""; }; + 83A8EF06FD1C6CF08CBCBE1B /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; + 842C3CD9BAE3CEF1F7B482F1 /* web_plugin_info_visitor_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = web_plugin_info_visitor_cpptoc.h; sourceTree = ""; }; + 847CD6CDF3ECAD677675D7AF /* cef_strings_sk.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_sk.pak; sourceTree = ""; }; + 84BA24AC65D242008E562F4A /* urlrequest_client_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = urlrequest_client_cpptoc.cc; sourceTree = ""; }; + 84C7CFBD54B4BF935F72B506 /* scheme_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_impl.cc; sourceTree = ""; }; + 84EA5424F8B6B4C6138402A8 /* adml_writer.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = adml_writer.py; sourceTree = ""; }; + 8508EC329657CF53E16F1D01 /* cef_resources.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_resources.pak; sourceTree = ""; }; + 850FF5EF5174D22356396681 /* ui_strings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ui_strings.h; sourceTree = ""; }; + 8510CB875D2FF04CC72D31FB /* writer_unittest_common.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = writer_unittest_common.py; sourceTree = ""; }; + 852E3E9379EE3E0A9039D014 /* BogoFP.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = BogoFP.py; sourceTree = ""; }; + 858C2D5C8CC42547CFC86498 /* app_locale_settings_es-419.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "app_locale_settings_es-419.pak"; sourceTree = ""; }; + 85AE1E1E67C77F50EA88BD66 /* vi */ = {isa = PBXFileReference; lastKnownFileType = text; name = vi; path = vi.lproj/locale.pak; sourceTree = ""; }; + 86184CB258BD6D57B44C5733 /* cef_strings_ml.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_ml.pak; sourceTree = ""; }; + 861B32FB07E1CC6FE369E3C6 /* keyboard_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = keyboard_handler_ctocpp.h; sourceTree = ""; }; + 8655427EA10E4D926EEAF92A /* PRESUBMIT.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = PRESUBMIT.py; sourceTree = ""; }; + 86F590426D755AA5BA84C09E /* jsdialog_callback_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsdialog_callback_ctocpp.h; sourceTree = ""; }; + 86FD5E59321079A429D3F6A7 /* app_locale_settings_lt.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_lt.pak; sourceTree = ""; }; + 87A4D3C6BA9F10864D1F273D /* cef_strings_hi.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_hi.pak; sourceTree = ""; }; + 87F45A638FBE61B6FDF891DC /* WebKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = WebKit.xcodeproj; path = ../third_party/WebKit/Source/WebKit/chromium/WebKit.xcodeproj; sourceTree = SOURCE_ROOT; }; + 8817D7F4FBBA2D42EF516513 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; + 88D2B183F026169B59F0AF61 /* cef_strings_ca.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_ca.pak; sourceTree = ""; }; + 88E0D3C1C49E1286F9B4ED96 /* domevent_listener_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domevent_listener_ctocpp.h; sourceTree = ""; }; + 88E59696A3A0233E5E0F880F /* cef_dom.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_dom.h; sourceTree = ""; }; + 89220459E7C4ACEA47FE8D44 /* display_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = display_handler_cpptoc.cc; sourceTree = ""; }; + 8948E45DD951A069CAF5AC80 /* cef_types_mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_types_mac.h; sourceTree = ""; }; + 8979600041C4474AD19BD3DC /* release_impl.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = release_impl.gypi; path = ../build/internal/release_impl.gypi; sourceTree = ""; }; + 89B77017A9EC70BA421EFAF7 /* cef_byte_read_handler.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cef_byte_read_handler.cc; sourceTree = ""; }; + 8A15B1BB8A62EC95076E6DEC /* webkit_strings_hi.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_hi.pak; sourceTree = ""; }; + 8A1657A5074BE6A5ACFBDA57 /* cef_strings_de.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_de.pak; sourceTree = ""; }; + 8A1A6FA2F84381B4C6F7645E /* plist_strings_writer_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = plist_strings_writer_unittest.py; sourceTree = ""; }; + 8A59126EFE9C5D97F374F4E3 /* ui_strings_hu.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_hu.pak; sourceTree = ""; }; + 8A8806D9491FFB692E6B67CE /* ppapi_internal.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ppapi_internal.xcodeproj; path = ../ppapi/ppapi_internal.xcodeproj; sourceTree = SOURCE_ROOT; }; + 8A8F46D578D570415EBDE473 /* binary_value_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = binary_value_cpptoc.cc; sourceTree = ""; }; + 8A9A71B5AC55058C531A10FA /* display_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = display_handler_cpptoc.h; sourceTree = ""; }; + 8AA64D0F18ADA015BFE201A5 /* json_writer.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = json_writer.py; sourceTree = ""; }; + 8AA6E9DC8966C36467FEA316 /* webkit_strings_tr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_tr.pak; sourceTree = ""; }; + 8AED9F7315C52F2A620486CD /* cef.gyp */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef.gyp; sourceTree = ""; }; + 8B0D5DB6543C85BC22C1EA1A /* zip_reader_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = zip_reader_cpptoc.h; sourceTree = ""; }; + 8B5021FC3D1392A6EAB8E5D3 /* postprocess_interface.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = postprocess_interface.py; sourceTree = ""; }; + 8B956AE1B815ACBF853C38A5 /* content_renderer_client.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = content_renderer_client.cc; sourceTree = ""; }; + 8BA02D444B3792D97FDCEECE /* cef_switches.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cef_switches.cc; sourceTree = ""; }; + 8C0C651ED6C209FA6A64751A /* domvisitor_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domvisitor_ctocpp.cc; sourceTree = ""; }; + 8C138B705D2D3C374E61DB8B /* cef_string_list.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_list.h; sourceTree = ""; }; + 8C92E6384542431595EF50A7 /* life_span_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = life_span_handler_ctocpp.cc; sourceTree = ""; }; + 8CB4088B971ED0D651106CD1 /* cookie_manager_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cookie_manager_ctocpp.h; sourceTree = ""; }; + 8CF0FFC054798BB8914DDBD8 /* data_pack.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = data_pack.py; sourceTree = ""; }; + 8D08F86EAC1279F520694642 /* frame_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = frame_impl.h; sourceTree = ""; }; + 8D290D79F3EF4612A4721B41 /* grd_reader_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = grd_reader_unittest.py; sourceTree = ""; }; + 8DD5724290D4064CB1982F99 /* cef_frame_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_frame_capi.h; sourceTree = ""; }; + 8DF06BB0F4FB0F0B2222B9E2 /* ui_resources_standard.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_resources_standard.pak; sourceTree = ""; }; + 8E14B6DD6174354A3AA97B3C /* cef_jsdialog_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_jsdialog_handler_capi.h; sourceTree = ""; }; + 8E197CF075AE60301D046E20 /* keyboard_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = keyboard_handler_cpptoc.cc; sourceTree = ""; }; + 8E4CDC7E28233AAF8A1353E0 /* ui_strings_sw.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_sw.pak; sourceTree = ""; }; + 8E7F353C35FE393BB527D3D4 /* url_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = url_unittest.cc; sourceTree = ""; }; + 8EC24B77969614A9E69D79F8 /* ui_strings_zh-TW.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "ui_strings_zh-TW.pak"; sourceTree = ""; }; + 8ECFAA9E466819116DFF920F /* flac.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = flac.xcodeproj; path = ../third_party/flac/flac.xcodeproj; sourceTree = SOURCE_ROOT; }; + 8F1DDCCC2B12987556CB7A6B /* browser_host_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_host_impl.h; sourceTree = ""; }; + 8F4A872B2216AC98AC00121B /* string_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = string_util.h; sourceTree = ""; }; + 8F6D40B2CD10D34AD8F714F3 /* cef_strings_th.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_th.pak; sourceTree = ""; }; + 8FAB2B3DA1D71DE9B41ED544 /* domdocument_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domdocument_ctocpp.cc; sourceTree = ""; }; + 8FC259076BAAC6707AF40AB9 /* modp_b64.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = modp_b64.xcodeproj; path = ../third_party/modp_b64/modp_b64.xcodeproj; sourceTree = SOURCE_ROOT; }; + 8FC487E61971FF8B957CF876 /* browser_process_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_process_handler_cpptoc.cc; sourceTree = ""; }; + 8FD3BF1B5EEC371550873F4F /* render_process_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = render_process_handler_cpptoc.h; sourceTree = ""; }; + 903BF2598ED5B457D394EB6F /* app_locale_settings_fi.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_fi.pak; sourceTree = ""; }; + 90482E31FC042C40AA27CBB6 /* tr_html.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = tr_html.py; sourceTree = ""; }; + 904D5B141FB66F69474E0938 /* app_locale_settings_et.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_et.pak; sourceTree = ""; }; + 907CCE9710B29FF62EBB8C9C /* content_browser_client.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = content_browser_client.h; sourceTree = ""; }; + 9084B9878C73E390FE28F4EA /* client_app_delegates.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_app_delegates.cc; sourceTree = ""; }; + 90899D9D0DBCB27C66786692 /* context_menu_params_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = context_menu_params_impl.h; sourceTree = ""; }; + 913E0B3B78A79604B8375494 /* libpng.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libpng.xcodeproj; path = ../third_party/libpng/libpng.xcodeproj; sourceTree = SOURCE_ROOT; }; + 914996F06142B7006F4C1AC7 /* build_angle.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = build_angle.xcodeproj; path = ../third_party/angle/src/build_angle.xcodeproj; sourceTree = SOURCE_ROOT; }; + 915A3F2F5BBCBA69CCA50C98 /* menu_model_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = menu_model_cpptoc.h; sourceTree = ""; }; + 915F17714BF54A96E694861D /* urlrequest_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = urlrequest_cpptoc.h; sourceTree = ""; }; + 9198D923FBC2970445FD08FB /* thread_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = thread_util.h; sourceTree = ""; }; + 91CA13A8DA1C53EA4CE12B1D /* browser_message_loop.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_message_loop.cc; sourceTree = ""; }; + 91D140738ACF233F694087D9 /* browser_message_loop.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_message_loop.h; sourceTree = ""; }; + 91E2C46974E5764CA2E00400 /* callback_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = callback_ctocpp.cc; sourceTree = ""; }; + 922A9087E94112E092CFF3D5 /* dictionary_value_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dictionary_value_ctocpp.h; sourceTree = ""; }; + 92563765E3EC9386F575B2E5 /* ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ctocpp.h; sourceTree = ""; }; + 92D415BA4DE9FDB56C848F0E /* cef_resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_resources.h; sourceTree = ""; }; + 92F71012F60E65800C7FA7EF /* domvisitor_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domvisitor_cpptoc.h; sourceTree = ""; }; + 93817B77718BE477E11D1B77 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text; name = fa; path = fa.lproj/locale.pak; sourceTree = ""; }; + 93D902B73577832D18BF75BB /* browser_host_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_host_ctocpp.cc; sourceTree = ""; }; + 9407ED90778DCAA2D95996E5 /* content_renderer_client.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = content_renderer_client.h; sourceTree = ""; }; + 941319F6C213FD2E5AF1379C /* skia.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = skia.xcodeproj; path = ../skia/skia.xcodeproj; sourceTree = SOURCE_ROOT; }; + 9450B68BEE27937EBAE05C64 /* webkit_resources.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_resources.pak; sourceTree = ""; }; + 94BB6DD0AB6105482AF28EEC /* request_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = request_handler_ctocpp.h; sourceTree = ""; }; + 94FC67A94B7C6A0594A768BB /* time_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = time_impl.cc; sourceTree = ""; }; + 9512A66AA48EE8FDA49979EE /* run_all_unittests.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = run_all_unittests.cc; sourceTree = ""; }; + 954C19699583BDE91C91EAD1 /* process_message_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = process_message_ctocpp.h; sourceTree = ""; }; + 957CAFCC3E62D16A6A9A7001 /* string_visitor_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = string_visitor_cpptoc.h; sourceTree = ""; }; + 95C841C5F5D8E955AD0C8442 /* geolocation_callback_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = geolocation_callback_cpptoc.cc; sourceTree = ""; }; + 96863EC71FE8C19086ECC663 /* cef_export.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_export.h; sourceTree = ""; }; + 96B6939FEEAE9C41E03CC563 /* libWebKitSystemInterfaceLeopardPrivateExtern.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libWebKitSystemInterfaceLeopardPrivateExtern.a; path = libWebKitSystemInterfaceLeopardPrivateExtern.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 972C388FC6C6D3094DB8E222 /* stream_writer_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stream_writer_ctocpp.h; sourceTree = ""; }; + 97982721950E57F089FF3B7B /* Atom Helper.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = "Atom Helper.app"; sourceTree = ""; }; + 980462CA3EBC9C7A46664528 /* cef_zip_archive.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_zip_archive.h; sourceTree = ""; }; + 98AF0BBBB8A81ABFFF43B0A9 /* xtb_reader.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = xtb_reader.py; sourceTree = ""; }; + 993D5FB77B5591A0FFDF0D3A /* dynamic_annotations.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = dynamic_annotations.xcodeproj; path = ../base/third_party/dynamic_annotations/dynamic_annotations.xcodeproj; sourceTree = SOURCE_ROOT; }; + 9957A9B688C530DBDCD91F85 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text; name = ja; path = ja.lproj/locale.pak; sourceTree = ""; }; + 997FB6FDE34A9EF10B934290 /* cef_stream_resource_handler.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cef_stream_resource_handler.cc; sourceTree = ""; }; + 99985A0B3AAA0CE9A2F58DBC /* value_base.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = value_base.h; sourceTree = ""; }; + 99A3E952F601D81D63364C9E /* download_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = download_handler_ctocpp.cc; sourceTree = ""; }; + 99BE64627B2516968DA69C99 /* rc2grd.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = rc2grd.py; sourceTree = ""; }; + 99C8F07ADEC000D37DBAB1B1 /* jsdialog_callback_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsdialog_callback_cpptoc.h; sourceTree = ""; }; + 9A1ABE45349A3F80FF5DF30C /* webkit_strings_nl.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_nl.pak; sourceTree = ""; }; + 9A50288704E7307F0E12CC53 /* geolocation_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = geolocation_handler_cpptoc.h; sourceTree = ""; }; + 9A8F4C8FC2E2DD2655298862 /* webkit_strings_cs.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_cs.pak; sourceTree = ""; }; + 9AA86EF695031C709EB48301 /* navigation_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = navigation_unittest.cc; sourceTree = ""; }; + 9AAB3640AEBCF8CDB6E3EBEB /* transfer_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = transfer_util.h; sourceTree = ""; }; + 9AC1D088FA80D3B2A81ECBA2 /* zip_reader_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = zip_reader_unittest.cc; sourceTree = ""; }; + 9AD2908E3E658119AC780B55 /* run_all_unittests_mac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = run_all_unittests_mac.mm; sourceTree = ""; }; + 9B4BBCC00C0C1A2BEEFA0D01 /* mach_override.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = mach_override.xcodeproj; path = ../third_party/mach_override/mach_override.xcodeproj; sourceTree = SOURCE_ROOT; }; + 9B828287DA08C00BF1CBA0BC /* task_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = task_ctocpp.h; sourceTree = ""; }; + 9B984E9924117932C6ABE9EE /* ui_strings_gu.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_gu.pak; sourceTree = ""; }; + 9BBD0B469DFDB884D93F96E4 /* NSURL+Utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSURL+Utils.h"; sourceTree = ""; }; + 9BC2A3979FF4D29EA9037A8A /* cookie_manager_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cookie_manager_impl.h; sourceTree = ""; }; + 9BDB4C89AB31661B24EC5AD7 /* libcef_dll_wrapper.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcef_dll_wrapper.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 9BFDA1D8AF3C3A8C3A0DDA99 /* resource_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resource_util.h; sourceTree = ""; }; + 9CF13FE6393B8398A8AA18AC /* zip_reader_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = zip_reader_ctocpp.cc; sourceTree = ""; }; + 9CF3DD0952B8129AD957046A /* frame_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = frame_cpptoc.cc; sourceTree = ""; }; + 9D026DB1DED7CFBFCC17DE88 /* json_writer_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = json_writer_unittest.py; sourceTree = ""; }; + 9D2B8499E56DBC7273B71185 /* domevent_listener_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domevent_listener_cpptoc.cc; sourceTree = ""; }; + 9D6481C14038928657DE4402 /* jsdialog_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = jsdialog_handler_cpptoc.cc; sourceTree = ""; }; + 9D8B23565B040C2C45D8D3A2 /* process_message_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = process_message_cpptoc.cc; sourceTree = ""; }; + 9DE09E60E64A6105D0908294 /* v8context_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8context_ctocpp.cc; sourceTree = ""; }; + 9E4F1653A19D8EBC682547EE /* diff_structures.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = diff_structures.py; sourceTree = ""; }; + 9E5BA8A7091C891C1E9C1E67 /* cef_base.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_base.h; sourceTree = ""; }; + 9EACAEEEA145DFC35216514B /* ui_resources_standard.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ui_resources_standard.h; sourceTree = ""; }; + 9EDC3A8C460020AA8C9D16D4 /* cookie_manager_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cookie_manager_cpptoc.h; sourceTree = ""; }; + 9EDDA92B6B176C1235419654 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text; name = nl; path = nl.lproj/locale.pak; sourceTree = ""; }; + 9F34C73D7E412A438C0810ED /* domnode_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domnode_ctocpp.cc; sourceTree = ""; }; + 9F5671B07D6ECD145A54BCAF /* cef_keyboard_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_keyboard_handler.h; sourceTree = ""; }; + 9F7159CBC485389851637A19 /* Atom Helper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Atom Helper.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 9F84468F6827D8F99B734EA6 /* url_request_interceptor.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = url_request_interceptor.cc; sourceTree = ""; }; + 9F8DF3A8D0D5CBD2B5BE5E4E /* cef_messages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_messages.h; sourceTree = ""; }; + 9FDCE1753EAB6DD51D5E88E8 /* cef_string_multimap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_multimap.h; sourceTree = ""; }; + A00B7334CB894C79096EA117 /* cef_strings_ko.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_ko.pak; sourceTree = ""; }; + A01E24D255497ECA6A00724B /* ui_strings_it.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_it.pak; sourceTree = ""; }; + A0D6B5F3B9D45FF5550586F2 /* variant.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = variant.py; sourceTree = ""; }; + A0ED4067E8EF944312A58B3B /* cef_path_util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_path_util.h; sourceTree = ""; }; + A0FAA9FA17E7293DE5B0C4BC /* app_locale_settings_ar.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_ar.pak; sourceTree = ""; }; + A10811BEC263444916496808 /* plist_writer_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = plist_writer_unittest.py; sourceTree = ""; }; + A118A80152C4BFB2B86A7B82 /* mock_writer.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = mock_writer.py; sourceTree = ""; }; + A1283A9BC3CE73AC0A600339 /* app_locale_settings_ru.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_ru.pak; sourceTree = ""; }; + A128B3C4C3B4EE24533CE3F1 /* resource_dispatcher_host_delegate.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = resource_dispatcher_host_delegate.cc; sourceTree = ""; }; + A12D4AF9EF7B9099616E9B3B /* context_menu_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = context_menu_handler_cpptoc.h; sourceTree = ""; }; + A13F63777B8D71B83A24E479 /* webkit_strings_et.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_et.pak; sourceTree = ""; }; + A20BA18DE54D9DF5B47E2884 /* pt_BR */ = {isa = PBXFileReference; lastKnownFileType = text; name = pt_BR; path = pt_BR.lproj/locale.pak; sourceTree = ""; }; + A2154ED96A97D207C4234EB2 /* surface.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = surface.xcodeproj; path = ../ui/surface/surface.xcodeproj; sourceTree = SOURCE_ROOT; }; + A21CFD1232932A6603B36EC5 /* ui_resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ui_resources.h; sourceTree = ""; }; + A2248098B30E4E5EB34CC368 /* cef_process_message.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_process_message.h; sourceTree = ""; }; + A23E588983D78761008F698D /* cef_strings_ro.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_ro.pak; sourceTree = ""; }; + A2542629E10750A9BC3BA215 /* cef_string_map.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string_map.h; sourceTree = ""; }; + A257D2FA79DFA717AA262734 /* policy_template_generator.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = policy_template_generator.py; sourceTree = ""; }; + A287C0A02FC93659AE3E9641 /* it */ = {isa = PBXFileReference; lastKnownFileType = text; name = it; path = it.lproj/locale.pak; sourceTree = ""; }; + A35179157274998BF0E609EC /* render_process_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = render_process_handler_ctocpp.h; sourceTree = ""; }; + A37B1202E9711AA83BFEA7FF /* cef_version.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_version.h; sourceTree = ""; }; + A40423FE7F5F0631781C1E2D /* cef_process_util_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_process_util_capi.h; sourceTree = ""; }; + A4649F89C716B218DD3268AB /* webkit_strings_ca.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_ca.pak; sourceTree = ""; }; + A4D2D5B95485DA3DF25972C8 /* transfer_util.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = transfer_util.cpp; sourceTree = ""; }; + A5189377EEEF134DACA8E6A3 /* request_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = request_handler_ctocpp.cc; sourceTree = ""; }; + A53019239E548876C20B9BE5 /* libcef_dll2.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = libcef_dll2.cc; sourceTree = ""; }; + A53D5848A69C0706241C7CCB /* process_util_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = process_util_impl.cc; sourceTree = ""; }; + A555FB4AFD31F904481AEF3C /* binding_test.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = binding_test.cpp; sourceTree = ""; }; + A5BF66C52CD8EF1AFBE82C1D /* content_resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = content_resources.h; sourceTree = ""; }; + A5F1211ECDBE15E114653097 /* client_app.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_app.cpp; sourceTree = ""; }; + A613E999829F80C375BF561C /* ui_strings_hi.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_hi.pak; sourceTree = ""; }; + A68D29BEFC7E90D722724A31 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + A6FFECB794D4143BFF69086A /* origin_whitelist_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = origin_whitelist_impl.cc; sourceTree = ""; }; + A70A59BED39A129DB3674488 /* proxy_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = proxy_handler_ctocpp.cc; sourceTree = ""; }; + A7150BB7F6260DC5E3D6014F /* response_manager.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = response_manager.cc; sourceTree = ""; }; + A71F417316E73DD2C81FA6F4 /* cef_strings_fr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_fr.pak; sourceTree = ""; }; + A722D7364A5D7B7D04F322B1 /* download_item_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = download_item_ctocpp.h; sourceTree = ""; }; + A723747B248AA1603A6105B5 /* cef_application_mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_application_mac.h; sourceTree = ""; }; + A7326AE828A2573E6E9A3C1A /* cef_strings_sr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_sr.pak; sourceTree = ""; }; + A7A7E4D5F6C691F87DADD0CC /* read_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = read_handler_ctocpp.cc; sourceTree = ""; }; + A7E5CBDB0B03EA4186699A8E /* cefclient_mac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = cefclient_mac.mm; sourceTree = ""; }; + A829A9477B7F5226C12126E6 /* sqlite_diagnostics_stub.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = sqlite_diagnostics_stub.cc; sourceTree = ""; }; + A837398CF32BE95F9B8C6CC2 /* jsdialog_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = jsdialog_handler_ctocpp.h; sourceTree = ""; }; + A8443181D36AE126CFADAC75 /* cef_download_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_download_handler_capi.h; sourceTree = ""; }; + A8C69E44BE827CD91CC1FD0D /* cef_strings_ru.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_ru.pak; sourceTree = ""; }; + A905BF58EB26153147FDE6F2 /* cef_strings_fil.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_fil.pak; sourceTree = ""; }; + A9F5AFFE1B03166029163683 /* devtools_scheme_handler.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = devtools_scheme_handler.cc; sourceTree = ""; }; + A9FBDEF643B43B3C94FCE05B /* url_request_context_getter.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = url_request_context_getter.cc; sourceTree = ""; }; + AAD317264CD53F09AB75F53F /* app_locale_settings_vi.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_vi.pak; sourceTree = ""; }; + AAEF5E0F1906033B0352D5B7 /* cef_time.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_time.h; sourceTree = ""; }; + AB2C2414833CDF0E294612FD /* webkit_strings_gu.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_gu.pak; sourceTree = ""; }; + AB44CA22DEEC02E4DB8ED2D6 /* domdocument_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domdocument_cpptoc.cc; sourceTree = ""; }; + AC352D25857DC066957F0709 /* app_locale_settings_sv.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_sv.pak; sourceTree = ""; }; + AC50AD2938980FFD18423AFA /* webkit_strings_th.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_th.pak; sourceTree = ""; }; + AC9A44C54E00B064658FB434 /* stream_writer_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stream_writer_cpptoc.h; sourceTree = ""; }; + ACC9DD4F18A619E64B23E04F /* dom_node_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dom_node_impl.h; sourceTree = ""; }; + AD4579C0BE099BC334661482 /* browser_host_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_host_ctocpp.h; sourceTree = ""; }; + AD46FECF48CAA90C69CBF929 /* __init__.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = ""; }; + AD738FC5F4AC2C880F5D1446 /* sqlite_persistent_cookie_store.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sqlite_persistent_cookie_store.h; sourceTree = ""; }; + ADF7DF75ED5214C882BA463D /* url_request_context_proxy.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = url_request_context_proxy.cc; sourceTree = ""; }; + AE1EECC7420185454F935DC0 /* client_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_cpptoc.cc; sourceTree = ""; }; + AE237E44F51811ABA1079BEF /* tclib_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = tclib_unittest.py; sourceTree = ""; }; + AE35153A534F6DC6E89C0E71 /* list_value_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = list_value_cpptoc.h; sourceTree = ""; }; + AE444896E4C5BBC3F0B079B4 /* lv */ = {isa = PBXFileReference; lastKnownFileType = text; name = lv; path = lv.lproj/locale.pak; sourceTree = ""; }; + AE5F7ED290206A896187D9CB /* webkit_strings_da.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_da.pak; sourceTree = ""; }; + AE6EDF6B7A543E0AC126F13E /* tr */ = {isa = PBXFileReference; lastKnownFileType = text; name = tr; path = tr.lproj/locale.pak; sourceTree = ""; }; + AE72EF7CAB16AAED4E988E57 /* webkit_support.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = webkit_support.xcodeproj; path = ../webkit/support/webkit_support.xcodeproj; sourceTree = SOURCE_ROOT; }; + AE7F6C5060549B2F2D5041BA /* cef_strings_bn.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_bn.pak; sourceTree = ""; }; + AEC1C1912BA3FE2AD51CFE7E /* devtools_resources.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = devtools_resources.pak; sourceTree = ""; }; + AEC666F3C94F4CEB8DEE2A9A /* origin_whitelist_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = origin_whitelist_impl.h; sourceTree = ""; }; + AECC35F2345D9149FF77702D /* app_locale_settings_el.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_el.pak; sourceTree = ""; }; + AED60E39DA93EBF9C3361DB2 /* ui_strings_pt-BR.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "ui_strings_pt-BR.pak"; sourceTree = ""; }; + AED67CD0D4C3055B1611DCA5 /* geolocation_callback_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = geolocation_callback_ctocpp.h; sourceTree = ""; }; + AF105947CAC15F96B9B00CF5 /* v8exception_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8exception_cpptoc.h; sourceTree = ""; }; + B031A6B9A59C5648001D8E7D /* client_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = client_cpptoc.h; sourceTree = ""; }; + B0E3E128BB10AF315930D732 /* cef_stream_resource_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_stream_resource_handler.h; sourceTree = ""; }; + B1072A8812268AA3912AD3A9 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text; name = nb; path = nb.lproj/locale.pak; sourceTree = ""; }; + B111F32791A8BCA7228774C1 /* zip_reader_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = zip_reader_impl.cc; sourceTree = ""; }; + B143F70E2B242100A3AC61A1 /* ui_strings_he.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_he.pak; sourceTree = ""; }; + B1B0B00499622B5212B3B8C8 /* harfbuzz.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = harfbuzz.xcodeproj; path = "../third_party/harfbuzz-ng/harfbuzz.xcodeproj"; sourceTree = SOURCE_ROOT; }; + B1B719B2DB39C964D60291E9 /* read_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = read_handler_cpptoc.cc; sourceTree = ""; }; + B1BC0DCCB17AA248A0D577F9 /* fi */ = {isa = PBXFileReference; lastKnownFileType = text; name = fi; path = fi.lproj/locale.pak; sourceTree = ""; }; + B1DAA340DB834465A936E8F8 /* cef_build.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_build.h; sourceTree = ""; }; + B203C1CF711EDC0366E714FB /* jsdialog_callback_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = jsdialog_callback_ctocpp.cc; sourceTree = ""; }; + B21D03DC680F4FD5CE10D719 /* ui_strings_fil.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_fil.pak; sourceTree = ""; }; + B28771FABF438DE250C9A59F /* sr */ = {isa = PBXFileReference; lastKnownFileType = text; name = sr; path = sr.lproj/locale.pak; sourceTree = ""; }; + B2F3D77B6647DF374CFCE5D4 /* libevent.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libevent.xcodeproj; path = ../third_party/libevent/libevent.xcodeproj; sourceTree = SOURCE_ROOT; }; + B3742C83FEE2415D7BA25F91 /* url_request_interceptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = url_request_interceptor.h; sourceTree = ""; }; + B3CBCE3BBAC700D4F20C4AB3 /* binding.html */ = {isa = PBXFileReference; lastKnownFileType = text; path = binding.html; sourceTree = ""; }; + B3CC57F25F4CFFB12C00E302 /* devtools_delegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = devtools_delegate.h; sourceTree = ""; }; + B44E71F696B42050FD0ACE2C /* cef_cookie_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_cookie_capi.h; sourceTree = ""; }; + B490B040DFADA86C197F241E /* release_impl_official.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = release_impl_official.gypi; path = ../build/internal/release_impl_official.gypi; sourceTree = ""; }; + B4B28A8840955A7A73CE082C /* unittests.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = unittests.icns; sourceTree = ""; }; + B4C774A7C430830E8E30CDC9 /* domnode_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domnode_ctocpp.h; sourceTree = ""; }; + B54A3D26A848E5E563BDF3FF /* browser_host_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_host_cpptoc.h; sourceTree = ""; }; + B5696836A233467D67F673DE /* app_locale_settings_nl.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_nl.pak; sourceTree = ""; }; + B595AE41CCEEAF881800F919 /* cef_strings_he.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_he.pak; sourceTree = ""; }; + B5BA3FB0EC2E38F37831385C /* app_locale_settings_sw.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_sw.pak; sourceTree = ""; }; + B5F1C4FA587CC89476D82E5F /* geolocation_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = geolocation_handler_ctocpp.cc; sourceTree = ""; }; + B5FFE53E8D18F5DF26098C3B /* webkit_strings_ko.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_ko.pak; sourceTree = ""; }; + B61CA6E61979A7CBF236E73D /* webkit_strings_am.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_am.pak; sourceTree = ""; }; + B631AEBC75354D3C9BAD7E60 /* de */ = {isa = PBXFileReference; lastKnownFileType = text; name = de; path = de.lproj/locale.pak; sourceTree = ""; }; + B65C386A4D3A2F46DACFEC63 /* app_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = app_ctocpp.h; sourceTree = ""; }; + B69A86A21D00AEECBFB9E0FC /* cef.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef.gypi; sourceTree = ""; }; + B6BCD87C8E9E2C07AAC3C15D /* read_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = read_handler_ctocpp.h; sourceTree = ""; }; + B71985071946DE0272140D33 /* menu_model_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = menu_model_cpptoc.cc; sourceTree = ""; }; + B769E54AA8C8C34D387D1898 /* cef_strings_es.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_es.pak; sourceTree = ""; }; + B79BFA0947C8B3B8648E52C2 /* app_locale_settings_te.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_te.pak; sourceTree = ""; }; + B7BAE94218DC1AF62AB9C262 /* callback_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = callback_cpptoc.h; sourceTree = ""; }; + B84A8C77A80959D3FDB79E03 /* before_download_callback_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = before_download_callback_cpptoc.h; sourceTree = ""; }; + B84B69F8F0FC909581ED64B5 /* proxy_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = proxy_handler_cpptoc.cc; sourceTree = ""; }; + B897373CE0763F38BC8B6005 /* test_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = test_handler.h; sourceTree = ""; }; + B8D92CFE5FE010A20C2DE9E0 /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = text; name = pt_PT; path = pt_PT.lproj/locale.pak; sourceTree = ""; }; + B8EFE13D4363591579F845BD /* url_network_delegate.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = url_network_delegate.cc; sourceTree = ""; }; + B93E20FDDFB45AEE1B1637FB /* repack.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = repack.py; sourceTree = ""; }; + B96DB9A5EA5CB33C9CF4E3B6 /* grd_reader.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = grd_reader.py; sourceTree = ""; }; + B9B3C5A2966003F02D99EDF8 /* dictionary_value_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = dictionary_value_cpptoc.cc; sourceTree = ""; }; + BA2CEA45A76DD834D9F46888 /* net_resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_resources.h; sourceTree = ""; }; + BA74D937DABFDDBFF7BC274A /* menu_controller.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = menu_controller.mm; sourceTree = ""; }; + BAAA56D25F15E3152CAB4310 /* request_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = request_cpptoc.h; sourceTree = ""; }; + BADF2CC70DD23FAC319DB0E8 /* webkit_strings_en-GB.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "webkit_strings_en-GB.pak"; sourceTree = ""; }; + BAE4F34D8497504C8EA49C0A /* client_switches.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_switches.cpp; sourceTree = ""; }; + BAEFF6772AA39B65C0A16BDC /* resource_request_job.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resource_request_job.h; sourceTree = ""; }; + BB40C94651F5869982CD0D73 /* shortcuts_unittests.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = shortcuts_unittests.py; sourceTree = ""; }; + BBB082F6C3D4048CFB7A4BCD /* browser_urlrequest_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_urlrequest_impl.h; sourceTree = ""; }; + BBB91956C816083526AB2EF2 /* libsrtp.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libsrtp.xcodeproj; path = ../third_party/libsrtp/libsrtp.xcodeproj; sourceTree = SOURCE_ROOT; }; + BBCC248506229E5B0D036B25 /* webkit_strings_el.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_el.pak; sourceTree = ""; }; + BBE2B501607B7615FF89D915 /* proxy_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = proxy_handler_cpptoc.h; sourceTree = ""; }; + BC2DBEF9AEE291FE9536BFF8 /* bn */ = {isa = PBXFileReference; lastKnownFileType = text; name = bn; path = bn.lproj/locale.pak; sourceTree = ""; }; + BC37FEDFB68554AC40F1927E /* stream_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = stream_unittest.cc; sourceTree = ""; }; + BCB5DD2EA2599FC9420529FC /* cef_v8.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_v8.h; sourceTree = ""; }; + BCE9DF91715018A1F2B5DDDE /* rc_header_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = rc_header_unittest.py; sourceTree = ""; }; + BD3AEF39973333594B3AF33E /* cef_focus_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_focus_handler.h; sourceTree = ""; }; + BD85B7325C97FE527A3B5FBA /* browser_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_cpptoc.h; sourceTree = ""; }; + BDC86D60E98ED367A18F3FF0 /* mapping.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = mapping.py; sourceTree = ""; }; + BDE38BE54F98960C8533F1FB /* cef_browser_process_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_browser_process_handler.h; sourceTree = ""; }; + BE1DA88C9CE8AABA2DA12E5A /* ui_strings_bg.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_bg.pak; sourceTree = ""; }; + BE9875EC6BFE09D36368B549 /* io_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = io_unittest.py; sourceTree = ""; }; + BF354E20164FC6AE1628E6D6 /* js_map_format_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = js_map_format_unittest.py; sourceTree = ""; }; + BF4157E193A514990BDB20AE /* cef_strings_bg.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_bg.pak; sourceTree = ""; }; + BF50FF0DB30BF7D2462511D5 /* cef_strings_es-419.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "cef_strings_es-419.pak"; sourceTree = ""; }; + BF8FBF76D26F678D79319E7F /* web_plugin_info_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = web_plugin_info_ctocpp.cc; sourceTree = ""; }; + BF9BCAC5E8B3E0B6E7204BAF /* scheme_handler_factory_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = scheme_handler_factory_cpptoc.cc; sourceTree = ""; }; + BFBC5D3F9539F3DEB423BC07 /* test_util.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = test_util.cc; sourceTree = ""; }; + BFBCF921341FE2A9CAAB209F /* json_loader.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = json_loader.py; sourceTree = ""; }; + BFEE9C961095CBD3A6F6BF12 /* test_suite.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = test_suite.h; sourceTree = ""; }; + BFF104F15A6A249851306E5B /* ui_strings_fi.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_fi.pak; sourceTree = ""; }; + BFFF75BA1DE505F4FC6CF8E1 /* igoogle_strings_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = igoogle_strings_unittest.py; sourceTree = ""; }; + C05CB3D9668BCF524D725D80 /* v8_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8_unittest.cc; sourceTree = ""; }; + C085C951644E10FC67FD2BFE /* command_line_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = command_line_cpptoc.cc; sourceTree = ""; }; + C0B028164A5328758788DBCC /* browser_message_filter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_message_filter.h; sourceTree = ""; }; + C132B2B7DFC87BF8A11A49AB /* urlrequest_client_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = urlrequest_client_cpptoc.h; sourceTree = ""; }; + C14DAB1AAEA0039C4522CC2B /* libcef.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libcef.dylib; sourceTree = ""; }; + C1676097512A3D9E2D02B869 /* task_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = task_ctocpp.cc; sourceTree = ""; }; + C180ABF4001443F7384CEAC7 /* v8exception_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8exception_ctocpp.cc; sourceTree = ""; }; + C1C9F222C0F4DDAD2BB19DE2 /* hu */ = {isa = PBXFileReference; lastKnownFileType = text; name = hu; path = hu.lproj/locale.pak; sourceTree = ""; }; + C1DD696D83AAACE47751B405 /* stream_reader_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = stream_reader_ctocpp.cc; sourceTree = ""; }; + C20E23727BD91D92D67D9980 /* ui_strings_es.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_es.pak; sourceTree = ""; }; + C2166EDE4476E4A63D1C2353 /* render_process_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = render_process_handler_cpptoc.cc; sourceTree = ""; }; + C2246857E5328D3CA26856D2 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; + C25773E7E22D4B38265E96C9 /* v8_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8_impl.cc; sourceTree = ""; }; + C29ADD61716033F36EC6FA4A /* voice_engine.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = voice_engine.xcodeproj; path = ../third_party/webrtc/voice_engine/voice_engine.xcodeproj; sourceTree = SOURCE_ROOT; }; + C2F9769424CA87A4DEE01F38 /* browser_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_cpptoc.cc; sourceTree = ""; }; + C2FB942E1079C9642625957C /* web_plugin_info_visitor_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = web_plugin_info_visitor_ctocpp.cc; sourceTree = ""; }; + C30424C31D8FA81F08221280 /* cef_strings_lv.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_lv.pak; sourceTree = ""; }; + C32B3AA8CEC445ABB8CCAB5A /* navigate_params.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = navigate_params.cc; sourceTree = ""; }; + C3D99D2C24C061BA724F9C77 /* webkit_strings_he.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_he.pak; sourceTree = ""; }; + C3F9A1466747A71994443EE8 /* net.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = net.xcodeproj; path = ../net/net.xcodeproj; sourceTree = SOURCE_ROOT; }; + C3FF36D1BCEC9430E0C11917 /* webkit_strings_bn.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_bn.pak; sourceTree = ""; }; + C43E59B4E40FDD94C723B8EF /* app_locale_settings_ca.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_ca.pak; sourceTree = ""; }; + C4598A5939FD219C10E8EDC2 /* request_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = request_cpptoc.cc; sourceTree = ""; }; + C466234A54DD0BD14A913865 /* v8exception_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8exception_cpptoc.cc; sourceTree = ""; }; + C4732367B9C8CFFB7629CCE1 /* post_data_element_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = post_data_element_cpptoc.h; sourceTree = ""; }; + C48A4B5FC43952BAA1560513 /* cef_strings.grd */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings.grd; sourceTree = ""; }; + C4A22E5D8FE6D3821F882BF8 /* tr_html_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = tr_html_unittest.py; sourceTree = ""; }; + C4A3583C69238109E4439A1F /* browser_process_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_process_handler_cpptoc.h; sourceTree = ""; }; + C51F821DAEE8400127A67F46 /* ui_strings_ar.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_ar.pak; sourceTree = ""; }; + C52B2176F56D4DEDFA70B6AB /* grit_runner_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = grit_runner_unittest.py; sourceTree = ""; }; + C5468CD8ADC7730A0D9F923B /* command_line_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = command_line_cpptoc.h; sourceTree = ""; }; + C559AD44464C4C17590FDEA6 /* download_item_callback_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = download_item_callback_ctocpp.cc; sourceTree = ""; }; + C5737F034076C86775D81DC5 /* cef_strings_gu.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_gu.pak; sourceTree = ""; }; + C58453B51F977741B3755433 /* ui_strings_mr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_mr.pak; sourceTree = ""; }; + C588A9DB0063296F21B52B91 /* jsdialog_callback_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = jsdialog_callback_cpptoc.cc; sourceTree = ""; }; + C5F9DE1CFBD858D7865444CF /* v8value_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8value_ctocpp.cc; sourceTree = ""; }; + C6060C990C83797D74493904 /* ui_strings_ca.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_ca.pak; sourceTree = ""; }; + C62BF572DED4F010FC0E89A2 /* life_span_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = life_span_handler_cpptoc.h; sourceTree = ""; }; + C6313715F5261BAD9D0C719F /* download_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = download_handler_cpptoc.h; sourceTree = ""; }; + C6528F46F9707EA091C7262B /* cef_strings_uk.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_uk.pak; sourceTree = ""; }; + C67B560402C9434CB1C7FEAC /* request_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = request_impl.cc; sourceTree = ""; }; + C67EF82BBCE5A044D2A565F8 /* message_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = message_unittest.py; sourceTree = ""; }; + C6928DEF7F0D141CA277C6D9 /* kn */ = {isa = PBXFileReference; lastKnownFileType = text; name = kn; path = kn.lproj/locale.pak; sourceTree = ""; }; + C6A7D0330BEEA0682AF0CF1D /* toolbar_postprocess.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = toolbar_postprocess.py; sourceTree = ""; }; + C6F9C805F913D447E3623EDC /* web_plugin_info_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = web_plugin_info_cpptoc.h; sourceTree = ""; }; + C723B94B88820ECB9B238D97 /* base.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = base.py; sourceTree = ""; }; + C72440BBDA9B2D0831F9B31B /* webkit_strings_vi.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_vi.pak; sourceTree = ""; }; + C725996ECD3353F9AF70492D /* cef_response_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_response_capi.h; sourceTree = ""; }; + C74DC68884C27EA075179638 /* browser_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_ctocpp.cc; sourceTree = ""; }; + C7705207DD77B0C0A875FEAF /* cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cpptoc.h; sourceTree = ""; }; + C7A48623E5586F1836DFC472 /* filename_rules.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = filename_rules.gypi; path = ../build/filename_rules.gypi; sourceTree = ""; }; + C7ACE0C68D51D0C218919A6C /* string_list_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = string_list_impl.cc; sourceTree = ""; }; + C7B512B42C038991A1237E72 /* menu_model_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = menu_model_impl.cc; sourceTree = ""; }; + C7EE4C2E678C3D80B0A02DA2 /* protobuf.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = protobuf.xcodeproj; path = ../third_party/protobuf/protobuf.xcodeproj; sourceTree = SOURCE_ROOT; }; + C82AFEAEA3B4F9DC13CADFC9 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + C84B4501D7B29FD743E409F7 /* release_defaults.gypi */ = {isa = PBXFileReference; lastKnownFileType = text; name = release_defaults.gypi; path = ../build/internal/release_defaults.gypi; sourceTree = ""; }; + C86CD8E3B19D61111DF9F73C /* postprocess_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = postprocess_unittest.py; sourceTree = ""; }; + C879B7C07DD025F3BFAD2E92 /* net_resources.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = net_resources.pak; sourceTree = ""; }; + C8A180CBAD1730307A7968AE /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo.png; sourceTree = ""; }; + C8B2E4A52DE2C4516E90AF0A /* en_GB */ = {isa = PBXFileReference; lastKnownFileType = text; name = en_GB; path = en_GB.lproj/locale.pak; sourceTree = ""; }; + C8D5566AFB8F260F77DAB20E /* xml_writer_base_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = xml_writer_base_unittest.py; sourceTree = ""; }; + C8F4C343AD3BD4B6CCFC1CE9 /* v8value_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8value_cpptoc.h; sourceTree = ""; }; + C90513F9659799663F6F0EF2 /* ui_strings_kn.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_kn.pak; sourceTree = ""; }; + C96E8D10AC36A42D17375908 /* task_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = task_cpptoc.h; sourceTree = ""; }; + C986618ECAB0A5C043D8BB3F /* jingle.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = jingle.xcodeproj; path = ../jingle/jingle.xcodeproj; sourceTree = SOURCE_ROOT; }; + CA2838C0FB67F18D5C4135A6 /* xml_reader_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xml_reader_ctocpp.h; sourceTree = ""; }; + CAD0608CFCF60C55553960B9 /* values_unittest.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = values_unittest.cc; sourceTree = ""; }; + CAF6A438DA5A40FD14194552 /* browser_context.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_context.cc; sourceTree = ""; }; + CB1A2A507DD7E247C86F4DE8 /* filename.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = filename.py; sourceTree = ""; }; + CB28E6AD5B83DA336278E20C /* context_menu_params_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = context_menu_params_cpptoc.cc; sourceTree = ""; }; + CB5EA804FCBC0FD14C48C9EA /* cef_scheme_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_scheme_capi.h; sourceTree = ""; }; + CB90EDB889CFB9BDAC13A0FD /* cookie_visitor_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cookie_visitor_ctocpp.cc; sourceTree = ""; }; + CBD002A1963C4F53D11B5870 /* ml */ = {isa = PBXFileReference; lastKnownFileType = text; name = ml; path = ml.lproj/locale.pak; sourceTree = ""; }; + CC02ACE784927C69439BC632 /* ui_strings_vi.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_vi.pak; sourceTree = ""; }; + CC2E0CD0BEC5AFA8BD641A34 /* cef_string.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_string.h; sourceTree = ""; }; + CC6C389575F116171DF2E9F2 /* webkit_strings_ml.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_ml.pak; sourceTree = ""; }; + CC8CAF87DF780BDAEAEAD507 /* content_client.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = content_client.h; sourceTree = ""; }; + CC9D2982021F72278C81EEED /* download_item_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = download_item_cpptoc.h; sourceTree = ""; }; + CD602F995973791BC74F5A97 /* javascript_dialog_mac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = javascript_dialog_mac.mm; sourceTree = ""; }; + CD86FFEA2D5001FA726510BE /* JavaScriptCore.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = JavaScriptCore.xcodeproj; path = ../third_party/WebKit/Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.xcodeproj; sourceTree = SOURCE_ROOT; }; + CDB2A1AB7093EC0735069E23 /* cef_message_generator.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cef_message_generator.cc; sourceTree = ""; }; + CDD57B391041DD8139A99BE4 /* txt_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = txt_unittest.py; sourceTree = ""; }; + CDDFE6F7750317167401DBB1 /* render_process_observer.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = render_process_observer.cc; sourceTree = ""; }; + CE20FF896D00BB796193B0C3 /* policy_json_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = policy_json_unittest.py; sourceTree = ""; }; + CE807F315C4A3B2A084C3D77 /* string_visitor_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = string_visitor_ctocpp.cc; sourceTree = ""; }; + CF995465B9EDCF391B89FEA8 /* webkit_glue.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = webkit_glue.cc; sourceTree = ""; }; + CFA1C64C814325D7DD4C85FD /* cef_strings_el.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_el.pak; sourceTree = ""; }; + D05576BEB3938E78B49B3AE0 /* process_message_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = process_message_impl.cc; sourceTree = ""; }; + D0856E7B20F81C035637FEEE /* libxml.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libxml.xcodeproj; path = ../third_party/libxml/libxml.xcodeproj; sourceTree = SOURCE_ROOT; }; + D0C928E6B9A90B8E7C82948B /* am */ = {isa = PBXFileReference; lastKnownFileType = text; name = am; path = am.lproj/locale.pak; sourceTree = ""; }; + D0E01ECF64FCF571173DCD92 /* request_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = request_ctocpp.cc; sourceTree = ""; }; + D1525B53591006BB536CE299 /* load_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = load_handler_cpptoc.h; sourceTree = ""; }; + D1966077D7D68ADB63A785AC /* __init__.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = ""; }; + D21108AEEAA66A731A5B0110 /* frame_host_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = frame_host_impl.h; sourceTree = ""; }; + D2145AD48706B90529681EE2 /* web_plugin_info_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = web_plugin_info_ctocpp.h; sourceTree = ""; }; + D27C8FC303AC0109A42C8D52 /* c_format_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = c_format_unittest.py; sourceTree = ""; }; + D2E051950242C84ED77FD8E7 /* response_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = response_cpptoc.cc; sourceTree = ""; }; + D2E95DA195A44E9F13800933 /* content_client.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = content_client.cc; sourceTree = ""; }; + D307D6AF258938000F036E81 /* ui_strings_hr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_hr.pak; sourceTree = ""; }; + D31E19966B4FFD0C7AFFC86C /* mr */ = {isa = PBXFileReference; lastKnownFileType = text; name = mr; path = mr.lproj/locale.pak; sourceTree = ""; }; + D32C9CC677C221FD93EE8BC8 /* igoogle_strings.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = igoogle_strings.py; sourceTree = ""; }; + D366285CB364244F44102F11 /* libcef_dll_wrapper.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = libcef_dll_wrapper.cc; sourceTree = ""; }; + D39A9A62C445BA011E1163D3 /* write_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = write_handler_ctocpp.cc; sourceTree = ""; }; + D3BEDFBD500FED829DC71255 /* cef_switches.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_switches.h; sourceTree = ""; }; + D3EBF675DE5EF129D3440EFC /* post_data_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = post_data_cpptoc.cc; sourceTree = ""; }; + D3FED2E6E88A2EB20010DFAC /* content_browser_client.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = content_browser_client.cc; sourceTree = ""; }; + D455FB5D8F74CAB2B3F41A9E /* tracker.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = tracker.cc; sourceTree = ""; }; + D4583E529523A3C1F0D38D95 /* base_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = base_ctocpp.h; sourceTree = ""; }; + D46FDC38673A7B16D6DAD52A /* policy_json.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = policy_json.py; sourceTree = ""; }; + D4CC7F2E668EBBEBC0B25A09 /* browser_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_impl.h; sourceTree = ""; }; + D4D09FA875F36BC20589A971 /* string_util.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = string_util.cpp; sourceTree = ""; }; + D4EA87717B8FA96AF184ECD8 /* webkit_strings_zh-TW.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "webkit_strings_zh-TW.pak"; sourceTree = ""; }; + D4F148746CEA2558106D7D63 /* v8context_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8context_cpptoc.h; sourceTree = ""; }; + D54F3662C373B066FED2B189 /* task_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = task_cpptoc.cc; sourceTree = ""; }; + D58C1FEF34712C6E4A5F8918 /* admx_writer.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = admx_writer.py; sourceTree = ""; }; + D58DC93A21C48D816DFBE475 /* app_locale_settings_id.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_id.pak; sourceTree = ""; }; + D5AE19360737D03F7E2221DB /* webkit_strings_en-US.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "webkit_strings_en-US.pak"; sourceTree = ""; }; + D5B5990FC45DD1B69097F780 /* frame_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = frame_ctocpp.cc; sourceTree = ""; }; + D5D6EA7FA371571B90F3341D /* libcef_dll.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = libcef_dll.cc; sourceTree = ""; }; + D5FD4E92AEBBDD820CD613D0 /* webkit_strings_uk.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_uk.pak; sourceTree = ""; }; + D6009C3FE4C9EAC76844183A /* rc.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = rc.py; sourceTree = ""; }; + D6354F773C04C1B426CEF241 /* domevent_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = domevent_ctocpp.cc; sourceTree = ""; }; + D63E0F20DC3D5F422F238E99 /* cef_strings_pl.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_pl.pak; sourceTree = ""; }; + D64438538235B85A8AEE9557 /* admx_writer_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = admx_writer_unittest.py; sourceTree = ""; }; + D70F2AD41B444A90D0917EFB /* printing.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = printing.xcodeproj; path = ../printing/printing.xcodeproj; sourceTree = SOURCE_ROOT; }; + D73F8D203BD3DC29958AA381 /* render_urlrequest_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = render_urlrequest_impl.cc; sourceTree = ""; }; + D750300952CFEECA77BB2E09 /* video_engine.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = video_engine.xcodeproj; path = ../third_party/webrtc/video_engine/video_engine.xcodeproj; sourceTree = SOURCE_ROOT; }; + D768A135320ECA4D23B837A2 /* cef_request_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_request_handler.h; sourceTree = ""; }; + D76B4B028759943E0918DA1F /* cef_resource_bundle_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_resource_bundle_handler.h; sourceTree = ""; }; + D7A0E7112DB25D43079BDBD4 /* command_line_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = command_line_impl.h; sourceTree = ""; }; + D7A7DCA77B5D7E0417FA2EE7 /* libxslt.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libxslt.xcodeproj; path = ../third_party/libxslt/libxslt.xcodeproj; sourceTree = SOURCE_ROOT; }; + D7AFDC016D372255D27E2AF7 /* cef_strings_kn.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_kn.pak; sourceTree = ""; }; + D7CE3427570BB20354E76B72 /* read_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = read_handler_cpptoc.h; sourceTree = ""; }; + D81D280D5FD2372126A044AE /* post_data_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = post_data_cpptoc.h; sourceTree = ""; }; + D828014EA35F6FF11305AC18 /* ui_strings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ui_strings.xcodeproj; path = ../ui/base/strings/ui_strings.xcodeproj; sourceTree = SOURCE_ROOT; }; + D82A58B16F6BCCF2847EECBC /* cef_strings_fi.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_fi.pak; sourceTree = ""; }; + D856CDF05187853E5B11722B /* url_request_context_getter_proxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = url_request_context_getter_proxy.h; sourceTree = ""; }; + D868357C760F520F1C128A40 /* ui_strings_bn.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_bn.pak; sourceTree = ""; }; + D8AEDA47EF0748D9516229F8 /* cef_strings_en-US.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "cef_strings_en-US.pak"; sourceTree = ""; }; + D940F7991272A95E78BC9D80 /* before_download_callback_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = before_download_callback_cpptoc.cc; sourceTree = ""; }; + D97321F6316E0C86664EDF93 /* values_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = values_impl.h; sourceTree = ""; }; + D980F0A679089BE9FB4C1F47 /* ui_strings_ro.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_ro.pak; sourceTree = ""; }; + D9A70811C1CA0449A9BB8F23 /* et */ = {isa = PBXFileReference; lastKnownFileType = text; name = et; path = et.lproj/locale.pak; sourceTree = ""; }; + D9E3CB72823229E4998256E7 /* cef_strings_hu.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_hu.pak; sourceTree = ""; }; + D9F48A2BC060CC7EF9C94F9D /* cef_strings_zh-TW.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "cef_strings_zh-TW.pak"; sourceTree = ""; }; + DA02DB97CDBBED8E70C5719D /* cef_strings_fa.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_fa.pak; sourceTree = ""; }; + DA0D761271620EF673356FAF /* webkit_strings_lv.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_lv.pak; sourceTree = ""; }; + DA1D01A728A8845E891328E7 /* zip_reader_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = zip_reader_cpptoc.cc; sourceTree = ""; }; + DA377C3032623ECAF54FE658 /* template_writer.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = template_writer.py; sourceTree = ""; }; + DAB9718F6B8064F992196C74 /* clear_on_exit_policy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = clear_on_exit_policy.h; sourceTree = ""; }; + DACC26B506287FD5B8026671 /* cef_values_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_values_capi.h; sourceTree = ""; }; + DAE1F7666030E9B8391D3447 /* cef_command_line.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_command_line.h; sourceTree = ""; }; + DBC9ADD36C96688115653866 /* sw */ = {isa = PBXFileReference; lastKnownFileType = text; name = sw; path = sw.lproj/locale.pak; sourceTree = ""; }; + DBF44633A3C9C520AFEF1CE1 /* webkit_glue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = webkit_glue.h; sourceTree = ""; }; + DC2688FB8963B48B34A8CB30 /* event_utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = event_utils.h; sourceTree = ""; }; + DC2F637745D18676B250F4D7 /* cef_url_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_url_capi.h; sourceTree = ""; }; + DC31F42D1CD61440FCE82A26 /* frame_host_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = frame_host_impl.cc; sourceTree = ""; }; + DC4E795B2C67468CA528503C /* app_locale_settings_fil.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_fil.pak; sourceTree = ""; }; + DC64E025926A9B0590800B79 /* app_locale_settings_pt-BR.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "app_locale_settings_pt-BR.pak"; sourceTree = ""; }; + DC72D0B7D1A6B663CB335034 /* WebCore.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = WebCore.xcodeproj; path = ../third_party/WebKit/Source/WebCore/WebCore.gyp/WebCore.xcodeproj; sourceTree = SOURCE_ROOT; }; + DCC7D766A8EC8756A8376CB3 /* urlrequest_client_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = urlrequest_client_ctocpp.h; sourceTree = ""; }; + DD3F14826655E3055F273989 /* xml_reader_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = xml_reader_ctocpp.cc; sourceTree = ""; }; + DD4F39FDF92A279B445CB635 /* cef_strings_pt-PT.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "cef_strings_pt-PT.pak"; sourceTree = ""; }; + DDA467E96A26AD4D03D9510E /* bg */ = {isa = PBXFileReference; lastKnownFileType = text; name = bg; path = bg.lproj/locale.pak; sourceTree = ""; }; + DDFAD28E804B0154D4660646 /* ui_strings_sl.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_sl.pak; sourceTree = ""; }; + DE17DA3B1BFB8194BB712051 /* test.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = test.py; sourceTree = ""; }; + DEC34FF48A6DE9F7B8BB5A73 /* sqlite_persistent_cookie_store.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = sqlite_persistent_cookie_store.cc; sourceTree = ""; }; + DEF73970376FB40B6877E899 /* scheme_registrar_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scheme_registrar_ctocpp.h; sourceTree = ""; }; + DFC6006F8E44EC259DFF6C6D /* web_plugin_info_visitor_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = web_plugin_info_visitor_cpptoc.cc; sourceTree = ""; }; + DFD892EE828C7CED561FA451 /* process_helper_mac.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = process_helper_mac.cpp; sourceTree = ""; }; + E01020EC056D3010F006EF72 /* cef_request_handler_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_request_handler_capi.h; sourceTree = ""; }; + E0F66F6372DC53DDA571C522 /* cef_unittests Helper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "cef_unittests Helper.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + E16C430DB6178E130B542B39 /* stream_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stream_impl.h; sourceTree = ""; }; + E1F92A687AF6981AE53D2B53 /* client_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = client_ctocpp.cc; sourceTree = ""; }; + E2BAA234A2BE8017D226EDD3 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + E2C3BC0EFC15B0A091A108B9 /* admin_template.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = admin_template.py; sourceTree = ""; }; + E2C86E608D1FE42AD3D883F2 /* dictionary_value_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dictionary_value_cpptoc.h; sourceTree = ""; }; + E331A5FC069C0C31B73E896D /* sk */ = {isa = PBXFileReference; lastKnownFileType = text; name = sk; path = sk.lproj/locale.pak; sourceTree = ""; }; + E39A8AB13257E2C3124AA2F3 /* download_item_callback_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = download_item_callback_cpptoc.cc; sourceTree = ""; }; + E39D9DE3B2B6FAA5D5A4C0BD /* rc_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = rc_unittest.py; sourceTree = ""; }; + E430F79B1322631374180E88 /* glu.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = glu.xcodeproj; path = ../third_party/WebKit/Source/ThirdParty/glu/glu.xcodeproj; sourceTree = SOURCE_ROOT; }; + E433B28466F26CA5A6E597A7 /* download_item_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = download_item_impl.h; sourceTree = ""; }; + E450C695FBCE11210A22C7BF /* clear_on_exit_policy.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = clear_on_exit_policy.cc; sourceTree = ""; }; + E4DBE8ED5B8C759DF03135D3 /* browser_settings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_settings.h; sourceTree = ""; }; + E543A7571C10044A6343AF07 /* ui_strings_am.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_am.pak; sourceTree = ""; }; + E557EFD39B50172DFACD3CF6 /* cef_strings_nl.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_nl.pak; sourceTree = ""; }; + E581A3AAAE322723FC773C13 /* cookie_visitor_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cookie_visitor_cpptoc.cc; sourceTree = ""; }; + E5BBF422E9D920423158F973 /* cefclient Helper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "cefclient Helper.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + E5EA7CF0EAFED588646FEBCF /* cookie_manager_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cookie_manager_cpptoc.cc; sourceTree = ""; }; + E628C159157AD577B39C0B42 /* sql.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = sql.xcodeproj; path = ../sql/sql.xcodeproj; sourceTree = SOURCE_ROOT; }; + E69FAB7C092C231EAE2CDE02 /* resource_ids */ = {isa = PBXFileReference; lastKnownFileType = text; path = resource_ids; sourceTree = ""; }; + E6BB666763D7433F2BA744AE /* cef_frame.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_frame.h; sourceTree = ""; }; + E6D4837DC7D70A7B4E9D9E96 /* load_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = load_handler_cpptoc.cc; sourceTree = ""; }; + E76B1563EE0C973C3C6418FE /* __init__.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = ""; }; + E779007C9491D76188594B0B /* cef_strings_da.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_da.pak; sourceTree = ""; }; + E7A199FD70EE5ABD2D98FCCB /* cef_strings_ja.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_ja.pak; sourceTree = ""; }; + E85A0832181D596715491B18 /* ui_strings_es-419.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "ui_strings_es-419.pak"; sourceTree = ""; }; + E862DE7D1FCFA8C328ECFC05 /* geolocation_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = geolocation_handler_cpptoc.cc; sourceTree = ""; }; + E88908652AACDC3D54805093 /* muppet_strings.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = muppet_strings.py; sourceTree = ""; }; + E8AD3F42F9B90E5553731848 /* exception.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = exception.py; sourceTree = ""; }; + E8B06DADDF85D240BCDEAD72 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; }; + E8FDF82B6BD1532187AFBE45 /* cef_xml_object.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = cef_xml_object.cc; sourceTree = ""; }; + E963A3CC92D8BF4256FDEA60 /* webkit_strings_sr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_sr.pak; sourceTree = ""; }; + E9E9C7069874412A6D7A5A7E /* focus_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = focus_handler_cpptoc.cc; sourceTree = ""; }; + E9F7732ADD6BB6E502471B62 /* download_item_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = download_item_impl.cc; sourceTree = ""; }; + EA2BC04B60C61C54807B3861 /* download_item_callback_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = download_item_callback_cpptoc.h; sourceTree = ""; }; + EA9A5910453B8A43C9F864E2 /* app_locale_settings_it.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_it.pak; sourceTree = ""; }; + EAA971EFC721FB184CA622B6 /* ui_strings_lt.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_lt.pak; sourceTree = ""; }; + EAF32C2CB8FDEFDC6747000F /* frame_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = frame_ctocpp.h; sourceTree = ""; }; + EB09904B2159F7256690EB9A /* v8context_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = v8context_ctocpp.h; sourceTree = ""; }; + EB32421AB024ADB6BE44999A /* geolocation_callback_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = geolocation_callback_cpptoc.h; sourceTree = ""; }; + EB7FB6461C4299EDEBC5FB83 /* cef_strings_ar.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_ar.pak; sourceTree = ""; }; + EB973CE4FEF9B5B2ED441179 /* cef_logging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_logging.h; sourceTree = ""; }; + EB9A29E13E54ACE6B01072A8 /* cef_strings_ms.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_ms.pak; sourceTree = ""; }; + EBDA2F288039C5E20D832C0F /* iccjpeg.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = iccjpeg.xcodeproj; path = ../third_party/iccjpeg/iccjpeg.xcodeproj; sourceTree = SOURCE_ROOT; }; + EBF5C06D8AC6121BFEF66A5F /* cef_dom_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_dom_capi.h; sourceTree = ""; }; + EC052161A1C3C55426875686 /* admin_template_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = admin_template_unittest.py; sourceTree = ""; }; + EC0822A9679CEA8BB6D488D7 /* proxy_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = proxy_handler_ctocpp.h; sourceTree = ""; }; + EC551A219A6DBB358916C1BF /* url_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = url_impl.cc; sourceTree = ""; }; + EC67219931CE7E3432F787C0 /* frame_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = frame_cpptoc.h; sourceTree = ""; }; + ECC79AFDFBD9192D75DBB4C6 /* devtools_delegate.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = devtools_delegate.cc; sourceTree = ""; }; + ECCBF7F6C5D31974CD894909 /* toolbar_preprocess.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = toolbar_preprocess.py; sourceTree = ""; }; + ECCC851AC8F72EDFC2B2F981 /* cef_response.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_response.h; sourceTree = ""; }; + ECDA7F89372354141C39ADFE /* webkit_strings_sl.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_sl.pak; sourceTree = ""; }; + ECFF6AE05958481BFD540AF3 /* app_locale_settings_cs.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_cs.pak; sourceTree = ""; }; + ED289D8FDDC0EF6873A96A45 /* app_locale_settings_bg.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_bg.pak; sourceTree = ""; }; + ED76BFB50460BA410E806208 /* webkit_strings_fa.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_fa.pak; sourceTree = ""; }; + ED774CC9A6E41E3411B553FA /* ui_strings_th.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_th.pak; sourceTree = ""; }; + EDC1E2A49F77A73C8F4D1725 /* cef_load_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_load_handler.h; sourceTree = ""; }; + EDE25A592AC6B469CF3C58F2 /* write_handler_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = write_handler_cpptoc.cc; sourceTree = ""; }; + EE39EE596DEA6D9182112734 /* webkit_strings_fi.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_fi.pak; sourceTree = ""; }; + EE7857FFF9A4D9C66BB38F61 /* cef_request_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_request_capi.h; sourceTree = ""; }; + EE8BBDFA9751E272EE4B6E34 /* FP.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = FP.py; sourceTree = ""; }; + EEA50A31F48D9F26C2270EC4 /* cef_stream_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_stream_capi.h; sourceTree = ""; }; + EF13D40094372E03784355D5 /* webkit_strings_ms.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = webkit_strings_ms.pak; sourceTree = ""; }; + EF34543C9A167C6FF768DCAE /* domdocument_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domdocument_ctocpp.h; sourceTree = ""; }; + EF4166854E3E8459757D0E2F /* render_process_handler_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = render_process_handler_ctocpp.cc; sourceTree = ""; }; + EF7EA3D6FCFE4AE5044B2703 /* app_locale_settings_am.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_am.pak; sourceTree = ""; }; + EFB261248F2CA9D5DA266A00 /* display_handler_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = display_handler_ctocpp.h; sourceTree = ""; }; + EFD61BE299279F804F6194CE /* app_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = app_cpptoc.h; sourceTree = ""; }; + F087160AE31260242344FE3C /* write_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = write_handler_cpptoc.h; sourceTree = ""; }; + F0C44F397DE57FF0BF3EE6B4 /* ui_strings_nl.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_nl.pak; sourceTree = ""; }; + F0C79A23253ACFB08E461D8C /* post_data_element_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = post_data_element_cpptoc.cc; sourceTree = ""; }; + F0F966C99991A8DE7B491044 /* string_map_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = string_map_impl.cc; sourceTree = ""; }; + F0FAA7EB5CB31AD8B8EEE341 /* __init__.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = __init__.py; sourceTree = ""; }; + F12BA7D477CE652CE0378E43 /* regexp.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = regexp.py; sourceTree = ""; }; + F12C567E71FD0DA421B6A5DF /* response_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = response_cpptoc.h; sourceTree = ""; }; + F13C237B772D9F520A612293 /* browser_context.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = browser_context.h; sourceTree = ""; }; + F13EDB36838C78E6470B1A91 /* lazy_re.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = lazy_re.py; sourceTree = ""; }; + F24BB8C67FE764F01DFBF960 /* stream_writer_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = stream_writer_ctocpp.cc; sourceTree = ""; }; + F28572D01F13C0A3F8644679 /* cef_urlrequest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_urlrequest.h; sourceTree = ""; }; + F292B9739283ADD79D7BEE01 /* javascript_dialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = javascript_dialog.h; sourceTree = ""; }; + F2C9D770BB176067208708D2 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; + F2DBCDF72B85E19AD64FB768 /* NSURL+Utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSURL+Utils.m"; sourceTree = ""; }; + F32CB72F18CF3355E5C1C895 /* dom_event_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dom_event_impl.h; sourceTree = ""; }; + F33B68CF5847805989509D13 /* transl2tc_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = transl2tc_unittest.py; sourceTree = ""; }; + F3E283BE9330EE912852D5AB /* value_base.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = value_base.cc; sourceTree = ""; }; + F425B1FFD0720AC546A431A4 /* xml_reader_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = xml_reader_impl.cc; sourceTree = ""; }; + F43F8E52BD7A46794874EAA3 /* cef_life_span_handler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_life_span_handler.h; sourceTree = ""; }; + F50B75FA83AC81C592A04541 /* app_locale_settings_ko.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_ko.pak; sourceTree = ""; }; + F57922A52A9CBE7D6C5818B3 /* adm_writer.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = adm_writer.py; sourceTree = ""; }; + F57FDD1E3CF622D99F92DC8A /* xml_reader_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xml_reader_cpptoc.h; sourceTree = ""; }; + F618FE14AAE048AA30C99EE2 /* dom_event_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = dom_event_impl.cc; sourceTree = ""; }; + F64D7374F957B22800459379 /* cef_callback.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_callback.h; sourceTree = ""; }; + F67C700426EF8449E5CCC774 /* shortcuts.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = shortcuts.py; sourceTree = ""; }; + F68051B3A28DAA052B15A469 /* v8accessor_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8accessor_ctocpp.cc; sourceTree = ""; }; + F68F18FF049593AC30D5381A /* scheme_registrar_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scheme_registrar_cpptoc.h; sourceTree = ""; }; + F6E29811FBA959CD7BC2EAA4 /* util_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = util_unittest.py; sourceTree = ""; }; + F6EE2C39F48A34DC1FD19315 /* browser_urlrequest_impl.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_urlrequest_impl.cc; sourceTree = ""; }; + F6FC8D0B14E925438D497470 /* libjpeg.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libjpeg.xcodeproj; path = ../third_party/libjpeg_turbo/libjpeg.xcodeproj; sourceTree = SOURCE_ROOT; }; + F70B20347C5192B800603656 /* command_line_ctocpp.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = command_line_ctocpp.cc; sourceTree = ""; }; + F727DE03E5EC9D7208861E7A /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; + F75945ED70B897D40F27A14B /* constants.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = constants.py; sourceTree = ""; }; + F76F445CF005C79B3ED25F86 /* domvisitor_ctocpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = domvisitor_ctocpp.h; sourceTree = ""; }; + F79BC80E5989366BC034AD67 /* v8value_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = v8value_cpptoc.cc; sourceTree = ""; }; + F8008887AB40C8E030162213 /* ui_strings_ta.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_ta.pak; sourceTree = ""; }; + F80705F721F23C071C68CBF0 /* speex.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = speex.xcodeproj; path = ../third_party/speex/speex.xcodeproj; sourceTree = SOURCE_ROOT; }; + F826FF98E5F795F91C77DDCA /* sdch.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = sdch.xcodeproj; path = ../sdch/sdch.xcodeproj; sourceTree = SOURCE_ROOT; }; + F889C65932D109B4889B4527 /* app_locale_settings_hr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_hr.pak; sourceTree = ""; }; + F909E4720F5671522B2B7B8C /* browser_host_cpptoc.cc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = browser_host_cpptoc.cc; sourceTree = ""; }; + F93BAD27A59BC516BB9311F8 /* pseudo_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = pseudo_unittest.py; sourceTree = ""; }; + F9AA4C47866D58A55D89906A /* app_locale_settings_lv.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_lv.pak; sourceTree = ""; }; + FA28652BC385FF946B57DA62 /* app_locale_settings_sk.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_sk.pak; sourceTree = ""; }; + FA58F4443A2BB8AB58939899 /* cef_download_item_capi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cef_download_item_capi.h; sourceTree = ""; }; + FB1E9137063AD67969F7C3F3 /* app_locale_settings_ml.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_ml.pak; sourceTree = ""; }; + FB531305A4122266E639EA1A /* app_locale_settings_sr.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_sr.pak; sourceTree = ""; }; + FB89F2BDE176C61ABD9F21FE /* fr */ = {isa = PBXFileReference; lastKnownFileType = text; name = fr; path = fr.lproj/locale.pak; sourceTree = ""; }; + FBB814347DC4A4175D6E4897 /* cef_strings_sw.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = cef_strings_sw.pak; sourceTree = ""; }; + FC5475BF8937399DFD353D03 /* ta */ = {isa = PBXFileReference; lastKnownFileType = text; name = ta; path = ta.lproj/locale.pak; sourceTree = ""; }; + FC70425D2E226756A6D1FCA6 /* app_locale_settings_pt-PT.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = "app_locale_settings_pt-PT.pak"; sourceTree = ""; }; + FC77141AAC1ABB1E3D77BA33 /* app_locale_settings_pl.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = app_locale_settings_pl.pak; sourceTree = ""; }; + FD4E83BB8718A54254419599 /* ui_resources.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_resources.pak; sourceTree = ""; }; + FDCD027B04F1985CF965A6D7 /* rc_header.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = rc_header.py; sourceTree = ""; }; + FE315AF8B75A20D4F79D2EFE /* googleurl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = googleurl.xcodeproj; path = ../build/temp_gyp/googleurl.xcodeproj; sourceTree = SOURCE_ROOT; }; + FE646E557D4F2F68727F9EA2 /* chrome_scaled_image_unittest.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = chrome_scaled_image_unittest.py; sourceTree = ""; }; + FE84C71E002AAD230CDFA753 /* ui_strings_ms.pak */ = {isa = PBXFileReference; lastKnownFileType = text; path = ui_strings_ms.pak; sourceTree = ""; }; + FED6A7D4CC6FDAC0ACF00545 /* dialogs.html */ = {isa = PBXFileReference; lastKnownFileType = text; path = dialogs.html; sourceTree = ""; }; + FF32EE1D0C75020413EA8446 /* resource_bundle_handler_cpptoc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resource_bundle_handler_cpptoc.h; sourceTree = ""; }; + FF8BB4B2506BBC0896EA40FE /* resource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = resource.h; sourceTree = ""; }; + FFD6F05FCEF91D95328C97C9 /* NSString+Utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSString+Utils.h"; sourceTree = ""; }; + FFF00D66C4A59FA632CF355D /* npapi.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = npapi.xcodeproj; path = ../third_party/npapi/npapi.xcodeproj; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 0EFC4FEA51E5E61F716A04B7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2E3453E8D91CCB4E6DE1F68A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D7F71CD3F0BD63CB4F0B3D87 /* libcef.dylib in Frameworks */, + F0A8AC18FF39C8DC5081AAF0 /* libcef_dll_wrapper.a in Frameworks */, + DAADE5BD72F606C80A55A035 /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 50130A990C148A218B7C3BD9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + EF1C148AB09ABA74E23F96A1 /* libbase.a in Frameworks */, + 574C7CAC6AFCD500174A2A45 /* libbase_i18n.a in Frameworks */, + C6F1C38F46260D1116E1EB93 /* libtest_support_base.a in Frameworks */, + 5011F1935C200CFC1B725732 /* libgtest.a in Frameworks */, + C168BC944255C0A12E15AF51 /* libicui18n.a in Frameworks */, + 23CE144D847A9AF82E379FFE /* libicuuc.a in Frameworks */, + 390BDCB26ED347EE2A30D596 /* libcef.dylib in Frameworks */, + 08A1EF262C1EF2AB3C1D9CD2 /* libcef_dll_wrapper.a in Frameworks */, + 2D25E25B0C2A75F4CC7A8913 /* libbase_static.a in Frameworks */, + A2635945AC974BEF46E1CADB /* liballocator_extension_thunks.a in Frameworks */, + A3E79D4490422EBB1FE9D2DB /* libmodp_b64.a in Frameworks */, + 2B45FCF79365697CA8254743 /* libdynamic_annotations.a in Frameworks */, + 92736BF03488492B25E90836 /* libmach_override.a in Frameworks */, + 08D87D8319269449D03364F6 /* libevent.a in Frameworks */, + 78824929E13B8777A8D5DBE6 /* libicudata.a in Frameworks */, + E4B7ADB4097F8ECBFC1969B5 /* libgmock.a in Frameworks */, + E985A1ECF9581803B2A5EBCA /* AppKit.framework in Frameworks */, + 2EA878D19A6F2EFF043D7D6D /* Carbon.framework in Frameworks */, + 40F06CC96A118205A945631C /* CoreFoundation.framework in Frameworks */, + E41F94ABD91197D7F562D44F /* Foundation.framework in Frameworks */, + D34BCE544D5BF02F2E44DA2F /* IOKit.framework in Frameworks */, + 0B3E25A5EB68DDAA28C5C05C /* Security.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 714FEC28B84B5C81930A0035 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A221D8DCAE94FF7F81841D9C /* libcef.dylib in Frameworks */, + CCF10249880E1F5A002A81DE /* libcef_dll_wrapper.a in Frameworks */, + A4BC912E45376271AC1A3D82 /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9705A89604762C019F4CA5B7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4D725CE2F2EA4D9EDDAB8498 /* libcef.dylib in Frameworks */, + 15742B6B2A048639DE9BC96E /* libcef_dll_wrapper.a in Frameworks */, + 5A1F938B7A72B555207D35A2 /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B903C7B9144BA6DAAF123B1A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2CD483F0DE7B4D13F87049A8 /* libcef.dylib in Frameworks */, + C1328581EAF07352D62D713D /* libcef_dll_wrapper.a in Frameworks */, + E93FCC1068322C03992030B3 /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BCCF06AC835461591F8E6D9B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A2C3A3D6B87B5520CE81D86E /* libcontent_app.a in Frameworks */, + C6470A4C9740915ED57F0503 /* libcontent_browser.a in Frameworks */, + 2DDA5503814CAB959D43775B /* libcontent_common.a in Frameworks */, + 13C29243D8C291552BC86AA8 /* libcontent_gpu.a in Frameworks */, + 4CAA2ECF687C405D90EC9B9B /* libcontent_plugin.a in Frameworks */, + 3786A5C285ED6164CCA66AE3 /* libcontent_ppapi_plugin.a in Frameworks */, + 7D3DCD2418E1DF36B21DEB1C /* libcontent_renderer.a in Frameworks */, + 28E4F22051D65BCC59F4D558 /* libcontent_utility.a in Frameworks */, + 70AA107566459038C0CF4893 /* libcontent_worker.a in Frameworks */, + 332E5D49FE9138DEBC0A6158 /* libbase.a in Frameworks */, + 457F68848C463E5784942057 /* libdynamic_annotations.a in Frameworks */, + C94809435E58FFBE1EE53E88 /* libgoogleurl.a in Frameworks */, + 5937EF842CBA1C1E6884F418 /* libipc.a in Frameworks */, + 72A34CAD138849FBCFB20158 /* libmedia.a in Frameworks */, + 850328AA54E1B709287C0133 /* libnet.a in Frameworks */, + B1A8C17B86B3CBE8E01BF49B /* libskia.a in Frameworks */, + 75527077D3313B90E791A460 /* libwebkit.a in Frameworks */, + DC7C68F9FF0ED28022D5417A /* libui.a in Frameworks */, + 9D23CFB96620D7F17522854A /* libappcache.a in Frameworks */, + 39C7FB1550F44D1682A083FA /* libdatabase.a in Frameworks */, + F9179A44555D6700BD529DBE /* libfileapi.a in Frameworks */, + 2188E527BDFBA04FBB123FD6 /* libglue.a in Frameworks */, + 486BEF17C50C3B6C07ADBA5E /* libquota.a in Frameworks */, + 4EF5DDF4ED6C631415816B70 /* libcef_static.a in Frameworks */, + AD429127FF8F824B59B68820 /* libbase_static.a in Frameworks */, + E64E8BB14454B9F2E2B99456 /* liballocator_extension_thunks.a in Frameworks */, + DBF78C8789DFB249A2C996F5 /* libmodp_b64.a in Frameworks */, + C11D6D6B9E8E62E3F1B97C00 /* libmach_override.a in Frameworks */, + C5317FDFB7DE3856AC1F7DB1 /* libevent.a in Frameworks */, + 9B2AB46D2F22FB8216947EA6 /* libicudata.a in Frameworks */, + 34B4DF4E2504AD8E091C4788 /* libicui18n.a in Frameworks */, + 3372199D0CDB3DB3962745C1 /* libicuuc.a in Frameworks */, + 24C4692634E1E9482969A6E4 /* libgles2_implementation.a in Frameworks */, + 2291F521B2DBFD4B3131C6BB /* libgl_wrapper.a in Frameworks */, + 4C3751111DCEC392481C2E36 /* libgles2_utils.a in Frameworks */, + 31FC1BC36D97C10ACD5632B0 /* libskia_opts.a in Frameworks */, + E28EF59AB76DA99F8B68DFE7 /* libskia_opts_ssse3.a in Frameworks */, + 29AF1337E5B83E64A85216EB /* libsfntly.a in Frameworks */, + CF0F5A11B32F444B14103963 /* libchrome_zlib.a in Frameworks */, + 2A8E708A7DB2B4EBDCD28F96 /* libbase_i18n.a in Frameworks */, + 1B66FB7132D4E9227F1BC343 /* libcrcrypto.a in Frameworks */, + 6F95577CFEAD995ED6F1C398 /* libcrnspr.a in Frameworks */, + 53E24EDE9B4E8DE2158E9E5E /* libcrnss.a in Frameworks */, + FB2B287CAAC55F92896777C2 /* libnss_static.a in Frameworks */, + 498DB5D393E4BCAF92938C0C /* libsqlite3.a in Frameworks */, + B28748CD97BD6DBB49362721 /* libsdch.a in Frameworks */, + F58527770C1C102AD5B12EE9 /* libv8_base.a in Frameworks */, + 6389CC8DEFD14DCEF65C9509 /* libv8_snapshot.a in Frameworks */, + C329736617AEE36044FB9D71 /* libssl.a in Frameworks */, + 0D5CAAF584FCEF6FC987E215 /* libpng.a in Frameworks */, + 09F4CF8F044E6BC4E9362EB7 /* libjpeg_turbo.a in Frameworks */, + 64C6A252822DA8F45C41B52D /* libgles2_cmd_helper.a in Frameworks */, + DA1E739503B9C92C48464A93 /* libcommand_buffer_client.a in Frameworks */, + 32515A016652B8604FBB9599 /* libcommand_buffer_common.a in Frameworks */, + 7D40D80FE969AA370AA47419 /* libgpu_ipc.a in Frameworks */, + 5C36AA25D0F468C91E1CCDEC /* libyuv_convert.a in Frameworks */, + 01EAB4093A6D6AA596E42901 /* libyuv_convert_simd_x86.a in Frameworks */, + 6770FC4915423692B30B8E33 /* libil.a in Frameworks */, + 8D3ECE4305228644255F2FC3 /* libffmpeg.a in Frameworks */, + 57BE03DEC5A991785CC2D6FA /* libwebcore_dom.a in Frameworks */, + E7A33BFCF64A531A4C6499A6 /* libtess.a in Frameworks */, + DCD6A474AC8988ADBE861000 /* libyarr.a in Frameworks */, + BEE1F22B02D1394614215AC9 /* libwtf.a in Frameworks */, + F29356D0FF8BAD6ED6BCF0E4 /* libwebkit_platform.a in Frameworks */, + 0C5F7438998B52E8C57BFE84 /* libiccjpeg.a in Frameworks */, + AE582613E4D1FA8EF407B9EF /* libwebp_enc.a in Frameworks */, + 32DCB1E2771353E462F3F6D2 /* libwebp_dec.a in Frameworks */, + 427134C2A9DF4CDEC3EFDD31 /* libwebp_dsp.a in Frameworks */, + D5D38ECC7D13265B5E7E3C70 /* libwebp_utils.a in Frameworks */, + DF8F31A1FFE26ECB6770C0E9 /* libxml2.a in Frameworks */, + 49FEC7DDBA98B0B01E9FF06F /* libxslt.a in Frameworks */, + 9986189551695DC93D7BD002 /* libots.a in Frameworks */, + 2148359DD84334D0DB3E613F /* libtranslator_glsl.a in Frameworks */, + 0C9CE87F2ED386264D3AE214 /* libtranslator_common.a in Frameworks */, + 8B9AA8813B8F41B4FF2E7EB5 /* libpreprocessor.a in Frameworks */, + AC9FB8311A15EDBDD53DF92C /* libgles2_c_lib.a in Frameworks */, + 706A5D6DB48A9F5FB8D98E0A /* libleveldatabase.a in Frameworks */, + ABC28235FC694755E4F2B388 /* libwebcore_html.a in Frameworks */, + 98C647EEE625335E5D2C2C1B /* libwebcore_platform.a in Frameworks */, + 51A6F0A7917BA50C8C2415E0 /* libharfbuzz-ng.a in Frameworks */, + E0E1535706E26B3964FFE20F /* libwebcore_remaining.a in Frameworks */, + C785E96BEAA5C3A21C29F7AF /* libv8-i18n.a in Frameworks */, + 65DDD02E8802408489124043 /* libwebcore_rendering.a in Frameworks */, + B19148FA87B75B49134F5131 /* libwebcore_bindings.a in Frameworks */, + 75CF2A1D82A3F7ADEBAB04AB /* libwebcore_svg.a in Frameworks */, + A0461C9D9B6B88544A0A289F /* libsql.a in Frameworks */, + 7F2D5C57D2D8299177FC597D /* libblob.a in Frameworks */, + 5879319A5738380C9D1571D5 /* libcommand_buffer_service.a in Frameworks */, + F4FBB487FF2C267320CF9B4C /* libsurface.a in Frameworks */, + DE7BDC88D670E25AAFB03FB1 /* libspeech_proto.a in Frameworks */, + 4B3177E22AE8185CEBE6B579 /* libprotobuf_lite.a in Frameworks */, + D7A5FF5F4D991CC1661E2559 /* libhttp_server.a in Frameworks */, + CEFC6CA2843A967D37E6DE51 /* libppapi_proxy.a in Frameworks */, + 62565F0267C1B96B93A37DB8 /* libppapi_shared.a in Frameworks */, + 472F457CBABB2EB1F5856FDA /* libflac.a in Frameworks */, + 9AE5747DC482AA54015313A6 /* libspeex.a in Frameworks */, + 3738E3E47F93E1E8BDF2064B /* libdom_storage.a in Frameworks */, + 5F303014A9D77F6773DCBB55 /* libsudden_motion_sensor.a in Frameworks */, + 6FC718E9EA3F27770FB75634 /* libprinting.a in Frameworks */, + FB3E367560C956FC430A6518 /* libwebkit_media.a in Frameworks */, + E6472481DDBA14952F8CD703 /* libwebkit_user_agent.a in Frameworks */, + FB26B3329C78E88E014DE538 /* libjingle_glue.a in Frameworks */, + 751004C1A9D6162DDC2623AC /* libjingle.a in Frameworks */, + A23F9E8E60A262D60751D4B5 /* libexpat.a in Frameworks */, + 24CD7638FA7459F99E7CE295 /* libjsoncpp.a in Frameworks */, + EC002E383BEDEBAD4AE79999 /* libjingle_p2p.a in Frameworks */, + 300F960F8F1450A4032B3F1F /* libwebkit_gpu.a in Frameworks */, + A307A7823B72BB0836ED4435 /* libjingle_peerconnection.a in Frameworks */, + 8E817A421AB5BC8F44AC386E /* libsrtp.a in Frameworks */, + 870EF5D90936EC4A06E6EE78 /* libvideo_capture_module.a in Frameworks */, + ED24EBBCE259B69C092FB02F /* libwebrtc_utility.a in Frameworks */, + 205A7DAAD947B797BB986DEB /* libaudio_coding_module.a in Frameworks */, + 8C46B6AF8C73D205EFBD51F8 /* libCNG.a in Frameworks */, + 95DDCDAC3D4FF867390C18A7 /* libsignal_processing.a in Frameworks */, + 0F32EAFCC9A2A60FEF136A84 /* libG711.a in Frameworks */, + D4865774BCB73686942D4ABB /* libG722.a in Frameworks */, + 53DA9A4B4AAC9F2574AD2328 /* libiLBC.a in Frameworks */, + DC68E4CEA60C357918FD948F /* libiSAC.a in Frameworks */, + CAA3B890D574B81FE02E78F6 /* libiSACFix.a in Frameworks */, + D879B99B226A88092BB49696 /* libPCM16B.a in Frameworks */, + 846C0C521F91EBE85E4DF8FB /* libNetEq.a in Frameworks */, + 36B378685297B9310D43E303 /* libresampler.a in Frameworks */, + 677FC82C4DA40800DA36655E /* libvad.a in Frameworks */, + 869AD4886DB3EBE42F5AC74F /* libsystem_wrappers.a in Frameworks */, + F5A950EBB168F0A10512CD2E /* libwebrtc_video_coding.a in Frameworks */, + 8DD1C4E3F578C58B2A9B8BD0 /* libwebrtc_i420.a in Frameworks */, + 8E645D0A842228177135228A /* libwebrtc_vp8.a in Frameworks */, + 66EBB9216BF008200C2C16F9 /* libwebrtc_libyuv.a in Frameworks */, + 6F6C3FF3080B6EA7B48DA906 /* libyuv.a in Frameworks */, + 1932382BEF16F19AD7939AED /* libvpx.a in Frameworks */, + 48FA10BC341B094B3F33B750 /* libvideo_render_module.a in Frameworks */, + D307D7F82B366EA986157A81 /* libvideo_engine_core.a in Frameworks */, + 363B4AE763B30CD5B1116C3C /* libwebrtc_jpeg.a in Frameworks */, + 010F4171FA5D72283581D13C /* libmedia_file.a in Frameworks */, + 2C121E16F5308F7980E95B5E /* librtp_rtcp.a in Frameworks */, + 635400CEB2A58D009A088BFF /* libudp_transport.a in Frameworks */, + D4100726F0933F0FFEC8D8BF /* libbitrate_controller.a in Frameworks */, + 562FEA15A6813058241E00A9 /* libvideo_processing.a in Frameworks */, + 4446856EA412F92A4E07AA5E /* libvideo_processing_sse2.a in Frameworks */, + 682096E97F88AB100E9A3D98 /* libvoice_engine_core.a in Frameworks */, + F6114BA29C8765E6520AE958 /* libaudio_conference_mixer.a in Frameworks */, + 48F4E65E56419C9FD000A6A1 /* libaudio_processing.a in Frameworks */, + 04C5BA236DB9B2ED2EF20499 /* libaec.a in Frameworks */, + 5C55339838F650B725A9EB10 /* libapm_util.a in Frameworks */, + 3E3EB58B0FD00BB0B9E0E326 /* libaec_sse2.a in Frameworks */, + 4206C5847974DE58FD75FCC4 /* libaecm.a in Frameworks */, + 313EEBB24006E1B73832AD55 /* libagc.a in Frameworks */, + 57CFCF31BDD682B5108FD40A /* libns.a in Frameworks */, + 09D04101D715987BB0BB81AD /* libaudio_device.a in Frameworks */, + F5A1923C8029AC1A2DABE283 /* AppKit.framework in Frameworks */, + 1443D604FDBF69C0ECEC6201 /* Carbon.framework in Frameworks */, + 5936ECC79FAF738E34341EF7 /* CoreFoundation.framework in Frameworks */, + B724629DBB78DB20D913B95D /* Foundation.framework in Frameworks */, + 7D7A3365DE8A0FA845B582C5 /* IOKit.framework in Frameworks */, + FB3ADDF565C8FB6A6D780810 /* Security.framework in Frameworks */, + ABF58A21401C3CD45BA99B87 /* OpenGL.framework in Frameworks */, + 0337D8FBEE11DC814AC2EAAE /* Accelerate.framework in Frameworks */, + 484FFB505367AE942C59F7E7 /* AudioUnit.framework in Frameworks */, + 18C16E1114B5980FA4D06965 /* CoreVideo.framework in Frameworks */, + 17E35FBBC18FEAB3F45CAB46 /* SystemConfiguration.framework in Frameworks */, + 795975A448D133FE6E730591 /* libresolv.dylib in Frameworks */, + 54FB30909986D1153CB5C29D /* CoreServices.framework in Frameworks */, + 483E54E82D31E620AF47B201 /* AudioToolbox.framework in Frameworks */, + E4ED537B4DC2866A830FE45A /* CoreAudio.framework in Frameworks */, + B11B844D5B7BFBE340F115A6 /* QTKit.framework in Frameworks */, + FEC60C6AF6CA1D0892E164DD /* libWebKitSystemInterfaceLeopardPrivateExtern.a in Frameworks */, + 49D26BAAD6702C0AF60EBBF8 /* QuartzCore.framework in Frameworks */, + 64CD0E97472E4A5086904996 /* libcups.dylib in Frameworks */, + 4915380176F656490E5B2C2B /* ApplicationServices.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C28AC5467575EA30992399FC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3D4AE82441CC5CA51F0162C0 /* libbase.a in Frameworks */, + EF742B7AFED89658D3A44BD1 /* libbase_i18n.a in Frameworks */, + 305255DD8022FA5BFC80A5B1 /* libtest_support_base.a in Frameworks */, + 8B7F5D24551A2E22C16FF697 /* libgtest.a in Frameworks */, + 837A1448675A5837410E2F10 /* libicui18n.a in Frameworks */, + 6304FDE1B6BA94E5B480FB64 /* libicuuc.a in Frameworks */, + D5FAF72CB8F9BFAFB259C81D /* libcef.dylib in Frameworks */, + FB98FD4E3BEA794BAB650F6C /* libcef_dll_wrapper.a in Frameworks */, + F440E7DD857C432492DC6580 /* libbase_static.a in Frameworks */, + 84A041B76F51A9A9267C37A4 /* liballocator_extension_thunks.a in Frameworks */, + E6E1F85709F53E113372FF34 /* libmodp_b64.a in Frameworks */, + 6E473E1F7CC71E258527F650 /* libdynamic_annotations.a in Frameworks */, + BDBB24D4CCE4A19D1EDFC951 /* libmach_override.a in Frameworks */, + 2D07C9F111F1BFFAC4ADC432 /* libevent.a in Frameworks */, + E5804D5C983F60BE9511CB22 /* libicudata.a in Frameworks */, + 1ED13ED25F33B1335CD29A5A /* libgmock.a in Frameworks */, + 50FF642A12EC0C16056B7204 /* AppKit.framework in Frameworks */, + DD3F05C4E0D15338891A9922 /* Carbon.framework in Frameworks */, + FD3465C742E7495B0489F119 /* CoreFoundation.framework in Frameworks */, + A518D2461127F778A7D73B16 /* Foundation.framework in Frameworks */, + A39CB5442D560022C02555A9 /* IOKit.framework in Frameworks */, + FDDC8E006BC4FEB0987952D1 /* Security.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FF7A801E01D9A5D08874F92D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0041A0FFCA788DD69BF9A559 /* renderer */ = { + isa = PBXGroup; + children = ( + 0214004821A34E16FAA98C37 /* browser_impl.cc */, + D4CC7F2E668EBBEBC0B25A09 /* browser_impl.h */, + 8B956AE1B815ACBF853C38A5 /* content_renderer_client.cc */, + 9407ED90778DCAA2D95996E5 /* content_renderer_client.h */, + 34342431CF0B291A417AB3DC /* dom_document_impl.cc */, + 12AAC7C7476E3B69B743F399 /* dom_document_impl.h */, + F618FE14AAE048AA30C99EE2 /* dom_event_impl.cc */, + F32CB72F18CF3355E5C1C895 /* dom_event_impl.h */, + 06CFB89D4546843303928D46 /* dom_node_impl.cc */, + ACC9DD4F18A619E64B23E04F /* dom_node_impl.h */, + 7569642FE0516CE15E0EB10B /* frame_impl.cc */, + 8D08F86EAC1279F520694642 /* frame_impl.h */, + CDDFE6F7750317167401DBB1 /* render_process_observer.cc */, + 0C2AFED1006ACC3B5DEA1B3A /* render_process_observer.h */, + D73F8D203BD3DC29958AA381 /* render_urlrequest_impl.cc */, + 20BA4A45C8E834D3CBD09AD1 /* render_urlrequest_impl.h */, + 9198D923FBC2970445FD08FB /* thread_util.h */, + C25773E7E22D4B38265E96C9 /* v8_impl.cc */, + 1FF3A7904AAC029FCC596CCB /* v8_impl.h */, + CF995465B9EDCF391B89FEA8 /* webkit_glue.cc */, + DBF44633A3C9C520AFEF1CE1 /* webkit_glue.h */, + ); + path = renderer; + sourceTree = ""; + }; + 057B966FE29A268A6863588E /* Products */ = { + isa = PBXGroup; + children = ( + AA9C990C6F0804F225B3E5F3 /* libchrome_zlib.a */, + ); + name = Products; + sourceTree = ""; + }; + 073C9061E63852E216E02CCE /* Products */ = { + isa = PBXGroup; + children = ( + 7F9E6BE9EC02F6F4CA505DA6 /* libsudden_motion_sensor.a */, + ); + name = Products; + sourceTree = ""; + }; + 07B3204DBE9ECB145822547F /* browser */ = { + isa = PBXGroup; + children = ( + 174958AFC1DC000B4DFCAAB5 /* application_mac.h */, + 0DCA45E5487FDB9C815839B1 /* application_mac.mm */, + CAF6A438DA5A40FD14194552 /* browser_context.cc */, + F13C237B772D9F520A612293 /* browser_context.h */, + 51AE0CA1355F7A0775D3A1D0 /* browser_host_impl.cc */, + 8F1DDCCC2B12987556CB7A6B /* browser_host_impl.h */, + 6A42142B50855298FBE0CB4E /* browser_host_impl_mac.mm */, + 37E8B79CC806BBF17FDB37C0 /* browser_main.cc */, + 5232F8242937DE8B5E28F994 /* browser_main.h */, + 4DB1B86AAC941216FCA32E15 /* browser_main_mac.mm */, + 67E2346E369D700890BAC5F2 /* browser_message_filter.cc */, + C0B028164A5328758788DBCC /* browser_message_filter.h */, + 91CA13A8DA1C53EA4CE12B1D /* browser_message_loop.cc */, + 91D140738ACF233F694087D9 /* browser_message_loop.h */, + 3A9A1DB9915BB6FD0AB526A1 /* browser_settings.cc */, + E4DBE8ED5B8C759DF03135D3 /* browser_settings.h */, + F6EE2C39F48A34DC1FD19315 /* browser_urlrequest_impl.cc */, + BBB082F6C3D4048CFB7A4BCD /* browser_urlrequest_impl.h */, + D3FED2E6E88A2EB20010DFAC /* content_browser_client.cc */, + 907CCE9710B29FF62EBB8C9C /* content_browser_client.h */, + 5FA82BA0F4237B9D72F3F4AB /* context.cc */, + 761F9B6F7D9C5D58B7800485 /* context.h */, + 14BDBB48FBFCED5C56A3D384 /* context_menu_params_impl.cc */, + 90899D9D0DBCB27C66786692 /* context_menu_params_impl.h */, + 00A3A60B85CDFEDACAEEB519 /* cookie_manager_impl.cc */, + 9BC2A3979FF4D29EA9037A8A /* cookie_manager_impl.h */, + ECC79AFDFBD9192D75DBB4C6 /* devtools_delegate.cc */, + B3CC57F25F4CFFB12C00E302 /* devtools_delegate.h */, + A9F5AFFE1B03166029163683 /* devtools_scheme_handler.cc */, + 3498BD423E02FABE1EE83BB8 /* devtools_scheme_handler.h */, + E9F7732ADD6BB6E502471B62 /* download_item_impl.cc */, + E433B28466F26CA5A6E597A7 /* download_item_impl.h */, + 4F44FF29D7C26F262CD730CA /* download_manager_delegate.cc */, + 49B228FEAE0E4BFBA9BB2266 /* download_manager_delegate.h */, + 58E1C7A6EE126C2D92CE13DD /* download_manager_delegate_mac.mm */, + DC31F42D1CD61440FCE82A26 /* frame_host_impl.cc */, + D21108AEEAA66A731A5B0110 /* frame_host_impl.h */, + F292B9739283ADD79D7BEE01 /* javascript_dialog.h */, + 511DFC813E6674C7EA914805 /* javascript_dialog_creator.cc */, + 6C401F20E3AC9FF553252DC8 /* javascript_dialog_creator.h */, + CD602F995973791BC74F5A97 /* javascript_dialog_mac.mm */, + 5C92D3A27E73BD53BB4E2F25 /* menu_creator.cc */, + 1094CFA6EF2DE7E52C584CD3 /* menu_creator.h */, + 173C4B63EE1C5DE552933F98 /* menu_creator_runner_mac.h */, + 1C6366E363E4421EDFB9EB05 /* menu_creator_runner_mac.mm */, + C7B512B42C038991A1237E72 /* menu_model_impl.cc */, + 718379D5B4EC037834401B14 /* menu_model_impl.h */, + C32B3AA8CEC445ABB8CCAB5A /* navigate_params.cc */, + 2EB9F9BD145BFF7BA721058A /* navigate_params.h */, + A6FFECB794D4143BFF69086A /* origin_whitelist_impl.cc */, + AEC666F3C94F4CEB8DEE2A9A /* origin_whitelist_impl.h */, + 6DFCAB3FE3A07471E7E8DF7A /* path_util_impl.cc */, + A53D5848A69C0706241C7CCB /* process_util_impl.cc */, + 2D1746EDD846025A7BBCF1F5 /* resource_context.cc */, + 373AC737314C99FC380A2C27 /* resource_context.h */, + A128B3C4C3B4EE24533CE3F1 /* resource_dispatcher_host_delegate.cc */, + 6D19A7B6453E43B9F0979372 /* resource_dispatcher_host_delegate.h */, + 3756CB6513E7539C28E1EAC8 /* resource_request_job.cc */, + BAEFF6772AA39B65C0A16BDC /* resource_request_job.h */, + 84C7CFBD54B4BF935F72B506 /* scheme_impl.cc */, + A829A9477B7F5226C12126E6 /* sqlite_diagnostics_stub.cc */, + 21B00D3F02764EF9434371B9 /* stream_impl.cc */, + E16C430DB6178E130B542B39 /* stream_impl.h */, + 71CA3191CD43BF1BF3DDC918 /* thread_util.h */, + B8EFE13D4363591579F845BD /* url_network_delegate.cc */, + 4F477F6CB38631F10E929F69 /* url_network_delegate.h */, + A9FBDEF643B43B3C94FCE05B /* url_request_context_getter.cc */, + 4FD83B3E31064A685C29F6A0 /* url_request_context_getter.h */, + 0DB4E599ACA1FF50AEA38D24 /* url_request_context_getter_proxy.cc */, + D856CDF05187853E5B11722B /* url_request_context_getter_proxy.h */, + ADF7DF75ED5214C882BA463D /* url_request_context_proxy.cc */, + 07A39F219A616F191160FF50 /* url_request_context_proxy.h */, + 9F84468F6827D8F99B734EA6 /* url_request_interceptor.cc */, + B3742C83FEE2415D7BA25F91 /* url_request_interceptor.h */, + 586069E4DE0F00ABACB87AEF /* web_plugin_impl.cc */, + F425B1FFD0720AC546A431A4 /* xml_reader_impl.cc */, + 10128A219805A7294C6801D1 /* xml_reader_impl.h */, + B111F32791A8BCA7228774C1 /* zip_reader_impl.cc */, + 3825964A1CB210151CB59E5A /* zip_reader_impl.h */, + ); + path = browser; + sourceTree = ""; + }; + 0A57F4FC2979198F954E180E /* net */ = { + isa = PBXGroup; + children = ( + E450C695FBCE11210A22C7BF /* clear_on_exit_policy.cc */, + DAB9718F6B8064F992196C74 /* clear_on_exit_policy.h */, + DEC34FF48A6DE9F7B8BB5A73 /* sqlite_persistent_cookie_store.cc */, + AD738FC5F4AC2C880F5D1446 /* sqlite_persistent_cookie_store.h */, + ); + path = net; + sourceTree = ""; + }; + 0AE0B805F4C7418FC2BE7CBB /* Products */ = { + isa = PBXGroup; + children = ( + EAA7B595FCFF3CBBB104B76B /* libiccjpeg.a */, + ); + name = Products; + sourceTree = ""; + }; + 0D308C0F1C74382E7D174B45 /* Products */ = { + isa = PBXGroup; + children = ( + B0D1337B3DE31CF644918BEB /* libgoogleurl.a */, + 966078E69F34CDDB98FA7FE0 /* googleurl_unittests */, + ); + name = Products; + sourceTree = ""; + }; + 0E7682419CD1D4CFAE35608F /* Products */ = { + isa = PBXGroup; + children = ( + D67EA0D4989FD408DD77B66C /* libgles2_implementation.a */, + 8796C04D2F5E75DABA00CF5A /* libgles2_implementation_client_side_arrays.a */, + 61692EC9A96F57D2E7F4FFEC /* libgles2_implementation_client_side_arrays_no_check.a */, + 47B457ECEE53FA38DB10AA91 /* libgles2_c_lib.a */, + B2E4D4A3022DC3194BDC73C3 /* libgles2_c_lib_nocheck.a */, + E10BE1AF48EF909F62A87B9C /* gpu_unittests */, + DCED4C272049F1F4D50F792C /* gl_tests */, + CD32E80AD06B431CD489F6E8 /* libgpu_unittest_utils.a */, + AE79CC2DBE576E182EE2D94C /* libcommand_buffer_common.a */, + 91833DED3D99DF0B2E532040 /* libgles2_cmd_helper.a */, + 3E85B3AAEDB5CB93E736DEA9 /* libcommand_buffer_client.a */, + 6A7B02C22238DAA06DCF08A2 /* libcommand_buffer_service.a */, + 281602B1CB941C0039247C5F /* libgpu_ipc.a */, + ); + name = Products; + sourceTree = ""; + }; + 1163FF8B98F887BD220732CF /* Products */ = { + isa = PBXGroup; + children = ( + 1A83EB2DBE27D347EF022E73 /* libgtest.a */, + BA2A08B372DBB101485675DB /* libgtest_main.a */, + ); + name = Products; + sourceTree = ""; + }; + 14B091E8F66195D659065DE3 /* Products */ = { + isa = PBXGroup; + children = ( + 19F011132AA33EFA48C6040F /* libcontent_shell_lib.a */, + 09633865ED0F4E9A65F5413F /* Content Shell.app */, + 038F9C52C4A43A403A11E976 /* libtest_support_content.a */, + 6BF642FBB4D4C46EE72E5A9C /* content_unittests */, + 824E7A6946DF27DEC5C519B5 /* content_browsertests */, + B901B1AA0FFB8733D3D34CDF /* video_decode_accelerator_unittest */, + 819DCC59DB3C3F90565A2D0B /* libcontent_app.a */, + 5ADF6FC0952597ED22A12929 /* libcontent_browser.a */, + A3459879EAAEA6159327E0AA /* libcontent_common.a */, + CE3B9660F42A253072C6E429 /* libcontent_gpu.a */, + D90E6D4C0A489F1C4BE5685A /* libcontent_plugin.a */, + 338DD3A741C5E6F0A7D1AC6F /* libcontent_ppapi_plugin.a */, + D870F67866877AB7743458DE /* libcontent_renderer.a */, + 03E1F4E49E9F8F568B054A97 /* libcontent_utility.a */, + 29AE609668619FB64D9573DC /* libcontent_worker.a */, + 0D1ACC57664C588B614EA509 /* Content Shell Framework.framework */, + D9A70841E03E00AE35585728 /* Content Shell Helper.app */, + ); + name = Products; + sourceTree = ""; + }; + 1882AC3D3E4436D106A05D1E /* Products */ = { + isa = PBXGroup; + children = ( + 72FF378E500352A3FE8EEBF4 /* libbase.a */, + 0EF0DF8FF56F5E3BCFAA3D4D /* libbase_i18n.a */, + E248C9BFA32A55025003A1F9 /* libbase_static.a */, + 8766E29593091A172075AC50 /* libbase_static_win64.a */, + BECB43A340B591D3D2E5BFD9 /* librun_all_unittests.a */, + 7E2AB0DD9FB567A6ABF1527D /* base_unittests */, + D85B04783FE65DAC171C848C /* check_example */, + 66396C6EFF9BDBC369436179 /* libtest_support_base.a */, + 1FA65F55B2768A2CDB7C17E9 /* libtest_support_perf.a */, + ); + name = Products; + sourceTree = ""; + }; + 18CA616B6D7C7067CF56A158 /* Products */ = { + isa = PBXGroup; + children = ( + 7FD04038A230D56812EFC77C /* libsdch.a */, + ); + name = Products; + sourceTree = ""; + }; + 1B6BCE57B535062FDA12910C /* libcef */ = { + isa = PBXGroup; + children = ( + 07B3204DBE9ECB145822547F /* browser */, + C56741FF440BB08E59C40D2D /* common */, + 0041A0FFCA788DD69BF9A559 /* renderer */, + 20043C937A02B68E543365F2 /* resources */, + ); + path = libcef; + sourceTree = ""; + }; + 1F7CA0EA50BBAB521B321365 /* Products */ = { + isa = PBXGroup; + children = ( + EAA20445274A6E929DA02F50 /* libmach_override.a */, + ); + name = Products; + sourceTree = ""; + }; + 1F7FF175E0E4D25F2BEF61EF /* grit */ = { + isa = PBXGroup; + children = ( + E5E3827436D25A88E9D0700C /* grit */, + 8655427EA10E4D926EEAF92A /* PRESUBMIT.py */, + 0EF3CF486BE3B15A5E526722 /* grit.py */, + 68BC095520583C85894071BD /* grit_info.py */, + ); + path = grit; + sourceTree = ""; + }; + 20043C937A02B68E543365F2 /* resources */ = { + isa = PBXGroup; + children = ( + 1C8EB17A5EB1BE9AF0E29160 /* cef_resources.grd */, + C48A4B5FC43952BAA1560513 /* cef_strings.grd */, + 5254CA911DB271FD83811B90 /* devtools_discovery_page.html */, + ); + path = resources; + sourceTree = ""; + }; + 209E0FC2D20323A6D349A006 /* Products */ = { + isa = PBXGroup; + children = ( + FF2B8B0E9DAEBCCFE02F46C8 /* libsurface.a */, + ); + name = Products; + sourceTree = ""; + }; + 21277E07B09DDCAFB11DD602 /* Products */ = { + isa = PBXGroup; + children = ( + 53C1E5EAC4E420FFB5E93F71 /* libmodp_b64.a */, + ); + name = Products; + sourceTree = ""; + }; + 224CE785D57ED4345CAA93FE /* Products */ = { + isa = PBXGroup; + children = ( + ); + name = Products; + sourceTree = ""; + }; + 26144774FE45D7ABF19C9895 /* Products */ = { + isa = PBXGroup; + children = ( + 1C999732FF6506A36E60DA85 /* libskia.a */, + E2C2F26B2F9DD883DE77215C /* libskia_opts.a */, + 0E7983D75D8A30A5BF897AC1 /* libskia_opts_ssse3.a */, + BAC8E39ACB2547774B671733 /* image_operations_bench */, + ); + name = Products; + sourceTree = ""; + }; + 2650782846712DB2DD701216 /* ui */ = { + isa = PBXGroup; + children = ( + 6763286823A1AD1CFC80FF11 /* app_locale_settings */, + 5199EDCB7025F0E2B22B8D70 /* ui_resources */, + BCFF87F98D20AC0C76C795D1 /* ui_resources_standard */, + EF5F28849C437F31B44DC7F1 /* ui_strings */, + ); + path = ui; + sourceTree = ""; + }; + 294295DEA98D91E039FB0B17 /* Products */ = { + isa = PBXGroup; + children = ( + 8DBB27495FD5C44CEEF44483 /* libppapi_cpp_objects.a */, + CD3756258E34DFF18BE68DD7 /* libppapi_cpp.a */, + CEBEAB89230F4E0AA610345F /* libppapi_egl.a */, + A522DCC2F11AB53EB593778D /* libppapi_gles2.a */, + ); + name = Products; + sourceTree = ""; + }; + 2C2F9795FB6FD0AF183B98C9 /* SHARED_INTERMEDIATE_DIR */ = { + isa = PBXGroup; + children = ( + 758FB0F3586923B5D0B4AB0D /* cef */, + 4775637EAF397760DEB2DA71 /* content */, + 6151DE280D4DF3FBC2477A56 /* net */, + 2650782846712DB2DD701216 /* ui */, + B2EA0EFD10DBCCC7D1352AFA /* webkit */, + ); + name = SHARED_INTERMEDIATE_DIR; + sourceTree = SHARED_INTERMEDIATE_DIR; + }; + 2D7E46727E85457FD7C7E494 /* Products */ = { + isa = PBXGroup; + children = ( + E2B0AD96A1FD510ACD225119 /* simple_encoder */, + 3D8ACFBFC35FF085E7365C21 /* simple_decoder */, + 9E3EA75D29A3C66D3E96AD23 /* libvpx.a */, + ); + name = Products; + sourceTree = ""; + }; + 355EF8BEF450D878E3BFBFA5 /* Products */ = { + isa = PBXGroup; + children = ( + 872BC5E7AD7B237BB766949C /* libexpat.a */, + ); + name = Products; + sourceTree = ""; + }; + 359DC2DF2DC84A5DF59E9DAB /* Products */ = { + isa = PBXGroup; + children = ( + ); + name = Products; + sourceTree = ""; + }; + 379B94E26997803291E0A1EE /* tool */ = { + isa = PBXGroup; + children = ( + F0FAA7EB5CB31AD8B8EEE341 /* __init__.py */, + 715EF92D9C1E94128B193C88 /* build.py */, + 705846BB8F452399EFCF2451 /* build_unittest.py */, + 55CC2E6AF87F44E121C68ABE /* buildinfo.py */, + 72B1A066321F72C7B897FE4C /* buildinfo_unittest.py */, + 641751712624080410E91CB3 /* count.py */, + 9E4F1653A19D8EBC682547EE /* diff_structures.py */, + 11705C7906E226312AA63C1E /* interface.py */, + 19D9BDEED72B2D29E3858E3E /* menu_from_parts.py */, + 3E5C4D7D7C3CBCEF72F2384A /* newgrd.py */, + 8B5021FC3D1392A6EAB8E5D3 /* postprocess_interface.py */, + C86CD8E3B19D61111DF9F73C /* postprocess_unittest.py */, + 448DDF4F4E28EDFB07CFE568 /* preprocess_interface.py */, + 726AD028360CE3C2B2DD85F5 /* preprocess_unittest.py */, + 99BE64627B2516968DA69C99 /* rc2grd.py */, + 51EE88270035C12D12B0B3A7 /* rc2grd_unittest.py */, + 2FF25DEDFC25519FC2068EB6 /* resize.py */, + DE17DA3B1BFB8194BB712051 /* test.py */, + C6A7D0330BEEA0682AF0CF1D /* toolbar_postprocess.py */, + ECCBF7F6C5D31974CD894909 /* toolbar_preprocess.py */, + 13A0D9C589E6C9B796C7A4D8 /* transl2tc.py */, + F33B68CF5847805989509D13 /* transl2tc_unittest.py */, + 426A81ACD2839880C079F32B /* unit.py */, + 0B1FA47E3643C52A9B849A79 /* xmb.py */, + 6F285D14138F575EB07E3D6B /* xmb_unittest.py */, + ); + path = tool; + sourceTree = ""; + }; + 38D2936464A136EEB0255508 /* cefclient */ = { + isa = PBXGroup; + children = ( + 5608C9478BD1D9667139A2FE /* mac */, + D7F14D3A57B1534B765AA4E9 /* res */, + A555FB4AFD31F904481AEF3C /* binding_test.cpp */, + 0BF4B487406238588B1E2E2F /* binding_test.h */, + 07D01593D99A6D465EBF7CCC /* cefclient.cpp */, + 3B15E335C3E87027FF66D749 /* cefclient.h */, + A7E5CBDB0B03EA4186699A8E /* cefclient_mac.mm */, + A5F1211ECDBE15E114653097 /* client_app.cpp */, + 1C275EF161AD18A51486855F /* client_app.h */, + 49C23F1EF21BEFFF47923163 /* client_app_delegates.cpp */, + 14ECE7D63EFCCBEE9F988D9C /* client_handler.cpp */, + 6CDFE332A71B9843DDFC84A0 /* client_handler.h */, + 059C98513FBDA8371C6B5F9D /* client_handler_mac.mm */, + 36E584D217689689EE7C0B2E /* client_renderer.cpp */, + 57A73EB7B742ECF9233F5E3C /* client_renderer.h */, + BAE4F34D8497504C8EA49C0A /* client_switches.cpp */, + 1A64382F7B0B236D969E4800 /* client_switches.h */, + 27A7579E4514158F63A538E1 /* dom_test.cpp */, + 639AAEAA42A9B69771AFDAE1 /* dom_test.h */, + DFD892EE828C7CED561FA451 /* process_helper_mac.cpp */, + 9BFDA1D8AF3C3A8C3A0DDA99 /* resource_util.h */, + 5E3EFC4ADFF566FEB0AAE6E4 /* resource_util_mac.mm */, + 712BB594138FAD0EA6092CB9 /* scheme_test.cpp */, + 565D44D754C3A2BDA29B7E25 /* scheme_test.h */, + D4D09FA875F36BC20589A971 /* string_util.cpp */, + 8F4A872B2216AC98AC00121B /* string_util.h */, + 42B0A821229EFB10F968E57F /* util.h */, + ); + path = cefclient; + sourceTree = ""; + }; + 3A4A3FDCBBE2EA1F0710DC54 /* grit */ = { + isa = PBXGroup; + children = ( + 9EACAEEEA145DFC35216514B /* ui_resources_standard.h */, + ); + path = grit; + sourceTree = ""; + }; + 3AF23DDB112C563E6F66BFA2 /* Products */ = { + isa = PBXGroup; + children = ( + DA0A21F8A0EAAC0756DC19D5 /* libjsoncpp.a */, + ); + name = Products; + sourceTree = ""; + }; + 3CBEE1BCA0F7BC9250684D95 /* Products */ = { + isa = PBXGroup; + children = ( + BC8AF58C370537486626D135 /* libflac.a */, + ); + name = Products; + sourceTree = ""; + }; + 3CEE93E380722D95E8075888 /* Products */ = { + isa = PBXGroup; + children = ( + BD2D7D254989E0B420EC6779 /* libgl_wrapper.a */, + ); + name = Products; + sourceTree = ""; + }; + 3D0AB27073899706187D4089 /* Products */ = { + isa = PBXGroup; + children = ( + 77967929794A8C9FAF7C3650 /* libspeech_proto.a */, + ); + name = Products; + sourceTree = ""; + }; + 3DB8F85FED6260396DE5A06B /* capi */ = { + isa = PBXGroup; + children = ( + 4B4010CB2AD4974D4C8F8DC8 /* cef_app_capi.h */, + 3C894B3DABF6A17A1BA3CB68 /* cef_base_capi.h */, + 1A5CFC73A744B2F9E3DBEC2E /* cef_browser_capi.h */, + 50066846B94BBDC728831F61 /* cef_browser_process_handler_capi.h */, + 746B2C1A2751D807C992896A /* cef_callback_capi.h */, + 3DB9E8B5EE2C9759E6EA76F6 /* cef_client_capi.h */, + 57660E666F3E2F8437F136E7 /* cef_command_line_capi.h */, + 3BAFE6C07BA55E84B964C109 /* cef_context_menu_handler_capi.h */, + B44E71F696B42050FD0ACE2C /* cef_cookie_capi.h */, + 3ED85DBA0FE48F4029D02617 /* cef_display_handler_capi.h */, + EBF5C06D8AC6121BFEF66A5F /* cef_dom_capi.h */, + A8443181D36AE126CFADAC75 /* cef_download_handler_capi.h */, + FA58F4443A2BB8AB58939899 /* cef_download_item_capi.h */, + 6BA5FC1DD74344A5BE308E65 /* cef_focus_handler_capi.h */, + 8DD5724290D4064CB1982F99 /* cef_frame_capi.h */, + 298E681B338969706F4D6E75 /* cef_geolocation_handler_capi.h */, + 8E14B6DD6174354A3AA97B3C /* cef_jsdialog_handler_capi.h */, + 0BB13BD19ADF478AB8D63F81 /* cef_keyboard_handler_capi.h */, + 31C96610709A0280F2673DD6 /* cef_life_span_handler_capi.h */, + 2C46051D65EF1F90D34F4D23 /* cef_load_handler_capi.h */, + 29F76CC8AE36885C4BFA2891 /* cef_menu_model_capi.h */, + 048991D7CE055E48525043FB /* cef_origin_whitelist_capi.h */, + 28BCD824953EF6C08B5C9158 /* cef_path_util_capi.h */, + 5BBDA43E2EEAC35BBC7E9207 /* cef_process_message_capi.h */, + A40423FE7F5F0631781C1E2D /* cef_process_util_capi.h */, + 62E38C90F6ACF232E9540430 /* cef_proxy_handler_capi.h */, + 7B65E2D31221886EBDF33C1E /* cef_render_process_handler_capi.h */, + EE7857FFF9A4D9C66BB38F61 /* cef_request_capi.h */, + E01020EC056D3010F006EF72 /* cef_request_handler_capi.h */, + 748471578ED2BCF616FE627B /* cef_resource_bundle_handler_capi.h */, + 604AD17ACC7B9777DE1303D5 /* cef_resource_handler_capi.h */, + C725996ECD3353F9AF70492D /* cef_response_capi.h */, + CB5EA804FCBC0FD14C48C9EA /* cef_scheme_capi.h */, + EEA50A31F48D9F26C2270EC4 /* cef_stream_capi.h */, + 50B64687B1239AFA23F8E464 /* cef_string_visitor_capi.h */, + 3F3E5D65FBA53AD358596510 /* cef_task_capi.h */, + DC2F637745D18676B250F4D7 /* cef_url_capi.h */, + 6E2EF60B78CBC85EA7267E5B /* cef_urlrequest_capi.h */, + 5F7BB33A9B300F224F9555C9 /* cef_v8_capi.h */, + DACC26B506287FD5B8026671 /* cef_values_capi.h */, + 0D452EDDF4C4CC7A41ADA11A /* cef_web_plugin_capi.h */, + 806ECE12D0E1388D810EAFB6 /* cef_xml_reader_capi.h */, + 26467F2D5FE71216BABF0212 /* cef_zip_reader_capi.h */, + ); + path = capi; + sourceTree = ""; + }; + 3ED2B5AE87A1D0442B901B78 /* Products */ = { + isa = PBXGroup; + children = ( + EE5959986B547B1347497441 /* libspeex.a */, + ); + name = Products; + sourceTree = ""; + }; + 3F0AA54C36F7A9444E4F42A4 /* Products */ = { + isa = PBXGroup; + children = ( + DF39FC582E99207308E5F0D3 /* libwtf.a */, + ); + name = Products; + sourceTree = ""; + }; + 409AD3F02306C0F01E7873E4 /* include */ = { + isa = PBXGroup; + children = ( + 3DB8F85FED6260396DE5A06B /* capi */, + CBDA1C3CE0298FB688E9410E /* internal */, + C1AB6355ED72CA74482BA6B4 /* wrapper */, + 24048A9014E601FAE7887602 /* cef_app.h */, + A723747B248AA1603A6105B5 /* cef_application_mac.h */, + 9E5BA8A7091C891C1E9C1E67 /* cef_base.h */, + 6CEE8EFAD8AE1F9992935CB5 /* cef_browser.h */, + BDE38BE54F98960C8533F1FB /* cef_browser_process_handler.h */, + F64D7374F957B22800459379 /* cef_callback.h */, + 03993E37BA0957D7AD5851EE /* cef_client.h */, + DAE1F7666030E9B8391D3447 /* cef_command_line.h */, + 5EB77B80F2135DA9BDEE4387 /* cef_context_menu_handler.h */, + 32E78C47B68A966E2251645E /* cef_cookie.h */, + 8170973032F443C76652C300 /* cef_display_handler.h */, + 88E59696A3A0233E5E0F880F /* cef_dom.h */, + 4F0955093BC13E5E2267CBBC /* cef_download_handler.h */, + 120B6AF524D6BA1589FD601A /* cef_download_item.h */, + BD3AEF39973333594B3AF33E /* cef_focus_handler.h */, + E6BB666763D7433F2BA744AE /* cef_frame.h */, + 03E168B20BA32B8A31F1C5C0 /* cef_geolocation_handler.h */, + 065F518B3E8F22E177526086 /* cef_jsdialog_handler.h */, + 9F5671B07D6ECD145A54BCAF /* cef_keyboard_handler.h */, + F43F8E52BD7A46794874EAA3 /* cef_life_span_handler.h */, + EDC1E2A49F77A73C8F4D1725 /* cef_load_handler.h */, + 0E111B6033380EFB8FAD197A /* cef_menu_model.h */, + 3289C0F1EBDFDB24A36905AC /* cef_origin_whitelist.h */, + 160697CEA26EA817C61CEF0B /* cef_pack_resources.h */, + 476478BD89A27581DFA1369F /* cef_pack_strings.h */, + A0ED4067E8EF944312A58B3B /* cef_path_util.h */, + A2248098B30E4E5EB34CC368 /* cef_process_message.h */, + 610B4D7BD43F5228DDA22ED7 /* cef_process_util.h */, + 2DD425A12F28FEF717511181 /* cef_proxy_handler.h */, + 486CCA5D23871D838C4679B9 /* cef_render_process_handler.h */, + 0DD56C161B0CA9D5F9D7C0CE /* cef_request.h */, + D768A135320ECA4D23B837A2 /* cef_request_handler.h */, + D76B4B028759943E0918DA1F /* cef_resource_bundle_handler.h */, + 77394B70985CB75AE307ED79 /* cef_resource_handler.h */, + ECCC851AC8F72EDFC2B2F981 /* cef_response.h */, + 81E23DC5D3BDCD65A0767A73 /* cef_runnable.h */, + 28E1959412BAB2B5F1226BCD /* cef_scheme.h */, + 3640DD4BA47FFCE38CB2153D /* cef_stream.h */, + 27F20B4EA7E219C534D26F81 /* cef_string_visitor.h */, + 500B6AC913CA493D51567061 /* cef_task.h */, + 78D08A88F7CD548C7B49CC11 /* cef_url.h */, + F28572D01F13C0A3F8644679 /* cef_urlrequest.h */, + BCB5DD2EA2599FC9420529FC /* cef_v8.h */, + 6A5D0244576BE203CC940B0F /* cef_values.h */, + A37B1202E9711AA83BFEA7FF /* cef_version.h */, + 02193627E8FF79BCD0817B49 /* cef_web_plugin.h */, + 59794A1EE30CB19313E4C75C /* cef_xml_reader.h */, + 63D5643A6EAC02B3D51EDFBB /* cef_zip_reader.h */, + ); + path = include; + sourceTree = ""; + }; + 4399DC192342F10F75990BC7 /* Products */ = { + isa = PBXGroup; + children = ( + 217AE35B8A9BA24CD3E26EFA /* Atom.app */, + 335F63827821FB9FB71D0599 /* cefclient.app */, + 60FDBC13FBB130A5982C0CC1 /* cef_unittests.app */, + 6E33046A4EDB56251FF60662 /* libcef.dylib */, + 9BDB4C89AB31661B24EC5AD7 /* libcef_dll_wrapper.a */, + 3555939C4755250EAA5AE2D0 /* libcef_static.a */, + 9F7159CBC485389851637A19 /* Atom Helper.app */, + E5BBF422E9D920423158F973 /* cefclient Helper.app */, + E0F66F6372DC53DDA571C522 /* cef_unittests Helper.app */, + ); + name = Products; + sourceTree = ""; + }; + 441C0A99B45B946641BC3BBE /* unittests */ = { + isa = PBXGroup; + children = ( + C1944C487F3CD8F951613556 /* mac */, + 9084B9878C73E390FE28F4EA /* client_app_delegates.cc */, + 1EB563F48D15B2AA41F39E0B /* command_line_unittest.cc */, + 46D7068EB7F17F74723CA1B7 /* cookie_unittest.cc */, + 5E46501D71E2CB64BE224B5D /* dom_unittest.cc */, + 52AC11600DD3A1C9B6499C87 /* jsdialog_unittest.cc */, + 9AA86EF695031C709EB48301 /* navigation_unittest.cc */, + 01C9A4CE5FB2EEC5EAA9CD29 /* process_message_unittest.cc */, + 6C06B951A9E79A8C04E770F1 /* request_unittest.cc */, + 9512A66AA48EE8FDA49979EE /* run_all_unittests.cc */, + 9AD2908E3E658119AC780B55 /* run_all_unittests_mac.mm */, + 5F4B6A88DBE351CE983397EB /* scheme_handler_unittest.cc */, + BC37FEDFB68554AC40F1927E /* stream_unittest.cc */, + 2DA4661D161001F0020E73D6 /* string_unittest.cc */, + 0CE409DD2BCB2D7EA19F1BE4 /* test_handler.cc */, + B897373CE0763F38BC8B6005 /* test_handler.h */, + 7B741C9DBC45EA55A3B1B633 /* test_suite.cc */, + BFEE9C961095CBD3A6F6BF12 /* test_suite.h */, + BFBC5D3F9539F3DEB423BC07 /* test_util.cc */, + 6CE1EC98D36F4A66660D5948 /* test_util.h */, + 8E7F353C35FE393BB527D3D4 /* url_unittest.cc */, + 24479F1AE7EB2CCF6878BC67 /* urlrequest_unittest.cc */, + C05CB3D9668BCF524D725D80 /* v8_unittest.cc */, + CAD0608CFCF60C55553960B9 /* values_unittest.cc */, + 6B5367A2A25C39A54B3D8E29 /* xml_reader_unittest.cc */, + 9AC1D088FA80D3B2A81ECBA2 /* zip_reader_unittest.cc */, + ); + path = unittests; + sourceTree = ""; + }; + 459B34C3F365205D9921340A /* policy_templates */ = { + isa = PBXGroup; + children = ( + CE30A9051DCD5A462900CCE9 /* writers */, + 43FC311667CE29FE323BFE5D /* PRESUBMIT.py */, + 81083F64C1E316C4C7B97590 /* __init__.py */, + A257D2FA79DFA717AA262734 /* policy_template_generator.py */, + 24B5217D196DBD2A39619EED /* policy_template_generator_unittest.py */, + 1B4EEB952256F5695BBE679E /* template_formatter.py */, + 13DA98F0EC61DC95C724F028 /* writer_configuration.py */, + ); + path = policy_templates; + sourceTree = ""; + }; + 4775637EAF397760DEB2DA71 /* content */ = { + isa = PBXGroup; + children = ( + 6F87F327FD0E73C3845F1955 /* grit */, + 2D0218D9DF2BD9D2F1CC3768 /* content_resources.pak */, + ); + path = content; + sourceTree = ""; + }; + 4AF90D72B04F524EF024F0B4 /* Products */ = { + isa = PBXGroup; + children = ( + E37BA3D3C92CCF19ACA1B9BC /* libpreprocessor.a */, + 6EC88F387B997B180C0EC59D /* libtranslator_common.a */, + 49FDFDC518AA7089085453C4 /* libtranslator_glsl.a */, + ); + name = Products; + sourceTree = ""; + }; + 4B8640B24DEEFFAECF63C786 /* Products */ = { + isa = PBXGroup; + children = ( + 77B8699CF89F70FBB168FD2F /* libsql.a */, + 16FE174CC7907A923C79B6AD /* sql_unittests */, + ); + name = Products; + sourceTree = ""; + }; + 4C21317EE939F489BFA80C9A /* third_party/mozilla */ = { + isa = PBXGroup; + children = ( + FFD6F05FCEF91D95328C97C9 /* NSString+Utils.h */, + 2486CD197F535BFE0E1F6A78 /* NSString+Utils.mm */, + 9BBD0B469DFDB884D93F96E4 /* NSURL+Utils.h */, + F2DBCDF72B85E19AD64FB768 /* NSURL+Utils.m */, + ); + path = third_party/mozilla; + sourceTree = ""; + }; + 4F29216594804409F75AE9B5 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 83A8EF06FD1C6CF08CBCBE1B /* Accelerate.framework */, + E2BAA234A2BE8017D226EDD3 /* AppKit.framework */, + E8B06DADDF85D240BCDEAD72 /* ApplicationServices.framework */, + A68D29BEFC7E90D722724A31 /* AudioToolbox.framework */, + 18F5B503F5681FCA9989BC95 /* AudioUnit.framework */, + 8817D7F4FBBA2D42EF516513 /* Carbon.framework */, + F727DE03E5EC9D7208861E7A /* CoreAudio.framework */, + F2C9D770BB176067208708D2 /* CoreFoundation.framework */, + 55E5C055CA03407284B1E92C /* CoreServices.framework */, + 4F81A5C061994A3CF973DCD9 /* CoreVideo.framework */, + 57A26B6D62FCA51F8C4DC37D /* Foundation.framework */, + 261D817CE1958F87B4F02BF4 /* IOKit.framework */, + 4E2E4DD63F79536D568A7268 /* OpenGL.framework */, + 767F7EE6C0A57FDC0A2BCF1C /* QTKit.framework */, + C82AFEAEA3B4F9DC13CADFC9 /* QuartzCore.framework */, + 511EC264157FFCCDE8CCC1C2 /* Security.framework */, + 679EE00993C436A33C876FE8 /* SystemConfiguration.framework */, + 96B6939FEEAE9C41E03CC563 /* libWebKitSystemInterfaceLeopardPrivateExtern.a */, + 427D3A7ABEF53DE52685F32F /* libcups.dylib */, + 648CCECC870023D06F575757 /* libresolv.dylib */, + ); + name = Frameworks; + sourceTree = ""; + }; + 5199EDCB7025F0E2B22B8D70 /* ui_resources */ = { + isa = PBXGroup; + children = ( + 6FED8DB9C40740CC8B6E32ED /* grit */, + FD4E83BB8718A54254419599 /* ui_resources.pak */, + ); + path = ui_resources; + sourceTree = ""; + }; + 522233B92E9BC54056C720A5 /* Products */ = { + isa = PBXGroup; + children = ( + 4965FA5E4825686FE1C34124 /* libv8-i18n.a */, + ); + name = Products; + sourceTree = ""; + }; + 524BF9BB09F0FBBD3F465B97 /* Products */ = { + isa = PBXGroup; + children = ( + E65826B5F5DCCEDCB9302BAC /* libwebkit.a */, + ); + name = Products; + sourceTree = ""; + }; + 55D65E95E695280545C49BFB /* Products */ = { + isa = PBXGroup; + children = ( + A10A80D34F695765402364FE /* libwebkit_platform.a */, + ); + name = Products; + sourceTree = ""; + }; + 5608C9478BD1D9667139A2FE /* mac */ = { + isa = PBXGroup; + children = ( + 5613ACDDE51DE1A506D91AE5 /* Info.plist */, + 8C0268548C079EBC071390BF /* InfoPlist.strings */, + 880329B56217F29FD88D58FE /* MainMenu.xib */, + 4FB77434E9211D828D8900D7 /* cefclient.icns */, + ); + path = mac; + sourceTree = ""; + }; + 5AFA5FE5BC503EC78D05F0CA /* ctocpp */ = { + isa = PBXGroup; + children = ( + 3C39C0CA9179567B35023165 /* app_ctocpp.cc */, + B65C386A4D3A2F46DACFEC63 /* app_ctocpp.h */, + 4529EA2982A94B6A373FEBF8 /* auth_callback_ctocpp.cc */, + 79DA1DA7F891159BACFC01F9 /* auth_callback_ctocpp.h */, + D4583E529523A3C1F0D38D95 /* base_ctocpp.h */, + 007F191CDADBB6B9DE99848F /* before_download_callback_ctocpp.cc */, + 1EB03115DE936B3FC248AB72 /* before_download_callback_ctocpp.h */, + 155206012707A590F898972B /* binary_value_ctocpp.cc */, + 7DF1D2D0221960F8BFD30EEE /* binary_value_ctocpp.h */, + C74DC68884C27EA075179638 /* browser_ctocpp.cc */, + 037D7D3E4B2DD1EF60ED4BEA /* browser_ctocpp.h */, + 93D902B73577832D18BF75BB /* browser_host_ctocpp.cc */, + AD4579C0BE099BC334661482 /* browser_host_ctocpp.h */, + 06C15E96A6E8E4C3CBE2895B /* browser_process_handler_ctocpp.cc */, + 000B84635289D69B3D86B827 /* browser_process_handler_ctocpp.h */, + 91E2C46974E5764CA2E00400 /* callback_ctocpp.cc */, + 646366A7F1714B899E3340BA /* callback_ctocpp.h */, + E1F92A687AF6981AE53D2B53 /* client_ctocpp.cc */, + 1037A328AAB20BB9F7CAE553 /* client_ctocpp.h */, + F70B20347C5192B800603656 /* command_line_ctocpp.cc */, + 5AD9CBEEB6751780A250053B /* command_line_ctocpp.h */, + 3D51C5F18F401B6CDA5A660F /* context_menu_handler_ctocpp.cc */, + 28A442512D6FDA74492B0849 /* context_menu_handler_ctocpp.h */, + 1D9B27BE6DA55ACB43ED477A /* context_menu_params_ctocpp.cc */, + 35FBEC5C8B25A9F051B48A4D /* context_menu_params_ctocpp.h */, + 40084DD23D8A663A21AFEE0F /* cookie_manager_ctocpp.cc */, + 8CB4088B971ED0D651106CD1 /* cookie_manager_ctocpp.h */, + CB90EDB889CFB9BDAC13A0FD /* cookie_visitor_ctocpp.cc */, + 2D7ECB9F3062F8D36F88D925 /* cookie_visitor_ctocpp.h */, + 92563765E3EC9386F575B2E5 /* ctocpp.h */, + 08623EC0BFEEA2B84E7943FF /* dictionary_value_ctocpp.cc */, + 922A9087E94112E092CFF3D5 /* dictionary_value_ctocpp.h */, + 112B6763C9E7B43E077673E3 /* display_handler_ctocpp.cc */, + EFB261248F2CA9D5DA266A00 /* display_handler_ctocpp.h */, + 8FAB2B3DA1D71DE9B41ED544 /* domdocument_ctocpp.cc */, + EF34543C9A167C6FF768DCAE /* domdocument_ctocpp.h */, + D6354F773C04C1B426CEF241 /* domevent_ctocpp.cc */, + 78A73BE9C6C0FCF92CB7CB09 /* domevent_ctocpp.h */, + 0A2108D276F821F2D9E1EA10 /* domevent_listener_ctocpp.cc */, + 88E0D3C1C49E1286F9B4ED96 /* domevent_listener_ctocpp.h */, + 9F34C73D7E412A438C0810ED /* domnode_ctocpp.cc */, + B4C774A7C430830E8E30CDC9 /* domnode_ctocpp.h */, + 8C0C651ED6C209FA6A64751A /* domvisitor_ctocpp.cc */, + F76F445CF005C79B3ED25F86 /* domvisitor_ctocpp.h */, + 99A3E952F601D81D63364C9E /* download_handler_ctocpp.cc */, + 60500211E4E81B16B827F3A8 /* download_handler_ctocpp.h */, + C559AD44464C4C17590FDEA6 /* download_item_callback_ctocpp.cc */, + 8105CA51505C648E67552EC4 /* download_item_callback_ctocpp.h */, + 029D01F5660890E5E63D2E00 /* download_item_ctocpp.cc */, + A722D7364A5D7B7D04F322B1 /* download_item_ctocpp.h */, + 47A2DB909734C51FF232F713 /* focus_handler_ctocpp.cc */, + 5323D57C484D43060D172B7C /* focus_handler_ctocpp.h */, + D5B5990FC45DD1B69097F780 /* frame_ctocpp.cc */, + EAF32C2CB8FDEFDC6747000F /* frame_ctocpp.h */, + 24579E9B79C662488A6C4DA6 /* geolocation_callback_ctocpp.cc */, + AED67CD0D4C3055B1611DCA5 /* geolocation_callback_ctocpp.h */, + B5F1C4FA587CC89476D82E5F /* geolocation_handler_ctocpp.cc */, + 258191CFC8F133D6A1577F7E /* geolocation_handler_ctocpp.h */, + B203C1CF711EDC0366E714FB /* jsdialog_callback_ctocpp.cc */, + 86F590426D755AA5BA84C09E /* jsdialog_callback_ctocpp.h */, + 561BF6A655EF750B0F26C0F7 /* jsdialog_handler_ctocpp.cc */, + A837398CF32BE95F9B8C6CC2 /* jsdialog_handler_ctocpp.h */, + 7F1DCC53C9DB0A1C4F1ECE2C /* keyboard_handler_ctocpp.cc */, + 861B32FB07E1CC6FE369E3C6 /* keyboard_handler_ctocpp.h */, + 8C92E6384542431595EF50A7 /* life_span_handler_ctocpp.cc */, + 7074163F5AAED437A99C2E10 /* life_span_handler_ctocpp.h */, + 72540D05FC3553AD383B2F3F /* list_value_ctocpp.cc */, + 710DB1EC856181BE60FC17CC /* list_value_ctocpp.h */, + 4250DE201EE11DF56C6BA191 /* load_handler_ctocpp.cc */, + 1B34D9CA1FF0A85F4E51BE1F /* load_handler_ctocpp.h */, + 54E670EE54F4600111F1A3BE /* menu_model_ctocpp.cc */, + 750C4EE3154FC1DDFA918C65 /* menu_model_ctocpp.h */, + 6EDDEACC058D3A3FC188F4BC /* post_data_ctocpp.cc */, + 79D9F5E9B68280119AB412F5 /* post_data_ctocpp.h */, + 621C08700150DEB6EBBBF8CC /* post_data_element_ctocpp.cc */, + 7B45BEE2E7E45FA556D3FC44 /* post_data_element_ctocpp.h */, + 47F9DE33B3520A33631E64E7 /* process_message_ctocpp.cc */, + 954C19699583BDE91C91EAD1 /* process_message_ctocpp.h */, + A70A59BED39A129DB3674488 /* proxy_handler_ctocpp.cc */, + EC0822A9679CEA8BB6D488D7 /* proxy_handler_ctocpp.h */, + A7A7E4D5F6C691F87DADD0CC /* read_handler_ctocpp.cc */, + B6BCD87C8E9E2C07AAC3C15D /* read_handler_ctocpp.h */, + EF4166854E3E8459757D0E2F /* render_process_handler_ctocpp.cc */, + A35179157274998BF0E609EC /* render_process_handler_ctocpp.h */, + D0E01ECF64FCF571173DCD92 /* request_ctocpp.cc */, + 66321C17937EFD7899A0C371 /* request_ctocpp.h */, + A5189377EEEF134DACA8E6A3 /* request_handler_ctocpp.cc */, + 94BB6DD0AB6105482AF28EEC /* request_handler_ctocpp.h */, + 15D1A25A73657683C2B5B1A2 /* resource_bundle_handler_ctocpp.cc */, + 80945157DB28BE61632B1E36 /* resource_bundle_handler_ctocpp.h */, + 5B6A2744649C07D4164F6649 /* resource_handler_ctocpp.cc */, + 8203F74736B14AD3D84B5215 /* resource_handler_ctocpp.h */, + 37EEED859E375D03300DA2E2 /* response_ctocpp.cc */, + 4AAF21B270EDC337AAB2A1BC /* response_ctocpp.h */, + 22912DF4A93A53C0E7D2C576 /* scheme_handler_factory_ctocpp.cc */, + 0B24DFC2B43AF06D76BD63EC /* scheme_handler_factory_ctocpp.h */, + 75D67087AD73BEE4616C28F1 /* scheme_registrar_ctocpp.cc */, + DEF73970376FB40B6877E899 /* scheme_registrar_ctocpp.h */, + C1DD696D83AAACE47751B405 /* stream_reader_ctocpp.cc */, + 4AC4CE6DD815BB901C3108F5 /* stream_reader_ctocpp.h */, + F24BB8C67FE764F01DFBF960 /* stream_writer_ctocpp.cc */, + 972C388FC6C6D3094DB8E222 /* stream_writer_ctocpp.h */, + CE807F315C4A3B2A084C3D77 /* string_visitor_ctocpp.cc */, + 6B3D4F2A31928792F3A97970 /* string_visitor_ctocpp.h */, + C1676097512A3D9E2D02B869 /* task_ctocpp.cc */, + 9B828287DA08C00BF1CBA0BC /* task_ctocpp.h */, + 111B057CA2C89F67064CCB20 /* urlrequest_client_ctocpp.cc */, + DCC7D766A8EC8756A8376CB3 /* urlrequest_client_ctocpp.h */, + 1F637E97023288AC42336958 /* urlrequest_ctocpp.cc */, + 3F39DB28B8AD57286FA171CB /* urlrequest_ctocpp.h */, + F68051B3A28DAA052B15A469 /* v8accessor_ctocpp.cc */, + 2F9C3E04A4E35C45B630AEC3 /* v8accessor_ctocpp.h */, + 9DE09E60E64A6105D0908294 /* v8context_ctocpp.cc */, + EB09904B2159F7256690EB9A /* v8context_ctocpp.h */, + C180ABF4001443F7384CEAC7 /* v8exception_ctocpp.cc */, + 4FF6DCE2C8423908E6D32EFA /* v8exception_ctocpp.h */, + 021BD3DBAAA1DBFB8232B9C5 /* v8handler_ctocpp.cc */, + 3BF77612B9FEC6BF25A6058B /* v8handler_ctocpp.h */, + C5F9DE1CFBD858D7865444CF /* v8value_ctocpp.cc */, + 59C38FB9F040D2D6A36C9F79 /* v8value_ctocpp.h */, + BF8FBF76D26F678D79319E7F /* web_plugin_info_ctocpp.cc */, + D2145AD48706B90529681EE2 /* web_plugin_info_ctocpp.h */, + C2FB942E1079C9642625957C /* web_plugin_info_visitor_ctocpp.cc */, + 617F27E76D033D2C52956AB8 /* web_plugin_info_visitor_ctocpp.h */, + D39A9A62C445BA011E1163D3 /* write_handler_ctocpp.cc */, + 3E5A0154F0820BB645B7B043 /* write_handler_ctocpp.h */, + DD3F14826655E3055F273989 /* xml_reader_ctocpp.cc */, + CA2838C0FB67F18D5C4135A6 /* xml_reader_ctocpp.h */, + 9CF13FE6393B8398A8AA18AC /* zip_reader_ctocpp.cc */, + 7657BFF87514B88894C02714 /* zip_reader_ctocpp.h */, + ); + path = ctocpp; + sourceTree = ""; + }; + 5DCFD674AFE14452D5CE8922 /* Products */ = { + isa = PBXGroup; + children = ( + FC0BA8C2E6DAEBB62B81A46E /* libvideo_engine_core.a */, + ); + name = Products; + sourceTree = ""; + }; + 6151DE280D4DF3FBC2477A56 /* net */ = { + isa = PBXGroup; + children = ( + 7896266262B7C669DAF9D148 /* grit */, + C879B7C07DD025F3BFAD2E92 /* net_resources.pak */, + ); + path = net; + sourceTree = ""; + }; + 625356F8D3FBA28D8CB3DE44 /* Products */ = { + isa = PBXGroup; + children = ( + A6EA5F801A212058E50C26BB /* libvoice_engine_core.a */, + ); + name = Products; + sourceTree = ""; + }; + 633FC56C3A41DEE4B57061F7 /* Build */ = { + isa = PBXGroup; + children = ( + 8AED9F7315C52F2A620486CD /* cef.gyp */, + B69A86A21D00AEECBFB9E0FC /* cef.gypi */, + 201DD4C6FAF3E4CE86D37388 /* cef_paths.gypi */, + 6EFE5DB322697063C5273BB5 /* cef_paths2.gypi */, + 335ADC702C533D5F128D5BA7 /* common.gypi */, + C7A48623E5586F1836DFC472 /* filename_rules.gypi */, + 2EC90772970F0A499BBC2294 /* grit_action.gypi */, + 2A80AEB3699E699F41429EC0 /* grit_target.gypi */, + 4C2E0E8BAE74F157CF8DE872 /* release.gypi */, + C84B4501D7B29FD743E409F7 /* release_defaults.gypi */, + 8979600041C4474AD19BD3DC /* release_impl.gypi */, + B490B040DFADA86C197F241E /* release_impl_official.gypi */, + ); + name = Build; + sourceTree = ""; + }; + 64CB63653C02F587F8F252D9 /* node */ = { + isa = PBXGroup; + children = ( + B8A81CA70F9812EE610BBF4C /* custom */, + 1E9256FD015F259D83BC5F28 /* __init__.py */, + C723B94B88820ECB9B238D97 /* base.py */, + 64D04DE76C59E3FB85DFA72C /* base_unittest.py */, + 82D9267508954B762CA4DA09 /* empty.py */, + 3AE54F845BE947BBE2F671CD /* include.py */, + 72C7E6EF7FA246FD7F6588CA /* io.py */, + BE9875EC6BFE09D36368B549 /* io_unittest.py */, + BDC86D60E98ED367A18F3FF0 /* mapping.py */, + 5E15A40C287847BB8E1910B1 /* message.py */, + C67EF82BBCE5A044D2A565F8 /* message_unittest.py */, + 72F60CEAFFDEE60993320A54 /* misc.py */, + 6FCE946FA0283D08BACC1771 /* misc_unittest.py */, + 084B8EA24DF5DF1571DE7137 /* structure.py */, + 38A059AD263AA05F79A8D5E8 /* structure_unittest.py */, + A0D6B5F3B9D45FF5550586F2 /* variant.py */, + ); + path = node; + sourceTree = ""; + }; + 65CE2FCEC207BBF0A8C37B4B /* Products */ = { + isa = PBXGroup; + children = ( + F80EA39EE90B63653656CFE7 /* libappcache.a */, + 67F31BA941D7E94E56456F3B /* libblob.a */, + 6454259BDFA3FECE94D1C1AE /* libdatabase.a */, + 6C2F171B97F577E374A8FAA5 /* libdom_storage.a */, + 035C1AFA36256CDAE5AB3302 /* libfileapi.a */, + A4D2CF33E3C3DAB91EDF8525 /* libwebkit_user_agent.a */, + C8E96D60D671FC45CD96BAC3 /* libglue.a */, + 2C1351997F60F82884D6DAC4 /* libwebkit_gpu.a */, + 8B282EDEF149A2A957FC5891 /* libwebkit_media.a */, + 34087D210DD3578FDC3F4176 /* libquota.a */, + 92D8EE4C39482EEDE27C545D /* libwebkit_support.a */, + 50795C98B83A7CE571E4664B /* libwebkit_support_common.a */, + F01AB71003340479A007B9FD /* libwebkit_support_gfx.a */, + ); + name = Products; + sourceTree = ""; + }; + 6763286823A1AD1CFC80FF11 /* app_locale_settings */ = { + isa = PBXGroup; + children = ( + EF7EA3D6FCFE4AE5044B2703 /* app_locale_settings_am.pak */, + A0FAA9FA17E7293DE5B0C4BC /* app_locale_settings_ar.pak */, + ED289D8FDDC0EF6873A96A45 /* app_locale_settings_bg.pak */, + 62BD83A69788540F5493CC6D /* app_locale_settings_bn.pak */, + C43E59B4E40FDD94C723B8EF /* app_locale_settings_ca.pak */, + ECFF6AE05958481BFD540AF3 /* app_locale_settings_cs.pak */, + 3D04DBAC9593A9461C8ACB56 /* app_locale_settings_da.pak */, + 04CFE5D5BE80944DAD609635 /* app_locale_settings_de.pak */, + AECC35F2345D9149FF77702D /* app_locale_settings_el.pak */, + 4EFD9E6CCD9D5AE5E19CBE7B /* app_locale_settings_en-GB.pak */, + 387E6456D80AA7C58C2C2D83 /* app_locale_settings_en-US.pak */, + 858C2D5C8CC42547CFC86498 /* app_locale_settings_es-419.pak */, + 36A2BF77DDB0DD644017E2CE /* app_locale_settings_es.pak */, + 904D5B141FB66F69474E0938 /* app_locale_settings_et.pak */, + 189D9B41955B28070345E46F /* app_locale_settings_fa.pak */, + 903BF2598ED5B457D394EB6F /* app_locale_settings_fi.pak */, + DC4E795B2C67468CA528503C /* app_locale_settings_fil.pak */, + 2B63F6058224C1F0584B9A68 /* app_locale_settings_fr.pak */, + 00FF2D290B6BA4D912A7885D /* app_locale_settings_gu.pak */, + 0A93C66579AABB2144A11281 /* app_locale_settings_he.pak */, + 1B7235D5B6CB67E3830DF992 /* app_locale_settings_hi.pak */, + F889C65932D109B4889B4527 /* app_locale_settings_hr.pak */, + 33191A3C80EE9FADC9681AC1 /* app_locale_settings_hu.pak */, + D58DC93A21C48D816DFBE475 /* app_locale_settings_id.pak */, + EA9A5910453B8A43C9F864E2 /* app_locale_settings_it.pak */, + 7AF2CED60ABFFC142836AD41 /* app_locale_settings_ja.pak */, + 696A201AD5DADB31D39F9821 /* app_locale_settings_kn.pak */, + F50B75FA83AC81C592A04541 /* app_locale_settings_ko.pak */, + 86FD5E59321079A429D3F6A7 /* app_locale_settings_lt.pak */, + F9AA4C47866D58A55D89906A /* app_locale_settings_lv.pak */, + FB1E9137063AD67969F7C3F3 /* app_locale_settings_ml.pak */, + 618CA731E5FCE115CCD258F3 /* app_locale_settings_mr.pak */, + 621075EE773DB9ADF51EEFAE /* app_locale_settings_ms.pak */, + 08E26B4DF6F60A58CE5BCAD8 /* app_locale_settings_nb.pak */, + B5696836A233467D67F673DE /* app_locale_settings_nl.pak */, + FC77141AAC1ABB1E3D77BA33 /* app_locale_settings_pl.pak */, + DC64E025926A9B0590800B79 /* app_locale_settings_pt-BR.pak */, + FC70425D2E226756A6D1FCA6 /* app_locale_settings_pt-PT.pak */, + 6F607F245C208EB8A961B1F4 /* app_locale_settings_ro.pak */, + A1283A9BC3CE73AC0A600339 /* app_locale_settings_ru.pak */, + FA28652BC385FF946B57DA62 /* app_locale_settings_sk.pak */, + 7400FF71541B599F6E09045A /* app_locale_settings_sl.pak */, + FB531305A4122266E639EA1A /* app_locale_settings_sr.pak */, + AC352D25857DC066957F0709 /* app_locale_settings_sv.pak */, + B5BA3FB0EC2E38F37831385C /* app_locale_settings_sw.pak */, + 6EBBB1D6E6BAD26E07BFF9F2 /* app_locale_settings_ta.pak */, + B79BFA0947C8B3B8648E52C2 /* app_locale_settings_te.pak */, + 50FDEBC89683ECEDA4ADB6A8 /* app_locale_settings_th.pak */, + 624D01F77B976B95E0FAC6E8 /* app_locale_settings_tr.pak */, + 0937034213F2744D0E0E7317 /* app_locale_settings_uk.pak */, + AAD317264CD53F09AB75F53F /* app_locale_settings_vi.pak */, + 0518EC34271437784B0CF75D /* app_locale_settings_zh-CN.pak */, + 1B2DDB258AEDB8CF0321091C /* app_locale_settings_zh-TW.pak */, + ); + path = app_locale_settings; + sourceTree = ""; + }; + 68557FAACEC86438309583C8 /* tools */ = { + isa = PBXGroup; + children = ( + 090865B9B17F24959C44BA28 /* make_pack_header.py */, + 69C419E03B9AAA605E8ED2DA /* repack_locales.py */, + ); + path = tools; + sourceTree = ""; + }; + 696BE6E415443CFDD08142A5 /* Products */ = { + isa = PBXGroup; + children = ( + 1F34CFD1E43CF0AD3D60FE45 /* libnet.a */, + A48CC24A6E16EDFACDF20C3C /* net_unittests */, + 55D519F24BC4D5CCFE6CB241 /* net_perftests */, + 3F4CEF83D8D4C2FDCC104362 /* stress_cache */, + 8725C0D8895B52CE87B9AE29 /* tld_cleanup */, + FE91E39839004AF69907B7A7 /* crash_cache */, + 4AD7CDE66D187C0F40782BF2 /* run_testserver */, + FFA0AC7FB9FD43ED5B983135 /* libnet_test_support.a */, + ACD648B6FF476EEF5D9024F6 /* gdig */, + 11577ADA978F291FD88572E3 /* fetch_client */, + 5FEB3CC6289A9674F13CC926 /* fetch_server */, + A1ED3E139080E96DF8598E9C /* libhttp_server.a */, + 7CF5A3CF60F25BA53D943E4D /* dnssec_chain_verify */, + 32814E763645F6CCB2CD720E /* crl_set_dump */, + 270F097F583DBB970DC90625 /* dns_fuzz_stub */, + ); + name = Products; + sourceTree = ""; + }; + 6AC0B3F3686943C881540614 /* Products */ = { + isa = PBXGroup; + children = ( + 5BB57088018F375BCDD62765 /* libharfbuzz-ng.a */, + ); + name = Products; + sourceTree = ""; + }; + 6CA7C7EBCDFF514D1291B57E /* Products */ = { + isa = PBXGroup; + children = ( + 25436BD64F6B22C9A36C0344 /* libffmpeg.a */, + D48B0CC2B1FE4D2EE9210079 /* ffmpegsumo.so */, + ); + name = Products; + sourceTree = ""; + }; + 6DCB4D40930F3E8F0137BEC9 /* Products */ = { + isa = PBXGroup; + children = ( + B8FF1DA4847671490A5DA716 /* libxslt.a */, + ); + name = Products; + sourceTree = ""; + }; + 6E95D63188E66A21B133C90F /* extern */ = { + isa = PBXGroup; + children = ( + 852E3E9379EE3E0A9039D014 /* BogoFP.py */, + EE8BBDFA9751E272EE4B6E34 /* FP.py */, + D1966077D7D68ADB63A785AC /* __init__.py */, + 737E0164E14751345C26E7B7 /* tclib.py */, + ); + path = extern; + sourceTree = ""; + }; + 6F87F327FD0E73C3845F1955 /* grit */ = { + isa = PBXGroup; + children = ( + A5BF66C52CD8EF1AFBE82C1D /* content_resources.h */, + ); + path = grit; + sourceTree = ""; + }; + 6FED8DB9C40740CC8B6E32ED /* grit */ = { + isa = PBXGroup; + children = ( + A21CFD1232932A6603B36EC5 /* ui_resources.h */, + ); + path = grit; + sourceTree = ""; + }; + 7273165156FF298450A1C2BB /* BUILT_PRODUCTS_DIR */ = { + isa = PBXGroup; + children = ( + 97982721950E57F089FF3B7B /* Atom Helper.app */, + 208F10822055563A9A88F9CB /* cef_unittests Helper.app */, + 58EAA82466055251156313DB /* cefclient Helper.app */, + 698C6F90A03997EC66CFABA1 /* ffmpegsumo.so */, + C14DAB1AAEA0039C4522CC2B /* libcef.dylib */, + ); + name = BUILT_PRODUCTS_DIR; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 745BB341F5095532FA4D7E24 /* Products */ = { + isa = PBXGroup; + children = ( + 10BC44DEA8FC22DDF2FA034F /* libgmock.a */, + 9427891299B218D591E06C60 /* libgmock_main.a */, + ); + name = Products; + sourceTree = ""; + }; + 758FB0F3586923B5D0B4AB0D /* cef */ = { + isa = PBXGroup; + children = ( + BBCD0828F4F33290CBAC58D3 /* grit */, + 8508EC329657CF53E16F1D01 /* cef_resources.pak */, + 28ECA57957568EE70BAF8F09 /* cef_strings_am.pak */, + EB7FB6461C4299EDEBC5FB83 /* cef_strings_ar.pak */, + BF4157E193A514990BDB20AE /* cef_strings_bg.pak */, + AE7F6C5060549B2F2D5041BA /* cef_strings_bn.pak */, + 88D2B183F026169B59F0AF61 /* cef_strings_ca.pak */, + 46281DC2D06840820B4EC4AC /* cef_strings_cs.pak */, + E779007C9491D76188594B0B /* cef_strings_da.pak */, + 8A1657A5074BE6A5ACFBDA57 /* cef_strings_de.pak */, + CFA1C64C814325D7DD4C85FD /* cef_strings_el.pak */, + 38290CC3CE5D634568EF6050 /* cef_strings_en-GB.pak */, + D8AEDA47EF0748D9516229F8 /* cef_strings_en-US.pak */, + BF50FF0DB30BF7D2462511D5 /* cef_strings_es-419.pak */, + B769E54AA8C8C34D387D1898 /* cef_strings_es.pak */, + 79CF4C48CC4458DFB82FF6A5 /* cef_strings_et.pak */, + DA02DB97CDBBED8E70C5719D /* cef_strings_fa.pak */, + 65EC939FBA72F086E83B5E67 /* cef_strings_fake-bidi.pak */, + D82A58B16F6BCCF2847EECBC /* cef_strings_fi.pak */, + A905BF58EB26153147FDE6F2 /* cef_strings_fil.pak */, + A71F417316E73DD2C81FA6F4 /* cef_strings_fr.pak */, + C5737F034076C86775D81DC5 /* cef_strings_gu.pak */, + B595AE41CCEEAF881800F919 /* cef_strings_he.pak */, + 87A4D3C6BA9F10864D1F273D /* cef_strings_hi.pak */, + 3C04F16E9C7F9976C62C5507 /* cef_strings_hr.pak */, + D9E3CB72823229E4998256E7 /* cef_strings_hu.pak */, + 7FF808AAC31F250C348EC7C4 /* cef_strings_id.pak */, + 4D235103EA04209B53D185B3 /* cef_strings_it.pak */, + E7A199FD70EE5ABD2D98FCCB /* cef_strings_ja.pak */, + D7AFDC016D372255D27E2AF7 /* cef_strings_kn.pak */, + A00B7334CB894C79096EA117 /* cef_strings_ko.pak */, + 4167C920D1424F0634762262 /* cef_strings_lt.pak */, + C30424C31D8FA81F08221280 /* cef_strings_lv.pak */, + 86184CB258BD6D57B44C5733 /* cef_strings_ml.pak */, + 523BF7F077DA578B4191F087 /* cef_strings_mr.pak */, + EB9A29E13E54ACE6B01072A8 /* cef_strings_ms.pak */, + 53488D368BB9562703A75203 /* cef_strings_nb.pak */, + E557EFD39B50172DFACD3CF6 /* cef_strings_nl.pak */, + D63E0F20DC3D5F422F238E99 /* cef_strings_pl.pak */, + 7617F7356CF67916645EB77F /* cef_strings_pt-BR.pak */, + DD4F39FDF92A279B445CB635 /* cef_strings_pt-PT.pak */, + A23E588983D78761008F698D /* cef_strings_ro.pak */, + A8C69E44BE827CD91CC1FD0D /* cef_strings_ru.pak */, + 847CD6CDF3ECAD677675D7AF /* cef_strings_sk.pak */, + 71F7F7EF3478453D96C1C5D7 /* cef_strings_sl.pak */, + A7326AE828A2573E6E9A3C1A /* cef_strings_sr.pak */, + 6B2EBA3530CDC6B770ADE84A /* cef_strings_sv.pak */, + FBB814347DC4A4175D6E4897 /* cef_strings_sw.pak */, + 44541A478EE0F105D27F1AF0 /* cef_strings_ta.pak */, + 26FED33C81845F6E153FDFC0 /* cef_strings_te.pak */, + 8F6D40B2CD10D34AD8F714F3 /* cef_strings_th.pak */, + 77447207CC3EC0AF7BB29C8F /* cef_strings_tr.pak */, + C6528F46F9707EA091C7262B /* cef_strings_uk.pak */, + 794985FF05FCCFB42BFAD90F /* cef_strings_vi.pak */, + 577E4529B37A372EC7982CCD /* cef_strings_zh-CN.pak */, + D9F48A2BC060CC7EF9C94F9D /* cef_strings_zh-TW.pak */, + ); + path = cef; + sourceTree = ""; + }; + 75F7B403FD5801BA5AFE0EB6 /* Products */ = { + isa = PBXGroup; + children = ( + ); + name = Products; + sourceTree = ""; + }; + 7604B20C2E3706D25B54F466 /* gather */ = { + isa = PBXGroup; + children = ( + 521CF1A5BF607EC6D5628149 /* __init__.py */, + E2C3BC0EFC15B0A091A108B9 /* admin_template.py */, + EC052161A1C3C55426875686 /* admin_template_unittest.py */, + 255110884F82A5FF3A20FA2D /* chrome_html.py */, + 7D4274E53C774448014738F7 /* chrome_html_unittest.py */, + 70459A5B49BE23629CC0DBC4 /* chrome_scaled_image.py */, + FE646E557D4F2F68727F9EA2 /* chrome_scaled_image_unittest.py */, + D32C9CC677C221FD93EE8BC8 /* igoogle_strings.py */, + BFFF75BA1DE505F4FC6CF8E1 /* igoogle_strings_unittest.py */, + 4B66B0B8539132668FAF09E6 /* interface.py */, + BFBCF921341FE2A9CAAB209F /* json_loader.py */, + E88908652AACDC3D54805093 /* muppet_strings.py */, + 45D4A61412E9D1F5B0824C4E /* muppet_strings_unittest.py */, + D46FDC38673A7B16D6DAD52A /* policy_json.py */, + CE20FF896D00BB796193B0C3 /* policy_json_unittest.py */, + 486DAB7574B9E13840732E6D /* rc.py */, + 4591B1B97998120F52F85520 /* rc_unittest.py */, + F12BA7D477CE652CE0378E43 /* regexp.py */, + 5D9B72F98520D246C6C638AD /* skeleton_gatherer.py */, + 90482E31FC042C40AA27CBB6 /* tr_html.py */, + C4A22E5D8FE6D3821F882BF8 /* tr_html_unittest.py */, + 33332EA2AC04ED29DEF2B062 /* txt.py */, + CDD57B391041DD8139A99BE4 /* txt_unittest.py */, + ); + path = gather; + sourceTree = ""; + }; + 7846595C5BF71D662A4872BA /* Products */ = { + isa = PBXGroup; + children = ( + A273E1A508576CCE31BDA52A /* libdynamic_annotations.a */, + ); + name = Products; + sourceTree = ""; + }; + 7896266262B7C669DAF9D148 /* grit */ = { + isa = PBXGroup; + children = ( + BA2CEA45A76DD834D9F46888 /* net_resources.h */, + ); + path = grit; + sourceTree = ""; + }; + 7AF118EBD6F7476696974ECF /* Products */ = { + isa = PBXGroup; + children = ( + B85BED980F0C092062FC7BF6 /* libprotobuf_lite.a */, + FF6806AF1530C10B07E48E78 /* libprotobuf_full_do_not_use.a */, + 8AB95AF34C0769AA29C00D81 /* protoc */, + ); + name = Products; + sourceTree = ""; + }; + 7B361E96F0846698F0CA80C1 /* libcef_dll */ = { + isa = PBXGroup; + children = ( + 950DB4A7D624C4526EAAA2F4 /* cpptoc */, + 5AFA5FE5BC503EC78D05F0CA /* ctocpp */, + A4DC3D3261EC5A21DA5A6600 /* wrapper */, + EB973CE4FEF9B5B2ED441179 /* cef_logging.h */, + D5D6EA7FA371571B90F3341D /* libcef_dll.cc */, + A53019239E548876C20B9BE5 /* libcef_dll2.cc */, + FF8BB4B2506BBC0896EA40FE /* resource.h */, + A4D2D5B95485DA3DF25972C8 /* transfer_util.cpp */, + 9AAB3640AEBCF8CDB6E3EBEB /* transfer_util.h */, + ); + path = libcef_dll; + sourceTree = ""; + }; + 855260D5F8EB9A5F5D90583B /* Products */ = { + isa = PBXGroup; + children = ( + EC96295730C4344F46C4CF8C /* libcrcrypto.a */, + 66166FA92F25B0DEEFA6A67B /* crypto_unittests */, + ); + name = Products; + sourceTree = ""; + }; + 8641E33E140AD05FA6EF538A /* Products */ = { + isa = PBXGroup; + children = ( + 1B42CA3D41E586DB8B43EE68 /* libipc.a */, + 9C56F3341074BDEBBDF0317D /* ipc_tests */, + 3B0ACFDE6A97007CA3F45358 /* libtest_support_ipc.a */, + ); + name = Products; + sourceTree = ""; + }; + 872ECB232111A77A324C2A9F /* Products */ = { + isa = PBXGroup; + children = ( + 40D8450E3A3D3953B2131E33 /* libv8_snapshot.a */, + 3D4E9841FF43307DE368DD09 /* libv8_nosnapshot.a */, + D7E4226EAF9EC841EFBEAD98 /* libv8_base.a */, + 188573DF6F5F630250FBAA30 /* mksnapshot */, + 5BB4D9F4524105F699CA6CB2 /* v8_shell */, + 65E4C9298E5BDF5797ED3622 /* libpreparser_lib.a */, + ); + name = Products; + sourceTree = ""; + }; + 876CF2BFEA22440C21B8445F /* Products */ = { + isa = PBXGroup; + children = ( + 51D58396CAC439AD5F352B7B /* libicudata.a */, + F0228BA8E7241096B69FA0D1 /* libicui18n.a */, + 54CF46DE6F3E2690DDB3A91F /* libicuuc.a */, + ); + name = Products; + sourceTree = ""; + }; + 88F70CD187AB20E99EB3666C /* Products */ = { + isa = PBXGroup; + children = ( + 76364D7D679109D4EF2C5D78 /* libevent.a */, + ); + name = Products; + sourceTree = ""; + }; + 8A6FD251A827E87691BCCA3F /* INTERMEDIATE_DIR */ = { + isa = PBXGroup; + children = ( + 9E74CA2249E727B65B812091 /* locale.pak */, + ); + name = INTERMEDIATE_DIR; + path = repack; + sourceTree = INTERMEDIATE_DIR; + }; + 8B68C9DB5F3258F6D3F495B9 /* grit */ = { + isa = PBXGroup; + children = ( + 588E6DF15E9D2FF032287599 /* devtools_resources.h */, + 0CDB496FCE74889BECC786AC /* webkit_chromium_resources.h */, + 738990D27BC0E432A3588FAD /* webkit_resources.h */, + 0514C79670E149EB872D2C1C /* webkit_strings.h */, + ); + path = grit; + sourceTree = ""; + }; + 9326958257DAA1843FADA0A0 /* Products */ = { + isa = PBXGroup; + children = ( + 54FB30231426CF8A98CB55CC /* libmedia.a */, + 469881A7AA01977748606E75 /* libyuv_convert.a */, + 33601FF4D83436341934DA90 /* libyuv_convert_simd_x86.a */, + 855A63411CC69C553F60E233 /* libyuv_convert_simd_arm.a */, + 4AB21D2D37F3E9F8AB2006E2 /* media_unittests */, + 325CBE7F77333A222059F4FB /* libmedia_test_support.a */, + 62D22A4533A0F0117E8A48B9 /* scaler_bench */, + E3B63B91F23894A10980BB49 /* qt_faststart */, + FA96B3B9711BEAA356D3BB42 /* seek_tester */, + 51FB1488787DE290A94E5A7B /* ffmpeg_unittests */, + 25F438E765C88ED06989C4EE /* ffmpeg_regression_tests */, + C34A4DA3E2E9C8D31557AD00 /* ffmpeg_tests */, + 0F34905BD3FE48763B983E73 /* media_bench */, + ); + name = Products; + sourceTree = ""; + }; + 950DB4A7D624C4526EAAA2F4 /* cpptoc */ = { + isa = PBXGroup; + children = ( + 476BDAB24D957D6802BC97D8 /* app_cpptoc.cc */, + EFD61BE299279F804F6194CE /* app_cpptoc.h */, + 151A694232221A890E2EBE2B /* auth_callback_cpptoc.cc */, + 42F5E5FEA30EA64D92C39B72 /* auth_callback_cpptoc.h */, + 51FCD3E7D567DF1A48B76769 /* base_cpptoc.h */, + D940F7991272A95E78BC9D80 /* before_download_callback_cpptoc.cc */, + B84A8C77A80959D3FDB79E03 /* before_download_callback_cpptoc.h */, + 8A8F46D578D570415EBDE473 /* binary_value_cpptoc.cc */, + 394C924B399DD9EB11D4EA90 /* binary_value_cpptoc.h */, + C2F9769424CA87A4DEE01F38 /* browser_cpptoc.cc */, + BD85B7325C97FE527A3B5FBA /* browser_cpptoc.h */, + F909E4720F5671522B2B7B8C /* browser_host_cpptoc.cc */, + B54A3D26A848E5E563BDF3FF /* browser_host_cpptoc.h */, + 8FC487E61971FF8B957CF876 /* browser_process_handler_cpptoc.cc */, + C4A3583C69238109E4439A1F /* browser_process_handler_cpptoc.h */, + 46B44C3D02C7D9175C39DEC6 /* callback_cpptoc.cc */, + B7BAE94218DC1AF62AB9C262 /* callback_cpptoc.h */, + AE1EECC7420185454F935DC0 /* client_cpptoc.cc */, + B031A6B9A59C5648001D8E7D /* client_cpptoc.h */, + C085C951644E10FC67FD2BFE /* command_line_cpptoc.cc */, + C5468CD8ADC7730A0D9F923B /* command_line_cpptoc.h */, + 832FB47A11CB7F9D7006944F /* context_menu_handler_cpptoc.cc */, + A12D4AF9EF7B9099616E9B3B /* context_menu_handler_cpptoc.h */, + CB28E6AD5B83DA336278E20C /* context_menu_params_cpptoc.cc */, + 3421E2BBB3DF1070D5E4BD87 /* context_menu_params_cpptoc.h */, + E5EA7CF0EAFED588646FEBCF /* cookie_manager_cpptoc.cc */, + 9EDC3A8C460020AA8C9D16D4 /* cookie_manager_cpptoc.h */, + E581A3AAAE322723FC773C13 /* cookie_visitor_cpptoc.cc */, + 765F54EF5B25F19B12554C17 /* cookie_visitor_cpptoc.h */, + C7705207DD77B0C0A875FEAF /* cpptoc.h */, + B9B3C5A2966003F02D99EDF8 /* dictionary_value_cpptoc.cc */, + E2C86E608D1FE42AD3D883F2 /* dictionary_value_cpptoc.h */, + 89220459E7C4ACEA47FE8D44 /* display_handler_cpptoc.cc */, + 8A9A71B5AC55058C531A10FA /* display_handler_cpptoc.h */, + AB44CA22DEEC02E4DB8ED2D6 /* domdocument_cpptoc.cc */, + 0F8D9EF32570C0C4F5E10D71 /* domdocument_cpptoc.h */, + 154A354AA505CD72DDB2EFA9 /* domevent_cpptoc.cc */, + 741FA37F8AA91FDCA7F7D0EF /* domevent_cpptoc.h */, + 9D2B8499E56DBC7273B71185 /* domevent_listener_cpptoc.cc */, + 1801E857339C7B5A3EB69624 /* domevent_listener_cpptoc.h */, + 2AA359A707FDEBCD53258B83 /* domnode_cpptoc.cc */, + 5443183CF36A8753D44E27DB /* domnode_cpptoc.h */, + 3D62F86A77EE5E930F24F3B3 /* domvisitor_cpptoc.cc */, + 92F71012F60E65800C7FA7EF /* domvisitor_cpptoc.h */, + 6899516D68CBC48011638AA3 /* download_handler_cpptoc.cc */, + C6313715F5261BAD9D0C719F /* download_handler_cpptoc.h */, + E39A8AB13257E2C3124AA2F3 /* download_item_callback_cpptoc.cc */, + EA2BC04B60C61C54807B3861 /* download_item_callback_cpptoc.h */, + 75C5A31CBBB197ED3436E4F2 /* download_item_cpptoc.cc */, + CC9D2982021F72278C81EEED /* download_item_cpptoc.h */, + E9E9C7069874412A6D7A5A7E /* focus_handler_cpptoc.cc */, + 20F593B2668252D45B5FC494 /* focus_handler_cpptoc.h */, + 9CF3DD0952B8129AD957046A /* frame_cpptoc.cc */, + EC67219931CE7E3432F787C0 /* frame_cpptoc.h */, + 95C841C5F5D8E955AD0C8442 /* geolocation_callback_cpptoc.cc */, + EB32421AB024ADB6BE44999A /* geolocation_callback_cpptoc.h */, + E862DE7D1FCFA8C328ECFC05 /* geolocation_handler_cpptoc.cc */, + 9A50288704E7307F0E12CC53 /* geolocation_handler_cpptoc.h */, + C588A9DB0063296F21B52B91 /* jsdialog_callback_cpptoc.cc */, + 99C8F07ADEC000D37DBAB1B1 /* jsdialog_callback_cpptoc.h */, + 9D6481C14038928657DE4402 /* jsdialog_handler_cpptoc.cc */, + 1EEBC9008E31713FA7F05FC9 /* jsdialog_handler_cpptoc.h */, + 8E197CF075AE60301D046E20 /* keyboard_handler_cpptoc.cc */, + 2BE5DEB2BA0ECEB7B1A7BEC0 /* keyboard_handler_cpptoc.h */, + 6DF28A5F1DB6F9C73A1E6F57 /* life_span_handler_cpptoc.cc */, + C62BF572DED4F010FC0E89A2 /* life_span_handler_cpptoc.h */, + 15CC340E227772893CA2AFEB /* list_value_cpptoc.cc */, + AE35153A534F6DC6E89C0E71 /* list_value_cpptoc.h */, + E6D4837DC7D70A7B4E9D9E96 /* load_handler_cpptoc.cc */, + D1525B53591006BB536CE299 /* load_handler_cpptoc.h */, + B71985071946DE0272140D33 /* menu_model_cpptoc.cc */, + 915A3F2F5BBCBA69CCA50C98 /* menu_model_cpptoc.h */, + D3EBF675DE5EF129D3440EFC /* post_data_cpptoc.cc */, + D81D280D5FD2372126A044AE /* post_data_cpptoc.h */, + F0C79A23253ACFB08E461D8C /* post_data_element_cpptoc.cc */, + C4732367B9C8CFFB7629CCE1 /* post_data_element_cpptoc.h */, + 9D8B23565B040C2C45D8D3A2 /* process_message_cpptoc.cc */, + 2C62ACF1F0A549F0A2051AB8 /* process_message_cpptoc.h */, + B84B69F8F0FC909581ED64B5 /* proxy_handler_cpptoc.cc */, + BBE2B501607B7615FF89D915 /* proxy_handler_cpptoc.h */, + B1B719B2DB39C964D60291E9 /* read_handler_cpptoc.cc */, + D7CE3427570BB20354E76B72 /* read_handler_cpptoc.h */, + C2166EDE4476E4A63D1C2353 /* render_process_handler_cpptoc.cc */, + 8FD3BF1B5EEC371550873F4F /* render_process_handler_cpptoc.h */, + C4598A5939FD219C10E8EDC2 /* request_cpptoc.cc */, + BAAA56D25F15E3152CAB4310 /* request_cpptoc.h */, + 771A5322D55C430A25BFB6DE /* request_handler_cpptoc.cc */, + 0493FA7D04E9DD460B094B27 /* request_handler_cpptoc.h */, + 021AAB8AF92012BFE87C320D /* resource_bundle_handler_cpptoc.cc */, + FF32EE1D0C75020413EA8446 /* resource_bundle_handler_cpptoc.h */, + 1C5AE824CF8FB2E013C771FB /* resource_handler_cpptoc.cc */, + 30CDEE9DE8D28F6CEA27CE6B /* resource_handler_cpptoc.h */, + D2E051950242C84ED77FD8E7 /* response_cpptoc.cc */, + F12C567E71FD0DA421B6A5DF /* response_cpptoc.h */, + BF9BCAC5E8B3E0B6E7204BAF /* scheme_handler_factory_cpptoc.cc */, + 45B1C90753578D3F409B5445 /* scheme_handler_factory_cpptoc.h */, + 1CCEA731C691044D678F8B9D /* scheme_registrar_cpptoc.cc */, + F68F18FF049593AC30D5381A /* scheme_registrar_cpptoc.h */, + 0F9E48B2C38027DC3F74C4AC /* stream_reader_cpptoc.cc */, + 4AFA6ADB70815EFEBB45B818 /* stream_reader_cpptoc.h */, + 11F7C69A218B1F1D26564618 /* stream_writer_cpptoc.cc */, + AC9A44C54E00B064658FB434 /* stream_writer_cpptoc.h */, + 5F71AEFBBD062CE8E4B035CD /* string_visitor_cpptoc.cc */, + 957CAFCC3E62D16A6A9A7001 /* string_visitor_cpptoc.h */, + D54F3662C373B066FED2B189 /* task_cpptoc.cc */, + C96E8D10AC36A42D17375908 /* task_cpptoc.h */, + 84BA24AC65D242008E562F4A /* urlrequest_client_cpptoc.cc */, + C132B2B7DFC87BF8A11A49AB /* urlrequest_client_cpptoc.h */, + 6EE3CEA7D97DE0E4E9F7C92B /* urlrequest_cpptoc.cc */, + 915F17714BF54A96E694861D /* urlrequest_cpptoc.h */, + 2BB627122277A2433EBFB9E3 /* v8accessor_cpptoc.cc */, + 3211D990A0868E4DA5F05C37 /* v8accessor_cpptoc.h */, + 64E0007CFC11C8A546F99276 /* v8context_cpptoc.cc */, + D4F148746CEA2558106D7D63 /* v8context_cpptoc.h */, + C466234A54DD0BD14A913865 /* v8exception_cpptoc.cc */, + AF105947CAC15F96B9B00CF5 /* v8exception_cpptoc.h */, + 403DF4C0E5AB39FF055E4392 /* v8handler_cpptoc.cc */, + 34E7B06FC2654047E51AA435 /* v8handler_cpptoc.h */, + F79BC80E5989366BC034AD67 /* v8value_cpptoc.cc */, + C8F4C343AD3BD4B6CCFC1CE9 /* v8value_cpptoc.h */, + 7AEB3EE43AF0938894DE8C2B /* web_plugin_info_cpptoc.cc */, + C6F9C805F913D447E3623EDC /* web_plugin_info_cpptoc.h */, + DFC6006F8E44EC259DFF6C6D /* web_plugin_info_visitor_cpptoc.cc */, + 842C3CD9BAE3CEF1F7B482F1 /* web_plugin_info_visitor_cpptoc.h */, + EDE25A592AC6B469CF3C58F2 /* write_handler_cpptoc.cc */, + F087160AE31260242344FE3C /* write_handler_cpptoc.h */, + 5F1F81C6FC28B3E39FC17988 /* xml_reader_cpptoc.cc */, + F57FDD1E3CF622D99F92DC8A /* xml_reader_cpptoc.h */, + DA1D01A728A8845E891328E7 /* zip_reader_cpptoc.cc */, + 8B0D5DB6543C85BC22C1EA1A /* zip_reader_cpptoc.h */, + ); + path = cpptoc; + sourceTree = ""; + }; + 9A402D0D5EB7BD4E096289D6 /* format */ = { + isa = PBXGroup; + children = ( + 459B34C3F365205D9921340A /* policy_templates */, + 394ED20393908DD4847D413E /* __init__.py */, + 6F0E17598B497B0F9754066C /* c_format.py */, + D27C8FC303AC0109A42C8D52 /* c_format_unittest.py */, + 8CF0FFC054798BB8914DDBD8 /* data_pack.py */, + 5E7E4D55681ECE4B05F2414C /* data_pack_unittest.py */, + 52D6F3198D44B31AF5068E98 /* html_inline.py */, + 50120FB7D2C144CF82F14F53 /* interface.py */, + 48431A857D81049FAA37A88E /* js_map_format.py */, + BF354E20164FC6AE1628E6D6 /* js_map_format_unittest.py */, + D6009C3FE4C9EAC76844183A /* rc.py */, + FDCD027B04F1985CF965A6D7 /* rc_header.py */, + BCE9DF91715018A1F2B5DDDE /* rc_header_unittest.py */, + E39D9DE3B2B6FAA5D5A4C0BD /* rc_unittest.py */, + B93E20FDDFB45AEE1B1637FB /* repack.py */, + 0D9C96436871C7AC09C92FBE /* resource_map.py */, + ); + path = format; + sourceTree = ""; + }; + 9DB10F9640171D3C0B81E069 /* Products */ = { + isa = PBXGroup; + children = ( + 7B4E766CE33B391FD5965AC9 /* libCNG.a */, + 5F6FFD63F4F6EB981AD41AF5 /* libG711.a */, + 7FDD976D13F31E5F969FF6F2 /* libG722.a */, + 17FFBEFCC8836FBB73E582A9 /* libiLBC.a */, + 222C454B32CA6D3246827AAD /* libiSAC.a */, + F3D7F0DDB63CA77F1F5205EA /* libiSACFix.a */, + 8706630C78544D75CEB14721 /* libPCM16B.a */, + 52125294678FD58D1610131B /* libaudio_coding_module.a */, + 84D084EB8AED55509F9E5E99 /* libNetEq.a */, + 44995BB877107C1B83D23200 /* libaudio_conference_mixer.a */, + 8D5761F6A0D523F7AA92BA0B /* libaudio_device.a */, + 98BC68C30AAE03AA50B0AFBA /* libaudio_processing.a */, + 0CB1640F4F4FB4AEB3B59E60 /* libaec.a */, + 89AA68583C800AD48D8910B9 /* libaecm.a */, + 1E7BCAB13DD3E553324824B7 /* libagc.a */, + F730AB17FB0BA0A61A7EF46C /* libns.a */, + F6CBA8C62E1D8E7F45C05DC8 /* libns_fix.a */, + 9718AEB2EBE47349877370D9 /* libapm_util.a */, + 508555DF81226478DF9A01DE /* libbitrate_controller.a */, + 648860494CFE2034D2C49E9B /* libmedia_file.a */, + 55099067C5B3B3719C34A3C6 /* libudp_transport.a */, + 2C707A0DCA7193E218AE2BB4 /* libwebrtc_utility.a */, + C914BC2649BE52A52D67FE5C /* libwebrtc_i420.a */, + B3C7283D59714B85617794EC /* libwebrtc_vp8.a */, + D09AE7D9C7AA685F3778A4AB /* libwebrtc_video_coding.a */, + 41802089CC60B523FD636494 /* libvideo_capture_module.a */, + 12423B699EEA302F59D5E5D2 /* libvideo_processing.a */, + B8CA1A3F3DC012EE6B29B090 /* libvideo_render_module.a */, + 5E776449B0DD985AA3A92196 /* librtp_rtcp.a */, + AADC551C1F61A7F0AF341714 /* libaec_sse2.a */, + 6385D313EA67413A056C5B94 /* libvideo_processing_sse2.a */, + ); + name = Products; + sourceTree = ""; + }; + A4DC3D3261EC5A21DA5A6600 /* wrapper */ = { + isa = PBXGroup; + children = ( + 89B77017A9EC70BA421EFAF7 /* cef_byte_read_handler.cc */, + 997FB6FDE34A9EF10B934290 /* cef_stream_resource_handler.cc */, + E8FDF82B6BD1532187AFBE45 /* cef_xml_object.cc */, + 01B79CB85CA6B558D2FF8CA1 /* cef_zip_archive.cc */, + D366285CB364244F44102F11 /* libcef_dll_wrapper.cc */, + 0BCDC6DD2A853EE361074F3C /* libcef_dll_wrapper2.cc */, + ); + path = wrapper; + sourceTree = ""; + }; + A74D756F1971EC0EDC5F1D39 /* Products */ = { + isa = PBXGroup; + children = ( + 231941D6606B6153490120F0 /* libxml2.a */, + ); + name = Products; + sourceTree = ""; + }; + A8558CE4AD60985B27A4FF18 /* Intermediates */ = { + isa = PBXGroup; + children = ( + 8A6FD251A827E87691BCCA3F /* INTERMEDIATE_DIR */, + 2C2F9795FB6FD0AF183B98C9 /* SHARED_INTERMEDIATE_DIR */, + ); + name = Intermediates; + sourceTree = ""; + }; + A90E1265C849F31BA7C13715 /* Source */ = { + isa = PBXGroup; + children = ( + C0BC56CD296A9CF9DD130584 /* .. */, + 7273165156FF298450A1C2BB /* BUILT_PRODUCTS_DIR */, + 409AD3F02306C0F01E7873E4 /* include */, + 1B6BCE57B535062FDA12910C /* libcef */, + 7B361E96F0846698F0CA80C1 /* libcef_dll */, + E4DF681FE7A091045A4118F0 /* tests */, + 68557FAACEC86438309583C8 /* tools */, + ); + name = Source; + sourceTree = ""; + }; + AE3B4A403D2D6BCFA4296AFD /* Products */ = { + isa = PBXGroup; + children = ( + FE3CC6EBD545B506351CCA2E /* libwebp_enc.a */, + 4690FA9F614135E1BCC39B3B /* libwebp_dec.a */, + 909D528CC75B31A615278676 /* libwebp_dsp.a */, + 7DFA5E6BE0D6213823703DE1 /* libwebp_utils.a */, + ); + name = Products; + sourceTree = ""; + }; + B2EA0EFD10DBCCC7D1352AFA /* webkit */ = { + isa = PBXGroup; + children = ( + 8B68C9DB5F3258F6D3F495B9 /* grit */, + AEC1C1912BA3FE2AD51CFE7E /* devtools_resources.pak */, + 59EAB9E13038989009194B97 /* webkit_chromium_resources.pak */, + 9450B68BEE27937EBAE05C64 /* webkit_resources.pak */, + B61CA6E61979A7CBF236E73D /* webkit_strings_am.pak */, + 6E8884157B62992B4215B66A /* webkit_strings_ar.pak */, + 44DFD12329D6AF141C7803A7 /* webkit_strings_bg.pak */, + C3FF36D1BCEC9430E0C11917 /* webkit_strings_bn.pak */, + A4649F89C716B218DD3268AB /* webkit_strings_ca.pak */, + 9A8F4C8FC2E2DD2655298862 /* webkit_strings_cs.pak */, + AE5F7ED290206A896187D9CB /* webkit_strings_da.pak */, + 2FA8C86FE90064CC6AD204B8 /* webkit_strings_de.pak */, + BBCC248506229E5B0D036B25 /* webkit_strings_el.pak */, + BADF2CC70DD23FAC319DB0E8 /* webkit_strings_en-GB.pak */, + D5AE19360737D03F7E2221DB /* webkit_strings_en-US.pak */, + 567A85368C6CF8CF07878874 /* webkit_strings_es-419.pak */, + 48F9EEAD7EF4135C5C8BC961 /* webkit_strings_es.pak */, + A13F63777B8D71B83A24E479 /* webkit_strings_et.pak */, + ED76BFB50460BA410E806208 /* webkit_strings_fa.pak */, + EE39EE596DEA6D9182112734 /* webkit_strings_fi.pak */, + 02943212AED67FDE1DE8A754 /* webkit_strings_fil.pak */, + 42DE707AD9ECC0C360C2142A /* webkit_strings_fr.pak */, + AB2C2414833CDF0E294612FD /* webkit_strings_gu.pak */, + C3D99D2C24C061BA724F9C77 /* webkit_strings_he.pak */, + 8A15B1BB8A62EC95076E6DEC /* webkit_strings_hi.pak */, + 5060C2094E2CEBD78D98E36F /* webkit_strings_hr.pak */, + 57DAB1E10A9A44D749F451E2 /* webkit_strings_hu.pak */, + 5D8769F23C7A85537ACD9C04 /* webkit_strings_id.pak */, + 7AF867AA9FC440565FAC0950 /* webkit_strings_it.pak */, + 199B54DD78FCFB3099B5300F /* webkit_strings_ja.pak */, + 25B6EE578237AB8259011D6C /* webkit_strings_kn.pak */, + B5FFE53E8D18F5DF26098C3B /* webkit_strings_ko.pak */, + 7AF4BB98B58929D0BFDC2D3C /* webkit_strings_lt.pak */, + DA0D761271620EF673356FAF /* webkit_strings_lv.pak */, + CC6C389575F116171DF2E9F2 /* webkit_strings_ml.pak */, + 208F7C728B9FBF8EA807E1E8 /* webkit_strings_mr.pak */, + EF13D40094372E03784355D5 /* webkit_strings_ms.pak */, + 5BE98613E89F29801EBFFEC3 /* webkit_strings_nb.pak */, + 9A1ABE45349A3F80FF5DF30C /* webkit_strings_nl.pak */, + 29166ED0F0896A7EB34736BD /* webkit_strings_pl.pak */, + 76E444CBCD615065EED446E0 /* webkit_strings_pt-BR.pak */, + 33DD50DB2E11BEE14F91DCCE /* webkit_strings_pt-PT.pak */, + 5FAC99DFA973BEE73C9D81E9 /* webkit_strings_ro.pak */, + 7E9C21B18AE55F7B6C178E61 /* webkit_strings_ru.pak */, + 08F481D420D2BEFAA309844B /* webkit_strings_sk.pak */, + ECDA7F89372354141C39ADFE /* webkit_strings_sl.pak */, + E963A3CC92D8BF4256FDEA60 /* webkit_strings_sr.pak */, + 39D2CC1ED178EB7C430ACCF4 /* webkit_strings_sv.pak */, + 6D811744DC5B0D7A3138A2A8 /* webkit_strings_sw.pak */, + 18CB17F5F89FE2DD4775C8D8 /* webkit_strings_ta.pak */, + 452131F0A02F514C887367A8 /* webkit_strings_te.pak */, + AC50AD2938980FFD18423AFA /* webkit_strings_th.pak */, + 8AA6E9DC8966C36467FEA316 /* webkit_strings_tr.pak */, + D5FD4E92AEBBDD820CD613D0 /* webkit_strings_uk.pak */, + C72440BBDA9B2D0831F9B31B /* webkit_strings_vi.pak */, + 4BFBD85606BCD5295F158F56 /* webkit_strings_zh-CN.pak */, + D4EA87717B8FA96AF184ECD8 /* webkit_strings_zh-TW.pak */, + ); + path = webkit; + sourceTree = ""; + }; + B3020DDB0727745BB8CFA371 /* Products */ = { + isa = PBXGroup; + children = ( + ED37D78E0792BDA1C05BA20E /* libpng.a */, + ); + name = Products; + sourceTree = ""; + }; + B30A3443E29F5A775A662DC5 /* Products */ = { + isa = PBXGroup; + children = ( + FDE3F18B0794AC39BE153998 /* libots.a */, + ); + name = Products; + sourceTree = ""; + }; + B5485D05DB6610D0EAE0B7C6 /* Projects */ = { + isa = PBXGroup; + children = ( + CD86FFEA2D5001FA726510BE /* JavaScriptCore.xcodeproj */, + 1193F2D58AEF3615DD79DEF7 /* Platform.xcodeproj */, + 421637DBD3560D81535E4C3A /* WTF.xcodeproj */, + DC72D0B7D1A6B663CB335034 /* WebCore.xcodeproj */, + 87F45A638FBE61B6FDF891DC /* WebKit.xcodeproj */, + 25EEC66C5B03F5672152ACCB /* all.xcodeproj */, + 79CF3557612C4997DAB1A862 /* allocator.xcodeproj */, + 1565CFD5145C22BAC85C3EEE /* base.xcodeproj */, + 914996F06142B7006F4C1AC7 /* build_angle.xcodeproj */, + 3D3157B668F5872BF7A22811 /* command_buffer.xcodeproj */, + 81B31A421FA8B15344436AA7 /* common_audio.xcodeproj */, + 159546C2D7977EF25EFA7B40 /* common_video.xcodeproj */, + 63589532FDDE3888E6D68564 /* content.xcodeproj */, + 4335E893FC259036D8785066 /* content_resources.xcodeproj */, + 1DBB070EBD1333BBE5C68D1C /* crypto.xcodeproj */, + 21CD3E93FEA7E8ABD82BFBAF /* devtools_resources.xcodeproj */, + 993D5FB77B5591A0FFDF0D3A /* dynamic_annotations.xcodeproj */, + 2AA818CBAF5F61D7A21B18D7 /* expat.xcodeproj */, + 34C9C80A8A51D6228A02CE15 /* ffmpeg.xcodeproj */, + 8ECFAA9E466819116DFF920F /* flac.xcodeproj */, + 33D2D9A353D54120D3468266 /* gl.xcodeproj */, + E430F79B1322631374180E88 /* glu.xcodeproj */, + 40EA4C2F8133B05D9D7E5A83 /* gmock.xcodeproj */, + FE315AF8B75A20D4F79D2EFE /* googleurl.xcodeproj */, + 2402718FB1781B628D8E9890 /* gpu.xcodeproj */, + 2BDFA0D019DB383FCBE2863E /* gtest.xcodeproj */, + B1B0B00499622B5212B3B8C8 /* harfbuzz.xcodeproj */, + EBDA2F288039C5E20D832C0F /* iccjpeg.xcodeproj */, + 42BA615544865FC9F7795548 /* icu.xcodeproj */, + 1C025E27C1B803BE216F4F86 /* ipc.xcodeproj */, + C986618ECAB0A5C043D8BB3F /* jingle.xcodeproj */, + 0651D00FD6E7F704270E6F29 /* jsoncpp.xcodeproj */, + 461BAAD82F8AB804176FDFE3 /* leveldatabase.xcodeproj */, + B2F3D77B6647DF374CFCE5D4 /* libevent.xcodeproj */, + 2D953328A837658D8BC680C6 /* libjingle.xcodeproj */, + F6FC8D0B14E925438D497470 /* libjpeg.xcodeproj */, + 913E0B3B78A79604B8375494 /* libpng.xcodeproj */, + BBB91956C816083526AB2EF2 /* libsrtp.xcodeproj */, + 334689EC756D47C76DABB010 /* libvpx.xcodeproj */, + 7C28C9975417680D544A5BA4 /* libwebp.xcodeproj */, + D0856E7B20F81C035637FEEE /* libxml.xcodeproj */, + D7A7DCA77B5D7E0417FA2EE7 /* libxslt.xcodeproj */, + 10FB137FABDB2510091F240E /* libyuv.xcodeproj */, + 9B4BBCC00C0C1A2BEEFA0D01 /* mach_override.xcodeproj */, + 4F303C29F3D1E527A63C3797 /* media.xcodeproj */, + 8FC259076BAAC6707AF40AB9 /* modp_b64.xcodeproj */, + 5DA409E878B3995C3EB7E55B /* modules.xcodeproj */, + C3F9A1466747A71994443EE8 /* net.xcodeproj */, + FFF00D66C4A59FA632CF355D /* npapi.xcodeproj */, + 1C1D2B476CB71FED19A90525 /* nss.xcodeproj */, + 6A3B8076CA7CD96C8E25A966 /* openmax.xcodeproj */, + 6A8A5FC8599E16C4CE106A47 /* ots.xcodeproj */, + 4EB85F5F7EB3A7B3221230A6 /* ppapi.xcodeproj */, + 8A8806D9491FFB692E6B67CE /* ppapi_internal.xcodeproj */, + D70F2AD41B444A90D0917EFB /* printing.xcodeproj */, + C7EE4C2E678C3D80B0A02DA2 /* protobuf.xcodeproj */, + F826FF98E5F795F91C77DDCA /* sdch.xcodeproj */, + 6991125C79C2BFE97903DCF9 /* sfntly.xcodeproj */, + 941319F6C213FD2E5AF1379C /* skia.xcodeproj */, + 71682F05AB957D4FB877358C /* speech_proto.xcodeproj */, + F80705F721F23C071C68CBF0 /* speex.xcodeproj */, + E628C159157AD577B39C0B42 /* sql.xcodeproj */, + 3E3D7C67B9F21F228D244464 /* sqlite.xcodeproj */, + 0896A4568A6EF547A818E252 /* ssl.xcodeproj */, + 0A252C48128C7984A5A7D199 /* sudden_motion_sensor.xcodeproj */, + A2154ED96A97D207C4234EB2 /* surface.xcodeproj */, + 074D7464D208F959F4EFA456 /* system_wrappers.xcodeproj */, + 36EE862F886D7E5F8DD66BF6 /* ui.xcodeproj */, + D828014EA35F6FF11305AC18 /* ui_strings.xcodeproj */, + 55DB375A3CC916F84D8CCE4A /* v8.xcodeproj */, + D750300952CFEECA77BB2E09 /* video_engine.xcodeproj */, + C29ADD61716033F36EC6FA4A /* voice_engine.xcodeproj */, + AE72EF7CAB16AAED4E988E57 /* webkit_support.xcodeproj */, + 2DF0099F0EE8FE9B392AACC4 /* zlib.xcodeproj */, + ); + name = Projects; + sourceTree = ""; + }; + B730FCB501E5A58141A4A7C5 /* Products */ = { + isa = PBXGroup; + children = ( + 3AE65874B3D2B86C62583370 /* libsrtp.a */, + ); + name = Products; + sourceTree = ""; + }; + B73EFEBDF0CF6CD4FD06A18D /* Products */ = { + isa = PBXGroup; + children = ( + 14D6BA9BB146A4F2A2B2247A /* libwebcore_bindings.a */, + F1A30087FEB5F03EBA42EF92 /* libwebcore_dom.a */, + 9E7793E9F576458BDD0FDC07 /* libwebcore_html.a */, + FA5C43585F17E267CF43DA3D /* libwebcore_svg.a */, + 6CE7806BDE6763DCD46EBCD5 /* libwebcore_platform.a */, + C740E01F34E473CAC79E1412 /* libwebcore_rendering.a */, + AA529CAE1A9752141B3D6AA0 /* libwebcore_remaining.a */, + A92D4D8C36225CC694E6249F /* libwebcore_test_support.a */, + ); + name = Products; + sourceTree = ""; + }; + B8A81CA70F9812EE610BBF4C /* custom */ = { + isa = PBXGroup; + children = ( + E76B1563EE0C973C3C6418FE /* __init__.py */, + CB1A2A507DD7E247C86F4DE8 /* filename.py */, + 80FABF2C108132E99FF6CD2C /* filename_unittest.py */, + ); + path = custom; + sourceTree = ""; + }; + BBB306902212C99A76FF1BB5 /* Products */ = { + isa = PBXGroup; + children = ( + 35BDDB08E575F02E3D8A6351 /* libui.a */, + 93032758CCEA393AF6F03221 /* libui_test_support.a */, + 532E866DC0DA884190819DA5 /* ui_unittests */, + ); + name = Products; + sourceTree = ""; + }; + BBCD0828F4F33290CBAC58D3 /* grit */ = { + isa = PBXGroup; + children = ( + 92D415BA4DE9FDB56C848F0E /* cef_resources.h */, + 356E1B48A82563540725E857 /* cef_strings.h */, + ); + path = grit; + sourceTree = ""; + }; + BCFF87F98D20AC0C76C795D1 /* ui_resources_standard */ = { + isa = PBXGroup; + children = ( + 3A4A3FDCBBE2EA1F0710DC54 /* grit */, + 8DF06BB0F4FB0F0B2222B9E2 /* ui_resources_standard.pak */, + ); + path = ui_resources_standard; + sourceTree = ""; + }; + BFD3D49A6960822DE76D2EE3 /* Products */ = { + isa = PBXGroup; + children = ( + 19A90B3A2AC4765B210294B8 /* libprinting.a */, + BDBFE371ED8537F0321E26F4 /* printing_unittests */, + ); + name = Products; + sourceTree = ""; + }; + C0BC56CD296A9CF9DD130584 /* .. */ = { + isa = PBXGroup; + children = ( + CBAAAC7CEE47A24B64DA4C0D /* chrome/browser */, + 4C21317EE939F489BFA80C9A /* third_party/mozilla */, + E8959847354D16C537BD54DD /* tools */, + ); + path = ..; + sourceTree = ""; + }; + C0D377AED2CD9427264853BA /* Products */ = { + isa = PBXGroup; + children = ( + EEF3DEBE3DF87BA94FA84325 /* libsignal_processing.a */, + DFAC89ACAC85C56A837AE4A4 /* libresampler.a */, + CA8D18339EA75625526C90B6 /* libvad.a */, + ); + name = Products; + sourceTree = ""; + }; + C1944C487F3CD8F951613556 /* mac */ = { + isa = PBXGroup; + children = ( + 807894F2C9EC4212FB1BD2CB /* Info.plist */, + 504BF73960853BE20696B75A /* InfoPlist.strings */, + C312F72C568701E9B4651474 /* MainMenu.xib */, + B4B28A8840955A7A73CE082C /* unittests.icns */, + ); + path = mac; + sourceTree = ""; + }; + C1AB6355ED72CA74482BA6B4 /* wrapper */ = { + isa = PBXGroup; + children = ( + 2E81A09EA187C5ABA0594B81 /* cef_byte_read_handler.h */, + B0E3E128BB10AF315930D732 /* cef_stream_resource_handler.h */, + 5BD5BBF7DBC575DC17C35D72 /* cef_xml_object.h */, + 980462CA3EBC9C7A46664528 /* cef_zip_archive.h */, + ); + path = wrapper; + sourceTree = ""; + }; + C54631913F021FCC1952873E /* Products */ = { + isa = PBXGroup; + children = ( + ); + name = Products; + sourceTree = ""; + }; + C561F2FD91D31ED5AFE3FE37 /* gritsettings */ = { + isa = PBXGroup; + children = ( + E69FAB7C092C231EAE2CDE02 /* resource_ids */, + ); + path = gritsettings; + sourceTree = ""; + }; + C56741FF440BB08E59C40D2D /* common */ = { + isa = PBXGroup; + children = ( + CDB2A1AB7093EC0735069E23 /* cef_message_generator.cc */, + 109971241DE89588510AC552 /* cef_message_generator.h */, + 9F8DF3A8D0D5CBD2B5BE5E4E /* cef_messages.h */, + 8BA02D444B3792D97FDCEECE /* cef_switches.cc */, + D3BEDFBD500FED829DC71255 /* cef_switches.h */, + 5F2B2BFABAAE633D56780C3F /* command_line_impl.cc */, + D7A0E7112DB25D43079BDBD4 /* command_line_impl.h */, + D2E95DA195A44E9F13800933 /* content_client.cc */, + CC8CAF87DF780BDAEAEAD507 /* content_client.h */, + 7FCC66352C9D74203077F2BA /* http_header_utils.cc */, + 411B7B4E82F9CE8BCDB26F59 /* http_header_utils.h */, + 541553E5FE02113AC639ECD1 /* main_delegate.cc */, + 1F32D37DE39EA6518CBF7A97 /* main_delegate.h */, + D05576BEB3938E78B49B3AE0 /* process_message_impl.cc */, + 7F495BA8C8C936D373D7924B /* process_message_impl.h */, + C67B560402C9434CB1C7FEAC /* request_impl.cc */, + 60094E2013060E84B9F0A442 /* request_impl.h */, + 731F5270DCA0C5F127CDB37C /* response_impl.cc */, + 5A208C2BA07A723EA111E6FE /* response_impl.h */, + A7150BB7F6260DC5E3D6014F /* response_manager.cc */, + 20B9C1471565555B56117D65 /* response_manager.h */, + 5CE0453C5A2622362B584F68 /* scheme_registrar_impl.cc */, + 82DACC558D6C9791E80B0D9A /* scheme_registrar_impl.h */, + C7ACE0C68D51D0C218919A6C /* string_list_impl.cc */, + F0F966C99991A8DE7B491044 /* string_map_impl.cc */, + 5400F37F18ACCCBFE7562D10 /* string_multimap_impl.cc */, + 60D541BCDBD964C84437C645 /* string_types_impl.cc */, + 262BD76496AAB06FA64AC8A7 /* task_impl.cc */, + 94FC67A94B7C6A0594A768BB /* time_impl.cc */, + 518172B054CD1F54D77451B4 /* time_util.h */, + D455FB5D8F74CAB2B3F41A9E /* tracker.cc */, + 51010D89047ECE793711047F /* tracker.h */, + EC551A219A6DBB358916C1BF /* url_impl.cc */, + 5243D729B37F95262AC8F6FD /* urlrequest_impl.cc */, + F3E283BE9330EE912852D5AB /* value_base.cc */, + 99985A0B3AAA0CE9A2F58DBC /* value_base.h */, + 2C5DCA0E34DEC39C40C17F5C /* values_impl.cc */, + D97321F6316E0C86664EDF93 /* values_impl.h */, + ); + path = common; + sourceTree = ""; + }; + C88A97A845DC6AA1133FCB60 /* Products */ = { + isa = PBXGroup; + children = ( + 7652B3C9D954E11920222382 /* libwebrtc_libyuv.a */, + 279E280A5DEEDC4C69880518 /* libwebrtc_jpeg.a */, + ); + name = Products; + sourceTree = ""; + }; + CB63D0D4E8FF24EAC785B775 /* grit */ = { + isa = PBXGroup; + children = ( + 850FF5EF5174D22356396681 /* ui_strings.h */, + ); + path = grit; + sourceTree = ""; + }; + CBAAAC7CEE47A24B64DA4C0D /* chrome/browser */ = { + isa = PBXGroup; + children = ( + 0A57F4FC2979198F954E180E /* net */, + CCE39362660556D64641A3EB /* ui/cocoa */, + 50904314745D75720421875B /* disposition_utils.cc */, + 6B57B9E2B3A48DA03AE7AE74 /* disposition_utils.h */, + 3BD182E8FB7A3E22134DF860 /* event_disposition.cc */, + 2000433F0589FE061FBFC7B7 /* event_disposition.h */, + ); + path = chrome/browser; + sourceTree = ""; + }; + CBDA1C3CE0298FB688E9410E /* internal */ = { + isa = PBXGroup; + children = ( + B1DAA340DB834465A936E8F8 /* cef_build.h */, + 96863EC71FE8C19086ECC663 /* cef_export.h */, + 12B6B25CD0AC0FEF0C37C56B /* cef_mac.h */, + 3A045FCB7D7264E8890109A5 /* cef_ptr.h */, + CC2E0CD0BEC5AFA8BD641A34 /* cef_string.h */, + 8C138B705D2D3C374E61DB8B /* cef_string_list.h */, + A2542629E10750A9BC3BA215 /* cef_string_map.h */, + 9FDCE1753EAB6DD51D5E88E8 /* cef_string_multimap.h */, + 7C75D1B55249E9B2D60AED98 /* cef_string_types.h */, + 83A8579EFC53B0B57F009E48 /* cef_string_wrappers.h */, + AAEF5E0F1906033B0352D5B7 /* cef_time.h */, + 79234382345BA3C64994D511 /* cef_tuple.h */, + 37477D39B7F50223303252D7 /* cef_types.h */, + 8948E45DD951A069CAF5AC80 /* cef_types_mac.h */, + 4BBD9CB783AC852918EFEAAD /* cef_types_wrappers.h */, + ); + path = internal; + sourceTree = ""; + }; + CCE39362660556D64641A3EB /* ui/cocoa */ = { + isa = PBXGroup; + children = ( + DC2688FB8963B48B34A8CB30 /* event_utils.h */, + 49AEA50476542BABAA469E49 /* event_utils.mm */, + 50DA499BC7B870350F0B702F /* menu_controller.h */, + BA74D937DABFDDBFF7BC274A /* menu_controller.mm */, + ); + path = ui/cocoa; + sourceTree = ""; + }; + CE30A9051DCD5A462900CCE9 /* writers */ = { + isa = PBXGroup; + children = ( + AD46FECF48CAA90C69CBF929 /* __init__.py */, + F57922A52A9CBE7D6C5818B3 /* adm_writer.py */, + 006E2641277922A5B3C03BC2 /* adm_writer_unittest.py */, + 84EA5424F8B6B4C6138402A8 /* adml_writer.py */, + 54A6B02FA001B6569F481D8F /* adml_writer_unittest.py */, + D58C1FEF34712C6E4A5F8918 /* admx_writer.py */, + D64438538235B85A8AEE9557 /* admx_writer_unittest.py */, + 0AD75F3C85B1E8E79017CEB8 /* doc_writer.py */, + 3D8C3734F4BDB05000A0B9BC /* doc_writer_unittest.py */, + 8AA64D0F18ADA015BFE201A5 /* json_writer.py */, + 9D026DB1DED7CFBFCC17DE88 /* json_writer_unittest.py */, + A118A80152C4BFB2B86A7B82 /* mock_writer.py */, + 36997FB0DD94284E4BB95802 /* plist_helper.py */, + 4B5ADD9D75499F753CF4B5C6 /* plist_strings_writer.py */, + 8A1A6FA2F84381B4C6F7645E /* plist_strings_writer_unittest.py */, + 7E0D94AA2AA4A03F0193832B /* plist_writer.py */, + A10811BEC263444916496808 /* plist_writer_unittest.py */, + 34F700726B1ECBCC4D64D776 /* reg_writer.py */, + 316413852D2E429AB85DC6BE /* reg_writer_unittest.py */, + DA377C3032623ECAF54FE658 /* template_writer.py */, + 093E2FE093BECFD41D5335CE /* template_writer_unittest.py */, + 8510CB875D2FF04CC72D31FB /* writer_unittest_common.py */, + 46E883C7AF1E84BD492C9DFC /* xml_formatted_writer.py */, + C8D5566AFB8F260F77DAB20E /* xml_writer_base_unittest.py */, + ); + path = writers; + sourceTree = ""; + }; + CF97BE27D2381517A113E1D8 /* Products */ = { + isa = PBXGroup; + children = ( + 68CC739E8547E5DFAE8D1FB6 /* libcrnspr.a */, + 59713494F5DE6C0FDA8AC1D7 /* libcrnss.a */, + BE4562C3575A70024C40D583 /* libcrnssckbi.a */, + 1858A88FAD19882F6EBAB134 /* libnss_static.a */, + ); + name = Products; + sourceTree = ""; + }; + D06540FBE4AAE457E9C1029A /* Products */ = { + isa = PBXGroup; + children = ( + 3631B37F09E89E2035707B42 /* libleveldatabase.a */, + 3F6F4D70548B8A2806B4743C /* libleveldb_testutil.a */, + 31388FCDD842A75BAC59D1A9 /* leveldb_arena_test */, + 1B40BA02D77EA14446AE0E66 /* leveldb_cache_test */, + B6D545E11394F55CC4F354C8 /* leveldb_coding_test */, + 59D9F57B61ABC9BBFCBF410D /* leveldb_corruption_test */, + 18E4DDFEECA23064607EC5C0 /* leveldb_crc32c_test */, + 5D556B1739ACFBD9D8902528 /* leveldb_db_bench */, + 64F841BCD64DF489F9FD7045 /* leveldb_db_test */, + 4A7008C1860BAEE50202FF31 /* leveldb_dbformat_test */, + 3F6D427ED8100B09055510A2 /* leveldb_env_test */, + 9BA3259F6DDAFB8F88C9E3BC /* leveldb_filename_test */, + 0E39BDD243670D990FC3D5F6 /* leveldb_log_test */, + 2DC399D70FCD7BBC202A7277 /* leveldb_skiplist_test */, + 9FFA44978A353086446A547F /* leveldb_table_test */, + 97ADD3FE37990403BF1A2C35 /* leveldb_version_edit_test */, + 098B47A6E50F158627CFAF1D /* leveldb_write_batch_test */, + ); + name = Products; + sourceTree = ""; + }; + D342E33851D57FDA0EEF1ECD /* Products */ = { + isa = PBXGroup; + children = ( + 57951AF27EC4AEC7499B8E1E /* libjingle_glue.a */, + C22D91CAFF221E82478B3EC9 /* libnotifier.a */, + F4E51FB8FB4C99518B681C2E /* libnotifier_test_util.a */, + DBB1214DF375AF358E9D16D8 /* libjingle_glue_test_util.a */, + 7D09C922698D218271E813C4 /* jingle_unittests */, + ); + name = Products; + sourceTree = ""; + }; + D6F45F8D700242BBD4C31548 /* Products */ = { + isa = PBXGroup; + children = ( + A3AEB897C9125806F2A3F2E0 /* libsqlite3.a */, + ); + name = Products; + sourceTree = ""; + }; + D7C91B40183481DDB56892F9 /* Products */ = { + isa = PBXGroup; + children = ( + E520D20D9B313E81E46EFC44 /* libssl.a */, + ); + name = Products; + sourceTree = ""; + }; + D7F14D3A57B1534B765AA4E9 /* res */ = { + isa = PBXGroup; + children = ( + B3CBCE3BBAC700D4F20C4AB3 /* binding.html */, + FED6A7D4CC6FDAC0ACF00545 /* dialogs.html */, + 5C73B895D250886CB5582389 /* domaccess.html */, + 47601D042653DA09EF8A0C8B /* localstorage.html */, + C8A180CBAD1730307A7968AE /* logo.png */, + 348B64EB025FFE2A7337DC68 /* xmlhttprequest.html */, + ); + path = res; + sourceTree = ""; + }; + D926808B308378706FD7D1A3 = { + isa = PBXGroup; + children = ( + A90E1265C849F31BA7C13715 /* Source */, + A8558CE4AD60985B27A4FF18 /* Intermediates */, + B5485D05DB6610D0EAE0B7C6 /* Projects */, + 4F29216594804409F75AE9B5 /* Frameworks */, + 4399DC192342F10F75990BC7 /* Products */, + 633FC56C3A41DEE4B57061F7 /* Build */, + ); + sourceTree = ""; + }; + DE95397154FFF95C3B71D9D0 /* Products */ = { + isa = PBXGroup; + children = ( + 7B21CBD334DD8DE180E71548 /* libppapi_shared.a */, + E0124C00BC9DD166682EA919 /* libppapi_proxy.a */, + 2146F4980A38504DBC71F58C /* PPAPIExample.bundle */, + 5C700F1C23E9A371A3D0CED7 /* ppapi_tests.bundle */, + FF117249FEB88AAAB9B6C26C /* libppapi_unittest_shared.a */, + 56EC778DB94C3D3BC59A1FF6 /* ppapi_perftests */, + 3B2C2E73B999F5A73B947FAA /* ppapi_unittests */, + 4BF89795A541A4D4674AE808 /* ppapi_example_mouse_cursor.bundle */, + 556EEC1C9B7F92DD0FDA2D84 /* ppapi_example_mouse_lock.bundle */, + 814B0A4056F5CC5CD72E4308 /* ppapi_example_gamepad.bundle */, + 2C849ED35F93B7313A6B3A26 /* ppapi_example_c_stub.bundle */, + 1C373555E11300EB4535B7AC /* ppapi_example_cc_stub.bundle */, + 151440EC37643EF77F8F3361 /* ppapi_example_audio.bundle */, + 1E92EAF020A7823CBF886789 /* ppapi_example_audio_input.bundle */, + 4ADC86031782B27551EC2E38 /* ppapi_example_file_chooser.bundle */, + E455343DCDDA068A7A605236 /* ppapi_example_graphics_2d.bundle */, + 0D13E88698DFD01971DF95F0 /* ppapi_example_ime.bundle */, + 45653EFBE55EA6DAD77F852E /* ppapi_example_paint_manager.bundle */, + 6F1D49D6CC8D5B19C5B5F7F4 /* ppapi_example_post_message.bundle */, + 7C00C2577296D3966E61FE2E /* ppapi_example_scroll.bundle */, + E353FC738370E3181F299DE0 /* ppapi_example_simple_font.bundle */, + B3DB9C8FD60EBC30C15EC819 /* ppapi_example_url_loader.bundle */, + BD079598FEB10D85498A2269 /* ppapi_example_gles2.bundle */, + 1DBD318A565F9970BC623441 /* ppapi_example_video_decode.bundle */, + 0520B359A318A0CE6636BC65 /* ppapi_example_vc.bundle */, + A9C070899E89D194B452F2FF /* ppapi_example_flash_topmost.bundle */, + 5C297D97F04A9FE35F576C2F /* ppapi_example_printing.bundle */, + ); + name = Products; + sourceTree = ""; + }; + E026A76AD13F93DE7BF64A25 /* Products */ = { + isa = PBXGroup; + children = ( + A233A9E0F2972D84C108ED2A /* liballocator.a */, + AB208F3EF428319141B9B3A7 /* liballocator_extension_thunks.a */, + ); + name = Products; + sourceTree = ""; + }; + E10C0D8C1FD5C7E44E001D9A /* Products */ = { + isa = PBXGroup; + children = ( + 5F32C68901D0E2D38FC3B717 /* libtess.a */, + ); + name = Products; + sourceTree = ""; + }; + E1A4F9759B3EF4A5D45E6375 /* Products */ = { + isa = PBXGroup; + children = ( + 6EB049F6609DE833AF093CA6 /* libil.a */, + ); + name = Products; + sourceTree = ""; + }; + E4DF681FE7A091045A4118F0 /* tests */ = { + isa = PBXGroup; + children = ( + 38D2936464A136EEB0255508 /* cefclient */, + 441C0A99B45B946641BC3BBE /* unittests */, + ); + path = tests; + sourceTree = ""; + }; + E5E3827436D25A88E9D0700C /* grit */ = { + isa = PBXGroup; + children = ( + 6E95D63188E66A21B133C90F /* extern */, + 9A402D0D5EB7BD4E096289D6 /* format */, + 7604B20C2E3706D25B54F466 /* gather */, + 64CB63653C02F587F8F252D9 /* node */, + 379B94E26997803291E0A1EE /* tool */, + 420F3C36CE7631034364E422 /* __init__.py */, + 3CD3016562E16F98BD1F566B /* clique.py */, + 177DBE23FF52BC4B6AA97A61 /* clique_unittest.py */, + F75945ED70B897D40F27A14B /* constants.py */, + E8AD3F42F9B90E5553731848 /* exception.py */, + B96DB9A5EA5CB33C9CF4E3B6 /* grd_reader.py */, + 8D290D79F3EF4612A4721B41 /* grd_reader_unittest.py */, + 343398266DEB232FF344BE97 /* grit_runner.py */, + C52B2176F56D4DEDFA70B6AB /* grit_runner_unittest.py */, + F13EDB36838C78E6470B1A91 /* lazy_re.py */, + 378DA12B5CDE121479554F64 /* lazy_re_unittest.py */, + 7561B5E1D6E73275673FA6F4 /* pseudo.py */, + 0BF739A5B1C2AA176439A5F6 /* pseudo_rtl.py */, + F93BAD27A59BC516BB9311F8 /* pseudo_unittest.py */, + 694DE4CBA4F0460BAAB3ACBB /* scons.py */, + F67C700426EF8449E5CCC774 /* shortcuts.py */, + BB40C94651F5869982CD0D73 /* shortcuts_unittests.py */, + 80E1D3C0C90A9611E57BDE85 /* tclib.py */, + AE237E44F51811ABA1079BEF /* tclib_unittest.py */, + 6ABBA458072A19A85269F56F /* test_suite_all.py */, + 0B156A4CFECFA1AB636989F5 /* util.py */, + F6E29811FBA959CD7BC2EAA4 /* util_unittest.py */, + 98AF0BBBB8A81ABFFF43B0A9 /* xtb_reader.py */, + 78B16B5577F0099FE17A1B76 /* xtb_reader_unittest.py */, + ); + path = grit; + sourceTree = ""; + }; + E8959847354D16C537BD54DD /* tools */ = { + isa = PBXGroup; + children = ( + 1F7FF175E0E4D25F2BEF61EF /* grit */, + C561F2FD91D31ED5AFE3FE37 /* gritsettings */, + ); + path = tools; + sourceTree = ""; + }; + EA116707259DA812076CECFB /* Products */ = { + isa = PBXGroup; + children = ( + B104E9FB51B61FDBF8A2306B /* libjpeg_turbo.a */, + ); + name = Products; + sourceTree = ""; + }; + EDA42135948F78CB9DACAAAC /* Products */ = { + isa = PBXGroup; + children = ( + B5424446D74DD25BADD31F1E /* libgles2_utils.a */, + ); + name = Products; + sourceTree = ""; + }; + EE7A2CE9D2FEF5C88C3CD15F /* Products */ = { + isa = PBXGroup; + children = ( + A8210CD6DD0487DCD90423F1 /* libyarr.a */, + ); + name = Products; + sourceTree = ""; + }; + EF5F28849C437F31B44DC7F1 /* ui_strings */ = { + isa = PBXGroup; + children = ( + CB63D0D4E8FF24EAC785B775 /* grit */, + E543A7571C10044A6343AF07 /* ui_strings_am.pak */, + C51F821DAEE8400127A67F46 /* ui_strings_ar.pak */, + BE1DA88C9CE8AABA2DA12E5A /* ui_strings_bg.pak */, + D868357C760F520F1C128A40 /* ui_strings_bn.pak */, + C6060C990C83797D74493904 /* ui_strings_ca.pak */, + 17D3CBDD52BE57CF73F313AD /* ui_strings_cs.pak */, + 2A3EC5E90DB5938F169F8A1C /* ui_strings_da.pak */, + 585D881341ADB1E66C55A49C /* ui_strings_de.pak */, + 100EB023F2DA2005C72B04F3 /* ui_strings_el.pak */, + 5D0959B70633F8D90C216DDF /* ui_strings_en-GB.pak */, + 14C68B169971C62D93A299B5 /* ui_strings_en-US.pak */, + E85A0832181D596715491B18 /* ui_strings_es-419.pak */, + C20E23727BD91D92D67D9980 /* ui_strings_es.pak */, + 44382DD411BD299BDE154EDF /* ui_strings_et.pak */, + 44A723FB55027DB9CEDE41A6 /* ui_strings_fa.pak */, + BFF104F15A6A249851306E5B /* ui_strings_fi.pak */, + B21D03DC680F4FD5CE10D719 /* ui_strings_fil.pak */, + 2362E106BA358E24CDBFA2D3 /* ui_strings_fr.pak */, + 9B984E9924117932C6ABE9EE /* ui_strings_gu.pak */, + B143F70E2B242100A3AC61A1 /* ui_strings_he.pak */, + A613E999829F80C375BF561C /* ui_strings_hi.pak */, + D307D6AF258938000F036E81 /* ui_strings_hr.pak */, + 8A59126EFE9C5D97F374F4E3 /* ui_strings_hu.pak */, + 2F9D1C00603D4F8A5C80D756 /* ui_strings_id.pak */, + A01E24D255497ECA6A00724B /* ui_strings_it.pak */, + 0E7E7A3D338D3815128F4FE1 /* ui_strings_ja.pak */, + C90513F9659799663F6F0EF2 /* ui_strings_kn.pak */, + 308A839E957D36AE47662CB5 /* ui_strings_ko.pak */, + EAA971EFC721FB184CA622B6 /* ui_strings_lt.pak */, + 55ED39C002EBB5CCD16E0BA3 /* ui_strings_lv.pak */, + 585DEF23D9BFD4D198D6EA33 /* ui_strings_ml.pak */, + C58453B51F977741B3755433 /* ui_strings_mr.pak */, + FE84C71E002AAD230CDFA753 /* ui_strings_ms.pak */, + 106433B6C1D2BC480CCB7ED5 /* ui_strings_nb.pak */, + F0C44F397DE57FF0BF3EE6B4 /* ui_strings_nl.pak */, + 69C916786797700DC9969DA2 /* ui_strings_pl.pak */, + AED60E39DA93EBF9C3361DB2 /* ui_strings_pt-BR.pak */, + 39E8E123C0A0556E41BB6D24 /* ui_strings_pt-PT.pak */, + D980F0A679089BE9FB4C1F47 /* ui_strings_ro.pak */, + 3E0E0DB9439B50E58A406601 /* ui_strings_ru.pak */, + 729A2C7E82535377AF318E1C /* ui_strings_sk.pak */, + DDFAD28E804B0154D4660646 /* ui_strings_sl.pak */, + 0F17041FB76E0352E317070D /* ui_strings_sr.pak */, + 0F027973D0ADA67E74793587 /* ui_strings_sv.pak */, + 8E4CDC7E28233AAF8A1353E0 /* ui_strings_sw.pak */, + F8008887AB40C8E030162213 /* ui_strings_ta.pak */, + 6569C982849C795FA1D77C0D /* ui_strings_te.pak */, + ED774CC9A6E41E3411B553FA /* ui_strings_th.pak */, + 054D552370799D9F7EACC73A /* ui_strings_tr.pak */, + 380B3BF381D78DB573A92FDA /* ui_strings_uk.pak */, + CC02ACE784927C69439BC632 /* ui_strings_vi.pak */, + 3C71276E1976DF076B0A55B4 /* ui_strings_zh-CN.pak */, + 8EC24B77969614A9E69D79F8 /* ui_strings_zh-TW.pak */, + ); + path = ui_strings; + sourceTree = ""; + }; + F0CD083F623E6A718A2A22F5 /* Products */ = { + isa = PBXGroup; + children = ( + D874478C6297A52B77C4472D /* libsystem_wrappers.a */, + ); + name = Products; + sourceTree = ""; + }; + F12E9AF2BA7517115998992F /* Products */ = { + isa = PBXGroup; + children = ( + 8A972F262B243A199E70827A /* libyuv.a */, + ); + name = Products; + sourceTree = ""; + }; + F2110F4DC49E005B1E51B67D /* Products */ = { + isa = PBXGroup; + children = ( + E3EFB43DABABCB5B5A738A2A /* libsfntly.a */, + ); + name = Products; + sourceTree = ""; + }; + FB929E32ABBBF57701094854 /* Products */ = { + isa = PBXGroup; + children = ( + EB159E178A7EBD4D052A34C7 /* libjingle.a */, + 16534921BF1B3E5292745B4E /* libjingle_p2p.a */, + 2F4B7D113B38123301170B05 /* libjingle_peerconnection.a */, + FD86F492F6C7DDEF4E61078F /* peerconnection_server */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 0493E18E77BAF61DDB854B47 /* cefclient */ = { + isa = PBXNativeTarget; + buildConfigurationList = F8BE8D5B24FBDFFAE459ADFB /* Build configuration list for PBXNativeTarget "cefclient" */; + buildPhases = ( + 363E6395E0705F8426E2F3E6 /* Copy to $(BUILT_PRODUCTS_DIR)/cefclient.app/Contents/Frameworks */, + 41B57737E8DFAF5F2FE86479 /* Copy to $(BUILT_PRODUCTS_DIR)/cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/ */, + B8B42A60AC7F478B1CBC517D /* Copy to $(BUILT_PRODUCTS_DIR)/cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/ */, + EF19C4CF1107FD1F8A1D58A1 /* Resources */, + 52AEDA1BA716D79F5BB98D8F /* Sources */, + 9705A89604762C019F4CA5B7 /* Frameworks */, + 75E283402CB05DC628E11273 /* Postbuild "Fix Framework Link" */, + 03A6A45959528523C7D649EA /* Postbuild "Copy Pack File" */, + 3639EADC695DADA070AB399B /* Postbuild "Copy WebCore Resources" */, + 3C9AFFAC17C9AC4410282CC2 /* Postbuild "Tweak Info.plist" */, + AD62A6B22A45C4C5A439D10C /* Postbuild "Make More Helpers" */, + BB7AE9DBAC3E98B040D5A1E1 /* Postbuild "Change Mach-O Flags" */, + C877D034A6CB2A4B434403D2 /* Postbuild "Strip If Needed" */, + ); + buildRules = ( + ); + dependencies = ( + FE2FCE7EA59AC634052A5124 /* PBXTargetDependency */, + C7E3361284E1F7D7C26E2D86 /* PBXTargetDependency */, + A67F761434AA6D80B00A4461 /* PBXTargetDependency */, + C759DC2977118579D0A96459 /* PBXTargetDependency */, + 00CC8BAF0A7A8E509848A36A /* PBXTargetDependency */, + F62CE60DD219AB04B67F1065 /* PBXTargetDependency */, + 70E8027D63C1504658A02E3A /* PBXTargetDependency */, + F2BB4FA3B940C07D89157EC9 /* PBXTargetDependency */, + CBEC0AD6362E3C9763E6645D /* PBXTargetDependency */, + 99BDB901D446F13EC2438D13 /* PBXTargetDependency */, + 028099C6F71DC42913A49104 /* PBXTargetDependency */, + 540798F295EEAC241257CEB8 /* PBXTargetDependency */, + 5BBB719F52008A86D3804FAB /* PBXTargetDependency */, + FC74A51F8B1C1F3E93952A9C /* PBXTargetDependency */, + 8086F1C2F886BB0FA6C3808C /* PBXTargetDependency */, + 1066787E3F98599D487F6AD9 /* PBXTargetDependency */, + F1C03BDF885790512F75EB01 /* PBXTargetDependency */, + 1539050364269C63EB69EB20 /* PBXTargetDependency */, + DBC2E821446337E0737E7AA1 /* PBXTargetDependency */, + 36DDF6E7056E8715A37E34EB /* PBXTargetDependency */, + FF0396C5BADD3C1A6445DEE2 /* PBXTargetDependency */, + 7B01A2656BB896DD657E03F2 /* PBXTargetDependency */, + 68D746A8CD1006F0100D1ED9 /* PBXTargetDependency */, + F0CA185DCC290D621BFBCFD1 /* PBXTargetDependency */, + 228E575EBCFD2F5AF4642E1B /* PBXTargetDependency */, + ); + name = cefclient; + productName = cefclient; + productReference = 335F63827821FB9FB71D0599 /* cefclient.app */; + productType = "com.apple.product-type.application"; + }; + 26DD2CB0340D816F3DF64EC9 /* libcef */ = { + isa = PBXNativeTarget; + buildConfigurationList = 86C662A5BDD8770B165021CD /* Build configuration list for PBXNativeTarget "libcef" */; + buildPhases = ( + 15AAF6C809448EC005E189B1 /* Sources */, + BCCF06AC835461591F8E6D9B /* Frameworks */, + DC5E0389A842A86C8885389B /* Postbuild "Strip If Needed" */, + ); + buildRules = ( + ); + dependencies = ( + A8475ADAE98E744D60D4FA2D /* PBXTargetDependency */, + 28A055A00F3B727579EB90E8 /* PBXTargetDependency */, + C87925E134D9B5DED1872997 /* PBXTargetDependency */, + 484AFC5054BDB319C75B4EAD /* PBXTargetDependency */, + 3C80EE74550ECE50F416926A /* PBXTargetDependency */, + 8CC7119C59AED674DDEC33A9 /* PBXTargetDependency */, + 66C1553721A4251B5FF2BE19 /* PBXTargetDependency */, + ADFE0487AC629536E7D3EEE9 /* PBXTargetDependency */, + BD97A80B0F044A62288E0E16 /* PBXTargetDependency */, + 6155A0EC77BD3E6FD922A778 /* PBXTargetDependency */, + 8BEC2A9DA21546398AE15AB4 /* PBXTargetDependency */, + F6209F2F154B8EDAC16F5D24 /* PBXTargetDependency */, + D4B32F5B63922E4C30765E62 /* PBXTargetDependency */, + 69D9011739B5C00D91962EE4 /* PBXTargetDependency */, + F8D0C8803EDBC67FD6553421 /* PBXTargetDependency */, + 52274D1E656EA0F4A7052558 /* PBXTargetDependency */, + 296095DCF49A827D4A9CD0DD /* PBXTargetDependency */, + 758D8664DBCA67282B14DC0F /* PBXTargetDependency */, + 6EBD39DE2A1C669C32FBE0EA /* PBXTargetDependency */, + 84796E5A790BD8AE52D809D9 /* PBXTargetDependency */, + 982664829BD1394D4FBAC30E /* PBXTargetDependency */, + F2679D3E14329F842B356CAA /* PBXTargetDependency */, + 4B72BEDE7217B509D2600B9F /* PBXTargetDependency */, + 1BDDEB568DB5442E20CAE6DF /* PBXTargetDependency */, + 3C5BF9FDE0FA061D4E213715 /* PBXTargetDependency */, + D4C3FDD69C6792EF9A1FCAA7 /* PBXTargetDependency */, + A5CD4A0369A1F5A93C9B1CE4 /* PBXTargetDependency */, + 8A1A94222C247E6B927783B4 /* PBXTargetDependency */, + A4427590BB7DD68EACBC16D7 /* PBXTargetDependency */, + D7C35C1D4B238BC1476638C8 /* PBXTargetDependency */, + 4B44D3877B1417EE50334F8C /* PBXTargetDependency */, + 9F4D474C6AAFDFD20ED9BDE4 /* PBXTargetDependency */, + 87DEEE47CF06B777B5004DC4 /* PBXTargetDependency */, + 897B18EA020CD10C5C92630A /* PBXTargetDependency */, + 37577390E57F4FBF244B1678 /* PBXTargetDependency */, + CB20BF2B84CAE7083B2F2609 /* PBXTargetDependency */, + 3766D1A3950B959D5CE56D1A /* PBXTargetDependency */, + A91AA97476150E261D8035AA /* PBXTargetDependency */, + 30541C58BCABF7CA64100986 /* PBXTargetDependency */, + E7D004A9273847E38D358ED2 /* PBXTargetDependency */, + 8EC605E0120603FBAC00E26F /* PBXTargetDependency */, + DB4DB9A8D28928F15DC54961 /* PBXTargetDependency */, + A36499018124CA3345F02A46 /* PBXTargetDependency */, + 86C35E93660FB4836609A431 /* PBXTargetDependency */, + 227432A6F74AFF42EFBFEF87 /* PBXTargetDependency */, + 91E61E43A283207178B02A1D /* PBXTargetDependency */, + 64644ABAC504E64F7A9CDB36 /* PBXTargetDependency */, + 401B9B206A61F21C85E51C75 /* PBXTargetDependency */, + E52010F8FD971760FCEFF954 /* PBXTargetDependency */, + F0B723B4F97690C506395CBB /* PBXTargetDependency */, + 8DBD55E95FAF06BFAB060981 /* PBXTargetDependency */, + 3E9D7987872A083EC773AFEC /* PBXTargetDependency */, + B784D096609A64A036DEC09E /* PBXTargetDependency */, + 97FD452B6EB19DF401DA8B03 /* PBXTargetDependency */, + 953B2BFA40E139C4CDC72CD7 /* PBXTargetDependency */, + D865DA821ED58CBF81B167B0 /* PBXTargetDependency */, + 39EBC6589AAC582B3EC95EA2 /* PBXTargetDependency */, + CECE00B958801956686E3535 /* PBXTargetDependency */, + 2D13543C7300F6E4DA78AAE5 /* PBXTargetDependency */, + 7CF98C7700E3B8EA4CE8E593 /* PBXTargetDependency */, + A1A072890819927711EF0762 /* PBXTargetDependency */, + C2EE1EC0A89FB359F99930D4 /* PBXTargetDependency */, + 4FA57FD67641983A172A7AEA /* PBXTargetDependency */, + ED1F3DA1BF2CBD12B366DC8E /* PBXTargetDependency */, + A8D88718842A615C2E5F8AE9 /* PBXTargetDependency */, + 018FE750CF501704E7933F75 /* PBXTargetDependency */, + 34CC444EF3CAADBEF921E3E1 /* PBXTargetDependency */, + 909C73A418602D84E1ED31B4 /* PBXTargetDependency */, + AC5FB89F35A36E5480C739CB /* PBXTargetDependency */, + 188EA8ED60991519923E9381 /* PBXTargetDependency */, + 08F502C3BD79E57B00A009D4 /* PBXTargetDependency */, + E55705F2149D6E6B4377C1E9 /* PBXTargetDependency */, + 6214A01CB11669182FA76449 /* PBXTargetDependency */, + 4B50B513F5D397E7DB633513 /* PBXTargetDependency */, + DF46FDAE1F4C33EF1A3EF27C /* PBXTargetDependency */, + 17CE9CB2BD146E5D3C69E0F8 /* PBXTargetDependency */, + 01DDDBD6CC9D07715FF38356 /* PBXTargetDependency */, + 20EB5AB3F0C0920F58F61675 /* PBXTargetDependency */, + 5984773E310FA1F734FDE1C8 /* PBXTargetDependency */, + 891C540F1779E4D880D78A77 /* PBXTargetDependency */, + 585AA89D4631F08224C9D00B /* PBXTargetDependency */, + 8EFB690D89687BDE3CDA4DA8 /* PBXTargetDependency */, + F62351C167200E946175EF15 /* PBXTargetDependency */, + E6A5E45AC2BBCA574F629848 /* PBXTargetDependency */, + D62A77AB9AF0B5C6CA6DD10A /* PBXTargetDependency */, + FB2DDCC207B854AD4FA2BD55 /* PBXTargetDependency */, + 44BE494DF00E33217EADB95F /* PBXTargetDependency */, + D4E971F7303C938071EC5A2E /* PBXTargetDependency */, + 0C9993BD290C3BC779AA5C05 /* PBXTargetDependency */, + 3ECFFA6BB917CB66E5928EAF /* PBXTargetDependency */, + 246B87C2FE1BA5EC2FA1754D /* PBXTargetDependency */, + 32541601F69C527499C9016D /* PBXTargetDependency */, + 590BE005DE4FAC19AAA1F968 /* PBXTargetDependency */, + CED29D01F7E6B437AA1B8F55 /* PBXTargetDependency */, + F43C88B1CC50EBB3FAEECBDE /* PBXTargetDependency */, + 9271BC0F42F41DBB3313BEA0 /* PBXTargetDependency */, + 018018695BEDC2B974BDE164 /* PBXTargetDependency */, + 6FF9442036876548B657834F /* PBXTargetDependency */, + 652D7D5F084AE948D073F4B6 /* PBXTargetDependency */, + 1A11351E16DCE360168336ED /* PBXTargetDependency */, + 0FF7D98572DAD9E964B21030 /* PBXTargetDependency */, + 0E5AD89016FFF8CEF869D1C3 /* PBXTargetDependency */, + 8567BB2B3AFE7442A6E3F7F7 /* PBXTargetDependency */, + 93E425833C2643FD23FE1F7C /* PBXTargetDependency */, + F8DA36B1F207ED049BC8B1B0 /* PBXTargetDependency */, + E2E90A60156F59E4170DA218 /* PBXTargetDependency */, + 9F0F24CBA9265CCC260D748E /* PBXTargetDependency */, + A6F6C80051573A8B72D17E68 /* PBXTargetDependency */, + C216A1EF9DFFA341DD1FF0A0 /* PBXTargetDependency */, + 3483302F5089952C0B1A341B /* PBXTargetDependency */, + CEAF706BE29DF4FC8007A5FA /* PBXTargetDependency */, + E8B5563B938B7089EFCAF709 /* PBXTargetDependency */, + EC4968AF05ED345F4C0568B0 /* PBXTargetDependency */, + 07D1D14CEBA3794874E91835 /* PBXTargetDependency */, + F4B1DAFAEBE2F272F77A1157 /* PBXTargetDependency */, + C7A76CE1D0D1DA3B256C2CFF /* PBXTargetDependency */, + 941A82AECCF13B61507D8FCA /* PBXTargetDependency */, + 4CE756CB03A45F41A46F30E6 /* PBXTargetDependency */, + F34A8190B10255E6B5E7245E /* PBXTargetDependency */, + BAAC718AEE06C92454F0C470 /* PBXTargetDependency */, + 8401EAD11384253DFEBD95AC /* PBXTargetDependency */, + 1CDC06A90ADFB3628D4737E4 /* PBXTargetDependency */, + 0E48D108765D5175A14C18C8 /* PBXTargetDependency */, + 69735C3504CA6548644E20D5 /* PBXTargetDependency */, + CCABC28C7229D914B0166755 /* PBXTargetDependency */, + 2259BFCC7F2B441712F43DAD /* PBXTargetDependency */, + 526DB93E57BF32C87DE2100E /* PBXTargetDependency */, + 126B209540241A45504C408E /* PBXTargetDependency */, + FB18C19A700F0008333FB2B2 /* PBXTargetDependency */, + E8C18615379C40545C7FBE21 /* PBXTargetDependency */, + BDFFE2C07E56354EAD8A1832 /* PBXTargetDependency */, + 7B345739958F21CEF1622363 /* PBXTargetDependency */, + FDB175F4706DD32BC8642CBA /* PBXTargetDependency */, + 0EC294FA5E7846C044B3D311 /* PBXTargetDependency */, + 5A958BB0525526F334EFCF04 /* PBXTargetDependency */, + 6D296BB1F607881183C98EEA /* PBXTargetDependency */, + 6B09209542CB7F47787DFF80 /* PBXTargetDependency */, + 924FE3007F44A850F3D98B29 /* PBXTargetDependency */, + 83A968FEC9B77B6C1760E272 /* PBXTargetDependency */, + 08F034B898C717EC093423AA /* PBXTargetDependency */, + 3ACD8CCE9DE5AC89B1617302 /* PBXTargetDependency */, + 68FDF28FDCEE90BB367CB7AB /* PBXTargetDependency */, + A7B693B69170AA4ECA288790 /* PBXTargetDependency */, + EFC63B579D17F4D1B0766435 /* PBXTargetDependency */, + 8C7AA0A739649197931E39F8 /* PBXTargetDependency */, + 0D6A729B06C9C99F67688304 /* PBXTargetDependency */, + 04277D2C7B69F2426AA0B6B4 /* PBXTargetDependency */, + 773248346B27F6A58720474E /* PBXTargetDependency */, + 532D9A1513C8583C40E0A2A3 /* PBXTargetDependency */, + AF8AAC0FA463088CFDC7406F /* PBXTargetDependency */, + D9C35CBA4217039633C22450 /* PBXTargetDependency */, + 09015733EC03E44F76E49F8B /* PBXTargetDependency */, + 9ECA24FA1C1D782D51C509E5 /* PBXTargetDependency */, + 2848E0BD5FE75507C5044611 /* PBXTargetDependency */, + 3A45BD1F2320206C7BBC081B /* PBXTargetDependency */, + B44FB998F5B58EAF00144080 /* PBXTargetDependency */, + B46F40D25EA68E98ED7AC4DF /* PBXTargetDependency */, + 28B0906BC92410A1E8A22A04 /* PBXTargetDependency */, + 11763C99A26EC98C83F45C00 /* PBXTargetDependency */, + 9D98F90F0B2D2CF1B34D9349 /* PBXTargetDependency */, + B2D9D83008DF76C3EFA8EB71 /* PBXTargetDependency */, + DD648AE0CEAD3B920AD2C49E /* PBXTargetDependency */, + 945ED72D954B41788CDFF222 /* PBXTargetDependency */, + 27D3B3479115A3226A63E602 /* PBXTargetDependency */, + B2A78482BA3852DC25AF5ECC /* PBXTargetDependency */, + 083D93B1EA1202E1D5BEEDEE /* PBXTargetDependency */, + 209C1916E50D686D8974ACE0 /* PBXTargetDependency */, + EE182D9359430CBC11B12B17 /* PBXTargetDependency */, + B7441324E2ACE24C3AD58F27 /* PBXTargetDependency */, + FC4FC4583C47C1909FF4DDB4 /* PBXTargetDependency */, + 38F06282E6CF6FC3E204D074 /* PBXTargetDependency */, + 5A33A3E27755B7349EAE1EA7 /* PBXTargetDependency */, + 0561F12C1B4E226E9EC4580C /* PBXTargetDependency */, + 68C922E53442F67D9724E7B6 /* PBXTargetDependency */, + 17024752957D72AC3993E625 /* PBXTargetDependency */, + 72BB74C982A49A0091FE7005 /* PBXTargetDependency */, + 7F6FD1F99EE06A9DD7E96CF4 /* PBXTargetDependency */, + 23E4C15A4B2CDA370FE05EBA /* PBXTargetDependency */, + 535B42FD5E84DB25FD9B6F6C /* PBXTargetDependency */, + C191AB6D80B73206C3EFB700 /* PBXTargetDependency */, + EE4FDA1878F278A35FA3AFC9 /* PBXTargetDependency */, + 358CC58FB67EB73F37C2B942 /* PBXTargetDependency */, + 6B1D91115389C6B23FF2CAC1 /* PBXTargetDependency */, + 34E5A9255A3CA3C752E30B29 /* PBXTargetDependency */, + 98238BABFA753D2FD44BF099 /* PBXTargetDependency */, + 1DB8A60BF127EBE36599760F /* PBXTargetDependency */, + 23DC6924F1BFDA9085F1F23A /* PBXTargetDependency */, + C3A8950A78F771F433883B03 /* PBXTargetDependency */, + 5EEC34626F2BEE1D822A64F3 /* PBXTargetDependency */, + CB10DA56733DE60BA0001808 /* PBXTargetDependency */, + ); + name = libcef; + productName = cef; + productReference = 6E33046A4EDB56251FF60662 /* libcef.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + 8DBADDE353DC46B377FC4192 /* libcef_static */ = { + isa = PBXNativeTarget; + buildConfigurationList = DC556C973BE9072C58775672 /* Build configuration list for PBXNativeTarget "libcef_static" */; + buildPhases = ( + 89C81779558346D9923CB00A /* Sources */, + FF7A801E01D9A5D08874F92D /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 2A2FCF7E43A072536BC50158 /* PBXTargetDependency */, + 1336D33832312F64220373F9 /* PBXTargetDependency */, + DE33C57E5B2E869B66768B55 /* PBXTargetDependency */, + 6ECA079A6DC4163BA797402E /* PBXTargetDependency */, + 7C1A473A79B462ADBABDF0BE /* PBXTargetDependency */, + 4A07CB85D4649A637B0A72BD /* PBXTargetDependency */, + ); + name = libcef_static; + productName = cef_static; + productReference = 3555939C4755250EAA5AE2D0 /* libcef_static.a */; + productType = "com.apple.product-type.library.static"; + }; + 94BAF60C7C90712E7F239E35 /* libcef_dll_wrapper */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6BE12BAEC226B0826AF78434 /* Build configuration list for PBXNativeTarget "libcef_dll_wrapper" */; + buildPhases = ( + 4A0EC8CCC35A03E5F9AFDB2C /* Sources */, + 0EFC4FEA51E5E61F716A04B7 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + E48C1957A87A9D58917A490B /* PBXTargetDependency */, + ); + name = libcef_dll_wrapper; + productName = cef_dll_wrapper; + productReference = 9BDB4C89AB31661B24EC5AD7 /* libcef_dll_wrapper.a */; + productType = "com.apple.product-type.library.static"; + }; + A9EF68F8BF3234583509BD43 /* Atom */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1174878B18A3C3D3A426A10D /* Build configuration list for PBXNativeTarget "Atom" */; + buildPhases = ( + 21654BF73893AF5F2F54CB22 /* Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks */, + BB909587FCDAA5C2AEB69999 /* Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/ */, + 110C3A0677FD3FB02DC58AA3 /* Copy to $(BUILT_PRODUCTS_DIR)/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/ */, + 6817CDB95BD034F292DA8F53 /* Resources */, + CC4ADB3EA7D1A4EAE3B45DDA /* Sources */, + 714FEC28B84B5C81930A0035 /* Frameworks */, + 54CA849DD7D891C030CFAB8D /* Postbuild "Fix Framework Link" */, + 0310BBDDD26FDFD9481502AE /* Postbuild "Copy Pack File" */, + 8FACF06540BB4D8E03202976 /* Postbuild "Copy WebCore Resources" */, + F893089D73E0B020449C4564 /* Postbuild "Tweak Info.plist" */, + 088D60E05B862F8EDEEF51C9 /* Postbuild "Make More Helpers" */, + 6E9206029272010913615E30 /* Postbuild "Change Mach-O Flags" */, + 81B48C19E2353482EA798BDC /* Postbuild "Strip If Needed" */, + ); + buildRules = ( + ); + dependencies = ( + 83709877BB29B37B1C92BD69 /* PBXTargetDependency */, + 33FA3CE13523A005F6637542 /* PBXTargetDependency */, + B8C2F9932BD812C91648B312 /* PBXTargetDependency */, + BFF345F0E2483933810B4967 /* PBXTargetDependency */, + 7778D2B4810EEB8B13596EFC /* PBXTargetDependency */, + 1DAAEBBDC21120A2BA5554CD /* PBXTargetDependency */, + A377701C78E94637691E4540 /* PBXTargetDependency */, + AFE212C0CA2DAF8A25E3240F /* PBXTargetDependency */, + 59B6C06E60371905C023EF88 /* PBXTargetDependency */, + 6E9F702DBF56871D8784C659 /* PBXTargetDependency */, + EC7DE7ABB6CCA086B36CB92B /* PBXTargetDependency */, + 8FA2690062158BFBA8709A0A /* PBXTargetDependency */, + 8FDB318D702CDB5B50573BA0 /* PBXTargetDependency */, + DA3D488D325CBBFB1762FA73 /* PBXTargetDependency */, + E6A0A8A887CA18F8E51725DC /* PBXTargetDependency */, + 7D15E4AD75676E3C2481F28A /* PBXTargetDependency */, + 30949FF2FD6FE023AAD0C599 /* PBXTargetDependency */, + F1B2B92053DF854D163A1553 /* PBXTargetDependency */, + CABA16FFBF964F3E0877AE92 /* PBXTargetDependency */, + F8FBEA78C0E87AC82CC5990F /* PBXTargetDependency */, + 5AA84938089115DBA6AF746D /* PBXTargetDependency */, + CFEE9A8D3AFA97BC2AC56599 /* PBXTargetDependency */, + 9C5E1EF2C1DB083B2B44725F /* PBXTargetDependency */, + 4EA8325CB5958DA70F4EA0F6 /* PBXTargetDependency */, + 2ADCFE2607C12E72B11E5956 /* PBXTargetDependency */, + ); + name = Atom; + productName = Atom; + productReference = 217AE35B8A9BA24CD3E26EFA /* Atom.app */; + productType = "com.apple.product-type.application"; + }; + DA259FAFFD7136C8A5C881A8 /* cef_unittests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9368946EEA5D018D56087305 /* Build configuration list for PBXNativeTarget "cef_unittests" */; + buildPhases = ( + 9DDB81FEBAA8E1149D805F39 /* Copy to $(BUILT_PRODUCTS_DIR)/cef_unittests.app/Contents/Frameworks */, + CEBDE3A692F8AF3998E534C0 /* Copy to $(BUILT_PRODUCTS_DIR)/cef_unittests.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/ */, + A19B3F0175919B22410392C8 /* Copy to $(BUILT_PRODUCTS_DIR)/cef_unittests.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/ */, + 905C10454B56710E20BFBB4C /* Resources */, + 2B59DED28F1CA97C1BEDABA0 /* Sources */, + 50130A990C148A218B7C3BD9 /* Frameworks */, + D3A607D63C1C6C789F5BFEE9 /* Postbuild "Fix Framework Link" */, + F530C19B5115115D7A7639EB /* Postbuild "Copy Pack File" */, + 4E78B13E3141E87A1C8839E4 /* Postbuild "Copy WebCore Resources" */, + 5242EEED2E14B727C773C262 /* Postbuild "Tweak Info.plist" */, + 0302AE1153B70E8F68D38370 /* Postbuild "Make More Helpers" */, + 499266B4B1AB1CE16FF810FC /* Postbuild "Change Mach-O Flags" */, + 9D7F4F37E16955CBDBB8B64A /* Postbuild "Strip If Needed" */, + ); + buildRules = ( + ); + dependencies = ( + 82853600193836A7ABE4CB69 /* PBXTargetDependency */, + 03924FAB6548882A8FA3FDF9 /* PBXTargetDependency */, + 9DAA018E161C538137C5B4DC /* PBXTargetDependency */, + C61CF4352A96E883FBD8648A /* PBXTargetDependency */, + B52B6B2CBB3D2EB5891AABEE /* PBXTargetDependency */, + A5FB2BD7F7D8DB45EFEFC723 /* PBXTargetDependency */, + 820BF79B902B5306B8BBFDB2 /* PBXTargetDependency */, + CD34116734A4250D23757470 /* PBXTargetDependency */, + 84B18BC5C21E915281D4A860 /* PBXTargetDependency */, + 078F3BFD741FC0181D2C5BFB /* PBXTargetDependency */, + CFDD3160FFD38A5A103F5C46 /* PBXTargetDependency */, + 1C5C1B9FA301D7CB56AE9719 /* PBXTargetDependency */, + D73B1CC21AE30C491438895B /* PBXTargetDependency */, + C0AA512C56B4CA181B73FF42 /* PBXTargetDependency */, + 30F2FE0EF3498498F5EF043D /* PBXTargetDependency */, + 278B38B322EEE5AF0A1E5673 /* PBXTargetDependency */, + 30C396F70D462E8540382230 /* PBXTargetDependency */, + E9CA9A04B2BB0C839FE53EF9 /* PBXTargetDependency */, + B04DD3BCCD24DDA72185A9D0 /* PBXTargetDependency */, + 8E2FD9149B8727F536867E00 /* PBXTargetDependency */, + 738A5BE7BA4CD9DAEBBBDF83 /* PBXTargetDependency */, + 878CE2270DE477FFA158E094 /* PBXTargetDependency */, + DAC5C714D00EB16221DE217C /* PBXTargetDependency */, + 4143A681BF1DAF2414D46C6E /* PBXTargetDependency */, + DA435D4861F6629421F8206F /* PBXTargetDependency */, + 8C8142F6763B303179E6C0DF /* PBXTargetDependency */, + 35C900F57711847D325F6627 /* PBXTargetDependency */, + F7BC8BF9A2CEC8FA8D4992A3 /* PBXTargetDependency */, + 8718C8550C80AE7CE8AF0A35 /* PBXTargetDependency */, + 0817E1BB3B61065DBC1A264D /* PBXTargetDependency */, + 963672EBBDDD69ADEADDF56D /* PBXTargetDependency */, + 4511C4D866B66A8B4AB452E2 /* PBXTargetDependency */, + 0723211F3CD6BED158C58898 /* PBXTargetDependency */, + A04FC7E1DE747D5F75E4402C /* PBXTargetDependency */, + 9995E522BA205FE09383D33B /* PBXTargetDependency */, + 54066FF3F964DB2600B6C979 /* PBXTargetDependency */, + 0CDB92373DDC2A1C014AE337 /* PBXTargetDependency */, + C40EFA3F6D1C6F9DE6D4C2DC /* PBXTargetDependency */, + 665F71C74381066EF3169B9C /* PBXTargetDependency */, + 510B2B2D9E49DB29CC008B1F /* PBXTargetDependency */, + ); + name = cef_unittests; + productName = cef_unittests; + productReference = 60FDBC13FBB130A5982C0CC1 /* cef_unittests.app */; + productType = "com.apple.product-type.application"; + }; + DA98FB3E241B73BA47200DFF /* AtomHelperApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3C1ACB3AF7F069E5CDF14E2C /* Build configuration list for PBXNativeTarget "AtomHelperApp" */; + buildPhases = ( + 660B06395030BC8F8F5AFAEA /* Sources */, + B903C7B9144BA6DAAF123B1A /* Frameworks */, + 4D8A02B632CBD7D3A480A954 /* Postbuild "Fix Framework Link" */, + 2A4EBA340C9E27703AF0630F /* Postbuild "Tweak Info.plist" */, + 8B7A5C0773D0725D94DACA20 /* Postbuild "Change Mach-O Flags" */, + 175A437AC43F027F233A6A47 /* Postbuild "Strip If Needed" */, + ); + buildRules = ( + ); + dependencies = ( + 7739908E957DA2487EBDB6C6 /* PBXTargetDependency */, + 6342CE64CFD5181540EAB3F8 /* PBXTargetDependency */, + EF89825F1F1D8C085B2D062D /* PBXTargetDependency */, + 9853FA541A219C3E1892FEEF /* PBXTargetDependency */, + E7BF5B47F1BE81DC0321B9FB /* PBXTargetDependency */, + D4A81AA031FDFFFD564D116A /* PBXTargetDependency */, + 61BE2B6370F8609262DC4E31 /* PBXTargetDependency */, + C21C8DF836E38F82A780D9E0 /* PBXTargetDependency */, + 178013DF56ED7719DAD441AF /* PBXTargetDependency */, + 5CCB13FAA4B13E6EA39F80B0 /* PBXTargetDependency */, + D6269028369F81CEE750919B /* PBXTargetDependency */, + 7F6CA27CDFC510F192395E0A /* PBXTargetDependency */, + AFBD472159527629D176CDD1 /* PBXTargetDependency */, + 63539F42A4F447AAADF3C4FD /* PBXTargetDependency */, + 65E8BAA34C272E4797C6C8B4 /* PBXTargetDependency */, + DCA81FD0679CDBDC87C90B95 /* PBXTargetDependency */, + 3632689D80672EE57D218C9C /* PBXTargetDependency */, + CACF350ABA7092F2EED4885B /* PBXTargetDependency */, + AF9CFE3BE26BBFB2EC760464 /* PBXTargetDependency */, + AD3C01CD58386E99F4993BBC /* PBXTargetDependency */, + 42B0C642B26E234B18115A7B /* PBXTargetDependency */, + 7F7A47B4E066C7FBB4D5D6B6 /* PBXTargetDependency */, + 165E18E56A410771B0140D0B /* PBXTargetDependency */, + 37AEFBDF1CC93EBF210DBE84 /* PBXTargetDependency */, + ); + name = AtomHelperApp; + productName = "Atom Helper"; + productReference = 9F7159CBC485389851637A19 /* Atom Helper.app */; + productType = "com.apple.product-type.application"; + }; + DCB001A34DDB8A1DBDB1A9C4 /* cefclient_helper_app */ = { + isa = PBXNativeTarget; + buildConfigurationList = DC1D5F02BEA3B133DF72CAA5 /* Build configuration list for PBXNativeTarget "cefclient_helper_app" */; + buildPhases = ( + 44932A9FD29C6A7F954CE8EC /* Sources */, + 2E3453E8D91CCB4E6DE1F68A /* Frameworks */, + AAEB415B37B6A705C7DAC877 /* Postbuild "Fix Framework Link" */, + 292469D37E7F54C53612D2DA /* Postbuild "Tweak Info.plist" */, + B7F19AED801FC55033369354 /* Postbuild "Change Mach-O Flags" */, + CD9DA8F3139BF447C6EAD60F /* Postbuild "Strip If Needed" */, + ); + buildRules = ( + ); + dependencies = ( + C3FEC5456936C6187B8524BE /* PBXTargetDependency */, + B361D916D0D9478CEBCCB194 /* PBXTargetDependency */, + 470884EB5CF60CE0EE9DB6EE /* PBXTargetDependency */, + C679DF31865E8994EB9FF3A8 /* PBXTargetDependency */, + 597AC5141DD941EF7CDACCC5 /* PBXTargetDependency */, + 67A1D1E1FED91745EDA96C3E /* PBXTargetDependency */, + 4B25B32F1D89C5E158C8331A /* PBXTargetDependency */, + 0073BA28D4FD916D20F04F74 /* PBXTargetDependency */, + 0BA49104A34A8D7896E9882E /* PBXTargetDependency */, + 0BAC8CD9FDD4640303922A85 /* PBXTargetDependency */, + D9C00D60B7473D8C80DC41B1 /* PBXTargetDependency */, + 9557816F1C288E829259A841 /* PBXTargetDependency */, + 078CA1911D3E9BBDACA768C7 /* PBXTargetDependency */, + E14394DC375369022496EB91 /* PBXTargetDependency */, + 50C55A37345BF5C79B0B724F /* PBXTargetDependency */, + 6E07A063DBC6CCB26CA157E7 /* PBXTargetDependency */, + 077955227EBB7E8C64D6F56A /* PBXTargetDependency */, + 8AEBB66F831D51043D88869F /* PBXTargetDependency */, + 65DB4F9FB555B097100DAF88 /* PBXTargetDependency */, + 56F918F1487EA8627F78BECF /* PBXTargetDependency */, + 7F224C17F06B6D071BFCB52D /* PBXTargetDependency */, + 3B680DD8EBAA46AFDBC353B0 /* PBXTargetDependency */, + 9DDDB808257CA7E6873741B7 /* PBXTargetDependency */, + 2FC3271BF0ACE651BC4DB637 /* PBXTargetDependency */, + ); + name = cefclient_helper_app; + productName = "cefclient Helper"; + productReference = E5BBF422E9D920423158F973 /* cefclient Helper.app */; + productType = "com.apple.product-type.application"; + }; + EF59E18D1B94CB26A18E3A3E /* cef_unittests_helper_app */ = { + isa = PBXNativeTarget; + buildConfigurationList = C55EAE453ACD4BF4839354A4 /* Build configuration list for PBXNativeTarget "cef_unittests_helper_app" */; + buildPhases = ( + 486323A0EF1B8BEF51AFE250 /* Sources */, + C28AC5467575EA30992399FC /* Frameworks */, + BFEFD08C1BBEBBF67A1479FE /* Postbuild "Fix Framework Link" */, + FC00781F5CB1A05417F28E8C /* Postbuild "Tweak Info.plist" */, + 9308A67602FDE42160C8E44C /* Postbuild "Change Mach-O Flags" */, + 83404D3B1F90F336C021A2E4 /* Postbuild "Strip If Needed" */, + ); + buildRules = ( + ); + dependencies = ( + FA5AC5784CF82BFB7E445A9A /* PBXTargetDependency */, + BC1DA3A1A8DFBD458309DF84 /* PBXTargetDependency */, + 34874AC4FDC6FB72CF5ED754 /* PBXTargetDependency */, + DDCBA090E5F6FF449541DC7B /* PBXTargetDependency */, + 61A456F2E4CE1E590E747210 /* PBXTargetDependency */, + 6EE720636749E5E8D20D3C24 /* PBXTargetDependency */, + 2C8D5E18F97214B83BEEF6C8 /* PBXTargetDependency */, + 56118112E14FFBF55D8084EA /* PBXTargetDependency */, + 43379012EACDB04007B211F0 /* PBXTargetDependency */, + 8480066A6E189D3624BDD3A8 /* PBXTargetDependency */, + A55B35614B8A8FC163035C1F /* PBXTargetDependency */, + 4C8387146A53FC00CEF17B71 /* PBXTargetDependency */, + A97C19D15AADB7375DA5485B /* PBXTargetDependency */, + 75EC6347006D1C82D1B06767 /* PBXTargetDependency */, + F9BD1E0CF1BF1CE250FDCB42 /* PBXTargetDependency */, + ADCFE4A390ACB5E254E38CE6 /* PBXTargetDependency */, + 8EBF9843D6C38CD7C4AC69F1 /* PBXTargetDependency */, + 4781DDA43F8F114DA7235E0A /* PBXTargetDependency */, + 8427FB00951CA3A5F7D993B7 /* PBXTargetDependency */, + 0B2DA38336A0CD7301071411 /* PBXTargetDependency */, + A6C858D0BD86057FE8BB2887 /* PBXTargetDependency */, + C16A64F27789BF415AD72E91 /* PBXTargetDependency */, + E65DBA579EE92F66AC6A4E39 /* PBXTargetDependency */, + 6DACA229296F828AF8BE82B1 /* PBXTargetDependency */, + 85B644EEBF2C8180377F5192 /* PBXTargetDependency */, + FA1E0AA7915B8467B9684838 /* PBXTargetDependency */, + B9A773106F83A6413A6687D9 /* PBXTargetDependency */, + 7B0D02ED61E3BACDBE6F8E0E /* PBXTargetDependency */, + 0EEFA96B104BF2376354DA78 /* PBXTargetDependency */, + F48E6804BAFE55960848350C /* PBXTargetDependency */, + 54B1DFD416D553261C4028D5 /* PBXTargetDependency */, + 2CA9E7BBCC486304F39922B0 /* PBXTargetDependency */, + 6E14ACED0E6E4B5CFC38B4A0 /* PBXTargetDependency */, + 8A31E76F00A065F4571D0CCD /* PBXTargetDependency */, + 4C3F317B91120655483110A3 /* PBXTargetDependency */, + 6A02A30D7D8D7C69FAE0475D /* PBXTargetDependency */, + B7F2A5490315CF7FEED0A128 /* PBXTargetDependency */, + C982BD4CEA60C1EE560E1E0F /* PBXTargetDependency */, + 9B20F39FB9E5BE58F0110E5F /* PBXTargetDependency */, + ); + name = cef_unittests_helper_app; + productName = "cef_unittests Helper"; + productReference = E0F66F6372DC53DDA571C522 /* cef_unittests Helper.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + C2F20C4F45FBF5D7ACC93412 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + }; + buildConfigurationList = 705B3EDF846FDFBBD2B42764 /* Build configuration list for PBXProject "cef" */; + compatibilityVersion = "Xcode 3.2"; + hasScannedForEncodings = 1; + mainGroup = D926808B308378706FD7D1A3; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 522233B92E9BC54056C720A5 /* Products */; + ProjectRef = 25EEC66C5B03F5672152ACCB /* all.xcodeproj */; + }, + { + ProductGroup = E026A76AD13F93DE7BF64A25 /* Products */; + ProjectRef = 79CF3557612C4997DAB1A862 /* allocator.xcodeproj */; + }, + { + ProductGroup = 1882AC3D3E4436D106A05D1E /* Products */; + ProjectRef = 1565CFD5145C22BAC85C3EEE /* base.xcodeproj */; + }, + { + ProductGroup = 4AF90D72B04F524EF024F0B4 /* Products */; + ProjectRef = 914996F06142B7006F4C1AC7 /* build_angle.xcodeproj */; + }, + { + ProductGroup = EDA42135948F78CB9DACAAAC /* Products */; + ProjectRef = 3D3157B668F5872BF7A22811 /* command_buffer.xcodeproj */; + }, + { + ProductGroup = C0D377AED2CD9427264853BA /* Products */; + ProjectRef = 81B31A421FA8B15344436AA7 /* common_audio.xcodeproj */; + }, + { + ProductGroup = C88A97A845DC6AA1133FCB60 /* Products */; + ProjectRef = 159546C2D7977EF25EFA7B40 /* common_video.xcodeproj */; + }, + { + ProductGroup = 14B091E8F66195D659065DE3 /* Products */; + ProjectRef = 63589532FDDE3888E6D68564 /* content.xcodeproj */; + }, + { + ProductGroup = 75F7B403FD5801BA5AFE0EB6 /* Products */; + ProjectRef = 4335E893FC259036D8785066 /* content_resources.xcodeproj */; + }, + { + ProductGroup = 855260D5F8EB9A5F5D90583B /* Products */; + ProjectRef = 1DBB070EBD1333BBE5C68D1C /* crypto.xcodeproj */; + }, + { + ProductGroup = 359DC2DF2DC84A5DF59E9DAB /* Products */; + ProjectRef = 21CD3E93FEA7E8ABD82BFBAF /* devtools_resources.xcodeproj */; + }, + { + ProductGroup = 7846595C5BF71D662A4872BA /* Products */; + ProjectRef = 993D5FB77B5591A0FFDF0D3A /* dynamic_annotations.xcodeproj */; + }, + { + ProductGroup = 355EF8BEF450D878E3BFBFA5 /* Products */; + ProjectRef = 2AA818CBAF5F61D7A21B18D7 /* expat.xcodeproj */; + }, + { + ProductGroup = 6CA7C7EBCDFF514D1291B57E /* Products */; + ProjectRef = 34C9C80A8A51D6228A02CE15 /* ffmpeg.xcodeproj */; + }, + { + ProductGroup = 3CBEE1BCA0F7BC9250684D95 /* Products */; + ProjectRef = 8ECFAA9E466819116DFF920F /* flac.xcodeproj */; + }, + { + ProductGroup = 3CEE93E380722D95E8075888 /* Products */; + ProjectRef = 33D2D9A353D54120D3468266 /* gl.xcodeproj */; + }, + { + ProductGroup = E10C0D8C1FD5C7E44E001D9A /* Products */; + ProjectRef = E430F79B1322631374180E88 /* glu.xcodeproj */; + }, + { + ProductGroup = 745BB341F5095532FA4D7E24 /* Products */; + ProjectRef = 40EA4C2F8133B05D9D7E5A83 /* gmock.xcodeproj */; + }, + { + ProductGroup = 0D308C0F1C74382E7D174B45 /* Products */; + ProjectRef = FE315AF8B75A20D4F79D2EFE /* googleurl.xcodeproj */; + }, + { + ProductGroup = 0E7682419CD1D4CFAE35608F /* Products */; + ProjectRef = 2402718FB1781B628D8E9890 /* gpu.xcodeproj */; + }, + { + ProductGroup = 1163FF8B98F887BD220732CF /* Products */; + ProjectRef = 2BDFA0D019DB383FCBE2863E /* gtest.xcodeproj */; + }, + { + ProductGroup = 6AC0B3F3686943C881540614 /* Products */; + ProjectRef = B1B0B00499622B5212B3B8C8 /* harfbuzz.xcodeproj */; + }, + { + ProductGroup = 0AE0B805F4C7418FC2BE7CBB /* Products */; + ProjectRef = EBDA2F288039C5E20D832C0F /* iccjpeg.xcodeproj */; + }, + { + ProductGroup = 876CF2BFEA22440C21B8445F /* Products */; + ProjectRef = 42BA615544865FC9F7795548 /* icu.xcodeproj */; + }, + { + ProductGroup = 8641E33E140AD05FA6EF538A /* Products */; + ProjectRef = 1C025E27C1B803BE216F4F86 /* ipc.xcodeproj */; + }, + { + ProductGroup = EE7A2CE9D2FEF5C88C3CD15F /* Products */; + ProjectRef = CD86FFEA2D5001FA726510BE /* JavaScriptCore.xcodeproj */; + }, + { + ProductGroup = D342E33851D57FDA0EEF1ECD /* Products */; + ProjectRef = C986618ECAB0A5C043D8BB3F /* jingle.xcodeproj */; + }, + { + ProductGroup = 3AF23DDB112C563E6F66BFA2 /* Products */; + ProjectRef = 0651D00FD6E7F704270E6F29 /* jsoncpp.xcodeproj */; + }, + { + ProductGroup = D06540FBE4AAE457E9C1029A /* Products */; + ProjectRef = 461BAAD82F8AB804176FDFE3 /* leveldatabase.xcodeproj */; + }, + { + ProductGroup = 88F70CD187AB20E99EB3666C /* Products */; + ProjectRef = B2F3D77B6647DF374CFCE5D4 /* libevent.xcodeproj */; + }, + { + ProductGroup = FB929E32ABBBF57701094854 /* Products */; + ProjectRef = 2D953328A837658D8BC680C6 /* libjingle.xcodeproj */; + }, + { + ProductGroup = EA116707259DA812076CECFB /* Products */; + ProjectRef = F6FC8D0B14E925438D497470 /* libjpeg.xcodeproj */; + }, + { + ProductGroup = B3020DDB0727745BB8CFA371 /* Products */; + ProjectRef = 913E0B3B78A79604B8375494 /* libpng.xcodeproj */; + }, + { + ProductGroup = B730FCB501E5A58141A4A7C5 /* Products */; + ProjectRef = BBB91956C816083526AB2EF2 /* libsrtp.xcodeproj */; + }, + { + ProductGroup = 2D7E46727E85457FD7C7E494 /* Products */; + ProjectRef = 334689EC756D47C76DABB010 /* libvpx.xcodeproj */; + }, + { + ProductGroup = AE3B4A403D2D6BCFA4296AFD /* Products */; + ProjectRef = 7C28C9975417680D544A5BA4 /* libwebp.xcodeproj */; + }, + { + ProductGroup = A74D756F1971EC0EDC5F1D39 /* Products */; + ProjectRef = D0856E7B20F81C035637FEEE /* libxml.xcodeproj */; + }, + { + ProductGroup = 6DCB4D40930F3E8F0137BEC9 /* Products */; + ProjectRef = D7A7DCA77B5D7E0417FA2EE7 /* libxslt.xcodeproj */; + }, + { + ProductGroup = F12E9AF2BA7517115998992F /* Products */; + ProjectRef = 10FB137FABDB2510091F240E /* libyuv.xcodeproj */; + }, + { + ProductGroup = 1F7CA0EA50BBAB521B321365 /* Products */; + ProjectRef = 9B4BBCC00C0C1A2BEEFA0D01 /* mach_override.xcodeproj */; + }, + { + ProductGroup = 9326958257DAA1843FADA0A0 /* Products */; + ProjectRef = 4F303C29F3D1E527A63C3797 /* media.xcodeproj */; + }, + { + ProductGroup = 21277E07B09DDCAFB11DD602 /* Products */; + ProjectRef = 8FC259076BAAC6707AF40AB9 /* modp_b64.xcodeproj */; + }, + { + ProductGroup = 9DB10F9640171D3C0B81E069 /* Products */; + ProjectRef = 5DA409E878B3995C3EB7E55B /* modules.xcodeproj */; + }, + { + ProductGroup = 696BE6E415443CFDD08142A5 /* Products */; + ProjectRef = C3F9A1466747A71994443EE8 /* net.xcodeproj */; + }, + { + ProductGroup = C54631913F021FCC1952873E /* Products */; + ProjectRef = FFF00D66C4A59FA632CF355D /* npapi.xcodeproj */; + }, + { + ProductGroup = CF97BE27D2381517A113E1D8 /* Products */; + ProjectRef = 1C1D2B476CB71FED19A90525 /* nss.xcodeproj */; + }, + { + ProductGroup = E1A4F9759B3EF4A5D45E6375 /* Products */; + ProjectRef = 6A3B8076CA7CD96C8E25A966 /* openmax.xcodeproj */; + }, + { + ProductGroup = B30A3443E29F5A775A662DC5 /* Products */; + ProjectRef = 6A8A5FC8599E16C4CE106A47 /* ots.xcodeproj */; + }, + { + ProductGroup = 55D65E95E695280545C49BFB /* Products */; + ProjectRef = 1193F2D58AEF3615DD79DEF7 /* Platform.xcodeproj */; + }, + { + ProductGroup = 294295DEA98D91E039FB0B17 /* Products */; + ProjectRef = 4EB85F5F7EB3A7B3221230A6 /* ppapi.xcodeproj */; + }, + { + ProductGroup = DE95397154FFF95C3B71D9D0 /* Products */; + ProjectRef = 8A8806D9491FFB692E6B67CE /* ppapi_internal.xcodeproj */; + }, + { + ProductGroup = BFD3D49A6960822DE76D2EE3 /* Products */; + ProjectRef = D70F2AD41B444A90D0917EFB /* printing.xcodeproj */; + }, + { + ProductGroup = 7AF118EBD6F7476696974ECF /* Products */; + ProjectRef = C7EE4C2E678C3D80B0A02DA2 /* protobuf.xcodeproj */; + }, + { + ProductGroup = 18CA616B6D7C7067CF56A158 /* Products */; + ProjectRef = F826FF98E5F795F91C77DDCA /* sdch.xcodeproj */; + }, + { + ProductGroup = F2110F4DC49E005B1E51B67D /* Products */; + ProjectRef = 6991125C79C2BFE97903DCF9 /* sfntly.xcodeproj */; + }, + { + ProductGroup = 26144774FE45D7ABF19C9895 /* Products */; + ProjectRef = 941319F6C213FD2E5AF1379C /* skia.xcodeproj */; + }, + { + ProductGroup = 3D0AB27073899706187D4089 /* Products */; + ProjectRef = 71682F05AB957D4FB877358C /* speech_proto.xcodeproj */; + }, + { + ProductGroup = 3ED2B5AE87A1D0442B901B78 /* Products */; + ProjectRef = F80705F721F23C071C68CBF0 /* speex.xcodeproj */; + }, + { + ProductGroup = 4B8640B24DEEFFAECF63C786 /* Products */; + ProjectRef = E628C159157AD577B39C0B42 /* sql.xcodeproj */; + }, + { + ProductGroup = D6F45F8D700242BBD4C31548 /* Products */; + ProjectRef = 3E3D7C67B9F21F228D244464 /* sqlite.xcodeproj */; + }, + { + ProductGroup = D7C91B40183481DDB56892F9 /* Products */; + ProjectRef = 0896A4568A6EF547A818E252 /* ssl.xcodeproj */; + }, + { + ProductGroup = 073C9061E63852E216E02CCE /* Products */; + ProjectRef = 0A252C48128C7984A5A7D199 /* sudden_motion_sensor.xcodeproj */; + }, + { + ProductGroup = 209E0FC2D20323A6D349A006 /* Products */; + ProjectRef = A2154ED96A97D207C4234EB2 /* surface.xcodeproj */; + }, + { + ProductGroup = F0CD083F623E6A718A2A22F5 /* Products */; + ProjectRef = 074D7464D208F959F4EFA456 /* system_wrappers.xcodeproj */; + }, + { + ProductGroup = BBB306902212C99A76FF1BB5 /* Products */; + ProjectRef = 36EE862F886D7E5F8DD66BF6 /* ui.xcodeproj */; + }, + { + ProductGroup = 224CE785D57ED4345CAA93FE /* Products */; + ProjectRef = D828014EA35F6FF11305AC18 /* ui_strings.xcodeproj */; + }, + { + ProductGroup = 872ECB232111A77A324C2A9F /* Products */; + ProjectRef = 55DB375A3CC916F84D8CCE4A /* v8.xcodeproj */; + }, + { + ProductGroup = 5DCFD674AFE14452D5CE8922 /* Products */; + ProjectRef = D750300952CFEECA77BB2E09 /* video_engine.xcodeproj */; + }, + { + ProductGroup = 625356F8D3FBA28D8CB3DE44 /* Products */; + ProjectRef = C29ADD61716033F36EC6FA4A /* voice_engine.xcodeproj */; + }, + { + ProductGroup = B73EFEBDF0CF6CD4FD06A18D /* Products */; + ProjectRef = DC72D0B7D1A6B663CB335034 /* WebCore.xcodeproj */; + }, + { + ProductGroup = 524BF9BB09F0FBBD3F465B97 /* Products */; + ProjectRef = 87F45A638FBE61B6FDF891DC /* WebKit.xcodeproj */; + }, + { + ProductGroup = 65CE2FCEC207BBF0A8C37B4B /* Products */; + ProjectRef = AE72EF7CAB16AAED4E988E57 /* webkit_support.xcodeproj */; + }, + { + ProductGroup = 3F0AA54C36F7A9444E4F42A4 /* Products */; + ProjectRef = 421637DBD3560D81535E4C3A /* WTF.xcodeproj */; + }, + { + ProductGroup = 057B966FE29A268A6863588E /* Products */; + ProjectRef = 2DF0099F0EE8FE9B392AACC4 /* zlib.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 26784BB866DFCCEB6B563D28 /* All */, + E921F9B822AD67F873DF6E09 /* Run All Tests */, + A9EF68F8BF3234583509BD43 /* Atom */, + 0493E18E77BAF61DDB854B47 /* cefclient */, + DA259FAFFD7136C8A5C881A8 /* cef_unittests */, + EF3BCECA3610152FBA76BFFF /* Run cef_unittests */, + 26DD2CB0340D816F3DF64EC9 /* libcef */, + 94BAF60C7C90712E7F239E35 /* libcef_dll_wrapper */, + 2E847C594D99442F54D6FA7B /* cef_strings */, + F506A5805463407F45E5D21B /* cef_locales */, + 667F41D8C9AE14BC19339FE5 /* cef_resources */, + 34C94585C2266BDAEE3DB526 /* cef_pak */, + 8DBADDE353DC46B377FC4192 /* libcef_static */, + DA98FB3E241B73BA47200DFF /* AtomHelperApp */, + DCB001A34DDB8A1DBDB1A9C4 /* cefclient_helper_app */, + EF59E18D1B94CB26A18E3A3E /* cef_unittests_helper_app */, + EEA6DA7521B65D3FCF65806C /* Run cef_unittests_helper_app */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 035C1AFA36256CDAE5AB3302 /* libfileapi.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libfileapi.a; + remoteRef = 3A38BC662343C7F360F72E2A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 038F9C52C4A43A403A11E976 /* libtest_support_content.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libtest_support_content.a; + remoteRef = 44509FF661D7982110D48438 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 03E1F4E49E9F8F568B054A97 /* libcontent_utility.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcontent_utility.a; + remoteRef = 76C4B41D98B415764747B5A1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 0520B359A318A0CE6636BC65 /* ppapi_example_vc.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_vc.bundle; + remoteRef = D718DF3AA3C9884E1CD5D695 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 09633865ED0F4E9A65F5413F /* Content Shell.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = "Content Shell.app"; + remoteRef = 9CB97F3375016342AE4A3D92 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 098B47A6E50F158627CFAF1D /* leveldb_write_batch_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_write_batch_test; + remoteRef = CC525BAEE75FC1660D0557D9 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 0CB1640F4F4FB4AEB3B59E60 /* libaec.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libaec.a; + remoteRef = 4098E63EB9705E8E4740D6B1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 0D13E88698DFD01971DF95F0 /* ppapi_example_ime.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_ime.bundle; + remoteRef = 27CF927C0087D5D5173E4B53 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 0D1ACC57664C588B614EA509 /* Content Shell Framework.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = "Content Shell Framework.framework"; + remoteRef = BEB773F063F9834CE9948EA8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 0E39BDD243670D990FC3D5F6 /* leveldb_log_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_log_test; + remoteRef = A838DB9897203FB9DCA78D7C /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 0E7983D75D8A30A5BF897AC1 /* libskia_opts_ssse3.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libskia_opts_ssse3.a; + remoteRef = D8A2AFC6C1C96EF5687B4C5D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 0EF0DF8FF56F5E3BCFAA3D4D /* libbase_i18n.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libbase_i18n.a; + remoteRef = D48D9800B6274BD37EFBD034 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 0F34905BD3FE48763B983E73 /* media_bench */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = media_bench; + remoteRef = 97DB7DF7B33FB161025F0449 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 10BC44DEA8FC22DDF2FA034F /* libgmock.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgmock.a; + remoteRef = 4527000AD737F95CA3728E20 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 11577ADA978F291FD88572E3 /* fetch_client */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = fetch_client; + remoteRef = B1755058A9FA0E05D519DC19 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 12423B699EEA302F59D5E5D2 /* libvideo_processing.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libvideo_processing.a; + remoteRef = 42DB37E3F89630F236D4F73C /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 14D6BA9BB146A4F2A2B2247A /* libwebcore_bindings.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebcore_bindings.a; + remoteRef = 69E1058B4FFD87138ED365C5 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 151440EC37643EF77F8F3361 /* ppapi_example_audio.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_audio.bundle; + remoteRef = 872D7527C9712E7D5D836C98 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 16534921BF1B3E5292745B4E /* libjingle_p2p.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libjingle_p2p.a; + remoteRef = 8C1E595BB360EEF7A3A9964E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 16FE174CC7907A923C79B6AD /* sql_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = sql_unittests; + remoteRef = 49196A5B921639F4C0C35877 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 17FFBEFCC8836FBB73E582A9 /* libiLBC.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libiLBC.a; + remoteRef = 39269951A5F848887F20BDA5 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 1858A88FAD19882F6EBAB134 /* libnss_static.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libnss_static.a; + remoteRef = 44A32A5D1BE0B65C384AB3BF /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 188573DF6F5F630250FBAA30 /* mksnapshot */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = mksnapshot; + remoteRef = AF33AE17C2418B0C2CA2DE38 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 18E4DDFEECA23064607EC5C0 /* leveldb_crc32c_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_crc32c_test; + remoteRef = 167D3048DDFA1422483C94EC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 19A90B3A2AC4765B210294B8 /* libprinting.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libprinting.a; + remoteRef = 5FABE8E2A745643674348F33 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 19F011132AA33EFA48C6040F /* libcontent_shell_lib.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcontent_shell_lib.a; + remoteRef = E8D0319DAEA64A19C25591BC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 1A83EB2DBE27D347EF022E73 /* libgtest.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgtest.a; + remoteRef = 7F13126F9BA59D5B85402575 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 1B40BA02D77EA14446AE0E66 /* leveldb_cache_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_cache_test; + remoteRef = 7F3DBFB8573C42F0498440A2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 1B42CA3D41E586DB8B43EE68 /* libipc.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libipc.a; + remoteRef = 7C455153F0AC479787C35F06 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 1C373555E11300EB4535B7AC /* ppapi_example_cc_stub.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_cc_stub.bundle; + remoteRef = 46EDEFFBD453D96F60F75D10 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 1C999732FF6506A36E60DA85 /* libskia.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libskia.a; + remoteRef = F3B91E976B3A5B52D0B5BCC9 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 1DBD318A565F9970BC623441 /* ppapi_example_video_decode.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_video_decode.bundle; + remoteRef = 01D8BC3A545B287109F847A1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 1E7BCAB13DD3E553324824B7 /* libagc.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libagc.a; + remoteRef = 5433D0AD4B4F9E7327634029 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 1E92EAF020A7823CBF886789 /* ppapi_example_audio_input.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_audio_input.bundle; + remoteRef = 6DD4434E22750DA8C342D211 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 1F34CFD1E43CF0AD3D60FE45 /* libnet.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libnet.a; + remoteRef = 589837BF39218883DAEF0C04 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 1FA65F55B2768A2CDB7C17E9 /* libtest_support_perf.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libtest_support_perf.a; + remoteRef = 4C2FCB3F63A16B39F1505548 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 2146F4980A38504DBC71F58C /* PPAPIExample.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = PPAPIExample.bundle; + remoteRef = A4867B9BA0C68A51B75162A3 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 222C454B32CA6D3246827AAD /* libiSAC.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libiSAC.a; + remoteRef = 2931EF7FE0AD887B4799662B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 231941D6606B6153490120F0 /* libxml2.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libxml2.a; + remoteRef = 709ED43691DC25D8235B765C /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 25436BD64F6B22C9A36C0344 /* libffmpeg.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libffmpeg.a; + remoteRef = AD16D0CFAB96E526A83F04BD /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 25F438E765C88ED06989C4EE /* ffmpeg_regression_tests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = ffmpeg_regression_tests; + remoteRef = 2A16A18FB04BCB1BF32A04A9 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 270F097F583DBB970DC90625 /* dns_fuzz_stub */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = dns_fuzz_stub; + remoteRef = 651987B881549F2B0F6424B1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 279E280A5DEEDC4C69880518 /* libwebrtc_jpeg.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebrtc_jpeg.a; + remoteRef = 4D16818AA685157645B21643 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 281602B1CB941C0039247C5F /* libgpu_ipc.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgpu_ipc.a; + remoteRef = 8DDA7AE164862557CC7B64AB /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 29AE609668619FB64D9573DC /* libcontent_worker.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcontent_worker.a; + remoteRef = 1FC857C93D19F398184995C6 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 2C1351997F60F82884D6DAC4 /* libwebkit_gpu.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebkit_gpu.a; + remoteRef = BEDF628093C51AE2763ECBEC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 2C707A0DCA7193E218AE2BB4 /* libwebrtc_utility.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebrtc_utility.a; + remoteRef = 8C31A2A4AE65323F53620FB0 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 2C849ED35F93B7313A6B3A26 /* ppapi_example_c_stub.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_c_stub.bundle; + remoteRef = B8CE858DEE0C708AFC75CD47 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 2DC399D70FCD7BBC202A7277 /* leveldb_skiplist_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_skiplist_test; + remoteRef = 45BEFF5BB82EAB50C6CA544D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 2F4B7D113B38123301170B05 /* libjingle_peerconnection.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libjingle_peerconnection.a; + remoteRef = B86EBE98D6127C3FC0B004AB /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 31388FCDD842A75BAC59D1A9 /* leveldb_arena_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_arena_test; + remoteRef = 124694D125B6AA97E516621B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 325CBE7F77333A222059F4FB /* libmedia_test_support.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libmedia_test_support.a; + remoteRef = 45970FE6B27FD5564D1CE7C3 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 32814E763645F6CCB2CD720E /* crl_set_dump */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = crl_set_dump; + remoteRef = 91B7BC723DF4CD348E0F263E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 33601FF4D83436341934DA90 /* libyuv_convert_simd_x86.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libyuv_convert_simd_x86.a; + remoteRef = A57B904872400D0F68ED4B3E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 338DD3A741C5E6F0A7D1AC6F /* libcontent_ppapi_plugin.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcontent_ppapi_plugin.a; + remoteRef = B8FD255232BF834B02FC2FA8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 34087D210DD3578FDC3F4176 /* libquota.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libquota.a; + remoteRef = 88861E8351FA2DAEDCA6E49D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 35BDDB08E575F02E3D8A6351 /* libui.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libui.a; + remoteRef = 01EFAD5C91DC26388FD529A8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3631B37F09E89E2035707B42 /* libleveldatabase.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libleveldatabase.a; + remoteRef = 12EC3B9607993E6244B3D851 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3AE65874B3D2B86C62583370 /* libsrtp.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libsrtp.a; + remoteRef = 9167451208F2ABE2A2BA12B4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3B0ACFDE6A97007CA3F45358 /* libtest_support_ipc.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libtest_support_ipc.a; + remoteRef = 1E6565D9CBC613B8FFB37B0D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3B2C2E73B999F5A73B947FAA /* ppapi_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = ppapi_unittests; + remoteRef = 28C8C15DF5DC8C7412A2E632 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3D4E9841FF43307DE368DD09 /* libv8_nosnapshot.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libv8_nosnapshot.a; + remoteRef = 423AAC27E17A7FAE4FD689D8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3D8ACFBFC35FF085E7365C21 /* simple_decoder */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = simple_decoder; + remoteRef = C4D2AAE1DACB5CA92EC17B30 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3E85B3AAEDB5CB93E736DEA9 /* libcommand_buffer_client.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcommand_buffer_client.a; + remoteRef = B19F602B2DD707D79E79C261 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3F4CEF83D8D4C2FDCC104362 /* stress_cache */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = stress_cache; + remoteRef = 8ABBE5A96D4E6C7D245E2E01 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3F6D427ED8100B09055510A2 /* leveldb_env_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_env_test; + remoteRef = 5F7D3DDC4D2A1A665F30E012 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3F6F4D70548B8A2806B4743C /* libleveldb_testutil.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libleveldb_testutil.a; + remoteRef = 42554B8506C574C0E79EBD5F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 40D8450E3A3D3953B2131E33 /* libv8_snapshot.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libv8_snapshot.a; + remoteRef = DCC90410740FBFD94D59B004 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 41802089CC60B523FD636494 /* libvideo_capture_module.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libvideo_capture_module.a; + remoteRef = B052BE67662976953475D96C /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 44995BB877107C1B83D23200 /* libaudio_conference_mixer.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libaudio_conference_mixer.a; + remoteRef = DC08B008E4156961FC70756D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 45653EFBE55EA6DAD77F852E /* ppapi_example_paint_manager.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_paint_manager.bundle; + remoteRef = B09ADD058FE4CFBC58B6E594 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4690FA9F614135E1BCC39B3B /* libwebp_dec.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebp_dec.a; + remoteRef = 47C9AD12CF5281C8DAEF2361 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 469881A7AA01977748606E75 /* libyuv_convert.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libyuv_convert.a; + remoteRef = E57D6B6F51871058DF7165BD /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 47B457ECEE53FA38DB10AA91 /* libgles2_c_lib.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgles2_c_lib.a; + remoteRef = E53487F87235833D9F96ABAD /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4965FA5E4825686FE1C34124 /* libv8-i18n.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libv8-i18n.a"; + remoteRef = D8C1372E0BE4ADB935C582F3 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 49FDFDC518AA7089085453C4 /* libtranslator_glsl.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libtranslator_glsl.a; + remoteRef = 6B24F6AA70A4F52E2DE745AC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4A7008C1860BAEE50202FF31 /* leveldb_dbformat_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_dbformat_test; + remoteRef = 812B3A8362856EB4B548E8CD /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4AB21D2D37F3E9F8AB2006E2 /* media_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = media_unittests; + remoteRef = 8EF99DA1EECF7C99E4A19B82 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4AD7CDE66D187C0F40782BF2 /* run_testserver */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = run_testserver; + remoteRef = 2E733A53CA6D6D70433EE065 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4ADC86031782B27551EC2E38 /* ppapi_example_file_chooser.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_file_chooser.bundle; + remoteRef = 5648E7C7E6D4CE8421E1FD66 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 4BF89795A541A4D4674AE808 /* ppapi_example_mouse_cursor.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_mouse_cursor.bundle; + remoteRef = BBC054C15CE32203F4DB15F1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 50795C98B83A7CE571E4664B /* libwebkit_support_common.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebkit_support_common.a; + remoteRef = 3200479F5CDB332D6B9B6D05 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 508555DF81226478DF9A01DE /* libbitrate_controller.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libbitrate_controller.a; + remoteRef = 0954812B221659C47A0E46D0 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 51D58396CAC439AD5F352B7B /* libicudata.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libicudata.a; + remoteRef = 406224E007CB5E54C49B1A1E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 51FB1488787DE290A94E5A7B /* ffmpeg_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = ffmpeg_unittests; + remoteRef = B77C9C403D2BCC80226D3AED /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 52125294678FD58D1610131B /* libaudio_coding_module.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libaudio_coding_module.a; + remoteRef = 297067644368E3B8004C602F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 532E866DC0DA884190819DA5 /* ui_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = ui_unittests; + remoteRef = E37A892E15211665139F509B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 53C1E5EAC4E420FFB5E93F71 /* libmodp_b64.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libmodp_b64.a; + remoteRef = 7DDB4F5E3B2006CD96097F4A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 54CF46DE6F3E2690DDB3A91F /* libicuuc.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libicuuc.a; + remoteRef = 052D505D84FC9587CE159D29 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 54FB30231426CF8A98CB55CC /* libmedia.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libmedia.a; + remoteRef = 5E44809EE7B1E960E4DC2981 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 55099067C5B3B3719C34A3C6 /* libudp_transport.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libudp_transport.a; + remoteRef = 9FD5E8ACEE7AEA14F92940B4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 556EEC1C9B7F92DD0FDA2D84 /* ppapi_example_mouse_lock.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_mouse_lock.bundle; + remoteRef = 33A64AF3FF2805E00CED7C48 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 55D519F24BC4D5CCFE6CB241 /* net_perftests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = net_perftests; + remoteRef = E00C4BE24AF64ECC61BA16EC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 56EC778DB94C3D3BC59A1FF6 /* ppapi_perftests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = ppapi_perftests; + remoteRef = 9BB2EA43EF4A2534073D2F19 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 57951AF27EC4AEC7499B8E1E /* libjingle_glue.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libjingle_glue.a; + remoteRef = A5BF4F208A631E61975C2ED8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 59713494F5DE6C0FDA8AC1D7 /* libcrnss.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcrnss.a; + remoteRef = 0EBEBDC9B06D0BD168B413BF /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 59D9F57B61ABC9BBFCBF410D /* leveldb_corruption_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_corruption_test; + remoteRef = D30F83195C6CC56FD1465A95 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5ADF6FC0952597ED22A12929 /* libcontent_browser.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcontent_browser.a; + remoteRef = 6F05A6E2CBAF5680F76959D0 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5BB4D9F4524105F699CA6CB2 /* v8_shell */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = v8_shell; + remoteRef = F0B3F4EA11C34E3E9F3138E9 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5BB57088018F375BCDD62765 /* libharfbuzz-ng.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libharfbuzz-ng.a"; + remoteRef = 212CA76ED76EC538C52B1239 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5C297D97F04A9FE35F576C2F /* ppapi_example_printing.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_printing.bundle; + remoteRef = 950187467EC1114941B845B7 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5C700F1C23E9A371A3D0CED7 /* ppapi_tests.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_tests.bundle; + remoteRef = C83E28FF66C71E7DA92029D0 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5D556B1739ACFBD9D8902528 /* leveldb_db_bench */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_db_bench; + remoteRef = 17567AD6C66622AB5A38047D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5E776449B0DD985AA3A92196 /* librtp_rtcp.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = librtp_rtcp.a; + remoteRef = C66F2E0108250010242F612B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5F32C68901D0E2D38FC3B717 /* libtess.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libtess.a; + remoteRef = E578090655E4B2338FA246EB /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5F6FFD63F4F6EB981AD41AF5 /* libG711.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libG711.a; + remoteRef = B0F6A081E0B0FD792ADF32E4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5FEB3CC6289A9674F13CC926 /* fetch_server */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = fetch_server; + remoteRef = 4294C7F14658D1FC2ADA5776 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 61692EC9A96F57D2E7F4FFEC /* libgles2_implementation_client_side_arrays_no_check.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgles2_implementation_client_side_arrays_no_check.a; + remoteRef = A245AB91418B85BB3A335B84 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 62D22A4533A0F0117E8A48B9 /* scaler_bench */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = scaler_bench; + remoteRef = D8DA17F3E65342FA50A5E9E3 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 6385D313EA67413A056C5B94 /* libvideo_processing_sse2.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libvideo_processing_sse2.a; + remoteRef = 79C1FA1CFA8D0C21198F7735 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 6454259BDFA3FECE94D1C1AE /* libdatabase.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libdatabase.a; + remoteRef = 306D1ADD6A8D8C87CD8C414A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 648860494CFE2034D2C49E9B /* libmedia_file.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libmedia_file.a; + remoteRef = 95EF8E92DDC64A7588A4669F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 64F841BCD64DF489F9FD7045 /* leveldb_db_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_db_test; + remoteRef = 157BA94EB126504F6E91B9B6 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 65E4C9298E5BDF5797ED3622 /* libpreparser_lib.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libpreparser_lib.a; + remoteRef = 511E3D5D251A5DA16BB0B44C /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 66166FA92F25B0DEEFA6A67B /* crypto_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = crypto_unittests; + remoteRef = B19F5840640B11C577C20C87 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 66396C6EFF9BDBC369436179 /* libtest_support_base.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libtest_support_base.a; + remoteRef = 20EDE7E4E59B516C67A2BE1B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 67F31BA941D7E94E56456F3B /* libblob.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libblob.a; + remoteRef = 078058CEFC1E73BC5238EDCE /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 68CC739E8547E5DFAE8D1FB6 /* libcrnspr.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcrnspr.a; + remoteRef = A9FBF3B9709C9F899FA16189 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 6A7B02C22238DAA06DCF08A2 /* libcommand_buffer_service.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcommand_buffer_service.a; + remoteRef = AF5FF72F98C5682F4C2AED38 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 6BF642FBB4D4C46EE72E5A9C /* content_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = content_unittests; + remoteRef = 203229A7B81AC4C1C4E604F5 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 6C2F171B97F577E374A8FAA5 /* libdom_storage.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libdom_storage.a; + remoteRef = 666A5DF91CA38763B4443DB0 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 6CE7806BDE6763DCD46EBCD5 /* libwebcore_platform.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebcore_platform.a; + remoteRef = 0A4A17C53C83FF99C5333C3A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 6EB049F6609DE833AF093CA6 /* libil.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libil.a; + remoteRef = BE42A98CD0C23A35A52230D4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 6EC88F387B997B180C0EC59D /* libtranslator_common.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libtranslator_common.a; + remoteRef = 1BBC83A06799BEA58B9F13B8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 6F1D49D6CC8D5B19C5B5F7F4 /* ppapi_example_post_message.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_post_message.bundle; + remoteRef = 6E73100767B8F3ADC4FC34E1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 72FF378E500352A3FE8EEBF4 /* libbase.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libbase.a; + remoteRef = A9C9A31586BDFC0A2E29B78F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 76364D7D679109D4EF2C5D78 /* libevent.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libevent.a; + remoteRef = 0E9ACC4A0A33DA5FE9B90DF0 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7652B3C9D954E11920222382 /* libwebrtc_libyuv.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebrtc_libyuv.a; + remoteRef = 36E86A8C41ED02B3B3FB9646 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 77967929794A8C9FAF7C3650 /* libspeech_proto.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libspeech_proto.a; + remoteRef = BBFF9499765B7B7724710183 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 77B8699CF89F70FBB168FD2F /* libsql.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libsql.a; + remoteRef = DA52B0805D9DECC2A0FE2D83 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7B21CBD334DD8DE180E71548 /* libppapi_shared.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libppapi_shared.a; + remoteRef = EF069F559439835BDE70DD0C /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7B4E766CE33B391FD5965AC9 /* libCNG.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libCNG.a; + remoteRef = AA259A8BD26170F64A997497 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7C00C2577296D3966E61FE2E /* ppapi_example_scroll.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_scroll.bundle; + remoteRef = 6CFCD1A94EA1A27FA4A881B8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7CF5A3CF60F25BA53D943E4D /* dnssec_chain_verify */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = dnssec_chain_verify; + remoteRef = 03E5F7D9598CA2D9C71AB275 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7D09C922698D218271E813C4 /* jingle_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = jingle_unittests; + remoteRef = 8ABEE84F655F3535F2532625 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7DFA5E6BE0D6213823703DE1 /* libwebp_utils.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebp_utils.a; + remoteRef = B925FCBDCEF3C3E55AD423A5 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7E2AB0DD9FB567A6ABF1527D /* base_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = base_unittests; + remoteRef = B25167DDF781A3E8C2D9C814 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7F9E6BE9EC02F6F4CA505DA6 /* libsudden_motion_sensor.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libsudden_motion_sensor.a; + remoteRef = 5A9FC87E9BA409E38603C7D6 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7FD04038A230D56812EFC77C /* libsdch.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libsdch.a; + remoteRef = E8CCC11172FE5D355217C99D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 7FDD976D13F31E5F969FF6F2 /* libG722.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libG722.a; + remoteRef = 596D710A621CA0838B632011 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 814B0A4056F5CC5CD72E4308 /* ppapi_example_gamepad.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_gamepad.bundle; + remoteRef = 1542D0F0CB8116170CA9B935 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 819DCC59DB3C3F90565A2D0B /* libcontent_app.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcontent_app.a; + remoteRef = 75E8621E1E0B1FD3D445D1DC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 824E7A6946DF27DEC5C519B5 /* content_browsertests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = content_browsertests; + remoteRef = DA4E220FF77AA30D6BFF897F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 84D084EB8AED55509F9E5E99 /* libNetEq.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libNetEq.a; + remoteRef = E0313043359ABEA6A2653261 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 855A63411CC69C553F60E233 /* libyuv_convert_simd_arm.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libyuv_convert_simd_arm.a; + remoteRef = 8AAF4DDB7BE16A173B8C7BBA /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 8706630C78544D75CEB14721 /* libPCM16B.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libPCM16B.a; + remoteRef = BCEE39A5F60EA1FFE3B09044 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 8725C0D8895B52CE87B9AE29 /* tld_cleanup */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = tld_cleanup; + remoteRef = 01669EAF0458A34F2C0B5BE2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 872BC5E7AD7B237BB766949C /* libexpat.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libexpat.a; + remoteRef = A505B929CFEBA66CADD67D25 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 8766E29593091A172075AC50 /* libbase_static_win64.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libbase_static_win64.a; + remoteRef = 265CD11A29815A994C588508 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 8796C04D2F5E75DABA00CF5A /* libgles2_implementation_client_side_arrays.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgles2_implementation_client_side_arrays.a; + remoteRef = 02D4896094B6AE5EB580D3BF /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 89AA68583C800AD48D8910B9 /* libaecm.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libaecm.a; + remoteRef = D8104A799E0347717B762D56 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 8A972F262B243A199E70827A /* libyuv.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libyuv.a; + remoteRef = 05F9047A2B7E060731C636A0 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 8AB95AF34C0769AA29C00D81 /* protoc */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = protoc; + remoteRef = D77322942ECE7F8A9ADFBCB1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 8B282EDEF149A2A957FC5891 /* libwebkit_media.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebkit_media.a; + remoteRef = CA2C0F6230A89D42A7514C82 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 8D5761F6A0D523F7AA92BA0B /* libaudio_device.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libaudio_device.a; + remoteRef = 34472E5A5C84919C6A988764 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 8DBB27495FD5C44CEEF44483 /* libppapi_cpp_objects.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libppapi_cpp_objects.a; + remoteRef = DB0CBDD952FE2503D928B4C4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 909D528CC75B31A615278676 /* libwebp_dsp.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebp_dsp.a; + remoteRef = 4FBF1072304C087A8596CC27 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 91833DED3D99DF0B2E532040 /* libgles2_cmd_helper.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgles2_cmd_helper.a; + remoteRef = 775DA362D42F421F68FC39F8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 92D8EE4C39482EEDE27C545D /* libwebkit_support.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebkit_support.a; + remoteRef = D7A26746AC6F4D64A9C44B32 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 93032758CCEA393AF6F03221 /* libui_test_support.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libui_test_support.a; + remoteRef = C4F7427774574D91E25D3B31 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 9427891299B218D591E06C60 /* libgmock_main.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgmock_main.a; + remoteRef = DCAC63CB6D0B6A9358CCD753 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 966078E69F34CDDB98FA7FE0 /* googleurl_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = googleurl_unittests; + remoteRef = 5086657C5C041E82FE233E89 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 9718AEB2EBE47349877370D9 /* libapm_util.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libapm_util.a; + remoteRef = E51931D5F2DFA1C8B36B098A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 97ADD3FE37990403BF1A2C35 /* leveldb_version_edit_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_version_edit_test; + remoteRef = 1E70F8589CAC6E5BA6586531 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 98BC68C30AAE03AA50B0AFBA /* libaudio_processing.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libaudio_processing.a; + remoteRef = 7CCE93D76101424C3B8BBC36 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 9BA3259F6DDAFB8F88C9E3BC /* leveldb_filename_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_filename_test; + remoteRef = 3C8D20728FFF6B0E47817978 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 9C56F3341074BDEBBDF0317D /* ipc_tests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = ipc_tests; + remoteRef = 788F8EC08840C2A970DB8523 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 9E3EA75D29A3C66D3E96AD23 /* libvpx.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libvpx.a; + remoteRef = 332A124E63C41FB4EEE401A6 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 9E7793E9F576458BDD0FDC07 /* libwebcore_html.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebcore_html.a; + remoteRef = 09839A215E44C25239DE4E58 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 9FFA44978A353086446A547F /* leveldb_table_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_table_test; + remoteRef = 3584755236AA6009AAB2975D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A10A80D34F695765402364FE /* libwebkit_platform.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebkit_platform.a; + remoteRef = CFFE5595A014867EF71B19AE /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A1ED3E139080E96DF8598E9C /* libhttp_server.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libhttp_server.a; + remoteRef = E4FC8C7B2CB0A01B72282772 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A233A9E0F2972D84C108ED2A /* liballocator.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = liballocator.a; + remoteRef = 583DD2D919F2747C04D9ACD9 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A273E1A508576CCE31BDA52A /* libdynamic_annotations.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libdynamic_annotations.a; + remoteRef = 3BBAB5EA78264BA664C52847 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A3459879EAAEA6159327E0AA /* libcontent_common.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcontent_common.a; + remoteRef = 3B04A9CD0C2DBDD0587B37FD /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A3AEB897C9125806F2A3F2E0 /* libsqlite3.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libsqlite3.a; + remoteRef = F3197215D82CADBA7F64F2CC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A48CC24A6E16EDFACDF20C3C /* net_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = net_unittests; + remoteRef = 69906B47CD2CEF046835C99E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A4D2CF33E3C3DAB91EDF8525 /* libwebkit_user_agent.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebkit_user_agent.a; + remoteRef = C14678C5565E6CEC1B714B95 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A522DCC2F11AB53EB593778D /* libppapi_gles2.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libppapi_gles2.a; + remoteRef = B094D1FE687DFE9FD89C3C13 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A6EA5F801A212058E50C26BB /* libvoice_engine_core.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libvoice_engine_core.a; + remoteRef = AB5E4498C8D560A9ADE9D2C9 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A8210CD6DD0487DCD90423F1 /* libyarr.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libyarr.a; + remoteRef = 03A2ACB8E4D5C90024B12502 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A92D4D8C36225CC694E6249F /* libwebcore_test_support.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebcore_test_support.a; + remoteRef = 96B2FC72D8ED5C8B24DAA3B8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + A9C070899E89D194B452F2FF /* ppapi_example_flash_topmost.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_flash_topmost.bundle; + remoteRef = 3B49E618212E1AB75C4C0A3F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + AA529CAE1A9752141B3D6AA0 /* libwebcore_remaining.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebcore_remaining.a; + remoteRef = F65A6C40E27DECB93742ECDF /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + AA9C990C6F0804F225B3E5F3 /* libchrome_zlib.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libchrome_zlib.a; + remoteRef = 02E8CF2E38D6F6D963B444BB /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + AADC551C1F61A7F0AF341714 /* libaec_sse2.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libaec_sse2.a; + remoteRef = 195F6D5F9F63FEC3597AC35B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + AB208F3EF428319141B9B3A7 /* liballocator_extension_thunks.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = liballocator_extension_thunks.a; + remoteRef = 68D942F582DB08C170E75A6C /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + ACD648B6FF476EEF5D9024F6 /* gdig */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = gdig; + remoteRef = E4C22E4AF63D445BFE0803D2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + AE79CC2DBE576E182EE2D94C /* libcommand_buffer_common.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcommand_buffer_common.a; + remoteRef = E074AF527176C4C382C92E55 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + B0D1337B3DE31CF644918BEB /* libgoogleurl.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgoogleurl.a; + remoteRef = 7A417E8CD8AAEE73461A62BD /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + B104E9FB51B61FDBF8A2306B /* libjpeg_turbo.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libjpeg_turbo.a; + remoteRef = 22A9936BAE6B666AF9EA5F9F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + B2E4D4A3022DC3194BDC73C3 /* libgles2_c_lib_nocheck.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgles2_c_lib_nocheck.a; + remoteRef = 20559EF77E152DCBDBCACD61 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + B3C7283D59714B85617794EC /* libwebrtc_vp8.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebrtc_vp8.a; + remoteRef = 8D8BF107B33A99B00650C1E8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + B3DB9C8FD60EBC30C15EC819 /* ppapi_example_url_loader.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_url_loader.bundle; + remoteRef = 14B71F19D25F7CD05F8E3DDF /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + B5424446D74DD25BADD31F1E /* libgles2_utils.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgles2_utils.a; + remoteRef = 4BD7773500D4CAFAB3333ABF /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + B6D545E11394F55CC4F354C8 /* leveldb_coding_test */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = leveldb_coding_test; + remoteRef = 8BF8F1D4A26689E9E4BA787D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + B85BED980F0C092062FC7BF6 /* libprotobuf_lite.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libprotobuf_lite.a; + remoteRef = A57C6E219399AC37D75990BD /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + B8CA1A3F3DC012EE6B29B090 /* libvideo_render_module.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libvideo_render_module.a; + remoteRef = 23940005BF133F95EF9D007D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + B8FF1DA4847671490A5DA716 /* libxslt.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libxslt.a; + remoteRef = 3C5DA11E367A749F7A226CFF /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + B901B1AA0FFB8733D3D34CDF /* video_decode_accelerator_unittest */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = video_decode_accelerator_unittest; + remoteRef = 7228ECD848A4EC3EABA72867 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + BA2A08B372DBB101485675DB /* libgtest_main.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgtest_main.a; + remoteRef = AD367C0C18A9638B9A9CD14F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + BAC8E39ACB2547774B671733 /* image_operations_bench */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = image_operations_bench; + remoteRef = 287BC2061A8621C6BAD40E03 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + BC8AF58C370537486626D135 /* libflac.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libflac.a; + remoteRef = F98C6D60F0811D23B77F37B7 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + BD079598FEB10D85498A2269 /* ppapi_example_gles2.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_gles2.bundle; + remoteRef = 22FE8682A9454DD2E86A123B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + BD2D7D254989E0B420EC6779 /* libgl_wrapper.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgl_wrapper.a; + remoteRef = 359BBA05F82695D400F50790 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + BDBFE371ED8537F0321E26F4 /* printing_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = printing_unittests; + remoteRef = 9196032B42BBA523596827C5 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + BE4562C3575A70024C40D583 /* libcrnssckbi.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcrnssckbi.a; + remoteRef = 2F8A4DF6A923DB6CB1A30DB8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + BECB43A340B591D3D2E5BFD9 /* librun_all_unittests.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = librun_all_unittests.a; + remoteRef = 757FEF3F76D43131CBED8C5B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C22D91CAFF221E82478B3EC9 /* libnotifier.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libnotifier.a; + remoteRef = 4066BA2095586535894C789F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C34A4DA3E2E9C8D31557AD00 /* ffmpeg_tests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = ffmpeg_tests; + remoteRef = B12BC585D8189CB3AA157913 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C740E01F34E473CAC79E1412 /* libwebcore_rendering.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebcore_rendering.a; + remoteRef = 5024107804D2AF1514F55ED4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C8E96D60D671FC45CD96BAC3 /* libglue.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libglue.a; + remoteRef = FAED0753F9D3F926B209F5DD /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C914BC2649BE52A52D67FE5C /* libwebrtc_i420.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebrtc_i420.a; + remoteRef = F39E714E91C2EFB29ABD70D8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + CA8D18339EA75625526C90B6 /* libvad.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libvad.a; + remoteRef = 169529FE3831F88FB9B7527C /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + CD32E80AD06B431CD489F6E8 /* libgpu_unittest_utils.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgpu_unittest_utils.a; + remoteRef = B7F4315EB8996BF458F8A705 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + CD3756258E34DFF18BE68DD7 /* libppapi_cpp.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libppapi_cpp.a; + remoteRef = B1D5D88E164CE31074399525 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + CE3B9660F42A253072C6E429 /* libcontent_gpu.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcontent_gpu.a; + remoteRef = B6698193902A916B7DCACAAE /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + CEBEAB89230F4E0AA610345F /* libppapi_egl.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libppapi_egl.a; + remoteRef = 148B64294A71827DD32268AD /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + D09AE7D9C7AA685F3778A4AB /* libwebrtc_video_coding.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebrtc_video_coding.a; + remoteRef = E2326D6EC24DCC7B01A1CA5B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + D48B0CC2B1FE4D2EE9210079 /* ffmpegsumo.so */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.dylib"; + path = ffmpegsumo.so; + remoteRef = 00D318C15C59AE5C6BAC0FF8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + D67EA0D4989FD408DD77B66C /* libgles2_implementation.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libgles2_implementation.a; + remoteRef = BD2C8B7022E96CA12CFC6BB6 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + D7E4226EAF9EC841EFBEAD98 /* libv8_base.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libv8_base.a; + remoteRef = 4B4C49DFEED47558DE0D9A5D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + D85B04783FE65DAC171C848C /* check_example */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = check_example; + remoteRef = 0BD9F7B23CFC802A88FC0578 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + D870F67866877AB7743458DE /* libcontent_renderer.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcontent_renderer.a; + remoteRef = C3140C49BC89699AF2D1F475 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + D874478C6297A52B77C4472D /* libsystem_wrappers.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libsystem_wrappers.a; + remoteRef = 37582B4A7787192DACC6CF7A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + D90E6D4C0A489F1C4BE5685A /* libcontent_plugin.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcontent_plugin.a; + remoteRef = 55594EB3B5984E205D0C5BF8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + D9A70841E03E00AE35585728 /* Content Shell Helper.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = "Content Shell Helper.app"; + remoteRef = E985B72ED8CD6CEC96B6DEC0 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + DA0A21F8A0EAAC0756DC19D5 /* libjsoncpp.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libjsoncpp.a; + remoteRef = 86FC41C04DD2CF043BD641EB /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + DBB1214DF375AF358E9D16D8 /* libjingle_glue_test_util.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libjingle_glue_test_util.a; + remoteRef = 5FF9709814B475BDD9BB9634 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + DCED4C272049F1F4D50F792C /* gl_tests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = gl_tests; + remoteRef = DD5CAB90FFC753B757B16188 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + DF39FC582E99207308E5F0D3 /* libwtf.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwtf.a; + remoteRef = DA49162825FEC6F2DF920FD7 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + DFAC89ACAC85C56A837AE4A4 /* libresampler.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libresampler.a; + remoteRef = D1D65BDA9DF16F93372B6D38 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E0124C00BC9DD166682EA919 /* libppapi_proxy.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libppapi_proxy.a; + remoteRef = 49A2BA04069DBA0AD5BDF22C /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E10BE1AF48EF909F62A87B9C /* gpu_unittests */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = gpu_unittests; + remoteRef = AE997F4CEA4AABD7207F01CC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E248C9BFA32A55025003A1F9 /* libbase_static.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libbase_static.a; + remoteRef = 17CC7BA1DE5BA019E48297BA /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E2B0AD96A1FD510ACD225119 /* simple_encoder */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = simple_encoder; + remoteRef = AB5C31A5287161C47750D7B7 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E2C2F26B2F9DD883DE77215C /* libskia_opts.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libskia_opts.a; + remoteRef = B2B0C693036EAAF6ADC7BD66 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E353FC738370E3181F299DE0 /* ppapi_example_simple_font.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_simple_font.bundle; + remoteRef = 7EE119AA57BC4D9AD80AF080 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E37BA3D3C92CCF19ACA1B9BC /* libpreprocessor.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libpreprocessor.a; + remoteRef = A96CB68E7E80957E540864C4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E3B63B91F23894A10980BB49 /* qt_faststart */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = qt_faststart; + remoteRef = BB0679EB8A203E2492706D58 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E3EFB43DABABCB5B5A738A2A /* libsfntly.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libsfntly.a; + remoteRef = CD409CCFCE8F689F35FEFD30 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E455343DCDDA068A7A605236 /* ppapi_example_graphics_2d.bundle */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ppapi_example_graphics_2d.bundle; + remoteRef = 76544C9F69DC787144A255A8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E520D20D9B313E81E46EFC44 /* libssl.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libssl.a; + remoteRef = 06167690665816396A64B996 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + E65826B5F5DCCEDCB9302BAC /* libwebkit.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebkit.a; + remoteRef = AB52844EA4733C15CEA1631E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + EAA20445274A6E929DA02F50 /* libmach_override.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libmach_override.a; + remoteRef = A9C613C9FBACDBBB5E2A3E1B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + EAA7B595FCFF3CBBB104B76B /* libiccjpeg.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libiccjpeg.a; + remoteRef = 181842CDA2DC32CFE2DE45C6 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + EB159E178A7EBD4D052A34C7 /* libjingle.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libjingle.a; + remoteRef = 71793833EA9EEC26D3E6F4B9 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + EC96295730C4344F46C4CF8C /* libcrcrypto.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libcrcrypto.a; + remoteRef = F526DF0C0B2A32EE9DE22AB5 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + ED37D78E0792BDA1C05BA20E /* libpng.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libpng.a; + remoteRef = C2E3C1171C23414E7B7A0D52 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + EE5959986B547B1347497441 /* libspeex.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libspeex.a; + remoteRef = DBF7F2D58A098B5842A8724F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + EEF3DEBE3DF87BA94FA84325 /* libsignal_processing.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libsignal_processing.a; + remoteRef = 3D7D3A7B1A9446ACCFF69A1B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F01AB71003340479A007B9FD /* libwebkit_support_gfx.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebkit_support_gfx.a; + remoteRef = 4A31BD4C9F1DD9CDE3F57506 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F0228BA8E7241096B69FA0D1 /* libicui18n.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libicui18n.a; + remoteRef = 188A1E8CF31DBE9DA966CCC4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F1A30087FEB5F03EBA42EF92 /* libwebcore_dom.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebcore_dom.a; + remoteRef = 800666C6BC68781DFA64D6B2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F3D7F0DDB63CA77F1F5205EA /* libiSACFix.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libiSACFix.a; + remoteRef = 742841A1810AEF9EE3864067 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F4E51FB8FB4C99518B681C2E /* libnotifier_test_util.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libnotifier_test_util.a; + remoteRef = 0668D05BC7D7D96761471AB1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F6CBA8C62E1D8E7F45C05DC8 /* libns_fix.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libns_fix.a; + remoteRef = 36215738AD0AE516908809F7 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F730AB17FB0BA0A61A7EF46C /* libns.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libns.a; + remoteRef = C4AEE6A041383B93F7026D89 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + F80EA39EE90B63653656CFE7 /* libappcache.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libappcache.a; + remoteRef = 865143ABA457D476C0389B76 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FA5C43585F17E267CF43DA3D /* libwebcore_svg.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebcore_svg.a; + remoteRef = 03D476619DA5E842CDF2CCDB /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FA96B3B9711BEAA356D3BB42 /* seek_tester */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = seek_tester; + remoteRef = 3C9D021E7C9F329F69CA98A9 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FC0BA8C2E6DAEBB62B81A46E /* libvideo_engine_core.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libvideo_engine_core.a; + remoteRef = 8B0DE9C8E5207E95CB1E2CEF /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FD86F492F6C7DDEF4E61078F /* peerconnection_server */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = peerconnection_server; + remoteRef = 93191A65543C391EBBEC6FBA /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FDE3F18B0794AC39BE153998 /* libots.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libots.a; + remoteRef = 4512A67BA93A52CFC91E9BEF /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FE3CC6EBD545B506351CCA2E /* libwebp_enc.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libwebp_enc.a; + remoteRef = D4A73E4F6037E259005EDB82 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FE91E39839004AF69907B7A7 /* crash_cache */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = crash_cache; + remoteRef = 176C1F95CEE96BDBAFFE170D /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FF117249FEB88AAAB9B6C26C /* libppapi_unittest_shared.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libppapi_unittest_shared.a; + remoteRef = 0F36EA3E37A087B808E76763 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FF2B8B0E9DAEBCCFE02F46C8 /* libsurface.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libsurface.a; + remoteRef = B34D16D8958181A331C9A3A2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FF6806AF1530C10B07E48E78 /* libprotobuf_full_do_not_use.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libprotobuf_full_do_not_use.a; + remoteRef = 7F0C73855BC0E63127D8A822 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + FFA0AC7FB9FD43ED5B983135 /* libnet_test_support.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libnet_test_support.a; + remoteRef = 265DB56B7F309F5B34073DA3 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 6817CDB95BD034F292DA8F53 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E9FA34F609DF067411A52C2B /* cefclient.icns in Resources */, + 234C5EB8ADE760FC5BAE647A /* InfoPlist.strings in Resources */, + BB50F5BD53C21286A1BD2D3D /* MainMenu.xib in Resources */, + 49C38710F28BC411D070F6EB /* binding.html in Resources */, + 093232FD5BBBEDCCFEB3F60F /* dialogs.html in Resources */, + A904368AF1F66C48DF17C2CD /* domaccess.html in Resources */, + 0C6C0FC67FB6A8079761A88D /* localstorage.html in Resources */, + 69474D6F7142BCFDF61EC73C /* logo.png in Resources */, + 76564BCA0FC47C829F93A8F9 /* xmlhttprequest.html in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 905C10454B56710E20BFBB4C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CC2124B3195237E3C341EA45 /* unittests.icns in Resources */, + 22BBB6A28901D896920B4E2F /* InfoPlist.strings in Resources */, + C7CE8FA5C7F0CC3516A3C3F0 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + EF19C4CF1107FD1F8A1D58A1 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3537BD5A7006FA48C4B84632 /* cefclient.icns in Resources */, + 0B23ED3968B19B9697B01B68 /* InfoPlist.strings in Resources */, + CF2069290E8EB1CCD228A4C8 /* MainMenu.xib in Resources */, + 6B39FD64E8841DE9A91D5902 /* binding.html in Resources */, + 8994E6C97FE7ADC8C3B9C2F1 /* dialogs.html in Resources */, + A64C48D0208E61228F3637E6 /* domaccess.html in Resources */, + B6DA0EA2BF8DD2E047DDCD1F /* localstorage.html in Resources */, + 2098CE57A8D49507B73CF379 /* logo.png in Resources */, + 19D404D668C11055204ECCD1 /* xmlhttprequest.html in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 0302AE1153B70E8F68D38370 /* Postbuild "Make More Helpers" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Make More Helpers\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/make_more_helpers.sh Frameworks cef_unittests\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 0310BBDDD26FDFD9481502AE /* Postbuild "Copy Pack File" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Copy Pack File\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec cp -f \"${BUILT_PRODUCTS_DIR}/cef.pak\" \"${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/cef.pak\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 03A6A45959528523C7D649EA /* Postbuild "Copy Pack File" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Copy Pack File\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec cp -f \"${BUILT_PRODUCTS_DIR}/cef.pak\" \"${BUILT_PRODUCTS_DIR}/cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/cef.pak\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 088D60E05B862F8EDEEF51C9 /* Postbuild "Make More Helpers" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Make More Helpers\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/make_more_helpers.sh Frameworks Atom\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 175A437AC43F027F233A6A47 /* Postbuild "Strip If Needed" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Strip If Needed\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/strip_from_xcode\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 292469D37E7F54C53612D2DA /* Postbuild "Tweak Info.plist" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Tweak Info.plist\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/tweak_info_plist.py \"--breakpad=0\" \"--keystone=0\" \"--svn=0\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 2A4EBA340C9E27703AF0630F /* Postbuild "Tweak Info.plist" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Tweak Info.plist\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/tweak_info_plist.py \"--breakpad=0\" \"--keystone=0\" \"--svn=0\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 3639EADC695DADA070AB399B /* Postbuild "Copy WebCore Resources" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Copy WebCore Resources\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec cp -Rf \"${BUILT_PRODUCTS_DIR}/../../third_party/WebKit/Source/WebCore/Resources/\" \"${BUILT_PRODUCTS_DIR}/cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 3B02B03470D5140960D97432 /* Action "repack_cef_pack" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ../tools/grit/grit/format/repack.py, + "$(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak", + "$(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/ui_resources_standard.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/devtools_resources.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_resources.pak", + ); + name = "Action \"repack_cef_pack\""; + outputPaths = ( + "$(BUILT_PRODUCTS_DIR)/cef.pak", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec python ../tools/grit/grit/format/repack.py \"${BUILT_PRODUCTS_DIR}/cef.pak\" \"${SHARED_INTERMEDIATE_DIR}/content/content_resources.pak\" \"${SHARED_INTERMEDIATE_DIR}/net/net_resources.pak\" \"${SHARED_INTERMEDIATE_DIR}/ui/ui_resources/ui_resources.pak\" \"${SHARED_INTERMEDIATE_DIR}/ui/ui_resources_standard/ui_resources_standard.pak\" \"${SHARED_INTERMEDIATE_DIR}/webkit/devtools_resources.pak\" \"${SHARED_INTERMEDIATE_DIR}/webkit/webkit_chromium_resources.pak\" \"${SHARED_INTERMEDIATE_DIR}/webkit/webkit_resources.pak\" \"${SHARED_INTERMEDIATE_DIR}/cef/cef_resources.pak\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 3C9AFFAC17C9AC4410282CC2 /* Postbuild "Tweak Info.plist" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Tweak Info.plist\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/tweak_info_plist.py \"--svn=1\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 499266B4B1AB1CE16FF810FC /* Postbuild "Change Mach-O Flags" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Change Mach-O Flags\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/change_mach_o_flags_from_xcode.sh\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 4D8A02B632CBD7D3A480A954 /* Postbuild "Fix Framework Link" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Fix Framework Link\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec install_name_tool -change @executable_path/libcef.dylib \"@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib\" \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 4E78B13E3141E87A1C8839E4 /* Postbuild "Copy WebCore Resources" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Copy WebCore Resources\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec cp -Rf \"${BUILT_PRODUCTS_DIR}/../../third_party/WebKit/Source/WebCore/Resources/\" \"${BUILT_PRODUCTS_DIR}/cef_unittests.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 5242EEED2E14B727C773C262 /* Postbuild "Tweak Info.plist" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Tweak Info.plist\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/tweak_info_plist.py \"--svn=1\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 54CA849DD7D891C030CFAB8D /* Postbuild "Fix Framework Link" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Fix Framework Link\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec install_name_tool -change @executable_path/libcef.dylib \"@executable_path/../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib\" \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 6E9206029272010913615E30 /* Postbuild "Change Mach-O Flags" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Change Mach-O Flags\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/change_mach_o_flags_from_xcode.sh\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 75E283402CB05DC628E11273 /* Postbuild "Fix Framework Link" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Fix Framework Link\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec install_name_tool -change @executable_path/libcef.dylib \"@executable_path/../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib\" \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 81B48C19E2353482EA798BDC /* Postbuild "Strip If Needed" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Strip If Needed\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/strip_from_xcode\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 83404D3B1F90F336C021A2E4 /* Postbuild "Strip If Needed" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Strip If Needed\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/strip_from_xcode\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 8852D1799E67EDB07CC36E6B /* Action "cef_strings" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ../tools/gritsettings/resource_ids, + libcef/resources/cef_strings.grd, + ../tools/grit/grit.py, + ../tools/grit/grit_info.py, + ../tools/grit/PRESUBMIT.py, + ../tools/grit/grit/__init__.py, + ../tools/grit/grit/clique.py, + ../tools/grit/grit/clique_unittest.py, + ../tools/grit/grit/constants.py, + ../tools/grit/grit/exception.py, + ../tools/grit/grit/grd_reader.py, + ../tools/grit/grit/grd_reader_unittest.py, + ../tools/grit/grit/grit_runner.py, + ../tools/grit/grit/grit_runner_unittest.py, + ../tools/grit/grit/lazy_re.py, + ../tools/grit/grit/lazy_re_unittest.py, + ../tools/grit/grit/pseudo.py, + ../tools/grit/grit/pseudo_rtl.py, + ../tools/grit/grit/pseudo_unittest.py, + ../tools/grit/grit/scons.py, + ../tools/grit/grit/shortcuts.py, + ../tools/grit/grit/shortcuts_unittests.py, + ../tools/grit/grit/tclib.py, + ../tools/grit/grit/tclib_unittest.py, + ../tools/grit/grit/test_suite_all.py, + ../tools/grit/grit/util.py, + ../tools/grit/grit/util_unittest.py, + ../tools/grit/grit/xtb_reader.py, + ../tools/grit/grit/xtb_reader_unittest.py, + ../tools/grit/grit/extern/__init__.py, + ../tools/grit/grit/extern/BogoFP.py, + ../tools/grit/grit/extern/FP.py, + ../tools/grit/grit/extern/tclib.py, + ../tools/grit/grit/format/__init__.py, + ../tools/grit/grit/format/c_format.py, + ../tools/grit/grit/format/c_format_unittest.py, + ../tools/grit/grit/format/data_pack.py, + ../tools/grit/grit/format/data_pack_unittest.py, + ../tools/grit/grit/format/html_inline.py, + ../tools/grit/grit/format/interface.py, + ../tools/grit/grit/format/js_map_format.py, + ../tools/grit/grit/format/js_map_format_unittest.py, + ../tools/grit/grit/format/rc.py, + ../tools/grit/grit/format/rc_header.py, + ../tools/grit/grit/format/rc_header_unittest.py, + ../tools/grit/grit/format/rc_unittest.py, + ../tools/grit/grit/format/repack.py, + ../tools/grit/grit/format/resource_map.py, + ../tools/grit/grit/format/policy_templates/__init__.py, + ../tools/grit/grit/format/policy_templates/policy_template_generator.py, + ../tools/grit/grit/format/policy_templates/policy_template_generator_unittest.py, + ../tools/grit/grit/format/policy_templates/PRESUBMIT.py, + ../tools/grit/grit/format/policy_templates/template_formatter.py, + ../tools/grit/grit/format/policy_templates/writer_configuration.py, + ../tools/grit/grit/format/policy_templates/writers/__init__.py, + ../tools/grit/grit/format/policy_templates/writers/adm_writer.py, + ../tools/grit/grit/format/policy_templates/writers/adm_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/adml_writer.py, + ../tools/grit/grit/format/policy_templates/writers/adml_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/admx_writer.py, + ../tools/grit/grit/format/policy_templates/writers/admx_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/doc_writer.py, + ../tools/grit/grit/format/policy_templates/writers/doc_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/json_writer.py, + ../tools/grit/grit/format/policy_templates/writers/json_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/mock_writer.py, + ../tools/grit/grit/format/policy_templates/writers/plist_helper.py, + ../tools/grit/grit/format/policy_templates/writers/plist_strings_writer.py, + ../tools/grit/grit/format/policy_templates/writers/plist_strings_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/plist_writer.py, + ../tools/grit/grit/format/policy_templates/writers/plist_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/reg_writer.py, + ../tools/grit/grit/format/policy_templates/writers/reg_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/template_writer.py, + ../tools/grit/grit/format/policy_templates/writers/template_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/writer_unittest_common.py, + ../tools/grit/grit/format/policy_templates/writers/xml_formatted_writer.py, + ../tools/grit/grit/format/policy_templates/writers/xml_writer_base_unittest.py, + ../tools/grit/grit/gather/__init__.py, + ../tools/grit/grit/gather/admin_template.py, + ../tools/grit/grit/gather/admin_template_unittest.py, + ../tools/grit/grit/gather/chrome_html.py, + ../tools/grit/grit/gather/chrome_html_unittest.py, + ../tools/grit/grit/gather/chrome_scaled_image.py, + ../tools/grit/grit/gather/chrome_scaled_image_unittest.py, + ../tools/grit/grit/gather/igoogle_strings.py, + ../tools/grit/grit/gather/igoogle_strings_unittest.py, + ../tools/grit/grit/gather/interface.py, + ../tools/grit/grit/gather/json_loader.py, + ../tools/grit/grit/gather/muppet_strings.py, + ../tools/grit/grit/gather/muppet_strings_unittest.py, + ../tools/grit/grit/gather/policy_json.py, + ../tools/grit/grit/gather/policy_json_unittest.py, + ../tools/grit/grit/gather/rc.py, + ../tools/grit/grit/gather/rc_unittest.py, + ../tools/grit/grit/gather/regexp.py, + ../tools/grit/grit/gather/skeleton_gatherer.py, + ../tools/grit/grit/gather/tr_html.py, + ../tools/grit/grit/gather/tr_html_unittest.py, + ../tools/grit/grit/gather/txt.py, + ../tools/grit/grit/gather/txt_unittest.py, + ../tools/grit/grit/node/__init__.py, + ../tools/grit/grit/node/base.py, + ../tools/grit/grit/node/base_unittest.py, + ../tools/grit/grit/node/empty.py, + ../tools/grit/grit/node/include.py, + ../tools/grit/grit/node/io.py, + ../tools/grit/grit/node/io_unittest.py, + ../tools/grit/grit/node/mapping.py, + ../tools/grit/grit/node/message.py, + ../tools/grit/grit/node/message_unittest.py, + ../tools/grit/grit/node/misc.py, + ../tools/grit/grit/node/misc_unittest.py, + ../tools/grit/grit/node/structure.py, + ../tools/grit/grit/node/structure_unittest.py, + ../tools/grit/grit/node/variant.py, + ../tools/grit/grit/node/custom/__init__.py, + ../tools/grit/grit/node/custom/filename.py, + ../tools/grit/grit/node/custom/filename_unittest.py, + ../tools/grit/grit/tool/__init__.py, + ../tools/grit/grit/tool/build.py, + ../tools/grit/grit/tool/build_unittest.py, + ../tools/grit/grit/tool/buildinfo.py, + ../tools/grit/grit/tool/buildinfo_unittest.py, + ../tools/grit/grit/tool/count.py, + ../tools/grit/grit/tool/diff_structures.py, + ../tools/grit/grit/tool/interface.py, + ../tools/grit/grit/tool/menu_from_parts.py, + ../tools/grit/grit/tool/newgrd.py, + ../tools/grit/grit/tool/postprocess_interface.py, + ../tools/grit/grit/tool/postprocess_unittest.py, + ../tools/grit/grit/tool/preprocess_interface.py, + ../tools/grit/grit/tool/preprocess_unittest.py, + ../tools/grit/grit/tool/rc2grd.py, + ../tools/grit/grit/tool/rc2grd_unittest.py, + ../tools/grit/grit/tool/resize.py, + ../tools/grit/grit/tool/test.py, + ../tools/grit/grit/tool/toolbar_postprocess.py, + ../tools/grit/grit/tool/toolbar_preprocess.py, + ../tools/grit/grit/tool/transl2tc.py, + ../tools/grit/grit/tool/transl2tc_unittest.py, + ../tools/grit/grit/tool/unit.py, + ../tools/grit/grit/tool/xmb.py, + ../tools/grit/grit/tool/xmb_unittest.py, + ); + name = "Action \"cef_strings\""; + outputPaths = ( + "$(SHARED_INTERMEDIATE_DIR)/cef/grit/cef_strings.h", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_am.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ar.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_bg.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_bn.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ca.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_cs.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_da.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_de.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_el.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_en-GB.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_en-US.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_es.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_es-419.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_et.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_fa.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_fake-bidi.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_fi.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_fil.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_fr.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_gu.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_he.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_hi.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_hr.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_hu.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_id.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_it.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ja.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_kn.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ko.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_lt.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_lv.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ml.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_mr.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ms.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_nl.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_nb.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_pl.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_pt-BR.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_pt-PT.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ro.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ru.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_sk.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_sl.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_sr.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_sv.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_sw.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ta.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_te.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_th.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_tr.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_uk.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_vi.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_zh-CN.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_zh-TW.pak", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo note: \"Generating resources from libcef/resources/cef_strings.grd\"\nexec python ../tools/grit/grit.py -i libcef/resources/cef_strings.grd build -f GRIT_DIR/../gritsettings/resource_ids -o \"${SHARED_INTERMEDIATE_DIR}/cef\" -D _chromium -E \"CHROMIUM_BUILD=chromium\" -D remoting -D use_titlecase -D enable_extensions -D enable_printing\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 8B7A5C0773D0725D94DACA20 /* Postbuild "Change Mach-O Flags" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Change Mach-O Flags\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/change_mach_o_flags_from_xcode.sh\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 8FACF06540BB4D8E03202976 /* Postbuild "Copy WebCore Resources" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Copy WebCore Resources\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec cp -Rf \"${BUILT_PRODUCTS_DIR}/../../third_party/WebKit/Source/WebCore/Resources/\" \"${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 9308A67602FDE42160C8E44C /* Postbuild "Change Mach-O Flags" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Change Mach-O Flags\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/change_mach_o_flags_from_xcode.sh\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 9953FC55F4311BA11D160112 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec python -c \"import fcntl, subprocess, sys\nfile = open('$TMPDIR/GYP_serialize_test_runs', 'a')\nfcntl.flock(file.fileno(), fcntl.LOCK_EX)\nsys.exit(subprocess.call(sys.argv[1:]))\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 9C2348DE2A7F270B8F0C0850 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec python -c \"import fcntl, subprocess, sys\nfile = open('$TMPDIR/GYP_serialize_test_runs', 'a')\nfcntl.flock(file.fileno(), fcntl.LOCK_EX)\nsys.exit(subprocess.call(sys.argv[1:]))\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/MacOS/${PRODUCT_NAME}\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + 9D7F4F37E16955CBDBB8B64A /* Postbuild "Strip If Needed" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Strip If Needed\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/strip_from_xcode\nexit 1\n"; + showEnvVarsInLog = 0; + }; + AAEB415B37B6A705C7DAC877 /* Postbuild "Fix Framework Link" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Fix Framework Link\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec install_name_tool -change @executable_path/libcef.dylib \"@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib\" \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + AD62A6B22A45C4C5A439D10C /* Postbuild "Make More Helpers" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Make More Helpers\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/make_more_helpers.sh Frameworks cefclient\nexit 1\n"; + showEnvVarsInLog = 0; + }; + B7F19AED801FC55033369354 /* Postbuild "Change Mach-O Flags" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Change Mach-O Flags\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/change_mach_o_flags_from_xcode.sh\nexit 1\n"; + showEnvVarsInLog = 0; + }; + B8A7A0CE7518319208F686E9 /* Action "cef_resources" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ../tools/gritsettings/resource_ids, + libcef/resources/cef_resources.grd, + libcef/resources/devtools_discovery_page.html, + ../tools/grit/grit.py, + ../tools/grit/grit_info.py, + ../tools/grit/PRESUBMIT.py, + ../tools/grit/grit/__init__.py, + ../tools/grit/grit/clique.py, + ../tools/grit/grit/clique_unittest.py, + ../tools/grit/grit/constants.py, + ../tools/grit/grit/exception.py, + ../tools/grit/grit/grd_reader.py, + ../tools/grit/grit/grd_reader_unittest.py, + ../tools/grit/grit/grit_runner.py, + ../tools/grit/grit/grit_runner_unittest.py, + ../tools/grit/grit/lazy_re.py, + ../tools/grit/grit/lazy_re_unittest.py, + ../tools/grit/grit/pseudo.py, + ../tools/grit/grit/pseudo_rtl.py, + ../tools/grit/grit/pseudo_unittest.py, + ../tools/grit/grit/scons.py, + ../tools/grit/grit/shortcuts.py, + ../tools/grit/grit/shortcuts_unittests.py, + ../tools/grit/grit/tclib.py, + ../tools/grit/grit/tclib_unittest.py, + ../tools/grit/grit/test_suite_all.py, + ../tools/grit/grit/util.py, + ../tools/grit/grit/util_unittest.py, + ../tools/grit/grit/xtb_reader.py, + ../tools/grit/grit/xtb_reader_unittest.py, + ../tools/grit/grit/extern/__init__.py, + ../tools/grit/grit/extern/BogoFP.py, + ../tools/grit/grit/extern/FP.py, + ../tools/grit/grit/extern/tclib.py, + ../tools/grit/grit/format/__init__.py, + ../tools/grit/grit/format/c_format.py, + ../tools/grit/grit/format/c_format_unittest.py, + ../tools/grit/grit/format/data_pack.py, + ../tools/grit/grit/format/data_pack_unittest.py, + ../tools/grit/grit/format/html_inline.py, + ../tools/grit/grit/format/interface.py, + ../tools/grit/grit/format/js_map_format.py, + ../tools/grit/grit/format/js_map_format_unittest.py, + ../tools/grit/grit/format/rc.py, + ../tools/grit/grit/format/rc_header.py, + ../tools/grit/grit/format/rc_header_unittest.py, + ../tools/grit/grit/format/rc_unittest.py, + ../tools/grit/grit/format/repack.py, + ../tools/grit/grit/format/resource_map.py, + ../tools/grit/grit/format/policy_templates/__init__.py, + ../tools/grit/grit/format/policy_templates/policy_template_generator.py, + ../tools/grit/grit/format/policy_templates/policy_template_generator_unittest.py, + ../tools/grit/grit/format/policy_templates/PRESUBMIT.py, + ../tools/grit/grit/format/policy_templates/template_formatter.py, + ../tools/grit/grit/format/policy_templates/writer_configuration.py, + ../tools/grit/grit/format/policy_templates/writers/__init__.py, + ../tools/grit/grit/format/policy_templates/writers/adm_writer.py, + ../tools/grit/grit/format/policy_templates/writers/adm_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/adml_writer.py, + ../tools/grit/grit/format/policy_templates/writers/adml_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/admx_writer.py, + ../tools/grit/grit/format/policy_templates/writers/admx_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/doc_writer.py, + ../tools/grit/grit/format/policy_templates/writers/doc_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/json_writer.py, + ../tools/grit/grit/format/policy_templates/writers/json_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/mock_writer.py, + ../tools/grit/grit/format/policy_templates/writers/plist_helper.py, + ../tools/grit/grit/format/policy_templates/writers/plist_strings_writer.py, + ../tools/grit/grit/format/policy_templates/writers/plist_strings_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/plist_writer.py, + ../tools/grit/grit/format/policy_templates/writers/plist_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/reg_writer.py, + ../tools/grit/grit/format/policy_templates/writers/reg_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/template_writer.py, + ../tools/grit/grit/format/policy_templates/writers/template_writer_unittest.py, + ../tools/grit/grit/format/policy_templates/writers/writer_unittest_common.py, + ../tools/grit/grit/format/policy_templates/writers/xml_formatted_writer.py, + ../tools/grit/grit/format/policy_templates/writers/xml_writer_base_unittest.py, + ../tools/grit/grit/gather/__init__.py, + ../tools/grit/grit/gather/admin_template.py, + ../tools/grit/grit/gather/admin_template_unittest.py, + ../tools/grit/grit/gather/chrome_html.py, + ../tools/grit/grit/gather/chrome_html_unittest.py, + ../tools/grit/grit/gather/chrome_scaled_image.py, + ../tools/grit/grit/gather/chrome_scaled_image_unittest.py, + ../tools/grit/grit/gather/igoogle_strings.py, + ../tools/grit/grit/gather/igoogle_strings_unittest.py, + ../tools/grit/grit/gather/interface.py, + ../tools/grit/grit/gather/json_loader.py, + ../tools/grit/grit/gather/muppet_strings.py, + ../tools/grit/grit/gather/muppet_strings_unittest.py, + ../tools/grit/grit/gather/policy_json.py, + ../tools/grit/grit/gather/policy_json_unittest.py, + ../tools/grit/grit/gather/rc.py, + ../tools/grit/grit/gather/rc_unittest.py, + ../tools/grit/grit/gather/regexp.py, + ../tools/grit/grit/gather/skeleton_gatherer.py, + ../tools/grit/grit/gather/tr_html.py, + ../tools/grit/grit/gather/tr_html_unittest.py, + ../tools/grit/grit/gather/txt.py, + ../tools/grit/grit/gather/txt_unittest.py, + ../tools/grit/grit/node/__init__.py, + ../tools/grit/grit/node/base.py, + ../tools/grit/grit/node/base_unittest.py, + ../tools/grit/grit/node/empty.py, + ../tools/grit/grit/node/include.py, + ../tools/grit/grit/node/io.py, + ../tools/grit/grit/node/io_unittest.py, + ../tools/grit/grit/node/mapping.py, + ../tools/grit/grit/node/message.py, + ../tools/grit/grit/node/message_unittest.py, + ../tools/grit/grit/node/misc.py, + ../tools/grit/grit/node/misc_unittest.py, + ../tools/grit/grit/node/structure.py, + ../tools/grit/grit/node/structure_unittest.py, + ../tools/grit/grit/node/variant.py, + ../tools/grit/grit/node/custom/__init__.py, + ../tools/grit/grit/node/custom/filename.py, + ../tools/grit/grit/node/custom/filename_unittest.py, + ../tools/grit/grit/tool/__init__.py, + ../tools/grit/grit/tool/build.py, + ../tools/grit/grit/tool/build_unittest.py, + ../tools/grit/grit/tool/buildinfo.py, + ../tools/grit/grit/tool/buildinfo_unittest.py, + ../tools/grit/grit/tool/count.py, + ../tools/grit/grit/tool/diff_structures.py, + ../tools/grit/grit/tool/interface.py, + ../tools/grit/grit/tool/menu_from_parts.py, + ../tools/grit/grit/tool/newgrd.py, + ../tools/grit/grit/tool/postprocess_interface.py, + ../tools/grit/grit/tool/postprocess_unittest.py, + ../tools/grit/grit/tool/preprocess_interface.py, + ../tools/grit/grit/tool/preprocess_unittest.py, + ../tools/grit/grit/tool/rc2grd.py, + ../tools/grit/grit/tool/rc2grd_unittest.py, + ../tools/grit/grit/tool/resize.py, + ../tools/grit/grit/tool/test.py, + ../tools/grit/grit/tool/toolbar_postprocess.py, + ../tools/grit/grit/tool/toolbar_preprocess.py, + ../tools/grit/grit/tool/transl2tc.py, + ../tools/grit/grit/tool/transl2tc_unittest.py, + ../tools/grit/grit/tool/unit.py, + ../tools/grit/grit/tool/xmb.py, + ../tools/grit/grit/tool/xmb_unittest.py, + ); + name = "Action \"cef_resources\""; + outputPaths = ( + "$(SHARED_INTERMEDIATE_DIR)/cef/grit/cef_resources.h", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_resources.pak", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo note: \"Generating resources from libcef/resources/cef_resources.grd\"\nexec python ../tools/grit/grit.py -i libcef/resources/cef_resources.grd build -f GRIT_DIR/../gritsettings/resource_ids -o \"${SHARED_INTERMEDIATE_DIR}/cef\" -D _chromium -E \"CHROMIUM_BUILD=chromium\" -D remoting -D use_titlecase -D enable_extensions -D enable_printing\nexit 1\n"; + showEnvVarsInLog = 0; + }; + BB7AE9DBAC3E98B040D5A1E1 /* Postbuild "Change Mach-O Flags" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Change Mach-O Flags\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/change_mach_o_flags_from_xcode.sh\nexit 1\n"; + showEnvVarsInLog = 0; + }; + BFEFD08C1BBEBBF67A1479FE /* Postbuild "Fix Framework Link" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Fix Framework Link\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec install_name_tool -change @executable_path/libcef.dylib \"@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib\" \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + C877D034A6CB2A4B434403D2 /* Postbuild "Strip If Needed" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Strip If Needed\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/strip_from_xcode\nexit 1\n"; + showEnvVarsInLog = 0; + }; + CD9DA8F3139BF447C6EAD60F /* Postbuild "Strip If Needed" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Strip If Needed\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/strip_from_xcode\nexit 1\n"; + showEnvVarsInLog = 0; + }; + D3373A7377E5AA9C261D591A /* Action "make_pack_strings_header" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + tools/make_pack_header.py, + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/grit/ui_strings.h", + "$(SHARED_INTERMEDIATE_DIR)/webkit/grit/webkit_strings.h", + "$(SHARED_INTERMEDIATE_DIR)/cef/grit/cef_strings.h", + ); + name = "Action \"make_pack_strings_header\""; + outputPaths = ( + include/cef_pack_strings.h, + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec python tools/make_pack_header.py include/cef_pack_strings.h \"${SHARED_INTERMEDIATE_DIR}/ui/ui_strings/grit/ui_strings.h\" \"${SHARED_INTERMEDIATE_DIR}/webkit/grit/webkit_strings.h\" \"${SHARED_INTERMEDIATE_DIR}/cef/grit/cef_strings.h\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + D3A607D63C1C6C789F5BFEE9 /* Postbuild "Fix Framework Link" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Fix Framework Link\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec install_name_tool -change @executable_path/libcef.dylib \"@executable_path/../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib\" \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + DC5E0389A842A86C8885389B /* Postbuild "Strip If Needed" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Strip If Needed\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/strip_from_xcode\nexit 1\n"; + showEnvVarsInLog = 0; + }; + F530C19B5115115D7A7639EB /* Postbuild "Copy Pack File" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Copy Pack File\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec cp -f \"${BUILT_PRODUCTS_DIR}/cef.pak\" \"${BUILT_PRODUCTS_DIR}/cef_unittests.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/cef.pak\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + F56F85D11FE913389343E424 /* Action "make_pack_resources_header" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + tools/make_pack_header.py, + "$(SHARED_INTERMEDIATE_DIR)/content/grit/content_resources.h", + "$(SHARED_INTERMEDIATE_DIR)/net/grit/net_resources.h", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/grit/ui_resources.h", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard/grit/ui_resources_standard.h", + "$(SHARED_INTERMEDIATE_DIR)/webkit/grit/devtools_resources.h", + "$(SHARED_INTERMEDIATE_DIR)/webkit/grit/webkit_chromium_resources.h", + "$(SHARED_INTERMEDIATE_DIR)/webkit/grit/webkit_resources.h", + "$(SHARED_INTERMEDIATE_DIR)/cef/grit/cef_resources.h", + ); + name = "Action \"make_pack_resources_header\""; + outputPaths = ( + include/cef_pack_resources.h, + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec python tools/make_pack_header.py include/cef_pack_resources.h \"${SHARED_INTERMEDIATE_DIR}/content/grit/content_resources.h\" \"${SHARED_INTERMEDIATE_DIR}/net/grit/net_resources.h\" \"${SHARED_INTERMEDIATE_DIR}/ui/ui_resources/grit/ui_resources.h\" \"${SHARED_INTERMEDIATE_DIR}/ui/ui_resources_standard/grit/ui_resources_standard.h\" \"${SHARED_INTERMEDIATE_DIR}/webkit/grit/devtools_resources.h\" \"${SHARED_INTERMEDIATE_DIR}/webkit/grit/webkit_chromium_resources.h\" \"${SHARED_INTERMEDIATE_DIR}/webkit/grit/webkit_resources.h\" \"${SHARED_INTERMEDIATE_DIR}/cef/grit/cef_resources.h\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + F757F82DE3BE900D86F73BCB /* Action "repack_locales" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + tools/repack_locales.py, + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_am.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_am.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_am.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_am.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_ar.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_ar.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_ar.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ar.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_bg.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_bg.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_bg.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_bg.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_bn.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_bn.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_bn.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_bn.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_ca.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_ca.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_ca.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ca.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_cs.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_cs.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_cs.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_cs.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_da.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_da.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_da.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_da.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_de.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_de.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_de.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_de.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_el.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_el.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_el.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_el.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-GB.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_en-GB.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_en-GB.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_en-GB.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_en-US.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_en-US.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_en-US.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_es-419.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_es-419.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_es-419.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_es-419.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_es.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_es.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_es.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_es.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_et.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_et.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_et.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_et.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_fa.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_fa.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_fa.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_fa.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_fi.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_fi.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_fi.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_fi.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_fil.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_fil.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_fil.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_fil.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_fr.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_fr.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_fr.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_fr.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_gu.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_gu.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_gu.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_gu.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_he.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_he.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_he.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_he.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_hi.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_hi.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_hi.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_hi.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_hr.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_hr.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_hr.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_hr.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_hu.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_hu.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_hu.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_hu.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_id.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_id.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_id.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_id.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_it.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_it.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_it.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_it.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_ja.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_ja.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_ja.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ja.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_kn.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_kn.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_kn.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_kn.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_ko.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_ko.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_ko.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ko.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_lt.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_lt.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_lt.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_lt.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_lv.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_lv.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_lv.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_lv.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_ml.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_ml.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_ml.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ml.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_mr.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_mr.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_mr.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_mr.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_ms.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_ms.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_ms.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ms.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_nb.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_nb.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_nb.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_nb.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_nl.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_nl.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_nl.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_nl.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_pl.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_pl.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_pl.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_pl.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_pt-BR.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_pt-BR.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_pt-BR.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_pt-BR.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_pt-PT.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_pt-PT.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_pt-PT.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_pt-PT.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_ro.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_ro.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_ro.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ro.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_ru.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_ru.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_ru.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ru.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_sk.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_sk.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_sk.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_sk.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_sl.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_sl.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_sl.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_sl.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_sr.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_sr.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_sr.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_sr.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_sv.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_sv.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_sv.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_sv.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_sw.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_sw.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_sw.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_sw.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_ta.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_ta.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_ta.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_ta.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_te.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_te.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_te.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_te.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_th.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_th.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_th.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_th.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_tr.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_tr.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_tr.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_tr.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_uk.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_uk.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_uk.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_uk.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_vi.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_vi.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_vi.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_vi.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_zh-CN.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_zh-CN.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_zh-CN.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_zh-CN.pak", + "$(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_zh-TW.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_zh-TW.pak", + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_zh-TW.pak", + "$(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_zh-TW.pak", + ); + name = "Action \"repack_locales\""; + outputPaths = ( + "$(INTERMEDIATE_DIR)/repack/am.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/ar.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/bg.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/bn.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/ca.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/cs.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/da.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/de.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/el.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/en_GB.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/en.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/es_419.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/es.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/et.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/fa.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/fi.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/fil.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/fr.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/gu.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/he.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/hi.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/hr.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/hu.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/id.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/it.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/ja.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/kn.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/ko.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/lt.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/lv.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/ml.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/mr.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/ms.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/nb.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/nl.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/pl.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/pt_BR.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/pt_PT.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/ro.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/ru.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/sk.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/sl.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/sr.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/sv.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/sw.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/ta.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/te.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/th.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/tr.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/uk.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/vi.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/zh_CN.lproj/locale.pak", + "$(INTERMEDIATE_DIR)/repack/zh_TW.lproj/locale.pak", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec python tools/repack_locales.py -g \"${SHARED_INTERMEDIATE_DIR}/cef\" -s \"${SHARED_INTERMEDIATE_DIR}\" -x \"${INTERMEDIATE_DIR}\" am ar bg bn ca cs da de el en-GB en-US es-419 es et fa fi fil fr gu he hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr sv sw ta te th tr uk vi zh-CN zh-TW\nexit 1\n"; + showEnvVarsInLog = 0; + }; + F893089D73E0B020449C4564 /* Postbuild "Tweak Info.plist" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Tweak Info.plist\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/tweak_info_plist.py \"--svn=1\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; + FC00781F5CB1A05417F28E8C /* Postbuild "Tweak Info.plist" */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)", + ); + name = "Postbuild \"Tweak Info.plist\""; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "exec ../build/mac/tweak_info_plist.py \"--breakpad=0\" \"--keystone=0\" \"--svn=0\"\nexit 1\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 15AAF6C809448EC005E189B1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2DF072D42F50C2AADCD9A443 /* libcef_dll.cc in Sources */, + 08412B2E2C0B784C94B4B65C /* libcef_dll2.cc in Sources */, + 0D80A5612DA59B05B6E1377F /* transfer_util.cpp in Sources */, + C082C526C4206732EDF63B9D /* app_ctocpp.cc in Sources */, + B748B2EEE8236127C08286F4 /* auth_callback_cpptoc.cc in Sources */, + 4E57B24E987042000672DDA1 /* before_download_callback_cpptoc.cc in Sources */, + 875BD0C679820178259D8A54 /* binary_value_cpptoc.cc in Sources */, + D87FF136BAB97CEA8D161814 /* browser_cpptoc.cc in Sources */, + AFEF9C6F2628CB105AD4F321 /* browser_host_cpptoc.cc in Sources */, + E004336F9CA973BC2B4C2D89 /* browser_process_handler_ctocpp.cc in Sources */, + 0BF0FCD0D4DACCA6B02D3E8C /* callback_cpptoc.cc in Sources */, + 61D619FD31277653C59F3321 /* client_ctocpp.cc in Sources */, + 9323D6AB7358CCF83CF1CB2F /* command_line_cpptoc.cc in Sources */, + F374C92C39CEA9F60F0FCC05 /* context_menu_handler_ctocpp.cc in Sources */, + BCE4623E435AF586325B1C80 /* context_menu_params_cpptoc.cc in Sources */, + 73B3D2659F6B8627581CB6EE /* cookie_manager_cpptoc.cc in Sources */, + A2D803E4D8490FE31E529E99 /* cookie_visitor_ctocpp.cc in Sources */, + 3C346B000B851A07F942D73B /* domdocument_cpptoc.cc in Sources */, + 91BE77E51A3340A218F4038F /* domevent_cpptoc.cc in Sources */, + EAA910BDE60E69E30F874F6D /* domevent_listener_ctocpp.cc in Sources */, + EB6DB5276DEA3F58BEDC1040 /* domnode_cpptoc.cc in Sources */, + DF63410737D13ACDC025F374 /* domvisitor_ctocpp.cc in Sources */, + 2A041BC7517CF78C04F49078 /* dictionary_value_cpptoc.cc in Sources */, + 4C635AC480BF4EDCB3E27792 /* display_handler_ctocpp.cc in Sources */, + A9467139CD19AE3B696FD9B8 /* download_handler_ctocpp.cc in Sources */, + 899A35A45B4EADE0D3764E1E /* download_item_cpptoc.cc in Sources */, + D9BEADA483C036DE6FAEA4FC /* download_item_callback_cpptoc.cc in Sources */, + DDA64DC3A66A44E199A883A7 /* focus_handler_ctocpp.cc in Sources */, + 5DA997DDE1F405CAD58953E3 /* frame_cpptoc.cc in Sources */, + 0F8E893EA4DE27BA8848DD68 /* geolocation_callback_cpptoc.cc in Sources */, + C08FF368F5378B72038BF7E8 /* geolocation_handler_ctocpp.cc in Sources */, + C5699629E74C69F3CF3517B0 /* jsdialog_callback_cpptoc.cc in Sources */, + 73455E9EDC893647F381032B /* jsdialog_handler_ctocpp.cc in Sources */, + 62291349F25A362F3B59D669 /* keyboard_handler_ctocpp.cc in Sources */, + 4CDC6E8014B1571C5F2E5FD6 /* life_span_handler_ctocpp.cc in Sources */, + C4BB12B924AEBD633D5FAB3E /* list_value_cpptoc.cc in Sources */, + 8DFE19F368355E317F165229 /* load_handler_ctocpp.cc in Sources */, + 360074340588876A70AE5B0C /* menu_model_cpptoc.cc in Sources */, + C9459B2BF34765BA9524DDD6 /* post_data_cpptoc.cc in Sources */, + 1DAF18310B9DFA66C6CE12C2 /* post_data_element_cpptoc.cc in Sources */, + AAEAC6F81ABB290DF1735820 /* process_message_cpptoc.cc in Sources */, + BDF482FC9A53CDC5923ECE38 /* proxy_handler_ctocpp.cc in Sources */, + FD62A620BD921FFA875D143B /* read_handler_ctocpp.cc in Sources */, + 9B3E98E8DA49920FDBCDD0AD /* render_process_handler_ctocpp.cc in Sources */, + B5E36AEEB67433195546BD80 /* request_cpptoc.cc in Sources */, + AF3E2C0767F941C5ECC1BC93 /* request_handler_ctocpp.cc in Sources */, + AEE856E8A7519A49816BB1D1 /* resource_bundle_handler_ctocpp.cc in Sources */, + 7B39271DAC5E572C257A889C /* resource_handler_ctocpp.cc in Sources */, + C3DD604EA8D146259CE01DF7 /* response_cpptoc.cc in Sources */, + 6383BE17F7297A566E7A8BD7 /* scheme_handler_factory_ctocpp.cc in Sources */, + 08D551BCC9772DA2B96743BA /* scheme_registrar_cpptoc.cc in Sources */, + 5EEB1217F1C92481B2CF5C4C /* stream_reader_cpptoc.cc in Sources */, + E2C8642C814A208E60596978 /* stream_writer_cpptoc.cc in Sources */, + 5A54C44C64D4BD8CA7C1817A /* string_visitor_ctocpp.cc in Sources */, + 944CB3AC150171A86FF0B832 /* task_ctocpp.cc in Sources */, + 7FA9BE1AF30B2F7A1182B69C /* urlrequest_cpptoc.cc in Sources */, + 443A4A941B679112E634C384 /* urlrequest_client_ctocpp.cc in Sources */, + 3FA0904E6D772D22699C5A8D /* v8accessor_ctocpp.cc in Sources */, + BA860F25AFB15AD6595D34C3 /* v8context_cpptoc.cc in Sources */, + 4E05C1EB5BF58D945F0999F0 /* v8exception_cpptoc.cc in Sources */, + 7A8E5101821E458CC15C6DB9 /* v8handler_ctocpp.cc in Sources */, + DD6B019B2E9DE6E43DB718EF /* v8value_cpptoc.cc in Sources */, + AC2816CE95D57F2AA8E621FC /* web_plugin_info_cpptoc.cc in Sources */, + 305F53952C6045E05E2FB947 /* web_plugin_info_visitor_ctocpp.cc in Sources */, + 88A9842446D178140DCC74BC /* write_handler_ctocpp.cc in Sources */, + 39CFE7BD9D246259B82499EA /* xml_reader_cpptoc.cc in Sources */, + 1C2C0C47609812747AA1E8FD /* zip_reader_cpptoc.cc in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2B59DED28F1CA97C1BEDABA0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9EADCCD9BF39A15442F81B92 /* client_app.cpp in Sources */, + DE09853654C85450CE9D67A2 /* client_switches.cpp in Sources */, + 9DC4DAEEAF08796B413BEC8C /* command_line_unittest.cc in Sources */, + 3DD609000669D9030D45F1BF /* cookie_unittest.cc in Sources */, + 2F637B5E0119842E2C5AF158 /* dom_unittest.cc in Sources */, + F1798D10917E9B878CE07511 /* jsdialog_unittest.cc in Sources */, + 53AF2C15B7C6E5247A380382 /* navigation_unittest.cc in Sources */, + FEDE2ED57A314174A97796CE /* process_message_unittest.cc in Sources */, + B984F24F1479F1FDC3B78875 /* request_unittest.cc in Sources */, + 04013A25517C49B02113629C /* run_all_unittests.cc in Sources */, + EFB2279A40210EEB91A31ADD /* scheme_handler_unittest.cc in Sources */, + 5A8C2F4DF73CE319F30E49BC /* stream_unittest.cc in Sources */, + 6908868821973BA856EA77A7 /* string_unittest.cc in Sources */, + 6F5C012F8EC4F87FDFB9596A /* client_app_delegates.cc in Sources */, + C0EEAB6423D08739B4EAE4EE /* test_handler.cc in Sources */, + 37D7C2A28CFFE76FE93D5251 /* test_suite.cc in Sources */, + EF70618DF1DF2F9F74BD5A0F /* test_util.cc in Sources */, + 55A64C0CF1052BFD7171F927 /* url_unittest.cc in Sources */, + B7ADCE3010BEBCA1C768775B /* urlrequest_unittest.cc in Sources */, + C5EF13DA50BB0EE92739CD1A /* v8_unittest.cc in Sources */, + 7D0676006B7170D1D0D2DCF2 /* values_unittest.cc in Sources */, + 9A9EA2D039A1E40ED9799526 /* xml_reader_unittest.cc in Sources */, + 7F20178041CEA2A7849602FC /* zip_reader_unittest.cc in Sources */, + 72D9CBB856E7243132D47096 /* run_all_unittests_mac.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 44932A9FD29C6A7F954CE8EC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B613E4F4FD6132849B9BA80E /* binding_test.cpp in Sources */, + D09980C48813C6BEF7CBAF97 /* client_app.cpp in Sources */, + 721A7D55867C4F6A7B7CC0C7 /* client_app_delegates.cpp in Sources */, + EE1EBB5BA44DD269AB853863 /* client_handler.cpp in Sources */, + ED0A02304E4BE94FB03238B1 /* client_handler_mac.mm in Sources */, + 19DEBD12054F64267E393E82 /* client_renderer.cpp in Sources */, + A990225C4CDA6BEBA9590A03 /* client_switches.cpp in Sources */, + 2EF5AE209CDC63E8BD2959DA /* dom_test.cpp in Sources */, + 66D8CD56A63405E304590A52 /* process_helper_mac.cpp in Sources */, + 68C8856B8468B74A65E862DF /* resource_util_mac.mm in Sources */, + CA816B4F8892082999A14DB1 /* scheme_test.cpp in Sources */, + 35329B61633FD584C7719194 /* string_util.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 486323A0EF1B8BEF51AFE250 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A3461E375FD8257EE29ED3EF /* client_app.cpp in Sources */, + B57015B08B96608B1A95FC09 /* client_switches.cpp in Sources */, + 300D5B4875D909290FF01391 /* process_helper_mac.cpp in Sources */, + EF2058F40B91E555C75987EB /* client_app_delegates.cc in Sources */, + AE514A5836AEF1B7CA5A23DE /* cookie_unittest.cc in Sources */, + BD80B72B0EB668CE54562914 /* dom_unittest.cc in Sources */, + E6444CDC3D1EE8EC1325BE02 /* process_message_unittest.cc in Sources */, + D3AFBD947F49F414ED1EC4A2 /* scheme_handler_unittest.cc in Sources */, + 1C775B6CAA6602A323FD750C /* urlrequest_unittest.cc in Sources */, + EC05C69B721CD430572CF766 /* test_handler.cc in Sources */, + CEE26CF7C0892A04179E1B63 /* test_suite.cc in Sources */, + CBF4118EDE596DB7AE7023B7 /* test_util.cc in Sources */, + 7CA9909934EC2339EDED706A /* v8_unittest.cc in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4A0EC8CCC35A03E5F9AFDB2C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 233E56DEBCA6C8F7989482AC /* transfer_util.cpp in Sources */, + 4BE408BB5B1467CA381E2678 /* cef_byte_read_handler.cc in Sources */, + 020BE1CD2D14F1FEB5249134 /* cef_stream_resource_handler.cc in Sources */, + 56B0FD5F26042F668FAEF18C /* cef_xml_object.cc in Sources */, + DAD3AF7978FBB188E7BA34DC /* cef_zip_archive.cc in Sources */, + 0C67BA8FBC882A7534317601 /* libcef_dll_wrapper.cc in Sources */, + 61DEF6984CE2172E120EC660 /* libcef_dll_wrapper2.cc in Sources */, + 59C331F42AD962B343B84C10 /* app_cpptoc.cc in Sources */, + 1CBB7FA8D8F04950C87552DF /* auth_callback_ctocpp.cc in Sources */, + 7DDDA7773D2F742660814A03 /* before_download_callback_ctocpp.cc in Sources */, + 274076827E1CB76E48A6BEA7 /* binary_value_ctocpp.cc in Sources */, + CC24459DD31BF83F32DE4789 /* browser_ctocpp.cc in Sources */, + 5F0076C9EADE201BD9FBD18E /* browser_host_ctocpp.cc in Sources */, + 4045C3D8475E54CEF29AB4D3 /* browser_process_handler_cpptoc.cc in Sources */, + 47C2F10BE54E292FF7BCB758 /* callback_ctocpp.cc in Sources */, + F1032E0815347BDA722D20B9 /* client_cpptoc.cc in Sources */, + 219B1671D6CC20D63C711589 /* command_line_ctocpp.cc in Sources */, + 71C92DE2E19F04A793BF5613 /* context_menu_handler_cpptoc.cc in Sources */, + BE4F31BCD2026A0D95D301CE /* context_menu_params_ctocpp.cc in Sources */, + D7C93774D9C6095A3100A564 /* cookie_manager_ctocpp.cc in Sources */, + 835BE369FFCCA69BE9AD76B6 /* cookie_visitor_cpptoc.cc in Sources */, + 3DAD1A1BC6FE1C33F98B6CE7 /* domdocument_ctocpp.cc in Sources */, + C86070A15BA5DE7E6C4BEC4C /* domevent_ctocpp.cc in Sources */, + 183D9A5FC65A0C8BA5C65B6E /* domevent_listener_cpptoc.cc in Sources */, + 478EF5029C5524310C41796D /* domnode_ctocpp.cc in Sources */, + 248D2C3BC283B7431D7A2C3B /* domvisitor_cpptoc.cc in Sources */, + 4DBB16038D4206562C281B16 /* dictionary_value_ctocpp.cc in Sources */, + 95544C16CCE60691A7A79851 /* display_handler_cpptoc.cc in Sources */, + EA04E4BC7EE2E008D452F932 /* download_handler_cpptoc.cc in Sources */, + 843694346F1D2172313022A6 /* download_item_ctocpp.cc in Sources */, + 88D791A2C5699BF212AD91DE /* download_item_callback_ctocpp.cc in Sources */, + E165D8B7AD636AB0372AE0C6 /* focus_handler_cpptoc.cc in Sources */, + 9785B121613B5D7C401738B4 /* frame_ctocpp.cc in Sources */, + B767C603C93815276845C682 /* geolocation_callback_ctocpp.cc in Sources */, + 9903749E86FECAEAD1D58B5F /* geolocation_handler_cpptoc.cc in Sources */, + 998718985151123004D21F93 /* jsdialog_callback_ctocpp.cc in Sources */, + 817AF953924D3B5547006F5F /* jsdialog_handler_cpptoc.cc in Sources */, + 917F7C8B054E1BD89EA13B1E /* keyboard_handler_cpptoc.cc in Sources */, + D03B7F4D2D8C40095F991E1A /* life_span_handler_cpptoc.cc in Sources */, + 12F0CFDA98EB526D45CE4D8B /* list_value_ctocpp.cc in Sources */, + 50E34A82F19C933F71680671 /* load_handler_cpptoc.cc in Sources */, + E8266A21D735C2F5BC8921C8 /* menu_model_ctocpp.cc in Sources */, + 19791527E0A85388A2435529 /* post_data_ctocpp.cc in Sources */, + F996DCC14E5FE2DA56960AE6 /* post_data_element_ctocpp.cc in Sources */, + EC0AE85DCE6E03831A7396BA /* process_message_ctocpp.cc in Sources */, + 58D3272CB8BA08EBA04B28A5 /* proxy_handler_cpptoc.cc in Sources */, + C765C43D9FFA551758800401 /* read_handler_cpptoc.cc in Sources */, + 489196AEBC83D1AC76B6D0A3 /* render_process_handler_cpptoc.cc in Sources */, + 4D88A7899F042AF5F6D52B4D /* request_ctocpp.cc in Sources */, + C7DE2ACA3CEC0698A6B54188 /* request_handler_cpptoc.cc in Sources */, + 3F0C3D46E04B77E72B30F4EC /* resource_bundle_handler_cpptoc.cc in Sources */, + A0B36A7828F6EB349AFD0C1E /* resource_handler_cpptoc.cc in Sources */, + AA50811C42CEE68E8D0962EE /* response_ctocpp.cc in Sources */, + FA9E0057F36596DCAA4F10F9 /* scheme_handler_factory_cpptoc.cc in Sources */, + F9F45DEE7C20CDACA8CFDEE2 /* scheme_registrar_ctocpp.cc in Sources */, + 187BA9808A259F3DA1B93518 /* stream_reader_ctocpp.cc in Sources */, + 8E0A4D8DF378F8728BB7A470 /* stream_writer_ctocpp.cc in Sources */, + 0AEE4ECDDC8348381839D712 /* string_visitor_cpptoc.cc in Sources */, + B6584D4042F482677DE5AC4F /* task_cpptoc.cc in Sources */, + 7F1AC8E1CDB79DF6C2D91B6A /* urlrequest_ctocpp.cc in Sources */, + 2CD7E3AB9DFA7D04DA46F59C /* urlrequest_client_cpptoc.cc in Sources */, + B035C9659A97076A096896F2 /* v8accessor_cpptoc.cc in Sources */, + F11CEF982035149925D39611 /* v8context_ctocpp.cc in Sources */, + 03E895FC8CE32ABFA9C4CFFB /* v8exception_ctocpp.cc in Sources */, + A09DC86DD267E0F7084C6E48 /* v8handler_cpptoc.cc in Sources */, + F912D1FC4DB57F95E2391585 /* v8value_ctocpp.cc in Sources */, + 57D3749D9808C179B98F23F5 /* web_plugin_info_ctocpp.cc in Sources */, + 0B0A44268650AA4978261D94 /* web_plugin_info_visitor_cpptoc.cc in Sources */, + 6EC7831D518043EF5DA86A7F /* write_handler_cpptoc.cc in Sources */, + E742EC9EE873872FFA77C191 /* xml_reader_ctocpp.cc in Sources */, + 01A715EF13E6769B868ED73A /* zip_reader_ctocpp.cc in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 52AEDA1BA716D79F5BB98D8F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3604B74425EFEDAA4B436A45 /* cefclient.cpp in Sources */, + 5D0A679939296ED2206D1000 /* binding_test.cpp in Sources */, + F060B40349EDBAF24B4BEB7A /* client_app.cpp in Sources */, + E04C647F65B19A23C4C37EF3 /* client_app_delegates.cpp in Sources */, + 6EDAC1972AE180FDEA8A12BE /* client_handler.cpp in Sources */, + 404A786FD6B149A6F9C13A49 /* client_renderer.cpp in Sources */, + 9868E599B4672A69D34FE61F /* client_switches.cpp in Sources */, + 72A32FA9A4F6BF71E28BF20A /* dom_test.cpp in Sources */, + 0450006D29C60FB869C5B910 /* scheme_test.cpp in Sources */, + A6DFA0C64E7FBE1E1D65021A /* string_util.cpp in Sources */, + 5BD44BCFDCAFDCFB8A50B1ED /* cefclient_mac.mm in Sources */, + 0C36F33E133B708835CB83B2 /* client_handler_mac.mm in Sources */, + 98D4EE6450BCDC119B552CD5 /* resource_util_mac.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 660B06395030BC8F8F5AFAEA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E62A018FDEC970FCB34288E4 /* binding_test.cpp in Sources */, + 94CD3C041C098A345501CA5A /* client_app.cpp in Sources */, + F7AA8E8039D66DB34F2AA890 /* client_app_delegates.cpp in Sources */, + 006E65916B08C7F449363237 /* client_handler.cpp in Sources */, + 8F3AC029913A80FAC90F95F7 /* client_handler_mac.mm in Sources */, + 88EEA859FB35419EA45CF0B3 /* client_renderer.cpp in Sources */, + A6D76814E1CC0E0D6800C874 /* client_switches.cpp in Sources */, + FD040603D16EC8361CD1B030 /* dom_test.cpp in Sources */, + 8E71C99050781F460ECF207B /* process_helper_mac.cpp in Sources */, + 88F43C406D5E20BA7664107B /* resource_util_mac.mm in Sources */, + 020871A068403DB7812EFA74 /* scheme_test.cpp in Sources */, + 7336DC4E3E05319F4FF00F7E /* string_util.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 89C81779558346D9923CB00A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 19E76A5715B39B88B7ED9EBE /* browser_context.cc in Sources */, + 9E8009A9FAA508B3B2C6E328 /* browser_host_impl.cc in Sources */, + 3FC6F188C2F703A55C5D10D3 /* browser_main.cc in Sources */, + 3C6BC32272757221514EAFEF /* browser_message_filter.cc in Sources */, + 610059D31F89C218DAFA689A /* browser_message_loop.cc in Sources */, + D621A87032F8B13339FB314E /* browser_settings.cc in Sources */, + CDD71291E76239C559B79BCA /* browser_urlrequest_impl.cc in Sources */, + 78B2F4527286E3DAF9B5BED6 /* content_browser_client.cc in Sources */, + 445F9E7B5CF914D05E6B5E2B /* context.cc in Sources */, + 531B9C8A520ADF402522B7CD /* context_menu_params_impl.cc in Sources */, + F36608CA4F606BE7C62304F9 /* cookie_manager_impl.cc in Sources */, + 619B8B734E543A365B213AA2 /* devtools_delegate.cc in Sources */, + 989F93D44EF7EC0D5EDBEDB4 /* devtools_scheme_handler.cc in Sources */, + 23811547BF1019B267FDCE78 /* download_item_impl.cc in Sources */, + 24AD16B0FDF55AD6B4D915D8 /* download_manager_delegate.cc in Sources */, + D0D57C0F830E51B7807D0789 /* frame_host_impl.cc in Sources */, + AD9CD615ED0C7F168C9A8E40 /* javascript_dialog_creator.cc in Sources */, + A3D6F1DE13102E9D824B3B91 /* menu_creator.cc in Sources */, + 4F7264FA54B49A1C7D981775 /* menu_model_impl.cc in Sources */, + 08AFD6D684E558FA3BC9CA0A /* navigate_params.cc in Sources */, + 911234D35A105E12ABECEC37 /* origin_whitelist_impl.cc in Sources */, + 25CDCF27F6A416B220C2EF7B /* path_util_impl.cc in Sources */, + 56E2E7200CEFE9A1CFF73D2E /* process_util_impl.cc in Sources */, + BB5606E67B39FF7DA292010F /* resource_context.cc in Sources */, + A3932A294A60AA840EAA602E /* resource_dispatcher_host_delegate.cc in Sources */, + 0B75761D0E732A945F9D7F0B /* resource_request_job.cc in Sources */, + 84F653893F90A1CDA2DC3E16 /* scheme_impl.cc in Sources */, + E735F9A907A45A2DE17F6469 /* sqlite_diagnostics_stub.cc in Sources */, + 6E1B1AD280A0E2C2C1A086DE /* stream_impl.cc in Sources */, + 8F717861DAC8BDE43074C062 /* url_network_delegate.cc in Sources */, + 676D6C5CA5468E88E95A89BB /* url_request_context_getter.cc in Sources */, + D9FFABF1384653843F40504F /* url_request_context_getter_proxy.cc in Sources */, + 5077CD7021B21C62B6BA4343 /* url_request_context_proxy.cc in Sources */, + 0365FFE4742EF2A02B7300C6 /* url_request_interceptor.cc in Sources */, + CB074E06F578E7DB36A1AE89 /* web_plugin_impl.cc in Sources */, + B0B61B07F1C63DBBE29333FD /* xml_reader_impl.cc in Sources */, + D953D582E04957774FED38A3 /* zip_reader_impl.cc in Sources */, + 306316F1661B8B8F92CA4048 /* cef_message_generator.cc in Sources */, + 3FFD06543F0304E5CB52A531 /* cef_switches.cc in Sources */, + AA635725D29F54155E999C16 /* command_line_impl.cc in Sources */, + C3A3B3C0EA89D6691B40AE75 /* content_client.cc in Sources */, + D42D018401CB887935FFC9D7 /* http_header_utils.cc in Sources */, + 7C912FC68FD13C0F0D43FC77 /* main_delegate.cc in Sources */, + 029049A4C35535ED2B538719 /* process_message_impl.cc in Sources */, + 3B81D94848B739CCFFECC51A /* request_impl.cc in Sources */, + AB6389DDF68FB9FE3385EC3F /* response_impl.cc in Sources */, + 93B24D58695EA585A354FBE7 /* response_manager.cc in Sources */, + 5E0D26D735BE80FCBDC089CE /* scheme_registrar_impl.cc in Sources */, + C0C9BF679234E4D882B5A83A /* string_list_impl.cc in Sources */, + 83E0754DC68F65C46E483894 /* string_map_impl.cc in Sources */, + E7481B828F0653AEB3C28264 /* string_multimap_impl.cc in Sources */, + C66B8D854C8406BFFD441085 /* string_types_impl.cc in Sources */, + A907CD0DE7D7D1EEE17DB475 /* task_impl.cc in Sources */, + F7E34BC10BF1A50CCC4FB311 /* time_impl.cc in Sources */, + 4128236018E7ED642C799A36 /* tracker.cc in Sources */, + 156B53590F9D2AD474457EAC /* url_impl.cc in Sources */, + 367922ECFB2C446168020E58 /* urlrequest_impl.cc in Sources */, + C7E5C77093971C7102340F88 /* value_base.cc in Sources */, + CCC4921DF97D3F0AEA1FF732 /* values_impl.cc in Sources */, + 1BC17A3A884CD160A2066B82 /* browser_impl.cc in Sources */, + 6A923D4EB4839F393D362AB7 /* content_renderer_client.cc in Sources */, + 97D4737D13CB2D7199D41F25 /* dom_document_impl.cc in Sources */, + FD5E750D302F4E85CD8DDADD /* dom_event_impl.cc in Sources */, + 0C282998CEEC0AD963C9728A /* dom_node_impl.cc in Sources */, + 64AB39FE02B112C9FEE5A37E /* frame_impl.cc in Sources */, + 786A35F5365C4F05E68608E1 /* render_process_observer.cc in Sources */, + 7DED952A67DFDEB8CAA91571 /* render_urlrequest_impl.cc in Sources */, + 3145E06509B88C2E7F736245 /* v8_impl.cc in Sources */, + 1A2FFCB939E5050B323885BE /* webkit_glue.cc in Sources */, + DFB941F8E4E0B70263EF192A /* clear_on_exit_policy.cc in Sources */, + 64C0C2A4A2A71B8EB429266E /* sqlite_persistent_cookie_store.cc in Sources */, + BC7B8F8CEE92DDC3B67D13EB /* application_mac.mm in Sources */, + 3B973E1E3D2854594F72BC05 /* browser_host_impl_mac.mm in Sources */, + D6B2A9146E154F18F220E3FD /* browser_main_mac.mm in Sources */, + 41ABFEF4EB34BC326BBDE15B /* download_manager_delegate_mac.mm in Sources */, + B467A77B76F9F9A57BB4D3A2 /* javascript_dialog_mac.mm in Sources */, + 69AD60116FE36E2BBBB4481E /* menu_creator_runner_mac.mm in Sources */, + 58146CC2CF2B09A67D445FEC /* NSString+Utils.mm in Sources */, + 4F5063216962E776F23184AE /* NSURL+Utils.m in Sources */, + 6E0BC5A73CD5822277DB4C00 /* disposition_utils.cc in Sources */, + 9B6FF73055B56C315903000B /* event_disposition.cc in Sources */, + 824C3E6380DAA41F1EDD8AAC /* event_utils.mm in Sources */, + 7E39B4B642C071B321D422F2 /* menu_controller.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + CC4ADB3EA7D1A4EAE3B45DDA /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D870C134AA871D60234D6587 /* cefclient.cpp in Sources */, + CD25ADB9FA447A6276C05E01 /* binding_test.cpp in Sources */, + D3B39E945B78041FF50AB4CC /* client_app.cpp in Sources */, + D373A46148051037DAE92F24 /* client_app_delegates.cpp in Sources */, + 1863724EE8E495906CC3A14C /* client_handler.cpp in Sources */, + AA76BC55154522EC7F4A7931 /* client_renderer.cpp in Sources */, + F8F6931DBBFD3C530FF0189A /* client_switches.cpp in Sources */, + 3CCF0ACB0485977587F27A1F /* dom_test.cpp in Sources */, + 8D66B6F816426B55BBB74977 /* scheme_test.cpp in Sources */, + 5A40B9E5D78A23BFE2F311CE /* string_util.cpp in Sources */, + C7567D17D83A15924EB02A37 /* cefclient_mac.mm in Sources */, + B21FE87EAB556B3FF831BBE0 /* client_handler_mac.mm in Sources */, + 8CF21FAFCB47A7512A55D283 /* resource_util_mac.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 0073BA28D4FD916D20F04F74 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_js; + targetProxy = 70CA44C3661F593A1B55B13D /* PBXContainerItemProxy */; + }; + 00CC8BAF0A7A8E509848A36A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_resources; + targetProxy = 5E87DE3ABD3197B20B23472D /* PBXContainerItemProxy */; + }; + 018018695BEDC2B974BDE164 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_system_interface; + targetProxy = 9E2C7A134F08F9ECA0BE3E9A /* PBXContainerItemProxy */; + }; + 018FE750CF501704E7933F75 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = il; + targetProxy = E1E714B11972204A5945DAF2 /* PBXContainerItemProxy */; + }; + 01DDDBD6CC9D07715FF38356 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webcore_bindings_sources; + targetProxy = 4CEFF58CFA2437A202587752 /* PBXContainerItemProxy */; + }; + 028099C6F71DC42913A49104 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_inspector_protocol_version; + targetProxy = F8BE0E94A8294565ACD18D13 /* PBXContainerItemProxy */; + }; + 03924FAB6548882A8FA3FDF9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = base_i18n; + targetProxy = C9A542EA91B07CD164F1556C /* PBXContainerItemProxy */; + }; + 04277D2C7B69F2426AA0B6B4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = video_capture_module; + targetProxy = E16661A8DF9C400CD862ACEA /* PBXContainerItemProxy */; + }; + 0561F12C1B4E226E9EC4580C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = udp_transport; + targetProxy = 0131AD177779A1571540E9ED /* PBXContainerItemProxy */; + }; + 05721E47DFEB78839A219CAC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 667F41D8C9AE14BC19339FE5 /* cef_resources */; + targetProxy = F3756E8A460DD15F7F76E3A0 /* PBXContainerItemProxy */; + }; + 06477D966F181341F4ABDBB3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = EF59E18D1B94CB26A18E3A3E /* cef_unittests_helper_app */; + targetProxy = 01DFC3F2945C7C73757C5277 /* PBXContainerItemProxy */; + }; + 0723211F3CD6BED158C58898 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources; + targetProxy = 62C1010FEC5DBDC7D1CD9084 /* PBXContainerItemProxy */; + }; + 077955227EBB7E8C64D6F56A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources; + targetProxy = F4B0C08972C7CEB3C4523526 /* PBXContainerItemProxy */; + }; + 078CA1911D3E9BBDACA768C7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_css; + targetProxy = CB326E84B415CAFA51ED4C43 /* PBXContainerItemProxy */; + }; + 078F3BFD741FC0181D2C5BFB /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = EF59E18D1B94CB26A18E3A3E /* cef_unittests_helper_app */; + targetProxy = F24BBD71B97600D2DE0AD749 /* PBXContainerItemProxy */; + }; + 07D1D14CEBA3794874E91835 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_html; + targetProxy = 793895900A6C3DFF21EE7259 /* PBXContainerItemProxy */; + }; + 0817E1BB3B61065DBC1A264D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_resources; + targetProxy = 868698C4C7A8E90CBB948CE2 /* PBXContainerItemProxy */; + }; + 083D93B1EA1202E1D5BEEDEE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libyuv; + targetProxy = 30CA77901761BD1D20421BD1 /* PBXContainerItemProxy */; + }; + 08F034B898C717EC093423AA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libjingle; + targetProxy = 90268E94A026EFC6DD0F5821 /* PBXContainerItemProxy */; + }; + 08F502C3BD79E57B00A009D4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webcore_prerequisites; + targetProxy = 8641D287B68F4B346755E2A6 /* PBXContainerItemProxy */; + }; + 09015733EC03E44F76E49F8B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = G711; + targetProxy = 82E2F27BE864A0755132A9D7 /* PBXContainerItemProxy */; + }; + 0B2DA38336A0CD7301071411 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_devtools_grd; + targetProxy = 347CE66DC69478D3DC2296BF /* PBXContainerItemProxy */; + }; + 0BA49104A34A8D7896E9882E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = inspector_protocol_sources; + targetProxy = 4666626482E977D8E163D075 /* PBXContainerItemProxy */; + }; + 0BAC8CD9FDD4640303922A85 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_inspector_protocol_version; + targetProxy = B2B25EC2A2F5809D9AD62CC7 /* PBXContainerItemProxy */; + }; + 0C9993BD290C3BC779AA5C05 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libwebp_utils; + targetProxy = 250D20888669966C57046D6A /* PBXContainerItemProxy */; + }; + 0CDB92373DDC2A1C014AE337 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_strings; + targetProxy = 7D325943553F39C02A948114 /* PBXContainerItemProxy */; + }; + 0D6A729B06C9C99F67688304 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libsrtp; + targetProxy = 0850D19ACA9EADCFD7885F4B /* PBXContainerItemProxy */; + }; + 0E48D108765D5175A14C18C8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ppapi_proxy; + targetProxy = 9756BB8AB72D7988E7F7C1CA /* PBXContainerItemProxy */; + }; + 0E5AD89016FFF8CEF869D1C3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webcore_remaining; + targetProxy = ED6941F40666BFD5821C77F4 /* PBXContainerItemProxy */; + }; + 0EC294FA5E7846C044B3D311 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = printing; + targetProxy = 9F9811C05E26CBD781CFE0F8 /* PBXContainerItemProxy */; + }; + 0EEFA96B104BF2376354DA78 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_resources; + targetProxy = C9EB15E0EDE5DF4391D613C7 /* PBXContainerItemProxy */; + }; + 0FF7D98572DAD9E964B21030 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "harfbuzz-ng"; + targetProxy = EDE694752B137453C2095FF8 /* PBXContainerItemProxy */; + }; + 1066787E3F98599D487F6AD9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_content_resources; + targetProxy = 32B9BED28A80B4EFBD3A743C /* PBXContainerItemProxy */; + }; + 11763C99A26EC98C83F45C00 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = resampler; + targetProxy = 35E1250A6F2A323CA4479139 /* PBXContainerItemProxy */; + }; + 126B209540241A45504C408E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources; + targetProxy = 77482531875F3529A418B6D3 /* PBXContainerItemProxy */; + }; + 1336D33832312F64220373F9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webcore; + targetProxy = CE98D7338C0B527E5C2B1B8D /* PBXContainerItemProxy */; + }; + 1539050364269C63EB69EB20 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources; + targetProxy = 878A8D01FF6209863DC919D4 /* PBXContainerItemProxy */; + }; + 165E18E56A410771B0140D0B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2E847C594D99442F54D6FA7B /* cef_strings */; + targetProxy = 2AE3C3FB402561F10E47D418 /* PBXContainerItemProxy */; + }; + 17024752957D72AC3993E625 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = video_processing; + targetProxy = 63C45A99E66D75C2D5203B3E /* PBXContainerItemProxy */; + }; + 178013DF56ED7719DAD441AF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = inspector_protocol_sources; + targetProxy = B8FB3BF0CC8061089F58BE0D /* PBXContainerItemProxy */; + }; + 17CE9CB2BD146E5D3C69E0F8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_inspector_protocol_version; + targetProxy = 581271CDF0A3651285B49D34 /* PBXContainerItemProxy */; + }; + 188EA8ED60991519923E9381 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webcore_dom; + targetProxy = 232BE3401335226D02083902 /* PBXContainerItemProxy */; + }; + 1A11351E16DCE360168336ED /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webcore_platform; + targetProxy = 9CDE43F98609E44B216CC396 /* PBXContainerItemProxy */; + }; + 1BDDEB568DB5442E20CAE6DF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = glue; + targetProxy = 5EB7E27D27B3CE79047539E4 /* PBXContainerItemProxy */; + }; + 1C5C1B9FA301D7CB56AE9719 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = allocator_extension_thunks; + targetProxy = 8D32025AE7D59C6894E152E5 /* PBXContainerItemProxy */; + }; + 1CDC06A90ADFB3628D4737E4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = http_server; + targetProxy = 499F6A6D9A203524476699AC /* PBXContainerItemProxy */; + }; + 1DAAEBBDC21120A2BA5554CD /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_devtools_grd; + targetProxy = 90A1153AC0D930081BEB828D /* PBXContainerItemProxy */; + }; + 1DB8A60BF127EBE36599760F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = audio_device; + targetProxy = FBE805126B7D924523E3FA60 /* PBXContainerItemProxy */; + }; + 209C1916E50D686D8974ACE0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libvpx; + targetProxy = 8EF263D39A1061DCA142F9E0 /* PBXContainerItemProxy */; + }; + 20EB5AB3F0C0920F58F61675 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_supplemental_dependency; + targetProxy = 0997EC282CF85D5700F24A71 /* PBXContainerItemProxy */; + }; + 2259BFCC7F2B441712F43DAD /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libflac; + targetProxy = 870D19EB0B6F1B5C2D72CCDF /* PBXContainerItemProxy */; + }; + 227432A6F74AFF42EFBFEF87 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = crypto; + targetProxy = EB4D64DE3615DD415BC5FC25 /* PBXContainerItemProxy */; + }; + 228E575EBCFD2F5AF4642E1B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 667F41D8C9AE14BC19339FE5 /* cef_resources */; + targetProxy = FC639473943A95D7F1B23AA7 /* PBXContainerItemProxy */; + }; + 23DC6924F1BFDA9085F1F23A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 34C94585C2266BDAEE3DB526 /* cef_pak */; + targetProxy = 59C60760D609EC5D56FA4A72 /* PBXContainerItemProxy */; + }; + 23E4C15A4B2CDA370FE05EBA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = audio_conference_mixer; + targetProxy = CC2DA5B8F3E3ACD05C8E7816 /* PBXContainerItemProxy */; + }; + 246B87C2FE1BA5EC2FA1754D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libxslt; + targetProxy = B5147C3DFCFF529D4B398923 /* PBXContainerItemProxy */; + }; + 278B38B322EEE5AF0A1E5673 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = mach_override; + targetProxy = 7854E572B56DE546980F0A7A /* PBXContainerItemProxy */; + }; + 27D3B3479115A3226A63E602 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webrtc_vp8; + targetProxy = A93025B55689B363F617483D /* PBXContainerItemProxy */; + }; + 2848E0BD5FE75507C5044611 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = iLBC; + targetProxy = 7675786C7BAF7B812CD92107 /* PBXContainerItemProxy */; + }; + 28A055A00F3B727579EB90E8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_browser; + targetProxy = D9764C030A91F23EBBFA6768 /* PBXContainerItemProxy */; + }; + 28B0906BC92410A1E8A22A04 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = NetEq; + targetProxy = 9B7809DE83D308F9C3EC286F /* PBXContainerItemProxy */; + }; + 296095DCF49A827D4A9CD0DD /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = skia; + targetProxy = 93C770F7723E817A30B3D834 /* PBXContainerItemProxy */; + }; + 2A2FCF7E43A072536BC50158 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_resources; + targetProxy = BE049CD1F7A5797AE232CC30 /* PBXContainerItemProxy */; + }; + 2ADCFE2607C12E72B11E5956 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 667F41D8C9AE14BC19339FE5 /* cef_resources */; + targetProxy = A776DC942AD5CD7DED7A8075 /* PBXContainerItemProxy */; + }; + 2B45735D2499E8BFF256574E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources_standard; + targetProxy = 10E4A7EE418CB56308487C8C /* PBXContainerItemProxy */; + }; + 2C8D5E18F97214B83BEEF6C8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 34C94585C2266BDAEE3DB526 /* cef_pak */; + targetProxy = 5756A429B2D7B2789404ED4E /* PBXContainerItemProxy */; + }; + 2CA9E7BBCC486304F39922B0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources; + targetProxy = 81D2D3BFAC65E90EB6B40B30 /* PBXContainerItemProxy */; + }; + 2D13543C7300F6E4DA78AAE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libjpeg; + targetProxy = 93A842EA0C626FFC94A752CE /* PBXContainerItemProxy */; + }; + 2F3968F8C0C33E3AFD617925 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_strings; + targetProxy = 20B0876196FE76A080760479 /* PBXContainerItemProxy */; + }; + 2FC3271BF0ACE651BC4DB637 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 667F41D8C9AE14BC19339FE5 /* cef_resources */; + targetProxy = C9CC9191138A0E39C9AB7F7C /* PBXContainerItemProxy */; + }; + 30541C58BCABF7CA64100986 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = gles2_utils; + targetProxy = E8915EB362636A94285910D5 /* PBXContainerItemProxy */; + }; + 30949FF2FD6FE023AAD0C599 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = net_resources; + targetProxy = DF87F6A75429590502DB940A /* PBXContainerItemProxy */; + }; + 30C396F70D462E8540382230 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libevent; + targetProxy = 8122F20DC38AC6B19F566BA5 /* PBXContainerItemProxy */; + }; + 30F2FE0EF3498498F5EF043D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = dynamic_annotations; + targetProxy = 51F38FA02F9B93F052D610CB /* PBXContainerItemProxy */; + }; + 32541601F69C527499C9016D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ots; + targetProxy = FC2B090B0C77642FDAF3398E /* PBXContainerItemProxy */; + }; + 33FA3CE13523A005F6637542 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 26DD2CB0340D816F3DF64EC9 /* libcef */; + targetProxy = 9A932EA117A6AE5B669AA90A /* PBXContainerItemProxy */; + }; + 3483302F5089952C0B1A341B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = command_buffer_service; + targetProxy = DA4F311CBF8FF58C554EBAAE /* PBXContainerItemProxy */; + }; + 34874AC4FDC6FB72CF5ED754 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = test_support_base; + targetProxy = 80F82FCC22188DA5332987B3 /* PBXContainerItemProxy */; + }; + 34CC444EF3CAADBEF921E3E1 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ffmpeg; + targetProxy = F1022A3EF4B1554F2677D37E /* PBXContainerItemProxy */; + }; + 34E5A9255A3CA3C752E30B29 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = agc; + targetProxy = 27BB6DC92EC680E7DDE2548F /* PBXContainerItemProxy */; + }; + 358CC58FB67EB73F37C2B942 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = aec_sse2; + targetProxy = A3BCDEC178B1226DCCB49CDF /* PBXContainerItemProxy */; + }; + 35C900F57711847D325F6627 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_heap_snapshot_worker_js; + targetProxy = 7F0C09637010CBDD5993AED1 /* PBXContainerItemProxy */; + }; + 3632689D80672EE57D218C9C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources; + targetProxy = A47103C7D2103982D560EACB /* PBXContainerItemProxy */; + }; + 36DDF6E7056E8715A37E34EB /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_resources; + targetProxy = 0EA3B588070DCDDCDE5698C2 /* PBXContainerItemProxy */; + }; + 37577390E57F4FBF244B1678 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = icui18n; + targetProxy = CEBA1433614E1CF02DFF355D /* PBXContainerItemProxy */; + }; + 3766D1A3950B959D5CE56D1A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = gles2_implementation; + targetProxy = CA2EBC9B9FAE848C2142B879 /* PBXContainerItemProxy */; + }; + 37AEFBDF1CC93EBF210DBE84 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 667F41D8C9AE14BC19339FE5 /* cef_resources */; + targetProxy = BFADB861EF79BAB1A544AE45 /* PBXContainerItemProxy */; + }; + 38F06282E6CF6FC3E204D074 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = media_file; + targetProxy = CBB3385195E047F29D63346C /* PBXContainerItemProxy */; + }; + 39EBC6589AAC582B3EC95EA2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_strings; + targetProxy = D4F63752E9256230F8DEB664 /* PBXContainerItemProxy */; + }; + 3A45BD1F2320206C7BBC081B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = iSAC; + targetProxy = B156B18D95A97609E8C366D4 /* PBXContainerItemProxy */; + }; + 3ACD8CCE9DE5AC89B1617302 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = expat; + targetProxy = 8500F1E1E1C263D012EB365C /* PBXContainerItemProxy */; + }; + 3B680DD8EBAA46AFDBC353B0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_strings; + targetProxy = 850FBEEBB238C3112659933F /* PBXContainerItemProxy */; + }; + 3C5BF9FDE0FA061D4E213715 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = quota; + targetProxy = 7EFD29793352F7615F0C7C16 /* PBXContainerItemProxy */; + }; + 3C80EE74550ECE50F416926A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_plugin; + targetProxy = 4E9E42CB5ACA30C9D979A576 /* PBXContainerItemProxy */; + }; + 3E9D7987872A083EC773AFEC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = v8_snapshot; + targetProxy = 315845640964437BDECE4F42 /* PBXContainerItemProxy */; + }; + 3ECFFA6BB917CB66E5928EAF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libxml; + targetProxy = E4F8098F20269AD328A9B45B /* PBXContainerItemProxy */; + }; + 401B9B206A61F21C85E51C75 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = nss_static; + targetProxy = 4E6F82B86A43245A806A226E /* PBXContainerItemProxy */; + }; + 4143A681BF1DAF2414D46C6E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_js; + targetProxy = 2EBDD1F322E29A8D73C80C0E /* PBXContainerItemProxy */; + }; + 42B0C642B26E234B18115A7B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_strings; + targetProxy = FF92C0DD679B95C444244753 /* PBXContainerItemProxy */; + }; + 43379012EACDB04007B211F0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 94BAF60C7C90712E7F239E35 /* libcef_dll_wrapper */; + targetProxy = D7787FD6BD5166801358A758 /* PBXContainerItemProxy */; + }; + 44BE494DF00E33217EADB95F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libwebp_dec; + targetProxy = 286BB97AA6EA16648FBFD8F5 /* PBXContainerItemProxy */; + }; + 4511C4D866B66A8B4AB452E2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = net_resources; + targetProxy = 205E91EB70EE5B1DB67C4B92 /* PBXContainerItemProxy */; + }; + 470884EB5CF60CE0EE9DB6EE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 94BAF60C7C90712E7F239E35 /* libcef_dll_wrapper */; + targetProxy = 982B7F97A2EA445ECB33068E /* PBXContainerItemProxy */; + }; + 4781DDA43F8F114DA7235E0A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = gmock; + targetProxy = 160460BB3DBAEB5099A73A3E /* PBXContainerItemProxy */; + }; + 484AFC5054BDB319C75B4EAD /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_gpu; + targetProxy = 116448F45BC09EB876D19B86 /* PBXContainerItemProxy */; + }; + 4A07CB85D4649A637B0A72BD /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 34C94585C2266BDAEE3DB526 /* cef_pak */; + targetProxy = 74EE791FC2A3E8D9E504BACC /* PBXContainerItemProxy */; + }; + 4B25B32F1D89C5E158C8331A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_extension_api; + targetProxy = BF4199C7BBD0B31CCBDD1D7C /* PBXContainerItemProxy */; + }; + 4B44D3877B1417EE50334F8C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = modp_b64; + targetProxy = 8A2B2B6D5A5AC2DC006DAF97 /* PBXContainerItemProxy */; + }; + 4B50B513F5D397E7DB633513 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = injected_webgl_script_source; + targetProxy = 556E76992B0DA14EFF7D2C81 /* PBXContainerItemProxy */; + }; + 4B72BEDE7217B509D2600B9F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = fileapi; + targetProxy = AFF2CBDA3F6702439D9DA377 /* PBXContainerItemProxy */; + }; + 4C3A829E468665D42ED57F38 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DA259FAFFD7136C8A5C881A8 /* cef_unittests */; + targetProxy = BCC32A3C690D16E6FD0811DD /* PBXContainerItemProxy */; + }; + 4C3F317B91120655483110A3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F506A5805463407F45E5D21B /* cef_locales */; + targetProxy = FC74D9BCE3D5D54765211770 /* PBXContainerItemProxy */; + }; + 4C8387146A53FC00CEF17B71 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = gtest_prod; + targetProxy = 806F62420602C02CA83D2800 /* PBXContainerItemProxy */; + }; + 4CE444759CF7FAA751622943 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DA98FB3E241B73BA47200DFF /* AtomHelperApp */; + targetProxy = FEFA3F00FF883AAAF6DA9B7E /* PBXContainerItemProxy */; + }; + 4CE756CB03A45F41A46F30E6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_script_formatter_worker_js; + targetProxy = 975B70A33F5E360D2BED96CD /* PBXContainerItemProxy */; + }; + 4EA8325CB5958DA70F4EA0F6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2E847C594D99442F54D6FA7B /* cef_strings */; + targetProxy = F1E269327CFD78F842649629 /* PBXContainerItemProxy */; + }; + 4FA57FD67641983A172A7AEA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = gpu_ipc; + targetProxy = BD783731A8CBC56975596CAA /* PBXContainerItemProxy */; + }; + 50C55A37345BF5C79B0B724F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_content_resources; + targetProxy = AAE269B31BAB75B0FCE28194 /* PBXContainerItemProxy */; + }; + 510B2B2D9E49DB29CC008B1F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 667F41D8C9AE14BC19339FE5 /* cef_resources */; + targetProxy = D956A982CD92E015E150CF32 /* PBXContainerItemProxy */; + }; + 52274D1E656EA0F4A7052558 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = net; + targetProxy = 222785D26B7704FF0DC3FA06 /* PBXContainerItemProxy */; + }; + 526DB93E57BF32C87DE2100E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libspeex; + targetProxy = CE7C33B42B0B9E23C2C0481C /* PBXContainerItemProxy */; + }; + 532D9A1513C8583C40E0A2A3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = audio_coding_module; + targetProxy = 76C8BFC198F4F3DDA9254BEF /* PBXContainerItemProxy */; + }; + 535B42FD5E84DB25FD9B6F6C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = audio_processing; + targetProxy = 1B4F6ED71397C1C467E438A6 /* PBXContainerItemProxy */; + }; + 54066FF3F964DB2600B6C979 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F506A5805463407F45E5D21B /* cef_locales */; + targetProxy = 551361E64910BB400355E513 /* PBXContainerItemProxy */; + }; + 540798F295EEAC241257CEB8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_heap_snapshot_worker_js; + targetProxy = EB8D2BEF321A2B94F5DB654A /* PBXContainerItemProxy */; + }; + 54B1DFD416D553261C4028D5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = net_resources; + targetProxy = 71DEE2B3D3390D0E13DC6779 /* PBXContainerItemProxy */; + }; + 56118112E14FFBF55D8084EA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 26DD2CB0340D816F3DF64EC9 /* libcef */; + targetProxy = 7DA6A87AF75200F6D180A14E /* PBXContainerItemProxy */; + }; + 56F918F1487EA8627F78BECF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F506A5805463407F45E5D21B /* cef_locales */; + targetProxy = BD3D0849C42BE09BB19D34D9 /* PBXContainerItemProxy */; + }; + 58224BA2958F00F0EB905913 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_resources; + targetProxy = B23B19A4A4CFF1204A21802A /* PBXContainerItemProxy */; + }; + 585AA89D4631F08224C9D00B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = wtf; + targetProxy = 36C6A83897360E2CC84F6DB0 /* PBXContainerItemProxy */; + }; + 590BE005DE4FAC19AAA1F968 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = translator_glsl; + targetProxy = 33A283C4F4D26C9C6F3E5C72 /* PBXContainerItemProxy */; + }; + 597AC5141DD941EF7CDACCC5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_devtools_grd; + targetProxy = F44A6644478536BE1B90AAA4 /* PBXContainerItemProxy */; + }; + 5984773E310FA1F734FDE1C8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libtess; + targetProxy = 29AAE5AC262F81FE94D5C3F3 /* PBXContainerItemProxy */; + }; + 59A5F740F59619269EF30942 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_resources; + targetProxy = 4C50EC19ED1C24C144F13396 /* PBXContainerItemProxy */; + }; + 59B6C06E60371905C023EF88 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_js; + targetProxy = 0A4F48B5EA9876E9390530D6 /* PBXContainerItemProxy */; + }; + 5A33A3E27755B7349EAE1EA7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = rtp_rtcp; + targetProxy = 24C35FC4350EB61C46CBE251 /* PBXContainerItemProxy */; + }; + 5A401A0910F4D1AEE02FEAF6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_strings; + targetProxy = 47333AFBD547636B87F4402D /* PBXContainerItemProxy */; + }; + 5A958BB0525526F334EFCF04 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = cups; + targetProxy = 5B33CDB8F99DDD9EDDDBF480 /* PBXContainerItemProxy */; + }; + 5AA84938089115DBA6AF746D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F506A5805463407F45E5D21B /* cef_locales */; + targetProxy = 6C1F455EB4FFD955509E0C16 /* PBXContainerItemProxy */; + }; + 5BBB719F52008A86D3804FAB /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_script_formatter_worker_js; + targetProxy = 4321E6E80EE7E13C0F864091 /* PBXContainerItemProxy */; + }; + 5BE983F56DDC3082D443A607 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 26DD2CB0340D816F3DF64EC9 /* libcef */; + targetProxy = 93509B8EFA31E020341F2765 /* PBXContainerItemProxy */; + }; + 5CCB13FAA4B13E6EA39F80B0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_inspector_protocol_version; + targetProxy = A07906403E762623A22FD6E7 /* PBXContainerItemProxy */; + }; + 5E55C9D8BB6BEAC15B22C477 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F506A5805463407F45E5D21B /* cef_locales */; + targetProxy = 4E1337F318F5EA9769F5EDAA /* PBXContainerItemProxy */; + }; + 5EEC34626F2BEE1D822A64F3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2E847C594D99442F54D6FA7B /* cef_strings */; + targetProxy = 7A88AC2FFE4E8163E299C359 /* PBXContainerItemProxy */; + }; + 6155A0EC77BD3E6FD922A778 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_resources; + targetProxy = 3A17DAD3484A71C6DD31E5A0 /* PBXContainerItemProxy */; + }; + 61A456F2E4CE1E590E747210 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = icui18n; + targetProxy = D31460C9F3368F2B476CB211 /* PBXContainerItemProxy */; + }; + 61BE2B6370F8609262DC4E31 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_extension_api; + targetProxy = FF1D53AB98649AA5EC35BA5A /* PBXContainerItemProxy */; + }; + 6214A01CB11669182FA76449 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = injected_script_source; + targetProxy = F88792EAEA2FE1B73ACD6AA1 /* PBXContainerItemProxy */; + }; + 6342CE64CFD5181540EAB3F8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 26DD2CB0340D816F3DF64EC9 /* libcef */; + targetProxy = 9E9E97874BFC02B7C5C43839 /* PBXContainerItemProxy */; + }; + 63539F42A4F447AAADF3C4FD /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_resources; + targetProxy = 6CB81999D1F58888B1F50BDD /* PBXContainerItemProxy */; + }; + 637AC7E3926DC4FDD3069D0F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A9EF68F8BF3234583509BD43 /* Atom */; + targetProxy = B48EA3338975B64FBD3C193B /* PBXContainerItemProxy */; + }; + 64644ABAC504E64F7A9CDB36 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = nss; + targetProxy = 63C6235F6B6A7E87B214072D /* PBXContainerItemProxy */; + }; + 652D7D5F084AE948D073F4B6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webcore_html; + targetProxy = BA27E924EF02BB5CFF26A8E8 /* PBXContainerItemProxy */; + }; + 65DB4F9FB555B097100DAF88 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_resources; + targetProxy = D200A4AB4EC59F29F815BB34 /* PBXContainerItemProxy */; + }; + 65E8BAA34C272E4797C6C8B4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_content_resources; + targetProxy = AD82220DA434D786C66D51C5 /* PBXContainerItemProxy */; + }; + 665F71C74381066EF3169B9C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2E847C594D99442F54D6FA7B /* cef_strings */; + targetProxy = C98E6E01D8E2B2F525CA86FF /* PBXContainerItemProxy */; + }; + 66C1553721A4251B5FF2BE19 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_renderer; + targetProxy = 15E9DB028CE049530F8556AA /* PBXContainerItemProxy */; + }; + 67A1D1E1FED91745EDA96C3E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_html; + targetProxy = 665AC9618E4AA362B439E8EE /* PBXContainerItemProxy */; + }; + 68C922E53442F67D9724E7B6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = bitrate_controller; + targetProxy = F09D7F755879C674E55563C3 /* PBXContainerItemProxy */; + }; + 68D746A8CD1006F0100D1ED9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_strings; + targetProxy = EB87AB2FE7BEBDE2554FDDDE /* PBXContainerItemProxy */; + }; + 68FDF28FDCEE90BB367CB7AB /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = jsoncpp; + targetProxy = 2C97A7E18D57EB1E925DB46E /* PBXContainerItemProxy */; + }; + 69735C3504CA6548644E20D5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ppapi_c; + targetProxy = 97C287244D5E413929DD12AA /* PBXContainerItemProxy */; + }; + 69B969CA397627FE3ACE965E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_resources; + targetProxy = F171A4C18195A5F660E230D5 /* PBXContainerItemProxy */; + }; + 69D9011739B5C00D91962EE4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ipc; + targetProxy = 16DCD631089F1D80A29C727A /* PBXContainerItemProxy */; + }; + 6A02A30D7D8D7C69FAE0475D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_strings; + targetProxy = 6BB7AB3D7B38610E83FE6513 /* PBXContainerItemProxy */; + }; + 6B09209542CB7F47787DFF80 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_user_agent; + targetProxy = E73F4A1FB7F6452C72FDDF13 /* PBXContainerItemProxy */; + }; + 6B1D91115389C6B23FF2CAC1 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = aecm; + targetProxy = 2A9AB8B7CE0879DB86873200 /* PBXContainerItemProxy */; + }; + 6D296BB1F607881183C98EEA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_media; + targetProxy = 3A5277166C3DA41B8C472A73 /* PBXContainerItemProxy */; + }; + 6DACA229296F828AF8BE82B1 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = inspector_protocol_sources; + targetProxy = 74212138F4F43AA79781F474 /* PBXContainerItemProxy */; + }; + 6E07A063DBC6CCB26CA157E7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = net_resources; + targetProxy = 1D17D43D8E5BA36AB421DC5B /* PBXContainerItemProxy */; + }; + 6E14ACED0E6E4B5CFC38B4A0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources_standard; + targetProxy = 82CA8A3E71D0C7AEDE5060F2 /* PBXContainerItemProxy */; + }; + 6E9F702DBF56871D8784C659 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = inspector_protocol_sources; + targetProxy = D40C73EEDE5552463DB0D5D9 /* PBXContainerItemProxy */; + }; + 6EBD39DE2A1C669C32FBE0EA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui; + targetProxy = DA5FA23991EBED0BD30EB8BA /* PBXContainerItemProxy */; + }; + 6ECA079A6DC4163BA797402E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = v8; + targetProxy = B1664C5F325D5E9EFC11B4AE /* PBXContainerItemProxy */; + }; + 6EE720636749E5E8D20D3C24 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = icuuc; + targetProxy = 610A7FF45A1157BC848FA8DA /* PBXContainerItemProxy */; + }; + 6FF9442036876548B657834F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = leveldatabase; + targetProxy = 18925A0BABBD13C7D3209D27 /* PBXContainerItemProxy */; + }; + 70E8027D63C1504658A02E3A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_html; + targetProxy = 7E885176B4EA50E8A9BC004A /* PBXContainerItemProxy */; + }; + 7293347A701F2FF9EFA903DD /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = net_resources; + targetProxy = AF682F4FBE565B8C95EC28B2 /* PBXContainerItemProxy */; + }; + 72BB74C982A49A0091FE7005 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = video_processing_sse2; + targetProxy = C104F1A276FE768DC62F4A1C /* PBXContainerItemProxy */; + }; + 738A5BE7BA4CD9DAEBBBDF83 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_devtools_grd; + targetProxy = C78C84AC10D7984AF2F09515 /* PBXContainerItemProxy */; + }; + 758D8664DBCA67282B14DC0F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit; + targetProxy = 850F5B643D19957779EF13E8 /* PBXContainerItemProxy */; + }; + 75EC6347006D1C82D1B06767 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = dynamic_annotations; + targetProxy = FF00C24F90AFEEBACA26CE2B /* PBXContainerItemProxy */; + }; + 773248346B27F6A58720474E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webrtc_utility; + targetProxy = A5BA0B56E6DE410306B6F5ED /* PBXContainerItemProxy */; + }; + 7739908E957DA2487EBDB6C6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 34C94585C2266BDAEE3DB526 /* cef_pak */; + targetProxy = 56093D32DACADE455E793B49 /* PBXContainerItemProxy */; + }; + 7778D2B4810EEB8B13596EFC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_resources; + targetProxy = AFB338C0C1383908F13C8B57 /* PBXContainerItemProxy */; + }; + 7B01A2656BB896DD657E03F2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_strings; + targetProxy = 92843F77610B9A55B098CD78 /* PBXContainerItemProxy */; + }; + 7B0D02ED61E3BACDBE6F8E0E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_css; + targetProxy = A6FAF928162F4114867DC38B /* PBXContainerItemProxy */; + }; + 7B345739958F21CEF1622363 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = closure_blocks_leopard_compat; + targetProxy = B695CECBA75EB95B68EB7983 /* PBXContainerItemProxy */; + }; + 7C1A473A79B462ADBABDF0BE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = glue; + targetProxy = 2CFB8FAE1C0B51AB1BFCCCEC /* PBXContainerItemProxy */; + }; + 7CF98C7700E3B8EA4CE8E593 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = gles2_cmd_helper; + targetProxy = C8672478AB82979FAF0348D0 /* PBXContainerItemProxy */; + }; + 7D15E4AD75676E3C2481F28A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_content_resources; + targetProxy = C174B6FE519FC7C04820298B /* PBXContainerItemProxy */; + }; + 7F224C17F06B6D071BFCB52D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_strings; + targetProxy = EDA161EA150C7C7D4E28559E /* PBXContainerItemProxy */; + }; + 7F6CA27CDFC510F192395E0A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_script_formatter_worker_js; + targetProxy = 47208991CBBA523344D7986D /* PBXContainerItemProxy */; + }; + 7F6FD1F99EE06A9DD7E96CF4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = voice_engine_core; + targetProxy = 7EDC898352EA24F68355C388 /* PBXContainerItemProxy */; + }; + 7F7A47B4E066C7FBB4D5D6B6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_strings; + targetProxy = B7B29E96820A563EF5C2C638 /* PBXContainerItemProxy */; + }; + 8086F1C2F886BB0FA6C3808C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_resources; + targetProxy = 97BFC437801F0F3C9B997420 /* PBXContainerItemProxy */; + }; + 820BF79B902B5306B8BBFDB2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 34C94585C2266BDAEE3DB526 /* cef_pak */; + targetProxy = F0932594B4A1426CC022037D /* PBXContainerItemProxy */; + }; + 82853600193836A7ABE4CB69 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = base; + targetProxy = F803F370D34715CF1580316E /* PBXContainerItemProxy */; + }; + 83709877BB29B37B1C92BD69 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 34C94585C2266BDAEE3DB526 /* cef_pak */; + targetProxy = FDB3C35EFDAFEB8E7925DF71 /* PBXContainerItemProxy */; + }; + 83A968FEC9B77B6C1760E272 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = jingle_glue; + targetProxy = E778490142BBC7C88B4639D8 /* PBXContainerItemProxy */; + }; + 8401EAD11384253DFEBD95AC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = protobuf_lite; + targetProxy = 96CBE7C36A361E1DD342C312 /* PBXContainerItemProxy */; + }; + 8427FB00951CA3A5F7D993B7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_resources; + targetProxy = 41BB4B293ADF16538C4402A7 /* PBXContainerItemProxy */; + }; + 84796E5A790BD8AE52D809D9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = v8; + targetProxy = CDFE1AE2795C755E232CA11F /* PBXContainerItemProxy */; + }; + 8480066A6E189D3624BDD3A8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = base_static; + targetProxy = 0A2A211EC6A23660E51E4F27 /* PBXContainerItemProxy */; + }; + 84B18BC5C21E915281D4A860 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 94BAF60C7C90712E7F239E35 /* libcef_dll_wrapper */; + targetProxy = 4A2AC443C3A71132E1C7452D /* PBXContainerItemProxy */; + }; + 8567BB2B3AFE7442A6E3F7F7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "v8-i18n"; + targetProxy = 8ED0E34A23E2F7C08FF3B78D /* PBXContainerItemProxy */; + }; + 85B644EEBF2C8180377F5192 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_inspector_protocol_version; + targetProxy = C80AF166862F22CFF9E9302E /* PBXContainerItemProxy */; + }; + 86C35E93660FB4836609A431 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = base_i18n; + targetProxy = 157FC71CB477E0AA192CC406 /* PBXContainerItemProxy */; + }; + 8718C8550C80AE7CE8AF0A35 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_css; + targetProxy = 635388D11A9A1BC7B2B46E11 /* PBXContainerItemProxy */; + }; + 878CE2270DE477FFA158E094 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_html; + targetProxy = F1C7E057C8BB1F3C1DA220F0 /* PBXContainerItemProxy */; + }; + 87DEEE47CF06B777B5004DC4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libevent; + targetProxy = 991817F4BB01EE75D8D2E960 /* PBXContainerItemProxy */; + }; + 891C540F1779E4D880D78A77 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = yarr; + targetProxy = D44E63958214800693D932B1 /* PBXContainerItemProxy */; + }; + 897B18EA020CD10C5C92630A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = icudata; + targetProxy = 1B58FFB5CAFB2B8A01BBCC00 /* PBXContainerItemProxy */; + }; + 8995348A687F6B6AB45530A8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = EEA6DA7521B65D3FCF65806C /* Run cef_unittests_helper_app */; + targetProxy = 9AA1433222F4564559BD29C7 /* PBXContainerItemProxy */; + }; + 8A1A94222C247E6B927783B4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = base_static; + targetProxy = 63874C612992BA4DB532EACC /* PBXContainerItemProxy */; + }; + 8A31E76F00A065F4571D0CCD /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_resources; + targetProxy = 4EDB06CE361B26797A1C8BFC /* PBXContainerItemProxy */; + }; + 8AAE5E642A5FDB842D43081A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 34C94585C2266BDAEE3DB526 /* cef_pak */; + targetProxy = D03CA9B0F2DC92AA587ED1A4 /* PBXContainerItemProxy */; + }; + 8AEBB66F831D51043D88869F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources_standard; + targetProxy = 0B717DD3C029497025266874 /* PBXContainerItemProxy */; + }; + 8BEC2A9DA21546398AE15AB4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = base; + targetProxy = C64B63A13E26118817343198 /* PBXContainerItemProxy */; + }; + 8C7AA0A739649197931E39F8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libjingle_peerconnection; + targetProxy = 63AC4A0AA9DCE3CD17044C28 /* PBXContainerItemProxy */; + }; + 8C8142F6763B303179E6C0DF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_inspector_protocol_version; + targetProxy = E7675204412FB9278062DF1F /* PBXContainerItemProxy */; + }; + 8CC7119C59AED674DDEC33A9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_ppapi_plugin; + targetProxy = BDD951D987CC3BF6174ECB1B /* PBXContainerItemProxy */; + }; + 8DBD55E95FAF06BFAB060981 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = v8_base; + targetProxy = A57249D5CBA4C7370E2C4471 /* PBXContainerItemProxy */; + }; + 8E2FD9149B8727F536867E00 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_resources; + targetProxy = 5586463279AF2979E762A2E9 /* PBXContainerItemProxy */; + }; + 8EBF9843D6C38CD7C4AC69F1 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = icudata; + targetProxy = 70697DFB7BC45A01E366F6D1 /* PBXContainerItemProxy */; + }; + 8EC605E0120603FBAC00E26F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = skia_opts_ssse3; + targetProxy = 8DB16A7046A42C151801ABBC /* PBXContainerItemProxy */; + }; + 8EFB690D89687BDE3CDA4DA8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = wtf_config; + targetProxy = 8F6AE5F0F7810F281ECC887A /* PBXContainerItemProxy */; + }; + 8FA2690062158BFBA8709A0A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_heap_snapshot_worker_js; + targetProxy = 8F47F2AE2959791C9558B5D6 /* PBXContainerItemProxy */; + }; + 8FDB318D702CDB5B50573BA0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_script_formatter_worker_js; + targetProxy = 896513A936EFA1B873DD6B73 /* PBXContainerItemProxy */; + }; + 909C73A418602D84E1ED31B4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = npapi; + targetProxy = 2DD6234124B1A8ECAF4F157C /* PBXContainerItemProxy */; + }; + 91E61E43A283207178B02A1D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = nspr; + targetProxy = 5A484EFA48FEB3E3AFDDD424 /* PBXContainerItemProxy */; + }; + 924FE3007F44A850F3D98B29 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_version; + targetProxy = 8CAE1717447E1274F064C6CE /* PBXContainerItemProxy */; + }; + 9271BC0F42F41DBB3313BEA0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = gles2_c_lib; + targetProxy = A19B2033F6168CDD43B25FFF /* PBXContainerItemProxy */; + }; + 93E425833C2643FD23FE1F7C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = api2c; + targetProxy = 37AEF0425961F5AA1ED616D7 /* PBXContainerItemProxy */; + }; + 941A82AECCF13B61507D8FCA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_heap_snapshot_worker_js; + targetProxy = 07974C86ADD313CD4C5010B6 /* PBXContainerItemProxy */; + }; + 945ED72D954B41788CDFF222 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webrtc_i420; + targetProxy = C5332843E42A434D816683C3 /* PBXContainerItemProxy */; + }; + 953B2BFA40E139C4CDC72CD7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libssl; + targetProxy = 3BF74E1A25125C5B5BF84E7B /* PBXContainerItemProxy */; + }; + 9557816F1C288E829259A841 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_script_formatter_worker_js; + targetProxy = 5C29F431CB259F9CCE295136 /* PBXContainerItemProxy */; + }; + 963672EBBDDD69ADEADDF56D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_content_resources; + targetProxy = 8ED083A461FDF845C44C4C3A /* PBXContainerItemProxy */; + }; + 97FD452B6EB19DF401DA8B03 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = net_resources; + targetProxy = EAACBC8D464E5A73DA6D782A /* PBXContainerItemProxy */; + }; + 98238BABFA753D2FD44BF099 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ns; + targetProxy = E64CBF3FE0ACDF96CF958FD0 /* PBXContainerItemProxy */; + }; + 982664829BD1394D4FBAC30E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = appcache; + targetProxy = A1A70B5140A6FBDDAE7C071E /* PBXContainerItemProxy */; + }; + 983D6ADF85BC682C3D807611 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2E847C594D99442F54D6FA7B /* cef_strings */; + targetProxy = 0EB754A2C2DFF055E241E738 /* PBXContainerItemProxy */; + }; + 9853FA541A219C3E1892FEEF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_resources; + targetProxy = 3346F4AADF6A7C889A6B9E17 /* PBXContainerItemProxy */; + }; + 9995E522BA205FE09383D33B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_resources; + targetProxy = 5193BE1549B8ACB99DF8E855 /* PBXContainerItemProxy */; + }; + 99BDB901D446F13EC2438D13 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = inspector_protocol_sources; + targetProxy = 1F1361075C0CF8D6A2939D73 /* PBXContainerItemProxy */; + }; + 9B20F39FB9E5BE58F0110E5F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 667F41D8C9AE14BC19339FE5 /* cef_resources */; + targetProxy = 8FB7D9F5D2A38E41885C4BF9 /* PBXContainerItemProxy */; + }; + 9C5E1EF2C1DB083B2B44725F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_strings; + targetProxy = B3A3C88F2ACEE45F1B2D5C49 /* PBXContainerItemProxy */; + }; + 9D98F90F0B2D2CF1B34D9349 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = vad; + targetProxy = FE5D86C420E3F443E11BA001 /* PBXContainerItemProxy */; + }; + 9DAA018E161C538137C5B4DC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = test_support_base; + targetProxy = 84A1E91E693ABF719ECE48B4 /* PBXContainerItemProxy */; + }; + 9DDDB808257CA7E6873741B7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2E847C594D99442F54D6FA7B /* cef_strings */; + targetProxy = DFF04A6F758093418DEA5D21 /* PBXContainerItemProxy */; + }; + 9ECA24FA1C1D782D51C509E5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = G722; + targetProxy = 9D356FF901E83DCA4D1CCCDB /* PBXContainerItemProxy */; + }; + 9F0F24CBA9265CCC260D748E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webcore_svg; + targetProxy = 427C585942DBDE267D77D52E /* PBXContainerItemProxy */; + }; + 9F4D474C6AAFDFD20ED9BDE4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = mach_override; + targetProxy = 614986A393D96A83A216039D /* PBXContainerItemProxy */; + }; + A04FC7E1DE747D5F75E4402C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources_standard; + targetProxy = 5F203C81FD3EB5281736FEE3 /* PBXContainerItemProxy */; + }; + A1A072890819927711EF0762 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = command_buffer_client; + targetProxy = 721356E906CAB52F98EB75DC /* PBXContainerItemProxy */; + }; + A36499018124CA3345F02A46 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = zlib; + targetProxy = 4428752BB80CB4DA298CD546 /* PBXContainerItemProxy */; + }; + A377701C78E94637691E4540 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_html; + targetProxy = FB81C5B5A652DDE3878FC555 /* PBXContainerItemProxy */; + }; + A4427590BB7DD68EACBC16D7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = allocator_extension_thunks; + targetProxy = 8A7BF8E1F47F65C9CDC86AED /* PBXContainerItemProxy */; + }; + A55B35614B8A8FC163035C1F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = allocator_extension_thunks; + targetProxy = 72B7E16466043BDBFEBEB2DC /* PBXContainerItemProxy */; + }; + A5CD4A0369A1F5A93C9B1CE4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_content_resources; + targetProxy = B9B485119348154EFBDDF686 /* PBXContainerItemProxy */; + }; + A5FB2BD7F7D8DB45EFEFC723 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = icuuc; + targetProxy = 521B86573F3E4189D991B278 /* PBXContainerItemProxy */; + }; + A67F761434AA6D80B00A4461 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 94BAF60C7C90712E7F239E35 /* libcef_dll_wrapper */; + targetProxy = BA11BA8FE45F8755DFA8CDD3 /* PBXContainerItemProxy */; + }; + A6C858D0BD86057FE8BB2887 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_html; + targetProxy = 1E247DA13ED508D57D8BCF78 /* PBXContainerItemProxy */; + }; + A6F6C80051573A8B72D17E68 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = sql; + targetProxy = 5EF075D40545DE6A95185B87 /* PBXContainerItemProxy */; + }; + A7B693B69170AA4ECA288790 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libjingle_p2p; + targetProxy = 88ADB5700E90A799EF63F6FA /* PBXContainerItemProxy */; + }; + A8475ADAE98E744D60D4FA2D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_app; + targetProxy = 82512BD79931D47B50997CB4 /* PBXContainerItemProxy */; + }; + A8D88718842A615C2E5F8AE9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = yuv_convert_simd_x86; + targetProxy = 5CBE1A21C58E05CC18C1D9DD /* PBXContainerItemProxy */; + }; + A91AA97476150E261D8035AA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = gl; + targetProxy = 0398F4B3C37D879C290A64E0 /* PBXContainerItemProxy */; + }; + A97C19D15AADB7375DA5485B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = modp_b64; + targetProxy = DC95B41EA7BCC8CD0809708A /* PBXContainerItemProxy */; + }; + AAEBE33A14731733FC9992AE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 94BAF60C7C90712E7F239E35 /* libcef_dll_wrapper */; + targetProxy = A27107D01FB762C850D38BF7 /* PBXContainerItemProxy */; + }; + AC5FB89F35A36E5480C739CB /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webcore; + targetProxy = 8FFFEF9D482787CA3EC64584 /* PBXContainerItemProxy */; + }; + AD3C01CD58386E99F4993BBC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F506A5805463407F45E5D21B /* cef_locales */; + targetProxy = 3E75BE42B8573A41CCC097CB /* PBXContainerItemProxy */; + }; + ADCFE4A390ACB5E254E38CE6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libevent; + targetProxy = A0DF8CFD968D44C24D979206 /* PBXContainerItemProxy */; + }; + ADDF12B88D8780253EC2F267 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = EF59E18D1B94CB26A18E3A3E /* cef_unittests_helper_app */; + targetProxy = C2A451FF8D54C598C57ACBF9 /* PBXContainerItemProxy */; + }; + ADFE0487AC629536E7D3EEE9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_utility; + targetProxy = FA83610F293800290D85FCFA /* PBXContainerItemProxy */; + }; + AF8AAC0FA463088CFDC7406F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CNG; + targetProxy = 07D4AB1417A05E30714469C6 /* PBXContainerItemProxy */; + }; + AF9CFE3BE26BBFB2EC760464 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_resources; + targetProxy = B8D3AC857FC404172E700976 /* PBXContainerItemProxy */; + }; + AFB00FFD2E4E0A01EAA33562 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DCB001A34DDB8A1DBDB1A9C4 /* cefclient_helper_app */; + targetProxy = 317BF6CE2FBBD6BBD3136D25 /* PBXContainerItemProxy */; + }; + AFBD472159527629D176CDD1 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_css; + targetProxy = 6C5E3CCA89BBD6F985878148 /* PBXContainerItemProxy */; + }; + AFE212C0CA2DAF8A25E3240F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_extension_api; + targetProxy = E2564C2CB7D986733E52F25A /* PBXContainerItemProxy */; + }; + B04DD3BCCD24DDA72185A9D0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = gmock; + targetProxy = CB32F956E3B0A8C0A1A84474 /* PBXContainerItemProxy */; + }; + B2A78482BA3852DC25AF5ECC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webrtc_libyuv; + targetProxy = 40E63186CE495AB67101F56C /* PBXContainerItemProxy */; + }; + B2D9D83008DF76C3EFA8EB71 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = system_wrappers; + targetProxy = B78673A0DD35A7299172025E /* PBXContainerItemProxy */; + }; + B361D916D0D9478CEBCCB194 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 26DD2CB0340D816F3DF64EC9 /* libcef */; + targetProxy = A43F12DE62E92CEB702E5B9C /* PBXContainerItemProxy */; + }; + B44FB998F5B58EAF00144080 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = iSACFix; + targetProxy = FDB0539C6CAB8E3358B1BA87 /* PBXContainerItemProxy */; + }; + B46F40D25EA68E98ED7AC4DF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = PCM16B; + targetProxy = C5BA50AB6C5A3596393A4D26 /* PBXContainerItemProxy */; + }; + B52B6B2CBB3D2EB5891AABEE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = icui18n; + targetProxy = 9A391C78226B07A5ABD43C00 /* PBXContainerItemProxy */; + }; + B7441324E2ACE24C3AD58F27 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = video_engine_core; + targetProxy = 301175776FFF607DC7AFBFD0 /* PBXContainerItemProxy */; + }; + B784D096609A64A036DEC09E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = js2c; + targetProxy = 43DA404A51148097301125FB /* PBXContainerItemProxy */; + }; + B7F2A5490315CF7FEED0A128 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_strings; + targetProxy = 3B52F4F5CB5D25913520A79C /* PBXContainerItemProxy */; + }; + B8C2F9932BD812C91648B312 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 94BAF60C7C90712E7F239E35 /* libcef_dll_wrapper */; + targetProxy = 424E0A3788B6163816F35A19 /* PBXContainerItemProxy */; + }; + B8D6BFE01BB5BC9EA108B22D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2E847C594D99442F54D6FA7B /* cef_strings */; + targetProxy = AA53D9366E0C78F477B360C6 /* PBXContainerItemProxy */; + }; + B9A773106F83A6413A6687D9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_script_formatter_worker_js; + targetProxy = 96B858CF0B0C2E3FD1F8BB7B /* PBXContainerItemProxy */; + }; + BAAC718AEE06C92454F0C470 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = speech_proto; + targetProxy = 4191D297BB9CD44C4BD61D4E /* PBXContainerItemProxy */; + }; + BC1DA3A1A8DFBD458309DF84 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = base_i18n; + targetProxy = 1010F02EBEF464B5EB0A40A4 /* PBXContainerItemProxy */; + }; + BD97A80B0F044A62288E0E16 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_worker; + targetProxy = BA6D86298DDC580298F0E28D /* PBXContainerItemProxy */; + }; + BDFFE2C07E56354EAD8A1832 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_strings; + targetProxy = 081CC7F2306E2E797B2F370E /* PBXContainerItemProxy */; + }; + BFF345F0E2483933810B4967 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DA98FB3E241B73BA47200DFF /* AtomHelperApp */; + targetProxy = 70C3B2F34E29BC2908474620 /* PBXContainerItemProxy */; + }; + C0AA512C56B4CA181B73FF42 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = modp_b64; + targetProxy = 988B8FE296C3F2BF53D6972E /* PBXContainerItemProxy */; + }; + C16A64F27789BF415AD72E91 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_extension_api; + targetProxy = CC74949B299A9E62B06291A0 /* PBXContainerItemProxy */; + }; + C191AB6D80B73206C3EFB700 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = aec; + targetProxy = F207912FEA4F9F5834433CBD /* PBXContainerItemProxy */; + }; + C216A1EF9DFFA341DD1FF0A0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = blob; + targetProxy = 7F79F2139E97617232064D46 /* PBXContainerItemProxy */; + }; + C21C8DF836E38F82A780D9E0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_js; + targetProxy = 932D6A605108D3A81A21D77B /* PBXContainerItemProxy */; + }; + C2EE1EC0A89FB359F99930D4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = command_buffer_common; + targetProxy = 05C397272269E53BAC058578 /* PBXContainerItemProxy */; + }; + C3A8950A78F771F433883B03 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F506A5805463407F45E5D21B /* cef_locales */; + targetProxy = 5F9CE73CEA17E69010626EE4 /* PBXContainerItemProxy */; + }; + C3FEC5456936C6187B8524BE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 34C94585C2266BDAEE3DB526 /* cef_pak */; + targetProxy = 40C70AC20B6DEFA908FA3AFA /* PBXContainerItemProxy */; + }; + C40EFA3F6D1C6F9DE6D4C2DC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_strings; + targetProxy = AA7FC570A4096EECE3D925B1 /* PBXContainerItemProxy */; + }; + C61CF4352A96E883FBD8648A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = gtest; + targetProxy = 32F7F5283B2AAD6E98A83586 /* PBXContainerItemProxy */; + }; + C679DF31865E8994EB9FF3A8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_resources; + targetProxy = 8DE4897593DE4E0E3A3FD6E5 /* PBXContainerItemProxy */; + }; + C759DC2977118579D0A96459 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DCB001A34DDB8A1DBDB1A9C4 /* cefclient_helper_app */; + targetProxy = 67DA397F195EB1EF7A59A9E8 /* PBXContainerItemProxy */; + }; + C7A76CE1D0D1DA3B256C2CFF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_js; + targetProxy = 0653C7A62277A74DC20441B0 /* PBXContainerItemProxy */; + }; + C7E3361284E1F7D7C26E2D86 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 26DD2CB0340D816F3DF64EC9 /* libcef */; + targetProxy = 833B8B0AF2B0AF665824A7CF /* PBXContainerItemProxy */; + }; + C8572EAEAA16C37793E85715 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 667F41D8C9AE14BC19339FE5 /* cef_resources */; + targetProxy = 1AD2EA638A44E4380534F8AA /* PBXContainerItemProxy */; + }; + C87925E134D9B5DED1872997 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_common; + targetProxy = 43D2D1FC60B7C1D93A2EAADF /* PBXContainerItemProxy */; + }; + C96C682CE5500237F5945E9A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DBADDE353DC46B377FC4192 /* libcef_static */; + targetProxy = 716D00D9A42CD2DA578F19C6 /* PBXContainerItemProxy */; + }; + C982BD4CEA60C1EE560E1E0F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2E847C594D99442F54D6FA7B /* cef_strings */; + targetProxy = BF426B5E629E53D6620AE838 /* PBXContainerItemProxy */; + }; + CA04358E4C6791BCEBF79538 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = EF3BCECA3610152FBA76BFFF /* Run cef_unittests */; + targetProxy = 228F888A4D6B1149EA854BE2 /* PBXContainerItemProxy */; + }; + CABA16FFBF964F3E0877AE92 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources_standard; + targetProxy = 0BF54FAEE33C508144F8D12F /* PBXContainerItemProxy */; + }; + CACF350ABA7092F2EED4885B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources_standard; + targetProxy = D71872A08CCEC1BD4B4E6744 /* PBXContainerItemProxy */; + }; + CB10DA56733DE60BA0001808 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 667F41D8C9AE14BC19339FE5 /* cef_resources */; + targetProxy = F5C1C84F00CC375F9F7645D9 /* PBXContainerItemProxy */; + }; + CB20BF2B84CAE7083B2F2609 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = icuuc; + targetProxy = D5C3B62136279495EF2C8892 /* PBXContainerItemProxy */; + }; + CBEC0AD6362E3C9763E6645D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_js; + targetProxy = 8C57F3C8183027B167E5A7A7 /* PBXContainerItemProxy */; + }; + CC7A1151DD0C6D8D0505587D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 0493E18E77BAF61DDB854B47 /* cefclient */; + targetProxy = 39D9C7B1BD5BBF2EE6BF0D8B /* PBXContainerItemProxy */; + }; + CCABC28C7229D914B0166755 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ppapi_shared; + targetProxy = 3D84F23A3CF0B67E68573B4C /* PBXContainerItemProxy */; + }; + CD34116734A4250D23757470 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 26DD2CB0340D816F3DF64EC9 /* libcef */; + targetProxy = E7451C1B2D44D27DC540FAEF /* PBXContainerItemProxy */; + }; + CEAF706BE29DF4FC8007A5FA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = surface; + targetProxy = 8489CEAA9E69008541690AC2 /* PBXContainerItemProxy */; + }; + CECE00B958801956686E3535 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources_standard; + targetProxy = 0C1B771951859F608F2FDD49 /* PBXContainerItemProxy */; + }; + CED29D01F7E6B437AA1B8F55 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = translator_common; + targetProxy = 4E15B334E55007F9DE94D230 /* PBXContainerItemProxy */; + }; + CFDD3160FFD38A5A103F5C46 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = base_static; + targetProxy = 6DA1FB47544333BB8183BA62 /* PBXContainerItemProxy */; + }; + CFEE9A8D3AFA97BC2AC56599 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_strings; + targetProxy = 087A8B35F48C7BF25CF5492B /* PBXContainerItemProxy */; + }; + D4A81AA031FDFFFD564D116A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_html; + targetProxy = 43AC608B09206F6E17DC912A /* PBXContainerItemProxy */; + }; + D4B32F5B63922E4C30765E62 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = googleurl; + targetProxy = 88669534DD78077ABE86C128 /* PBXContainerItemProxy */; + }; + D4C3FDD69C6792EF9A1FCAA7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DBADDE353DC46B377FC4192 /* libcef_static */; + targetProxy = D34DA442DD5291029646E27F /* PBXContainerItemProxy */; + }; + D4E971F7303C938071EC5A2E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libwebp_dsp; + targetProxy = 0C76579E2AEE0056CBF8886D /* PBXContainerItemProxy */; + }; + D6269028369F81CEE750919B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_heap_snapshot_worker_js; + targetProxy = C69A3B5976F183E0AD6AD56F /* PBXContainerItemProxy */; + }; + D62A77AB9AF0B5C6CA6DD10A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libwebp; + targetProxy = 9D664659936D47D3BE9DCBE2 /* PBXContainerItemProxy */; + }; + D73B1CC21AE30C491438895B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = gtest_prod; + targetProxy = 9F88B14DF9B91F41B89D9673 /* PBXContainerItemProxy */; + }; + D7C35C1D4B238BC1476638C8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = gtest_prod; + targetProxy = D4478BEE26730DF69FD271A7 /* PBXContainerItemProxy */; + }; + D865DA821ED58CBF81B167B0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libpng; + targetProxy = BD9A2EA6CC3887454D3D097E /* PBXContainerItemProxy */; + }; + D9C00D60B7473D8C80DC41B1 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_heap_snapshot_worker_js; + targetProxy = 65C898B7F1A88D5FBC16AC82 /* PBXContainerItemProxy */; + }; + D9C35CBA4217039633C22450 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = signal_processing; + targetProxy = 122D85636D403254B9FF74DC /* PBXContainerItemProxy */; + }; + DA3D488D325CBBFB1762FA73 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_css; + targetProxy = FC7759F4CB25D67D5673D434 /* PBXContainerItemProxy */; + }; + DA435D4861F6629421F8206F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = inspector_protocol_sources; + targetProxy = 2A9D12E5E0A3DEEA09DBF13C /* PBXContainerItemProxy */; + }; + DAC5C714D00EB16221DE217C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_extension_api; + targetProxy = 1830B2E1ABC7EAF923F52A0D /* PBXContainerItemProxy */; + }; + DB4DB9A8D28928F15DC54961 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = sfntly; + targetProxy = B275EEAE71F03742E3DA6801 /* PBXContainerItemProxy */; + }; + DBC2E821446337E0737E7AA1 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources_standard; + targetProxy = 0CA35B9CFE081FFC1C1F4F90 /* PBXContainerItemProxy */; + }; + DCA81FD0679CDBDC87C90B95 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = net_resources; + targetProxy = C5A7D2422E9ED79A3A197BB8 /* PBXContainerItemProxy */; + }; + DD648AE0CEAD3B920AD2C49E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webrtc_video_coding; + targetProxy = FAFA66135B1078945647E8A9 /* PBXContainerItemProxy */; + }; + DDCBA090E5F6FF449541DC7B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = gtest; + targetProxy = 3D58E114847868683B50E554 /* PBXContainerItemProxy */; + }; + DE33C57E5B2E869B66768B55 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webcore_bindings; + targetProxy = 20A4907C83472A3B07A96C7E /* PBXContainerItemProxy */; + }; + DF46FDAE1F4C33EF1A3EF27C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = inspector_protocol_sources; + targetProxy = 87D1401BEE5267ED94319D3C /* PBXContainerItemProxy */; + }; + E14394DC375369022496EB91 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_resources; + targetProxy = EB017E52279082CE6740C548 /* PBXContainerItemProxy */; + }; + E2E90A60156F59E4170DA218 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webcore_bindings; + targetProxy = F57517FEA780EBD72B6F18FD /* PBXContainerItemProxy */; + }; + E48C1957A87A9D58917A490B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 26DD2CB0340D816F3DF64EC9 /* libcef */; + targetProxy = A571737D82A42A2394A7E891 /* PBXContainerItemProxy */; + }; + E52010F8FD971760FCEFF954 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = sqlite; + targetProxy = D3A86904CD5DCC0A5F782932 /* PBXContainerItemProxy */; + }; + E55705F2149D6E6B4377C1E9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = debugger_script_source; + targetProxy = 982968A232F6FAF9BE2A3787 /* PBXContainerItemProxy */; + }; + E65DBA579EE92F66AC6A4E39 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_js; + targetProxy = CFE496C1AF614A3E880DEA31 /* PBXContainerItemProxy */; + }; + E6A0A8A887CA18F8E51725DC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = content_resources; + targetProxy = 1FBCE1DE8DADB748860FF2B6 /* PBXContainerItemProxy */; + }; + E6A5E45AC2BBCA574F629848 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = iccjpeg; + targetProxy = A28E741C9FEBAC8342FFF2F2 /* PBXContainerItemProxy */; + }; + E7BF5B47F1BE81DC0321B9FB /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_devtools_grd; + targetProxy = 1EBAA26A37509D645A9BDACB /* PBXContainerItemProxy */; + }; + E7D004A9273847E38D358ED2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = skia_opts; + targetProxy = 5547482E189BB6F18FB29F43 /* PBXContainerItemProxy */; + }; + E8B5563B938B7089EFCAF709 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_resources; + targetProxy = 5C14CCA72577376126365C2A /* PBXContainerItemProxy */; + }; + E8C18615379C40545C7FBE21 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_resources; + targetProxy = ED725A9FB1C7C4B0FF7DBA95 /* PBXContainerItemProxy */; + }; + E957B3B33ABFC9FE40BFBEAA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F506A5805463407F45E5D21B /* cef_locales */; + targetProxy = 691682CC834B8FAEF8F6A51D /* PBXContainerItemProxy */; + }; + E9CA9A04B2BB0C839FE53EF9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = icudata; + targetProxy = C477E230B26B99674FE16C6E /* PBXContainerItemProxy */; + }; + EC4968AF05ED345F4C0568B0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_devtools_grd; + targetProxy = ABB57020D6F6F67D1530792E /* PBXContainerItemProxy */; + }; + EC7DE7ABB6CCA086B36CB92B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_inspector_protocol_version; + targetProxy = 06713C1F841C3F1F68A985EE /* PBXContainerItemProxy */; + }; + ECFBF7E36BCF37F7495501B8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DA259FAFFD7136C8A5C881A8 /* cef_unittests */; + targetProxy = CFE92743DA9397AE9F611037 /* PBXContainerItemProxy */; + }; + ED1F3DA1BF2CBD12B366DC8E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = yuv_convert; + targetProxy = 4C2026A4C578741C75462322 /* PBXContainerItemProxy */; + }; + EE182D9359430CBC11B12B17 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = video_render_module; + targetProxy = 0065A55A9D6639BFC171990C /* PBXContainerItemProxy */; + }; + EE4FDA1878F278A35FA3AFC9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = apm_util; + targetProxy = B62D1F514CA3FC2532A713BA /* PBXContainerItemProxy */; + }; + EF89825F1F1D8C085B2D062D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 94BAF60C7C90712E7F239E35 /* libcef_dll_wrapper */; + targetProxy = 1FE166E915EB6AD8920DE9A7 /* PBXContainerItemProxy */; + }; + EFC63B579D17F4D1B0766435 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_gpu; + targetProxy = E94C0C60B7AFE63BBE0B5470 /* PBXContainerItemProxy */; + }; + F0B723B4F97690C506395CBB /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = sdch; + targetProxy = D6587A772AD1B4D18637C802 /* PBXContainerItemProxy */; + }; + F0CA185DCC290D621BFBCFD1 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2E847C594D99442F54D6FA7B /* cef_strings */; + targetProxy = 853A1330852D346AD017EE16 /* PBXContainerItemProxy */; + }; + F1B2B92053DF854D163A1553 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources; + targetProxy = E6910964CC71673EA2FBC79D /* PBXContainerItemProxy */; + }; + F1C03BDF885790512F75EB01 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = net_resources; + targetProxy = 183462F2B21573387F07286B /* PBXContainerItemProxy */; + }; + F2679D3E14329F842B356CAA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = database; + targetProxy = 891D10A69BD088AB45ED563D /* PBXContainerItemProxy */; + }; + F2BB4FA3B940C07D89157EC9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_extension_api; + targetProxy = E8327162A6B7F0E5B8C34C1D /* PBXContainerItemProxy */; + }; + F34A8190B10255E6B5E7245E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_css; + targetProxy = BE4E7BC41BF33A6705FB3111 /* PBXContainerItemProxy */; + }; + F43C88B1CC50EBB3FAEECBDE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = preprocessor; + targetProxy = 62EF434C253260FC8FE714A8 /* PBXContainerItemProxy */; + }; + F48E6804BAFE55960848350C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_content_resources; + targetProxy = 14AABBA826DE5C6C9B6465A6 /* PBXContainerItemProxy */; + }; + F4B1DAFAEBE2F272F77A1157 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = devtools_extension_api; + targetProxy = 5F7C27B24FC162FB9813CC26 /* PBXContainerItemProxy */; + }; + F6209F2F154B8EDAC16F5D24 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = dynamic_annotations; + targetProxy = 16F0B818474A0285294912F5 /* PBXContainerItemProxy */; + }; + F62351C167200E946175EF15 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_platform; + targetProxy = 34D1CF272CE65F9A39DDD963 /* PBXContainerItemProxy */; + }; + F62CE60DD219AB04B67F1065 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = generate_devtools_grd; + targetProxy = EBD3B14199A6BACC74036512 /* PBXContainerItemProxy */; + }; + F7BC8BF9A2CEC8FA8D4992A3 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_script_formatter_worker_js; + targetProxy = A9CA87B6D4E69017E9F20693 /* PBXContainerItemProxy */; + }; + F8D0C8803EDBC67FD6553421 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = media; + targetProxy = 70582AA93F08BA41908FED77 /* PBXContainerItemProxy */; + }; + F8DA36B1F207ED049BC8B1B0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webcore_rendering; + targetProxy = 6C56C8016760A7D376CA24D1 /* PBXContainerItemProxy */; + }; + F8FBEA78C0E87AC82CC5990F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webkit_resources; + targetProxy = 2E86B31897F952E4E9CDAB58 /* PBXContainerItemProxy */; + }; + F9BD1E0CF1BF1CE250FDCB42 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = mach_override; + targetProxy = 3200E00B80EA473B4DD27553 /* PBXContainerItemProxy */; + }; + F9C625D2D07F3429FB9B0A86 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = ui_resources; + targetProxy = 9C1516C2A8DB489541CF69A6 /* PBXContainerItemProxy */; + }; + FA1E0AA7915B8467B9684838 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_heap_snapshot_worker_js; + targetProxy = 811A770259ECD862EA4F1BFD /* PBXContainerItemProxy */; + }; + FA5AC5784CF82BFB7E445A9A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = base; + targetProxy = 88188A34571CF694C61B1933 /* PBXContainerItemProxy */; + }; + FB18C19A700F0008333FB2B2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = dom_storage; + targetProxy = 2B2EE32C90EFFA776B326380 /* PBXContainerItemProxy */; + }; + FB2DDCC207B854AD4FA2BD55 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = libwebp_enc; + targetProxy = A433AB69035674FAD93254AD /* PBXContainerItemProxy */; + }; + FC4FC4583C47C1909FF4DDB4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = webrtc_jpeg; + targetProxy = 2DC0B73434700491AD419D40 /* PBXContainerItemProxy */; + }; + FC74A51F8B1C1F3E93952A9C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = concatenated_devtools_css; + targetProxy = 612B234078CD9D9B606B6248 /* PBXContainerItemProxy */; + }; + FDB175F4706DD32BC8642CBA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = sudden_motion_sensor; + targetProxy = 8FF3AA87114F0E63F0DFB512 /* PBXContainerItemProxy */; + }; + FE2FCE7EA59AC634052A5124 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 34C94585C2266BDAEE3DB526 /* cef_pak */; + targetProxy = 89968FBB98A71E24114B71B4 /* PBXContainerItemProxy */; + }; + FF0396C5BADD3C1A6445DEE2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F506A5805463407F45E5D21B /* cef_locales */; + targetProxy = C04A5DCE600A75EC791276D2 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 504BF73960853BE20696B75A /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 4F41E3D04AC393353B1EF8B1 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 880329B56217F29FD88D58FE /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 72FB6EEF729DD9BE4DE9913C /* English */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; + 8C0268548C079EBC071390BF /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 668C83DE4FD97FDAF9A1743C /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 9E74CA2249E727B65B812091 /* locale.pak */ = { + isa = PBXVariantGroup; + children = ( + D0C928E6B9A90B8E7C82948B /* am */, + 2887799486DC2264974AAA31 /* ar */, + DDA467E96A26AD4D03D9510E /* bg */, + BC2DBEF9AEE291FE9536BFF8 /* bn */, + 4EFE292D06E344DCCB3F36DA /* ca */, + 62D155EAC030B92E5833CC71 /* cs */, + 74EF14161F0A734FCB88E4D8 /* da */, + B631AEBC75354D3C9BAD7E60 /* de */, + 12E42A64F19E4B183A87E741 /* el */, + 1AF072F4E95AF8E70575FDC6 /* en */, + C8B2E4A52DE2C4516E90AF0A /* en_GB */, + 17FE54DB3FAE1BF5BF29F441 /* es */, + 6DE552DE833DCAC5A7DF4BE7 /* es_419 */, + D9A70811C1CA0449A9BB8F23 /* et */, + 93817B77718BE477E11D1B77 /* fa */, + B1BC0DCCB17AA248A0D577F9 /* fi */, + 07B50631033A1D31193C99F0 /* fil */, + FB89F2BDE176C61ABD9F21FE /* fr */, + 821F22742E14E5EBB9BD5C10 /* gu */, + 1974FF0ADD0407E965545E45 /* he */, + 1C5196D5A93468A76CA3C7F1 /* hi */, + 6741F51DA01588D368B31427 /* hr */, + C1C9F222C0F4DDAD2BB19DE2 /* hu */, + 1C834CCB1E55E906499F26DE /* id */, + A287C0A02FC93659AE3E9641 /* it */, + 9957A9B688C530DBDCD91F85 /* ja */, + C6928DEF7F0D141CA277C6D9 /* kn */, + 7A7D3194355A8B0B087AB0F7 /* ko */, + 6AAF07370A423CF8AC644D16 /* lt */, + AE444896E4C5BBC3F0B079B4 /* lv */, + CBD002A1963C4F53D11B5870 /* ml */, + D31E19966B4FFD0C7AFFC86C /* mr */, + 2F4E80723D53CD819926DBBC /* ms */, + B1072A8812268AA3912AD3A9 /* nb */, + 9EDDA92B6B176C1235419654 /* nl */, + 73467F9CB00DFEDF2093D88B /* pl */, + A20BA18DE54D9DF5B47E2884 /* pt_BR */, + B8D92CFE5FE010A20C2DE9E0 /* pt_PT */, + 03C4C78B8596116BFD2BEED2 /* ro */, + 5B71AA10477E9E5993D8F79B /* ru */, + E331A5FC069C0C31B73E896D /* sk */, + 6A120E36DD430329E402BAD5 /* sl */, + B28771FABF438DE250C9A59F /* sr */, + 4A8F5A7994245C71941FF80A /* sv */, + DBC9ADD36C96688115653866 /* sw */, + FC5475BF8937399DFD353D03 /* ta */, + 796D220B79FC44A95CE17BDE /* te */, + 5077ADEACE5517E5F138A071 /* th */, + AE6EDF6B7A543E0AC126F13E /* tr */, + 02C3921F366D7D841D6667B0 /* uk */, + 85AE1E1E67C77F50EA88BD66 /* vi */, + 60BDE740DC8E69DC493B2F84 /* zh_CN */, + 83813FFC96ED9BA50A4F2072 /* zh_TW */, + ); + name = locale.pak; + sourceTree = ""; + }; + C312F72C568701E9B4651474 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + C2246857E5328D3CA26856D2 /* English */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 0B11CAE87B86BCDA1071EFFF /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + EXECUTABLE_PREFIX = lib; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"BUILDING_CEF_SHARED\"", + "\"SK_BUILD_NO_IMAGE_ENCODE\"", + "\"GR_GL_CUSTOM_SETUP_HEADER=\\\"GrGLConfig_chrome.h\\\"\"", + "\"GR_AGGRESSIVE_SHADER_OPTS=1\"", + "\"U_USING_ICU_NAMESPACE=0\"", + "\"U_STATIC_IMPLEMENTATION\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + "\"_DEBUG\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ../third_party/icu/public/i18n, + ../third_party/icu/public/common, + ., + ../third_party/khronos, + .., + "$(SHARED_INTERMEDIATE_DIR)/content", + ../skia/config, + ../third_party/skia/include/config, + ../third_party/skia/include/core, + ../third_party/skia/include/effects, + ../third_party/skia/include/pdf, + ../third_party/skia/include/gpu, + ../third_party/skia/include/gpu/gl, + ../third_party/skia/include/ports, + ../third_party/skia/include/utils, + ../skia/ext, + ../third_party/skia/include/utils/mac, + ../third_party/npapi, + ../third_party/npapi/bindings, + ../v8/include, + ); + INSTALL_PATH = "@executable_path"; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/System/Library/Frameworks", + "$(BUILT_PRODUCTS_DIR)", + ); + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + OTHER_LDFLAGS = ( + "-Wl,-ObjC", + "-Wl,-search_paths_first", + ); + PRODUCT_NAME = cef; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Debug; + }; + 0CA785BAC652A740FEDD3EEA /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings", + "$(SHARED_INTERMEDIATE_DIR)/webkit", + "$(SHARED_INTERMEDIATE_DIR)/cef", + ); + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + OTHER_LDFLAGS = "-Wl,-search_paths_first"; + PRODUCT_NAME = cef_locales; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Debug; + }; + 1EA5CC4C789D20059C96ED45 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + INTERMEDIATE_DIR = "$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)"; + SDKROOT = macosx10.6; + SHARED_INTERMEDIATE_DIR = "$(SYMROOT)/DerivedSources/$(CONFIGURATION)"; + SYMROOT = ../xcodebuild; + }; + name = Debug; + }; + 1F2B12072EFE0FB85B1D218B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"UNIT_TEST\"", + "\"GTEST_HAS_RTTI=0\"", + "\"GTEST_USE_OWN_TR1_TUPLE=1\"", + "\"U_USING_ICU_NAMESPACE=0\"", + "\"U_STATIC_IMPLEMENTATION\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ../third_party/icu/public/common, + ../third_party/icu/public/i18n, + ., + ../third_party/khronos, + .., + ../testing/gtest/include, + ); + INFOPLIST_FILE = "tests/cefclient/mac/helper-Info.plist"; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = "cef_unittests Helper"; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + WRAPPER_PREFIX = ""; + }; + name = Release; + }; + 1FEC448F6319CE585410BF7D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = All; + }; + name = Debug; + }; + 388EAAEB77349E4A43824356 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + EXECUTABLE_PREFIX = lib; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"BUILDING_CEF_SHARED\"", + "\"SK_BUILD_NO_IMAGE_ENCODE\"", + "\"GR_GL_CUSTOM_SETUP_HEADER=\\\"GrGLConfig_chrome.h\\\"\"", + "\"GR_AGGRESSIVE_SHADER_OPTS=1\"", + "\"LIBXML_STATIC\"", + "\"U_USING_ICU_NAMESPACE=0\"", + "\"U_STATIC_IMPLEMENTATION\"", + "\"ENABLE_3D_PLUGIN=1\"", + "\"ENABLE_BATTERY_STATUS=0\"", + "\"ENABLE_BLOB=1\"", + "\"ENABLE_BLOB_SLICE=1\"", + "\"ENABLE_CHANNEL_MESSAGING=1\"", + "\"ENABLE_CSS3_FLEXBOX=1\"", + "\"ENABLE_CSS_BOX_DECORATION_BREAK=1\"", + "\"ENABLE_CSS_EXCLUSIONS=1\"", + "\"ENABLE_CSS_FILTERS=1\"", + "\"ENABLE_CSS_IMAGE_SET=1\"", + "\"ENABLE_CSS_IMAGE_RESOLUTION=0\"", + "\"ENABLE_CSS_REGIONS=1\"", + "\"ENABLE_CSS_SHADERS=1\"", + "\"ENABLE_CSS_VARIABLES=0\"", + "\"ENABLE_CUSTOM_SCHEME_HANDLER=0\"", + "\"ENABLE_DATALIST=1\"", + "\"ENABLE_DASHBOARD_SUPPORT=0\"", + "\"ENABLE_DATA_TRANSFER_ITEMS=1\"", + "\"ENABLE_DETAILS=1\"", + "\"ENABLE_DEVICE_ORIENTATION=1\"", + "\"ENABLE_DIRECTORY_UPLOAD=1\"", + "\"ENABLE_DOWNLOAD_ATTRIBUTE=1\"", + "\"ENABLE_ENCRYPTED_MEDIA=1\"", + "\"ENABLE_FILE_SYSTEM=1\"", + "\"ENABLE_FILTERS=1\"", + "\"ENABLE_FULLSCREEN_API=1\"", + "\"ENABLE_GAMEPAD=1\"", + "\"ENABLE_GEOLOCATION=1\"", + "\"ENABLE_GESTURE_EVENTS=1\"", + "\"ENABLE_ICONDATABASE=0\"", + "\"ENABLE_IFRAME_SEAMLESS=1\"", + "\"ENABLE_INDEXED_DATABASE=1\"", + "\"ENABLE_INPUT_TYPE_DATE=1\"", + "\"ENABLE_JAVASCRIPT_DEBUGGER=1\"", + "\"ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0\"", + "\"ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1\"", + "\"ENABLE_LINK_PREFETCH=1\"", + "\"ENABLE_LINK_PRERENDER=1\"", + "\"ENABLE_MEDIA_SOURCE=1\"", + "\"ENABLE_MEDIA_STATISTICS=1\"", + "\"ENABLE_METER_TAG=1\"", + "\"ENABLE_MHTML=1\"", + "\"ENABLE_MICRODATA=0\"", + "\"ENABLE_MUTATION_OBSERVERS=1\"", + "\"ENABLE_PAGE_VISIBILITY_API=1\"", + "\"ENABLE_POINTER_LOCK=1\"", + "\"ENABLE_PROGRESS_TAG=1\"", + "\"ENABLE_QUOTA=1\"", + "\"ENABLE_REGISTER_PROTOCOL_HANDLER=1\"", + "\"ENABLE_REQUEST_ANIMATION_FRAME=1\"", + "\"ENABLE_RUBY=1\"", + "\"ENABLE_SANDBOX=1\"", + "\"ENABLE_SCRIPTED_SPEECH=1\"", + "\"ENABLE_SHADOW_DOM=1\"", + "\"ENABLE_SMOOTH_SCROLLING=1\"", + "\"ENABLE_SQL_DATABASE=1\"", + "\"ENABLE_STYLE_SCOPED=1\"", + "\"ENABLE_SVG=1\"", + "\"ENABLE_SVG_FONTS=1\"", + "\"ENABLE_TOUCH_ADJUSTMENT=1\"", + "\"ENABLE_TOUCH_EVENTS=1\"", + "\"ENABLE_TOUCH_ICON_LOADING=0\"", + "\"ENABLE_V8_SCRIPT_DEBUG_SERVER=1\"", + "\"ENABLE_VIDEO=1\"", + "\"ENABLE_VIDEO_TRACK=1\"", + "\"ENABLE_VIEWPORT=1\"", + "\"ENABLE_WEBGL=1\"", + "\"ENABLE_WEB_SOCKETS=1\"", + "\"ENABLE_WEB_TIMING=1\"", + "\"ENABLE_WORKERS=1\"", + "\"ENABLE_XHR_RESPONSE_BLOB=1\"", + "\"ENABLE_XSLT=1\"", + "\"WTF_USE_LEVELDB=1\"", + "\"WTF_USE_BUILTIN_UTF8_CODEC=1\"", + "\"WTF_USE_OPENTYPE_SANITIZER=1\"", + "\"WTF_USE_RTL_SCROLLBAR=1\"", + "\"WTF_USE_SKIA_TEXT=1\"", + "\"WTF_USE_WEBP=1\"", + "\"WTF_USE_WEBKIT_IMAGE_DECODERS=1\"", + "\"ENABLE_CALENDAR_PICKER=1\"", + "\"ENABLE_FONT_BOOSTING=0\"", + "\"ENABLE_FULLSCREEN_MEDIA_CONTROLS=1\"", + "\"ENABLE_INPUT_SPEECH=1\"", + "\"ENABLE_JAVASCRIPT_I18N_API=1\"", + "\"ENABLE_LEGACY_NOTIFICATIONS=1\"", + "\"ENABLE_MEDIA_CAPTURE=0\"", + "\"ENABLE_MEDIA_STREAM=1\"", + "\"ENABLE_NOTIFICATIONS=1\"", + "\"ENABLE_ORIENTATION_EVENTS=0\"", + "\"ENABLE_OVERFLOW_SCROLLING=0\"", + "\"ENABLE_PAGE_POPUP=1\"", + "\"ENABLE_SHARED_WORKERS=1\"", + "\"ENABLE_WEB_AUDIO=1\"", + "\"ENABLE_INPUT_TYPE_COLOR=1\"", + "\"WTF_USE_ACCELERATED_COMPOSITING=1\"", + "\"ENABLE_3D_RENDERING=1\"", + "\"ENABLE_ACCELERATED_2D_CANVAS=1\"", + "\"ENABLE_RUBBER_BANDING=1\"", + "\"WTF_USE_SKIA_ON_MAC_CHROMIUM=1\"", + "\"BUILDING_CHROMIUM__=1\"", + "\"USE_SYSTEM_MALLOC=1\"", + "\"WTF_USE_NEW_THEME=1\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + "\"_DEBUG\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ../third_party/icu/public/i18n, + ../third_party/icu/public/common, + ., + ../third_party/WebKit/Source/WebKit/chromium/public, + "$(SHARED_INTERMEDIATE_DIR)/cef", + ../third_party/khronos, + .., + "$(SHARED_INTERMEDIATE_DIR)/content", + ../skia/config, + ../third_party/skia/include/config, + ../third_party/skia/include/core, + ../third_party/skia/include/effects, + ../third_party/skia/include/pdf, + ../third_party/skia/include/gpu, + ../third_party/skia/include/gpu/gl, + ../third_party/skia/include/ports, + ../third_party/skia/include/utils, + ../skia/ext, + ../third_party/skia/include/utils/mac, + ../third_party/libxml/mac/include, + ../third_party/libxml/src/include, + ../third_party/WebKit/Source/WebCore/, + ../third_party/WebKit/Source, + ../third_party/WebKit/Source/WebCore/Modules/battery, + ../third_party/WebKit/Source/WebCore/Modules/filesystem, + ../third_party/WebKit/Source/WebCore/Modules/filesystem/chromium, + ../third_party/WebKit/Source/WebCore/Modules/gamepad, + ../third_party/WebKit/Source/WebCore/Modules/geolocation, + ../third_party/WebKit/Source/WebCore/Modules/intents, + ../third_party/WebKit/Source/WebCore/Modules/indexeddb, + ../third_party/WebKit/Source/WebCore/Modules/mediastream, + ../third_party/WebKit/Source/WebCore/Modules/quota, + ../third_party/WebKit/Source/WebCore/Modules/speech, + ../third_party/WebKit/Source/WebCore/Modules/webaudio, + ../third_party/WebKit/Source/WebCore/Modules/webdatabase, + ../third_party/WebKit/Source/WebCore/Modules/webdatabase/chromium, + ../third_party/WebKit/Source/WebCore/Modules/websockets, + ../third_party/WebKit/Source/WebCore/accessibility, + ../third_party/WebKit/Source/WebCore/accessibility/chromium, + ../third_party/WebKit/Source/WebCore/bindings, + ../third_party/WebKit/Source/WebCore/bindings/generic, + ../third_party/WebKit/Source/WebCore/bindings/v8, + ../third_party/WebKit/Source/WebCore/bindings/v8/custom, + ../third_party/WebKit/Source/WebCore/bindings/v8/specialization, + ../third_party/WebKit/Source/WebCore/bridge, + ../third_party/WebKit/Source/WebCore/bridge/jni, + ../third_party/WebKit/Source/WebCore/bridge/jni/v8, + ../third_party/WebKit/Source/WebCore/css, + ../third_party/WebKit/Source/WebCore/dom, + ../third_party/WebKit/Source/WebCore/dom/default, + ../third_party/WebKit/Source/WebCore/editing, + ../third_party/WebKit/Source/WebCore/fileapi, + ../third_party/WebKit/Source/WebCore/history, + ../third_party/WebKit/Source/WebCore/html, + ../third_party/WebKit/Source/WebCore/html/canvas, + ../third_party/WebKit/Source/WebCore/html/parser, + ../third_party/WebKit/Source/WebCore/html/shadow, + ../third_party/WebKit/Source/WebCore/html/track, + ../third_party/WebKit/Source/WebCore/inspector, + ../third_party/WebKit/Source/WebCore/loader, + ../third_party/WebKit/Source/WebCore/loader/appcache, + ../third_party/WebKit/Source/WebCore/loader/archive, + ../third_party/WebKit/Source/WebCore/loader/archive/cf, + ../third_party/WebKit/Source/WebCore/loader/archive/mhtml, + ../third_party/WebKit/Source/WebCore/loader/cache, + ../third_party/WebKit/Source/WebCore/loader/icon, + ../third_party/WebKit/Source/WebCore/mathml, + ../third_party/WebKit/Source/WebCore/notifications, + ../third_party/WebKit/Source/WebCore/page, + ../third_party/WebKit/Source/WebCore/page/animation, + ../third_party/WebKit/Source/WebCore/page/chromium, + ../third_party/WebKit/Source/WebCore/page/scrolling, + ../third_party/WebKit/Source/WebCore/platform, + ../third_party/WebKit/Source/WebCore/platform/animation, + ../third_party/WebKit/Source/WebCore/platform/audio, + ../third_party/WebKit/Source/WebCore/platform/audio/chromium, + ../third_party/WebKit/Source/WebCore/platform/chromium, + ../third_party/WebKit/Source/WebCore/platform/chromium/support, + ../third_party/WebKit/Source/WebCore/platform/graphics, + ../third_party/WebKit/Source/WebCore/platform/graphics/chromium, + ../third_party/WebKit/Source/WebCore/platform/graphics/filters, + ../third_party/WebKit/Source/WebCore/platform/graphics/filters/arm, + ../third_party/WebKit/Source/WebCore/platform/graphics/gpu, + ../third_party/WebKit/Source/WebCore/platform/graphics/opentype, + ../third_party/WebKit/Source/WebCore/platform/graphics/skia, + ../third_party/WebKit/Source/WebCore/platform/graphics/transforms, + "../third_party/WebKit/Source/WebCore/platform/image-decoders", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/bmp", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/gif", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/ico", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/jpeg", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/png", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/skia", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/webp", + "../third_party/WebKit/Source/WebCore/platform/image-encoders/skia", + ../third_party/WebKit/Source/WebCore/platform/leveldb, + ../third_party/WebKit/Source/WebCore/platform/mediastream, + ../third_party/WebKit/Source/WebCore/platform/mediastream/chromium, + ../third_party/WebKit/Source/WebCore/platform/mock, + ../third_party/WebKit/Source/WebCore/platform/network, + ../third_party/WebKit/Source/WebCore/platform/network/chromium, + ../third_party/WebKit/Source/WebCore/platform/sql, + ../third_party/WebKit/Source/WebCore/platform/text, + ../third_party/WebKit/Source/WebCore/platform/text/transcoder, + ../third_party/WebKit/Source/WebCore/plugins, + ../third_party/WebKit/Source/WebCore/plugins/chromium, + ../third_party/WebKit/Source/WebCore/rendering, + ../third_party/WebKit/Source/WebCore/rendering/style, + ../third_party/WebKit/Source/WebCore/rendering/svg, + ../third_party/WebKit/Source/WebCore/storage, + ../third_party/WebKit/Source/WebCore/storage/chromium, + ../third_party/WebKit/Source/WebCore/svg, + ../third_party/WebKit/Source/WebCore/svg/animation, + ../third_party/WebKit/Source/WebCore/svg/graphics, + ../third_party/WebKit/Source/WebCore/svg/graphics/filters, + ../third_party/WebKit/Source/WebCore/svg/properties, + ../third_party/WebKit/Source/ThirdParty/glu, + ../third_party/WebKit/Source/WebCore/workers, + ../third_party/WebKit/Source/WebCore/xml, + ../third_party/WebKit/Source/WebCore/xml/parser, + ../third_party/WebKit/Source/WebCore/platform/audio/mac, + ../third_party/WebKit/Source/WebCore/platform/cocoa, + ../third_party/WebKit/Source/WebCore/platform/graphics/cg, + ../third_party/WebKit/Source/WebCore/platform/graphics/cocoa, + ../third_party/WebKit/Source/WebCore/platform/graphics/mac, + ../third_party/WebKit/Source/WebCore/platform/mac, + ../third_party/WebKit/Source/WebCore/platform/text/mac, + ../third_party/WebKit/Source/WebCore/platform/graphics/harfbuzz, + ../third_party/WebKit/Source/WebCore/platform/graphics/harfbuzz/ng, + ../third_party/apple_webkit, + ../third_party/WebKit/Source/WebKit/mac/WebCoreSupport, + "$(SHARED_INTERMEDIATE_DIR)/webkit", + "$(SHARED_INTERMEDIATE_DIR)/webkit/bindings", + ../third_party/WebKit/Source/WTF/, + ../third_party/WebKit/Source/JavaScriptCore, + ../third_party/npapi, + ../third_party/npapi/bindings, + ../v8/include, + ); + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + PRODUCT_NAME = cef_static; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Debug; + }; + 39A28F6B600F8332458F5D57 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + INTERMEDIATE_DIR = "$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)"; + SDKROOT = macosx10.6; + SHARED_INTERMEDIATE_DIR = "$(SYMROOT)/DerivedSources/$(CONFIGURATION)"; + SYMROOT = ../xcodebuild; + }; + name = Release; + }; + 3C9F01671BED3F3FE4770C7F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"UNIT_TEST\"", + "\"GTEST_HAS_RTTI=0\"", + "\"GTEST_USE_OWN_TR1_TUPLE=1\"", + "\"U_USING_ICU_NAMESPACE=0\"", + "\"U_STATIC_IMPLEMENTATION\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + "\"_DEBUG\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ../third_party/icu/public/common, + ../third_party/icu/public/i18n, + ., + ../third_party/khronos, + .., + ../testing/gtest/include, + ); + INFOPLIST_FILE = tests/unittests/mac/Info.plist; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = cef_unittests; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + WRAPPER_PREFIX = ""; + }; + name = Debug; + }; + 447FA390B7AABFB46F3CFF10 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + "\"_DEBUG\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + tests, + ../third_party/khronos, + .., + ); + INFOPLIST_FILE = "tests/cefclient/mac/helper-Info.plist"; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = "cefclient Helper"; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + "-Wexit-time-destructors", + ); + WRAPPER_PREFIX = ""; + }; + name = Debug; + }; + 48D37D50CFEC156A8F02584E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + tests, + atom, + ../third_party/khronos, + .., + ); + INFOPLIST_FILE = tests/cefclient/mac/Info.plist; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = Atom; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + WRAPPER_PREFIX = ""; + }; + name = Release; + }; + 4911B1797B4CF1854E519A38 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + "$(SHARED_INTERMEDIATE_DIR)/webkit", + "$(SHARED_INTERMEDIATE_DIR)/content", + "$(SHARED_INTERMEDIATE_DIR)/net", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_resources", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard", + "$(SHARED_INTERMEDIATE_DIR)/cef", + ); + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + OTHER_LDFLAGS = "-Wl,-search_paths_first"; + PRODUCT_NAME = cef_pak; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Release; + }; + 495933C57FB159951816B3AB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + "\"_DEBUG\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + tests, + atom, + ../third_party/khronos, + .., + ); + INFOPLIST_FILE = tests/cefclient/mac/Info.plist; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = Atom; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + WRAPPER_PREFIX = ""; + }; + name = Debug; + }; + 4BAAF65C8238704CBAF7A70D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + OTHER_LDFLAGS = "-Wl,-search_paths_first"; + PRODUCT_NAME = cef_strings; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Debug; + }; + 4E0402305AA0A85B9CC1024F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "cef_unittests Helper"; + }; + name = Debug; + }; + 5F9D7DDEA9133A4D5B650D84 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "Run All Tests"; + }; + name = Release; + }; + 64CEF8A17C9F2BE97232BDBC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "Run All Tests"; + }; + name = Debug; + }; + 79EF47A0598EC44A455BCEC5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + tests, + ../third_party/khronos, + .., + ); + INFOPLIST_FILE = tests/cefclient/mac/Info.plist; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = cefclient; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + WRAPPER_PREFIX = ""; + }; + name = Release; + }; + 7B196ABA18B800D1C54C9801 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + OTHER_LDFLAGS = "-Wl,-search_paths_first"; + PRODUCT_NAME = cef_resources; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Release; + }; + 8DA91A22864591030822BF75 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + "\"_DEBUG\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + tests, + ../third_party/khronos, + .., + ); + INFOPLIST_FILE = "tests/cefclient/mac/helper-Info.plist"; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = "Atom Helper"; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + "-Wexit-time-destructors", + ); + WRAPPER_PREFIX = ""; + }; + name = Debug; + }; + 9362FF0A666E37006D1E8EA8 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + "\"_DEBUG\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + tests, + ../third_party/khronos, + .., + ); + INFOPLIST_FILE = tests/cefclient/mac/Info.plist; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = cefclient; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + WRAPPER_PREFIX = ""; + }; + name = Debug; + }; + 94A0D69031EE60C7C655BA8E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = cef_unittests; + }; + name = Release; + }; + 9E40E0949E7E4D608BB46236 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + "$(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_strings", + "$(SHARED_INTERMEDIATE_DIR)/webkit", + "$(SHARED_INTERMEDIATE_DIR)/cef", + ); + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + OTHER_LDFLAGS = "-Wl,-search_paths_first"; + PRODUCT_NAME = cef_locales; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Release; + }; + 9ED69BE9396DDA160FF9D394 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + EXECUTABLE_PREFIX = lib; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + "\"_DEBUG\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + ../third_party/khronos, + .., + ); + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + PRODUCT_NAME = cef_dll_wrapper; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Debug; + }; + AFCB25F61F80B8DF9C126AA6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "cef_unittests Helper"; + }; + name = Release; + }; + B323320A87D9B6ABFF9772EB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + EXECUTABLE_PREFIX = lib; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + ../third_party/khronos, + .., + ); + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + PRODUCT_NAME = cef_dll_wrapper; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Release; + }; + B346823DF1A47C5E2FD97897 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"UNIT_TEST\"", + "\"GTEST_HAS_RTTI=0\"", + "\"GTEST_USE_OWN_TR1_TUPLE=1\"", + "\"U_USING_ICU_NAMESPACE=0\"", + "\"U_STATIC_IMPLEMENTATION\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ../third_party/icu/public/common, + ../third_party/icu/public/i18n, + ., + ../third_party/khronos, + .., + ../testing/gtest/include, + ); + INFOPLIST_FILE = tests/unittests/mac/Info.plist; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = cef_unittests; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + WRAPPER_PREFIX = ""; + }; + name = Release; + }; + B6F26756C398D91FBD18A76A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = All; + }; + name = Release; + }; + BA4F904BCC839492D1D61E27 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + tests, + ../third_party/khronos, + .., + ); + INFOPLIST_FILE = "tests/cefclient/mac/helper-Info.plist"; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = "cefclient Helper"; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + "-Wexit-time-destructors", + ); + WRAPPER_PREFIX = ""; + }; + name = Release; + }; + BA58EFEB072F3EDA6FC0B639 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"UNIT_TEST\"", + "\"GTEST_HAS_RTTI=0\"", + "\"GTEST_USE_OWN_TR1_TUPLE=1\"", + "\"U_USING_ICU_NAMESPACE=0\"", + "\"U_STATIC_IMPLEMENTATION\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + "\"_DEBUG\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ../third_party/icu/public/common, + ../third_party/icu/public/i18n, + ., + ../third_party/khronos, + .., + ../testing/gtest/include, + ); + INFOPLIST_FILE = "tests/cefclient/mac/helper-Info.plist"; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = "cef_unittests Helper"; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + WRAPPER_PREFIX = ""; + }; + name = Debug; + }; + C292DF767D7DBC3A9B01F8B2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + EXECUTABLE_PREFIX = lib; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"BUILDING_CEF_SHARED\"", + "\"SK_BUILD_NO_IMAGE_ENCODE\"", + "\"GR_GL_CUSTOM_SETUP_HEADER=\\\"GrGLConfig_chrome.h\\\"\"", + "\"GR_AGGRESSIVE_SHADER_OPTS=1\"", + "\"U_USING_ICU_NAMESPACE=0\"", + "\"U_STATIC_IMPLEMENTATION\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ../third_party/icu/public/i18n, + ../third_party/icu/public/common, + ., + ../third_party/khronos, + .., + "$(SHARED_INTERMEDIATE_DIR)/content", + ../skia/config, + ../third_party/skia/include/config, + ../third_party/skia/include/core, + ../third_party/skia/include/effects, + ../third_party/skia/include/pdf, + ../third_party/skia/include/gpu, + ../third_party/skia/include/gpu/gl, + ../third_party/skia/include/ports, + ../third_party/skia/include/utils, + ../skia/ext, + ../third_party/skia/include/utils/mac, + ../third_party/npapi, + ../third_party/npapi/bindings, + ../v8/include, + ); + INSTALL_PATH = "@executable_path"; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/System/Library/Frameworks", + "$(BUILT_PRODUCTS_DIR)", + ); + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + OTHER_LDFLAGS = ( + "-Wl,-ObjC", + "-Wl,-search_paths_first", + ); + PRODUCT_NAME = cef; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Release; + }; + DA105689FBC605011197124A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + OTHER_LDFLAGS = "-Wl,-search_paths_first"; + PRODUCT_NAME = cef_resources; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Debug; + }; + DAAA25CDB0B58FF4FD22A4DC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + EXECUTABLE_PREFIX = lib; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"BUILDING_CEF_SHARED\"", + "\"SK_BUILD_NO_IMAGE_ENCODE\"", + "\"GR_GL_CUSTOM_SETUP_HEADER=\\\"GrGLConfig_chrome.h\\\"\"", + "\"GR_AGGRESSIVE_SHADER_OPTS=1\"", + "\"LIBXML_STATIC\"", + "\"U_USING_ICU_NAMESPACE=0\"", + "\"U_STATIC_IMPLEMENTATION\"", + "\"ENABLE_3D_PLUGIN=1\"", + "\"ENABLE_BATTERY_STATUS=0\"", + "\"ENABLE_BLOB=1\"", + "\"ENABLE_BLOB_SLICE=1\"", + "\"ENABLE_CHANNEL_MESSAGING=1\"", + "\"ENABLE_CSS3_FLEXBOX=1\"", + "\"ENABLE_CSS_BOX_DECORATION_BREAK=1\"", + "\"ENABLE_CSS_EXCLUSIONS=1\"", + "\"ENABLE_CSS_FILTERS=1\"", + "\"ENABLE_CSS_IMAGE_SET=1\"", + "\"ENABLE_CSS_IMAGE_RESOLUTION=0\"", + "\"ENABLE_CSS_REGIONS=1\"", + "\"ENABLE_CSS_SHADERS=1\"", + "\"ENABLE_CSS_VARIABLES=0\"", + "\"ENABLE_CUSTOM_SCHEME_HANDLER=0\"", + "\"ENABLE_DATALIST=1\"", + "\"ENABLE_DASHBOARD_SUPPORT=0\"", + "\"ENABLE_DATA_TRANSFER_ITEMS=1\"", + "\"ENABLE_DETAILS=1\"", + "\"ENABLE_DEVICE_ORIENTATION=1\"", + "\"ENABLE_DIRECTORY_UPLOAD=1\"", + "\"ENABLE_DOWNLOAD_ATTRIBUTE=1\"", + "\"ENABLE_ENCRYPTED_MEDIA=1\"", + "\"ENABLE_FILE_SYSTEM=1\"", + "\"ENABLE_FILTERS=1\"", + "\"ENABLE_FULLSCREEN_API=1\"", + "\"ENABLE_GAMEPAD=1\"", + "\"ENABLE_GEOLOCATION=1\"", + "\"ENABLE_GESTURE_EVENTS=1\"", + "\"ENABLE_ICONDATABASE=0\"", + "\"ENABLE_IFRAME_SEAMLESS=1\"", + "\"ENABLE_INDEXED_DATABASE=1\"", + "\"ENABLE_INPUT_TYPE_DATE=1\"", + "\"ENABLE_JAVASCRIPT_DEBUGGER=1\"", + "\"ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0\"", + "\"ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1\"", + "\"ENABLE_LINK_PREFETCH=1\"", + "\"ENABLE_LINK_PRERENDER=1\"", + "\"ENABLE_MEDIA_SOURCE=1\"", + "\"ENABLE_MEDIA_STATISTICS=1\"", + "\"ENABLE_METER_TAG=1\"", + "\"ENABLE_MHTML=1\"", + "\"ENABLE_MICRODATA=0\"", + "\"ENABLE_MUTATION_OBSERVERS=1\"", + "\"ENABLE_PAGE_VISIBILITY_API=1\"", + "\"ENABLE_POINTER_LOCK=1\"", + "\"ENABLE_PROGRESS_TAG=1\"", + "\"ENABLE_QUOTA=1\"", + "\"ENABLE_REGISTER_PROTOCOL_HANDLER=1\"", + "\"ENABLE_REQUEST_ANIMATION_FRAME=1\"", + "\"ENABLE_RUBY=1\"", + "\"ENABLE_SANDBOX=1\"", + "\"ENABLE_SCRIPTED_SPEECH=1\"", + "\"ENABLE_SHADOW_DOM=1\"", + "\"ENABLE_SMOOTH_SCROLLING=1\"", + "\"ENABLE_SQL_DATABASE=1\"", + "\"ENABLE_STYLE_SCOPED=1\"", + "\"ENABLE_SVG=1\"", + "\"ENABLE_SVG_FONTS=1\"", + "\"ENABLE_TOUCH_ADJUSTMENT=1\"", + "\"ENABLE_TOUCH_EVENTS=1\"", + "\"ENABLE_TOUCH_ICON_LOADING=0\"", + "\"ENABLE_V8_SCRIPT_DEBUG_SERVER=1\"", + "\"ENABLE_VIDEO=1\"", + "\"ENABLE_VIDEO_TRACK=1\"", + "\"ENABLE_VIEWPORT=1\"", + "\"ENABLE_WEBGL=1\"", + "\"ENABLE_WEB_SOCKETS=1\"", + "\"ENABLE_WEB_TIMING=1\"", + "\"ENABLE_WORKERS=1\"", + "\"ENABLE_XHR_RESPONSE_BLOB=1\"", + "\"ENABLE_XSLT=1\"", + "\"WTF_USE_LEVELDB=1\"", + "\"WTF_USE_BUILTIN_UTF8_CODEC=1\"", + "\"WTF_USE_OPENTYPE_SANITIZER=1\"", + "\"WTF_USE_RTL_SCROLLBAR=1\"", + "\"WTF_USE_SKIA_TEXT=1\"", + "\"WTF_USE_WEBP=1\"", + "\"WTF_USE_WEBKIT_IMAGE_DECODERS=1\"", + "\"ENABLE_CALENDAR_PICKER=1\"", + "\"ENABLE_FONT_BOOSTING=0\"", + "\"ENABLE_FULLSCREEN_MEDIA_CONTROLS=1\"", + "\"ENABLE_INPUT_SPEECH=1\"", + "\"ENABLE_JAVASCRIPT_I18N_API=1\"", + "\"ENABLE_LEGACY_NOTIFICATIONS=1\"", + "\"ENABLE_MEDIA_CAPTURE=0\"", + "\"ENABLE_MEDIA_STREAM=1\"", + "\"ENABLE_NOTIFICATIONS=1\"", + "\"ENABLE_ORIENTATION_EVENTS=0\"", + "\"ENABLE_OVERFLOW_SCROLLING=0\"", + "\"ENABLE_PAGE_POPUP=1\"", + "\"ENABLE_SHARED_WORKERS=1\"", + "\"ENABLE_WEB_AUDIO=1\"", + "\"ENABLE_INPUT_TYPE_COLOR=1\"", + "\"WTF_USE_ACCELERATED_COMPOSITING=1\"", + "\"ENABLE_3D_RENDERING=1\"", + "\"ENABLE_ACCELERATED_2D_CANVAS=1\"", + "\"ENABLE_RUBBER_BANDING=1\"", + "\"WTF_USE_SKIA_ON_MAC_CHROMIUM=1\"", + "\"BUILDING_CHROMIUM__=1\"", + "\"USE_SYSTEM_MALLOC=1\"", + "\"WTF_USE_NEW_THEME=1\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ../third_party/icu/public/i18n, + ../third_party/icu/public/common, + ., + ../third_party/WebKit/Source/WebKit/chromium/public, + "$(SHARED_INTERMEDIATE_DIR)/cef", + ../third_party/khronos, + .., + "$(SHARED_INTERMEDIATE_DIR)/content", + ../skia/config, + ../third_party/skia/include/config, + ../third_party/skia/include/core, + ../third_party/skia/include/effects, + ../third_party/skia/include/pdf, + ../third_party/skia/include/gpu, + ../third_party/skia/include/gpu/gl, + ../third_party/skia/include/ports, + ../third_party/skia/include/utils, + ../skia/ext, + ../third_party/skia/include/utils/mac, + ../third_party/libxml/mac/include, + ../third_party/libxml/src/include, + ../third_party/WebKit/Source/WebCore/, + ../third_party/WebKit/Source, + ../third_party/WebKit/Source/WebCore/Modules/battery, + ../third_party/WebKit/Source/WebCore/Modules/filesystem, + ../third_party/WebKit/Source/WebCore/Modules/filesystem/chromium, + ../third_party/WebKit/Source/WebCore/Modules/gamepad, + ../third_party/WebKit/Source/WebCore/Modules/geolocation, + ../third_party/WebKit/Source/WebCore/Modules/intents, + ../third_party/WebKit/Source/WebCore/Modules/indexeddb, + ../third_party/WebKit/Source/WebCore/Modules/mediastream, + ../third_party/WebKit/Source/WebCore/Modules/quota, + ../third_party/WebKit/Source/WebCore/Modules/speech, + ../third_party/WebKit/Source/WebCore/Modules/webaudio, + ../third_party/WebKit/Source/WebCore/Modules/webdatabase, + ../third_party/WebKit/Source/WebCore/Modules/webdatabase/chromium, + ../third_party/WebKit/Source/WebCore/Modules/websockets, + ../third_party/WebKit/Source/WebCore/accessibility, + ../third_party/WebKit/Source/WebCore/accessibility/chromium, + ../third_party/WebKit/Source/WebCore/bindings, + ../third_party/WebKit/Source/WebCore/bindings/generic, + ../third_party/WebKit/Source/WebCore/bindings/v8, + ../third_party/WebKit/Source/WebCore/bindings/v8/custom, + ../third_party/WebKit/Source/WebCore/bindings/v8/specialization, + ../third_party/WebKit/Source/WebCore/bridge, + ../third_party/WebKit/Source/WebCore/bridge/jni, + ../third_party/WebKit/Source/WebCore/bridge/jni/v8, + ../third_party/WebKit/Source/WebCore/css, + ../third_party/WebKit/Source/WebCore/dom, + ../third_party/WebKit/Source/WebCore/dom/default, + ../third_party/WebKit/Source/WebCore/editing, + ../third_party/WebKit/Source/WebCore/fileapi, + ../third_party/WebKit/Source/WebCore/history, + ../third_party/WebKit/Source/WebCore/html, + ../third_party/WebKit/Source/WebCore/html/canvas, + ../third_party/WebKit/Source/WebCore/html/parser, + ../third_party/WebKit/Source/WebCore/html/shadow, + ../third_party/WebKit/Source/WebCore/html/track, + ../third_party/WebKit/Source/WebCore/inspector, + ../third_party/WebKit/Source/WebCore/loader, + ../third_party/WebKit/Source/WebCore/loader/appcache, + ../third_party/WebKit/Source/WebCore/loader/archive, + ../third_party/WebKit/Source/WebCore/loader/archive/cf, + ../third_party/WebKit/Source/WebCore/loader/archive/mhtml, + ../third_party/WebKit/Source/WebCore/loader/cache, + ../third_party/WebKit/Source/WebCore/loader/icon, + ../third_party/WebKit/Source/WebCore/mathml, + ../third_party/WebKit/Source/WebCore/notifications, + ../third_party/WebKit/Source/WebCore/page, + ../third_party/WebKit/Source/WebCore/page/animation, + ../third_party/WebKit/Source/WebCore/page/chromium, + ../third_party/WebKit/Source/WebCore/page/scrolling, + ../third_party/WebKit/Source/WebCore/platform, + ../third_party/WebKit/Source/WebCore/platform/animation, + ../third_party/WebKit/Source/WebCore/platform/audio, + ../third_party/WebKit/Source/WebCore/platform/audio/chromium, + ../third_party/WebKit/Source/WebCore/platform/chromium, + ../third_party/WebKit/Source/WebCore/platform/chromium/support, + ../third_party/WebKit/Source/WebCore/platform/graphics, + ../third_party/WebKit/Source/WebCore/platform/graphics/chromium, + ../third_party/WebKit/Source/WebCore/platform/graphics/filters, + ../third_party/WebKit/Source/WebCore/platform/graphics/filters/arm, + ../third_party/WebKit/Source/WebCore/platform/graphics/gpu, + ../third_party/WebKit/Source/WebCore/platform/graphics/opentype, + ../third_party/WebKit/Source/WebCore/platform/graphics/skia, + ../third_party/WebKit/Source/WebCore/platform/graphics/transforms, + "../third_party/WebKit/Source/WebCore/platform/image-decoders", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/bmp", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/gif", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/ico", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/jpeg", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/png", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/skia", + "../third_party/WebKit/Source/WebCore/platform/image-decoders/webp", + "../third_party/WebKit/Source/WebCore/platform/image-encoders/skia", + ../third_party/WebKit/Source/WebCore/platform/leveldb, + ../third_party/WebKit/Source/WebCore/platform/mediastream, + ../third_party/WebKit/Source/WebCore/platform/mediastream/chromium, + ../third_party/WebKit/Source/WebCore/platform/mock, + ../third_party/WebKit/Source/WebCore/platform/network, + ../third_party/WebKit/Source/WebCore/platform/network/chromium, + ../third_party/WebKit/Source/WebCore/platform/sql, + ../third_party/WebKit/Source/WebCore/platform/text, + ../third_party/WebKit/Source/WebCore/platform/text/transcoder, + ../third_party/WebKit/Source/WebCore/plugins, + ../third_party/WebKit/Source/WebCore/plugins/chromium, + ../third_party/WebKit/Source/WebCore/rendering, + ../third_party/WebKit/Source/WebCore/rendering/style, + ../third_party/WebKit/Source/WebCore/rendering/svg, + ../third_party/WebKit/Source/WebCore/storage, + ../third_party/WebKit/Source/WebCore/storage/chromium, + ../third_party/WebKit/Source/WebCore/svg, + ../third_party/WebKit/Source/WebCore/svg/animation, + ../third_party/WebKit/Source/WebCore/svg/graphics, + ../third_party/WebKit/Source/WebCore/svg/graphics/filters, + ../third_party/WebKit/Source/WebCore/svg/properties, + ../third_party/WebKit/Source/ThirdParty/glu, + ../third_party/WebKit/Source/WebCore/workers, + ../third_party/WebKit/Source/WebCore/xml, + ../third_party/WebKit/Source/WebCore/xml/parser, + ../third_party/WebKit/Source/WebCore/platform/audio/mac, + ../third_party/WebKit/Source/WebCore/platform/cocoa, + ../third_party/WebKit/Source/WebCore/platform/graphics/cg, + ../third_party/WebKit/Source/WebCore/platform/graphics/cocoa, + ../third_party/WebKit/Source/WebCore/platform/graphics/mac, + ../third_party/WebKit/Source/WebCore/platform/mac, + ../third_party/WebKit/Source/WebCore/platform/text/mac, + ../third_party/WebKit/Source/WebCore/platform/graphics/harfbuzz, + ../third_party/WebKit/Source/WebCore/platform/graphics/harfbuzz/ng, + ../third_party/apple_webkit, + ../third_party/WebKit/Source/WebKit/mac/WebCoreSupport, + "$(SHARED_INTERMEDIATE_DIR)/webkit", + "$(SHARED_INTERMEDIATE_DIR)/webkit/bindings", + ../third_party/WebKit/Source/WTF/, + ../third_party/WebKit/Source/JavaScriptCore, + ../third_party/npapi, + ../third_party/npapi/bindings, + ../v8/include, + ); + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + PRODUCT_NAME = cef_static; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Release; + }; + ED2F2FA63588A86CCBF34C2A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + COPY_PHASE_STRIP = NO; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"__STDC_FORMAT_MACROS\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=1\"", + "\"WTF_USE_DYNAMIC_ANNOTATIONS=1\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + "$(SHARED_INTERMEDIATE_DIR)/webkit", + "$(SHARED_INTERMEDIATE_DIR)/content", + "$(SHARED_INTERMEDIATE_DIR)/net", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_resources", + "$(SHARED_INTERMEDIATE_DIR)/ui/ui_resources_standard", + "$(SHARED_INTERMEDIATE_DIR)/cef", + ); + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = ( + "-fno-strict-aliasing", + "-fstack-protector-all", + ); + OTHER_LDFLAGS = "-Wl,-search_paths_first"; + PRODUCT_NAME = cef_pak; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Debug; + }; + EFE1A56136EEB0B6CE0DEE03 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = cef_unittests; + }; + name = Debug; + }; + F9DBB8CFF74B9A46B526FA50 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + OTHER_LDFLAGS = "-Wl,-search_paths_first"; + PRODUCT_NAME = cef_strings; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + ); + }; + name = Release; + }; + FAEBF57F5E49ADC357189D53 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CC = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang"; + CLANG_WARN_CXX0X_EXTENSIONS = NO; + DEAD_CODE_STRIPPING = YES; + GCC_CW_ASM_SYNTAX = NO; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_PASCAL_STRINGS = NO; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_OBJC_CALL_CXX_CDTORS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "\"CHROMIUM_BUILD\"", + "\"ENABLE_ONE_CLICK_SIGNIN\"", + "\"ENABLE_REMOTING=1\"", + "\"ENABLE_WEBRTC=1\"", + "\"ENABLE_CONFIGURATION_POLICY\"", + "\"ENABLE_INPUT_SPEECH\"", + "\"ENABLE_NOTIFICATIONS\"", + "\"ENABLE_HIDPI=1\"", + "\"ENABLE_GPU=1\"", + "\"ENABLE_EGLIMAGE=1\"", + "\"USE_SKIA=1\"", + "\"ENABLE_TASK_MANAGER=1\"", + "\"ENABLE_WEB_INTENTS=1\"", + "\"ENABLE_EXTENSIONS=1\"", + "\"ENABLE_PLUGIN_INSTALLATION=1\"", + "\"ENABLE_PROTECTOR_SERVICE=1\"", + "\"ENABLE_SESSION_SERVICE=1\"", + "\"ENABLE_THEMES=1\"", + "\"ENABLE_BACKGROUND=1\"", + "\"ENABLE_PROMO_RESOURCE_SERVICE=1\"", + "\"ENABLE_AUTOMATION=1\"", + "\"ENABLE_PRINTING=1\"", + "\"ENABLE_CAPTIVE_PORTAL_DETECTION=1\"", + "\"USING_CEF_SHARED\"", + "\"__STDC_FORMAT_MACROS\"", + "\"NDEBUG\"", + "\"NVALGRIND\"", + "\"DYNAMIC_ANNOTATIONS_ENABLED=0\"", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + GCC_THREADSAFE_STATICS = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + HEADER_SEARCH_PATHS = ( + ., + tests, + ../third_party/khronos, + .., + ); + INFOPLIST_FILE = "tests/cefclient/mac/helper-Info.plist"; + LDPLUSPLUS = "$(SOURCE_ROOT)/../third_party/llvm-build/Release+Asserts/bin/clang++"; + LIBRARY_SEARCH_PATHS = "$(SDKROOT)/System/Library/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.5; + OTHER_CFLAGS = "-fno-strict-aliasing"; + OTHER_LDFLAGS = ( + "-Wl,-headerpad_max_install_names", + "-Wl,-search_paths_first", + "-Wl,-ObjC", + "-Wl,-pie", + ); + PRODUCT_NAME = "Atom Helper"; + SHARED_PRECOMPS_DIR = "$(CONFIGURATION_BUILD_DIR)/SharedPrecompiledHeaders"; + USE_HEADERMAP = NO; + WARNING_CFLAGS = ( + "-Wall", + "-Wendif-labels", + "-Wextra", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wheader-hygiene", + "-Wno-char-subscripts", + "-Wno-unused-function", + "-Wno-unnamed-type-template-args", + "-Wno-c++11-extensions", + "-Wno-covered-switch-default", + "-Wexit-time-destructors", + ); + WRAPPER_PREFIX = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1174878B18A3C3D3A426A10D /* Build configuration list for PBXNativeTarget "Atom" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 495933C57FB159951816B3AB /* Debug */, + 48D37D50CFEC156A8F02584E /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 20C2C8546A145CE8C269BB10 /* Build configuration list for PBXAggregateTarget "cef_locales" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0CA785BAC652A740FEDD3EEA /* Debug */, + 9E40E0949E7E4D608BB46236 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 3C1ACB3AF7F069E5CDF14E2C /* Build configuration list for PBXNativeTarget "AtomHelperApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8DA91A22864591030822BF75 /* Debug */, + FAEBF57F5E49ADC357189D53 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 5233A6F99A37C5BA2605AF11 /* Build configuration list for PBXAggregateTarget "cef_strings" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4BAAF65C8238704CBAF7A70D /* Debug */, + F9DBB8CFF74B9A46B526FA50 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 6BE12BAEC226B0826AF78434 /* Build configuration list for PBXNativeTarget "libcef_dll_wrapper" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9ED69BE9396DDA160FF9D394 /* Debug */, + B323320A87D9B6ABFF9772EB /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 705B3EDF846FDFBBD2B42764 /* Build configuration list for PBXProject "cef" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1EA5CC4C789D20059C96ED45 /* Debug */, + 39A28F6B600F8332458F5D57 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 7203AE8FFBEC111ABE94E8C0 /* Build configuration list for PBXAggregateTarget "cef_resources" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DA105689FBC605011197124A /* Debug */, + 7B196ABA18B800D1C54C9801 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 86C662A5BDD8770B165021CD /* Build configuration list for PBXNativeTarget "libcef" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0B11CAE87B86BCDA1071EFFF /* Debug */, + C292DF767D7DBC3A9B01F8B2 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 86D8C52813B1CC34CBABF3CC /* Build configuration list for PBXAggregateTarget "Run cef_unittests_helper_app" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4E0402305AA0A85B9CC1024F /* Debug */, + AFCB25F61F80B8DF9C126AA6 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 9368946EEA5D018D56087305 /* Build configuration list for PBXNativeTarget "cef_unittests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3C9F01671BED3F3FE4770C7F /* Debug */, + B346823DF1A47C5E2FD97897 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + 94333E7E4BA1B40A7AC0BC4F /* Build configuration list for PBXAggregateTarget "Run cef_unittests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + EFE1A56136EEB0B6CE0DEE03 /* Debug */, + 94A0D69031EE60C7C655BA8E /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + A55C7DEA6FC020BE2C1C1D74 /* Build configuration list for PBXAggregateTarget "Run All Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 64CEF8A17C9F2BE97232BDBC /* Debug */, + 5F9D7DDEA9133A4D5B650D84 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + C55EAE453ACD4BF4839354A4 /* Build configuration list for PBXNativeTarget "cef_unittests_helper_app" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BA58EFEB072F3EDA6FC0B639 /* Debug */, + 1F2B12072EFE0FB85B1D218B /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + C86F3A4B24F8B2B0B678FE87 /* Build configuration list for PBXAggregateTarget "cef_pak" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ED2F2FA63588A86CCBF34C2A /* Debug */, + 4911B1797B4CF1854E519A38 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + D100EFEBA06BEEA1A3F6A346 /* Build configuration list for PBXAggregateTarget "All" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1FEC448F6319CE585410BF7D /* Debug */, + B6F26756C398D91FBD18A76A /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + DC1D5F02BEA3B133DF72CAA5 /* Build configuration list for PBXNativeTarget "cefclient_helper_app" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 447FA390B7AABFB46F3CFF10 /* Debug */, + BA4F904BCC839492D1D61E27 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + DC556C973BE9072C58775672 /* Build configuration list for PBXNativeTarget "libcef_static" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 388EAAEB77349E4A43824356 /* Debug */, + DAAA25CDB0B58FF4FD22A4DC /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; + F8BE8D5B24FBDFFAE459ADFB /* Build configuration list for PBXNativeTarget "cefclient" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9362FF0A666E37006D1E8EA8 /* Debug */, + 79EF47A0598EC44A455BCEC5 /* Release */, + ); + defaultConfigurationIsVisible = 1; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = C2F20C4F45FBF5D7ACC93412 /* Project object */; +} diff --git a/cef/cef.pak b/cef/cef.pak new file mode 100644 index 000000000..5029411e5 Binary files /dev/null and b/cef/cef.pak differ diff --git a/cef/ffmpegsumo.so b/cef/ffmpegsumo.so new file mode 100755 index 000000000..d8f5826d5 Binary files /dev/null and b/cef/ffmpegsumo.so differ diff --git a/cef/include/capi/cef_app_capi.h b/cef/include/capi/cef_app_capi.h deleted file mode 100644 index 8741966d6..000000000 --- a/cef/include/capi/cef_app_capi.h +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// This function should be called on the main application thread to initialize -// CEF when the application is started. The |application| parameter may be NULL. -// A return value of true (1) indicates that it succeeded and false (0) -// indicates that it failed. -/// -CEF_EXPORT int cef_initialize(const struct _cef_settings_t* settings, - struct _cef_app_t* application); - -/// -// This function should be called on the main application thread to shut down -// CEF before the application exits. -/// -CEF_EXPORT void cef_shutdown(); - -/// -// Perform a single iteration of CEF message loop processing. This function is -// used to integrate the CEF message loop into an existing application message -// loop. Care must be taken to balance performance against excessive CPU usage. -// This function should only be called on the main application thread and only -// if cef_initialize() is called with a CefSettings.multi_threaded_message_loop -// value of false (0). This function will not block. -/// -CEF_EXPORT void cef_do_message_loop_work(); - -/// -// Run the CEF message loop. Use this function instead of an application- -// provided message loop to get the best balance between performance and CPU -// usage. This function should only be called on the main application thread and -// only if cef_initialize() is called with a -// CefSettings.multi_threaded_message_loop value of false (0). This function -// will block until a quit message is received by the system. -/// -CEF_EXPORT void cef_run_message_loop(); - -/// -// Quit the CEF message loop that was started by calling cef_run_message_loop(). -// This function should only be called on the main application thread and only -// if cef_run_message_loop() was used. -/// -CEF_EXPORT void cef_quit_message_loop(); - -/// -// Implement this structure to provide handler implementations. Methods will be -// called on the thread indicated. -/// -typedef struct _cef_app_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Return the handler for resource bundle events. If - // CefSettings.pack_loading_disabled is true (1) a handler must be returned. - // If no handler is returned resources will be loaded from pack files. This - // function is called on multiple threads. - /// - struct _cef_resource_bundle_handler_t* ( - CEF_CALLBACK *get_resource_bundle_handler)(struct _cef_app_t* self); - - /// - // Return the handler for proxy events. If not handler is returned the default - // system handler will be used. This function is called on the IO thread. - /// - struct _cef_proxy_handler_t* (CEF_CALLBACK *get_proxy_handler)( - struct _cef_app_t* self); -} cef_app_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_ diff --git a/cef/include/capi/cef_browser_capi.h b/cef/include/capi/cef_browser_capi.h deleted file mode 100644 index eccb3f3e9..000000000 --- a/cef/include/capi/cef_browser_capi.h +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Structure used to represent a browser window. The functions of this structure -// may be called on any thread unless otherwise indicated in the comments. -/// -typedef struct _cef_browser_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Call this function before destroying a contained browser window. This - // function performs any internal cleanup that may be needed before the - // browser window is destroyed. - /// - void (CEF_CALLBACK *parent_window_will_close)(struct _cef_browser_t* self); - - /// - // Closes this browser window. - /// - void (CEF_CALLBACK *close_browser)(struct _cef_browser_t* self); - - /// - // Returns true (1) if the browser can navigate backwards. - /// - int (CEF_CALLBACK *can_go_back)(struct _cef_browser_t* self); - - /// - // Navigate backwards. - /// - void (CEF_CALLBACK *go_back)(struct _cef_browser_t* self); - - /// - // Returns true (1) if the browser can navigate forwards. - /// - int (CEF_CALLBACK *can_go_forward)(struct _cef_browser_t* self); - - /// - // Navigate forwards. - /// - void (CEF_CALLBACK *go_forward)(struct _cef_browser_t* self); - - /// - // Reload the current page. - /// - void (CEF_CALLBACK *reload)(struct _cef_browser_t* self); - - /// - // Reload the current page ignoring any cached data. - /// - void (CEF_CALLBACK *reload_ignore_cache)(struct _cef_browser_t* self); - - /// - // Stop loading the page. - /// - void (CEF_CALLBACK *stop_load)(struct _cef_browser_t* self); - - /// - // Set focus for the browser window. If |enable| is true (1) focus will be set - // to the window. Otherwise, focus will be removed. - /// - void (CEF_CALLBACK *set_focus)(struct _cef_browser_t* self, int enable); - - /// - // Retrieve the window handle for this browser. - /// - cef_window_handle_t (CEF_CALLBACK *get_window_handle)( - struct _cef_browser_t* self); - - /// - // Retrieve the window handle of the browser that opened this browser. Will - // return NULL for non-popup windows. This function can be used in combination - // with custom handling of modal windows. - /// - cef_window_handle_t (CEF_CALLBACK *get_opener_window_handle)( - struct _cef_browser_t* self); - - /// - // Returns true (1) if the window is a popup window. - /// - int (CEF_CALLBACK *is_popup)(struct _cef_browser_t* self); - - // Returns true (1) if a document has been loaded in the browser. - int (CEF_CALLBACK *has_document)(struct _cef_browser_t* self); - - /// - // Returns the client for this browser. - /// - struct _cef_client_t* (CEF_CALLBACK *get_client)(struct _cef_browser_t* self); - - /// - // Returns the main (top-level) frame for the browser window. - /// - struct _cef_frame_t* (CEF_CALLBACK *get_main_frame)( - struct _cef_browser_t* self); - - /// - // Returns the focused frame for the browser window. This function should only - // be called on the UI thread. - /// - struct _cef_frame_t* (CEF_CALLBACK *get_focused_frame)( - struct _cef_browser_t* self); - - /// - // Returns the frame with the specified name, or NULL if not found. This - // function should only be called on the UI thread. - /// - struct _cef_frame_t* (CEF_CALLBACK *get_frame)(struct _cef_browser_t* self, - const cef_string_t* name); - - /// - // Returns the names of all existing frames. This function should only be - // called on the UI thread. - /// - void (CEF_CALLBACK *get_frame_names)(struct _cef_browser_t* self, - cef_string_list_t names); - - /// - // Search for |searchText|. |identifier| can be used to have multiple searches - // running simultaniously. |forward| indicates whether to search forward or - // backward within the page. |matchCase| indicates whether the search should - // be case-sensitive. |findNext| indicates whether this is the first request - // or a follow-up. - /// - void (CEF_CALLBACK *find)(struct _cef_browser_t* self, int identifier, - const cef_string_t* searchText, int forward, int matchCase, - int findNext); - - /// - // Cancel all searches that are currently going on. - /// - void (CEF_CALLBACK *stop_finding)(struct _cef_browser_t* self, - int clearSelection); - - /// - // Get the zoom level. - /// - double (CEF_CALLBACK *get_zoom_level)(struct _cef_browser_t* self); - - /// - // Change the zoom level to the specified value. - /// - void (CEF_CALLBACK *set_zoom_level)(struct _cef_browser_t* self, - double zoomLevel); - - /// - // Clear the back/forward browsing history. - /// - void (CEF_CALLBACK *clear_history)(struct _cef_browser_t* self); - - /// - // Open developer tools in its own window. - /// - void (CEF_CALLBACK *show_dev_tools)(struct _cef_browser_t* self); - - /// - // Explicitly close the developer tools window if one exists for this browser - // instance. - /// - void (CEF_CALLBACK *close_dev_tools)(struct _cef_browser_t* self); - - /// - // Returns true (1) if window rendering is disabled. - /// - int (CEF_CALLBACK *is_window_rendering_disabled)(struct _cef_browser_t* self); - - /// - // Get the size of the specified element. This function should only be called - // on the UI thread. - /// - int (CEF_CALLBACK *get_size)(struct _cef_browser_t* self, - enum cef_paint_element_type_t type, int* width, int* height); - - /// - // Set the size of the specified element. This function is only used when - // window rendering is disabled. - /// - void (CEF_CALLBACK *set_size)(struct _cef_browser_t* self, - enum cef_paint_element_type_t type, int width, int height); - - /// - // Returns true (1) if a popup is currently visible. This function should only - // be called on the UI thread. - /// - int (CEF_CALLBACK *is_popup_visible)(struct _cef_browser_t* self); - - /// - // Hide the currently visible popup, if any. - /// - void (CEF_CALLBACK *hide_popup)(struct _cef_browser_t* self); - - /// - // Invalidate the |dirtyRect| region of the view. This function is only used - // when window rendering is disabled and will result in a call to - // HandlePaint(). - /// - void (CEF_CALLBACK *invalidate)(struct _cef_browser_t* self, - const cef_rect_t* dirtyRect); - - /// - // Get the raw image data contained in the specified element without - // performing validation. The specified |width| and |height| dimensions must - // match the current element size. On Windows |buffer| must be width*height*4 - // bytes in size and represents a BGRA image with an upper-left origin. This - // function should only be called on the UI thread. - /// - int (CEF_CALLBACK *get_image)(struct _cef_browser_t* self, - enum cef_paint_element_type_t type, int width, int height, - void* buffer); - - /// - // Send a key event to the browser. - /// - void (CEF_CALLBACK *send_key_event)(struct _cef_browser_t* self, - enum cef_key_type_t type, const struct _cef_key_info_t* keyInfo, - int modifiers); - - /// - // Send a mouse click event to the browser. The |x| and |y| coordinates are - // relative to the upper-left corner of the view. - /// - void (CEF_CALLBACK *send_mouse_click_event)(struct _cef_browser_t* self, - int x, int y, enum cef_mouse_button_type_t type, int mouseUp, - int clickCount); - - /// - // Send a mouse move event to the browser. The |x| and |y| coordinates are - // relative to the upper-left corner of the view. - /// - void (CEF_CALLBACK *send_mouse_move_event)(struct _cef_browser_t* self, int x, - int y, int mouseLeave); - - /// - // Send a mouse wheel event to the browser. The |x| and |y| coordinates are - // relative to the upper-left corner of the view. The |deltaX| and |deltaY| - // values represent the movement delta in the X and Y directions respectively. - /// - void (CEF_CALLBACK *send_mouse_wheel_event)(struct _cef_browser_t* self, - int x, int y, int deltaX, int deltaY); - - /// - // Send a focus event to the browser. - /// - void (CEF_CALLBACK *send_focus_event)(struct _cef_browser_t* self, - int setFocus); - - /// - // Send a capture lost event to the browser. - /// - void (CEF_CALLBACK *send_capture_lost_event)(struct _cef_browser_t* self); -} cef_browser_t; - - -/// -// Create a new browser window using the window parameters specified by -// |windowInfo|. All values will be copied internally and the actual window will -// be created on the UI thread. This function call will not block. -/// -CEF_EXPORT int cef_browser_create(cef_window_info_t* windowInfo, - struct _cef_client_t* client, const cef_string_t* url, - const struct _cef_browser_settings_t* settings); - -/// -// Create a new browser window using the window parameters specified by -// |windowInfo|. This function should only be called on the UI thread. -/// -CEF_EXPORT cef_browser_t* cef_browser_create_sync(cef_window_info_t* windowInfo, - struct _cef_client_t* client, const cef_string_t* url, - const struct _cef_browser_settings_t* settings); - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ diff --git a/cef/include/capi/cef_content_filter_capi.h b/cef/include/capi/cef_content_filter_capi.h deleted file mode 100644 index e9ed878a4..000000000 --- a/cef/include/capi/cef_content_filter_capi.h +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_CONTENT_FILTER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_CONTENT_FILTER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Structure to implement for filtering response content. The functions of this -// structure will always be called on the UI thread. -/// -typedef struct _cef_content_filter_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Set |substitute_data| to the replacement for the data in |data| if data - // should be modified. - /// - void (CEF_CALLBACK *process_data)(struct _cef_content_filter_t* self, - const void* data, int data_size, - struct _cef_stream_reader_t** substitute_data); - - /// - // Called when there is no more data to be processed. It is expected that - // whatever data was retained in the last process_data() call, it should be - // returned now by setting |remainder| if appropriate. - /// - void (CEF_CALLBACK *drain)(struct _cef_content_filter_t* self, - struct _cef_stream_reader_t** remainder); -} cef_content_filter_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_CONTENT_FILTER_CAPI_H_ diff --git a/cef/include/capi/cef_download_handler_capi.h b/cef/include/capi/cef_download_handler_capi.h deleted file mode 100644 index 50f1f4bd1..000000000 --- a/cef/include/capi/cef_download_handler_capi.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Structure used to handle file downloads. The functions of this structure will -// always be called on the UI thread. -/// -typedef struct _cef_download_handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // A portion of the file contents have been received. This function will be - // called multiple times until the download is complete. Return |true (1)| to - // continue receiving data and |false (0)| to cancel. - /// - int (CEF_CALLBACK *received_data)(struct _cef_download_handler_t* self, - void* data, int data_size); - - /// - // The download is complete. - /// - void (CEF_CALLBACK *complete)(struct _cef_download_handler_t* self); -} cef_download_handler_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_drag_data_capi.h b/cef/include/capi/cef_drag_data_capi.h deleted file mode 100644 index f2fff0d97..000000000 --- a/cef/include/capi/cef_drag_data_capi.h +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Structure used to represent drag data. The functions of this structure may be -// called on any thread. -/// -typedef struct _cef_drag_data_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Returns true (1) if the drag data is a link. - /// - int (CEF_CALLBACK *is_link)(struct _cef_drag_data_t* self); - - /// - // Returns true (1) if the drag data is a text or html fragment. - /// - int (CEF_CALLBACK *is_fragment)(struct _cef_drag_data_t* self); - - /// - // Returns true (1) if the drag data is a file. - /// - int (CEF_CALLBACK *is_file)(struct _cef_drag_data_t* self); - - /// - // Return the link URL that is being dragged. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_link_url)( - struct _cef_drag_data_t* self); - - /// - // Return the title associated with the link being dragged. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_link_title)( - struct _cef_drag_data_t* self); - - /// - // Return the metadata, if any, associated with the link being dragged. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_link_metadata)( - struct _cef_drag_data_t* self); - - /// - // Return the plain text fragment that is being dragged. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_fragment_text)( - struct _cef_drag_data_t* self); - - /// - // Return the text/html fragment that is being dragged. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_fragment_html)( - struct _cef_drag_data_t* self); - - /// - // Return the base URL that the fragment came from. This value is used for - // resolving relative URLs and may be NULL. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_fragment_base_url)( - struct _cef_drag_data_t* self); - - /// - // Return the extension of the file being dragged out of the browser window. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_file_extension)( - struct _cef_drag_data_t* self); - - /// - // Return the name of the file being dragged out of the browser window. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_file_name)( - struct _cef_drag_data_t* self); - - /// - // Retrieve the list of file names that are being dragged into the browser - // window. - /// - int (CEF_CALLBACK *get_file_names)(struct _cef_drag_data_t* self, - cef_string_list_t names); -} cef_drag_data_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ diff --git a/cef/include/capi/cef_drag_handler_capi.h b/cef/include/capi/cef_drag_handler_capi.h deleted file mode 100644 index 8e74f3586..000000000 --- a/cef/include/capi/cef_drag_handler_capi.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Implement this structure to handle events related to dragging. The functions -// of this structure will be called on the UI thread. -/// -typedef struct _cef_drag_handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Called when the browser window initiates a drag event. |dragData| contains - // the drag event data and |mask| represents the type of drag operation. - // Return false (0) for default drag handling behavior or true (1) to cancel - // the drag event. - /// - int (CEF_CALLBACK *on_drag_start)(struct _cef_drag_handler_t* self, - struct _cef_browser_t* browser, struct _cef_drag_data_t* dragData, - enum cef_drag_operations_mask_t mask); - - /// - // Called when an external drag event enters the browser window. |dragData| - // contains the drag event data and |mask| represents the type of drag - // operation. Return false (0) for default drag handling behavior or true (1) - // to cancel the drag event. - /// - int (CEF_CALLBACK *on_drag_enter)(struct _cef_drag_handler_t* self, - struct _cef_browser_t* browser, struct _cef_drag_data_t* dragData, - enum cef_drag_operations_mask_t mask); -} cef_drag_handler_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_find_handler_capi.h b/cef/include/capi/cef_find_handler_capi.h deleted file mode 100644 index b729bd1e3..000000000 --- a/cef/include/capi/cef_find_handler_capi.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_FIND_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_FIND_HANDLER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Implement this structure to handle events related to find results. The -// functions of this structure will be called on the UI thread. -/// -typedef struct _cef_find_handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Called to report find results returned by cef_browser_t::find(). - // |identifer| is the identifier passed to cef_browser_t::find(), |count| is - // the number of matches currently identified, |selectionRect| is the location - // of where the match was found (in window coordinates), |activeMatchOrdinal| - // is the current position in the search results, and |finalUpdate| is true - // (1) if this is the last find notification. - /// - void (CEF_CALLBACK *on_find_result)(struct _cef_find_handler_t* self, - struct _cef_browser_t* browser, int identifier, int count, - const cef_rect_t* selectionRect, int activeMatchOrdinal, - int finalUpdate); -} cef_find_handler_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_FIND_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_jsdialog_handler_capi.h b/cef/include/capi/cef_jsdialog_handler_capi.h deleted file mode 100644 index 36ed63ef4..000000000 --- a/cef/include/capi/cef_jsdialog_handler_capi.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_JSDIALOG_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_JSDIALOG_HANDLER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Implement this structure to handle events related to JavaScript dialogs. The -// functions of this structure will be called on the UI thread. -/// -typedef struct _cef_jsdialog_handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Called to run a JavaScript alert message. Return false (0) to display the - // default alert or true (1) if you displayed a custom alert. - /// - int (CEF_CALLBACK *on_jsalert)(struct _cef_jsdialog_handler_t* self, - struct _cef_browser_t* browser, struct _cef_frame_t* frame, - const cef_string_t* message); - - /// - // Called to run a JavaScript confirm request. Return false (0) to display the - // default alert or true (1) if you displayed a custom alert. If you handled - // the alert set |retval| to true (1) if the user accepted the confirmation. - /// - int (CEF_CALLBACK *on_jsconfirm)(struct _cef_jsdialog_handler_t* self, - struct _cef_browser_t* browser, struct _cef_frame_t* frame, - const cef_string_t* message, int* retval); - - /// - // Called to run a JavaScript prompt request. Return false (0) to display the - // default prompt or true (1) if you displayed a custom prompt. If you handled - // the prompt set |retval| to true (1) if the user accepted the prompt and - // request and |result| to the resulting value. - /// - int (CEF_CALLBACK *on_jsprompt)(struct _cef_jsdialog_handler_t* self, - struct _cef_browser_t* browser, struct _cef_frame_t* frame, - const cef_string_t* message, const cef_string_t* defaultValue, - int* retval, cef_string_t* result); -} cef_jsdialog_handler_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_JSDIALOG_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_keyboard_handler_capi.h b/cef/include/capi/cef_keyboard_handler_capi.h deleted file mode 100644 index ff96b3312..000000000 --- a/cef/include/capi/cef_keyboard_handler_capi.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_KEYBOARD_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_KEYBOARD_HANDLER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Implement this structure to handle events related to keyboard input. The -// functions of this structure will be called on the UI thread. -/// -typedef struct _cef_keyboard_handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Called when the browser component receives a keyboard event. This function - // is called both before the event is passed to the renderer and after - // JavaScript in the page has had a chance to handle the event. |type| is the - // type of keyboard event, |code| is the windows scan-code for the event, - // |modifiers| is a set of bit- flags describing any pressed modifier keys and - // |isSystemKey| is true (1) if Windows considers this a 'system key' message - // (see http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx). If - // |isAfterJavaScript| is true (1) then JavaScript in the page has had a - // chance to handle the event and has chosen not to. Only RAWKEYDOWN, KEYDOWN - // and CHAR events will be sent with |isAfterJavaScript| set to true (1). - // Return true (1) if the keyboard event was handled or false (0) to allow - // continued handling of the event by the renderer. - /// - int (CEF_CALLBACK *on_key_event)(struct _cef_keyboard_handler_t* self, - struct _cef_browser_t* browser, enum cef_handler_keyevent_type_t type, - int code, int modifiers, int isSystemKey, int isAfterJavaScript); -} cef_keyboard_handler_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_KEYBOARD_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_menu_handler_capi.h b/cef/include/capi/cef_menu_handler_capi.h deleted file mode 100644 index 7cf2b9ad8..000000000 --- a/cef/include/capi/cef_menu_handler_capi.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_MENU_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_MENU_HANDLER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Implement this structure to handle events related to browser context menus. -// The functions of this structure will be called on the UI thread. -/// -typedef struct _cef_menu_handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Called before a context menu is displayed. Return false (0) to display the - // default context menu or true (1) to cancel the display. - /// - int (CEF_CALLBACK *on_before_menu)(struct _cef_menu_handler_t* self, - struct _cef_browser_t* browser, - const struct _cef_menu_info_t* menuInfo); - - /// - // Called to optionally override the default text for a context menu item. - // |label| contains the default text and may be modified to substitute - // alternate text. - /// - void (CEF_CALLBACK *get_menu_label)(struct _cef_menu_handler_t* self, - struct _cef_browser_t* browser, enum cef_menu_id_t menuId, - cef_string_t* label); - - /// - // Called when an option is selected from the default context menu. Return - // false (0) to execute the default action or true (1) to cancel the action. - /// - int (CEF_CALLBACK *on_menu_action)(struct _cef_menu_handler_t* self, - struct _cef_browser_t* browser, enum cef_menu_id_t menuId); -} cef_menu_handler_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_MENU_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_nplugin_capi.h b/cef/include/capi/cef_nplugin_capi.h deleted file mode 100644 index d6adf1bf0..000000000 --- a/cef/include/capi/cef_nplugin_capi.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#ifndef CEF_INCLUDE_CAPI_CEF_NPLUGIN_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_NPLUGIN_CAPI_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/internal/cef_nplugin_types.h" - -/// -// Register a plugin with the system. Returns true (1) on success. -/// -CEF_EXPORT int cef_register_plugin(const cef_plugin_info_t* plugin_info); - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_NPLUGIN_CAPI_H_ diff --git a/cef/include/capi/cef_permission_handler_capi.h b/cef/include/capi/cef_permission_handler_capi.h deleted file mode 100644 index 13db70eb9..000000000 --- a/cef/include/capi/cef_permission_handler_capi.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_PERMISSION_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_PERMISSION_HANDLER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Implement this structure to handle events related to browser permissions. The -// functions of this structure will be called on the UI thread. -/// -typedef struct _cef_permission_handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Called on the UI thread before a script extension is loaded. Return false - // (0) to let the extension load normally. - /// - int (CEF_CALLBACK *on_before_script_extension_load)( - struct _cef_permission_handler_t* self, struct _cef_browser_t* browser, - struct _cef_frame_t* frame, const cef_string_t* extensionName); -} cef_permission_handler_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_PERMISSION_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_print_handler_capi.h b/cef/include/capi/cef_print_handler_capi.h deleted file mode 100644 index be5cfc78e..000000000 --- a/cef/include/capi/cef_print_handler_capi.h +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_PRINT_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_PRINT_HANDLER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Implement this structure to handle events related to printing. The functions -// of this structure will be called on the UI thread. -/// -typedef struct _cef_print_handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Called to allow customization of standard print options before the print - // dialog is displayed. |printOptions| allows specification of paper size, - // orientation and margins. Note that the specified margins may be adjusted if - // they are outside the range supported by the printer. All units are in - // inches. Return false (0) to display the default print options or true (1) - // to display the modified |printOptions|. - /// - int (CEF_CALLBACK *get_print_options)(struct _cef_print_handler_t* self, - struct _cef_browser_t* browser, - struct _cef_print_options_t* printOptions); - - /// - // Called to format print headers and footers. |printInfo| contains platform- - // specific information about the printer context. |url| is the URL if the - // currently printing page, |title| is the title of the currently printing - // page, |currentPage| is the current page number and |maxPages| is the total - // number of pages. Six default header locations are provided by the - // implementation: top left, top center, top right, bottom left, bottom center - // and bottom right. To use one of these default locations just assign a - // string to the appropriate variable. To draw the header and footer yourself - // return true (1). Otherwise, populate the approprate variables and return - // false (0). - /// - int (CEF_CALLBACK *get_print_header_footer)(struct _cef_print_handler_t* self, - struct _cef_browser_t* browser, struct _cef_frame_t* frame, - const struct _cef_print_info_t* printInfo, const cef_string_t* url, - const cef_string_t* title, int currentPage, int maxPages, - cef_string_t* topLeft, cef_string_t* topCenter, cef_string_t* topRight, - cef_string_t* bottomLeft, cef_string_t* bottomCenter, - cef_string_t* bottomRight); -} cef_print_handler_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_PRINT_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_render_handler_capi.h b/cef/include/capi/cef_render_handler_capi.h deleted file mode 100644 index 53fc5d8e5..000000000 --- a/cef/include/capi/cef_render_handler_capi.h +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Implement this structure to handle events when window rendering is disabled. -// The functions of this structure will be called on the UI thread. -/// -typedef struct _cef_render_handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Called to retrieve the view rectangle which is relative to screen - // coordinates. Return true (1) if the rectangle was provided. - /// - int (CEF_CALLBACK *get_view_rect)(struct _cef_render_handler_t* self, - struct _cef_browser_t* browser, cef_rect_t* rect); - - /// - // Called to retrieve the simulated screen rectangle. Return true (1) if the - // rectangle was provided. - /// - int (CEF_CALLBACK *get_screen_rect)(struct _cef_render_handler_t* self, - struct _cef_browser_t* browser, cef_rect_t* rect); - - /// - // Called to retrieve the translation from view coordinates to actual screen - // coordinates. Return true (1) if the screen coordinates were provided. - /// - int (CEF_CALLBACK *get_screen_point)(struct _cef_render_handler_t* self, - struct _cef_browser_t* browser, int viewX, int viewY, int* screenX, - int* screenY); - - /// - // Called when the browser wants to show or hide the popup widget. The popup - // should be shown if |show| is true (1) and hidden if |show| is false (0). - /// - void (CEF_CALLBACK *on_popup_show)(struct _cef_render_handler_t* self, - struct _cef_browser_t* browser, int show); - - /// - // Called when the browser wants to move or resize the popup widget. |rect| - // contains the new location and size. - /// - void (CEF_CALLBACK *on_popup_size)(struct _cef_render_handler_t* self, - struct _cef_browser_t* browser, const cef_rect_t* rect); - - /// - // Called when an element should be painted. |type| indicates whether the - // element is the view or the popup widget. |buffer| contains the pixel data - // for the whole image. |dirtyRects| contains the set of rectangles that need - // to be repainted. On Windows |buffer| will be width*height*4 bytes in size - // and represents a BGRA image with an upper-left origin. - /// - void (CEF_CALLBACK *on_paint)(struct _cef_render_handler_t* self, - struct _cef_browser_t* browser, enum cef_paint_element_type_t type, - size_t dirtyRectsCount, cef_rect_t const* dirtyRects, - const void* buffer); - - /// - // Called when the browser window's cursor has changed. - /// - void (CEF_CALLBACK *on_cursor_change)(struct _cef_render_handler_t* self, - struct _cef_browser_t* browser, cef_cursor_handle_t cursor); -} cef_render_handler_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_request_handler_capi.h b/cef/include/capi/cef_request_handler_capi.h deleted file mode 100644 index 3414001b9..000000000 --- a/cef/include/capi/cef_request_handler_capi.h +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Implement this structure to handle events related to browser requests. The -// functions of this structure will be called on the thread indicated. -/// -typedef struct _cef_request_handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Called on the UI thread before browser navigation. Return true (1) to - // cancel the navigation or false (0) to allow the navigation to proceed. - /// - int (CEF_CALLBACK *on_before_browse)(struct _cef_request_handler_t* self, - struct _cef_browser_t* browser, struct _cef_frame_t* frame, - struct _cef_request_t* request, enum cef_handler_navtype_t navType, - int isRedirect); - - /// - // Called on the IO thread before a resource is loaded. To allow the resource - // to load normally return false (0). To redirect the resource to a new url - // populate the |redirectUrl| value and return false (0). To specify data for - // the resource return a CefStream object in |resourceStream|, use the - // |response| object to set mime type, HTTP status code and optional header - // values, and return false (0). To cancel loading of the resource return true - // (1). Any modifications to |request| will be observed. If the URL in - // |request| is changed and |redirectUrl| is also set, the URL in |request| - // will be used. - /// - int (CEF_CALLBACK *on_before_resource_load)( - struct _cef_request_handler_t* self, struct _cef_browser_t* browser, - struct _cef_request_t* request, cef_string_t* redirectUrl, - struct _cef_stream_reader_t** resourceStream, - struct _cef_response_t* response, int loadFlags); - - /// - // Called on the IO thread when a resource load is redirected. The |old_url| - // parameter will contain the old URL. The |new_url| parameter will contain - // the new URL and can be changed if desired. - /// - void (CEF_CALLBACK *on_resource_redirect)(struct _cef_request_handler_t* self, - struct _cef_browser_t* browser, const cef_string_t* old_url, - cef_string_t* new_url); - - /// - // Called on the UI thread after a response to the resource request is - // received. Set |filter| if response content needs to be monitored and/or - // modified as it arrives. - /// - void (CEF_CALLBACK *on_resource_response)(struct _cef_request_handler_t* self, - struct _cef_browser_t* browser, const cef_string_t* url, - struct _cef_response_t* response, - struct _cef_content_filter_t** filter); - - /// - // Called on the IO thread to handle requests for URLs with an unknown - // protocol component. Return true (1) to indicate that the request should - // succeed because it was handled externally. Set |allowOSExecution| to true - // (1) and return false (0) to attempt execution via the registered OS - // protocol handler, if any. If false (0) is returned and either - // |allow_os_execution| is false (0) or OS protocol handler execution fails - // then the request will fail with an error condition. SECURITY WARNING: YOU - // SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR - // OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION. - /// - int (CEF_CALLBACK *on_protocol_execution)(struct _cef_request_handler_t* self, - struct _cef_browser_t* browser, const cef_string_t* url, - int* allowOSExecution); - - /// - // Called on the UI thread when a server indicates via the 'Content- - // Disposition' header that a response represents a file to download. - // |mimeType| is the mime type for the download, |fileName| is the suggested - // target file name and |contentLength| is either the value of the 'Content- - // Size' header or -1 if no size was provided. Set |handler| to the - // cef_download_handler_t instance that will recieve the file contents. Return - // true (1) to download the file or false (0) to cancel the file download. - /// - int (CEF_CALLBACK *get_download_handler)(struct _cef_request_handler_t* self, - struct _cef_browser_t* browser, const cef_string_t* mimeType, - const cef_string_t* fileName, int64 contentLength, - struct _cef_download_handler_t** handler); - - /// - // Called on the IO thread when the browser needs credentials from the user. - // |isProxy| indicates whether the host is a proxy server. |host| contains the - // hostname and port number. Set |username| and |password| and return true (1) - // to handle the request. Return false (0) to cancel the request. - /// - int (CEF_CALLBACK *get_auth_credentials)(struct _cef_request_handler_t* self, - struct _cef_browser_t* browser, int isProxy, const cef_string_t* host, - int port, const cef_string_t* realm, const cef_string_t* scheme, - cef_string_t* username, cef_string_t* password); - - /// - // Called on the IO thread to retrieve the cookie manager. |main_url| is the - // URL of the top-level frame. Cookies managers can be unique per browser or - // shared across multiple browsers. The global cookie manager will be used if - // this function returns NULL. - /// - struct _cef_cookie_manager_t* (CEF_CALLBACK *get_cookie_manager)( - struct _cef_request_handler_t* self, struct _cef_browser_t* browser, - const cef_string_t* main_url); -} cef_request_handler_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_scheme_capi.h b/cef/include/capi/cef_scheme_capi.h deleted file mode 100644 index b3806580b..000000000 --- a/cef/include/capi/cef_scheme_capi.h +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Register a custom scheme. This function should not be called for the built-in -// HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes. -// -// If |is_standard| is true (1) the scheme will be treated as a standard scheme. -// Standard schemes are subject to URL canonicalization and parsing rules as -// defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1 available -// at http://www.ietf.org/rfc/rfc1738.txt -// -// In particular, the syntax for standard scheme URLs must be of the form:
    -//  [scheme]://[username]:[password]@[host]:[port]/[url-path]
    -// 
    Standard scheme URLs must have a host component that is a fully -// qualified domain name as defined in Section 3.5 of RFC 1034 [13] and Section -// 2.1 of RFC 1123. These URLs will be canonicalized to "scheme://host/path" in -// the simplest case and "scheme://username:password@host:port/path" in the most -// explicit case. For example, "scheme:host/path" and "scheme:///host/path" will -// both be canonicalized to "scheme://host/path". The origin of a standard -// scheme URL is the combination of scheme, host and port (i.e., -// "scheme://host:port" in the most explicit case). -// -// For non-standard scheme URLs only the "scheme:" component is parsed and -// canonicalized. The remainder of the URL will be passed to the handler as-is. -// For example, "scheme:///some%20text" will remain the same. Non-standard -// scheme URLs cannot be used as a target for form submission. -// -// If |is_local| is true (1) the scheme will be treated as local (i.e., with the -// same security rules as those applied to "file" URLs). Normal pages cannot -// link to or access local URLs. Also, by default, local URLs can only perform -// XMLHttpRequest calls to the same URL (origin + path) that originated the -// request. To allow XMLHttpRequest calls from a local URL to other URLs with -// the same origin set the CefSettings.file_access_from_file_urls_allowed value -// to true (1). To allow XMLHttpRequest calls from a local URL to all origins -// set the CefSettings.universal_access_from_file_urls_allowed value to true -// (1). -// -// If |is_display_isolated| is true (1) the scheme will be treated as display- -// isolated. This means that pages cannot display these URLs unless they are -// from the same scheme. For example, pages in another origin cannot create -// iframes or hyperlinks to URLs with this scheme. -// -// This function may be called on any thread. It should only be called once per -// unique |scheme_name| value. If |scheme_name| is already registered or if an -// error occurs this function will return false (0). -/// -CEF_EXPORT int cef_register_custom_scheme(const cef_string_t* scheme_name, - int is_standard, int is_local, int is_display_isolated); - -/// -// Register a scheme handler factory for the specified |scheme_name| and -// optional |domain_name|. An NULL |domain_name| value for a standard scheme -// will cause the factory to match all domain names. The |domain_name| value -// will be ignored for non-standard schemes. If |scheme_name| is a built-in -// scheme and no handler is returned by |factory| then the built-in scheme -// handler factory will be called. If |scheme_name| is a custom scheme the -// cef_register_custom_scheme() function should be called for that scheme. This -// function may be called multiple times to change or remove the factory that -// matches the specified |scheme_name| and optional |domain_name|. Returns false -// (0) if an error occurs. This function may be called on any thread. -/// -CEF_EXPORT int cef_register_scheme_handler_factory( - const cef_string_t* scheme_name, const cef_string_t* domain_name, - struct _cef_scheme_handler_factory_t* factory); - -/// -// Clear all registered scheme handler factories. Returns false (0) on error. -// This function may be called on any thread. -/// -CEF_EXPORT int cef_clear_scheme_handler_factories(); - -/// -// Structure that creates cef_scheme_handler_t instances. The functions of this -// structure will always be called on the IO thread. -/// -typedef struct _cef_scheme_handler_factory_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Return a new scheme handler instance to handle the request. |browser| will - // be the browser window that initiated the request. If the request was - // initiated using the cef_web_urlrequest_t API |browser| will be NULL. The - // |request| object passed to this function will not contain cookie data. - /// - struct _cef_scheme_handler_t* (CEF_CALLBACK *create)( - struct _cef_scheme_handler_factory_t* self, - struct _cef_browser_t* browser, const cef_string_t* scheme_name, - struct _cef_request_t* request); -} cef_scheme_handler_factory_t; - - -/// -// Structure used to facilitate asynchronous responses to custom scheme handler -// requests. The functions of this structure may be called on any thread. -/// -typedef struct _cef_scheme_handler_callback_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Notify that header information is now available for retrieval. - /// - void (CEF_CALLBACK *headers_available)( - struct _cef_scheme_handler_callback_t* self); - - /// - // Notify that response data is now available for reading. - /// - void (CEF_CALLBACK *bytes_available)( - struct _cef_scheme_handler_callback_t* self); - - /// - // Cancel processing of the request. - /// - void (CEF_CALLBACK *cancel)(struct _cef_scheme_handler_callback_t* self); -} cef_scheme_handler_callback_t; - - -/// -// Structure used to implement a custom scheme handler structure. The functions -// of this structure will always be called on the IO thread. -/// -typedef struct _cef_scheme_handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Begin processing the request. To handle the request return true (1) and - // call headers_available() once the response header information is available - // (headers_available() can also be called from inside this function if header - // information is available immediately). To cancel the request return false - // (0). - /// - int (CEF_CALLBACK *process_request)(struct _cef_scheme_handler_t* self, - struct _cef_request_t* request, - struct _cef_scheme_handler_callback_t* callback); - - /// - // Retrieve response header information. If the response length is not known - // set |response_length| to -1 and read_response() will be called until it - // returns false (0). If the response length is known set |response_length| to - // a positive value and read_response() will be called until it returns false - // (0) or the specified number of bytes have been read. Use the |response| - // object to set the mime type, http status code and other optional header - // values. To redirect the request to a new URL set |redirectUrl| to the new - // URL. - /// - void (CEF_CALLBACK *get_response_headers)(struct _cef_scheme_handler_t* self, - struct _cef_response_t* response, int64* response_length, - cef_string_t* redirectUrl); - - /// - // Read response data. If data is available immediately copy up to - // |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of - // bytes copied, and return true (1). To read the data at a later time set - // |bytes_read| to 0, return true (1) and call bytes_available() when the data - // is available. To indicate response completion return false (0). - /// - int (CEF_CALLBACK *read_response)(struct _cef_scheme_handler_t* self, - void* data_out, int bytes_to_read, int* bytes_read, - struct _cef_scheme_handler_callback_t* callback); - - /// - // Request processing has been canceled. - /// - void (CEF_CALLBACK *cancel)(struct _cef_scheme_handler_t* self); -} cef_scheme_handler_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_ diff --git a/cef/include/capi/cef_storage_capi.h b/cef/include/capi/cef_storage_capi.h deleted file mode 100644 index d04a6684b..000000000 --- a/cef/include/capi/cef_storage_capi.h +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_STORAGE_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_STORAGE_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Visit storage of the specified type. If |origin| is non-NULL only data -// matching that origin will be visited. If |key| is non-NULL only data matching -// that key will be visited. Otherwise, all data for the storage type will be -// visited. Origin should be of the form scheme://domain. If no origin is -// specified only data currently in memory will be returned. Returns false (0) -// if the storage cannot be accessed. -/// -CEF_EXPORT int cef_visit_storage(enum cef_storage_type_t type, - const cef_string_t* origin, const cef_string_t* key, - struct _cef_storage_visitor_t* visitor); - -/// -// Sets storage of the specified type, origin, key and value. Returns false (0) -// if storage cannot be accessed. This function must be called on the UI thread. -/// -CEF_EXPORT int cef_set_storage(enum cef_storage_type_t type, - const cef_string_t* origin, const cef_string_t* key, - const cef_string_t* value); - -/// -// Deletes all storage of the specified type. If |origin| is non-NULL only data -// matching that origin will be cleared. If |key| is non-NULL only data matching -// that key will be cleared. Otherwise, all data for the storage type will be -// cleared. Returns false (0) if storage cannot be accessed. This function must -// be called on the UI thread. -/// -CEF_EXPORT int cef_delete_storage(enum cef_storage_type_t type, - const cef_string_t* origin, const cef_string_t* key); - -/// -// Sets the directory path that will be used for storing data of the specified -// type. Currently only the ST_LOCALSTORAGE type is supported by this function. -// If |path| is NULL data will be stored in memory only. By default the storage -// path is the same as the cache path. Returns false (0) if the storage cannot -// be accessed. -/// -CEF_EXPORT int cef_set_storage_path(enum cef_storage_type_t type, - const cef_string_t* path); - -/// -// Structure to implement for visiting storage. The functions of this structure -// will always be called on the UI thread. -/// -typedef struct _cef_storage_visitor_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Method that will be called once for each key/value data pair in storage. - // |count| is the 0-based index for the current pair. |total| is the total - // number of pairs. Set |deleteData| to true (1) to delete the pair currently - // being visited. Return false (0) to stop visiting pairs. This function may - // never be called if no data is found. - /// - int (CEF_CALLBACK *visit)(struct _cef_storage_visitor_t* self, - enum cef_storage_type_t type, const cef_string_t* origin, - const cef_string_t* key, const cef_string_t* value, int count, int total, - int* deleteData); -} cef_storage_visitor_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_STORAGE_CAPI_H_ diff --git a/cef/include/capi/cef_v8_capi.h b/cef/include/capi/cef_v8_capi.h deleted file mode 100644 index f0113dbf9..000000000 --- a/cef/include/capi/cef_v8_capi.h +++ /dev/null @@ -1,615 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Register a new V8 extension with the specified JavaScript extension code and -// handler. Functions implemented by the handler are prototyped using the -// keyword 'native'. The calling of a native function is restricted to the scope -// in which the prototype of the native function is defined. This function may -// be called on any thread. -// -// Example JavaScript extension code:
    -//   // create the 'example' global object if it doesn't already exist.
    -//   if (!example)
    -//     example = {};
    -//   // create the 'example.test' global object if it doesn't already exist.
    -//   if (!example.test)
    -//     example.test = {};
    -//   (function() {
    -//     // Define the function 'example.test.myfunction'.
    -//     example.test.myfunction = function() {
    -//       // Call CefV8Handler::Execute() with the function name 'MyFunction'
    -//       // and no arguments.
    -//       native function MyFunction();
    -//       return MyFunction();
    -//     };
    -//     // Define the getter function for parameter 'example.test.myparam'.
    -//     example.test.__defineGetter__('myparam', function() {
    -//       // Call CefV8Handler::Execute() with the function name 'GetMyParam'
    -//       // and no arguments.
    -//       native function GetMyParam();
    -//       return GetMyParam();
    -//     });
    -//     // Define the setter function for parameter 'example.test.myparam'.
    -//     example.test.__defineSetter__('myparam', function(b) {
    -//       // Call CefV8Handler::Execute() with the function name 'SetMyParam'
    -//       // and a single argument.
    -//       native function SetMyParam();
    -//       if(b) SetMyParam(b);
    -//     });
    -//
    -//     // Extension definitions can also contain normal JavaScript variables
    -//     // and functions.
    -//     var myint = 0;
    -//     example.test.increment = function() {
    -//       myint += 1;
    -//       return myint;
    -//     };
    -//   })();
    -// 
    Example usage in the page:
    -//   // Call the function.
    -//   example.test.myfunction();
    -//   // Set the parameter.
    -//   example.test.myparam = value;
    -//   // Get the parameter.
    -//   value = example.test.myparam;
    -//   // Call another function.
    -//   example.test.increment();
    -// 
    -/// -CEF_EXPORT int cef_register_extension(const cef_string_t* extension_name, - const cef_string_t* javascript_code, struct _cef_v8handler_t* handler); - -/// -// Structure that encapsulates a V8 context handle. -/// -typedef struct _cef_v8context_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Returns the browser for this context. - /// - struct _cef_browser_t* (CEF_CALLBACK *get_browser)( - struct _cef_v8context_t* self); - - /// - // Returns the frame for this context. - /// - struct _cef_frame_t* (CEF_CALLBACK *get_frame)(struct _cef_v8context_t* self); - - /// - // Returns the global object for this context. - /// - struct _cef_v8value_t* (CEF_CALLBACK *get_global)( - struct _cef_v8context_t* self); - - /// - // Enter this context. A context must be explicitly entered before creating a - // V8 Object, Array or Function asynchronously. exit() must be called the same - // number of times as enter() before releasing this context. V8 objects belong - // to the context in which they are created. Returns true (1) if the scope was - // entered successfully. - /// - int (CEF_CALLBACK *enter)(struct _cef_v8context_t* self); - - /// - // Exit this context. Call this function only after calling enter(). Returns - // true (1) if the scope was exited successfully. - /// - int (CEF_CALLBACK *exit)(struct _cef_v8context_t* self); - - /// - // Returns true (1) if this object is pointing to the same handle as |that| - // object. - /// - int (CEF_CALLBACK *is_same)(struct _cef_v8context_t* self, - struct _cef_v8context_t* that); -} cef_v8context_t; - - -/// -// Returns the current (top) context object in the V8 context stack. -/// -CEF_EXPORT cef_v8context_t* cef_v8context_get_current_context(); - -/// -// Returns the entered (bottom) context object in the V8 context stack. -/// -CEF_EXPORT cef_v8context_t* cef_v8context_get_entered_context(); - -/// -// Returns true (1) if V8 is currently inside a context. -/// -CEF_EXPORT int cef_v8context_in_context(); - - -/// -// Structure that should be implemented to handle V8 function calls. The -// functions of this structure will always be called on the UI thread. -/// -typedef struct _cef_v8handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Handle execution of the function identified by |name|. |object| is the - // receiver ('this' object) of the function. |arguments| is the list of - // arguments passed to the function. If execution succeeds set |retval| to the - // function return value. If execution fails set |exception| to the exception - // that will be thrown. Return true (1) if execution was handled. - /// - int (CEF_CALLBACK *execute)(struct _cef_v8handler_t* self, - const cef_string_t* name, struct _cef_v8value_t* object, - size_t argumentsCount, struct _cef_v8value_t* const* arguments, - struct _cef_v8value_t** retval, cef_string_t* exception); -} cef_v8handler_t; - - -/// -// Structure that should be implemented to handle V8 accessor calls. Accessor -// identifiers are registered by calling cef_v8value_t::set_value_byaccessor(). -// The functions of this structure will always be called on the UI thread. -/// -typedef struct _cef_v8accessor_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Handle retrieval the accessor value identified by |name|. |object| is the - // receiver ('this' object) of the accessor. If retrieval succeeds set - // |retval| to the return value. If retrieval fails set |exception| to the - // exception that will be thrown. Return true (1) if accessor retrieval was - // handled. - /// - int (CEF_CALLBACK *get)(struct _cef_v8accessor_t* self, - const cef_string_t* name, struct _cef_v8value_t* object, - struct _cef_v8value_t** retval, cef_string_t* exception); - - /// - // Handle assignment of the accessor value identified by |name|. |object| is - // the receiver ('this' object) of the accessor. |value| is the new value - // being assigned to the accessor. If assignment fails set |exception| to the - // exception that will be thrown. Return true (1) if accessor assignment was - // handled. - /// - int (CEF_CALLBACK *set)(struct _cef_v8accessor_t* self, - const cef_string_t* name, struct _cef_v8value_t* object, - struct _cef_v8value_t* value, cef_string_t* exception); -} cef_v8accessor_t; - - -/// -// Structure representing a V8 exception. -/// -typedef struct _cef_v8exception_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Returns the exception message. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_message)( - struct _cef_v8exception_t* self); - - /// - // Returns the line of source code that the exception occurred within. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_source_line)( - struct _cef_v8exception_t* self); - - /// - // Returns the resource name for the script from where the function causing - // the error originates. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_script_resource_name)( - struct _cef_v8exception_t* self); - - /// - // Returns the 1-based number of the line where the error occurred or 0 if the - // line number is unknown. - /// - int (CEF_CALLBACK *get_line_number)(struct _cef_v8exception_t* self); - - /// - // Returns the index within the script of the first character where the error - // occurred. - /// - int (CEF_CALLBACK *get_start_position)(struct _cef_v8exception_t* self); - - /// - // Returns the index within the script of the last character where the error - // occurred. - /// - int (CEF_CALLBACK *get_end_position)(struct _cef_v8exception_t* self); - - /// - // Returns the index within the line of the first character where the error - // occurred. - /// - int (CEF_CALLBACK *get_start_column)(struct _cef_v8exception_t* self); - - /// - // Returns the index within the line of the last character where the error - // occurred. - /// - int (CEF_CALLBACK *get_end_column)(struct _cef_v8exception_t* self); -} cef_v8exception_t; - - -/// -// Structure representing a V8 value. The functions of this structure should -// only be called on the UI thread. -/// -typedef struct _cef_v8value_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // True if the value type is undefined. - /// - int (CEF_CALLBACK *is_undefined)(struct _cef_v8value_t* self); - - /// - // True if the value type is null. - /// - int (CEF_CALLBACK *is_null)(struct _cef_v8value_t* self); - - /// - // True if the value type is bool. - /// - int (CEF_CALLBACK *is_bool)(struct _cef_v8value_t* self); - - /// - // True if the value type is int. - /// - int (CEF_CALLBACK *is_int)(struct _cef_v8value_t* self); - - /// - // True if the value type is double. - /// - int (CEF_CALLBACK *is_double)(struct _cef_v8value_t* self); - - /// - // True if the value type is Date. - /// - int (CEF_CALLBACK *is_date)(struct _cef_v8value_t* self); - - /// - // True if the value type is string. - /// - int (CEF_CALLBACK *is_string)(struct _cef_v8value_t* self); - - /// - // True if the value type is object. - /// - int (CEF_CALLBACK *is_object)(struct _cef_v8value_t* self); - - /// - // True if the value type is array. - /// - int (CEF_CALLBACK *is_array)(struct _cef_v8value_t* self); - - /// - // True if the value type is function. - /// - int (CEF_CALLBACK *is_function)(struct _cef_v8value_t* self); - - /// - // Returns true (1) if this object is pointing to the same handle as |that| - // object. - /// - int (CEF_CALLBACK *is_same)(struct _cef_v8value_t* self, - struct _cef_v8value_t* that); - - /// - // Return a bool value. The underlying data will be converted to if - // necessary. - /// - int (CEF_CALLBACK *get_bool_value)(struct _cef_v8value_t* self); - - /// - // Return an int value. The underlying data will be converted to if - // necessary. - /// - int (CEF_CALLBACK *get_int_value)(struct _cef_v8value_t* self); - - /// - // Return a double value. The underlying data will be converted to if - // necessary. - /// - double (CEF_CALLBACK *get_double_value)(struct _cef_v8value_t* self); - - /// - // Return a Date value. The underlying data will be converted to if - // necessary. - /// - cef_time_t (CEF_CALLBACK *get_date_value)(struct _cef_v8value_t* self); - - /// - // Return a string value. The underlying data will be converted to if - // necessary. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_string_value)( - struct _cef_v8value_t* self); - - - // OBJECT METHODS - These functions are only available on objects. Arrays and - // functions are also objects. String- and integer-based keys can be used - // interchangably with the framework converting between them as necessary. - - /// - // Returns true (1) if the object has a value with the specified identifier. - /// - int (CEF_CALLBACK *has_value_bykey)(struct _cef_v8value_t* self, - const cef_string_t* key); - - /// - // Returns true (1) if the object has a value with the specified identifier. - /// - int (CEF_CALLBACK *has_value_byindex)(struct _cef_v8value_t* self, int index); - - /// - // Delete the value with the specified identifier. - /// - int (CEF_CALLBACK *delete_value_bykey)(struct _cef_v8value_t* self, - const cef_string_t* key); - - /// - // Delete the value with the specified identifier. - /// - int (CEF_CALLBACK *delete_value_byindex)(struct _cef_v8value_t* self, - int index); - - /// - // Returns the value with the specified identifier. - /// - struct _cef_v8value_t* (CEF_CALLBACK *get_value_bykey)( - struct _cef_v8value_t* self, const cef_string_t* key); - - /// - // Returns the value with the specified identifier. - /// - struct _cef_v8value_t* (CEF_CALLBACK *get_value_byindex)( - struct _cef_v8value_t* self, int index); - - /// - // Associate a value with the specified identifier. - /// - int (CEF_CALLBACK *set_value_bykey)(struct _cef_v8value_t* self, - const cef_string_t* key, struct _cef_v8value_t* value, - enum cef_v8_propertyattribute_t attribute); - - /// - // Associate a value with the specified identifier. - /// - int (CEF_CALLBACK *set_value_byindex)(struct _cef_v8value_t* self, int index, - struct _cef_v8value_t* value); - - /// - // Register an identifier whose access will be forwarded to the - // cef_v8accessor_t instance passed to - // cef_v8value_t::cef_v8value_create_object_with_accessor(). - /// - int (CEF_CALLBACK *set_value_byaccessor)(struct _cef_v8value_t* self, - const cef_string_t* key, enum cef_v8_accesscontrol_t settings, - enum cef_v8_propertyattribute_t attribute); - - /// - // Read the keys for the object's values into the specified vector. Integer- - // based keys will also be returned as strings. - /// - int (CEF_CALLBACK *get_keys)(struct _cef_v8value_t* self, - cef_string_list_t keys); - - /// - // Returns the user data, if any, specified when the object was created. - /// - struct _cef_base_t* (CEF_CALLBACK *get_user_data)( - struct _cef_v8value_t* self); - - /// - // Returns the amount of externally allocated memory registered for the - // object. - /// - int (CEF_CALLBACK *get_externally_allocated_memory)( - struct _cef_v8value_t* self); - - /// - // Adjusts the amount of registered external memory for the object. Used to - // give V8 an indication of the amount of externally allocated memory that is - // kept alive by JavaScript objects. V8 uses this information to decide when - // to perform global garbage collection. Each cef_v8value_t tracks the amount - // of external memory associated with it and automatically decreases the - // global total by the appropriate amount on its destruction. - // |change_in_bytes| specifies the number of bytes to adjust by. This function - // returns the number of bytes associated with the object after the - // adjustment. - /// - int (CEF_CALLBACK *adjust_externally_allocated_memory)( - struct _cef_v8value_t* self, int change_in_bytes); - - - // ARRAY METHODS - These functions are only available on arrays. - - /// - // Returns the number of elements in the array. - /// - int (CEF_CALLBACK *get_array_length)(struct _cef_v8value_t* self); - - - // FUNCTION METHODS - These functions are only available on functions. - - /// - // Returns the function name. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_function_name)( - struct _cef_v8value_t* self); - - /// - // Returns the function handler or NULL if not a CEF-created function. - /// - struct _cef_v8handler_t* (CEF_CALLBACK *get_function_handler)( - struct _cef_v8value_t* self); - - /// - // Execute the function using the current V8 context. This function should - // only be called from within the scope of a cef_v8handler_t or - // cef_v8accessor_t callback, or in combination with calling enter() and - // exit() on a stored cef_v8context_t reference. |object| is the receiver - // ('this' object) of the function. |arguments| is the list of arguments that - // will be passed to the function. If execution succeeds |retval| will be set - // to the function return value. If execution fails |exception| will be set to - // the exception that was thrown. If |rethrow_exception| is true (1) any - // exception will also be re- thrown. This function returns false (0) if - // called incorrectly. - /// - int (CEF_CALLBACK *execute_function)(struct _cef_v8value_t* self, - struct _cef_v8value_t* object, size_t argumentsCount, - struct _cef_v8value_t* const* arguments, struct _cef_v8value_t** retval, - struct _cef_v8exception_t** exception, int rethrow_exception); - - /// - // Execute the function using the specified V8 context. |object| is the - // receiver ('this' object) of the function. |arguments| is the list of - // arguments that will be passed to the function. If execution succeeds - // |retval| will be set to the function return value. If execution fails - // |exception| will be set to the exception that was thrown. If - // |rethrow_exception| is true (1) any exception will also be re-thrown. This - // function returns false (0) if called incorrectly. - /// - int (CEF_CALLBACK *execute_function_with_context)(struct _cef_v8value_t* self, - struct _cef_v8context_t* context, struct _cef_v8value_t* object, - size_t argumentsCount, struct _cef_v8value_t* const* arguments, - struct _cef_v8value_t** retval, struct _cef_v8exception_t** exception, - int rethrow_exception); -} cef_v8value_t; - - -/// -// Create a new cef_v8value_t object of type undefined. -/// -CEF_EXPORT cef_v8value_t* cef_v8value_create_undefined(); - -/// -// Create a new cef_v8value_t object of type null. -/// -CEF_EXPORT cef_v8value_t* cef_v8value_create_null(); - -/// -// Create a new cef_v8value_t object of type bool. -/// -CEF_EXPORT cef_v8value_t* cef_v8value_create_bool(int value); - -/// -// Create a new cef_v8value_t object of type int. -/// -CEF_EXPORT cef_v8value_t* cef_v8value_create_int(int value); - -/// -// Create a new cef_v8value_t object of type double. -/// -CEF_EXPORT cef_v8value_t* cef_v8value_create_double(double value); - -/// -// Create a new cef_v8value_t object of type Date. -/// -CEF_EXPORT cef_v8value_t* cef_v8value_create_date(const cef_time_t* date); - -/// -// Create a new cef_v8value_t object of type string. -/// -CEF_EXPORT cef_v8value_t* cef_v8value_create_string(const cef_string_t* value); - -/// -// Create a new cef_v8value_t object of type object with optional user data and -// accessor. This function should only be called from within the scope of a -// cef_v8context_tHandler, cef_v8handler_t or cef_v8accessor_t callback, or in -// combination with calling enter() and exit() on a stored cef_v8context_t -// reference. -/// -CEF_EXPORT cef_v8value_t* cef_v8value_create_object_with_accessor( - cef_base_t* user_data, cef_v8accessor_t* accessor); - -/// -// Create a new cef_v8value_t object of type array. This function should only be -// called from within the scope of a cef_v8context_tHandler, cef_v8handler_t or -// cef_v8accessor_t callback, or in combination with calling enter() and exit() -// on a stored cef_v8context_t reference. -/// -CEF_EXPORT cef_v8value_t* cef_v8value_create_array(); - -/// -// Create a new cef_v8value_t object of type function. This function should only -// be called from within the scope of a cef_v8context_tHandler, cef_v8handler_t -// or cef_v8accessor_t callback, or in combination with calling enter() and -// exit() on a stored cef_v8context_t reference. -/// -CEF_EXPORT cef_v8value_t* cef_v8value_create_function(const cef_string_t* name, - cef_v8handler_t* handler); - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_ diff --git a/cef/include/capi/cef_v8context_handler_capi.h b/cef/include/capi/cef_v8context_handler_capi.h deleted file mode 100644 index fa00e419b..000000000 --- a/cef/include/capi/cef_v8context_handler_capi.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_V8CONTEXT_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_V8CONTEXT_HANDLER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Implement this structure to handle V8 context events. The functions of this -// structure will be called on the UI thread. -/// -typedef struct _cef_v8context_handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Called immediately after the V8 context for a frame has been created. To - // retrieve the JavaScript 'window' object use the - // cef_v8context_t::get_global() function. - /// - void (CEF_CALLBACK *on_context_created)(struct _cef_v8context_handler_t* self, - struct _cef_browser_t* browser, struct _cef_frame_t* frame, - struct _cef_v8context_t* context); - - /// - // Called immediately before the V8 context for a frame is released. No - // references to the context should be kept after this function is called. - /// - void (CEF_CALLBACK *on_context_released)( - struct _cef_v8context_handler_t* self, struct _cef_browser_t* browser, - struct _cef_frame_t* frame, struct _cef_v8context_t* context); -} cef_v8context_handler_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_V8CONTEXT_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_web_urlrequest_capi.h b/cef/include/capi/cef_web_urlrequest_capi.h deleted file mode 100644 index 3e2cbb12d..000000000 --- a/cef/include/capi/cef_web_urlrequest_capi.h +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_WEB_URLREQUEST_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_WEB_URLREQUEST_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Structure used to make a Web URL request. Web URL requests are not associated -// with a browser instance so no cef_client_t callbacks will be executed. The -// functions of this structure may be called on any thread. -/// -typedef struct _cef_web_urlrequest_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Cancels the request. - /// - void (CEF_CALLBACK *cancel)(struct _cef_web_urlrequest_t* self); - - /// - // Returns the current ready state of the request. - /// - enum cef_weburlrequest_state_t (CEF_CALLBACK *get_state)( - struct _cef_web_urlrequest_t* self); -} cef_web_urlrequest_t; - - -/// -// Create a new CefWebUrlRequest object. -/// -CEF_EXPORT cef_web_urlrequest_t* cef_web_urlrequest_create( - struct _cef_request_t* request, - struct _cef_web_urlrequest_client_t* client); - - -/// -// Structure that should be implemented by the cef_web_urlrequest_t client. The -// functions of this structure will always be called on the UI thread. -/// -typedef struct _cef_web_urlrequest_client_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Notifies the client that the request state has changed. State change - // notifications will always be sent before the below notification functions - // are called. - /// - void (CEF_CALLBACK *on_state_change)( - struct _cef_web_urlrequest_client_t* self, - struct _cef_web_urlrequest_t* requester, - enum cef_weburlrequest_state_t state); - - /// - // Notifies the client that the request has been redirected and provides a - // chance to change the request parameters. - /// - void (CEF_CALLBACK *on_redirect)(struct _cef_web_urlrequest_client_t* self, - struct _cef_web_urlrequest_t* requester, struct _cef_request_t* request, - struct _cef_response_t* response); - - /// - // Notifies the client of the response data. - /// - void (CEF_CALLBACK *on_headers_received)( - struct _cef_web_urlrequest_client_t* self, - struct _cef_web_urlrequest_t* requester, - struct _cef_response_t* response); - - /// - // Notifies the client of the upload progress. - /// - void (CEF_CALLBACK *on_progress)(struct _cef_web_urlrequest_client_t* self, - struct _cef_web_urlrequest_t* requester, uint64 bytesSent, - uint64 totalBytesToBeSent); - - /// - // Notifies the client that content has been received. - /// - void (CEF_CALLBACK *on_data)(struct _cef_web_urlrequest_client_t* self, - struct _cef_web_urlrequest_t* requester, const void* data, - int dataLength); - - /// - // Notifies the client that the request ended with an error. - /// - void (CEF_CALLBACK *on_error)(struct _cef_web_urlrequest_client_t* self, - struct _cef_web_urlrequest_t* requester, - enum cef_handler_errorcode_t errorCode); -} cef_web_urlrequest_client_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_WEB_URLREQUEST_CAPI_H_ diff --git a/cef/include/cef_app.h b/cef/include/cef_app.h deleted file mode 100644 index 028bd71d1..000000000 --- a/cef/include/cef_app.h +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - - -#ifndef CEF_INCLUDE_CEF_APP_H_ -#define CEF_INCLUDE_CEF_APP_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_proxy_handler.h" -#include "include/cef_resource_bundle_handler.h" - -class CefApp; - -/// -// This function should be called on the main application thread to initialize -// CEF when the application is started. The |application| parameter may be -// empty. A return value of true indicates that it succeeded and false indicates -// that it failed. -/// -/*--cef(revision_check,optional_param=application)--*/ -bool CefInitialize(const CefSettings& settings, CefRefPtr application); - -/// -// This function should be called on the main application thread to shut down -// CEF before the application exits. -/// -/*--cef()--*/ -void CefShutdown(); - -/// -// Perform a single iteration of CEF message loop processing. This function is -// used to integrate the CEF message loop into an existing application message -// loop. Care must be taken to balance performance against excessive CPU usage. -// This function should only be called on the main application thread and only -// if CefInitialize() is called with a CefSettings.multi_threaded_message_loop -// value of false. This function will not block. -/// -/*--cef()--*/ -void CefDoMessageLoopWork(); - -/// -// Run the CEF message loop. Use this function instead of an application- -// provided message loop to get the best balance between performance and CPU -// usage. This function should only be called on the main application thread and -// only if CefInitialize() is called with a -// CefSettings.multi_threaded_message_loop value of false. This function will -// block until a quit message is received by the system. -/// -/*--cef()--*/ -void CefRunMessageLoop(); - -/// -// Quit the CEF message loop that was started by calling CefRunMessageLoop(). -// This function should only be called on the main application thread and only -// if CefRunMessageLoop() was used. -/// -/*--cef()--*/ -void CefQuitMessageLoop(); - - -/// -// Implement this interface to provide handler implementations. Methods will be -// called on the thread indicated. -/// -/*--cef(source=client,no_debugct_check)--*/ -class CefApp : public virtual CefBase { - public: - /// - // Return the handler for resource bundle events. If - // CefSettings.pack_loading_disabled is true a handler must be returned. If no - // handler is returned resources will be loaded from pack files. This method - // is called on multiple threads. - /// - /*--cef()--*/ - virtual CefRefPtr GetResourceBundleHandler() { - return NULL; - } - - /// - // Return the handler for proxy events. If not handler is returned the default - // system handler will be used. This method is called on the IO thread. - /// - /*--cef()--*/ - virtual CefRefPtr GetProxyHandler() { - return NULL; - } -}; - -#endif // CEF_INCLUDE_CEF_APP_H_ diff --git a/cef/include/cef_browser.h b/cef/include/cef_browser.h deleted file mode 100644 index b319bc1dd..000000000 --- a/cef/include/cef_browser.h +++ /dev/null @@ -1,336 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_BROWSER_H_ -#define CEF_INCLUDE_CEF_BROWSER_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_frame.h" -#include - -class CefClient; - -/// -// Class used to represent a browser window. The methods of this class may be -// called on any thread unless otherwise indicated in the comments. -/// -/*--cef(source=library)--*/ -class CefBrowser : public virtual CefBase { - public: - typedef cef_key_type_t KeyType; - typedef cef_mouse_button_type_t MouseButtonType; - typedef cef_paint_element_type_t PaintElementType; - - /// - // Create a new browser window using the window parameters specified by - // |windowInfo|. All values will be copied internally and the actual window - // will be created on the UI thread. This method call will not block. - /// - /*--cef(optional_param=url)--*/ - static bool CreateBrowser(CefWindowInfo& windowInfo, - CefRefPtr client, - const CefString& url, - const CefBrowserSettings& settings); - - /// - // Create a new browser window using the window parameters specified by - // |windowInfo|. This method should only be called on the UI thread. - /// - /*--cef(optional_param=url)--*/ - static CefRefPtr CreateBrowserSync(CefWindowInfo& windowInfo, - CefRefPtr client, - const CefString& url, - const CefBrowserSettings& settings); - - /// - // Call this method before destroying a contained browser window. This method - // performs any internal cleanup that may be needed before the browser window - // is destroyed. - /// - /*--cef()--*/ - virtual void ParentWindowWillClose() =0; - - /// - // Closes this browser window. - /// - /*--cef()--*/ - virtual void CloseBrowser() =0; - - /// - // Returns true if the browser can navigate backwards. - /// - /*--cef()--*/ - virtual bool CanGoBack() =0; - /// - // Navigate backwards. - /// - /*--cef()--*/ - virtual void GoBack() =0; - /// - // Returns true if the browser can navigate forwards. - /// - /*--cef()--*/ - virtual bool CanGoForward() =0; - /// - // Navigate forwards. - /// - /*--cef()--*/ - virtual void GoForward() =0; - /// - // Reload the current page. - /// - /*--cef()--*/ - virtual void Reload() =0; - /// - // Reload the current page ignoring any cached data. - /// - /*--cef()--*/ - virtual void ReloadIgnoreCache() =0; - /// - // Stop loading the page. - /// - /*--cef()--*/ - virtual void StopLoad() =0; - - /// - // Set focus for the browser window. If |enable| is true focus will be set to - // the window. Otherwise, focus will be removed. - /// - /*--cef()--*/ - virtual void SetFocus(bool enable) =0; - - /// - // Retrieve the window handle for this browser. - /// - /*--cef()--*/ - virtual CefWindowHandle GetWindowHandle() =0; - - /// - // Retrieve the window handle of the browser that opened this browser. Will - // return NULL for non-popup windows. This method can be used in combination - // with custom handling of modal windows. - /// - /*--cef()--*/ - virtual CefWindowHandle GetOpenerWindowHandle() =0; - - /// - // Returns true if the window is a popup window. - /// - /*--cef()--*/ - virtual bool IsPopup() =0; - - // Returns true if a document has been loaded in the browser. - /*--cef()--*/ - virtual bool HasDocument() =0; - - /// - // Returns the client for this browser. - /// - /*--cef()--*/ - virtual CefRefPtr GetClient() =0; - - /// - // Returns the main (top-level) frame for the browser window. - /// - /*--cef()--*/ - virtual CefRefPtr GetMainFrame() =0; - - /// - // Returns the focused frame for the browser window. This method should only - // be called on the UI thread. - /// - /*--cef()--*/ - virtual CefRefPtr GetFocusedFrame() =0; - - /// - // Returns the frame with the specified name, or NULL if not found. This - // method should only be called on the UI thread. - /// - /*--cef()--*/ - virtual CefRefPtr GetFrame(const CefString& name) =0; - - /// - // Returns the names of all existing frames. This method should only be called - // on the UI thread. - /// - /*--cef()--*/ - virtual void GetFrameNames(std::vector& names) =0; - - /// - // Search for |searchText|. |identifier| can be used to have multiple searches - // running simultaniously. |forward| indicates whether to search forward or - // backward within the page. |matchCase| indicates whether the search should - // be case-sensitive. |findNext| indicates whether this is the first request - // or a follow-up. - /// - /*--cef()--*/ - virtual void Find(int identifier, const CefString& searchText, - bool forward, bool matchCase, bool findNext) =0; - - /// - // Cancel all searches that are currently going on. - /// - /*--cef()--*/ - virtual void StopFinding(bool clearSelection) =0; - - /// - // Get the zoom level. - /// - /*--cef()--*/ - virtual double GetZoomLevel() =0; - - /// - // Change the zoom level to the specified value. - /// - /*--cef()--*/ - virtual void SetZoomLevel(double zoomLevel) =0; - - /// - // Clear the back/forward browsing history. - /// - /*--cef()--*/ - virtual void ClearHistory() =0; - - /// - // Open developer tools in its own window. - /// - /*--cef()--*/ - virtual void ShowDevTools() =0; - - /// - // Explicitly close the developer tools window if one exists for this browser - // instance. - /// - /*--cef()--*/ - virtual void CloseDevTools() =0; - - /// - // Returns true if window rendering is disabled. - /// - /*--cef()--*/ - virtual bool IsWindowRenderingDisabled() =0; - - /// - // Get the size of the specified element. This method should only be called on - // the UI thread. - /// - /*--cef()--*/ - virtual bool GetSize(PaintElementType type, int& width, int& height) =0; - - /// - // Set the size of the specified element. This method is only used when window - // rendering is disabled. - /// - /*--cef()--*/ - virtual void SetSize(PaintElementType type, int width, int height) =0; - - /// - // Returns true if a popup is currently visible. This method should only be - // called on the UI thread. - /// - /*--cef()--*/ - virtual bool IsPopupVisible() =0; - - /// - // Hide the currently visible popup, if any. - /// - /*--cef()--*/ - virtual void HidePopup() =0; - - /// - // Invalidate the |dirtyRect| region of the view. This method is only used - // when window rendering is disabled and will result in a call to - // HandlePaint(). - /// - /*--cef()--*/ - virtual void Invalidate(const CefRect& dirtyRect) =0; - - /// - // Get the raw image data contained in the specified element without - // performing validation. The specified |width| and |height| dimensions must - // match the current element size. On Windows |buffer| must be width*height*4 - // bytes in size and represents a BGRA image with an upper-left origin. This - // method should only be called on the UI thread. - /// - /*--cef()--*/ - virtual bool GetImage(PaintElementType type, int width, int height, - void* buffer) =0; - - /// - // Send a key event to the browser. - /// - /*--cef()--*/ - virtual void SendKeyEvent(KeyType type, const CefKeyInfo& keyInfo, - int modifiers) =0; - - /// - // Send a mouse click event to the browser. The |x| and |y| coordinates are - // relative to the upper-left corner of the view. - /// - /*--cef()--*/ - virtual void SendMouseClickEvent(int x, int y, MouseButtonType type, - bool mouseUp, int clickCount) =0; - - /// - // Send a mouse move event to the browser. The |x| and |y| coordinates are - // relative to the upper-left corner of the view. - /// - /*--cef()--*/ - virtual void SendMouseMoveEvent(int x, int y, bool mouseLeave) =0; - - /// - // Send a mouse wheel event to the browser. The |x| and |y| coordinates are - // relative to the upper-left corner of the view. The |deltaX| and |deltaY| - // values represent the movement delta in the X and Y directions respectively. - /// - /*--cef()--*/ - virtual void SendMouseWheelEvent(int x, int y, int deltaX, int deltaY) =0; - - /// - // Send a focus event to the browser. - /// - /*--cef()--*/ - virtual void SendFocusEvent(bool setFocus) =0; - - /// - // Send a capture lost event to the browser. - /// - /*--cef()--*/ - virtual void SendCaptureLostEvent() =0; -}; - -#endif // CEF_INCLUDE_CEF_BROWSER_H_ diff --git a/cef/include/cef_client.h b/cef/include/cef_client.h deleted file mode 100644 index 5e10971b8..000000000 --- a/cef/include/cef_client.h +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_CLIENT_H_ -#define CEF_INCLUDE_CEF_CLIENT_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_display_handler.h" -#include "include/cef_drag_handler.h" -#include "include/cef_find_handler.h" -#include "include/cef_focus_handler.h" -#include "include/cef_jsdialog_handler.h" -#include "include/cef_keyboard_handler.h" -#include "include/cef_life_span_handler.h" -#include "include/cef_load_handler.h" -#include "include/cef_menu_handler.h" -#include "include/cef_permission_handler.h" -#include "include/cef_print_handler.h" -#include "include/cef_render_handler.h" -#include "include/cef_request_handler.h" -#include "include/cef_v8context_handler.h" - -/// -// Implement this interface to provide handler implementations. -/// -/*--cef(source=client,no_debugct_check)--*/ -class CefClient : public virtual CefBase { - public: - /// - // Return the handler for browser life span events. - /// - /*--cef()--*/ - virtual CefRefPtr GetLifeSpanHandler() { - return NULL; - } - - /// - // Return the handler for browser load status events. - /// - /*--cef()--*/ - virtual CefRefPtr GetLoadHandler() { - return NULL; - } - - /// - // Return the handler for browser request events. - /// - /*--cef()--*/ - virtual CefRefPtr GetRequestHandler() { - return NULL; - } - - /// - // Return the handler for browser display state events. - /// - /*--cef()--*/ - virtual CefRefPtr GetDisplayHandler() { - return NULL; - } - - /// - // Return the handler for focus events. - /// - /*--cef()--*/ - virtual CefRefPtr GetFocusHandler() { - return NULL; - } - - /// - // Return the handler for keyboard events. - /// - /*--cef()--*/ - virtual CefRefPtr GetKeyboardHandler() { - return NULL; - } - - /// - // Return the handler for context menu events. - /// - /*--cef()--*/ - virtual CefRefPtr GetMenuHandler() { - return NULL; - } - - /// - // Return the handler for browser permission events. - /// - /*--cef()--*/ - virtual CefRefPtr GetPermissionHandler() { - return NULL; - } - - /// - // Return the handler for printing events. - /// - /*--cef()--*/ - virtual CefRefPtr GetPrintHandler() { - return NULL; - } - - /// - // Return the handler for find result events. - /// - /*--cef()--*/ - virtual CefRefPtr GetFindHandler() { - return NULL; - } - - /// - // Return the handler for JavaScript dialog events. - /// - /*--cef()--*/ - virtual CefRefPtr GetJSDialogHandler() { - return NULL; - } - - /// - // Return the handler for V8 context events. - /// - /*--cef()--*/ - virtual CefRefPtr GetV8ContextHandler() { - return NULL; - } - - /// - // Return the handler for off-screen rendering events. - /// - /*--cef()--*/ - virtual CefRefPtr GetRenderHandler() { - return NULL; - } - - /// - // Return the handler for drag events. - /// - /*--cef()--*/ - virtual CefRefPtr GetDragHandler() { - return NULL; - } -}; - -#endif // CEF_INCLUDE_CEF_CLIENT_H_ diff --git a/cef/include/cef_content_filter.h b/cef/include/cef_content_filter.h deleted file mode 100644 index af5cf1755..000000000 --- a/cef/include/cef_content_filter.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_CONTENT_FILTER_H_ -#define CEF_INCLUDE_CEF_CONTENT_FILTER_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_stream.h" - -/// -// Interface to implement for filtering response content. The methods of this -// class will always be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefContentFilter : public virtual CefBase { - public: - /// - // Set |substitute_data| to the replacement for the data in |data| if data - // should be modified. - /// - /*--cef()--*/ - virtual void ProcessData(const void* data, int data_size, - CefRefPtr& substitute_data) {} - - /// - // Called when there is no more data to be processed. It is expected that - // whatever data was retained in the last ProcessData() call, it should be - // returned now by setting |remainder| if appropriate. - /// - /*--cef()--*/ - virtual void Drain(CefRefPtr& remainder) {} -}; - -#endif // CEF_INCLUDE_CEF_CONTENT_FILTER_H_ diff --git a/cef/include/cef_download_handler.h b/cef/include/cef_download_handler.h deleted file mode 100644 index 8fd209447..000000000 --- a/cef/include/cef_download_handler.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_DOWNLOAD_HANDLER_H_ -#define CEF_INCLUDE_CEF_DOWNLOAD_HANDLER_H_ -#pragma once - -#include "include/cef_base.h" - -/// -// Class used to handle file downloads. The methods of this class will always be -// called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefDownloadHandler : public virtual CefBase { - public: - /// - // A portion of the file contents have been received. This method will be - // called multiple times until the download is complete. Return |true| to - // continue receiving data and |false| to cancel. - /// - /*--cef()--*/ - virtual bool ReceivedData(void* data, int data_size) =0; - - /// - // The download is complete. - /// - /*--cef()--*/ - virtual void Complete() =0; -}; - -#endif // CEF_INCLUDE_CEF_DOWNLOAD_HANDLER_H_ diff --git a/cef/include/cef_drag_data.h b/cef/include/cef_drag_data.h deleted file mode 100644 index 99487b3ae..000000000 --- a/cef/include/cef_drag_data.h +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_DRAG_DATA_H_ -#define CEF_INCLUDE_CEF_DRAG_DATA_H_ -#pragma once - -#include "include/cef_base.h" -#include - -/// -// Class used to represent drag data. The methods of this class may be called -// on any thread. -/// -/*--cef(source=library)--*/ -class CefDragData : public virtual CefBase { - public: - /// - // Returns true if the drag data is a link. - /// - /*--cef()--*/ - virtual bool IsLink() =0; - - /// - // Returns true if the drag data is a text or html fragment. - /// - /*--cef()--*/ - virtual bool IsFragment() =0; - - /// - // Returns true if the drag data is a file. - /// - /*--cef()--*/ - virtual bool IsFile() =0; - - /// - // Return the link URL that is being dragged. - /// - /*--cef()--*/ - virtual CefString GetLinkURL() =0; - - /// - // Return the title associated with the link being dragged. - /// - /*--cef()--*/ - virtual CefString GetLinkTitle() =0; - - /// - // Return the metadata, if any, associated with the link being dragged. - /// - /*--cef()--*/ - virtual CefString GetLinkMetadata() =0; - - /// - // Return the plain text fragment that is being dragged. - /// - /*--cef()--*/ - virtual CefString GetFragmentText() =0; - - /// - // Return the text/html fragment that is being dragged. - /// - /*--cef()--*/ - virtual CefString GetFragmentHtml() =0; - - /// - // Return the base URL that the fragment came from. This value is used for - // resolving relative URLs and may be empty. - /// - /*--cef()--*/ - virtual CefString GetFragmentBaseURL() =0; - - /// - // Return the extension of the file being dragged out of the browser window. - /// - /*--cef()--*/ - virtual CefString GetFileExtension() =0; - - /// - // Return the name of the file being dragged out of the browser window. - /// - /*--cef()--*/ - virtual CefString GetFileName() =0; - - /// - // Retrieve the list of file names that are being dragged into the browser - // window. - /// - /*--cef()--*/ - virtual bool GetFileNames(std::vector& names) =0; -}; - -#endif // CEF_INCLUDE_CEF_DRAG_DATA_H_ diff --git a/cef/include/cef_drag_handler.h b/cef/include/cef_drag_handler.h deleted file mode 100644 index 79d90e57e..000000000 --- a/cef/include/cef_drag_handler.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_DRAG_HANDLER_H_ -#define CEF_INCLUDE_CEF_DRAG_HANDLER_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_drag_data.h" -#include "include/cef_browser.h" - -/// -// Implement this interface to handle events related to dragging. The methods of -// this class will be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefDragHandler : public virtual CefBase { - public: - typedef cef_drag_operations_mask_t DragOperationsMask; - - /// - // Called when the browser window initiates a drag event. |dragData| - // contains the drag event data and |mask| represents the type of drag - // operation. Return false for default drag handling behavior or true to - // cancel the drag event. - /// - /*--cef()--*/ - virtual bool OnDragStart(CefRefPtr browser, - CefRefPtr dragData, - DragOperationsMask mask) { return false; } - - /// - // Called when an external drag event enters the browser window. |dragData| - // contains the drag event data and |mask| represents the type of drag - // operation. Return false for default drag handling behavior or true to - // cancel the drag event. - /// - /*--cef()--*/ - virtual bool OnDragEnter(CefRefPtr browser, - CefRefPtr dragData, - DragOperationsMask mask) { return false; } -}; - -#endif // CEF_INCLUDE_CEF_DRAG_HANDLER_H_ diff --git a/cef/include/cef_find_handler.h b/cef/include/cef_find_handler.h deleted file mode 100644 index bead6feeb..000000000 --- a/cef/include/cef_find_handler.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_FIND_HANDLER_H_ -#define CEF_INCLUDE_CEF_FIND_HANDLER_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_browser.h" - -/// -// Implement this interface to handle events related to find results. The -// methods of this class will be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefFindHandler : public virtual CefBase { - public: - /// - // Called to report find results returned by CefBrowser::Find(). |identifer| - // is the identifier passed to CefBrowser::Find(), |count| is the number of - // matches currently identified, |selectionRect| is the location of where the - // match was found (in window coordinates), |activeMatchOrdinal| is the - // current position in the search results, and |finalUpdate| is true if this - // is the last find notification. - /// - /*--cef()--*/ - virtual void OnFindResult(CefRefPtr browser, - int identifier, - int count, - const CefRect& selectionRect, - int activeMatchOrdinal, - bool finalUpdate) {} -}; - -#endif // CEF_INCLUDE_CEF_FIND_HANDLER_H_ diff --git a/cef/include/cef_jsdialog_handler.h b/cef/include/cef_jsdialog_handler.h deleted file mode 100644 index d3067f3c0..000000000 --- a/cef/include/cef_jsdialog_handler.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_JSDIALOG_HANDLER_H_ -#define CEF_INCLUDE_CEF_JSDIALOG_HANDLER_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_browser.h" -#include "include/cef_frame.h" - -/// -// Implement this interface to handle events related to JavaScript dialogs. The -// methods of this class will be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefJSDialogHandler : public virtual CefBase { - public: - /// - // Called to run a JavaScript alert message. Return false to display the - // default alert or true if you displayed a custom alert. - /// - /*--cef(optional_param=message)--*/ - virtual bool OnJSAlert(CefRefPtr browser, - CefRefPtr frame, - const CefString& message) { return false; } - - /// - // Called to run a JavaScript confirm request. Return false to display the - // default alert or true if you displayed a custom alert. If you handled the - // alert set |retval| to true if the user accepted the confirmation. - /// - /*--cef(optional_param=message)--*/ - virtual bool OnJSConfirm(CefRefPtr browser, - CefRefPtr frame, - const CefString& message, - bool& retval) { return false; } - - /// - // Called to run a JavaScript prompt request. Return false to display the - // default prompt or true if you displayed a custom prompt. If you handled - // the prompt set |retval| to true if the user accepted the prompt and request - // and |result| to the resulting value. - /// - /*--cef(optional_param=message,optional_param=defaultValue)--*/ - virtual bool OnJSPrompt(CefRefPtr browser, - CefRefPtr frame, - const CefString& message, - const CefString& defaultValue, - bool& retval, - CefString& result) { return false; } -}; - -#endif // CEF_INCLUDE_CEF_JSDIALOG_HANDLER_H_ diff --git a/cef/include/cef_keyboard_handler.h b/cef/include/cef_keyboard_handler.h deleted file mode 100644 index a8133e91f..000000000 --- a/cef/include/cef_keyboard_handler.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_KEYBOARD_HANDLER_H_ -#define CEF_INCLUDE_CEF_KEYBOARD_HANDLER_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_browser.h" - -/// -// Implement this interface to handle events related to keyboard input. The -// methods of this class will be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefKeyboardHandler : public virtual CefBase { - public: - typedef cef_handler_keyevent_type_t KeyEventType; - - /// - // Called when the browser component receives a keyboard event. This method - // is called both before the event is passed to the renderer and after - // JavaScript in the page has had a chance to handle the event. |type| is the - // type of keyboard event, |code| is the windows scan-code for the event, - // |modifiers| is a set of bit- flags describing any pressed modifier keys and - // |isSystemKey| is true if Windows considers this a 'system key' message (see - // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx). If - // |isAfterJavaScript| is true then JavaScript in the page has had a chance - // to handle the event and has chosen not to. Only RAWKEYDOWN, KEYDOWN and - // CHAR events will be sent with |isAfterJavaScript| set to true. Return - // true if the keyboard event was handled or false to allow continued handling - // of the event by the renderer. - /// - /*--cef()--*/ - virtual bool OnKeyEvent(CefRefPtr browser, - KeyEventType type, - int code, - int modifiers, - bool isSystemKey, - bool isAfterJavaScript) { return false; } -}; - -#endif // CEF_INCLUDE_CEF_KEYBOARD_HANDLER_H_ diff --git a/cef/include/cef_menu_handler.h b/cef/include/cef_menu_handler.h deleted file mode 100644 index 81fe115b1..000000000 --- a/cef/include/cef_menu_handler.h +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_MENU_HANDLER_H_ -#define CEF_INCLUDE_CEF_MENU_HANDLER_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_browser.h" - -/// -// Implement this interface to handle events related to browser context menus. -// The methods of this class will be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefMenuHandler : public virtual CefBase { - public: - typedef cef_menu_id_t MenuId; - - /// - // Called before a context menu is displayed. Return false to display the - // default context menu or true to cancel the display. - /// - /*--cef()--*/ - virtual bool OnBeforeMenu(CefRefPtr browser, - const CefMenuInfo& menuInfo) { return false; } - - /// - // Called to optionally override the default text for a context menu item. - // |label| contains the default text and may be modified to substitute - // alternate text. - /// - /*--cef()--*/ - virtual void GetMenuLabel(CefRefPtr browser, - MenuId menuId, - CefString& label) {} - - /// - // Called when an option is selected from the default context menu. Return - // false to execute the default action or true to cancel the action. - /// - /*--cef()--*/ - virtual bool OnMenuAction(CefRefPtr browser, - MenuId menuId) { return false; } -}; - -#endif // CEF_INCLUDE_CEF_MENU_HANDLER_H_ diff --git a/cef/include/cef_nplugin.h b/cef/include/cef_nplugin.h deleted file mode 100644 index 4b16fe91f..000000000 --- a/cef/include/cef_nplugin.h +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#ifndef CEF_INCLUDE_CEF_NPLUGIN_H_ -#define CEF_INCLUDE_CEF_NPLUGIN_H_ -#pragma once - -#include "internal/cef_nplugin_types.h" - -/// -// Netscape plugins are normally built at separate DLLs that are loaded by the -// browser when needed. This interface supports the creation of plugins that -// are an embedded component of the application. Embedded plugins built using -// this interface use the same Netscape Plugin API as DLL-based plugins. -// See https://developer.mozilla.org/En/Gecko_Plugin_API_Reference for complete -// documentation on how to use the Netscape Plugin API. -// -// This class provides attribute information and entry point functions for a -// plugin. -/// -class CefPluginInfo : public cef_plugin_info_t { - public: - CefPluginInfo() { - Init(); - } - virtual ~CefPluginInfo() { - Reset(); - } - - CefPluginInfo(const CefPluginInfo& r) { // NOLINT(runtime/explicit) - Init(); - *this = r; - } - CefPluginInfo(const cef_plugin_info_t& r) { // NOLINT(runtime/explicit) - Init(); - *this = r; - } - - void Reset() { - cef_string_clear(&unique_name); - cef_string_clear(&display_name); - cef_string_clear(&version); - cef_string_clear(&description); - cef_string_clear(&mime_types); - cef_string_clear(&file_extensions); - cef_string_clear(&type_descriptions); - Init(); - } - - void Attach(const cef_plugin_info_t& r) { - Reset(); - *static_cast(this) = r; - } - - void Detach() { - Init(); - } - - CefPluginInfo& operator=(const CefPluginInfo& r) { - return operator=(static_cast(r)); - } - - CefPluginInfo& operator=(const cef_plugin_info_t& r) { - cef_string_copy(r.unique_name.str, r.unique_name.length, &unique_name); - cef_string_copy(r.display_name.str, r.display_name.length, &display_name); - cef_string_copy(r.version.str, r.version.length, &version); - cef_string_copy(r.description.str, r.description.length, &description); - cef_string_copy(r.mime_types.str, r.mime_types.length, &mime_types); - cef_string_copy(r.file_extensions.str, r.file_extensions.length, - &file_extensions); - cef_string_copy(r.type_descriptions.str, r.type_descriptions.length, - &type_descriptions); -#if !defined(OS_POSIX) || defined(OS_MACOSX) - np_getentrypoints = r.np_getentrypoints; -#endif - np_initialize = r.np_initialize; - np_shutdown = r.np_shutdown; - return *this; - } - - protected: - void Init() { - memset(static_cast(this), 0, sizeof(cef_plugin_info_t)); - } -}; - -/// -// Register a plugin with the system. -/// -bool CefRegisterPlugin(const CefPluginInfo& plugin_info); - -#endif // CEF_INCLUDE_CEF_NPLUGIN_H_ diff --git a/cef/include/cef_permission_handler.h b/cef/include/cef_permission_handler.h deleted file mode 100644 index aea8e46bb..000000000 --- a/cef/include/cef_permission_handler.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_PERMISSION_HANDLER_H_ -#define CEF_INCLUDE_CEF_PERMISSION_HANDLER_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_browser.h" -#include "include/cef_frame.h" - -/// -// Implement this interface to handle events related to browser permissions. -// The methods of this class will be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefPermissionHandler : public virtual CefBase { - public: - /// - // Called on the UI thread before a script extension is loaded. - // Return false to let the extension load normally. - /// - /*--cef()--*/ - virtual bool OnBeforeScriptExtensionLoad(CefRefPtr browser, - CefRefPtr frame, - const CefString& extensionName) { - return false; - } -}; - -#endif // CEF_INCLUDE_CEF_PERMISSION_HANDLER_H_ diff --git a/cef/include/cef_print_handler.h b/cef/include/cef_print_handler.h deleted file mode 100644 index d47fbf632..000000000 --- a/cef/include/cef_print_handler.h +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_PRINT_HANDLER_H_ -#define CEF_INCLUDE_CEF_PRINT_HANDLER_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_browser.h" -#include "include/cef_frame.h" - -/// -// Implement this interface to handle events related to printing. The methods of -// this class will be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefPrintHandler : public virtual CefBase { - public: - /// - // Called to allow customization of standard print options before the print - // dialog is displayed. |printOptions| allows specification of paper size, - // orientation and margins. Note that the specified margins may be adjusted if - // they are outside the range supported by the printer. All units are in - // inches. Return false to display the default print options or true to - // display the modified |printOptions|. - /// - /*--cef()--*/ - virtual bool GetPrintOptions(CefRefPtr browser, - CefPrintOptions& printOptions) { return false; } - - /// - // Called to format print headers and footers. |printInfo| contains platform- - // specific information about the printer context. |url| is the URL if the - // currently printing page, |title| is the title of the currently printing - // page, |currentPage| is the current page number and |maxPages| is the total - // number of pages. Six default header locations are provided by the - // implementation: top left, top center, top right, bottom left, bottom center - // and bottom right. To use one of these default locations just assign a - // string to the appropriate variable. To draw the header and footer yourself - // return true. Otherwise, populate the approprate variables and return false. - /// - /*--cef()--*/ - 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) { return false; } -}; - -#endif // CEF_INCLUDE_CEF_PRINT_HANDLER_H_ diff --git a/cef/include/cef_render_handler.h b/cef/include/cef_render_handler.h deleted file mode 100644 index 9bb9f68af..000000000 --- a/cef/include/cef_render_handler.h +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_RENDER_HANDLER_H_ -#define CEF_INCLUDE_CEF_RENDER_HANDLER_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_browser.h" -#include - -/// -// Implement this interface to handle events when window rendering is disabled. -// The methods of this class will be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefRenderHandler : public virtual CefBase { - public: - typedef cef_paint_element_type_t PaintElementType; - typedef std::vector RectList; - - /// - // Called to retrieve the view rectangle which is relative to screen - // coordinates. Return true if the rectangle was provided. - /// - /*--cef()--*/ - virtual bool GetViewRect(CefRefPtr browser, - CefRect& rect) { return false; } - - /// - // Called to retrieve the simulated screen rectangle. Return true if the - // rectangle was provided. - /// - /*--cef()--*/ - virtual bool GetScreenRect(CefRefPtr browser, - CefRect& rect) { return false; } - - /// - // Called to retrieve the translation from view coordinates to actual screen - // coordinates. Return true if the screen coordinates were provided. - /// - /*--cef()--*/ - virtual bool GetScreenPoint(CefRefPtr browser, - int viewX, - int viewY, - int& screenX, - int& screenY) { return false; } - - /// - // Called when the browser wants to show or hide the popup widget. The popup - // should be shown if |show| is true and hidden if |show| is false. - /// - /*--cef()--*/ - virtual void OnPopupShow(CefRefPtr browser, - bool show) {} - - /// - // Called when the browser wants to move or resize the popup widget. |rect| - // contains the new location and size. - /// - /*--cef()--*/ - virtual void OnPopupSize(CefRefPtr browser, - const CefRect& rect) {} - - /// - // Called when an element should be painted. |type| indicates whether the - // element is the view or the popup widget. |buffer| contains the pixel data - // for the whole image. |dirtyRects| contains the set of rectangles that need - // to be repainted. On Windows |buffer| will be width*height*4 bytes in size - // and represents a BGRA image with an upper-left origin. - /// - /*--cef()--*/ - virtual void OnPaint(CefRefPtr browser, - PaintElementType type, - const RectList& dirtyRects, - const void* buffer) {} - - /// - // Called when the browser window's cursor has changed. - /// - /*--cef()--*/ - virtual void OnCursorChange(CefRefPtr browser, - CefCursorHandle cursor) {} -}; - -#endif // CEF_INCLUDE_CEF_RENDER_HANDLER_H_ diff --git a/cef/include/cef_request_handler.h b/cef/include/cef_request_handler.h deleted file mode 100644 index 0ee758f07..000000000 --- a/cef/include/cef_request_handler.h +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_REQUEST_HANDLER_H_ -#define CEF_INCLUDE_CEF_REQUEST_HANDLER_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_browser.h" -#include "include/cef_cookie.h" -#include "include/cef_download_handler.h" -#include "include/cef_frame.h" -#include "include/cef_content_filter.h" -#include "include/cef_response.h" -#include "include/cef_request.h" -#include "include/cef_stream.h" - -/// -// Implement this interface to handle events related to browser requests. The -// methods of this class will be called on the thread indicated. -/// -/*--cef(source=client)--*/ -class CefRequestHandler : public virtual CefBase { - public: - typedef cef_handler_navtype_t NavType; - - /// - // Called on the UI thread before browser navigation. Return true to cancel - // the navigation or false to allow the navigation to proceed. - /// - /*--cef()--*/ - virtual bool OnBeforeBrowse(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr request, - NavType navType, - bool isRedirect) { return false; } - - /// - // Called on the IO thread before a resource is loaded. To allow the resource - // to load normally return false. To redirect the resource to a new url - // populate the |redirectUrl| value and return false. To specify data for the - // resource return a CefStream object in |resourceStream|, use the |response| - // object to set mime type, HTTP status code and optional header values, and - // return false. To cancel loading of the resource return true. Any - // modifications to |request| will be observed. If the URL in |request| is - // changed and |redirectUrl| is also set, the URL in |request| will be used. - /// - /*--cef()--*/ - virtual bool OnBeforeResourceLoad(CefRefPtr browser, - CefRefPtr request, - CefString& redirectUrl, - CefRefPtr& resourceStream, - CefRefPtr response, - int loadFlags) { return false; } - - /// - // Called on the IO thread when a resource load is redirected. The |old_url| - // parameter will contain the old URL. The |new_url| parameter will contain - // the new URL and can be changed if desired. - /// - /*--cef()--*/ - virtual void OnResourceRedirect(CefRefPtr browser, - const CefString& old_url, - CefString& new_url) {} - - /// - // Called on the UI thread after a response to the resource request is - // received. Set |filter| if response content needs to be monitored and/or - // modified as it arrives. - /// - /*--cef()--*/ - virtual void OnResourceResponse(CefRefPtr browser, - const CefString& url, - CefRefPtr response, - CefRefPtr& filter) {} - - /// - // Called on the IO thread to handle requests for URLs with an unknown - // protocol component. Return true to indicate that the request should - // succeed because it was handled externally. Set |allowOSExecution| to true - // and return false to attempt execution via the registered OS protocol - // handler, if any. If false is returned and either |allow_os_execution| - // is false or OS protocol handler execution fails then the request will fail - // with an error condition. - // SECURITY WARNING: YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED - // ON SCHEME, HOST OR OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION. - /// - /*--cef()--*/ - virtual bool OnProtocolExecution(CefRefPtr browser, - const CefString& url, - bool& allowOSExecution) { return false; } - - /// - // Called on the UI thread when a server indicates via the - // 'Content-Disposition' header that a response represents a file to download. - // |mimeType| is the mime type for the download, |fileName| is the suggested - // target file name and |contentLength| is either the value of the - // 'Content-Size' header or -1 if no size was provided. Set |handler| to the - // CefDownloadHandler instance that will recieve the file contents. Return - // true to download the file or false to cancel the file download. - /// - /*--cef()--*/ - virtual bool GetDownloadHandler(CefRefPtr browser, - const CefString& mimeType, - const CefString& fileName, - int64 contentLength, - CefRefPtr& handler) - { return false; } - - /// - // Called on the IO thread when the browser needs credentials from the user. - // |isProxy| indicates whether the host is a proxy server. |host| contains the - // hostname and port number. Set |username| and |password| and return - // true to handle the request. Return false to cancel the request. - /// - /*--cef(optional_param=realm)--*/ - virtual bool GetAuthCredentials(CefRefPtr browser, - bool isProxy, - const CefString& host, - int port, - const CefString& realm, - const CefString& scheme, - CefString& username, - CefString& password) { return false; } - - /// - // Called on the IO thread to retrieve the cookie manager. |main_url| is the - // URL of the top-level frame. Cookies managers can be unique per browser or - // shared across multiple browsers. The global cookie manager will be used if - // this method returns NULL. - /// - /*--cef()--*/ - virtual CefRefPtr GetCookieManager( - CefRefPtr browser, - const CefString& main_url) { return NULL; } -}; - -#endif // CEF_INCLUDE_CEF_REQUEST_HANDLER_H_ diff --git a/cef/include/cef_scheme.h b/cef/include/cef_scheme.h deleted file mode 100644 index 1bd9a39b2..000000000 --- a/cef/include/cef_scheme.h +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_SCHEME_H_ -#define CEF_INCLUDE_CEF_SCHEME_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_browser.h" -#include "include/cef_response.h" -#include "include/cef_request.h" - -class CefSchemeHandler; -class CefSchemeHandlerFactory; - -/// -// Register a custom scheme. This method should not be called for the built-in -// HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes. -// -// If |is_standard| is true the scheme will be treated as a standard scheme. -// Standard schemes are subject to URL canonicalization and parsing rules as -// defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1 available -// at http://www.ietf.org/rfc/rfc1738.txt -// -// In particular, the syntax for standard scheme URLs must be of the form: -//
    -//  [scheme]://[username]:[password]@[host]:[port]/[url-path]
    -// 
    -// Standard scheme URLs must have a host component that is a fully qualified -// domain name as defined in Section 3.5 of RFC 1034 [13] and Section 2.1 of RFC -// 1123. These URLs will be canonicalized to "scheme://host/path" in the -// simplest case and "scheme://username:password@host:port/path" in the most -// explicit case. For example, "scheme:host/path" and "scheme:///host/path" will -// both be canonicalized to "scheme://host/path". The origin of a standard -// scheme URL is the combination of scheme, host and port (i.e., -// "scheme://host:port" in the most explicit case). -// -// For non-standard scheme URLs only the "scheme:" component is parsed and -// canonicalized. The remainder of the URL will be passed to the handler as-is. -// For example, "scheme:///some%20text" will remain the same. Non-standard -// scheme URLs cannot be used as a target for form submission. -// -// If |is_local| is true the scheme will be treated as local (i.e., with the -// same security rules as those applied to "file" URLs). Normal pages cannot -// link to or access local URLs. Also, by default, local URLs can only perform -// XMLHttpRequest calls to the same URL (origin + path) that originated the -// request. To allow XMLHttpRequest calls from a local URL to other URLs with -// the same origin set the CefSettings.file_access_from_file_urls_allowed value -// to true. To allow XMLHttpRequest calls from a local URL to all origins set -// the CefSettings.universal_access_from_file_urls_allowed value to true. -// -// If |is_display_isolated| is true the scheme will be treated as display- -// isolated. This means that pages cannot display these URLs unless they are -// from the same scheme. For example, pages in another origin cannot create -// iframes or hyperlinks to URLs with this scheme. -// -// This function may be called on any thread. It should only be called once -// per unique |scheme_name| value. If |scheme_name| is already registered or if -// an error occurs this method will return false. -/// -/*--cef()--*/ -bool CefRegisterCustomScheme(const CefString& scheme_name, - bool is_standard, - bool is_local, - bool is_display_isolated); - -/// -// Register a scheme handler factory for the specified |scheme_name| and -// optional |domain_name|. An empty |domain_name| value for a standard scheme -// will cause the factory to match all domain names. The |domain_name| value -// will be ignored for non-standard schemes. If |scheme_name| is a built-in -// scheme and no handler is returned by |factory| then the built-in scheme -// handler factory will be called. If |scheme_name| is a custom scheme the -// CefRegisterCustomScheme() function should be called for that scheme. -// This function may be called multiple times to change or remove the factory -// that matches the specified |scheme_name| and optional |domain_name|. -// Returns false if an error occurs. This function may be called on any thread. -/// -/*--cef(optional_param=domain_name,optional_param=factory)--*/ -bool CefRegisterSchemeHandlerFactory(const CefString& scheme_name, - const CefString& domain_name, - CefRefPtr factory); - -/// -// Clear all registered scheme handler factories. Returns false on error. This -// function may be called on any thread. -/// -/*--cef()--*/ -bool CefClearSchemeHandlerFactories(); - - -/// -// Class that creates CefSchemeHandler instances. The methods of this class will -// always be called on the IO thread. -/// -/*--cef(source=client)--*/ -class CefSchemeHandlerFactory : public virtual CefBase { - public: - /// - // Return a new scheme handler instance to handle the request. |browser| will - // be the browser window that initiated the request. If the request was - // initiated using the CefWebURLRequest API |browser| will be NULL. The - // |request| object passed to this method will not contain cookie data. - /// - /*--cef()--*/ - virtual CefRefPtr Create(CefRefPtr browser, - const CefString& scheme_name, - CefRefPtr request) =0; -}; - -/// -// Class used to facilitate asynchronous responses to custom scheme handler -// requests. The methods of this class may be called on any thread. -/// -/*--cef(source=library)--*/ -class CefSchemeHandlerCallback : public virtual CefBase { - public: - /// - // Notify that header information is now available for retrieval. - /// - /*--cef()--*/ - virtual void HeadersAvailable() =0; - - /// - // Notify that response data is now available for reading. - /// - /*--cef()--*/ - virtual void BytesAvailable() =0; - - /// - // Cancel processing of the request. - /// - /*--cef()--*/ - virtual void Cancel() =0; -}; - -/// -// Class used to implement a custom scheme handler interface. The methods of -// this class will always be called on the IO thread. -/// -/*--cef(source=client)--*/ -class CefSchemeHandler : public virtual CefBase { - public: - /// - // Begin processing the request. To handle the request return true and call - // HeadersAvailable() once the response header information is available - // (HeadersAvailable() can also be called from inside this method if header - // information is available immediately). To cancel the request return false. - /// - /*--cef()--*/ - virtual bool ProcessRequest(CefRefPtr request, - CefRefPtr callback) =0; - - /// - // Retrieve response header information. If the response length is not known - // set |response_length| to -1 and ReadResponse() will be called until it - // returns false. If the response length is known set |response_length| - // to a positive value and ReadResponse() will be called until it returns - // false or the specified number of bytes have been read. Use the |response| - // object to set the mime type, http status code and other optional header - // values. To redirect the request to a new URL set |redirectUrl| to the new - // URL. - /// - /*--cef()--*/ - virtual void GetResponseHeaders(CefRefPtr response, - int64& response_length, - CefString& redirectUrl) =0; - - /// - // Read response data. If data is available immediately copy up to - // |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of - // bytes copied, and return true. To read the data at a later time set - // |bytes_read| to 0, return true and call BytesAvailable() when the data is - // available. To indicate response completion return false. - /// - /*--cef()--*/ - virtual bool ReadResponse(void* data_out, - int bytes_to_read, - int& bytes_read, - CefRefPtr callback) =0; - - /// - // Request processing has been canceled. - /// - /*--cef()--*/ - virtual void Cancel() =0; -}; - -#endif // CEF_INCLUDE_CEF_SCHEME_H_ diff --git a/cef/include/cef_storage.h b/cef/include/cef_storage.h deleted file mode 100644 index 869595159..000000000 --- a/cef/include/cef_storage.h +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_STORAGE_H_ -#define CEF_INCLUDE_CEF_STORAGE_H_ -#pragma once - -#include "include/cef_base.h" - -class CefStorageVisitor; - -typedef cef_storage_type_t CefStorageType; - -/// -// Visit storage of the specified type. If |origin| is non-empty only data -// matching that origin will be visited. If |key| is non-empty only data -// matching that key will be visited. Otherwise, all data for the storage -// type will be visited. Origin should be of the form scheme://domain. If no -// origin is specified only data currently in memory will be returned. Returns -// false if the storage cannot be accessed. -/// -/*--cef(optional_param=origin,optional_param=key)--*/ -bool CefVisitStorage(CefStorageType type, const CefString& origin, - const CefString& key, - CefRefPtr visitor); - -/// -// Sets storage of the specified type, origin, key and value. Returns false if -// storage cannot be accessed. This method must be called on the UI thread. -/// -/*--cef()--*/ -bool CefSetStorage(CefStorageType type, const CefString& origin, - const CefString& key, const CefString& value); - -/// -// Deletes all storage of the specified type. If |origin| is non-empty only data -// matching that origin will be cleared. If |key| is non-empty only data -// matching that key will be cleared. Otherwise, all data for the storage type -// will be cleared. Returns false if storage cannot be accessed. This method -// must be called on the UI thread. -/// -/*--cef(optional_param=origin,optional_param=key)--*/ -bool CefDeleteStorage(CefStorageType type, const CefString& origin, - const CefString& key); - -/// -// Sets the directory path that will be used for storing data of the specified -// type. Currently only the ST_LOCALSTORAGE type is supported by this method. -// If |path| is empty data will be stored in memory only. By default the storage -// path is the same as the cache path. Returns false if the storage cannot be -// accessed. -/// -/*--cef(optional_param=path)--*/ -bool CefSetStoragePath(CefStorageType type, const CefString& path); - - -/// -// Interface to implement for visiting storage. The methods of this class will -// always be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefStorageVisitor : public virtual CefBase { - public: - /// - // Method that will be called once for each key/value data pair in storage. - // |count| is the 0-based index for the current pair. |total| is the total - // number of pairs. Set |deleteData| to true to delete the pair currently - // being visited. Return false to stop visiting pairs. This method may never - // be called if no data is found. - /// - /*--cef()--*/ - virtual bool Visit(CefStorageType type, const CefString& origin, - const CefString& key, const CefString& value, int count, - int total, bool& deleteData) =0; -}; - -#endif // CEF_INCLUDE_CEF_STORAGE_H_ diff --git a/cef/include/cef_v8.h b/cef/include/cef_v8.h deleted file mode 100644 index 6024ce4a9..000000000 --- a/cef/include/cef_v8.h +++ /dev/null @@ -1,618 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - - -#ifndef CEF_INCLUDE_CEF_V8_H_ -#define CEF_INCLUDE_CEF_V8_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_browser.h" -#include "include/cef_frame.h" -#include - -class CefV8Handler; -class CefV8Value; - - -/// -// Register a new V8 extension with the specified JavaScript extension code and -// handler. Functions implemented by the handler are prototyped using the -// keyword 'native'. The calling of a native function is restricted to the scope -// in which the prototype of the native function is defined. This function may -// be called on any thread. -// -// Example JavaScript extension code: -//
    -//   // create the 'example' global object if it doesn't already exist.
    -//   if (!example)
    -//     example = {};
    -//   // create the 'example.test' global object if it doesn't already exist.
    -//   if (!example.test)
    -//     example.test = {};
    -//   (function() {
    -//     // Define the function 'example.test.myfunction'.
    -//     example.test.myfunction = function() {
    -//       // Call CefV8Handler::Execute() with the function name 'MyFunction'
    -//       // and no arguments.
    -//       native function MyFunction();
    -//       return MyFunction();
    -//     };
    -//     // Define the getter function for parameter 'example.test.myparam'.
    -//     example.test.__defineGetter__('myparam', function() {
    -//       // Call CefV8Handler::Execute() with the function name 'GetMyParam'
    -//       // and no arguments.
    -//       native function GetMyParam();
    -//       return GetMyParam();
    -//     });
    -//     // Define the setter function for parameter 'example.test.myparam'.
    -//     example.test.__defineSetter__('myparam', function(b) {
    -//       // Call CefV8Handler::Execute() with the function name 'SetMyParam'
    -//       // and a single argument.
    -//       native function SetMyParam();
    -//       if(b) SetMyParam(b);
    -//     });
    -//
    -//     // Extension definitions can also contain normal JavaScript variables
    -//     // and functions.
    -//     var myint = 0;
    -//     example.test.increment = function() {
    -//       myint += 1;
    -//       return myint;
    -//     };
    -//   })();
    -// 
    -// Example usage in the page: -//
    -//   // Call the function.
    -//   example.test.myfunction();
    -//   // Set the parameter.
    -//   example.test.myparam = value;
    -//   // Get the parameter.
    -//   value = example.test.myparam;
    -//   // Call another function.
    -//   example.test.increment();
    -// 
    -/// -/*--cef(optional_param=handler)--*/ -bool CefRegisterExtension(const CefString& extension_name, - const CefString& javascript_code, - CefRefPtr handler); - - -/// -// Class that encapsulates a V8 context handle. -/// -/*--cef(source=library)--*/ -class CefV8Context : public virtual CefBase { - public: - /// - // Returns the current (top) context object in the V8 context stack. - /// - /*--cef()--*/ - static CefRefPtr GetCurrentContext(); - - /// - // Returns the entered (bottom) context object in the V8 context stack. - /// - /*--cef()--*/ - static CefRefPtr GetEnteredContext(); - - /// - // Returns true if V8 is currently inside a context. - /// - /*--cef()--*/ - static bool InContext(); - - /// - // Returns the browser for this context. - /// - /*--cef()--*/ - virtual CefRefPtr GetBrowser() =0; - - /// - // Returns the frame for this context. - /// - /*--cef()--*/ - virtual CefRefPtr GetFrame() =0; - - /// - // Returns the global object for this context. - /// - /*--cef()--*/ - virtual CefRefPtr GetGlobal() =0; - - /// - // Enter this context. A context must be explicitly entered before creating a - // V8 Object, Array or Function asynchronously. Exit() must be called the same - // number of times as Enter() before releasing this context. V8 objects belong - // to the context in which they are created. Returns true if the scope was - // entered successfully. - /// - /*--cef()--*/ - virtual bool Enter() =0; - - /// - // Exit this context. Call this method only after calling Enter(). Returns - // true if the scope was exited successfully. - /// - /*--cef()--*/ - virtual bool Exit() =0; - - /// - // Returns true if this object is pointing to the same handle as |that| - // object. - /// - /*--cef()--*/ - virtual bool IsSame(CefRefPtr that) =0; -}; - - -typedef std::vector > CefV8ValueList; - -/// -// Interface that should be implemented to handle V8 function calls. The methods -// of this class will always be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefV8Handler : public virtual CefBase { - public: - /// - // Handle execution of the function identified by |name|. |object| is the - // receiver ('this' object) of the function. |arguments| is the list of - // arguments passed to the function. If execution succeeds set |retval| to the - // function return value. If execution fails set |exception| to the exception - // that will be thrown. Return true if execution was handled. - /// - /*--cef()--*/ - virtual bool Execute(const CefString& name, - CefRefPtr object, - const CefV8ValueList& arguments, - CefRefPtr& retval, - CefString& exception) =0; -}; - -/// -// Interface that should be implemented to handle V8 accessor calls. Accessor -// identifiers are registered by calling CefV8Value::SetValue(). The methods -// of this class will always be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefV8Accessor : public virtual CefBase { - public: - /// - // Handle retrieval the accessor value identified by |name|. |object| is the - // receiver ('this' object) of the accessor. If retrieval succeeds set - // |retval| to the return value. If retrieval fails set |exception| to the - // exception that will be thrown. Return true if accessor retrieval was - // handled. - /// - /*--cef()--*/ - virtual bool Get(const CefString& name, - const CefRefPtr object, - CefRefPtr& retval, - CefString& exception) =0; - - /// - // Handle assignment of the accessor value identified by |name|. |object| is - // the receiver ('this' object) of the accessor. |value| is the new value - // being assigned to the accessor. If assignment fails set |exception| to the - // exception that will be thrown. Return true if accessor assignment was - // handled. - /// - /*--cef()--*/ - virtual bool Set(const CefString& name, - const CefRefPtr object, - const CefRefPtr value, - CefString& exception) =0; -}; - -/// -// Class representing a V8 exception. -/// -/*--cef(source=library)--*/ -class CefV8Exception : public virtual CefBase { - public: - /// - // Returns the exception message. - /// - /*--cef()--*/ - virtual CefString GetMessage() =0; - - /// - // Returns the line of source code that the exception occurred within. - /// - /*--cef()--*/ - virtual CefString GetSourceLine() =0; - - /// - // Returns the resource name for the script from where the function causing - // the error originates. - /// - /*--cef()--*/ - virtual CefString GetScriptResourceName() =0; - - /// - // Returns the 1-based number of the line where the error occurred or 0 if the - // line number is unknown. - /// - /*--cef()--*/ - virtual int GetLineNumber() =0; - - /// - // Returns the index within the script of the first character where the error - // occurred. - /// - /*--cef()--*/ - virtual int GetStartPosition() =0; - - /// - // Returns the index within the script of the last character where the error - // occurred. - /// - /*--cef()--*/ - virtual int GetEndPosition() =0; - - /// - // Returns the index within the line of the first character where the error - // occurred. - /// - /*--cef()--*/ - virtual int GetStartColumn() =0; - - /// - // Returns the index within the line of the last character where the error - // occurred. - /// - /*--cef()--*/ - virtual int GetEndColumn() =0; -}; - -/// -// Class representing a V8 value. The methods of this class should only be -// called on the UI thread. -/// -/*--cef(source=library)--*/ -class CefV8Value : public virtual CefBase { - public: - typedef cef_v8_accesscontrol_t AccessControl; - typedef cef_v8_propertyattribute_t PropertyAttribute; - - /// - // Create a new CefV8Value object of type undefined. - /// - /*--cef()--*/ - static CefRefPtr CreateUndefined(); - /// - // Create a new CefV8Value object of type null. - /// - /*--cef()--*/ - static CefRefPtr CreateNull(); - /// - // Create a new CefV8Value object of type bool. - /// - /*--cef()--*/ - static CefRefPtr CreateBool(bool value); - /// - // Create a new CefV8Value object of type int. - /// - /*--cef()--*/ - static CefRefPtr CreateInt(int value); - /// - // Create a new CefV8Value object of type double. - /// - /*--cef()--*/ - static CefRefPtr CreateDouble(double value); - /// - // Create a new CefV8Value object of type Date. - /// - /*--cef()--*/ - static CefRefPtr CreateDate(const CefTime& date); - /// - // Create a new CefV8Value object of type string. - /// - /*--cef(optional_param=value)--*/ - static CefRefPtr CreateString(const CefString& value); - /// - // Create a new CefV8Value object of type object with optional user data and - // accessor. This method should only be called from within the scope of a - // CefV8ContextHandler, CefV8Handler or CefV8Accessor callback, or in - // combination with calling Enter() and Exit() on a stored CefV8Context - // reference. - /// - /*--cef(capi_name=cef_v8value_create_object_with_accessor, - optional_param=user_data,optional_param=accessor)--*/ - static CefRefPtr CreateObject(CefRefPtr user_data, - CefRefPtr accessor); - /// - // Create a new CefV8Value object of type array. This method should only be - // called from within the scope of a CefV8ContextHandler, CefV8Handler or - // CefV8Accessor callback, or in combination with calling Enter() and Exit() - // on a stored CefV8Context reference. - /// - /*--cef()--*/ - static CefRefPtr CreateArray(); - /// - // Create a new CefV8Value object of type function. This method should only be - // called from within the scope of a CefV8ContextHandler, CefV8Handler or - // CefV8Accessor callback, or in combination with calling Enter() and Exit() - // on a stored CefV8Context reference. - /// - /*--cef()--*/ - static CefRefPtr CreateFunction(const CefString& name, - CefRefPtr handler); - - /// - // True if the value type is undefined. - /// - /*--cef()--*/ - virtual bool IsUndefined() =0; - /// - // True if the value type is null. - /// - /*--cef()--*/ - virtual bool IsNull() =0; - /// - // True if the value type is bool. - /// - /*--cef()--*/ - virtual bool IsBool() =0; - /// - // True if the value type is int. - /// - /*--cef()--*/ - virtual bool IsInt() =0; - /// - // True if the value type is double. - /// - /*--cef()--*/ - virtual bool IsDouble() =0; - /// - // True if the value type is Date. - /// - /*--cef()--*/ - virtual bool IsDate() =0; - /// - // True if the value type is string. - /// - /*--cef()--*/ - virtual bool IsString() =0; - /// - // True if the value type is object. - /// - /*--cef()--*/ - virtual bool IsObject() =0; - /// - // True if the value type is array. - /// - /*--cef()--*/ - virtual bool IsArray() =0; - /// - // True if the value type is function. - /// - /*--cef()--*/ - virtual bool IsFunction() =0; - - /// - // Returns true if this object is pointing to the same handle as |that| - // object. - /// - /*--cef()--*/ - virtual bool IsSame(CefRefPtr that) =0; - - /// - // Return a bool value. The underlying data will be converted to if - // necessary. - /// - /*--cef()--*/ - virtual bool GetBoolValue() =0; - /// - // Return an int value. The underlying data will be converted to if - // necessary. - /// - /*--cef()--*/ - virtual int GetIntValue() =0; - /// - // Return a double value. The underlying data will be converted to if - // necessary. - /// - /*--cef()--*/ - virtual double GetDoubleValue() =0; - /// - // Return a Date value. The underlying data will be converted to if - // necessary. - /// - /*--cef()--*/ - virtual CefTime GetDateValue() =0; - /// - // Return a string value. The underlying data will be converted to if - // necessary. - /// - /*--cef()--*/ - virtual CefString GetStringValue() =0; - - - // OBJECT METHODS - These methods are only available on objects. Arrays and - // functions are also objects. String- and integer-based keys can be used - // interchangably with the framework converting between them as necessary. - - /// - // Returns true if the object has a value with the specified identifier. - /// - /*--cef(capi_name=has_value_bykey)--*/ - virtual bool HasValue(const CefString& key) =0; - /// - // Returns true if the object has a value with the specified identifier. - /// - /*--cef(capi_name=has_value_byindex,index_param=index)--*/ - virtual bool HasValue(int index) =0; - - /// - // Delete the value with the specified identifier. - /// - /*--cef(capi_name=delete_value_bykey)--*/ - virtual bool DeleteValue(const CefString& key) =0; - /// - // Delete the value with the specified identifier. - /// - /*--cef(capi_name=delete_value_byindex,index_param=index)--*/ - virtual bool DeleteValue(int index) =0; - - /// - // Returns the value with the specified identifier. - /// - /*--cef(capi_name=get_value_bykey)--*/ - virtual CefRefPtr GetValue(const CefString& key) =0; - /// - // Returns the value with the specified identifier. - /// - /*--cef(capi_name=get_value_byindex,index_param=index)--*/ - virtual CefRefPtr GetValue(int index) =0; - - /// - // Associate a value with the specified identifier. - /// - /*--cef(capi_name=set_value_bykey)--*/ - virtual bool SetValue(const CefString& key, CefRefPtr value, - PropertyAttribute attribute) =0; - /// - // Associate a value with the specified identifier. - /// - /*--cef(capi_name=set_value_byindex,index_param=index)--*/ - virtual bool SetValue(int index, CefRefPtr value) =0; - - /// - // Register an identifier whose access will be forwarded to the CefV8Accessor - // instance passed to CefV8Value::CreateObject(). - /// - /*--cef(capi_name=set_value_byaccessor)--*/ - virtual bool SetValue(const CefString& key, AccessControl settings, - PropertyAttribute attribute) =0; - - /// - // Read the keys for the object's values into the specified vector. Integer- - // based keys will also be returned as strings. - /// - /*--cef()--*/ - virtual bool GetKeys(std::vector& keys) =0; - - /// - // Returns the user data, if any, specified when the object was created. - /// - /*--cef()--*/ - virtual CefRefPtr GetUserData() =0; - - /// - // Returns the amount of externally allocated memory registered for the - // object. - /// - /*--cef()--*/ - virtual int GetExternallyAllocatedMemory() =0; - - /// - // Adjusts the amount of registered external memory for the object. Used to - // give V8 an indication of the amount of externally allocated memory that is - // kept alive by JavaScript objects. V8 uses this information to decide when - // to perform global garbage collection. Each CefV8Value tracks the amount of - // external memory associated with it and automatically decreases the global - // total by the appropriate amount on its destruction. |change_in_bytes| - // specifies the number of bytes to adjust by. This method returns the number - // of bytes associated with the object after the adjustment. - /// - /*--cef()--*/ - virtual int AdjustExternallyAllocatedMemory(int change_in_bytes) =0; - - - // ARRAY METHODS - These methods are only available on arrays. - - /// - // Returns the number of elements in the array. - /// - /*--cef()--*/ - virtual int GetArrayLength() =0; - - - // FUNCTION METHODS - These methods are only available on functions. - - /// - // Returns the function name. - /// - /*--cef()--*/ - virtual CefString GetFunctionName() =0; - - /// - // Returns the function handler or NULL if not a CEF-created function. - /// - /*--cef()--*/ - virtual CefRefPtr GetFunctionHandler() =0; - - /// - // Execute the function using the current V8 context. This method should only - // be called from within the scope of a CefV8Handler or CefV8Accessor - // callback, or in combination with calling Enter() and Exit() on a stored - // CefV8Context reference. |object| is the receiver ('this' object) of the - // function. |arguments| is the list of arguments that will be passed to the - // function. If execution succeeds |retval| will be set to the function return - // value. If execution fails |exception| will be set to the exception that was - // thrown. If |rethrow_exception| is true any exception will also be re- - // thrown. This method returns false if called incorrectly. - /// - /*--cef(optional_param=object)--*/ - virtual bool ExecuteFunction(CefRefPtr object, - const CefV8ValueList& arguments, - CefRefPtr& retval, - CefRefPtr& exception, - bool rethrow_exception) =0; - - /// - // Execute the function using the specified V8 context. |object| is the - // receiver ('this' object) of the function. |arguments| is the list of - // arguments that will be passed to the function. If execution succeeds - // |retval| will be set to the function return value. If execution fails - // |exception| will be set to the exception that was thrown. If - // |rethrow_exception| is true any exception will also be re-thrown. This - // method returns false if called incorrectly. - /// - /*--cef(optional_param=object)--*/ - virtual bool ExecuteFunctionWithContext(CefRefPtr context, - CefRefPtr object, - const CefV8ValueList& arguments, - CefRefPtr& retval, - CefRefPtr& exception, - bool rethrow_exception) =0; -}; - -#endif // CEF_INCLUDE_CEF_V8_H_ diff --git a/cef/include/cef_v8context_handler.h b/cef/include/cef_v8context_handler.h deleted file mode 100644 index 5fd82da03..000000000 --- a/cef/include/cef_v8context_handler.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_V8CONTEXT_HANDLER_H_ -#define CEF_INCLUDE_CEF_V8CONTEXT_HANDLER_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_browser.h" -#include "include/cef_frame.h" -#include "include/cef_v8.h" - -/// -// Implement this interface to handle V8 context events. The methods of this -// class will be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefV8ContextHandler : public virtual CefBase { - public: - /// - // Called immediately after the V8 context for a frame has been created. To - // retrieve the JavaScript 'window' object use the CefV8Context::GetGlobal() - // method. - /// - /*--cef()--*/ - virtual void OnContextCreated(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr context) {} - - /// - // Called immediately before the V8 context for a frame is released. No - // references to the context should be kept after this method is called. - /// - /*--cef()--*/ - virtual void OnContextReleased(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr context) {} -}; - -#endif // CEF_INCLUDE_CEF_V8CONTEXT_HANDLER_H_ diff --git a/cef/include/cef_web_urlrequest.h b/cef/include/cef_web_urlrequest.h deleted file mode 100644 index c5f471f9a..000000000 --- a/cef/include/cef_web_urlrequest.h +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_WEB_URLREQUEST_H_ -#define CEF_INCLUDE_CEF_WEB_URLREQUEST_H_ -#pragma once - -#include "include/cef_base.h" -#include "include/cef_request.h" -#include "include/cef_response.h" - -class CefWebURLRequestClient; - -/// -// Class used to make a Web URL request. Web URL requests are not associated -// with a browser instance so no CefClient callbacks will be executed. The -// methods of this class may be called on any thread. -/// -/*--cef(source=library)--*/ -class CefWebURLRequest : public virtual CefBase { - public: - typedef cef_weburlrequest_state_t RequestState; - - /// - // Create a new CefWebUrlRequest object. - /// - /*--cef()--*/ - static CefRefPtr CreateWebURLRequest( - CefRefPtr request, - CefRefPtr client); - - /// - // Cancels the request. - /// - /*--cef()--*/ - virtual void Cancel() =0; - - /// - // Returns the current ready state of the request. - /// - /*--cef(default_retval=WUR_STATE_UNSENT)--*/ - virtual RequestState GetState() =0; -}; - -/// -// Interface that should be implemented by the CefWebURLRequest client. The -// methods of this class will always be called on the UI thread. -/// -/*--cef(source=client)--*/ -class CefWebURLRequestClient : public virtual CefBase { - public: - typedef cef_weburlrequest_state_t RequestState; - typedef cef_handler_errorcode_t ErrorCode; - - /// - // Notifies the client that the request state has changed. State change - // notifications will always be sent before the below notification methods - // are called. - /// - /*--cef()--*/ - virtual void OnStateChange(CefRefPtr requester, - RequestState state) =0; - - /// - // Notifies the client that the request has been redirected and provides a - // chance to change the request parameters. - /// - /*--cef()--*/ - virtual void OnRedirect(CefRefPtr requester, - CefRefPtr request, - CefRefPtr response) =0; - - /// - // Notifies the client of the response data. - /// - /*--cef()--*/ - virtual void OnHeadersReceived(CefRefPtr requester, - CefRefPtr response) =0; - - /// - // Notifies the client of the upload progress. - /// - /*--cef()--*/ - virtual void OnProgress(CefRefPtr requester, - uint64 bytesSent, uint64 totalBytesToBeSent) =0; - - /// - // Notifies the client that content has been received. - /// - /*--cef()--*/ - virtual void OnData(CefRefPtr requester, - const void* data, int dataLength) =0; - - /// - // Notifies the client that the request ended with an error. - /// - /*--cef()--*/ - virtual void OnError(CefRefPtr requester, - ErrorCode errorCode) =0; -}; - -#endif // CEF_INCLUDE_CEF_WEB_URLREQUEST_H_ diff --git a/cef/include/internal/cef_mac.h b/cef/include/internal/cef_mac.h deleted file mode 100644 index d979e80fe..000000000 --- a/cef/include/internal/cef_mac.h +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright (c) 2010 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#ifndef CEF_INCLUDE_INTERNAL_CEF_MAC_H_ -#define CEF_INCLUDE_INTERNAL_CEF_MAC_H_ -#pragma once - -#if defined(OS_MACOSX) -#include -#include "include/internal/cef_types_mac.h" -#include "include/internal/cef_types_wrappers.h" - -/// -// Atomic increment and decrement. -/// -inline long CefAtomicIncrement(long volatile *pDest) { // NOLINT(runtime/int) - return __sync_add_and_fetch(pDest, 1); -} -inline long CefAtomicDecrement(long volatile *pDest) { // NOLINT(runtime/int) - return __sync_sub_and_fetch(pDest, 1); -} - -/// -// Handle types. -/// -#define CefWindowHandle cef_window_handle_t -#define CefCursorHandle cef_cursor_handle_t - -/// -// Critical section wrapper. -/// -class CefCriticalSection { - public: - CefCriticalSection() { - pthread_mutexattr_init(&attr_); - pthread_mutexattr_settype(&attr_, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(&lock_, &attr_); - } - virtual ~CefCriticalSection() { - pthread_mutex_destroy(&lock_); - pthread_mutexattr_destroy(&attr_); - } - void Lock() { - pthread_mutex_lock(&lock_); - } - void Unlock() { - pthread_mutex_unlock(&lock_); - } - - pthread_mutex_t lock_; - pthread_mutexattr_t attr_; -}; - - -struct CefWindowInfoTraits { - typedef cef_window_info_t struct_type; - - static inline void init(struct_type* s) {} - - static inline void clear(struct_type* s) { - cef_string_clear(&s->m_windowName); - } - - static inline void set(const struct_type* src, struct_type* target, - bool copy) { - target->m_View = src->m_View; - target->m_ParentView = src->m_ParentView; - cef_string_set(src->m_windowName.str, src->m_windowName.length, - &target->m_windowName, copy); - target->m_x = src->m_x; - target->m_y = src->m_y; - target->m_nWidth = src->m_nWidth; - target->m_nHeight = src->m_nHeight; - target->m_bHidden = src->m_bHidden; - target->m_bWindowRenderingDisabled = src->m_bWindowRenderingDisabled; - target->m_bTransparentPainting = src->m_bTransparentPainting; - } -}; - -/// -// Class representing window information. -/// -class CefWindowInfo : public CefStructBase { - public: - typedef CefStructBase parent; - - CefWindowInfo() : parent() {} - explicit CefWindowInfo(const cef_window_info_t& r) : parent(r) {} - explicit CefWindowInfo(const CefWindowInfo& r) : parent(r) {} - - void SetAsChild(CefWindowHandle ParentView, int x, int y, int width, - int height) { - m_ParentView = ParentView; - m_x = x; - m_y = y; - m_nWidth = width; - m_nHeight = height; - m_bHidden = false; - } - - void SetAsOffScreen(NSView* parent) { - m_bWindowRenderingDisabled = true; - m_ParentView = parent; - } - - void SetTransparentPainting(int transparentPainting) { - m_bTransparentPainting = transparentPainting; - } -}; - - -struct CefPrintInfoTraits { - typedef cef_print_info_t struct_type; - - static inline void init(struct_type* s) {} - static inline void clear(struct_type* s) {} - - static inline void set(const struct_type* src, struct_type* target, - bool copy) { - target->m_Scale = src->m_Scale; - } -}; - -/// -// Class representing print context information. -/// -typedef CefStructBase CefPrintInfo; - -struct CefKeyInfoTraits { - typedef cef_key_info_t struct_type; - - static inline void init(struct_type* s) {} - static inline void clear(struct_type* s) {} - - static inline void set(const struct_type* src, struct_type* target, - bool copy) { - target->keyCode = src->keyCode; - target->character = src->character; - target->characterNoModifiers = src->characterNoModifiers; - } -}; - -/// -// Class representing key information. -/// -typedef CefStructBase CefKeyInfo; - - -#endif // OS_MACOSX - -#endif // CEF_INCLUDE_INTERNAL_CEF_MAC_H_ diff --git a/cef/include/internal/cef_nplugin_types.h b/cef/include/internal/cef_nplugin_types.h deleted file mode 100644 index 47f6705eb..000000000 --- a/cef/include/internal/cef_nplugin_types.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#ifndef CEF_INCLUDE_INTERNAL_CEF_NPLUGIN_TYPES_H_ -#define CEF_INCLUDE_INTERNAL_CEF_NPLUGIN_TYPES_H_ -#pragma once - -#include "include/internal/cef_export.h" -#include "include/internal/cef_string.h" -// Include path modified for CEF Binary Distribution. -#include "include/internal/npapi/npapi.h" -// Include path modified for CEF Binary Distribution. -#include "include/internal/npapi/nphostapi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Netscape plugins are normally built at separate DLLs that are loaded by the -// browser when needed. This interface supports the creation of plugins that -// are an embedded component of the application. Embedded plugins built using -// this interface use the same Netscape Plugin API as DLL-based plugins. -// See https://developer.mozilla.org/En/Gecko_Plugin_API_Reference for complete -// documentation on how to use the Netscape Plugin API. - -// This structure provides attribute information and entry point functions for -// a plugin. -typedef struct _cef_plugin_info_t { - // The unique name that identifies the plugin. - cef_string_t unique_name; - - // The friendly display name of the plugin. - cef_string_t display_name; - - // The version string of the plugin. - cef_string_t version; - - // A description of the plugin. - cef_string_t description; - - // A pipe (|) delimited list of mime type values that the plugin supports. - cef_string_t mime_types; - - // A pipe (|) delimited list of extension values. Each value is associated - // with the mime type value at the same position. Multiple file extensions - // for the same mime type may be delimited with commas (,). - cef_string_t file_extensions; - - // A pipe (|) delimited list of description values. Each value is associated - // with the mime type value at the same position. - cef_string_t type_descriptions; - - // Entry point function pointers. -#if !defined(OS_POSIX) || defined(OS_MACOSX) - NP_GetEntryPointsFunc np_getentrypoints; -#endif - NP_InitializeFunc np_initialize; - NP_ShutdownFunc np_shutdown; -} cef_plugin_info_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_INTERNAL_CEF_NPLUGIN_TYPES_H_ diff --git a/cef/include/internal/cef_types.h b/cef/include/internal/cef_types.h deleted file mode 100644 index e3b266eed..000000000 --- a/cef/include/internal/cef_types.h +++ /dev/null @@ -1,1097 +0,0 @@ -// Copyright (c) 2010 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_H_ -#define CEF_INCLUDE_INTERNAL_CEF_TYPES_H_ -#pragma once - -#include "include/internal/cef_build.h" -#include "include/internal/cef_string.h" -#include "include/internal/cef_string_list.h" -#include "include/internal/cef_time.h" - -// Bring in platform-specific definitions. -#if defined(OS_WIN) -#include "include/internal/cef_types_win.h" -#elif defined(OS_MACOSX) -#include "include/internal/cef_types_mac.h" -#elif defined(OS_LINUX) -#include "include/internal/cef_types_linux.h" -#endif - -#include // For size_t - -// The NSPR system headers define 64-bit as |long| when possible, except on -// Mac OS X. In order to not have typedef mismatches, we do the same on LP64. -// -// On Mac OS X, |long long| is used for 64-bit types for compatibility with -// format macros even in the LP64 model. -#if defined(__LP64__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) -typedef long int64; // NOLINT(runtime/int) -typedef unsigned long uint64; // NOLINT(runtime/int) -#else -typedef long long int64; // NOLINT(runtime/int) -typedef unsigned long long uint64; // NOLINT(runtime/int) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Log severity levels. -/// -enum cef_log_severity_t { - LOGSEVERITY_VERBOSE = -1, - LOGSEVERITY_INFO, - LOGSEVERITY_WARNING, - LOGSEVERITY_ERROR, - LOGSEVERITY_ERROR_REPORT, - // Disables logging completely. - LOGSEVERITY_DISABLE = 99 -}; - -/// -// Initialization settings. Specify NULL or 0 to get the recommended default -// values. -/// -typedef struct _cef_settings_t { - /// - // Size of this structure. - /// - size_t size; - - /// - // Set to true (1) to have the message loop run in a separate thread. If - // false (0) than the CefDoMessageLoopWork() function must be called from - // your application message loop. - /// - bool multi_threaded_message_loop; - - /// - // The location where cache data will be stored on disk. If empty an - // in-memory cache will be used. HTML5 databases such as localStorage will - // only persist across sessions if a cache path is specified. - /// - cef_string_t cache_path; - - /// - // Value that will be returned as the User-Agent HTTP header. If empty the - // default User-Agent string will be used. - /// - cef_string_t user_agent; - - /// - // Value that will be inserted as the product portion of the default - // User-Agent string. If empty the Chromium product version will be used. If - // |userAgent| is specified this value will be ignored. - /// - cef_string_t product_version; - - /// - // The locale string that will be passed to WebKit. If empty the default - // locale of "en-US" will be used. This value is ignored on Linux where locale - // is determined using environment variable parsing with the precedence order: - // LANGUAGE, LC_ALL, LC_MESSAGES and LANG. - /// - cef_string_t locale; - - /// - // List of fully qualified paths to plugins (including plugin name) that will - // be loaded in addition to any plugins found in the default search paths. - /// - cef_string_list_t extra_plugin_paths; - - /// - // The directory and file name to use for the debug log. If empty, the - // default name of "debug.log" will be used and the file will be written - // to the application directory. - /// - cef_string_t log_file; - - /// - // The log severity. Only messages of this severity level or higher will be - // logged. - /// - cef_log_severity_t log_severity; - - /// - // The graphics implementation that CEF will use for rendering GPU accelerated - // content like WebGL, accelerated layers and 3D CSS. - /// - cef_graphics_implementation_t graphics_implementation; - - /// - // Quota limit for localStorage data across all origins. Default size is 5MB. - /// - unsigned int local_storage_quota; - - /// - // Quota limit for sessionStorage data per namespace. Default size is 5MB. - /// - unsigned int session_storage_quota; - - /// - // Custom flags that will be used when initializing the V8 JavaScript engine. - // The consequences of using custom flags may not be well tested. - /// - cef_string_t javascript_flags; - -#if defined(OS_WIN) - /// - // Set to true (1) to use the system proxy resolver on Windows when - // "Automatically detect settings" is checked. This setting is disabled - // by default for performance reasons. - /// - bool auto_detect_proxy_settings_enabled; -#endif - - /// - // The fully qualified path for the cef.pak file. If this value is empty - // the cef.pak file must be located in the module directory. This value is - // ignored on Mac OS X where pack files are always loaded from the app bundle - // resource directory. - /// - cef_string_t pack_file_path; - - /// - // The fully qualified path for the locales directory. If this value is empty - // the locales directory must be located in the module directory. This value - // is ignored on Mac OS X where pack files are always loaded from the app - // bundle resource directory. - /// - cef_string_t locales_dir_path; - - /// - // Set to true (1) to disable loading of pack files for resources and locales. - // A resource bundle handler must be provided for the browser and renderer - // processes via CefApp::GetResourceBundleHandler() if loading of pack files - // is disabled. - /// - bool pack_loading_disabled; -} cef_settings_t; - -/// -// Browser initialization settings. Specify NULL or 0 to get the recommended -// default values. The consequences of using custom values may not be well -// tested. -/// -typedef struct _cef_browser_settings_t { - /// - // Size of this structure. - /// - size_t size; - - /// - // Disable drag & drop of URLs from other windows. - /// - bool drag_drop_disabled; - - /// - // Disable default navigation resulting from drag & drop of URLs. - /// - bool load_drops_disabled; - - /// - // Disable history back/forward navigation. - /// - bool history_disabled; - - // The below values map to WebPreferences settings. - - /// - // Font settings. - /// - cef_string_t standard_font_family; - cef_string_t fixed_font_family; - cef_string_t serif_font_family; - cef_string_t sans_serif_font_family; - cef_string_t cursive_font_family; - cef_string_t fantasy_font_family; - int default_font_size; - int default_fixed_font_size; - int minimum_font_size; - int minimum_logical_font_size; - - /// - // Set to true (1) to disable loading of fonts from remote sources. - /// - bool remote_fonts_disabled; - - /// - // Default encoding for Web content. If empty "ISO-8859-1" will be used. - /// - cef_string_t default_encoding; - - /// - // Set to true (1) to attempt automatic detection of content encoding. - /// - bool encoding_detector_enabled; - - /// - // Set to true (1) to disable JavaScript. - /// - bool javascript_disabled; - - /// - // Set to true (1) to disallow JavaScript from opening windows. - /// - bool javascript_open_windows_disallowed; - - /// - // Set to true (1) to disallow JavaScript from closing windows. - /// - bool javascript_close_windows_disallowed; - - /// - // Set to true (1) to disallow JavaScript from accessing the clipboard. - /// - bool javascript_access_clipboard_disallowed; - - /// - // Set to true (1) to disable DOM pasting in the editor. DOM pasting also - // depends on |javascript_cannot_access_clipboard| being false (0). - /// - bool dom_paste_disabled; - - /// - // Set to true (1) to enable drawing of the caret position. - /// - bool caret_browsing_enabled; - - /// - // Set to true (1) to disable Java. - /// - bool java_disabled; - - /// - // Set to true (1) to disable plugins. - /// - bool plugins_disabled; - - /// - // Set to true (1) to allow access to all URLs from file URLs. - /// - bool universal_access_from_file_urls_allowed; - - /// - // Set to true (1) to allow access to file URLs from other file URLs. - /// - bool file_access_from_file_urls_allowed; - - /// - // Set to true (1) to allow risky security behavior such as cross-site - // scripting (XSS). Use with extreme care. - /// - bool web_security_disabled; - - /// - // Set to true (1) to enable console warnings about XSS attempts. - /// - bool xss_auditor_enabled; - - /// - // Set to true (1) to suppress the network load of image URLs. A cached - // image will still be rendered if requested. - /// - bool image_load_disabled; - - /// - // Set to true (1) to shrink standalone images to fit the page. - /// - bool shrink_standalone_images_to_fit; - - /// - // Set to true (1) to disable browser backwards compatibility features. - /// - bool site_specific_quirks_disabled; - - /// - // Set to true (1) to disable resize of text areas. - /// - bool text_area_resize_disabled; - - /// - // Set to true (1) to disable use of the page cache. - /// - bool page_cache_disabled; - - /// - // Set to true (1) to not have the tab key advance focus to links. - /// - bool tab_to_links_disabled; - - /// - // Set to true (1) to disable hyperlink pings ( and window.sendPing). - /// - bool hyperlink_auditing_disabled; - - /// - // Set to true (1) to enable the user style sheet for all pages. - /// - bool user_style_sheet_enabled; - - /// - // Location of the user style sheet. This must be a data URL of the form - // "data:text/css;charset=utf-8;base64,csscontent" where "csscontent" is the - // base64 encoded contents of the CSS file. - /// - cef_string_t user_style_sheet_location; - - /// - // Set to true (1) to disable style sheets. - /// - bool author_and_user_styles_disabled; - - /// - // Set to true (1) to disable local storage. - /// - bool local_storage_disabled; - - /// - // Set to true (1) to disable databases. - /// - bool databases_disabled; - - /// - // Set to true (1) to disable application cache. - /// - bool application_cache_disabled; - - /// - // Set to true (1) to disable WebGL. - /// - bool webgl_disabled; - - /// - // Set to true (1) to enable accelerated compositing. This is turned off by - // default because the current in-process GPU implementation does not - // support it correctly. - /// - bool accelerated_compositing_enabled; - - /// - // Set to true (1) to enable threaded compositing. This is currently only - // supported by the command buffer graphics implementation. - /// - bool threaded_compositing_enabled; - - /// - // Set to true (1) to disable accelerated layers. This affects features like - // 3D CSS transforms. - /// - bool accelerated_layers_disabled; - - /// - // Set to true (1) to disable accelerated video. - /// - bool accelerated_video_disabled; - - /// - // Set to true (1) to disable accelerated 2d canvas. - /// - bool accelerated_2d_canvas_disabled; - - /// - // Set to true (1) to disable accelerated painting. - /// - bool accelerated_painting_disabled; - - /// - // Set to true (1) to disable accelerated filters. - /// - bool accelerated_filters_disabled; - - /// - // Set to true (1) to disable accelerated plugins. - /// - bool accelerated_plugins_disabled; - - /// - // Set to true (1) to disable developer tools (WebKit inspector). - /// - bool developer_tools_disabled; - - /// - // Set to true (1) to enable fullscreen mode. - /// - bool fullscreen_enabled; -} cef_browser_settings_t; - -/// -// URL component parts. -/// -typedef struct _cef_urlparts_t { - /// - // The complete URL specification. - /// - cef_string_t spec; - - /// - // Scheme component not including the colon (e.g., "http"). - /// - cef_string_t scheme; - - /// - // User name component. - /// - cef_string_t username; - - /// - // Password component. - /// - cef_string_t password; - - /// - // Host component. This may be a hostname, an IPv4 address or an IPv6 literal - // surrounded by square brackets (e.g., "[2001:db8::1]"). - /// - cef_string_t host; - - /// - // Port number component. - /// - cef_string_t port; - - /// - // Path component including the first slash following the host. - /// - cef_string_t path; - - /// - // Query string component (i.e., everything following the '?'). - /// - cef_string_t query; -} cef_urlparts_t; - -/// -// Cookie information. -/// -typedef struct _cef_cookie_t { - /// - // The cookie name. - /// - cef_string_t name; - - /// - // The cookie value. - /// - cef_string_t value; - - /// - // If |domain| is empty a host cookie will be created instead of a domain - // cookie. Domain cookies are stored with a leading "." and are visible to - // sub-domains whereas host cookies are not. - /// - cef_string_t domain; - - /// - // If |path| is non-empty only URLs at or below the path will get the cookie - // value. - /// - cef_string_t path; - - /// - // If |secure| is true the cookie will only be sent for HTTPS requests. - /// - bool secure; - - /// - // If |httponly| is true the cookie will only be sent for HTTP requests. - /// - bool httponly; - - /// - // The cookie creation date. This is automatically populated by the system on - // cookie creation. - /// - cef_time_t creation; - - /// - // The cookie last access date. This is automatically populated by the system - // on access. - /// - cef_time_t last_access; - - /// - // The cookie expiration date is only valid if |has_expires| is true. - /// - bool has_expires; - cef_time_t expires; -} cef_cookie_t; - -/// -// Storage types. -/// -enum cef_storage_type_t { - ST_LOCALSTORAGE = 0, - ST_SESSIONSTORAGE, -}; - -/// -// Mouse button types. -/// -enum cef_mouse_button_type_t { - MBT_LEFT = 0, - MBT_MIDDLE, - MBT_RIGHT, -}; - -/// -// Key types. -/// -enum cef_key_type_t { - KT_KEYUP = 0, - KT_KEYDOWN, - KT_CHAR, -}; - -/// -// Various browser navigation types supported by chrome. -/// -enum cef_handler_navtype_t { - NAVTYPE_LINKCLICKED = 0, - NAVTYPE_FORMSUBMITTED, - NAVTYPE_BACKFORWARD, - NAVTYPE_RELOAD, - NAVTYPE_FORMRESUBMITTED, - NAVTYPE_OTHER, - NAVTYPE_LINKDROPPED, -}; - -/// -// Supported error code values. See net\base\net_error_list.h for complete -// descriptions of the error codes. -/// -enum cef_handler_errorcode_t { - ERR_FAILED = -2, - ERR_ABORTED = -3, - ERR_INVALID_ARGUMENT = -4, - ERR_INVALID_HANDLE = -5, - ERR_FILE_NOT_FOUND = -6, - ERR_TIMED_OUT = -7, - ERR_FILE_TOO_BIG = -8, - ERR_UNEXPECTED = -9, - ERR_ACCESS_DENIED = -10, - ERR_NOT_IMPLEMENTED = -11, - ERR_CONNECTION_CLOSED = -100, - ERR_CONNECTION_RESET = -101, - ERR_CONNECTION_REFUSED = -102, - ERR_CONNECTION_ABORTED = -103, - ERR_CONNECTION_FAILED = -104, - ERR_NAME_NOT_RESOLVED = -105, - ERR_INTERNET_DISCONNECTED = -106, - ERR_SSL_PROTOCOL_ERROR = -107, - ERR_ADDRESS_INVALID = -108, - ERR_ADDRESS_UNREACHABLE = -109, - ERR_SSL_CLIENT_AUTH_CERT_NEEDED = -110, - ERR_TUNNEL_CONNECTION_FAILED = -111, - ERR_NO_SSL_VERSIONS_ENABLED = -112, - ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113, - ERR_SSL_RENEGOTIATION_REQUESTED = -114, - ERR_CERT_COMMON_NAME_INVALID = -200, - ERR_CERT_DATE_INVALID = -201, - ERR_CERT_AUTHORITY_INVALID = -202, - ERR_CERT_CONTAINS_ERRORS = -203, - ERR_CERT_NO_REVOCATION_MECHANISM = -204, - ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205, - ERR_CERT_REVOKED = -206, - ERR_CERT_INVALID = -207, - ERR_CERT_END = -208, - ERR_INVALID_URL = -300, - ERR_DISALLOWED_URL_SCHEME = -301, - ERR_UNKNOWN_URL_SCHEME = -302, - ERR_TOO_MANY_REDIRECTS = -310, - ERR_UNSAFE_REDIRECT = -311, - ERR_UNSAFE_PORT = -312, - ERR_INVALID_RESPONSE = -320, - ERR_INVALID_CHUNKED_ENCODING = -321, - ERR_METHOD_NOT_SUPPORTED = -322, - ERR_UNEXPECTED_PROXY_AUTH = -323, - ERR_EMPTY_RESPONSE = -324, - ERR_RESPONSE_HEADERS_TOO_BIG = -325, - ERR_CACHE_MISS = -400, - ERR_INSECURE_RESPONSE = -501, -}; - -/// -// "Verb" of a drag-and-drop operation as negotiated between the source and -// destination. These constants match their equivalents in WebCore's -// DragActions.h and should not be renumbered. -/// -enum cef_drag_operations_mask_t { - DRAG_OPERATION_NONE = 0, - DRAG_OPERATION_COPY = 1, - DRAG_OPERATION_LINK = 2, - DRAG_OPERATION_GENERIC = 4, - DRAG_OPERATION_PRIVATE = 8, - DRAG_OPERATION_MOVE = 16, - DRAG_OPERATION_DELETE = 32, - DRAG_OPERATION_EVERY = UINT_MAX -}; - -/// -// V8 access control values. -/// -enum cef_v8_accesscontrol_t { - V8_ACCESS_CONTROL_DEFAULT = 0, - V8_ACCESS_CONTROL_ALL_CAN_READ = 1, - V8_ACCESS_CONTROL_ALL_CAN_WRITE = 1 << 1, - V8_ACCESS_CONTROL_PROHIBITS_OVERWRITING = 1 << 2 -}; - -/// -// V8 property attribute values. -/// -enum cef_v8_propertyattribute_t { - V8_PROPERTY_ATTRIBUTE_NONE = 0, // Writeable, Enumerable, - // Configurable - V8_PROPERTY_ATTRIBUTE_READONLY = 1 << 0, // Not writeable - V8_PROPERTY_ATTRIBUTE_DONTENUM = 1 << 1, // Not enumerable - V8_PROPERTY_ATTRIBUTE_DONTDELETE = 1 << 2 // Not configurable -}; - -/// -// Structure representing menu information. -/// -typedef struct _cef_menu_info_t { - /// - // Values from the cef_handler_menutypebits_t enumeration. - /// - int typeFlags; - - /// - // If window rendering is enabled |x| and |y| will be in screen coordinates. - // Otherwise, |x| and |y| will be in view coordinates. - /// - int x; - int y; - - cef_string_t linkUrl; - cef_string_t imageUrl; - cef_string_t pageUrl; - cef_string_t frameUrl; - cef_string_t selectionText; - cef_string_t misspelledWord; - - /// - // Values from the cef_handler_menucapabilitybits_t enumeration. - /// - int editFlags; - - cef_string_t securityInfo; -} cef_menu_info_t; - -/// -// The cef_menu_info_t typeFlags value will be a combination of the -// following values. -/// -enum cef_menu_typebits_t { - /// - // No node is selected - /// - MENUTYPE_NONE = 0x0, - /// - // The top page is selected - /// - MENUTYPE_PAGE = 0x1, - /// - // A subframe page is selected - /// - MENUTYPE_FRAME = 0x2, - /// - // A link is selected - /// - MENUTYPE_LINK = 0x4, - /// - // An image is selected - /// - MENUTYPE_IMAGE = 0x8, - /// - // There is a textual or mixed selection that is selected - /// - MENUTYPE_SELECTION = 0x10, - /// - // An editable element is selected - /// - MENUTYPE_EDITABLE = 0x20, - /// - // A misspelled word is selected - /// - MENUTYPE_MISSPELLED_WORD = 0x40, - /// - // A video node is selected - /// - MENUTYPE_VIDEO = 0x80, - /// - // A video node is selected - /// - MENUTYPE_AUDIO = 0x100, -}; - -/// -// The cef_menu_info_t editFlags value will be a combination of the -// following values. -/// -enum cef_menu_capabilitybits_t { - // Values from WebContextMenuData::EditFlags in WebContextMenuData.h - MENU_CAN_DO_NONE = 0x0, - MENU_CAN_UNDO = 0x1, - MENU_CAN_REDO = 0x2, - MENU_CAN_CUT = 0x4, - MENU_CAN_COPY = 0x8, - MENU_CAN_PASTE = 0x10, - MENU_CAN_DELETE = 0x20, - MENU_CAN_SELECT_ALL = 0x40, - MENU_CAN_TRANSLATE = 0x80, - // Values unique to CEF - MENU_CAN_GO_FORWARD = 0x10000000, - MENU_CAN_GO_BACK = 0x20000000, -}; - -/// -// Supported menu ID values. -/// -enum cef_menu_id_t { - MENU_ID_NAV_BACK = 10, - MENU_ID_NAV_FORWARD = 11, - MENU_ID_NAV_RELOAD = 12, - MENU_ID_NAV_RELOAD_NOCACHE = 13, - MENU_ID_NAV_STOP = 14, - MENU_ID_UNDO = 20, - MENU_ID_REDO = 21, - MENU_ID_CUT = 22, - MENU_ID_COPY = 23, - MENU_ID_PASTE = 24, - MENU_ID_DELETE = 25, - MENU_ID_SELECTALL = 26, - MENU_ID_PRINT = 30, - MENU_ID_VIEWSOURCE = 31, -}; - -enum cef_paint_element_type_t { - PET_VIEW = 0, - PET_POPUP, -}; - -/// -// Post data elements may represent either bytes or files. -/// -enum cef_postdataelement_type_t { - PDE_TYPE_EMPTY = 0, - PDE_TYPE_BYTES, - PDE_TYPE_FILE, -}; - -enum cef_weburlrequest_flags_t { - WUR_FLAG_NONE = 0, - WUR_FLAG_SKIP_CACHE = 0x1, - WUR_FLAG_ALLOW_CACHED_CREDENTIALS = 0x2, - WUR_FLAG_ALLOW_COOKIES = 0x4, - WUR_FLAG_REPORT_UPLOAD_PROGRESS = 0x8, - WUR_FLAG_REPORT_LOAD_TIMING = 0x10, - WUR_FLAG_REPORT_RAW_HEADERS = 0x20 -}; - -enum cef_weburlrequest_state_t { - WUR_STATE_UNSENT = 0, - WUR_STATE_STARTED = 1, - WUR_STATE_HEADERS_RECEIVED = 2, - WUR_STATE_LOADING = 3, - WUR_STATE_DONE = 4, - WUR_STATE_ERROR = 5, - WUR_STATE_ABORT = 6, -}; - -/// -// Focus sources. -/// -enum cef_handler_focus_source_t { - /// - // The source is explicit navigation via the API (LoadURL(), etc). - /// - FOCUS_SOURCE_NAVIGATION = 0, - /// - // The source is a system-generated focus event. - /// - FOCUS_SOURCE_SYSTEM, - /// - // The source is a child widget of the browser window requesting focus. - /// - FOCUS_SOURCE_WIDGET, -}; - -/// -// Key event types. -/// -enum cef_handler_keyevent_type_t { - KEYEVENT_RAWKEYDOWN = 0, - KEYEVENT_KEYDOWN, - KEYEVENT_KEYUP, - KEYEVENT_CHAR -}; - -/// -// Key event modifiers. -/// -enum cef_handler_keyevent_modifiers_t { - KEY_SHIFT = 1 << 0, - KEY_CTRL = 1 << 1, - KEY_ALT = 1 << 2, - KEY_META = 1 << 3, - KEY_KEYPAD = 1 << 4, // Only used on Mac OS-X -}; - -/// -// Structure representing a rectangle. -/// -typedef struct _cef_rect_t { - int x; - int y; - int width; - int height; -} cef_rect_t; - -/// -// Existing thread IDs. -/// -enum cef_thread_id_t { - TID_UI = 0, - TID_IO = 1, - TID_FILE = 2, -}; - -/// -// Paper type for printing. -/// -enum cef_paper_type_t { - PT_LETTER = 0, - PT_LEGAL, - PT_EXECUTIVE, - PT_A3, - PT_A4, - PT_CUSTOM -}; - -/// -// Paper metric information for printing. -/// -struct cef_paper_metrics { - enum cef_paper_type_t paper_type; - // Length and width needed if paper_type is custom_size - // Units are in inches. - double length; - double width; -}; - -/// -// Paper print margins. -/// -struct cef_print_margins { - // Margin size in inches for left/right/top/bottom (this is content margins). - double left; - double right; - double top; - double bottom; - // Margin size (top/bottom) in inches for header/footer. - double header; - double footer; -}; - -/// -// Page orientation for printing. -/// -enum cef_page_orientation { - PORTRAIT = 0, - LANDSCAPE -}; - -/// -// Printing options. -/// -typedef struct _cef_print_options_t { - enum cef_page_orientation page_orientation; - struct cef_paper_metrics paper_metrics; - struct cef_print_margins paper_margins; -} cef_print_options_t; - -/// -// Supported XML encoding types. The parser supports ASCII, ISO-8859-1, and -// UTF16 (LE and BE) by default. All other types must be translated to UTF8 -// before being passed to the parser. If a BOM is detected and the correct -// decoder is available then that decoder will be used automatically. -/// -enum cef_xml_encoding_type_t { - XML_ENCODING_NONE = 0, - XML_ENCODING_UTF8, - XML_ENCODING_UTF16LE, - XML_ENCODING_UTF16BE, - XML_ENCODING_ASCII, -}; - -/// -// XML node types. -/// -enum cef_xml_node_type_t { - XML_NODE_UNSUPPORTED = 0, - XML_NODE_PROCESSING_INSTRUCTION, - XML_NODE_DOCUMENT_TYPE, - XML_NODE_ELEMENT_START, - XML_NODE_ELEMENT_END, - XML_NODE_ATTRIBUTE, - XML_NODE_TEXT, - XML_NODE_CDATA, - XML_NODE_ENTITY_REFERENCE, - XML_NODE_WHITESPACE, - XML_NODE_COMMENT, -}; - -/// -// Status message types. -/// -enum cef_handler_statustype_t { - STATUSTYPE_TEXT = 0, - STATUSTYPE_MOUSEOVER_URL, - STATUSTYPE_KEYBOARD_FOCUS_URL, -}; - -/// -// Popup window features. -/// -typedef struct _cef_popup_features_t { - int x; - bool xSet; - int y; - bool ySet; - int width; - bool widthSet; - int height; - bool heightSet; - - bool menuBarVisible; - bool statusBarVisible; - bool toolBarVisible; - bool locationBarVisible; - bool scrollbarsVisible; - bool resizable; - - bool fullscreen; - bool dialog; - cef_string_list_t additionalFeatures; -} cef_popup_features_t; - -/// -// DOM document types. -/// -enum cef_dom_document_type_t { - DOM_DOCUMENT_TYPE_UNKNOWN = 0, - DOM_DOCUMENT_TYPE_HTML, - DOM_DOCUMENT_TYPE_XHTML, - DOM_DOCUMENT_TYPE_PLUGIN, -}; - -/// -// DOM event category flags. -/// -enum cef_dom_event_category_t { - DOM_EVENT_CATEGORY_UNKNOWN = 0x0, - DOM_EVENT_CATEGORY_UI = 0x1, - DOM_EVENT_CATEGORY_MOUSE = 0x2, - DOM_EVENT_CATEGORY_MUTATION = 0x4, - DOM_EVENT_CATEGORY_KEYBOARD = 0x8, - DOM_EVENT_CATEGORY_TEXT = 0x10, - DOM_EVENT_CATEGORY_COMPOSITION = 0x20, - DOM_EVENT_CATEGORY_DRAG = 0x40, - DOM_EVENT_CATEGORY_CLIPBOARD = 0x80, - DOM_EVENT_CATEGORY_MESSAGE = 0x100, - DOM_EVENT_CATEGORY_WHEEL = 0x200, - DOM_EVENT_CATEGORY_BEFORE_TEXT_INSERTED = 0x400, - DOM_EVENT_CATEGORY_OVERFLOW = 0x800, - DOM_EVENT_CATEGORY_PAGE_TRANSITION = 0x1000, - DOM_EVENT_CATEGORY_POPSTATE = 0x2000, - DOM_EVENT_CATEGORY_PROGRESS = 0x4000, - DOM_EVENT_CATEGORY_XMLHTTPREQUEST_PROGRESS = 0x8000, - DOM_EVENT_CATEGORY_WEBKIT_ANIMATION = 0x10000, - DOM_EVENT_CATEGORY_WEBKIT_TRANSITION = 0x20000, - DOM_EVENT_CATEGORY_BEFORE_LOAD = 0x40000, -}; - -/// -// DOM event processing phases. -/// -enum cef_dom_event_phase_t { - DOM_EVENT_PHASE_UNKNOWN = 0, - DOM_EVENT_PHASE_CAPTURING, - DOM_EVENT_PHASE_AT_TARGET, - DOM_EVENT_PHASE_BUBBLING, -}; - -/// -// DOM node types. -/// -enum cef_dom_node_type_t { - DOM_NODE_TYPE_UNSUPPORTED = 0, - DOM_NODE_TYPE_ELEMENT, - DOM_NODE_TYPE_ATTRIBUTE, - DOM_NODE_TYPE_TEXT, - DOM_NODE_TYPE_CDATA_SECTION, - DOM_NODE_TYPE_ENTITY_REFERENCE, - DOM_NODE_TYPE_ENTITY, - DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS, - DOM_NODE_TYPE_COMMENT, - DOM_NODE_TYPE_DOCUMENT, - DOM_NODE_TYPE_DOCUMENT_TYPE, - DOM_NODE_TYPE_DOCUMENT_FRAGMENT, - DOM_NODE_TYPE_NOTATION, - DOM_NODE_TYPE_XPATH_NAMESPACE, -}; - -/// -// Proxy types. -/// -enum cef_proxy_type_t { - PROXY_TYPE_DIRECT = 0, - PROXY_TYPE_NAMED, - PROXY_TYPE_PAC_STRING, -}; - -/// -// Proxy information. -/// -typedef struct _cef_proxy_info_t { - enum cef_proxy_type_t proxyType; - cef_string_t proxyList; -} cef_proxy_info_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_H_ diff --git a/cef/include/internal/cef_types_mac.h b/cef/include/internal/cef_types_mac.h deleted file mode 100644 index 9d73253cb..000000000 --- a/cef/include/internal/cef_types_mac.h +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2010 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -#ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_ -#define CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_ -#pragma once - -#include "include/internal/cef_build.h" - -#if defined(OS_MACOSX) -#include "include/internal/cef_string.h" - -// Window handle. -#ifdef __cplusplus -#ifdef __OBJC__ -@class NSCursor; -@class NSView; -#else -class NSCursor; -class NSView; -#endif -#define cef_window_handle_t NSView* -#define cef_cursor_handle_t NSCursor* -#else -#define cef_window_handle_t void* -#define cef_cursor_handle_t void* -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Supported graphics implementations. -/// -enum cef_graphics_implementation_t { - DESKTOP_IN_PROCESS = 0, - DESKTOP_IN_PROCESS_COMMAND_BUFFER, -}; - -/// -// Class representing window information. -/// -typedef struct _cef_window_info_t { - cef_string_t m_windowName; - int m_x; - int m_y; - int m_nWidth; - int m_nHeight; - int m_bHidden; - - // NSView pointer for the parent view. - cef_window_handle_t m_ParentView; - - // If window rendering is disabled no browser window will be created. Set - // |m_ParentView| to the window that will act as the parent for popup menus, - // dialog boxes, etc. - int m_bWindowRenderingDisabled; - - // Set to true to enable transparent painting. - int m_bTransparentPainting; - - // NSView pointer for the new browser view. - cef_window_handle_t m_View; -} cef_window_info_t; - -/// -// Class representing print context information. -/// -typedef struct _cef_print_info_t { - double m_Scale; -} cef_print_info_t; - -/// -// Class representing key information. -/// -typedef struct _cef_key_info_t { - int keyCode; - int character; - int characterNoModifiers; -} cef_key_info_t; - -#ifdef __cplusplus -} -#endif - -#endif // OS_MACOSX - -#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_ diff --git a/cef/include/internal/npapi/README-TRANSFER.txt b/cef/include/internal/npapi/README-TRANSFER.txt deleted file mode 100644 index 4eecacab8..000000000 --- a/cef/include/internal/npapi/README-TRANSFER.txt +++ /dev/null @@ -1,14 +0,0 @@ -Files in this directory have been copied from other locations in the Chromium -source tree. They have been modified only to the extent necessary to work in -the CEF Binary Distribution directory structure. Below is a listing of the -original file locations. - -../base/basictypes.h -../build/build_config.h -../third_party/npapi/bindings/npapi.h -../third_party/npapi/bindings/npapi_extensions.h -../third_party/npapi/bindings/npfunctions.h -../third_party/npapi/bindings/nphostapi.h -../third_party/npapi/bindings/npruntime.h -../third_party/npapi/bindings/nptypes.h -../base/port.h diff --git a/cef/include/internal/npapi/basictypes.h b/cef/include/internal/npapi/basictypes.h deleted file mode 100644 index 97ca48571..000000000 --- a/cef/include/internal/npapi/basictypes.h +++ /dev/null @@ -1,363 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef BASE_BASICTYPES_H_ -#define BASE_BASICTYPES_H_ -#pragma once - -#include // So we can set the bounds of our types -#include // For size_t -#include // for memcpy - -// Include path modified for CEF Binary Distribution. -#include "port.h" // Types that only need exist on certain systems - -#ifndef COMPILER_MSVC -// stdint.h is part of C99 but MSVC doesn't have it. -#include // For intptr_t. -#endif - -typedef signed char schar; -typedef signed char int8; -typedef short int16; -// TODO: Remove these type guards. These are to avoid conflicts with -// obsolete/protypes.h in the Gecko SDK. -#ifndef _INT32 -#define _INT32 -typedef int int32; -#endif - -// The NSPR system headers define 64-bit as |long| when possible, except on -// Mac OS X. In order to not have typedef mismatches, we do the same on LP64. -// -// On Mac OS X, |long long| is used for 64-bit types for compatibility with -// format macros even in the LP64 model. -#if defined(__LP64__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) -typedef long int64; -#else -typedef long long int64; -#endif - -// NOTE: unsigned types are DANGEROUS in loops and other arithmetical -// places. Use the signed types unless your variable represents a bit -// pattern (eg a hash value) or you really need the extra bit. Do NOT -// use 'unsigned' to express "this value should always be positive"; -// use assertions for this. - -typedef unsigned char uint8; -typedef unsigned short uint16; -// TODO: Remove these type guards. These are to avoid conflicts with -// obsolete/protypes.h in the Gecko SDK. -#ifndef _UINT32 -#define _UINT32 -typedef unsigned int uint32; -#endif - -// See the comment above about NSPR and 64-bit. -#if defined(__LP64__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) -typedef unsigned long uint64; -#else -typedef unsigned long long uint64; -#endif - -// A type to represent a Unicode code-point value. As of Unicode 4.0, -// such values require up to 21 bits. -// (For type-checking on pointers, make this explicitly signed, -// and it should always be the signed version of whatever int32 is.) -typedef signed int char32; - -const uint8 kuint8max = (( uint8) 0xFF); -const uint16 kuint16max = ((uint16) 0xFFFF); -const uint32 kuint32max = ((uint32) 0xFFFFFFFF); -const uint64 kuint64max = ((uint64) GG_LONGLONG(0xFFFFFFFFFFFFFFFF)); -const int8 kint8min = (( int8) 0x80); -const int8 kint8max = (( int8) 0x7F); -const int16 kint16min = (( int16) 0x8000); -const int16 kint16max = (( int16) 0x7FFF); -const int32 kint32min = (( int32) 0x80000000); -const int32 kint32max = (( int32) 0x7FFFFFFF); -const int64 kint64min = (( int64) GG_LONGLONG(0x8000000000000000)); -const int64 kint64max = (( int64) GG_LONGLONG(0x7FFFFFFFFFFFFFFF)); - -// A macro to disallow the copy constructor and operator= functions -// This should be used in the private: declarations for a class -#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&); \ - void operator=(const TypeName&) - -// An older, deprecated, politically incorrect name for the above. -// NOTE: The usage of this macro was baned from our code base, but some -// third_party libraries are yet using it. -// TODO(tfarina): Figure out how to fix the usage of this macro in the -// third_party libraries and get rid of it. -#define DISALLOW_EVIL_CONSTRUCTORS(TypeName) DISALLOW_COPY_AND_ASSIGN(TypeName) - -// A macro to disallow all the implicit constructors, namely the -// default constructor, copy constructor and operator= functions. -// -// This should be used in the private: declarations for a class -// that wants to prevent anyone from instantiating it. This is -// especially useful for classes containing only static methods. -#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ - TypeName(); \ - DISALLOW_COPY_AND_ASSIGN(TypeName) - -// The arraysize(arr) macro returns the # of elements in an array arr. -// The expression is a compile-time constant, and therefore can be -// used in defining new arrays, for example. If you use arraysize on -// a pointer by mistake, you will get a compile-time error. -// -// One caveat is that arraysize() doesn't accept any array of an -// anonymous type or a type defined inside a function. In these rare -// cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below. This is -// due to a limitation in C++'s template system. The limitation might -// eventually be removed, but it hasn't happened yet. - -// This template function declaration is used in defining arraysize. -// Note that the function doesn't need an implementation, as we only -// use its type. -template -char (&ArraySizeHelper(T (&array)[N]))[N]; - -// That gcc wants both of these prototypes seems mysterious. VC, for -// its part, can't decide which to use (another mystery). Matching of -// template overloads: the final frontier. -#ifndef _MSC_VER -template -char (&ArraySizeHelper(const T (&array)[N]))[N]; -#endif - -#define arraysize(array) (sizeof(ArraySizeHelper(array))) - -// ARRAYSIZE_UNSAFE performs essentially the same calculation as arraysize, -// but can be used on anonymous types or types defined inside -// functions. It's less safe than arraysize as it accepts some -// (although not all) pointers. Therefore, you should use arraysize -// whenever possible. -// -// The expression ARRAYSIZE_UNSAFE(a) is a compile-time constant of type -// size_t. -// -// ARRAYSIZE_UNSAFE catches a few type errors. If you see a compiler error -// -// "warning: division by zero in ..." -// -// when using ARRAYSIZE_UNSAFE, you are (wrongfully) giving it a pointer. -// You should only use ARRAYSIZE_UNSAFE on statically allocated arrays. -// -// The following comments are on the implementation details, and can -// be ignored by the users. -// -// ARRAYSIZE_UNSAFE(arr) works by inspecting sizeof(arr) (the # of bytes in -// the array) and sizeof(*(arr)) (the # of bytes in one array -// element). If the former is divisible by the latter, perhaps arr is -// indeed an array, in which case the division result is the # of -// elements in the array. Otherwise, arr cannot possibly be an array, -// and we generate a compiler error to prevent the code from -// compiling. -// -// Since the size of bool is implementation-defined, we need to cast -// !(sizeof(a) & sizeof(*(a))) to size_t in order to ensure the final -// result has type size_t. -// -// This macro is not perfect as it wrongfully accepts certain -// pointers, namely where the pointer size is divisible by the pointee -// size. Since all our code has to go through a 32-bit compiler, -// where a pointer is 4 bytes, this means all pointers to a type whose -// size is 3 or greater than 4 will be (righteously) rejected. - -#define ARRAYSIZE_UNSAFE(a) \ - ((sizeof(a) / sizeof(*(a))) / \ - static_cast(!(sizeof(a) % sizeof(*(a))))) - - -// Use implicit_cast as a safe version of static_cast or const_cast -// for upcasting in the type hierarchy (i.e. casting a pointer to Foo -// to a pointer to SuperclassOfFoo or casting a pointer to Foo to -// a const pointer to Foo). -// When you use implicit_cast, the compiler checks that the cast is safe. -// Such explicit implicit_casts are necessary in surprisingly many -// situations where C++ demands an exact type match instead of an -// argument type convertable to a target type. -// -// The From type can be inferred, so the preferred syntax for using -// implicit_cast is the same as for static_cast etc.: -// -// implicit_cast(expr) -// -// implicit_cast would have been part of the C++ standard library, -// but the proposal was submitted too late. It will probably make -// its way into the language in the future. -template -inline To implicit_cast(From const &f) { - return f; -} - -// The COMPILE_ASSERT macro can be used to verify that a compile time -// expression is true. For example, you could use it to verify the -// size of a static array: -// -// COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES, -// content_type_names_incorrect_size); -// -// or to make sure a struct is smaller than a certain size: -// -// COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large); -// -// The second argument to the macro is the name of the variable. If -// the expression is false, most compilers will issue a warning/error -// containing the name of the variable. - -template -struct CompileAssert { -}; - -#undef COMPILE_ASSERT -#define COMPILE_ASSERT(expr, msg) \ - typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] - -// Implementation details of COMPILE_ASSERT: -// -// - COMPILE_ASSERT works by defining an array type that has -1 -// elements (and thus is invalid) when the expression is false. -// -// - The simpler definition -// -// #define COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1] -// -// does not work, as gcc supports variable-length arrays whose sizes -// are determined at run-time (this is gcc's extension and not part -// of the C++ standard). As a result, gcc fails to reject the -// following code with the simple definition: -// -// int foo; -// COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is -// // not a compile-time constant. -// -// - By using the type CompileAssert<(bool(expr))>, we ensures that -// expr is a compile-time constant. (Template arguments must be -// determined at compile-time.) -// -// - The outer parentheses in CompileAssert<(bool(expr))> are necessary -// to work around a bug in gcc 3.4.4 and 4.0.1. If we had written -// -// CompileAssert -// -// instead, these compilers will refuse to compile -// -// COMPILE_ASSERT(5 > 0, some_message); -// -// (They seem to think the ">" in "5 > 0" marks the end of the -// template argument list.) -// -// - The array size is (bool(expr) ? 1 : -1), instead of simply -// -// ((expr) ? 1 : -1). -// -// This is to avoid running into a bug in MS VC 7.1, which -// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1. - - -// bit_cast is a template function that implements the -// equivalent of "*reinterpret_cast(&source)". We need this in -// very low-level functions like the protobuf library and fast math -// support. -// -// float f = 3.14159265358979; -// int i = bit_cast(f); -// // i = 0x40490fdb -// -// The classical address-casting method is: -// -// // WRONG -// float f = 3.14159265358979; // WRONG -// int i = * reinterpret_cast(&f); // WRONG -// -// The address-casting method actually produces undefined behavior -// according to ISO C++ specification section 3.10 -15 -. Roughly, this -// section says: if an object in memory has one type, and a program -// accesses it with a different type, then the result is undefined -// behavior for most values of "different type". -// -// This is true for any cast syntax, either *(int*)&f or -// *reinterpret_cast(&f). And it is particularly true for -// conversions betweeen integral lvalues and floating-point lvalues. -// -// The purpose of 3.10 -15- is to allow optimizing compilers to assume -// that expressions with different types refer to different memory. gcc -// 4.0.1 has an optimizer that takes advantage of this. So a -// non-conforming program quietly produces wildly incorrect output. -// -// The problem is not the use of reinterpret_cast. The problem is type -// punning: holding an object in memory of one type and reading its bits -// back using a different type. -// -// The C++ standard is more subtle and complex than this, but that -// is the basic idea. -// -// Anyways ... -// -// bit_cast<> calls memcpy() which is blessed by the standard, -// especially by the example in section 3.9 . Also, of course, -// bit_cast<> wraps up the nasty logic in one place. -// -// Fortunately memcpy() is very fast. In optimized mode, with a -// constant size, gcc 2.95.3, gcc 4.0.1, and msvc 7.1 produce inline -// code with the minimal amount of data movement. On a 32-bit system, -// memcpy(d,s,4) compiles to one load and one store, and memcpy(d,s,8) -// compiles to two loads and two stores. -// -// I tested this code with gcc 2.95.3, gcc 4.0.1, icc 8.1, and msvc 7.1. -// -// WARNING: if Dest or Source is a non-POD type, the result of the memcpy -// is likely to surprise you. - -template -inline Dest bit_cast(const Source& source) { - // Compile time assertion: sizeof(Dest) == sizeof(Source) - // A compile error here means your Dest and Source have different sizes. - typedef char VerifySizesAreEqual [sizeof(Dest) == sizeof(Source) ? 1 : -1]; - - Dest dest; - memcpy(&dest, &source, sizeof(dest)); - return dest; -} - -// Used to explicitly mark the return value of a function as unused. If you are -// really sure you don't want to do anything with the return value of a function -// that has been marked WARN_UNUSED_RESULT, wrap it with this. Example: -// -// scoped_ptr my_var = ...; -// if (TakeOwnership(my_var.get()) == SUCCESS) -// ignore_result(my_var.release()); -// -template -inline void ignore_result(const T&) { -} - -// The following enum should be used only as a constructor argument to indicate -// that the variable has static storage class, and that the constructor should -// do nothing to its state. It indicates to the reader that it is legal to -// declare a static instance of the class, provided the constructor is given -// the base::LINKER_INITIALIZED argument. Normally, it is unsafe to declare a -// static variable that has a constructor or a destructor because invocation -// order is undefined. However, IF the type can be initialized by filling with -// zeroes (which the loader does for static variables), AND the destructor also -// does nothing to the storage, AND there are no virtual methods, then a -// constructor declared as -// explicit MyClass(base::LinkerInitialized x) {} -// and invoked as -// static MyClass my_variable_name(base::LINKER_INITIALIZED); -namespace base { -enum LinkerInitialized { LINKER_INITIALIZED }; - -// Use these to declare and define a static local variable (static T;) so that -// it is leaked so that its destructors are not called at exit. If you need -// thread-safe initialization, use base/lazy_instance.h instead. -#define CR_DEFINE_STATIC_LOCAL(type, name, arguments) \ - static type& name = *new type arguments - -} // base - -#endif // BASE_BASICTYPES_H_ diff --git a/cef/include/internal/npapi/build_config.h b/cef/include/internal/npapi/build_config.h deleted file mode 100644 index 7784bb628..000000000 --- a/cef/include/internal/npapi/build_config.h +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file adds defines about the platform we're currently building on. -// Operating System: -// OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX) -// Compiler: -// COMPILER_MSVC / COMPILER_GCC -// Processor: -// ARCH_CPU_X86 / ARCH_CPU_X86_64 / ARCH_CPU_X86_FAMILY (X86 or X86_64) -// ARCH_CPU_32_BITS / ARCH_CPU_64_BITS - -#ifndef BUILD_BUILD_CONFIG_H_ -#define BUILD_BUILD_CONFIG_H_ - -// A set of macros to use for platform detection. -#if defined(__APPLE__) -#define OS_MACOSX 1 -#elif defined(ANDROID) -#define OS_ANDROID 1 -#elif defined(__native_client__) -#define OS_NACL 1 -#elif defined(__linux__) -#define OS_LINUX 1 -// Use TOOLKIT_GTK on linux if TOOLKIT_VIEWS isn't defined. -#if !defined(TOOLKIT_VIEWS) -#define TOOLKIT_GTK -#endif -#elif defined(_WIN32) -#define OS_WIN 1 -#define TOOLKIT_VIEWS 1 -#elif defined(__FreeBSD__) -#define OS_FREEBSD 1 -#define TOOLKIT_GTK -#elif defined(__OpenBSD__) -#define OS_OPENBSD 1 -#define TOOLKIT_GTK -#elif defined(__sun) -#define OS_SOLARIS 1 -#define TOOLKIT_GTK -#else -#error Please add support for your platform in build/build_config.h -#endif - -#if defined(USE_OPENSSL) && defined(USE_NSS) -#error Cannot use both OpenSSL and NSS -#endif - -// For access to standard BSD features, use OS_BSD instead of a -// more specific macro. -#if defined(OS_FREEBSD) || defined(OS_OPENBSD) -#define OS_BSD 1 -#endif - -// For access to standard POSIXish features, use OS_POSIX instead of a -// more specific macro. -#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \ - defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_ANDROID) || \ - defined(OS_NACL) -#define OS_POSIX 1 -#endif - -#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ - !defined(OS_NACL) -#define USE_X11 1 // Use X for graphics. -#endif - -// Use tcmalloc -#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(NO_TCMALLOC) -#define USE_TCMALLOC 1 -#endif - -// Compiler detection. -#if defined(__GNUC__) -#define COMPILER_GCC 1 -#elif defined(_MSC_VER) -#define COMPILER_MSVC 1 -#else -#error Please add support for your compiler in build/build_config.h -#endif - -// Processor architecture detection. For more info on what's defined, see: -// http://msdn.microsoft.com/en-us/library/b0084kay.aspx -// http://www.agner.org/optimize/calling_conventions.pdf -// or with gcc, run: "echo | gcc -E -dM -" -#if defined(_M_X64) || defined(__x86_64__) -#define ARCH_CPU_X86_FAMILY 1 -#define ARCH_CPU_X86_64 1 -#define ARCH_CPU_64_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(_M_IX86) || defined(__i386__) -#define ARCH_CPU_X86_FAMILY 1 -#define ARCH_CPU_X86 1 -#define ARCH_CPU_32_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(__ARMEL__) -#define ARCH_CPU_ARM_FAMILY 1 -#define ARCH_CPU_ARMEL 1 -#define ARCH_CPU_32_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#define WCHAR_T_IS_UNSIGNED 1 -#elif defined(__pnacl__) -#define ARCH_CPU_32_BITS 1 -#else -#error Please add support for your architecture in build/build_config.h -#endif - -// Type detection for wchar_t. -#if defined(OS_WIN) -#define WCHAR_T_IS_UTF16 -#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \ - defined(__WCHAR_MAX__) && \ - (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff) -#define WCHAR_T_IS_UTF32 -#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \ - defined(__WCHAR_MAX__) && \ - (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff) -// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to -// compile in this mode (in particular, Chrome doesn't). This is intended for -// other projects using base who manage their own dependencies and make sure -// short wchar works for them. -#define WCHAR_T_IS_UTF16 -#else -#error Please add support for your compiler in build/build_config.h -#endif - -#if defined(OS_CHROMEOS) -// Single define to trigger whether CrOS fonts have BCI on. -// In that case font sizes/deltas should be adjusted. -//define CROS_FONTS_USING_BCI -#endif - -#if defined(OS_ANDROID) -// The compiler thinks std::string::const_iterator and "const char*" are -// equivalent types. -#define STD_STRING_ITERATOR_IS_CHAR_POINTER -// The compiler thinks base::string16::const_iterator and "char16*" are -// equivalent types. -#define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER -#endif - -#endif // BUILD_BUILD_CONFIG_H_ diff --git a/cef/include/internal/npapi/npapi.h b/cef/include/internal/npapi/npapi.h deleted file mode 100644 index 16045aad1..000000000 --- a/cef/include/internal/npapi/npapi.h +++ /dev/null @@ -1,926 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef npapi_h_ -#define npapi_h_ - -#if defined(__OS2__) -#pragma pack(1) -#endif - -/* BEGIN GOOGLE MODIFICATIONS */ - -#ifndef __native_client__ -#include "nptypes.h" -#endif - -#ifdef __native_client__ -#include -#include -#else -// Include path modified for CEF Binary Distribution. -#include "basictypes.h" -#endif /* __native_client__ */ - -/* END GOOGLE MODIFICATIONS */ - -#if defined(__OS2__) || defined(OS2) -#ifndef XP_OS2 -#define XP_OS2 1 -#endif -#endif - -#if defined(_WIN32) && !defined(__SYMBIAN32__) -#include -#ifndef XP_WIN -#define XP_WIN 1 -#endif -#endif - -/* BEGIN GOOGLE MODIFICATIONS */ -/* On Linux and Mac, be sure to set Mozilla-specific macros. */ -#if defined(USE_X11) -#if !defined(XP_UNIX) -#define XP_UNIX 1 -#endif -#if !defined(MOZ_X11) -#define MOZ_X11 1 -#endif -#endif -/* END GOOGLE MODIFICATIONS */ - -#if defined(__SYMBIAN32__) -#ifndef XP_SYMBIAN -#define XP_SYMBIAN 1 -#undef XP_WIN -#endif -#endif - -#if defined(__APPLE_CC__) && !defined(XP_UNIX) -#ifndef XP_MACOSX -#define XP_MACOSX 1 -#endif -#endif - -#if defined(XP_MACOSX) && defined(__LP64__) -#define NP_NO_QUICKDRAW -#define NP_NO_CARBON -#endif - -#if defined(XP_MACOSX) -#include -#include -#ifndef NP_NO_CARBON -#include -#endif -#endif - -#if defined(XP_UNIX) -#include -/* BEGIN GOOGLE MODIFICATIONS */ -#if 0 -/* END GOOGLE MODIFICATIONS */ -#if defined(MOZ_X11) -#include -#include -#endif -/* BEGIN GOOGLE MODIFICATIONS */ -#endif -/* END GOOGLE MODIFICATIONS */ -#endif - -#if defined(XP_SYMBIAN) -#include -#include -#endif - -/*----------------------------------------------------------------------*/ -/* Plugin Version Constants */ -/*----------------------------------------------------------------------*/ - -#define NP_VERSION_MAJOR 0 -#define NP_VERSION_MINOR 27 - - -/* The OS/2 version of Netscape uses RC_DATA to define the - mime types, file extensions, etc that are required. - Use a vertical bar to separate types, end types with \0. - FileVersion and ProductVersion are 32bit ints, all other - entries are strings that MUST be terminated with a \0. - -AN EXAMPLE: - -RCDATA NP_INFO_ProductVersion { 1,0,0,1,} - -RCDATA NP_INFO_MIMEType { "video/x-video|", - "video/x-flick\0" } -RCDATA NP_INFO_FileExtents { "avi|", - "flc\0" } -RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|", - "MMOS2 Flc/Fli player(*.flc)\0" } - -RCDATA NP_INFO_FileVersion { 1,0,0,1 } -RCDATA NP_INFO_CompanyName { "Netscape Communications\0" } -RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0" -RCDATA NP_INFO_InternalName { "NPAVI32\0" ) -RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0" -RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" } -RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" } -*/ -/* RC_DATA types for version info - required */ -#define NP_INFO_ProductVersion 1 -#define NP_INFO_MIMEType 2 -#define NP_INFO_FileOpenName 3 -#define NP_INFO_FileExtents 4 -/* RC_DATA types for version info - used if found */ -#define NP_INFO_FileDescription 5 -#define NP_INFO_ProductName 6 -/* RC_DATA types for version info - optional */ -#define NP_INFO_CompanyName 7 -#define NP_INFO_FileVersion 8 -#define NP_INFO_InternalName 9 -#define NP_INFO_LegalCopyright 10 -#define NP_INFO_OriginalFilename 11 - -#ifndef RC_INVOKED - -/*----------------------------------------------------------------------*/ -/* Definition of Basic Types */ -/*----------------------------------------------------------------------*/ - -typedef unsigned char NPBool; -typedef int16_t NPError; -typedef int16_t NPReason; -typedef char* NPMIMEType; - -/*----------------------------------------------------------------------*/ -/* Structures and definitions */ -/*----------------------------------------------------------------------*/ - -#if !defined(__LP64__) -#if defined(XP_MACOSX) -#pragma options align=mac68k -#endif -#endif /* __LP64__ */ - -/* - * NPP is a plug-in's opaque instance handle - */ -typedef struct _NPP -{ - void* pdata; /* plug-in private data */ - void* ndata; /* netscape private data */ -} NPP_t; - -typedef NPP_t* NPP; - -typedef struct _NPStream -{ - void* pdata; /* plug-in private data */ - void* ndata; /* netscape private data */ - const char* url; - uint32_t end; - uint32_t lastmodified; - void* notifyData; - const char* headers; /* Response headers from host. - * Exists only for >= NPVERS_HAS_RESPONSE_HEADERS. - * Used for HTTP only; NULL for non-HTTP. - * Available from NPP_NewStream onwards. - * Plugin should copy this data before storing it. - * Includes HTTP status line and all headers, - * preferably verbatim as received from server, - * headers formatted as in HTTP ("Header: Value"), - * and newlines (\n, NOT \r\n) separating lines. - * Terminated by \n\0 (NOT \n\n\0). */ -} NPStream; - -typedef struct _NPByteRange -{ - int32_t offset; /* negative offset means from the end */ - uint32_t length; - struct _NPByteRange* next; -} NPByteRange; - -typedef struct _NPSavedData -{ - int32_t len; - void* buf; -} NPSavedData; - -typedef struct _NPRect -{ - uint16_t top; - uint16_t left; - uint16_t bottom; - uint16_t right; -} NPRect; - -typedef struct _NPSize -{ - int32_t width; - int32_t height; -} NPSize; - -typedef enum { - NPFocusNext = 0, - NPFocusPrevious = 1 -} NPFocusDirection; - -/* Return values for NPP_HandleEvent */ -#define kNPEventNotHandled 0 -#define kNPEventHandled 1 -/* Exact meaning must be spec'd in event model. */ -#define kNPEventStartIME 2 - -#if defined(XP_UNIX) -/* - * Unix specific structures and definitions - */ - -/* - * Callback Structures. - * - * These are used to pass additional platform specific information. - */ -enum { - NP_SETWINDOW = 1, - NP_PRINT -}; - -typedef struct -{ - int32_t type; -} NPAnyCallbackStruct; - -/* BEGIN GOOGLE MODIFICATIONS */ -typedef struct _NPSetWindowCallbackStruct NPSetWindowCallbackStruct; -/* END GOOGLE MODIFICATIONS */ - -typedef struct -{ - int32_t type; - FILE* fp; -} NPPrintCallbackStruct; - -#endif /* XP_UNIX */ - -#if defined(XP_MACOSX) -typedef enum { -#ifndef NP_NO_QUICKDRAW - NPDrawingModelQuickDraw = 0, -#endif - NPDrawingModelCoreGraphics = 1, - NPDrawingModelOpenGL = 2, - NPDrawingModelCoreAnimation = 3, - NPDrawingModelInvalidatingCoreAnimation = 4 -} NPDrawingModel; - -typedef enum { -#ifndef NP_NO_CARBON - NPEventModelCarbon = 0, -#endif - NPEventModelCocoa = 1 -} NPEventModel; -#endif - -/* - * The following masks are applied on certain platforms to NPNV and - * NPPV selectors that pass around pointers to COM interfaces. Newer - * compilers on some platforms may generate vtables that are not - * compatible with older compilers. To prevent older plugins from - * not understanding a new browser's ABI, these masks change the - * values of those selectors on those platforms. To remain backwards - * compatible with different versions of the browser, plugins can - * use these masks to dynamically determine and use the correct C++ - * ABI that the browser is expecting. This does not apply to Windows - * as Microsoft's COM ABI will likely not change. - */ - -#define NP_ABI_GCC3_MASK 0x10000000 -/* - * gcc 3.x generated vtables on UNIX and OSX are incompatible with - * previous compilers. - */ -#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3)) -#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK -#else -#define _NP_ABI_MIXIN_FOR_GCC3 0 -#endif - -#if defined(XP_MACOSX) -#define NP_ABI_MACHO_MASK 0x01000000 -#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK -#else -#define _NP_ABI_MIXIN_FOR_MACHO 0 -#endif - -#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO) - -/* - * List of variable names for which NPP_GetValue shall be implemented - */ -typedef enum { - NPPVpluginNameString = 1, - NPPVpluginDescriptionString, - NPPVpluginWindowBool, - NPPVpluginTransparentBool, - NPPVjavaClass, - NPPVpluginWindowSize, - NPPVpluginTimerInterval, - NPPVpluginScriptableInstance = (10 | NP_ABI_MASK), - NPPVpluginScriptableIID = 11, - NPPVjavascriptPushCallerBool = 12, - NPPVpluginKeepLibraryInMemory = 13, - NPPVpluginNeedsXEmbed = 14, - - /* Get the NPObject for scripting the plugin. Introduced in NPAPI minor version 14. - */ - NPPVpluginScriptableNPObject = 15, - - /* Get the plugin value (as \0-terminated UTF-8 string data) for - * form submission if the plugin is part of a form. Use - * NPN_MemAlloc() to allocate memory for the string data. Introduced - * in NPAPI minor version 15. - */ - NPPVformValue = 16, - - NPPVpluginUrlRequestsDisplayedBool = 17, - - /* Checks if the plugin is interested in receiving the http body of - * all http requests (including failed ones, http status != 200). - */ - NPPVpluginWantsAllNetworkStreams = 18, - - /* Browsers can retrieve a native ATK accessibility plug ID via this variable. */ - NPPVpluginNativeAccessibleAtkPlugId = 19, - - /* Checks to see if the plug-in would like the browser to load the "src" attribute. */ - NPPVpluginCancelSrcStream = 20, - - NPPVsupportsAdvancedKeyHandling = 21, - - NPPVpluginUsesDOMForCursorBool = 22 - -#if defined(XP_MACOSX) - /* Used for negotiating drawing models */ - , NPPVpluginDrawingModel = 1000 - /* Used for negotiating event models */ - , NPPVpluginEventModel = 1001 - /* In the NPDrawingModelCoreAnimation drawing model, the browser asks the plug-in for a Core Animation layer. */ - , NPPVpluginCoreAnimationLayer = 1003 -#endif - -#if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)) - , NPPVpluginWindowlessLocalBool = 2002 -#endif -} NPPVariable; - -/* - * List of variable names for which NPN_GetValue should be implemented. - */ -typedef enum { - NPNVxDisplay = 1, - NPNVxtAppContext, - NPNVnetscapeWindow, - NPNVjavascriptEnabledBool, - NPNVasdEnabledBool, - NPNVisOfflineBool, - - NPNVserviceManager = (10 | NP_ABI_MASK), - NPNVDOMElement = (11 | NP_ABI_MASK), - NPNVDOMWindow = (12 | NP_ABI_MASK), - NPNVToolkit = (13 | NP_ABI_MASK), - NPNVSupportsXEmbedBool = 14, - - /* Get the NPObject wrapper for the browser window. */ - NPNVWindowNPObject = 15, - - /* Get the NPObject wrapper for the plugins DOM element. */ - NPNVPluginElementNPObject = 16, - - NPNVSupportsWindowless = 17, - - NPNVprivateModeBool = 18, - - NPNVsupportsAdvancedKeyHandling = 21, - - NPNVdocumentOrigin = 22 - -#if defined(XP_MACOSX) - /* Used for negotiating drawing models */ - , NPNVpluginDrawingModel = 1000 -#ifndef NP_NO_QUICKDRAW - , NPNVsupportsQuickDrawBool = 2000 -#endif - , NPNVsupportsCoreGraphicsBool = 2001 - , NPNVsupportsOpenGLBool = 2002 - , NPNVsupportsCoreAnimationBool = 2003 - , NPNVsupportsInvalidatingCoreAnimationBool = 2004 -#ifndef NP_NO_CARBON - , NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */ -#endif - , NPNVsupportsCocoaBool = 3001 /* TRUE if the browser supports the Cocoa event model */ - , NPNVsupportsUpdatedCocoaTextInputBool = 3002 /* TRUE if the browser supports the updated - Cocoa text input specification. */ - , NPNVsupportsCompositingCoreAnimationPluginsBool = 74656 /* TRUE if the browser supports - CA model compositing */ -#endif -#if defined(MOZ_PLATFORM_MAEMO) && ((MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6)) - , NPNVSupportsWindowlessLocal = 2002 -#endif -} NPNVariable; - -typedef enum { - NPNURLVCookie = 501, - NPNURLVProxy -} NPNURLVariable; - -/* - * The type of Toolkit the widgets use - */ -typedef enum { - NPNVGtk12 = 1, - NPNVGtk2 -} NPNToolkitType; - -/* - * The type of a NPWindow - it specifies the type of the data structure - * returned in the window field. - */ -typedef enum { - NPWindowTypeWindow = 1, - NPWindowTypeDrawable -} NPWindowType; - -typedef struct _NPWindow -{ - void* window; /* Platform specific window handle */ - /* OS/2: x - Position of bottom left corner */ - /* OS/2: y - relative to visible netscape window */ - int32_t x; /* Position of top left corner relative */ - int32_t y; /* to a netscape page. */ - uint32_t width; /* Maximum window size */ - uint32_t height; - NPRect clipRect; /* Clipping rectangle in port coordinates */ -#if (defined(XP_UNIX) || defined(XP_SYMBIAN)) && !defined(XP_MACOSX) - void * ws_info; /* Platform-dependent additional data */ -#endif /* XP_UNIX */ - NPWindowType type; /* Is this a window or a drawable? */ -} NPWindow; - -typedef struct _NPImageExpose -{ - char* data; /* image pointer */ - int32_t stride; /* Stride of data image pointer */ - int32_t depth; /* Depth of image pointer */ - int32_t x; /* Expose x */ - int32_t y; /* Expose y */ - uint32_t width; /* Expose width */ - uint32_t height; /* Expose height */ - NPSize dataSize; /* Data buffer size */ - float translateX; /* translate X matrix value */ - float translateY; /* translate Y matrix value */ - float scaleX; /* scale X matrix value */ - float scaleY; /* scale Y matrix value */ -} NPImageExpose; - -typedef struct _NPFullPrint -{ - NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */ - NPBool printOne; /* TRUE if plugin should print one copy to default - printer */ - void* platformPrint; /* Platform-specific printing info */ -} NPFullPrint; - -typedef struct _NPEmbedPrint -{ - NPWindow window; - void* platformPrint; /* Platform-specific printing info */ -} NPEmbedPrint; - -typedef struct _NPPrint -{ - uint16_t mode; /* NP_FULL or NP_EMBED */ - union - { - NPFullPrint fullPrint; /* if mode is NP_FULL */ - NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ - } print; -} NPPrint; - -#if defined(XP_MACOSX) -#ifndef NP_NO_CARBON -typedef EventRecord NPEvent; -#endif -#elif defined(XP_SYMBIAN) -typedef QEvent NPEvent; -#elif defined(XP_WIN) -typedef struct _NPEvent -{ - uint16_t event; - uintptr_t wParam; - uintptr_t lParam; -} NPEvent; -#elif defined(XP_OS2) -typedef struct _NPEvent -{ - uint32_t event; - uint32_t wParam; - uint32_t lParam; -} NPEvent; -#elif defined(XP_UNIX) && defined(MOZ_X11) -/* BEGIN GOOGLE MODIFICATIONS */ -typedef union _XEvent XEvent; -/* END GOOGLE MODIFICATIONS */ -typedef XEvent NPEvent; -#else -typedef void* NPEvent; -#endif - -#if defined(XP_MACOSX) -typedef void* NPRegion; -#ifndef NP_NO_QUICKDRAW -typedef RgnHandle NPQDRegion; -#endif -typedef CGPathRef NPCGRegion; -#elif defined(XP_WIN) -typedef HRGN NPRegion; -#elif defined(XP_UNIX) && defined(MOZ_X11) -/* BEGIN GOOGLE MODIFICATIONS */ -typedef struct _XRegion *Region; -/* END GOOGLE MODIFICATIONS */ -typedef Region NPRegion; -#elif defined(XP_SYMBIAN) -typedef QRegion* NPRegion; -#else -typedef void *NPRegion; -#endif - -typedef struct _NPNSString NPNSString; -typedef struct _NPNSWindow NPNSWindow; -typedef struct _NPNSMenu NPNSMenu; - -#if defined(XP_MACOSX) -typedef NPNSMenu NPMenu; -#else -typedef void *NPMenu; -#endif - -typedef enum { - NPCoordinateSpacePlugin = 1, - NPCoordinateSpaceWindow, - NPCoordinateSpaceFlippedWindow, - NPCoordinateSpaceScreen, - NPCoordinateSpaceFlippedScreen -} NPCoordinateSpace; - -#if defined(XP_MACOSX) - -#ifndef NP_NO_QUICKDRAW -typedef struct NP_Port -{ - CGrafPtr port; - int32_t portx; /* position inside the topmost window */ - int32_t porty; -} NP_Port; -#endif /* NP_NO_QUICKDRAW */ - -/* - * NP_CGContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelCoreGraphics - * as its drawing model. - */ - -typedef struct NP_CGContext -{ - CGContextRef context; - void *window; /* A WindowRef under the Carbon event model. */ -} NP_CGContext; - -/* - * NP_GLContext is the type of the NPWindow's 'window' when the plugin specifies NPDrawingModelOpenGL as its - * drawing model. - */ - -typedef struct NP_GLContext -{ - CGLContextObj context; -#ifdef NP_NO_CARBON - NPNSWindow *window; -#else - void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */ -#endif -} NP_GLContext; - -typedef enum { - NPCocoaEventDrawRect = 1, - NPCocoaEventMouseDown, - NPCocoaEventMouseUp, - NPCocoaEventMouseMoved, - NPCocoaEventMouseEntered, - NPCocoaEventMouseExited, - NPCocoaEventMouseDragged, - NPCocoaEventKeyDown, - NPCocoaEventKeyUp, - NPCocoaEventFlagsChanged, - NPCocoaEventFocusChanged, - NPCocoaEventWindowFocusChanged, - NPCocoaEventScrollWheel, - NPCocoaEventTextInput -} NPCocoaEventType; - -typedef struct _NPCocoaEvent { - NPCocoaEventType type; - uint32_t version; - union { - struct { - uint32_t modifierFlags; - double pluginX; - double pluginY; - int32_t buttonNumber; - int32_t clickCount; - double deltaX; - double deltaY; - double deltaZ; - } mouse; - struct { - uint32_t modifierFlags; - NPNSString *characters; - NPNSString *charactersIgnoringModifiers; - NPBool isARepeat; - uint16_t keyCode; - } key; - struct { - CGContextRef context; - double x; - double y; - double width; - double height; - } draw; - struct { - NPBool hasFocus; - } focus; - struct { - NPNSString *text; - } text; - } data; -} NPCocoaEvent; - -#ifndef NP_NO_CARBON -/* Non-standard event types that can be passed to HandleEvent */ -enum NPEventType { - NPEventType_GetFocusEvent = (osEvt + 16), - NPEventType_LoseFocusEvent, - NPEventType_AdjustCursorEvent, - NPEventType_MenuCommandEvent, - NPEventType_ClippingChangedEvent, - NPEventType_ScrollingBeginsEvent = 1000, - NPEventType_ScrollingEndsEvent -}; -#endif /* NP_NO_CARBON */ - -#endif /* XP_MACOSX */ - -/* - * Values for mode passed to NPP_New: - */ -#define NP_EMBED 1 -#define NP_FULL 2 - -/* - * Values for stream type passed to NPP_NewStream: - */ -#define NP_NORMAL 1 -#define NP_SEEK 2 -#define NP_ASFILE 3 -#define NP_ASFILEONLY 4 - -#define NP_MAXREADY (((unsigned)(~0)<<1)>>1) - -/* - * Flags for NPP_ClearSiteData. - */ -#define NP_CLEAR_ALL 0 -#define NP_CLEAR_CACHE (1 << 0) - -#if !defined(__LP64__) -#if defined(XP_MACOSX) -#pragma options align=reset -#endif -#endif /* __LP64__ */ - -/*----------------------------------------------------------------------*/ -/* Error and Reason Code definitions */ -/*----------------------------------------------------------------------*/ - -/* - * Values of type NPError: - */ -#define NPERR_BASE 0 -#define NPERR_NO_ERROR (NPERR_BASE + 0) -#define NPERR_GENERIC_ERROR (NPERR_BASE + 1) -#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2) -#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3) -#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4) -#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5) -#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6) -#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7) -#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8) -#define NPERR_INVALID_PARAM (NPERR_BASE + 9) -#define NPERR_INVALID_URL (NPERR_BASE + 10) -#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11) -#define NPERR_NO_DATA (NPERR_BASE + 12) -#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13) -#define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14) -#define NPERR_MALFORMED_SITE (NPERR_BASE + 15) - -/* - * Values of type NPReason: - */ -#define NPRES_BASE 0 -#define NPRES_DONE (NPRES_BASE + 0) -#define NPRES_NETWORK_ERR (NPRES_BASE + 1) -#define NPRES_USER_BREAK (NPRES_BASE + 2) - -/* - * Don't use these obsolete error codes any more. - */ -#define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR -#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR -#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK - -/* - * Version feature information - */ -#define NPVERS_HAS_STREAMOUTPUT 8 -#define NPVERS_HAS_NOTIFICATION 9 -#define NPVERS_HAS_LIVECONNECT 9 -#define NPVERS_68K_HAS_LIVECONNECT 11 -#define NPVERS_HAS_WINDOWLESS 11 -#define NPVERS_HAS_XPCONNECT_SCRIPTING 13 -#define NPVERS_HAS_NPRUNTIME_SCRIPTING 14 -#define NPVERS_HAS_FORM_VALUES 15 -#define NPVERS_HAS_POPUPS_ENABLED_STATE 16 -#define NPVERS_HAS_RESPONSE_HEADERS 17 -#define NPVERS_HAS_NPOBJECT_ENUM 18 -#define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19 -#define NPVERS_HAS_ALL_NETWORK_STREAMS 20 -#define NPVERS_HAS_URL_AND_AUTH_INFO 21 -#define NPVERS_HAS_PRIVATE_MODE 22 -#define NPVERS_MACOSX_HAS_COCOA_EVENTS 23 -#define NPVERS_HAS_ADVANCED_KEY_HANDLING 25 -#define NPVERS_HAS_URL_REDIRECT_HANDLING 26 -#define NPVERS_HAS_CLEAR_SITE_DATA 27 - -/*----------------------------------------------------------------------*/ -/* Function Prototypes */ -/*----------------------------------------------------------------------*/ - -#if defined(__OS2__) -#define NP_LOADDS _System -#else -#define NP_LOADDS -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* NPP_* functions are provided by the plugin and called by the navigator. */ - -#if defined(XP_UNIX) -const char* NPP_GetMIMEDescription(void); -#endif - -NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, - uint16_t mode, int16_t argc, char* argn[], - char* argv[], NPSavedData* saved); -NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save); -NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window); -NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, - NPStream* stream, NPBool seekable, - uint16_t* stype); -NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, - NPReason reason); -int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream); -int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset, - int32_t len, void* buffer); -void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, - const char* fname); -void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint); -int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event); -void NP_LOADDS NPP_URLNotify(NPP instance, const char* url, - NPReason reason, void* notifyData); -NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value); -NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value); -NPBool NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction); -void NP_LOADDS NPP_LostFocus(NPP instance); -void NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData); -NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge); -char** NP_LOADDS NPP_GetSitesWithData(void); - -/* NPN_* functions are provided by the navigator and called by the plugin. */ -void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor, - int* netscape_major, int* netscape_minor); -NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url, - const char* target, void* notifyData); -NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url, - const char* target); -NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url, - const char* target, uint32_t len, - const char* buf, NPBool file, - void* notifyData); -NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url, - const char* target, uint32_t len, - const char* buf, NPBool file); -NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); -NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type, - const char* target, NPStream** stream); -int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len, - void* buffer); -NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream, - NPReason reason); -void NP_LOADDS NPN_Status(NPP instance, const char* message); -const char* NP_LOADDS NPN_UserAgent(NPP instance); -void* NP_LOADDS NPN_MemAlloc(uint32_t size); -void NP_LOADDS NPN_MemFree(void* ptr); -uint32_t NP_LOADDS NPN_MemFlush(uint32_t size); -void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages); -NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable, - void *value); -NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable, - void *value); -void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect); -void NP_LOADDS NPN_InvalidateRegion(NPP instance, - NPRegion invalidRegion); -void NP_LOADDS NPN_ForceRedraw(NPP instance); -void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled); -void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance); -void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance, - void (*func) (void *), - void *userData); -NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable, - const char *url, char **value, - uint32_t *len); -NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable, - const char *url, const char *value, - uint32_t len); -NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance, - const char *protocol, - const char *host, int32_t port, - const char *scheme, - const char *realm, - char **username, uint32_t *ulen, - char **password, - uint32_t *plen); -uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); -void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID); -NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu); -NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); -NPBool NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled); -NPBool NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction); -void NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow); - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - -#endif /* RC_INVOKED */ -#if defined(__OS2__) -#pragma pack() -#endif - -#endif /* npapi_h_ */ diff --git a/cef/include/internal/npapi/npapi_extensions.h b/cef/include/internal/npapi/npapi_extensions.h deleted file mode 100644 index 144417b3e..000000000 --- a/cef/include/internal/npapi/npapi_extensions.h +++ /dev/null @@ -1,1079 +0,0 @@ -/* Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef _NP_EXTENSIONS_H_ -#define _NP_EXTENSIONS_H_ - -// Use the shorter include path here so that this file can be used in non- -// Chromium projects, such as the Native Client SDK. -#include "npapi.h" - -#include // For size_t - -/* - * A fake "enum" value for getting browser-implemented Pepper extensions. - * The variable returns a pointer to an NPNExtensions structure. */ -#define NPNVPepperExtensions ((NPNVariable) 4000) - -/* - * A fake "enum" value for getting plugin-implemented Pepper extensions. - * The variable returns a pointer to an NPPExtensions structure. */ -#define NPPVPepperExtensions ((NPPVariable) 4001) - -typedef void NPDeviceConfig; -typedef void NPDeviceContext; -typedef void NPUserData; - -/* unique id for each device interface */ -typedef int32_t NPDeviceID; - -/* Events -------------------------------------------------------------------*/ - -typedef enum { - NPMouseButton_None = -1, - NPMouseButton_Left = 0, - NPMouseButton_Middle = 1, - NPMouseButton_Right = 2 -} NPMouseButtons; - -typedef enum { - NPEventType_Undefined = -1, - NPEventType_MouseDown = 0, - NPEventType_MouseUp = 1, - NPEventType_MouseMove = 2, - NPEventType_MouseEnter = 3, - NPEventType_MouseLeave = 4, - NPEventType_MouseWheel = 5, - NPEventType_RawKeyDown = 6, - NPEventType_KeyDown = 7, - NPEventType_KeyUp = 8, - NPEventType_Char = 9, - NPEventType_Minimize = 10, - NPEventType_Focus = 11, - NPEventType_Device = 12 -} NPEventTypes; - -typedef enum { - NPEventModifier_ShiftKey = 1 << 0, - NPEventModifier_ControlKey = 1 << 1, - NPEventModifier_AltKey = 1 << 2, - NPEventModifier_MetaKey = 1 << 3, - NPEventModifier_IsKeyPad = 1 << 4, - NPEventModifier_IsAutoRepeat = 1 << 5, - NPEventModifier_LeftButtonDown = 1 << 6, - NPEventModifier_MiddleButtonDown = 1 << 7, - NPEventModifier_RightButtonDown = 1 << 8 -} NPEventModifiers; - -typedef struct _NPKeyEvent -{ - uint32_t modifier; - uint32_t normalizedKeyCode; -} NPKeyEvent; - -typedef struct _NPCharacterEvent -{ - uint32_t modifier; - uint16_t text[4]; - uint16_t unmodifiedText[4]; -} NPCharacterEvent; - -typedef struct _NPMouseEvent -{ - uint32_t modifier; - int32_t button; - int32_t x; - int32_t y; - int32_t clickCount; -} NPMouseEvent; - -typedef struct _NPMouseWheelEvent -{ - uint32_t modifier; - float deltaX; - float deltaY; - float wheelTicksX; - float wheelTicksY; - uint32_t scrollByPage; -} NPMouseWheelEvent; - -typedef struct _NPDeviceEvent { - uint32_t device_uid; - uint32_t subtype; - /* uint8_t generic[0]; */ -} NPDeviceEvent; - -typedef struct _NPMinimizeEvent { - int32_t value; -} NPMinimizeEvent; - -typedef struct _NPFocusEvent { - int32_t value; -} NPFocusEvent; - -typedef struct _NPPepperEvent -{ - uint32_t size; - int32_t type; - double timeStampSeconds; - union { - NPKeyEvent key; - NPCharacterEvent character; - NPMouseEvent mouse; - NPMouseWheelEvent wheel; - NPMinimizeEvent minimize; - NPFocusEvent focus; - NPDeviceEvent device; - } u; -} NPPepperEvent; - -/* 2D -----------------------------------------------------------------------*/ - -#define NPPepper2DDevice 1 - -typedef struct _NPDeviceContext2DConfig { -} NPDeviceContext2DConfig; - -typedef struct _NPDeviceContext2D -{ - /* Internal value used by the browser to identify this device. */ - void* reserved; - - /* A pointer to the pixel data. This data is 8-bit values in BGRA order in - * memory. Each row will start |stride| bytes after the previous one. - * - * THIS DATA USES PREMULTIPLIED ALPHA. This means that each color channel has - * been multiplied with the corresponding alpha, which makes compositing - * easier. If any color channels have a value greater than the alpha value, - * you'll likely get crazy colors and weird artifacts. */ - void* region; - - /* Length of each row of pixels in bytes. This may be larger than width * 4 - * if there is padding at the end of each row to help with alignment. */ - int32_t stride; - - /* The dirty region that the plugin has painted into the buffer. This - * will be initialized to the size of the plugin image in - * initializeContextPtr. The plugin can change the values to only - * update portions of the image. */ - struct { - int32_t left; - int32_t top; - int32_t right; - int32_t bottom; - } dirty; -} NPDeviceContext2D; - -typedef struct _NPDeviceBuffer { - void* ptr; - size_t size; -} NPDeviceBuffer; - -/* completion callback for flush device */ -typedef void (*NPDeviceFlushContextCallbackPtr)( - NPP instance, - NPDeviceContext* context, - NPError err, - NPUserData* userData); - -/* query single capabilities of device */ -typedef NPError ( - *NPDeviceQueryCapabilityPtr)(NPP instance, - int32_t capability, - int32_t *value); -/* query config (configuration == a set of capabilities) */ -typedef NPError ( - *NPDeviceQueryConfigPtr)(NPP instance, - const NPDeviceConfig* request, - NPDeviceConfig* obtain); -/* device initialization */ -typedef NPError (*NPDeviceInitializeContextPtr)( - NPP instance, - const NPDeviceConfig* config, - NPDeviceContext* context); -/* peek at device state */ -typedef NPError (*NPDeviceGetStateContextPtr) ( - NPP instance, - NPDeviceContext* context, - int32_t state, - intptr_t* value); -/* poke device state */ -typedef NPError (*NPDeviceSetStateContextPtr) ( - NPP instance, - NPDeviceContext* context, - int32_t state, - intptr_t value); -/* flush context, if callback, userData are NULL */ -/* this becomes a blocking call */ -typedef NPError (*NPDeviceFlushContextPtr)( - NPP instance, - NPDeviceContext* context, - NPDeviceFlushContextCallbackPtr callback, - void* userData); -/* destroy device context. Application responsible for */ -/* freeing context, if applicable */ -typedef NPError (*NPDeviceDestroyContextPtr)( - NPP instance, - NPDeviceContext* context); -/* Create a buffer associated with a particular context. The usage of the */ -/* buffer is device specific. The lifetime of the buffer is scoped with the */ -/* lifetime of the context. */ -typedef NPError (*NPDeviceCreateBufferPtr)( - NPP instance, - NPDeviceContext* context, - size_t size, - int32_t* id); -/* Destroy a buffer associated with a particular context. */ -typedef NPError (*NPDeviceDestroyBufferPtr)( - NPP instance, - NPDeviceContext* context, - int32_t id); -/* Map a buffer id to its address. */ -typedef NPError (*NPDeviceMapBufferPtr)( - NPP instance, - NPDeviceContext* context, - int32_t id, - NPDeviceBuffer* buffer); - - -/* forward decl typdef structs */ -typedef struct NPDevice NPDevice; -typedef struct NPNExtensions NPNExtensions; - -// DEPRECATED: this typedef is just for the NaCl code until they switch to NPNExtensions. -// PLEASE REMOVE THIS WHEN THE NACL CODE IS UPDATED. -typedef struct NPNExtensions NPExtensions; - - -/* New experimental device API. */ - -/* Mode for calls to NPDeviceSynchronizeContext. */ -typedef enum { - /* Get or set locally cached state without synchronizing or communicating */ - /* with the service process (or thread). */ - NPDeviceSynchronizationMode_Cached, - - /* Exchanges state with service process (or thread). Does not wait for any */ - /* progress before returning. */ - NPDeviceSynchronizationMode_Immediate, - - /* Exchanges state with service process (or thread). Blocks caller until */ - /* further progress can be made. */ - NPDeviceSynchronizationMode_Flush -} NPDeviceSynchronizationMode; - -/* Get the number of configs supported by a given device. */ -typedef NPError (*NPDeviceGetNumConfigsPtr)(NPP instance, - int32_t* numConfigs); - -/* Get attribute values from a config. NPDeviceGetConfigs might return */ -/* multiple configs. This function can be used to examine them to */ -/* find the most suitable. For example, NPDeviceGetConfigs might return one */ -/* config with antialiasing enabled and one without. This can be determined */ -/* using this function. */ -/* Inputs: */ -/* config: The config index to extract the attributes from. */ -/* attribList: Array of input config attribute / value pairs */ -/* terminated with NPAttrib_End. */ -/* Outputs: */ -/* attribList: The values paired up with each attribute are filled in */ -/* on return. */ -typedef NPError (*NPDeviceGetConfigAttribsPtr)(NPP instance, - int32_t config, - int32_t* attribList); - -/* Create a device context based on a particular device configuration and a */ -/* list config input attributes. */ -/* Inputs: */ -/* config: The device configuration to use. */ -/* attribList: NULL or an array of context specific attribute / value */ -/* pairs terminated with NPAttrib_End. */ -/* Outputs: */ -/* context: The created context. */ -typedef NPError (*NPDeviceCreateContextPtr)(NPP instance, - int32_t config, - const int32_t* attribList, - NPDeviceContext** context); - -/* Destroy a context. */ -/* Inputs: */ -/* context: The context to destroy. */ -/*typedef NPError (*NPDestroyContext)(NPP instance, */ -/* NPDeviceContext* context); */ - -/* This type should be cast to the type associated with the particular */ -/* callback type */ -typedef void (*NPDeviceGenericCallbackPtr)(void); - -/* Register a callback with a context. Callbacks are never invoked after the */ -/* associated context has been destroyed. The semantics of the particular */ -/* callback type determine which thread the callback is invoked on. It might */ -/* be the plugin thread, the thread RegisterCallback is invoked on or a */ -/* special thread created for servicing callbacks, such as an audio thread */ -/* Inputs: */ -/* callbackType: The device specific callback type */ -/* callback: The callback to invoke. The signature varies by type. Use */ -/* NULL to unregister the callback for a particular type. */ -/* callbackData: A value that is passed to the callback function. Other */ -/* callback arguments vary by type. */ -typedef NPError (*NPDeviceRegisterCallbackPtr)( - NPP instance, - NPDeviceContext* context, - int32_t callbackType, - NPDeviceGenericCallbackPtr callback, - void* callbackData); - -/* Callback for NPDeviceSynchronizeContext. */ -/* Inputs: */ -/* instance: The associated plugin instance. */ -/* context: The context that was flushed. */ -/* error: Indicates success of flush operation. */ -/* data: The completion callback data that was passed to */ -/* NPDeviceSynchronizeContext. */ -typedef void (*NPDeviceSynchronizeContextCallbackPtr)( - NPP instance, - NPDeviceContext* context, - NPError error, - void* data); - -/* Synchronize the state of a device context. Takes lists of input and output */ -/* attributes. Generally, the input attributes are copied into the context */ -/* and the output attributes are filled in the state of the context either */ -/* after (before) the synchronization depending on whether it is synchronous */ -/* (asynchronous). The get the state of the context after an asynchronous */ -/* synchronization, call this function a second time with Cached mode after */ -/* the callback has been invoked. */ -/* Inputs: */ -/* context: The context to synchronize. */ -/* mode: The type of synchronization to perform. */ -/* inputAttribList: NULL or an array of input synchronization attribute / */ -/* value pairs terminated with NPAttrib_End. */ -/* outputAttribList: NULL or an array of output synchronization */ -/* attributes / uninitialized value pairs terminated */ -/* with NPAttrib_End. */ -/* callback: NULL for synchronous operation or completion callback function */ -/* for asynchronous operation. */ -/* callbackData: Argument passed to callback function. */ -/* Outputs: */ -/* outputAttribList: The values paired up with each attribute are filled */ -/* in on return for synchronous operation. */ -typedef NPError (*NPDeviceSynchronizeContextPtr)( - NPP instance, - NPDeviceContext* context, - NPDeviceSynchronizationMode mode, - const int32_t* inputAttribList, - int32_t* outputAttribList, - NPDeviceSynchronizeContextCallbackPtr callback, - void* callbackData); - -/* All attributes shared between devices, with the exception of */ -/* NPDeviceContextAttrib_End, have bit 31 set. Device specific attributes */ -/* have the bit clear. */ -enum { - /* Used to terminate arrays of attribute / value pairs. */ - NPAttrib_End = 0, - - /* Error status of context. Non-zero means error. Shared by all devices, */ - /* though error values are device specific. */ - NPAttrib_Error = 0x80000000 -}; - -/* generic device interface */ -struct NPDevice { - NPDeviceQueryCapabilityPtr queryCapability; - NPDeviceQueryConfigPtr queryConfig; - NPDeviceInitializeContextPtr initializeContext; - NPDeviceSetStateContextPtr setStateContext; - NPDeviceGetStateContextPtr getStateContext; - NPDeviceFlushContextPtr flushContext; - NPDeviceDestroyContextPtr destroyContext; - NPDeviceCreateBufferPtr createBuffer; - NPDeviceDestroyBufferPtr destroyBuffer; - NPDeviceMapBufferPtr mapBuffer; - - /* Experimental device API */ - NPDeviceGetNumConfigsPtr getNumConfigs; - NPDeviceGetConfigAttribsPtr getConfigAttribs; - NPDeviceCreateContextPtr createContext; -/* NPDeviceDestroyContextPtr destroyContext; */ - NPDeviceRegisterCallbackPtr registerCallback; - NPDeviceSynchronizeContextPtr synchronizeContext; -/* NPDeviceCreateBufferPtr createBuffer; */ -/* NPDeviceDestroyBufferPtr destroyBuffer; */ -/* NPDeviceMapBufferPtr mapBuffer; */ -}; - -/* returns NULL if deviceID unavailable / unrecognized */ -typedef NPDevice* (*NPAcquireDevicePtr)( - NPP instance, - NPDeviceID device); - -/* Updates the number of find results for the current search term. If - * there are no matches 0 should be passed in. Only when the plugin has - * finished searching should it pass in the final count with finalResult set to - * true. */ -typedef void (*NPNumberOfFindResultsChangedPtr)( - NPP instance, - int total, - bool finalResult); - - /* Updates the index of the currently selected search item. */ -typedef void (*NPSelectedFindResultChangedPtr)( - NPP instance, - int index); - -/* Theming -----------------------------------------------------------------*/ -typedef int32_t NPWidgetID; - -typedef enum { - NPWidgetTypeScrollbar = 0 -} NPWidgetType; - -typedef struct _NPScrollbarCreateParams { - bool vertical; -} NPScrollbarCreateParams; - -typedef struct _NPRect32 -{ - uint32_t top; - uint32_t left; - uint32_t bottom; - uint32_t right; -} NPRect32; - -typedef struct _NPScrollbarTickMarks { - uint32_t count; - NPRect32* tickmarks; -} NPScrollbarTickMarks; - -typedef enum { - NPWidgetPropertyLocation = 0, // variable is NPRect*. - NPWidgetPropertyDirtyRect = 1, // Get only. variable is NPRec*. - NPWidgetPropertyScrollbarThickness = 2, // Get only. variable is int32_t*. - NPWidgetPropertyScrollbarValue = 3, // variable is int32_t*. - NPWidgetPropertyScrollbarDocumentSize = 4, // Set only. variable is int32_t*. - // Set only. variable is NPScrollbarTickMarks*. - NPWidgetPropertyScrollbarTickMarks = 5, - // Set only. variable is bool* (true for forward, false for backward). - NPWidgetPropertyScrollbarScrollByLine = 6, - // Set only. variable is bool* (true for forward, false for backward). - NPWidgetPropertyScrollbarScrollByPage = 7, - // Set only. variable is bool* (true for forward, false for backward). - NPWidgetPropertyScrollbarScrollByDocument = 8, - // Set only. variable is int32_t* (positive forward, negative backward). - NPWidgetPropertyScrollbarScrollByPixels = 9 -} NPWidgetProperty; - -// Creates a widget. If it returns NPERR_NO_ERROR then id will contain a unique -// identifer for the widget that's used for the next functions. -typedef NPError (*NPCreateWidgetPtr) ( - NPP instance, - NPWidgetType type, - void* params, // Widget specific. - NPWidgetID* id); - -// Destroys a widget. -typedef NPError (*NPDestroyWidgetPtr) ( - NPP instance, - NPWidgetID id); - -// Paint the dirty rectangle of the given widget into context. -typedef NPError (*NPPaintWidgetPtr) ( - NPP instance, - NPWidgetID id, - NPDeviceContext2D* context, - NPRect* dirty); - -// Pass in a pepper event to a plugin. It'll return true iff it uses it. -typedef bool (*NPHandleWidgetEventPtr) ( - NPP instance, - NPWidgetID id, - NPPepperEvent* event); - -// Gets a property of the widget. "value" varies depending on the variable. -typedef NPError (*NPGetWidgetPropertyPtr) ( - NPP instance, - NPWidgetID id, - NPWidgetProperty property, - void* value); - -// Sets a property of the widget. -typedef NPError (*NPSetWidgetPropertyPtr) ( - NPP instance, - NPWidgetID id, - NPWidgetProperty property, - void* value); - -typedef struct _NPWidgetExtensions { - NPCreateWidgetPtr createWidget; - NPDestroyWidgetPtr destroyWidget; - NPPaintWidgetPtr paintWidget; - NPHandleWidgetEventPtr handleWidgetEvent; - NPGetWidgetPropertyPtr getWidgetProperty; - NPSetWidgetPropertyPtr setWidgetProperty; -} NPWidgetExtensions; - -typedef NPWidgetExtensions* (*NPGetWidgetExtensionsPtr)( - NPP instance); - - -/* Supports opening files anywhere on the system after prompting the user to - * pick one. - * - * This API is asynchronous. It will return immediately and the user will be - * prompted in parallel to pick a file. The plugin may continue to receive - * events while the open file dialog is up, and may continue to paint. Plugins - * may want to ignore input events between the call and the callback to avoid - * reentrant behavior. If the return value is not NPERR_NO_ERROR, the callback - * will NOT be executed. - * - * It is an error to call BrowseForFile before a previous call has executed - * the callback. - * - * Setting the flags to "Open" requires that the file exist to allow picking. - * Setting the flags to "Save" allows selecting nonexistant files (which will - * then be created), and will prompt the user if they want to overwrite an - * existing file if it exists. - * - * The plugin may specify a comma-separated list of possible mime types in - * the "extensions" parameter. If no extensions are specified, the dialog box - * will default to allowing all extensions. The first extension in the list - * will be the default. - * - * TODO(brettw) On Windows the extensions traditionally include a text - * description with the extension in the popup, do we want to allow this? - * We should probably also allow the ability to put "All files" in the - * list on Windows. - * - * Once the user has picked a file or has canceled the dialog box, the given - * callback will be called with the results of the operation and the passed in - * "user data" pointer. If the user successfully picked a file, the filename - * will be non-NULL and will contain a pointer to an array of strings, one for - * each file picked (the first file will be file_paths[0]). This buffer will - * become invalid as soon as the call completes, so it is the plugin's - * responsibility to copy the filename(sp if it needs future access to them. - * A NULL file_paths in the callback means the user canceled the dialog box. - * - * The filename will be in UTF-8. It may not actually correspond to the actual - * file on disk on a Linux system, because we'll do our best to convert it from - * the filesystem's locale to UTF-8. Instead, the string will be appropriate for - * displaying to the user which file they picked. - * */ -typedef enum { - NPChooseFile_Open = 1, - NPChooseFile_OpenMultiple = 2, - NPChooseFile_Save = 3 -} NPChooseFileMode; -typedef void (*NPChooseFileCallback)(const char** filePaths, - uint32_t pathCount, - void* userData); -typedef NPError (*NPChooseFilePtr)( - NPP instance, - const char* mimeTypes, - NPChooseFileMode mode, - NPChooseFileCallback callback, - void* userData); - -typedef enum { - NPCursorTypePointer = 0, - NPCursorTypeCross = 1, - NPCursorTypeHand = 2, - NPCursorTypeIBeam = 3, - NPCursorTypeWait = 4, - NPCursorTypeHelp = 5, - NPCursorTypeEastResize = 6, - NPCursorTypeNorthResize = 7, - NPCursorTypeNorthEastResize = 8, - NPCursorTypeNorthWestResize = 9, - NPCursorTypeSouthResize = 10, - NPCursorTypeSouthEastResize = 11, - NPCursorTypeSouthWestResize = 12, - NPCursorTypeWestResize = 13, - NPCursorTypeNorthSouthResize = 14, - NPCursorTypeEastWestResize = 15, - NPCursorTypeNorthEastSouthWestResize = 16, - NPCursorTypeNorthWestSouthEastResize = 17, - NPCursorTypeColumnResize = 18, - NPCursorTypeRowResize = 19, - NPCursorTypeMiddlePanning = 20, - NPCursorTypeEastPanning = 21, - NPCursorTypeNorthPanning = 22, - NPCursorTypeNorthEastPanning = 23, - NPCursorTypeNorthWestPanning = 24, - NPCursorTypeSouthPanning = 25, - NPCursorTypeSouthEastPanning = 26, - NPCursorTypeSouthWestPanning = 27, - NPCursorTypeWestPanning = 28, - NPCursorTypeMove = 29, - NPCursorTypeVerticalText = 30, - NPCursorTypeCell = 31, - NPCursorTypeContextMenu = 32, - NPCursorTypeAlias = 33, - NPCursorTypeProgress = 34, - NPCursorTypeNoDrop = 35, - NPCursorTypeCopy = 36, - NPCursorTypeNone = 37, - NPCursorTypeNotAllowed = 38, - NPCursorTypeZoomIn = 39, - NPCursorTypeZoomOut = 40 -} NPCursorType; - -// Temporary SetCursor API. -typedef NPError (*NPSetCursorPtr)( - NPP instance, - NPCursorType type); - -/* unique id for each font */ -typedef int NPFontID; - -typedef enum { - NPCharsetAnsi = 0, - NPCharsetDefault = 1, - NPCharsetSymbol = 2, - NPCharsetMac = 77, - NPCharsetShiftJIS = 128, - NPCharsetHangul = 129, - NPCharsetJohab = 130, - NPCharsetGB2312 =134, - NPCharsetChineseBIG5 = 136, - NPCharsetGreek = 161, - NPCharsetTurkish = 162, - NPCharsetVietnamese = 163, - NPCharsetHebrew = 177, - NPCharsetArabic = 178, - NPCharsetBaltic = 186, - NPCharsetRussian = 204, - NPCharsetThai = 222, - NPCharsetEastEurope = 238, - NPCharsetOEM = 255 -} NPCharset; - -typedef enum { - NPPitchDefault, - NPPitchFixed -} NPPitch; - -typedef enum { - NPFamilyDefault, - NPFamilyRoman, - NPFamilyScript -} NPFamily; - -typedef struct _NPFontDescription { - const char* face; - int weight; - bool italic; - NPPitch pitch; - NPFamily family; - NPCharset charset; -} NPFontDescription; - -// Return a font which best matches the given properties. -typedef NPError (*NPMatchFontWithFallbackPtr) ( - NPP instance, - const NPFontDescription* description, - NPFontID* id); - -// Loads a specified font table for the given font. -// table: the table in *big-endian* format, or 0 for the whole font file. -// output: a buffer of size output_length that gets the data. can be 0, in -// which case output_length will be set to the required size in bytes. -// output_length: size of output, if it's not 0. -typedef NPError (*GetFontTablePtr) ( - NPP instance, - NPFontID id, - uint32_t table, - void* output, - size_t* output_length); - -// Destroys a font. -typedef NPError (*NPDestroyFontPtr) ( - NPP instance, - NPFontID id); - -typedef struct _NPFontExtensions { - NPMatchFontWithFallbackPtr matchFontWithFallback; - GetFontTablePtr getFontTable; - NPDestroyFontPtr destroyFont; -} NPFontExtensions; - -typedef NPFontExtensions* (*NPGetFontExtensionsPtr)( - NPP instance); - -/* Pepper extensions */ -struct NPNExtensions { - /* Device interface acquisition */ - NPAcquireDevicePtr acquireDevice; - /* Find */ - NPNumberOfFindResultsChangedPtr numberOfFindResultsChanged; - NPSelectedFindResultChangedPtr selectedFindResultChanged; - /* File I/O extensions */ - NPChooseFilePtr chooseFile; - /* Widget */ - NPGetWidgetExtensionsPtr getWidgetExtensions; - /* Cursor */ - NPSetCursorPtr setCursor; - /* Font */ - NPGetFontExtensionsPtr getFontExtensions; -}; - -/* 3D -----------------------------------------------------------------------*/ - -#define NPPepper3DDevice 2 - -typedef struct _NPDeviceContext3DConfig { - int32_t commandBufferSize; -} NPDeviceContext3DConfig; - -typedef enum _NPDeviceContext3DError { - // No error has ocurred. - NPDeviceContext3DError_NoError, - - // The size of a command was invalid. - NPDeviceContext3DError_InvalidSize, - - // An offset was out of bounds. - NPDeviceContext3DError_OutOfBounds, - - // A command was not recognized. - NPDeviceContext3DError_UnknownCommand, - - // The arguments to a command were invalid. - NPDeviceContext3DError_InvalidArguments, - - // The 3D context was lost, for example due to a power management event. The - // context must be destroyed and a new one created. - NPDeviceContext3DError_LostContext, - - // Any other error. - NPDeviceContext3DError_GenericError -} NPDeviceContext3DError; - -typedef struct _NPDeviceContext3D NPDeviceContext3D; - -typedef void (*NPDeviceContext3DRepaintPtr)(NPP npp, - NPDeviceContext3D* context); - -// TODO(apatrick): this need not be exposed when we switch over to the new -// device API. It's layout can also be implementation dependent. -typedef struct _NPDeviceContext3D -{ - void* reserved; - - // If true, then a flush will only complete once the get offset has advanced - // on the GPU thread. If false, then the get offset might have changed but - // the GPU thread will respond as quickly as possible without guaranteeing - // having made any progress in executing pending commands. Set to true - // to ensure that progress is made or when flushing in a loop waiting for the - // GPU to reach a certain state, for example in advancing beyond a particular - // token. Set to false when flushing to query the current state, for example - // whether an error has occurred. - bool waitForProgress; - - // Buffer in which commands are stored. - void* commandBuffer; - int32_t commandBufferSize; - - // Offset in command buffer reader has reached. Synchronized on flush. - int32_t getOffset; - - // Offset in command buffer writer has reached. Synchronized on flush. - int32_t putOffset; - - // Last processed token. Synchronized on flush. - int32_t token; - - // Callback invoked on the main thread when the context must be repainted. - // TODO(apatrick): move this out of the context struct like the rest of the - // fields. - NPDeviceContext3DRepaintPtr repaintCallback; - - // Error status. Synchronized on flush. - NPDeviceContext3DError error; -} NPDeviceContext3D; - - -/* Begin 3D specific portion of experimental device API */ - -/* Device buffer ID reserved for command buffer */ -enum { - NP3DCommandBufferId = 0 -}; - -/* 3D attributes */ -enum { - /* Example GetConfigAttribs attributes. See EGL 1.4 spec. */ - /* These may be passed to GetConfigAttribs. */ - NP3DAttrib_BufferSize = 0x3020, - NP3DAttrib_AlphaSize = 0x3021, - NP3DAttrib_BlueSize = 0x3022, - NP3DAttrib_GreenSize = 0x3023, - NP3DAttrib_RedSize = 0x3024, - NP3DAttrib_DepthSize = 0x3025, - NP3DAttrib_StencilSize = 0x3026, - NP3DAttrib_SurfaceType = 0x3033, - - /* Example CreateContext attributes. See EGL 1.4 spec. */ - /* These may be passed to CreateContext. */ - NP3DAttrib_SwapBehavior = 0x3093, - NP3DAttrib_MultisampleResolve = 0x3099, - - /* Size of command buffer in 32-bit entries. */ - /* This may be passed to CreateContext as an input or SynchronizeContext as */ - /* an output. */ - NP3DAttrib_CommandBufferSize = 0x10000000, - - /* These may be passed to SynchronizeContext. */ - - /* Offset in command buffer writer has reached. In / out.*/ - NP3DAttrib_PutOffset, - - /* Offset in command buffer reader has reached. Out only. */ - NP3DAttrib_GetOffset, - - /* Last processed token. Out only. */ - NP3DAttrib_Token -}; - -/* 3D callbacks */ -enum { - /* This callback is invoked whenever the plugin must repaint everything. */ - /* This might be because the window manager must repaint a window or */ - /* the context has been lost, for example a power management event. */ - NP3DCallback_Repaint = 1 -}; - -/* Flags for NPConfig3DOutAttrib_SurfaceType */ -enum { - NP3DSurfaceType_MultisampleResolveBox = 0x0200, - NP3DSurfaceType_SwapBehaviorPreserved = 0x0400 -}; - -/* Values for NPConfig3DInAttrib_SwapBehavior */ -enum { - NP3DSwapBehavior_Preserved = 0x3094, - NP3DSwapBehavior_Destroyed = 0x3095 -}; - -/* Values for NPConfig3DInAttrib_MultisampleResolve */ -enum { - NP3DMultisampleResolve_Default = 0x309A, - NP3DMultisampleResolve_Box = 0x309B -}; - -/* End 3D specific API */ - -/* Audio --------------------------------------------------------------------*/ - -#define NPPepperAudioDevice 3 - -/* min & max sample frame count */ -typedef enum { - NPAudioMinSampleFrameCount = 64, - NPAudioMaxSampleFrameCount = 32768 -} NPAudioSampleFrameCounts; - -/* supported sample rates */ -typedef enum { - NPAudioSampleRate44100Hz = 44100, - NPAudioSampleRate48000Hz = 48000, - NPAudioSampleRate96000Hz = 96000 -} NPAudioSampleRates; - -/* supported sample formats */ -typedef enum { - NPAudioSampleTypeInt16 = 0, - NPAudioSampleTypeFloat32 = 1 -} NPAudioSampleTypes; - -/* supported channel layouts */ -/* there is code that depends on these being the actual number of channels */ -typedef enum { - NPAudioChannelNone = 0, - NPAudioChannelMono = 1, - NPAudioChannelStereo = 2, - NPAudioChannelThree = 3, - NPAudioChannelFour = 4, - NPAudioChannelFive = 5, - NPAudioChannelFiveOne = 6, - NPAudioChannelSeven = 7, - NPAudioChannelSevenOne = 8 -} NPAudioChannels; - -/* audio context states */ -typedef enum { - NPAudioContextStateCallback = 0, - NPAudioContextStateUnderrunCounter = 1 -} NPAudioContextStates; - -/* audio context state values */ -typedef enum { - NPAudioCallbackStop = 0, - NPAudioCallbackStart = 1 -} NPAudioContextStateValues; - -/* audio query capabilities */ -typedef enum { - NPAudioCapabilitySampleRate = 0, - NPAudioCapabilitySampleType = 1, - NPAudioCapabilitySampleFrameCount = 2, - NPAudioCapabilitySampleFrameCount44100Hz = 3, - NPAudioCapabilitySampleFrameCount48000Hz = 4, - NPAudioCapabilitySampleFrameCount96000Hz = 5, - NPAudioCapabilityOutputChannelMap = 6, - NPAudioCapabilityInputChannelMap = 7 -} NPAudioCapabilities; - -typedef struct _NPDeviceContextAudio NPDeviceContextAudio; - -/* user supplied callback function */ -typedef void (*NPAudioCallback)(NPDeviceContextAudio *context); - -typedef struct _NPDeviceContextAudioConfig { - int32_t sampleRate; - int32_t sampleType; - int32_t outputChannelMap; - int32_t inputChannelMap; - int32_t sampleFrameCount; - uint32_t startThread; - uint32_t flags; - NPAudioCallback callback; - void *userData; -} NPDeviceContextAudioConfig; - -struct _NPDeviceContextAudio { - NPDeviceContextAudioConfig config; - void *outBuffer; - void *inBuffer; - void *reserved; -}; - -/* Printing related APIs ---------------------------------------------------*/ - -/* Defines a contiguous range of pages to be printed. Page numbers use a - * zero-based index. */ -typedef struct _NPPrintPageNumberRange { - int32_t firstPageNumber; - int32_t lastPageNumber; -} NPPrintPageNumberRange; - -/* Being a print operation. Returns the total number of pages to print at the - * given printableArea size and DPI. printableArea is in points (a point is 1/72 - * of an inch). The plugin is expected to remember the values of printableArea - * and printerDPI for use in subsequent print interface calls. These values - * should be cleared in printEnd. */ -typedef NPError (*NPPPrintBeginPtr) ( - NPP instance, - NPRect* printableArea, - int32_t printerDPI, - int32_t* numPages); -/* Returns the required raster dimensions for the given page. */ -typedef NPError (*NPPGetRasterDimensionsPtr) ( - NPP instance, - int32_t pageNumber, - int32_t* widthInPixels, - int32_t* heightInPixels); -/* Prints the specified page This allows the plugin to print a raster output. */ -typedef NPError (*NPPPrintPageRasterPtr) ( - NPP instance, - int32_t pageNumber, - NPDeviceContext2D* printSurface); -/* Ends the print operation */ -typedef NPError (*NPPPrintEndPtr) (NPP instance); -/* Prints the specified pages as PDF. The plugin allocates the output buffer - * pointed to by pdf_output using the browser-supplied NPN_MemAlloc function. - * The caller is expected to free the output buffer upon success.*/ -typedef NPError (*NPPrintPagesAsPDFPtr)(NPP instance, - NPPrintPageNumberRange* page_ranges, - int32_t page_range_count, - unsigned char** pdf_output, - int32_t* output_size); - - -/* TODO(sanjeevr) : Provide a vector interface for printing. We need to decide - * on a vector format that can support embedded fonts. A vector format will - * greatly reduce the size of the required output buffer. */ - -typedef struct _NPPPrintExtensions { - NPPPrintBeginPtr printBegin; - NPPGetRasterDimensionsPtr getRasterDimensions; - NPPPrintPageRasterPtr printPageRaster; - NPPPrintEndPtr printEnd; - NPPrintPagesAsPDFPtr printPagesAsPDF; -} NPPPrintExtensions; - -/* Returns NULL if the plugin does not support print extensions */ -typedef NPPPrintExtensions* (*NPPGetPrintExtensionsPtr)(NPP instance); - -/* Find ---------------------------------------------------------------------*/ - -/* Finds the given UTF-8 text starting at the current selection. The number of - * results will be updated asynchronously via numberOfFindResultsChanged. Note - * that multiple StartFind calls can happen before StopFind is called in the - * case of the search term changing. */ -typedef NPError (*NPPStartFindPtr) ( - NPP instance, - const char* text, - bool caseSensitive); - -/* Go to the next/previous result. */ -typedef NPError (*NPPSelectFindResultPtr) ( - NPP instance, - bool forward); - -/* Tells the plugin that the find operation has stopped, so it should clear - * any highlighting. */ -typedef NPError (*NPPStopFindPtr) ( - NPP instance); - -typedef struct _NPPFindExtensions { - NPPStartFindPtr startFind; - NPPSelectFindResultPtr selectFindResult; - NPPStopFindPtr stopFind; -} NPPFindExtensions; - -/* Returns NULL if the plugin does not support find extensions. */ -typedef NPPFindExtensions* (*NPPGetFindExtensionsPtr)(NPP instance); - -/* Zooms a plugin to the given factor. If text_only is true, then only the text - * should be zoomed. */ -typedef NPError (*NPPZoomPtr) ( - NPP instance, - float factor, - bool text_only); - -typedef NPError (*NPPWidgetPropertyChangedPtr) ( - NPP instance, - NPWidgetID id, - NPWidgetProperty property); - -/* type of selection */ -typedef enum { - NPSelectionTypeAny = 0, - NPSelectionTypePlainText = 1, - NPSelectionTypeHTML = 2 -} NPSelectionType; - -/* Gets the selection. NPERR_GENERIC_ERROR is returned if nothing is selected. - * 'type' is both an input and output parameter. The caller can request a - * specific type, and if the plugin can't provide it, it will return - * NPERR_GENERIC_ERROR. Or the caller can specify NPSelectionTypeAny to let the - * plugin pick the best format for the data. The result is returned in a buffer - * that's owned by the caller and which is allocated using NPN_MemAlloc. If no - * data is available, NPERR_GENERIC_ERROR is returned. */ -typedef NPError (*NPPGetSelectionPtr) ( - NPP instance, - NPSelectionType* type, - void** data); - -typedef struct _NPPExtensions { - NPPGetPrintExtensionsPtr getPrintExtensions; - NPPGetFindExtensionsPtr getFindExtensions; - NPPZoomPtr zoom; - NPPWidgetPropertyChangedPtr widgetPropertyChanged; - NPPGetSelectionPtr getSelection; -} NPPExtensions; - -#endif /* _NP_EXTENSIONS_H_ */ diff --git a/cef/include/internal/npapi/npfunctions.h b/cef/include/internal/npapi/npfunctions.h deleted file mode 100644 index 02a54be1b..000000000 --- a/cef/include/internal/npapi/npfunctions.h +++ /dev/null @@ -1,239 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef npfunctions_h_ -#define npfunctions_h_ - -#ifdef __OS2__ -#pragma pack(1) -#define NP_LOADDS _System -#else -#define NP_LOADDS -#endif - -#include "npapi.h" -#include "npruntime.h" - -typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); -typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save); -typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window); -typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); -typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason); -typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream); -typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer); -typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname); -typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint); -typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event); -typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData); -/* Any NPObjects returned to the browser via NPP_GetValue should be retained - by the plugin on the way out. The browser is responsible for releasing. */ -typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value); -typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value); -typedef NPBool (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction); -typedef void (* NP_LOADDS NPP_LostFocusPtr)(NPP instance); -typedef void (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData); -typedef NPError (* NP_LOADDS NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge); -typedef char** (* NP_LOADDS NPP_GetSitesWithDataPtr)(void); - -typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value); -typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value); -typedef NPError (*NPN_GetURLNotifyProcPtr)(NPP instance, const char* url, const char* window, void* notifyData); -typedef NPError (*NPN_PostURLNotifyProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData); -typedef NPError (*NPN_GetURLProcPtr)(NPP instance, const char* url, const char* window); -typedef NPError (*NPN_PostURLProcPtr)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file); -typedef NPError (*NPN_RequestReadProcPtr)(NPStream* stream, NPByteRange* rangeList); -typedef NPError (*NPN_NewStreamProcPtr)(NPP instance, NPMIMEType type, const char* window, NPStream** stream); -typedef int32_t (*NPN_WriteProcPtr)(NPP instance, NPStream* stream, int32_t len, void* buffer); -typedef NPError (*NPN_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason); -typedef void (*NPN_StatusProcPtr)(NPP instance, const char* message); -/* Browser manages the lifetime of the buffer returned by NPN_UserAgent, don't - depend on it sticking around and don't free it. */ -typedef const char* (*NPN_UserAgentProcPtr)(NPP instance); -typedef void* (*NPN_MemAllocProcPtr)(uint32_t size); -typedef void (*NPN_MemFreeProcPtr)(void* ptr); -typedef uint32_t (*NPN_MemFlushProcPtr)(uint32_t size); -typedef void (*NPN_ReloadPluginsProcPtr)(NPBool reloadPages); -typedef void* (*NPN_GetJavaEnvProcPtr)(void); -typedef void* (*NPN_GetJavaPeerProcPtr)(NPP instance); -typedef void (*NPN_InvalidateRectProcPtr)(NPP instance, NPRect *rect); -typedef void (*NPN_InvalidateRegionProcPtr)(NPP instance, NPRegion region); -typedef void (*NPN_ForceRedrawProcPtr)(NPP instance); -typedef NPIdentifier (*NPN_GetStringIdentifierProcPtr)(const NPUTF8* name); -typedef void (*NPN_GetStringIdentifiersProcPtr)(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers); -typedef NPIdentifier (*NPN_GetIntIdentifierProcPtr)(int32_t intid); -typedef bool (*NPN_IdentifierIsStringProcPtr)(NPIdentifier identifier); -typedef NPUTF8* (*NPN_UTF8FromIdentifierProcPtr)(NPIdentifier identifier); -typedef int32_t (*NPN_IntFromIdentifierProcPtr)(NPIdentifier identifier); -typedef NPObject* (*NPN_CreateObjectProcPtr)(NPP npp, NPClass *aClass); -typedef NPObject* (*NPN_RetainObjectProcPtr)(NPObject *obj); -typedef void (*NPN_ReleaseObjectProcPtr)(NPObject *obj); -typedef bool (*NPN_InvokeProcPtr)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result); -typedef bool (*NPN_InvokeDefaultProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); -typedef bool (*NPN_EvaluateProcPtr)(NPP npp, NPObject *obj, NPString *script, NPVariant *result); -typedef bool (*NPN_GetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result); -typedef bool (*NPN_SetPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value); -typedef bool (*NPN_RemovePropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName); -typedef bool (*NPN_HasPropertyProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName); -typedef bool (*NPN_HasMethodProcPtr)(NPP npp, NPObject *obj, NPIdentifier propertyName); -typedef void (*NPN_ReleaseVariantValueProcPtr)(NPVariant *variant); -typedef void (*NPN_SetExceptionProcPtr)(NPObject *obj, const NPUTF8 *message); -typedef void (*NPN_PushPopupsEnabledStateProcPtr)(NPP npp, NPBool enabled); -typedef void (*NPN_PopPopupsEnabledStateProcPtr)(NPP npp); -typedef bool (*NPN_EnumerateProcPtr)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count); -typedef void (*NPN_PluginThreadAsyncCallProcPtr)(NPP instance, void (*func)(void *), void *userData); -typedef bool (*NPN_ConstructProcPtr)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result); -typedef NPError (*NPN_GetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, char **value, uint32_t *len); -typedef NPError (*NPN_SetValueForURLPtr)(NPP npp, NPNURLVariable variable, const char *url, const char *value, uint32_t len); -typedef NPError (*NPN_GetAuthenticationInfoPtr)(NPP npp, const char *protocol, const char *host, int32_t port, const char *scheme, const char *realm, char **username, uint32_t *ulen, char **password, uint32_t *plen); -typedef uint32_t (*NPN_ScheduleTimerPtr)(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID)); -typedef void (*NPN_UnscheduleTimerPtr)(NPP instance, uint32_t timerID); -typedef NPError (*NPN_PopUpContextMenuPtr)(NPP instance, NPMenu* menu); -typedef NPBool (*NPN_ConvertPointPtr)(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace); -typedef NPBool (*NPN_HandleEventPtr)(NPP instance, void *event, NPBool handled); -typedef NPBool (*NPN_UnfocusInstancePtr)(NPP instance, NPFocusDirection direction); -typedef void (*NPN_URLRedirectResponsePtr)(NPP instance, void* notifyData, NPBool allow); - -typedef struct _NPPluginFuncs { - uint16_t size; - uint16_t version; - NPP_NewProcPtr newp; - NPP_DestroyProcPtr destroy; - NPP_SetWindowProcPtr setwindow; - NPP_NewStreamProcPtr newstream; - NPP_DestroyStreamProcPtr destroystream; - NPP_StreamAsFileProcPtr asfile; - NPP_WriteReadyProcPtr writeready; - NPP_WriteProcPtr write; - NPP_PrintProcPtr print; - NPP_HandleEventProcPtr event; - NPP_URLNotifyProcPtr urlnotify; - void* javaClass; - NPP_GetValueProcPtr getvalue; - NPP_SetValueProcPtr setvalue; - NPP_GotFocusPtr gotfocus; - NPP_LostFocusPtr lostfocus; - NPP_URLRedirectNotifyPtr urlredirectnotify; - NPP_ClearSiteDataPtr clearsitedata; - NPP_GetSitesWithDataPtr getsiteswithdata; -} NPPluginFuncs; - -typedef struct _NPNetscapeFuncs { - uint16_t size; - uint16_t version; - NPN_GetURLProcPtr geturl; - NPN_PostURLProcPtr posturl; - NPN_RequestReadProcPtr requestread; - NPN_NewStreamProcPtr newstream; - NPN_WriteProcPtr write; - NPN_DestroyStreamProcPtr destroystream; - NPN_StatusProcPtr status; - NPN_UserAgentProcPtr uagent; - NPN_MemAllocProcPtr memalloc; - NPN_MemFreeProcPtr memfree; - NPN_MemFlushProcPtr memflush; - NPN_ReloadPluginsProcPtr reloadplugins; - NPN_GetJavaEnvProcPtr getJavaEnv; - NPN_GetJavaPeerProcPtr getJavaPeer; - NPN_GetURLNotifyProcPtr geturlnotify; - NPN_PostURLNotifyProcPtr posturlnotify; - NPN_GetValueProcPtr getvalue; - NPN_SetValueProcPtr setvalue; - NPN_InvalidateRectProcPtr invalidaterect; - NPN_InvalidateRegionProcPtr invalidateregion; - NPN_ForceRedrawProcPtr forceredraw; - NPN_GetStringIdentifierProcPtr getstringidentifier; - NPN_GetStringIdentifiersProcPtr getstringidentifiers; - NPN_GetIntIdentifierProcPtr getintidentifier; - NPN_IdentifierIsStringProcPtr identifierisstring; - NPN_UTF8FromIdentifierProcPtr utf8fromidentifier; - NPN_IntFromIdentifierProcPtr intfromidentifier; - NPN_CreateObjectProcPtr createobject; - NPN_RetainObjectProcPtr retainobject; - NPN_ReleaseObjectProcPtr releaseobject; - NPN_InvokeProcPtr invoke; - NPN_InvokeDefaultProcPtr invokeDefault; - NPN_EvaluateProcPtr evaluate; - NPN_GetPropertyProcPtr getproperty; - NPN_SetPropertyProcPtr setproperty; - NPN_RemovePropertyProcPtr removeproperty; - NPN_HasPropertyProcPtr hasproperty; - NPN_HasMethodProcPtr hasmethod; - NPN_ReleaseVariantValueProcPtr releasevariantvalue; - NPN_SetExceptionProcPtr setexception; - NPN_PushPopupsEnabledStateProcPtr pushpopupsenabledstate; - NPN_PopPopupsEnabledStateProcPtr poppopupsenabledstate; - NPN_EnumerateProcPtr enumerate; - NPN_PluginThreadAsyncCallProcPtr pluginthreadasynccall; - NPN_ConstructProcPtr construct; - NPN_GetValueForURLPtr getvalueforurl; - NPN_SetValueForURLPtr setvalueforurl; - NPN_GetAuthenticationInfoPtr getauthenticationinfo; - NPN_ScheduleTimerPtr scheduletimer; - NPN_UnscheduleTimerPtr unscheduletimer; - NPN_PopUpContextMenuPtr popupcontextmenu; - NPN_ConvertPointPtr convertpoint; - NPN_HandleEventPtr handleevent; - NPN_UnfocusInstancePtr unfocusinstance; - NPN_URLRedirectResponsePtr urlredirectresponse; -} NPNetscapeFuncs; - -#ifdef XP_MACOSX -/* - * Mac OS X version(s) of NP_GetMIMEDescription(const char *) - * These can be called to retreive MIME information from the plugin dynamically - * - * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way - * to get mime info from the plugin only on OSX and may not be supported - * in furture version -- use NP_GetMIMEDescription instead - */ -enum -{ - kBPSupportedMIMETypesStructVers_1 = 1 -}; -typedef struct _BPSupportedMIMETypes -{ - SInt32 structVersion; /* struct version */ - Handle typeStrings; /* STR# formated handle, allocated by plug-in */ - Handle infoStrings; /* STR# formated handle, allocated by plug-in */ -} BPSupportedMIMETypes; -OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags); -#define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription" -typedef const char* (*NP_GetMIMEDescriptionProcPtr)(void); -typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32); -#endif - -#endif /* npfunctions_h_ */ diff --git a/cef/include/internal/npapi/nphostapi.h b/cef/include/internal/npapi/nphostapi.h deleted file mode 100644 index d59dbe6f1..000000000 --- a/cef/include/internal/npapi/nphostapi.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef _NPHOSTAPI_H_ -#define _NPHOSTAPI_H_ - -// Include path modified for CEF Binary Distribution. -#include "port.h" -// Include path modified for CEF Binary Distribution. -#include "npapi.h" -// Include path modified for CEF Binary Distribution. -#include "npapi_extensions.h" -// Include path modified for CEF Binary Distribution. -#include "npfunctions.h" -// Include path modified for CEF Binary Distribution. -#include "npruntime.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// -// NPAPI library entry points -// -#if defined(OS_POSIX) && !defined(OS_MACOSX) -typedef NPError (API_CALL * NP_InitializeFunc)(NPNetscapeFuncs* pNFuncs, - NPPluginFuncs* pPFuncs); -#else -typedef NPError (API_CALL * NP_InitializeFunc)(NPNetscapeFuncs* pFuncs); -typedef NPError (API_CALL * NP_GetEntryPointsFunc)(NPPluginFuncs* pFuncs); -#endif -typedef NPError (API_CALL * NP_ShutdownFunc)(void); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _NPHOSTAPI_H_ diff --git a/cef/include/internal/npapi/npruntime.h b/cef/include/internal/npapi/npruntime.h deleted file mode 100644 index 9f7848c63..000000000 --- a/cef/include/internal/npapi/npruntime.h +++ /dev/null @@ -1,397 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Copyright (c) 2004, Apple Computer, Inc. and The Mozilla Foundation. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla - * Foundation ("Mozilla") nor the names of their contributors may be used - * to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR CONTRIBUTORS "AS - * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, MOZILLA OR - * THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#ifndef _NP_RUNTIME_H_ -#define _NP_RUNTIME_H_ - -// BEGIN GOOGLE MODIFICATIONS -#include "npapi.h" -// END GOOGLE MODIFICATIONS - -#ifdef __cplusplus -extern "C" { -#endif - -#include "nptypes.h" - -/* - This API is used to facilitate binding code written in C to script - objects. The API in this header does not assume the presence of a - user agent. That is, it can be used to bind C code to scripting - environments outside of the context of a user agent. - - However, the normal use of the this API is in the context of a - scripting environment running in a browser or other user agent. - In particular it is used to support the extended Netscape - script-ability API for plugins (NP-SAP). NP-SAP is an extension - of the Netscape plugin API. As such we have adopted the use of - the "NP" prefix for this API. - - The following NP{N|P}Variables were added to the Netscape plugin - API (in npapi.h): - - NPNVWindowNPObject - NPNVPluginElementNPObject - NPPVpluginScriptableNPObject - - These variables are exposed through NPN_GetValue() and - NPP_GetValue() (respectively) and are used to establish the - initial binding between the user agent and native code. The DOM - objects in the user agent can be examined and manipulated using - the NPN_ functions that operate on NPObjects described in this - header. - - To the extent possible the assumptions about the scripting - language used by the scripting environment have been minimized. -*/ - -#define NP_BEGIN_MACRO do { -#define NP_END_MACRO } while (0) - -/* - Objects (non-primitive data) passed between 'C' and script is - always wrapped in an NPObject. The 'interface' of an NPObject is - described by an NPClass. -*/ -typedef struct NPObject NPObject; -typedef struct NPClass NPClass; - -typedef char NPUTF8; -typedef struct _NPString { - const NPUTF8 *UTF8Characters; - uint32_t UTF8Length; -} NPString; - -typedef enum { - NPVariantType_Void, - NPVariantType_Null, - NPVariantType_Bool, - NPVariantType_Int32, - NPVariantType_Double, - NPVariantType_String, - NPVariantType_Object -} NPVariantType; - -typedef struct _NPVariant { - NPVariantType type; - union { - bool boolValue; - int32_t intValue; - double doubleValue; - NPString stringValue; - NPObject *objectValue; - } value; -} NPVariant; - -/* - NPN_ReleaseVariantValue is called on all 'out' parameters - references. Specifically it is to be called on variants that own - their value, as is the case with all non-const NPVariant* - arguments after a successful call to any methods (except this one) - in this API. - - After calling NPN_ReleaseVariantValue, the type of the variant - will be NPVariantType_Void. -*/ -void NPN_ReleaseVariantValue(NPVariant *variant); - -#define NPVARIANT_IS_VOID(_v) ((_v).type == NPVariantType_Void) -#define NPVARIANT_IS_NULL(_v) ((_v).type == NPVariantType_Null) -#define NPVARIANT_IS_BOOLEAN(_v) ((_v).type == NPVariantType_Bool) -#define NPVARIANT_IS_INT32(_v) ((_v).type == NPVariantType_Int32) -#define NPVARIANT_IS_DOUBLE(_v) ((_v).type == NPVariantType_Double) -#define NPVARIANT_IS_STRING(_v) ((_v).type == NPVariantType_String) -#define NPVARIANT_IS_OBJECT(_v) ((_v).type == NPVariantType_Object) - -#define NPVARIANT_TO_BOOLEAN(_v) ((_v).value.boolValue) -#define NPVARIANT_TO_INT32(_v) ((_v).value.intValue) -#define NPVARIANT_TO_DOUBLE(_v) ((_v).value.doubleValue) -#define NPVARIANT_TO_STRING(_v) ((_v).value.stringValue) -#define NPVARIANT_TO_OBJECT(_v) ((_v).value.objectValue) - -#define VOID_TO_NPVARIANT(_v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_Void; \ - (_v).value.objectValue = NULL; \ -NP_END_MACRO - -#define NULL_TO_NPVARIANT(_v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_Null; \ - (_v).value.objectValue = NULL; \ -NP_END_MACRO - -#define BOOLEAN_TO_NPVARIANT(_val, _v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_Bool; \ - (_v).value.boolValue = !!(_val); \ -NP_END_MACRO - -#define INT32_TO_NPVARIANT(_val, _v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_Int32; \ - (_v).value.intValue = _val; \ -NP_END_MACRO - -#define DOUBLE_TO_NPVARIANT(_val, _v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_Double; \ - (_v).value.doubleValue = _val; \ -NP_END_MACRO - -#define STRINGZ_TO_NPVARIANT(_val, _v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_String; \ - NPString str = { _val, (uint32_t)(strlen(_val)) }; \ - (_v).value.stringValue = str; \ -NP_END_MACRO - -#define STRINGN_TO_NPVARIANT(_val, _len, _v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_String; \ - NPString str = { _val, (uint32_t)(_len) }; \ - (_v).value.stringValue = str; \ -NP_END_MACRO - -#define OBJECT_TO_NPVARIANT(_val, _v) \ -NP_BEGIN_MACRO \ - (_v).type = NPVariantType_Object; \ - (_v).value.objectValue = _val; \ -NP_END_MACRO - - -/* - Type mappings (JavaScript types have been used for illustration - purposes): - - JavaScript to C (NPVariant with type:) - undefined NPVariantType_Void - null NPVariantType_Null - Boolean NPVariantType_Bool - Number NPVariantType_Double or NPVariantType_Int32 - String NPVariantType_String - Object NPVariantType_Object - - C (NPVariant with type:) to JavaScript - NPVariantType_Void undefined - NPVariantType_Null null - NPVariantType_Bool Boolean - NPVariantType_Int32 Number - NPVariantType_Double Number - NPVariantType_String String - NPVariantType_Object Object -*/ - -typedef void *NPIdentifier; - -/* - NPObjects have methods and properties. Methods and properties are - identified with NPIdentifiers. These identifiers may be reflected - in script. NPIdentifiers can be either strings or integers, IOW, - methods and properties can be identified by either strings or - integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be - compared using ==. In case of any errors, the requested - NPIdentifier(s) will be NULL. NPIdentifier lifetime is controlled - by the browser. Plugins do not need to worry about memory management - with regards to NPIdentifiers. -*/ -NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name); -void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, - NPIdentifier *identifiers); -NPIdentifier NPN_GetIntIdentifier(int32_t intid); -bool NPN_IdentifierIsString(NPIdentifier identifier); - -/* - The NPUTF8 returned from NPN_UTF8FromIdentifier SHOULD be freed. -*/ -NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier); - -/* - Get the integer represented by identifier. If identifier is not an - integer identifier, the behaviour is undefined. -*/ -int32_t NPN_IntFromIdentifier(NPIdentifier identifier); - -/* - NPObject behavior is implemented using the following set of - callback functions. - - The NPVariant *result argument of these functions (where - applicable) should be released using NPN_ReleaseVariantValue(). -*/ -typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass); -typedef void (*NPDeallocateFunctionPtr)(NPObject *npobj); -typedef void (*NPInvalidateFunctionPtr)(NPObject *npobj); -typedef bool (*NPHasMethodFunctionPtr)(NPObject *npobj, NPIdentifier name); -typedef bool (*NPInvokeFunctionPtr)(NPObject *npobj, NPIdentifier name, - const NPVariant *args, uint32_t argCount, - NPVariant *result); -typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj, - const NPVariant *args, - uint32_t argCount, - NPVariant *result); -typedef bool (*NPHasPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name); -typedef bool (*NPGetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name, - NPVariant *result); -typedef bool (*NPSetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name, - const NPVariant *value); -typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj, - NPIdentifier name); -typedef bool (*NPEnumerationFunctionPtr)(NPObject *npobj, NPIdentifier **value, - uint32_t *count); -typedef bool (*NPConstructFunctionPtr)(NPObject *npobj, - const NPVariant *args, - uint32_t argCount, - NPVariant *result); - -/* - NPObjects returned by create, retain, invoke, and getProperty pass - a reference count to the caller. That is, the callee adds a - reference count which passes to the caller. It is the caller's - responsibility to release the returned object. - - NPInvokeFunctionPtr function may return 0 to indicate a void - result. - - NPInvalidateFunctionPtr is called by the scripting environment - when the native code is shutdown. Any attempt to message a - NPObject instance after the invalidate callback has been - called will result in undefined behavior, even if the native code - is still retaining those NPObject instances. (The runtime - will typically return immediately, with 0 or NULL, from an attempt - to dispatch to a NPObject, but this behavior should not be - depended upon.) - - The NPEnumerationFunctionPtr function may pass an array of - NPIdentifiers back to the caller. The callee allocs the memory of - the array using NPN_MemAlloc(), and it's the caller's responsibility - to release it using NPN_MemFree(). -*/ -struct NPClass -{ - uint32_t structVersion; - NPAllocateFunctionPtr allocate; - NPDeallocateFunctionPtr deallocate; - NPInvalidateFunctionPtr invalidate; - NPHasMethodFunctionPtr hasMethod; - NPInvokeFunctionPtr invoke; - NPInvokeDefaultFunctionPtr invokeDefault; - NPHasPropertyFunctionPtr hasProperty; - NPGetPropertyFunctionPtr getProperty; - NPSetPropertyFunctionPtr setProperty; - NPRemovePropertyFunctionPtr removeProperty; - NPEnumerationFunctionPtr enumerate; - NPConstructFunctionPtr construct; -}; - -#define NP_CLASS_STRUCT_VERSION 3 - -#define NP_CLASS_STRUCT_VERSION_ENUM 2 -#define NP_CLASS_STRUCT_VERSION_CTOR 3 - -#define NP_CLASS_STRUCT_VERSION_HAS_ENUM(npclass) \ - ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_ENUM) - -#define NP_CLASS_STRUCT_VERSION_HAS_CTOR(npclass) \ - ((npclass)->structVersion >= NP_CLASS_STRUCT_VERSION_CTOR) - -struct NPObject { - NPClass *_class; - uint32_t referenceCount; - /* - * Additional space may be allocated here by types of NPObjects - */ -}; - -/* - If the class has an allocate function, NPN_CreateObject invokes - that function, otherwise a NPObject is allocated and - returned. This method will initialize the referenceCount member of - the NPObject to 1. -*/ -NPObject *NPN_CreateObject(NPP npp, NPClass *aClass); - -/* - Increment the NPObject's reference count. -*/ -NPObject *NPN_RetainObject(NPObject *npobj); - -/* - Decremented the NPObject's reference count. If the reference - count goes to zero, the class's destroy function is invoke if - specified, otherwise the object is freed directly. -*/ -void NPN_ReleaseObject(NPObject *npobj); - -/* - Functions to access script objects represented by NPObject. - - Calls to script objects are synchronous. If a function returns a - value, it will be supplied via the result NPVariant - argument. Successful calls will return true, false will be - returned in case of an error. - - Calls made from plugin code to script must be made from the thread - on which the plugin was initialized. -*/ - -bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName, - const NPVariant *args, uint32_t argCount, NPVariant *result); -bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args, - uint32_t argCount, NPVariant *result); -bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script, - NPVariant *result); -bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, - NPVariant *result); -bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName, - const NPVariant *value); -bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName); -bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName); -bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName); -bool NPN_Enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier, - uint32_t *count); -bool NPN_Construct(NPP npp, NPObject *npobj, const NPVariant *args, - uint32_t argCount, NPVariant *result); - -/* - NPN_SetException may be called to trigger a script exception upon - return from entry points into NPObjects. Typical usage: - - NPN_SetException (npobj, message); -*/ -void NPN_SetException(NPObject *npobj, const NPUTF8 *message); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/cef/include/internal/npapi/nptypes.h b/cef/include/internal/npapi/nptypes.h deleted file mode 100644 index abcc96be0..000000000 --- a/cef/include/internal/npapi/nptypes.h +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * mozilla.org. - * Portions created by the Initial Developer are Copyright (C) 2004 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Johnny Stenback (Original author) - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nptypes_h_ -#define nptypes_h_ - -/* - * Header file for ensuring that C99 types ([u]int32_t, [u]int64_t and bool) and - * true/false macros are available. - */ - -#if defined(WIN32) || defined(OS2) - /* - * Win32 and OS/2 don't know C99, so define [u]int_16/32/64 here. The bool - * is predefined tho, both in C and C++. - */ - typedef short int16_t; - typedef unsigned short uint16_t; - typedef int int32_t; - typedef unsigned int uint32_t; - typedef long long int64_t; - typedef unsigned long long uint64_t; -#elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX) - /* - * AIX and SunOS ship a inttypes.h header that defines [u]int32_t, - * but not bool for C. - */ - #include - - #ifndef __cplusplus - typedef int bool; - #define true 1 - #define false 0 - #endif -#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) - /* - * BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and - * u_int32_t. - */ - #include - - /* - * BSD/OS ships no header that defines uint32_t, nor bool (for C) - */ - #if defined(bsdi) - typedef u_int32_t uint32_t; - typedef u_int64_t uint64_t; - - #if !defined(__cplusplus) - typedef int bool; - #define true 1 - #define false 0 - #endif - #else - /* - * FreeBSD and OpenBSD define uint32_t and bool. - */ - #include - #include - #endif -#elif defined(BEOS) - #include -#else - /* - * For those that ship a standard C99 stdint.h header file, include - * it. Can't do the same for stdbool.h tho, since some systems ship - * with a stdbool.h file that doesn't compile! - */ - #include - - #ifndef __cplusplus - #if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95) - #include - #else - /* - * GCC 2.91 can't deal with a typedef for bool, but a #define - * works. - */ - #define bool int - #define true 1 - #define false 0 - #endif - #endif -#endif - -#endif /* nptypes_h_ */ diff --git a/cef/include/internal/npapi/port.h b/cef/include/internal/npapi/port.h deleted file mode 100644 index e1f827563..000000000 --- a/cef/include/internal/npapi/port.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef BASE_PORT_H_ -#define BASE_PORT_H_ -#pragma once - -#include -// Include path modified for CEF Binary Distribution. -#include "build_config.h" - -#ifdef COMPILER_MSVC -#define GG_LONGLONG(x) x##I64 -#define GG_ULONGLONG(x) x##UI64 -#else -#define GG_LONGLONG(x) x##LL -#define GG_ULONGLONG(x) x##ULL -#endif - -// Per C99 7.8.14, define __STDC_CONSTANT_MACROS before including -// to get the INTn_C and UINTn_C macros for integer constants. It's difficult -// to guarantee any specific ordering of header includes, so it's difficult to -// guarantee that the INTn_C macros can be defined by including at -// any specific point. Provide GG_INTn_C macros instead. - -#define GG_INT8_C(x) (x) -#define GG_INT16_C(x) (x) -#define GG_INT32_C(x) (x) -#define GG_INT64_C(x) GG_LONGLONG(x) - -#define GG_UINT8_C(x) (x ## U) -#define GG_UINT16_C(x) (x ## U) -#define GG_UINT32_C(x) (x ## U) -#define GG_UINT64_C(x) GG_ULONGLONG(x) - -// It's possible for functions that use a va_list, such as StringPrintf, to -// invalidate the data in it upon use. The fix is to make a copy of the -// structure before using it and use that copy instead. va_copy is provided -// for this purpose. MSVC does not provide va_copy, so define an -// implementation here. It is not guaranteed that assignment is a copy, so the -// StringUtil.VariableArgsFunc unit test tests this capability. -#if defined(COMPILER_GCC) -#define GG_VA_COPY(a, b) (va_copy(a, b)) -#elif defined(COMPILER_MSVC) -#define GG_VA_COPY(a, b) (a = b) -#endif - -// Define an OS-neutral wrapper for shared library entry points -#if defined(OS_WIN) -#define API_CALL __stdcall -#else -#define API_CALL -#endif - -#endif // BASE_PORT_H_ diff --git a/cef/libcef.dylib b/cef/libcef.dylib new file mode 100755 index 000000000..c63ed444c Binary files /dev/null and b/cef/libcef.dylib differ diff --git a/cef/libcef.dylib.dSYM/Contents/Info.plist b/cef/libcef.dylib.dSYM/Contents/Info.plist new file mode 100644 index 000000000..512ed0b2c --- /dev/null +++ b/cef/libcef.dylib.dSYM/Contents/Info.plist @@ -0,0 +1,27 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.libcef.dylib + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + dSYM_UUID + + i386 + B1738709-A4C5-3D9B-BE79-A8FF138FC819 + + fake_dsym + + + diff --git a/cef/libcef.dylib.dSYM/Contents/Resources/DWARF/libcef.dylib b/cef/libcef.dylib.dSYM/Contents/Resources/DWARF/libcef.dylib new file mode 100644 index 000000000..00aa792a2 Binary files /dev/null and b/cef/libcef.dylib.dSYM/Contents/Resources/DWARF/libcef.dylib differ diff --git a/cef/libcef_dll/cpptoc/app_cpptoc.cc b/cef/libcef_dll/cpptoc/app_cpptoc.cc deleted file mode 100644 index 4b1045a42..000000000 --- a/cef/libcef_dll/cpptoc/app_cpptoc.cc +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/app_cpptoc.h" -#include "libcef_dll/cpptoc/proxy_handler_cpptoc.h" -#include "libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -struct _cef_resource_bundle_handler_t* CEF_CALLBACK app_get_resource_bundle_handler( - struct _cef_app_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefAppCppToC::Get( - self)->GetResourceBundleHandler(); - - // Return type: refptr_same - return CefResourceBundleHandlerCppToC::Wrap(_retval); -} - -struct _cef_proxy_handler_t* CEF_CALLBACK app_get_proxy_handler( - struct _cef_app_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefAppCppToC::Get(self)->GetProxyHandler( - ); - - // Return type: refptr_same - return CefProxyHandlerCppToC::Wrap(_retval); -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefAppCppToC::CefAppCppToC(CefApp* cls) - : CefCppToC(cls) { - struct_.struct_.get_resource_bundle_handler = app_get_resource_bundle_handler; - struct_.struct_.get_proxy_handler = app_get_proxy_handler; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/client_cpptoc.cc b/cef/libcef_dll/cpptoc/client_cpptoc.cc deleted file mode 100644 index 6ce7df474..000000000 --- a/cef/libcef_dll/cpptoc/client_cpptoc.cc +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/client_cpptoc.h" -#include "libcef_dll/cpptoc/display_handler_cpptoc.h" -#include "libcef_dll/cpptoc/drag_handler_cpptoc.h" -#include "libcef_dll/cpptoc/find_handler_cpptoc.h" -#include "libcef_dll/cpptoc/focus_handler_cpptoc.h" -#include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h" -#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h" -#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h" -#include "libcef_dll/cpptoc/load_handler_cpptoc.h" -#include "libcef_dll/cpptoc/menu_handler_cpptoc.h" -#include "libcef_dll/cpptoc/permission_handler_cpptoc.h" -#include "libcef_dll/cpptoc/print_handler_cpptoc.h" -#include "libcef_dll/cpptoc/render_handler_cpptoc.h" -#include "libcef_dll/cpptoc/request_handler_cpptoc.h" -#include "libcef_dll/cpptoc/v8context_handler_cpptoc.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -struct _cef_life_span_handler_t* CEF_CALLBACK client_get_life_span_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetLifeSpanHandler(); - - // Return type: refptr_same - return CefLifeSpanHandlerCppToC::Wrap(_retval); -} - -struct _cef_load_handler_t* CEF_CALLBACK client_get_load_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetLoadHandler(); - - // Return type: refptr_same - return CefLoadHandlerCppToC::Wrap(_retval); -} - -struct _cef_request_handler_t* CEF_CALLBACK client_get_request_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetRequestHandler(); - - // Return type: refptr_same - return CefRequestHandlerCppToC::Wrap(_retval); -} - -struct _cef_display_handler_t* CEF_CALLBACK client_get_display_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetDisplayHandler(); - - // Return type: refptr_same - return CefDisplayHandlerCppToC::Wrap(_retval); -} - -struct _cef_focus_handler_t* CEF_CALLBACK client_get_focus_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetFocusHandler(); - - // Return type: refptr_same - return CefFocusHandlerCppToC::Wrap(_retval); -} - -struct _cef_keyboard_handler_t* CEF_CALLBACK client_get_keyboard_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetKeyboardHandler(); - - // Return type: refptr_same - return CefKeyboardHandlerCppToC::Wrap(_retval); -} - -struct _cef_menu_handler_t* CEF_CALLBACK client_get_menu_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetMenuHandler(); - - // Return type: refptr_same - return CefMenuHandlerCppToC::Wrap(_retval); -} - -struct _cef_permission_handler_t* CEF_CALLBACK client_get_permission_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetPermissionHandler(); - - // Return type: refptr_same - return CefPermissionHandlerCppToC::Wrap(_retval); -} - -struct _cef_print_handler_t* CEF_CALLBACK client_get_print_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetPrintHandler(); - - // Return type: refptr_same - return CefPrintHandlerCppToC::Wrap(_retval); -} - -struct _cef_find_handler_t* CEF_CALLBACK client_get_find_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetFindHandler(); - - // Return type: refptr_same - return CefFindHandlerCppToC::Wrap(_retval); -} - -struct _cef_jsdialog_handler_t* CEF_CALLBACK client_get_jsdialog_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetJSDialogHandler(); - - // Return type: refptr_same - return CefJSDialogHandlerCppToC::Wrap(_retval); -} - -struct _cef_v8context_handler_t* CEF_CALLBACK client_get_v8context_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetV8ContextHandler(); - - // Return type: refptr_same - return CefV8ContextHandlerCppToC::Wrap(_retval); -} - -struct _cef_render_handler_t* CEF_CALLBACK client_get_render_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetRenderHandler(); - - // Return type: refptr_same - return CefRenderHandlerCppToC::Wrap(_retval); -} - -struct _cef_drag_handler_t* CEF_CALLBACK client_get_drag_handler( - struct _cef_client_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefClientCppToC::Get( - self)->GetDragHandler(); - - // Return type: refptr_same - return CefDragHandlerCppToC::Wrap(_retval); -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefClientCppToC::CefClientCppToC(CefClient* cls) - : CefCppToC(cls) { - struct_.struct_.get_life_span_handler = client_get_life_span_handler; - struct_.struct_.get_load_handler = client_get_load_handler; - struct_.struct_.get_request_handler = client_get_request_handler; - struct_.struct_.get_display_handler = client_get_display_handler; - struct_.struct_.get_focus_handler = client_get_focus_handler; - struct_.struct_.get_keyboard_handler = client_get_keyboard_handler; - struct_.struct_.get_menu_handler = client_get_menu_handler; - struct_.struct_.get_permission_handler = client_get_permission_handler; - struct_.struct_.get_print_handler = client_get_print_handler; - struct_.struct_.get_find_handler = client_get_find_handler; - struct_.struct_.get_jsdialog_handler = client_get_jsdialog_handler; - struct_.struct_.get_v8context_handler = client_get_v8context_handler; - struct_.struct_.get_render_handler = client_get_render_handler; - struct_.struct_.get_drag_handler = client_get_drag_handler; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/content_filter_cpptoc.cc b/cef/libcef_dll/cpptoc/content_filter_cpptoc.cc deleted file mode 100644 index 1284f3ad3..000000000 --- a/cef/libcef_dll/cpptoc/content_filter_cpptoc.cc +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/content_filter_cpptoc.h" -#include "libcef_dll/ctocpp/stream_reader_ctocpp.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -void CEF_CALLBACK content_filter_process_data( - struct _cef_content_filter_t* self, const void* data, int data_size, - struct _cef_stream_reader_t** substitute_data) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: data; type: simple_byaddr - DCHECK(data); - if (!data) - return; - // Verify param: substitute_data; type: refptr_diff_byref - DCHECK(substitute_data); - if (!substitute_data) - return; - - // Translate param: substitute_data; type: refptr_diff_byref - CefRefPtr substitute_dataPtr; - if (substitute_data && *substitute_data) - substitute_dataPtr = CefStreamReaderCToCpp::Wrap(*substitute_data); - CefStreamReader* substitute_dataOrig = substitute_dataPtr.get(); - - // Execute - CefContentFilterCppToC::Get(self)->ProcessData( - data, - data_size, - substitute_dataPtr); - - // Restore param: substitute_data; type: refptr_diff_byref - if (substitute_data) { - if (substitute_dataPtr.get()) { - if (substitute_dataPtr.get() != substitute_dataOrig) { - *substitute_data = CefStreamReaderCToCpp::Unwrap(substitute_dataPtr); - } - } else { - *substitute_data = NULL; - } - } -} - -void CEF_CALLBACK content_filter_drain(struct _cef_content_filter_t* self, - struct _cef_stream_reader_t** remainder) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: remainder; type: refptr_diff_byref - DCHECK(remainder); - if (!remainder) - return; - - // Translate param: remainder; type: refptr_diff_byref - CefRefPtr remainderPtr; - if (remainder && *remainder) - remainderPtr = CefStreamReaderCToCpp::Wrap(*remainder); - CefStreamReader* remainderOrig = remainderPtr.get(); - - // Execute - CefContentFilterCppToC::Get(self)->Drain( - remainderPtr); - - // Restore param: remainder; type: refptr_diff_byref - if (remainder) { - if (remainderPtr.get()) { - if (remainderPtr.get() != remainderOrig) { - *remainder = CefStreamReaderCToCpp::Unwrap(remainderPtr); - } - } else { - *remainder = NULL; - } - } -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefContentFilterCppToC::CefContentFilterCppToC(CefContentFilter* cls) - : CefCppToC( - cls) { - struct_.struct_.process_data = content_filter_process_data; - struct_.struct_.drain = content_filter_drain; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/content_filter_cpptoc.h b/cef/libcef_dll/cpptoc/content_filter_cpptoc.h deleted file mode 100644 index a1af009ca..000000000 --- a/cef/libcef_dll/cpptoc/content_filter_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_CONTENT_FILTER_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_CONTENT_FILTER_CPPTOC_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include "include/cef_content_filter.h" -#include "include/capi/cef_content_filter_capi.h" -#include "libcef_dll/cpptoc/cpptoc.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefContentFilterCppToC - : public CefCppToC { - public: - explicit CefContentFilterCppToC(CefContentFilter* cls); - virtual ~CefContentFilterCppToC() {} -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CPPTOC_CONTENT_FILTER_CPPTOC_H_ - diff --git a/cef/libcef_dll/cpptoc/download_handler_cpptoc.cc b/cef/libcef_dll/cpptoc/download_handler_cpptoc.cc deleted file mode 100644 index a868039ec..000000000 --- a/cef/libcef_dll/cpptoc/download_handler_cpptoc.cc +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/download_handler_cpptoc.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -int CEF_CALLBACK download_handler_received_data( - struct _cef_download_handler_t* self, void* data, int data_size) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: data; type: simple_byaddr - DCHECK(data); - if (!data) - return 0; - - // Execute - bool _retval = CefDownloadHandlerCppToC::Get(self)->ReceivedData( - data, - data_size); - - // Return type: bool - return _retval; -} - -void CEF_CALLBACK download_handler_complete( - struct _cef_download_handler_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - - // Execute - CefDownloadHandlerCppToC::Get(self)->Complete(); -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefDownloadHandlerCppToC::CefDownloadHandlerCppToC(CefDownloadHandler* cls) - : CefCppToC(cls) { - struct_.struct_.received_data = download_handler_received_data; - struct_.struct_.complete = download_handler_complete; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/drag_handler_cpptoc.cc b/cef/libcef_dll/cpptoc/drag_handler_cpptoc.cc deleted file mode 100644 index 927caeeb5..000000000 --- a/cef/libcef_dll/cpptoc/drag_handler_cpptoc.cc +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/drag_handler_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" -#include "libcef_dll/ctocpp/drag_data_ctocpp.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -int CEF_CALLBACK drag_handler_on_drag_start(struct _cef_drag_handler_t* self, - cef_browser_t* browser, cef_drag_data_t* dragData, - enum cef_drag_operations_mask_t mask) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: dragData; type: refptr_diff - DCHECK(dragData); - if (!dragData) - return 0; - - // Execute - bool _retval = CefDragHandlerCppToC::Get(self)->OnDragStart( - CefBrowserCToCpp::Wrap(browser), - CefDragDataCToCpp::Wrap(dragData), - mask); - - // Return type: bool - return _retval; -} - -int CEF_CALLBACK drag_handler_on_drag_enter(struct _cef_drag_handler_t* self, - cef_browser_t* browser, cef_drag_data_t* dragData, - enum cef_drag_operations_mask_t mask) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: dragData; type: refptr_diff - DCHECK(dragData); - if (!dragData) - return 0; - - // Execute - bool _retval = CefDragHandlerCppToC::Get(self)->OnDragEnter( - CefBrowserCToCpp::Wrap(browser), - CefDragDataCToCpp::Wrap(dragData), - mask); - - // Return type: bool - return _retval; -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefDragHandlerCppToC::CefDragHandlerCppToC(CefDragHandler* cls) - : CefCppToC(cls) { - struct_.struct_.on_drag_start = drag_handler_on_drag_start; - struct_.struct_.on_drag_enter = drag_handler_on_drag_enter; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/drag_handler_cpptoc.h b/cef/libcef_dll/cpptoc/drag_handler_cpptoc.h deleted file mode 100644 index 94138f843..000000000 --- a/cef/libcef_dll/cpptoc/drag_handler_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_DRAG_HANDLER_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_DRAG_HANDLER_CPPTOC_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include "include/cef_drag_handler.h" -#include "include/capi/cef_drag_handler_capi.h" -#include "libcef_dll/cpptoc/cpptoc.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefDragHandlerCppToC - : public CefCppToC { - public: - explicit CefDragHandlerCppToC(CefDragHandler* cls); - virtual ~CefDragHandlerCppToC() {} -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CPPTOC_DRAG_HANDLER_CPPTOC_H_ - diff --git a/cef/libcef_dll/cpptoc/find_handler_cpptoc.cc b/cef/libcef_dll/cpptoc/find_handler_cpptoc.cc deleted file mode 100644 index e96273377..000000000 --- a/cef/libcef_dll/cpptoc/find_handler_cpptoc.cc +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/find_handler_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -void CEF_CALLBACK find_handler_on_find_result(struct _cef_find_handler_t* self, - cef_browser_t* browser, int identifier, int count, - const cef_rect_t* selectionRect, int activeMatchOrdinal, - int finalUpdate) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - // Verify param: selectionRect; type: simple_byref_const - DCHECK(selectionRect); - if (!selectionRect) - return; - - // Translate param: selectionRect; type: simple_byref_const - CefRect selectionRectVal = selectionRect?*selectionRect:CefRect(); - - // Execute - CefFindHandlerCppToC::Get(self)->OnFindResult( - CefBrowserCToCpp::Wrap(browser), - identifier, - count, - selectionRectVal, - activeMatchOrdinal, - finalUpdate?true:false); -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefFindHandlerCppToC::CefFindHandlerCppToC(CefFindHandler* cls) - : CefCppToC(cls) { - struct_.struct_.on_find_result = find_handler_on_find_result; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/find_handler_cpptoc.h b/cef/libcef_dll/cpptoc/find_handler_cpptoc.h deleted file mode 100644 index 9bb2c68b0..000000000 --- a/cef/libcef_dll/cpptoc/find_handler_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_FIND_HANDLER_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_FIND_HANDLER_CPPTOC_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include "include/cef_find_handler.h" -#include "include/capi/cef_find_handler_capi.h" -#include "libcef_dll/cpptoc/cpptoc.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefFindHandlerCppToC - : public CefCppToC { - public: - explicit CefFindHandlerCppToC(CefFindHandler* cls); - virtual ~CefFindHandlerCppToC() {} -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CPPTOC_FIND_HANDLER_CPPTOC_H_ - diff --git a/cef/libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc b/cef/libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc deleted file mode 100644 index 0de68df23..000000000 --- a/cef/libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" -#include "libcef_dll/ctocpp/frame_ctocpp.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -int CEF_CALLBACK jsdialog_handler_on_jsalert( - struct _cef_jsdialog_handler_t* self, cef_browser_t* browser, - cef_frame_t* frame, const cef_string_t* message) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: frame; type: refptr_diff - DCHECK(frame); - if (!frame) - return 0; - // Unverified params: message - - // Execute - bool _retval = CefJSDialogHandlerCppToC::Get(self)->OnJSAlert( - CefBrowserCToCpp::Wrap(browser), - CefFrameCToCpp::Wrap(frame), - CefString(message)); - - // Return type: bool - return _retval; -} - -int CEF_CALLBACK jsdialog_handler_on_jsconfirm( - struct _cef_jsdialog_handler_t* self, cef_browser_t* browser, - cef_frame_t* frame, const cef_string_t* message, int* retval) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: frame; type: refptr_diff - DCHECK(frame); - if (!frame) - return 0; - // Verify param: retval; type: bool_byref - DCHECK(retval); - if (!retval) - return 0; - // Unverified params: message - - // Translate param: retval; type: bool_byref - bool retvalBool = (retval && *retval)?true:false; - - // Execute - bool _retval = CefJSDialogHandlerCppToC::Get(self)->OnJSConfirm( - CefBrowserCToCpp::Wrap(browser), - CefFrameCToCpp::Wrap(frame), - CefString(message), - retvalBool); - - // Restore param: retval; type: bool_byref - if (retval) - *retval = retvalBool?true:false; - - // Return type: bool - return _retval; -} - -int CEF_CALLBACK jsdialog_handler_on_jsprompt( - struct _cef_jsdialog_handler_t* self, cef_browser_t* browser, - cef_frame_t* frame, const cef_string_t* message, - const cef_string_t* defaultValue, int* retval, cef_string_t* result) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: frame; type: refptr_diff - DCHECK(frame); - if (!frame) - return 0; - // Verify param: retval; type: bool_byref - DCHECK(retval); - if (!retval) - return 0; - // Verify param: result; type: string_byref - DCHECK(result); - if (!result) - return 0; - // Unverified params: message, defaultValue - - // Translate param: retval; type: bool_byref - bool retvalBool = (retval && *retval)?true:false; - // Translate param: result; type: string_byref - CefString resultStr(result); - - // Execute - bool _retval = CefJSDialogHandlerCppToC::Get(self)->OnJSPrompt( - CefBrowserCToCpp::Wrap(browser), - CefFrameCToCpp::Wrap(frame), - CefString(message), - CefString(defaultValue), - retvalBool, - resultStr); - - // Restore param: retval; type: bool_byref - if (retval) - *retval = retvalBool?true:false; - - // Return type: bool - return _retval; -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefJSDialogHandlerCppToC::CefJSDialogHandlerCppToC(CefJSDialogHandler* cls) - : CefCppToC(cls) { - struct_.struct_.on_jsalert = jsdialog_handler_on_jsalert; - struct_.struct_.on_jsconfirm = jsdialog_handler_on_jsconfirm; - struct_.struct_.on_jsprompt = jsdialog_handler_on_jsprompt; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/keyboard_handler_cpptoc.cc b/cef/libcef_dll/cpptoc/keyboard_handler_cpptoc.cc deleted file mode 100644 index dbced2bed..000000000 --- a/cef/libcef_dll/cpptoc/keyboard_handler_cpptoc.cc +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -int CEF_CALLBACK keyboard_handler_on_key_event( - struct _cef_keyboard_handler_t* self, cef_browser_t* browser, - enum cef_handler_keyevent_type_t type, int code, int modifiers, - int isSystemKey, int isAfterJavaScript) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - - // Execute - bool _retval = CefKeyboardHandlerCppToC::Get(self)->OnKeyEvent( - CefBrowserCToCpp::Wrap(browser), - type, - code, - modifiers, - isSystemKey?true:false, - isAfterJavaScript?true:false); - - // Return type: bool - return _retval; -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefKeyboardHandlerCppToC::CefKeyboardHandlerCppToC(CefKeyboardHandler* cls) - : CefCppToC(cls) { - struct_.struct_.on_key_event = keyboard_handler_on_key_event; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/load_handler_cpptoc.cc b/cef/libcef_dll/cpptoc/load_handler_cpptoc.cc deleted file mode 100644 index 14c31cfa3..000000000 --- a/cef/libcef_dll/cpptoc/load_handler_cpptoc.cc +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/load_handler_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" -#include "libcef_dll/ctocpp/frame_ctocpp.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -void CEF_CALLBACK load_handler_on_load_start(struct _cef_load_handler_t* self, - cef_browser_t* browser, cef_frame_t* frame) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - // Verify param: frame; type: refptr_diff - DCHECK(frame); - if (!frame) - return; - - // Execute - CefLoadHandlerCppToC::Get(self)->OnLoadStart( - CefBrowserCToCpp::Wrap(browser), - CefFrameCToCpp::Wrap(frame)); -} - -void CEF_CALLBACK load_handler_on_load_end(struct _cef_load_handler_t* self, - cef_browser_t* browser, cef_frame_t* frame, int httpStatusCode) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - // Verify param: frame; type: refptr_diff - DCHECK(frame); - if (!frame) - return; - - // Execute - CefLoadHandlerCppToC::Get(self)->OnLoadEnd( - CefBrowserCToCpp::Wrap(browser), - CefFrameCToCpp::Wrap(frame), - httpStatusCode); -} - -int CEF_CALLBACK load_handler_on_load_error(struct _cef_load_handler_t* self, - cef_browser_t* browser, cef_frame_t* frame, - enum cef_handler_errorcode_t errorCode, const cef_string_t* failedUrl, - cef_string_t* errorText) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: frame; type: refptr_diff - DCHECK(frame); - if (!frame) - return 0; - // Verify param: failedUrl; type: string_byref_const - DCHECK(failedUrl); - if (!failedUrl) - return 0; - // Verify param: errorText; type: string_byref - DCHECK(errorText); - if (!errorText) - return 0; - - // Translate param: errorText; type: string_byref - CefString errorTextStr(errorText); - - // Execute - bool _retval = CefLoadHandlerCppToC::Get(self)->OnLoadError( - CefBrowserCToCpp::Wrap(browser), - CefFrameCToCpp::Wrap(frame), - errorCode, - CefString(failedUrl), - errorTextStr); - - // Return type: bool - return _retval; -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefLoadHandlerCppToC::CefLoadHandlerCppToC(CefLoadHandler* cls) - : CefCppToC(cls) { - struct_.struct_.on_load_start = load_handler_on_load_start; - struct_.struct_.on_load_end = load_handler_on_load_end; - struct_.struct_.on_load_error = load_handler_on_load_error; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/menu_handler_cpptoc.cc b/cef/libcef_dll/cpptoc/menu_handler_cpptoc.cc deleted file mode 100644 index d1c000f90..000000000 --- a/cef/libcef_dll/cpptoc/menu_handler_cpptoc.cc +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/menu_handler_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -int CEF_CALLBACK menu_handler_on_before_menu(struct _cef_menu_handler_t* self, - cef_browser_t* browser, const struct _cef_menu_info_t* menuInfo) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: menuInfo; type: struct_byref_const - DCHECK(menuInfo); - if (!menuInfo) - return 0; - - // Translate param: menuInfo; type: struct_byref_const - CefMenuInfo menuInfoObj; - if (menuInfo) - menuInfoObj.Set(*menuInfo, false); - - // Execute - bool _retval = CefMenuHandlerCppToC::Get(self)->OnBeforeMenu( - CefBrowserCToCpp::Wrap(browser), - menuInfoObj); - - // Return type: bool - return _retval; -} - -void CEF_CALLBACK menu_handler_get_menu_label(struct _cef_menu_handler_t* self, - cef_browser_t* browser, enum cef_menu_id_t menuId, cef_string_t* label) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - // Verify param: label; type: string_byref - DCHECK(label); - if (!label) - return; - - // Translate param: label; type: string_byref - CefString labelStr(label); - - // Execute - CefMenuHandlerCppToC::Get(self)->GetMenuLabel( - CefBrowserCToCpp::Wrap(browser), - menuId, - labelStr); -} - -int CEF_CALLBACK menu_handler_on_menu_action(struct _cef_menu_handler_t* self, - cef_browser_t* browser, enum cef_menu_id_t menuId) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - - // Execute - bool _retval = CefMenuHandlerCppToC::Get(self)->OnMenuAction( - CefBrowserCToCpp::Wrap(browser), - menuId); - - // Return type: bool - return _retval; -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefMenuHandlerCppToC::CefMenuHandlerCppToC(CefMenuHandler* cls) - : CefCppToC(cls) { - struct_.struct_.on_before_menu = menu_handler_on_before_menu; - struct_.struct_.get_menu_label = menu_handler_get_menu_label; - struct_.struct_.on_menu_action = menu_handler_on_menu_action; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/menu_handler_cpptoc.h b/cef/libcef_dll/cpptoc/menu_handler_cpptoc.h deleted file mode 100644 index 20086f438..000000000 --- a/cef/libcef_dll/cpptoc/menu_handler_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_MENU_HANDLER_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_MENU_HANDLER_CPPTOC_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include "include/cef_menu_handler.h" -#include "include/capi/cef_menu_handler_capi.h" -#include "libcef_dll/cpptoc/cpptoc.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefMenuHandlerCppToC - : public CefCppToC { - public: - explicit CefMenuHandlerCppToC(CefMenuHandler* cls); - virtual ~CefMenuHandlerCppToC() {} -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CPPTOC_MENU_HANDLER_CPPTOC_H_ - diff --git a/cef/libcef_dll/cpptoc/print_handler_cpptoc.cc b/cef/libcef_dll/cpptoc/print_handler_cpptoc.cc deleted file mode 100644 index d72e151ff..000000000 --- a/cef/libcef_dll/cpptoc/print_handler_cpptoc.cc +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/print_handler_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" -#include "libcef_dll/ctocpp/frame_ctocpp.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -int CEF_CALLBACK print_handler_get_print_options( - struct _cef_print_handler_t* self, cef_browser_t* browser, - struct _cef_print_options_t* printOptions) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: printOptions; type: struct_byref - DCHECK(printOptions); - if (!printOptions) - return 0; - - // Translate param: printOptions; type: struct_byref - CefPrintOptions printOptionsObj; - if (printOptions) - printOptionsObj.AttachTo(*printOptions); - - // Execute - bool _retval = CefPrintHandlerCppToC::Get(self)->GetPrintOptions( - CefBrowserCToCpp::Wrap(browser), - printOptionsObj); - - // Restore param: printOptions; type: struct_byref - if (printOptions) - printOptionsObj.DetachTo(*printOptions); - - // Return type: bool - return _retval; -} - -int CEF_CALLBACK print_handler_get_print_header_footer( - struct _cef_print_handler_t* self, cef_browser_t* browser, - cef_frame_t* frame, const cef_print_info_t* printInfo, - const cef_string_t* url, const cef_string_t* title, int currentPage, - int maxPages, cef_string_t* topLeft, cef_string_t* topCenter, - cef_string_t* topRight, cef_string_t* bottomLeft, - cef_string_t* bottomCenter, cef_string_t* bottomRight) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: frame; type: refptr_diff - DCHECK(frame); - if (!frame) - return 0; - // Verify param: printInfo; type: struct_byref_const - DCHECK(printInfo); - if (!printInfo) - return 0; - // Verify param: url; type: string_byref_const - DCHECK(url); - if (!url) - return 0; - // Verify param: title; type: string_byref_const - DCHECK(title); - if (!title) - return 0; - // Verify param: topLeft; type: string_byref - DCHECK(topLeft); - if (!topLeft) - return 0; - // Verify param: topCenter; type: string_byref - DCHECK(topCenter); - if (!topCenter) - return 0; - // Verify param: topRight; type: string_byref - DCHECK(topRight); - if (!topRight) - return 0; - // Verify param: bottomLeft; type: string_byref - DCHECK(bottomLeft); - if (!bottomLeft) - return 0; - // Verify param: bottomCenter; type: string_byref - DCHECK(bottomCenter); - if (!bottomCenter) - return 0; - // Verify param: bottomRight; type: string_byref - DCHECK(bottomRight); - if (!bottomRight) - return 0; - - // Translate param: printInfo; type: struct_byref_const - CefPrintInfo printInfoObj; - if (printInfo) - printInfoObj.Set(*printInfo, false); - // Translate param: topLeft; type: string_byref - CefString topLeftStr(topLeft); - // Translate param: topCenter; type: string_byref - CefString topCenterStr(topCenter); - // Translate param: topRight; type: string_byref - CefString topRightStr(topRight); - // Translate param: bottomLeft; type: string_byref - CefString bottomLeftStr(bottomLeft); - // Translate param: bottomCenter; type: string_byref - CefString bottomCenterStr(bottomCenter); - // Translate param: bottomRight; type: string_byref - CefString bottomRightStr(bottomRight); - - // Execute - bool _retval = CefPrintHandlerCppToC::Get(self)->GetPrintHeaderFooter( - CefBrowserCToCpp::Wrap(browser), - CefFrameCToCpp::Wrap(frame), - printInfoObj, - CefString(url), - CefString(title), - currentPage, - maxPages, - topLeftStr, - topCenterStr, - topRightStr, - bottomLeftStr, - bottomCenterStr, - bottomRightStr); - - // Return type: bool - return _retval; -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefPrintHandlerCppToC::CefPrintHandlerCppToC(CefPrintHandler* cls) - : CefCppToC( - cls) { - struct_.struct_.get_print_options = print_handler_get_print_options; - struct_.struct_.get_print_header_footer = - print_handler_get_print_header_footer; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/print_handler_cpptoc.h b/cef/libcef_dll/cpptoc/print_handler_cpptoc.h deleted file mode 100644 index 9289aa503..000000000 --- a/cef/libcef_dll/cpptoc/print_handler_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_PRINT_HANDLER_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_PRINT_HANDLER_CPPTOC_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include "include/cef_print_handler.h" -#include "include/capi/cef_print_handler_capi.h" -#include "libcef_dll/cpptoc/cpptoc.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefPrintHandlerCppToC - : public CefCppToC { - public: - explicit CefPrintHandlerCppToC(CefPrintHandler* cls); - virtual ~CefPrintHandlerCppToC() {} -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CPPTOC_PRINT_HANDLER_CPPTOC_H_ - diff --git a/cef/libcef_dll/cpptoc/render_handler_cpptoc.cc b/cef/libcef_dll/cpptoc/render_handler_cpptoc.cc deleted file mode 100644 index 1aec01198..000000000 --- a/cef/libcef_dll/cpptoc/render_handler_cpptoc.cc +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/render_handler_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -int CEF_CALLBACK render_handler_get_view_rect( - struct _cef_render_handler_t* self, cef_browser_t* browser, - cef_rect_t* rect) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: rect; type: simple_byref - DCHECK(rect); - if (!rect) - return 0; - - // Translate param: rect; type: simple_byref - CefRect rectVal = rect?*rect:CefRect(); - - // Execute - bool _retval = CefRenderHandlerCppToC::Get(self)->GetViewRect( - CefBrowserCToCpp::Wrap(browser), - rectVal); - - // Restore param: rect; type: simple_byref - if (rect) - *rect = rectVal; - - // Return type: bool - return _retval; -} - -int CEF_CALLBACK render_handler_get_screen_rect( - struct _cef_render_handler_t* self, cef_browser_t* browser, - cef_rect_t* rect) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: rect; type: simple_byref - DCHECK(rect); - if (!rect) - return 0; - - // Translate param: rect; type: simple_byref - CefRect rectVal = rect?*rect:CefRect(); - - // Execute - bool _retval = CefRenderHandlerCppToC::Get(self)->GetScreenRect( - CefBrowserCToCpp::Wrap(browser), - rectVal); - - // Restore param: rect; type: simple_byref - if (rect) - *rect = rectVal; - - // Return type: bool - return _retval; -} - -int CEF_CALLBACK render_handler_get_screen_point( - struct _cef_render_handler_t* self, cef_browser_t* browser, int viewX, - int viewY, int* screenX, int* screenY) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: screenX; type: simple_byref - DCHECK(screenX); - if (!screenX) - return 0; - // Verify param: screenY; type: simple_byref - DCHECK(screenY); - if (!screenY) - return 0; - - // Translate param: screenX; type: simple_byref - int screenXVal = screenX?*screenX:0; - // Translate param: screenY; type: simple_byref - int screenYVal = screenY?*screenY:0; - - // Execute - bool _retval = CefRenderHandlerCppToC::Get(self)->GetScreenPoint( - CefBrowserCToCpp::Wrap(browser), - viewX, - viewY, - screenXVal, - screenYVal); - - // Restore param: screenX; type: simple_byref - if (screenX) - *screenX = screenXVal; - // Restore param: screenY; type: simple_byref - if (screenY) - *screenY = screenYVal; - - // Return type: bool - return _retval; -} - -void CEF_CALLBACK render_handler_on_popup_show( - struct _cef_render_handler_t* self, cef_browser_t* browser, int show) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - - // Execute - CefRenderHandlerCppToC::Get(self)->OnPopupShow( - CefBrowserCToCpp::Wrap(browser), - show?true:false); -} - -void CEF_CALLBACK render_handler_on_popup_size( - struct _cef_render_handler_t* self, cef_browser_t* browser, - const cef_rect_t* rect) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - // Verify param: rect; type: simple_byref_const - DCHECK(rect); - if (!rect) - return; - - // Translate param: rect; type: simple_byref_const - CefRect rectVal = rect?*rect:CefRect(); - - // Execute - CefRenderHandlerCppToC::Get(self)->OnPopupSize( - CefBrowserCToCpp::Wrap(browser), - rectVal); -} - -void CEF_CALLBACK render_handler_on_paint(struct _cef_render_handler_t* self, - cef_browser_t* browser, enum cef_paint_element_type_t type, - size_t dirtyRectsCount, cef_rect_t const* dirtyRects, - const void* buffer) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - // Verify param: dirtyRects; type: simple_vec_byref_const - DCHECK(dirtyRectsCount == 0 || dirtyRects); - if (dirtyRectsCount > 0 && !dirtyRects) - return; - // Verify param: buffer; type: simple_byaddr - DCHECK(buffer); - if (!buffer) - return; - - // Translate param: dirtyRects; type: simple_vec_byref_const - std::vector dirtyRectsList; - if (dirtyRectsCount > 0) { - for (size_t i = 0; i < dirtyRectsCount; ++i) { - dirtyRectsList.push_back(dirtyRects[i]); - } - } - - // Execute - CefRenderHandlerCppToC::Get(self)->OnPaint( - CefBrowserCToCpp::Wrap(browser), - type, - dirtyRectsList, - buffer); -} - -void CEF_CALLBACK render_handler_on_cursor_change( - struct _cef_render_handler_t* self, cef_browser_t* browser, - cef_cursor_handle_t cursor) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - - // Execute - CefRenderHandlerCppToC::Get(self)->OnCursorChange( - CefBrowserCToCpp::Wrap(browser), - cursor); -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefRenderHandlerCppToC::CefRenderHandlerCppToC(CefRenderHandler* cls) - : CefCppToC( - cls) { - struct_.struct_.get_view_rect = render_handler_get_view_rect; - struct_.struct_.get_screen_rect = render_handler_get_screen_rect; - struct_.struct_.get_screen_point = render_handler_get_screen_point; - struct_.struct_.on_popup_show = render_handler_on_popup_show; - struct_.struct_.on_popup_size = render_handler_on_popup_size; - struct_.struct_.on_paint = render_handler_on_paint; - struct_.struct_.on_cursor_change = render_handler_on_cursor_change; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/render_handler_cpptoc.h b/cef/libcef_dll/cpptoc/render_handler_cpptoc.h deleted file mode 100644 index 8c9b65c2a..000000000 --- a/cef/libcef_dll/cpptoc/render_handler_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_RENDER_HANDLER_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_RENDER_HANDLER_CPPTOC_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include "include/cef_render_handler.h" -#include "include/capi/cef_render_handler_capi.h" -#include "libcef_dll/cpptoc/cpptoc.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefRenderHandlerCppToC - : public CefCppToC { - public: - explicit CefRenderHandlerCppToC(CefRenderHandler* cls); - virtual ~CefRenderHandlerCppToC() {} -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CPPTOC_RENDER_HANDLER_CPPTOC_H_ - diff --git a/cef/libcef_dll/cpptoc/request_handler_cpptoc.cc b/cef/libcef_dll/cpptoc/request_handler_cpptoc.cc deleted file mode 100644 index 9dfe7aed7..000000000 --- a/cef/libcef_dll/cpptoc/request_handler_cpptoc.cc +++ /dev/null @@ -1,399 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/content_filter_cpptoc.h" -#include "libcef_dll/cpptoc/download_handler_cpptoc.h" -#include "libcef_dll/cpptoc/request_handler_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" -#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h" -#include "libcef_dll/ctocpp/frame_ctocpp.h" -#include "libcef_dll/ctocpp/request_ctocpp.h" -#include "libcef_dll/ctocpp/response_ctocpp.h" -#include "libcef_dll/ctocpp/stream_reader_ctocpp.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -int CEF_CALLBACK request_handler_on_before_browse( - struct _cef_request_handler_t* self, cef_browser_t* browser, - cef_frame_t* frame, cef_request_t* request, - enum cef_handler_navtype_t navType, int isRedirect) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: frame; type: refptr_diff - DCHECK(frame); - if (!frame) - return 0; - // Verify param: request; type: refptr_diff - DCHECK(request); - if (!request) - return 0; - - // Execute - bool _retval = CefRequestHandlerCppToC::Get(self)->OnBeforeBrowse( - CefBrowserCToCpp::Wrap(browser), - CefFrameCToCpp::Wrap(frame), - CefRequestCToCpp::Wrap(request), - navType, - isRedirect?true:false); - - // Return type: bool - return _retval; -} - -int CEF_CALLBACK request_handler_on_before_resource_load( - struct _cef_request_handler_t* self, cef_browser_t* browser, - cef_request_t* request, cef_string_t* redirectUrl, - struct _cef_stream_reader_t** resourceStream, - struct _cef_response_t* response, int loadFlags) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: request; type: refptr_diff - DCHECK(request); - if (!request) - return 0; - // Verify param: redirectUrl; type: string_byref - DCHECK(redirectUrl); - if (!redirectUrl) - return 0; - // Verify param: resourceStream; type: refptr_diff_byref - DCHECK(resourceStream); - if (!resourceStream) - return 0; - // Verify param: response; type: refptr_diff - DCHECK(response); - if (!response) - return 0; - - // Translate param: redirectUrl; type: string_byref - CefString redirectUrlStr(redirectUrl); - // Translate param: resourceStream; type: refptr_diff_byref - CefRefPtr resourceStreamPtr; - if (resourceStream && *resourceStream) - resourceStreamPtr = CefStreamReaderCToCpp::Wrap(*resourceStream); - CefStreamReader* resourceStreamOrig = resourceStreamPtr.get(); - - // Execute - bool _retval = CefRequestHandlerCppToC::Get(self)->OnBeforeResourceLoad( - CefBrowserCToCpp::Wrap(browser), - CefRequestCToCpp::Wrap(request), - redirectUrlStr, - resourceStreamPtr, - CefResponseCToCpp::Wrap(response), - loadFlags); - - // Restore param: resourceStream; type: refptr_diff_byref - if (resourceStream) { - if (resourceStreamPtr.get()) { - if (resourceStreamPtr.get() != resourceStreamOrig) { - *resourceStream = CefStreamReaderCToCpp::Unwrap(resourceStreamPtr); - } - } else { - *resourceStream = NULL; - } - } - - // Return type: bool - return _retval; -} - -void CEF_CALLBACK request_handler_on_resource_redirect( - struct _cef_request_handler_t* self, cef_browser_t* browser, - const cef_string_t* old_url, cef_string_t* new_url) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - // Verify param: old_url; type: string_byref_const - DCHECK(old_url); - if (!old_url) - return; - // Verify param: new_url; type: string_byref - DCHECK(new_url); - if (!new_url) - return; - - // Translate param: new_url; type: string_byref - CefString new_urlStr(new_url); - - // Execute - CefRequestHandlerCppToC::Get(self)->OnResourceRedirect( - CefBrowserCToCpp::Wrap(browser), - CefString(old_url), - new_urlStr); -} - -void CEF_CALLBACK request_handler_on_resource_response( - struct _cef_request_handler_t* self, cef_browser_t* browser, - const cef_string_t* url, struct _cef_response_t* response, - cef_content_filter_t** filter) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - // Verify param: url; type: string_byref_const - DCHECK(url); - if (!url) - return; - // Verify param: response; type: refptr_diff - DCHECK(response); - if (!response) - return; - // Verify param: filter; type: refptr_same_byref - DCHECK(filter); - if (!filter) - return; - - // Translate param: filter; type: refptr_same_byref - CefRefPtr filterPtr; - if (filter && *filter) - filterPtr = CefContentFilterCppToC::Unwrap(*filter); - CefContentFilter* filterOrig = filterPtr.get(); - - // Execute - CefRequestHandlerCppToC::Get(self)->OnResourceResponse( - CefBrowserCToCpp::Wrap(browser), - CefString(url), - CefResponseCToCpp::Wrap(response), - filterPtr); - - // Restore param: filter; type: refptr_same_byref - if (filter) { - if (filterPtr.get()) { - if (filterPtr.get() != filterOrig) { - *filter = CefContentFilterCppToC::Wrap(filterPtr); - } - } else { - *filter = NULL; - } - } -} - -int CEF_CALLBACK request_handler_on_protocol_execution( - struct _cef_request_handler_t* self, cef_browser_t* browser, - const cef_string_t* url, int* allowOSExecution) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: url; type: string_byref_const - DCHECK(url); - if (!url) - return 0; - // Verify param: allowOSExecution; type: bool_byref - DCHECK(allowOSExecution); - if (!allowOSExecution) - return 0; - - // Translate param: allowOSExecution; type: bool_byref - bool allowOSExecutionBool = ( - allowOSExecution && *allowOSExecution)?true:false; - - // Execute - bool _retval = CefRequestHandlerCppToC::Get(self)->OnProtocolExecution( - CefBrowserCToCpp::Wrap(browser), - CefString(url), - allowOSExecutionBool); - - // Restore param: allowOSExecution; type: bool_byref - if (allowOSExecution) - *allowOSExecution = allowOSExecutionBool?true:false; - - // Return type: bool - return _retval; -} - -int CEF_CALLBACK request_handler_get_download_handler( - struct _cef_request_handler_t* self, cef_browser_t* browser, - const cef_string_t* mimeType, const cef_string_t* fileName, - int64 contentLength, cef_download_handler_t** handler) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: mimeType; type: string_byref_const - DCHECK(mimeType); - if (!mimeType) - return 0; - // Verify param: fileName; type: string_byref_const - DCHECK(fileName); - if (!fileName) - return 0; - // Verify param: handler; type: refptr_same_byref - DCHECK(handler); - if (!handler) - return 0; - - // Translate param: handler; type: refptr_same_byref - CefRefPtr handlerPtr; - if (handler && *handler) - handlerPtr = CefDownloadHandlerCppToC::Unwrap(*handler); - CefDownloadHandler* handlerOrig = handlerPtr.get(); - - // Execute - bool _retval = CefRequestHandlerCppToC::Get(self)->GetDownloadHandler( - CefBrowserCToCpp::Wrap(browser), - CefString(mimeType), - CefString(fileName), - contentLength, - handlerPtr); - - // Restore param: handler; type: refptr_same_byref - if (handler) { - if (handlerPtr.get()) { - if (handlerPtr.get() != handlerOrig) { - *handler = CefDownloadHandlerCppToC::Wrap(handlerPtr); - } - } else { - *handler = NULL; - } - } - - // Return type: bool - return _retval; -} - -int CEF_CALLBACK request_handler_get_auth_credentials( - struct _cef_request_handler_t* self, cef_browser_t* browser, int isProxy, - const cef_string_t* host, int port, const cef_string_t* realm, - const cef_string_t* scheme, cef_string_t* username, - cef_string_t* password) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return 0; - // Verify param: host; type: string_byref_const - DCHECK(host); - if (!host) - return 0; - // Verify param: scheme; type: string_byref_const - DCHECK(scheme); - if (!scheme) - return 0; - // Verify param: username; type: string_byref - DCHECK(username); - if (!username) - return 0; - // Verify param: password; type: string_byref - DCHECK(password); - if (!password) - return 0; - // Unverified params: realm - - // Translate param: username; type: string_byref - CefString usernameStr(username); - // Translate param: password; type: string_byref - CefString passwordStr(password); - - // Execute - bool _retval = CefRequestHandlerCppToC::Get(self)->GetAuthCredentials( - CefBrowserCToCpp::Wrap(browser), - isProxy?true:false, - CefString(host), - port, - CefString(realm), - CefString(scheme), - usernameStr, - passwordStr); - - // Return type: bool - return _retval; -} - -cef_cookie_manager_t* CEF_CALLBACK request_handler_get_cookie_manager( - struct _cef_request_handler_t* self, cef_browser_t* browser, - const cef_string_t* main_url) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return NULL; - // Verify param: main_url; type: string_byref_const - DCHECK(main_url); - if (!main_url) - return NULL; - - // Execute - CefRefPtr _retval = CefRequestHandlerCppToC::Get( - self)->GetCookieManager( - CefBrowserCToCpp::Wrap(browser), - CefString(main_url)); - - // Return type: refptr_diff - return CefCookieManagerCToCpp::Unwrap(_retval); -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefRequestHandlerCppToC::CefRequestHandlerCppToC(CefRequestHandler* cls) - : CefCppToC(cls) { - struct_.struct_.on_before_browse = request_handler_on_before_browse; - struct_.struct_.on_before_resource_load = - request_handler_on_before_resource_load; - struct_.struct_.on_resource_redirect = request_handler_on_resource_redirect; - struct_.struct_.on_resource_response = request_handler_on_resource_response; - struct_.struct_.on_protocol_execution = request_handler_on_protocol_execution; - struct_.struct_.get_download_handler = request_handler_get_download_handler; - struct_.struct_.get_auth_credentials = request_handler_get_auth_credentials; - struct_.struct_.get_cookie_manager = request_handler_get_cookie_manager; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/scheme_handler_cpptoc.cc b/cef/libcef_dll/cpptoc/scheme_handler_cpptoc.cc deleted file mode 100644 index a613a3cf0..000000000 --- a/cef/libcef_dll/cpptoc/scheme_handler_cpptoc.cc +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/scheme_handler_cpptoc.h" -#include "libcef_dll/ctocpp/request_ctocpp.h" -#include "libcef_dll/ctocpp/response_ctocpp.h" -#include "libcef_dll/ctocpp/scheme_handler_callback_ctocpp.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -int CEF_CALLBACK scheme_handler_process_request( - struct _cef_scheme_handler_t* self, cef_request_t* request, - cef_scheme_handler_callback_t* callback) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: request; type: refptr_diff - DCHECK(request); - if (!request) - return 0; - // Verify param: callback; type: refptr_diff - DCHECK(callback); - if (!callback) - return 0; - - // Execute - bool _retval = CefSchemeHandlerCppToC::Get(self)->ProcessRequest( - CefRequestCToCpp::Wrap(request), - CefSchemeHandlerCallbackCToCpp::Wrap(callback)); - - // Return type: bool - return _retval; -} - -void CEF_CALLBACK scheme_handler_get_response_headers( - struct _cef_scheme_handler_t* self, cef_response_t* response, - int64* response_length, cef_string_t* redirectUrl) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: response; type: refptr_diff - DCHECK(response); - if (!response) - return; - // Verify param: response_length; type: simple_byref - DCHECK(response_length); - if (!response_length) - return; - // Verify param: redirectUrl; type: string_byref - DCHECK(redirectUrl); - if (!redirectUrl) - return; - - // Translate param: response_length; type: simple_byref - int64 response_lengthVal = response_length?*response_length:0; - // Translate param: redirectUrl; type: string_byref - CefString redirectUrlStr(redirectUrl); - - // Execute - CefSchemeHandlerCppToC::Get(self)->GetResponseHeaders( - CefResponseCToCpp::Wrap(response), - response_lengthVal, - redirectUrlStr); - - // Restore param: response_length; type: simple_byref - if (response_length) - *response_length = response_lengthVal; -} - -int CEF_CALLBACK scheme_handler_read_response( - struct _cef_scheme_handler_t* self, void* data_out, int bytes_to_read, - int* bytes_read, cef_scheme_handler_callback_t* callback) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: data_out; type: simple_byaddr - DCHECK(data_out); - if (!data_out) - return 0; - // Verify param: bytes_read; type: simple_byref - DCHECK(bytes_read); - if (!bytes_read) - return 0; - // Verify param: callback; type: refptr_diff - DCHECK(callback); - if (!callback) - return 0; - - // Translate param: bytes_read; type: simple_byref - int bytes_readVal = bytes_read?*bytes_read:0; - - // Execute - bool _retval = CefSchemeHandlerCppToC::Get(self)->ReadResponse( - data_out, - bytes_to_read, - bytes_readVal, - CefSchemeHandlerCallbackCToCpp::Wrap(callback)); - - // Restore param: bytes_read; type: simple_byref - if (bytes_read) - *bytes_read = bytes_readVal; - - // Return type: bool - return _retval; -} - -void CEF_CALLBACK scheme_handler_cancel(struct _cef_scheme_handler_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - - // Execute - CefSchemeHandlerCppToC::Get(self)->Cancel(); -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefSchemeHandlerCppToC::CefSchemeHandlerCppToC(CefSchemeHandler* cls) - : CefCppToC( - cls) { - struct_.struct_.process_request = scheme_handler_process_request; - struct_.struct_.get_response_headers = scheme_handler_get_response_headers; - struct_.struct_.read_response = scheme_handler_read_response; - struct_.struct_.cancel = scheme_handler_cancel; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/scheme_handler_cpptoc.h b/cef/libcef_dll/cpptoc/scheme_handler_cpptoc.h deleted file mode 100644 index e38e705f1..000000000 --- a/cef/libcef_dll/cpptoc/scheme_handler_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_SCHEME_HANDLER_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_SCHEME_HANDLER_CPPTOC_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include "include/cef_scheme.h" -#include "include/capi/cef_scheme_capi.h" -#include "libcef_dll/cpptoc/cpptoc.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefSchemeHandlerCppToC - : public CefCppToC { - public: - explicit CefSchemeHandlerCppToC(CefSchemeHandler* cls); - virtual ~CefSchemeHandlerCppToC() {} -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CPPTOC_SCHEME_HANDLER_CPPTOC_H_ - diff --git a/cef/libcef_dll/cpptoc/storage_visitor_cpptoc.cc b/cef/libcef_dll/cpptoc/storage_visitor_cpptoc.cc deleted file mode 100644 index b5c4a42ac..000000000 --- a/cef/libcef_dll/cpptoc/storage_visitor_cpptoc.cc +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/storage_visitor_cpptoc.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -int CEF_CALLBACK storage_visitor_visit(struct _cef_storage_visitor_t* self, - enum cef_storage_type_t type, const cef_string_t* origin, - const cef_string_t* key, const cef_string_t* value, int count, int total, - int* deleteData) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - // Verify param: origin; type: string_byref_const - DCHECK(origin); - if (!origin) - return 0; - // Verify param: key; type: string_byref_const - DCHECK(key); - if (!key) - return 0; - // Verify param: value; type: string_byref_const - DCHECK(value); - if (!value) - return 0; - // Verify param: deleteData; type: bool_byref - DCHECK(deleteData); - if (!deleteData) - return 0; - - // Translate param: deleteData; type: bool_byref - bool deleteDataBool = (deleteData && *deleteData)?true:false; - - // Execute - bool _retval = CefStorageVisitorCppToC::Get(self)->Visit( - type, - CefString(origin), - CefString(key), - CefString(value), - count, - total, - deleteDataBool); - - // Restore param: deleteData; type: bool_byref - if (deleteData) - *deleteData = deleteDataBool?true:false; - - // Return type: bool - return _retval; -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefStorageVisitorCppToC::CefStorageVisitorCppToC(CefStorageVisitor* cls) - : CefCppToC(cls) { - struct_.struct_.visit = storage_visitor_visit; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/storage_visitor_cpptoc.h b/cef/libcef_dll/cpptoc/storage_visitor_cpptoc.h deleted file mode 100644 index af8569853..000000000 --- a/cef/libcef_dll/cpptoc/storage_visitor_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_STORAGE_VISITOR_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_STORAGE_VISITOR_CPPTOC_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include "include/cef_storage.h" -#include "include/capi/cef_storage_capi.h" -#include "libcef_dll/cpptoc/cpptoc.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefStorageVisitorCppToC - : public CefCppToC { - public: - explicit CefStorageVisitorCppToC(CefStorageVisitor* cls); - virtual ~CefStorageVisitorCppToC() {} -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CPPTOC_STORAGE_VISITOR_CPPTOC_H_ - diff --git a/cef/libcef_dll/cpptoc/v8context_handler_cpptoc.cc b/cef/libcef_dll/cpptoc/v8context_handler_cpptoc.cc deleted file mode 100644 index 2c426834c..000000000 --- a/cef/libcef_dll/cpptoc/v8context_handler_cpptoc.cc +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/v8context_handler_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" -#include "libcef_dll/ctocpp/frame_ctocpp.h" -#include "libcef_dll/ctocpp/v8context_ctocpp.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -void CEF_CALLBACK v8context_handler_on_context_created( - struct _cef_v8context_handler_t* self, cef_browser_t* browser, - cef_frame_t* frame, cef_v8context_t* context) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - // Verify param: frame; type: refptr_diff - DCHECK(frame); - if (!frame) - return; - // Verify param: context; type: refptr_diff - DCHECK(context); - if (!context) - return; - - // Execute - CefV8ContextHandlerCppToC::Get(self)->OnContextCreated( - CefBrowserCToCpp::Wrap(browser), - CefFrameCToCpp::Wrap(frame), - CefV8ContextCToCpp::Wrap(context)); -} - -void CEF_CALLBACK v8context_handler_on_context_released( - struct _cef_v8context_handler_t* self, cef_browser_t* browser, - cef_frame_t* frame, cef_v8context_t* context) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - // Verify param: frame; type: refptr_diff - DCHECK(frame); - if (!frame) - return; - // Verify param: context; type: refptr_diff - DCHECK(context); - if (!context) - return; - - // Execute - CefV8ContextHandlerCppToC::Get(self)->OnContextReleased( - CefBrowserCToCpp::Wrap(browser), - CefFrameCToCpp::Wrap(frame), - CefV8ContextCToCpp::Wrap(context)); -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefV8ContextHandlerCppToC::CefV8ContextHandlerCppToC(CefV8ContextHandler* cls) - : CefCppToC(cls) { - struct_.struct_.on_context_created = v8context_handler_on_context_created; - struct_.struct_.on_context_released = v8context_handler_on_context_released; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/v8context_handler_cpptoc.h b/cef/libcef_dll/cpptoc/v8context_handler_cpptoc.h deleted file mode 100644 index d77b908e2..000000000 --- a/cef/libcef_dll/cpptoc/v8context_handler_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_V8CONTEXT_HANDLER_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_V8CONTEXT_HANDLER_CPPTOC_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include "include/cef_v8context_handler.h" -#include "include/capi/cef_v8context_handler_capi.h" -#include "libcef_dll/cpptoc/cpptoc.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefV8ContextHandlerCppToC - : public CefCppToC { - public: - explicit CefV8ContextHandlerCppToC(CefV8ContextHandler* cls); - virtual ~CefV8ContextHandlerCppToC() {} -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CPPTOC_V8CONTEXT_HANDLER_CPPTOC_H_ - diff --git a/cef/libcef_dll/cpptoc/web_urlrequest_client_cpptoc.cc b/cef/libcef_dll/cpptoc/web_urlrequest_client_cpptoc.cc deleted file mode 100644 index d576345e0..000000000 --- a/cef/libcef_dll/cpptoc/web_urlrequest_client_cpptoc.cc +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/web_urlrequest_client_cpptoc.h" -#include "libcef_dll/ctocpp/request_ctocpp.h" -#include "libcef_dll/ctocpp/response_ctocpp.h" -#include "libcef_dll/ctocpp/web_urlrequest_ctocpp.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -void CEF_CALLBACK web_urlrequest_client_on_state_change( - struct _cef_web_urlrequest_client_t* self, cef_web_urlrequest_t* requester, - enum cef_weburlrequest_state_t state) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: requester; type: refptr_diff - DCHECK(requester); - if (!requester) - return; - - // Execute - CefWebURLRequestClientCppToC::Get(self)->OnStateChange( - CefWebURLRequestCToCpp::Wrap(requester), - state); -} - -void CEF_CALLBACK web_urlrequest_client_on_redirect( - struct _cef_web_urlrequest_client_t* self, cef_web_urlrequest_t* requester, - cef_request_t* request, cef_response_t* response) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: requester; type: refptr_diff - DCHECK(requester); - if (!requester) - return; - // Verify param: request; type: refptr_diff - DCHECK(request); - if (!request) - return; - // Verify param: response; type: refptr_diff - DCHECK(response); - if (!response) - return; - - // Execute - CefWebURLRequestClientCppToC::Get(self)->OnRedirect( - CefWebURLRequestCToCpp::Wrap(requester), - CefRequestCToCpp::Wrap(request), - CefResponseCToCpp::Wrap(response)); -} - -void CEF_CALLBACK web_urlrequest_client_on_headers_received( - struct _cef_web_urlrequest_client_t* self, cef_web_urlrequest_t* requester, - cef_response_t* response) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: requester; type: refptr_diff - DCHECK(requester); - if (!requester) - return; - // Verify param: response; type: refptr_diff - DCHECK(response); - if (!response) - return; - - // Execute - CefWebURLRequestClientCppToC::Get(self)->OnHeadersReceived( - CefWebURLRequestCToCpp::Wrap(requester), - CefResponseCToCpp::Wrap(response)); -} - -void CEF_CALLBACK web_urlrequest_client_on_progress( - struct _cef_web_urlrequest_client_t* self, cef_web_urlrequest_t* requester, - uint64 bytesSent, uint64 totalBytesToBeSent) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: requester; type: refptr_diff - DCHECK(requester); - if (!requester) - return; - - // Execute - CefWebURLRequestClientCppToC::Get(self)->OnProgress( - CefWebURLRequestCToCpp::Wrap(requester), - bytesSent, - totalBytesToBeSent); -} - -void CEF_CALLBACK web_urlrequest_client_on_data( - struct _cef_web_urlrequest_client_t* self, cef_web_urlrequest_t* requester, - const void* data, int dataLength) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: requester; type: refptr_diff - DCHECK(requester); - if (!requester) - return; - // Verify param: data; type: simple_byaddr - DCHECK(data); - if (!data) - return; - - // Execute - CefWebURLRequestClientCppToC::Get(self)->OnData( - CefWebURLRequestCToCpp::Wrap(requester), - data, - dataLength); -} - -void CEF_CALLBACK web_urlrequest_client_on_error( - struct _cef_web_urlrequest_client_t* self, cef_web_urlrequest_t* requester, - enum cef_handler_errorcode_t errorCode) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: requester; type: refptr_diff - DCHECK(requester); - if (!requester) - return; - - // Execute - CefWebURLRequestClientCppToC::Get(self)->OnError( - CefWebURLRequestCToCpp::Wrap(requester), - errorCode); -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefWebURLRequestClientCppToC::CefWebURLRequestClientCppToC( - CefWebURLRequestClient* cls) - : CefCppToC(cls) { - struct_.struct_.on_state_change = web_urlrequest_client_on_state_change; - struct_.struct_.on_redirect = web_urlrequest_client_on_redirect; - struct_.struct_.on_headers_received = - web_urlrequest_client_on_headers_received; - struct_.struct_.on_progress = web_urlrequest_client_on_progress; - struct_.struct_.on_data = web_urlrequest_client_on_data; - struct_.struct_.on_error = web_urlrequest_client_on_error; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/cpptoc/web_urlrequest_client_cpptoc.h b/cef/libcef_dll/cpptoc/web_urlrequest_client_cpptoc.h deleted file mode 100644 index 1aca5c15a..000000000 --- a/cef/libcef_dll/cpptoc/web_urlrequest_client_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_WEB_URLREQUEST_CLIENT_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_WEB_URLREQUEST_CLIENT_CPPTOC_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include "include/cef_web_urlrequest.h" -#include "include/capi/cef_web_urlrequest_capi.h" -#include "libcef_dll/cpptoc/cpptoc.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefWebURLRequestClientCppToC - : public CefCppToC { - public: - explicit CefWebURLRequestClientCppToC(CefWebURLRequestClient* cls); - virtual ~CefWebURLRequestClientCppToC() {} -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CPPTOC_WEB_URLREQUEST_CLIENT_CPPTOC_H_ - diff --git a/cef/libcef_dll/ctocpp/browser_ctocpp.cc b/cef/libcef_dll/ctocpp/browser_ctocpp.cc deleted file mode 100644 index cbce950c9..000000000 --- a/cef/libcef_dll/ctocpp/browser_ctocpp.cc +++ /dev/null @@ -1,578 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/client_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" -#include "libcef_dll/ctocpp/frame_ctocpp.h" -#include "libcef_dll/transfer_util.h" - - -// STATIC METHODS - Body may be edited by hand. - -bool CefBrowser::CreateBrowser(CefWindowInfo& windowInfo, - CefRefPtr client, const CefString& url, - const CefBrowserSettings& settings) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: client; type: refptr_diff - DCHECK(client.get()); - if (!client.get()) - return false; - // Unverified params: url - - // Execute - int _retval = cef_browser_create( - &windowInfo, - CefClientCppToC::Wrap(client), - url.GetStruct(), - &settings); - - // Return type: bool - return _retval?true:false; -} - -CefRefPtr CefBrowser::CreateBrowserSync(CefWindowInfo& windowInfo, - CefRefPtr client, const CefString& url, - const CefBrowserSettings& settings) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: client; type: refptr_diff - DCHECK(client.get()); - if (!client.get()) - return NULL; - // Unverified params: url - - // Execute - cef_browser_t* _retval = cef_browser_create_sync( - &windowInfo, - CefClientCppToC::Wrap(client), - url.GetStruct(), - &settings); - - // Return type: refptr_same - return CefBrowserCToCpp::Wrap(_retval); -} - - -// VIRTUAL METHODS - Body may be edited by hand. - -void CefBrowserCToCpp::ParentWindowWillClose() { - if (CEF_MEMBER_MISSING(struct_, parent_window_will_close)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->parent_window_will_close(struct_); -} - -void CefBrowserCToCpp::CloseBrowser() { - if (CEF_MEMBER_MISSING(struct_, close_browser)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->close_browser(struct_); -} - -bool CefBrowserCToCpp::CanGoBack() { - if (CEF_MEMBER_MISSING(struct_, can_go_back)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = struct_->can_go_back(struct_); - - // Return type: bool - return _retval?true:false; -} - -void CefBrowserCToCpp::GoBack() { - if (CEF_MEMBER_MISSING(struct_, go_back)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->go_back(struct_); -} - -bool CefBrowserCToCpp::CanGoForward() { - if (CEF_MEMBER_MISSING(struct_, can_go_forward)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = struct_->can_go_forward(struct_); - - // Return type: bool - return _retval?true:false; -} - -void CefBrowserCToCpp::GoForward() { - if (CEF_MEMBER_MISSING(struct_, go_forward)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->go_forward(struct_); -} - -void CefBrowserCToCpp::Reload() { - if (CEF_MEMBER_MISSING(struct_, reload)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->reload(struct_); -} - -void CefBrowserCToCpp::ReloadIgnoreCache() { - if (CEF_MEMBER_MISSING(struct_, reload_ignore_cache)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->reload_ignore_cache(struct_); -} - -void CefBrowserCToCpp::StopLoad() { - if (CEF_MEMBER_MISSING(struct_, stop_load)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->stop_load(struct_); -} - -void CefBrowserCToCpp::SetFocus(bool enable) { - if (CEF_MEMBER_MISSING(struct_, set_focus)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->set_focus(struct_, - enable); -} - -CefWindowHandle CefBrowserCToCpp::GetWindowHandle() { - if (CEF_MEMBER_MISSING(struct_, get_window_handle)) - return NULL; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_window_handle_t _retval = struct_->get_window_handle(struct_); - - // Return type: simple - return _retval; -} - -CefWindowHandle CefBrowserCToCpp::GetOpenerWindowHandle() { - if (CEF_MEMBER_MISSING(struct_, get_opener_window_handle)) - return NULL; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_window_handle_t _retval = struct_->get_opener_window_handle(struct_); - - // Return type: simple - return _retval; -} - -bool CefBrowserCToCpp::IsPopup() { - if (CEF_MEMBER_MISSING(struct_, is_popup)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = struct_->is_popup(struct_); - - // Return type: bool - return _retval?true:false; -} - -bool CefBrowserCToCpp::HasDocument() { - if (CEF_MEMBER_MISSING(struct_, has_document)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = struct_->has_document(struct_); - - // Return type: bool - return _retval?true:false; -} - -CefRefPtr CefBrowserCToCpp::GetClient() { - if (CEF_MEMBER_MISSING(struct_, get_client)) - return NULL; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_client_t* _retval = struct_->get_client(struct_); - - // Return type: refptr_diff - return CefClientCppToC::Unwrap(_retval); -} - -CefRefPtr CefBrowserCToCpp::GetMainFrame() { - if (CEF_MEMBER_MISSING(struct_, get_main_frame)) - return NULL; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_frame_t* _retval = struct_->get_main_frame(struct_); - - // Return type: refptr_same - return CefFrameCToCpp::Wrap(_retval); -} - -CefRefPtr CefBrowserCToCpp::GetFocusedFrame() { - if (CEF_MEMBER_MISSING(struct_, get_focused_frame)) - return NULL; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_frame_t* _retval = struct_->get_focused_frame(struct_); - - // Return type: refptr_same - return CefFrameCToCpp::Wrap(_retval); -} - -CefRefPtr CefBrowserCToCpp::GetFrame(const CefString& name) { - if (CEF_MEMBER_MISSING(struct_, get_frame)) - return NULL; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: name; type: string_byref_const - DCHECK(!name.empty()); - if (name.empty()) - return NULL; - - // Execute - cef_frame_t* _retval = struct_->get_frame(struct_, - name.GetStruct()); - - // Return type: refptr_same - return CefFrameCToCpp::Wrap(_retval); -} - -void CefBrowserCToCpp::GetFrameNames(std::vector& names) { - if (CEF_MEMBER_MISSING(struct_, get_frame_names)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Translate param: names; type: string_vec_byref - cef_string_list_t namesList = cef_string_list_alloc(); - DCHECK(namesList); - if (namesList) - transfer_string_list_contents(names, namesList); - - // Execute - struct_->get_frame_names(struct_, - namesList); - - // Restore param:names; type: string_vec_byref - if (namesList) { - names.clear(); - transfer_string_list_contents(namesList, names); - cef_string_list_free(namesList); - } -} - -void CefBrowserCToCpp::Find(int identifier, const CefString& searchText, - bool forward, bool matchCase, bool findNext) { - if (CEF_MEMBER_MISSING(struct_, find)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: searchText; type: string_byref_const - DCHECK(!searchText.empty()); - if (searchText.empty()) - return; - - // Execute - struct_->find(struct_, - identifier, - searchText.GetStruct(), - forward, - matchCase, - findNext); -} - -void CefBrowserCToCpp::StopFinding(bool clearSelection) { - if (CEF_MEMBER_MISSING(struct_, stop_finding)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->stop_finding(struct_, - clearSelection); -} - -double CefBrowserCToCpp::GetZoomLevel() { - if (CEF_MEMBER_MISSING(struct_, get_zoom_level)) - return 0; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - double _retval = struct_->get_zoom_level(struct_); - - // Return type: simple - return _retval; -} - -void CefBrowserCToCpp::SetZoomLevel(double zoomLevel) { - if (CEF_MEMBER_MISSING(struct_, set_zoom_level)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->set_zoom_level(struct_, - zoomLevel); -} - -void CefBrowserCToCpp::ClearHistory() { - if (CEF_MEMBER_MISSING(struct_, clear_history)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->clear_history(struct_); -} - -void CefBrowserCToCpp::ShowDevTools() { - if (CEF_MEMBER_MISSING(struct_, show_dev_tools)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->show_dev_tools(struct_); -} - -void CefBrowserCToCpp::CloseDevTools() { - if (CEF_MEMBER_MISSING(struct_, close_dev_tools)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->close_dev_tools(struct_); -} - -bool CefBrowserCToCpp::IsWindowRenderingDisabled() { - if (CEF_MEMBER_MISSING(struct_, is_window_rendering_disabled)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = struct_->is_window_rendering_disabled(struct_); - - // Return type: bool - return _retval?true:false; -} - -bool CefBrowserCToCpp::GetSize(PaintElementType type, int& width, int& height) { - if (CEF_MEMBER_MISSING(struct_, get_size)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = struct_->get_size(struct_, - type, - &width, - &height); - - // Return type: bool - return _retval?true:false; -} - -void CefBrowserCToCpp::SetSize(PaintElementType type, int width, int height) { - if (CEF_MEMBER_MISSING(struct_, set_size)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->set_size(struct_, - type, - width, - height); -} - -bool CefBrowserCToCpp::IsPopupVisible() { - if (CEF_MEMBER_MISSING(struct_, is_popup_visible)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = struct_->is_popup_visible(struct_); - - // Return type: bool - return _retval?true:false; -} - -void CefBrowserCToCpp::HidePopup() { - if (CEF_MEMBER_MISSING(struct_, hide_popup)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->hide_popup(struct_); -} - -void CefBrowserCToCpp::Invalidate(const CefRect& dirtyRect) { - if (CEF_MEMBER_MISSING(struct_, invalidate)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->invalidate(struct_, - &dirtyRect); -} - -bool CefBrowserCToCpp::GetImage(PaintElementType type, int width, int height, - void* buffer) { - if (CEF_MEMBER_MISSING(struct_, get_image)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: buffer; type: simple_byaddr - DCHECK(buffer); - if (!buffer) - return false; - - // Execute - int _retval = struct_->get_image(struct_, - type, - width, - height, - buffer); - - // Return type: bool - return _retval?true:false; -} - -void CefBrowserCToCpp::SendKeyEvent(KeyType type, const CefKeyInfo& keyInfo, - int modifiers) { - if (CEF_MEMBER_MISSING(struct_, send_key_event)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->send_key_event(struct_, - type, - &keyInfo, - modifiers); -} - -void CefBrowserCToCpp::SendMouseClickEvent(int x, int y, MouseButtonType type, - bool mouseUp, int clickCount) { - if (CEF_MEMBER_MISSING(struct_, send_mouse_click_event)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->send_mouse_click_event(struct_, - x, - y, - type, - mouseUp, - clickCount); -} - -void CefBrowserCToCpp::SendMouseMoveEvent(int x, int y, bool mouseLeave) { - if (CEF_MEMBER_MISSING(struct_, send_mouse_move_event)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->send_mouse_move_event(struct_, - x, - y, - mouseLeave); -} - -void CefBrowserCToCpp::SendMouseWheelEvent(int x, int y, int deltaX, - int deltaY) { - if (CEF_MEMBER_MISSING(struct_, send_mouse_wheel_event)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->send_mouse_wheel_event(struct_, - x, - y, - deltaX, - deltaY); -} - -void CefBrowserCToCpp::SendFocusEvent(bool setFocus) { - if (CEF_MEMBER_MISSING(struct_, send_focus_event)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->send_focus_event(struct_, - setFocus); -} - -void CefBrowserCToCpp::SendCaptureLostEvent() { - if (CEF_MEMBER_MISSING(struct_, send_capture_lost_event)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->send_capture_lost_event(struct_); -} - - -#ifndef NDEBUG -template<> long CefCToCpp::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/ctocpp/browser_ctocpp.h b/cef/libcef_dll/ctocpp/browser_ctocpp.h deleted file mode 100644 index d22900c55..000000000 --- a/cef/libcef_dll/ctocpp/browser_ctocpp.h +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_CTOCPP_H_ -#define CEF_LIBCEF_DLL_CTOCPP_BROWSER_CTOCPP_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include -#include "include/cef_browser.h" -#include "include/capi/cef_browser_capi.h" -#include "include/cef_client.h" -#include "include/capi/cef_client_capi.h" -#include "libcef_dll/ctocpp/ctocpp.h" - -// Wrap a C structure with a C++ class. -// This class may be instantiated and accessed wrapper-side only. -class CefBrowserCToCpp - : public CefCToCpp { - public: - explicit CefBrowserCToCpp(cef_browser_t* str) - : CefCToCpp(str) {} - virtual ~CefBrowserCToCpp() {} - - // CefBrowser methods - virtual void ParentWindowWillClose() OVERRIDE; - virtual void CloseBrowser() OVERRIDE; - virtual bool CanGoBack() OVERRIDE; - virtual void GoBack() OVERRIDE; - virtual bool CanGoForward() OVERRIDE; - virtual void GoForward() OVERRIDE; - virtual void Reload() OVERRIDE; - virtual void ReloadIgnoreCache() OVERRIDE; - virtual void StopLoad() OVERRIDE; - virtual void SetFocus(bool enable) OVERRIDE; - virtual CefWindowHandle GetWindowHandle() OVERRIDE; - virtual CefWindowHandle GetOpenerWindowHandle() OVERRIDE; - virtual bool IsPopup() OVERRIDE; - virtual bool HasDocument() OVERRIDE; - virtual CefRefPtr GetClient() OVERRIDE; - virtual CefRefPtr GetMainFrame() OVERRIDE; - virtual CefRefPtr GetFocusedFrame() OVERRIDE; - virtual CefRefPtr GetFrame(const CefString& name) OVERRIDE; - virtual void GetFrameNames(std::vector& names) OVERRIDE; - virtual void Find(int identifier, const CefString& searchText, bool forward, - bool matchCase, bool findNext) OVERRIDE; - virtual void StopFinding(bool clearSelection) OVERRIDE; - virtual double GetZoomLevel() OVERRIDE; - virtual void SetZoomLevel(double zoomLevel) OVERRIDE; - virtual void ClearHistory() OVERRIDE; - virtual void ShowDevTools() OVERRIDE; - virtual void CloseDevTools() OVERRIDE; - virtual bool IsWindowRenderingDisabled() OVERRIDE; - virtual bool GetSize(PaintElementType type, int& width, int& height) OVERRIDE; - virtual void SetSize(PaintElementType type, int width, int height) OVERRIDE; - virtual bool IsPopupVisible() OVERRIDE; - virtual void HidePopup() OVERRIDE; - virtual void Invalidate(const CefRect& dirtyRect) OVERRIDE; - virtual bool GetImage(PaintElementType type, int width, int height, - void* buffer) OVERRIDE; - virtual void SendKeyEvent(KeyType type, const CefKeyInfo& keyInfo, - int modifiers) OVERRIDE; - virtual void SendMouseClickEvent(int x, int y, MouseButtonType type, - bool mouseUp, int clickCount) OVERRIDE; - virtual void SendMouseMoveEvent(int x, int y, bool mouseLeave) OVERRIDE; - virtual void SendMouseWheelEvent(int x, int y, int deltaX, - int deltaY) OVERRIDE; - virtual void SendFocusEvent(bool setFocus) OVERRIDE; - virtual void SendCaptureLostEvent() OVERRIDE; -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CTOCPP_BROWSER_CTOCPP_H_ - diff --git a/cef/libcef_dll/ctocpp/drag_data_ctocpp.cc b/cef/libcef_dll/ctocpp/drag_data_ctocpp.cc deleted file mode 100644 index f73d18f1d..000000000 --- a/cef/libcef_dll/ctocpp/drag_data_ctocpp.cc +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/ctocpp/drag_data_ctocpp.h" -#include "libcef_dll/transfer_util.h" - - -// VIRTUAL METHODS - Body may be edited by hand. - -bool CefDragDataCToCpp::IsLink() { - if (CEF_MEMBER_MISSING(struct_, is_link)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = struct_->is_link(struct_); - - // Return type: bool - return _retval?true:false; -} - -bool CefDragDataCToCpp::IsFragment() { - if (CEF_MEMBER_MISSING(struct_, is_fragment)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = struct_->is_fragment(struct_); - - // Return type: bool - return _retval?true:false; -} - -bool CefDragDataCToCpp::IsFile() { - if (CEF_MEMBER_MISSING(struct_, is_file)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = struct_->is_file(struct_); - - // Return type: bool - return _retval?true:false; -} - -CefString CefDragDataCToCpp::GetLinkURL() { - if (CEF_MEMBER_MISSING(struct_, get_link_url)) - return CefString(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_string_userfree_t _retval = struct_->get_link_url(struct_); - - // Return type: string - CefString _retvalStr; - _retvalStr.AttachToUserFree(_retval); - return _retvalStr; -} - -CefString CefDragDataCToCpp::GetLinkTitle() { - if (CEF_MEMBER_MISSING(struct_, get_link_title)) - return CefString(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_string_userfree_t _retval = struct_->get_link_title(struct_); - - // Return type: string - CefString _retvalStr; - _retvalStr.AttachToUserFree(_retval); - return _retvalStr; -} - -CefString CefDragDataCToCpp::GetLinkMetadata() { - if (CEF_MEMBER_MISSING(struct_, get_link_metadata)) - return CefString(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_string_userfree_t _retval = struct_->get_link_metadata(struct_); - - // Return type: string - CefString _retvalStr; - _retvalStr.AttachToUserFree(_retval); - return _retvalStr; -} - -CefString CefDragDataCToCpp::GetFragmentText() { - if (CEF_MEMBER_MISSING(struct_, get_fragment_text)) - return CefString(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_string_userfree_t _retval = struct_->get_fragment_text(struct_); - - // Return type: string - CefString _retvalStr; - _retvalStr.AttachToUserFree(_retval); - return _retvalStr; -} - -CefString CefDragDataCToCpp::GetFragmentHtml() { - if (CEF_MEMBER_MISSING(struct_, get_fragment_html)) - return CefString(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_string_userfree_t _retval = struct_->get_fragment_html(struct_); - - // Return type: string - CefString _retvalStr; - _retvalStr.AttachToUserFree(_retval); - return _retvalStr; -} - -CefString CefDragDataCToCpp::GetFragmentBaseURL() { - if (CEF_MEMBER_MISSING(struct_, get_fragment_base_url)) - return CefString(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_string_userfree_t _retval = struct_->get_fragment_base_url(struct_); - - // Return type: string - CefString _retvalStr; - _retvalStr.AttachToUserFree(_retval); - return _retvalStr; -} - -CefString CefDragDataCToCpp::GetFileExtension() { - if (CEF_MEMBER_MISSING(struct_, get_file_extension)) - return CefString(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_string_userfree_t _retval = struct_->get_file_extension(struct_); - - // Return type: string - CefString _retvalStr; - _retvalStr.AttachToUserFree(_retval); - return _retvalStr; -} - -CefString CefDragDataCToCpp::GetFileName() { - if (CEF_MEMBER_MISSING(struct_, get_file_name)) - return CefString(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_string_userfree_t _retval = struct_->get_file_name(struct_); - - // Return type: string - CefString _retvalStr; - _retvalStr.AttachToUserFree(_retval); - return _retvalStr; -} - -bool CefDragDataCToCpp::GetFileNames(std::vector& names) { - if (CEF_MEMBER_MISSING(struct_, get_file_names)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Translate param: names; type: string_vec_byref - cef_string_list_t namesList = cef_string_list_alloc(); - DCHECK(namesList); - if (namesList) - transfer_string_list_contents(names, namesList); - - // Execute - int _retval = struct_->get_file_names(struct_, - namesList); - - // Restore param:names; type: string_vec_byref - if (namesList) { - names.clear(); - transfer_string_list_contents(namesList, names); - cef_string_list_free(namesList); - } - - // Return type: bool - return _retval?true:false; -} - - -#ifndef NDEBUG -template<> long CefCToCpp::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/ctocpp/drag_data_ctocpp.h b/cef/libcef_dll/ctocpp/drag_data_ctocpp.h deleted file mode 100644 index d97f1cafd..000000000 --- a/cef/libcef_dll/ctocpp/drag_data_ctocpp.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CTOCPP_DRAG_DATA_CTOCPP_H_ -#define CEF_LIBCEF_DLL_CTOCPP_DRAG_DATA_CTOCPP_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include -#include "include/cef_drag_data.h" -#include "include/capi/cef_drag_data_capi.h" -#include "libcef_dll/ctocpp/ctocpp.h" - -// Wrap a C structure with a C++ class. -// This class may be instantiated and accessed wrapper-side only. -class CefDragDataCToCpp - : public CefCToCpp { - public: - explicit CefDragDataCToCpp(cef_drag_data_t* str) - : CefCToCpp(str) {} - virtual ~CefDragDataCToCpp() {} - - // CefDragData methods - virtual bool IsLink() OVERRIDE; - virtual bool IsFragment() OVERRIDE; - virtual bool IsFile() OVERRIDE; - virtual CefString GetLinkURL() OVERRIDE; - virtual CefString GetLinkTitle() OVERRIDE; - virtual CefString GetLinkMetadata() OVERRIDE; - virtual CefString GetFragmentText() OVERRIDE; - virtual CefString GetFragmentHtml() OVERRIDE; - virtual CefString GetFragmentBaseURL() OVERRIDE; - virtual CefString GetFileExtension() OVERRIDE; - virtual CefString GetFileName() OVERRIDE; - virtual bool GetFileNames(std::vector& names) OVERRIDE; -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CTOCPP_DRAG_DATA_CTOCPP_H_ - diff --git a/cef/libcef_dll/ctocpp/scheme_handler_callback_ctocpp.cc b/cef/libcef_dll/ctocpp/scheme_handler_callback_ctocpp.cc deleted file mode 100644 index 37773d592..000000000 --- a/cef/libcef_dll/ctocpp/scheme_handler_callback_ctocpp.cc +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/ctocpp/scheme_handler_callback_ctocpp.h" - - -// VIRTUAL METHODS - Body may be edited by hand. - -void CefSchemeHandlerCallbackCToCpp::HeadersAvailable() { - if (CEF_MEMBER_MISSING(struct_, headers_available)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->headers_available(struct_); -} - -void CefSchemeHandlerCallbackCToCpp::BytesAvailable() { - if (CEF_MEMBER_MISSING(struct_, bytes_available)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->bytes_available(struct_); -} - -void CefSchemeHandlerCallbackCToCpp::Cancel() { - if (CEF_MEMBER_MISSING(struct_, cancel)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->cancel(struct_); -} - - -#ifndef NDEBUG -template<> long CefCToCpp::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/ctocpp/scheme_handler_callback_ctocpp.h b/cef/libcef_dll/ctocpp/scheme_handler_callback_ctocpp.h deleted file mode 100644 index 27f069086..000000000 --- a/cef/libcef_dll/ctocpp/scheme_handler_callback_ctocpp.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CTOCPP_SCHEME_HANDLER_CALLBACK_CTOCPP_H_ -#define CEF_LIBCEF_DLL_CTOCPP_SCHEME_HANDLER_CALLBACK_CTOCPP_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include "include/cef_scheme.h" -#include "include/capi/cef_scheme_capi.h" -#include "libcef_dll/ctocpp/ctocpp.h" - -// Wrap a C structure with a C++ class. -// This class may be instantiated and accessed wrapper-side only. -class CefSchemeHandlerCallbackCToCpp - : public CefCToCpp { - public: - explicit CefSchemeHandlerCallbackCToCpp(cef_scheme_handler_callback_t* str) - : CefCToCpp(str) {} - virtual ~CefSchemeHandlerCallbackCToCpp() {} - - // CefSchemeHandlerCallback methods - virtual void HeadersAvailable() OVERRIDE; - virtual void BytesAvailable() OVERRIDE; - virtual void Cancel() OVERRIDE; -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CTOCPP_SCHEME_HANDLER_CALLBACK_CTOCPP_H_ - diff --git a/cef/libcef_dll/ctocpp/v8context_ctocpp.cc b/cef/libcef_dll/ctocpp/v8context_ctocpp.cc deleted file mode 100644 index ec2eca20b..000000000 --- a/cef/libcef_dll/ctocpp/v8context_ctocpp.cc +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/ctocpp/browser_ctocpp.h" -#include "libcef_dll/ctocpp/frame_ctocpp.h" -#include "libcef_dll/ctocpp/v8context_ctocpp.h" -#include "libcef_dll/ctocpp/v8value_ctocpp.h" - - -// STATIC METHODS - Body may be edited by hand. - -CefRefPtr CefV8Context::GetCurrentContext() { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_v8context_t* _retval = cef_v8context_get_current_context(); - - // Return type: refptr_same - return CefV8ContextCToCpp::Wrap(_retval); -} - -CefRefPtr CefV8Context::GetEnteredContext() { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_v8context_t* _retval = cef_v8context_get_entered_context(); - - // Return type: refptr_same - return CefV8ContextCToCpp::Wrap(_retval); -} - -bool CefV8Context::InContext() { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = cef_v8context_in_context(); - - // Return type: bool - return _retval?true:false; -} - - -// VIRTUAL METHODS - Body may be edited by hand. - -CefRefPtr CefV8ContextCToCpp::GetBrowser() { - if (CEF_MEMBER_MISSING(struct_, get_browser)) - return NULL; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_browser_t* _retval = struct_->get_browser(struct_); - - // Return type: refptr_same - return CefBrowserCToCpp::Wrap(_retval); -} - -CefRefPtr CefV8ContextCToCpp::GetFrame() { - if (CEF_MEMBER_MISSING(struct_, get_frame)) - return NULL; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_frame_t* _retval = struct_->get_frame(struct_); - - // Return type: refptr_same - return CefFrameCToCpp::Wrap(_retval); -} - -CefRefPtr CefV8ContextCToCpp::GetGlobal() { - if (CEF_MEMBER_MISSING(struct_, get_global)) - return NULL; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_v8value_t* _retval = struct_->get_global(struct_); - - // Return type: refptr_same - return CefV8ValueCToCpp::Wrap(_retval); -} - -bool CefV8ContextCToCpp::Enter() { - if (CEF_MEMBER_MISSING(struct_, enter)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = struct_->enter(struct_); - - // Return type: bool - return _retval?true:false; -} - -bool CefV8ContextCToCpp::Exit() { - if (CEF_MEMBER_MISSING(struct_, exit)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = struct_->exit(struct_); - - // Return type: bool - return _retval?true:false; -} - -bool CefV8ContextCToCpp::IsSame(CefRefPtr that) { - if (CEF_MEMBER_MISSING(struct_, is_same)) - return false; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: that; type: refptr_same - DCHECK(that.get()); - if (!that.get()) - return false; - - // Execute - int _retval = struct_->is_same(struct_, - CefV8ContextCToCpp::Unwrap(that)); - - // Return type: bool - return _retval?true:false; -} - - -#ifndef NDEBUG -template<> long CefCToCpp::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/ctocpp/web_urlrequest_ctocpp.cc b/cef/libcef_dll/ctocpp/web_urlrequest_ctocpp.cc deleted file mode 100644 index b99490e30..000000000 --- a/cef/libcef_dll/ctocpp/web_urlrequest_ctocpp.cc +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/web_urlrequest_client_cpptoc.h" -#include "libcef_dll/ctocpp/request_ctocpp.h" -#include "libcef_dll/ctocpp/web_urlrequest_ctocpp.h" - - -// STATIC METHODS - Body may be edited by hand. - -CefRefPtr CefWebURLRequest::CreateWebURLRequest( - CefRefPtr request, CefRefPtr client) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: request; type: refptr_same - DCHECK(request.get()); - if (!request.get()) - return NULL; - // Verify param: client; type: refptr_diff - DCHECK(client.get()); - if (!client.get()) - return NULL; - - // Execute - cef_web_urlrequest_t* _retval = cef_web_urlrequest_create( - CefRequestCToCpp::Unwrap(request), - CefWebURLRequestClientCppToC::Wrap(client)); - - // Return type: refptr_same - return CefWebURLRequestCToCpp::Wrap(_retval); -} - - -// VIRTUAL METHODS - Body may be edited by hand. - -void CefWebURLRequestCToCpp::Cancel() { - if (CEF_MEMBER_MISSING(struct_, cancel)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->cancel(struct_); -} - -CefWebURLRequest::RequestState CefWebURLRequestCToCpp::GetState() { - if (CEF_MEMBER_MISSING(struct_, get_state)) - return WUR_STATE_UNSENT; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_weburlrequest_state_t _retval = struct_->get_state(struct_); - - // Return type: simple - return _retval; -} - - -#ifndef NDEBUG -template<> long CefCToCpp::DebugObjCt = 0; -#endif - diff --git a/cef/libcef_dll/ctocpp/web_urlrequest_ctocpp.h b/cef/libcef_dll/ctocpp/web_urlrequest_ctocpp.h deleted file mode 100644 index 0a363fc01..000000000 --- a/cef/libcef_dll/ctocpp/web_urlrequest_ctocpp.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CTOCPP_WEB_URLREQUEST_CTOCPP_H_ -#define CEF_LIBCEF_DLL_CTOCPP_WEB_URLREQUEST_CTOCPP_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include "include/cef_web_urlrequest.h" -#include "include/capi/cef_web_urlrequest_capi.h" -#include "libcef_dll/ctocpp/ctocpp.h" - -// Wrap a C structure with a C++ class. -// This class may be instantiated and accessed wrapper-side only. -class CefWebURLRequestCToCpp - : public CefCToCpp { - public: - explicit CefWebURLRequestCToCpp(cef_web_urlrequest_t* str) - : CefCToCpp(str) {} - virtual ~CefWebURLRequestCToCpp() {} - - // CefWebURLRequest methods - virtual void Cancel() OVERRIDE; - virtual RequestState GetState() OVERRIDE; -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CTOCPP_WEB_URLREQUEST_CTOCPP_H_ - diff --git a/cef/libcef_dll/wrapper/libcef_dll_wrapper.cc b/cef/libcef_dll/wrapper/libcef_dll_wrapper.cc deleted file mode 100644 index 2b6d63da5..000000000 --- a/cef/libcef_dll/wrapper/libcef_dll_wrapper.cc +++ /dev/null @@ -1,529 +0,0 @@ -// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "include/cef_app.h" -#include "include/capi/cef_app_capi.h" -#include "include/cef_origin_whitelist.h" -#include "include/capi/cef_origin_whitelist_capi.h" -#include "include/cef_scheme.h" -#include "include/capi/cef_scheme_capi.h" -#include "include/cef_storage.h" -#include "include/capi/cef_storage_capi.h" -#include "include/cef_task.h" -#include "include/capi/cef_task_capi.h" -#include "include/cef_url.h" -#include "include/capi/cef_url_capi.h" -#include "include/cef_v8.h" -#include "include/capi/cef_v8_capi.h" -#include "include/cef_web_plugin.h" -#include "include/capi/cef_web_plugin_capi.h" -#include "include/cef_version.h" -#include "libcef_dll/cpptoc/app_cpptoc.h" -#include "libcef_dll/cpptoc/content_filter_cpptoc.h" -#include "libcef_dll/cpptoc/cookie_visitor_cpptoc.h" -#include "libcef_dll/cpptoc/domevent_listener_cpptoc.h" -#include "libcef_dll/cpptoc/domvisitor_cpptoc.h" -#include "libcef_dll/cpptoc/display_handler_cpptoc.h" -#include "libcef_dll/cpptoc/download_handler_cpptoc.h" -#include "libcef_dll/cpptoc/drag_handler_cpptoc.h" -#include "libcef_dll/cpptoc/find_handler_cpptoc.h" -#include "libcef_dll/cpptoc/focus_handler_cpptoc.h" -#include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h" -#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h" -#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h" -#include "libcef_dll/cpptoc/load_handler_cpptoc.h" -#include "libcef_dll/cpptoc/menu_handler_cpptoc.h" -#include "libcef_dll/cpptoc/permission_handler_cpptoc.h" -#include "libcef_dll/cpptoc/print_handler_cpptoc.h" -#include "libcef_dll/cpptoc/proxy_handler_cpptoc.h" -#include "libcef_dll/cpptoc/read_handler_cpptoc.h" -#include "libcef_dll/cpptoc/render_handler_cpptoc.h" -#include "libcef_dll/cpptoc/request_handler_cpptoc.h" -#include "libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h" -#include "libcef_dll/cpptoc/scheme_handler_cpptoc.h" -#include "libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h" -#include "libcef_dll/cpptoc/storage_visitor_cpptoc.h" -#include "libcef_dll/cpptoc/task_cpptoc.h" -#include "libcef_dll/cpptoc/v8accessor_cpptoc.h" -#include "libcef_dll/cpptoc/v8context_handler_cpptoc.h" -#include "libcef_dll/cpptoc/v8handler_cpptoc.h" -#include "libcef_dll/cpptoc/web_urlrequest_client_cpptoc.h" -#include "libcef_dll/cpptoc/write_handler_cpptoc.h" -#include "libcef_dll/ctocpp/browser_ctocpp.h" -#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h" -#include "libcef_dll/ctocpp/domdocument_ctocpp.h" -#include "libcef_dll/ctocpp/domevent_ctocpp.h" -#include "libcef_dll/ctocpp/domnode_ctocpp.h" -#include "libcef_dll/ctocpp/drag_data_ctocpp.h" -#include "libcef_dll/ctocpp/frame_ctocpp.h" -#include "libcef_dll/ctocpp/post_data_ctocpp.h" -#include "libcef_dll/ctocpp/post_data_element_ctocpp.h" -#include "libcef_dll/ctocpp/request_ctocpp.h" -#include "libcef_dll/ctocpp/response_ctocpp.h" -#include "libcef_dll/ctocpp/scheme_handler_callback_ctocpp.h" -#include "libcef_dll/ctocpp/stream_reader_ctocpp.h" -#include "libcef_dll/ctocpp/stream_writer_ctocpp.h" -#include "libcef_dll/ctocpp/v8context_ctocpp.h" -#include "libcef_dll/ctocpp/v8exception_ctocpp.h" -#include "libcef_dll/ctocpp/v8value_ctocpp.h" -#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h" -#include "libcef_dll/ctocpp/web_urlrequest_ctocpp.h" -#include "libcef_dll/ctocpp/xml_reader_ctocpp.h" -#include "libcef_dll/ctocpp/zip_reader_ctocpp.h" - -// Define used to facilitate parsing. -#define CEF_GLOBAL - - -// GLOBAL METHODS - Body may be edited by hand. - -CEF_GLOBAL bool CefInitialize(const CefSettings& settings, - CefRefPtr application) { - int build_revision = cef_build_revision(); - if (build_revision != CEF_REVISION) { - // The libcef build revision does not match the CEF API revision. - DCHECK(false); - return false; - } - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Unverified params: application - - // Execute - int _retval = cef_initialize( - &settings, - CefAppCppToC::Wrap(application)); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL void CefShutdown() { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_shutdown(); - -#ifndef NDEBUG - // Check that all wrapper objects have been destroyed - DCHECK_EQ(CefBrowserCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefContentFilterCppToC::DebugObjCt, 0); - DCHECK_EQ(CefCookieManagerCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefCookieVisitorCppToC::DebugObjCt, 0); - DCHECK_EQ(CefDOMDocumentCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefDOMEventCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefDOMEventListenerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefDOMNodeCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefDOMVisitorCppToC::DebugObjCt, 0); - DCHECK_EQ(CefDisplayHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefDownloadHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefDragDataCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefDragHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefFindHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefFocusHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefFrameCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefJSDialogHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefKeyboardHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefLifeSpanHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefLoadHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefMenuHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefPermissionHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefPostDataCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefPostDataElementCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefPrintHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefProxyHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefReadHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefRenderHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefRequestCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefRequestHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefResourceBundleHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefResponseCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefSchemeHandlerCallbackCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefSchemeHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefSchemeHandlerFactoryCppToC::DebugObjCt, 0); - DCHECK_EQ(CefStorageVisitorCppToC::DebugObjCt, 0); - DCHECK_EQ(CefStreamReaderCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefStreamWriterCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefTaskCppToC::DebugObjCt, 0); - DCHECK_EQ(CefV8AccessorCppToC::DebugObjCt, 0); - DCHECK_EQ(CefV8ContextCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefV8ContextHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefV8ExceptionCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefV8HandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefV8ValueCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefWebPluginInfoCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefWebURLRequestCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefWebURLRequestClientCppToC::DebugObjCt, 0); - DCHECK_EQ(CefWriteHandlerCppToC::DebugObjCt, 0); - DCHECK_EQ(CefXmlReaderCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefZipReaderCToCpp::DebugObjCt, 0); -#endif // !NDEBUG -} - -CEF_GLOBAL void CefDoMessageLoopWork() { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_do_message_loop_work(); -} - -CEF_GLOBAL void CefRunMessageLoop() { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_run_message_loop(); -} - -CEF_GLOBAL void CefQuitMessageLoop() { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_quit_message_loop(); -} - -CEF_GLOBAL bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin, - const CefString& target_protocol, const CefString& target_domain, - bool allow_target_subdomains) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: source_origin; type: string_byref_const - DCHECK(!source_origin.empty()); - if (source_origin.empty()) - return false; - // Verify param: target_protocol; type: string_byref_const - DCHECK(!target_protocol.empty()); - if (target_protocol.empty()) - return false; - // Verify param: target_domain; type: string_byref_const - DCHECK(!target_domain.empty()); - if (target_domain.empty()) - return false; - - // Execute - int _retval = cef_add_cross_origin_whitelist_entry( - source_origin.GetStruct(), - target_protocol.GetStruct(), - target_domain.GetStruct(), - allow_target_subdomains); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefRemoveCrossOriginWhitelistEntry( - const CefString& source_origin, const CefString& target_protocol, - const CefString& target_domain, bool allow_target_subdomains) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: source_origin; type: string_byref_const - DCHECK(!source_origin.empty()); - if (source_origin.empty()) - return false; - // Verify param: target_protocol; type: string_byref_const - DCHECK(!target_protocol.empty()); - if (target_protocol.empty()) - return false; - // Verify param: target_domain; type: string_byref_const - DCHECK(!target_domain.empty()); - if (target_domain.empty()) - return false; - - // Execute - int _retval = cef_remove_cross_origin_whitelist_entry( - source_origin.GetStruct(), - target_protocol.GetStruct(), - target_domain.GetStruct(), - allow_target_subdomains); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefClearCrossOriginWhitelist() { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = cef_clear_cross_origin_whitelist(); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefRegisterCustomScheme(const CefString& scheme_name, - bool is_standard, bool is_local, bool is_display_isolated) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: scheme_name; type: string_byref_const - DCHECK(!scheme_name.empty()); - if (scheme_name.empty()) - return false; - - // Execute - int _retval = cef_register_custom_scheme( - scheme_name.GetStruct(), - is_standard, - is_local, - is_display_isolated); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefRegisterSchemeHandlerFactory(const CefString& scheme_name, - const CefString& domain_name, - CefRefPtr factory) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: scheme_name; type: string_byref_const - DCHECK(!scheme_name.empty()); - if (scheme_name.empty()) - return false; - // Unverified params: domain_name, factory - - // Execute - int _retval = cef_register_scheme_handler_factory( - scheme_name.GetStruct(), - domain_name.GetStruct(), - CefSchemeHandlerFactoryCppToC::Wrap(factory)); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefClearSchemeHandlerFactories() { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = cef_clear_scheme_handler_factories(); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefVisitStorage(CefStorageType type, const CefString& origin, - const CefString& key, CefRefPtr visitor) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: visitor; type: refptr_diff - DCHECK(visitor.get()); - if (!visitor.get()) - return false; - // Unverified params: origin, key - - // Execute - int _retval = cef_visit_storage( - type, - origin.GetStruct(), - key.GetStruct(), - CefStorageVisitorCppToC::Wrap(visitor)); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefSetStorage(CefStorageType type, const CefString& origin, - const CefString& key, const CefString& value) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: origin; type: string_byref_const - DCHECK(!origin.empty()); - if (origin.empty()) - return false; - // Verify param: key; type: string_byref_const - DCHECK(!key.empty()); - if (key.empty()) - return false; - // Verify param: value; type: string_byref_const - DCHECK(!value.empty()); - if (value.empty()) - return false; - - // Execute - int _retval = cef_set_storage( - type, - origin.GetStruct(), - key.GetStruct(), - value.GetStruct()); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefDeleteStorage(CefStorageType type, const CefString& origin, - const CefString& key) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Unverified params: origin, key - - // Execute - int _retval = cef_delete_storage( - type, - origin.GetStruct(), - key.GetStruct()); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefSetStoragePath(CefStorageType type, const CefString& path) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Unverified params: path - - // Execute - int _retval = cef_set_storage_path( - type, - path.GetStruct()); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefCurrentlyOn(CefThreadId threadId) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = cef_currently_on( - threadId); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefPostTask(CefThreadId threadId, CefRefPtr task) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: task; type: refptr_diff - DCHECK(task.get()); - if (!task.get()) - return false; - - // Execute - int _retval = cef_post_task( - threadId, - CefTaskCppToC::Wrap(task)); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefPostDelayedTask(CefThreadId threadId, - CefRefPtr task, int64 delay_ms) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: task; type: refptr_diff - DCHECK(task.get()); - if (!task.get()) - return false; - - // Execute - int _retval = cef_post_delayed_task( - threadId, - CefTaskCppToC::Wrap(task), - delay_ms); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefParseURL(const CefString& url, CefURLParts& parts) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: url; type: string_byref_const - DCHECK(!url.empty()); - if (url.empty()) - return false; - - // Execute - int _retval = cef_parse_url( - url.GetStruct(), - &parts); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefCreateURL(const CefURLParts& parts, CefString& url) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = cef_create_url( - &parts, - url.GetWritableStruct()); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL bool CefRegisterExtension(const CefString& extension_name, - const CefString& javascript_code, CefRefPtr handler) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: extension_name; type: string_byref_const - DCHECK(!extension_name.empty()); - if (extension_name.empty()) - return false; - // Verify param: javascript_code; type: string_byref_const - DCHECK(!javascript_code.empty()); - if (javascript_code.empty()) - return false; - // Unverified params: handler - - // Execute - int _retval = cef_register_extension( - extension_name.GetStruct(), - javascript_code.GetStruct(), - CefV8HandlerCppToC::Wrap(handler)); - - // Return type: bool - return _retval?true:false; -} - -CEF_GLOBAL size_t CefGetWebPluginCount() { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - size_t _retval = cef_get_web_plugin_count(); - - // Return type: simple - return _retval; -} - -CEF_GLOBAL CefRefPtr CefGetWebPluginInfo(int index) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_web_plugin_info_t* _retval = cef_get_web_plugin_info( - index); - - // Return type: refptr_same - return CefWebPluginInfoCToCpp::Wrap(_retval); -} - -CEF_GLOBAL CefRefPtr CefGetWebPluginInfo( - const CefString& name) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: name; type: string_byref_const - DCHECK(!name.empty()); - if (name.empty()) - return NULL; - - // Execute - cef_web_plugin_info_t* _retval = cef_get_web_plugin_info_byname( - name.GetStruct()); - - // Return type: refptr_same - return CefWebPluginInfoCToCpp::Wrap(_retval); -} - diff --git a/cef/libcef_dll/wrapper/libcef_dll_wrapper2.cc b/cef/libcef_dll/wrapper/libcef_dll_wrapper2.cc deleted file mode 100644 index cb34a0a55..000000000 --- a/cef/libcef_dll/wrapper/libcef_dll_wrapper2.cc +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. - -#include "include/cef_nplugin.h" -#include "include/capi/cef_nplugin_capi.h" - -bool CefRegisterPlugin(const CefPluginInfo& plugin_info) { - return cef_register_plugin(&plugin_info)?true:false; -} diff --git a/cef/tools/README-TRANSFER.txt b/cef/tools/README-TRANSFER.txt deleted file mode 100644 index b49d72db1..000000000 --- a/cef/tools/README-TRANSFER.txt +++ /dev/null @@ -1,9 +0,0 @@ -Files in this directory have been copied from other locations in the Chromium -source tree. They have been modified only to the extent necessary to work in -the CEF Binary Distribution directory structure. Below is a listing of the -original file locations. - -../build/mac/change_mach_o_flags_from_xcode.sh -../build/mac/change_mach_o_flags.py -../build/mac/strip_from_xcode -../build/mac/strip_save_dsym diff --git a/cef/tools/change_mach_o_flags.py b/cef/tools/change_mach_o_flags.py deleted file mode 100755 index c2aeaec9b..000000000 --- a/cef/tools/change_mach_o_flags.py +++ /dev/null @@ -1,273 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2011 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Usage: change_mach_o_flags.py [--executable-heap] [--no-pie] - -Arranges for the executable at |executable_path| to have its data (heap) -pages protected to prevent execution on Mac OS X 10.7 ("Lion"), and to have -the PIE (position independent executable) bit set to enable ASLR (address -space layout randomization). With --executable-heap or --no-pie, the -respective bits are cleared instead of set, making the heap executable or -disabling PIE/ASLR. - -This script is able to operate on thin (single-architecture) Mach-O files -and fat (universal, multi-architecture) files. When operating on fat files, -it will set or clear the bits for each architecture contained therein. - -NON-EXECUTABLE HEAP - -Traditionally in Mac OS X, 32-bit processes did not have data pages set to -prohibit execution. Although user programs could call mprotect and -mach_vm_protect to deny execution of code in data pages, the kernel would -silently ignore such requests without updating the page tables, and the -hardware would happily execute code on such pages. 64-bit processes were -always given proper hardware protection of data pages. This behavior was -controllable on a system-wide level via the vm.allow_data_exec sysctl, which -is set by default to 1. The bit with value 1 (set by default) allows code -execution on data pages for 32-bit processes, and the bit with value 2 -(clear by default) does the same for 64-bit processes. - -In Mac OS X 10.7, executables can "opt in" to having hardware protection -against code execution on data pages applied. This is done by setting a new -bit in the |flags| field of an executable's |mach_header|. When -MH_NO_HEAP_EXECUTION is set, proper protections will be applied, regardless -of the setting of vm.allow_data_exec. See xnu-1699.22.73/osfmk/vm/vm_map.c -override_nx and xnu-1699.22.73/bsd/kern/mach_loader.c load_machfile. - -The Apple toolchain has been revised to set the MH_NO_HEAP_EXECUTION when -producing executables, provided that -allow_heap_execute is not specified -at link time. Only linkers shipping with Xcode 4.0 and later (ld64-123.2 and -later) have this ability. See ld64-123.2.1/src/ld/Options.cpp -Options::reconfigureDefaults() and -ld64-123.2.1/src/ld/HeaderAndLoadCommands.hpp -HeaderAndLoadCommandsAtom::flags(). - -This script sets the MH_NO_HEAP_EXECUTION bit on Mach-O executables. It is -intended for use with executables produced by a linker that predates Apple's -modifications to set this bit itself. It is also useful for setting this bit -for non-i386 executables, including x86_64 executables. Apple's linker only -sets it for 32-bit i386 executables, presumably under the assumption that -the value of vm.allow_data_exec is set in stone. However, if someone were to -change vm.allow_data_exec to 2 or 3, 64-bit x86_64 executables would run -without hardware protection against code execution on data pages. This -script can set the bit for x86_64 executables, guaranteeing that they run -with appropriate protection even when vm.allow_data_exec has been tampered -with. - -POSITION-INDEPENDENT EXECUTABLES/ADDRESS SPACE LAYOUT RANDOMIZATION - -This script sets or clears the MH_PIE bit in an executable's Mach-O header, -enabling or disabling position independence on Mac OS X 10.5 and later. -Processes running position-independent executables have varying levels of -ASLR protection depending on the OS release. The main executable's load -address, shared library load addresess, and the heap and stack base -addresses may be randomized. Position-independent executables are produced -by supplying the -pie flag to the linker (or defeated by supplying -no_pie). -Executables linked with a deployment target of 10.7 or higher have PIE on -by default. - -This script is never strictly needed during the build to enable PIE, as all -linkers used are recent enough to support -pie. However, it's used to -disable the PIE bit as needed on already-linked executables. -""" - -import optparse -import os -import struct -import sys - - -# -FAT_MAGIC = 0xcafebabe -FAT_CIGAM = 0xbebafeca - -# -MH_MAGIC = 0xfeedface -MH_CIGAM = 0xcefaedfe -MH_MAGIC_64 = 0xfeedfacf -MH_CIGAM_64 = 0xcffaedfe -MH_EXECUTE = 0x2 -MH_PIE = 0x00200000 -MH_NO_HEAP_EXECUTION = 0x01000000 - - -class MachOError(Exception): - """A class for exceptions thrown by this module.""" - - pass - - -def CheckedSeek(file, offset): - """Seeks the file-like object at |file| to offset |offset| and raises a - MachOError if anything funny happens.""" - - file.seek(offset, os.SEEK_SET) - new_offset = file.tell() - if new_offset != offset: - raise MachOError, \ - 'seek: expected offset %d, observed %d' % (offset, new_offset) - - -def CheckedRead(file, count): - """Reads |count| bytes from the file-like |file| object, raising a - MachOError if any other number of bytes is read.""" - - bytes = file.read(count) - if len(bytes) != count: - raise MachOError, \ - 'read: expected length %d, observed %d' % (count, len(bytes)) - - return bytes - - -def ReadUInt32(file, endian): - """Reads an unsinged 32-bit integer from the file-like |file| object, - treating it as having endianness specified by |endian| (per the |struct| - module), and returns it as a number. Raises a MachOError if the proper - length of data can't be read from |file|.""" - - bytes = CheckedRead(file, 4) - - (uint32,) = struct.unpack(endian + 'I', bytes) - return uint32 - - -def ReadMachHeader(file, endian): - """Reads an entire |mach_header| structure () from the - file-like |file| object, treating it as having endianness specified by - |endian| (per the |struct| module), and returns a 7-tuple of its members - as numbers. Raises a MachOError if the proper length of data can't be read - from |file|.""" - - bytes = CheckedRead(file, 28) - - magic, cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags = \ - struct.unpack(endian + '7I', bytes) - return magic, cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags - - -def ReadFatArch(file): - """Reads an entire |fat_arch| structure () from the file-like - |file| object, treating it as having endianness specified by |endian| - (per the |struct| module), and returns a 5-tuple of its members as numbers. - Raises a MachOError if the proper length of data can't be read from - |file|.""" - - bytes = CheckedRead(file, 20) - - cputype, cpusubtype, offset, size, align = struct.unpack('>5I', bytes) - return cputype, cpusubtype, offset, size, align - - -def WriteUInt32(file, uint32, endian): - """Writes |uint32| as an unsinged 32-bit integer to the file-like |file| - object, treating it as having endianness specified by |endian| (per the - |struct| module).""" - - bytes = struct.pack(endian + 'I', uint32) - assert len(bytes) == 4 - - file.write(bytes) - - -def HandleMachOFile(file, options, offset=0): - """Seeks the file-like |file| object to |offset|, reads its |mach_header|, - and rewrites the header's |flags| field if appropriate. The header's - endianness is detected. Both 32-bit and 64-bit Mach-O headers are supported - (mach_header and mach_header_64). Raises MachOError if used on a header that - does not have a known magic number or is not of type MH_EXECUTE. The - MH_PIE and MH_NO_HEAP_EXECUTION bits are set or cleared in the |flags| field - according to |options| and written to |file| if any changes need to be made. - If already set or clear as specified by |options|, nothing is written.""" - - CheckedSeek(file, offset) - magic = ReadUInt32(file, '<') - if magic == MH_MAGIC or magic == MH_MAGIC_64: - endian = '<' - elif magic == MH_CIGAM or magic == MH_CIGAM_64: - endian = '>' - else: - raise MachOError, \ - 'Mach-O file at offset %d has illusion of magic' % offset - - CheckedSeek(file, offset) - magic, cputype, cpusubtype, filetype, ncmds, sizeofcmds, flags = \ - ReadMachHeader(file, endian) - assert magic == MH_MAGIC or magic == MH_MAGIC_64 - if filetype != MH_EXECUTE: - raise MachOError, \ - 'Mach-O file at offset %d is type 0x%x, expected MH_EXECUTE' % \ - (offset, filetype) - - original_flags = flags - - if options.no_heap_execution: - flags |= MH_NO_HEAP_EXECUTION - else: - flags &= ~MH_NO_HEAP_EXECUTION - - if options.pie: - flags |= MH_PIE - else: - flags &= ~MH_PIE - - if flags != original_flags: - CheckedSeek(file, offset + 24) - WriteUInt32(file, flags, endian) - - -def HandleFatFile(file, options, fat_offset=0): - """Seeks the file-like |file| object to |offset| and loops over its - |fat_header| entries, calling HandleMachOFile for each.""" - - CheckedSeek(file, fat_offset) - magic = ReadUInt32(file, '>') - assert magic == FAT_MAGIC - - nfat_arch = ReadUInt32(file, '>') - - for index in xrange(0, nfat_arch): - cputype, cpusubtype, offset, size, align = ReadFatArch(file) - assert size >= 28 - - # HandleMachOFile will seek around. Come back here after calling it, in - # case it sought. - fat_arch_offset = file.tell() - HandleMachOFile(file, options, offset) - CheckedSeek(file, fat_arch_offset) - - -def main(me, args): - parser = optparse.OptionParser('%prog [options] ') - parser.add_option('--executable-heap', action='store_false', - dest='no_heap_execution', default=True, - help='Clear the MH_NO_HEAP_EXECUTION bit') - parser.add_option('--no-pie', action='store_false', - dest='pie', default=True, - help='Clear the MH_PIE bit') - (options, loose_args) = parser.parse_args(args) - if len(loose_args) != 1: - parser.print_usage() - return 1 - - executable_path = loose_args[0] - executable_file = open(executable_path, 'rb+') - - magic = ReadUInt32(executable_file, '<') - if magic == FAT_CIGAM: - # Check FAT_CIGAM and not FAT_MAGIC because the read was little-endian. - HandleFatFile(executable_file, options) - elif magic == MH_MAGIC or magic == MH_CIGAM or \ - magic == MH_MAGIC_64 or magic == MH_CIGAM_64: - HandleMachOFile(executable_file, options) - else: - raise MachOError, '%s is not a Mach-O or fat file' % executable_file - - executable_file.close() - return 0 - - -if __name__ == '__main__': - sys.exit(main(sys.argv[0], sys.argv[1:])) diff --git a/cef/tools/change_mach_o_flags_from_xcode.sh b/cef/tools/change_mach_o_flags_from_xcode.sh deleted file mode 100755 index 1824f8db5..000000000 --- a/cef/tools/change_mach_o_flags_from_xcode.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2011 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This is a small wrapper script around change_mach_o_flags.py allowing it to -# be invoked easily from Xcode. change_mach_o_flags.py expects its arguments -# on the command line, but Xcode puts its parameters in the environment. - -set -e - -exec "$(dirname "${0}")/change_mach_o_flags.py" \ - "${@}" \ - "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" diff --git a/cef/tools/strip_from_xcode b/cef/tools/strip_from_xcode deleted file mode 100755 index c26b9fb49..000000000 --- a/cef/tools/strip_from_xcode +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2008 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This is a handy wrapper script that figures out how to call the strip -# utility (strip_save_dsym in this case), if it even needs to be called at all, -# and then does it. This script should be called by a post-link phase in -# targets that might generate Mach-O executables, dynamic libraries, or -# loadable bundles. -# -# An example "Strip If Needed" build phase placed after "Link Binary With -# Libraries" would do: -# exec "${XCODEPROJ_DEPTH}/build/mac/strip_from_xcode" - -if [ "${CONFIGURATION}" != "Release" ] ; then - # Only strip in release mode. - exit 0 -fi - -declare -a FLAGS - -# MACH_O_TYPE is not set for a command-line tool, so check PRODUCT_TYPE too. -# Weird. -if [ "${MACH_O_TYPE}" = "mh_execute" ] || \ - [ "${PRODUCT_TYPE}" = "com.apple.product-type.tool" ] ; then - # Strip everything (no special flags). No-op. - true -elif [ "${MACH_O_TYPE}" = "mh_dylib" ] || \ - [ "${MACH_O_TYPE}" = "mh_bundle" ]; then - # Strip debugging symbols and local symbols - FLAGS[${#FLAGS[@]}]=-S - FLAGS[${#FLAGS[@]}]=-x -elif [ "${MACH_O_TYPE}" = "staticlib" ] ; then - # Don't strip static libraries. - exit 0 -else - # Warn, but don't treat this as an error. - echo $0: warning: unrecognized MACH_O_TYPE ${MACH_O_TYPE} - exit 0 -fi - -if [ -n "${STRIPFLAGS}" ] ; then - # Pick up the standard STRIPFLAGS Xcode setting, used for "Additional Strip - # Flags". - for stripflag in "${STRIPFLAGS}" ; do - FLAGS[${#FLAGS[@]}]="${stripflag}" - done -fi - -if [ -n "${CHROMIUM_STRIP_SAVE_FILE}" ] ; then - # An Xcode project can communicate a file listing symbols to saved in this - # environment variable by setting it as a build setting. This isn't a - # standard Xcode setting. It's used in preference to STRIPFLAGS to - # eliminate quoting ambiguity concerns. - FLAGS[${#FLAGS[@]}]=-s - FLAGS[${#FLAGS[@]}]="${CHROMIUM_STRIP_SAVE_FILE}" -fi - -exec "$(dirname ${0})/strip_save_dsym" "${FLAGS[@]}" \ - "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" diff --git a/cef/tools/strip_save_dsym b/cef/tools/strip_save_dsym deleted file mode 100755 index a132379d8..000000000 --- a/cef/tools/strip_save_dsym +++ /dev/null @@ -1,341 +0,0 @@ -#!/usr/bin/python - -# Copyright (c) 2011 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Usage: strip_save_dsym -# -# strip_save_dsym is a wrapper around the standard strip utility. Given an -# input Mach-O file, strip_save_dsym will save a copy of the file in a "fake" -# .dSYM bundle for debugging, and then call strip to strip the Mach-O file. -# Note that the .dSYM file is a "fake" in that it's not a self-contained -# .dSYM bundle, it just contains a copy of the original (unstripped) Mach-O -# file, and therefore contains references to object files on the filesystem. -# The generated .dSYM bundle is therefore unsuitable for debugging in the -# absence of these .o files. -# -# If a .dSYM already exists and has a newer timestamp than the Mach-O file, -# this utility does nothing. That allows strip_save_dsym to be run on a file -# that has already been stripped without trashing the .dSYM. -# -# Rationale: the "right" way to generate dSYM bundles, dsymutil, is incredibly -# slow. On the other hand, doing a file copy (which is really all that -# dsymutil does) is comparatively fast. Since we usually just want to strip -# a release-mode executable but still be able to debug it, and we don't care -# so much about generating a hermetic dSYM bundle, we'll prefer the file copy. -# If a real dSYM is ever needed, it's still possible to create one by running -# dsymutil and pointing it at the original Mach-O file inside the "fake" -# bundle, provided that the object files are available. - -import errno -import os -import re -import shutil -import subprocess -import sys -import time - -# Returns a list of architectures contained in a Mach-O file. The file can be -# a universal (fat) file, in which case there will be one list element for -# each contained architecture, or it can be a thin single-architecture Mach-O -# file, in which case the list will contain a single element identifying the -# architecture. On error, returns an empty list. Determines the architecture -# list by calling file. -def macho_archs(macho): - macho_types = ["executable", - "dynamically linked shared library", - "bundle"] - macho_types_re = "Mach-O (?:64-bit )?(?:" + "|".join(macho_types) + ")" - - file_cmd = subprocess.Popen(["/usr/bin/file", "-b", "-L", "--", macho], - stdout=subprocess.PIPE) - - archs = [] - - type_line = file_cmd.stdout.readline() - type_match = re.match("^%s (.*)$" % macho_types_re, type_line) - if type_match: - archs.append(type_match.group(1)) - return [type_match.group(1)] - else: - type_match = re.match("^Mach-O universal binary with (.*) architectures$", - type_line) - if type_match: - for i in range(0, int(type_match.group(1))): - arch_line = file_cmd.stdout.readline() - arch_match = re.match( - "^.* \(for architecture (.*)\):\t%s .*$" % macho_types_re, - arch_line) - if arch_match: - archs.append(arch_match.group(1)) - - if file_cmd.wait() != 0: - archs = [] - - if len(archs) == 0: - print >> sys.stderr, "No architectures in %s" % macho - - return archs - -# Returns a dictionary mapping architectures contained in the file as returned -# by macho_archs to the LC_UUID load command for that architecture. -# Architectures with no LC_UUID load command are omitted from the dictionary. -# Determines the UUID value by calling otool. -def macho_uuids(macho): - uuids = {} - - archs = macho_archs(macho) - if len(archs) == 0: - return uuids - - for arch in archs: - if arch == "": - continue - - otool_cmd = subprocess.Popen(["/usr/bin/otool", "-arch", arch, "-l", "-", - macho], - stdout=subprocess.PIPE) - # state 0 is when nothing UUID-related has been seen yet. State 1 is - # entered after a load command begins, but it may not be an LC_UUID load - # command. States 2, 3, and 4 are intermediate states while reading an - # LC_UUID command. State 5 is the terminal state for a successful LC_UUID - # read. State 6 is the error state. - state = 0 - uuid = "" - for otool_line in otool_cmd.stdout: - if state == 0: - if re.match("^Load command .*$", otool_line): - state = 1 - elif state == 1: - if re.match("^ cmd LC_UUID$", otool_line): - state = 2 - else: - state = 0 - elif state == 2: - if re.match("^ cmdsize 24$", otool_line): - state = 3 - else: - state = 6 - elif state == 3: - # The UUID display format changed in the version of otool shipping - # with the Xcode 3.2.2 prerelease. The new format is traditional: - # uuid 4D7135B2-9C56-C5F5-5F49-A994258E0955 - # and with Xcode 3.2.6, then line is indented one more space: - # uuid 4D7135B2-9C56-C5F5-5F49-A994258E0955 - # The old format, from cctools-750 and older's otool, breaks the UUID - # up into a sequence of bytes: - # uuid 0x4d 0x71 0x35 0xb2 0x9c 0x56 0xc5 0xf5 - # 0x5f 0x49 0xa9 0x94 0x25 0x8e 0x09 0x55 - new_uuid_match = re.match("^ {3,4}uuid (.{8}-.{4}-.{4}-.{4}-.{12})$", - otool_line) - if new_uuid_match: - uuid = new_uuid_match.group(1) - - # Skip state 4, there is no second line to read. - state = 5 - else: - old_uuid_match = re.match("^ uuid 0x(..) 0x(..) 0x(..) 0x(..) " - "0x(..) 0x(..) 0x(..) 0x(..)$", - otool_line) - if old_uuid_match: - state = 4 - uuid = old_uuid_match.group(1) + old_uuid_match.group(2) + \ - old_uuid_match.group(3) + old_uuid_match.group(4) + "-" + \ - old_uuid_match.group(5) + old_uuid_match.group(6) + "-" + \ - old_uuid_match.group(7) + old_uuid_match.group(8) + "-" - else: - state = 6 - elif state == 4: - old_uuid_match = re.match("^ 0x(..) 0x(..) 0x(..) 0x(..) " - "0x(..) 0x(..) 0x(..) 0x(..)$", - otool_line) - if old_uuid_match: - state = 5 - uuid += old_uuid_match.group(1) + old_uuid_match.group(2) + "-" + \ - old_uuid_match.group(3) + old_uuid_match.group(4) + \ - old_uuid_match.group(5) + old_uuid_match.group(6) + \ - old_uuid_match.group(7) + old_uuid_match.group(8) - else: - state = 6 - - if otool_cmd.wait() != 0: - state = 6 - - if state == 5: - uuids[arch] = uuid.upper() - - if len(uuids) == 0: - print >> sys.stderr, "No UUIDs in %s" % macho - - return uuids - -# Given a path to a Mach-O file and possible information from the environment, -# determines the desired path to the .dSYM. -def dsym_path(macho): - # If building a bundle, the .dSYM should be placed next to the bundle. Use - # WRAPPER_NAME to make this determination. If called from xcodebuild, - # WRAPPER_NAME will be set to the name of the bundle. - dsym = "" - if "WRAPPER_NAME" in os.environ: - if "BUILT_PRODUCTS_DIR" in os.environ: - dsym = os.path.join(os.environ["BUILT_PRODUCTS_DIR"], - os.environ["WRAPPER_NAME"]) - else: - dsym = os.environ["WRAPPER_NAME"] - else: - dsym = macho - - dsym += ".dSYM" - - return dsym - -# Creates a fake .dSYM bundle at dsym for macho, a Mach-O image with the -# architectures and UUIDs specified by the uuids map. -def make_fake_dsym(macho, dsym): - uuids = macho_uuids(macho) - if len(uuids) == 0: - return False - - dwarf_dir = os.path.join(dsym, "Contents", "Resources", "DWARF") - dwarf_file = os.path.join(dwarf_dir, os.path.basename(macho)) - try: - os.makedirs(dwarf_dir) - except OSError, (err, error_string): - if err != errno.EEXIST: - raise - shutil.copyfile(macho, dwarf_file) - - # info_template is the same as what dsymutil would have written, with the - # addition of the fake_dsym key. - info_template = \ -''' - - - - CFBundleDevelopmentRegion - English - CFBundleIdentifier - com.apple.xcode.dsym.%(root_name)s - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - dSYM - CFBundleSignature - ???? - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - dSYM_UUID - -%(uuid_dict)s - fake_dsym - - - -''' - - root_name = os.path.basename(dsym)[:-5] # whatever.dSYM without .dSYM - uuid_dict = "" - for arch in sorted(uuids): - uuid_dict += "\t\t\t" + arch + "\n"\ - "\t\t\t" + uuids[arch] + "\n" - info_dict = { - "root_name": root_name, - "uuid_dict": uuid_dict, - } - info_contents = info_template % info_dict - info_file = os.path.join(dsym, "Contents", "Info.plist") - info_fd = open(info_file, "w") - info_fd.write(info_contents) - info_fd.close() - - return True - -# For a Mach-O file, determines where the .dSYM bundle should be located. If -# the bundle does not exist or has a modification time older than the Mach-O -# file, calls make_fake_dsym to create a fake .dSYM bundle there, then strips -# the Mach-O file and sets the modification time on the .dSYM bundle and Mach-O -# file to be identical. -def strip_and_make_fake_dsym(macho): - dsym = dsym_path(macho) - macho_stat = os.stat(macho) - dsym_stat = None - try: - dsym_stat = os.stat(dsym) - except OSError, (err, error_string): - if err != errno.ENOENT: - raise - - if dsym_stat is None or dsym_stat.st_mtime < macho_stat.st_mtime: - # Make a .dSYM bundle - if not make_fake_dsym(macho, dsym): - return False - - # Strip the Mach-O file - remove_dsym = True - try: - strip_path = "" - if "SYSTEM_DEVELOPER_BIN_DIR" in os.environ: - strip_path = os.environ["SYSTEM_DEVELOPER_BIN_DIR"] - else: - strip_path = "/usr/bin" - strip_path = os.path.join(strip_path, "strip") - strip_cmdline = [strip_path] + sys.argv[1:] - strip_cmd = subprocess.Popen(strip_cmdline) - if strip_cmd.wait() == 0: - remove_dsym = False - finally: - if remove_dsym: - shutil.rmtree(dsym) - - # Update modification time on the Mach-O file and .dSYM bundle - now = time.time() - os.utime(macho, (now, now)) - os.utime(dsym, (now, now)) - - return True - -def main(argv=None): - if argv is None: - argv = sys.argv - - # This only supports operating on one file at a time. Look at the arguments - # to strip to figure out what the source to be stripped is. Arguments are - # processed in the same way that strip does, although to reduce complexity, - # this doesn't do all of the same checking as strip. For example, strip - # has no -Z switch and would treat -Z on the command line as an error. For - # the purposes this is needed for, that's fine. - macho = None - process_switches = True - ignore_argument = False - for arg in argv[1:]: - if ignore_argument: - ignore_argument = False - continue - if process_switches: - if arg == "-": - process_switches = False - # strip has these switches accept an argument: - if arg in ["-s", "-R", "-d", "-o", "-arch"]: - ignore_argument = True - if arg[0] == "-": - continue - if macho is None: - macho = arg - else: - print >> sys.stderr, "Too many things to strip" - return 1 - - if macho is None: - print >> sys.stderr, "Nothing to strip" - return 1 - - if not strip_and_make_fake_dsym(macho): - return 1 - - return 0 - -if __name__ == "__main__": - sys.exit(main(sys.argv)) diff --git a/cef_paths.gypi b/cef_paths.gypi new file mode 100644 index 000000000..a450bd61c --- /dev/null +++ b/cef_paths.gypi @@ -0,0 +1,363 @@ +# Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. +# +# --------------------------------------------------------------------------- +# +# This file was generated by the CEF translator tool and should not edited +# by hand. See the translator.README.txt file in the tools directory for +# more information. +# + +{ + 'variables': { + 'autogen_cpp_includes': [ + 'include/cef_app.h', + 'include/cef_browser.h', + 'include/cef_browser_process_handler.h', + 'include/cef_callback.h', + 'include/cef_client.h', + 'include/cef_command_line.h', + 'include/cef_context_menu_handler.h', + 'include/cef_cookie.h', + 'include/cef_display_handler.h', + 'include/cef_dom.h', + 'include/cef_download_handler.h', + 'include/cef_download_item.h', + 'include/cef_focus_handler.h', + 'include/cef_frame.h', + 'include/cef_geolocation_handler.h', + 'include/cef_jsdialog_handler.h', + 'include/cef_keyboard_handler.h', + 'include/cef_life_span_handler.h', + 'include/cef_load_handler.h', + 'include/cef_menu_model.h', + 'include/cef_origin_whitelist.h', + 'include/cef_path_util.h', + 'include/cef_process_message.h', + 'include/cef_process_util.h', + 'include/cef_proxy_handler.h', + 'include/cef_render_process_handler.h', + 'include/cef_request.h', + 'include/cef_request_handler.h', + 'include/cef_resource_bundle_handler.h', + 'include/cef_resource_handler.h', + 'include/cef_response.h', + 'include/cef_scheme.h', + 'include/cef_stream.h', + 'include/cef_string_visitor.h', + 'include/cef_task.h', + 'include/cef_url.h', + 'include/cef_urlrequest.h', + 'include/cef_v8.h', + 'include/cef_values.h', + 'include/cef_web_plugin.h', + 'include/cef_xml_reader.h', + 'include/cef_zip_reader.h', + ], + 'autogen_capi_includes': [ + 'include/capi/cef_app_capi.h', + 'include/capi/cef_browser_capi.h', + 'include/capi/cef_browser_process_handler_capi.h', + 'include/capi/cef_callback_capi.h', + 'include/capi/cef_client_capi.h', + 'include/capi/cef_command_line_capi.h', + 'include/capi/cef_context_menu_handler_capi.h', + 'include/capi/cef_cookie_capi.h', + 'include/capi/cef_display_handler_capi.h', + 'include/capi/cef_dom_capi.h', + 'include/capi/cef_download_handler_capi.h', + 'include/capi/cef_download_item_capi.h', + 'include/capi/cef_focus_handler_capi.h', + 'include/capi/cef_frame_capi.h', + 'include/capi/cef_geolocation_handler_capi.h', + 'include/capi/cef_jsdialog_handler_capi.h', + 'include/capi/cef_keyboard_handler_capi.h', + 'include/capi/cef_life_span_handler_capi.h', + 'include/capi/cef_load_handler_capi.h', + 'include/capi/cef_menu_model_capi.h', + 'include/capi/cef_origin_whitelist_capi.h', + 'include/capi/cef_path_util_capi.h', + 'include/capi/cef_process_message_capi.h', + 'include/capi/cef_process_util_capi.h', + 'include/capi/cef_proxy_handler_capi.h', + 'include/capi/cef_render_process_handler_capi.h', + 'include/capi/cef_request_capi.h', + 'include/capi/cef_request_handler_capi.h', + 'include/capi/cef_resource_bundle_handler_capi.h', + 'include/capi/cef_resource_handler_capi.h', + 'include/capi/cef_response_capi.h', + 'include/capi/cef_scheme_capi.h', + 'include/capi/cef_stream_capi.h', + 'include/capi/cef_string_visitor_capi.h', + 'include/capi/cef_task_capi.h', + 'include/capi/cef_url_capi.h', + 'include/capi/cef_urlrequest_capi.h', + 'include/capi/cef_v8_capi.h', + 'include/capi/cef_values_capi.h', + 'include/capi/cef_web_plugin_capi.h', + 'include/capi/cef_xml_reader_capi.h', + 'include/capi/cef_zip_reader_capi.h', + ], + 'autogen_library_side': [ + 'libcef_dll/ctocpp/app_ctocpp.cc', + 'libcef_dll/ctocpp/app_ctocpp.h', + 'libcef_dll/cpptoc/auth_callback_cpptoc.cc', + 'libcef_dll/cpptoc/auth_callback_cpptoc.h', + 'libcef_dll/cpptoc/before_download_callback_cpptoc.cc', + 'libcef_dll/cpptoc/before_download_callback_cpptoc.h', + 'libcef_dll/cpptoc/binary_value_cpptoc.cc', + 'libcef_dll/cpptoc/binary_value_cpptoc.h', + 'libcef_dll/cpptoc/browser_cpptoc.cc', + 'libcef_dll/cpptoc/browser_cpptoc.h', + 'libcef_dll/cpptoc/browser_host_cpptoc.cc', + 'libcef_dll/cpptoc/browser_host_cpptoc.h', + 'libcef_dll/ctocpp/browser_process_handler_ctocpp.cc', + 'libcef_dll/ctocpp/browser_process_handler_ctocpp.h', + 'libcef_dll/cpptoc/callback_cpptoc.cc', + 'libcef_dll/cpptoc/callback_cpptoc.h', + 'libcef_dll/ctocpp/client_ctocpp.cc', + 'libcef_dll/ctocpp/client_ctocpp.h', + 'libcef_dll/cpptoc/command_line_cpptoc.cc', + 'libcef_dll/cpptoc/command_line_cpptoc.h', + 'libcef_dll/ctocpp/context_menu_handler_ctocpp.cc', + 'libcef_dll/ctocpp/context_menu_handler_ctocpp.h', + 'libcef_dll/cpptoc/context_menu_params_cpptoc.cc', + 'libcef_dll/cpptoc/context_menu_params_cpptoc.h', + 'libcef_dll/cpptoc/cookie_manager_cpptoc.cc', + 'libcef_dll/cpptoc/cookie_manager_cpptoc.h', + 'libcef_dll/ctocpp/cookie_visitor_ctocpp.cc', + 'libcef_dll/ctocpp/cookie_visitor_ctocpp.h', + 'libcef_dll/cpptoc/domdocument_cpptoc.cc', + 'libcef_dll/cpptoc/domdocument_cpptoc.h', + 'libcef_dll/cpptoc/domevent_cpptoc.cc', + 'libcef_dll/cpptoc/domevent_cpptoc.h', + 'libcef_dll/ctocpp/domevent_listener_ctocpp.cc', + 'libcef_dll/ctocpp/domevent_listener_ctocpp.h', + 'libcef_dll/cpptoc/domnode_cpptoc.cc', + 'libcef_dll/cpptoc/domnode_cpptoc.h', + 'libcef_dll/ctocpp/domvisitor_ctocpp.cc', + 'libcef_dll/ctocpp/domvisitor_ctocpp.h', + 'libcef_dll/cpptoc/dictionary_value_cpptoc.cc', + 'libcef_dll/cpptoc/dictionary_value_cpptoc.h', + 'libcef_dll/ctocpp/display_handler_ctocpp.cc', + 'libcef_dll/ctocpp/display_handler_ctocpp.h', + 'libcef_dll/ctocpp/download_handler_ctocpp.cc', + 'libcef_dll/ctocpp/download_handler_ctocpp.h', + 'libcef_dll/cpptoc/download_item_cpptoc.cc', + 'libcef_dll/cpptoc/download_item_cpptoc.h', + 'libcef_dll/cpptoc/download_item_callback_cpptoc.cc', + 'libcef_dll/cpptoc/download_item_callback_cpptoc.h', + 'libcef_dll/ctocpp/focus_handler_ctocpp.cc', + 'libcef_dll/ctocpp/focus_handler_ctocpp.h', + 'libcef_dll/cpptoc/frame_cpptoc.cc', + 'libcef_dll/cpptoc/frame_cpptoc.h', + 'libcef_dll/cpptoc/geolocation_callback_cpptoc.cc', + 'libcef_dll/cpptoc/geolocation_callback_cpptoc.h', + 'libcef_dll/ctocpp/geolocation_handler_ctocpp.cc', + 'libcef_dll/ctocpp/geolocation_handler_ctocpp.h', + 'libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc', + 'libcef_dll/cpptoc/jsdialog_callback_cpptoc.h', + 'libcef_dll/ctocpp/jsdialog_handler_ctocpp.cc', + 'libcef_dll/ctocpp/jsdialog_handler_ctocpp.h', + 'libcef_dll/ctocpp/keyboard_handler_ctocpp.cc', + 'libcef_dll/ctocpp/keyboard_handler_ctocpp.h', + 'libcef_dll/ctocpp/life_span_handler_ctocpp.cc', + 'libcef_dll/ctocpp/life_span_handler_ctocpp.h', + 'libcef_dll/cpptoc/list_value_cpptoc.cc', + 'libcef_dll/cpptoc/list_value_cpptoc.h', + 'libcef_dll/ctocpp/load_handler_ctocpp.cc', + 'libcef_dll/ctocpp/load_handler_ctocpp.h', + 'libcef_dll/cpptoc/menu_model_cpptoc.cc', + 'libcef_dll/cpptoc/menu_model_cpptoc.h', + 'libcef_dll/cpptoc/post_data_cpptoc.cc', + 'libcef_dll/cpptoc/post_data_cpptoc.h', + 'libcef_dll/cpptoc/post_data_element_cpptoc.cc', + 'libcef_dll/cpptoc/post_data_element_cpptoc.h', + 'libcef_dll/cpptoc/process_message_cpptoc.cc', + 'libcef_dll/cpptoc/process_message_cpptoc.h', + 'libcef_dll/ctocpp/proxy_handler_ctocpp.cc', + 'libcef_dll/ctocpp/proxy_handler_ctocpp.h', + 'libcef_dll/ctocpp/read_handler_ctocpp.cc', + 'libcef_dll/ctocpp/read_handler_ctocpp.h', + 'libcef_dll/ctocpp/render_process_handler_ctocpp.cc', + 'libcef_dll/ctocpp/render_process_handler_ctocpp.h', + 'libcef_dll/cpptoc/request_cpptoc.cc', + 'libcef_dll/cpptoc/request_cpptoc.h', + 'libcef_dll/ctocpp/request_handler_ctocpp.cc', + 'libcef_dll/ctocpp/request_handler_ctocpp.h', + 'libcef_dll/ctocpp/resource_bundle_handler_ctocpp.cc', + 'libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h', + 'libcef_dll/ctocpp/resource_handler_ctocpp.cc', + 'libcef_dll/ctocpp/resource_handler_ctocpp.h', + 'libcef_dll/cpptoc/response_cpptoc.cc', + 'libcef_dll/cpptoc/response_cpptoc.h', + 'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc', + 'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h', + 'libcef_dll/cpptoc/scheme_registrar_cpptoc.cc', + 'libcef_dll/cpptoc/scheme_registrar_cpptoc.h', + 'libcef_dll/cpptoc/stream_reader_cpptoc.cc', + 'libcef_dll/cpptoc/stream_reader_cpptoc.h', + 'libcef_dll/cpptoc/stream_writer_cpptoc.cc', + 'libcef_dll/cpptoc/stream_writer_cpptoc.h', + 'libcef_dll/ctocpp/string_visitor_ctocpp.cc', + 'libcef_dll/ctocpp/string_visitor_ctocpp.h', + 'libcef_dll/ctocpp/task_ctocpp.cc', + 'libcef_dll/ctocpp/task_ctocpp.h', + 'libcef_dll/cpptoc/urlrequest_cpptoc.cc', + 'libcef_dll/cpptoc/urlrequest_cpptoc.h', + 'libcef_dll/ctocpp/urlrequest_client_ctocpp.cc', + 'libcef_dll/ctocpp/urlrequest_client_ctocpp.h', + 'libcef_dll/ctocpp/v8accessor_ctocpp.cc', + 'libcef_dll/ctocpp/v8accessor_ctocpp.h', + 'libcef_dll/cpptoc/v8context_cpptoc.cc', + 'libcef_dll/cpptoc/v8context_cpptoc.h', + 'libcef_dll/cpptoc/v8exception_cpptoc.cc', + 'libcef_dll/cpptoc/v8exception_cpptoc.h', + 'libcef_dll/ctocpp/v8handler_ctocpp.cc', + 'libcef_dll/ctocpp/v8handler_ctocpp.h', + 'libcef_dll/cpptoc/v8value_cpptoc.cc', + 'libcef_dll/cpptoc/v8value_cpptoc.h', + 'libcef_dll/cpptoc/web_plugin_info_cpptoc.cc', + 'libcef_dll/cpptoc/web_plugin_info_cpptoc.h', + 'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.cc', + 'libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h', + 'libcef_dll/ctocpp/write_handler_ctocpp.cc', + 'libcef_dll/ctocpp/write_handler_ctocpp.h', + 'libcef_dll/cpptoc/xml_reader_cpptoc.cc', + 'libcef_dll/cpptoc/xml_reader_cpptoc.h', + 'libcef_dll/cpptoc/zip_reader_cpptoc.cc', + 'libcef_dll/cpptoc/zip_reader_cpptoc.h', + ], + 'autogen_client_side': [ + 'libcef_dll/cpptoc/app_cpptoc.cc', + 'libcef_dll/cpptoc/app_cpptoc.h', + 'libcef_dll/ctocpp/auth_callback_ctocpp.cc', + 'libcef_dll/ctocpp/auth_callback_ctocpp.h', + 'libcef_dll/ctocpp/before_download_callback_ctocpp.cc', + 'libcef_dll/ctocpp/before_download_callback_ctocpp.h', + 'libcef_dll/ctocpp/binary_value_ctocpp.cc', + 'libcef_dll/ctocpp/binary_value_ctocpp.h', + 'libcef_dll/ctocpp/browser_ctocpp.cc', + 'libcef_dll/ctocpp/browser_ctocpp.h', + 'libcef_dll/ctocpp/browser_host_ctocpp.cc', + 'libcef_dll/ctocpp/browser_host_ctocpp.h', + 'libcef_dll/cpptoc/browser_process_handler_cpptoc.cc', + 'libcef_dll/cpptoc/browser_process_handler_cpptoc.h', + 'libcef_dll/ctocpp/callback_ctocpp.cc', + 'libcef_dll/ctocpp/callback_ctocpp.h', + 'libcef_dll/cpptoc/client_cpptoc.cc', + 'libcef_dll/cpptoc/client_cpptoc.h', + 'libcef_dll/ctocpp/command_line_ctocpp.cc', + 'libcef_dll/ctocpp/command_line_ctocpp.h', + 'libcef_dll/cpptoc/context_menu_handler_cpptoc.cc', + 'libcef_dll/cpptoc/context_menu_handler_cpptoc.h', + 'libcef_dll/ctocpp/context_menu_params_ctocpp.cc', + 'libcef_dll/ctocpp/context_menu_params_ctocpp.h', + 'libcef_dll/ctocpp/cookie_manager_ctocpp.cc', + 'libcef_dll/ctocpp/cookie_manager_ctocpp.h', + 'libcef_dll/cpptoc/cookie_visitor_cpptoc.cc', + 'libcef_dll/cpptoc/cookie_visitor_cpptoc.h', + 'libcef_dll/ctocpp/domdocument_ctocpp.cc', + 'libcef_dll/ctocpp/domdocument_ctocpp.h', + 'libcef_dll/ctocpp/domevent_ctocpp.cc', + 'libcef_dll/ctocpp/domevent_ctocpp.h', + 'libcef_dll/cpptoc/domevent_listener_cpptoc.cc', + 'libcef_dll/cpptoc/domevent_listener_cpptoc.h', + 'libcef_dll/ctocpp/domnode_ctocpp.cc', + 'libcef_dll/ctocpp/domnode_ctocpp.h', + 'libcef_dll/cpptoc/domvisitor_cpptoc.cc', + 'libcef_dll/cpptoc/domvisitor_cpptoc.h', + 'libcef_dll/ctocpp/dictionary_value_ctocpp.cc', + 'libcef_dll/ctocpp/dictionary_value_ctocpp.h', + 'libcef_dll/cpptoc/display_handler_cpptoc.cc', + 'libcef_dll/cpptoc/display_handler_cpptoc.h', + 'libcef_dll/cpptoc/download_handler_cpptoc.cc', + 'libcef_dll/cpptoc/download_handler_cpptoc.h', + 'libcef_dll/ctocpp/download_item_ctocpp.cc', + 'libcef_dll/ctocpp/download_item_ctocpp.h', + 'libcef_dll/ctocpp/download_item_callback_ctocpp.cc', + 'libcef_dll/ctocpp/download_item_callback_ctocpp.h', + 'libcef_dll/cpptoc/focus_handler_cpptoc.cc', + 'libcef_dll/cpptoc/focus_handler_cpptoc.h', + 'libcef_dll/ctocpp/frame_ctocpp.cc', + 'libcef_dll/ctocpp/frame_ctocpp.h', + 'libcef_dll/ctocpp/geolocation_callback_ctocpp.cc', + 'libcef_dll/ctocpp/geolocation_callback_ctocpp.h', + 'libcef_dll/cpptoc/geolocation_handler_cpptoc.cc', + 'libcef_dll/cpptoc/geolocation_handler_cpptoc.h', + 'libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc', + 'libcef_dll/ctocpp/jsdialog_callback_ctocpp.h', + 'libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc', + 'libcef_dll/cpptoc/jsdialog_handler_cpptoc.h', + 'libcef_dll/cpptoc/keyboard_handler_cpptoc.cc', + 'libcef_dll/cpptoc/keyboard_handler_cpptoc.h', + 'libcef_dll/cpptoc/life_span_handler_cpptoc.cc', + 'libcef_dll/cpptoc/life_span_handler_cpptoc.h', + 'libcef_dll/ctocpp/list_value_ctocpp.cc', + 'libcef_dll/ctocpp/list_value_ctocpp.h', + 'libcef_dll/cpptoc/load_handler_cpptoc.cc', + 'libcef_dll/cpptoc/load_handler_cpptoc.h', + 'libcef_dll/ctocpp/menu_model_ctocpp.cc', + 'libcef_dll/ctocpp/menu_model_ctocpp.h', + 'libcef_dll/ctocpp/post_data_ctocpp.cc', + 'libcef_dll/ctocpp/post_data_ctocpp.h', + 'libcef_dll/ctocpp/post_data_element_ctocpp.cc', + 'libcef_dll/ctocpp/post_data_element_ctocpp.h', + 'libcef_dll/ctocpp/process_message_ctocpp.cc', + 'libcef_dll/ctocpp/process_message_ctocpp.h', + 'libcef_dll/cpptoc/proxy_handler_cpptoc.cc', + 'libcef_dll/cpptoc/proxy_handler_cpptoc.h', + 'libcef_dll/cpptoc/read_handler_cpptoc.cc', + 'libcef_dll/cpptoc/read_handler_cpptoc.h', + 'libcef_dll/cpptoc/render_process_handler_cpptoc.cc', + 'libcef_dll/cpptoc/render_process_handler_cpptoc.h', + 'libcef_dll/ctocpp/request_ctocpp.cc', + 'libcef_dll/ctocpp/request_ctocpp.h', + 'libcef_dll/cpptoc/request_handler_cpptoc.cc', + 'libcef_dll/cpptoc/request_handler_cpptoc.h', + 'libcef_dll/cpptoc/resource_bundle_handler_cpptoc.cc', + 'libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h', + 'libcef_dll/cpptoc/resource_handler_cpptoc.cc', + 'libcef_dll/cpptoc/resource_handler_cpptoc.h', + 'libcef_dll/ctocpp/response_ctocpp.cc', + 'libcef_dll/ctocpp/response_ctocpp.h', + 'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc', + 'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h', + 'libcef_dll/ctocpp/scheme_registrar_ctocpp.cc', + 'libcef_dll/ctocpp/scheme_registrar_ctocpp.h', + 'libcef_dll/ctocpp/stream_reader_ctocpp.cc', + 'libcef_dll/ctocpp/stream_reader_ctocpp.h', + 'libcef_dll/ctocpp/stream_writer_ctocpp.cc', + 'libcef_dll/ctocpp/stream_writer_ctocpp.h', + 'libcef_dll/cpptoc/string_visitor_cpptoc.cc', + 'libcef_dll/cpptoc/string_visitor_cpptoc.h', + 'libcef_dll/cpptoc/task_cpptoc.cc', + 'libcef_dll/cpptoc/task_cpptoc.h', + 'libcef_dll/ctocpp/urlrequest_ctocpp.cc', + 'libcef_dll/ctocpp/urlrequest_ctocpp.h', + 'libcef_dll/cpptoc/urlrequest_client_cpptoc.cc', + 'libcef_dll/cpptoc/urlrequest_client_cpptoc.h', + 'libcef_dll/cpptoc/v8accessor_cpptoc.cc', + 'libcef_dll/cpptoc/v8accessor_cpptoc.h', + 'libcef_dll/ctocpp/v8context_ctocpp.cc', + 'libcef_dll/ctocpp/v8context_ctocpp.h', + 'libcef_dll/ctocpp/v8exception_ctocpp.cc', + 'libcef_dll/ctocpp/v8exception_ctocpp.h', + 'libcef_dll/cpptoc/v8handler_cpptoc.cc', + 'libcef_dll/cpptoc/v8handler_cpptoc.h', + 'libcef_dll/ctocpp/v8value_ctocpp.cc', + 'libcef_dll/ctocpp/v8value_ctocpp.h', + 'libcef_dll/ctocpp/web_plugin_info_ctocpp.cc', + 'libcef_dll/ctocpp/web_plugin_info_ctocpp.h', + 'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.cc', + 'libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h', + 'libcef_dll/cpptoc/write_handler_cpptoc.cc', + 'libcef_dll/cpptoc/write_handler_cpptoc.h', + 'libcef_dll/ctocpp/xml_reader_ctocpp.cc', + 'libcef_dll/ctocpp/xml_reader_ctocpp.h', + 'libcef_dll/ctocpp/zip_reader_ctocpp.cc', + 'libcef_dll/ctocpp/zip_reader_ctocpp.h', + ], + }, +} diff --git a/cef_paths2.gypi b/cef_paths2.gypi new file mode 100644 index 000000000..a6fe2ba65 --- /dev/null +++ b/cef_paths2.gypi @@ -0,0 +1,175 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +{ + 'includes': [ + # Bring in the autogenerated source file lists. + 'cef_paths.gypi', + ], + 'variables': { + 'includes_common': [ + 'include/cef_base.h', + 'include/cef_pack_resources.h', + 'include/cef_pack_strings.h', + 'include/cef_runnable.h', + 'include/cef_version.h', + 'include/internal/cef_build.h', + 'include/internal/cef_export.h', + 'include/internal/cef_ptr.h', + 'include/internal/cef_string.h', + 'include/internal/cef_string_list.h', + 'include/internal/cef_string_map.h', + 'include/internal/cef_string_multimap.h', + 'include/internal/cef_string_types.h', + 'include/internal/cef_string_wrappers.h', + 'include/internal/cef_time.h', + 'include/internal/cef_tuple.h', + 'include/internal/cef_types.h', + 'include/internal/cef_types_wrappers.h', + '<@(autogen_cpp_includes)', + ], + 'includes_capi': [ + 'include/capi/cef_base_capi.h', + '<@(autogen_capi_includes)', + ], + 'includes_wrapper': [ + 'include/wrapper/cef_byte_read_handler.h', + 'include/wrapper/cef_stream_resource_handler.h', + 'include/wrapper/cef_xml_object.h', + 'include/wrapper/cef_zip_archive.h', + ], + 'includes_win': [ + 'include/internal/cef_types_win.h', + 'include/internal/cef_win.h', + ], + 'includes_mac': [ + 'include/cef_application_mac.h', + 'include/internal/cef_mac.h', + 'include/internal/cef_types_mac.h', + ], + 'includes_linux': [ + 'include/internal/cef_linux.h', + 'include/internal/cef_types_linux.h', + ], + 'libcef_sources_common': [ + 'libcef_dll/cef_logging.h', + 'libcef_dll/cpptoc/cpptoc.h', + 'libcef_dll/ctocpp/ctocpp.h', + 'libcef_dll/libcef_dll.cc', + 'libcef_dll/libcef_dll2.cc', + 'libcef_dll/resource.h', + 'libcef_dll/transfer_util.cpp', + 'libcef_dll/transfer_util.h', + '<@(autogen_library_side)', + ], + 'libcef_dll_wrapper_sources_common': [ + 'libcef_dll/cef_logging.h', + 'libcef_dll/cpptoc/base_cpptoc.h', + 'libcef_dll/cpptoc/cpptoc.h', + 'libcef_dll/ctocpp/base_ctocpp.h', + 'libcef_dll/ctocpp/ctocpp.h', + 'libcef_dll/transfer_util.cpp', + 'libcef_dll/transfer_util.h', + 'libcef_dll/wrapper/cef_byte_read_handler.cc', + 'libcef_dll/wrapper/cef_stream_resource_handler.cc', + 'libcef_dll/wrapper/cef_xml_object.cc', + 'libcef_dll/wrapper/cef_zip_archive.cc', + 'libcef_dll/wrapper/libcef_dll_wrapper.cc', + 'libcef_dll/wrapper/libcef_dll_wrapper2.cc', + '<@(autogen_client_side)', + ], + 'cefclient_sources_common': [ + 'tests/cefclient/cefclient.cpp', + 'tests/cefclient/cefclient.h', + 'tests/cefclient/binding_test.cpp', + 'tests/cefclient/binding_test.h', + 'tests/cefclient/client_app.cpp', + 'tests/cefclient/client_app.h', + 'tests/cefclient/client_app_delegates.cpp', + 'tests/cefclient/client_handler.cpp', + 'tests/cefclient/client_handler.h', + 'tests/cefclient/client_renderer.cpp', + 'tests/cefclient/client_renderer.h', + 'tests/cefclient/client_switches.cpp', + 'tests/cefclient/client_switches.h', + 'tests/cefclient/dom_test.cpp', + 'tests/cefclient/dom_test.h', + 'tests/cefclient/res/binding.html', + 'tests/cefclient/res/dialogs.html', + 'tests/cefclient/res/domaccess.html', + 'tests/cefclient/res/localstorage.html', + 'tests/cefclient/res/logo.png', + 'tests/cefclient/res/xmlhttprequest.html', + 'tests/cefclient/resource_util.h', + 'tests/cefclient/scheme_test.cpp', + 'tests/cefclient/scheme_test.h', + 'tests/cefclient/string_util.cpp', + 'tests/cefclient/string_util.h', + 'tests/cefclient/util.h', + ], + 'cefclient_sources_win': [ + 'tests/cefclient/cefclient.rc', + 'tests/cefclient/cefclient_win.cpp', + 'tests/cefclient/client_handler_win.cpp', + 'tests/cefclient/resource.h', + 'tests/cefclient/res/cefclient.ico', + 'tests/cefclient/res/logoball.png', + 'tests/cefclient/res/small.ico', + 'tests/cefclient/resource_util_win.cpp', + ], + 'cefclient_sources_mac': [ + 'tests/cefclient/cefclient_mac.mm', + 'tests/cefclient/client_handler_mac.mm', + 'tests/cefclient/resource_util_mac.mm', + ], + 'cefclient_sources_mac_helper': [ + 'tests/cefclient/binding_test.cpp', + 'tests/cefclient/binding_test.h', + 'tests/cefclient/client_app.cpp', + 'tests/cefclient/client_app.h', + 'tests/cefclient/client_app_delegates.cpp', + 'tests/cefclient/client_handler.cpp', + 'tests/cefclient/client_handler.h', + 'tests/cefclient/client_handler_mac.mm', + 'tests/cefclient/client_renderer.cpp', + 'tests/cefclient/client_renderer.h', + 'tests/cefclient/client_switches.cpp', + 'tests/cefclient/client_switches.h', + 'tests/cefclient/dom_test.cpp', + 'tests/cefclient/dom_test.h', + 'tests/cefclient/process_helper_mac.cpp', + 'tests/cefclient/resource_util.h', + 'tests/cefclient/resource_util_mac.mm', + 'tests/cefclient/scheme_test.cpp', + 'tests/cefclient/scheme_test.h', + 'tests/cefclient/string_util.cpp', + 'tests/cefclient/string_util.h', + 'tests/cefclient/util.h', + ], + 'cefclient_bundle_resources_mac': [ + 'tests/cefclient/mac/cefclient.icns', + 'tests/cefclient/mac/English.lproj/InfoPlist.strings', + 'tests/cefclient/mac/English.lproj/MainMenu.xib', + 'tests/cefclient/mac/Info.plist', + 'tests/cefclient/res/binding.html', + 'tests/cefclient/res/dialogs.html', + 'tests/cefclient/res/domaccess.html', + 'tests/cefclient/res/localstorage.html', + 'tests/cefclient/res/logo.png', + 'tests/cefclient/res/xmlhttprequest.html', + ], + 'cefclient_sources_linux': [ + 'tests/cefclient/cefclient_gtk.cpp', + 'tests/cefclient/client_handler_gtk.cpp', + 'tests/cefclient/resource_util_linux.cpp', + ], + 'cefclient_bundle_resources_linux': [ + 'tests/cefclient/res/binding.html', + 'tests/cefclient/res/domaccess.html', + 'tests/cefclient/res/localstorage.html', + 'tests/cefclient/res/logo.png', + 'tests/cefclient/res/xmlhttprequest.html', + ], + }, +} diff --git a/chromium b/chromium new file mode 120000 index 000000000..8fe92e5d6 --- /dev/null +++ b/chromium @@ -0,0 +1 @@ +/Users/nathansobo/code/chromium/src/ \ No newline at end of file diff --git a/docs/file-modification b/docs/file-modification deleted file mode 100644 index a3df1c0be..000000000 --- a/docs/file-modification +++ /dev/null @@ -1,18 +0,0 @@ -Buffers - modify - - if dirty alert user (immediately if focused, or on next focus) - - if clean update contents - - remove - - mark file as unsaved (but maintains previous path) - - only unsubscribe from KQueue - - attempt to resubscribe after timeout (because of git weirdness) - - move file - - update path - - move ancestor directory - - update path on focus and save - - recreated after remove (at same path) - - resubscribe on focus or save \ No newline at end of file diff --git a/docs/flexbox-test-2.html b/docs/flexbox-test-2.html deleted file mode 100644 index 482f2e6e9..000000000 --- a/docs/flexbox-test-2.html +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - -
    -
    -
    - My cross size (height) should be equal to the height of my flexbox container. I should overflow, because my height should be too short to contain all my content. -
    1
    -
    2
    -
    3
    -
    4
    -
    5
    -
    6
    -
    7
    -
    8
    -
    9
    -
    10
    -
    11
    -
    12
    -
    13
    -
    14
    -
    15
    -
    -
    -
    - My cross size (height) should also be equal to the height of my flexbox container, but I don't overflow. -
    -
    - - - - diff --git a/docs/flexbox-test-old.html b/docs/flexbox-test-old.html deleted file mode 100644 index 683c44842..000000000 --- a/docs/flexbox-test-old.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - wtf - - - - -
    -
    Keffiyeh mustache pickled post-ironic, lomo vegan food truck helvetica direct trade nostrud. Assumenda odio brunch, DIY non anim delectus sunt aliqua organic VHS nihil pork belly accusamus. Bushwick vice high life tumblr mumblecore ullamco. High life pop-up lomo, pariatur exercitation odio helvetica food truck ex williamsburg stumptown hoodie ea polaroid jean shorts. Keytar sed sapiente, mumblecore fixie +1 cred occaecat accusamus. Fanny pack authentic dolor, id four loko dolore ex +1 pop-up. Thundercats cliche aliqua, fugiat irony marfa chambray banksy kogi organic selvage VHS DIY. Id mumblecore nisi, brunch narwhal nostrud vegan squid before they sold out. Sriracha laborum nesciunt, in salvia you probably haven't heard of them mustache VHS commodo squid proident williamsburg. Magna vero gentrify labore, non american apparel occaecat put a bird on it mlkshk DIY occupy eu pinterest aute cliche. Nihil delectus commodo voluptate nostrud. Tattooed tempor skateboard, sed tumblr nostrud chambray put a bird on it non salvia helvetica consectetur mcsweeney's incididunt. Est semiotics ut yr, fanny pack leggings voluptate carles. Ea odd future hoodie cred. Ex small batch wayfarers sartorial. Delectus mumblecore skateboard, kogi esse keytar vinyl sriracha before they sold out typewriter marfa odd future viral mollit. Polaroid biodiesel street art viral cupidatat art party, post-ironic minim. Irony qui reprehenderit, put a bird on it eiusmod iphone labore skateboard. Craft beer keffiyeh echo park, 3 wolf moon thundercats gentrify dolor beard VHS ullamco cillum post-ironic qui chambray. Sartorial cred ex, aliqua trust fund est consectetur put a bird on it in nisi cupidatat sapiente art party freegan. Mlkshk authentic velit laborum. Est tattooed hella pickled qui flexitarian. Mustache wes anderson food truck, cardigan selvage organic wayfarers VHS irure typewriter irony. Kale chips pitchfork four loko before they sold out. Quis blog proident jean shorts voluptate, photo booth high life post-ironic odio hella whatever. Vinyl 3 wolf moon qui, officia non artisan et helvetica cosby sweater velit street art proident quinoa reprehenderit. Odd future fap put a bird on it laboris, kale chips tempor duis velit. Voluptate mlkshk brooklyn nihil. Hoodie sustainable excepteur next level. Anim qui aliqua officia keffiyeh semiotics. Est brooklyn pop-up photo booth, jean shorts banksy mumblecore. Consequat typewriter ennui put a bird on it odio. Reprehenderit narwhal master cleanse, messenger bag sed wayfarers vinyl adipisicing ex nesciunt. Mollit carles ethnic craft beer shoreditch, incididunt veniam laboris small batch authentic dreamcatcher proident you probably haven't heard of them seitan. Id art party narwhal assumenda farm-to-table brooklyn. Seitan artisan adipisicing put a bird on it aute lomo. Next level letterpress pitchfork, master cleanse Austin small batch scenester mlkshk trust fund hella accusamus laboris iphone lo-fi. Minim consectetur fanny pack occupy, lo-fi twee cupidatat nostrud laborum sint. Master cleanse consectetur excepteur enim food truck banksy. Qui nisi truffaut helvetica excepteur. Quinoa banksy non four loko tattooed keffiyeh pickled, ex semiotics quis odd future consectetur flexitarian. Quis readymade 8-bit nisi.
    -
    -
    Keffiyeh mustache pickled post-ironic, lomo vegan food truck helvetica direct trade nostrud. Assumenda odio brunch, DIY non anim delectus sunt aliqua organic VHS nihil pork belly accusamus. Bushwick vice high life tumblr mumblecore ullamco. High life pop-up lomo, pariatur exercitation odio helvetica food truck ex williamsburg stumptown hoodie ea polaroid jean shorts. Keytar sed sapiente, mumblecore fixie +1 cred occaecat accusamus. Fanny pack authentic dolor, id four loko dolore ex +1 pop-up. Thundercats cliche aliqua, fugiat irony marfa chambray banksy kogi organic selvage VHS DIY. Id mumblecore nisi, brunch narwhal nostrud vegan squid before they sold out. Sriracha laborum nesciunt, in salvia you probably haven't heard of them mustache VHS commodo squid proident williamsburg. Magna vero gentrify labore, non american apparel occaecat put a bird on it mlkshk DIY occupy eu pinterest aute cliche. Nihil delectus commodo voluptate nostrud. Tattooed tempor skateboard, sed tumblr nostrud chambray put a bird on it non salvia helvetica consectetur mcsweeney's incididunt. Est semiotics ut yr, fanny pack leggings voluptate carles. Ea odd future hoodie cred. Ex small batch wayfarers sartorial. Delectus mumblecore skateboard, kogi esse keytar vinyl sriracha before they sold out typewriter marfa odd future viral mollit. Polaroid biodiesel street art viral cupidatat art party, post-ironic minim. Irony qui reprehenderit, put a bird on it eiusmod iphone labore skateboard. Craft beer keffiyeh echo park, 3 wolf moon thundercats gentrify dolor beard VHS ullamco cillum post-ironic qui chambray. Sartorial cred ex, aliqua trust fund est consectetur put a bird on it in nisi cupidatat sapiente art party freegan. Mlkshk authentic velit laborum. Est tattooed hella pickled qui flexitarian. Mustache wes anderson food truck, cardigan selvage organic wayfarers VHS irure typewriter irony. Kale chips pitchfork four loko before they sold out. Quis blog proident jean shorts voluptate, photo booth high life post-ironic odio hella whatever. Vinyl 3 wolf moon qui, officia non artisan et helvetica cosby sweater velit street art proident quinoa reprehenderit. Odd future fap put a bird on it laboris, kale chips tempor duis velit. Voluptate mlkshk brooklyn nihil. Hoodie sustainable excepteur next level. Anim qui aliqua officia keffiyeh semiotics. Est brooklyn pop-up photo booth, jean shorts banksy mumblecore. Consequat typewriter ennui put a bird on it odio. Reprehenderit narwhal master cleanse, messenger bag sed wayfarers vinyl adipisicing ex nesciunt. Mollit carles ethnic craft beer shoreditch, incididunt veniam laboris small batch authentic dreamcatcher proident you probably haven't heard of them seitan. Id art party narwhal assumenda farm-to-table brooklyn. Seitan artisan adipisicing put a bird on it aute lomo. Next level letterpress pitchfork, master cleanse Austin small batch scenester mlkshk trust fund hella accusamus laboris iphone lo-fi. Minim consectetur fanny pack occupy, lo-fi twee cupidatat nostrud laborum sint. Master cleanse consectetur excepteur enim food truck banksy. Qui nisi truffaut helvetica excepteur. Quinoa banksy non four loko tattooed keffiyeh pickled, ex semiotics quis odd future consectetur flexitarian. Quis readymade 8-bit nisi.
    -
    -
    - I am a child of a flexbox item. My height should be exactly the height of my container. -
    -
    -
    Keffiyeh mustache pickled post-ironic, lomo vegan food truck helvetica direct trade nostrud. Assumenda odio brunch, DIY non anim delectus sunt aliqua organic VHS nihil pork belly accusamus. Bushwick vice high life tumblr mumblecore ullamco. High life pop-up lomo, pariatur exercitation odio helvetica food truck ex williamsburg stumptown hoodie ea polaroid jean shorts. Keytar sed sapiente, mumblecore fixie +1 cred occaecat accusamus. Fanny pack authentic dolor, id four loko dolore ex +1 pop-up. Thundercats cliche aliqua, fugiat irony marfa chambray banksy kogi organic selvage VHS DIY. Id mumblecore nisi, brunch narwhal nostrud vegan squid before they sold out. Sriracha laborum nesciunt, in salvia you probably haven't heard of them mustache VHS commodo squid proident williamsburg. Magna vero gentrify labore, non american apparel occaecat put a bird on it mlkshk DIY occupy eu pinterest aute cliche. Nihil delectus commodo voluptate nostrud. Tattooed tempor skateboard, sed tumblr nostrud chambray put a bird on it non salvia helvetica consectetur mcsweeney's incididunt. Est semiotics ut yr, fanny pack leggings voluptate carles. Ea odd future hoodie cred. Ex small batch wayfarers sartorial. Delectus mumblecore skateboard, kogi esse keytar vinyl sriracha before they sold out typewriter marfa odd future viral mollit. Polaroid biodiesel street art viral cupidatat art party, post-ironic minim. Irony qui reprehenderit, put a bird on it eiusmod iphone labore skateboard. Craft beer keffiyeh echo park, 3 wolf moon thundercats gentrify dolor beard VHS ullamco cillum post-ironic qui chambray. Sartorial cred ex, aliqua trust fund est consectetur put a bird on it in nisi cupidatat sapiente art party freegan. Mlkshk authentic velit laborum. Est tattooed hella pickled qui flexitarian. Mustache wes anderson food truck, cardigan selvage organic wayfarers VHS irure typewriter irony. Kale chips pitchfork four loko before they sold out. Quis blog proident jean shorts voluptate, photo booth high life post-ironic odio hella whatever. Vinyl 3 wolf moon qui, officia non artisan et helvetica cosby sweater velit street art proident quinoa reprehenderit. Odd future fap put a bird on it laboris, kale chips tempor duis velit. Voluptate mlkshk brooklyn nihil. Hoodie sustainable excepteur next level. Anim qui aliqua officia keffiyeh semiotics. Est brooklyn pop-up photo booth, jean shorts banksy mumblecore. Consequat typewriter ennui put a bird on it odio. Reprehenderit narwhal master cleanse, messenger bag sed wayfarers vinyl adipisicing ex nesciunt. Mollit carles ethnic craft beer shoreditch, incididunt veniam laboris small batch authentic dreamcatcher proident you probably haven't heard of them seitan. Id art party narwhal assumenda farm-to-table brooklyn. Seitan artisan adipisicing put a bird on it aute lomo. Next level letterpress pitchfork, master cleanse Austin small batch scenester mlkshk trust fund hella accusamus laboris iphone lo-fi. Minim consectetur fanny pack occupy, lo-fi twee cupidatat nostrud laborum sint. Master cleanse consectetur excepteur enim food truck banksy. Qui nisi truffaut helvetica excepteur. Quinoa banksy non four loko tattooed keffiyeh pickled, ex semiotics quis odd future consectetur flexitarian. Quis readymade 8-bit nisi.
    -
    -
    Keffiyeh mustache pickled post-ironic, lomo vegan food truck helvetica direct trade nostrud. Assumenda odio brunch, DIY non anim delectus sunt aliqua organic VHS nihil pork belly accusamus. Bushwick vice high life tumblr mumblecore ullamco. High life pop-up lomo, pariatur exercitation odio helvetica food truck ex williamsburg stumptown hoodie ea polaroid jean shorts. Keytar sed sapiente, mumblecore fixie +1 cred occaecat accusamus. Fanny pack authentic dolor, id four loko dolore ex +1 pop-up. Thundercats cliche aliqua, fugiat irony marfa chambray banksy kogi organic selvage VHS DIY. Id mumblecore nisi, brunch narwhal nostrud vegan squid before they sold out. Sriracha laborum nesciunt, in salvia you probably haven't heard of them mustache VHS commodo squid proident williamsburg. Magna vero gentrify labore, non american apparel occaecat put a bird on it mlkshk DIY occupy eu pinterest aute cliche. Nihil delectus commodo voluptate nostrud. Tattooed tempor skateboard, sed tumblr nostrud chambray put a bird on it non salvia helvetica consectetur mcsweeney's incididunt. Est semiotics ut yr, fanny pack leggings voluptate carles. Ea odd future hoodie cred. Ex small batch wayfarers sartorial. Delectus mumblecore skateboard, kogi esse keytar vinyl sriracha before they sold out typewriter marfa odd future viral mollit. Polaroid biodiesel street art viral cupidatat art party, post-ironic minim. Irony qui reprehenderit, put a bird on it eiusmod iphone labore skateboard. Craft beer keffiyeh echo park, 3 wolf moon thundercats gentrify dolor beard VHS ullamco cillum post-ironic qui chambray. Sartorial cred ex, aliqua trust fund est consectetur put a bird on it in nisi cupidatat sapiente art party freegan. Mlkshk authentic velit laborum. Est tattooed hella pickled qui flexitarian. Mustache wes anderson food truck, cardigan selvage organic wayfarers VHS irure typewriter irony. Kale chips pitchfork four loko before they sold out. Quis blog proident jean shorts voluptate, photo booth high life post-ironic odio hella whatever. Vinyl 3 wolf moon qui, officia non artisan et helvetica cosby sweater velit street art proident quinoa reprehenderit. Odd future fap put a bird on it laboris, kale chips tempor duis velit. Voluptate mlkshk brooklyn nihil. Hoodie sustainable excepteur next level. Anim qui aliqua officia keffiyeh semiotics. Est brooklyn pop-up photo booth, jean shorts banksy mumblecore. Consequat typewriter ennui put a bird on it odio. Reprehenderit narwhal master cleanse, messenger bag sed wayfarers vinyl adipisicing ex nesciunt. Mollit carles ethnic craft beer shoreditch, incididunt veniam laboris small batch authentic dreamcatcher proident you probably haven't heard of them seitan. Id art party narwhal assumenda farm-to-table brooklyn. Seitan artisan adipisicing put a bird on it aute lomo. Next level letterpress pitchfork, master cleanse Austin small batch scenester mlkshk trust fund hella accusamus laboris iphone lo-fi. Minim consectetur fanny pack occupy, lo-fi twee cupidatat nostrud laborum sint. Master cleanse consectetur excepteur enim food truck banksy. Qui nisi truffaut helvetica excepteur. Quinoa banksy non four loko tattooed keffiyeh pickled, ex semiotics quis odd future consectetur flexitarian. Quis readymade 8-bit nisi.
    -
    - - - diff --git a/docs/flexbox-test.html b/docs/flexbox-test.html deleted file mode 100644 index c301a8ab7..000000000 --- a/docs/flexbox-test.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - -
    -
    -
    - I should be 100% of the height of my container, right? -
    -
    -
    - I don't have a flex property, so I should have an auto height -
    -
    - - diff --git a/frameworks/CocoaOniguruma.framework/CocoaOniguruma b/frameworks/CocoaOniguruma.framework/CocoaOniguruma deleted file mode 120000 index 3fd2801a2..000000000 --- a/frameworks/CocoaOniguruma.framework/CocoaOniguruma +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/CocoaOniguruma \ No newline at end of file diff --git a/frameworks/CocoaOniguruma.framework/Headers b/frameworks/CocoaOniguruma.framework/Headers deleted file mode 120000 index a177d2a6b..000000000 --- a/frameworks/CocoaOniguruma.framework/Headers +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Headers \ No newline at end of file diff --git a/frameworks/CocoaOniguruma.framework/Resources b/frameworks/CocoaOniguruma.framework/Resources deleted file mode 120000 index 953ee36f3..000000000 --- a/frameworks/CocoaOniguruma.framework/Resources +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Resources \ No newline at end of file diff --git a/frameworks/CocoaOniguruma.framework/Versions/A/CocoaOniguruma b/frameworks/CocoaOniguruma.framework/Versions/A/CocoaOniguruma deleted file mode 100755 index 3799f6f6b..000000000 Binary files a/frameworks/CocoaOniguruma.framework/Versions/A/CocoaOniguruma and /dev/null differ diff --git a/frameworks/CocoaOniguruma.framework/Versions/A/Headers/OnigRegexp.h b/frameworks/CocoaOniguruma.framework/Versions/A/Headers/OnigRegexp.h deleted file mode 100644 index 84f24b46d..000000000 --- a/frameworks/CocoaOniguruma.framework/Versions/A/Headers/OnigRegexp.h +++ /dev/null @@ -1,91 +0,0 @@ -// CocoaOniguruma is copyrighted free software by Satoshi Nakagawa . -// You can redistribute it and/or modify it under the new BSD license. - -#import -#import "oniguruma.h" -#import "OnigRegexpUtility.h" - - -@class OnigResult; - -typedef enum { - OnigOptionNone = ONIG_OPTION_NONE, - OnigOptionIgnorecase = ONIG_OPTION_IGNORECASE, - OnigOptionExtend = ONIG_OPTION_EXTEND, - OnigOptionMultiline = ONIG_OPTION_MULTILINE, - OnigOptionSingleline = ONIG_OPTION_SINGLELINE, - OnigOptionFindLongest = ONIG_OPTION_FIND_LONGEST, - OnigOptionFindNotEmpty = ONIG_OPTION_FIND_NOT_EMPTY, - OnigOptionNegateSingleLine = ONIG_OPTION_NEGATE_SINGLELINE, - OnigOptionDontCaptureGroup = ONIG_OPTION_DONT_CAPTURE_GROUP, - OnigOptionCaptureGroup = ONIG_OPTION_CAPTURE_GROUP, - - /* options (search time) */ - OnigOptionNotbol = ONIG_OPTION_NOTBOL, - OnigOptionNoteol = ONIG_OPTION_NOTEOL, - OnigOptionPosixRegion = ONIG_OPTION_POSIX_REGION, - OnigOptionMaxbit = ONIG_OPTION_MAXBIT -} OnigOption; - -@interface OnigRegexp : NSObject -{ - regex_t* _entity; - NSString* _expression; -} - -+ (OnigRegexp*)compile:(NSString*)expression; -+ (OnigRegexp*)compile:(NSString*)expression error:(NSError **)error; -+ (OnigRegexp*)compileIgnorecase:(NSString*)expression; -+ (OnigRegexp*)compileIgnorecase:(NSString*)expression error:(NSError **)error; -+ (OnigRegexp*)compile:(NSString*)expression ignorecase:(BOOL)ignorecase multiline:(BOOL)multiline; -+ (OnigRegexp*)compile:(NSString*)expression ignorecase:(BOOL)ignorecase multiline:(BOOL)multiline error:(NSError **)error; -+ (OnigRegexp*)compile:(NSString*)expression ignorecase:(BOOL)ignorecase multiline:(BOOL)multiline extended:(BOOL)extended; -+ (OnigRegexp*)compile:(NSString*)expression ignorecase:(BOOL)ignorecase multiline:(BOOL)multiline extended:(BOOL)extended error:(NSError **)error; -+ (OnigRegexp*)compile:(NSString*)expression options:(OnigOption)options; -+ (OnigRegexp*)compile:(NSString*)expression options:(OnigOption)options error:(NSError **)error; - -- (OnigResult*)search:(NSString*)target; -- (OnigResult*)search:(NSString*)target start:(int)start; -- (OnigResult*)search:(NSString*)target start:(int)start end:(int)end; -- (OnigResult*)search:(NSString*)target range:(NSRange)range; - -- (OnigResult*)match:(NSString*)target; -- (OnigResult*)match:(NSString*)target start:(int)start; - -- (NSUInteger)captureCount; -- (NSString*)expression; - -@end - - -@interface OnigResult : NSObject -{ - OnigRegexp* _expression; - OnigRegion* _region; - NSString* _target; - NSMutableArray* _captureNames; -} - -- (NSString*)target; - -- (int)count; -- (NSString*)stringAt:(int)index; -- (NSArray*)strings; -- (NSRange)rangeAt:(int)index; -- (int)locationAt:(int)index; -- (int)lengthAt:(int)index; - -- (NSString*)body; -- (NSRange)bodyRange; - -- (NSString*)preMatch; -- (NSString*)postMatch; - -// named capture support -- (NSArray*)captureNames; -- (int)indexForName:(NSString*)name; -- (NSIndexSet*)indexesForName:(NSString*)name; -- (NSString*)stringForName:(NSString*)name; -- (NSArray*)stringsForName:(NSString*)name; - -@end diff --git a/frameworks/CocoaOniguruma.framework/Versions/A/Headers/OnigRegexpUtility.h b/frameworks/CocoaOniguruma.framework/Versions/A/Headers/OnigRegexpUtility.h deleted file mode 100644 index 245ebae3d..000000000 --- a/frameworks/CocoaOniguruma.framework/Versions/A/Headers/OnigRegexpUtility.h +++ /dev/null @@ -1,57 +0,0 @@ -// CocoaOniguruma is copyrighted free software by Satoshi Nakagawa . -// You can redistribute it and/or modify it under the new BSD license. - -#import -#import "oniguruma.h" -#import "OnigRegexp.h" - - -@class OnigRegexp; -@class OnigResult; - - -@interface NSString (OnigRegexpUtility) - -// pattern is OnigRegexp or NSString - -- (NSRange)rangeOfRegexp:(id)pattern; - -// based on ruby's split - -- (NSArray*)split; -- (NSArray*)splitByRegexp:(id)pattern; -- (NSArray*)splitByRegexp:(id)pattern limit:(int)limit; - -// based on ruby's gsub - -- (NSString*)replaceByRegexp:(id)pattern with:(NSString*)string; -- (NSString*)replaceAllByRegexp:(id)pattern with:(NSString*)string; - -- (NSString*)replaceByRegexp:(id)pattern withCallback:(id)object selector:(SEL)sel; -- (NSString*)replaceAllByRegexp:(id)pattern withCallback:(id)object selector:(SEL)sel; - -#if defined(NS_BLOCKS_AVAILABLE) -- (NSString*)replaceByRegexp:(id)pattern withBlock:(NSString* (^)(OnigResult*))block; -- (NSString*)replaceAllByRegexp:(id)pattern withBlock:(NSString* (^)(OnigResult*))block; -#endif - -@end - - -@interface NSMutableString (OnigRegexpUtility) - -// pattern is OnigRegexp or NSString - -// based on ruby's gsub - -- (NSMutableString*)replaceByRegexp:(id)pattern with:(NSString*)string; -- (NSMutableString*)replaceAllByRegexp:(id)pattern with:(NSString*)string; - -- (NSMutableString*)replaceByRegexp:(id)pattern withCallback:(id)object selector:(SEL)sel; -- (NSMutableString*)replaceAllByRegexp:(id)pattern withCallback:(id)object selector:(SEL)sel; - -#if defined(NS_BLOCKS_AVAILABLE) -- (NSMutableString*)replaceByRegexp:(id)pattern withBlock:(NSString* (^)(OnigResult*))block; -- (NSMutableString*)replaceAllByRegexp:(id)pattern withBlock:(NSString* (^)(OnigResult*))block; -#endif -@end diff --git a/frameworks/CocoaOniguruma.framework/Versions/A/Headers/oniguruma.h b/frameworks/CocoaOniguruma.framework/Versions/A/Headers/oniguruma.h deleted file mode 100644 index 8c6322c9b..000000000 --- a/frameworks/CocoaOniguruma.framework/Versions/A/Headers/oniguruma.h +++ /dev/null @@ -1,770 +0,0 @@ -#ifndef ONIGURUMA_H -#define ONIGURUMA_H -/********************************************************************** - oniguruma.h - Oniguruma (regular expression library) -**********************************************************************/ -/*- - * Copyright (c) 2002-2009 K.Kosako - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#define ONIGURUMA -#define ONIGURUMA_VERSION_MAJOR 5 -#define ONIGURUMA_VERSION_MINOR 9 -#define ONIGURUMA_VERSION_TEENY 2 - -#ifdef __cplusplus -# ifndef HAVE_PROTOTYPES -# define HAVE_PROTOTYPES 1 -# endif -# ifndef HAVE_STDARG_PROTOTYPES -# define HAVE_STDARG_PROTOTYPES 1 -# endif -#endif - -/* escape Mac OS X/Xcode 2.4/gcc 4.0.1 problem */ -#if defined(__APPLE__) && defined(__GNUC__) && __GNUC__ >= 4 -# ifndef HAVE_STDARG_PROTOTYPES -# define HAVE_STDARG_PROTOTYPES 1 -# endif -#endif - -#ifdef HAVE_STDARG_H -# ifndef HAVE_STDARG_PROTOTYPES -# define HAVE_STDARG_PROTOTYPES 1 -# endif -#endif - -#ifndef P_ -#if defined(__STDC__) || defined(_WIN32) -# define P_(args) args -#else -# define P_(args) () -#endif -#endif - -#ifndef PV_ -#ifdef HAVE_STDARG_PROTOTYPES -# define PV_(args) args -#else -# define PV_(args) () -#endif -#endif - -#ifndef ONIG_EXTERN -#if defined(_WIN32) && !defined(__GNUC__) -#if defined(EXPORT) || defined(RUBY_EXPORT) -#define ONIG_EXTERN extern __declspec(dllexport) -#else -#define ONIG_EXTERN extern __declspec(dllimport) -#endif -#endif -#endif - -#ifndef ONIG_EXTERN -#define ONIG_EXTERN extern -#endif - -/* PART: character encoding */ - -#ifndef ONIG_ESCAPE_UCHAR_COLLISION -#define UChar OnigUChar -#endif - -typedef unsigned char OnigUChar; -typedef unsigned long OnigCodePoint; -typedef unsigned int OnigCtype; -typedef unsigned int OnigDistance; - -#define ONIG_INFINITE_DISTANCE ~((OnigDistance )0) - -typedef unsigned int OnigCaseFoldType; /* case fold flag */ - -ONIG_EXTERN OnigCaseFoldType OnigDefaultCaseFoldFlag; - -/* #define ONIGENC_CASE_FOLD_HIRAGANA_KATAKANA (1<<1) */ -/* #define ONIGENC_CASE_FOLD_KATAKANA_WIDTH (1<<2) */ -#define ONIGENC_CASE_FOLD_TURKISH_AZERI (1<<20) -#define INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR (1<<30) - -#define ONIGENC_CASE_FOLD_MIN INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR -#define ONIGENC_CASE_FOLD_DEFAULT OnigDefaultCaseFoldFlag - - -#define ONIGENC_MAX_COMP_CASE_FOLD_CODE_LEN 3 -#define ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM 13 -/* 13 => Unicode:0x1ffc */ - -/* code range */ -#define ONIGENC_CODE_RANGE_NUM(range) ((int )range[0]) -#define ONIGENC_CODE_RANGE_FROM(range,i) range[((i)*2) + 1] -#define ONIGENC_CODE_RANGE_TO(range,i) range[((i)*2) + 2] - -typedef struct { - int byte_len; /* argument(original) character(s) byte length */ - int code_len; /* number of code */ - OnigCodePoint code[ONIGENC_MAX_COMP_CASE_FOLD_CODE_LEN]; -} OnigCaseFoldCodeItem; - -typedef struct { - OnigCodePoint esc; - OnigCodePoint anychar; - OnigCodePoint anytime; - OnigCodePoint zero_or_one_time; - OnigCodePoint one_or_more_time; - OnigCodePoint anychar_anytime; -} OnigMetaCharTableType; - -typedef int (*OnigApplyAllCaseFoldFunc)(OnigCodePoint from, OnigCodePoint* to, int to_len, void* arg); - -typedef struct OnigEncodingTypeST { - int (*mbc_enc_len)(const OnigUChar* p); - const char* name; - int max_enc_len; - int min_enc_len; - int (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end); - OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end); - int (*code_to_mbclen)(OnigCodePoint code); - int (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf); - int (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to); - int (*apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg); - int (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[]); - int (*property_name_to_ctype)(struct OnigEncodingTypeST* enc, OnigUChar* p, OnigUChar* end); - int (*is_code_ctype)(OnigCodePoint code, OnigCtype ctype); - int (*get_ctype_code_range)(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[]); - OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p); - int (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end); -} OnigEncodingType; - -typedef OnigEncodingType* OnigEncoding; - -ONIG_EXTERN OnigEncodingType OnigEncodingASCII; -ONIG_EXTERN OnigEncodingType OnigEncodingUTF16_BE; -ONIG_EXTERN OnigEncodingType OnigEncodingUTF16_LE; -ONIG_EXTERN OnigEncodingType OnigEncodingUTF32_BE; -ONIG_EXTERN OnigEncodingType OnigEncodingUTF32_LE; - -#define ONIG_ENCODING_ASCII (&OnigEncodingASCII) -#define ONIG_ENCODING_UTF16_BE (&OnigEncodingUTF16_BE) -#define ONIG_ENCODING_UTF16_LE (&OnigEncodingUTF16_LE) -#define ONIG_ENCODING_UTF32_BE (&OnigEncodingUTF32_BE) -#define ONIG_ENCODING_UTF32_LE (&OnigEncodingUTF32_LE) - -#define ONIG_ENCODING_UNDEF ((OnigEncoding )0) - - -/* work size */ -#define ONIGENC_CODE_TO_MBC_MAXLEN 7 -#define ONIGENC_MBC_CASE_FOLD_MAXLEN 18 -/* 18: 6(max-byte) * 3(case-fold chars) */ - -/* character types */ -#define ONIGENC_CTYPE_NEWLINE 0 -#define ONIGENC_CTYPE_ALPHA 1 -#define ONIGENC_CTYPE_BLANK 2 -#define ONIGENC_CTYPE_CNTRL 3 -#define ONIGENC_CTYPE_DIGIT 4 -#define ONIGENC_CTYPE_GRAPH 5 -#define ONIGENC_CTYPE_LOWER 6 -#define ONIGENC_CTYPE_PRINT 7 -#define ONIGENC_CTYPE_PUNCT 8 -#define ONIGENC_CTYPE_SPACE 9 -#define ONIGENC_CTYPE_UPPER 10 -#define ONIGENC_CTYPE_XDIGIT 11 -#define ONIGENC_CTYPE_WORD 12 -#define ONIGENC_CTYPE_ALNUM 13 /* alpha || digit */ -#define ONIGENC_CTYPE_ASCII 14 -#define ONIGENC_MAX_STD_CTYPE ONIGENC_CTYPE_ASCII - - -#define onig_enc_len(enc,p,end) ONIGENC_MBC_ENC_LEN(enc,p) - -#define ONIGENC_IS_UNDEF(enc) ((enc) == ONIG_ENCODING_UNDEF) -#define ONIGENC_IS_SINGLEBYTE(enc) (ONIGENC_MBC_MAXLEN(enc) == 1) -#define ONIGENC_IS_MBC_HEAD(enc,p) (ONIGENC_MBC_ENC_LEN(enc,p) != 1) -#define ONIGENC_IS_MBC_ASCII(p) (*(p) < 128) -#define ONIGENC_IS_CODE_ASCII(code) ((code) < 128) -#define ONIGENC_IS_MBC_WORD(enc,s,end) \ - ONIGENC_IS_CODE_WORD(enc,ONIGENC_MBC_TO_CODE(enc,s,end)) - - -#define ONIGENC_NAME(enc) ((enc)->name) - -#define ONIGENC_MBC_CASE_FOLD(enc,flag,pp,end,buf) \ - (enc)->mbc_case_fold(flag,(const OnigUChar** )pp,end,buf) -#define ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc,s,end) \ - (enc)->is_allowed_reverse_match(s,end) -#define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,start,s) \ - (enc)->left_adjust_char_head(start, s) -#define ONIGENC_APPLY_ALL_CASE_FOLD(enc,case_fold_flag,f,arg) \ - (enc)->apply_all_case_fold(case_fold_flag,f,arg) -#define ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc,case_fold_flag,p,end,acs) \ - (enc)->get_case_fold_codes_by_str(case_fold_flag,p,end,acs) -#define ONIGENC_STEP_BACK(enc,start,s,n) \ - onigenc_step_back((enc),(start),(s),(n)) - -#define ONIGENC_MBC_ENC_LEN(enc,p) (enc)->mbc_enc_len(p) -#define ONIGENC_MBC_MAXLEN(enc) ((enc)->max_enc_len) -#define ONIGENC_MBC_MAXLEN_DIST(enc) ONIGENC_MBC_MAXLEN(enc) -#define ONIGENC_MBC_MINLEN(enc) ((enc)->min_enc_len) -#define ONIGENC_IS_MBC_NEWLINE(enc,p,end) (enc)->is_mbc_newline((p),(end)) -#define ONIGENC_MBC_TO_CODE(enc,p,end) (enc)->mbc_to_code((p),(end)) -#define ONIGENC_CODE_TO_MBCLEN(enc,code) (enc)->code_to_mbclen(code) -#define ONIGENC_CODE_TO_MBC(enc,code,buf) (enc)->code_to_mbc(code,buf) -#define ONIGENC_PROPERTY_NAME_TO_CTYPE(enc,p,end) \ - (enc)->property_name_to_ctype(enc,p,end) - -#define ONIGENC_IS_CODE_CTYPE(enc,code,ctype) (enc)->is_code_ctype(code,ctype) - -#define ONIGENC_IS_CODE_NEWLINE(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_NEWLINE) -#define ONIGENC_IS_CODE_GRAPH(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_GRAPH) -#define ONIGENC_IS_CODE_PRINT(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PRINT) -#define ONIGENC_IS_CODE_ALNUM(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALNUM) -#define ONIGENC_IS_CODE_ALPHA(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALPHA) -#define ONIGENC_IS_CODE_LOWER(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_LOWER) -#define ONIGENC_IS_CODE_UPPER(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_UPPER) -#define ONIGENC_IS_CODE_CNTRL(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_CNTRL) -#define ONIGENC_IS_CODE_PUNCT(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PUNCT) -#define ONIGENC_IS_CODE_SPACE(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_SPACE) -#define ONIGENC_IS_CODE_BLANK(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_BLANK) -#define ONIGENC_IS_CODE_DIGIT(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_DIGIT) -#define ONIGENC_IS_CODE_XDIGIT(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_XDIGIT) -#define ONIGENC_IS_CODE_WORD(enc,code) \ - ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_WORD) - -#define ONIGENC_GET_CTYPE_CODE_RANGE(enc,ctype,sbout,ranges) \ - (enc)->get_ctype_code_range(ctype,sbout,ranges) - -ONIG_EXTERN -OnigUChar* onigenc_step_back P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, int n)); - - -/* encoding API */ -ONIG_EXTERN -int onigenc_init P_((void)); -ONIG_EXTERN -int onigenc_set_default_encoding P_((OnigEncoding enc)); -ONIG_EXTERN -OnigEncoding onigenc_get_default_encoding P_((void)); -ONIG_EXTERN -void onigenc_set_default_caseconv_table P_((const OnigUChar* table)); -ONIG_EXTERN -OnigUChar* onigenc_get_right_adjust_char_head_with_prev P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar** prev)); -ONIG_EXTERN -OnigUChar* onigenc_get_prev_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s)); -ONIG_EXTERN -OnigUChar* onigenc_get_left_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s)); -ONIG_EXTERN -OnigUChar* onigenc_get_right_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s)); -ONIG_EXTERN -int onigenc_strlen P_((OnigEncoding enc, const OnigUChar* p, const OnigUChar* end)); -ONIG_EXTERN -int onigenc_strlen_null P_((OnigEncoding enc, const OnigUChar* p)); -ONIG_EXTERN -int onigenc_str_bytelen_null P_((OnigEncoding enc, const OnigUChar* p)); - - - -/* PART: regular expression */ - -/* config parameters */ -#define ONIG_NREGION 10 -#define ONIG_MAX_BACKREF_NUM 1000 -#define ONIG_MAX_REPEAT_NUM 100000 -#define ONIG_MAX_MULTI_BYTE_RANGES_NUM 10000 -/* constants */ -#define ONIG_MAX_ERROR_MESSAGE_LEN 90 - -typedef unsigned int OnigOptionType; - -#define ONIG_OPTION_DEFAULT ONIG_OPTION_NONE - -/* options */ -#define ONIG_OPTION_NONE 0U -#define ONIG_OPTION_IGNORECASE 1U -#define ONIG_OPTION_EXTEND (ONIG_OPTION_IGNORECASE << 1) -#define ONIG_OPTION_MULTILINE (ONIG_OPTION_EXTEND << 1) -#define ONIG_OPTION_SINGLELINE (ONIG_OPTION_MULTILINE << 1) -#define ONIG_OPTION_FIND_LONGEST (ONIG_OPTION_SINGLELINE << 1) -#define ONIG_OPTION_FIND_NOT_EMPTY (ONIG_OPTION_FIND_LONGEST << 1) -#define ONIG_OPTION_NEGATE_SINGLELINE (ONIG_OPTION_FIND_NOT_EMPTY << 1) -#define ONIG_OPTION_DONT_CAPTURE_GROUP (ONIG_OPTION_NEGATE_SINGLELINE << 1) -#define ONIG_OPTION_CAPTURE_GROUP (ONIG_OPTION_DONT_CAPTURE_GROUP << 1) -/* options (search time) */ -#define ONIG_OPTION_NOTBOL (ONIG_OPTION_CAPTURE_GROUP << 1) -#define ONIG_OPTION_NOTEOL (ONIG_OPTION_NOTBOL << 1) -#define ONIG_OPTION_POSIX_REGION (ONIG_OPTION_NOTEOL << 1) -#define ONIG_OPTION_MAXBIT ONIG_OPTION_POSIX_REGION /* limit */ - -#define ONIG_OPTION_ON(options,regopt) ((options) |= (regopt)) -#define ONIG_OPTION_OFF(options,regopt) ((options) &= ~(regopt)) -#define ONIG_IS_OPTION_ON(options,option) ((options) & (option)) - -/* syntax */ -typedef struct { - unsigned int op; - unsigned int op2; - unsigned int behavior; - OnigOptionType options; /* default option */ - OnigMetaCharTableType meta_char_table; -} OnigSyntaxType; - -ONIG_EXTERN OnigSyntaxType OnigSyntaxASIS; -ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixBasic; -ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixExtended; -ONIG_EXTERN OnigSyntaxType OnigSyntaxEmacs; -ONIG_EXTERN OnigSyntaxType OnigSyntaxGrep; -ONIG_EXTERN OnigSyntaxType OnigSyntaxGnuRegex; -ONIG_EXTERN OnigSyntaxType OnigSyntaxJava; -ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl; -ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl_NG; -ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby; - -/* predefined syntaxes (see regsyntax.c) */ -#define ONIG_SYNTAX_ASIS (&OnigSyntaxASIS) -#define ONIG_SYNTAX_POSIX_BASIC (&OnigSyntaxPosixBasic) -#define ONIG_SYNTAX_POSIX_EXTENDED (&OnigSyntaxPosixExtended) -#define ONIG_SYNTAX_EMACS (&OnigSyntaxEmacs) -#define ONIG_SYNTAX_GREP (&OnigSyntaxGrep) -#define ONIG_SYNTAX_GNU_REGEX (&OnigSyntaxGnuRegex) -#define ONIG_SYNTAX_JAVA (&OnigSyntaxJava) -#define ONIG_SYNTAX_PERL (&OnigSyntaxPerl) -#define ONIG_SYNTAX_PERL_NG (&OnigSyntaxPerl_NG) -#define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby) - -/* default syntax */ -ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax; -#define ONIG_SYNTAX_DEFAULT OnigDefaultSyntax - -/* syntax (operators) */ -#define ONIG_SYN_OP_VARIABLE_META_CHARACTERS (1U<<0) -#define ONIG_SYN_OP_DOT_ANYCHAR (1U<<1) /* . */ -#define ONIG_SYN_OP_ASTERISK_ZERO_INF (1U<<2) /* * */ -#define ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF (1U<<3) -#define ONIG_SYN_OP_PLUS_ONE_INF (1U<<4) /* + */ -#define ONIG_SYN_OP_ESC_PLUS_ONE_INF (1U<<5) -#define ONIG_SYN_OP_QMARK_ZERO_ONE (1U<<6) /* ? */ -#define ONIG_SYN_OP_ESC_QMARK_ZERO_ONE (1U<<7) -#define ONIG_SYN_OP_BRACE_INTERVAL (1U<<8) /* {lower,upper} */ -#define ONIG_SYN_OP_ESC_BRACE_INTERVAL (1U<<9) /* \{lower,upper\} */ -#define ONIG_SYN_OP_VBAR_ALT (1U<<10) /* | */ -#define ONIG_SYN_OP_ESC_VBAR_ALT (1U<<11) /* \| */ -#define ONIG_SYN_OP_LPAREN_SUBEXP (1U<<12) /* (...) */ -#define ONIG_SYN_OP_ESC_LPAREN_SUBEXP (1U<<13) /* \(...\) */ -#define ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR (1U<<14) /* \A, \Z, \z */ -#define ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR (1U<<15) /* \G */ -#define ONIG_SYN_OP_DECIMAL_BACKREF (1U<<16) /* \num */ -#define ONIG_SYN_OP_BRACKET_CC (1U<<17) /* [...] */ -#define ONIG_SYN_OP_ESC_W_WORD (1U<<18) /* \w, \W */ -#define ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END (1U<<19) /* \<. \> */ -#define ONIG_SYN_OP_ESC_B_WORD_BOUND (1U<<20) /* \b, \B */ -#define ONIG_SYN_OP_ESC_S_WHITE_SPACE (1U<<21) /* \s, \S */ -#define ONIG_SYN_OP_ESC_D_DIGIT (1U<<22) /* \d, \D */ -#define ONIG_SYN_OP_LINE_ANCHOR (1U<<23) /* ^, $ */ -#define ONIG_SYN_OP_POSIX_BRACKET (1U<<24) /* [:xxxx:] */ -#define ONIG_SYN_OP_QMARK_NON_GREEDY (1U<<25) /* ??,*?,+?,{n,m}? */ -#define ONIG_SYN_OP_ESC_CONTROL_CHARS (1U<<26) /* \n,\r,\t,\a ... */ -#define ONIG_SYN_OP_ESC_C_CONTROL (1U<<27) /* \cx */ -#define ONIG_SYN_OP_ESC_OCTAL3 (1U<<28) /* \OOO */ -#define ONIG_SYN_OP_ESC_X_HEX2 (1U<<29) /* \xHH */ -#define ONIG_SYN_OP_ESC_X_BRACE_HEX8 (1U<<30) /* \x{7HHHHHHH} */ - -#define ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE (1U<<0) /* \Q...\E */ -#define ONIG_SYN_OP2_QMARK_GROUP_EFFECT (1U<<1) /* (?...) */ -#define ONIG_SYN_OP2_OPTION_PERL (1U<<2) /* (?imsx),(?-imsx) */ -#define ONIG_SYN_OP2_OPTION_RUBY (1U<<3) /* (?imx), (?-imx) */ -#define ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT (1U<<4) /* ?+,*+,++ */ -#define ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL (1U<<5) /* {n,m}+ */ -#define ONIG_SYN_OP2_CCLASS_SET_OP (1U<<6) /* [...&&..[..]..] */ -#define ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP (1U<<7) /* (?...) */ -#define ONIG_SYN_OP2_ESC_K_NAMED_BACKREF (1U<<8) /* \k */ -#define ONIG_SYN_OP2_ESC_G_SUBEXP_CALL (1U<<9) /* \g, \g */ -#define ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY (1U<<10) /* (?@..),(?@..) */ -#define ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL (1U<<11) /* \C-x */ -#define ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META (1U<<12) /* \M-x */ -#define ONIG_SYN_OP2_ESC_V_VTAB (1U<<13) /* \v as VTAB */ -#define ONIG_SYN_OP2_ESC_U_HEX4 (1U<<14) /* \uHHHH */ -#define ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR (1U<<15) /* \`, \' */ -#define ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY (1U<<16) /* \p{...}, \P{...} */ -#define ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT (1U<<17) /* \p{^..}, \P{^..} */ -/* #define ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS (1U<<18) */ -#define ONIG_SYN_OP2_ESC_H_XDIGIT (1U<<19) /* \h, \H */ -#define ONIG_SYN_OP2_INEFFECTIVE_ESCAPE (1U<<20) /* \ */ - -/* syntax (behavior) */ -#define ONIG_SYN_CONTEXT_INDEP_ANCHORS (1U<<31) /* not implemented */ -#define ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS (1U<<0) /* ?, *, +, {n,m} */ -#define ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS (1U<<1) /* error or ignore */ -#define ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP (1U<<2) /* ...)... */ -#define ONIG_SYN_ALLOW_INVALID_INTERVAL (1U<<3) /* {??? */ -#define ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV (1U<<4) /* {,n} => {0,n} */ -#define ONIG_SYN_STRICT_CHECK_BACKREF (1U<<5) /* /(\1)/,/\1()/ ..*/ -#define ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND (1U<<6) /* (?<=a|bc) */ -#define ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP (1U<<7) /* see doc/RE */ -#define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME (1U<<8) /* (?)(?) */ -#define ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY (1U<<9) /* a{n}?=(?:a{n})? */ - -/* syntax (behavior) in char class [...] */ -#define ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC (1U<<20) /* [^...] */ -#define ONIG_SYN_BACKSLASH_ESCAPE_IN_CC (1U<<21) /* [..\w..] etc.. */ -#define ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC (1U<<22) -#define ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC (1U<<23) /* [0-9-a]=[0-9\-a] */ -/* syntax (behavior) warning */ -#define ONIG_SYN_WARN_CC_OP_NOT_ESCAPED (1U<<24) /* [,-,] */ -#define ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT (1U<<25) /* (?:a*)+ */ - -/* meta character specifiers (onig_set_meta_char()) */ -#define ONIG_META_CHAR_ESCAPE 0 -#define ONIG_META_CHAR_ANYCHAR 1 -#define ONIG_META_CHAR_ANYTIME 2 -#define ONIG_META_CHAR_ZERO_OR_ONE_TIME 3 -#define ONIG_META_CHAR_ONE_OR_MORE_TIME 4 -#define ONIG_META_CHAR_ANYCHAR_ANYTIME 5 - -#define ONIG_INEFFECTIVE_META_CHAR 0 - -/* error codes */ -#define ONIG_IS_PATTERN_ERROR(ecode) ((ecode) <= -100 && (ecode) > -1000) -/* normal return */ -#define ONIG_NORMAL 0 -#define ONIG_MISMATCH -1 -#define ONIG_NO_SUPPORT_CONFIG -2 - -/* internal error */ -#define ONIGERR_MEMORY -5 -#define ONIGERR_TYPE_BUG -6 -#define ONIGERR_PARSER_BUG -11 -#define ONIGERR_STACK_BUG -12 -#define ONIGERR_UNDEFINED_BYTECODE -13 -#define ONIGERR_UNEXPECTED_BYTECODE -14 -#define ONIGERR_MATCH_STACK_LIMIT_OVER -15 -#define ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED -21 -#define ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR -22 -/* general error */ -#define ONIGERR_INVALID_ARGUMENT -30 -/* syntax error */ -#define ONIGERR_END_PATTERN_AT_LEFT_BRACE -100 -#define ONIGERR_END_PATTERN_AT_LEFT_BRACKET -101 -#define ONIGERR_EMPTY_CHAR_CLASS -102 -#define ONIGERR_PREMATURE_END_OF_CHAR_CLASS -103 -#define ONIGERR_END_PATTERN_AT_ESCAPE -104 -#define ONIGERR_END_PATTERN_AT_META -105 -#define ONIGERR_END_PATTERN_AT_CONTROL -106 -#define ONIGERR_META_CODE_SYNTAX -108 -#define ONIGERR_CONTROL_CODE_SYNTAX -109 -#define ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE -110 -#define ONIGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE -111 -#define ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS -112 -#define ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED -113 -#define ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID -114 -#define ONIGERR_NESTED_REPEAT_OPERATOR -115 -#define ONIGERR_UNMATCHED_CLOSE_PARENTHESIS -116 -#define ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS -117 -#define ONIGERR_END_PATTERN_IN_GROUP -118 -#define ONIGERR_UNDEFINED_GROUP_OPTION -119 -#define ONIGERR_INVALID_POSIX_BRACKET_TYPE -121 -#define ONIGERR_INVALID_LOOK_BEHIND_PATTERN -122 -#define ONIGERR_INVALID_REPEAT_RANGE_PATTERN -123 -/* values error (syntax error) */ -#define ONIGERR_TOO_BIG_NUMBER -200 -#define ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE -201 -#define ONIGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE -202 -#define ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS -203 -#define ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE -204 -#define ONIGERR_TOO_MANY_MULTI_BYTE_RANGES -205 -#define ONIGERR_TOO_SHORT_MULTI_BYTE_STRING -206 -#define ONIGERR_TOO_BIG_BACKREF_NUMBER -207 -#define ONIGERR_INVALID_BACKREF -208 -#define ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED -209 -#define ONIGERR_TOO_LONG_WIDE_CHAR_VALUE -212 -#define ONIGERR_EMPTY_GROUP_NAME -214 -#define ONIGERR_INVALID_GROUP_NAME -215 -#define ONIGERR_INVALID_CHAR_IN_GROUP_NAME -216 -#define ONIGERR_UNDEFINED_NAME_REFERENCE -217 -#define ONIGERR_UNDEFINED_GROUP_REFERENCE -218 -#define ONIGERR_MULTIPLEX_DEFINED_NAME -219 -#define ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL -220 -#define ONIGERR_NEVER_ENDING_RECURSION -221 -#define ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY -222 -#define ONIGERR_INVALID_CHAR_PROPERTY_NAME -223 -#define ONIGERR_INVALID_CODE_POINT_VALUE -400 -#define ONIGERR_INVALID_WIDE_CHAR_VALUE -400 -#define ONIGERR_TOO_BIG_WIDE_CHAR_VALUE -401 -#define ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION -402 -#define ONIGERR_INVALID_COMBINATION_OF_OPTIONS -403 - -/* errors related to thread */ -#define ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT -1001 - - -/* must be smaller than BIT_STATUS_BITS_NUM (unsigned int * 8) */ -#define ONIG_MAX_CAPTURE_HISTORY_GROUP 31 -#define ONIG_IS_CAPTURE_HISTORY_GROUP(r, i) \ - ((i) <= ONIG_MAX_CAPTURE_HISTORY_GROUP && (r)->list && (r)->list[i]) - -typedef struct OnigCaptureTreeNodeStruct { - int group; /* group number */ - int beg; - int end; - int allocated; - int num_childs; - struct OnigCaptureTreeNodeStruct** childs; -} OnigCaptureTreeNode; - -/* match result region type */ -struct re_registers { - int allocated; - int num_regs; - int* beg; - int* end; - /* extended */ - OnigCaptureTreeNode* history_root; /* capture history tree root */ -}; - -/* capture tree traverse */ -#define ONIG_TRAVERSE_CALLBACK_AT_FIRST 1 -#define ONIG_TRAVERSE_CALLBACK_AT_LAST 2 -#define ONIG_TRAVERSE_CALLBACK_AT_BOTH \ - ( ONIG_TRAVERSE_CALLBACK_AT_FIRST | ONIG_TRAVERSE_CALLBACK_AT_LAST ) - - -#define ONIG_REGION_NOTPOS -1 - -typedef struct re_registers OnigRegion; - -typedef struct { - OnigEncoding enc; - OnigUChar* par; - OnigUChar* par_end; -} OnigErrorInfo; - -typedef struct { - int lower; - int upper; -} OnigRepeatRange; - -typedef void (*OnigWarnFunc) P_((const char* s)); -extern void onig_null_warn P_((const char* s)); -#define ONIG_NULL_WARN onig_null_warn - -#define ONIG_CHAR_TABLE_SIZE 256 - -/* regex_t state */ -#define ONIG_STATE_NORMAL 0 -#define ONIG_STATE_SEARCHING 1 -#define ONIG_STATE_COMPILING -1 -#define ONIG_STATE_MODIFY -2 - -#define ONIG_STATE(reg) \ - ((reg)->state > 0 ? ONIG_STATE_SEARCHING : (reg)->state) - -typedef struct re_pattern_buffer { - /* common members of BBuf(bytes-buffer) */ - unsigned char* p; /* compiled pattern */ - unsigned int used; /* used space for p */ - unsigned int alloc; /* allocated space for p */ - - int state; /* normal, searching, compiling */ - int num_mem; /* used memory(...) num counted from 1 */ - int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */ - int num_null_check; /* OP_NULL_CHECK_START/END id counter */ - int num_comb_exp_check; /* combination explosion check */ - int num_call; /* number of subexp call */ - unsigned int capture_history; /* (?@...) flag (1-31) */ - unsigned int bt_mem_start; /* need backtrack flag */ - unsigned int bt_mem_end; /* need backtrack flag */ - int stack_pop_level; - int repeat_range_alloc; - OnigRepeatRange* repeat_range; - - OnigEncoding enc; - OnigOptionType options; - OnigSyntaxType* syntax; - OnigCaseFoldType case_fold_flag; - void* name_table; - - /* optimization info (string search, char-map and anchors) */ - int optimize; /* optimize flag */ - int threshold_len; /* search str-length for apply optimize */ - int anchor; /* BEGIN_BUF, BEGIN_POS, (SEMI_)END_BUF */ - OnigDistance anchor_dmin; /* (SEMI_)END_BUF anchor distance */ - OnigDistance anchor_dmax; /* (SEMI_)END_BUF anchor distance */ - int sub_anchor; /* start-anchor for exact or map */ - unsigned char *exact; - unsigned char *exact_end; - unsigned char map[ONIG_CHAR_TABLE_SIZE]; /* used as BM skip or char-map */ - int *int_map; /* BM skip for exact_len > 255 */ - int *int_map_backward; /* BM skip for backward search */ - OnigDistance dmin; /* min-distance of exact or map */ - OnigDistance dmax; /* max-distance of exact or map */ - - /* regex_t link chain */ - struct re_pattern_buffer* chain; /* escape compile-conflict */ -} OnigRegexType; - -typedef OnigRegexType* OnigRegex; - -#ifndef ONIG_ESCAPE_REGEX_T_COLLISION - typedef OnigRegexType regex_t; -#endif - - -typedef struct { - int num_of_elements; - OnigEncoding pattern_enc; - OnigEncoding target_enc; - OnigSyntaxType* syntax; - OnigOptionType option; - OnigCaseFoldType case_fold_flag; -} OnigCompileInfo; - -/* Oniguruma Native API */ -ONIG_EXTERN -int onig_init P_((void)); -ONIG_EXTERN -int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...)); -ONIG_EXTERN -void onig_set_warn_func P_((OnigWarnFunc f)); -ONIG_EXTERN -void onig_set_verb_warn_func P_((OnigWarnFunc f)); -ONIG_EXTERN -int onig_new P_((OnigRegex*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo)); -ONIG_EXTERN -int onig_reg_init P_((regex_t* reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, OnigSyntaxType* syntax)); -int onig_new_without_alloc P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo)); -ONIG_EXTERN -int onig_new_deluxe P_((OnigRegex* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo)); -ONIG_EXTERN -void onig_free P_((OnigRegex)); -ONIG_EXTERN -void onig_free_body P_((OnigRegex)); -ONIG_EXTERN -int onig_recompile P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo)); -ONIG_EXTERN -int onig_recompile_deluxe P_((OnigRegex reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo)); -ONIG_EXTERN -int onig_search P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option)); -ONIG_EXTERN -int onig_match P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option)); -ONIG_EXTERN -OnigRegion* onig_region_new P_((void)); -ONIG_EXTERN -void onig_region_init P_((OnigRegion* region)); -ONIG_EXTERN -void onig_region_free P_((OnigRegion* region, int free_self)); -ONIG_EXTERN -void onig_region_copy P_((OnigRegion* to, OnigRegion* from)); -ONIG_EXTERN -void onig_region_clear P_((OnigRegion* region)); -ONIG_EXTERN -int onig_region_resize P_((OnigRegion* region, int n)); -ONIG_EXTERN -int onig_region_set P_((OnigRegion* region, int at, int beg, int end)); -ONIG_EXTERN -int onig_name_to_group_numbers P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, int** nums)); -ONIG_EXTERN -int onig_name_to_backref_number P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, OnigRegion *region)); -ONIG_EXTERN -int onig_foreach_name P_((OnigRegex reg, int (*func)(const OnigUChar*, const OnigUChar*,int,int*,OnigRegex,void*), void* arg)); -ONIG_EXTERN -int onig_number_of_names P_((OnigRegex reg)); -ONIG_EXTERN -int onig_number_of_captures P_((OnigRegex reg)); -ONIG_EXTERN -int onig_number_of_capture_histories P_((OnigRegex reg)); -ONIG_EXTERN -OnigCaptureTreeNode* onig_get_capture_tree P_((OnigRegion* region)); -ONIG_EXTERN -int onig_capture_tree_traverse P_((OnigRegion* region, int at, int(*callback_func)(int,int,int,int,int,void*), void* arg)); -ONIG_EXTERN -int onig_noname_group_capture_is_active P_((OnigRegex reg)); -ONIG_EXTERN -OnigEncoding onig_get_encoding P_((OnigRegex reg)); -ONIG_EXTERN -OnigOptionType onig_get_options P_((OnigRegex reg)); -ONIG_EXTERN -OnigCaseFoldType onig_get_case_fold_flag P_((OnigRegex reg)); -ONIG_EXTERN -OnigSyntaxType* onig_get_syntax P_((OnigRegex reg)); -ONIG_EXTERN -int onig_set_default_syntax P_((OnigSyntaxType* syntax)); -ONIG_EXTERN -void onig_copy_syntax P_((OnigSyntaxType* to, OnigSyntaxType* from)); -ONIG_EXTERN -unsigned int onig_get_syntax_op P_((OnigSyntaxType* syntax)); -ONIG_EXTERN -unsigned int onig_get_syntax_op2 P_((OnigSyntaxType* syntax)); -ONIG_EXTERN -unsigned int onig_get_syntax_behavior P_((OnigSyntaxType* syntax)); -ONIG_EXTERN -OnigOptionType onig_get_syntax_options P_((OnigSyntaxType* syntax)); -ONIG_EXTERN -void onig_set_syntax_op P_((OnigSyntaxType* syntax, unsigned int op)); -ONIG_EXTERN -void onig_set_syntax_op2 P_((OnigSyntaxType* syntax, unsigned int op2)); -ONIG_EXTERN -void onig_set_syntax_behavior P_((OnigSyntaxType* syntax, unsigned int behavior)); -ONIG_EXTERN -void onig_set_syntax_options P_((OnigSyntaxType* syntax, OnigOptionType options)); -ONIG_EXTERN -int onig_set_meta_char P_((OnigSyntaxType* syntax, unsigned int what, OnigCodePoint code)); -ONIG_EXTERN -void onig_copy_encoding P_((OnigEncoding to, OnigEncoding from)); -ONIG_EXTERN -OnigCaseFoldType onig_get_default_case_fold_flag P_((void)); -ONIG_EXTERN -int onig_set_default_case_fold_flag P_((OnigCaseFoldType case_fold_flag)); -ONIG_EXTERN -unsigned int onig_get_match_stack_limit_size P_((void)); -ONIG_EXTERN -int onig_set_match_stack_limit_size P_((unsigned int size)); -ONIG_EXTERN -int onig_end P_((void)); -ONIG_EXTERN -const char* onig_version P_((void)); -ONIG_EXTERN -const char* onig_copyright P_((void)); - -#ifdef __cplusplus -} -#endif - -#endif /* ONIGURUMA_H */ diff --git a/frameworks/CocoaOniguruma.framework/Versions/A/Resources/English.lproj/InfoPlist.strings b/frameworks/CocoaOniguruma.framework/Versions/A/Resources/English.lproj/InfoPlist.strings deleted file mode 100644 index 39d5b82c7..000000000 Binary files a/frameworks/CocoaOniguruma.framework/Versions/A/Resources/English.lproj/InfoPlist.strings and /dev/null differ diff --git a/frameworks/CocoaOniguruma.framework/Versions/A/Resources/Info.plist b/frameworks/CocoaOniguruma.framework/Versions/A/Resources/Info.plist deleted file mode 100644 index d466488d4..000000000 --- a/frameworks/CocoaOniguruma.framework/Versions/A/Resources/Info.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - BuildMachineOSBuild - 11E2620 - CFBundleDevelopmentRegion - English - CFBundleExecutable - CocoaOniguruma - CFBundleIdentifier - net.limechat.CocoaOniguruma - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - CocoaOniguruma - CFBundlePackageType - FMWK - CFBundleSignature - ???? - CFBundleVersion - 1.0 - DTCompiler - - DTPlatformBuild - 4E3002 - DTPlatformVersion - GM - DTSDKBuild - 11E2620 - DTSDKName - - DTXcode - 0433 - DTXcodeBuild - 4E3002 - - diff --git a/frameworks/CocoaOniguruma.framework/Versions/Current b/frameworks/CocoaOniguruma.framework/Versions/Current deleted file mode 120000 index 8c7e5a667..000000000 --- a/frameworks/CocoaOniguruma.framework/Versions/Current +++ /dev/null @@ -1 +0,0 @@ -A \ No newline at end of file diff --git a/frameworks/Sparkle.framework/Headers b/frameworks/Sparkle.framework/Headers deleted file mode 120000 index a177d2a6b..000000000 --- a/frameworks/Sparkle.framework/Headers +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Headers \ No newline at end of file diff --git a/frameworks/Sparkle.framework/Resources b/frameworks/Sparkle.framework/Resources deleted file mode 120000 index 953ee36f3..000000000 --- a/frameworks/Sparkle.framework/Resources +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Resources \ No newline at end of file diff --git a/frameworks/Sparkle.framework/Sparkle b/frameworks/Sparkle.framework/Sparkle deleted file mode 120000 index b2c52731e..000000000 --- a/frameworks/Sparkle.framework/Sparkle +++ /dev/null @@ -1 +0,0 @@ -Versions/Current/Sparkle \ No newline at end of file diff --git a/frameworks/Sparkle.framework/Versions/A/Headers/SUAppcast.h b/frameworks/Sparkle.framework/Versions/A/Headers/SUAppcast.h deleted file mode 100644 index 5a60d2fda..000000000 --- a/frameworks/Sparkle.framework/Versions/A/Headers/SUAppcast.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// SUAppcast.h -// Sparkle -// -// Created by Andy Matuschak on 3/12/06. -// Copyright 2006 Andy Matuschak. All rights reserved. -// - -#ifndef SUAPPCAST_H -#define SUAPPCAST_H - -@class SUAppcastItem; -@interface SUAppcast : NSObject -{ -@private - NSArray *items; - NSString *userAgentString; - id delegate; - NSString *downloadFilename; - NSURLDownload *download; -} - -- (void)fetchAppcastFromURL:(NSURL *)url; -- (void)setDelegate:delegate; -- (void)setUserAgentString:(NSString *)userAgentString; - -- (NSArray *)items; - -@end - -@interface NSObject (SUAppcastDelegate) -- (void)appcastDidFinishLoading:(SUAppcast *)appcast; -- (void)appcast:(SUAppcast *)appcast failedToLoadWithError:(NSError *)error; -@end - -#endif diff --git a/frameworks/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h b/frameworks/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h deleted file mode 100644 index d1067321a..000000000 --- a/frameworks/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h +++ /dev/null @@ -1,58 +0,0 @@ -// -// SUAppcastItem.h -// Sparkle -// -// Created by Andy Matuschak on 3/12/06. -// Copyright 2006 Andy Matuschak. All rights reserved. -// - -#ifndef SUAPPCASTITEM_H -#define SUAPPCASTITEM_H - -@interface SUAppcastItem : NSObject -{ -@private - NSString *title; - NSDate *date; - NSString *itemDescription; - - NSURL *releaseNotesURL; - - NSString *DSASignature; - NSString *minimumSystemVersion; - - NSURL *fileURL; - NSString *versionString; - NSString *displayVersionString; - - NSDictionary *deltaUpdates; - - NSDictionary *propertiesDictionary; - - NSURL *infoURL; // UK 2007-08-31 -} - -// Initializes with data from a dictionary provided by the RSS class. -- initWithDictionary:(NSDictionary *)dict; -- initWithDictionary:(NSDictionary *)dict failureReason:(NSString**)error; - -- (NSString *)title; -- (NSString *)versionString; -- (NSString *)displayVersionString; -- (NSDate *)date; -- (NSString *)itemDescription; -- (NSURL *)releaseNotesURL; -- (NSURL *)fileURL; -- (NSString *)DSASignature; -- (NSString *)minimumSystemVersion; -- (NSDictionary *)deltaUpdates; -- (BOOL)isDeltaUpdate; - -// Returns the dictionary provided in initWithDictionary; this might be useful later for extensions. -- (NSDictionary *)propertiesDictionary; - -- (NSURL *)infoURL; // UK 2007-08-31 - -@end - -#endif diff --git a/frameworks/Sparkle.framework/Versions/A/Headers/SUUpdater.h b/frameworks/Sparkle.framework/Versions/A/Headers/SUUpdater.h deleted file mode 100644 index ff04620c7..000000000 --- a/frameworks/Sparkle.framework/Versions/A/Headers/SUUpdater.h +++ /dev/null @@ -1,161 +0,0 @@ -// -// SUUpdater.h -// Sparkle -// -// Created by Andy Matuschak on 1/4/06. -// Copyright 2006 Andy Matuschak. All rights reserved. -// - -#ifndef SUUPDATER_H -#define SUUPDATER_H - -#import "SUVersionComparisonProtocol.h" -#import "SUVersionDisplayProtocol.h" - -@class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast; - -@interface SUUpdater : NSObject -{ -@private - NSTimer *checkTimer; - SUUpdateDriver *driver; - - NSString *customUserAgentString; - SUHost *host; - IBOutlet id delegate; -} - -+ (SUUpdater *)sharedUpdater; -+ (SUUpdater *)updaterForBundle:(NSBundle *)bundle; -- initForBundle:(NSBundle *)bundle; - -- (NSBundle *)hostBundle; - -- (void)setDelegate:(id)delegate; -- delegate; - -- (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyChecks; -- (BOOL)automaticallyChecksForUpdates; - -- (void)setUpdateCheckInterval:(NSTimeInterval)interval; -- (NSTimeInterval)updateCheckInterval; - -- (void)setFeedURL:(NSURL *)feedURL; -- (NSURL *)feedURL; // *** MUST BE CALLED ON MAIN THREAD *** - -- (void)setUserAgentString:(NSString *)userAgent; -- (NSString *)userAgentString; - -- (void)setSendsSystemProfile:(BOOL)sendsSystemProfile; -- (BOOL)sendsSystemProfile; - -- (void)setAutomaticallyDownloadsUpdates:(BOOL)automaticallyDownloadsUpdates; -- (BOOL)automaticallyDownloadsUpdates; - -// This IBAction is meant for a main menu item. Hook up any menu item to this action, -// and Sparkle will check for updates and report back its findings verbosely. -- (IBAction)checkForUpdates:(id)sender; - -// This kicks off an update meant to be programmatically initiated. That is, it will display no UI unless it actually finds an update, -// in which case it proceeds as usual. If the fully automated updating is turned on, however, this will invoke that behavior, and if an -// update is found, it will be downloaded and prepped for installation. -- (void)checkForUpdatesInBackground; - -// Date of last update check. Returns nil if no check has been performed. -- (NSDate*)lastUpdateCheckDate; - -// This begins a "probing" check for updates which will not actually offer to update to that version. The delegate methods, though, -// (up to updater:didFindValidUpdate: and updaterDidNotFindUpdate:), are called, so you can use that information in your UI. -- (void)checkForUpdateInformation; - -// Call this to appropriately schedule or cancel the update checking timer according to the preferences for time interval and automatic checks. This call does not change the date of the next check, but only the internal NSTimer. -- (void)resetUpdateCycle; - -- (BOOL)updateInProgress; - -@end - - -// ----------------------------------------------------------------------------- -// SUUpdater Delegate: -// ----------------------------------------------------------------------------- - -@interface NSObject (SUUpdaterDelegateInformalProtocol) - -// Use this to keep Sparkle from popping up e.g. while your setup assistant is showing: -- (BOOL)updaterMayCheckForUpdates:(SUUpdater *)bundle; - -// This method allows you to add extra parameters to the appcast URL, potentially based on whether or not Sparkle will also be sending along the system profile. This method should return an array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user. -- (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile; - -// Override this to dynamically specify the entire URL. -- (NSString*)feedURLStringForUpdater:(SUUpdater*)updater; - -// Use this to override the default behavior for Sparkle prompting the user about automatic update checks. -- (BOOL)updaterShouldPromptForPermissionToCheckForUpdates:(SUUpdater *)bundle; - -// Implement this if you want to do some special handling with the appcast once it finishes loading. -- (void)updater:(SUUpdater *)updater didFinishLoadingAppcast:(SUAppcast *)appcast; - -// If you're using special logic or extensions in your appcast, implement this to use your own logic for finding -// a valid update, if any, in the given appcast. -- (SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forUpdater:(SUUpdater *)bundle; - -// Sent when a valid update is found by the update driver. -- (void)updater:(SUUpdater *)updater didFindValidUpdate:(SUAppcastItem *)update; - -// Sent when a valid update is not found. -- (void)updaterDidNotFindUpdate:(SUUpdater *)update; - -// Sent immediately before installing the specified update. -- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update; - -// Return YES to delay the relaunch until you do some processing; invoke the given NSInvocation to continue. -// This is not called if the user didn't relaunch on the previous update, in that case it will immediately -// restart. -- (BOOL)updater:(SUUpdater *)updater shouldPostponeRelaunchForUpdate:(SUAppcastItem *)update untilInvoking:(NSInvocation *)invocation; - -// Some apps *can not* be relaunched in certain circumstances. They can use this method -// to prevent a relaunch "hard": -- (BOOL)updaterShouldRelaunchApplication:(SUUpdater *)updater; - -// Called immediately before relaunching. -- (void)updaterWillRelaunchApplication:(SUUpdater *)updater; - -// This method allows you to provide a custom version comparator. -// If you don't implement this method or return nil, the standard version comparator will be used. -- (id )versionComparatorForUpdater:(SUUpdater *)updater; - -// This method allows you to provide a custom version comparator. -// If you don't implement this method or return nil, the standard version displayer will be used. -- (id )versionDisplayerForUpdater:(SUUpdater *)updater; - -// Returns the path which is used to relaunch the client after the update is installed. By default, the path of the host bundle. -- (NSString *)pathToRelaunchForUpdater:(SUUpdater *)updater; - -// Called before and after, respectively, an updater shows a modal alert window, to give the host -// the opportunity to hide attached windows etc. that may get in the way: --(void) updaterWillShowModalAlert:(SUUpdater *)updater; --(void) updaterDidShowModalAlert:(SUUpdater *)updater; - -@end - - -// ----------------------------------------------------------------------------- -// Constants: -// ----------------------------------------------------------------------------- - -// Define some minimum intervals to avoid DOS-like checking attacks. These are in seconds. -#if defined(DEBUG) && DEBUG && 0 -#define SU_MIN_CHECK_INTERVAL 60 -#else -#define SU_MIN_CHECK_INTERVAL 60*60 -#endif - -#if defined(DEBUG) && DEBUG && 0 -#define SU_DEFAULT_CHECK_INTERVAL 60 -#else -#define SU_DEFAULT_CHECK_INTERVAL 60*60*24 -#endif - -#endif diff --git a/frameworks/Sparkle.framework/Versions/A/Headers/SUVersionComparisonProtocol.h b/frameworks/Sparkle.framework/Versions/A/Headers/SUVersionComparisonProtocol.h deleted file mode 100644 index 6c65ea45a..000000000 --- a/frameworks/Sparkle.framework/Versions/A/Headers/SUVersionComparisonProtocol.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// SUVersionComparisonProtocol.h -// Sparkle -// -// Created by Andy Matuschak on 12/21/07. -// Copyright 2007 Andy Matuschak. All rights reserved. -// - -#ifndef SUVERSIONCOMPARISONPROTOCOL_H -#define SUVERSIONCOMPARISONPROTOCOL_H - -#import - -/*! - @protocol - @abstract Implement this protocol to provide version comparison facilities for Sparkle. -*/ -@protocol SUVersionComparison - -/*! - @method - @abstract An abstract method to compare two version strings. - @discussion Should return NSOrderedAscending if b > a, NSOrderedDescending if b < a, and NSOrderedSame if they are equivalent. -*/ -- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB; // *** MAY BE CALLED ON NON-MAIN THREAD! - -@end - -#endif diff --git a/frameworks/Sparkle.framework/Versions/A/Headers/SUVersionDisplayProtocol.h b/frameworks/Sparkle.framework/Versions/A/Headers/SUVersionDisplayProtocol.h deleted file mode 100644 index 368b9c9f4..000000000 --- a/frameworks/Sparkle.framework/Versions/A/Headers/SUVersionDisplayProtocol.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// SUVersionDisplayProtocol.h -// EyeTV -// -// Created by Uli Kusterer on 08.12.09. -// Copyright 2009 Elgato Systems GmbH. All rights reserved. -// - -#import - - -/*! - @protocol - @abstract Implement this protocol to apply special formatting to the two - version numbers. -*/ -@protocol SUVersionDisplay - -/*! - @method - @abstract An abstract method to format two version strings. - @discussion You get both so you can display important distinguishing - information, but leave out unnecessary/confusing parts. -*/ --(void) formatVersion: (NSString**)inOutVersionA andVersion: (NSString**)inOutVersionB; - -@end diff --git a/frameworks/Sparkle.framework/Versions/A/Headers/Sparkle.h b/frameworks/Sparkle.framework/Versions/A/Headers/Sparkle.h deleted file mode 100644 index 08dd57775..000000000 --- a/frameworks/Sparkle.framework/Versions/A/Headers/Sparkle.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// Sparkle.h -// Sparkle -// -// Created by Andy Matuschak on 3/16/06. (Modified by CDHW on 23/12/07) -// Copyright 2006 Andy Matuschak. All rights reserved. -// - -#ifndef SPARKLE_H -#define SPARKLE_H - -// This list should include the shared headers. It doesn't matter if some of them aren't shared (unless -// there are name-space collisions) so we can list all of them to start with: - -#import - -#import -#import -#import - -#endif diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/Info.plist b/frameworks/Sparkle.framework/Versions/A/Resources/Info.plist deleted file mode 100644 index 6c9fd86e0..000000000 --- a/frameworks/Sparkle.framework/Versions/A/Resources/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ - - - - - BuildMachineOSBuild - 11C74 - CFBundleDevelopmentRegion - en - CFBundleExecutable - Sparkle - CFBundleIdentifier - org.andymatuschak.Sparkle - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Sparkle - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.5 Beta (git) - CFBundleSignature - ???? - CFBundleVersion - 9aa3015 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 4D502 - DTPlatformVersion - GM - DTSDKBuild - 11C63 - DTSDKName - macosx10.7 - DTXcode - 0421 - DTXcodeBuild - 4D502 - - diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/License.txt b/frameworks/Sparkle.framework/Versions/A/Resources/License.txt deleted file mode 100644 index 08364c631..000000000 --- a/frameworks/Sparkle.framework/Versions/A/Resources/License.txt +++ /dev/null @@ -1,38 +0,0 @@ -Copyright (c) 2006 Andy Matuschak - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -================= -EXTERNAL LICENSES -================= - -License for bspatch.c and bsdiff.c, from bsdiff 4.3 (: -/*- - * Copyright 2003-2005 Colin Percival - * All rights reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted providing that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/SUModelTranslation.plist b/frameworks/Sparkle.framework/Versions/A/Resources/SUModelTranslation.plist deleted file mode 100644 index 63644f088..000000000 --- a/frameworks/Sparkle.framework/Versions/A/Resources/SUModelTranslation.plist +++ /dev/null @@ -1,182 +0,0 @@ - - - - - ADP2,1 - Developer Transition Kit - iMac1,1 - iMac G3 (Rev A-D) - iMac4,1 - iMac (Core Duo) - iMac4,2 - iMac for Education (17-inch, Core Duo) - iMac5,1 - iMac (Core 2 Duo, 17 or 20 inch, SuperDrive) - iMac5,2 - iMac (Core 2 Duo, 17 inch, Combo Drive) - iMac6,1 - iMac (Core 2 Duo, 24 inch, SuperDrive) - iMac8,1 - iMac (April 2008) - MacBook1,1 - MacBook (Core Duo) - MacBook2,1 - MacBook (Core 2 Duo) - MacBook4,1 - MacBook (Core 2 Duo Feb 2008) - MacBookAir1,1 - MacBook Air (January 2008) - MacBookAir2,1 - MacBook Air (June 2009) - MacBookAir3,1 - MacBook Air (October 2010) - MacBookPro1,1 - MacBook Pro Core Duo (15-inch) - MacBookPro1,2 - MacBook Pro Core Duo (17-inch) - MacBookPro2,1 - MacBook Pro Core 2 Duo (17-inch) - MacBookPro2,2 - MacBook Pro Core 2 Duo (15-inch) - MacBookPro3,1 - MacBook Pro Core 2 Duo (15-inch LED, Core 2 Duo) - MacBookPro3,2 - MacBook Pro Core 2 Duo (17-inch HD, Core 2 Duo) - MacBookPro4,1 - MacBook Pro (Core 2 Duo Feb 2008) - Macmini1,1 - Mac Mini (Core Solo/Duo) - MacPro1,1 - Mac Pro (four-core) - MacPro2,1 - Mac Pro (eight-core) - MacPro3,1 - Mac Pro (January 2008 4- or 8- core "Harpertown") - MacPro4,1 - Mac Pro (March 2009) - MacPro5,1 - Mac Pro (August 2010) - PowerBook1,1 - PowerBook G3 - PowerBook2,1 - iBook G3 - PowerBook2,2 - iBook G3 (FireWire) - PowerBook2,3 - iBook G3 - PowerBook2,4 - iBook G3 - PowerBook3,1 - PowerBook G3 (FireWire) - PowerBook3,2 - PowerBook G4 - PowerBook3,3 - PowerBook G4 (Gigabit Ethernet) - PowerBook3,4 - PowerBook G4 (DVI) - PowerBook3,5 - PowerBook G4 (1GHz / 867MHz) - PowerBook4,1 - iBook G3 (Dual USB, Late 2001) - PowerBook4,2 - iBook G3 (16MB VRAM) - PowerBook4,3 - iBook G3 Opaque 16MB VRAM, 32MB VRAM, Early 2003) - PowerBook5,1 - PowerBook G4 (17 inch) - PowerBook5,2 - PowerBook G4 (15 inch FW 800) - PowerBook5,3 - PowerBook G4 (17-inch 1.33GHz) - PowerBook5,4 - PowerBook G4 (15 inch 1.5/1.33GHz) - PowerBook5,5 - PowerBook G4 (17-inch 1.5GHz) - PowerBook5,6 - PowerBook G4 (15 inch 1.67GHz/1.5GHz) - PowerBook5,7 - PowerBook G4 (17-inch 1.67GHz) - PowerBook5,8 - PowerBook G4 (Double layer SD, 15 inch) - PowerBook5,9 - PowerBook G4 (Double layer SD, 17 inch) - PowerBook6,1 - PowerBook G4 (12 inch) - PowerBook6,2 - PowerBook G4 (12 inch, DVI) - PowerBook6,3 - iBook G4 - PowerBook6,4 - PowerBook G4 (12 inch 1.33GHz) - PowerBook6,5 - iBook G4 (Early-Late 2004) - PowerBook6,7 - iBook G4 (Mid 2005) - PowerBook6,8 - PowerBook G4 (12 inch 1.5GHz) - PowerMac1,1 - Power Macintosh G3 (Blue & White) - PowerMac1,2 - Power Macintosh G4 (PCI Graphics) - PowerMac10,1 - Mac Mini G4 - PowerMac10,2 - Mac Mini (Late 2005) - PowerMac11,2 - Power Macintosh G5 (Late 2005) - PowerMac12,1 - iMac G5 (iSight) - PowerMac2,1 - iMac G3 (Slot-loading CD-ROM) - PowerMac2,2 - iMac G3 (Summer 2000) - PowerMac3,1 - Power Macintosh G4 (AGP Graphics) - PowerMac3,2 - Power Macintosh G4 (AGP Graphics) - PowerMac3,3 - Power Macintosh G4 (Gigabit Ethernet) - PowerMac3,4 - Power Macintosh G4 (Digital Audio) - PowerMac3,5 - Power Macintosh G4 (Quick Silver) - PowerMac3,6 - Power Macintosh G4 (Mirrored Drive Door) - PowerMac4,1 - iMac G3 (Early/Summer 2001) - PowerMac4,2 - iMac G4 (Flat Panel) - PowerMac4,4 - eMac - PowerMac4,5 - iMac G4 (17-inch Flat Panel) - PowerMac5,1 - Power Macintosh G4 Cube - PowerMac6,1 - iMac G4 (USB 2.0) - PowerMac6,3 - iMac G4 (20-inch Flat Panel) - PowerMac6,4 - eMac (USB 2.0, 2005) - PowerMac7,2 - Power Macintosh G5 - PowerMac7,3 - Power Macintosh G5 - PowerMac8,1 - iMac G5 - PowerMac8,2 - iMac G5 (Ambient Light Sensor) - PowerMac9,1 - Power Macintosh G5 (Late 2005) - RackMac1,1 - Xserve G4 - RackMac1,2 - Xserve G4 (slot-loading, cluster node) - RackMac3,1 - Xserve G5 - Xserve1,1 - Xserve (Intel Xeon) - Xserve2,1 - Xserve (January 2008 quad-core) - - diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/SUStatus.nib b/frameworks/Sparkle.framework/Versions/A/Resources/SUStatus.nib deleted file mode 100644 index 74d62f2cf..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/SUStatus.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index 222ec10b2..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib deleted file mode 100644 index fe2d2912e..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index 15d1c8278..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings deleted file mode 100644 index 9bbb99686..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index eddb8a789..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib deleted file mode 100644 index 5a9885223..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index 53d787dc6..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/da.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/da.lproj/Sparkle.strings deleted file mode 100644 index 4725267c2..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/da.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index a5cdc3369..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib deleted file mode 100644 index 0c9c0f291..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index 4e57acddb..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings deleted file mode 100644 index 664946d41..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index a718bac5b..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib deleted file mode 100644 index 40c6d887f..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index 73ede865d..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings deleted file mode 100644 index ebfa934be..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index d268ddf68..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib deleted file mode 100644 index 2430a9b9f..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index 0ff0add5d..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings deleted file mode 100644 index 8e4ab943b..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Info.plist b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Info.plist deleted file mode 100644 index c5ba1c45e..000000000 --- a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Info.plist +++ /dev/null @@ -1,50 +0,0 @@ - - - - - BuildMachineOSBuild - 11C74 - CFBundleDevelopmentRegion - English - CFBundleExecutable - finish_installation - CFBundleIconFile - Sparkle - CFBundleIdentifier - org.andymatuschak.sparkle.finish-installation - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 4D502 - DTPlatformVersion - GM - DTSDKBuild - 11C63 - DTSDKName - macosx10.7 - DTXcode - 0421 - DTXcodeBuild - 4D502 - LSBackgroundOnly - 1 - LSMinimumSystemVersion - 10.4 - LSUIElement - 1 - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/MacOS/finish_installation b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/MacOS/finish_installation deleted file mode 100755 index 4adb2451e..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/MacOS/finish_installation and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/PkgInfo b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/PkgInfo deleted file mode 100644 index bd04210fb..000000000 --- a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPL???? \ No newline at end of file diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/SUStatus.nib b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/SUStatus.nib deleted file mode 100644 index 74d62f2cf..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/SUStatus.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/Sparkle.icns b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/Sparkle.icns deleted file mode 100644 index 8e56d45c0..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/Sparkle.icns and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/cs.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/cs.lproj/Sparkle.strings deleted file mode 100644 index 9bbb99686..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/cs.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/da.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/da.lproj/Sparkle.strings deleted file mode 100644 index 4725267c2..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/da.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/de.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/de.lproj/Sparkle.strings deleted file mode 100644 index 664946d41..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/de.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/en.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/en.lproj/Sparkle.strings deleted file mode 100644 index ebfa934be..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/en.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/es.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/es.lproj/Sparkle.strings deleted file mode 100644 index 8e4ab943b..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/es.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/fr.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/fr.lproj/Sparkle.strings deleted file mode 100644 index 236f807a7..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/fr.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/is.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/is.lproj/Sparkle.strings deleted file mode 100644 index 2ea7c123f..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/is.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/it.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/it.lproj/Sparkle.strings deleted file mode 100644 index 4ccd7affb..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/it.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/ja.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/ja.lproj/Sparkle.strings deleted file mode 100644 index b21ea044d..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/ja.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/nl.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/nl.lproj/Sparkle.strings deleted file mode 100644 index 023c473b2..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/nl.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/pl.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/pl.lproj/Sparkle.strings deleted file mode 100644 index 9a0bc8b9f..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/pl.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/pt_BR.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/pt_BR.lproj/Sparkle.strings deleted file mode 100644 index b67c3b822..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/pt_BR.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/pt_PT.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/pt_PT.lproj/Sparkle.strings deleted file mode 100644 index 497cd8303..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/pt_PT.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/ro.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/ro.lproj/Sparkle.strings deleted file mode 100644 index e6320adfa..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/ro.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/ru.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/ru.lproj/Sparkle.strings deleted file mode 100644 index 7afef95f4..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/ru.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/sl.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/sl.lproj/Sparkle.strings deleted file mode 100644 index 51e3b4647..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/sl.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/sv.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/sv.lproj/Sparkle.strings deleted file mode 100644 index 16c3fb842..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/sv.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/tr.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/tr.lproj/Sparkle.strings deleted file mode 100644 index 32af4914b..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/tr.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/uk.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/uk.lproj/Sparkle.strings deleted file mode 100644 index 6f0e4db95..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/uk.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/zh_CN.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/zh_CN.lproj/Sparkle.strings deleted file mode 100644 index b741758fd..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/zh_CN.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/zh_TW.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/zh_TW.lproj/Sparkle.strings deleted file mode 100644 index c1f7e85ed..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/Resources/zh_TW.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index b6d2b2678..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib deleted file mode 100644 index 172c8ab6a..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index e9126f744..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings deleted file mode 100644 index 236f807a7..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/fr_CA.lproj b/frameworks/Sparkle.framework/Versions/A/Resources/fr_CA.lproj deleted file mode 120000 index f9834a395..000000000 --- a/frameworks/Sparkle.framework/Versions/A/Resources/fr_CA.lproj +++ /dev/null @@ -1 +0,0 @@ -fr.lproj \ No newline at end of file diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index 4e61334e2..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib deleted file mode 100644 index 11c0e1700..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index a5392de39..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/is.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/is.lproj/Sparkle.strings deleted file mode 100644 index 2ea7c123f..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/is.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index 43a112aff..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib deleted file mode 100644 index ad650d77f..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index 597b2ffe7..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings deleted file mode 100644 index 4ccd7affb..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index 6f10c7dd1..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib deleted file mode 100644 index 766acddce..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index ad670f3db..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings deleted file mode 100644 index b21ea044d..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index 31f813aae..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib deleted file mode 100644 index 34f9d44ec..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index fa6378a6e..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index a9fa51aa6..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib deleted file mode 100644 index 22df73ba5..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index 7b6473ffe..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings deleted file mode 100644 index 023c473b2..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index 3320f526d..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib deleted file mode 100644 index 6fb78aa8e..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index 00589de79..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/pl.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/pl.lproj/Sparkle.strings deleted file mode 100644 index 9a0bc8b9f..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/pl.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/pt.lproj b/frameworks/Sparkle.framework/Versions/A/Resources/pt.lproj deleted file mode 120000 index 3c1c9f6dc..000000000 --- a/frameworks/Sparkle.framework/Versions/A/Resources/pt.lproj +++ /dev/null @@ -1 +0,0 @@ -pt_BR.lproj \ No newline at end of file diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index da605425b..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUUpdateAlert.nib deleted file mode 100644 index f9e0817bb..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index fa81c11a1..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/Sparkle.strings deleted file mode 100644 index b67c3b822..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index c0818b022..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUUpdateAlert.nib deleted file mode 100644 index b1b19e0e8..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index be34d39bc..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/Sparkle.strings deleted file mode 100644 index 497cd8303..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/pt_PT.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ro.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/ro.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index e50a8a7a1..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ro.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ro.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/ro.lproj/SUUpdateAlert.nib deleted file mode 100644 index 2205dbeb0..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ro.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ro.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/ro.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index bcaf4b09b..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ro.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ro.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/ro.lproj/Sparkle.strings deleted file mode 100644 index e6320adfa..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ro.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index e2dc6d945..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib deleted file mode 100644 index 7d277d570..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index 2b857f5eb..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings deleted file mode 100644 index 7afef95f4..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index b83375643..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib deleted file mode 100644 index 845fc6fe5..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index d05528bf5..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/sl.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/sl.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index 142c9d4a6..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/sl.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/sl.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/sl.lproj/SUUpdateAlert.nib deleted file mode 100644 index b09b8ef26..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/sl.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/sl.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/sl.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index bc4530e0c..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/sl.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/sl.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/sl.lproj/Sparkle.strings deleted file mode 100644 index 51e3b4647..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/sl.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index 0e6acb30d..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib deleted file mode 100644 index 46bac4211..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index bd3642e3c..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings deleted file mode 100644 index 16c3fb842..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index e18c9ad71..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib deleted file mode 100644 index a20bcd6ed..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index b81322c26..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/tr.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/tr.lproj/Sparkle.strings deleted file mode 100644 index 32af4914b..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/tr.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/uk.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/uk.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index 044c71c59..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/uk.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/uk.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/uk.lproj/SUUpdateAlert.nib deleted file mode 100644 index f8fc4af84..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/uk.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/uk.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/uk.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index f0714ec94..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/uk.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/uk.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/uk.lproj/Sparkle.strings deleted file mode 100644 index 6f0e4db95..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/uk.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index c5746958b..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib deleted file mode 100644 index 884abe8b5..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index 4787b9b80..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings deleted file mode 100644 index b741758fd..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib deleted file mode 100644 index eaef21066..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib b/frameworks/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib deleted file mode 100644 index 8aa7c42c5..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdatePermissionPrompt.nib b/frameworks/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdatePermissionPrompt.nib deleted file mode 100644 index 2afd73755..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdatePermissionPrompt.nib and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/Sparkle.strings b/frameworks/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/Sparkle.strings deleted file mode 100644 index c1f7e85ed..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/Sparkle.strings and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/A/Sparkle b/frameworks/Sparkle.framework/Versions/A/Sparkle deleted file mode 100755 index a3fe7ad0a..000000000 Binary files a/frameworks/Sparkle.framework/Versions/A/Sparkle and /dev/null differ diff --git a/frameworks/Sparkle.framework/Versions/Current b/frameworks/Sparkle.framework/Versions/Current deleted file mode 120000 index 8c7e5a667..000000000 --- a/frameworks/Sparkle.framework/Versions/Current +++ /dev/null @@ -1 +0,0 @@ -A \ No newline at end of file diff --git a/frameworks/ffmpegsumo.so b/frameworks/ffmpegsumo.so deleted file mode 100755 index 183ec37ab..000000000 Binary files a/frameworks/ffmpegsumo.so and /dev/null differ diff --git a/frameworks/libcef.dylib b/frameworks/libcef.dylib deleted file mode 100755 index a1cb9e776..000000000 Binary files a/frameworks/libcef.dylib and /dev/null differ diff --git a/include/capi/cef_app_capi.h b/include/capi/cef_app_capi.h new file mode 100644 index 000000000..e698171d0 --- /dev/null +++ b/include/capi/cef_app_capi.h @@ -0,0 +1,166 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// This function should be called from the application entry point function to +// execute a secondary process. It can be used to run secondary processes from +// the browser client executable (default behavior) or from a separate +// executable specified by the CefSettings.browser_subprocess_path value. If +// called for the browser process (identified by no "type" command-line value) +// it will return immediately with a value of -1. If called for a recognized +// secondary process it will block until the process should exit and then return +// the process exit code. The |application| parameter may be NULL. +/// +CEF_EXPORT int cef_execute_process(const struct _cef_main_args_t* args, + struct _cef_app_t* application); + +/// +// This function should be called on the main application thread to initialize +// the CEF browser process. The |application| parameter may be NULL. A return +// value of true (1) indicates that it succeeded and false (0) indicates that it +// failed. +/// +CEF_EXPORT int cef_initialize(const struct _cef_main_args_t* args, + const struct _cef_settings_t* settings, struct _cef_app_t* application); + +/// +// This function should be called on the main application thread to shut down +// the CEF browser process before the application exits. +/// +CEF_EXPORT void cef_shutdown(); + +/// +// Perform a single iteration of CEF message loop processing. This function is +// used to integrate the CEF message loop into an existing application message +// loop. Care must be taken to balance performance against excessive CPU usage. +// This function should only be called on the main application thread and only +// if cef_initialize() is called with a CefSettings.multi_threaded_message_loop +// value of false (0). This function will not block. +/// +CEF_EXPORT void cef_do_message_loop_work(); + +/// +// Run the CEF message loop. Use this function instead of an application- +// provided message loop to get the best balance between performance and CPU +// usage. This function should only be called on the main application thread and +// only if cef_initialize() is called with a +// CefSettings.multi_threaded_message_loop value of false (0). This function +// will block until a quit message is received by the system. +/// +CEF_EXPORT void cef_run_message_loop(); + +/// +// Quit the CEF message loop that was started by calling cef_run_message_loop(). +// This function should only be called on the main application thread and only +// if cef_run_message_loop() was used. +/// +CEF_EXPORT void cef_quit_message_loop(); + +/// +// Implement this structure to provide handler implementations. Methods will be +// called by the process and/or thread indicated. +/// +typedef struct _cef_app_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Provides an opportunity to view and/or modify command-line arguments before + // processing by CEF and Chromium. The |process_type| value will be NULL for + // the browser process. Do not keep a reference to the cef_command_line_t + // object passed to this function. The CefSettings.command_line_args_disabled + // value can be used to start with an NULL command-line object. Any values + // specified in CefSettings that equate to command-line arguments will be set + // before this function is called. Be cautious when using this function to + // modify command-line arguments for non-browser processes as this may result + // in undefined behavior including crashes. + /// + void (CEF_CALLBACK *on_before_command_line_processing)( + struct _cef_app_t* self, const cef_string_t* process_type, + struct _cef_command_line_t* command_line); + + /// + // Provides an opportunity to register custom schemes. Do not keep a reference + // to the |registrar| object. This function is called on the main thread for + // each process and the registered schemes should be the same across all + // processes. + /// + void (CEF_CALLBACK *on_register_custom_schemes)(struct _cef_app_t* self, + struct _cef_scheme_registrar_t* registrar); + + /// + // Return the handler for resource bundle events. If + // CefSettings.pack_loading_disabled is true (1) a handler must be returned. + // If no handler is returned resources will be loaded from pack files. This + // function is called by the browser and render processes on multiple threads. + /// + struct _cef_resource_bundle_handler_t* ( + CEF_CALLBACK *get_resource_bundle_handler)(struct _cef_app_t* self); + + /// + // Return the handler for functionality specific to the browser process. This + // function is called on multiple threads in the browser process. + /// + struct _cef_browser_process_handler_t* ( + CEF_CALLBACK *get_browser_process_handler)(struct _cef_app_t* self); + + /// + // Return the handler for functionality specific to the render process. This + // function is called on the render process main thread. + /// + struct _cef_render_process_handler_t* ( + CEF_CALLBACK *get_render_process_handler)(struct _cef_app_t* self); +} cef_app_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_ diff --git a/cef/include/capi/cef_base_capi.h b/include/capi/cef_base_capi.h similarity index 100% rename from cef/include/capi/cef_base_capi.h rename to include/capi/cef_base_capi.h diff --git a/include/capi/cef_browser_capi.h b/include/capi/cef_browser_capi.h new file mode 100644 index 000000000..10ba46f24 --- /dev/null +++ b/include/capi/cef_browser_capi.h @@ -0,0 +1,277 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Structure used to represent a browser window. When used in the browser +// process the functions of this structure may be called on any thread unless +// otherwise indicated in the comments. When used in the render process the +// functions of this structure may only be called on the main thread. +/// +typedef struct _cef_browser_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Returns the browser host object. This function can only be called in the + // browser process. + /// + struct _cef_browser_host_t* (CEF_CALLBACK *get_host)( + struct _cef_browser_t* self); + + /// + // Returns true (1) if the browser can navigate backwards. + /// + int (CEF_CALLBACK *can_go_back)(struct _cef_browser_t* self); + + /// + // Navigate backwards. + /// + void (CEF_CALLBACK *go_back)(struct _cef_browser_t* self); + + /// + // Returns true (1) if the browser can navigate forwards. + /// + int (CEF_CALLBACK *can_go_forward)(struct _cef_browser_t* self); + + /// + // Navigate forwards. + /// + void (CEF_CALLBACK *go_forward)(struct _cef_browser_t* self); + + /// + // Returns true (1) if the browser is currently loading. + /// + int (CEF_CALLBACK *is_loading)(struct _cef_browser_t* self); + + /// + // Reload the current page. + /// + void (CEF_CALLBACK *reload)(struct _cef_browser_t* self); + + /// + // Reload the current page ignoring any cached data. + /// + void (CEF_CALLBACK *reload_ignore_cache)(struct _cef_browser_t* self); + + /// + // Stop loading the page. + /// + void (CEF_CALLBACK *stop_load)(struct _cef_browser_t* self); + + /// + // Returns the globally unique identifier for this browser. + /// + int (CEF_CALLBACK *get_identifier)(struct _cef_browser_t* self); + + /// + // Returns true (1) if the window is a popup window. + /// + int (CEF_CALLBACK *is_popup)(struct _cef_browser_t* self); + + // Returns true (1) if a document has been loaded in the browser. + int (CEF_CALLBACK *has_document)(struct _cef_browser_t* self); + + /// + // Returns the main (top-level) frame for the browser window. + /// + struct _cef_frame_t* (CEF_CALLBACK *get_main_frame)( + struct _cef_browser_t* self); + + /// + // Returns the focused frame for the browser window. + /// + struct _cef_frame_t* (CEF_CALLBACK *get_focused_frame)( + struct _cef_browser_t* self); + + /// + // Returns the frame with the specified identifier, or NULL if not found. + /// + struct _cef_frame_t* (CEF_CALLBACK *get_frame_byident)( + struct _cef_browser_t* self, int64 identifier); + + /// + // Returns the frame with the specified name, or NULL if not found. + /// + struct _cef_frame_t* (CEF_CALLBACK *get_frame)(struct _cef_browser_t* self, + const cef_string_t* name); + + /// + // Returns the number of frames that currently exist. + /// + size_t (CEF_CALLBACK *get_frame_count)(struct _cef_browser_t* self); + + /// + // Returns the identifiers of all existing frames. + /// + void (CEF_CALLBACK *get_frame_identifiers)(struct _cef_browser_t* self, + size_t* identifiersCount, int64* identifiers); + + /// + // Returns the names of all existing frames. + /// + void (CEF_CALLBACK *get_frame_names)(struct _cef_browser_t* self, + cef_string_list_t names); + + // + // Send a message to the specified |target_process|. Returns true (1) if the + // message was sent successfully. + /// + int (CEF_CALLBACK *send_process_message)(struct _cef_browser_t* self, + enum cef_process_id_t target_process, + struct _cef_process_message_t* message); +} cef_browser_t; + + +/// +// Structure used to represent the browser process aspects of a browser window. +// The functions of this structure can only be called in the browser process. +// They may be called on any thread in that process unless otherwise indicated +// in the comments. +/// +typedef struct _cef_browser_host_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Returns the hosted browser object. + /// + struct _cef_browser_t* (CEF_CALLBACK *get_browser)( + struct _cef_browser_host_t* self); + + /// + // Call this function before destroying a contained browser window. This + // function performs any internal cleanup that may be needed before the + // browser window is destroyed. + /// + void (CEF_CALLBACK *parent_window_will_close)( + struct _cef_browser_host_t* self); + + /// + // Closes this browser window. + /// + void (CEF_CALLBACK *close_browser)(struct _cef_browser_host_t* self); + + /// + // Set focus for the browser window. If |enable| is true (1) focus will be set + // to the window. Otherwise, focus will be removed. + /// + void (CEF_CALLBACK *set_focus)(struct _cef_browser_host_t* self, int enable); + + /// + // Retrieve the window handle for this browser. + /// + cef_window_handle_t (CEF_CALLBACK *get_window_handle)( + struct _cef_browser_host_t* self); + + /// + // Retrieve the window handle of the browser that opened this browser. Will + // return NULL for non-popup windows. This function can be used in combination + // with custom handling of modal windows. + /// + cef_window_handle_t (CEF_CALLBACK *get_opener_window_handle)( + struct _cef_browser_host_t* self); + + /// + // Returns the client for this browser. + /// + struct _cef_client_t* (CEF_CALLBACK *get_client)( + struct _cef_browser_host_t* self); + + /// + // Returns the DevTools URL for this browser. If |http_scheme| is true (1) the + // returned URL will use the http scheme instead of the chrome-devtools + // scheme. Remote debugging can be enabled by specifying the "remote- + // debugging-port" command-line flag or by setting the + // CefSettings.remote_debugging_port value. If remote debugging is not enabled + // this function will return an NULL string. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_dev_tools_url)( + struct _cef_browser_host_t* self, int http_scheme); + + /// + // Get the zoom level. This function can only be called on the UI thread. + /// + double (CEF_CALLBACK *get_zoom_level)(struct _cef_browser_host_t* self); + + /// + // Change the zoom level to the specified value. + /// + void (CEF_CALLBACK *set_zoom_level)(struct _cef_browser_host_t* self, + double zoomLevel); +} cef_browser_host_t; + + +/// +// Create a new browser window using the window parameters specified by +// |windowInfo|. All values will be copied internally and the actual window will +// be created on the UI thread. This function can be called on any browser +// process thread and will not block. +/// +CEF_EXPORT int cef_browser_host_create_browser( + const cef_window_info_t* windowInfo, struct _cef_client_t* client, + const cef_string_t* url, const struct _cef_browser_settings_t* settings); + +/// +// Create a new browser window using the window parameters specified by +// |windowInfo|. This function can only be called on the browser process UI +// thread. +/// +CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync( + const cef_window_info_t* windowInfo, struct _cef_client_t* client, + const cef_string_t* url, const struct _cef_browser_settings_t* settings); + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ diff --git a/include/capi/cef_browser_process_handler_capi.h b/include/capi/cef_browser_process_handler_capi.h new file mode 100644 index 000000000..b07c9a90b --- /dev/null +++ b/include/capi/cef_browser_process_handler_capi.h @@ -0,0 +1,80 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Structure used to implement browser process callbacks. The functions of this +// structure will be called on the browser process main thread unless otherwise +// indicated. +/// +typedef struct _cef_browser_process_handler_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Return the handler for proxy events. If no handler is returned the default + // system handler will be used. This function is called on the browser process + // IO thread. + /// + struct _cef_proxy_handler_t* (CEF_CALLBACK *get_proxy_handler)( + struct _cef_browser_process_handler_t* self); + + /// + // Called on the browser process UI thread immediately after the CEF context + // has been initialized. + /// + void (CEF_CALLBACK *on_context_initialized)( + struct _cef_browser_process_handler_t* self); +} cef_browser_process_handler_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_ diff --git a/include/capi/cef_callback_capi.h b/include/capi/cef_callback_capi.h new file mode 100644 index 000000000..8f5cbeb62 --- /dev/null +++ b/include/capi/cef_callback_capi.h @@ -0,0 +1,73 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_CALLBACK_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_CALLBACK_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Generic callback structure used for asynchronous continuation. +/// +typedef struct _cef_callback_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Continue processing. + /// + void (CEF_CALLBACK *cont)(struct _cef_callback_t* self); + + /// + // Cancel processing. + /// + void (CEF_CALLBACK *cancel)(struct _cef_callback_t* self); +} cef_callback_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_CALLBACK_CAPI_H_ diff --git a/cef/include/capi/cef_client_capi.h b/include/capi/cef_client_capi.h similarity index 75% rename from cef/include/capi/cef_client_capi.h rename to include/capi/cef_client_capi.h index 639acdae9..f3fd271fb 100644 --- a/cef/include/capi/cef_client_capi.h +++ b/include/capi/cef_client_capi.h @@ -54,6 +54,52 @@ typedef struct _cef_client_t { /// cef_base_t base; + /// + // Return the handler for context menus. If no handler is provided the default + // implementation will be used. + /// + struct _cef_context_menu_handler_t* (CEF_CALLBACK *get_context_menu_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for browser display state events. + /// + struct _cef_display_handler_t* (CEF_CALLBACK *get_display_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for download events. If no handler is returned downloads + // will not be allowed. + /// + struct _cef_download_handler_t* (CEF_CALLBACK *get_download_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for focus events. + /// + struct _cef_focus_handler_t* (CEF_CALLBACK *get_focus_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for geolocation permissions requests. If no handler is + // provided geolocation access will be denied by default. + /// + struct _cef_geolocation_handler_t* (CEF_CALLBACK *get_geolocation_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for JavaScript dialogs. If no handler is provided the + // default implementation will be used. + /// + struct _cef_jsdialog_handler_t* (CEF_CALLBACK *get_jsdialog_handler)( + struct _cef_client_t* self); + + /// + // Return the handler for keyboard events. + /// + struct _cef_keyboard_handler_t* (CEF_CALLBACK *get_keyboard_handler)( + struct _cef_client_t* self); + /// // Return the handler for browser life span events. /// @@ -73,70 +119,13 @@ typedef struct _cef_client_t { struct _cef_client_t* self); /// - // Return the handler for browser display state events. + // Called when a new message is received from a different process. Return true + // (1) if the message was handled or false (0) otherwise. Do not keep a + // reference to or attempt to access the message outside of this callback. /// - struct _cef_display_handler_t* (CEF_CALLBACK *get_display_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for focus events. - /// - struct _cef_focus_handler_t* (CEF_CALLBACK *get_focus_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for keyboard events. - /// - struct _cef_keyboard_handler_t* (CEF_CALLBACK *get_keyboard_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for context menu events. - /// - struct _cef_menu_handler_t* (CEF_CALLBACK *get_menu_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for browser permission events. - /// - struct _cef_permission_handler_t* (CEF_CALLBACK *get_permission_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for printing events. - /// - struct _cef_print_handler_t* (CEF_CALLBACK *get_print_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for find result events. - /// - struct _cef_find_handler_t* (CEF_CALLBACK *get_find_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for JavaScript dialog events. - /// - struct _cef_jsdialog_handler_t* (CEF_CALLBACK *get_jsdialog_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for V8 context events. - /// - struct _cef_v8context_handler_t* (CEF_CALLBACK *get_v8context_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for off-screen rendering events. - /// - struct _cef_render_handler_t* (CEF_CALLBACK *get_render_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for drag events. - /// - struct _cef_drag_handler_t* (CEF_CALLBACK *get_drag_handler)( - struct _cef_client_t* self); + int (CEF_CALLBACK *on_process_message_received)(struct _cef_client_t* self, + struct _cef_browser_t* browser, enum cef_process_id_t source_process, + struct _cef_process_message_t* message); } cef_client_t; diff --git a/cef/include/capi/cef_command_line_capi.h b/include/capi/cef_command_line_capi.h similarity index 87% rename from cef/include/capi/cef_command_line_capi.h rename to include/capi/cef_command_line_capi.h index a5a5ea9fc..49a883899 100644 --- a/cef/include/capi/cef_command_line_capi.h +++ b/include/capi/cef_command_line_capi.h @@ -61,6 +61,24 @@ typedef struct _cef_command_line_t { /// cef_base_t base; + /// + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + /// + int (CEF_CALLBACK *is_valid)(struct _cef_command_line_t* self); + + /// + // Returns true (1) if the values of this object are read-only. Some APIs may + // expose read-only objects. + /// + int (CEF_CALLBACK *is_read_only)(struct _cef_command_line_t* self); + + /// + // Returns a writable copy of this object. + /// + struct _cef_command_line_t* (CEF_CALLBACK *copy)( + struct _cef_command_line_t* self); + /// // Initialize the command line with the specified |argc| and |argv| values. // The first argument must be the name of the program. This function is only @@ -76,6 +94,12 @@ typedef struct _cef_command_line_t { void (CEF_CALLBACK *init_from_string)(struct _cef_command_line_t* self, const cef_string_t* command_line); + /// + // Reset the command-line switches and arguments but leave the program + // component unchanged. + /// + void (CEF_CALLBACK *reset)(struct _cef_command_line_t* self); + /// // Constructs and returns the represented command line string. Use this // function cautiously because quoting behavior is unclear. @@ -161,6 +185,12 @@ typedef struct _cef_command_line_t { /// CEF_EXPORT cef_command_line_t* cef_command_line_create(); +/// +// Returns the singleton global cef_command_line_t object. The returned object +// will be read-only. +/// +CEF_EXPORT cef_command_line_t* cef_command_line_get_global(); + #ifdef __cplusplus } diff --git a/include/capi/cef_context_menu_handler_capi.h b/include/capi/cef_context_menu_handler_capi.h new file mode 100644 index 000000000..02989d9c4 --- /dev/null +++ b/include/capi/cef_context_menu_handler_capi.h @@ -0,0 +1,221 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Implement this structure to handle context menu events. The functions of this +// structure will be called on the UI thread. +/// +typedef struct _cef_context_menu_handler_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Called before a context menu is displayed. |params| provides information + // about the context menu state. |model| initially contains the default + // context menu. The |model| can be cleared to show no context menu or + // modified to show a custom menu. Do not keep references to |params| or + // |model| outside of this callback. + /// + void (CEF_CALLBACK *on_before_context_menu)( + struct _cef_context_menu_handler_t* self, struct _cef_browser_t* browser, + struct _cef_frame_t* frame, struct _cef_context_menu_params_t* params, + struct _cef_menu_model_t* model); + + /// + // Called to execute a command selected from the context menu. Return true (1) + // if the command was handled or false (0) for the default implementation. See + // cef_menu_id_t for the command ids that have default implementations. All + // user-defined command ids should be between MENU_ID_USER_FIRST and + // MENU_ID_USER_LAST. |params| will have the same values as what was passed to + // on_before_context_menu(). Do not keep a reference to |params| outside of + // this callback. + /// + int (CEF_CALLBACK *on_context_menu_command)( + struct _cef_context_menu_handler_t* self, struct _cef_browser_t* browser, + struct _cef_frame_t* frame, struct _cef_context_menu_params_t* params, + int command_id, enum cef_event_flags_t event_flags); + + /// + // Called when the context menu is dismissed irregardless of whether the menu + // was NULL or a command was selected. + /// + void (CEF_CALLBACK *on_context_menu_dismissed)( + struct _cef_context_menu_handler_t* self, struct _cef_browser_t* browser, + struct _cef_frame_t* frame); +} cef_context_menu_handler_t; + + +/// +// Provides information about the context menu state. The ethods of this +// structure can only be accessed on browser process the UI thread. +/// +typedef struct _cef_context_menu_params_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Returns the X coordinate of the mouse where the context menu was invoked. + // Coords are relative to the associated RenderView's origin. + /// + int (CEF_CALLBACK *get_xcoord)(struct _cef_context_menu_params_t* self); + + /// + // Returns the Y coordinate of the mouse where the context menu was invoked. + // Coords are relative to the associated RenderView's origin. + /// + int (CEF_CALLBACK *get_ycoord)(struct _cef_context_menu_params_t* self); + + /// + // Returns flags representing the type of node that the context menu was + // invoked on. + /// + enum cef_context_menu_type_flags_t (CEF_CALLBACK *get_type_flags)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the URL of the link, if any, that encloses the node that the + // context menu was invoked on. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_link_url)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the link URL, if any, to be used ONLY for "copy link address". We + // don't validate this field in the frontend process. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_unfiltered_link_url)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the source URL, if any, for the element that the context menu was + // invoked on. Example of elements with source URLs are img, audio, and video. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_source_url)( + struct _cef_context_menu_params_t* self); + + /// + // Returns true (1) if the context menu was invoked on a blocked image. + /// + int (CEF_CALLBACK *is_image_blocked)(struct _cef_context_menu_params_t* self); + + /// + // Returns the URL of the top level page that the context menu was invoked on. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_page_url)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the URL of the subframe that the context menu was invoked on. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_frame_url)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the character encoding of the subframe that the context menu was + // invoked on. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_frame_charset)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the type of context node that the context menu was invoked on. + /// + enum cef_context_menu_media_type_t (CEF_CALLBACK *get_media_type)( + struct _cef_context_menu_params_t* self); + + /// + // Returns flags representing the actions supported by the media element, if + // any, that the context menu was invoked on. + /// + enum cef_context_menu_media_state_flags_t ( + CEF_CALLBACK *get_media_state_flags)( + struct _cef_context_menu_params_t* self); + + /// + // Returns the text of the selection, if any, that the context menu was + // invoked on. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_selection_text)( + struct _cef_context_menu_params_t* self); + + /// + // Returns true (1) if the context menu was invoked on an editable node. + /// + int (CEF_CALLBACK *is_editable)(struct _cef_context_menu_params_t* self); + + /// + // Returns true (1) if the context menu was invoked on an editable node where + // speech-input is enabled. + /// + int (CEF_CALLBACK *is_speech_input_enabled)( + struct _cef_context_menu_params_t* self); + + /// + // Returns flags representing the actions supported by the editable node, if + // any, that the context menu was invoked on. + /// + enum cef_context_menu_edit_state_flags_t (CEF_CALLBACK *get_edit_state_flags)( + struct _cef_context_menu_params_t* self); +} cef_context_menu_params_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_cookie_capi.h b/include/capi/cef_cookie_capi.h similarity index 100% rename from cef/include/capi/cef_cookie_capi.h rename to include/capi/cef_cookie_capi.h diff --git a/cef/include/capi/cef_display_handler_capi.h b/include/capi/cef_display_handler_capi.h similarity index 91% rename from cef/include/capi/cef_display_handler_capi.h rename to include/capi/cef_display_handler_capi.h index 5f2ea0fb9..6c4ad694b 100644 --- a/cef/include/capi/cef_display_handler_capi.h +++ b/include/capi/cef_display_handler_capi.h @@ -56,10 +56,11 @@ typedef struct _cef_display_handler_t { cef_base_t base; /// - // Called when the navigation state has changed. + // Called when the loading state has changed. /// - void (CEF_CALLBACK *on_nav_state_change)(struct _cef_display_handler_t* self, - struct _cef_browser_t* browser, int canGoBack, int canGoForward); + void (CEF_CALLBACK *on_loading_state_change)( + struct _cef_display_handler_t* self, struct _cef_browser_t* browser, + int isLoading, int canGoBack, int canGoForward); /// // Called when a frame's address has changed. @@ -68,13 +69,6 @@ typedef struct _cef_display_handler_t { struct _cef_browser_t* browser, struct _cef_frame_t* frame, const cef_string_t* url); - /// - // Called when the size of the content area has changed. - /// - void (CEF_CALLBACK *on_contents_size_change)( - struct _cef_display_handler_t* self, struct _cef_browser_t* browser, - struct _cef_frame_t* frame, int width, int height); - /// // Called when the page title changes. /// diff --git a/cef/include/capi/cef_dom_capi.h b/include/capi/cef_dom_capi.h similarity index 96% rename from cef/include/capi/cef_dom_capi.h rename to include/capi/cef_dom_capi.h index 1807ea203..8b5b752ec 100644 --- a/cef/include/capi/cef_dom_capi.h +++ b/include/capi/cef_dom_capi.h @@ -47,7 +47,7 @@ extern "C" { /// // Structure to implement for visiting the DOM. The functions of this structure -// will be called on the UI thread. +// will be called on the render process main thread. /// typedef struct _cef_domvisitor_t { /// @@ -69,7 +69,7 @@ typedef struct _cef_domvisitor_t { /// // Structure used to represent a DOM document. The functions of this structure -// should only be called on the UI thread. +// should only be called on the render process main thread thread. /// typedef struct _cef_domdocument_t { /// @@ -181,7 +181,7 @@ typedef struct _cef_domdocument_t { /// // Structure used to represent a DOM node. The functions of this structure -// should only be called on the UI thread. +// should only be called on the render process main thread. /// typedef struct _cef_domnode_t { /// @@ -205,6 +205,11 @@ typedef struct _cef_domnode_t { /// int (CEF_CALLBACK *is_element)(struct _cef_domnode_t* self); + /// + // Returns true (1) if this is an editable node. + /// + int (CEF_CALLBACK *is_editable)(struct _cef_domnode_t* self); + /// // Returns true (1) if this is a form control element node. /// @@ -356,7 +361,7 @@ typedef struct _cef_domnode_t { /// // Structure used to represent a DOM event. The functions of this structure -// should only be called on the UI thread. +// should only be called on the render process main thread. /// typedef struct _cef_domevent_t { /// @@ -414,7 +419,7 @@ typedef struct _cef_domevent_t { /// // Structure to implement for handling DOM events. The functions of this -// structure will be called on the UI thread. +// structure will be called on the render process main thread. /// typedef struct _cef_domevent_listener_t { /// diff --git a/include/capi/cef_download_handler_capi.h b/include/capi/cef_download_handler_capi.h new file mode 100644 index 000000000..ef0821c27 --- /dev/null +++ b/include/capi/cef_download_handler_capi.h @@ -0,0 +1,124 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Callback structure used to asynchronously continue a download. +/// +typedef struct _cef_before_download_callback_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Call to continue the download. Set |download_path| to the full file path + // for the download including the file name or leave blank to use the + // suggested name and the default temp directory. Set |show_dialog| to true + // (1) if you do wish to show the default "Save As" dialog. + /// + void (CEF_CALLBACK *cont)(struct _cef_before_download_callback_t* self, + const cef_string_t* download_path, int show_dialog); +} cef_before_download_callback_t; + + +/// +// Callback structure used to asynchronously cancel a download. +/// +typedef struct _cef_download_item_callback_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Call to cancel the download. + /// + void (CEF_CALLBACK *cancel)(struct _cef_download_item_callback_t* self); +} cef_download_item_callback_t; + + +/// +// Structure used to handle file downloads. The functions of this structure will +// called on the browser process UI thread. +/// +typedef struct _cef_download_handler_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Called before a download begins. |suggested_name| is the suggested name for + // the download file. By default the download will be canceled. Execute + // |callback| either asynchronously or in this function to continue the + // download if desired. Do not keep a reference to |download_item| outside of + // this function. + /// + void (CEF_CALLBACK *on_before_download)(struct _cef_download_handler_t* self, + struct _cef_browser_t* browser, + struct _cef_download_item_t* download_item, + const cef_string_t* suggested_name, + struct _cef_before_download_callback_t* callback); + + /// + // Called when a download's status or progress information has been updated. + // Execute |callback| either asynchronously or in this function to cancel the + // download if desired. Do not keep a reference to |download_item| outside of + // this function. + /// + void (CEF_CALLBACK *on_download_updated)(struct _cef_download_handler_t* self, + struct _cef_browser_t* browser, + struct _cef_download_item_t* download_item, + struct _cef_download_item_callback_t* callback); +} cef_download_handler_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_ diff --git a/include/capi/cef_download_item_capi.h b/include/capi/cef_download_item_capi.h new file mode 100644 index 000000000..c5ac8b5c5 --- /dev/null +++ b/include/capi/cef_download_item_capi.h @@ -0,0 +1,162 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Structure used to represent a download item. +/// +typedef struct _cef_download_item_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + /// + int (CEF_CALLBACK *is_valid)(struct _cef_download_item_t* self); + + /// + // Returns true (1) if the download is in progress. + /// + int (CEF_CALLBACK *is_in_progress)(struct _cef_download_item_t* self); + + /// + // Returns true (1) if the download is complete. + /// + int (CEF_CALLBACK *is_complete)(struct _cef_download_item_t* self); + + /// + // Returns true (1) if the download has been canceled or interrupted. + /// + int (CEF_CALLBACK *is_canceled)(struct _cef_download_item_t* self); + + /// + // Returns a simple speed estimate in bytes/s. + /// + int64 (CEF_CALLBACK *get_current_speed)(struct _cef_download_item_t* self); + + /// + // Returns the rough percent complete or -1 if the receive total size is + // unknown. + /// + int (CEF_CALLBACK *get_percent_complete)(struct _cef_download_item_t* self); + + /// + // Returns the total number of bytes. + /// + int64 (CEF_CALLBACK *get_total_bytes)(struct _cef_download_item_t* self); + + /// + // Returns the number of received bytes. + /// + int64 (CEF_CALLBACK *get_received_bytes)(struct _cef_download_item_t* self); + + /// + // Returns the time that the download started. + /// + cef_time_t (CEF_CALLBACK *get_start_time)(struct _cef_download_item_t* self); + + /// + // Returns the time that the download ended. + /// + cef_time_t (CEF_CALLBACK *get_end_time)(struct _cef_download_item_t* self); + + /// + // Returns the full path to the downloaded or downloading file. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_full_path)( + struct _cef_download_item_t* self); + + /// + // Returns the unique identifier for this download. + /// + int32 (CEF_CALLBACK *get_id)(struct _cef_download_item_t* self); + + /// + // Returns the URL. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_url)( + struct _cef_download_item_t* self); + + /// + // Returns the suggested file name. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_suggested_file_name)( + struct _cef_download_item_t* self); + + /// + // Returns the content disposition. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_content_disposition)( + struct _cef_download_item_t* self); + + /// + // Returns the mime type. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_mime_type)( + struct _cef_download_item_t* self); + + /// + // Returns the referrer character set. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_referrer_charset)( + struct _cef_download_item_t* self); +} cef_download_item_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_ diff --git a/cef/include/capi/cef_focus_handler_capi.h b/include/capi/cef_focus_handler_capi.h similarity index 82% rename from cef/include/capi/cef_focus_handler_capi.h rename to include/capi/cef_focus_handler_capi.h index 17de32c64..04ee80d81 100644 --- a/cef/include/capi/cef_focus_handler_capi.h +++ b/include/capi/cef_focus_handler_capi.h @@ -70,19 +70,13 @@ typedef struct _cef_focus_handler_t { // focus to be set or true (1) to cancel setting the focus. /// int (CEF_CALLBACK *on_set_focus)(struct _cef_focus_handler_t* self, - struct _cef_browser_t* browser, enum cef_handler_focus_source_t source); + struct _cef_browser_t* browser, enum cef_focus_source_t source); /// - // Called when a new node in the the browser gets focus. The |node| value may - // be NULL if no specific node has gained focus. The node object passed to - // this function represents a snapshot of the DOM at the time this function is - // executed. DOM objects are only valid for the scope of this function. Do not - // keep references to or attempt to access any DOM objects outside the scope - // of this function. + // Called when the browser component has received focus. /// - void (CEF_CALLBACK *on_focused_node_changed)( - struct _cef_focus_handler_t* self, struct _cef_browser_t* browser, - struct _cef_frame_t* frame, struct _cef_domnode_t* node); + void (CEF_CALLBACK *on_got_focus)(struct _cef_focus_handler_t* self, + struct _cef_browser_t* browser); } cef_focus_handler_t; diff --git a/cef/include/capi/cef_frame_capi.h b/include/capi/cef_frame_capi.h similarity index 79% rename from cef/include/capi/cef_frame_capi.h rename to include/capi/cef_frame_capi.h index 4009ac63c..88f0ae20d 100644 --- a/cef/include/capi/cef_frame_capi.h +++ b/include/capi/cef_frame_capi.h @@ -46,9 +46,10 @@ extern "C" { /// -// Structure used to represent a frame in the browser window. The functions of -// this structure may be called on any thread unless otherwise indicated in the -// comments. +// Structure used to represent a frame in the browser window. When used in the +// browser process the functions of this structure may be called on any thread +// unless otherwise indicated in the comments. When used in the render process +// the functions of this structure may only be called on the main thread. /// typedef struct _cef_frame_t { /// @@ -56,6 +57,11 @@ typedef struct _cef_frame_t { /// cef_base_t base; + /// + // True if this object is currently attached to a valid frame. + /// + int (CEF_CALLBACK *is_valid)(struct _cef_frame_t* self); + /// // Execute undo in this frame. /// @@ -91,31 +97,26 @@ typedef struct _cef_frame_t { /// void (CEF_CALLBACK *select_all)(struct _cef_frame_t* self); - /// - // Execute printing in the this frame. The user will be prompted with the - // print dialog appropriate to the operating system. - /// - void (CEF_CALLBACK *print)(struct _cef_frame_t* self); - /// // Save this frame's HTML source to a temporary file and open it in the - // default text viewing application. + // default text viewing application. This function can only be called from the + // browser process. /// void (CEF_CALLBACK *view_source)(struct _cef_frame_t* self); /// - // Returns this frame's HTML source as a string. This function should only be - // called on the UI thread. + // Retrieve this frame's HTML source as a string sent to the specified + // visitor. /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_source)(struct _cef_frame_t* self); + void (CEF_CALLBACK *get_source)(struct _cef_frame_t* self, + struct _cef_string_visitor_t* visitor); /// - // Returns this frame's display text as a string. This function should only be - // called on the UI thread. + // Retrieve this frame's display text as a string sent to the specified + // visitor. /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t (CEF_CALLBACK *get_text)(struct _cef_frame_t* self); + void (CEF_CALLBACK *get_text)(struct _cef_frame_t* self, + struct _cef_string_visitor_t* visitor); /// // Load the request represented by the |request| object. @@ -135,12 +136,6 @@ typedef struct _cef_frame_t { void (CEF_CALLBACK *load_string)(struct _cef_frame_t* self, const cef_string_t* string_val, const cef_string_t* url); - /// - // Load the contents of |stream| with the optional dummy target |url|. - /// - void (CEF_CALLBACK *load_stream)(struct _cef_frame_t* self, - struct _cef_stream_reader_t* stream, const cef_string_t* url); - /// // Execute a string of JavaScript code in this frame. The |script_url| // parameter is the URL where the script in question can be found, if any. The @@ -149,8 +144,8 @@ typedef struct _cef_frame_t { // reporting. /// void (CEF_CALLBACK *execute_java_script)(struct _cef_frame_t* self, - const cef_string_t* jsCode, const cef_string_t* scriptUrl, - int startLine); + const cef_string_t* code, const cef_string_t* script_url, + int start_line); /// // Returns true (1) if this is the main (top-level) frame. @@ -158,8 +153,7 @@ typedef struct _cef_frame_t { int (CEF_CALLBACK *is_main)(struct _cef_frame_t* self); /// - // Returns true (1) if this is the focused frame. This function should only be - // called on the UI thread. + // Returns true (1) if this is the focused frame. /// int (CEF_CALLBACK *is_focused)(struct _cef_frame_t* self); @@ -180,7 +174,7 @@ typedef struct _cef_frame_t { /// // Returns the parent of this frame or NULL if this is the main (top-level) - // frame. This function should only be called on the UI thread. + // frame. /// struct _cef_frame_t* (CEF_CALLBACK *get_parent)(struct _cef_frame_t* self); @@ -196,17 +190,18 @@ typedef struct _cef_frame_t { struct _cef_browser_t* (CEF_CALLBACK *get_browser)(struct _cef_frame_t* self); /// - // Visit the DOM document. - /// - void (CEF_CALLBACK *visit_dom)(struct _cef_frame_t* self, - struct _cef_domvisitor_t* visitor); - - /// - // Get the V8 context associated with the frame. This function should only be - // called on the UI thread. + // Get the V8 context associated with the frame. This function can only be + // called from the render process. /// struct _cef_v8context_t* (CEF_CALLBACK *get_v8context)( struct _cef_frame_t* self); + + /// + // Visit the DOM document. This function can only be called from the render + // process. + /// + void (CEF_CALLBACK *visit_dom)(struct _cef_frame_t* self, + struct _cef_domvisitor_t* visitor); } cef_frame_t; diff --git a/include/capi/cef_geolocation_handler_capi.h b/include/capi/cef_geolocation_handler_capi.h new file mode 100644 index 000000000..30eca09a6 --- /dev/null +++ b/include/capi/cef_geolocation_handler_capi.h @@ -0,0 +1,104 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Callback structure used for asynchronous continuation of geolocation +// permission requests. +/// +typedef struct _cef_geolocation_callback_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Call to allow or deny geolocation access. + /// + void (CEF_CALLBACK *cont)(struct _cef_geolocation_callback_t* self, + int allow); +} cef_geolocation_callback_t; + + +/// +// Implement this structure to handle events related to geolocation permission +// requests. The functions of this structure will be called on the browser +// process IO thread. +/// +typedef struct _cef_geolocation_handler_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Called when a page requests permission to access geolocation information. + // |requesting_url| is the URL requesting permission and |request_id| is the + // unique ID for the permission request. Call + // cef_geolocation_callback_t::Continue to allow or deny the permission + // request. + /// + void (CEF_CALLBACK *on_request_geolocation_permission)( + struct _cef_geolocation_handler_t* self, struct _cef_browser_t* browser, + const cef_string_t* requesting_url, int request_id, + struct _cef_geolocation_callback_t* callback); + + /// + // Called when a geolocation access request is canceled. |requesting_url| is + // the URL that originally requested permission and |request_id| is the unique + // ID for the permission request. + /// + void (CEF_CALLBACK *on_cancel_geolocation_permission)( + struct _cef_geolocation_handler_t* self, struct _cef_browser_t* browser, + const cef_string_t* requesting_url, int request_id); +} cef_geolocation_handler_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_ diff --git a/include/capi/cef_jsdialog_handler_capi.h b/include/capi/cef_jsdialog_handler_capi.h new file mode 100644 index 000000000..a667b5a6b --- /dev/null +++ b/include/capi/cef_jsdialog_handler_capi.h @@ -0,0 +1,126 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_JSDIALOG_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_JSDIALOG_HANDLER_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Callback structure used for asynchronous continuation of JavaScript dialog +// requests. +/// +typedef struct _cef_jsdialog_callback_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Continue the JS dialog request. Set |success| to true (1) if the OK button + // was pressed. The |user_input| value should be specified for prompt dialogs. + /// + void (CEF_CALLBACK *cont)(struct _cef_jsdialog_callback_t* self, int success, + const cef_string_t* user_input); +} cef_jsdialog_callback_t; + + +/// +// Implement this structure to handle events related to JavaScript dialogs. The +// functions of this structure will be called on the UI thread. +/// +typedef struct _cef_jsdialog_handler_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Called to run a JavaScript dialog. The |default_prompt_text| value will be + // specified for prompt dialogs only. Set |suppress_message| to true (1) and + // return false (0) to suppress the message (suppressing messages is + // preferable to immediately executing the callback as this is used to detect + // presumably malicious behavior like spamming alert messages in + // onbeforeunload). Set |suppress_message| to false (0) and return false (0) + // to use the default implementation (the default implementation will show one + // modal dialog at a time and suppress any additional dialog requests until + // the displayed dialog is dismissed). Return true (1) if the application will + // use a custom dialog or if the callback has been executed immediately. + // Custom dialogs may be either modal or modeless. If a custom dialog is used + // the application must execute |callback| once the custom dialog is + // dismissed. + /// + int (CEF_CALLBACK *on_jsdialog)(struct _cef_jsdialog_handler_t* self, + struct _cef_browser_t* browser, const cef_string_t* origin_url, + const cef_string_t* accept_lang, enum cef_jsdialog_type_t dialog_type, + const cef_string_t* message_text, + const cef_string_t* default_prompt_text, + struct _cef_jsdialog_callback_t* callback, int* suppress_message); + + /// + // Called to run a dialog asking the user if they want to leave a page. Return + // false (0) to use the default dialog implementation. Return true (1) if the + // application will use a custom dialog or if the callback has been executed + // immediately. Custom dialogs may be either modal or modeless. If a custom + // dialog is used the application must execute |callback| once the custom + // dialog is dismissed. + /// + int (CEF_CALLBACK *on_before_unload_dialog)( + struct _cef_jsdialog_handler_t* self, struct _cef_browser_t* browser, + const cef_string_t* message_text, int is_reload, + struct _cef_jsdialog_callback_t* callback); + + /// + // Called to cancel any pending dialogs and reset any saved dialog state. Will + // be called due to events like page navigation irregardless of whether any + // dialogs are currently pending. + /// + void (CEF_CALLBACK *on_reset_dialog_state)( + struct _cef_jsdialog_handler_t* self, struct _cef_browser_t* browser); +} cef_jsdialog_handler_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_JSDIALOG_HANDLER_CAPI_H_ diff --git a/include/capi/cef_keyboard_handler_capi.h b/include/capi/cef_keyboard_handler_capi.h new file mode 100644 index 000000000..abff51461 --- /dev/null +++ b/include/capi/cef_keyboard_handler_capi.h @@ -0,0 +1,83 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_KEYBOARD_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_KEYBOARD_HANDLER_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Implement this structure to handle events related to keyboard input. The +// functions of this structure will be called on the UI thread. +/// +typedef struct _cef_keyboard_handler_t { + /// + // Base structure. + /// + cef_base_t base; + + // Called before a keyboard event is sent to the renderer. |event| contains + // information about the keyboard event. |os_event| is the operating system + // event message, if any. Return true (1) if the event was handled or false + // (0) otherwise. If the event will be handled in on_key_event() as a keyboard + // shortcut set |is_keyboard_shortcut| to true (1) and return false (0). + int (CEF_CALLBACK *on_pre_key_event)(struct _cef_keyboard_handler_t* self, + struct _cef_browser_t* browser, const struct _cef_key_event_t* event, + cef_event_handle_t os_event, int* is_keyboard_shortcut); + + /// + // Called after the renderer and JavaScript in the page has had a chance to + // handle the event. |event| contains information about the keyboard event. + // |os_event| is the operating system event message, if any. Return true (1) + // if the keyboard event was handled or false (0) otherwise. + /// + int (CEF_CALLBACK *on_key_event)(struct _cef_keyboard_handler_t* self, + struct _cef_browser_t* browser, const struct _cef_key_event_t* event, + cef_event_handle_t os_event); +} cef_keyboard_handler_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_KEYBOARD_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_life_span_handler_capi.h b/include/capi/cef_life_span_handler_capi.h similarity index 100% rename from cef/include/capi/cef_life_span_handler_capi.h rename to include/capi/cef_life_span_handler_capi.h diff --git a/cef/include/capi/cef_load_handler_capi.h b/include/capi/cef_load_handler_capi.h similarity index 80% rename from cef/include/capi/cef_load_handler_capi.h rename to include/capi/cef_load_handler_capi.h index baea13038..e707a8dd2 100644 --- a/cef/include/capi/cef_load_handler_capi.h +++ b/include/capi/cef_load_handler_capi.h @@ -80,15 +80,29 @@ typedef struct _cef_load_handler_t { /// // Called when the browser fails to load a resource. |errorCode| is the error - // code number and |failedUrl| is the URL that failed to load. To provide - // custom error text assign the text to |errorText| and return true (1). - // Otherwise, return false (0) for the default error text. See - // net\base\net_error_list.h for complete descriptions of the error codes. + // code number, |errorText| is the error text and and |failedUrl| is the URL + // that failed to load. See net\base\net_error_list.h for complete + // descriptions of the error codes. /// - int (CEF_CALLBACK *on_load_error)(struct _cef_load_handler_t* self, + void (CEF_CALLBACK *on_load_error)(struct _cef_load_handler_t* self, struct _cef_browser_t* browser, struct _cef_frame_t* frame, - enum cef_handler_errorcode_t errorCode, const cef_string_t* failedUrl, - cef_string_t* errorText); + enum cef_errorcode_t errorCode, const cef_string_t* errorText, + const cef_string_t* failedUrl); + + /// + // Called when the render process terminates unexpectedly. |status| indicates + // how the process terminated. + /// + void (CEF_CALLBACK *on_render_process_terminated)( + struct _cef_load_handler_t* self, struct _cef_browser_t* browser, + enum cef_termination_status_t status); + + /// + // Called when a plugin has crashed. |plugin_path| is the path of the plugin + // that crashed. + /// + void (CEF_CALLBACK *on_plugin_crashed)(struct _cef_load_handler_t* self, + struct _cef_browser_t* browser, const cef_string_t* plugin_path); } cef_load_handler_t; diff --git a/include/capi/cef_menu_model_capi.h b/include/capi/cef_menu_model_capi.h new file mode 100644 index 000000000..6a4179998 --- /dev/null +++ b/include/capi/cef_menu_model_capi.h @@ -0,0 +1,388 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Supports creation and modification of menus. See cef_menu_id_t for the +// command ids that have default implementations. All user-defined command ids +// should be between MENU_ID_USER_FIRST and MENU_ID_USER_LAST. The functions of +// this structure can only be accessed on the browser process the UI thread. +/// +typedef struct _cef_menu_model_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Clears the menu. Returns true (1) on success. + /// + int (CEF_CALLBACK *clear)(struct _cef_menu_model_t* self); + + /// + // Returns the number of items in this menu. + /// + int (CEF_CALLBACK *get_count)(struct _cef_menu_model_t* self); + + // + // Add a separator to the menu. Returns true (1) on success. + /// + int (CEF_CALLBACK *add_separator)(struct _cef_menu_model_t* self); + + // + // Add an item to the menu. Returns true (1) on success. + /// + int (CEF_CALLBACK *add_item)(struct _cef_menu_model_t* self, int command_id, + const cef_string_t* label); + + // + // Add a check item to the menu. Returns true (1) on success. + /// + int (CEF_CALLBACK *add_check_item)(struct _cef_menu_model_t* self, + int command_id, const cef_string_t* label); + + // + // Add a radio item to the menu. Only a single item with the specified + // |group_id| can be checked at a time. Returns true (1) on success. + /// + int (CEF_CALLBACK *add_radio_item)(struct _cef_menu_model_t* self, + int command_id, const cef_string_t* label, int group_id); + + // + // Add a sub-menu to the menu. The new sub-menu is returned. + /// + struct _cef_menu_model_t* (CEF_CALLBACK *add_sub_menu)( + struct _cef_menu_model_t* self, int command_id, + const cef_string_t* label); + + // + // Insert a separator in the menu at the specified |index|. Returns true (1) + // on success. + /// + int (CEF_CALLBACK *insert_separator_at)(struct _cef_menu_model_t* self, + int index); + + // + // Insert an item in the menu at the specified |index|. Returns true (1) on + // success. + /// + int (CEF_CALLBACK *insert_item_at)(struct _cef_menu_model_t* self, int index, + int command_id, const cef_string_t* label); + + // + // Insert a check item in the menu at the specified |index|. Returns true (1) + // on success. + /// + int (CEF_CALLBACK *insert_check_item_at)(struct _cef_menu_model_t* self, + int index, int command_id, const cef_string_t* label); + + // + // Insert a radio item in the menu at the specified |index|. Only a single + // item with the specified |group_id| can be checked at a time. Returns true + // (1) on success. + /// + int (CEF_CALLBACK *insert_radio_item_at)(struct _cef_menu_model_t* self, + int index, int command_id, const cef_string_t* label, int group_id); + + // + // Insert a sub-menu in the menu at the specified |index|. The new sub-menu is + // returned. + /// + struct _cef_menu_model_t* (CEF_CALLBACK *insert_sub_menu_at)( + struct _cef_menu_model_t* self, int index, int command_id, + const cef_string_t* label); + + /// + // Removes the item with the specified |command_id|. Returns true (1) on + // success. + /// + int (CEF_CALLBACK *remove)(struct _cef_menu_model_t* self, int command_id); + + /// + // Removes the item at the specified |index|. Returns true (1) on success. + /// + int (CEF_CALLBACK *remove_at)(struct _cef_menu_model_t* self, int index); + + /// + // Returns the index associated with the specified |command_id| or -1 if not + // found due to the command id not existing in the menu. + /// + int (CEF_CALLBACK *get_index_of)(struct _cef_menu_model_t* self, + int command_id); + + /// + // Returns the command id at the specified |index| or -1 if not found due to + // invalid range or the index being a separator. + /// + int (CEF_CALLBACK *get_command_id_at)(struct _cef_menu_model_t* self, + int index); + + /// + // Sets the command id at the specified |index|. Returns true (1) on success. + /// + int (CEF_CALLBACK *set_command_id_at)(struct _cef_menu_model_t* self, + int index, int command_id); + + /// + // Returns the label for the specified |command_id| or NULL if not found. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_label)( + struct _cef_menu_model_t* self, int command_id); + + /// + // Returns the label at the specified |index| or NULL if not found due to + // invalid range or the index being a separator. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_label_at)( + struct _cef_menu_model_t* self, int index); + + /// + // Sets the label for the specified |command_id|. Returns true (1) on success. + /// + int (CEF_CALLBACK *set_label)(struct _cef_menu_model_t* self, int command_id, + const cef_string_t* label); + + /// + // Set the label at the specified |index|. Returns true (1) on success. + /// + int (CEF_CALLBACK *set_label_at)(struct _cef_menu_model_t* self, int index, + const cef_string_t* label); + + /// + // Returns the item type for the specified |command_id|. + /// + enum cef_menu_item_type_t (CEF_CALLBACK *get_type)( + struct _cef_menu_model_t* self, int command_id); + + /// + // Returns the item type at the specified |index|. + /// + enum cef_menu_item_type_t (CEF_CALLBACK *get_type_at)( + struct _cef_menu_model_t* self, int index); + + /// + // Returns the group id for the specified |command_id| or -1 if invalid. + /// + int (CEF_CALLBACK *get_group_id)(struct _cef_menu_model_t* self, + int command_id); + + /// + // Returns the group id at the specified |index| or -1 if invalid. + /// + int (CEF_CALLBACK *get_group_id_at)(struct _cef_menu_model_t* self, + int index); + + /// + // Sets the group id for the specified |command_id|. Returns true (1) on + // success. + /// + int (CEF_CALLBACK *set_group_id)(struct _cef_menu_model_t* self, + int command_id, int group_id); + + /// + // Sets the group id at the specified |index|. Returns true (1) on success. + /// + int (CEF_CALLBACK *set_group_id_at)(struct _cef_menu_model_t* self, int index, + int group_id); + + /// + // Returns the submenu for the specified |command_id| or NULL if invalid. + /// + struct _cef_menu_model_t* (CEF_CALLBACK *get_sub_menu)( + struct _cef_menu_model_t* self, int command_id); + + /// + // Returns the submenu at the specified |index| or NULL if invalid. + /// + struct _cef_menu_model_t* (CEF_CALLBACK *get_sub_menu_at)( + struct _cef_menu_model_t* self, int index); + + // + // Returns true (1) if the specified |command_id| is visible. + /// + int (CEF_CALLBACK *is_visible)(struct _cef_menu_model_t* self, + int command_id); + + // + // Returns true (1) if the specified |index| is visible. + /// + int (CEF_CALLBACK *is_visible_at)(struct _cef_menu_model_t* self, int index); + + // + // Change the visibility of the specified |command_id|. Returns true (1) on + // success. + /// + int (CEF_CALLBACK *set_visible)(struct _cef_menu_model_t* self, + int command_id, int visible); + + // + // Change the visibility at the specified |index|. Returns true (1) on + // success. + /// + int (CEF_CALLBACK *set_visible_at)(struct _cef_menu_model_t* self, int index, + int visible); + + // + // Returns true (1) if the specified |command_id| is enabled. + /// + int (CEF_CALLBACK *is_enabled)(struct _cef_menu_model_t* self, + int command_id); + + // + // Returns true (1) if the specified |index| is enabled. + /// + int (CEF_CALLBACK *is_enabled_at)(struct _cef_menu_model_t* self, int index); + + // + // Change the enabled status of the specified |command_id|. Returns true (1) + // on success. + /// + int (CEF_CALLBACK *set_enabled)(struct _cef_menu_model_t* self, + int command_id, int enabled); + + // + // Change the enabled status at the specified |index|. Returns true (1) on + // success. + /// + int (CEF_CALLBACK *set_enabled_at)(struct _cef_menu_model_t* self, int index, + int enabled); + + // + // Returns true (1) if the specified |command_id| is checked. Only applies to + // check and radio items. + /// + int (CEF_CALLBACK *is_checked)(struct _cef_menu_model_t* self, + int command_id); + + // + // Returns true (1) if the specified |index| is checked. Only applies to check + // and radio items. + /// + int (CEF_CALLBACK *is_checked_at)(struct _cef_menu_model_t* self, int index); + + // + // Check the specified |command_id|. Only applies to check and radio items. + // Returns true (1) on success. + /// + int (CEF_CALLBACK *set_checked)(struct _cef_menu_model_t* self, + int command_id, int checked); + + // + // Check the specified |index|. Only applies to check and radio items. Returns + // true (1) on success. + /// + int (CEF_CALLBACK *set_checked_at)(struct _cef_menu_model_t* self, int index, + int checked); + + // + // Returns true (1) if the specified |command_id| has a keyboard accelerator + // assigned. + /// + int (CEF_CALLBACK *has_accelerator)(struct _cef_menu_model_t* self, + int command_id); + + // + // Returns true (1) if the specified |index| has a keyboard accelerator + // assigned. + /// + int (CEF_CALLBACK *has_accelerator_at)(struct _cef_menu_model_t* self, + int index); + + // + // Set the keyboard accelerator for the specified |command_id|. |key_code| can + // be any virtual key or character value. Returns true (1) on success. + /// + int (CEF_CALLBACK *set_accelerator)(struct _cef_menu_model_t* self, + int command_id, int key_code, int shift_pressed, int ctrl_pressed, + int alt_pressed); + + // + // Set the keyboard accelerator at the specified |index|. |key_code| can be + // any virtual key or character value. Returns true (1) on success. + /// + int (CEF_CALLBACK *set_accelerator_at)(struct _cef_menu_model_t* self, + int index, int key_code, int shift_pressed, int ctrl_pressed, + int alt_pressed); + + // + // Remove the keyboard accelerator for the specified |command_id|. Returns + // true (1) on success. + /// + int (CEF_CALLBACK *remove_accelerator)(struct _cef_menu_model_t* self, + int command_id); + + // + // Remove the keyboard accelerator at the specified |index|. Returns true (1) + // on success. + /// + int (CEF_CALLBACK *remove_accelerator_at)(struct _cef_menu_model_t* self, + int index); + + // + // Retrieves the keyboard accelerator for the specified |command_id|. Returns + // true (1) on success. + /// + int (CEF_CALLBACK *get_accelerator)(struct _cef_menu_model_t* self, + int command_id, int* key_code, int* shift_pressed, int* ctrl_pressed, + int* alt_pressed); + + // + // Retrieves the keyboard accelerator for the specified |index|. Returns true + // (1) on success. + /// + int (CEF_CALLBACK *get_accelerator_at)(struct _cef_menu_model_t* self, + int index, int* key_code, int* shift_pressed, int* ctrl_pressed, + int* alt_pressed); +} cef_menu_model_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_MENU_MODEL_CAPI_H_ diff --git a/cef/include/capi/cef_origin_whitelist_capi.h b/include/capi/cef_origin_whitelist_capi.h similarity index 92% rename from cef/include/capi/cef_origin_whitelist_capi.h rename to include/capi/cef_origin_whitelist_capi.h index e6fb2d1ac..917ec861e 100644 --- a/cef/include/capi/cef_origin_whitelist_capi.h +++ b/include/capi/cef_origin_whitelist_capi.h @@ -67,8 +67,11 @@ extern "C" { // the same-origin policy. Scripts hosted underneath the fully qualified // |source_origin| URL (like http://www.example.com) will be allowed access to // all resources hosted on the specified |target_protocol| and |target_domain|. -// If |allow_target_subdomains| is true (1) access will also be allowed to all -// subdomains of the target domain. +// If |target_domain| is non-NULL and |allow_target_subdomains| if false (0) +// only exact domain matches will be allowed. If |target_domain| is non-NULL and +// |allow_target_subdomains| is true (1) sub-domain matches will be allowed. If +// |target_domain| is NULL and |allow_target_subdomains| if true (1) all domains +// and IP addresses will be allowed. // // This function cannot be used to bypass the restrictions on local or display // isolated schemes. See the comments on CefRegisterCustomScheme for more diff --git a/include/capi/cef_path_util_capi.h b/include/capi/cef_path_util_capi.h new file mode 100644 index 000000000..3df1a100a --- /dev/null +++ b/include/capi/cef_path_util_capi.h @@ -0,0 +1,58 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_PATH_UTIL_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_PATH_UTIL_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Retrieve the path associated with the specified |key|. Returns true (1) on +// success. Can be called on any thread in the browser process. +/// +CEF_EXPORT int cef_get_path(enum cef_path_key_t key, cef_string_t* path); + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_PATH_UTIL_CAPI_H_ diff --git a/include/capi/cef_process_message_capi.h b/include/capi/cef_process_message_capi.h new file mode 100644 index 000000000..2b072dcf7 --- /dev/null +++ b/include/capi/cef_process_message_capi.h @@ -0,0 +1,101 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_PROCESS_MESSAGE_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_PROCESS_MESSAGE_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Structure representing a message. Can be used on any process and thread. +/// +typedef struct _cef_process_message_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + /// + int (CEF_CALLBACK *is_valid)(struct _cef_process_message_t* self); + + /// + // Returns true (1) if the values of this object are read-only. Some APIs may + // expose read-only objects. + /// + int (CEF_CALLBACK *is_read_only)(struct _cef_process_message_t* self); + + /// + // Returns a writable copy of this object. + /// + struct _cef_process_message_t* (CEF_CALLBACK *copy)( + struct _cef_process_message_t* self); + + /// + // Returns the message name. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_name)( + struct _cef_process_message_t* self); + + /// + // Returns the list of arguments. + /// + struct _cef_list_value_t* (CEF_CALLBACK *get_argument_list)( + struct _cef_process_message_t* self); +} cef_process_message_t; + + +/// +// Create a new cef_process_message_t object with the specified name. +/// +CEF_EXPORT cef_process_message_t* cef_process_message_create( + const cef_string_t* name); + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_PROCESS_MESSAGE_CAPI_H_ diff --git a/include/capi/cef_process_util_capi.h b/include/capi/cef_process_util_capi.h new file mode 100644 index 000000000..53ccbb2c1 --- /dev/null +++ b/include/capi/cef_process_util_capi.h @@ -0,0 +1,64 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_PROCESS_UTIL_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_PROCESS_UTIL_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Launches the process specified via |command_line|. Returns true (1) upon +// success. Must be called on the browser process TID_PROCESS_LAUNCHER thread. +// +// Unix-specific notes: - All file descriptors open in the parent process will +// be closed in the +// child process except for stdin, stdout, and stderr. +// - If the first argument on the command line does not contain a slash, +// PATH will be searched. (See man execvp.) +/// +CEF_EXPORT int cef_launch_process(struct _cef_command_line_t* command_line); + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_PROCESS_UTIL_CAPI_H_ diff --git a/cef/include/capi/cef_proxy_handler_capi.h b/include/capi/cef_proxy_handler_capi.h similarity index 100% rename from cef/include/capi/cef_proxy_handler_capi.h rename to include/capi/cef_proxy_handler_capi.h diff --git a/include/capi/cef_render_process_handler_capi.h b/include/capi/cef_render_process_handler_capi.h new file mode 100644 index 000000000..6ff24d0b7 --- /dev/null +++ b/include/capi/cef_render_process_handler_capi.h @@ -0,0 +1,132 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Structure used to implement render process callbacks. The functions of this +// structure will always be called on the render process main thread. +/// +typedef struct _cef_render_process_handler_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Called after the render process main thread has been created. + /// + void (CEF_CALLBACK *on_render_thread_created)( + struct _cef_render_process_handler_t* self); + + /// + // Called after WebKit has been initialized. + /// + void (CEF_CALLBACK *on_web_kit_initialized)( + struct _cef_render_process_handler_t* self); + + /// + // Called after a browser has been created. + /// + void (CEF_CALLBACK *on_browser_created)( + struct _cef_render_process_handler_t* self, + struct _cef_browser_t* browser); + + /// + // Called before a browser is destroyed. + /// + void (CEF_CALLBACK *on_browser_destroyed)( + struct _cef_render_process_handler_t* self, + struct _cef_browser_t* browser); + + /// + // Called immediately after the V8 context for a frame has been created. To + // retrieve the JavaScript 'window' object use the + // cef_v8context_t::get_global() function. + /// + void (CEF_CALLBACK *on_context_created)( + struct _cef_render_process_handler_t* self, + struct _cef_browser_t* browser, struct _cef_frame_t* frame, + struct _cef_v8context_t* context); + + /// + // Called immediately before the V8 context for a frame is released. No + // references to the context should be kept after this function is called. + /// + void (CEF_CALLBACK *on_context_released)( + struct _cef_render_process_handler_t* self, + struct _cef_browser_t* browser, struct _cef_frame_t* frame, + struct _cef_v8context_t* context); + + /// + // Called when a new node in the the browser gets focus. The |node| value may + // be NULL if no specific node has gained focus. The node object passed to + // this function represents a snapshot of the DOM at the time this function is + // executed. DOM objects are only valid for the scope of this function. Do not + // keep references to or attempt to access any DOM objects outside the scope + // of this function. + /// + void (CEF_CALLBACK *on_focused_node_changed)( + struct _cef_render_process_handler_t* self, + struct _cef_browser_t* browser, struct _cef_frame_t* frame, + struct _cef_domnode_t* node); + + /// + // Called when a new message is received from a different process. Return true + // (1) if the message was handled or false (0) otherwise. Do not keep a + // reference to or attempt to access the message outside of this callback. + /// + int (CEF_CALLBACK *on_process_message_received)( + struct _cef_render_process_handler_t* self, + struct _cef_browser_t* browser, enum cef_process_id_t source_process, + struct _cef_process_message_t* message); +} cef_render_process_handler_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_request_capi.h b/include/capi/cef_request_capi.h similarity index 90% rename from cef/include/capi/cef_request_capi.h rename to include/capi/cef_request_capi.h index f4650f6ec..a28d4754d 100644 --- a/cef/include/capi/cef_request_capi.h +++ b/include/capi/cef_request_capi.h @@ -55,6 +55,11 @@ typedef struct _cef_request_t { /// cef_base_t base; + /// + // Returns true (1) if this object is read-only. + /// + int (CEF_CALLBACK *is_read_only)(struct _cef_request_t* self); + /// // Get the fully qualified URL. /// @@ -112,20 +117,20 @@ typedef struct _cef_request_t { cef_string_multimap_t headerMap); /// - // Get the flags used in combination with cef_web_urlrequest_t. + // Get the flags used in combination with cef_urlrequest_t. See + // cef_urlrequest_flags_t for supported values. /// - enum cef_weburlrequest_flags_t (CEF_CALLBACK *get_flags)( - struct _cef_request_t* self); + int (CEF_CALLBACK *get_flags)(struct _cef_request_t* self); /// - // Set the flags used in combination with cef_web_urlrequest_t. + // Set the flags used in combination with cef_urlrequest_t. See + // cef_urlrequest_flags_t for supported values. /// - void (CEF_CALLBACK *set_flags)(struct _cef_request_t* self, - enum cef_weburlrequest_flags_t flags); + void (CEF_CALLBACK *set_flags)(struct _cef_request_t* self, int flags); /// // Set the URL to the first party for cookies used in combination with - // cef_web_urlrequest_t. + // cef_urlrequest_t. /// // The resulting string must be freed by calling cef_string_userfree_free(). cef_string_userfree_t (CEF_CALLBACK *get_first_party_for_cookies)( @@ -133,7 +138,7 @@ typedef struct _cef_request_t { /// // Get the URL to the first party for cookies used in combination with - // cef_web_urlrequest_t. + // cef_urlrequest_t. /// void (CEF_CALLBACK *set_first_party_for_cookies)(struct _cef_request_t* self, const cef_string_t* url); @@ -156,6 +161,11 @@ typedef struct _cef_post_data_t { /// cef_base_t base; + /// + // Returns true (1) if this object is read-only. + /// + int (CEF_CALLBACK *is_read_only)(struct _cef_post_data_t* self); + /// // Returns the number of existing post data elements. /// @@ -203,6 +213,11 @@ typedef struct _cef_post_data_element_t { /// cef_base_t base; + /// + // Returns true (1) if this object is read-only. + /// + int (CEF_CALLBACK *is_read_only)(struct _cef_post_data_element_t* self); + /// // Remove all contents from the post data element. /// diff --git a/include/capi/cef_request_handler_capi.h b/include/capi/cef_request_handler_capi.h new file mode 100644 index 000000000..1d70a2e5e --- /dev/null +++ b/include/capi/cef_request_handler_capi.h @@ -0,0 +1,149 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Callback structure used for asynchronous continuation of authentication +// requests. +/// +typedef struct _cef_auth_callback_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Continue the authentication request. + /// + void (CEF_CALLBACK *cont)(struct _cef_auth_callback_t* self, + const cef_string_t* username, const cef_string_t* password); + + /// + // Cancel the authentication request. + /// + void (CEF_CALLBACK *cancel)(struct _cef_auth_callback_t* self); +} cef_auth_callback_t; + + +/// +// Implement this structure to handle events related to browser requests. The +// functions of this structure will be called on the thread indicated. +/// +typedef struct _cef_request_handler_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Called on the IO thread before a resource request is loaded. The |request| + // object may be modified. To cancel the request return true (1) otherwise + // return false (0). + /// + int (CEF_CALLBACK *on_before_resource_load)( + struct _cef_request_handler_t* self, struct _cef_browser_t* browser, + struct _cef_frame_t* frame, struct _cef_request_t* request); + + /// + // Called on the IO thread before a resource is loaded. To allow the resource + // to load normally return NULL. To specify a handler for the resource return + // a cef_resource_handler_t object. The |request| object should not be + // modified in this callback. + /// + struct _cef_resource_handler_t* (CEF_CALLBACK *get_resource_handler)( + struct _cef_request_handler_t* self, struct _cef_browser_t* browser, + struct _cef_frame_t* frame, struct _cef_request_t* request); + + /// + // Called on the IO thread when a resource load is redirected. The |old_url| + // parameter will contain the old URL. The |new_url| parameter will contain + // the new URL and can be changed if desired. + /// + void (CEF_CALLBACK *on_resource_redirect)(struct _cef_request_handler_t* self, + struct _cef_browser_t* browser, struct _cef_frame_t* frame, + const cef_string_t* old_url, cef_string_t* new_url); + + /// + // Called on the IO thread when the browser needs credentials from the user. + // |isProxy| indicates whether the host is a proxy server. |host| contains the + // hostname and |port| contains the port number. Return true (1) to continue + // the request and call cef_auth_callback_t::Complete() when the + // authentication information is available. Return false (0) to cancel the + // request. + /// + int (CEF_CALLBACK *get_auth_credentials)(struct _cef_request_handler_t* self, + struct _cef_browser_t* browser, struct _cef_frame_t* frame, int isProxy, + const cef_string_t* host, int port, const cef_string_t* realm, + const cef_string_t* scheme, struct _cef_auth_callback_t* callback); + + /// + // Called on the IO thread to retrieve the cookie manager. |main_url| is the + // URL of the top-level frame. Cookies managers can be unique per browser or + // shared across multiple browsers. The global cookie manager will be used if + // this function returns NULL. + /// + struct _cef_cookie_manager_t* (CEF_CALLBACK *get_cookie_manager)( + struct _cef_request_handler_t* self, struct _cef_browser_t* browser, + const cef_string_t* main_url); + + /// + // Called on the UI thread to handle requests for URLs with an unknown + // protocol component. Set |allow_os_execution| to true (1) to attempt + // execution via the registered OS protocol handler, if any. SECURITY WARNING: + // YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR + // OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION. + /// + void (CEF_CALLBACK *on_protocol_execution)( + struct _cef_request_handler_t* self, struct _cef_browser_t* browser, + const cef_string_t* url, int* allow_os_execution); +} cef_request_handler_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_resource_bundle_handler_capi.h b/include/capi/cef_resource_bundle_handler_capi.h similarity index 84% rename from cef/include/capi/cef_resource_bundle_handler_capi.h rename to include/capi/cef_resource_bundle_handler_capi.h index 2111fa7e2..e81d7f947 100644 --- a/cef/include/capi/cef_resource_bundle_handler_capi.h +++ b/include/capi/cef_resource_bundle_handler_capi.h @@ -59,12 +59,7 @@ typedef struct _cef_resource_bundle_handler_t { // Called to retrieve a localized translation for the string specified by // |message_id|. To provide the translation set |string| to the translation // string and return true (1). To use the default translation return false - // (0). - // - // WARNING: Be cautious when implementing this function. ID values are auto- - // generated when CEF is built and may change between versions. Existing ID - // values can be discovered by searching for *_strings.h in the - // "obj/global_intermediate" build output directory. + // (0). Supported message IDs are listed in cef_pack_strings.h. /// int (CEF_CALLBACK *get_localized_string)( struct _cef_resource_bundle_handler_t* self, int message_id, @@ -75,12 +70,8 @@ typedef struct _cef_resource_bundle_handler_t { // provide the resource data set |data| and |data_size| to the data pointer // and size respectively and return true (1). To use the default resource data // return false (0). The resource data will not be copied and must remain - // resident in memory. - // - // WARNING: Be cautious when implementing this function. ID values are auto- - // generated when CEF is built and may change between versions. Existing ID - // values can be discovered by searching for *_resources.h in the - // "obj/global_intermediate" build output directory. + // resident in memory. Supported resource IDs are listed in + // cef_pack_resources.h. /// int (CEF_CALLBACK *get_data_resource)( struct _cef_resource_bundle_handler_t* self, int resource_id, void** data, diff --git a/include/capi/cef_resource_handler_capi.h b/include/capi/cef_resource_handler_capi.h new file mode 100644 index 000000000..b55c41202 --- /dev/null +++ b/include/capi/cef_resource_handler_capi.h @@ -0,0 +1,119 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_HANDLER_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_RESOURCE_HANDLER_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Structure used to implement a custom request handler structure. The functions +// of this structure will always be called on the IO thread. +/// +typedef struct _cef_resource_handler_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Begin processing the request. To handle the request return true (1) and + // call cef_callback_t::cont() once the response header information is + // available (cef_callback_t::cont() can also be called from inside this + // function if header information is available immediately). To cancel the + // request return false (0). + /// + int (CEF_CALLBACK *process_request)(struct _cef_resource_handler_t* self, + struct _cef_request_t* request, struct _cef_callback_t* callback); + + /// + // Retrieve response header information. If the response length is not known + // set |response_length| to -1 and read_response() will be called until it + // returns false (0). If the response length is known set |response_length| to + // a positive value and read_response() will be called until it returns false + // (0) or the specified number of bytes have been read. Use the |response| + // object to set the mime type, http status code and other optional header + // values. To redirect the request to a new URL set |redirectUrl| to the new + // URL. + /// + void (CEF_CALLBACK *get_response_headers)( + struct _cef_resource_handler_t* self, struct _cef_response_t* response, + int64* response_length, cef_string_t* redirectUrl); + + /// + // Read response data. If data is available immediately copy up to + // |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of + // bytes copied, and return true (1). To read the data at a later time set + // |bytes_read| to 0, return true (1) and call cef_callback_t::cont() when the + // data is available. To indicate response completion return false (0). + /// + int (CEF_CALLBACK *read_response)(struct _cef_resource_handler_t* self, + void* data_out, int bytes_to_read, int* bytes_read, + struct _cef_callback_t* callback); + + /// + // Return true (1) if the specified cookie can be sent with the request or + // false (0) otherwise. If false (0) is returned for any cookie then no + // cookies will be sent with the request. + /// + int (CEF_CALLBACK *can_get_cookie)(struct _cef_resource_handler_t* self, + const struct _cef_cookie_t* cookie); + + /// + // Return true (1) if the specified cookie returned with the response can be + // set or false (0) otherwise. + /// + int (CEF_CALLBACK *can_set_cookie)(struct _cef_resource_handler_t* self, + const struct _cef_cookie_t* cookie); + + /// + // Request processing has been canceled. + /// + void (CEF_CALLBACK *cancel)(struct _cef_resource_handler_t* self); +} cef_resource_handler_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_RESOURCE_HANDLER_CAPI_H_ diff --git a/cef/include/capi/cef_response_capi.h b/include/capi/cef_response_capi.h similarity index 94% rename from cef/include/capi/cef_response_capi.h rename to include/capi/cef_response_capi.h index e58180711..5dd682ae4 100644 --- a/cef/include/capi/cef_response_capi.h +++ b/include/capi/cef_response_capi.h @@ -55,6 +55,11 @@ typedef struct _cef_response_t { /// cef_base_t base; + /// + // Returns true (1) if this object is read-only. + /// + int (CEF_CALLBACK *is_read_only)(struct _cef_response_t* self); + /// // Get the response status code. /// @@ -112,6 +117,12 @@ typedef struct _cef_response_t { } cef_response_t; +/// +// Create a new cef_response_t object. +/// +CEF_EXPORT cef_response_t* cef_response_create(); + + #ifdef __cplusplus } #endif diff --git a/include/capi/cef_scheme_capi.h b/include/capi/cef_scheme_capi.h new file mode 100644 index 000000000..3e9622eb9 --- /dev/null +++ b/include/capi/cef_scheme_capi.h @@ -0,0 +1,160 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Register a scheme handler factory for the specified |scheme_name| and +// optional |domain_name|. An NULL |domain_name| value for a standard scheme +// will cause the factory to match all domain names. The |domain_name| value +// will be ignored for non-standard schemes. If |scheme_name| is a built-in +// scheme and no handler is returned by |factory| then the built-in scheme +// handler factory will be called. If |scheme_name| is a custom scheme the +// CefRegisterCustomScheme() function should be called for that scheme. This +// function may be called multiple times to change or remove the factory that +// matches the specified |scheme_name| and optional |domain_name|. Returns false +// (0) if an error occurs. This function may be called on any thread. +/// +CEF_EXPORT int cef_register_scheme_handler_factory( + const cef_string_t* scheme_name, const cef_string_t* domain_name, + struct _cef_scheme_handler_factory_t* factory); + +/// +// Clear all registered scheme handler factories. Returns false (0) on error. +// This function may be called on any thread. +/// +CEF_EXPORT int cef_clear_scheme_handler_factories(); + +/// +// Structure that manages custom scheme registrations. +/// +typedef struct _cef_scheme_registrar_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Register a custom scheme. This function should not be called for the built- + // in HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes. + // + // If |is_standard| is true (1) the scheme will be treated as a standard + // scheme. Standard schemes are subject to URL canonicalization and parsing + // rules as defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1 + // available at http://www.ietf.org/rfc/rfc1738.txt + // + // In particular, the syntax for standard scheme URLs must be of the form: + //
    +  //  [scheme]://[username]:[password]@[host]:[port]/[url-path]
    +  // 
    Standard scheme URLs must have a host component that is a fully + // qualified domain name as defined in Section 3.5 of RFC 1034 [13] and + // Section 2.1 of RFC 1123. These URLs will be canonicalized to + // "scheme://host/path" in the simplest case and + // "scheme://username:password@host:port/path" in the most explicit case. For + // example, "scheme:host/path" and "scheme:///host/path" will both be + // canonicalized to "scheme://host/path". The origin of a standard scheme URL + // is the combination of scheme, host and port (i.e., "scheme://host:port" in + // the most explicit case). + // + // For non-standard scheme URLs only the "scheme:" component is parsed and + // canonicalized. The remainder of the URL will be passed to the handler as- + // is. For example, "scheme:///some%20text" will remain the same. Non-standard + // scheme URLs cannot be used as a target for form submission. + // + // If |is_local| is true (1) the scheme will be treated as local (i.e., with + // the same security rules as those applied to "file" URLs). Normal pages + // cannot link to or access local URLs. Also, by default, local URLs can only + // perform XMLHttpRequest calls to the same URL (origin + path) that + // originated the request. To allow XMLHttpRequest calls from a local URL to + // other URLs with the same origin set the + // CefSettings.file_access_from_file_urls_allowed value to true (1). To allow + // XMLHttpRequest calls from a local URL to all origins set the + // CefSettings.universal_access_from_file_urls_allowed value to true (1). + // + // If |is_display_isolated| is true (1) the scheme will be treated as display- + // isolated. This means that pages cannot display these URLs unless they are + // from the same scheme. For example, pages in another origin cannot create + // iframes or hyperlinks to URLs with this scheme. + // + // This function may be called on any thread. It should only be called once + // per unique |scheme_name| value. If |scheme_name| is already registered or + // if an error occurs this function will return false (0). + /// + int (CEF_CALLBACK *add_custom_scheme)(struct _cef_scheme_registrar_t* self, + const cef_string_t* scheme_name, int is_standard, int is_local, + int is_display_isolated); +} cef_scheme_registrar_t; + + +/// +// Structure that creates cef_resource_handler_t instances for handling scheme +// requests. The functions of this structure will always be called on the IO +// thread. +/// +typedef struct _cef_scheme_handler_factory_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Return a new resource handler instance to handle the request. |browser| and + // |frame| will be the browser window and frame respectively that originated + // the request or NULL if the request did not originate from a browser window + // (for example, if the request came from cef_urlrequest_t). The |request| + // object passed to this function will not contain cookie data. + /// + struct _cef_resource_handler_t* (CEF_CALLBACK *create)( + struct _cef_scheme_handler_factory_t* self, + struct _cef_browser_t* browser, struct _cef_frame_t* frame, + const cef_string_t* scheme_name, struct _cef_request_t* request); +} cef_scheme_handler_factory_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_ diff --git a/cef/include/capi/cef_stream_capi.h b/include/capi/cef_stream_capi.h similarity index 100% rename from cef/include/capi/cef_stream_capi.h rename to include/capi/cef_stream_capi.h diff --git a/include/capi/cef_string_visitor_capi.h b/include/capi/cef_string_visitor_capi.h new file mode 100644 index 000000000..aa628faae --- /dev/null +++ b/include/capi/cef_string_visitor_capi.h @@ -0,0 +1,69 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_STRING_VISITOR_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_STRING_VISITOR_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Implement this structure to receive string values asynchronously. +/// +typedef struct _cef_string_visitor_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Method that will be executed. + /// + void (CEF_CALLBACK *visit)(struct _cef_string_visitor_t* self, + const cef_string_t* string); +} cef_string_visitor_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_STRING_VISITOR_CAPI_H_ diff --git a/cef/include/capi/cef_task_capi.h b/include/capi/cef_task_capi.h similarity index 83% rename from cef/include/capi/cef_task_capi.h rename to include/capi/cef_task_capi.h index cca4fbd9c..75b6ee3ed 100644 --- a/cef/include/capi/cef_task_capi.h +++ b/include/capi/cef_task_capi.h @@ -47,26 +47,25 @@ extern "C" { /// // CEF maintains multiple internal threads that are used for handling different -// types of tasks. The UI thread creates the browser window and is used for all -// interaction with the WebKit rendering engine and V8 JavaScript engine (The UI -// thread will be the same as the main application thread if cef_initialize() is -// called with a CefSettings.multi_threaded_message_loop value of false (0).) -// The IO thread is used for handling schema and network requests. The FILE -// thread is used for the application cache and other miscellaneous activities. -// This function will return true (1) if called on the specified thread. +// types of tasks in different processes. See the cef_thread_id_t definitions in +// cef_types.h for more information. This function will return true (1) if +// called on the specified thread. It is an error to request a thread from the +// wrong process. /// CEF_EXPORT int cef_currently_on(cef_thread_id_t threadId); /// // Post a task for execution on the specified thread. This function may be -// called on any thread. +// called on any thread. It is an error to request a thread from the wrong +// process. /// CEF_EXPORT int cef_post_task(cef_thread_id_t threadId, struct _cef_task_t* task); /// // Post a task for delayed execution on the specified thread. This function may -// be called on any thread. +// be called on any thread. It is an error to request a thread from the wrong +// process. /// CEF_EXPORT int cef_post_delayed_task(cef_thread_id_t threadId, struct _cef_task_t* task, int64 delay_ms); diff --git a/cef/include/capi/cef_url_capi.h b/include/capi/cef_url_capi.h similarity index 100% rename from cef/include/capi/cef_url_capi.h rename to include/capi/cef_url_capi.h diff --git a/include/capi/cef_urlrequest_capi.h b/include/capi/cef_urlrequest_capi.h new file mode 100644 index 000000000..29e111e9b --- /dev/null +++ b/include/capi/cef_urlrequest_capi.h @@ -0,0 +1,164 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_URLREQUEST_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_URLREQUEST_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Structure used to make a URL request. URL requests are not associated with a +// browser instance so no cef_client_t callbacks will be executed. URL requests +// can be created on any valid CEF thread in either the browser or render +// process. Once created the functions of the URL request object must be +// accessed on the same thread that created it. +/// +typedef struct _cef_urlrequest_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Returns the request object used to create this URL request. The returned + // object is read-only and should not be modified. + /// + struct _cef_request_t* (CEF_CALLBACK *get_request)( + struct _cef_urlrequest_t* self); + + /// + // Returns the client. + /// + struct _cef_urlrequest_client_t* (CEF_CALLBACK *get_client)( + struct _cef_urlrequest_t* self); + + /// + // Returns the request status. + /// + enum cef_urlrequest_status_t (CEF_CALLBACK *get_request_status)( + struct _cef_urlrequest_t* self); + + /// + // Returns the request error if status is UR_CANCELED or UR_FAILED, or 0 + // otherwise. + /// + enum cef_errorcode_t (CEF_CALLBACK *get_request_error)( + struct _cef_urlrequest_t* self); + + /// + // Returns the response, or NULL if no response information is available. + // Response information will only be available after the upload has completed. + // The returned object is read-only and should not be modified. + /// + struct _cef_response_t* (CEF_CALLBACK *get_response)( + struct _cef_urlrequest_t* self); + + /// + // Cancel the request. + /// + void (CEF_CALLBACK *cancel)(struct _cef_urlrequest_t* self); +} cef_urlrequest_t; + + +/// +// Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request +// functions are supported. The |request| object will be marked as read-only +// after calling this function. +/// +CEF_EXPORT cef_urlrequest_t* cef_urlrequest_create( + struct _cef_request_t* request, struct _cef_urlrequest_client_t* client); + + +/// +// Structure that should be implemented by the cef_urlrequest_t client. The +// functions of this structure will be called on the same thread that created +// the request. +/// +typedef struct _cef_urlrequest_client_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Notifies the client that the request has completed. Use the + // cef_urlrequest_t::GetRequestStatus function to determine if the request was + // successful or not. + /// + void (CEF_CALLBACK *on_request_complete)( + struct _cef_urlrequest_client_t* self, + struct _cef_urlrequest_t* request); + + /// + // Notifies the client of upload progress. |current| denotes the number of + // bytes sent so far and |total| is the total size of uploading data (or -1 if + // chunked upload is enabled). This function will only be called if the + // UR_FLAG_REPORT_UPLOAD_PROGRESS flag is set on the request. + /// + void (CEF_CALLBACK *on_upload_progress)(struct _cef_urlrequest_client_t* self, + struct _cef_urlrequest_t* request, uint64 current, uint64 total); + + /// + // Notifies the client of download progress. |current| denotes the number of + // bytes received up to the call and |total| is the expected total size of the + // response (or -1 if not determined). + /// + void (CEF_CALLBACK *on_download_progress)( + struct _cef_urlrequest_client_t* self, struct _cef_urlrequest_t* request, + uint64 current, uint64 total); + + /// + // Called when some part of the response is read. |data| contains the current + // bytes received since the last call. This function will not be called if the + // UR_FLAG_NO_DOWNLOAD_DATA flag is set on the request. + /// + void (CEF_CALLBACK *on_download_data)(struct _cef_urlrequest_client_t* self, + struct _cef_urlrequest_t* request, const void* data, + size_t data_length); +} cef_urlrequest_client_t; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_URLREQUEST_CAPI_H_ diff --git a/include/capi/cef_v8_capi.h b/include/capi/cef_v8_capi.h new file mode 100644 index 000000000..6acc03726 --- /dev/null +++ b/include/capi/cef_v8_capi.h @@ -0,0 +1,707 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Register a new V8 extension with the specified JavaScript extension code and +// handler. Functions implemented by the handler are prototyped using the +// keyword 'native'. The calling of a native function is restricted to the scope +// in which the prototype of the native function is defined. This function may +// only be called on the render process main thread. +// +// Example JavaScript extension code:
    +//   // create the 'example' global object if it doesn't already exist.
    +//   if (!example)
    +//     example = {};
    +//   // create the 'example.test' global object if it doesn't already exist.
    +//   if (!example.test)
    +//     example.test = {};
    +//   (function() {
    +//     // Define the function 'example.test.myfunction'.
    +//     example.test.myfunction = function() {
    +//       // Call CefV8Handler::Execute() with the function name 'MyFunction'
    +//       // and no arguments.
    +//       native function MyFunction();
    +//       return MyFunction();
    +//     };
    +//     // Define the getter function for parameter 'example.test.myparam'.
    +//     example.test.__defineGetter__('myparam', function() {
    +//       // Call CefV8Handler::Execute() with the function name 'GetMyParam'
    +//       // and no arguments.
    +//       native function GetMyParam();
    +//       return GetMyParam();
    +//     });
    +//     // Define the setter function for parameter 'example.test.myparam'.
    +//     example.test.__defineSetter__('myparam', function(b) {
    +//       // Call CefV8Handler::Execute() with the function name 'SetMyParam'
    +//       // and a single argument.
    +//       native function SetMyParam();
    +//       if(b) SetMyParam(b);
    +//     });
    +//
    +//     // Extension definitions can also contain normal JavaScript variables
    +//     // and functions.
    +//     var myint = 0;
    +//     example.test.increment = function() {
    +//       myint += 1;
    +//       return myint;
    +//     };
    +//   })();
    +// 
    Example usage in the page:
    +//   // Call the function.
    +//   example.test.myfunction();
    +//   // Set the parameter.
    +//   example.test.myparam = value;
    +//   // Get the parameter.
    +//   value = example.test.myparam;
    +//   // Call another function.
    +//   example.test.increment();
    +// 
    +/// +CEF_EXPORT int cef_register_extension(const cef_string_t* extension_name, + const cef_string_t* javascript_code, struct _cef_v8handler_t* handler); + +/// +// Structure that encapsulates a V8 context handle. The functions of this +// structure may only be called on the render process main thread. +/// +typedef struct _cef_v8context_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Returns the browser for this context. + /// + struct _cef_browser_t* (CEF_CALLBACK *get_browser)( + struct _cef_v8context_t* self); + + /// + // Returns the frame for this context. + /// + struct _cef_frame_t* (CEF_CALLBACK *get_frame)(struct _cef_v8context_t* self); + + /// + // Returns the global object for this context. The context must be entered + // before calling this function. + /// + struct _cef_v8value_t* (CEF_CALLBACK *get_global)( + struct _cef_v8context_t* self); + + /// + // Enter this context. A context must be explicitly entered before creating a + // V8 Object, Array, Function or Date asynchronously. exit() must be called + // the same number of times as enter() before releasing this context. V8 + // objects belong to the context in which they are created. Returns true (1) + // if the scope was entered successfully. + /// + int (CEF_CALLBACK *enter)(struct _cef_v8context_t* self); + + /// + // Exit this context. Call this function only after calling enter(). Returns + // true (1) if the scope was exited successfully. + /// + int (CEF_CALLBACK *exit)(struct _cef_v8context_t* self); + + /// + // Returns true (1) if this object is pointing to the same handle as |that| + // object. + /// + int (CEF_CALLBACK *is_same)(struct _cef_v8context_t* self, + struct _cef_v8context_t* that); + + /// + // Evaluates the specified JavaScript code using this context's global object. + // On success |retval| will be set to the return value, if any, and the + // function will return true (1). On failure |exception| will be set to the + // exception, if any, and the function will return false (0). + /// + int (CEF_CALLBACK *eval)(struct _cef_v8context_t* self, + const cef_string_t* code, struct _cef_v8value_t** retval, + struct _cef_v8exception_t** exception); +} cef_v8context_t; + + +/// +// Returns the current (top) context object in the V8 context stack. +/// +CEF_EXPORT cef_v8context_t* cef_v8context_get_current_context(); + +/// +// Returns the entered (bottom) context object in the V8 context stack. +/// +CEF_EXPORT cef_v8context_t* cef_v8context_get_entered_context(); + +/// +// Returns true (1) if V8 is currently inside a context. +/// +CEF_EXPORT int cef_v8context_in_context(); + + +/// +// Structure that should be implemented to handle V8 function calls. The +// functions of this structure will always be called on the render process main +// thread. +/// +typedef struct _cef_v8handler_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Handle execution of the function identified by |name|. |object| is the + // receiver ('this' object) of the function. |arguments| is the list of + // arguments passed to the function. If execution succeeds set |retval| to the + // function return value. If execution fails set |exception| to the exception + // that will be thrown. Return true (1) if execution was handled. + /// + int (CEF_CALLBACK *execute)(struct _cef_v8handler_t* self, + const cef_string_t* name, struct _cef_v8value_t* object, + size_t argumentsCount, struct _cef_v8value_t* const* arguments, + struct _cef_v8value_t** retval, cef_string_t* exception); +} cef_v8handler_t; + + +/// +// Structure that should be implemented to handle V8 accessor calls. Accessor +// identifiers are registered by calling cef_v8value_t::set_value_byaccessor(). +// The functions of this structure will always be called on the render process +// main thread. +/// +typedef struct _cef_v8accessor_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Handle retrieval the accessor value identified by |name|. |object| is the + // receiver ('this' object) of the accessor. If retrieval succeeds set + // |retval| to the return value. If retrieval fails set |exception| to the + // exception that will be thrown. Return true (1) if accessor retrieval was + // handled. + /// + int (CEF_CALLBACK *get)(struct _cef_v8accessor_t* self, + const cef_string_t* name, struct _cef_v8value_t* object, + struct _cef_v8value_t** retval, cef_string_t* exception); + + /// + // Handle assignment of the accessor value identified by |name|. |object| is + // the receiver ('this' object) of the accessor. |value| is the new value + // being assigned to the accessor. If assignment fails set |exception| to the + // exception that will be thrown. Return true (1) if accessor assignment was + // handled. + /// + int (CEF_CALLBACK *set)(struct _cef_v8accessor_t* self, + const cef_string_t* name, struct _cef_v8value_t* object, + struct _cef_v8value_t* value, cef_string_t* exception); +} cef_v8accessor_t; + + +/// +// Structure representing a V8 exception. +/// +typedef struct _cef_v8exception_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Returns the exception message. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_message)( + struct _cef_v8exception_t* self); + + /// + // Returns the line of source code that the exception occurred within. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_source_line)( + struct _cef_v8exception_t* self); + + /// + // Returns the resource name for the script from where the function causing + // the error originates. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_script_resource_name)( + struct _cef_v8exception_t* self); + + /// + // Returns the 1-based number of the line where the error occurred or 0 if the + // line number is unknown. + /// + int (CEF_CALLBACK *get_line_number)(struct _cef_v8exception_t* self); + + /// + // Returns the index within the script of the first character where the error + // occurred. + /// + int (CEF_CALLBACK *get_start_position)(struct _cef_v8exception_t* self); + + /// + // Returns the index within the script of the last character where the error + // occurred. + /// + int (CEF_CALLBACK *get_end_position)(struct _cef_v8exception_t* self); + + /// + // Returns the index within the line of the first character where the error + // occurred. + /// + int (CEF_CALLBACK *get_start_column)(struct _cef_v8exception_t* self); + + /// + // Returns the index within the line of the last character where the error + // occurred. + /// + int (CEF_CALLBACK *get_end_column)(struct _cef_v8exception_t* self); +} cef_v8exception_t; + + +/// +// Structure representing a V8 value. The functions of this structure may only +// be called on the render process main thread. +/// +typedef struct _cef_v8value_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // True if the value type is undefined. + /// + int (CEF_CALLBACK *is_undefined)(struct _cef_v8value_t* self); + + /// + // True if the value type is null. + /// + int (CEF_CALLBACK *is_null)(struct _cef_v8value_t* self); + + /// + // True if the value type is bool. + /// + int (CEF_CALLBACK *is_bool)(struct _cef_v8value_t* self); + + /// + // True if the value type is int. + /// + int (CEF_CALLBACK *is_int)(struct _cef_v8value_t* self); + + /// + // True if the value type is unsigned int. + /// + int (CEF_CALLBACK *is_uint)(struct _cef_v8value_t* self); + + /// + // True if the value type is double. + /// + int (CEF_CALLBACK *is_double)(struct _cef_v8value_t* self); + + /// + // True if the value type is Date. + /// + int (CEF_CALLBACK *is_date)(struct _cef_v8value_t* self); + + /// + // True if the value type is string. + /// + int (CEF_CALLBACK *is_string)(struct _cef_v8value_t* self); + + /// + // True if the value type is object. + /// + int (CEF_CALLBACK *is_object)(struct _cef_v8value_t* self); + + /// + // True if the value type is array. + /// + int (CEF_CALLBACK *is_array)(struct _cef_v8value_t* self); + + /// + // True if the value type is function. + /// + int (CEF_CALLBACK *is_function)(struct _cef_v8value_t* self); + + /// + // Returns true (1) if this object is pointing to the same handle as |that| + // object. + /// + int (CEF_CALLBACK *is_same)(struct _cef_v8value_t* self, + struct _cef_v8value_t* that); + + /// + // Return a bool value. The underlying data will be converted to if + // necessary. + /// + int (CEF_CALLBACK *get_bool_value)(struct _cef_v8value_t* self); + + /// + // Return an int value. The underlying data will be converted to if + // necessary. + /// + int32 (CEF_CALLBACK *get_int_value)(struct _cef_v8value_t* self); + + /// + // Return an unisgned int value. The underlying data will be converted to if + // necessary. + /// + uint32 (CEF_CALLBACK *get_uint_value)(struct _cef_v8value_t* self); + + /// + // Return a double value. The underlying data will be converted to if + // necessary. + /// + double (CEF_CALLBACK *get_double_value)(struct _cef_v8value_t* self); + + /// + // Return a Date value. The underlying data will be converted to if + // necessary. + /// + cef_time_t (CEF_CALLBACK *get_date_value)(struct _cef_v8value_t* self); + + /// + // Return a string value. The underlying data will be converted to if + // necessary. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_string_value)( + struct _cef_v8value_t* self); + + + // OBJECT METHODS - These functions are only available on objects. Arrays and + // functions are also objects. String- and integer-based keys can be used + // interchangably with the framework converting between them as necessary. + + /// + // Returns true (1) if this is a user created object. + /// + int (CEF_CALLBACK *is_user_created)(struct _cef_v8value_t* self); + + /// + // Returns true (1) if the last function call resulted in an exception. This + // attribute exists only in the scope of the current CEF value object. + /// + int (CEF_CALLBACK *has_exception)(struct _cef_v8value_t* self); + + /// + // Returns the exception resulting from the last function call. This attribute + // exists only in the scope of the current CEF value object. + /// + struct _cef_v8exception_t* (CEF_CALLBACK *get_exception)( + struct _cef_v8value_t* self); + + /// + // Clears the last exception and returns true (1) on success. + /// + int (CEF_CALLBACK *clear_exception)(struct _cef_v8value_t* self); + + /// + // Returns true (1) if this object will re-throw future exceptions. This + // attribute exists only in the scope of the current CEF value object. + /// + int (CEF_CALLBACK *will_rethrow_exceptions)(struct _cef_v8value_t* self); + + /// + // Set whether this object will re-throw future exceptions. By default + // exceptions are not re-thrown. If a exception is re-thrown the current + // context should not be accessed again until after the exception has been + // caught and not re-thrown. Returns true (1) on success. This attribute + // exists only in the scope of the current CEF value object. + /// + int (CEF_CALLBACK *set_rethrow_exceptions)(struct _cef_v8value_t* self, + int rethrow); + + /// + // Returns true (1) if the object has a value with the specified identifier. + /// + int (CEF_CALLBACK *has_value_bykey)(struct _cef_v8value_t* self, + const cef_string_t* key); + + /// + // Returns true (1) if the object has a value with the specified identifier. + /// + int (CEF_CALLBACK *has_value_byindex)(struct _cef_v8value_t* self, int index); + + /// + // Deletes the value with the specified identifier and returns true (1) on + // success. Returns false (0) if this function is called incorrectly or an + // exception is thrown. For read-only and don't-delete values this function + // will return true (1) even though deletion failed. + /// + int (CEF_CALLBACK *delete_value_bykey)(struct _cef_v8value_t* self, + const cef_string_t* key); + + /// + // Deletes the value with the specified identifier and returns true (1) on + // success. Returns false (0) if this function is called incorrectly, deletion + // fails or an exception is thrown. For read-only and don't-delete values this + // function will return true (1) even though deletion failed. + /// + int (CEF_CALLBACK *delete_value_byindex)(struct _cef_v8value_t* self, + int index); + + /// + // Returns the value with the specified identifier on success. Returns NULL if + // this function is called incorrectly or an exception is thrown. + /// + struct _cef_v8value_t* (CEF_CALLBACK *get_value_bykey)( + struct _cef_v8value_t* self, const cef_string_t* key); + + /// + // Returns the value with the specified identifier on success. Returns NULL if + // this function is called incorrectly or an exception is thrown. + /// + struct _cef_v8value_t* (CEF_CALLBACK *get_value_byindex)( + struct _cef_v8value_t* self, int index); + + /// + // Associates a value with the specified identifier and returns true (1) on + // success. Returns false (0) if this function is called incorrectly or an + // exception is thrown. For read-only values this function will return true + // (1) even though assignment failed. + /// + int (CEF_CALLBACK *set_value_bykey)(struct _cef_v8value_t* self, + const cef_string_t* key, struct _cef_v8value_t* value, + enum cef_v8_propertyattribute_t attribute); + + /// + // Associates a value with the specified identifier and returns true (1) on + // success. Returns false (0) if this function is called incorrectly or an + // exception is thrown. For read-only values this function will return true + // (1) even though assignment failed. + /// + int (CEF_CALLBACK *set_value_byindex)(struct _cef_v8value_t* self, int index, + struct _cef_v8value_t* value); + + /// + // Registers an identifier and returns true (1) on success. Access to the + // identifier will be forwarded to the cef_v8accessor_t instance passed to + // cef_v8value_t::cef_v8value_create_object(). Returns false (0) if this + // function is called incorrectly or an exception is thrown. For read-only + // values this function will return true (1) even though assignment failed. + /// + int (CEF_CALLBACK *set_value_byaccessor)(struct _cef_v8value_t* self, + const cef_string_t* key, enum cef_v8_accesscontrol_t settings, + enum cef_v8_propertyattribute_t attribute); + + /// + // Read the keys for the object's values into the specified vector. Integer- + // based keys will also be returned as strings. + /// + int (CEF_CALLBACK *get_keys)(struct _cef_v8value_t* self, + cef_string_list_t keys); + + /// + // Sets the user data for this object and returns true (1) on success. Returns + // false (0) if this function is called incorrectly. This function can only be + // called on user created objects. + /// + int (CEF_CALLBACK *set_user_data)(struct _cef_v8value_t* self, + struct _cef_base_t* user_data); + + /// + // Returns the user data, if any, assigned to this object. + /// + struct _cef_base_t* (CEF_CALLBACK *get_user_data)( + struct _cef_v8value_t* self); + + /// + // Returns the amount of externally allocated memory registered for the + // object. + /// + int (CEF_CALLBACK *get_externally_allocated_memory)( + struct _cef_v8value_t* self); + + /// + // Adjusts the amount of registered external memory for the object. Used to + // give V8 an indication of the amount of externally allocated memory that is + // kept alive by JavaScript objects. V8 uses this information to decide when + // to perform global garbage collection. Each cef_v8value_t tracks the amount + // of external memory associated with it and automatically decreases the + // global total by the appropriate amount on its destruction. + // |change_in_bytes| specifies the number of bytes to adjust by. This function + // returns the number of bytes associated with the object after the + // adjustment. This function can only be called on user created objects. + /// + int (CEF_CALLBACK *adjust_externally_allocated_memory)( + struct _cef_v8value_t* self, int change_in_bytes); + + + // ARRAY METHODS - These functions are only available on arrays. + + /// + // Returns the number of elements in the array. + /// + int (CEF_CALLBACK *get_array_length)(struct _cef_v8value_t* self); + + + // FUNCTION METHODS - These functions are only available on functions. + + /// + // Returns the function name. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_function_name)( + struct _cef_v8value_t* self); + + /// + // Returns the function handler or NULL if not a CEF-created function. + /// + struct _cef_v8handler_t* (CEF_CALLBACK *get_function_handler)( + struct _cef_v8value_t* self); + + /// + // Execute the function using the current V8 context. This function should + // only be called from within the scope of a cef_v8handler_t or + // cef_v8accessor_t callback, or in combination with calling enter() and + // exit() on a stored cef_v8context_t reference. |object| is the receiver + // ('this' object) of the function. If |object| is NULL the current context's + // global object will be used. |arguments| is the list of arguments that will + // be passed to the function. Returns the function return value on success. + // Returns NULL if this function is called incorrectly or an exception is + // thrown. + /// + struct _cef_v8value_t* (CEF_CALLBACK *execute_function)( + struct _cef_v8value_t* self, struct _cef_v8value_t* object, + size_t argumentsCount, struct _cef_v8value_t* const* arguments); + + /// + // Execute the function using the specified V8 context. |object| is the + // receiver ('this' object) of the function. If |object| is NULL the specified + // context's global object will be used. |arguments| is the list of arguments + // that will be passed to the function. Returns the function return value on + // success. Returns NULL if this function is called incorrectly or an + // exception is thrown. + /// + struct _cef_v8value_t* (CEF_CALLBACK *execute_function_with_context)( + struct _cef_v8value_t* self, struct _cef_v8context_t* context, + struct _cef_v8value_t* object, size_t argumentsCount, + struct _cef_v8value_t* const* arguments); +} cef_v8value_t; + + +/// +// Create a new cef_v8value_t object of type undefined. +/// +CEF_EXPORT cef_v8value_t* cef_v8value_create_undefined(); + +/// +// Create a new cef_v8value_t object of type null. +/// +CEF_EXPORT cef_v8value_t* cef_v8value_create_null(); + +/// +// Create a new cef_v8value_t object of type bool. +/// +CEF_EXPORT cef_v8value_t* cef_v8value_create_bool(int value); + +/// +// Create a new cef_v8value_t object of type int. +/// +CEF_EXPORT cef_v8value_t* cef_v8value_create_int(int32 value); + +/// +// Create a new cef_v8value_t object of type unsigned int. +/// +CEF_EXPORT cef_v8value_t* cef_v8value_create_uint(uint32 value); + +/// +// Create a new cef_v8value_t object of type double. +/// +CEF_EXPORT cef_v8value_t* cef_v8value_create_double(double value); + +/// +// Create a new cef_v8value_t object of type Date. This function should only be +// called from within the scope of a cef_v8context_tHandler, cef_v8handler_t or +// cef_v8accessor_t callback, or in combination with calling enter() and exit() +// on a stored cef_v8context_t reference. +/// +CEF_EXPORT cef_v8value_t* cef_v8value_create_date(const cef_time_t* date); + +/// +// Create a new cef_v8value_t object of type string. +/// +CEF_EXPORT cef_v8value_t* cef_v8value_create_string(const cef_string_t* value); + +/// +// Create a new cef_v8value_t object of type object with optional accessor. This +// function should only be called from within the scope of a +// cef_v8context_tHandler, cef_v8handler_t or cef_v8accessor_t callback, or in +// combination with calling enter() and exit() on a stored cef_v8context_t +// reference. +/// +CEF_EXPORT cef_v8value_t* cef_v8value_create_object(cef_v8accessor_t* accessor); + +/// +// Create a new cef_v8value_t object of type array with the specified |length|. +// If |length| is negative the returned array will have length 0. This function +// should only be called from within the scope of a cef_v8context_tHandler, +// cef_v8handler_t or cef_v8accessor_t callback, or in combination with calling +// enter() and exit() on a stored cef_v8context_t reference. +/// +CEF_EXPORT cef_v8value_t* cef_v8value_create_array(int length); + +/// +// Create a new cef_v8value_t object of type function. This function should only +// be called from within the scope of a cef_v8context_tHandler, cef_v8handler_t +// or cef_v8accessor_t callback, or in combination with calling enter() and +// exit() on a stored cef_v8context_t reference. +/// +CEF_EXPORT cef_v8value_t* cef_v8value_create_function(const cef_string_t* name, + cef_v8handler_t* handler); + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_ diff --git a/include/capi/cef_values_capi.h b/include/capi/cef_values_capi.h new file mode 100644 index 000000000..712474a09 --- /dev/null +++ b/include/capi/cef_values_capi.h @@ -0,0 +1,461 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef CEF_INCLUDE_CAPI_CEF_VALUES_CAPI_H_ +#define CEF_INCLUDE_CAPI_CEF_VALUES_CAPI_H_ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + + +/// +// Structure representing a binary value. Can be used on any process and thread. +/// +typedef struct _cef_binary_value_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + /// + int (CEF_CALLBACK *is_valid)(struct _cef_binary_value_t* self); + + /// + // Returns true (1) if this object is currently owned by another object. + /// + int (CEF_CALLBACK *is_owned)(struct _cef_binary_value_t* self); + + /// + // Returns a copy of this object. The data in this object will also be copied. + /// + struct _cef_binary_value_t* (CEF_CALLBACK *copy)( + struct _cef_binary_value_t* self); + + /// + // Returns the data size. + /// + size_t (CEF_CALLBACK *get_size)(struct _cef_binary_value_t* self); + + /// + // Read up to |buffer_size| number of bytes into |buffer|. Reading begins at + // the specified byte |data_offset|. Returns the number of bytes read. + /// + size_t (CEF_CALLBACK *get_data)(struct _cef_binary_value_t* self, + void* buffer, size_t buffer_size, size_t data_offset); +} cef_binary_value_t; + + +/// +// Creates a new object that is not owned by any other object. The specified +// |data| will be copied. +/// +CEF_EXPORT cef_binary_value_t* cef_binary_value_create(const void* data, + size_t data_size); + + +/// +// Structure representing a dictionary value. Can be used on any process and +// thread. +/// +typedef struct _cef_dictionary_value_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + /// + int (CEF_CALLBACK *is_valid)(struct _cef_dictionary_value_t* self); + + /// + // Returns true (1) if this object is currently owned by another object. + /// + int (CEF_CALLBACK *is_owned)(struct _cef_dictionary_value_t* self); + + /// + // Returns true (1) if the values of this object are read-only. Some APIs may + // expose read-only objects. + /// + int (CEF_CALLBACK *is_read_only)(struct _cef_dictionary_value_t* self); + + /// + // Returns a writable copy of this object. If |exclude_NULL_children| is true + // (1) any NULL dictionaries or lists will be excluded from the copy. + /// + struct _cef_dictionary_value_t* (CEF_CALLBACK *copy)( + struct _cef_dictionary_value_t* self, int exclude_empty_children); + + /// + // Returns the number of values. + /// + size_t (CEF_CALLBACK *get_size)(struct _cef_dictionary_value_t* self); + + /// + // Removes all values. Returns true (1) on success. + /// + int (CEF_CALLBACK *clear)(struct _cef_dictionary_value_t* self); + + /// + // Returns true (1) if the current dictionary has a value for the given key. + /// + int (CEF_CALLBACK *has_key)(struct _cef_dictionary_value_t* self, + const cef_string_t* key); + + /// + // Reads all keys for this dictionary into the specified vector. + /// + int (CEF_CALLBACK *get_keys)(struct _cef_dictionary_value_t* self, + cef_string_list_t keys); + + /// + // Removes the value at the specified key. Returns true (1) is the value was + // removed successfully. + /// + int (CEF_CALLBACK *remove)(struct _cef_dictionary_value_t* self, + const cef_string_t* key); + + /// + // Returns the value type for the specified key. + /// + enum cef_value_type_t (CEF_CALLBACK *get_type)( + struct _cef_dictionary_value_t* self, const cef_string_t* key); + + /// + // Returns the value at the specified key as type bool. + /// + int (CEF_CALLBACK *get_bool)(struct _cef_dictionary_value_t* self, + const cef_string_t* key); + + /// + // Returns the value at the specified key as type int. + /// + int (CEF_CALLBACK *get_int)(struct _cef_dictionary_value_t* self, + const cef_string_t* key); + + /// + // Returns the value at the specified key as type double. + /// + double (CEF_CALLBACK *get_double)(struct _cef_dictionary_value_t* self, + const cef_string_t* key); + + /// + // Returns the value at the specified key as type string. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_string)( + struct _cef_dictionary_value_t* self, const cef_string_t* key); + + /// + // Returns the value at the specified key as type binary. + /// + struct _cef_binary_value_t* (CEF_CALLBACK *get_binary)( + struct _cef_dictionary_value_t* self, const cef_string_t* key); + + /// + // Returns the value at the specified key as type dictionary. + /// + struct _cef_dictionary_value_t* (CEF_CALLBACK *get_dictionary)( + struct _cef_dictionary_value_t* self, const cef_string_t* key); + + /// + // Returns the value at the specified key as type list. + /// + struct _cef_list_value_t* (CEF_CALLBACK *get_list)( + struct _cef_dictionary_value_t* self, const cef_string_t* key); + + /// + // Sets the value at the specified key as type null. Returns true (1) if the + // value was set successfully. + /// + int (CEF_CALLBACK *set_null)(struct _cef_dictionary_value_t* self, + const cef_string_t* key); + + /// + // Sets the value at the specified key as type bool. Returns true (1) if the + // value was set successfully. + /// + int (CEF_CALLBACK *set_bool)(struct _cef_dictionary_value_t* self, + const cef_string_t* key, int value); + + /// + // Sets the value at the specified key as type int. Returns true (1) if the + // value was set successfully. + /// + int (CEF_CALLBACK *set_int)(struct _cef_dictionary_value_t* self, + const cef_string_t* key, int value); + + /// + // Sets the value at the specified key as type double. Returns true (1) if the + // value was set successfully. + /// + int (CEF_CALLBACK *set_double)(struct _cef_dictionary_value_t* self, + const cef_string_t* key, double value); + + /// + // Sets the value at the specified key as type string. Returns true (1) if the + // value was set successfully. + /// + int (CEF_CALLBACK *set_string)(struct _cef_dictionary_value_t* self, + const cef_string_t* key, const cef_string_t* value); + + /// + // Sets the value at the specified key as type binary. Returns true (1) if the + // value was set successfully. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + /// + int (CEF_CALLBACK *set_binary)(struct _cef_dictionary_value_t* self, + const cef_string_t* key, struct _cef_binary_value_t* value); + + /// + // Sets the value at the specified key as type dict. Returns true (1) if the + // value was set successfully. After calling this function the |value| object + // will no longer be valid. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + /// + int (CEF_CALLBACK *set_dictionary)(struct _cef_dictionary_value_t* self, + const cef_string_t* key, struct _cef_dictionary_value_t* value); + + /// + // Sets the value at the specified key as type list. Returns true (1) if the + // value was set successfully. After calling this function the |value| object + // will no longer be valid. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + /// + int (CEF_CALLBACK *set_list)(struct _cef_dictionary_value_t* self, + const cef_string_t* key, struct _cef_list_value_t* value); +} cef_dictionary_value_t; + + +/// +// Creates a new object that is not owned by any other object. +/// +CEF_EXPORT cef_dictionary_value_t* cef_dictionary_value_create(); + + +/// +// Structure representing a list value. Can be used on any process and thread. +/// +typedef struct _cef_list_value_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + /// + int (CEF_CALLBACK *is_valid)(struct _cef_list_value_t* self); + + /// + // Returns true (1) if this object is currently owned by another object. + /// + int (CEF_CALLBACK *is_owned)(struct _cef_list_value_t* self); + + /// + // Returns true (1) if the values of this object are read-only. Some APIs may + // expose read-only objects. + /// + int (CEF_CALLBACK *is_read_only)(struct _cef_list_value_t* self); + + /// + // Returns a writable copy of this object. + /// + struct _cef_list_value_t* (CEF_CALLBACK *copy)( + struct _cef_list_value_t* self); + + /// + // Sets the number of values. If the number of values is expanded all new + // value slots will default to type null. Returns true (1) on success. + /// + int (CEF_CALLBACK *set_size)(struct _cef_list_value_t* self, size_t size); + + /// + // Returns the number of values. + /// + size_t (CEF_CALLBACK *get_size)(struct _cef_list_value_t* self); + + /// + // Removes all values. Returns true (1) on success. + /// + int (CEF_CALLBACK *clear)(struct _cef_list_value_t* self); + + /// + // Removes the value at the specified index. + /// + int (CEF_CALLBACK *remove)(struct _cef_list_value_t* self, int index); + + /// + // Returns the value type at the specified index. + /// + enum cef_value_type_t (CEF_CALLBACK *get_type)(struct _cef_list_value_t* self, + int index); + + /// + // Returns the value at the specified index as type bool. + /// + int (CEF_CALLBACK *get_bool)(struct _cef_list_value_t* self, int index); + + /// + // Returns the value at the specified index as type int. + /// + int (CEF_CALLBACK *get_int)(struct _cef_list_value_t* self, int index); + + /// + // Returns the value at the specified index as type double. + /// + double (CEF_CALLBACK *get_double)(struct _cef_list_value_t* self, int index); + + /// + // Returns the value at the specified index as type string. + /// + // The resulting string must be freed by calling cef_string_userfree_free(). + cef_string_userfree_t (CEF_CALLBACK *get_string)( + struct _cef_list_value_t* self, int index); + + /// + // Returns the value at the specified index as type binary. + /// + struct _cef_binary_value_t* (CEF_CALLBACK *get_binary)( + struct _cef_list_value_t* self, int index); + + /// + // Returns the value at the specified index as type dictionary. + /// + struct _cef_dictionary_value_t* (CEF_CALLBACK *get_dictionary)( + struct _cef_list_value_t* self, int index); + + /// + // Returns the value at the specified index as type list. + /// + struct _cef_list_value_t* (CEF_CALLBACK *get_list)( + struct _cef_list_value_t* self, int index); + + /// + // Sets the value at the specified index as type null. Returns true (1) if the + // value was set successfully. + /// + int (CEF_CALLBACK *set_null)(struct _cef_list_value_t* self, int index); + + /// + // Sets the value at the specified index as type bool. Returns true (1) if the + // value was set successfully. + /// + int (CEF_CALLBACK *set_bool)(struct _cef_list_value_t* self, int index, + int value); + + /// + // Sets the value at the specified index as type int. Returns true (1) if the + // value was set successfully. + /// + int (CEF_CALLBACK *set_int)(struct _cef_list_value_t* self, int index, + int value); + + /// + // Sets the value at the specified index as type double. Returns true (1) if + // the value was set successfully. + /// + int (CEF_CALLBACK *set_double)(struct _cef_list_value_t* self, int index, + double value); + + /// + // Sets the value at the specified index as type string. Returns true (1) if + // the value was set successfully. + /// + int (CEF_CALLBACK *set_string)(struct _cef_list_value_t* self, int index, + const cef_string_t* value); + + /// + // Sets the value at the specified index as type binary. Returns true (1) if + // the value was set successfully. After calling this function the |value| + // object will no longer be valid. If |value| is currently owned by another + // object then the value will be copied and the |value| reference will not + // change. Otherwise, ownership will be transferred to this object and the + // |value| reference will be invalidated. + /// + int (CEF_CALLBACK *set_binary)(struct _cef_list_value_t* self, int index, + struct _cef_binary_value_t* value); + + /// + // Sets the value at the specified index as type dict. Returns true (1) if the + // value was set successfully. After calling this function the |value| object + // will no longer be valid. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + /// + int (CEF_CALLBACK *set_dictionary)(struct _cef_list_value_t* self, int index, + struct _cef_dictionary_value_t* value); + + /// + // Sets the value at the specified index as type list. Returns true (1) if the + // value was set successfully. After calling this function the |value| object + // will no longer be valid. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + /// + int (CEF_CALLBACK *set_list)(struct _cef_list_value_t* self, int index, + struct _cef_list_value_t* value); +} cef_list_value_t; + + +/// +// Creates a new object that is not owned by any other object. +/// +CEF_EXPORT cef_list_value_t* cef_list_value_create(); + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_CAPI_CEF_VALUES_CAPI_H_ diff --git a/cef/include/capi/cef_web_plugin_capi.h b/include/capi/cef_web_plugin_capi.h similarity index 80% rename from cef/include/capi/cef_web_plugin_capi.h rename to include/capi/cef_web_plugin_capi.h index d5aab64bd..8ffaf7c8f 100644 --- a/cef/include/capi/cef_web_plugin_capi.h +++ b/include/capi/cef_web_plugin_capi.h @@ -46,23 +46,10 @@ extern "C" { /// -// Returns the number of installed web plugins. This function must be called on -// the UI thread. +// Visit web plugin information. /// -CEF_EXPORT size_t cef_get_web_plugin_count(); - -/// -// Returns information for web plugin at the specified zero-based index. This -// function must be called on the UI thread. -/// -CEF_EXPORT struct _cef_web_plugin_info_t* cef_get_web_plugin_info(int index); - -/// -// Returns information for web plugin with the specified name. This function -// must be called on the UI thread. -/// -CEF_EXPORT struct _cef_web_plugin_info_t* cef_get_web_plugin_info_byname( - const cef_string_t* name); +CEF_EXPORT void cef_visit_web_plugin_info( + struct _cef_web_plugin_info_visitor_t* visitor); /// // Information about a specific web plugin. @@ -103,6 +90,27 @@ typedef struct _cef_web_plugin_info_t { } cef_web_plugin_info_t; +/// +// Structure to implement for visiting web plugin information. The functions of +// this structure will be called on the UI thread. +/// +typedef struct _cef_web_plugin_info_visitor_t { + /// + // Base structure. + /// + cef_base_t base; + + /// + // Method that will be called once for each plugin. |count| is the 0-based + // index for the current plugin. |total| is the total number of plugins. + // Return false (0) to stop visiting plugins. This function may never be + // called if no plugins are found. + /// + int (CEF_CALLBACK *visit)(struct _cef_web_plugin_info_visitor_t* self, + struct _cef_web_plugin_info_t* info, int count, int total); +} cef_web_plugin_info_visitor_t; + + #ifdef __cplusplus } #endif diff --git a/cef/include/capi/cef_xml_reader_capi.h b/include/capi/cef_xml_reader_capi.h similarity index 100% rename from cef/include/capi/cef_xml_reader_capi.h rename to include/capi/cef_xml_reader_capi.h diff --git a/cef/include/capi/cef_zip_reader_capi.h b/include/capi/cef_zip_reader_capi.h similarity index 100% rename from cef/include/capi/cef_zip_reader_capi.h rename to include/capi/cef_zip_reader_capi.h diff --git a/include/cef_app.h b/include/cef_app.h new file mode 100644 index 000000000..9d1aa321d --- /dev/null +++ b/include/cef_app.h @@ -0,0 +1,175 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + + +#ifndef CEF_INCLUDE_CEF_APP_H_ +#define CEF_INCLUDE_CEF_APP_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_browser_process_handler.h" +#include "include/cef_command_line.h" +#include "include/cef_render_process_handler.h" +#include "include/cef_resource_bundle_handler.h" +#include "include/cef_scheme.h" + +class CefApp; + +/// +// This function should be called from the application entry point function to +// execute a secondary process. It can be used to run secondary processes from +// the browser client executable (default behavior) or from a separate +// executable specified by the CefSettings.browser_subprocess_path value. If +// called for the browser process (identified by no "type" command-line value) +// it will return immediately with a value of -1. If called for a recognized +// secondary process it will block until the process should exit and then return +// the process exit code. The |application| parameter may be empty. +/// +/*--cef(revision_check,optional_param=application)--*/ +int CefExecuteProcess(const CefMainArgs& args, CefRefPtr application); + +/// +// This function should be called on the main application thread to initialize +// the CEF browser process. The |application| parameter may be empty. A return +// value of true indicates that it succeeded and false indicates that it failed. +/// +/*--cef(revision_check,optional_param=application)--*/ +bool CefInitialize(const CefMainArgs& args, const CefSettings& settings, + CefRefPtr application); + +/// +// This function should be called on the main application thread to shut down +// the CEF browser process before the application exits. +/// +/*--cef()--*/ +void CefShutdown(); + +/// +// Perform a single iteration of CEF message loop processing. This function is +// used to integrate the CEF message loop into an existing application message +// loop. Care must be taken to balance performance against excessive CPU usage. +// This function should only be called on the main application thread and only +// if CefInitialize() is called with a CefSettings.multi_threaded_message_loop +// value of false. This function will not block. +/// +/*--cef()--*/ +void CefDoMessageLoopWork(); + +/// +// Run the CEF message loop. Use this function instead of an application- +// provided message loop to get the best balance between performance and CPU +// usage. This function should only be called on the main application thread and +// only if CefInitialize() is called with a +// CefSettings.multi_threaded_message_loop value of false. This function will +// block until a quit message is received by the system. +/// +/*--cef()--*/ +void CefRunMessageLoop(); + +/// +// Quit the CEF message loop that was started by calling CefRunMessageLoop(). +// This function should only be called on the main application thread and only +// if CefRunMessageLoop() was used. +/// +/*--cef()--*/ +void CefQuitMessageLoop(); + +/// +// Implement this interface to provide handler implementations. Methods will be +// called by the process and/or thread indicated. +/// +/*--cef(source=client,no_debugct_check)--*/ +class CefApp : public virtual CefBase { + public: + /// + // Provides an opportunity to view and/or modify command-line arguments before + // processing by CEF and Chromium. The |process_type| value will be empty for + // the browser process. Do not keep a reference to the CefCommandLine object + // passed to this method. The CefSettings.command_line_args_disabled value + // can be used to start with an empty command-line object. Any values + // specified in CefSettings that equate to command-line arguments will be set + // before this method is called. Be cautious when using this method to modify + // command-line arguments for non-browser processes as this may result in + // undefined behavior including crashes. + /// + /*--cef(optional_param=process_type)--*/ + virtual void OnBeforeCommandLineProcessing( + const CefString& process_type, + CefRefPtr command_line) { + } + + /// + // Provides an opportunity to register custom schemes. Do not keep a reference + // to the |registrar| object. This method is called on the main thread for + // each process and the registered schemes should be the same across all + // processes. + /// + /*--cef()--*/ + virtual void OnRegisterCustomSchemes( + CefRefPtr registrar) { + } + + /// + // Return the handler for resource bundle events. If + // CefSettings.pack_loading_disabled is true a handler must be returned. If no + // handler is returned resources will be loaded from pack files. This method + // is called by the browser and render processes on multiple threads. + /// + /*--cef()--*/ + virtual CefRefPtr GetResourceBundleHandler() { + return NULL; + } + + /// + // Return the handler for functionality specific to the browser process. This + // method is called on multiple threads in the browser process. + /// + /*--cef()--*/ + virtual CefRefPtr GetBrowserProcessHandler() { + return NULL; + } + + /// + // Return the handler for functionality specific to the render process. This + // method is called on the render process main thread. + /// + /*--cef()--*/ + virtual CefRefPtr GetRenderProcessHandler() { + return NULL; + } +}; + +#endif // CEF_INCLUDE_CEF_APP_H_ diff --git a/cef/include/cef_application_mac.h b/include/cef_application_mac.h similarity index 84% rename from cef/include/cef_application_mac.h rename to include/cef_application_mac.h index 33042478c..3a5126ef7 100644 --- a/cef/include/cef_application_mac.h +++ b/include/cef_application_mac.h @@ -38,7 +38,13 @@ #ifdef BUILDING_CEF_SHARED // Use the existing CrAppProtocol definition. -#include "base/message_pump_mac.h" +#import "base/message_pump_mac.h" + +// Use the existing CrAppControlProtocol definition. +#import "base/mac/scoped_sending_event.h" + +// Use the existing UnderlayableSurface definition. +#import "ui/base/cocoa/underlay_opengl_hosting_window.h" // Use the existing empty protocol definitions. #import "base/mac/cocoa_protocols.h" @@ -48,12 +54,24 @@ #import #import -// Copy of CrAppProtocol definition from base/message_pump_mac.h. +// Copy of definition from base/message_pump_mac.h. @protocol CrAppProtocol // Must return true if -[NSApplication sendEvent:] is currently on the stack. - (BOOL)isHandlingSendEvent; @end +// Copy of definition from base/mac/scoped_sending_event.h. +@protocol CrAppControlProtocol +- (void)setHandlingSendEvent:(BOOL)handlingSendEvent; +@end + +// Copy of definition from ui/base/cocoa/underlay_opengl_hosting_window.h. +// Common base class for windows that host a OpenGL surface that renders under +// the window. Contains methods relating to hole punching so that the OpenGL +// surface is visible through the window. +@interface UnderlayOpenGLHostingWindow : NSWindow +@end + // The Mac OS X 10.6 SDK introduced new protocols used for delegates. These // protocol defintions were not present in earlier releases of the Mac OS X // SDK. In order to support building against the new SDK, which requires @@ -92,8 +110,7 @@ DEFINE_EMPTY_PROTOCOL(NSWindowDelegate) // All CEF client applications must subclass NSApplication and implement this // protocol. -@protocol CefAppProtocol -- (void)setHandlingSendEvent:(BOOL)handlingSendEvent; +@protocol CefAppProtocol @end // Controls the state of |isHandlingSendEvent| in the event loop so that it is diff --git a/cef/include/cef_base.h b/include/cef_base.h similarity index 98% rename from cef/include/cef_base.h rename to include/cef_base.h index 5fc964fa3..bc284f72e 100644 --- a/cef/include/cef_base.h +++ b/include/cef_base.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/cef_browser.h b/include/cef_browser.h new file mode 100644 index 000000000..b54f7dda3 --- /dev/null +++ b/include/cef_browser.h @@ -0,0 +1,288 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_BROWSER_H_ +#define CEF_INCLUDE_CEF_BROWSER_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_frame.h" +#include "include/cef_process_message.h" +#include + +class CefBrowserHost; +class CefClient; + + +/// +// Class used to represent a browser window. When used in the browser process +// the methods of this class may be called on any thread unless otherwise +// indicated in the comments. When used in the render process the methods of +// this class may only be called on the main thread. +/// +/*--cef(source=library)--*/ +class CefBrowser : public virtual CefBase { + public: + /// + // Returns the browser host object. This method can only be called in the + // browser process. + /// + /*--cef()--*/ + virtual CefRefPtr GetHost() =0; + + /// + // Returns true if the browser can navigate backwards. + /// + /*--cef()--*/ + virtual bool CanGoBack() =0; + + /// + // Navigate backwards. + /// + /*--cef()--*/ + virtual void GoBack() =0; + + /// + // Returns true if the browser can navigate forwards. + /// + /*--cef()--*/ + virtual bool CanGoForward() =0; + + /// + // Navigate forwards. + /// + /*--cef()--*/ + virtual void GoForward() =0; + + /// + // Returns true if the browser is currently loading. + /// + /*--cef()--*/ + virtual bool IsLoading() =0; + + /// + // Reload the current page. + /// + /*--cef()--*/ + virtual void Reload() =0; + + /// + // Reload the current page ignoring any cached data. + /// + /*--cef()--*/ + virtual void ReloadIgnoreCache() =0; + + /// + // Stop loading the page. + /// + /*--cef()--*/ + virtual void StopLoad() =0; + + /// + // Returns the globally unique identifier for this browser. + /// + /*--cef()--*/ + virtual int GetIdentifier() =0; + + /// + // Returns true if the window is a popup window. + /// + /*--cef()--*/ + virtual bool IsPopup() =0; + + /// + // Returns true if a document has been loaded in the browser. + /// + /*--cef()--*/ + virtual bool HasDocument() =0; + + /// + // Returns the main (top-level) frame for the browser window. + /// + /*--cef()--*/ + virtual CefRefPtr GetMainFrame() =0; + + /// + // Returns the focused frame for the browser window. + /// + /*--cef()--*/ + virtual CefRefPtr GetFocusedFrame() =0; + + /// + // Returns the frame with the specified identifier, or NULL if not found. + /// + /*--cef(capi_name=get_frame_byident)--*/ + virtual CefRefPtr GetFrame(int64 identifier) =0; + + /// + // Returns the frame with the specified name, or NULL if not found. + /// + /*--cef()--*/ + virtual CefRefPtr GetFrame(const CefString& name) =0; + + /// + // Returns the number of frames that currently exist. + /// + /*--cef()--*/ + virtual size_t GetFrameCount() =0; + + /// + // Returns the identifiers of all existing frames. + /// + /*--cef(count_func=identifiers:GetFrameCount)--*/ + virtual void GetFrameIdentifiers(std::vector& identifiers) =0; + + /// + // Returns the names of all existing frames. + /// + /*--cef()--*/ + virtual void GetFrameNames(std::vector& names) =0; + + // + // Send a message to the specified |target_process|. Returns true if the + // message was sent successfully. + /// + /*--cef()--*/ + virtual bool SendProcessMessage(CefProcessId target_process, + CefRefPtr message) =0; +}; + + +/// +// Class used to represent the browser process aspects of a browser window. The +// methods of this class can only be called in the browser process. They may be +// called on any thread in that process unless otherwise indicated in the +// comments. +/// +/*--cef(source=library)--*/ +class CefBrowserHost : public virtual CefBase { + public: + /// + // Create a new browser window using the window parameters specified by + // |windowInfo|. All values will be copied internally and the actual window + // will be created on the UI thread. This method can be called on any browser + // process thread and will not block. + /// + /*--cef(optional_param=url)--*/ + static bool CreateBrowser(const CefWindowInfo& windowInfo, + CefRefPtr client, + const CefString& url, + const CefBrowserSettings& settings); + + /// + // Create a new browser window using the window parameters specified by + // |windowInfo|. This method can only be called on the browser process UI + // thread. + /// + /*--cef(optional_param=url)--*/ + static CefRefPtr CreateBrowserSync( + const CefWindowInfo& windowInfo, + CefRefPtr client, + const CefString& url, + const CefBrowserSettings& settings); + + /// + // Returns the hosted browser object. + /// + /*--cef()--*/ + virtual CefRefPtr GetBrowser() =0; + + /// + // Call this method before destroying a contained browser window. This method + // performs any internal cleanup that may be needed before the browser window + // is destroyed. + /// + /*--cef()--*/ + virtual void ParentWindowWillClose() =0; + + /// + // Closes this browser window. + /// + /*--cef()--*/ + virtual void CloseBrowser() =0; + + /// + // Set focus for the browser window. If |enable| is true focus will be set to + // the window. Otherwise, focus will be removed. + /// + /*--cef()--*/ + virtual void SetFocus(bool enable) =0; + + /// + // Retrieve the window handle for this browser. + /// + /*--cef()--*/ + virtual CefWindowHandle GetWindowHandle() =0; + + /// + // Retrieve the window handle of the browser that opened this browser. Will + // return NULL for non-popup windows. This method can be used in combination + // with custom handling of modal windows. + /// + /*--cef()--*/ + virtual CefWindowHandle GetOpenerWindowHandle() =0; + + /// + // Returns the client for this browser. + /// + /*--cef()--*/ + virtual CefRefPtr GetClient() =0; + + /// + // Returns the DevTools URL for this browser. If |http_scheme| is true the + // returned URL will use the http scheme instead of the chrome-devtools + // scheme. Remote debugging can be enabled by specifying the + // "remote-debugging-port" command-line flag or by setting the + // CefSettings.remote_debugging_port value. If remote debugging is not enabled + // this method will return an empty string. + /// + /*--cef()--*/ + virtual CefString GetDevToolsURL(bool http_scheme) =0; + + /// + // Get the zoom level. This method can only be called on the UI thread. + /// + /*--cef()--*/ + virtual double GetZoomLevel() =0; + + /// + // Change the zoom level to the specified value. + /// + /*--cef()--*/ + virtual void SetZoomLevel(double zoomLevel) =0; +}; + +#endif // CEF_INCLUDE_CEF_BROWSER_H_ diff --git a/include/cef_browser_process_handler.h b/include/cef_browser_process_handler.h new file mode 100644 index 000000000..1095e2da1 --- /dev/null +++ b/include/cef_browser_process_handler.h @@ -0,0 +1,69 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_BROWSER_PROCESS_HANDLER_H_ +#define CEF_INCLUDE_CEF_BROWSER_PROCESS_HANDLER_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_proxy_handler.h" + +/// +// Class used to implement browser process callbacks. The methods of this class +// will be called on the browser process main thread unless otherwise indicated. +/// +/*--cef(source=client)--*/ +class CefBrowserProcessHandler : public virtual CefBase { + public: + /// + // Return the handler for proxy events. If no handler is returned the default + // system handler will be used. This method is called on the browser process + // IO thread. + /// + /*--cef()--*/ + virtual CefRefPtr GetProxyHandler() { + return NULL; + } + + /// + // Called on the browser process UI thread immediately after the CEF context + // has been initialized. + /// + /*--cef()--*/ + virtual void OnContextInitialized() {} +}; + +#endif // CEF_INCLUDE_CEF_BROWSER_PROCESS_HANDLER_H_ diff --git a/include/cef_callback.h b/include/cef_callback.h new file mode 100644 index 000000000..34f67a6c6 --- /dev/null +++ b/include/cef_callback.h @@ -0,0 +1,62 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_CALLBACK_H_ +#define CEF_INCLUDE_CEF_CALLBACK_H_ +#pragma once + +#include "include/cef_base.h" + +/// +// Generic callback interface used for asynchronous continuation. +/// +/*--cef(source=library)--*/ +class CefCallback : public virtual CefBase { + public: + /// + // Continue processing. + /// + /*--cef(capi_name=cont)--*/ + virtual void Continue() =0; + + /// + // Cancel processing. + /// + /*--cef()--*/ + virtual void Cancel() =0; +}; + +#endif // CEF_INCLUDE_CEF_CALLBACK_H_ diff --git a/include/cef_client.h b/include/cef_client.h new file mode 100644 index 000000000..2614fc39a --- /dev/null +++ b/include/cef_client.h @@ -0,0 +1,157 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_CLIENT_H_ +#define CEF_INCLUDE_CEF_CLIENT_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_context_menu_handler.h" +#include "include/cef_display_handler.h" +#include "include/cef_download_handler.h" +#include "include/cef_focus_handler.h" +#include "include/cef_geolocation_handler.h" +#include "include/cef_jsdialog_handler.h" +#include "include/cef_keyboard_handler.h" +#include "include/cef_life_span_handler.h" +#include "include/cef_load_handler.h" +#include "include/cef_process_message.h" +#include "include/cef_request_handler.h" + +/// +// Implement this interface to provide handler implementations. +/// +/*--cef(source=client,no_debugct_check)--*/ +class CefClient : public virtual CefBase { + public: + /// + // Return the handler for context menus. If no handler is provided the default + // implementation will be used. + /// + /*--cef()--*/ + virtual CefRefPtr GetContextMenuHandler() { + return NULL; + } + + /// + // Return the handler for browser display state events. + /// + /*--cef()--*/ + virtual CefRefPtr GetDisplayHandler() { + return NULL; + } + + /// + // Return the handler for download events. If no handler is returned downloads + // will not be allowed. + /// + /*--cef()--*/ + virtual CefRefPtr GetDownloadHandler() { + return NULL; + } + + /// + // Return the handler for focus events. + /// + /*--cef()--*/ + virtual CefRefPtr GetFocusHandler() { + return NULL; + } + + /// + // Return the handler for geolocation permissions requests. If no handler is + // provided geolocation access will be denied by default. + /// + /*--cef()--*/ + virtual CefRefPtr GetGeolocationHandler() { + return NULL; + } + + /// + // Return the handler for JavaScript dialogs. If no handler is provided the + // default implementation will be used. + /// + /*--cef()--*/ + virtual CefRefPtr GetJSDialogHandler() { + return NULL; + } + + /// + // Return the handler for keyboard events. + /// + /*--cef()--*/ + virtual CefRefPtr GetKeyboardHandler() { + return NULL; + } + + /// + // Return the handler for browser life span events. + /// + /*--cef()--*/ + virtual CefRefPtr GetLifeSpanHandler() { + return NULL; + } + + /// + // Return the handler for browser load status events. + /// + /*--cef()--*/ + virtual CefRefPtr GetLoadHandler() { + return NULL; + } + + /// + // Return the handler for browser request events. + /// + /*--cef()--*/ + virtual CefRefPtr GetRequestHandler() { + return NULL; + } + + /// + // Called when a new message is received from a different process. Return true + // if the message was handled or false otherwise. Do not keep a reference to + // or attempt to access the message outside of this callback. + /// + /*--cef()--*/ + virtual bool OnProcessMessageReceived(CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) { + return false; + } +}; + +#endif // CEF_INCLUDE_CEF_CLIENT_H_ diff --git a/cef/include/cef_command_line.h b/include/cef_command_line.h similarity index 86% rename from cef/include/cef_command_line.h rename to include/cef_command_line.h index a698187ee..38f1a434d 100644 --- a/cef/include/cef_command_line.h +++ b/include/cef_command_line.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -64,6 +64,33 @@ class CefCommandLine : public virtual CefBase { /*--cef(revision_check)--*/ static CefRefPtr CreateCommandLine(); + /// + // Returns the singleton global CefCommandLine object. The returned object + // will be read-only. + /// + /*--cef(revision_check)--*/ + static CefRefPtr GetGlobalCommandLine(); + + /// + // Returns true if this object is valid. Do not call any other methods if this + // function returns false. + /// + /*--cef()--*/ + virtual bool IsValid() =0; + + /// + // Returns true if the values of this object are read-only. Some APIs may + // expose read-only objects. + /// + /*--cef()--*/ + virtual bool IsReadOnly() =0; + + /// + // Returns a writable copy of this object. + /// + /*--cef()--*/ + virtual CefRefPtr Copy() =0; + /// // Initialize the command line with the specified |argc| and |argv| values. // The first argument must be the name of the program. This method is only @@ -79,6 +106,13 @@ class CefCommandLine : public virtual CefBase { /*--cef()--*/ virtual void InitFromString(const CefString& command_line) =0; + /// + // Reset the command-line switches and arguments but leave the program + // component unchanged. + /// + /*--cef()--*/ + virtual void Reset() =0; + /// // Constructs and returns the represented command line string. Use this method // cautiously because quoting behavior is unclear. diff --git a/include/cef_context_menu_handler.h b/include/cef_context_menu_handler.h new file mode 100644 index 000000000..e3e983ad5 --- /dev/null +++ b/include/cef_context_menu_handler.h @@ -0,0 +1,216 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_CONTEXT_MENU_HANDLER_H_ +#define CEF_INCLUDE_CEF_CONTEXT_MENU_HANDLER_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "include/cef_menu_model.h" + +class CefContextMenuParams; + +/// +// Implement this interface to handle context menu events. The methods of this +// class will be called on the UI thread. +/// +/*--cef(source=client)--*/ +class CefContextMenuHandler : public virtual CefBase { + public: + typedef cef_event_flags_t EventFlags; + + /// + // Called before a context menu is displayed. |params| provides information + // about the context menu state. |model| initially contains the default + // context menu. The |model| can be cleared to show no context menu or + // modified to show a custom menu. Do not keep references to |params| or + // |model| outside of this callback. + /// + /*--cef()--*/ + virtual void OnBeforeContextMenu(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr params, + CefRefPtr model) {} + + /// + // Called to execute a command selected from the context menu. Return true if + // the command was handled or false for the default implementation. See + // cef_menu_id_t for the command ids that have default implementations. All + // user-defined command ids should be between MENU_ID_USER_FIRST and + // MENU_ID_USER_LAST. |params| will have the same values as what was passed to + // OnBeforeContextMenu(). Do not keep a reference to |params| outside of this + // callback. + /// + /*--cef()--*/ + virtual bool OnContextMenuCommand(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr params, + int command_id, + EventFlags event_flags) { return false; } + + /// + // Called when the context menu is dismissed irregardless of whether the menu + // was empty or a command was selected. + /// + /*--cef()--*/ + virtual void OnContextMenuDismissed(CefRefPtr browser, + CefRefPtr frame) {} +}; + + +/// +// Provides information about the context menu state. The ethods of this class +// can only be accessed on browser process the UI thread. +/// +/*--cef(source=library)--*/ +class CefContextMenuParams : public virtual CefBase { + public: + typedef cef_context_menu_type_flags_t TypeFlags; + typedef cef_context_menu_media_type_t MediaType; + typedef cef_context_menu_media_state_flags_t MediaStateFlags; + typedef cef_context_menu_edit_state_flags_t EditStateFlags; + + /// + // Returns the X coordinate of the mouse where the context menu was invoked. + // Coords are relative to the associated RenderView's origin. + /// + /*--cef()--*/ + virtual int GetXCoord() =0; + + /// + // Returns the Y coordinate of the mouse where the context menu was invoked. + // Coords are relative to the associated RenderView's origin. + /// + /*--cef()--*/ + virtual int GetYCoord() =0; + + /// + // Returns flags representing the type of node that the context menu was + // invoked on. + /// + /*--cef(default_retval=CM_TYPEFLAG_NONE)--*/ + virtual TypeFlags GetTypeFlags() =0; + + /// + // Returns the URL of the link, if any, that encloses the node that the + // context menu was invoked on. + /// + /*--cef()--*/ + virtual CefString GetLinkUrl() =0; + + /// + // Returns the link URL, if any, to be used ONLY for "copy link address". We + // don't validate this field in the frontend process. + /// + /*--cef()--*/ + virtual CefString GetUnfilteredLinkUrl() =0; + + /// + // Returns the source URL, if any, for the element that the context menu was + // invoked on. Example of elements with source URLs are img, audio, and video. + /// + /*--cef()--*/ + virtual CefString GetSourceUrl() =0; + + /// + // Returns true if the context menu was invoked on a blocked image. + /// + /*--cef()--*/ + virtual bool IsImageBlocked() =0; + + /// + // Returns the URL of the top level page that the context menu was invoked on. + /// + /*--cef()--*/ + virtual CefString GetPageUrl() =0; + + /// + // Returns the URL of the subframe that the context menu was invoked on. + /// + /*--cef()--*/ + virtual CefString GetFrameUrl() =0; + + /// + // Returns the character encoding of the subframe that the context menu was + // invoked on. + /// + /*--cef()--*/ + virtual CefString GetFrameCharset() =0; + + /// + // Returns the type of context node that the context menu was invoked on. + /// + /*--cef(default_retval=CM_MEDIATYPE_NONE)--*/ + virtual MediaType GetMediaType() =0; + + /// + // Returns flags representing the actions supported by the media element, if + // any, that the context menu was invoked on. + /// + /*--cef(default_retval=CM_MEDIAFLAG_NONE)--*/ + virtual MediaStateFlags GetMediaStateFlags() =0; + + /// + // Returns the text of the selection, if any, that the context menu was + // invoked on. + /// + /*--cef()--*/ + virtual CefString GetSelectionText() =0; + + /// + // Returns true if the context menu was invoked on an editable node. + /// + /*--cef()--*/ + virtual bool IsEditable() =0; + + /// + // Returns true if the context menu was invoked on an editable node where + // speech-input is enabled. + /// + /*--cef()--*/ + virtual bool IsSpeechInputEnabled() =0; + + /// + // Returns flags representing the actions supported by the editable node, if + // any, that the context menu was invoked on. + /// + /*--cef(default_retval=CM_EDITFLAG_NONE)--*/ + virtual EditStateFlags GetEditStateFlags() =0; +}; + +#endif // CEF_INCLUDE_CEF_CONTEXT_MENU_HANDLER_H_ diff --git a/cef/include/cef_cookie.h b/include/cef_cookie.h similarity index 100% rename from cef/include/cef_cookie.h rename to include/cef_cookie.h diff --git a/cef/include/cef_display_handler.h b/include/cef_display_handler.h similarity index 87% rename from cef/include/cef_display_handler.h rename to include/cef_display_handler.h index 2c55445d8..7a1c270d4 100644 --- a/cef/include/cef_display_handler.h +++ b/include/cef_display_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -52,12 +52,13 @@ class CefDisplayHandler : public virtual CefBase { typedef cef_handler_statustype_t StatusType; /// - // Called when the navigation state has changed. + // Called when the loading state has changed. /// /*--cef()--*/ - virtual void OnNavStateChange(CefRefPtr browser, - bool canGoBack, - bool canGoForward) {} + virtual void OnLoadingStateChange(CefRefPtr browser, + bool isLoading, + bool canGoBack, + bool canGoForward) {} /// // Called when a frame's address has changed. @@ -67,15 +68,6 @@ class CefDisplayHandler : public virtual CefBase { CefRefPtr frame, const CefString& url) {} - /// - // Called when the size of the content area has changed. - /// - /*--cef()--*/ - virtual void OnContentsSizeChange(CefRefPtr browser, - CefRefPtr frame, - int width, - int height) {} - /// // Called when the page title changes. /// diff --git a/cef/include/cef_dom.h b/include/cef_dom.h similarity index 96% rename from cef/include/cef_dom.h rename to include/cef_dom.h index b56050d87..f155e2f31 100644 --- a/cef/include/cef_dom.h +++ b/include/cef_dom.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -47,7 +47,7 @@ class CefDOMNode; /// // Interface to implement for visiting the DOM. The methods of this class will -// be called on the UI thread. +// be called on the render process main thread. /// /*--cef(source=client)--*/ class CefDOMVisitor : public virtual CefBase { @@ -66,7 +66,7 @@ class CefDOMVisitor : public virtual CefBase { /// // Class used to represent a DOM document. The methods of this class should only -// be called on the UI thread. +// be called on the render process main thread thread. /// /*--cef(source=library)--*/ class CefDOMDocument : public virtual CefBase { @@ -174,7 +174,7 @@ class CefDOMDocument : public virtual CefBase { /// // Class used to represent a DOM node. The methods of this class should only be -// called on the UI thread. +// called on the render process main thread. /// /*--cef(source=library)--*/ class CefDOMNode : public virtual CefBase { @@ -200,6 +200,12 @@ class CefDOMNode : public virtual CefBase { /*--cef()--*/ virtual bool IsElement() =0; + /// + // Returns true if this is an editable node. + /// + /*--cef()--*/ + virtual bool IsEditable() =0; + /// // Returns true if this is a form control element node. /// @@ -351,7 +357,7 @@ class CefDOMNode : public virtual CefBase { /// // Class used to represent a DOM event. The methods of this class should only -// be called on the UI thread. +// be called on the render process main thread. /// /*--cef(source=library)--*/ class CefDOMEvent : public virtual CefBase { @@ -411,7 +417,7 @@ class CefDOMEvent : public virtual CefBase { /// // Interface to implement for handling DOM events. The methods of this class -// will be called on the UI thread. +// will be called on the render process main thread. /// /*--cef(source=client)--*/ class CefDOMEventListener : public virtual CefBase { diff --git a/include/cef_download_handler.h b/include/cef_download_handler.h new file mode 100644 index 000000000..495fa8798 --- /dev/null +++ b/include/cef_download_handler.h @@ -0,0 +1,111 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_DOWNLOAD_HANDLER_H_ +#define CEF_INCLUDE_CEF_DOWNLOAD_HANDLER_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_browser.h" +#include "include/cef_download_item.h" + + +/// +// Callback interface used to asynchronously continue a download. +/// +/*--cef(source=library)--*/ +class CefBeforeDownloadCallback : public virtual CefBase { + public: + /// + // Call to continue the download. Set |download_path| to the full file path + // for the download including the file name or leave blank to use the + // suggested name and the default temp directory. Set |show_dialog| to true + // if you do wish to show the default "Save As" dialog. + /// + /*--cef(capi_name=cont,optional_param=download_path)--*/ + virtual void Continue(const CefString& download_path, bool show_dialog) =0; +}; + + +/// +// Callback interface used to asynchronously cancel a download. +/// +/*--cef(source=library)--*/ +class CefDownloadItemCallback : public virtual CefBase { + public: + /// + // Call to cancel the download. + /// + /*--cef()--*/ + virtual void Cancel() =0; +}; + + +/// +// Class used to handle file downloads. The methods of this class will called +// on the browser process UI thread. +/// +/*--cef(source=client)--*/ +class CefDownloadHandler : public virtual CefBase { + public: + /// + // Called before a download begins. |suggested_name| is the suggested name for + // the download file. By default the download will be canceled. Execute + // |callback| either asynchronously or in this method to continue the download + // if desired. Do not keep a reference to |download_item| outside of this + // method. + /// + /*--cef()--*/ + virtual void OnBeforeDownload( + CefRefPtr browser, + CefRefPtr download_item, + const CefString& suggested_name, + CefRefPtr callback) =0; + + /// + // Called when a download's status or progress information has been updated. + // Execute |callback| either asynchronously or in this method to cancel the + // download if desired. Do not keep a reference to |download_item| outside of + // this method. + /// + /*--cef()--*/ + virtual void OnDownloadUpdated( + CefRefPtr browser, + CefRefPtr download_item, + CefRefPtr callback) {} +}; + +#endif // CEF_INCLUDE_CEF_DOWNLOAD_HANDLER_H_ diff --git a/include/cef_download_item.h b/include/cef_download_item.h new file mode 100644 index 000000000..01988bfd5 --- /dev/null +++ b/include/cef_download_item.h @@ -0,0 +1,154 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_DOWNLOAD_ITEM_H_ +#define CEF_INCLUDE_CEF_DOWNLOAD_ITEM_H_ +#pragma once + +#include "include/cef_base.h" + +/// +// Class used to represent a download item. +/// +/*--cef(source=library)--*/ +class CefDownloadItem : public virtual CefBase { + public: + /// + // Returns true if this object is valid. Do not call any other methods if this + // function returns false. + /// + /*--cef()--*/ + virtual bool IsValid() =0; + + /// + // Returns true if the download is in progress. + /// + /*--cef()--*/ + virtual bool IsInProgress() =0; + + /// + // Returns true if the download is complete. + /// + /*--cef()--*/ + virtual bool IsComplete() =0; + + /// + // Returns true if the download has been canceled or interrupted. + /// + /*--cef()--*/ + virtual bool IsCanceled() =0; + + /// + // Returns a simple speed estimate in bytes/s. + /// + /*--cef()--*/ + virtual int64 GetCurrentSpeed() =0; + + /// + // Returns the rough percent complete or -1 if the receive total size is + // unknown. + /// + /*--cef()--*/ + virtual int GetPercentComplete() =0; + + /// + // Returns the total number of bytes. + /// + /*--cef()--*/ + virtual int64 GetTotalBytes() =0; + + /// + // Returns the number of received bytes. + /// + /*--cef()--*/ + virtual int64 GetReceivedBytes() =0; + + /// + // Returns the time that the download started. + /// + /*--cef()--*/ + virtual CefTime GetStartTime() =0; + + /// + // Returns the time that the download ended. + /// + /*--cef()--*/ + virtual CefTime GetEndTime() =0; + + /// + // Returns the full path to the downloaded or downloading file. + /// + /*--cef()--*/ + virtual CefString GetFullPath() =0; + + /// + // Returns the unique identifier for this download. + /// + /*--cef()--*/ + virtual int32 GetId() =0; + + /// + // Returns the URL. + /// + /*--cef()--*/ + virtual CefString GetURL() =0; + + /// + // Returns the suggested file name. + /// + /*--cef()--*/ + virtual CefString GetSuggestedFileName() =0; + + /// + // Returns the content disposition. + /// + /*--cef()--*/ + virtual CefString GetContentDisposition() =0; + + /// + // Returns the mime type. + /// + /*--cef()--*/ + virtual CefString GetMimeType() =0; + + /// + // Returns the referrer character set. + /// + /*--cef()--*/ + virtual CefString GetReferrerCharset() =0; +}; + +#endif // CEF_INCLUDE_CEF_DOWNLOAD_ITEM_H_ diff --git a/cef/include/cef_focus_handler.h b/include/cef_focus_handler.h similarity index 79% rename from cef/include/cef_focus_handler.h rename to include/cef_focus_handler.h index a45b6f52e..1d91c42ab 100644 --- a/cef/include/cef_focus_handler.h +++ b/include/cef_focus_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -50,7 +50,7 @@ /*--cef(source=client)--*/ class CefFocusHandler : public virtual CefBase { public: - typedef cef_handler_focus_source_t FocusSource; + typedef cef_focus_source_t FocusSource; /// // Called when the browser component is about to loose focus. For instance, if @@ -72,17 +72,10 @@ class CefFocusHandler : public virtual CefBase { FocusSource source) { return false; } /// - // Called when a new node in the the browser gets focus. The |node| value may - // be empty if no specific node has gained focus. The node object passed to - // this method represents a snapshot of the DOM at the time this method is - // executed. DOM objects are only valid for the scope of this method. Do not - // keep references to or attempt to access any DOM objects outside the scope - // of this method. + // Called when the browser component has received focus. /// - /*--cef(optional_param=frame,optional_param=node)--*/ - virtual void OnFocusedNodeChanged(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr node) {} + /*--cef()--*/ + virtual void OnGotFocus(CefRefPtr browser) {} }; #endif // CEF_INCLUDE_CEF_FOCUS_HANDLER_H_ diff --git a/cef/include/cef_frame.h b/include/cef_frame.h similarity index 78% rename from cef/include/cef_frame.h rename to include/cef_frame.h index f0ac6ef7a..872e01a61 100644 --- a/cef/include/cef_frame.h +++ b/include/cef_frame.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -42,80 +42,89 @@ #include "include/cef_dom.h" #include "include/cef_request.h" #include "include/cef_stream.h" +#include "include/cef_string_visitor.h" class CefBrowser; class CefV8Context; /// -// Class used to represent a frame in the browser window. The methods of this -// class may be called on any thread unless otherwise indicated in the comments. +// Class used to represent a frame in the browser window. When used in the +// browser process the methods of this class may be called on any thread unless +// otherwise indicated in the comments. When used in the render process the +// methods of this class may only be called on the main thread. /// /*--cef(source=library)--*/ class CefFrame : public virtual CefBase { public: + /// + // True if this object is currently attached to a valid frame. + /// + /*--cef()--*/ + virtual bool IsValid() =0; + /// // Execute undo in this frame. /// /*--cef()--*/ virtual void Undo() =0; + /// // Execute redo in this frame. /// /*--cef()--*/ virtual void Redo() =0; + /// // Execute cut in this frame. /// /*--cef()--*/ virtual void Cut() =0; + /// // Execute copy in this frame. /// /*--cef()--*/ virtual void Copy() =0; + /// // Execute paste in this frame. /// /*--cef()--*/ virtual void Paste() =0; + /// // Execute delete in this frame. /// /*--cef(capi_name=del)--*/ virtual void Delete() =0; + /// // Execute select all in this frame. /// /*--cef()--*/ virtual void SelectAll() =0; - /// - // Execute printing in the this frame. The user will be prompted with the - // print dialog appropriate to the operating system. - /// - /*--cef()--*/ - virtual void Print() =0; - /// // Save this frame's HTML source to a temporary file and open it in the - // default text viewing application. + // default text viewing application. This method can only be called from the + // browser process. /// /*--cef()--*/ virtual void ViewSource() =0; /// - // Returns this frame's HTML source as a string. This method should only be - // called on the UI thread. + // Retrieve this frame's HTML source as a string sent to the specified + // visitor. /// /*--cef()--*/ - virtual CefString GetSource() =0; + virtual void GetSource(CefRefPtr visitor) =0; /// - // Returns this frame's display text as a string. This method should only be - // called on the UI thread. + // Retrieve this frame's display text as a string sent to the specified + // visitor. /// /*--cef()--*/ - virtual CefString GetText() =0; + virtual void GetText(CefRefPtr visitor) =0; /// // Load the request represented by the |request| object. @@ -136,13 +145,6 @@ class CefFrame : public virtual CefBase { virtual void LoadString(const CefString& string_val, const CefString& url) =0; - /// - // Load the contents of |stream| with the optional dummy target |url|. - /// - /*--cef()--*/ - virtual void LoadStream(CefRefPtr stream, - const CefString& url) =0; - /// // Execute a string of JavaScript code in this frame. The |script_url| // parameter is the URL where the script in question can be found, if any. @@ -150,10 +152,10 @@ class CefFrame : public virtual CefBase { // error. The |start_line| parameter is the base line number to use for error // reporting. /// - /*--cef(optional_param=scriptUrl)--*/ - virtual void ExecuteJavaScript(const CefString& jsCode, - const CefString& scriptUrl, - int startLine) =0; + /*--cef(optional_param=script_url)--*/ + virtual void ExecuteJavaScript(const CefString& code, + const CefString& script_url, + int start_line) =0; /// // Returns true if this is the main (top-level) frame. @@ -162,8 +164,7 @@ class CefFrame : public virtual CefBase { virtual bool IsMain() =0; /// - // Returns true if this is the focused frame. This method should only be - // called on the UI thread. + // Returns true if this is the focused frame. /// /*--cef()--*/ virtual bool IsFocused() =0; @@ -186,7 +187,7 @@ class CefFrame : public virtual CefBase { /// // Returns the parent of this frame or NULL if this is the main (top-level) - // frame. This method should only be called on the UI thread. + // frame. /// /*--cef()--*/ virtual CefRefPtr GetParent() =0; @@ -204,17 +205,18 @@ class CefFrame : public virtual CefBase { virtual CefRefPtr GetBrowser() =0; /// - // Visit the DOM document. - /// - /*--cef()--*/ - virtual void VisitDOM(CefRefPtr visitor) =0; - - /// - // Get the V8 context associated with the frame. This method should only be - // called on the UI thread. + // Get the V8 context associated with the frame. This method can only be + // called from the render process. /// /*--cef()--*/ virtual CefRefPtr GetV8Context() =0; + + /// + // Visit the DOM document. This method can only be called from the render + // process. + /// + /*--cef()--*/ + virtual void VisitDOM(CefRefPtr visitor) =0; }; #endif // CEF_INCLUDE_CEF_FRAME_H_ diff --git a/include/cef_geolocation_handler.h b/include/cef_geolocation_handler.h new file mode 100644 index 000000000..ea92cdd20 --- /dev/null +++ b/include/cef_geolocation_handler.h @@ -0,0 +1,94 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_GEOLOCATION_HANDLER_H_ +#define CEF_INCLUDE_CEF_GEOLOCATION_HANDLER_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_browser.h" + +/// +// Callback interface used for asynchronous continuation of geolocation +// permission requests. +/// +/*--cef(source=library)--*/ +class CefGeolocationCallback : public virtual CefBase { + public: + /// + // Call to allow or deny geolocation access. + /// + /*--cef(capi_name=cont)--*/ + virtual void Continue(bool allow) =0; +}; + + +/// +// Implement this interface to handle events related to geolocation permission +// requests. The methods of this class will be called on the browser process IO +// thread. +/// +/*--cef(source=client)--*/ +class CefGeolocationHandler : public virtual CefBase { + public: + /// + // Called when a page requests permission to access geolocation information. + // |requesting_url| is the URL requesting permission and |request_id| is the + // unique ID for the permission request. Call CefGeolocationCallback::Continue + // to allow or deny the permission request. + /// + /*--cef()--*/ + virtual void OnRequestGeolocationPermission( + CefRefPtr browser, + const CefString& requesting_url, + int request_id, + CefRefPtr callback) { + } + + /// + // Called when a geolocation access request is canceled. |requesting_url| is + // the URL that originally requested permission and |request_id| is the unique + // ID for the permission request. + /// + /*--cef()--*/ + virtual void OnCancelGeolocationPermission( + CefRefPtr browser, + const CefString& requesting_url, + int request_id) { + } +}; + +#endif // CEF_INCLUDE_CEF_GEOLOCATION_HANDLER_H_ diff --git a/include/cef_jsdialog_handler.h b/include/cef_jsdialog_handler.h new file mode 100644 index 000000000..f2a4cf849 --- /dev/null +++ b/include/cef_jsdialog_handler.h @@ -0,0 +1,122 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_JSDIALOG_HANDLER_H_ +#define CEF_INCLUDE_CEF_JSDIALOG_HANDLER_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_browser.h" + +/// +// Callback interface used for asynchronous continuation of JavaScript dialog +// requests. +/// +/*--cef(source=library)--*/ +class CefJSDialogCallback : public virtual CefBase { + public: + /// + // Continue the JS dialog request. Set |success| to true if the OK button was + // pressed. The |user_input| value should be specified for prompt dialogs. + /// + /*--cef(capi_name=cont,optional_param=user_input)--*/ + virtual void Continue(bool success, + const CefString& user_input) =0; +}; + + +/// +// Implement this interface to handle events related to JavaScript dialogs. The +// methods of this class will be called on the UI thread. +/// +/*--cef(source=client)--*/ +class CefJSDialogHandler : public virtual CefBase { + public: + typedef cef_jsdialog_type_t JSDialogType; + + /// + // Called to run a JavaScript dialog. The |default_prompt_text| value will be + // specified for prompt dialogs only. Set |suppress_message| to true and + // return false to suppress the message (suppressing messages is preferable + // to immediately executing the callback as this is used to detect presumably + // malicious behavior like spamming alert messages in onbeforeunload). Set + // |suppress_message| to false and return false to use the default + // implementation (the default implementation will show one modal dialog at a + // time and suppress any additional dialog requests until the displayed dialog + // is dismissed). Return true if the application will use a custom dialog or + // if the callback has been executed immediately. Custom dialogs may be either + // modal or modeless. If a custom dialog is used the application must execute + // |callback| once the custom dialog is dismissed. + /// + /*--cef(optional_param=accept_lang,optional_param=message_text, + optional_param=default_prompt_text)--*/ + virtual bool OnJSDialog(CefRefPtr browser, + const CefString& origin_url, + const CefString& accept_lang, + JSDialogType dialog_type, + const CefString& message_text, + const CefString& default_prompt_text, + CefRefPtr callback, + bool& suppress_message) { + return false; + } + + /// + // Called to run a dialog asking the user if they want to leave a page. Return + // false to use the default dialog implementation. Return true if the + // application will use a custom dialog or if the callback has been executed + // immediately. Custom dialogs may be either modal or modeless. If a custom + // dialog is used the application must execute |callback| once the custom + // dialog is dismissed. + /// + /*--cef(optional_param=message_text)--*/ + virtual bool OnBeforeUnloadDialog(CefRefPtr browser, + const CefString& message_text, + bool is_reload, + CefRefPtr callback) { + return false; + } + + /// + // Called to cancel any pending dialogs and reset any saved dialog state. Will + // be called due to events like page navigation irregardless of whether any + // dialogs are currently pending. + /// + /*--cef()--*/ + virtual void OnResetDialogState(CefRefPtr browser) {} +}; + +#endif // CEF_INCLUDE_CEF_JSDIALOG_HANDLER_H_ diff --git a/include/cef_keyboard_handler.h b/include/cef_keyboard_handler.h new file mode 100644 index 000000000..55cb57ef8 --- /dev/null +++ b/include/cef_keyboard_handler.h @@ -0,0 +1,74 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_KEYBOARD_HANDLER_H_ +#define CEF_INCLUDE_CEF_KEYBOARD_HANDLER_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_browser.h" + +/// +// Implement this interface to handle events related to keyboard input. The +// methods of this class will be called on the UI thread. +/// +/*--cef(source=client)--*/ +class CefKeyboardHandler : public virtual CefBase { + public: + // Called before a keyboard event is sent to the renderer. |event| contains + // information about the keyboard event. |os_event| is the operating system + // event message, if any. Return true if the event was handled or false + // otherwise. If the event will be handled in OnKeyEvent() as a keyboard + // shortcut set |is_keyboard_shortcut| to true and return false. + /*--cef()--*/ + virtual bool OnPreKeyEvent(CefRefPtr browser, + const CefKeyEvent& event, + CefEventHandle os_event, + bool* is_keyboard_shortcut) { return false; } + + /// + // Called after the renderer and JavaScript in the page has had a chance to + // handle the event. |event| contains information about the keyboard event. + // |os_event| is the operating system event message, if any. Return true if + // the keyboard event was handled or false otherwise. + /// + /*--cef()--*/ + virtual bool OnKeyEvent(CefRefPtr browser, + const CefKeyEvent& event, + CefEventHandle os_event) { return false; } +}; + +#endif // CEF_INCLUDE_CEF_KEYBOARD_HANDLER_H_ diff --git a/cef/include/cef_life_span_handler.h b/include/cef_life_span_handler.h similarity index 98% rename from cef/include/cef_life_span_handler.h rename to include/cef_life_span_handler.h index 907d755a8..af1ac83d0 100644 --- a/cef/include/cef_life_span_handler.h +++ b/include/cef_life_span_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/cef/include/cef_load_handler.h b/include/cef_load_handler.h similarity index 77% rename from cef/include/cef_load_handler.h rename to include/cef_load_handler.h index bfa01df25..cc5cbf376 100644 --- a/cef/include/cef_load_handler.h +++ b/include/cef_load_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -49,7 +49,8 @@ /*--cef(source=client)--*/ class CefLoadHandler : public virtual CefBase { public: - typedef cef_handler_errorcode_t ErrorCode; + typedef cef_errorcode_t ErrorCode; + typedef cef_termination_status_t TerminationStatus; /// // Called when the browser begins loading a frame. The |frame| value will @@ -78,17 +79,32 @@ class CefLoadHandler : public virtual CefBase { /// // Called when the browser fails to load a resource. |errorCode| is the error - // code number and |failedUrl| is the URL that failed to load. To provide - // custom error text assign the text to |errorText| and return true. - // Otherwise, return false for the default error text. See - // net\base\net_error_list.h for complete descriptions of the error codes. + // code number, |errorText| is the error text and and |failedUrl| is the URL + // that failed to load. See net\base\net_error_list.h for complete + // descriptions of the error codes. /// - /*--cef()--*/ - virtual bool OnLoadError(CefRefPtr browser, + /*--cef(optional_param=errorText)--*/ + virtual void OnLoadError(CefRefPtr browser, CefRefPtr frame, ErrorCode errorCode, - const CefString& failedUrl, - CefString& errorText) { return false; } + const CefString& errorText, + const CefString& failedUrl) {} + + /// + // Called when the render process terminates unexpectedly. |status| indicates + // how the process terminated. + /// + /*--cef()--*/ + virtual void OnRenderProcessTerminated(CefRefPtr browser, + TerminationStatus status) {} + + /// + // Called when a plugin has crashed. |plugin_path| is the path of the plugin + // that crashed. + /// + /*--cef()--*/ + virtual void OnPluginCrashed(CefRefPtr browser, + const CefString& plugin_path) {} }; #endif // CEF_INCLUDE_CEF_LOAD_HANDLER_H_ diff --git a/include/cef_menu_model.h b/include/cef_menu_model.h new file mode 100644 index 000000000..84728c58b --- /dev/null +++ b/include/cef_menu_model.h @@ -0,0 +1,402 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_MENU_MODEL_H_ +#define CEF_INCLUDE_CEF_MENU_MODEL_H_ +#pragma once + +#include "include/cef_base.h" + +/// +// Supports creation and modification of menus. See cef_menu_id_t for the +// command ids that have default implementations. All user-defined command ids +// should be between MENU_ID_USER_FIRST and MENU_ID_USER_LAST. The methods of +// this class can only be accessed on the browser process the UI thread. +/// +/*--cef(source=library)--*/ +class CefMenuModel : public virtual CefBase { + public: + typedef cef_menu_item_type_t MenuItemType; + + /// + // Clears the menu. Returns true on success. + /// + /*--cef()--*/ + virtual bool Clear() =0; + + /// + // Returns the number of items in this menu. + /// + /*--cef()--*/ + virtual int GetCount() =0; + + // + // Add a separator to the menu. Returns true on success. + /// + /*--cef()--*/ + virtual bool AddSeparator() =0; + + // + // Add an item to the menu. Returns true on success. + /// + /*--cef()--*/ + virtual bool AddItem(int command_id, + const CefString& label) =0; + + // + // Add a check item to the menu. Returns true on success. + /// + /*--cef()--*/ + virtual bool AddCheckItem(int command_id, + const CefString& label) =0; + // + // Add a radio item to the menu. Only a single item with the specified + // |group_id| can be checked at a time. Returns true on success. + /// + /*--cef()--*/ + virtual bool AddRadioItem(int command_id, + const CefString& label, + int group_id) =0; + + // + // Add a sub-menu to the menu. The new sub-menu is returned. + /// + /*--cef()--*/ + virtual CefRefPtr AddSubMenu(int command_id, + const CefString& label) =0; + + // + // Insert a separator in the menu at the specified |index|. Returns true on + // success. + /// + /*--cef()--*/ + virtual bool InsertSeparatorAt(int index) =0; + + // + // Insert an item in the menu at the specified |index|. Returns true on + // success. + /// + /*--cef()--*/ + virtual bool InsertItemAt(int index, + int command_id, + const CefString& label) =0; + + // + // Insert a check item in the menu at the specified |index|. Returns true on + // success. + /// + /*--cef()--*/ + virtual bool InsertCheckItemAt(int index, + int command_id, + const CefString& label) =0; + + // + // Insert a radio item in the menu at the specified |index|. Only a single + // item with the specified |group_id| can be checked at a time. Returns true + // on success. + /// + /*--cef()--*/ + virtual bool InsertRadioItemAt(int index, + int command_id, + const CefString& label, + int group_id) =0; + + // + // Insert a sub-menu in the menu at the specified |index|. The new sub-menu + // is returned. + /// + /*--cef()--*/ + virtual CefRefPtr InsertSubMenuAt(int index, + int command_id, + const CefString& label) =0; + + /// + // Removes the item with the specified |command_id|. Returns true on success. + /// + /*--cef()--*/ + virtual bool Remove(int command_id) =0; + + /// + // Removes the item at the specified |index|. Returns true on success. + /// + /*--cef()--*/ + virtual bool RemoveAt(int index) =0; + + /// + // Returns the index associated with the specified |command_id| or -1 if not + // found due to the command id not existing in the menu. + /// + /*--cef()--*/ + virtual int GetIndexOf(int command_id) =0; + + /// + // Returns the command id at the specified |index| or -1 if not found due to + // invalid range or the index being a separator. + /// + /*--cef()--*/ + virtual int GetCommandIdAt(int index) =0; + + /// + // Sets the command id at the specified |index|. Returns true on success. + /// + /*--cef()--*/ + virtual bool SetCommandIdAt(int index, int command_id) =0; + + /// + // Returns the label for the specified |command_id| or empty if not found. + /// + /*--cef()--*/ + virtual CefString GetLabel(int command_id) =0; + + /// + // Returns the label at the specified |index| or empty if not found due to + // invalid range or the index being a separator. + /// + /*--cef()--*/ + virtual CefString GetLabelAt(int index) =0; + + /// + // Sets the label for the specified |command_id|. Returns true on success. + /// + /*--cef()--*/ + virtual bool SetLabel(int command_id, const CefString& label) =0; + + /// + // Set the label at the specified |index|. Returns true on success. + /// + /*--cef()--*/ + virtual bool SetLabelAt(int index, const CefString& label) =0; + + /// + // Returns the item type for the specified |command_id|. + /// + /*--cef(default_retval=MENUITEMTYPE_NONE)--*/ + virtual MenuItemType GetType(int command_id) =0; + + /// + // Returns the item type at the specified |index|. + /// + /*--cef(default_retval=MENUITEMTYPE_NONE)--*/ + virtual MenuItemType GetTypeAt(int index) =0; + + /// + // Returns the group id for the specified |command_id| or -1 if invalid. + /// + /*--cef()--*/ + virtual int GetGroupId(int command_id) =0; + + /// + // Returns the group id at the specified |index| or -1 if invalid. + /// + /*--cef()--*/ + virtual int GetGroupIdAt(int index) =0; + + /// + // Sets the group id for the specified |command_id|. Returns true on success. + /// + /*--cef()--*/ + virtual bool SetGroupId(int command_id, int group_id) =0; + + /// + // Sets the group id at the specified |index|. Returns true on success. + /// + /*--cef()--*/ + virtual bool SetGroupIdAt(int index, int group_id) =0; + + /// + // Returns the submenu for the specified |command_id| or empty if invalid. + /// + /*--cef()--*/ + virtual CefRefPtr GetSubMenu(int command_id) =0; + + /// + // Returns the submenu at the specified |index| or empty if invalid. + /// + /*--cef()--*/ + virtual CefRefPtr GetSubMenuAt(int index) =0; + + // + // Returns true if the specified |command_id| is visible. + /// + /*--cef()--*/ + virtual bool IsVisible(int command_id) =0; + + // + // Returns true if the specified |index| is visible. + /// + /*--cef()--*/ + virtual bool IsVisibleAt(int index) =0; + + // + // Change the visibility of the specified |command_id|. Returns true on + // success. + /// + /*--cef()--*/ + virtual bool SetVisible(int command_id, bool visible) =0; + + // + // Change the visibility at the specified |index|. Returns true on success. + /// + /*--cef()--*/ + virtual bool SetVisibleAt(int index, bool visible) =0; + + // + // Returns true if the specified |command_id| is enabled. + /// + /*--cef()--*/ + virtual bool IsEnabled(int command_id) =0; + + // + // Returns true if the specified |index| is enabled. + /// + /*--cef()--*/ + virtual bool IsEnabledAt(int index) =0; + + // + // Change the enabled status of the specified |command_id|. Returns true on + // success. + /// + /*--cef()--*/ + virtual bool SetEnabled(int command_id, bool enabled) =0; + + // + // Change the enabled status at the specified |index|. Returns true on + // success. + /// + /*--cef()--*/ + virtual bool SetEnabledAt(int index, bool enabled) =0; + + // + // Returns true if the specified |command_id| is checked. Only applies to + // check and radio items. + /// + /*--cef()--*/ + virtual bool IsChecked(int command_id) =0; + + // + // Returns true if the specified |index| is checked. Only applies to check + // and radio items. + /// + /*--cef()--*/ + virtual bool IsCheckedAt(int index) =0; + + // + // Check the specified |command_id|. Only applies to check and radio items. + // Returns true on success. + /// + /*--cef()--*/ + virtual bool SetChecked(int command_id, bool checked) =0; + + // + // Check the specified |index|. Only applies to check and radio items. Returns + // true on success. + /// + /*--cef()--*/ + virtual bool SetCheckedAt(int index, bool checked) =0; + + // + // Returns true if the specified |command_id| has a keyboard accelerator + // assigned. + /// + /*--cef()--*/ + virtual bool HasAccelerator(int command_id) =0; + + // + // Returns true if the specified |index| has a keyboard accelerator assigned. + /// + /*--cef()--*/ + virtual bool HasAcceleratorAt(int index) =0; + + // + // Set the keyboard accelerator for the specified |command_id|. |key_code| can + // be any virtual key or character value. Returns true on success. + /// + /*--cef()--*/ + virtual bool SetAccelerator(int command_id, + int key_code, + bool shift_pressed, + bool ctrl_pressed, + bool alt_pressed) =0; + + // + // Set the keyboard accelerator at the specified |index|. |key_code| can be + // any virtual key or character value. Returns true on success. + /// + /*--cef()--*/ + virtual bool SetAcceleratorAt(int index, + int key_code, + bool shift_pressed, + bool ctrl_pressed, + bool alt_pressed) =0; + + // + // Remove the keyboard accelerator for the specified |command_id|. Returns + // true on success. + /// + /*--cef()--*/ + virtual bool RemoveAccelerator(int command_id) =0; + + // + // Remove the keyboard accelerator at the specified |index|. Returns true on + // success. + /// + /*--cef()--*/ + virtual bool RemoveAcceleratorAt(int index) =0; + + // + // Retrieves the keyboard accelerator for the specified |command_id|. Returns + // true on success. + /// + /*--cef()--*/ + virtual bool GetAccelerator(int command_id, + int& key_code, + bool& shift_pressed, + bool& ctrl_pressed, + bool& alt_pressed) =0; + + // + // Retrieves the keyboard accelerator for the specified |index|. Returns true + // on success. + /// + /*--cef()--*/ + virtual bool GetAcceleratorAt(int index, + int& key_code, + bool& shift_pressed, + bool& ctrl_pressed, + bool& alt_pressed) =0; +}; + +#endif // CEF_INCLUDE_CEF_MENU_MODEL_H_ diff --git a/cef/include/cef_origin_whitelist.h b/include/cef_origin_whitelist.h similarity index 90% rename from cef/include/cef_origin_whitelist.h rename to include/cef_origin_whitelist.h index fce2e805e..163a93b91 100644 --- a/cef/include/cef_origin_whitelist.h +++ b/include/cef_origin_whitelist.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -63,8 +63,11 @@ // the same-origin policy. Scripts hosted underneath the fully qualified // |source_origin| URL (like http://www.example.com) will be allowed access to // all resources hosted on the specified |target_protocol| and |target_domain|. -// If |allow_target_subdomains| is true access will also be allowed to all -// subdomains of the target domain. +// If |target_domain| is non-empty and |allow_target_subdomains| if false only +// exact domain matches will be allowed. If |target_domain| is non-empty and +// |allow_target_subdomains| is true sub-domain matches will be allowed. If +// |target_domain| is empty and |allow_target_subdomains| if true all domains +// and IP addresses will be allowed. // // This method cannot be used to bypass the restrictions on local or display // isolated schemes. See the comments on CefRegisterCustomScheme for more @@ -73,7 +76,7 @@ // This function may be called on any thread. Returns false if |source_origin| // is invalid or the whitelist cannot be accessed. /// -/*--cef()--*/ +/*--cef(optional_param=target_domain)--*/ bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin, const CefString& target_protocol, const CefString& target_domain, @@ -83,7 +86,7 @@ bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin, // Remove an entry from the cross-origin access whitelist. Returns false if // |source_origin| is invalid or the whitelist cannot be accessed. /// -/*--cef()--*/ +/*--cef(optional_param=target_domain)--*/ bool CefRemoveCrossOriginWhitelistEntry(const CefString& source_origin, const CefString& target_protocol, const CefString& target_domain, diff --git a/include/cef_pack_resources.h b/include/cef_pack_resources.h new file mode 100644 index 000000000..1526ebf12 --- /dev/null +++ b/include/cef_pack_resources.h @@ -0,0 +1,1000 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file is generated by the make_pack_header.py tool. +// + +#ifndef CEF_INCLUDE_CEF_PACK_RESOURCES_H_ +#define CEF_INCLUDE_CEF_PACK_RESOURCES_H_ +#pragma once + +// --------------------------------------------------------------------------- +// From cef_resources.h: + +#define IDR_CEF_DEVTOOLS_DISCOVERY_PAGE 26000 + +// --------------------------------------------------------------------------- +// From content_resources.h: + +#define IDR_DOM_AUTOMATION_JS 24500 +#define IDR_GPU_SANDBOX_PROFILE 24501 +#define IDR_WORKER_SANDBOX_PROFILE 24502 +#define IDR_COMMON_SANDBOX_PROFILE 24503 +#define IDR_PPAPI_SANDBOX_PROFILE 24504 +#define IDR_RENDERER_SANDBOX_PROFILE 24505 +#define IDR_UTILITY_SANDBOX_PROFILE 24506 + +// --------------------------------------------------------------------------- +// From devtools_resources.h: + +#define DEVTOOLS_HTML 20500 +#define DEVTOOLS_JS 20501 +#define HEAPSNAPSHOTWORKER_JS 20502 +#define SCRIPTFORMATTERWORKER_JS 20503 +#define DEVTOOLS_CSS 20504 +#define DEVTOOLS_EXTENSION_API_JS 20505 +#define AUDITSPANEL_CSS 20506 +#define DATAGRID_CSS 20507 +#define ELEMENTSPANEL_CSS 20508 +#define FILTEREDITEMSELECTIONDIALOG_CSS 20509 +#define HEAPPROFILER_CSS 20510 +#define HELPSCREEN_CSS 20511 +#define INDEXEDDBVIEWS_CSS 20512 +#define INSPECTORCOMMON_CSS 20513 +#define NATIVEMEMORYPROFILER_CSS 20514 +#define NAVIGATORVIEW_CSS 20515 +#define NETWORKLOGVIEW_CSS 20516 +#define NETWORKPANEL_CSS 20517 +#define PANELENABLERVIEW_CSS 20518 +#define PROFILESPANEL_CSS 20519 +#define RESOURCEVIEW_CSS 20520 +#define RESOURCESPANEL_CSS 20521 +#define REVISIONHISTORY_CSS 20522 +#define SCRIPTSPANEL_CSS 20523 +#define SPLITVIEW_CSS 20524 +#define TABBEDPANE_CSS 20525 +#define TEXTPROMPT_CSS 20526 +#define TEXTVIEWER_CSS 20527 +#define TIMELINEPANEL_CSS 20528 +#define IMAGES_APPLICATIONCACHE_PNG 20529 +#define IMAGES_BACK_PNG 20530 +#define IMAGES_BREAKPOINTBORDER_PNG 20531 +#define IMAGES_BREAKPOINTCONDITIONALBORDER_PNG 20532 +#define IMAGES_BREAKPOINTCONDITIONALCOUNTERBORDER_PNG 20533 +#define IMAGES_BREAKPOINTCOUNTERBORDER_PNG 20534 +#define IMAGES_CHECKER_PNG 20535 +#define IMAGES_CLOSEBUTTONS_PNG 20536 +#define IMAGES_COOKIE_PNG 20537 +#define IMAGES_DATABASE_PNG 20538 +#define IMAGES_DATABASETABLE_PNG 20539 +#define IMAGES_DEBUGGERCONTINUE_PNG 20540 +#define IMAGES_DEBUGGERPAUSE_PNG 20541 +#define IMAGES_DEBUGGERSTEPINTO_PNG 20542 +#define IMAGES_DEBUGGERSTEPOUT_PNG 20543 +#define IMAGES_DEBUGGERSTEPOVER_PNG 20544 +#define IMAGES_DELETEICON_PNG 20545 +#define IMAGES_DISCLOSURETRIANGLESMALLDOWN_PNG 20546 +#define IMAGES_DISCLOSURETRIANGLESMALLDOWNBLACK_PNG 20547 +#define IMAGES_DISCLOSURETRIANGLESMALLDOWNWHITE_PNG 20548 +#define IMAGES_DISCLOSURETRIANGLESMALLRIGHT_PNG 20549 +#define IMAGES_DISCLOSURETRIANGLESMALLRIGHTBLACK_PNG 20550 +#define IMAGES_DISCLOSURETRIANGLESMALLRIGHTDOWN_PNG 20551 +#define IMAGES_DISCLOSURETRIANGLESMALLRIGHTDOWNBLACK_PNG 20552 +#define IMAGES_DISCLOSURETRIANGLESMALLRIGHTDOWNWHITE_PNG 20553 +#define IMAGES_DISCLOSURETRIANGLESMALLRIGHTWHITE_PNG 20554 +#define IMAGES_DOMAIN_PNG 20555 +#define IMAGES_ERRORICON_PNG 20556 +#define IMAGES_ERRORMEDIUMICON_PNG 20557 +#define IMAGES_ERRORREDDOT_PNG 20558 +#define IMAGES_FILESYSTEM_PNG 20559 +#define IMAGES_FORWARD_PNG 20560 +#define IMAGES_FRAME_PNG 20561 +#define IMAGES_GLOSSYHEADER_PNG 20562 +#define IMAGES_GLOSSYHEADERPRESSED_PNG 20563 +#define IMAGES_GLOSSYHEADERSELECTED_PNG 20564 +#define IMAGES_GLOSSYHEADERSELECTEDPRESSED_PNG 20565 +#define IMAGES_GOARROW_PNG 20566 +#define IMAGES_GRAPHLABELCALLOUTLEFT_PNG 20567 +#define IMAGES_GRAPHLABELCALLOUTRIGHT_PNG 20568 +#define IMAGES_INDEXEDDB_PNG 20569 +#define IMAGES_INDEXEDDBINDEX_PNG 20570 +#define IMAGES_INDEXEDDBOBJECTSTORE_PNG 20571 +#define IMAGES_LOCALSTORAGE_PNG 20572 +#define IMAGES_NAVIGATORSHOWHIDEBUTTON_PNG 20573 +#define IMAGES_PANEADDBUTTONS_PNG 20574 +#define IMAGES_PANEBOTTOMGROW_PNG 20575 +#define IMAGES_PANEBOTTOMGROWACTIVE_PNG 20576 +#define IMAGES_PANEELEMENTSTATEBUTTONS_PNG 20577 +#define IMAGES_PANEFILTERBUTTONS_PNG 20578 +#define IMAGES_PANEGROWHANDLELINE_PNG 20579 +#define IMAGES_PANEREFRESHBUTTONS_PNG 20580 +#define IMAGES_PANESETTINGSBUTTONS_PNG 20581 +#define IMAGES_POPOVERARROWS_PNG 20582 +#define IMAGES_POPOVERBACKGROUND_PNG 20583 +#define IMAGES_PROFILEGROUPICON_PNG 20584 +#define IMAGES_PROFILEICON_PNG 20585 +#define IMAGES_PROFILESMALLICON_PNG 20586 +#define IMAGES_PROFILESSILHOUETTE_PNG 20587 +#define IMAGES_PROGRAMCOUNTERBORDER_PNG 20588 +#define IMAGES_RADIODOT_PNG 20589 +#define IMAGES_RESOURCECSSICON_PNG 20590 +#define IMAGES_RESOURCEDOCUMENTICON_PNG 20591 +#define IMAGES_RESOURCEDOCUMENTICONSMALL_PNG 20592 +#define IMAGES_RESOURCEJSICON_PNG 20593 +#define IMAGES_RESOURCEPLAINICON_PNG 20594 +#define IMAGES_RESOURCEPLAINICONSMALL_PNG 20595 +#define IMAGES_RESOURCESSIZEGRAPHICON_PNG 20596 +#define IMAGES_RESOURCESTIMEGRAPHICON_PNG 20597 +#define IMAGES_SCRIPTSSILHOUETTE_PNG 20598 +#define IMAGES_SEARCHNEXT_PNG 20599 +#define IMAGES_SEARCHPREV_PNG 20600 +#define IMAGES_SEARCHSMALLBLUE_PNG 20601 +#define IMAGES_SEARCHSMALLBRIGHTBLUE_PNG 20602 +#define IMAGES_SEARCHSMALLGRAY_PNG 20603 +#define IMAGES_SEARCHSMALLWHITE_PNG 20604 +#define IMAGES_SEGMENT_PNG 20605 +#define IMAGES_SEGMENTEND_PNG 20606 +#define IMAGES_SEGMENTHOVER_PNG 20607 +#define IMAGES_SEGMENTHOVEREND_PNG 20608 +#define IMAGES_SEGMENTSELECTED_PNG 20609 +#define IMAGES_SEGMENTSELECTEDEND_PNG 20610 +#define IMAGES_SESSIONSTORAGE_PNG 20611 +#define IMAGES_SPINNER_GIF 20612 +#define IMAGES_SPINNERACTIVE_GIF 20613 +#define IMAGES_SPINNERACTIVESELECTED_GIF 20614 +#define IMAGES_SPINNERINACTIVE_GIF 20615 +#define IMAGES_SPINNERINACTIVESELECTED_GIF 20616 +#define IMAGES_SPLITVIEWDIMPLE_PNG 20617 +#define IMAGES_SPLITVIEWDIVIDERBACKGROUND_PNG 20618 +#define IMAGES_STATUSBARBACKGROUND_PNG 20619 +#define IMAGES_STATUSBARBOTTOMBACKGROUND_PNG 20620 +#define IMAGES_STATUSBARBUTTONGLYPHS_PNG 20621 +#define IMAGES_STATUSBARBUTTONS_PNG 20622 +#define IMAGES_STATUSBARMENUBUTTON_PNG 20623 +#define IMAGES_STATUSBARMENUBUTTONSELECTED_PNG 20624 +#define IMAGES_STATUSBARRESIZERHORIZONTAL_PNG 20625 +#define IMAGES_STATUSBARRESIZERVERTICAL_PNG 20626 +#define IMAGES_SUCCESSGREENDOT_PNG 20627 +#define IMAGES_THUMBACTIVEHORIZ_PNG 20628 +#define IMAGES_THUMBACTIVEVERT_PNG 20629 +#define IMAGES_THUMBHORIZ_PNG 20630 +#define IMAGES_THUMBHOVERHORIZ_PNG 20631 +#define IMAGES_THUMBHOVERVERT_PNG 20632 +#define IMAGES_THUMBVERT_PNG 20633 +#define IMAGES_TICKMARK_PNG 20634 +#define IMAGES_TIMELINEHOLLOWPILLBLUE_PNG 20635 +#define IMAGES_TIMELINEHOLLOWPILLGRAY_PNG 20636 +#define IMAGES_TIMELINEHOLLOWPILLGREEN_PNG 20637 +#define IMAGES_TIMELINEHOLLOWPILLORANGE_PNG 20638 +#define IMAGES_TIMELINEHOLLOWPILLPURPLE_PNG 20639 +#define IMAGES_TIMELINEHOLLOWPILLRED_PNG 20640 +#define IMAGES_TIMELINEHOLLOWPILLYELLOW_PNG 20641 +#define IMAGES_TIMELINEPILLBLUE_PNG 20642 +#define IMAGES_TIMELINEPILLGRAY_PNG 20643 +#define IMAGES_TIMELINEPILLGREEN_PNG 20644 +#define IMAGES_TIMELINEPILLORANGE_PNG 20645 +#define IMAGES_TIMELINEPILLPURPLE_PNG 20646 +#define IMAGES_TIMELINEPILLRED_PNG 20647 +#define IMAGES_TIMELINEPILLYELLOW_PNG 20648 +#define IMAGES_TOOLBARICONS_PNG 20649 +#define IMAGES_TOOLBARICONSSMALL_PNG 20650 +#define IMAGES_TOOLBARITEMSELECTED_PNG 20651 +#define IMAGES_TRACKHORIZ_PNG 20652 +#define IMAGES_TRACKVERT_PNG 20653 +#define IMAGES_TREEDOWNTRIANGLEBLACK_PNG 20654 +#define IMAGES_TREEDOWNTRIANGLEWHITE_PNG 20655 +#define IMAGES_TREERIGHTTRIANGLEBLACK_PNG 20656 +#define IMAGES_TREERIGHTTRIANGLEWHITE_PNG 20657 +#define IMAGES_TREEUPTRIANGLEBLACK_PNG 20658 +#define IMAGES_TREEUPTRIANGLEWHITE_PNG 20659 +#define IMAGES_USERINPUTICON_PNG 20660 +#define IMAGES_USERINPUTPREVIOUSICON_PNG 20661 +#define IMAGES_USERINPUTRESULTICON_PNG 20662 +#define IMAGES_WARNINGICON_PNG 20663 +#define IMAGES_WARNINGMEDIUMICON_PNG 20664 +#define IMAGES_WARNINGORANGEDOT_PNG 20665 +#define IMAGES_WARNINGSERRORS_PNG 20666 +#define IMAGES_SEGMENTCHROMIUM_PNG 20667 +#define IMAGES_SEGMENTHOVERCHROMIUM_PNG 20668 +#define IMAGES_SEGMENTHOVERENDCHROMIUM_PNG 20669 +#define IMAGES_SEGMENTSELECTEDCHROMIUM_PNG 20670 +#define IMAGES_SEGMENTSELECTEDENDCHROMIUM_PNG 20671 +#define IMAGES_STATUSBARBACKGROUNDCHROMIUM_PNG 20672 +#define IMAGES_STATUSBARBOTTOMBACKGROUNDCHROMIUM_PNG 20673 +#define IMAGES_STATUSBARBUTTONSCHROMIUM_PNG 20674 +#define IMAGES_STATUSBARMENUBUTTONCHROMIUM_PNG 20675 +#define IMAGES_STATUSBARMENUBUTTONSELECTEDCHROMIUM_PNG 20676 + +// --------------------------------------------------------------------------- +// From net_resources.h: + +#define IDR_DIR_HEADER_HTML 4000 + +// --------------------------------------------------------------------------- +// From ui_resources.h: + +#define IDR_APP_TOP_CENTER 5500 +#define IDR_BROWSER_ACTION_BADGE_CENTER 5501 +#define IDR_BROWSER_ACTION_BADGE_LEFT 5502 +#define IDR_BROWSER_ACTION_BADGE_RIGHT 5503 +#define IDR_CHECKMARK 5504 +#define IDR_CLOSE 5505 +#define IDR_CLOSE_H 5506 +#define IDR_CLOSE_P 5507 +#define IDR_CONTENT_BOTTOM_CENTER 5511 +#define IDR_CONTENT_BOTTOM_LEFT_CORNER 5512 +#define IDR_CONTENT_BOTTOM_RIGHT_CORNER 5513 +#define IDR_CONTENT_LEFT_SIDE 5514 +#define IDR_CONTENT_RIGHT_SIDE 5515 +#define IDR_DEFAULT_FAVICON 5516 +#define IDR_DEFAULT_LARGE_FAVICON 5517 +#define IDR_FOLDER_CLOSED 5518 +#define IDR_FOLDER_CLOSED_RTL 5519 +#define IDR_FOLDER_OPEN 5520 +#define IDR_FOLDER_OPEN_RTL 5521 +#define IDR_FRAME 5522 +#define IDR_FRAME_APP_PANEL 5523 +#define IDR_FRAME_INACTIVE 5524 +#define IDR_MAXIMIZE 5525 +#define IDR_MAXIMIZE_H 5526 +#define IDR_MAXIMIZE_P 5527 +#define IDR_MENU_DROPARROW 5531 +#define IDR_MENU_DROPARROW_SHARP 5532 +#define IDR_MINIMIZE 5533 +#define IDR_MINIMIZE_H 5534 +#define IDR_MINIMIZE_P 5535 +#define IDR_RESTORE 5539 +#define IDR_RESTORE_H 5540 +#define IDR_RESTORE_P 5541 +#define IDR_TEXTBUTTON_HOVER_BOTTOM 5545 +#define IDR_TEXTBUTTON_HOVER_BOTTOM_LEFT 5546 +#define IDR_TEXTBUTTON_PRESSED_BOTTOM_LEFT 5547 +#define IDR_TEXTBUTTON_PRESSED_BOTTOM 5548 +#define IDR_TEXTBUTTON_HOVER_BOTTOM_RIGHT 5549 +#define IDR_TEXTBUTTON_PRESSED_BOTTOM_RIGHT 5550 +#define IDR_TEXTBUTTON_HOVER_CENTER 5551 +#define IDR_TEXTBUTTON_PRESSED_CENTER 5552 +#define IDR_TEXTBUTTON_HOVER_LEFT 5553 +#define IDR_TEXTBUTTON_PRESSED_LEFT 5554 +#define IDR_TEXTBUTTON_HOVER_RIGHT 5555 +#define IDR_TEXTBUTTON_PRESSED_RIGHT 5556 +#define IDR_TEXTBUTTON_HOVER_TOP 5557 +#define IDR_TEXTBUTTON_HOVER_TOP_LEFT 5558 +#define IDR_TEXTBUTTON_PRESSED_TOP_LEFT 5559 +#define IDR_TEXTBUTTON_PRESSED_TOP 5560 +#define IDR_TEXTBUTTON_HOVER_TOP_RIGHT 5561 +#define IDR_TEXTBUTTON_PRESSED_TOP_RIGHT 5562 +#define IDR_WINDOW_BOTTOM_CENTER 5581 +#define IDR_WINDOW_BOTTOM_LEFT_CORNER 5582 +#define IDR_WINDOW_BOTTOM_RIGHT_CORNER 5583 +#define IDR_WINDOW_LEFT_SIDE 5584 +#define IDR_WINDOW_RIGHT_SIDE 5585 +#define IDR_WINDOW_TOP_CENTER 5586 +#define IDR_WINDOW_TOP_LEFT_CORNER 5587 +#define IDR_WINDOW_TOP_RIGHT_CORNER 5588 +#define IDR_PANEL_BOTTOM_LEFT_CORNER 5589 +#define IDR_PANEL_BOTTOM_RIGHT_CORNER 5590 +#define IDR_APP_TOP_LEFT 5591 +#define IDR_APP_TOP_RIGHT 5592 +#define IDR_CLOSE_SA 5593 +#define IDR_CLOSE_SA_H 5594 +#define IDR_CLOSE_SA_P 5595 +#define IDR_DISCLOSURE_ARROW 5596 +#define IDR_MENU_ARROW 5597 +#define IDR_MENU_CHECK 5598 +#define IDR_AURA_LAUNCHER_BROWSER_SHORTCUT 5599 +#define IDR_AURA_LAUNCHER_BROWSER 5600 +#define IDR_AURA_LAUNCHER_BROWSER_PANEL 5601 +#define IDR_AURA_LAUNCHER_ICON_APPLIST 5602 +#define IDR_AURA_LAUNCHER_ICON_APPLIST_HOT 5603 +#define IDR_AURA_LAUNCHER_ICON_APPLIST_PUSHED 5604 +#define IDR_AURA_LAUNCHER_INCOGNITO_BROWSER 5605 +#define IDR_AURA_LAUNCHER_INCOGNITO_BROWSER_PANEL 5606 +#define IDR_AURA_LAUNCHER_NEW_BROWSER 5607 +#define IDR_AURA_LAUNCHER_NEW_BROWSER_HOT 5608 +#define IDR_AURA_LAUNCHER_NEW_BROWSER_PUSHED 5609 +#define IDR_AURA_LAUNCHER_OVERFLOW 5610 +#define IDR_AURA_LAUNCHER_OVERFLOW_HOT 5611 +#define IDR_AURA_LAUNCHER_OVERFLOW_PUSHED 5612 +#define IDR_AURA_LAUNCHER_UNDERLINE_ACTIVE 5613 +#define IDR_AURA_LAUNCHER_UNDERLINE_HOVER 5614 +#define IDR_AURA_LAUNCHER_UNDERLINE_RUNNING 5615 +#define IDR_AURA_LAUNCHER_UNDERLINE_VERTICAL_ACTIVE 5616 +#define IDR_AURA_LAUNCHER_UNDERLINE_VERTICAL_HOVER 5617 +#define IDR_AURA_LAUNCHER_UNDERLINE_VERTICAL_RUNNING 5618 +#define IDR_AURA_MULTI_WINDOW_RESIZE_H 5619 +#define IDR_AURA_MULTI_WINDOW_RESIZE_V 5620 +#define IDR_AURA_RESIZE_SHADOW_TOP_LEFT 5621 +#define IDR_AURA_RESIZE_SHADOW_TOP 5622 +#define IDR_AURA_RESIZE_SHADOW_TOP_RIGHT 5623 +#define IDR_AURA_RESIZE_SHADOW_LEFT 5624 +#define IDR_AURA_RESIZE_SHADOW_RIGHT 5625 +#define IDR_AURA_RESIZE_SHADOW_BOTTOM_LEFT 5626 +#define IDR_AURA_RESIZE_SHADOW_BOTTOM 5627 +#define IDR_AURA_RESIZE_SHADOW_BOTTOM_RIGHT 5628 +#define IDR_AURA_SHADOW_ACTIVE_TOP_LEFT 5629 +#define IDR_AURA_SHADOW_ACTIVE_TOP 5630 +#define IDR_AURA_SHADOW_ACTIVE_TOP_RIGHT 5631 +#define IDR_AURA_SHADOW_ACTIVE_LEFT 5632 +#define IDR_AURA_SHADOW_ACTIVE_RIGHT 5633 +#define IDR_AURA_SHADOW_ACTIVE_BOTTOM_LEFT 5634 +#define IDR_AURA_SHADOW_ACTIVE_BOTTOM 5635 +#define IDR_AURA_SHADOW_ACTIVE_BOTTOM_RIGHT 5636 +#define IDR_AURA_SHADOW_INACTIVE_TOP_LEFT 5637 +#define IDR_AURA_SHADOW_INACTIVE_TOP 5638 +#define IDR_AURA_SHADOW_INACTIVE_TOP_RIGHT 5639 +#define IDR_AURA_SHADOW_INACTIVE_LEFT 5640 +#define IDR_AURA_SHADOW_INACTIVE_RIGHT 5641 +#define IDR_AURA_SHADOW_INACTIVE_BOTTOM_LEFT 5642 +#define IDR_AURA_SHADOW_INACTIVE_BOTTOM 5643 +#define IDR_AURA_SHADOW_INACTIVE_BOTTOM_RIGHT 5644 +#define IDR_AURA_SHADOW_SMALL_TOP_LEFT 5645 +#define IDR_AURA_SHADOW_SMALL_TOP 5646 +#define IDR_AURA_SHADOW_SMALL_TOP_RIGHT 5647 +#define IDR_AURA_SHADOW_SMALL_LEFT 5648 +#define IDR_AURA_SHADOW_SMALL_RIGHT 5649 +#define IDR_AURA_SHADOW_SMALL_BOTTOM_LEFT 5650 +#define IDR_AURA_SHADOW_SMALL_BOTTOM 5651 +#define IDR_AURA_SHADOW_SMALL_BOTTOM_RIGHT 5652 +#define IDR_AURA_STATUS_MOCK 5653 +#define IDR_AURA_WALLPAPERS_ROMAINGUY_0 5654 +#define IDR_AURA_WALLPAPERS_ROMAINGUY_0_THUMB 5655 +#define IDR_AURA_WALLPAPERS_1_NATURE0 5656 +#define IDR_AURA_WALLPAPERS_1_NATURE0_THUMB 5657 +#define IDR_AURA_WALLPAPERS_1_NATURE1 5658 +#define IDR_AURA_WALLPAPERS_1_NATURE1_THUMB 5659 +#define IDR_AURA_WALLPAPERS_1_NATURE2 5660 +#define IDR_AURA_WALLPAPERS_1_NATURE2_THUMB 5661 +#define IDR_AURA_WALLPAPERS_1_NATURE3 5662 +#define IDR_AURA_WALLPAPERS_1_NATURE3_THUMB 5663 +#define IDR_AURA_WALLPAPERS_1_NATURE4 5664 +#define IDR_AURA_WALLPAPERS_1_NATURE4_THUMB 5665 +#define IDR_AURA_WALLPAPERS_1_NATURE5 5666 +#define IDR_AURA_WALLPAPERS_1_NATURE5_THUMB 5667 +#define IDR_AURA_WALLPAPERS_1_NATURE6 5668 +#define IDR_AURA_WALLPAPERS_1_NATURE6_THUMB 5669 +#define IDR_AURA_WALLPAPERS_1_NATURE7 5670 +#define IDR_AURA_WALLPAPERS_1_NATURE7_THUMB 5671 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE0 5672 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE0_THUMB 5673 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE1 5674 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE1_THUMB 5675 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE2 5676 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE2_THUMB 5677 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE3 5678 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE3_THUMB 5679 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE4 5680 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE4_THUMB 5681 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE5 5682 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE5_THUMB 5683 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE6 5684 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE6_THUMB 5685 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE7 5686 +#define IDR_AURA_WALLPAPERS_2_LANDSCAPE7_THUMB 5687 +#define IDR_AURA_WALLPAPERS_3_URBAN0 5688 +#define IDR_AURA_WALLPAPERS_3_URBAN0_THUMB 5689 +#define IDR_AURA_WALLPAPERS_3_URBAN1 5690 +#define IDR_AURA_WALLPAPERS_3_URBAN1_THUMB 5691 +#define IDR_AURA_WALLPAPERS_3_URBAN2 5692 +#define IDR_AURA_WALLPAPERS_3_URBAN2_THUMB 5693 +#define IDR_AURA_WALLPAPERS_3_URBAN3 5694 +#define IDR_AURA_WALLPAPERS_3_URBAN3_THUMB 5695 +#define IDR_AURA_WALLPAPERS_5_GRADIENT0 5696 +#define IDR_AURA_WALLPAPERS_5_GRADIENT0_THUMB 5697 +#define IDR_AURA_WALLPAPERS_5_GRADIENT1 5698 +#define IDR_AURA_WALLPAPERS_5_GRADIENT1_THUMB 5699 +#define IDR_AURA_WALLPAPERS_5_GRADIENT2 5700 +#define IDR_AURA_WALLPAPERS_5_GRADIENT2_THUMB 5701 +#define IDR_AURA_WALLPAPERS_5_GRADIENT3 5702 +#define IDR_AURA_WALLPAPERS_5_GRADIENT3_THUMB 5703 +#define IDR_AURA_WALLPAPERS_5_GRADIENT4 5704 +#define IDR_AURA_WALLPAPERS_5_GRADIENT4_THUMB 5705 +#define IDR_AURA_WALLPAPERS_5_GRADIENT5 5706 +#define IDR_AURA_WALLPAPERS_5_GRADIENT5_THUMB 5707 +#define IDR_AURA_WALLPAPERS_5_GRADIENT6 5708 +#define IDR_AURA_WALLPAPERS_5_GRADIENT6_THUMB 5709 +#define IDR_AURA_WALLPAPERS_5_GRADIENT7 5710 +#define IDR_AURA_WALLPAPERS_5_GRADIENT7_THUMB 5711 +#define IDR_AURA_WINDOW_CLOSE_ICON 5712 +#define IDR_AURA_WINDOW_FULLSCREEN_SHADOW 5713 +#define IDR_AURA_WINDOW_HEADER_BASE_ACTIVE 5714 +#define IDR_AURA_WINDOW_HEADER_BASE_INACTIVE 5715 +#define IDR_AURA_WINDOW_HEADER_BASE_INCOGNITO_ACTIVE 5716 +#define IDR_AURA_WINDOW_HEADER_BASE_INCOGNITO_INACTIVE 5717 +#define IDR_AURA_WINDOW_HEADER_SHADE_BOTTOM 5718 +#define IDR_AURA_WINDOW_HEADER_SHADE_BOTTOM_LEFT 5719 +#define IDR_AURA_WINDOW_HEADER_SHADE_BOTTOM_RIGHT 5720 +#define IDR_AURA_WINDOW_HEADER_SHADE_LEFT 5721 +#define IDR_AURA_WINDOW_HEADER_SHADE_MIDDLE 5722 +#define IDR_AURA_WINDOW_HEADER_SHADE_RIGHT 5723 +#define IDR_AURA_WINDOW_HEADER_SHADE_TOP 5724 +#define IDR_AURA_WINDOW_HEADER_SHADE_TOP_LEFT 5725 +#define IDR_AURA_WINDOW_HEADER_SHADE_TOP_RIGHT 5726 +#define IDR_AURA_WINDOW_ZOOM_ICON 5727 +#define IDR_AURA_SWITCH_MONITOR 5728 +#define IDR_OAK 5729 + +// --------------------------------------------------------------------------- +// From ui_resources_standard.h: + +#define IDR_BUBBLE_B 24000 +#define IDR_BUBBLE_BL 24001 +#define IDR_BUBBLE_BR 24002 +#define IDR_BUBBLE_B_ARROW 24003 +#define IDR_BUBBLE_L 24004 +#define IDR_BUBBLE_L_ARROW 24005 +#define IDR_BUBBLE_R 24006 +#define IDR_BUBBLE_R_ARROW 24007 +#define IDR_BUBBLE_T 24008 +#define IDR_BUBBLE_TL 24009 +#define IDR_BUBBLE_TR 24010 +#define IDR_BUBBLE_T_ARROW 24011 +#define IDR_BUBBLE_SHADOW_B 24012 +#define IDR_BUBBLE_SHADOW_BL 24013 +#define IDR_BUBBLE_SHADOW_BR 24014 +#define IDR_BUBBLE_SHADOW_L 24015 +#define IDR_BUBBLE_SHADOW_R 24016 +#define IDR_BUBBLE_SHADOW_T 24017 +#define IDR_BUBBLE_SHADOW_TL 24018 +#define IDR_BUBBLE_SHADOW_TR 24019 +#define IDR_CLOSE_BAR 24020 +#define IDR_CLOSE_BAR_H 24021 +#define IDR_CLOSE_BAR_MASK 24022 +#define IDR_CLOSE_BAR_P 24023 +#define IDR_THROBBER 24024 +#define IDR_AURA_WINDOW_BUTTON_SEPARATOR 24025 +#define IDR_AURA_WINDOW_CLOSE 24026 +#define IDR_AURA_WINDOW_CLOSE_H 24027 +#define IDR_AURA_WINDOW_CLOSE_P 24028 +#define IDR_AURA_WINDOW_FULLSCREEN_CLOSE 24029 +#define IDR_AURA_WINDOW_FULLSCREEN_CLOSE_H 24030 +#define IDR_AURA_WINDOW_FULLSCREEN_CLOSE_P 24031 +#define IDR_AURA_WINDOW_FULLSCREEN_RESTORE 24032 +#define IDR_AURA_WINDOW_FULLSCREEN_RESTORE_H 24033 +#define IDR_AURA_WINDOW_FULLSCREEN_RESTORE_P 24034 +#define IDR_AURA_WINDOW_FULLSCREEN_SEPARATOR 24035 +#define IDR_AURA_WINDOW_MAXIMIZE 24043 +#define IDR_AURA_WINDOW_MAXIMIZE_H 24044 +#define IDR_AURA_WINDOW_MAXIMIZE_P 24045 +#define IDR_AURA_WINDOW_MAXIMIZED_CLOSE 24046 +#define IDR_AURA_WINDOW_MAXIMIZED_CLOSE_H 24047 +#define IDR_AURA_WINDOW_MAXIMIZED_CLOSE_P 24048 +#define IDR_AURA_WINDOW_MAXIMIZED_MINIMIZE 24052 +#define IDR_AURA_WINDOW_MAXIMIZED_MINIMIZE_H 24053 +#define IDR_AURA_WINDOW_MAXIMIZED_MINIMIZE_P 24054 +#define IDR_AURA_WINDOW_MAXIMIZED_SNAP_LEFT_P 24055 +#define IDR_AURA_WINDOW_MAXIMIZED_SNAP_MINIMIZE_P 24056 +#define IDR_AURA_WINDOW_MAXIMIZED_SNAP_P 24057 +#define IDR_AURA_WINDOW_MAXIMIZED_SNAP_RIGHT_P 24058 +#define IDR_AURA_WINDOW_MAXIMIZED_RESTORE 24059 +#define IDR_AURA_WINDOW_MAXIMIZED_RESTORE_H 24060 +#define IDR_AURA_WINDOW_MAXIMIZED_RESTORE_P 24061 +#define IDR_AURA_WINDOW_SNAP_LEFT_P 24069 +#define IDR_AURA_WINDOW_SNAP_MINIMIZE_P 24070 +#define IDR_AURA_WINDOW_SNAP_P 24071 +#define IDR_AURA_WINDOW_SNAP_RIGHT_P 24072 +#define IDR_AURA_CURSOR_PTR 24073 +#define IDR_AURA_CURSOR_NO_DROP 24074 +#define IDR_AURA_CURSOR_COPY 24075 +#define IDR_AURA_CURSOR_HAND 24076 +#define IDR_AURA_CURSOR_FLEUR 24077 +#define IDR_AURA_CURSOR_IBEAM 24078 +#define IDR_AURA_CURSOR_NORTH_WEST_RESIZE 24079 +#define IDR_AURA_CURSOR_SOUTH_EAST_RESIZE 24080 +#define IDR_AURA_CURSOR_NORTH_EAST_RESIZE 24081 +#define IDR_AURA_CURSOR_SOUTH_WEST_RESIZE 24082 +#define IDR_AURA_CURSOR_NORTH_RESIZE 24083 +#define IDR_AURA_CURSOR_EAST_RESIZE 24084 +#define IDR_AURA_CURSOR_SOUTH_RESIZE 24085 +#define IDR_AURA_CURSOR_WEST_RESIZE 24086 +#define IDR_AURA_CURSOR_ALIAS 24087 +#define IDR_AURA_CURSOR_CELL 24088 +#define IDR_AURA_CURSOR_CONTEXT_MENU 24089 +#define IDR_AURA_CURSOR_CROSSHAIR 24090 +#define IDR_AURA_CURSOR_HELP 24091 +#define IDR_AURA_CURSOR_MOVE 24092 +#define IDR_AURA_CURSOR_XTERM_HORIZ 24093 +#define IDR_AURA_CURSOR_ZOOM_IN 24094 +#define IDR_AURA_CURSOR_ZOOM_OUT 24095 +#define IDR_AURA_CURSOR_ROW_RESIZE 24096 +#define IDR_AURA_CURSOR_COL_RESIZE 24097 +#define IDR_AURA_CURSOR_NORTH_WEST_SOUTH_EAST_RESIZE 24098 +#define IDR_AURA_CURSOR_NORTH_EAST_SOUTH_WEST_RESIZE 24099 +#define IDR_AURA_CURSOR_NORTH_SOUTH_RESIZE 24100 +#define IDR_AURA_CURSOR_EAST_WEST_RESIZE 24101 +#define IDR_AURA_UBER_TRAY_VOLUME_LEVELS 24102 +#define IDR_AURA_UBER_TRAY_VOLUME_MUTE 24103 +#define IDR_AURA_UBER_TRAY_BRIGHTNESS 24104 +#define IDR_AURA_UBER_TRAY_SETTINGS 24105 +#define IDR_AURA_UBER_TRAY_POWER_SMALL 24106 +#define IDR_AURA_UBER_TRAY_POWER_SMALL_DARK 24107 +#define IDR_AURA_UBER_TRAY_NETWORK_AIRPLANE 24108 +#define IDR_AURA_UBER_TRAY_NETWORK_INFO 24109 +#define IDR_AURA_UBER_TRAY_NETWORK_INFO_HOVER 24110 +#define IDR_AURA_UBER_TRAY_NETWORK_FAILED 24111 +#define IDR_AURA_UBER_TRAY_NETWORK_DATA_LOW 24112 +#define IDR_AURA_UBER_TRAY_NETWORK_DATA_NONE 24113 +#define IDR_AURA_UBER_TRAY_SMS 24114 +#define IDR_AURA_UBER_TRAY_MORE 24115 +#define IDR_AURA_UBER_TRAY_LESS 24116 +#define IDR_AURA_UBER_TRAY_ACCESSIBILITY 24117 +#define IDR_AURA_UBER_TRAY_ACCESSIBILITY_DARK 24118 +#define IDR_AURA_UBER_TRAY_CAPS_LOCK 24119 +#define IDR_AURA_UBER_TRAY_CAPS_LOCK_DARK 24120 +#define IDR_AURA_UBER_TRAY_BLUETOOTH 24121 +#define IDR_AURA_UBER_TRAY_DRIVE 24122 +#define IDR_AURA_UBER_TRAY_DRIVE_FAILED 24123 +#define IDR_AURA_UBER_TRAY_DRIVE_DONE 24124 +#define IDR_AURA_UBER_TRAY_DRIVE_CANCEL 24125 +#define IDR_AURA_UBER_TRAY_DRIVE_CANCEL_HOVER 24126 +#define IDR_AURA_UBER_TRAY_DRIVE_LIGHT 24127 +#define IDR_AURA_UBER_TRAY_IME 24128 +#define IDR_AURA_UBER_TRAY_UPDATE 24129 +#define IDR_AURA_UBER_TRAY_UPDATE_DARK 24130 +#define IDR_AURA_UBER_TRAY_WIFI_ENABLED 24131 +#define IDR_AURA_UBER_TRAY_WIFI_ENABLED_HOVER 24132 +#define IDR_AURA_UBER_TRAY_WIFI_DISABLED 24133 +#define IDR_AURA_UBER_TRAY_WIFI_DISABLED_HOVER 24134 +#define IDR_AURA_UBER_TRAY_CELLULAR_ENABLED 24135 +#define IDR_AURA_UBER_TRAY_CELLULAR_ENABLED_HOVER 24136 +#define IDR_AURA_UBER_TRAY_CELLULAR_DISABLED 24137 +#define IDR_AURA_UBER_TRAY_CELLULAR_DISABLED_HOVER 24138 +#define IDR_AURA_UBER_TRAY_BLUETOOTH_ENABLED 24139 +#define IDR_AURA_UBER_TRAY_BLUETOOTH_ENABLED_HOVER 24140 +#define IDR_AURA_UBER_TRAY_BLUETOOTH_DISABLED 24141 +#define IDR_AURA_UBER_TRAY_BLUETOOTH_DISABLED_HOVER 24142 +#define IDR_AURA_UBER_TRAY_SHUTDOWN 24143 +#define IDR_AURA_UBER_TRAY_SHUTDOWN_HOVER 24144 +#define IDR_AURA_UBER_TRAY_LOCKSCREEN 24145 +#define IDR_AURA_UBER_TRAY_LOCKSCREEN_HOVER 24146 +#define IDR_AURA_UBER_TRAY_HELP 24147 +#define IDR_AURA_UBER_TRAY_HELP_HOVER 24148 +#define IDR_AURA_UBER_TRAY_LOCALE 24149 +#define IDR_AURA_UBER_TRAY_WEB_NOTIFICATON 24150 +#define IDR_CHECKBOX_DISABLED_INDETERMINATE 24151 +#define IDR_CHECKBOX_DISABLED_OFF 24152 +#define IDR_CHECKBOX_DISABLED_ON 24153 +#define IDR_CHECKBOX_INDETERMINATE 24154 +#define IDR_CHECKBOX_OFF 24155 +#define IDR_CHECKBOX_ON 24156 +#define IDR_RADIO_DISABLED_OFF 24157 +#define IDR_RADIO_DISABLED_ON 24158 +#define IDR_RADIO_OFF 24159 +#define IDR_RADIO_ON 24160 +#define IDR_PROGRESS_BAR 24161 +#define IDR_PROGRESS_BORDER_LEFT 24162 +#define IDR_PROGRESS_BORDER_RIGHT 24163 +#define IDR_PROGRESS_VALUE 24164 +#define IDR_SCROLL_BASE_CORNER 24179 +#define IDR_SCROLL_BASE_CORNER_H 24180 +#define IDR_SCROLL_BASE_HORIZONTAL_CENTER 24181 +#define IDR_SCROLL_BASE_HORIZONTAL_CENTER_H 24182 +#define IDR_SCROLL_BASE_HORIZONTAL_LEFT 24183 +#define IDR_SCROLL_BASE_HORIZONTAL_LEFT_H 24184 +#define IDR_SCROLL_BASE_HORIZONTAL_RIGHT 24185 +#define IDR_SCROLL_BASE_HORIZONTAL_RIGHT_H 24186 +#define IDR_SCROLL_BASE_VERTICAL_BOTTOM 24187 +#define IDR_SCROLL_BASE_VERTICAL_BOTTOM_H 24188 +#define IDR_SCROLL_BASE_VERTICAL_CENTER 24189 +#define IDR_SCROLL_BASE_VERTICAL_CENTER_H 24190 +#define IDR_SCROLL_BASE_VERTICAL_TOP 24191 +#define IDR_SCROLL_BASE_VERTICAL_TOP_H 24192 +#define IDR_SCROLL_THUMB_HORIZONTAL_CENTER 24193 +#define IDR_SCROLL_THUMB_HORIZONTAL_CENTER_H 24194 +#define IDR_SCROLL_THUMB_HORIZONTAL_CENTER_P 24195 +#define IDR_SCROLL_THUMB_HORIZONTAL_LEFT 24196 +#define IDR_SCROLL_THUMB_HORIZONTAL_LEFT_H 24197 +#define IDR_SCROLL_THUMB_HORIZONTAL_LEFT_P 24198 +#define IDR_SCROLL_THUMB_HORIZONTAL_RIGHT 24199 +#define IDR_SCROLL_THUMB_HORIZONTAL_RIGHT_H 24200 +#define IDR_SCROLL_THUMB_HORIZONTAL_RIGHT_P 24201 +#define IDR_SCROLL_THUMB_VERTICAL_BOTTOM 24202 +#define IDR_SCROLL_THUMB_VERTICAL_BOTTOM_H 24203 +#define IDR_SCROLL_THUMB_VERTICAL_BOTTOM_P 24204 +#define IDR_SCROLL_THUMB_VERTICAL_CENTER 24205 +#define IDR_SCROLL_THUMB_VERTICAL_CENTER_H 24206 +#define IDR_SCROLL_THUMB_VERTICAL_CENTER_P 24207 +#define IDR_SCROLL_THUMB_VERTICAL_TOP 24208 +#define IDR_SCROLL_THUMB_VERTICAL_TOP_H 24209 +#define IDR_SCROLL_THUMB_VERTICAL_TOP_P 24210 + +// --------------------------------------------------------------------------- +// From webkit_chromium_resources.h: + +#define IDR_AUDIO_SPATIALIZATION_T000_P000 7000 +#define IDR_AUDIO_SPATIALIZATION_T000_P015 7001 +#define IDR_AUDIO_SPATIALIZATION_T000_P030 7002 +#define IDR_AUDIO_SPATIALIZATION_T000_P045 7003 +#define IDR_AUDIO_SPATIALIZATION_T000_P060 7004 +#define IDR_AUDIO_SPATIALIZATION_T000_P075 7005 +#define IDR_AUDIO_SPATIALIZATION_T000_P090 7006 +#define IDR_AUDIO_SPATIALIZATION_T000_P315 7007 +#define IDR_AUDIO_SPATIALIZATION_T000_P330 7008 +#define IDR_AUDIO_SPATIALIZATION_T000_P345 7009 +#define IDR_AUDIO_SPATIALIZATION_T015_P000 7010 +#define IDR_AUDIO_SPATIALIZATION_T015_P015 7011 +#define IDR_AUDIO_SPATIALIZATION_T015_P030 7012 +#define IDR_AUDIO_SPATIALIZATION_T015_P045 7013 +#define IDR_AUDIO_SPATIALIZATION_T015_P060 7014 +#define IDR_AUDIO_SPATIALIZATION_T015_P075 7015 +#define IDR_AUDIO_SPATIALIZATION_T015_P090 7016 +#define IDR_AUDIO_SPATIALIZATION_T015_P315 7017 +#define IDR_AUDIO_SPATIALIZATION_T015_P330 7018 +#define IDR_AUDIO_SPATIALIZATION_T015_P345 7019 +#define IDR_AUDIO_SPATIALIZATION_T030_P000 7020 +#define IDR_AUDIO_SPATIALIZATION_T030_P015 7021 +#define IDR_AUDIO_SPATIALIZATION_T030_P030 7022 +#define IDR_AUDIO_SPATIALIZATION_T030_P045 7023 +#define IDR_AUDIO_SPATIALIZATION_T030_P060 7024 +#define IDR_AUDIO_SPATIALIZATION_T030_P075 7025 +#define IDR_AUDIO_SPATIALIZATION_T030_P090 7026 +#define IDR_AUDIO_SPATIALIZATION_T030_P315 7027 +#define IDR_AUDIO_SPATIALIZATION_T030_P330 7028 +#define IDR_AUDIO_SPATIALIZATION_T030_P345 7029 +#define IDR_AUDIO_SPATIALIZATION_T045_P000 7030 +#define IDR_AUDIO_SPATIALIZATION_T045_P015 7031 +#define IDR_AUDIO_SPATIALIZATION_T045_P030 7032 +#define IDR_AUDIO_SPATIALIZATION_T045_P045 7033 +#define IDR_AUDIO_SPATIALIZATION_T045_P060 7034 +#define IDR_AUDIO_SPATIALIZATION_T045_P075 7035 +#define IDR_AUDIO_SPATIALIZATION_T045_P090 7036 +#define IDR_AUDIO_SPATIALIZATION_T045_P315 7037 +#define IDR_AUDIO_SPATIALIZATION_T045_P330 7038 +#define IDR_AUDIO_SPATIALIZATION_T045_P345 7039 +#define IDR_AUDIO_SPATIALIZATION_T060_P000 7040 +#define IDR_AUDIO_SPATIALIZATION_T060_P015 7041 +#define IDR_AUDIO_SPATIALIZATION_T060_P030 7042 +#define IDR_AUDIO_SPATIALIZATION_T060_P045 7043 +#define IDR_AUDIO_SPATIALIZATION_T060_P060 7044 +#define IDR_AUDIO_SPATIALIZATION_T060_P075 7045 +#define IDR_AUDIO_SPATIALIZATION_T060_P090 7046 +#define IDR_AUDIO_SPATIALIZATION_T060_P315 7047 +#define IDR_AUDIO_SPATIALIZATION_T060_P330 7048 +#define IDR_AUDIO_SPATIALIZATION_T060_P345 7049 +#define IDR_AUDIO_SPATIALIZATION_T075_P000 7050 +#define IDR_AUDIO_SPATIALIZATION_T075_P015 7051 +#define IDR_AUDIO_SPATIALIZATION_T075_P030 7052 +#define IDR_AUDIO_SPATIALIZATION_T075_P045 7053 +#define IDR_AUDIO_SPATIALIZATION_T075_P060 7054 +#define IDR_AUDIO_SPATIALIZATION_T075_P075 7055 +#define IDR_AUDIO_SPATIALIZATION_T075_P090 7056 +#define IDR_AUDIO_SPATIALIZATION_T075_P315 7057 +#define IDR_AUDIO_SPATIALIZATION_T075_P330 7058 +#define IDR_AUDIO_SPATIALIZATION_T075_P345 7059 +#define IDR_AUDIO_SPATIALIZATION_T090_P000 7060 +#define IDR_AUDIO_SPATIALIZATION_T090_P015 7061 +#define IDR_AUDIO_SPATIALIZATION_T090_P030 7062 +#define IDR_AUDIO_SPATIALIZATION_T090_P045 7063 +#define IDR_AUDIO_SPATIALIZATION_T090_P060 7064 +#define IDR_AUDIO_SPATIALIZATION_T090_P075 7065 +#define IDR_AUDIO_SPATIALIZATION_T090_P090 7066 +#define IDR_AUDIO_SPATIALIZATION_T090_P315 7067 +#define IDR_AUDIO_SPATIALIZATION_T090_P330 7068 +#define IDR_AUDIO_SPATIALIZATION_T090_P345 7069 +#define IDR_AUDIO_SPATIALIZATION_T105_P000 7070 +#define IDR_AUDIO_SPATIALIZATION_T105_P015 7071 +#define IDR_AUDIO_SPATIALIZATION_T105_P030 7072 +#define IDR_AUDIO_SPATIALIZATION_T105_P045 7073 +#define IDR_AUDIO_SPATIALIZATION_T105_P060 7074 +#define IDR_AUDIO_SPATIALIZATION_T105_P075 7075 +#define IDR_AUDIO_SPATIALIZATION_T105_P090 7076 +#define IDR_AUDIO_SPATIALIZATION_T105_P315 7077 +#define IDR_AUDIO_SPATIALIZATION_T105_P330 7078 +#define IDR_AUDIO_SPATIALIZATION_T105_P345 7079 +#define IDR_AUDIO_SPATIALIZATION_T120_P000 7080 +#define IDR_AUDIO_SPATIALIZATION_T120_P015 7081 +#define IDR_AUDIO_SPATIALIZATION_T120_P030 7082 +#define IDR_AUDIO_SPATIALIZATION_T120_P045 7083 +#define IDR_AUDIO_SPATIALIZATION_T120_P060 7084 +#define IDR_AUDIO_SPATIALIZATION_T120_P075 7085 +#define IDR_AUDIO_SPATIALIZATION_T120_P090 7086 +#define IDR_AUDIO_SPATIALIZATION_T120_P315 7087 +#define IDR_AUDIO_SPATIALIZATION_T120_P330 7088 +#define IDR_AUDIO_SPATIALIZATION_T120_P345 7089 +#define IDR_AUDIO_SPATIALIZATION_T135_P000 7090 +#define IDR_AUDIO_SPATIALIZATION_T135_P015 7091 +#define IDR_AUDIO_SPATIALIZATION_T135_P030 7092 +#define IDR_AUDIO_SPATIALIZATION_T135_P045 7093 +#define IDR_AUDIO_SPATIALIZATION_T135_P060 7094 +#define IDR_AUDIO_SPATIALIZATION_T135_P075 7095 +#define IDR_AUDIO_SPATIALIZATION_T135_P090 7096 +#define IDR_AUDIO_SPATIALIZATION_T135_P315 7097 +#define IDR_AUDIO_SPATIALIZATION_T135_P330 7098 +#define IDR_AUDIO_SPATIALIZATION_T135_P345 7099 +#define IDR_AUDIO_SPATIALIZATION_T150_P000 7100 +#define IDR_AUDIO_SPATIALIZATION_T150_P015 7101 +#define IDR_AUDIO_SPATIALIZATION_T150_P030 7102 +#define IDR_AUDIO_SPATIALIZATION_T150_P045 7103 +#define IDR_AUDIO_SPATIALIZATION_T150_P060 7104 +#define IDR_AUDIO_SPATIALIZATION_T150_P075 7105 +#define IDR_AUDIO_SPATIALIZATION_T150_P090 7106 +#define IDR_AUDIO_SPATIALIZATION_T150_P315 7107 +#define IDR_AUDIO_SPATIALIZATION_T150_P330 7108 +#define IDR_AUDIO_SPATIALIZATION_T150_P345 7109 +#define IDR_AUDIO_SPATIALIZATION_T165_P000 7110 +#define IDR_AUDIO_SPATIALIZATION_T165_P015 7111 +#define IDR_AUDIO_SPATIALIZATION_T165_P030 7112 +#define IDR_AUDIO_SPATIALIZATION_T165_P045 7113 +#define IDR_AUDIO_SPATIALIZATION_T165_P060 7114 +#define IDR_AUDIO_SPATIALIZATION_T165_P075 7115 +#define IDR_AUDIO_SPATIALIZATION_T165_P090 7116 +#define IDR_AUDIO_SPATIALIZATION_T165_P315 7117 +#define IDR_AUDIO_SPATIALIZATION_T165_P330 7118 +#define IDR_AUDIO_SPATIALIZATION_T165_P345 7119 +#define IDR_AUDIO_SPATIALIZATION_T180_P000 7120 +#define IDR_AUDIO_SPATIALIZATION_T180_P015 7121 +#define IDR_AUDIO_SPATIALIZATION_T180_P030 7122 +#define IDR_AUDIO_SPATIALIZATION_T180_P045 7123 +#define IDR_AUDIO_SPATIALIZATION_T180_P060 7124 +#define IDR_AUDIO_SPATIALIZATION_T180_P075 7125 +#define IDR_AUDIO_SPATIALIZATION_T180_P090 7126 +#define IDR_AUDIO_SPATIALIZATION_T180_P315 7127 +#define IDR_AUDIO_SPATIALIZATION_T180_P330 7128 +#define IDR_AUDIO_SPATIALIZATION_T180_P345 7129 +#define IDR_AUDIO_SPATIALIZATION_T195_P000 7130 +#define IDR_AUDIO_SPATIALIZATION_T195_P015 7131 +#define IDR_AUDIO_SPATIALIZATION_T195_P030 7132 +#define IDR_AUDIO_SPATIALIZATION_T195_P045 7133 +#define IDR_AUDIO_SPATIALIZATION_T195_P060 7134 +#define IDR_AUDIO_SPATIALIZATION_T195_P075 7135 +#define IDR_AUDIO_SPATIALIZATION_T195_P090 7136 +#define IDR_AUDIO_SPATIALIZATION_T195_P315 7137 +#define IDR_AUDIO_SPATIALIZATION_T195_P330 7138 +#define IDR_AUDIO_SPATIALIZATION_T195_P345 7139 +#define IDR_AUDIO_SPATIALIZATION_T210_P000 7140 +#define IDR_AUDIO_SPATIALIZATION_T210_P015 7141 +#define IDR_AUDIO_SPATIALIZATION_T210_P030 7142 +#define IDR_AUDIO_SPATIALIZATION_T210_P045 7143 +#define IDR_AUDIO_SPATIALIZATION_T210_P060 7144 +#define IDR_AUDIO_SPATIALIZATION_T210_P075 7145 +#define IDR_AUDIO_SPATIALIZATION_T210_P090 7146 +#define IDR_AUDIO_SPATIALIZATION_T210_P315 7147 +#define IDR_AUDIO_SPATIALIZATION_T210_P330 7148 +#define IDR_AUDIO_SPATIALIZATION_T210_P345 7149 +#define IDR_AUDIO_SPATIALIZATION_T225_P000 7150 +#define IDR_AUDIO_SPATIALIZATION_T225_P015 7151 +#define IDR_AUDIO_SPATIALIZATION_T225_P030 7152 +#define IDR_AUDIO_SPATIALIZATION_T225_P045 7153 +#define IDR_AUDIO_SPATIALIZATION_T225_P060 7154 +#define IDR_AUDIO_SPATIALIZATION_T225_P075 7155 +#define IDR_AUDIO_SPATIALIZATION_T225_P090 7156 +#define IDR_AUDIO_SPATIALIZATION_T225_P315 7157 +#define IDR_AUDIO_SPATIALIZATION_T225_P330 7158 +#define IDR_AUDIO_SPATIALIZATION_T225_P345 7159 +#define IDR_AUDIO_SPATIALIZATION_T240_P000 7160 +#define IDR_AUDIO_SPATIALIZATION_T240_P015 7161 +#define IDR_AUDIO_SPATIALIZATION_T240_P030 7162 +#define IDR_AUDIO_SPATIALIZATION_T240_P045 7163 +#define IDR_AUDIO_SPATIALIZATION_T240_P060 7164 +#define IDR_AUDIO_SPATIALIZATION_T240_P075 7165 +#define IDR_AUDIO_SPATIALIZATION_T240_P090 7166 +#define IDR_AUDIO_SPATIALIZATION_T240_P315 7167 +#define IDR_AUDIO_SPATIALIZATION_T240_P330 7168 +#define IDR_AUDIO_SPATIALIZATION_T240_P345 7169 +#define IDR_AUDIO_SPATIALIZATION_T255_P000 7170 +#define IDR_AUDIO_SPATIALIZATION_T255_P015 7171 +#define IDR_AUDIO_SPATIALIZATION_T255_P030 7172 +#define IDR_AUDIO_SPATIALIZATION_T255_P045 7173 +#define IDR_AUDIO_SPATIALIZATION_T255_P060 7174 +#define IDR_AUDIO_SPATIALIZATION_T255_P075 7175 +#define IDR_AUDIO_SPATIALIZATION_T255_P090 7176 +#define IDR_AUDIO_SPATIALIZATION_T255_P315 7177 +#define IDR_AUDIO_SPATIALIZATION_T255_P330 7178 +#define IDR_AUDIO_SPATIALIZATION_T255_P345 7179 +#define IDR_AUDIO_SPATIALIZATION_T270_P000 7180 +#define IDR_AUDIO_SPATIALIZATION_T270_P015 7181 +#define IDR_AUDIO_SPATIALIZATION_T270_P030 7182 +#define IDR_AUDIO_SPATIALIZATION_T270_P045 7183 +#define IDR_AUDIO_SPATIALIZATION_T270_P060 7184 +#define IDR_AUDIO_SPATIALIZATION_T270_P075 7185 +#define IDR_AUDIO_SPATIALIZATION_T270_P090 7186 +#define IDR_AUDIO_SPATIALIZATION_T270_P315 7187 +#define IDR_AUDIO_SPATIALIZATION_T270_P330 7188 +#define IDR_AUDIO_SPATIALIZATION_T270_P345 7189 +#define IDR_AUDIO_SPATIALIZATION_T285_P000 7190 +#define IDR_AUDIO_SPATIALIZATION_T285_P015 7191 +#define IDR_AUDIO_SPATIALIZATION_T285_P030 7192 +#define IDR_AUDIO_SPATIALIZATION_T285_P045 7193 +#define IDR_AUDIO_SPATIALIZATION_T285_P060 7194 +#define IDR_AUDIO_SPATIALIZATION_T285_P075 7195 +#define IDR_AUDIO_SPATIALIZATION_T285_P090 7196 +#define IDR_AUDIO_SPATIALIZATION_T285_P315 7197 +#define IDR_AUDIO_SPATIALIZATION_T285_P330 7198 +#define IDR_AUDIO_SPATIALIZATION_T285_P345 7199 +#define IDR_AUDIO_SPATIALIZATION_T300_P000 7200 +#define IDR_AUDIO_SPATIALIZATION_T300_P015 7201 +#define IDR_AUDIO_SPATIALIZATION_T300_P030 7202 +#define IDR_AUDIO_SPATIALIZATION_T300_P045 7203 +#define IDR_AUDIO_SPATIALIZATION_T300_P060 7204 +#define IDR_AUDIO_SPATIALIZATION_T300_P075 7205 +#define IDR_AUDIO_SPATIALIZATION_T300_P090 7206 +#define IDR_AUDIO_SPATIALIZATION_T300_P315 7207 +#define IDR_AUDIO_SPATIALIZATION_T300_P330 7208 +#define IDR_AUDIO_SPATIALIZATION_T300_P345 7209 +#define IDR_AUDIO_SPATIALIZATION_T315_P000 7210 +#define IDR_AUDIO_SPATIALIZATION_T315_P015 7211 +#define IDR_AUDIO_SPATIALIZATION_T315_P030 7212 +#define IDR_AUDIO_SPATIALIZATION_T315_P045 7213 +#define IDR_AUDIO_SPATIALIZATION_T315_P060 7214 +#define IDR_AUDIO_SPATIALIZATION_T315_P075 7215 +#define IDR_AUDIO_SPATIALIZATION_T315_P090 7216 +#define IDR_AUDIO_SPATIALIZATION_T315_P315 7217 +#define IDR_AUDIO_SPATIALIZATION_T315_P330 7218 +#define IDR_AUDIO_SPATIALIZATION_T315_P345 7219 +#define IDR_AUDIO_SPATIALIZATION_T330_P000 7220 +#define IDR_AUDIO_SPATIALIZATION_T330_P015 7221 +#define IDR_AUDIO_SPATIALIZATION_T330_P030 7222 +#define IDR_AUDIO_SPATIALIZATION_T330_P045 7223 +#define IDR_AUDIO_SPATIALIZATION_T330_P060 7224 +#define IDR_AUDIO_SPATIALIZATION_T330_P075 7225 +#define IDR_AUDIO_SPATIALIZATION_T330_P090 7226 +#define IDR_AUDIO_SPATIALIZATION_T330_P315 7227 +#define IDR_AUDIO_SPATIALIZATION_T330_P330 7228 +#define IDR_AUDIO_SPATIALIZATION_T330_P345 7229 +#define IDR_AUDIO_SPATIALIZATION_T345_P000 7230 +#define IDR_AUDIO_SPATIALIZATION_T345_P015 7231 +#define IDR_AUDIO_SPATIALIZATION_T345_P030 7232 +#define IDR_AUDIO_SPATIALIZATION_T345_P045 7233 +#define IDR_AUDIO_SPATIALIZATION_T345_P060 7234 +#define IDR_AUDIO_SPATIALIZATION_T345_P075 7235 +#define IDR_AUDIO_SPATIALIZATION_T345_P090 7236 +#define IDR_AUDIO_SPATIALIZATION_T345_P315 7237 +#define IDR_AUDIO_SPATIALIZATION_T345_P330 7238 +#define IDR_AUDIO_SPATIALIZATION_T345_P345 7239 + +// --------------------------------------------------------------------------- +// From webkit_resources.h: + +#define IDC_ALIAS 4500 +#define IDR_BROKENIMAGE 4501 +#define IDC_CELL 4502 +#define IDC_COLRESIZE 4503 +#define IDC_COPYCUR 4504 +#define IDC_CURSOR_NONE 4505 +#define IDR_INPUT_SPEECH 4506 +#define IDR_INPUT_SPEECH_RECORDING 4507 +#define IDR_INPUT_SPEECH_WAITING 4508 +#define IDR_MEDIA_FULLSCREEN_BUTTON 4509 +#define IDR_MEDIA_PAUSE_BUTTON 4510 +#define IDR_MEDIA_PLAY_BUTTON 4511 +#define IDR_MEDIA_PLAY_BUTTON_DISABLED 4512 +#define IDR_MEDIA_SOUND_DISABLED 4513 +#define IDR_MEDIA_SOUND_FULL_BUTTON 4514 +#define IDR_MEDIA_SOUND_NONE_BUTTON 4515 +#define IDR_MEDIA_SLIDER_THUMB 4516 +#define IDR_MEDIA_VOLUME_SLIDER_THUMB 4517 +#define IDR_MEDIAPLAYER_PAUSE_BUTTON 4518 +#define IDR_MEDIAPLAYER_PAUSE_BUTTON_HOVER 4519 +#define IDR_MEDIAPLAYER_PAUSE_BUTTON_DOWN 4520 +#define IDR_MEDIAPLAYER_PLAY_BUTTON 4521 +#define IDR_MEDIAPLAYER_PLAY_BUTTON_HOVER 4522 +#define IDR_MEDIAPLAYER_PLAY_BUTTON_DOWN 4523 +#define IDR_MEDIAPLAYER_PLAY_BUTTON_DISABLED 4524 +#define IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON 4525 +#define IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON_HOVER 4526 +#define IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON_DOWN 4527 +#define IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON 4528 +#define IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON_HOVER 4529 +#define IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON_DOWN 4530 +#define IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON 4531 +#define IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON_HOVER 4532 +#define IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON_DOWN 4533 +#define IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON 4534 +#define IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON_HOVER 4535 +#define IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON_DOWN 4536 +#define IDR_MEDIAPLAYER_SOUND_DISABLED 4537 +#define IDR_MEDIAPLAYER_SLIDER_THUMB 4538 +#define IDR_MEDIAPLAYER_SLIDER_THUMB_HOVER 4539 +#define IDR_MEDIAPLAYER_SLIDER_THUMB_DOWN 4540 +#define IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB 4541 +#define IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_HOVER 4542 +#define IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_DOWN 4543 +#define IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_DISABLED 4544 +#define IDR_MEDIAPLAYER_FULLSCREEN_BUTTON 4545 +#define IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_HOVER 4546 +#define IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_DOWN 4547 +#define IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_DISABLED 4548 +#define IDR_OVERHANG_PATTERN 4549 +#define IDC_PAN_EAST 4550 +#define IDC_PAN_MIDDLE 4551 +#define IDC_PAN_NORTH 4552 +#define IDC_PAN_NORTH_EAST 4553 +#define IDC_PAN_NORTH_WEST 4554 +#define IDR_PAN_SCROLL_ICON 4555 +#define IDC_PAN_SOUTH 4556 +#define IDC_PAN_SOUTH_EAST 4557 +#define IDC_PAN_SOUTH_WEST 4558 +#define IDC_PAN_WEST 4559 +#define IDC_ROWRESIZE 4560 +#define IDR_SEARCH_CANCEL 4561 +#define IDR_SEARCH_CANCEL_PRESSED 4562 +#define IDR_SEARCH_MAGNIFIER 4563 +#define IDR_SEARCH_MAGNIFIER_RESULTS 4564 +#define IDR_TEXTAREA_RESIZER 4565 +#define IDR_TICKMARK_DASH 4566 +#define IDC_VERTICALTEXT 4567 +#define IDC_ZOOMIN 4568 +#define IDC_ZOOMOUT 4569 +#define IDR_AUTOFILL_CC_AMEX 4570 +#define IDR_AUTOFILL_CC_DINERS 4571 +#define IDR_AUTOFILL_CC_DISCOVER 4572 +#define IDR_AUTOFILL_CC_GENERIC 4573 +#define IDR_AUTOFILL_CC_JCB 4574 +#define IDR_AUTOFILL_CC_MASTERCARD 4575 +#define IDR_AUTOFILL_CC_SOLO 4576 +#define IDR_AUTOFILL_CC_VISA 4577 +#define IDR_PDF_BUTTON_FTP 4578 +#define IDR_PDF_BUTTON_FTP_HOVER 4579 +#define IDR_PDF_BUTTON_FTP_PRESSED 4580 +#define IDR_PDF_BUTTON_FTW 4581 +#define IDR_PDF_BUTTON_FTW_HOVER 4582 +#define IDR_PDF_BUTTON_FTW_PRESSED 4583 +#define IDR_PDF_BUTTON_ZOOMIN_END 4584 +#define IDR_PDF_BUTTON_ZOOMIN_END_HOVER 4585 +#define IDR_PDF_BUTTON_ZOOMIN_END_PRESSED 4586 +#define IDR_PDF_BUTTON_ZOOMIN 4587 +#define IDR_PDF_BUTTON_ZOOMIN_HOVER 4588 +#define IDR_PDF_BUTTON_ZOOMIN_PRESSED 4589 +#define IDR_PDF_BUTTON_ZOOMOUT 4590 +#define IDR_PDF_BUTTON_ZOOMOUT_HOVER 4591 +#define IDR_PDF_BUTTON_ZOOMOUT_PRESSED 4592 +#define IDR_PDF_BUTTON_SAVE 4593 +#define IDR_PDF_BUTTON_SAVE_HOVER 4594 +#define IDR_PDF_BUTTON_SAVE_PRESSED 4595 +#define IDR_PDF_BUTTON_PRINT 4596 +#define IDR_PDF_BUTTON_PRINT_HOVER 4597 +#define IDR_PDF_BUTTON_PRINT_PRESSED 4598 +#define IDR_PDF_THUMBNAIL_0 4599 +#define IDR_PDF_THUMBNAIL_1 4600 +#define IDR_PDF_THUMBNAIL_2 4601 +#define IDR_PDF_THUMBNAIL_3 4602 +#define IDR_PDF_THUMBNAIL_4 4603 +#define IDR_PDF_THUMBNAIL_5 4604 +#define IDR_PDF_THUMBNAIL_6 4605 +#define IDR_PDF_THUMBNAIL_7 4606 +#define IDR_PDF_THUMBNAIL_8 4607 +#define IDR_PDF_THUMBNAIL_9 4608 +#define IDR_PDF_THUMBNAIL_NUM_BACKGROUND 4609 +#define IDR_PDF_PROGRESS_BAR_0 4610 +#define IDR_PDF_PROGRESS_BAR_1 4611 +#define IDR_PDF_PROGRESS_BAR_2 4612 +#define IDR_PDF_PROGRESS_BAR_3 4613 +#define IDR_PDF_PROGRESS_BAR_4 4614 +#define IDR_PDF_PROGRESS_BAR_5 4615 +#define IDR_PDF_PROGRESS_BAR_6 4616 +#define IDR_PDF_PROGRESS_BAR_7 4617 +#define IDR_PDF_PROGRESS_BAR_8 4618 +#define IDR_PDF_PROGRESS_BAR_BACKGROUND 4619 +#define IDR_PDF_PAGE_INDICATOR_BACKGROUND 4620 +#define IDR_PDF_PAGE_DROPSHADOW 4621 +#define IDR_PASSWORD_GENERATION_ICON 4622 + +#endif // CEF_INCLUDE_CEF_PACK_RESOURCES_H_ diff --git a/include/cef_pack_strings.h b/include/cef_pack_strings.h new file mode 100644 index 000000000..872a15e6e --- /dev/null +++ b/include/cef_pack_strings.h @@ -0,0 +1,180 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file is generated by the make_pack_header.py tool. +// + +#ifndef CEF_INCLUDE_CEF_PACK_STRINGS_H_ +#define CEF_INCLUDE_CEF_PACK_STRINGS_H_ +#pragma once + +// --------------------------------------------------------------------------- +// From cef_strings.h: + +#define IDS_MENU_BACK 26500 +#define IDS_MENU_FORWARD 26501 +#define IDS_MENU_RELOAD 26502 +#define IDS_MENU_RELOAD_NOCACHE 26503 +#define IDS_MENU_STOPLOAD 26504 +#define IDS_MENU_UNDO 26505 +#define IDS_MENU_REDO 26506 +#define IDS_MENU_CUT 26507 +#define IDS_MENU_COPY 26508 +#define IDS_MENU_PASTE 26509 +#define IDS_MENU_DELETE 26510 +#define IDS_MENU_SELECT_ALL 26511 +#define IDS_MENU_FIND 26512 +#define IDS_MENU_PRINT 26513 +#define IDS_MENU_VIEW_SOURCE 26514 + +// --------------------------------------------------------------------------- +// From ui_strings.h: + +#define IDS_APP_MENU_EMPTY_SUBMENU 9500 +#define IDS_APP_UNTITLED_SHORTCUT_FILE_NAME 9501 +#define IDS_APP_SAVEAS_ALL_FILES 9502 +#define IDS_APP_SAVEAS_EXTENSION_FORMAT 9503 +#define IDS_APP_ACCACTION_PRESS 9504 +#define IDS_APP_ACCNAME_CLOSE 9505 +#define IDS_APP_ACCNAME_MINIMIZE 9506 +#define IDS_APP_ACCNAME_MAXIMIZE 9507 +#define IDS_APP_ACCNAME_RESTORE 9508 +#define IDS_APP_SCROLLBAR_CXMENU_SCROLLHERE 9509 +#define IDS_APP_SCROLLBAR_CXMENU_SCROLLLEFTEDGE 9510 +#define IDS_APP_SCROLLBAR_CXMENU_SCROLLRIGHTEDGE 9511 +#define IDS_APP_SCROLLBAR_CXMENU_SCROLLHOME 9512 +#define IDS_APP_SCROLLBAR_CXMENU_SCROLLEND 9513 +#define IDS_APP_SCROLLBAR_CXMENU_SCROLLPAGEUP 9514 +#define IDS_APP_SCROLLBAR_CXMENU_SCROLLPAGEDOWN 9515 +#define IDS_APP_SCROLLBAR_CXMENU_SCROLLLEFT 9516 +#define IDS_APP_SCROLLBAR_CXMENU_SCROLLRIGHT 9517 +#define IDS_APP_SCROLLBAR_CXMENU_SCROLLUP 9518 +#define IDS_APP_SCROLLBAR_CXMENU_SCROLLDOWN 9519 +#define IDS_APP_UNDO 9520 +#define IDS_APP_CUT 9521 +#define IDS_APP_COPY 9522 +#define IDS_APP_PASTE 9523 +#define IDS_APP_DELETE 9524 +#define IDS_APP_SELECT_ALL 9525 +#define IDS_APP_OK 9526 +#define IDS_APP_CANCEL 9527 +#define IDS_APP_CLOSE 9528 +#define IDS_APP_ESC_KEY 9529 +#define IDS_APP_TAB_KEY 9530 +#define IDS_APP_INSERT_KEY 9531 +#define IDS_APP_HOME_KEY 9532 +#define IDS_APP_DELETE_KEY 9533 +#define IDS_APP_END_KEY 9534 +#define IDS_APP_PAGEUP_KEY 9535 +#define IDS_APP_PAGEDOWN_KEY 9536 +#define IDS_APP_LEFT_ARROW_KEY 9537 +#define IDS_APP_RIGHT_ARROW_KEY 9538 +#define IDS_APP_RIGHT_UP_KEY 9539 +#define IDS_APP_RIGHT_DOWN_KEY 9540 +#define IDS_APP_ENTER_KEY 9541 +#define IDS_APP_F1_KEY 9542 +#define IDS_APP_F11_KEY 9543 +#define IDS_APP_BACKSPACE_KEY 9544 +#define IDS_APP_CONTROL_MODIFIER 9545 +#define IDS_APP_ALT_MODIFIER 9546 +#define IDS_APP_SHIFT_MODIFIER 9547 +#define IDS_APP_BYTES 9548 +#define IDS_APP_KIBIBYTES 9549 +#define IDS_APP_MEBIBYTES 9550 +#define IDS_APP_GIBIBYTES 9551 +#define IDS_APP_TEBIBYTES 9552 +#define IDS_APP_PEBIBYTES 9553 +#define IDS_APP_BYTES_PER_SECOND 9554 +#define IDS_APP_KIBIBYTES_PER_SECOND 9555 +#define IDS_APP_MEBIBYTES_PER_SECOND 9556 +#define IDS_APP_GIBIBYTES_PER_SECOND 9557 +#define IDS_APP_TEBIBYTES_PER_SECOND 9558 +#define IDS_APP_PEBIBYTES_PER_SECOND 9559 + +// --------------------------------------------------------------------------- +// From webkit_strings.h: + +#define IDS_DETAILS_WITHOUT_SUMMARY_LABEL 16500 +#define IDS_SEARCHABLE_INDEX_INTRO 16501 +#define IDS_FORM_CALENDAR_CLEAR 16502 +#define IDS_FORM_CALENDAR_TODAY 16503 +#define IDS_FORM_DATE_FORMAT_DAY_IN_MONTH 16504 +#define IDS_FORM_DATE_FORMAT_MONTH 16505 +#define IDS_FORM_DATE_FORMAT_YEAR 16506 +#define IDS_FORM_SUBMIT_LABEL 16507 +#define IDS_FORM_INPUT_ALT 16508 +#define IDS_FORM_RESET_LABEL 16509 +#define IDS_FORM_FILE_BUTTON_LABEL 16510 +#define IDS_FORM_MULTIPLE_FILES_BUTTON_LABEL 16511 +#define IDS_FORM_FILE_NO_FILE_LABEL 16512 +#define IDS_FORM_FILE_NO_FILE_DRAG_LABEL 16513 +#define IDS_FORM_FILE_MULTIPLE_UPLOAD 16514 +#define IDS_RECENT_SEARCHES_NONE 16515 +#define IDS_RECENT_SEARCHES 16516 +#define IDS_RECENT_SEARCHES_CLEAR 16517 +#define IDS_IMAGE_TITLE_FOR_FILENAME 16518 +#define IDS_AX_ROLE_WEB_AREA 16519 +#define IDS_AX_ROLE_LINK 16520 +#define IDS_AX_ROLE_LIST_MARKER 16521 +#define IDS_AX_ROLE_IMAGE_MAP 16522 +#define IDS_AX_ROLE_HEADING 16523 +#define IDS_AX_ROLE_FOOTER 16524 +#define IDS_AX_BUTTON_ACTION_VERB 16525 +#define IDS_AX_RADIO_BUTTON_ACTION_VERB 16526 +#define IDS_AX_TEXT_FIELD_ACTION_VERB 16527 +#define IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB 16528 +#define IDS_AX_UNCHECKED_CHECK_BOX_ACTION_VERB 16529 +#define IDS_AX_LINK_ACTION_VERB 16530 +#define IDS_KEYGEN_HIGH_GRADE_KEY 16531 +#define IDS_KEYGEN_MED_GRADE_KEY 16532 +#define IDS_FORM_VALIDATION_VALUE_MISSING_MULTIPLE_FILE 16533 +#define IDS_FORM_VALIDATION_TYPE_MISMATCH 16534 +#define IDS_FORM_VALIDATION_TYPE_MISMATCH_MULTIPLE_EMAIL 16535 +#define IDS_FORM_VALIDATION_RANGE_UNDERFLOW 16536 +#define IDS_FORM_VALIDATION_RANGE_OVERFLOW 16537 +#define IDS_FORM_VALIDATION_STEP_MISMATCH 16538 +#define IDS_FORM_VALIDATION_VALUE_MISSING 16539 +#define IDS_FORM_VALIDATION_VALUE_MISSING_CHECKBOX 16540 +#define IDS_FORM_VALIDATION_VALUE_MISSING_FILE 16541 +#define IDS_FORM_VALIDATION_VALUE_MISSING_RADIO 16542 +#define IDS_FORM_VALIDATION_VALUE_MISSING_SELECT 16543 +#define IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL 16544 +#define IDS_FORM_VALIDATION_TYPE_MISMATCH_URL 16545 +#define IDS_FORM_VALIDATION_PATTERN_MISMATCH 16546 +#define IDS_FORM_VALIDATION_TOO_LONG 16547 +#define IDS_PDF_NEED_PASSWORD 16548 +#define IDS_PDF_PAGE_LOADING 16549 +#define IDS_PDF_LOADING_PROGRESS 16550 +#define IDS_PDF_PAGE_LOAD_FAILED 16551 +#define IDS_PDF_PROGRESS_LOADING 16552 +#define IDS_PLUGIN_INITIALIZATION_ERROR 16553 + +#endif // CEF_INCLUDE_CEF_PACK_STRINGS_H_ diff --git a/include/cef_path_util.h b/include/cef_path_util.h new file mode 100644 index 000000000..552f4ba59 --- /dev/null +++ b/include/cef_path_util.h @@ -0,0 +1,52 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_PATH_UTIL_H_ +#define CEF_INCLUDE_CEF_PATH_UTIL_H_ +#pragma once + +#include "include/cef_base.h" + +typedef cef_path_key_t PathKey; + +/// +// Retrieve the path associated with the specified |key|. Returns true on +// success. Can be called on any thread in the browser process. +/// +/*--cef()--*/ +bool CefGetPath(PathKey key, CefString& path); + +#endif // CEF_INCLUDE_CEF_PATH_UTIL_H_ diff --git a/include/cef_process_message.h b/include/cef_process_message.h new file mode 100644 index 000000000..1e27bd681 --- /dev/null +++ b/include/cef_process_message.h @@ -0,0 +1,91 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_MESSAGE_H_ +#define CEF_INCLUDE_CEF_MESSAGE_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_values.h" + +typedef cef_process_id_t CefProcessId; + +/// +// Class representing a message. Can be used on any process and thread. +/// +/*--cef(source=library)--*/ +class CefProcessMessage : public virtual CefBase { + public: + /// + // Create a new CefProcessMessage object with the specified name. + /// + /*--cef()--*/ + static CefRefPtr Create(const CefString& name); + + /// + // Returns true if this object is valid. Do not call any other methods if this + // function returns false. + /// + /*--cef()--*/ + virtual bool IsValid() =0; + + /// + // Returns true if the values of this object are read-only. Some APIs may + // expose read-only objects. + /// + /*--cef()--*/ + virtual bool IsReadOnly() =0; + + /// + // Returns a writable copy of this object. + /// + /*--cef()--*/ + virtual CefRefPtr Copy() =0; + + /// + // Returns the message name. + /// + /*--cef()--*/ + virtual CefString GetName() =0; + + /// + // Returns the list of arguments. + /// + /*--cef()--*/ + virtual CefRefPtr GetArgumentList() =0; +}; + +#endif // CEF_INCLUDE_CEF_MESSAGE_H_ diff --git a/include/cef_process_util.h b/include/cef_process_util.h new file mode 100644 index 000000000..4fce778e7 --- /dev/null +++ b/include/cef_process_util.h @@ -0,0 +1,57 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_PROCESS_UTIL_H_ +#define CEF_INCLUDE_CEF_PROCESS_UTIL_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_command_line.h" + +/// +// Launches the process specified via |command_line|. Returns true upon +// success. Must be called on the browser process TID_PROCESS_LAUNCHER thread. +// +// Unix-specific notes: +// - All file descriptors open in the parent process will be closed in the +// child process except for stdin, stdout, and stderr. +// - If the first argument on the command line does not contain a slash, +// PATH will be searched. (See man execvp.) +/// +/*--cef()--*/ +bool CefLaunchProcess(CefRefPtr command_line); + +#endif // CEF_INCLUDE_CEF_PROCESS_UTIL_H_ diff --git a/cef/include/cef_proxy_handler.h b/include/cef_proxy_handler.h similarity index 100% rename from cef/include/cef_proxy_handler.h rename to include/cef_proxy_handler.h diff --git a/include/cef_render_process_handler.h b/include/cef_render_process_handler.h new file mode 100644 index 000000000..f81fc2dee --- /dev/null +++ b/include/cef_render_process_handler.h @@ -0,0 +1,124 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_RENDER_PROCESS_HANDLER_H_ +#define CEF_INCLUDE_CEF_RENDER_PROCESS_HANDLER_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_browser.h" +#include "include/cef_dom.h" +#include "include/cef_frame.h" +#include "include/cef_process_message.h" +#include "include/cef_v8.h" + +/// +// Class used to implement render process callbacks. The methods of this class +// will always be called on the render process main thread. +/// +/*--cef(source=client)--*/ +class CefRenderProcessHandler : public virtual CefBase { + public: + /// + // Called after the render process main thread has been created. + /// + /*--cef()--*/ + virtual void OnRenderThreadCreated() {} + + /// + // Called after WebKit has been initialized. + /// + /*--cef()--*/ + virtual void OnWebKitInitialized() {} + + /// + // Called after a browser has been created. + /// + /*--cef()--*/ + virtual void OnBrowserCreated(CefRefPtr browser) {} + + /// + // Called before a browser is destroyed. + /// + /*--cef()--*/ + virtual void OnBrowserDestroyed(CefRefPtr browser) {} + + /// + // Called immediately after the V8 context for a frame has been created. To + // retrieve the JavaScript 'window' object use the CefV8Context::GetGlobal() + // method. + /// + /*--cef()--*/ + virtual void OnContextCreated(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) {} + + /// + // Called immediately before the V8 context for a frame is released. No + // references to the context should be kept after this method is called. + /// + /*--cef()--*/ + virtual void OnContextReleased(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) {} + + /// + // Called when a new node in the the browser gets focus. The |node| value may + // be empty if no specific node has gained focus. The node object passed to + // this method represents a snapshot of the DOM at the time this method is + // executed. DOM objects are only valid for the scope of this method. Do not + // keep references to or attempt to access any DOM objects outside the scope + // of this method. + /// + /*--cef(optional_param=frame,optional_param=node)--*/ + virtual void OnFocusedNodeChanged(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr node) {} + + /// + // Called when a new message is received from a different process. Return true + // if the message was handled or false otherwise. Do not keep a reference to + // or attempt to access the message outside of this callback. + /// + /*--cef()--*/ + virtual bool OnProcessMessageReceived(CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) { + return false; + } +}; + +#endif // CEF_INCLUDE_CEF_RENDER_PROCESS_HANDLER_H_ diff --git a/cef/include/cef_request.h b/include/cef_request.h similarity index 85% rename from cef/include/cef_request.h rename to include/cef_request.h index 95ade79b1..7ac4cb027 100644 --- a/cef/include/cef_request.h +++ b/include/cef_request.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -49,23 +49,29 @@ class CefPostDataElement; // Class used to represent a web request. The methods of this class may be // called on any thread. /// -/*--cef(source=library)--*/ +/*--cef(source=library,no_debugct_check)--*/ class CefRequest : public virtual CefBase { public: typedef std::multimap HeaderMap; - typedef cef_weburlrequest_flags_t RequestFlags; /// // Create a new CefRequest object. /// /*--cef()--*/ - static CefRefPtr CreateRequest(); + static CefRefPtr Create(); + + /// + // Returns true if this object is read-only. + /// + /*--cef()--*/ + virtual bool IsReadOnly() =0; /// // Get the fully qualified URL. /// /*--cef()--*/ virtual CefString GetURL() =0; + /// // Set the fully qualified URL. /// @@ -78,6 +84,7 @@ class CefRequest : public virtual CefBase { /// /*--cef()--*/ virtual CefString GetMethod() =0; + /// // Set the request method type. /// @@ -89,6 +96,7 @@ class CefRequest : public virtual CefBase { /// /*--cef()--*/ virtual CefRefPtr GetPostData() =0; + /// // Set the post data. /// @@ -100,6 +108,7 @@ class CefRequest : public virtual CefBase { /// /*--cef()--*/ virtual void GetHeaderMap(HeaderMap& headerMap) =0; + /// // Set the header values. /// @@ -116,25 +125,29 @@ class CefRequest : public virtual CefBase { const HeaderMap& headerMap) =0; /// - // Get the flags used in combination with CefWebURLRequest. + // Get the flags used in combination with CefURLRequest. See + // cef_urlrequest_flags_t for supported values. /// - /*--cef(default_retval=WUR_FLAG_NONE)--*/ - virtual RequestFlags GetFlags() =0; + /*--cef(default_retval=UR_FLAG_NONE)--*/ + virtual int GetFlags() =0; + /// - // Set the flags used in combination with CefWebURLRequest. + // Set the flags used in combination with CefURLRequest. See + // cef_urlrequest_flags_t for supported values. /// /*--cef()--*/ - virtual void SetFlags(RequestFlags flags) =0; + virtual void SetFlags(int flags) =0; /// // Set the URL to the first party for cookies used in combination with - // CefWebURLRequest. + // CefURLRequest. /// /*--cef()--*/ virtual CefString GetFirstPartyForCookies() =0; + /// // Get the URL to the first party for cookies used in combination with - // CefWebURLRequest. + // CefURLRequest. /// /*--cef()--*/ virtual void SetFirstPartyForCookies(const CefString& url) =0; @@ -145,7 +158,7 @@ class CefRequest : public virtual CefBase { // Class used to represent post data for a web request. The methods of this // class may be called on any thread. /// -/*--cef(source=library)--*/ +/*--cef(source=library,no_debugct_check)--*/ class CefPostData : public virtual CefBase { public: typedef std::vector > ElementVector; @@ -154,7 +167,13 @@ class CefPostData : public virtual CefBase { // Create a new CefPostData object. /// /*--cef()--*/ - static CefRefPtr CreatePostData(); + static CefRefPtr Create(); + + /// + // Returns true if this object is read-only. + /// + /*--cef()--*/ + virtual bool IsReadOnly() =0; /// // Returns the number of existing post data elements. @@ -193,7 +212,7 @@ class CefPostData : public virtual CefBase { // Class used to represent a single element in the request post data. The // methods of this class may be called on any thread. /// -/*--cef(source=library)--*/ +/*--cef(source=library,no_debugct_check)--*/ class CefPostDataElement : public virtual CefBase { public: /// @@ -205,7 +224,13 @@ class CefPostDataElement : public virtual CefBase { // Create a new CefPostDataElement object. /// /*--cef()--*/ - static CefRefPtr CreatePostDataElement(); + static CefRefPtr Create(); + + /// + // Returns true if this object is read-only. + /// + /*--cef()--*/ + virtual bool IsReadOnly() =0; /// // Remove all contents from the post data element. diff --git a/include/cef_request_handler.h b/include/cef_request_handler.h new file mode 100644 index 000000000..3576e94de --- /dev/null +++ b/include/cef_request_handler.h @@ -0,0 +1,158 @@ +// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_REQUEST_HANDLER_H_ +#define CEF_INCLUDE_CEF_REQUEST_HANDLER_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_browser.h" +#include "include/cef_cookie.h" +#include "include/cef_frame.h" +#include "include/cef_resource_handler.h" +#include "include/cef_response.h" +#include "include/cef_request.h" + +/// +// Callback interface used for asynchronous continuation of authentication +// requests. +/// +/*--cef(source=library)--*/ +class CefAuthCallback : public virtual CefBase { + public: + /// + // Continue the authentication request. + /// + /*--cef(capi_name=cont)--*/ + virtual void Continue(const CefString& username, + const CefString& password) =0; + + /// + // Cancel the authentication request. + /// + /*--cef()--*/ + virtual void Cancel() =0; +}; + + +/// +// Implement this interface to handle events related to browser requests. The +// methods of this class will be called on the thread indicated. +/// +/*--cef(source=client)--*/ +class CefRequestHandler : public virtual CefBase { + public: + /// + // Called on the IO thread before a resource request is loaded. The |request| + // object may be modified. To cancel the request return true otherwise return + // false. + /// + /*--cef()--*/ + virtual bool OnBeforeResourceLoad(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request) { + return false; + } + + /// + // Called on the IO thread before a resource is loaded. To allow the resource + // to load normally return NULL. To specify a handler for the resource return + // a CefResourceHandler object. The |request| object should not be modified in + // this callback. + /// + /*--cef()--*/ + virtual CefRefPtr GetResourceHandler( + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request) { + return NULL; + } + + /// + // Called on the IO thread when a resource load is redirected. The |old_url| + // parameter will contain the old URL. The |new_url| parameter will contain + // the new URL and can be changed if desired. + /// + /*--cef()--*/ + virtual void OnResourceRedirect(CefRefPtr browser, + CefRefPtr frame, + const CefString& old_url, + CefString& new_url) {} + + /// + // Called on the IO thread when the browser needs credentials from the user. + // |isProxy| indicates whether the host is a proxy server. |host| contains the + // hostname and |port| contains the port number. Return true to continue the + // request and call CefAuthCallback::Complete() when the authentication + // information is available. Return false to cancel the request. + /// + /*--cef(optional_param=realm)--*/ + virtual bool GetAuthCredentials(CefRefPtr browser, + CefRefPtr frame, + bool isProxy, + const CefString& host, + int port, + const CefString& realm, + const CefString& scheme, + CefRefPtr callback) { + return false; + } + + /// + // Called on the IO thread to retrieve the cookie manager. |main_url| is the + // URL of the top-level frame. Cookies managers can be unique per browser or + // shared across multiple browsers. The global cookie manager will be used if + // this method returns NULL. + /// + /*--cef()--*/ + virtual CefRefPtr GetCookieManager( + CefRefPtr browser, + const CefString& main_url) { return NULL; } + + /// + // Called on the UI thread to handle requests for URLs with an unknown + // protocol component. Set |allow_os_execution| to true to attempt execution + // via the registered OS protocol handler, if any. + // SECURITY WARNING: YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED + // ON SCHEME, HOST OR OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION. + /// + /*--cef()--*/ + virtual void OnProtocolExecution(CefRefPtr browser, + const CefString& url, + bool& allow_os_execution) {} +}; + +#endif // CEF_INCLUDE_CEF_REQUEST_HANDLER_H_ diff --git a/cef/include/cef_resource_bundle_handler.h b/include/cef_resource_bundle_handler.h similarity index 84% rename from cef/include/cef_resource_bundle_handler.h rename to include/cef_resource_bundle_handler.h index e7a37d1b5..2cd39a5eb 100644 --- a/cef/include/cef_resource_bundle_handler.h +++ b/include/cef_resource_bundle_handler.h @@ -51,11 +51,7 @@ class CefResourceBundleHandler : public virtual CefBase { // Called to retrieve a localized translation for the string specified by // |message_id|. To provide the translation set |string| to the translation // string and return true. To use the default translation return false. - // - // WARNING: Be cautious when implementing this method. ID values are auto- - // generated when CEF is built and may change between versions. Existing ID - // values can be discovered by searching for *_strings.h in the - // "obj/global_intermediate" build output directory. + // Supported message IDs are listed in cef_pack_strings.h. /// /*--cef()--*/ virtual bool GetLocalizedString(int message_id, @@ -66,12 +62,7 @@ class CefResourceBundleHandler : public virtual CefBase { // provide the resource data set |data| and |data_size| to the data pointer // and size respectively and return true. To use the default resource data // return false. The resource data will not be copied and must remain resident - // in memory. - // - // WARNING: Be cautious when implementing this method. ID values are auto- - // generated when CEF is built and may change between versions. Existing ID - // values can be discovered by searching for *_resources.h in the - // "obj/global_intermediate" build output directory. + // in memory. Supported resource IDs are listed in cef_pack_resources.h. /// /*--cef()--*/ virtual bool GetDataResource(int resource_id, diff --git a/include/cef_resource_handler.h b/include/cef_resource_handler.h new file mode 100644 index 000000000..57c8b7fc0 --- /dev/null +++ b/include/cef_resource_handler.h @@ -0,0 +1,116 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_RESOURCE_HANDLER_H_ +#define CEF_INCLUDE_CEF_RESOURCE_HANDLER_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_browser.h" +#include "include/cef_callback.h" +#include "include/cef_cookie.h" +#include "include/cef_request.h" +#include "include/cef_response.h" + +/// +// Class used to implement a custom request handler interface. The methods of +// this class will always be called on the IO thread. +/// +/*--cef(source=client)--*/ +class CefResourceHandler : public virtual CefBase { + public: + /// + // Begin processing the request. To handle the request return true and call + // CefCallback::Continue() once the response header information is available + // (CefCallback::Continue() can also be called from inside this method if + // header information is available immediately). To cancel the request return + // false. + /// + /*--cef()--*/ + virtual bool ProcessRequest(CefRefPtr request, + CefRefPtr callback) =0; + + /// + // Retrieve response header information. If the response length is not known + // set |response_length| to -1 and ReadResponse() will be called until it + // returns false. If the response length is known set |response_length| + // to a positive value and ReadResponse() will be called until it returns + // false or the specified number of bytes have been read. Use the |response| + // object to set the mime type, http status code and other optional header + // values. To redirect the request to a new URL set |redirectUrl| to the new + // URL. + /// + /*--cef()--*/ + virtual void GetResponseHeaders(CefRefPtr response, + int64& response_length, + CefString& redirectUrl) =0; + + /// + // Read response data. If data is available immediately copy up to + // |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of + // bytes copied, and return true. To read the data at a later time set + // |bytes_read| to 0, return true and call CefCallback::Continue() when the + // data is available. To indicate response completion return false. + /// + /*--cef()--*/ + virtual bool ReadResponse(void* data_out, + int bytes_to_read, + int& bytes_read, + CefRefPtr callback) =0; + + /// + // Return true if the specified cookie can be sent with the request or false + // otherwise. If false is returned for any cookie then no cookies will be sent + // with the request. + /// + /*--cef()--*/ + virtual bool CanGetCookie(const CefCookie& cookie) { return true; } + + /// + // Return true if the specified cookie returned with the response can be set + // or false otherwise. + /// + /*--cef()--*/ + virtual bool CanSetCookie(const CefCookie& cookie) { return true; } + + /// + // Request processing has been canceled. + /// + /*--cef()--*/ + virtual void Cancel() =0; +}; + +#endif // CEF_INCLUDE_CEF_RESOURCE_HANDLER_H_ diff --git a/cef/include/cef_response.h b/include/cef_response.h similarity index 90% rename from cef/include/cef_response.h rename to include/cef_response.h index 5448cd71c..32fbef1b0 100644 --- a/cef/include/cef_response.h +++ b/include/cef_response.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -45,16 +45,29 @@ // Class used to represent a web response. The methods of this class may be // called on any thread. /// -/*--cef(source=library)--*/ +/*--cef(source=library,no_debugct_check)--*/ class CefResponse : public virtual CefBase { public: typedef std::multimap HeaderMap; + /// + // Create a new CefResponse object. + /// + /*--cef()--*/ + static CefRefPtr Create(); + + /// + // Returns true if this object is read-only. + /// + /*--cef()--*/ + virtual bool IsReadOnly() =0; + /// // Get the response status code. /// /*--cef()--*/ virtual int GetStatus() =0; + /// // Set the response status code. /// @@ -66,6 +79,7 @@ class CefResponse : public virtual CefBase { /// /*--cef()--*/ virtual CefString GetStatusText() =0; + /// // Set the response status text. /// @@ -77,6 +91,7 @@ class CefResponse : public virtual CefBase { /// /*--cef()--*/ virtual CefString GetMimeType() = 0; + /// // Set the response mime type. /// @@ -94,6 +109,7 @@ class CefResponse : public virtual CefBase { /// /*--cef()--*/ virtual void GetHeaderMap(HeaderMap& headerMap) =0; + /// // Set all response header fields. /// diff --git a/cef/include/cef_runnable.h b/include/cef_runnable.h similarity index 99% rename from cef/include/cef_runnable.h rename to include/cef_runnable.h index 826ddaa46..7002d431b 100644 --- a/cef/include/cef_runnable.h +++ b/include/cef_runnable.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. Portions Copyright (c) +// Copyright (c) 2012 Marshall A. Greenblatt. Portions Copyright (c) // 2006-2011 Google Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without diff --git a/include/cef_scheme.h b/include/cef_scheme.h new file mode 100644 index 000000000..58eae5f69 --- /dev/null +++ b/include/cef_scheme.h @@ -0,0 +1,159 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_SCHEME_H_ +#define CEF_INCLUDE_CEF_SCHEME_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "include/cef_request.h" +#include "include/cef_response.h" +#include "include/cef_resource_handler.h" + +class CefSchemeHandlerFactory; + + +/// +// Register a scheme handler factory for the specified |scheme_name| and +// optional |domain_name|. An empty |domain_name| value for a standard scheme +// will cause the factory to match all domain names. The |domain_name| value +// will be ignored for non-standard schemes. If |scheme_name| is a built-in +// scheme and no handler is returned by |factory| then the built-in scheme +// handler factory will be called. If |scheme_name| is a custom scheme the +// CefRegisterCustomScheme() function should be called for that scheme. +// This function may be called multiple times to change or remove the factory +// that matches the specified |scheme_name| and optional |domain_name|. +// Returns false if an error occurs. This function may be called on any thread. +/// +/*--cef(optional_param=domain_name,optional_param=factory)--*/ +bool CefRegisterSchemeHandlerFactory( + const CefString& scheme_name, + const CefString& domain_name, + CefRefPtr factory); + +/// +// Clear all registered scheme handler factories. Returns false on error. This +// function may be called on any thread. +/// +/*--cef()--*/ +bool CefClearSchemeHandlerFactories(); + + +/// +// Class that manages custom scheme registrations. +/// +/*--cef(source=library)--*/ +class CefSchemeRegistrar : public virtual CefBase { + public: + /// + // Register a custom scheme. This method should not be called for the built-in + // HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes. + // + // If |is_standard| is true the scheme will be treated as a standard scheme. + // Standard schemes are subject to URL canonicalization and parsing rules as + // defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1 available + // at http://www.ietf.org/rfc/rfc1738.txt + // + // In particular, the syntax for standard scheme URLs must be of the form: + //
    +  //  [scheme]://[username]:[password]@[host]:[port]/[url-path]
    +  // 
    + // Standard scheme URLs must have a host component that is a fully qualified + // domain name as defined in Section 3.5 of RFC 1034 [13] and Section 2.1 of + // RFC 1123. These URLs will be canonicalized to "scheme://host/path" in the + // simplest case and "scheme://username:password@host:port/path" in the most + // explicit case. For example, "scheme:host/path" and "scheme:///host/path" + // will both be canonicalized to "scheme://host/path". The origin of a + // standard scheme URL is the combination of scheme, host and port (i.e., + // "scheme://host:port" in the most explicit case). + // + // For non-standard scheme URLs only the "scheme:" component is parsed and + // canonicalized. The remainder of the URL will be passed to the handler + // as-is. For example, "scheme:///some%20text" will remain the same. + // Non-standard scheme URLs cannot be used as a target for form submission. + // + // If |is_local| is true the scheme will be treated as local (i.e., with the + // same security rules as those applied to "file" URLs). Normal pages cannot + // link to or access local URLs. Also, by default, local URLs can only perform + // XMLHttpRequest calls to the same URL (origin + path) that originated the + // request. To allow XMLHttpRequest calls from a local URL to other URLs with + // the same origin set the CefSettings.file_access_from_file_urls_allowed + // value to true. To allow XMLHttpRequest calls from a local URL to all + // origins set the CefSettings.universal_access_from_file_urls_allowed value + // to true. + // + // If |is_display_isolated| is true the scheme will be treated as display- + // isolated. This means that pages cannot display these URLs unless they are + // from the same scheme. For example, pages in another origin cannot create + // iframes or hyperlinks to URLs with this scheme. + // + // This function may be called on any thread. It should only be called once + // per unique |scheme_name| value. If |scheme_name| is already registered or + // if an error occurs this method will return false. + /// + /*--cef()--*/ + virtual bool AddCustomScheme(const CefString& scheme_name, + bool is_standard, + bool is_local, + bool is_display_isolated) =0; +}; + + +/// +// Class that creates CefResourceHandler instances for handling scheme requests. +// The methods of this class will always be called on the IO thread. +/// +/*--cef(source=client)--*/ +class CefSchemeHandlerFactory : public virtual CefBase { + public: + /// + // Return a new resource handler instance to handle the request. |browser| + // and |frame| will be the browser window and frame respectively that + // originated the request or NULL if the request did not originate from a + // browser window (for example, if the request came from CefURLRequest). The + // |request| object passed to this method will not contain cookie data. + /// + /*--cef(optional_param=browser,optional_param=frame)--*/ + virtual CefRefPtr Create( + CefRefPtr browser, + CefRefPtr frame, + const CefString& scheme_name, + CefRefPtr request) =0; +}; + +#endif // CEF_INCLUDE_CEF_SCHEME_H_ diff --git a/cef/include/cef_stream.h b/include/cef_stream.h similarity index 98% rename from cef/include/cef_stream.h rename to include/cef_stream.h index 8daae1708..6ccec8dec 100644 --- a/cef/include/cef_stream.h +++ b/include/cef_stream.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/cef_string_visitor.h b/include/cef_string_visitor.h new file mode 100644 index 000000000..79c9b1cbc --- /dev/null +++ b/include/cef_string_visitor.h @@ -0,0 +1,55 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_STRING_VISITOR_H_ +#define CEF_INCLUDE_CEF_STRING_VISITOR_H_ + +#include "include/cef_base.h" + +/// +// Implement this interface to receive string values asynchronously. +/// +/*--cef(source=client)--*/ +class CefStringVisitor : public virtual CefBase { + public: + /// + // Method that will be executed. + /// + /*--cef()--*/ + virtual void Visit(const CefString& string) =0; +}; + +#endif // CEF_INCLUDE_CEF_STRING_VISITOR_H_ diff --git a/cef/include/cef_task.h b/include/cef_task.h similarity index 81% rename from cef/include/cef_task.h rename to include/cef_task.h index 86550f6a0..77dd3b991 100644 --- a/cef/include/cef_task.h +++ b/include/cef_task.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -45,27 +45,26 @@ typedef cef_thread_id_t CefThreadId; /// // CEF maintains multiple internal threads that are used for handling different -// types of tasks. The UI thread creates the browser window and is used for all -// interaction with the WebKit rendering engine and V8 JavaScript engine (The -// UI thread will be the same as the main application thread if CefInitialize() -// is called with a CefSettings.multi_threaded_message_loop value of false.) The -// IO thread is used for handling schema and network requests. The FILE thread -// is used for the application cache and other miscellaneous activities. This -// function will return true if called on the specified thread. +// types of tasks in different processes. See the cef_thread_id_t definitions in +// cef_types.h for more information. This function will return true if called on +// the specified thread. It is an error to request a thread from the wrong +// process. /// /*--cef()--*/ bool CefCurrentlyOn(CefThreadId threadId); /// // Post a task for execution on the specified thread. This function may be -// called on any thread. +// called on any thread. It is an error to request a thread from the wrong +// process. /// /*--cef()--*/ bool CefPostTask(CefThreadId threadId, CefRefPtr task); /// // Post a task for delayed execution on the specified thread. This function may -// be called on any thread. +// be called on any thread. It is an error to request a thread from the wrong +// process. /// /*--cef()--*/ bool CefPostDelayedTask(CefThreadId threadId, CefRefPtr task, diff --git a/cef/include/cef_url.h b/include/cef_url.h similarity index 97% rename from cef/include/cef_url.h rename to include/cef_url.h index 6caa1e229..c5cb21aaf 100644 --- a/cef/include/cef_url.h +++ b/include/cef_url.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/include/cef_urlrequest.h b/include/cef_urlrequest.h new file mode 100644 index 000000000..069d2668c --- /dev/null +++ b/include/cef_urlrequest.h @@ -0,0 +1,159 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_URLREQUEST_H_ +#define CEF_INCLUDE_CEF_URLREQUEST_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_request.h" +#include "include/cef_response.h" + +class CefURLRequestClient; + +/// +// Class used to make a URL request. URL requests are not associated with a +// browser instance so no CefClient callbacks will be executed. URL requests +// can be created on any valid CEF thread in either the browser or render +// process. Once created the methods of the URL request object must be accessed +// on the same thread that created it. +/// +/*--cef(source=library)--*/ +class CefURLRequest : public virtual CefBase { + public: + typedef cef_urlrequest_status_t Status; + typedef cef_errorcode_t ErrorCode; + + /// + // Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request + // methods are supported. The |request| object will be marked as read-only + // after calling this method. + /// + /*--cef()--*/ + static CefRefPtr Create( + CefRefPtr request, + CefRefPtr client); + + /// + // Returns the request object used to create this URL request. The returned + // object is read-only and should not be modified. + /// + /*--cef()--*/ + virtual CefRefPtr GetRequest() =0; + + /// + // Returns the client. + /// + /*--cef()--*/ + virtual CefRefPtr GetClient() =0; + + /// + // Returns the request status. + /// + /*--cef(default_retval=UR_UNKNOWN)--*/ + virtual Status GetRequestStatus() =0; + + /// + // Returns the request error if status is UR_CANCELED or UR_FAILED, or 0 + // otherwise. + /// + /*--cef(default_retval=ERR_NONE)--*/ + virtual ErrorCode GetRequestError() =0; + + /// + // Returns the response, or NULL if no response information is available. + // Response information will only be available after the upload has completed. + // The returned object is read-only and should not be modified. + /// + /*--cef()--*/ + virtual CefRefPtr GetResponse() =0; + + /// + // Cancel the request. + /// + /*--cef()--*/ + virtual void Cancel() =0; +}; + +/// +// Interface that should be implemented by the CefURLRequest client. The +// methods of this class will be called on the same thread that created the +// request. +/// +/*--cef(source=client)--*/ +class CefURLRequestClient : public virtual CefBase { + public: + /// + // Notifies the client that the request has completed. Use the + // CefURLRequest::GetRequestStatus method to determine if the request was + // successful or not. + /// + /*--cef()--*/ + virtual void OnRequestComplete(CefRefPtr request) =0; + + /// + // Notifies the client of upload progress. |current| denotes the number of + // bytes sent so far and |total| is the total size of uploading data (or -1 if + // chunked upload is enabled). This method will only be called if the + // UR_FLAG_REPORT_UPLOAD_PROGRESS flag is set on the request. + /// + /*--cef()--*/ + virtual void OnUploadProgress(CefRefPtr request, + uint64 current, + uint64 total) =0; + + /// + // Notifies the client of download progress. |current| denotes the number of + // bytes received up to the call and |total| is the expected total size of the + // response (or -1 if not determined). + /// + /*--cef()--*/ + virtual void OnDownloadProgress(CefRefPtr request, + uint64 current, + uint64 total) =0; + + /// + // Called when some part of the response is read. |data| contains the current + // bytes received since the last call. This method will not be called if the + // UR_FLAG_NO_DOWNLOAD_DATA flag is set on the request. + /// + /*--cef()--*/ + virtual void OnDownloadData(CefRefPtr request, + const void* data, + size_t data_length) =0; +}; + +#endif // CEF_INCLUDE_CEF_URLREQUEST_H_ diff --git a/include/cef_v8.h b/include/cef_v8.h new file mode 100644 index 000000000..b1b0dc7b0 --- /dev/null +++ b/include/cef_v8.h @@ -0,0 +1,742 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + + +#ifndef CEF_INCLUDE_CEF_V8_H_ +#define CEF_INCLUDE_CEF_V8_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include + +class CefV8Exception; +class CefV8Handler; +class CefV8Value; + + +/// +// Register a new V8 extension with the specified JavaScript extension code and +// handler. Functions implemented by the handler are prototyped using the +// keyword 'native'. The calling of a native function is restricted to the scope +// in which the prototype of the native function is defined. This function may +// only be called on the render process main thread. +// +// Example JavaScript extension code: +//
    +//   // create the 'example' global object if it doesn't already exist.
    +//   if (!example)
    +//     example = {};
    +//   // create the 'example.test' global object if it doesn't already exist.
    +//   if (!example.test)
    +//     example.test = {};
    +//   (function() {
    +//     // Define the function 'example.test.myfunction'.
    +//     example.test.myfunction = function() {
    +//       // Call CefV8Handler::Execute() with the function name 'MyFunction'
    +//       // and no arguments.
    +//       native function MyFunction();
    +//       return MyFunction();
    +//     };
    +//     // Define the getter function for parameter 'example.test.myparam'.
    +//     example.test.__defineGetter__('myparam', function() {
    +//       // Call CefV8Handler::Execute() with the function name 'GetMyParam'
    +//       // and no arguments.
    +//       native function GetMyParam();
    +//       return GetMyParam();
    +//     });
    +//     // Define the setter function for parameter 'example.test.myparam'.
    +//     example.test.__defineSetter__('myparam', function(b) {
    +//       // Call CefV8Handler::Execute() with the function name 'SetMyParam'
    +//       // and a single argument.
    +//       native function SetMyParam();
    +//       if(b) SetMyParam(b);
    +//     });
    +//
    +//     // Extension definitions can also contain normal JavaScript variables
    +//     // and functions.
    +//     var myint = 0;
    +//     example.test.increment = function() {
    +//       myint += 1;
    +//       return myint;
    +//     };
    +//   })();
    +// 
    +// Example usage in the page: +//
    +//   // Call the function.
    +//   example.test.myfunction();
    +//   // Set the parameter.
    +//   example.test.myparam = value;
    +//   // Get the parameter.
    +//   value = example.test.myparam;
    +//   // Call another function.
    +//   example.test.increment();
    +// 
    +/// +/*--cef(optional_param=handler)--*/ +bool CefRegisterExtension(const CefString& extension_name, + const CefString& javascript_code, + CefRefPtr handler); + + +/// +// Class that encapsulates a V8 context handle. The methods of this class may +// only be called on the render process main thread. +/// +/*--cef(source=library)--*/ +class CefV8Context : public virtual CefBase { + public: + /// + // Returns the current (top) context object in the V8 context stack. + /// + /*--cef()--*/ + static CefRefPtr GetCurrentContext(); + + /// + // Returns the entered (bottom) context object in the V8 context stack. + /// + /*--cef()--*/ + static CefRefPtr GetEnteredContext(); + + /// + // Returns true if V8 is currently inside a context. + /// + /*--cef()--*/ + static bool InContext(); + + /// + // Returns the browser for this context. + /// + /*--cef()--*/ + virtual CefRefPtr GetBrowser() =0; + + /// + // Returns the frame for this context. + /// + /*--cef()--*/ + virtual CefRefPtr GetFrame() =0; + + /// + // Returns the global object for this context. The context must be entered + // before calling this method. + /// + /*--cef()--*/ + virtual CefRefPtr GetGlobal() =0; + + /// + // Enter this context. A context must be explicitly entered before creating a + // V8 Object, Array, Function or Date asynchronously. Exit() must be called + // the same number of times as Enter() before releasing this context. V8 + // objects belong to the context in which they are created. Returns true if + // the scope was entered successfully. + /// + /*--cef()--*/ + virtual bool Enter() =0; + + /// + // Exit this context. Call this method only after calling Enter(). Returns + // true if the scope was exited successfully. + /// + /*--cef()--*/ + virtual bool Exit() =0; + + /// + // Returns true if this object is pointing to the same handle as |that| + // object. + /// + /*--cef()--*/ + virtual bool IsSame(CefRefPtr that) =0; + + /// + // Evaluates the specified JavaScript code using this context's global object. + // On success |retval| will be set to the return value, if any, and the + // function will return true. On failure |exception| will be set to the + // exception, if any, and the function will return false. + /// + /*--cef()--*/ + virtual bool Eval(const CefString& code, + CefRefPtr& retval, + CefRefPtr& exception) =0; +}; + + +typedef std::vector > CefV8ValueList; + +/// +// Interface that should be implemented to handle V8 function calls. The methods +// of this class will always be called on the render process main thread. +/// +/*--cef(source=client)--*/ +class CefV8Handler : public virtual CefBase { + public: + /// + // Handle execution of the function identified by |name|. |object| is the + // receiver ('this' object) of the function. |arguments| is the list of + // arguments passed to the function. If execution succeeds set |retval| to the + // function return value. If execution fails set |exception| to the exception + // that will be thrown. Return true if execution was handled. + /// + /*--cef()--*/ + virtual bool Execute(const CefString& name, + CefRefPtr object, + const CefV8ValueList& arguments, + CefRefPtr& retval, + CefString& exception) =0; +}; + +/// +// Interface that should be implemented to handle V8 accessor calls. Accessor +// identifiers are registered by calling CefV8Value::SetValue(). The methods +// of this class will always be called on the render process main thread. +/// +/*--cef(source=client)--*/ +class CefV8Accessor : public virtual CefBase { + public: + /// + // Handle retrieval the accessor value identified by |name|. |object| is the + // receiver ('this' object) of the accessor. If retrieval succeeds set + // |retval| to the return value. If retrieval fails set |exception| to the + // exception that will be thrown. Return true if accessor retrieval was + // handled. + /// + /*--cef()--*/ + virtual bool Get(const CefString& name, + const CefRefPtr object, + CefRefPtr& retval, + CefString& exception) =0; + + /// + // Handle assignment of the accessor value identified by |name|. |object| is + // the receiver ('this' object) of the accessor. |value| is the new value + // being assigned to the accessor. If assignment fails set |exception| to the + // exception that will be thrown. Return true if accessor assignment was + // handled. + /// + /*--cef()--*/ + virtual bool Set(const CefString& name, + const CefRefPtr object, + const CefRefPtr value, + CefString& exception) =0; +}; + +/// +// Class representing a V8 exception. +/// +/*--cef(source=library)--*/ +class CefV8Exception : public virtual CefBase { + public: + /// + // Returns the exception message. + /// + /*--cef()--*/ + virtual CefString GetMessage() =0; + + /// + // Returns the line of source code that the exception occurred within. + /// + /*--cef()--*/ + virtual CefString GetSourceLine() =0; + + /// + // Returns the resource name for the script from where the function causing + // the error originates. + /// + /*--cef()--*/ + virtual CefString GetScriptResourceName() =0; + + /// + // Returns the 1-based number of the line where the error occurred or 0 if the + // line number is unknown. + /// + /*--cef()--*/ + virtual int GetLineNumber() =0; + + /// + // Returns the index within the script of the first character where the error + // occurred. + /// + /*--cef()--*/ + virtual int GetStartPosition() =0; + + /// + // Returns the index within the script of the last character where the error + // occurred. + /// + /*--cef()--*/ + virtual int GetEndPosition() =0; + + /// + // Returns the index within the line of the first character where the error + // occurred. + /// + /*--cef()--*/ + virtual int GetStartColumn() =0; + + /// + // Returns the index within the line of the last character where the error + // occurred. + /// + /*--cef()--*/ + virtual int GetEndColumn() =0; +}; + +/// +// Class representing a V8 value. The methods of this class may only be called +// on the render process main thread. +/// +/*--cef(source=library)--*/ +class CefV8Value : public virtual CefBase { + public: + typedef cef_v8_accesscontrol_t AccessControl; + typedef cef_v8_propertyattribute_t PropertyAttribute; + + /// + // Create a new CefV8Value object of type undefined. + /// + /*--cef()--*/ + static CefRefPtr CreateUndefined(); + + /// + // Create a new CefV8Value object of type null. + /// + /*--cef()--*/ + static CefRefPtr CreateNull(); + + /// + // Create a new CefV8Value object of type bool. + /// + /*--cef()--*/ + static CefRefPtr CreateBool(bool value); + + /// + // Create a new CefV8Value object of type int. + /// + /*--cef()--*/ + static CefRefPtr CreateInt(int32 value); + + /// + // Create a new CefV8Value object of type unsigned int. + /// + /*--cef()--*/ + static CefRefPtr CreateUInt(uint32 value); + + /// + // Create a new CefV8Value object of type double. + /// + /*--cef()--*/ + static CefRefPtr CreateDouble(double value); + + /// + // Create a new CefV8Value object of type Date. This method should only be + // called from within the scope of a CefV8ContextHandler, CefV8Handler or + // CefV8Accessor callback, or in combination with calling Enter() and Exit() + // on a stored CefV8Context reference. + /// + /*--cef()--*/ + static CefRefPtr CreateDate(const CefTime& date); + + /// + // Create a new CefV8Value object of type string. + /// + /*--cef(optional_param=value)--*/ + static CefRefPtr CreateString(const CefString& value); + + /// + // Create a new CefV8Value object of type object with optional accessor. This + // method should only be called from within the scope of a + // CefV8ContextHandler, CefV8Handler or CefV8Accessor callback, or in + // combination with calling Enter() and Exit() on a stored CefV8Context + // reference. + /// + /*--cef(optional_param=accessor)--*/ + static CefRefPtr CreateObject(CefRefPtr accessor); + + /// + // Create a new CefV8Value object of type array with the specified |length|. + // If |length| is negative the returned array will have length 0. This method + // should only be called from within the scope of a CefV8ContextHandler, + // CefV8Handler or CefV8Accessor callback, or in combination with calling + // Enter() and Exit() on a stored CefV8Context reference. + /// + /*--cef()--*/ + static CefRefPtr CreateArray(int length); + + /// + // Create a new CefV8Value object of type function. This method should only be + // called from within the scope of a CefV8ContextHandler, CefV8Handler or + // CefV8Accessor callback, or in combination with calling Enter() and Exit() + // on a stored CefV8Context reference. + /// + /*--cef()--*/ + static CefRefPtr CreateFunction(const CefString& name, + CefRefPtr handler); + + /// + // True if the value type is undefined. + /// + /*--cef()--*/ + virtual bool IsUndefined() =0; + + /// + // True if the value type is null. + /// + /*--cef()--*/ + virtual bool IsNull() =0; + + /// + // True if the value type is bool. + /// + /*--cef()--*/ + virtual bool IsBool() =0; + + /// + // True if the value type is int. + /// + /*--cef()--*/ + virtual bool IsInt() =0; + + /// + // True if the value type is unsigned int. + /// + /*--cef()--*/ + virtual bool IsUInt() =0; + + /// + // True if the value type is double. + /// + /*--cef()--*/ + virtual bool IsDouble() =0; + + /// + // True if the value type is Date. + /// + /*--cef()--*/ + virtual bool IsDate() =0; + + /// + // True if the value type is string. + /// + /*--cef()--*/ + virtual bool IsString() =0; + + /// + // True if the value type is object. + /// + /*--cef()--*/ + virtual bool IsObject() =0; + + /// + // True if the value type is array. + /// + /*--cef()--*/ + virtual bool IsArray() =0; + + /// + // True if the value type is function. + /// + /*--cef()--*/ + virtual bool IsFunction() =0; + + /// + // Returns true if this object is pointing to the same handle as |that| + // object. + /// + /*--cef()--*/ + virtual bool IsSame(CefRefPtr that) =0; + + /// + // Return a bool value. The underlying data will be converted to if + // necessary. + /// + /*--cef()--*/ + virtual bool GetBoolValue() =0; + + /// + // Return an int value. The underlying data will be converted to if + // necessary. + /// + /*--cef()--*/ + virtual int32 GetIntValue() =0; + + /// + // Return an unisgned int value. The underlying data will be converted to if + // necessary. + /// + /*--cef()--*/ + virtual uint32 GetUIntValue() =0; + + /// + // Return a double value. The underlying data will be converted to if + // necessary. + /// + /*--cef()--*/ + virtual double GetDoubleValue() =0; + + /// + // Return a Date value. The underlying data will be converted to if + // necessary. + /// + /*--cef()--*/ + virtual CefTime GetDateValue() =0; + + /// + // Return a string value. The underlying data will be converted to if + // necessary. + /// + /*--cef()--*/ + virtual CefString GetStringValue() =0; + + + // OBJECT METHODS - These methods are only available on objects. Arrays and + // functions are also objects. String- and integer-based keys can be used + // interchangably with the framework converting between them as necessary. + + /// + // Returns true if this is a user created object. + /// + /*--cef()--*/ + virtual bool IsUserCreated() =0; + + /// + // Returns true if the last method call resulted in an exception. This + // attribute exists only in the scope of the current CEF value object. + /// + /*--cef()--*/ + virtual bool HasException() =0; + + /// + // Returns the exception resulting from the last method call. This attribute + // exists only in the scope of the current CEF value object. + /// + /*--cef()--*/ + virtual CefRefPtr GetException() =0; + + /// + // Clears the last exception and returns true on success. + /// + /*--cef()--*/ + virtual bool ClearException() =0; + + /// + // Returns true if this object will re-throw future exceptions. This attribute + // exists only in the scope of the current CEF value object. + /// + /*--cef()--*/ + virtual bool WillRethrowExceptions() =0; + + /// + // Set whether this object will re-throw future exceptions. By default + // exceptions are not re-thrown. If a exception is re-thrown the current + // context should not be accessed again until after the exception has been + // caught and not re-thrown. Returns true on success. This attribute exists + // only in the scope of the current CEF value object. + /// + /*--cef()--*/ + virtual bool SetRethrowExceptions(bool rethrow) =0; + + /// + // Returns true if the object has a value with the specified identifier. + /// + /*--cef(capi_name=has_value_bykey)--*/ + virtual bool HasValue(const CefString& key) =0; + + /// + // Returns true if the object has a value with the specified identifier. + /// + /*--cef(capi_name=has_value_byindex,index_param=index)--*/ + virtual bool HasValue(int index) =0; + + /// + // Deletes the value with the specified identifier and returns true on + // success. Returns false if this method is called incorrectly or an exception + // is thrown. For read-only and don't-delete values this method will return + // true even though deletion failed. + /// + /*--cef(capi_name=delete_value_bykey)--*/ + virtual bool DeleteValue(const CefString& key) =0; + + /// + // Deletes the value with the specified identifier and returns true on + // success. Returns false if this method is called incorrectly, deletion fails + // or an exception is thrown. For read-only and don't-delete values this + // method will return true even though deletion failed. + /// + /*--cef(capi_name=delete_value_byindex,index_param=index)--*/ + virtual bool DeleteValue(int index) =0; + + /// + // Returns the value with the specified identifier on success. Returns NULL + // if this method is called incorrectly or an exception is thrown. + /// + /*--cef(capi_name=get_value_bykey)--*/ + virtual CefRefPtr GetValue(const CefString& key) =0; + + /// + // Returns the value with the specified identifier on success. Returns NULL + // if this method is called incorrectly or an exception is thrown. + /// + /*--cef(capi_name=get_value_byindex,index_param=index)--*/ + virtual CefRefPtr GetValue(int index) =0; + + /// + // Associates a value with the specified identifier and returns true on + // success. Returns false if this method is called incorrectly or an exception + // is thrown. For read-only values this method will return true even though + // assignment failed. + /// + /*--cef(capi_name=set_value_bykey)--*/ + virtual bool SetValue(const CefString& key, CefRefPtr value, + PropertyAttribute attribute) =0; + + /// + // Associates a value with the specified identifier and returns true on + // success. Returns false if this method is called incorrectly or an exception + // is thrown. For read-only values this method will return true even though + // assignment failed. + /// + /*--cef(capi_name=set_value_byindex,index_param=index)--*/ + virtual bool SetValue(int index, CefRefPtr value) =0; + + /// + // Registers an identifier and returns true on success. Access to the + // identifier will be forwarded to the CefV8Accessor instance passed to + // CefV8Value::CreateObject(). Returns false if this method is called + // incorrectly or an exception is thrown. For read-only values this method + // will return true even though assignment failed. + /// + /*--cef(capi_name=set_value_byaccessor)--*/ + virtual bool SetValue(const CefString& key, AccessControl settings, + PropertyAttribute attribute) =0; + + /// + // Read the keys for the object's values into the specified vector. Integer- + // based keys will also be returned as strings. + /// + /*--cef()--*/ + virtual bool GetKeys(std::vector& keys) =0; + + /// + // Sets the user data for this object and returns true on success. Returns + // false if this method is called incorrectly. This method can only be called + // on user created objects. + /// + /*--cef(optional_param=user_data)--*/ + virtual bool SetUserData(CefRefPtr user_data) =0; + + /// + // Returns the user data, if any, assigned to this object. + /// + /*--cef()--*/ + virtual CefRefPtr GetUserData() =0; + + /// + // Returns the amount of externally allocated memory registered for the + // object. + /// + /*--cef()--*/ + virtual int GetExternallyAllocatedMemory() =0; + + /// + // Adjusts the amount of registered external memory for the object. Used to + // give V8 an indication of the amount of externally allocated memory that is + // kept alive by JavaScript objects. V8 uses this information to decide when + // to perform global garbage collection. Each CefV8Value tracks the amount of + // external memory associated with it and automatically decreases the global + // total by the appropriate amount on its destruction. |change_in_bytes| + // specifies the number of bytes to adjust by. This method returns the number + // of bytes associated with the object after the adjustment. This method can + // only be called on user created objects. + /// + /*--cef()--*/ + virtual int AdjustExternallyAllocatedMemory(int change_in_bytes) =0; + + + // ARRAY METHODS - These methods are only available on arrays. + + /// + // Returns the number of elements in the array. + /// + /*--cef()--*/ + virtual int GetArrayLength() =0; + + + // FUNCTION METHODS - These methods are only available on functions. + + /// + // Returns the function name. + /// + /*--cef()--*/ + virtual CefString GetFunctionName() =0; + + /// + // Returns the function handler or NULL if not a CEF-created function. + /// + /*--cef()--*/ + virtual CefRefPtr GetFunctionHandler() =0; + + /// + // Execute the function using the current V8 context. This method should only + // be called from within the scope of a CefV8Handler or CefV8Accessor + // callback, or in combination with calling Enter() and Exit() on a stored + // CefV8Context reference. |object| is the receiver ('this' object) of the + // function. If |object| is empty the current context's global object will be + // used. |arguments| is the list of arguments that will be passed to the + // function. Returns the function return value on success. Returns NULL if + // this method is called incorrectly or an exception is thrown. + /// + /*--cef(optional_param=object)--*/ + virtual CefRefPtr ExecuteFunction( + CefRefPtr object, + const CefV8ValueList& arguments) =0; + + /// + // Execute the function using the specified V8 context. |object| is the + // receiver ('this' object) of the function. If |object| is empty the + // specified context's global object will be used. |arguments| is the list of + // arguments that will be passed to the function. Returns the function return + // value on success. Returns NULL if this method is called incorrectly or an + // exception is thrown. + /// + /*--cef(optional_param=object)--*/ + virtual CefRefPtr ExecuteFunctionWithContext( + CefRefPtr context, + CefRefPtr object, + const CefV8ValueList& arguments) =0; +}; + +#endif // CEF_INCLUDE_CEF_V8_H_ diff --git a/include/cef_values.h b/include/cef_values.h new file mode 100644 index 000000000..9a640ab77 --- /dev/null +++ b/include/cef_values.h @@ -0,0 +1,471 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file must follow a specific format in order to +// support the CEF translator tool. See the translator.README.txt file in the +// tools directory for more information. +// + +#ifndef CEF_INCLUDE_CEF_VALUES_H_ +#define CEF_INCLUDE_CEF_VALUES_H_ +#pragma once + +#include +#include "include/cef_base.h" + +class CefDictionaryValue; +class CefListValue; + +typedef cef_value_type_t CefValueType; + +/// +// Class representing a binary value. Can be used on any process and thread. +/// +/*--cef(source=library)--*/ +class CefBinaryValue : public virtual CefBase { + public: + /// + // Creates a new object that is not owned by any other object. The specified + // |data| will be copied. + /// + /*--cef()--*/ + static CefRefPtr Create(const void* data, + size_t data_size); + + /// + // Returns true if this object is valid. Do not call any other methods if this + // method returns false. + /// + /*--cef()--*/ + virtual bool IsValid() =0; + + /// + // Returns true if this object is currently owned by another object. + /// + /*--cef()--*/ + virtual bool IsOwned() =0; + + /// + // Returns a copy of this object. The data in this object will also be copied. + /// + /*--cef()--*/ + virtual CefRefPtr Copy() =0; + + /// + // Returns the data size. + /// + /*--cef()--*/ + virtual size_t GetSize() =0; + + /// + // Read up to |buffer_size| number of bytes into |buffer|. Reading begins at + // the specified byte |data_offset|. Returns the number of bytes read. + /// + /*--cef()--*/ + virtual size_t GetData(void* buffer, + size_t buffer_size, + size_t data_offset) =0; +}; + + +/// +// Class representing a dictionary value. Can be used on any process and thread. +/// +/*--cef(source=library)--*/ +class CefDictionaryValue : public virtual CefBase { + public: + typedef std::vector KeyList; + + /// + // Creates a new object that is not owned by any other object. + /// + /*--cef()--*/ + static CefRefPtr Create(); + + /// + // Returns true if this object is valid. Do not call any other methods if this + // method returns false. + /// + /*--cef()--*/ + virtual bool IsValid() =0; + + /// + // Returns true if this object is currently owned by another object. + /// + /*--cef()--*/ + virtual bool IsOwned() =0; + + /// + // Returns true if the values of this object are read-only. Some APIs may + // expose read-only objects. + /// + /*--cef()--*/ + virtual bool IsReadOnly() =0; + + /// + // Returns a writable copy of this object. If |exclude_empty_children| is true + // any empty dictionaries or lists will be excluded from the copy. + /// + /*--cef()--*/ + virtual CefRefPtr Copy(bool exclude_empty_children) =0; + + /// + // Returns the number of values. + /// + /*--cef()--*/ + virtual size_t GetSize() =0; + + /// + // Removes all values. Returns true on success. + /// + /*--cef()--*/ + virtual bool Clear() =0; + + /// + // Returns true if the current dictionary has a value for the given key. + /// + /*--cef()--*/ + virtual bool HasKey(const CefString& key) =0; + + /// + // Reads all keys for this dictionary into the specified vector. + /// + /*--cef()--*/ + virtual bool GetKeys(KeyList& keys) =0; + + /// + // Removes the value at the specified key. Returns true is the value was + // removed successfully. + /// + /*--cef()--*/ + virtual bool Remove(const CefString& key) =0; + + /// + // Returns the value type for the specified key. + /// + /*--cef(default_retval=VTYPE_INVALID)--*/ + virtual CefValueType GetType(const CefString& key) =0; + + /// + // Returns the value at the specified key as type bool. + /// + /*--cef()--*/ + virtual bool GetBool(const CefString& key) =0; + + /// + // Returns the value at the specified key as type int. + /// + /*--cef()--*/ + virtual int GetInt(const CefString& key) =0; + + /// + // Returns the value at the specified key as type double. + /// + /*--cef()--*/ + virtual double GetDouble(const CefString& key) =0; + + /// + // Returns the value at the specified key as type string. + /// + /*--cef()--*/ + virtual CefString GetString(const CefString& key) =0; + + /// + // Returns the value at the specified key as type binary. + /// + /*--cef()--*/ + virtual CefRefPtr GetBinary(const CefString& key) =0; + + /// + // Returns the value at the specified key as type dictionary. + /// + /*--cef()--*/ + virtual CefRefPtr GetDictionary(const CefString& key) =0; + + /// + // Returns the value at the specified key as type list. + /// + /*--cef()--*/ + virtual CefRefPtr GetList(const CefString& key) =0; + + /// + // Sets the value at the specified key as type null. Returns true if the + // value was set successfully. + /// + /*--cef()--*/ + virtual bool SetNull(const CefString& key) =0; + + /// + // Sets the value at the specified key as type bool. Returns true if the + // value was set successfully. + /// + /*--cef()--*/ + virtual bool SetBool(const CefString& key, bool value) =0; + + /// + // Sets the value at the specified key as type int. Returns true if the + // value was set successfully. + /// + /*--cef()--*/ + virtual bool SetInt(const CefString& key, int value) =0; + + /// + // Sets the value at the specified key as type double. Returns true if the + // value was set successfully. + /// + /*--cef()--*/ + virtual bool SetDouble(const CefString& key, double value) =0; + + /// + // Sets the value at the specified key as type string. Returns true if the + // value was set successfully. + /// + /*--cef(optional_param=value)--*/ + virtual bool SetString(const CefString& key, const CefString& value) =0; + + /// + // Sets the value at the specified key as type binary. Returns true if the + // value was set successfully. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + /// + /*--cef()--*/ + virtual bool SetBinary(const CefString& key, + CefRefPtr value) =0; + + /// + // Sets the value at the specified key as type dict. Returns true if the + // value was set successfully. After calling this method the |value| object + // will no longer be valid. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + /// + /*--cef()--*/ + virtual bool SetDictionary(const CefString& key, + CefRefPtr value) =0; + + /// + // Sets the value at the specified key as type list. Returns true if the + // value was set successfully. After calling this method the |value| object + // will no longer be valid. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + /// + /*--cef()--*/ + virtual bool SetList(const CefString& key, + CefRefPtr value) =0; +}; + + +/// +// Class representing a list value. Can be used on any process and thread. +/// +/*--cef(source=library)--*/ +class CefListValue : public virtual CefBase { + public: + /// + // Creates a new object that is not owned by any other object. + /// + /*--cef()--*/ + static CefRefPtr Create(); + + /// + // Returns true if this object is valid. Do not call any other methods if this + // method returns false. + /// + /*--cef()--*/ + virtual bool IsValid() =0; + + /// + // Returns true if this object is currently owned by another object. + /// + /*--cef()--*/ + virtual bool IsOwned() =0; + + /// + // Returns true if the values of this object are read-only. Some APIs may + // expose read-only objects. + /// + /*--cef()--*/ + virtual bool IsReadOnly() =0; + + /// + // Returns a writable copy of this object. + /// + /*--cef()--*/ + virtual CefRefPtr Copy() =0; + + /// + // Sets the number of values. If the number of values is expanded all + // new value slots will default to type null. Returns true on success. + /// + /*--cef()--*/ + virtual bool SetSize(size_t size) =0; + + /// + // Returns the number of values. + /// + /*--cef()--*/ + virtual size_t GetSize() =0; + + /// + // Removes all values. Returns true on success. + /// + /*--cef()--*/ + virtual bool Clear() =0; + + /// + // Removes the value at the specified index. + /// + /*--cef(index_param=index)--*/ + virtual bool Remove(int index) =0; + + /// + // Returns the value type at the specified index. + /// + /*--cef(default_retval=VTYPE_INVALID,index_param=index)--*/ + virtual CefValueType GetType(int index) =0; + + /// + // Returns the value at the specified index as type bool. + /// + /*--cef(index_param=index)--*/ + virtual bool GetBool(int index) =0; + + /// + // Returns the value at the specified index as type int. + /// + /*--cef(index_param=index)--*/ + virtual int GetInt(int index) =0; + + /// + // Returns the value at the specified index as type double. + /// + /*--cef(index_param=index)--*/ + virtual double GetDouble(int index) =0; + + /// + // Returns the value at the specified index as type string. + /// + /*--cef(index_param=index)--*/ + virtual CefString GetString(int index) =0; + + /// + // Returns the value at the specified index as type binary. + /// + /*--cef(index_param=index)--*/ + virtual CefRefPtr GetBinary(int index) =0; + + /// + // Returns the value at the specified index as type dictionary. + /// + /*--cef(index_param=index)--*/ + virtual CefRefPtr GetDictionary(int index) =0; + + /// + // Returns the value at the specified index as type list. + /// + /*--cef(index_param=index)--*/ + virtual CefRefPtr GetList(int index) =0; + + /// + // Sets the value at the specified index as type null. Returns true if the + // value was set successfully. + /// + /*--cef(index_param=index)--*/ + virtual bool SetNull(int index) =0; + + /// + // Sets the value at the specified index as type bool. Returns true if the + // value was set successfully. + /// + /*--cef(index_param=index)--*/ + virtual bool SetBool(int index, bool value) =0; + + /// + // Sets the value at the specified index as type int. Returns true if the + // value was set successfully. + /// + /*--cef(index_param=index)--*/ + virtual bool SetInt(int index, int value) =0; + + /// + // Sets the value at the specified index as type double. Returns true if the + // value was set successfully. + /// + /*--cef(index_param=index)--*/ + virtual bool SetDouble(int index, double value) =0; + + /// + // Sets the value at the specified index as type string. Returns true if the + // value was set successfully. + /// + /*--cef(optional_param=value,index_param=index)--*/ + virtual bool SetString(int index, const CefString& value) =0; + + /// + // Sets the value at the specified index as type binary. Returns true if the + // value was set successfully. After calling this method the |value| object + // will no longer be valid. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + /// + /*--cef(index_param=index)--*/ + virtual bool SetBinary(int index, CefRefPtr value) =0; + + /// + // Sets the value at the specified index as type dict. Returns true if the + // value was set successfully. After calling this method the |value| object + // will no longer be valid. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + /// + /*--cef(index_param=index)--*/ + virtual bool SetDictionary(int index, CefRefPtr value) =0; + + /// + // Sets the value at the specified index as type list. Returns true if the + // value was set successfully. After calling this method the |value| object + // will no longer be valid. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + /// + /*--cef(index_param=index)--*/ + virtual bool SetList(int index, CefRefPtr value) =0; +}; + +#endif // CEF_INCLUDE_CEF_VALUES_H_ diff --git a/cef/include/cef_version.h b/include/cef_version.h similarity index 94% rename from cef/include/cef_version.h rename to include/cef_version.h index cef9257cc..0962ebb80 100644 --- a/cef/include/cef_version.h +++ b/include/cef_version.h @@ -35,13 +35,13 @@ #ifndef CEF_INCLUDE_CEF_VERSION_H_ #define CEF_INCLUDE_CEF_VERSION_H_ -#define CEF_REVISION 714 +#define CEF_REVISION 735 #define COPYRIGHT_YEAR 2012 -#define CHROME_VERSION_MAJOR 18 +#define CHROME_VERSION_MAJOR 21 #define CHROME_VERSION_MINOR 0 -#define CHROME_VERSION_BUILD 1025 -#define CHROME_VERSION_PATCH 166 +#define CHROME_VERSION_BUILD 1180 +#define CHROME_VERSION_PATCH 18 #define DO_MAKE_STRING(p) #p #define MAKE_STRING(p) DO_MAKE_STRING(p) diff --git a/cef/include/cef_web_plugin.h b/include/cef_web_plugin.h similarity index 78% rename from cef/include/cef_web_plugin.h rename to include/cef_web_plugin.h index e00b2349b..dcb4e9efb 100644 --- a/cef/include/cef_web_plugin.h +++ b/include/cef_web_plugin.h @@ -39,28 +39,14 @@ #include "include/cef_base.h" -class CefWebPluginInfo; +class CefWebPluginInfoVisitor; + /// -// Returns the number of installed web plugins. This method must be called on -// the UI thread. +// Visit web plugin information. /// /*--cef()--*/ -size_t CefGetWebPluginCount(); - -/// -// Returns information for web plugin at the specified zero-based index. This -// method must be called on the UI thread. -/// -/*--cef()--*/ -CefRefPtr CefGetWebPluginInfo(int index); - -/// -// Returns information for web plugin with the specified name. This method must -// be called on the UI thread. -/// -/*--cef(capi_name=cef_get_web_plugin_info_byname)--*/ -CefRefPtr CefGetWebPluginInfo(const CefString& name); +void CefVisitWebPluginInfo(CefRefPtr visitor); /// @@ -94,4 +80,22 @@ class CefWebPluginInfo : public virtual CefBase { virtual CefString GetDescription() =0; }; + +/// +// Interface to implement for visiting web plugin information. The methods of +// this class will be called on the UI thread. +/// +/*--cef(source=client)--*/ +class CefWebPluginInfoVisitor : public virtual CefBase { + public: + /// + // Method that will be called once for each plugin. |count| is the 0-based + // index for the current plugin. |total| is the total number of plugins. + // Return false to stop visiting plugins. This method may never be called if + // no plugins are found. + /// + /*--cef()--*/ + virtual bool Visit(CefRefPtr info, int count, int total) =0; +}; + #endif // CEF_INCLUDE_CEF_WEB_PLUGIN_H_ diff --git a/cef/include/cef_xml_reader.h b/include/cef_xml_reader.h similarity index 99% rename from cef/include/cef_xml_reader.h rename to include/cef_xml_reader.h index e457e0d8d..86be8bac7 100644 --- a/cef/include/cef_xml_reader.h +++ b/include/cef_xml_reader.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/cef/include/cef_zip_reader.h b/include/cef_zip_reader.h similarity index 98% rename from cef/include/cef_zip_reader.h rename to include/cef_zip_reader.h index 9498f06ed..1fe02b916 100644 --- a/cef/include/cef_zip_reader.h +++ b/include/cef_zip_reader.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are diff --git a/cef/include/internal/cef_build.h b/include/internal/cef_build.h similarity index 100% rename from cef/include/internal/cef_build.h rename to include/internal/cef_build.h diff --git a/cef/include/internal/cef_export.h b/include/internal/cef_export.h similarity index 100% rename from cef/include/internal/cef_export.h rename to include/internal/cef_export.h diff --git a/cef/include/internal/cef_linux.h b/include/internal/cef_linux.h similarity index 84% rename from cef/include/internal/cef_linux.h rename to include/internal/cef_linux.h index 0c9003b06..c7974bec2 100644 --- a/cef/include/internal/cef_linux.h +++ b/include/internal/cef_linux.h @@ -37,9 +37,7 @@ #include "include/internal/cef_types_linux.h" #include "include/internal/cef_types_wrappers.h" -/// // Atomic increment and decrement. -/// inline long CefAtomicIncrement(long volatile *pDest) { // NOLINT(runtime/int) return __sync_add_and_fetch(pDest, 1); } @@ -47,9 +45,7 @@ inline long CefAtomicDecrement(long volatile *pDest) { // NOLINT(runtime/int) return __sync_sub_and_fetch(pDest, 1); } -/// // Critical section wrapper. -/// class CefCriticalSection { public: CefCriticalSection() { @@ -72,12 +68,37 @@ class CefCriticalSection { pthread_mutexattr_t attr_; }; -/// // Handle types. -/// -#define CefWindowHandle cef_window_handle_t #define CefCursorHandle cef_cursor_handle_t +#define CefEventHandle cef_event_handle_t +#define CefWindowHandle cef_window_handle_t +struct CefMainArgsTraits { + typedef cef_main_args_t struct_type; + + static inline void init(struct_type* s) {} + static inline void clear(struct_type* s) {} + + static inline void set(const struct_type* src, struct_type* target, + bool copy) { + target->argc = src->argc; + target->argv = src->argv; + } +}; + +// Class representing CefExecuteProcess arguments. +class CefMainArgs : public CefStructBase { + public: + typedef CefStructBase parent; + + CefMainArgs() : parent() {} + explicit CefMainArgs(const cef_main_args_t& r) : parent(r) {} + explicit CefMainArgs(const CefMainArgs& r) : parent(r) {} + CefMainArgs(int argc_arg, char** argv_arg) : parent() { + argc = argc_arg; + argv = argv_arg; + } +}; struct CefWindowInfoTraits { typedef cef_window_info_t struct_type; @@ -87,14 +108,12 @@ struct CefWindowInfoTraits { static inline void set(const struct_type* src, struct_type* target, bool copy) { - target->m_Widget = src->m_Widget; - target->m_ParentWidget = src->m_ParentWidget; + target->widget = src->widget; + target->parent_widget = src->parent_widget; } }; -/// // Class representing window information. -/// class CefWindowInfo : public CefStructBase { public: typedef CefStructBase parent; @@ -104,46 +123,10 @@ class CefWindowInfo : public CefStructBase { explicit CefWindowInfo(const CefWindowInfo& r) : parent(r) {} void SetAsChild(CefWindowHandle ParentWidget) { - m_ParentWidget = ParentWidget; + parent_widget = ParentWidget; } }; - -struct CefPrintInfoTraits { - typedef cef_print_info_t struct_type; - - static inline void init(struct_type* s) {} - static inline void clear(struct_type* s) {} - - static inline void set(const struct_type* src, struct_type* target, - bool copy) { - target->m_Scale = src->m_Scale; - } -}; - -/// -// Class representing print context information. -/// -typedef CefStructBase CefPrintInfo; - - -struct CefKeyInfoTraits { - typedef cef_key_info_t struct_type; - - static inline void init(struct_type* s) {} - static inline void clear(struct_type* s) {} - - static inline void set(const struct_type* src, struct_type* target, - bool copy) { - target->key = src->key; - } -}; - -/// -// Class representing key information. -/// -typedef CefStructBase CefKeyInfo; - #endif // OS_LINUX #endif // CEF_INCLUDE_INTERNAL_CEF_LINUX_H_ diff --git a/include/internal/cef_mac.h b/include/internal/cef_mac.h new file mode 100644 index 000000000..ddedbce50 --- /dev/null +++ b/include/internal/cef_mac.h @@ -0,0 +1,148 @@ +// Copyright (c) 2010 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +#ifndef CEF_INCLUDE_INTERNAL_CEF_MAC_H_ +#define CEF_INCLUDE_INTERNAL_CEF_MAC_H_ +#pragma once + +#if defined(OS_MACOSX) +#include +#include "include/internal/cef_types_mac.h" +#include "include/internal/cef_types_wrappers.h" + +// Atomic increment and decrement. +inline long CefAtomicIncrement(long volatile *pDest) { // NOLINT(runtime/int) + return __sync_add_and_fetch(pDest, 1); +} +inline long CefAtomicDecrement(long volatile *pDest) { // NOLINT(runtime/int) + return __sync_sub_and_fetch(pDest, 1); +} + +// Critical section wrapper. +class CefCriticalSection { + public: + CefCriticalSection() { + pthread_mutexattr_init(&attr_); + pthread_mutexattr_settype(&attr_, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&lock_, &attr_); + } + virtual ~CefCriticalSection() { + pthread_mutex_destroy(&lock_); + pthread_mutexattr_destroy(&attr_); + } + void Lock() { + pthread_mutex_lock(&lock_); + } + void Unlock() { + pthread_mutex_unlock(&lock_); + } + + pthread_mutex_t lock_; + pthread_mutexattr_t attr_; +}; + +// Handle types. +#define CefCursorHandle cef_cursor_handle_t +#define CefEventHandle cef_event_handle_t +#define CefWindowHandle cef_window_handle_t + +struct CefMainArgsTraits { + typedef cef_main_args_t struct_type; + + static inline void init(struct_type* s) {} + static inline void clear(struct_type* s) {} + + static inline void set(const struct_type* src, struct_type* target, + bool copy) { + target->argc = src->argc; + target->argv = src->argv; + } +}; + +// Class representing CefExecuteProcess arguments. +class CefMainArgs : public CefStructBase { + public: + typedef CefStructBase parent; + + CefMainArgs() : parent() {} + explicit CefMainArgs(const cef_main_args_t& r) : parent(r) {} + explicit CefMainArgs(const CefMainArgs& r) : parent(r) {} + CefMainArgs(int argc, char** argv) : parent() { + this->argc = argc; + this->argv = argv; + } +}; + +struct CefWindowInfoTraits { + typedef cef_window_info_t struct_type; + + static inline void init(struct_type* s) {} + + static inline void clear(struct_type* s) { + cef_string_clear(&s->window_name); + } + + static inline void set(const struct_type* src, struct_type* target, + bool copy) { + target->view = src->view; + target->parent_view = src->parent_view; + cef_string_set(src->window_name.str, src->window_name.length, + &target->window_name, copy); + target->x = src->x; + target->y = src->y; + target->width = src->width; + target->height = src->height; + target->hidden = src->hidden; + } +}; + +// Class representing window information. +class CefWindowInfo : public CefStructBase { + public: + typedef CefStructBase parent; + + CefWindowInfo() : parent() {} + explicit CefWindowInfo(const cef_window_info_t& r) : parent(r) {} + explicit CefWindowInfo(const CefWindowInfo& r) : parent(r) {} + + void SetAsChild(CefWindowHandle ParentView, int x, int y, int width, + int height) { + parent_view = ParentView; + this->x = x; + this->y = y; + this->width = width; + this->height = height; + hidden = false; + } +}; + +#endif // OS_MACOSX + +#endif // CEF_INCLUDE_INTERNAL_CEF_MAC_H_ diff --git a/cef/include/internal/cef_ptr.h b/include/internal/cef_ptr.h similarity index 100% rename from cef/include/internal/cef_ptr.h rename to include/internal/cef_ptr.h diff --git a/cef/include/internal/cef_string.h b/include/internal/cef_string.h similarity index 100% rename from cef/include/internal/cef_string.h rename to include/internal/cef_string.h diff --git a/cef/include/internal/cef_string_list.h b/include/internal/cef_string_list.h similarity index 100% rename from cef/include/internal/cef_string_list.h rename to include/internal/cef_string_list.h diff --git a/cef/include/internal/cef_string_map.h b/include/internal/cef_string_map.h similarity index 100% rename from cef/include/internal/cef_string_map.h rename to include/internal/cef_string_map.h diff --git a/cef/include/internal/cef_string_multimap.h b/include/internal/cef_string_multimap.h similarity index 100% rename from cef/include/internal/cef_string_multimap.h rename to include/internal/cef_string_multimap.h diff --git a/cef/include/internal/cef_string_types.h b/include/internal/cef_string_types.h similarity index 100% rename from cef/include/internal/cef_string_types.h rename to include/internal/cef_string_types.h diff --git a/cef/include/internal/cef_string_wrappers.h b/include/internal/cef_string_wrappers.h similarity index 100% rename from cef/include/internal/cef_string_wrappers.h rename to include/internal/cef_string_wrappers.h diff --git a/cef/include/internal/cef_time.h b/include/internal/cef_time.h similarity index 99% rename from cef/include/internal/cef_time.h rename to include/internal/cef_time.h index 5d38cf7bc..ccaf19320 100644 --- a/cef/include/internal/cef_time.h +++ b/include/internal/cef_time.h @@ -44,9 +44,7 @@ extern "C" { typedef struct _cef_time_t { int year; // Four digit year "2007" int month; // 1-based month (values 1 = January, etc.) -#if !defined(OS_MACOSX) int day_of_week; // 0-based day of week (0 = Sunday, etc.) -#endif int day_of_month; // 1-based day of month (1-31) int hour; // Hour within the current day (0-23) int minute; // Minute within the current hour (0-59) diff --git a/cef/include/internal/cef_tuple.h b/include/internal/cef_tuple.h similarity index 99% rename from cef/include/internal/cef_tuple.h rename to include/internal/cef_tuple.h index d9a1a2c96..c2cdf7058 100644 --- a/cef/include/internal/cef_tuple.h +++ b/include/internal/cef_tuple.h @@ -57,6 +57,10 @@ #define CEF_INCLUDE_INTERNAL_CEF_TUPLE_H_ #pragma once +// If base/tuple.h is included first then exclude this file. This is to +// facilitate the use of both base/bind.h and cef_runnable.h in unit tests. +#ifndef BASE_TUPLE_H__ + #if defined(OS_CHROMEOS) // To troubleshoot crosbug.com/7327. #include "base/logging.h" @@ -1079,4 +1083,6 @@ inline void DispatchToMethod(ObjT* obj, Method method, &out->a, &out->b, &out->c, &out->d, &out->e); } +#endif // BASE_TUPLE_H__ + #endif // CEF_INCLUDE_INTERNAL_CEF_TUPLE_H_ diff --git a/include/internal/cef_types.h b/include/internal/cef_types.h new file mode 100644 index 000000000..0d6cea0ff --- /dev/null +++ b/include/internal/cef_types.h @@ -0,0 +1,1324 @@ +// Copyright (c) 2010 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +#ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_H_ +#define CEF_INCLUDE_INTERNAL_CEF_TYPES_H_ +#pragma once + +#include "include/internal/cef_build.h" +#include "include/internal/cef_string.h" +#include "include/internal/cef_string_list.h" +#include "include/internal/cef_time.h" + +// Bring in platform-specific definitions. +#if defined(OS_WIN) +#include "include/internal/cef_types_win.h" +#elif defined(OS_MACOSX) +#include "include/internal/cef_types_mac.h" +#elif defined(OS_LINUX) +#include "include/internal/cef_types_linux.h" +#endif + +#include // For size_t + +// The NSPR system headers define 64-bit as |long| when possible, except on +// Mac OS X. In order to not have typedef mismatches, we do the same on LP64. +// +// On Mac OS X, |long long| is used for 64-bit types for compatibility with +// format macros even in the LP64 model. +#if defined(__LP64__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) +typedef long int64; // NOLINT(runtime/int) +typedef unsigned long uint64; // NOLINT(runtime/int) +#else +typedef long long int64; // NOLINT(runtime/int) +typedef unsigned long long uint64; // NOLINT(runtime/int) +#endif + +// TODO: Remove these type guards. These are to avoid conflicts with +// obsolete/protypes.h in the Gecko SDK. +#ifndef _INT32 +#define _INT32 +typedef int int32; +#endif + +// TODO: Remove these type guards. These are to avoid conflicts with +// obsolete/protypes.h in the Gecko SDK. +#ifndef _UINT32 +#define _UINT32 +typedef unsigned int uint32; +#endif + +// UTF-16 character type +#ifndef char16 +#if defined(WIN32) +typedef wchar_t char16; +#else +typedef unsigned short char16; +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Log severity levels. +/// +enum cef_log_severity_t { + /// + // Default logging (currently INFO logging). + /// + LOGSEVERITY_DEFAULT, + + /// + // Verbose logging. + /// + LOGSEVERITY_VERBOSE, + + /// + // INFO logging. + /// + LOGSEVERITY_INFO, + + /// + // WARNING logging. + /// + LOGSEVERITY_WARNING, + + /// + // ERROR logging. + /// + LOGSEVERITY_ERROR, + + /// + // ERROR_REPORT logging. + /// + LOGSEVERITY_ERROR_REPORT, + + /// + // Completely disable logging. + /// + LOGSEVERITY_DISABLE = 99 +}; + +/// +// Initialization settings. Specify NULL or 0 to get the recommended default +// values. +/// +typedef struct _cef_settings_t { + /// + // Size of this structure. + /// + size_t size; + + /// + // Set to true (1) to use a single process for the browser and renderer. This + // run mode is not officially supported by Chromium and is less stable than + // the multi-process default. + /// + bool single_process; + + /// + // The path to a separate executable that will be launched for sub-processes. + // By default the browser process executable is used. See the comments on + // CefExecuteProcess() for details. + /// + cef_string_t browser_subprocess_path; + + /// + // Set to true (1) to have the browser process message loop run in a separate + // thread. If false (0) than the CefDoMessageLoopWork() function must be + // called from your application message loop. + /// + bool multi_threaded_message_loop; + + /// + // Set to true (1) to disable configuration of browser process features using + // standard CEF and Chromium command-line arguments. Configuration can still + // be specified using CEF data structures or via the + // CefApp::OnBeforeCommandLineProcessing() method. + /// + bool command_line_args_disabled; + + /// + // The location where cache data will be stored on disk. If empty an in-memory + // cache will be used. HTML5 databases such as localStorage will only persist + // across sessions if a cache path is specified. + /// + cef_string_t cache_path; + + /// + // Value that will be returned as the User-Agent HTTP header. If empty the + // default User-Agent string will be used. + /// + cef_string_t user_agent; + + /// + // Value that will be inserted as the product portion of the default + // User-Agent string. If empty the Chromium product version will be used. If + // |userAgent| is specified this value will be ignored. + /// + cef_string_t product_version; + + /// + // The locale string that will be passed to WebKit. If empty the default + // locale of "en-US" will be used. This value is ignored on Linux where locale + // is determined using environment variable parsing with the precedence order: + // LANGUAGE, LC_ALL, LC_MESSAGES and LANG. + /// + cef_string_t locale; + + /// + // The directory and file name to use for the debug log. If empty, the + // default name of "debug.log" will be used and the file will be written + // to the application directory. + /// + cef_string_t log_file; + + /// + // The log severity. Only messages of this severity level or higher will be + // logged. + /// + cef_log_severity_t log_severity; + + /// + // Custom flags that will be used when initializing the V8 JavaScript engine. + // The consequences of using custom flags may not be well tested. + /// + cef_string_t javascript_flags; + + /// + // Set to true (1) to use the system proxy resolver on Windows when + // "Automatically detect settings" is checked. This setting is disabled + // by default for performance reasons. + /// + bool auto_detect_proxy_settings_enabled; + + /// + // The fully qualified path for the cef.pak file. If this value is empty + // the cef.pak file must be located in the module directory. This value is + // ignored on Mac OS X where pack files are always loaded from the app bundle + // resource directory. + /// + cef_string_t pack_file_path; + + /// + // The fully qualified path for the locales directory. If this value is empty + // the locales directory must be located in the module directory. This value + // is ignored on Mac OS X where pack files are always loaded from the app + // bundle resource directory. + /// + cef_string_t locales_dir_path; + + /// + // Set to true (1) to disable loading of pack files for resources and locales. + // A resource bundle handler must be provided for the browser and render + // processes via CefApp::GetResourceBundleHandler() if loading of pack files + // is disabled. + /// + bool pack_loading_disabled; + + /// + // Set to a value between 1024 and 65535 to enable remote debugging on the + // specified port. For example, if 8080 is specified the remote debugging URL + // will be http://localhost:8080. CEF can be remotely debugged from any CEF or + // Chrome browser window. + /// + int remote_debugging_port; +} cef_settings_t; + +/// +// Browser initialization settings. Specify NULL or 0 to get the recommended +// default values. The consequences of using custom values may not be well +// tested. +/// +typedef struct _cef_browser_settings_t { + /// + // Size of this structure. + /// + size_t size; + + // The below values map to WebPreferences settings. + + /// + // Font settings. + /// + cef_string_t standard_font_family; + cef_string_t fixed_font_family; + cef_string_t serif_font_family; + cef_string_t sans_serif_font_family; + cef_string_t cursive_font_family; + cef_string_t fantasy_font_family; + int default_font_size; + int default_fixed_font_size; + int minimum_font_size; + int minimum_logical_font_size; + + /// + // Set to true (1) to disable loading of fonts from remote sources. + /// + bool remote_fonts_disabled; + + /// + // Default encoding for Web content. If empty "ISO-8859-1" will be used. + /// + cef_string_t default_encoding; + + /// + // Set to true (1) to attempt automatic detection of content encoding. + /// + bool encoding_detector_enabled; + + /// + // Set to true (1) to disable JavaScript. + /// + bool javascript_disabled; + + /// + // Set to true (1) to disallow JavaScript from opening windows. + /// + bool javascript_open_windows_disallowed; + + /// + // Set to true (1) to disallow JavaScript from closing windows. + /// + bool javascript_close_windows_disallowed; + + /// + // Set to true (1) to disallow JavaScript from accessing the clipboard. + /// + bool javascript_access_clipboard_disallowed; + + /// + // Set to true (1) to disable DOM pasting in the editor. DOM pasting also + // depends on |javascript_cannot_access_clipboard| being false (0). + /// + bool dom_paste_disabled; + + /// + // Set to true (1) to enable drawing of the caret position. + /// + bool caret_browsing_enabled; + + /// + // Set to true (1) to disable Java. + /// + bool java_disabled; + + /// + // Set to true (1) to disable plugins. + /// + bool plugins_disabled; + + /// + // Set to true (1) to allow access to all URLs from file URLs. + /// + bool universal_access_from_file_urls_allowed; + + /// + // Set to true (1) to allow access to file URLs from other file URLs. + /// + bool file_access_from_file_urls_allowed; + + /// + // Set to true (1) to allow risky security behavior such as cross-site + // scripting (XSS). Use with extreme care. + /// + bool web_security_disabled; + + /// + // Set to true (1) to enable console warnings about XSS attempts. + /// + bool xss_auditor_enabled; + + /// + // Set to true (1) to suppress the network load of image URLs. A cached + // image will still be rendered if requested. + /// + bool image_load_disabled; + + /// + // Set to true (1) to shrink standalone images to fit the page. + /// + bool shrink_standalone_images_to_fit; + + /// + // Set to true (1) to disable browser backwards compatibility features. + /// + bool site_specific_quirks_disabled; + + /// + // Set to true (1) to disable resize of text areas. + /// + bool text_area_resize_disabled; + + /// + // Set to true (1) to disable use of the page cache. + /// + bool page_cache_disabled; + + /// + // Set to true (1) to not have the tab key advance focus to links. + /// + bool tab_to_links_disabled; + + /// + // Set to true (1) to disable hyperlink pings (
    and window.sendPing). + /// + bool hyperlink_auditing_disabled; + + /// + // Set to true (1) to enable the user style sheet for all pages. + /// + bool user_style_sheet_enabled; + + /// + // Location of the user style sheet. This must be a data URL of the form + // "data:text/css;charset=utf-8;base64,csscontent" where "csscontent" is the + // base64 encoded contents of the CSS file. + /// + cef_string_t user_style_sheet_location; + + /// + // Set to true (1) to disable style sheets. + /// + bool author_and_user_styles_disabled; + + /// + // Set to true (1) to disable local storage. + /// + bool local_storage_disabled; + + /// + // Set to true (1) to disable databases. + /// + bool databases_disabled; + + /// + // Set to true (1) to disable application cache. + /// + bool application_cache_disabled; + + /// + // Set to true (1) to disable WebGL. + /// + bool webgl_disabled; + + /// + // Set to true (1) to disable accelerated compositing. + /// + bool accelerated_compositing_disabled; + + /// + // Set to true (1) to disable accelerated layers. This affects features like + // 3D CSS transforms. + /// + bool accelerated_layers_disabled; + + /// + // Set to true (1) to disable accelerated video. + /// + bool accelerated_video_disabled; + + /// + // Set to true (1) to disable accelerated 2d canvas. + /// + bool accelerated_2d_canvas_disabled; + + /// + // Set to true (1) to enable accelerated painting. + /// + bool accelerated_painting_enabled; + + /// + // Set to true (1) to enable accelerated filters. + /// + bool accelerated_filters_enabled; + + /// + // Set to true (1) to disable accelerated plugins. + /// + bool accelerated_plugins_disabled; + + /// + // Set to true (1) to disable developer tools (WebKit inspector). + /// + bool developer_tools_disabled; + + /// + // Set to true (1) to enable fullscreen mode. + /// + bool fullscreen_enabled; +} cef_browser_settings_t; + +/// +// URL component parts. +/// +typedef struct _cef_urlparts_t { + /// + // The complete URL specification. + /// + cef_string_t spec; + + /// + // Scheme component not including the colon (e.g., "http"). + /// + cef_string_t scheme; + + /// + // User name component. + /// + cef_string_t username; + + /// + // Password component. + /// + cef_string_t password; + + /// + // Host component. This may be a hostname, an IPv4 address or an IPv6 literal + // surrounded by square brackets (e.g., "[2001:db8::1]"). + /// + cef_string_t host; + + /// + // Port number component. + /// + cef_string_t port; + + /// + // Path component including the first slash following the host. + /// + cef_string_t path; + + /// + // Query string component (i.e., everything following the '?'). + /// + cef_string_t query; +} cef_urlparts_t; + +/// +// Cookie information. +/// +typedef struct _cef_cookie_t { + /// + // The cookie name. + /// + cef_string_t name; + + /// + // The cookie value. + /// + cef_string_t value; + + /// + // If |domain| is empty a host cookie will be created instead of a domain + // cookie. Domain cookies are stored with a leading "." and are visible to + // sub-domains whereas host cookies are not. + /// + cef_string_t domain; + + /// + // If |path| is non-empty only URLs at or below the path will get the cookie + // value. + /// + cef_string_t path; + + /// + // If |secure| is true the cookie will only be sent for HTTPS requests. + /// + bool secure; + + /// + // If |httponly| is true the cookie will only be sent for HTTP requests. + /// + bool httponly; + + /// + // The cookie creation date. This is automatically populated by the system on + // cookie creation. + /// + cef_time_t creation; + + /// + // The cookie last access date. This is automatically populated by the system + // on access. + /// + cef_time_t last_access; + + /// + // The cookie expiration date is only valid if |has_expires| is true. + /// + bool has_expires; + cef_time_t expires; +} cef_cookie_t; + +/// +// Process termination status values. +/// +enum cef_termination_status_t { + /// + // Non-zero exit status. + /// + TS_ABNORMAL_TERMINATION, + + /// + // SIGKILL or task manager kill. + /// + TS_PROCESS_WAS_KILLED, + + /// + // Segmentation fault. + /// + TS_PROCESS_CRASHED, +}; + +/// +// Path key values. +/// +enum cef_path_key_t { + /// + // Current directory. + /// + PK_DIR_CURRENT, + + /// + // Directory containing PK_FILE_EXE. + /// + PK_DIR_EXE, + + /// + // Directory containing PK_FILE_MODULE. + /// + PK_DIR_MODULE, + + /// + // Temporary directory. + /// + PK_DIR_TEMP, + + /// + // Path and filename of the current executable. + /// + PK_FILE_EXE, + + /// + // Path and filename of the module containing the CEF code (usually the libcef + // module). + /// + PK_FILE_MODULE, +}; + +/// +// Storage types. +/// +enum cef_storage_type_t { + ST_LOCALSTORAGE = 0, + ST_SESSIONSTORAGE, +}; + +/// +// Supported error code values. See net\base\net_error_list.h for complete +// descriptions of the error codes. +/// +enum cef_errorcode_t { + ERR_NONE = 0, + ERR_FAILED = -2, + ERR_ABORTED = -3, + ERR_INVALID_ARGUMENT = -4, + ERR_INVALID_HANDLE = -5, + ERR_FILE_NOT_FOUND = -6, + ERR_TIMED_OUT = -7, + ERR_FILE_TOO_BIG = -8, + ERR_UNEXPECTED = -9, + ERR_ACCESS_DENIED = -10, + ERR_NOT_IMPLEMENTED = -11, + ERR_CONNECTION_CLOSED = -100, + ERR_CONNECTION_RESET = -101, + ERR_CONNECTION_REFUSED = -102, + ERR_CONNECTION_ABORTED = -103, + ERR_CONNECTION_FAILED = -104, + ERR_NAME_NOT_RESOLVED = -105, + ERR_INTERNET_DISCONNECTED = -106, + ERR_SSL_PROTOCOL_ERROR = -107, + ERR_ADDRESS_INVALID = -108, + ERR_ADDRESS_UNREACHABLE = -109, + ERR_SSL_CLIENT_AUTH_CERT_NEEDED = -110, + ERR_TUNNEL_CONNECTION_FAILED = -111, + ERR_NO_SSL_VERSIONS_ENABLED = -112, + ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113, + ERR_SSL_RENEGOTIATION_REQUESTED = -114, + ERR_CERT_COMMON_NAME_INVALID = -200, + ERR_CERT_DATE_INVALID = -201, + ERR_CERT_AUTHORITY_INVALID = -202, + ERR_CERT_CONTAINS_ERRORS = -203, + ERR_CERT_NO_REVOCATION_MECHANISM = -204, + ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205, + ERR_CERT_REVOKED = -206, + ERR_CERT_INVALID = -207, + ERR_CERT_END = -208, + ERR_INVALID_URL = -300, + ERR_DISALLOWED_URL_SCHEME = -301, + ERR_UNKNOWN_URL_SCHEME = -302, + ERR_TOO_MANY_REDIRECTS = -310, + ERR_UNSAFE_REDIRECT = -311, + ERR_UNSAFE_PORT = -312, + ERR_INVALID_RESPONSE = -320, + ERR_INVALID_CHUNKED_ENCODING = -321, + ERR_METHOD_NOT_SUPPORTED = -322, + ERR_UNEXPECTED_PROXY_AUTH = -323, + ERR_EMPTY_RESPONSE = -324, + ERR_RESPONSE_HEADERS_TOO_BIG = -325, + ERR_CACHE_MISS = -400, + ERR_INSECURE_RESPONSE = -501, +}; + +/// +// V8 access control values. +/// +enum cef_v8_accesscontrol_t { + V8_ACCESS_CONTROL_DEFAULT = 0, + V8_ACCESS_CONTROL_ALL_CAN_READ = 1, + V8_ACCESS_CONTROL_ALL_CAN_WRITE = 1 << 1, + V8_ACCESS_CONTROL_PROHIBITS_OVERWRITING = 1 << 2 +}; + +/// +// V8 property attribute values. +/// +enum cef_v8_propertyattribute_t { + V8_PROPERTY_ATTRIBUTE_NONE = 0, // Writeable, Enumerable, + // Configurable + V8_PROPERTY_ATTRIBUTE_READONLY = 1 << 0, // Not writeable + V8_PROPERTY_ATTRIBUTE_DONTENUM = 1 << 1, // Not enumerable + V8_PROPERTY_ATTRIBUTE_DONTDELETE = 1 << 2 // Not configurable +}; + +/// +// Post data elements may represent either bytes or files. +/// +enum cef_postdataelement_type_t { + PDE_TYPE_EMPTY = 0, + PDE_TYPE_BYTES, + PDE_TYPE_FILE, +}; + +/// +// Flags used to customize the behavior of CefURLRequest. +/// +enum cef_urlrequest_flags_t { + /// + // Default behavior. + /// + UR_FLAG_NONE = 0, + + /// + // If set the cache will be skipped when handling the request. + /// + UR_FLAG_SKIP_CACHE = 1 << 0, + + /// + // If set user name, password, and cookies may be sent with the request. + /// + UR_FLAG_ALLOW_CACHED_CREDENTIALS = 1 << 1, + + /// + // If set cookies may be sent with the request and saved from the response. + // UR_FLAG_ALLOW_CACHED_CREDENTIALS must also be set. + /// + UR_FLAG_ALLOW_COOKIES = 1 << 2, + + /// + // If set upload progress events will be generated when a request has a body. + /// + UR_FLAG_REPORT_UPLOAD_PROGRESS = 1 << 3, + + /// + // If set load timing info will be collected for the request. + /// + UR_FLAG_REPORT_LOAD_TIMING = 1 << 4, + + /// + // If set the headers sent and received for the request will be recorded. + /// + UR_FLAG_REPORT_RAW_HEADERS = 1 << 5, + + /// + // If set the CefURLRequestClient::OnDownloadData method will not be called. + /// + UR_FLAG_NO_DOWNLOAD_DATA = 1 << 6, + + /// + // If set 5XX redirect errors will be propagated to the observer instead of + // automatically re-tried. This currently only applies for requests + // originated in the browser process. + /// + UR_FLAG_NO_RETRY_ON_5XX = 1 << 7, +}; + +/// +// Flags that represent CefURLRequest status. +/// +enum cef_urlrequest_status_t { + /// + // Unknown status. + /// + UR_UNKNOWN = 0, + + /// + // Request succeeded. + /// + UR_SUCCESS, + + /// + // An IO request is pending, and the caller will be informed when it is + // completed. + /// + UR_IO_PENDING, + + /// + // Request was successful but was handled by an external program, so there + // is no response data. This usually means the current page should not be + // navigated, but no error should be displayed. + /// + UR_HANDLED_EXTERNALLY, + + /// + // Request was canceled programatically. + /// + UR_CANCELED, + + /// + // Request failed for some reason. + /// + UR_FAILED, +}; + +/// +// Structure representing a rectangle. +/// +typedef struct _cef_rect_t { + int x; + int y; + int width; + int height; +} cef_rect_t; + +/// +// Existing process IDs. +/// +enum cef_process_id_t { + /// + // Browser process. + /// + PID_BROWSER, + /// + // Renderer process. + /// + PID_RENDERER, +}; + +/// +// Existing thread IDs. +/// +enum cef_thread_id_t { +// BROWSER PROCESS THREADS -- Only available in the browser process. + + /// + // The main thread in the browser. This will be the same as the main + // application thread if CefInitialize() is called with a + // CefSettings.multi_threaded_message_loop value of false. + /// + TID_UI, + + /// + // Used to interact with the database. + /// + TID_DB, + + /// + // Used to interact with the file system. + /// + TID_FILE, + + /// + // Used for file system operations that block user interactions. + // Responsiveness of this thread affects users. + /// + TID_FILE_USER_BLOCKING, + + /// + // Used to launch and terminate browser processes. + /// + TID_PROCESS_LAUNCHER, + + /// + // Used to handle slow HTTP cache operations. + /// + TID_CACHE, + + /// + // Used to process IPC and network messages. + /// + TID_IO, + +// RENDER PROCESS THREADS -- Only available in the render process. + + /// + // The main thread in the renderer. Used for all WebKit and V8 interaction. + /// + TID_RENDERER, +}; + +/// +// Supported value types. +/// +enum cef_value_type_t { + VTYPE_INVALID = 0, + VTYPE_NULL, + VTYPE_BOOL, + VTYPE_INT, + VTYPE_DOUBLE, + VTYPE_STRING, + VTYPE_BINARY, + VTYPE_DICTIONARY, + VTYPE_LIST, +}; + +/// +// Supported JavaScript dialog types. +/// +enum cef_jsdialog_type_t { + JSDIALOGTYPE_ALERT = 0, + JSDIALOGTYPE_CONFIRM, + JSDIALOGTYPE_PROMPT, +}; + +/// +// Supported menu IDs. Non-English translations can be provided for the +// IDS_MENU_* strings in CefResourceBundleHandler::GetLocalizedString(). +/// +enum cef_menu_id_t { + // Navigation. + MENU_ID_BACK = 100, + MENU_ID_FORWARD = 101, + MENU_ID_RELOAD = 102, + MENU_ID_RELOAD_NOCACHE = 103, + MENU_ID_STOPLOAD = 104, + + // Editing. + MENU_ID_UNDO = 110, + MENU_ID_REDO = 111, + MENU_ID_CUT = 112, + MENU_ID_COPY = 113, + MENU_ID_PASTE = 114, + MENU_ID_DELETE = 115, + MENU_ID_SELECT_ALL = 116, + + // Miscellaneous. + MENU_ID_FIND = 130, + MENU_ID_PRINT = 131, + MENU_ID_VIEW_SOURCE = 132, + + // All user-defined menu IDs should come between MENU_ID_USER_FIRST and + // MENU_ID_USER_LAST to avoid overlapping the Chromium and CEF ID ranges + // defined in the tools/gritsettings/resource_ids file. + MENU_ID_USER_FIRST = 26500, + MENU_ID_USER_LAST = 28500, +}; + +/// +// Supported event bit flags. +/// +enum cef_event_flags_t { + EVENTFLAG_NONE = 0, + EVENTFLAG_CAPS_LOCK_DOWN = 1 << 0, + EVENTFLAG_SHIFT_DOWN = 1 << 1, + EVENTFLAG_CONTROL_DOWN = 1 << 2, + EVENTFLAG_ALT_DOWN = 1 << 3, + EVENTFLAG_LEFT_MOUSE_BUTTON = 1 << 4, + EVENTFLAG_MIDDLE_MOUSE_BUTTON = 1 << 5, + EVENTFLAG_RIGHT_MOUSE_BUTTON = 1 << 6, + // Mac OS-X command key. + EVENTFLAG_COMMAND_DOWN = 1 << 7, + // Windows extended key (see WM_KEYDOWN doc). + EVENTFLAG_EXTENDED = 1 << 8, +}; + +/// +// Supported menu item types. +/// +enum cef_menu_item_type_t { + MENUITEMTYPE_NONE, + MENUITEMTYPE_COMMAND, + MENUITEMTYPE_CHECK, + MENUITEMTYPE_RADIO, + MENUITEMTYPE_SEPARATOR, + MENUITEMTYPE_SUBMENU, +}; + +/// +// Supported context menu type flags. +/// +enum cef_context_menu_type_flags_t { + /// + // No node is selected. + /// + CM_TYPEFLAG_NONE = 0, + /// + // The top page is selected. + /// + CM_TYPEFLAG_PAGE = 1 << 0, + /// + // A subframe page is selected. + /// + CM_TYPEFLAG_FRAME = 1 << 1, + /// + // A link is selected. + /// + CM_TYPEFLAG_LINK = 1 << 2, + /// + // A media node is selected. + /// + CM_TYPEFLAG_MEDIA = 1 << 3, + /// + // There is a textual or mixed selection that is selected. + /// + CM_TYPEFLAG_SELECTION = 1 << 4, + /// + // An editable element is selected. + /// + CM_TYPEFLAG_EDITABLE = 1 << 5, +}; + +/// +// Supported context menu media types. +/// +enum cef_context_menu_media_type_t { + /// + // No special node is in context. + /// + CM_MEDIATYPE_NONE, + /// + // An image node is selected. + /// + CM_MEDIATYPE_IMAGE, + /// + // A video node is selected. + /// + CM_MEDIATYPE_VIDEO, + /// + // An audio node is selected. + /// + CM_MEDIATYPE_AUDIO, + /// + // A file node is selected. + /// + CM_MEDIATYPE_FILE, + /// + // A plugin node is selected. + /// + CM_MEDIATYPE_PLUGIN, +}; + +/// +// Supported context menu media state bit flags. +/// +enum cef_context_menu_media_state_flags_t { + CM_MEDIAFLAG_NONE = 0, + CM_MEDIAFLAG_ERROR = 1 << 0, + CM_MEDIAFLAG_PAUSED = 1 << 1, + CM_MEDIAFLAG_MUTED = 1 << 2, + CM_MEDIAFLAG_LOOP = 1 << 3, + CM_MEDIAFLAG_CAN_SAVE = 1 << 4, + CM_MEDIAFLAG_HAS_AUDIO = 1 << 5, + CM_MEDIAFLAG_HAS_VIDEO = 1 << 6, + CM_MEDIAFLAG_CONTROL_ROOT_ELEMENT = 1 << 7, + CM_MEDIAFLAG_CAN_PRINT = 1 << 8, + CM_MEDIAFLAG_CAN_ROTATE = 1 << 9, +}; + +/// +// Supported context menu edit state bit flags. +/// +enum cef_context_menu_edit_state_flags_t { + CM_EDITFLAG_NONE = 0, + CM_EDITFLAG_CAN_UNDO = 1 << 0, + CM_EDITFLAG_CAN_REDO = 1 << 1, + CM_EDITFLAG_CAN_CUT = 1 << 2, + CM_EDITFLAG_CAN_COPY = 1 << 3, + CM_EDITFLAG_CAN_PASTE = 1 << 4, + CM_EDITFLAG_CAN_DELETE = 1 << 5, + CM_EDITFLAG_CAN_SELECT_ALL = 1 << 6, + CM_EDITFLAG_CAN_TRANSLATE = 1 << 7, +}; + +/// +// Key event types. +/// +enum cef_key_event_type_t { + KEYEVENT_RAWKEYDOWN = 0, + KEYEVENT_KEYDOWN, + KEYEVENT_KEYUP, + KEYEVENT_CHAR +}; + +/// +// Key event modifiers. +/// +enum cef_key_event_modifiers_t { + KEY_SHIFT = 1 << 0, + KEY_CTRL = 1 << 1, + KEY_ALT = 1 << 2, + KEY_META = 1 << 3, + KEY_KEYPAD = 1 << 4, // Only used on Mac OS-X +}; + +/// +// Structure representing keyboard event information. +/// +typedef struct _cef_key_event_t { + /// + // The type of keyboard event. + /// + cef_key_event_type_t type; + + /// + // Bit flags describing any pressed modifier keys. See + // cef_key_event_modifiers_t for values. + /// + int modifiers; + + /// + // The Windows key code for the key event. This value is used by the DOM + // specification. Sometimes it comes directly from the event (i.e. on + // Windows) and sometimes it's determined using a mapping function. See + // WebCore/platform/chromium/KeyboardCodes.h for the list of values. + /// + int windows_key_code; + + /// + // The actual key code genenerated by the platform. + /// + int native_key_code; + + /// + // Indicates whether the event is considered a "system key" event (see + // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for details). + // This value will always be false on non-Windows platforms. + /// + bool is_system_key; + + /// + // The character generated by the keystroke. + /// + char16 character; + + /// + // Same as |character| but unmodified by any concurrently-held modifiers + // (except shift). This is useful for working out shortcut keys. + /// + char16 unmodified_character; + + /// + // True if the focus is currently on an editable field on the page. This is + // useful for determining if standard key events should be intercepted. + /// + bool focus_on_editable_field; +} cef_key_event_t; + +/// +// Focus sources. +/// +enum cef_focus_source_t { + /// + // The source is explicit navigation via the API (LoadURL(), etc). + /// + FOCUS_SOURCE_NAVIGATION = 0, + /// + // The source is a system-generated focus event. + /// + FOCUS_SOURCE_SYSTEM, +}; + +/// +// Supported XML encoding types. The parser supports ASCII, ISO-8859-1, and +// UTF16 (LE and BE) by default. All other types must be translated to UTF8 +// before being passed to the parser. If a BOM is detected and the correct +// decoder is available then that decoder will be used automatically. +/// +enum cef_xml_encoding_type_t { + XML_ENCODING_NONE = 0, + XML_ENCODING_UTF8, + XML_ENCODING_UTF16LE, + XML_ENCODING_UTF16BE, + XML_ENCODING_ASCII, +}; + +/// +// XML node types. +/// +enum cef_xml_node_type_t { + XML_NODE_UNSUPPORTED = 0, + XML_NODE_PROCESSING_INSTRUCTION, + XML_NODE_DOCUMENT_TYPE, + XML_NODE_ELEMENT_START, + XML_NODE_ELEMENT_END, + XML_NODE_ATTRIBUTE, + XML_NODE_TEXT, + XML_NODE_CDATA, + XML_NODE_ENTITY_REFERENCE, + XML_NODE_WHITESPACE, + XML_NODE_COMMENT, +}; + +/// +// Status message types. +/// +enum cef_handler_statustype_t { + STATUSTYPE_TEXT = 0, + STATUSTYPE_MOUSEOVER_URL, + STATUSTYPE_KEYBOARD_FOCUS_URL, +}; + +/// +// Popup window features. +/// +typedef struct _cef_popup_features_t { + int x; + bool xSet; + int y; + bool ySet; + int width; + bool widthSet; + int height; + bool heightSet; + + bool menuBarVisible; + bool statusBarVisible; + bool toolBarVisible; + bool locationBarVisible; + bool scrollbarsVisible; + bool resizable; + + bool fullscreen; + bool dialog; + cef_string_list_t additionalFeatures; +} cef_popup_features_t; + +/// +// Proxy types. +/// +enum cef_proxy_type_t { + PROXY_TYPE_DIRECT = 0, + PROXY_TYPE_NAMED, + PROXY_TYPE_PAC_STRING, +}; + +/// +// Proxy information. +/// +typedef struct _cef_proxy_info_t { + enum cef_proxy_type_t proxyType; + cef_string_t proxyList; +} cef_proxy_info_t; + +/// +// DOM document types. +/// +enum cef_dom_document_type_t { + DOM_DOCUMENT_TYPE_UNKNOWN = 0, + DOM_DOCUMENT_TYPE_HTML, + DOM_DOCUMENT_TYPE_XHTML, + DOM_DOCUMENT_TYPE_PLUGIN, +}; + +/// +// DOM event category flags. +/// +enum cef_dom_event_category_t { + DOM_EVENT_CATEGORY_UNKNOWN = 0x0, + DOM_EVENT_CATEGORY_UI = 0x1, + DOM_EVENT_CATEGORY_MOUSE = 0x2, + DOM_EVENT_CATEGORY_MUTATION = 0x4, + DOM_EVENT_CATEGORY_KEYBOARD = 0x8, + DOM_EVENT_CATEGORY_TEXT = 0x10, + DOM_EVENT_CATEGORY_COMPOSITION = 0x20, + DOM_EVENT_CATEGORY_DRAG = 0x40, + DOM_EVENT_CATEGORY_CLIPBOARD = 0x80, + DOM_EVENT_CATEGORY_MESSAGE = 0x100, + DOM_EVENT_CATEGORY_WHEEL = 0x200, + DOM_EVENT_CATEGORY_BEFORE_TEXT_INSERTED = 0x400, + DOM_EVENT_CATEGORY_OVERFLOW = 0x800, + DOM_EVENT_CATEGORY_PAGE_TRANSITION = 0x1000, + DOM_EVENT_CATEGORY_POPSTATE = 0x2000, + DOM_EVENT_CATEGORY_PROGRESS = 0x4000, + DOM_EVENT_CATEGORY_XMLHTTPREQUEST_PROGRESS = 0x8000, + DOM_EVENT_CATEGORY_WEBKIT_ANIMATION = 0x10000, + DOM_EVENT_CATEGORY_WEBKIT_TRANSITION = 0x20000, + DOM_EVENT_CATEGORY_BEFORE_LOAD = 0x40000, +}; + +/// +// DOM event processing phases. +/// +enum cef_dom_event_phase_t { + DOM_EVENT_PHASE_UNKNOWN = 0, + DOM_EVENT_PHASE_CAPTURING, + DOM_EVENT_PHASE_AT_TARGET, + DOM_EVENT_PHASE_BUBBLING, +}; + +/// +// DOM node types. +/// +enum cef_dom_node_type_t { + DOM_NODE_TYPE_UNSUPPORTED = 0, + DOM_NODE_TYPE_ELEMENT, + DOM_NODE_TYPE_ATTRIBUTE, + DOM_NODE_TYPE_TEXT, + DOM_NODE_TYPE_CDATA_SECTION, + DOM_NODE_TYPE_ENTITY_REFERENCE, + DOM_NODE_TYPE_ENTITY, + DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS, + DOM_NODE_TYPE_COMMENT, + DOM_NODE_TYPE_DOCUMENT, + DOM_NODE_TYPE_DOCUMENT_TYPE, + DOM_NODE_TYPE_DOCUMENT_FRAGMENT, + DOM_NODE_TYPE_NOTATION, + DOM_NODE_TYPE_XPATH_NAMESPACE, +}; + + +#ifdef __cplusplus +} +#endif + +#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_H_ diff --git a/cef/include/internal/cef_types_linux.h b/include/internal/cef_types_linux.h similarity index 81% rename from cef/include/internal/cef_types_linux.h rename to include/internal/cef_types_linux.h index 15966907e..e92c5d0b5 100644 --- a/cef/include/internal/cef_types_linux.h +++ b/include/internal/cef_types_linux.h @@ -42,43 +42,30 @@ extern "C" { #endif -// Window handle. +// Handle types. +#define cef_cursor_handle_t GtkCursor* +#define cef_event_handle_t GdkEvent* #define cef_window_handle_t GtkWidget* -#define cef_cursor_handle_t void* /// -// Supported graphics implementations. +// Structure representing CefExecuteProcess arguments. /// -enum cef_graphics_implementation_t { - DESKTOP_IN_PROCESS = 0, - DESKTOP_IN_PROCESS_COMMAND_BUFFER, -}; +typedef struct _cef_main_args_t { + int argc; + char** argv; +} cef_main_args_t; /// // Class representing window information. /// typedef struct _cef_window_info_t { // Pointer for the parent GtkBox widget. - cef_window_handle_t m_ParentWidget; + cef_window_handle_t parent_widget; // Pointer for the new browser widget. - cef_window_handle_t m_Widget; + cef_window_handle_t widget; } cef_window_info_t; -/// -// Class representing print context information. -/// -typedef struct _cef_print_info_t { - double m_Scale; -} cef_print_info_t; - -/// -// Class representing key information. -/// -typedef struct _cef_key_info_t { - int key; -} cef_key_info_t; - #ifdef __cplusplus } #endif diff --git a/include/internal/cef_types_mac.h b/include/internal/cef_types_mac.h new file mode 100644 index 000000000..44863bd4b --- /dev/null +++ b/include/internal/cef_types_mac.h @@ -0,0 +1,96 @@ +// Copyright (c) 2010 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +#ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_ +#define CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_ +#pragma once + +#include "include/internal/cef_build.h" + +#if defined(OS_MACOSX) +#include "include/internal/cef_string.h" + +// Handle types. +#ifdef __cplusplus +#ifdef __OBJC__ +@class NSCursor; +@class NSEvent; +@class NSView; +#else +class NSCursor; +class NSEvent; +struct NSView; +#endif +#define cef_cursor_handle_t NSCursor* +#define cef_event_handle_t NSEvent* +#define cef_window_handle_t NSView* +#else +#define cef_cursor_handle_t void* +#define cef_event_handle_t void* +#define cef_window_handle_t void* +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/// +// Structure representing CefExecuteProcess arguments. +/// +typedef struct _cef_main_args_t { + int argc; + char** argv; +} cef_main_args_t; + +/// +// Class representing window information. +/// +typedef struct _cef_window_info_t { + cef_string_t window_name; + int x; + int y; + int width; + int height; + int hidden; + + // NSView pointer for the parent view. + cef_window_handle_t parent_view; + + // NSView pointer for the new browser view. + cef_window_handle_t view; +} cef_window_info_t; + +#ifdef __cplusplus +} +#endif + +#endif // OS_MACOSX + +#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_ diff --git a/include/internal/cef_types_win.h b/include/internal/cef_types_win.h new file mode 100644 index 000000000..136b89744 --- /dev/null +++ b/include/internal/cef_types_win.h @@ -0,0 +1,85 @@ +// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +#ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_WIN_H_ +#define CEF_INCLUDE_INTERNAL_CEF_TYPES_WIN_H_ +#pragma once + +#include "include/internal/cef_build.h" + +#if defined(OS_WIN) +#include +#include "include/internal/cef_string.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Handle types. +#define cef_cursor_handle_t HCURSOR +#define cef_event_handle_t MSG* +#define cef_window_handle_t HWND + +/// +// Structure representing CefExecuteProcess arguments. +/// +typedef struct _cef_main_args_t { + HINSTANCE instance; +} cef_main_args_t; + +/// +// Structure representing window information. +/// +typedef struct _cef_window_info_t { + // Standard parameters required by CreateWindowEx() + DWORD ex_style; + cef_string_t window_name; + DWORD style; + int x; + int y; + int width; + int height; + cef_window_handle_t parent_window; + HMENU menu; + + // Set to true to enable transparent painting. + BOOL transparent_painting; + + // Handle for the new browser window. + cef_window_handle_t window; +} cef_window_info_t; + +#ifdef __cplusplus +} +#endif + +#endif // OS_WIN + +#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_WIN_H_ diff --git a/cef/include/internal/cef_types_wrappers.h b/include/internal/cef_types_wrappers.h similarity index 87% rename from cef/include/internal/cef_types_wrappers.h rename to include/internal/cef_types_wrappers.h index 2f1cbd9c5..115a4cc4b 100644 --- a/cef/include/internal/cef_types_wrappers.h +++ b/include/internal/cef_types_wrappers.h @@ -174,24 +174,30 @@ inline bool operator!=(const CefRect& a, const CefRect& b) { return !(a == b); } - -struct CefPrintOptionsTraits { - typedef cef_print_options_t struct_type; +struct CefKeyEventTraits { + typedef cef_key_event_t struct_type; static inline void init(struct_type* s) {} + static inline void clear(struct_type* s) {} static inline void set(const struct_type* src, struct_type* target, bool copy) { - *target = *src; + target->type = src->type; + target->modifiers = src->modifiers; + target->windows_key_code = src->windows_key_code; + target->native_key_code = src->native_key_code; + target->is_system_key = src->is_system_key; + target->character = src->character; + target->unmodified_character = src->unmodified_character; + target->focus_on_editable_field = src->focus_on_editable_field; } }; /// -// Class representing print options. +// Class representing a a keyboard event. /// -typedef CefStructBase CefPrintOptions; - +typedef CefStructBase CefKeyEvent; struct CefPopupFeaturesTraits { @@ -251,12 +257,11 @@ struct CefSettingsTraits { } static inline void clear(struct_type* s) { + cef_string_clear(&s->browser_subprocess_path); cef_string_clear(&s->cache_path); cef_string_clear(&s->user_agent); cef_string_clear(&s->product_version); cef_string_clear(&s->locale); - if (s->extra_plugin_paths) - cef_string_list_free(s->extra_plugin_paths); cef_string_clear(&s->log_file); cef_string_clear(&s->javascript_flags); cef_string_clear(&s->pack_file_path); @@ -265,7 +270,12 @@ struct CefSettingsTraits { static inline void set(const struct_type* src, struct_type* target, bool copy) { + target->single_process = src->single_process; + cef_string_set(src->browser_subprocess_path.str, + src->browser_subprocess_path.length, + &target->browser_subprocess_path, copy); target->multi_threaded_message_loop = src->multi_threaded_message_loop; + target->command_line_args_disabled = src->command_line_args_disabled; cef_string_set(src->cache_path.str, src->cache_path.length, &target->cache_path, copy); @@ -275,30 +285,21 @@ struct CefSettingsTraits { &target->product_version, copy); cef_string_set(src->locale.str, src->locale.length, &target->locale, copy); - if (target->extra_plugin_paths) - cef_string_list_free(target->extra_plugin_paths); - target->extra_plugin_paths = src->extra_plugin_paths ? - cef_string_list_copy(src->extra_plugin_paths) : NULL; - cef_string_set(src->log_file.str, src->log_file.length, &target->log_file, copy); target->log_severity = src->log_severity; - target->graphics_implementation = src->graphics_implementation; - target->local_storage_quota = src->local_storage_quota; - target->session_storage_quota = src->session_storage_quota; cef_string_set(src->javascript_flags.str, src->javascript_flags.length, &target->javascript_flags, copy); -#if defined(OS_WIN) target->auto_detect_proxy_settings_enabled = src->auto_detect_proxy_settings_enabled; -#endif cef_string_set(src->pack_file_path.str, src->pack_file_path.length, &target->pack_file_path, copy); cef_string_set(src->locales_dir_path.str, src->locales_dir_path.length, &target->locales_dir_path, copy); target->pack_loading_disabled = src->pack_loading_disabled; + target->remote_debugging_port = src->remote_debugging_port; } }; @@ -328,10 +329,6 @@ struct CefBrowserSettingsTraits { static inline void set(const struct_type* src, struct_type* target, bool copy) { - target->drag_drop_disabled = src->drag_drop_disabled; - target->load_drops_disabled = src->load_drops_disabled; - target->history_disabled = src->history_disabled; - cef_string_set(src->standard_font_family.str, src->standard_font_family.length, &target->standard_font_family, copy); cef_string_set(src->fixed_font_family.str, src->fixed_font_family.length, @@ -393,15 +390,14 @@ struct CefBrowserSettingsTraits { target->databases_disabled = src->databases_disabled; target->application_cache_disabled = src->application_cache_disabled; target->webgl_disabled = src->webgl_disabled; - target->accelerated_compositing_enabled = - src->accelerated_compositing_enabled; - target->threaded_compositing_enabled = src->threaded_compositing_enabled; + target->accelerated_compositing_disabled = + src->accelerated_compositing_disabled; target->accelerated_layers_disabled = src->accelerated_layers_disabled; target->accelerated_video_disabled = src->accelerated_video_disabled; target->accelerated_2d_canvas_disabled = src->accelerated_2d_canvas_disabled; - target->accelerated_painting_disabled = src->accelerated_painting_disabled; - target->accelerated_filters_disabled = src->accelerated_filters_disabled; + target->accelerated_painting_enabled = src->accelerated_painting_enabled; + target->accelerated_filters_enabled = src->accelerated_filters_enabled; target->accelerated_plugins_disabled = src->accelerated_plugins_disabled; target->developer_tools_disabled = src->developer_tools_disabled; target->fullscreen_enabled = src->fullscreen_enabled; @@ -534,52 +530,6 @@ struct CefCookieTraits { typedef CefStructBase CefCookie; -struct CefMenuInfoTraits { - typedef cef_menu_info_t struct_type; - - static inline void init(struct_type* s) {} - - static inline void clear(struct_type* s) { - cef_string_clear(&s->linkUrl); - cef_string_clear(&s->imageUrl); - cef_string_clear(&s->pageUrl); - cef_string_clear(&s->frameUrl); - cef_string_clear(&s->selectionText); - cef_string_clear(&s->misspelledWord); - cef_string_clear(&s->securityInfo); - } - - static inline void set(const struct_type* src, struct_type* target, - bool copy) { - target->typeFlags = src->typeFlags; - target->x = src->x; - target->y = src->y; - - cef_string_set(src->linkUrl.str, src->linkUrl.length, - &target->linkUrl, copy); - cef_string_set(src->imageUrl.str, src->imageUrl.length, - &target->imageUrl, copy); - cef_string_set(src->pageUrl.str, src->pageUrl.length, - &target->pageUrl, copy); - cef_string_set(src->frameUrl.str, src->frameUrl.length, - &target->frameUrl, copy); - cef_string_set(src->selectionText.str, src->selectionText.length, - &target->selectionText, copy); - cef_string_set(src->misspelledWord.str, src->misspelledWord.length, - &target->misspelledWord, copy); - cef_string_set(src->securityInfo.str, src->securityInfo.length, - &target->securityInfo, copy); - - target->editFlags = src->editFlags; - } -}; - -/// -// Class representing menu info. -/// -typedef CefStructBase CefMenuInfo; - - struct CefProxyInfoTraits { typedef cef_proxy_info_t struct_type; diff --git a/include/internal/cef_win.h b/include/internal/cef_win.h new file mode 100644 index 000000000..1115bd161 --- /dev/null +++ b/include/internal/cef_win.h @@ -0,0 +1,166 @@ +// Copyright (c) 2008 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +#ifndef CEF_INCLUDE_INTERNAL_CEF_WIN_H_ +#define CEF_INCLUDE_INTERNAL_CEF_WIN_H_ +#pragma once + +#if defined(OS_WIN) +#include +#include "include/internal/cef_types_win.h" +#include "include/internal/cef_types_wrappers.h" + +/// +// Atomic increment and decrement. +/// +#define CefAtomicIncrement(p) InterlockedIncrement(p) +#define CefAtomicDecrement(p) InterlockedDecrement(p) + +/// +// Critical section wrapper. +/// +class CefCriticalSection { + public: + CefCriticalSection() { + memset(&m_sec, 0, sizeof(CRITICAL_SECTION)); + InitializeCriticalSection(&m_sec); + } + virtual ~CefCriticalSection() { + DeleteCriticalSection(&m_sec); + } + void Lock() { + EnterCriticalSection(&m_sec); + } + void Unlock() { + LeaveCriticalSection(&m_sec); + } + + CRITICAL_SECTION m_sec; +}; + +/// +// Handle types. +/// +#define CefCursorHandle cef_cursor_handle_t +#define CefEventHandle cef_event_handle_t +#define CefWindowHandle cef_window_handle_t + +struct CefMainArgsTraits { + typedef cef_main_args_t struct_type; + + static inline void init(struct_type* s) {} + static inline void clear(struct_type* s) {} + + static inline void set(const struct_type* src, struct_type* target, + bool copy) { + target->instance = src->instance; + } +}; + +// Class representing CefExecuteProcess arguments. +class CefMainArgs : public CefStructBase { + public: + typedef CefStructBase parent; + + CefMainArgs() : parent() {} + explicit CefMainArgs(const cef_main_args_t& r) : parent(r) {} + explicit CefMainArgs(const CefMainArgs& r) : parent(r) {} + explicit CefMainArgs(HINSTANCE hInstance) : parent() { + instance = hInstance; + } +}; + +struct CefWindowInfoTraits { + typedef cef_window_info_t struct_type; + + static inline void init(struct_type* s) {} + + static inline void clear(struct_type* s) { + cef_string_clear(&s->window_name); + } + + static inline void set(const struct_type* src, struct_type* target, + bool copy) { + target->ex_style = src->ex_style; + cef_string_set(src->window_name.str, src->window_name.length, + &target->window_name, copy); + target->style = src->style; + target->x = src->x; + target->y = src->y; + target->width = src->width; + target->height = src->height; + target->parent_window = src->parent_window; + target->menu = src->menu; + target->window = src->window; + target->transparent_painting = src->transparent_painting; + } +}; + +/// +// Class representing window information. +/// +class CefWindowInfo : public CefStructBase { + public: + typedef CefStructBase parent; + + CefWindowInfo() : parent() {} + explicit CefWindowInfo(const cef_window_info_t& r) : parent(r) {} + explicit CefWindowInfo(const CefWindowInfo& r) : parent(r) {} + + void SetAsChild(HWND hWndParent, RECT windowRect) { + style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_TABSTOP | + WS_VISIBLE; + parent_window = hWndParent; + x = windowRect.left; + y = windowRect.top; + width = windowRect.right - windowRect.left; + height = windowRect.bottom - windowRect.top; + } + + void SetAsPopup(HWND hWndParent, const CefString& windowName) { + style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | + WS_VISIBLE; + parent_window = hWndParent; + x = CW_USEDEFAULT; + y = CW_USEDEFAULT; + width = CW_USEDEFAULT; + height = CW_USEDEFAULT; + + cef_string_copy(windowName.c_str(), windowName.length(), &window_name); + } + + void SetTransparentPainting(BOOL transparentPainting) { + transparent_painting = transparentPainting; + } +}; + +#endif // OS_WIN + +#endif // CEF_INCLUDE_INTERNAL_CEF_WIN_H_ diff --git a/cef/include/wrapper/cef_byte_read_handler.h b/include/wrapper/cef_byte_read_handler.h similarity index 82% rename from cef/include/wrapper/cef_byte_read_handler.h rename to include/wrapper/cef_byte_read_handler.h index f7ca7a15a..1752588de 100644 --- a/cef/include/wrapper/cef_byte_read_handler.h +++ b/include/wrapper/cef_byte_read_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -51,29 +51,15 @@ class CefByteReadHandler : public CefReadHandler { // reference can be kept to keep the underlying data source from being // released while the reader exists. /// - CefByteReadHandler(const unsigned char* bytes, size_t size, + CefByteReadHandler(const unsigned char* bytes, + size_t size, CefRefPtr source); - /// - // Read raw binary data. - /// - virtual size_t Read(void* ptr, size_t size, size_t n); - - /// - // Seek to the specified offset position. |whence| may be any one of - // SEEK_CUR, SEEK_END or SEEK_SET. - /// - virtual int Seek(int64 offset, int whence); - - /// - // Return the current offset position. - /// - virtual int64 Tell(); - - /// - // Return non-zero if at end of file. - /// - virtual int Eof(); + // CefReadHandler methods. + virtual size_t Read(void* ptr, size_t size, size_t n) OVERRIDE; + virtual int Seek(int64 offset, int whence) OVERRIDE; + virtual int64 Tell() OVERRIDE; + virtual int Eof() OVERRIDE; private: const unsigned char* bytes_; diff --git a/include/wrapper/cef_stream_resource_handler.h b/include/wrapper/cef_stream_resource_handler.h new file mode 100644 index 000000000..181bbbfe8 --- /dev/null +++ b/include/wrapper/cef_stream_resource_handler.h @@ -0,0 +1,85 @@ +// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// The contents of this file are only available to applications that link +// against the libcef_dll_wrapper target. +// + +#ifndef CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_ +#define CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_ +#pragma once + +#include "include/cef_base.h" +#include "include/cef_resource_handler.h" +#include "include/cef_response.h" + +class CefStreamReader; + +/// +// Implementation of the CefResourceHandler class for reading from a CefStream. +/// +class CefStreamResourceHandler : public CefResourceHandler { + public: + /// + // Create a new object with default response values. + /// + CefStreamResourceHandler(const CefString& mime_type, + CefRefPtr stream); + /// + // Create a new object with explicit response values. + /// + CefStreamResourceHandler(int status_code, + const CefString& mime_type, + CefResponse::HeaderMap header_map, + CefRefPtr stream); + + // CefStreamResourceHandler methods. + virtual bool ProcessRequest(CefRefPtr request, + CefRefPtr callback) OVERRIDE; + virtual void GetResponseHeaders(CefRefPtr response, + int64& response_length, + CefString& redirectUrl) OVERRIDE; + virtual bool ReadResponse(void* data_out, + int bytes_to_read, + int& bytes_read, + CefRefPtr callback) OVERRIDE; + virtual void Cancel() OVERRIDE; + + private: + int status_code_; + CefString mime_type_; + CefResponse::HeaderMap header_map_; + CefRefPtr stream_; + + IMPLEMENT_REFCOUNTING(CefStreamResourceHandler); +}; + +#endif // CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_ diff --git a/cef/include/wrapper/cef_xml_object.h b/include/wrapper/cef_xml_object.h similarity index 100% rename from cef/include/wrapper/cef_xml_object.h rename to include/wrapper/cef_xml_object.h diff --git a/cef/include/wrapper/cef_zip_archive.h b/include/wrapper/cef_zip_archive.h similarity index 100% rename from cef/include/wrapper/cef_zip_archive.h rename to include/wrapper/cef_zip_archive.h diff --git a/index.html b/index.html deleted file mode 100644 index cca81e569..000000000 --- a/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - diff --git a/libcef/browser/application_mac.h b/libcef/browser/application_mac.h new file mode 100644 index 000000000..440cbf180 --- /dev/null +++ b/libcef/browser/application_mac.h @@ -0,0 +1,11 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_APPLICATION_MAC_H_ +#define CEF_LIBCEF_BROWSER_APPLICATION_MAC_H_ + +// Create the CefCrApplication instance used by secondary processes. +void CefCrApplicationCreate(); + +#endif // CEF_LIBCEF_BROWSER_APPLICATION_MAC_H_ diff --git a/libcef/browser/application_mac.mm b/libcef/browser/application_mac.mm new file mode 100644 index 000000000..ad85cf8fa --- /dev/null +++ b/libcef/browser/application_mac.mm @@ -0,0 +1,46 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/application_mac.h" + +#include "base/message_pump_mac.h" +#include "base/mac/scoped_sending_event.h" + +@interface CefCrApplication : NSApplication { + @private + BOOL handlingSendEvent_; +} + +// CrAppProtocol: +- (BOOL)isHandlingSendEvent; + +// CrAppControlProtocol: +- (void)setHandlingSendEvent:(BOOL)handlingSendEvent; + +@end + +@implementation CefCrApplication + +- (BOOL)isHandlingSendEvent { + return handlingSendEvent_; +} + +- (void)sendEvent:(NSEvent*)event { + BOOL wasHandlingSendEvent = handlingSendEvent_; + handlingSendEvent_ = YES; + [super sendEvent:event]; + handlingSendEvent_ = wasHandlingSendEvent; +} + +- (void)setHandlingSendEvent:(BOOL)handlingSendEvent { + handlingSendEvent_ = handlingSendEvent; +} + +@end + +void CefCrApplicationCreate() { + [CefCrApplication sharedApplication]; +} diff --git a/libcef/browser/browser_context.cc b/libcef/browser/browser_context.cc new file mode 100644 index 000000000..56e53d58e --- /dev/null +++ b/libcef/browser/browser_context.cc @@ -0,0 +1,260 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/browser_context.h" + +#include + +#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/context.h" +#include "libcef/browser/download_manager_delegate.h" +#include "libcef/browser/resource_context.h" +#include "libcef/browser/thread_util.h" +#include "libcef/browser/url_request_context_getter.h" + +#include "base/bind.h" +#include "base/logging.h" +#include "base/threading/thread.h" +#include "content/public/browser/download_manager.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/geolocation_permission_context.h" +#include "content/public/browser/speech_recognition_preferences.h" + +using content::BrowserThread; + +namespace { + +class CefGeolocationPermissionContext + : public content::GeolocationPermissionContext { + public: + // CefGeolocationCallback implementation. + class CallbackImpl : public CefGeolocationCallback { + public: + typedef base::Callback // NOLINT(readability/function) + CallbackType; + + explicit CallbackImpl( + CefGeolocationPermissionContext* context, + int bridge_id, + const CallbackType& callback) + : context_(context), + bridge_id_(bridge_id), + callback_(callback) {} + + virtual void Continue(bool allow) OVERRIDE { + if (CEF_CURRENTLY_ON_IOT()) { + if (!callback_.is_null()) { + // Callback must be executed on the UI thread. + CEF_POST_TASK(CEF_UIT, + base::Bind(&CallbackImpl::Run, callback_, allow)); + context_->RemoveCallback(bridge_id_); + } + } else { + CEF_POST_TASK(CEF_IOT, + base::Bind(&CallbackImpl::Continue, this, allow)); + } + } + + void Disconnect() { + callback_.Reset(); + context_ = NULL; + } + + private: + static void Run(const CallbackType& callback, bool allow) { + CEF_REQUIRE_UIT(); + callback.Run(allow); + } + + CefGeolocationPermissionContext* context_; + int bridge_id_; + CallbackType callback_; + + IMPLEMENT_REFCOUNTING(CallbackImpl); + }; + + CefGeolocationPermissionContext() {} + + virtual void RequestGeolocationPermission( + int render_process_id, + int render_view_id, + int bridge_id, + const GURL& requesting_frame, + base::Callback callback) // NOLINT(readability/function) + OVERRIDE { + CEF_REQUIRE_IOT(); + + CefRefPtr browser = + CefBrowserHostImpl::GetBrowserByRoutingID(render_process_id, + render_view_id); + if (browser.get()) { + CefRefPtr client = browser->GetClient(); + if (client.get()) { + CefRefPtr handler = + client->GetGeolocationHandler(); + if (handler.get()) { + CefRefPtr callbackPtr( + new CallbackImpl(this, bridge_id, callback)); + + // Add the callback reference to the map. + callback_map_.insert(std::make_pair(bridge_id, callbackPtr)); + + // Notify the handler. + handler->OnRequestGeolocationPermission(browser.get(), + requesting_frame.spec(), bridge_id, callbackPtr.get()); + return; + } + } + } + + // Disallow geolocation access by default. + callback.Run(false); + } + + virtual void CancelGeolocationPermissionRequest( + int render_process_id, + int render_view_id, + int bridge_id, + const GURL& requesting_frame) OVERRIDE { + RemoveCallback(bridge_id); + + CefRefPtr browser = + CefBrowserHostImpl::GetBrowserByRoutingID(render_process_id, + render_view_id); + if (browser.get()) { + CefRefPtr client = browser->GetClient(); + if (client.get()) { + CefRefPtr handler = + client->GetGeolocationHandler(); + if (handler.get()) { + // Notify the handler. + handler->OnCancelGeolocationPermission(browser.get(), + requesting_frame.spec(), bridge_id); + } + } + } + } + + void RemoveCallback(int bridge_id) { + CEF_REQUIRE_IOT(); + + // Disconnect the callback and remove the reference from the map. + CallbackMap::iterator it = callback_map_.find(bridge_id); + if (it != callback_map_.end()) { + it->second->Disconnect(); + callback_map_.erase(it); + } + } + + private: + // Map of bridge ids to callback references. + typedef std::map > CallbackMap; + CallbackMap callback_map_; + + DISALLOW_COPY_AND_ASSIGN(CefGeolocationPermissionContext); +}; + +class CefSpeechRecognitionPreferences + : public content::SpeechRecognitionPreferences { + public: + CefSpeechRecognitionPreferences() { + } + + // Overridden from SpeechRecognitionPreferences: + virtual bool FilterProfanities() const OVERRIDE { + return false; + } + + private: + DISALLOW_COPY_AND_ASSIGN(CefSpeechRecognitionPreferences); +}; + +} // namespace + +CefBrowserContext::CefBrowserContext() { + // Initialize the request context getter. + url_request_getter_ = new CefURLRequestContextGetter( + GetPath(), + BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO), + BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE)); +} + +CefBrowserContext::~CefBrowserContext() { + // Clear the download manager delegate here because otherwise we'll crash + // when it's accessed from the content::BrowserContext destructor. + if (download_manager_delegate_.get()) + BrowserContext::GetDownloadManager(this)->SetDelegate(NULL); + + if (resource_context_.get()) { + BrowserThread::DeleteSoon( + BrowserThread::IO, FROM_HERE, resource_context_.release()); + } +} + +FilePath CefBrowserContext::GetPath() { + return _Context->cache_path(); +} + +bool CefBrowserContext::IsOffTheRecord() const { + return false; +} + +content::DownloadManagerDelegate* + CefBrowserContext::GetDownloadManagerDelegate() { + DCHECK(!download_manager_delegate_.get()); + + download_manager_delegate_ = new CefDownloadManagerDelegate(); + return download_manager_delegate_.get(); +} + +net::URLRequestContextGetter* CefBrowserContext::GetRequestContext() { + return url_request_getter_; +} + +net::URLRequestContextGetter* + CefBrowserContext::GetRequestContextForRenderProcess( + int renderer_child_id) { + CefRefPtr browser = + CefBrowserHostImpl::GetBrowserByChildID(renderer_child_id); + if (browser.get()) + return browser->GetRequestContext(); + return GetRequestContext(); +} + +net::URLRequestContextGetter* + CefBrowserContext::GetRequestContextForMedia() { + return GetRequestContext(); +} + +content::ResourceContext* CefBrowserContext::GetResourceContext() { + if (!resource_context_.get()) { + resource_context_.reset(new CefResourceContext( + static_cast(GetRequestContext()))); + } + return resource_context_.get(); +} + +content::GeolocationPermissionContext* + CefBrowserContext::GetGeolocationPermissionContext() { + if (!geolocation_permission_context_) { + geolocation_permission_context_ = + new CefGeolocationPermissionContext(); + } + return geolocation_permission_context_; +} + +content::SpeechRecognitionPreferences* + CefBrowserContext::GetSpeechRecognitionPreferences() { + if (!speech_recognition_preferences_.get()) + speech_recognition_preferences_ = new CefSpeechRecognitionPreferences(); + return speech_recognition_preferences_.get(); +} + +bool CefBrowserContext::DidLastSessionExitCleanly() { + return true; +} + +quota::SpecialStoragePolicy* CefBrowserContext::GetSpecialStoragePolicy() { + return NULL; +} diff --git a/libcef/browser/browser_context.h b/libcef/browser/browser_context.h new file mode 100644 index 000000000..771f59fea --- /dev/null +++ b/libcef/browser/browser_context.h @@ -0,0 +1,57 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_H_ +#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_H_ +#pragma once + +#include "base/compiler_specific.h" +#include "base/file_path.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" +#include "content/public/browser/browser_context.h" + +namespace content { +class DownloadManagerDelegate; +class SpeechRecognitionPreferences; +} + +class CefDownloadManagerDelegate; +class CefResourceContext; + +class CefBrowserContext : public content::BrowserContext { + public: + CefBrowserContext(); + virtual ~CefBrowserContext(); + + // BrowserContext methods. + virtual FilePath GetPath() OVERRIDE; + virtual bool IsOffTheRecord() const OVERRIDE; + virtual content::DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE; + virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; + virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( + int renderer_child_id) OVERRIDE; + virtual net::URLRequestContextGetter* GetRequestContextForMedia() OVERRIDE; + virtual content::ResourceContext* GetResourceContext() OVERRIDE; + virtual content::GeolocationPermissionContext* + GetGeolocationPermissionContext() OVERRIDE; + virtual content::SpeechRecognitionPreferences* + GetSpeechRecognitionPreferences() OVERRIDE; + virtual bool DidLastSessionExitCleanly() OVERRIDE; + virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE; + + private: + + scoped_ptr resource_context_; + scoped_refptr download_manager_delegate_; + scoped_refptr url_request_getter_; + scoped_refptr + geolocation_permission_context_; + scoped_refptr + speech_recognition_preferences_; + + DISALLOW_COPY_AND_ASSIGN(CefBrowserContext); +}; + +#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_H_ diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc new file mode 100644 index 000000000..6317296ed --- /dev/null +++ b/libcef/browser/browser_host_impl.cc @@ -0,0 +1,1566 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/browser_host_impl.h" + +#include +#include + +#include "libcef/browser/browser_context.h" +#include "libcef/browser/context.h" +#include "libcef/browser/devtools_delegate.h" +#include "libcef/browser/navigate_params.h" +#include "libcef/browser/thread_util.h" +#include "libcef/browser/url_request_context_getter.h" +#include "libcef/browser/url_request_context_getter_proxy.h" +#include "libcef/common/cef_messages.h" +#include "libcef/common/http_header_utils.h" +#include "libcef/common/main_delegate.h" +#include "libcef/common/process_message_impl.h" +#include "libcef/common/request_impl.h" + +#include "base/bind.h" +#include "base/bind_helpers.h" +#include "content/browser/renderer_host/render_view_host_impl.h" +#include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/browser/native_web_keyboard_event.h" +#include "content/public/browser/navigation_controller.h" +#include "content/public/browser/navigation_entry.h" +#include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_source.h" +#include "content/public/browser/notification_types.h" +#include "content/public/browser/resource_request_info.h" +#include "content/public/common/file_chooser_params.h" +#include "content/public/common/selected_file_info.h" + +namespace { + +class CreateBrowserHelper { + public: + CreateBrowserHelper(const CefWindowInfo& windowInfo, + CefRefPtr client, + const CefString& url, + const CefBrowserSettings& settings) + : window_info_(windowInfo), + client_(client), + url_(url), + settings_(settings) {} + + CefWindowInfo window_info_; + CefRefPtr client_; + CefString url_; + CefBrowserSettings settings_; +}; + +void CreateBrowserWithHelper(CreateBrowserHelper* helper) { + CefBrowserHost::CreateBrowserSync(helper->window_info_, helper->client_, + helper->url_, helper->settings_); + delete helper; +} + +// Convert a NativeWebKeyboardEvent to a CefKeyEvent. +bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event, + CefKeyEvent& cef_event) { + switch (event.type) { + case WebKit::WebKeyboardEvent::RawKeyDown: + cef_event.type = KEYEVENT_RAWKEYDOWN; + break; + case WebKit::WebKeyboardEvent::KeyDown: + cef_event.type = KEYEVENT_KEYDOWN; + break; + case WebKit::WebKeyboardEvent::KeyUp: + cef_event.type = KEYEVENT_KEYUP; + break; + case WebKit::WebKeyboardEvent::Char: + cef_event.type = KEYEVENT_CHAR; + break; + default: + return false; + } + + cef_event.modifiers = 0; + if (event.modifiers & WebKit::WebKeyboardEvent::ShiftKey) + cef_event.modifiers |= KEY_SHIFT; + if (event.modifiers & WebKit::WebKeyboardEvent::ControlKey) + cef_event.modifiers |= KEY_CTRL; + if (event.modifiers & WebKit::WebKeyboardEvent::AltKey) + cef_event.modifiers |= KEY_ALT; + if (event.modifiers & WebKit::WebKeyboardEvent::MetaKey) + cef_event.modifiers |= KEY_META; + if (event.modifiers & WebKit::WebKeyboardEvent::IsKeyPad) + cef_event.modifiers |= KEY_KEYPAD; + + cef_event.windows_key_code = event.windowsKeyCode; + cef_event.native_key_code = event.nativeKeyCode; + cef_event.is_system_key = event.isSystemKey; + cef_event.character = event.text[0]; + cef_event.unmodified_character = event.unmodifiedText[0]; + + return true; +} + +} // namespace + + +// CefBrowserHost static methods. +// ----------------------------------------------------------------------------- + +// static +bool CefBrowserHost::CreateBrowser(const CefWindowInfo& windowInfo, + CefRefPtr client, + const CefString& url, + const CefBrowserSettings& settings) { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED() << "context not valid"; + return false; + } + + // Verify that the settings structure is a valid size. + if (settings.size != sizeof(cef_browser_settings_t)) { + NOTREACHED() << "invalid CefBrowserSettings structure size"; + return false; + } + + // Create the browser on the UI thread. + CreateBrowserHelper* helper = + new CreateBrowserHelper(windowInfo, client, url, settings); + CEF_POST_TASK(CEF_UIT, base::Bind(CreateBrowserWithHelper, helper)); + + return true; +} + +// static +CefRefPtr CefBrowserHost::CreateBrowserSync( + const CefWindowInfo& windowInfo, + CefRefPtr client, + const CefString& url, + const CefBrowserSettings& settings) { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED() << "context not valid"; + return NULL; + } + + // Verify that the settings structure is a valid size. + if (settings.size != sizeof(cef_browser_settings_t)) { + NOTREACHED() << "invalid CefBrowserSettings structure size"; + return NULL; + } + + // Verify that this method is being called on the UI thread. + if (!CEF_CURRENTLY_ON_UIT()) { + NOTREACHED() << "called on invalid thread"; + return NULL; + } + + CefRefPtr browser = + CefBrowserHostImpl::Create(windowInfo, settings, client, NULL, NULL); + if (!url.empty()) + browser->LoadURL(CefFrameHostImpl::kMainFrameId, url); + return browser.get(); +} + + +// CefBrowserHostImpl static methods. +// ----------------------------------------------------------------------------- + +// static +CefRefPtr CefBrowserHostImpl::Create( + const CefWindowInfo& window_info, + const CefBrowserSettings& settings, + CefRefPtr client, + content::WebContents* web_contents, + CefWindowHandle opener) { + CEF_REQUIRE_UIT(); + + if (web_contents == NULL) { + web_contents = content::WebContents::Create( + _Context->browser_context(), + NULL, + MSG_ROUTING_NONE, + NULL, + NULL); + } + + CefRefPtr browser = + new CefBrowserHostImpl(window_info, settings, client, web_contents, + opener); + if (!browser->PlatformCreateWindow()) + return NULL; + + _Context->AddBrowser(browser); + + if (client.get()) { + CefRefPtr handler = client->GetLifeSpanHandler(); + if (handler.get()) + handler->OnAfterCreated(browser.get()); + } + + return browser; +} + +// static +CefRefPtr CefBrowserHostImpl::GetBrowserForHost( + const content::RenderViewHost* host) { + DCHECK(host); + CEF_REQUIRE_UIT(); + WebContentsImpl* web_contents = + static_cast(host->GetDelegate()); + if (web_contents) + return static_cast(web_contents->GetDelegate()); + return NULL; +} + +// static +CefRefPtr CefBrowserHostImpl::GetBrowserForContents( + content::WebContents* contents) { + DCHECK(contents); + CEF_REQUIRE_UIT(); + return static_cast(contents->GetDelegate()); +} + +// static +CefRefPtr CefBrowserHostImpl::GetBrowserForRequest( + net::URLRequest* request) { + DCHECK(request); + CEF_REQUIRE_IOT(); + int render_process_id = -1; + int render_view_id = -1; + + if (!content::ResourceRequestInfo::GetRenderViewForRequest(request, + &render_process_id, + &render_view_id)) { + return NULL; + } + + return GetBrowserByRoutingID(render_process_id, render_view_id); +} + +// static +CefRefPtr CefBrowserHostImpl::GetBrowserByRoutingID( + int render_process_id, int render_view_id) { + if (CEF_CURRENTLY_ON_UIT()) { + // Use the non-thread-safe but potentially faster approach. + content::RenderViewHost* render_view_host = + content::RenderViewHost::FromID(render_process_id, render_view_id); + if (!render_view_host) + return NULL; + return GetBrowserForHost(render_view_host); + } else { + // Use the thread-safe approach. + return _Context->GetBrowserByRoutingID(render_process_id, render_view_id); + } +} + +// static +CefRefPtr CefBrowserHostImpl::GetBrowserByChildID( + int render_process_id) { + if (CEF_CURRENTLY_ON_UIT()) { + // Use the non-thread-safe but potentially faster approach. + content::RenderProcessHost* render_process_host = + content::RenderProcessHost::FromID(render_process_id); + if (!render_process_host) + return NULL; + + content::RenderProcessHost::RenderWidgetHostsIterator iter( + render_process_host->GetRenderWidgetHostsIterator()); + if (!iter.IsAtEnd()) { + const content::RenderWidgetHost* widget = iter.GetCurrentValue(); + + // This implementation is based on an assumption that each process hosts a + // single renderer. Revisit this implementation if the assumption proves + // false. + iter.Advance(); + DCHECK(iter.IsAtEnd()); + + if (widget && widget->IsRenderView()) { + return GetBrowserForHost(content::RenderViewHost::From( + const_cast(widget))); + } + } + + return NULL; + } else { + // Use the thread-safe approach. + return _Context->GetBrowserByRoutingID(render_process_id, 0); + } +} + + +// CefBrowserHost methods. +// ----------------------------------------------------------------------------- + +CefRefPtr CefBrowserHostImpl::GetBrowser() { + return this; +} + +void CefBrowserHostImpl::CloseBrowser() { + if (CEF_CURRENTLY_ON_UIT()) { + PlatformCloseWindow(); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBrowserHostImpl::PlatformCloseWindow, this)); + } +} + +void CefBrowserHostImpl::ParentWindowWillClose() { +} + +void CefBrowserHostImpl::SetFocus(bool enable) { + if (!enable) + return; + + if (CEF_CURRENTLY_ON_UIT()) { + OnSetFocus(FOCUS_SOURCE_SYSTEM); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBrowserHostImpl::SetFocus, this, enable)); + } +} + +CefWindowHandle CefBrowserHostImpl::GetWindowHandle() { + return PlatformGetWindowHandle(); +} + +CefWindowHandle CefBrowserHostImpl::GetOpenerWindowHandle() { + return opener_; +} + +CefRefPtr CefBrowserHostImpl::GetClient() { + return client_; +} + +CefString CefBrowserHostImpl::GetDevToolsURL(bool http_scheme) { + base::AutoLock lock_scope(state_lock_); + return (http_scheme ? devtools_url_http_ : devtools_url_chrome_); +} + +double CefBrowserHostImpl::GetZoomLevel() { + // Verify that this method is being called on the UI thread. + if (!CEF_CURRENTLY_ON_UIT()) { + NOTREACHED() << "called on invalid thread"; + return 0; + } + + if (web_contents_.get()) + return web_contents_->GetZoomLevel(); + + return 0; +} + +void CefBrowserHostImpl::SetZoomLevel(double zoomLevel) { + if (CEF_CURRENTLY_ON_UIT()) { + if (web_contents_.get() && web_contents_->GetRenderViewHost()) + web_contents_->GetRenderViewHost()->SetZoomLevel(zoomLevel); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBrowserHostImpl::SetZoomLevel, this, zoomLevel)); + } +} + + +// CefBrowser methods. +// ----------------------------------------------------------------------------- + +CefRefPtr CefBrowserHostImpl::GetHost() { + return this; +} + +bool CefBrowserHostImpl::CanGoBack() { + base::AutoLock lock_scope(state_lock_); + return can_go_back_; +} + +void CefBrowserHostImpl::GoBack() { + if (CEF_CURRENTLY_ON_UIT()) { + if (web_contents_.get() && web_contents_->GetController().CanGoBack()) + web_contents_->GetController().GoBack(); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBrowserHostImpl::GoBack, this)); + } +} + +bool CefBrowserHostImpl::CanGoForward() { + base::AutoLock lock_scope(state_lock_); + return can_go_forward_; +} + +void CefBrowserHostImpl::GoForward() { + if (CEF_CURRENTLY_ON_UIT()) { + if (web_contents_.get() && web_contents_->GetController().CanGoForward()) + web_contents_->GetController().GoForward(); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBrowserHostImpl::GoForward, this)); + } +} + +bool CefBrowserHostImpl::IsLoading() { + base::AutoLock lock_scope(state_lock_); + return is_loading_; +} + +void CefBrowserHostImpl::Reload() { + if (CEF_CURRENTLY_ON_UIT()) { + if (web_contents_.get()) + web_contents_->GetController().Reload(true); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBrowserHostImpl::Reload, this)); + } +} + +void CefBrowserHostImpl::ReloadIgnoreCache() { + if (CEF_CURRENTLY_ON_UIT()) { + if (web_contents_.get()) + web_contents_->GetController().ReloadIgnoringCache(true); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBrowserHostImpl::ReloadIgnoreCache, this)); + } +} + +void CefBrowserHostImpl::StopLoad() { + if (CEF_CURRENTLY_ON_UIT()) { + if (web_contents_.get()) + web_contents_->Stop(); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBrowserHostImpl::StopLoad, this)); + } +} + +int CefBrowserHostImpl::GetIdentifier() { + return unique_id(); +} + +bool CefBrowserHostImpl::IsPopup() { + return (opener_ != NULL); +} + +bool CefBrowserHostImpl::HasDocument() { + base::AutoLock lock_scope(state_lock_); + return has_document_; +} + +CefRefPtr CefBrowserHostImpl::GetMainFrame() { + return GetFrame(CefFrameHostImpl::kMainFrameId); +} + +CefRefPtr CefBrowserHostImpl::GetFocusedFrame() { + return GetFrame(CefFrameHostImpl::kFocusedFrameId); +} + +CefRefPtr CefBrowserHostImpl::GetFrame(int64 identifier) { + base::AutoLock lock_scope(state_lock_); + + if (main_frame_id_ == CefFrameHostImpl::kInvalidFrameId) { + // A main frame does not exist yet. Return the placeholder frame that + // provides limited functionality. + return placeholder_frame_.get(); + } + + if (identifier == CefFrameHostImpl::kMainFrameId) { + identifier = main_frame_id_; + } else if (identifier == CefFrameHostImpl::kFocusedFrameId) { + // Return the main frame if no focused frame is currently identified. + if (focused_frame_id_ == CefFrameHostImpl::kInvalidFrameId) + identifier = main_frame_id_; + else + identifier = focused_frame_id_; + } + + if (identifier == CefFrameHostImpl::kInvalidFrameId) + return NULL; + + FrameMap::const_iterator it = frames_.find(identifier); + if (it != frames_.end()) + return it->second.get(); + + return NULL; +} + +CefRefPtr CefBrowserHostImpl::GetFrame(const CefString& name) { + base::AutoLock lock_scope(state_lock_); + + FrameMap::const_iterator it = frames_.begin(); + for (; it != frames_.end(); ++it) { + if (it->second->GetName() == name) + return it->second.get(); + } + + return NULL; +} + +size_t CefBrowserHostImpl::GetFrameCount() { + base::AutoLock lock_scope(state_lock_); + return frames_.size(); +} + +void CefBrowserHostImpl::GetFrameIdentifiers(std::vector& identifiers) { + base::AutoLock lock_scope(state_lock_); + + if (identifiers.size() > 0) + identifiers.clear(); + + FrameMap::const_iterator it = frames_.begin(); + for (; it != frames_.end(); ++it) + identifiers.push_back(it->first); +} + +void CefBrowserHostImpl::GetFrameNames(std::vector& names) { + base::AutoLock lock_scope(state_lock_); + + if (names.size() > 0) + names.clear(); + + FrameMap::const_iterator it = frames_.begin(); + for (; it != frames_.end(); ++it) + names.push_back(it->second->GetName()); +} + +bool CefBrowserHostImpl::SendProcessMessage( + CefProcessId target_process, + CefRefPtr message) { + DCHECK_EQ(PID_RENDERER, target_process); + DCHECK(message.get()); + + Cef_Request_Params params; + CefProcessMessageImpl* impl = + static_cast(message.get()); + if (impl->CopyTo(params)) { + DCHECK(!params.name.empty()); + + params.frame_id = -1; + params.user_initiated = true; + params.request_id = -1; + params.expect_response = false; + + return Send(new CefMsg_Request(routing_id(), params)); + } + + return false; +} + + +// CefBrowserHostImpl public methods. +// ----------------------------------------------------------------------------- + +void CefBrowserHostImpl::SetUniqueId(int unique_id) { + CEF_REQUIRE_UIT(); + unique_id_ = unique_id; + Send(new CefMsg_UpdateBrowserWindowId(routing_id(), unique_id, IsPopup())); +} + +void CefBrowserHostImpl::DestroyBrowser() { + CEF_REQUIRE_UIT(); + + if (client_.get()) { + CefRefPtr handler = client_->GetLifeSpanHandler(); + if (handler.get()) { + // Notify the handler that the window is about to be closed. + handler->OnBeforeClose(this); + } + } + + while (!queued_messages_.empty()) { + delete queued_messages_.front(); + queued_messages_.pop(); + } + + registrar_.reset(NULL); + response_manager_.reset(NULL); + content::WebContentsObserver::Observe(NULL); + web_contents_.reset(NULL); + + DetachAllFrames(); + + request_context_proxy_ = NULL; + + // Remove the browser from the list maintained by the context. + _Context->RemoveBrowser(this); +} + +gfx::NativeView CefBrowserHostImpl::GetContentView() const { + CEF_REQUIRE_UIT(); + if (!web_contents_.get()) + return NULL; + return web_contents_->GetNativeView(); +} + +content::WebContents* CefBrowserHostImpl::GetWebContents() const { + CEF_REQUIRE_UIT(); + return web_contents_.get(); +} + +net::URLRequestContextGetter* CefBrowserHostImpl::GetRequestContext() { + CEF_REQUIRE_UIT(); + if (!request_context_proxy_) { + request_context_proxy_ = + new CefURLRequestContextGetterProxy(this, + static_cast( + _Context->browser_context()->GetRequestContext())); + } + return request_context_proxy_.get(); +} + +CefRefPtr CefBrowserHostImpl::GetFrameForRequest( + net::URLRequest* request) { + CEF_REQUIRE_IOT(); + const content::ResourceRequestInfo* info = + content::ResourceRequestInfo::ForRequest(request); + if (!info) + return NULL; + return GetOrCreateFrame(info->GetFrameID(), info->GetParentFrameID(), + info->IsMainFrame(), string16(), GURL()); +} + +void CefBrowserHostImpl::Navigate(const CefNavigateParams& params) { + // Only known frame ids and kMainFrameId are supported. + DCHECK(params.frame_id >= CefFrameHostImpl::kMainFrameId); + + CefMsg_LoadRequest_Params request; + request.url = params.url; + if (!request.url.is_valid()) { + DLOG(ERROR) << "Invalid URL passed to CefBrowserHostImpl::Navigate: " << + params.url; + return; + } + + request.method = params.method; + request.referrer = params.referrer.url; + request.referrer_policy = params.referrer.policy; + request.frame_id = params.frame_id; + request.first_party_for_cookies = params.first_party_for_cookies; + request.headers = params.headers; + request.load_flags = params.load_flags; + request.upload_data = params.upload_data; + + Send(new CefMsg_LoadRequest(routing_id(), request)); + + OnSetFocus(FOCUS_SOURCE_NAVIGATION); +} + +void CefBrowserHostImpl::LoadRequest(int64 frame_id, + CefRefPtr request) { + CefNavigateParams params(GURL(std::string(request->GetURL())), + content::PAGE_TRANSITION_TYPED); + params.method = request->GetMethod(); + params.frame_id = frame_id; + params.first_party_for_cookies = + GURL(std::string(request->GetFirstPartyForCookies())); + + CefRequest::HeaderMap headerMap; + request->GetHeaderMap(headerMap); + if (!headerMap.empty()) + params.headers = HttpHeaderUtils::GenerateHeaders(headerMap); + + CefRefPtr postData = request->GetPostData(); + if (postData.get()) { + CefPostDataImpl* impl = static_cast(postData.get()); + params.upload_data = new net::UploadData(); + impl->Get(*params.upload_data.get()); + } + + params.load_flags = request->GetFlags(); + + Navigate(params); +} + +void CefBrowserHostImpl::LoadURL(int64 frame_id, const std::string& url) { + if (frame_id == CefFrameHostImpl::kMainFrameId) { + // Go through the navigation controller. + if (CEF_CURRENTLY_ON_UIT()) { + if (web_contents_.get()) { + GURL gurl = GURL(url); + + if (!gurl.is_valid() && !gurl.has_scheme()) { + // Try to add "http://" at the beginning + std::string new_url = std::string("http://") + url; + gurl = GURL(new_url); + } + + if (!gurl.is_valid()) { + DLOG(ERROR) << + "Invalid URL passed to CefBrowserHostImpl::LoadURL: " << url; + return; + } + + // Update the loading URL. + OnLoadingURLChange(gurl); + + web_contents_->GetController().LoadURL( + gurl, + content::Referrer(), + content::PAGE_TRANSITION_TYPED, + std::string()); + OnSetFocus(FOCUS_SOURCE_NAVIGATION); + } + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBrowserHostImpl::LoadURL, this, frame_id, url)); + } + } else { + CefNavigateParams params(GURL(url), content::PAGE_TRANSITION_TYPED); + params.frame_id = frame_id; + Navigate(params); + } +} + +void CefBrowserHostImpl::LoadString(int64 frame_id, const CefString& string, + const CefString& url) { + // Only known frame ids or kMainFrameId are supported. + DCHECK(frame_id >= CefFrameHostImpl::kMainFrameId); + + Cef_Request_Params params; + params.name = "load-string"; + params.frame_id = frame_id; + params.user_initiated = false; + params.request_id = -1; + params.expect_response = false; + + params.arguments.Append(base::Value::CreateStringValue(string.ToString16())); + params.arguments.Append(base::Value::CreateStringValue(url.ToString16())); + + Send(new CefMsg_Request(routing_id(), params)); +} + +void CefBrowserHostImpl::SendCommand( + int64 frame_id, + const CefString& command, + CefRefPtr responseHandler) { + // Only known frame ids are supported. + DCHECK(frame_id > CefFrameHostImpl::kMainFrameId); + DCHECK(!command.empty()); + + // Execute on the UI thread because CefResponseManager is not thread safe. + if (CEF_CURRENTLY_ON_UIT()) { + Cef_Request_Params params; + params.name = "execute-command"; + params.frame_id = frame_id; + params.user_initiated = false; + + if (responseHandler.get()) { + params.request_id = response_manager_->RegisterHandler(responseHandler); + params.expect_response = true; + } else { + params.request_id = -1; + params.expect_response = false; + } + + params.arguments.Append( + base::Value::CreateStringValue(command.ToString16())); + + Send(new CefMsg_Request(routing_id(), params)); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBrowserHostImpl::SendCommand, this, frame_id, command, + responseHandler)); + } +} + +void CefBrowserHostImpl::SendCode( + int64 frame_id, + bool is_javascript, + const CefString& code, + const CefString& script_url, + int script_start_line, + CefRefPtr responseHandler) { + // Only known frame ids are supported. + DCHECK(frame_id >= CefFrameHostImpl::kMainFrameId); + DCHECK(!code.empty()); + DCHECK_GE(script_start_line, 0); + + // Execute on the UI thread because CefResponseManager is not thread safe. + if (CEF_CURRENTLY_ON_UIT()) { + Cef_Request_Params params; + params.name = "execute-code"; + params.frame_id = frame_id; + params.user_initiated = false; + + if (responseHandler.get()) { + params.request_id = response_manager_->RegisterHandler(responseHandler); + params.expect_response = true; + } else { + params.request_id = -1; + params.expect_response = false; + } + + params.arguments.Append(base::Value::CreateBooleanValue(is_javascript)); + params.arguments.Append(base::Value::CreateStringValue(code.ToString16())); + params.arguments.Append( + base::Value::CreateStringValue(script_url.ToString16())); + params.arguments.Append(base::Value::CreateIntegerValue(script_start_line)); + + Send(new CefMsg_Request(routing_id(), params)); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBrowserHostImpl::SendCode, this, frame_id, is_javascript, + code, script_url, script_start_line, responseHandler)); + } +} + +bool CefBrowserHostImpl::ViewText(const std::string& text) { + return PlatformViewText(text); +} + +void CefBrowserHostImpl::HandleExternalProtocol(const GURL& url) { + if (CEF_CURRENTLY_ON_UIT()) { + bool allow_os_execution = false; + + if (client_.get()) { + CefRefPtr handler = client_->GetRequestHandler(); + if (handler.get()) + handler->OnProtocolExecution(this, url.spec(), allow_os_execution); + } + + if (allow_os_execution) + PlatformHandleExternalProtocol(url); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBrowserHostImpl::HandleExternalProtocol, this, url)); + } +} + +bool CefBrowserHostImpl::HasIDMatch(int render_process_id, int render_view_id) { + base::AutoLock lock_scope(state_lock_); + if (render_process_id != render_process_id_) + return false; + return (render_view_id == 0 || render_view_id == render_view_id_); +} + +GURL CefBrowserHostImpl::GetLoadingURL() { + base::AutoLock lock_scope(state_lock_); + return loading_url_; +} + +void CefBrowserHostImpl::OnSetFocus(cef_focus_source_t source) { + CEF_REQUIRE_UIT(); + + // SetFocus() might be called while inside the OnSetFocus() callback. If so, + // don't re-enter the callback. + if (!is_in_onsetfocus_) { + if (client_.get()) { + CefRefPtr handler = client_->GetFocusHandler(); + if (handler.get()) { + is_in_onsetfocus_ = true; + bool handled = handler->OnSetFocus(this, source); + is_in_onsetfocus_ = false; + + if (handled) + return; + } + } + } + + if (web_contents_.get()) + web_contents_->Focus(); +} + + +// content::WebContentsDelegate methods. +// ----------------------------------------------------------------------------- + +content::WebContents* CefBrowserHostImpl::OpenURLFromTab( + content::WebContents* source, + const content::OpenURLParams& params) { + // Start the new navigation. + CefNavigateParams nav_params(params.url, params.transition); + nav_params.referrer = params.referrer; + nav_params.frame_id = params.source_frame_id; + nav_params.disposition = params.disposition; + nav_params.user_gesture = true; + nav_params.override_encoding = params.override_encoding; + nav_params.is_renderer_initiated = params.is_renderer_initiated; + nav_params.transferred_global_request_id = + params.transferred_global_request_id; + Navigate(nav_params); + + return source; +} + +void CefBrowserHostImpl::LoadingStateChanged(content::WebContents* source) { + int current_index = web_contents_->GetController().GetCurrentEntryIndex(); + int max_index = web_contents_->GetController().GetEntryCount() - 1; + + bool is_loading, can_go_back, can_go_forward; + + { + base::AutoLock lock_scope(state_lock_); + is_loading = is_loading_ = web_contents_->IsLoading(); + can_go_back = can_go_back_ = (current_index > 0); + can_go_forward = can_go_forward_ = (current_index < max_index); + } + + if (client_.get()) { + CefRefPtr handler = client_->GetDisplayHandler(); + if (handler.get()) { + handler->OnLoadingStateChange(this, is_loading, can_go_back, + can_go_forward); + } + } +} + +void CefBrowserHostImpl::CloseContents(content::WebContents* source) { + PlatformCloseWindow(); +} + +bool CefBrowserHostImpl::TakeFocus(bool reverse) { + if (client_.get()) { + CefRefPtr handler = client_->GetFocusHandler(); + if (handler.get()) + handler->OnTakeFocus(this, !reverse); + } + + return false; +} + +void CefBrowserHostImpl::WebContentsFocused(content::WebContents* contents) { + if (client_.get()) { + CefRefPtr handler = client_->GetFocusHandler(); + if (handler.get()) + handler->OnGotFocus(this); + } +} + +bool CefBrowserHostImpl::HandleContextMenu( + const content::ContextMenuParams& params) { + if (!menu_creator_.get()) + menu_creator_.reset(new CefMenuCreator(this)); + return menu_creator_->CreateContextMenu(params); +} + +bool CefBrowserHostImpl::PreHandleKeyboardEvent( + const content::NativeWebKeyboardEvent& event, + bool* is_keyboard_shortcut) { + if (client_.get()) { + CefRefPtr handler = client_->GetKeyboardHandler(); + if (handler.get()) { + CefKeyEvent cef_event; + if (!GetCefKeyEvent(event, cef_event)) + return false; + +#if defined(OS_WIN) + CefEventHandle os_event = const_cast(&event.os_event); +#else + CefEventHandle os_event = event.os_event; +#endif + + cef_event.focus_on_editable_field = focus_on_editable_field_; + + return handler->OnPreKeyEvent(this, cef_event, os_event, + is_keyboard_shortcut); + } + } + + return false; +} + +void CefBrowserHostImpl::HandleKeyboardEvent( + const content::NativeWebKeyboardEvent& event) { + // Check to see if event should be ignored. + if (event.skip_in_browser) + return; + + if (client_.get()) { + CefRefPtr handler = client_->GetKeyboardHandler(); + if (handler.get()) { + CefKeyEvent cef_event; + if (GetCefKeyEvent(event, cef_event)) { +#if defined(OS_WIN) + CefEventHandle os_event = const_cast(&event.os_event); +#else + CefEventHandle os_event = event.os_event; +#endif + + cef_event.focus_on_editable_field = focus_on_editable_field_; + + if (handler->OnKeyEvent(this, cef_event, os_event)) + return; + } + } + } + + PlatformHandleKeyboardEvent(event); +} + +bool CefBrowserHostImpl::ShouldCreateWebContents( + content::WebContents* web_contents, + int route_id, + WindowContainerType window_container_type, + const string16& frame_name, + const GURL& target_url) { + // Start with the current browser window's client and settings. + pending_client_ = client_; + pending_settings_ = settings_; + + // TODO(cef): Figure out how to populate these values. + // See: http://crbug.com/110510 + CefPopupFeatures features; + + pending_window_info_ = CefWindowInfo(); +#if defined(OS_WIN) + pending_window_info_.SetAsPopup(NULL, CefString()); +#endif + +#if (defined(OS_WIN) || defined(OS_MACOSX)) + // Default to the size from the popup features. + if (features.xSet) + pending_window_info_.x = features.x; + if (features.ySet) + pending_window_info_.y = features.y; + if (features.widthSet) + pending_window_info_.width = features.width; + if (features.heightSet) + pending_window_info_.height = features.height; +#endif + + if (client_.get()) { + CefRefPtr handler = client_->GetLifeSpanHandler(); + // Give the handler an opportunity to modify window attributes, handler, + // or cancel the window creation. + if (handler.get() && + handler->OnBeforePopup(this, features, pending_window_info_, + target_url.spec(), pending_client_, + pending_settings_)) { + pending_client_ = NULL; + return false; + } + } + + return true; +} + +void CefBrowserHostImpl::WebContentsCreated( + content::WebContents* source_contents, + int64 source_frame_id, + const GURL& target_url, + content::WebContents* new_contents) { + CefWindowHandle opener = NULL; + if (source_contents) + opener = GetBrowserForContents(source_contents)->GetWindowHandle(); + + CefRefPtr browser = CefBrowserHostImpl::Create( + pending_window_info_, pending_settings_, pending_client_, new_contents, + opener); + + pending_client_ = NULL; +} + +void CefBrowserHostImpl::DidNavigateMainFramePostCommit( + content::WebContents* tab) { + { + base::AutoLock lock_scope(state_lock_); + has_document_ = false; + } + + // Allow the new page to set the title again. + received_page_title_ = false; +} + +content::JavaScriptDialogCreator* + CefBrowserHostImpl::GetJavaScriptDialogCreator() { + if (!dialog_creator_.get()) + dialog_creator_.reset(new CefJavaScriptDialogCreator(this)); + return dialog_creator_.get(); +} + +void CefBrowserHostImpl::RunFileChooser( + content::WebContents* tab, + const content::FileChooserParams& params) { + content::RenderViewHost* render_view_host = tab->GetRenderViewHost(); + if (!render_view_host) + return; + + if (params.mode != content::FileChooserParams::Open && + params.mode != content::FileChooserParams::OpenMultiple) { + NOTREACHED() << "unsupported file chooser mode requested"; + return; + } + + std::vector fileList; + PlatformRunFileChooser(tab, params, fileList); + + const int kReadFilePermissions = + base::PLATFORM_FILE_OPEN | + base::PLATFORM_FILE_READ | + base::PLATFORM_FILE_EXCLUSIVE_READ | + base::PLATFORM_FILE_ASYNC; + + // Convert FilePath list to SelectedFileInfo list. + std::vector selected_files; + for (size_t i = 0; i < fileList.size(); ++i) { + selected_files.push_back( + content::SelectedFileInfo(fileList[i], FilePath::StringType())); + } + + // Notify our RenderViewHost in all cases. + render_view_host->FilesSelectedInChooser(selected_files, + kReadFilePermissions); +} + +void CefBrowserHostImpl::UpdatePreferredSize(content::WebContents* source, + const gfx::Size& pref_size) { + PlatformSizeTo(pref_size.width(), pref_size.height()); +} + +void CefBrowserHostImpl::RequestMediaAccessPermission( + content::WebContents* web_contents, + const content::MediaStreamRequest* request, + const content::MediaResponseCallback& callback) { + CEF_CURRENTLY_ON_UIT(); + + content::MediaStreamDevices devices; + for (content::MediaStreamDeviceMap::const_iterator it = + request->devices.begin(); it != request->devices.end(); ++it) { + devices.push_back(*it->second.begin()); + } + + // TODO(cef): Give the user an opportunity to approve the device list or run + // the callback with an empty device list to cancel the request. + callback.Run(devices); +} + + +// content::WebContentsObserver methods. +// ----------------------------------------------------------------------------- + +void CefBrowserHostImpl::RenderViewCreated( + content::RenderViewHost* render_view_host) { + SetRenderViewHost(render_view_host); +} + +void CefBrowserHostImpl::RenderViewDeleted( + content::RenderViewHost* render_view_host) { + registrar_->Remove(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, + content::Source(render_view_host)); +} + +void CefBrowserHostImpl::RenderViewReady() { + // Send the queued messages. + queue_messages_ = false; + while (!queued_messages_.empty()) { + Send(queued_messages_.front()); + queued_messages_.pop(); + } +} + +void CefBrowserHostImpl::RenderViewGone(base::TerminationStatus status) { + queue_messages_ = true; + + cef_termination_status_t ts = TS_ABNORMAL_TERMINATION; + if (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED) + ts = TS_PROCESS_WAS_KILLED; + else if (status == base::TERMINATION_STATUS_PROCESS_CRASHED) + ts = TS_PROCESS_CRASHED; + else if (status != base::TERMINATION_STATUS_ABNORMAL_TERMINATION) + return; + + if (client_.get()) { + CefRefPtr handler = client_->GetLoadHandler(); + if (handler.get()) + handler->OnRenderProcessTerminated(this, ts); + } +} + +void CefBrowserHostImpl::DidCommitProvisionalLoadForFrame( + int64 frame_id, + bool is_main_frame, + const GURL& url, + content::PageTransition transition_type, + content::RenderViewHost* render_view_host) { + CefRefPtr frame = GetOrCreateFrame(frame_id, + CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, string16(), url); + OnLoadStart(frame, url, transition_type); + if (is_main_frame) + OnAddressChange(frame, url); +} + +void CefBrowserHostImpl::DidFailProvisionalLoad( + int64 frame_id, + bool is_main_frame, + const GURL& validated_url, + int error_code, + const string16& error_description, + content::RenderViewHost* render_view_host) { + CefRefPtr frame = GetOrCreateFrame(frame_id, + CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, string16(), + validated_url); + OnLoadError(frame, validated_url, error_code, error_description); +} + +void CefBrowserHostImpl::DocumentAvailableInMainFrame() { + base::AutoLock lock_scope(state_lock_); + has_document_ = true; +} + +void CefBrowserHostImpl::DidFinishLoad(int64 frame_id, + const GURL& validated_url, + bool is_main_frame) { + CefRefPtr frame = GetOrCreateFrame(frame_id, + CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, string16(), + validated_url); + OnLoadEnd(frame, validated_url); +} + +void CefBrowserHostImpl::DidFailLoad(int64 frame_id, + const GURL& validated_url, + bool is_main_frame, + int error_code, + const string16& error_description) { + CefRefPtr frame = GetOrCreateFrame(frame_id, + CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, string16(), + validated_url); + OnLoadError(frame, validated_url, error_code, error_description); + OnLoadEnd(frame, validated_url); +} + +void CefBrowserHostImpl::PluginCrashed(const FilePath& plugin_path) { + if (client_.get()) { + CefRefPtr handler = client_->GetLoadHandler(); + if (handler.get()) + handler->OnPluginCrashed(this, plugin_path.value()); + } +} + +bool CefBrowserHostImpl::OnMessageReceived(const IPC::Message& message) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(CefBrowserHostImpl, message) + IPC_MESSAGE_HANDLER(CefHostMsg_FrameIdentified, OnFrameIdentified) + IPC_MESSAGE_HANDLER(CefHostMsg_FrameDetached, DetachFrame) + IPC_MESSAGE_HANDLER(CefHostMsg_FrameFocusChange, SetFocusedFrame) + IPC_MESSAGE_HANDLER(CefHostMsg_LoadingURLChange, OnLoadingURLChange) + IPC_MESSAGE_HANDLER(CefHostMsg_Request, OnRequest) + IPC_MESSAGE_HANDLER(CefHostMsg_Response, OnResponse) + IPC_MESSAGE_HANDLER(CefHostMsg_ResponseAck, OnResponseAck) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + return handled; +} + +bool CefBrowserHostImpl::Send(IPC::Message* message) { + if (CEF_CURRENTLY_ON_UIT()) { + if (queue_messages_) { + queued_messages_.push(message); + return true; + } else { + return content::WebContentsObserver::Send(message); + } + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(base::IgnoreResult(&CefBrowserHostImpl::Send), this, + message)); + return true; + } +} + + +// content::WebContentsObserver::OnMessageReceived() message handlers. +// ----------------------------------------------------------------------------- + +void CefBrowserHostImpl::OnFrameIdentified(int64 frame_id, + int64 parent_frame_id, + string16 name) { + bool is_main_frame = (parent_frame_id == CefFrameHostImpl::kMainFrameId); + GetOrCreateFrame(frame_id, parent_frame_id, is_main_frame, name, GURL()); +} + +void CefBrowserHostImpl::OnLoadingURLChange(const GURL& loading_url) { + base::AutoLock lock_scope(state_lock_); + loading_url_ = loading_url; +} + +void CefBrowserHostImpl::OnRequest(const Cef_Request_Params& params) { + bool success = false; + std::string response; + bool expect_response_ack = false; + + if (params.user_initiated) { + // Give the user a chance to handle the request. + if (client_.get()) { + CefRefPtr message( + new CefProcessMessageImpl(const_cast(¶ms), + false, true)); + success = client_->OnProcessMessageReceived(this, PID_RENDERER, + message.get()); + message->Detach(NULL); + } + } else { + // Invalid request. + NOTREACHED(); + } + + if (params.expect_response) { + DCHECK_GE(params.request_id, 0); + + // Send a response to the renderer. + Cef_Response_Params response_params; + response_params.request_id = params.request_id; + response_params.success = success; + response_params.response = response; + response_params.expect_response_ack = expect_response_ack; + Send(new CefMsg_Response(routing_id(), response_params)); + } +} + +void CefBrowserHostImpl::OnResponse(const Cef_Response_Params& params) { + response_manager_->RunHandler(params); + if (params.expect_response_ack) + Send(new CefMsg_ResponseAck(routing_id(), params.request_id)); +} + +void CefBrowserHostImpl::OnResponseAck(int request_id) { + response_manager_->RunAckHandler(request_id); +} + + +// content::NotificationObserver methods. +// ----------------------------------------------------------------------------- + +void CefBrowserHostImpl::Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { + DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED || + type == content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE); + + if (type == content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED) { + std::pair* title = + content::Details >( + details).ptr(); + + if (received_page_title_) + return; + + if (title->first) { + if (client_.get()) { + CefRefPtr handler = client_->GetDisplayHandler(); + if (handler.get()) { + CefString title_str = title->first->GetTitleForDisplay(""); + handler->OnTitleChange(this, title_str); + } + } + + received_page_title_ = title->second; + } + } else if (type == content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE) { + focus_on_editable_field_ = *content::Details(details).ptr(); + } +} + + +// CefBrowserHostImpl private methods. +// ----------------------------------------------------------------------------- + +CefBrowserHostImpl::CefBrowserHostImpl(const CefWindowInfo& window_info, + const CefBrowserSettings& settings, + CefRefPtr client, + content::WebContents* web_contents, + CefWindowHandle opener) + : content::WebContentsObserver(web_contents), + window_info_(window_info), + settings_(settings), + client_(client), + opener_(opener), + render_process_id_(0), + render_view_id_(0), + unique_id_(0), + received_page_title_(false), + is_loading_(false), + can_go_back_(false), + can_go_forward_(false), + has_document_(false), + queue_messages_(true), + main_frame_id_(CefFrameHostImpl::kInvalidFrameId), + focused_frame_id_(CefFrameHostImpl::kInvalidFrameId), + is_in_onsetfocus_(false), + focus_on_editable_field_(false) { + web_contents_.reset(web_contents); + web_contents->SetDelegate(this); + + registrar_.reset(new content::NotificationRegistrar); + registrar_->Add(this, content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, + content::Source(web_contents)); + + response_manager_.reset(new CefResponseManager); + + placeholder_frame_ = + new CefFrameHostImpl(this, CefFrameHostImpl::kInvalidFrameId, true); + + SetRenderViewHost(web_contents->GetRenderViewHost()); +} + +void CefBrowserHostImpl::SetRenderViewHost(content::RenderViewHost* rvh) { + { + base::AutoLock lock_scope(state_lock_); + + render_view_id_ = rvh->GetRoutingID(); + render_process_id_ = rvh->GetProcess()->GetID(); + + // Update the DevTools URLs, if any. + CefDevToolsDelegate* devtools_delegate = _Context->devtools_delegate(); + if (devtools_delegate) { + devtools_url_http_ = devtools_delegate->GetDevToolsURL(rvh, true); + devtools_url_chrome_ = devtools_delegate->GetDevToolsURL(rvh, false); + } + } + + if (!registrar_->IsRegistered( + this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, + content::Source(rvh))) { + registrar_->Add(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, + content::Source(rvh)); + } +} + +CefRefPtr CefBrowserHostImpl::GetOrCreateFrame( + int64 frame_id, int64 parent_frame_id, bool is_main_frame, + string16 frame_name, const GURL& frame_url) { + DCHECK(frame_id > CefFrameHostImpl::kInvalidFrameId); + if (frame_id <= CefFrameHostImpl::kInvalidFrameId) + return NULL; + + CefString url; + if (frame_url.is_valid()) + url = frame_url.spec(); + + CefString name; + if (!frame_name.empty()) + name = frame_name; + + base::AutoLock lock_scope(state_lock_); + + if (is_main_frame) + main_frame_id_ = frame_id; + + CefRefPtr frame; + + // Check if a frame object already exists. + FrameMap::const_iterator it = frames_.find(frame_id); + if (it != frames_.end()) + frame = it->second.get(); + + if (!frame.get()) { + // Create a new frame object. + frame = new CefFrameHostImpl(this, frame_id, is_main_frame); + frames_.insert(std::make_pair(frame_id, frame)); + } + + if (!url.empty()) + frame->SetURL(url); + if (!name.empty()) + frame->SetName(name); + if (parent_frame_id != CefFrameHostImpl::kUnspecifiedFrameId) + frame->SetParentId(parent_frame_id); + + return frame.get(); +} + +void CefBrowserHostImpl::DetachFrame(int64 frame_id) { + base::AutoLock lock_scope(state_lock_); + + FrameMap::iterator it = frames_.find(frame_id); + if (it != frames_.end()) { + it->second->Detach(); + frames_.erase(it); + } + + if (main_frame_id_ == frame_id) + main_frame_id_ = CefFrameHostImpl::kInvalidFrameId; + if (focused_frame_id_ == frame_id) + focused_frame_id_ = CefFrameHostImpl::kInvalidFrameId; +} + +void CefBrowserHostImpl::DetachAllFrames() { + base::AutoLock lock_scope(state_lock_); + + FrameMap::const_iterator it = frames_.begin(); + for (; it != frames_.end(); ++it) + it->second->Detach(); + + frames_.clear(); + + if (main_frame_id_ != CefFrameHostImpl::kInvalidFrameId) + main_frame_id_ = CefFrameHostImpl::kInvalidFrameId; + if (focused_frame_id_ != CefFrameHostImpl::kInvalidFrameId) + focused_frame_id_ = CefFrameHostImpl::kInvalidFrameId; +} + +void CefBrowserHostImpl::SetFocusedFrame(int64 frame_id) { + base::AutoLock lock_scope(state_lock_); + + if (focused_frame_id_ != CefFrameHostImpl::kInvalidFrameId) { + // Unfocus the previously focused frame. + FrameMap::const_iterator it = frames_.find(frame_id); + if (it != frames_.end()) + it->second->SetFocused(false); + } + + if (frame_id != CefFrameHostImpl::kInvalidFrameId) { + // Focus the newly focused frame. + FrameMap::iterator it = frames_.find(frame_id); + if (it != frames_.end()) { + it->second->SetFocused(true); + focused_frame_id_ = frame_id; + return; + } + } + + // No valid frame found. + focused_frame_id_ = CefFrameHostImpl::kInvalidFrameId; +} + +void CefBrowserHostImpl::OnAddressChange(CefRefPtr frame, + const GURL& url) { + if (client_.get()) { + CefRefPtr handler = client_->GetDisplayHandler(); + if (handler.get()) { + // Notify the handler of an address change. + handler->OnAddressChange(this, GetMainFrame(), url.spec()); + } + } +} + +void CefBrowserHostImpl::OnLoadStart(CefRefPtr frame, + const GURL& url, + content::PageTransition transition_type) { + if (client_.get()) { + CefRefPtr handler = client_->GetLoadHandler(); + if (handler.get()) { + // Notify the handler that loading has started. + handler->OnLoadStart(this, frame); + } + } +} + +void CefBrowserHostImpl::OnLoadError(CefRefPtr frame, + const GURL& url, + int error_code, + const string16& error_description) { + if (client_.get()) { + CefRefPtr handler = client_->GetLoadHandler(); + if (handler.get()) { + // Notify the handler that loading has failed. + handler->OnLoadError(this, frame, + static_cast(error_code), + CefString(error_description), + url.spec()); + } + } +} + +void CefBrowserHostImpl::OnLoadEnd(CefRefPtr frame, + const GURL& url) { + if (client_.get()) { + CefRefPtr handler = client_->GetLoadHandler(); + if (handler.get()) { + // Notify the handler that loading has ended. + // TODO(cef): Identify the HTTP status code. + handler->OnLoadEnd(this, frame, 200); + } + } +} + diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h new file mode 100644 index 000000000..960b77834 --- /dev/null +++ b/libcef/browser/browser_host_impl.h @@ -0,0 +1,427 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_BROWSER_HOST_IMPL_H_ +#define CEF_LIBCEF_BROWSER_BROWSER_HOST_IMPL_H_ +#pragma once + +#include +#include +#include +#include + +#include "include/cef_browser.h" +#include "include/cef_client.h" +#include "include/cef_frame.h" +#include "libcef/browser/frame_host_impl.h" +#include "libcef/browser/javascript_dialog_creator.h" +#include "libcef/browser/menu_creator.h" +#include "libcef/common/response_manager.h" + +#include "base/memory/scoped_ptr.h" +#include "base/string16.h" +#include "base/synchronization/lock.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/web_contents_delegate.h" +#include "content/public/browser/web_contents_observer.h" +#include "net/url_request/url_request_context_getter.h" + +namespace content { +struct NativeWebKeyboardEvent; +} + +namespace net { +class URLRequest; +} + +struct Cef_Request_Params; +struct Cef_Response_Params; +struct CefNavigateParams; +class SiteInstance; + +// Implementation of CefBrowser. +// +// WebContentsDelegate: Interface for handling WebContents delegations. There is +// a one-to-one relationship between CefBrowserHostImpl and WebContents +// instances. +// +// WebContentsObserver: Interface for observing WebContents notifications and +// IPC messages. There is a one-to-one relationship between WebContents and +// RenderViewHost instances. IPC messages received by the RenderViewHost will be +// forwarded to this WebContentsObserver implementation via WebContents. IPC +// messages sent using CefBrowserHostImpl::Send() will be forwarded to the +// RenderViewHost (after posting to the UI thread if necessary). Use +// WebContentsObserver::routing_id() when sending IPC messages. +// +// NotificationObserver: Interface for observing post-processed notifications. +class CefBrowserHostImpl : public CefBrowserHost, + public CefBrowser, + public content::WebContentsDelegate, + public content::WebContentsObserver, + public content::NotificationObserver { + public: + // Used for handling the response to command messages. + class CommandResponseHandler : public virtual CefBase { + public: + virtual void OnResponse(const std::string& response) =0; + }; + + virtual ~CefBrowserHostImpl() {} + + // Create a new CefBrowserHostImpl instance. + static CefRefPtr Create( + const CefWindowInfo& window_info, + const CefBrowserSettings& settings, + CefRefPtr client, + content::WebContents* web_contents, + CefWindowHandle opener); + + // Returns the browser associated with the specified RenderViewHost. + static CefRefPtr GetBrowserForHost( + const content::RenderViewHost* host); + // Returns the browser associated with the specified WebContents. + static CefRefPtr GetBrowserForContents( + content::WebContents* contents); + // Returns the browser associated with the specified URLRequest. + static CefRefPtr GetBrowserForRequest( + net::URLRequest* request); + // Returns the browser associated with the specified routing IDs. + static CefRefPtr GetBrowserByRoutingID( + int render_process_id, int render_view_id); + // Returns the browser associated with the specified child process ID. + static CefRefPtr GetBrowserByChildID( + int render_process_id); + + // CefBrowserHost methods. + virtual CefRefPtr GetBrowser() OVERRIDE; + virtual void CloseBrowser() OVERRIDE; + virtual void ParentWindowWillClose() OVERRIDE; + virtual void SetFocus(bool enable) OVERRIDE; + virtual CefWindowHandle GetWindowHandle() OVERRIDE; + virtual CefWindowHandle GetOpenerWindowHandle() OVERRIDE; + virtual CefRefPtr GetClient() OVERRIDE; + virtual CefString GetDevToolsURL(bool http_scheme) OVERRIDE; + virtual double GetZoomLevel() OVERRIDE; + virtual void SetZoomLevel(double zoomLevel) OVERRIDE; + + // CefBrowser methods. + virtual CefRefPtr GetHost() OVERRIDE; + virtual bool CanGoBack() OVERRIDE; + virtual void GoBack() OVERRIDE; + virtual bool CanGoForward() OVERRIDE; + virtual void GoForward() OVERRIDE; + virtual bool IsLoading() OVERRIDE; + virtual void Reload() OVERRIDE; + virtual void ReloadIgnoreCache() OVERRIDE; + virtual void StopLoad() OVERRIDE; + virtual int GetIdentifier() OVERRIDE; + virtual bool IsPopup() OVERRIDE; + virtual bool HasDocument() OVERRIDE; + virtual CefRefPtr GetMainFrame() OVERRIDE; + virtual CefRefPtr GetFocusedFrame() OVERRIDE; + virtual CefRefPtr GetFrame(int64 identifier) OVERRIDE; + virtual CefRefPtr GetFrame(const CefString& name) OVERRIDE; + virtual size_t GetFrameCount() OVERRIDE; + virtual void GetFrameIdentifiers(std::vector& identifiers) OVERRIDE; + virtual void GetFrameNames(std::vector& names) OVERRIDE; + virtual bool SendProcessMessage( + CefProcessId target_process, + CefRefPtr message) OVERRIDE; + + // Set the unique identifier for this browser. + void SetUniqueId(int unique_id); + + // Destroy the browser members. This method should only be called after the + // native browser window is not longer processing messages. + void DestroyBrowser(); + + // Returns the native view for the WebContents. + gfx::NativeView GetContentView() const; + + // Returns a pointer to the WebContents. + content::WebContents* GetWebContents() const; + + // Returns the browser-specific request context. + net::URLRequestContextGetter* GetRequestContext(); + + // Returns the frame associated with the specified URLRequest. + CefRefPtr GetFrameForRequest(net::URLRequest* request); + + // Navigate as specified by the |params| argument. + void Navigate(const CefNavigateParams& params); + + // Load the specified request. + void LoadRequest(int64 frame_id, CefRefPtr request); + + // Load the specified URL. + void LoadURL(int64 frame_id, const std::string& url); + + // Load the specified string. + void LoadString(int64 frame_id, const CefString& string, + const CefString& url); + + // Send a command to the renderer for execution. + void SendCommand(int64 frame_id, const CefString& command, + CefRefPtr responseHandler); + + // Send code to the renderer for execution. + void SendCode(int64 frame_id, bool is_javascript, const CefString& code, + const CefString& script_url, int script_start_line, + CefRefPtr responseHandler); + + // Open the specified text in the default text editor. + bool ViewText(const std::string& text); + + // Handler for URLs involving external protocols. + void HandleExternalProtocol(const GURL& url); + + // Returns true if this browser matches the specified ID values. If + // |render_view_id| is 0 any browser with the specified |render_process_id| + // will match. + bool HasIDMatch(int render_process_id, int render_view_id); + + // Thread safe accessors. + const CefBrowserSettings& settings() const { return settings_; } + CefRefPtr client() const { return client_; } + int unique_id() const { return unique_id_; } + + // Returns the URL that is currently loading (or loaded) in the main frame. + GURL GetLoadingURL(); + +#if defined(OS_WIN) + static void RegisterWindowClass(); +#endif + + void OnSetFocus(cef_focus_source_t source); + + private: + // content::WebContentsDelegate methods. + virtual content::WebContents* OpenURLFromTab( + content::WebContents* source, + const content::OpenURLParams& params) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; + virtual void CloseContents(content::WebContents* source) OVERRIDE; + virtual bool TakeFocus(bool reverse) OVERRIDE; + virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; + virtual bool HandleContextMenu(const content::ContextMenuParams& params) + OVERRIDE; + virtual bool PreHandleKeyboardEvent( + const content::NativeWebKeyboardEvent& event, + bool* is_keyboard_shortcut) OVERRIDE; + virtual void HandleKeyboardEvent( + const content::NativeWebKeyboardEvent& event) OVERRIDE; + virtual bool ShouldCreateWebContents( + content::WebContents* web_contents, + int route_id, + WindowContainerType window_container_type, + const string16& frame_name, + const GURL& target_url) OVERRIDE; + virtual void WebContentsCreated(content::WebContents* source_contents, + int64 source_frame_id, + const GURL& target_url, + content::WebContents* new_contents) OVERRIDE; + virtual void DidNavigateMainFramePostCommit( + content::WebContents* tab) OVERRIDE; + virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator() + OVERRIDE; + virtual void RunFileChooser( + content::WebContents* tab, + const content::FileChooserParams& params) OVERRIDE; + virtual void UpdatePreferredSize(content::WebContents* source, + const gfx::Size& pref_size) OVERRIDE; + virtual void RequestMediaAccessPermission( + content::WebContents* web_contents, + const content::MediaStreamRequest* request, + const content::MediaResponseCallback& callback) OVERRIDE; + + // content::WebContentsObserver methods. + virtual void RenderViewCreated( + content::RenderViewHost* render_view_host) OVERRIDE; + virtual void RenderViewDeleted( + content::RenderViewHost* render_view_host) OVERRIDE; + virtual void RenderViewReady() OVERRIDE; + virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; + virtual void DidCommitProvisionalLoadForFrame( + int64 frame_id, + bool is_main_frame, + const GURL& url, + content::PageTransition transition_type, + content::RenderViewHost* render_view_host) OVERRIDE; + virtual void DidFailProvisionalLoad( + int64 frame_id, + bool is_main_frame, + const GURL& validated_url, + int error_code, + const string16& error_description, + content::RenderViewHost* render_view_host) OVERRIDE; + virtual void DocumentAvailableInMainFrame() OVERRIDE; + virtual void DidFinishLoad(int64 frame_id, + const GURL& validated_url, + bool is_main_frame) OVERRIDE; + virtual void DidFailLoad(int64 frame_id, + const GURL& validated_url, + bool is_main_frame, + int error_code, + const string16& error_description) OVERRIDE; + virtual void PluginCrashed(const FilePath& plugin_path) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + // Override to provide a thread safe implementation. + virtual bool Send(IPC::Message* message) OVERRIDE; + + // content::WebContentsObserver::OnMessageReceived() message handlers. + void OnFrameIdentified(int64 frame_id, int64 parent_frame_id, string16 name); + void OnLoadingURLChange(const GURL& pending_url); + void OnRequest(const Cef_Request_Params& params); + void OnResponse(const Cef_Response_Params& params); + void OnResponseAck(int request_id); + + // content::NotificationObserver methods. + virtual void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) OVERRIDE; + + CefBrowserHostImpl(const CefWindowInfo& window_info, + const CefBrowserSettings& settings, + CefRefPtr client, + content::WebContents* web_contents, + CefWindowHandle opener); + + // Initialize settings based on the specified RenderViewHost. + void SetRenderViewHost(content::RenderViewHost* rvh); + + // Updates and returns an existing frame or creates a new frame. Pass + // CefFrameHostImpl::kUnspecifiedFrameId for |parent_frame_id| if unknown. + CefRefPtr GetOrCreateFrame(int64 frame_id, + int64 parent_frame_id, + bool is_main_frame, + string16 frame_name, + const GURL& frame_url); + // Remove the reference to the frame and mark it as detached. + void DetachFrame(int64 frame_id); + // Remove the references to all frames and mark them as detached. + void DetachAllFrames(); + // Set the frame that currently has focus. + void SetFocusedFrame(int64 frame_id); + +#if defined(OS_WIN) + static LPCTSTR GetWndClass(); + static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam); +#endif + + // Create the window. + bool PlatformCreateWindow(); + // Sends a message via the OS to close the native browser window. + // DestroyBrowser will be called after the native window has closed. + void PlatformCloseWindow(); + // Resize the window to the given dimensions. + void PlatformSizeTo(int width, int height); + // Return the handle for this window. + CefWindowHandle PlatformGetWindowHandle(); + // Open the specified text in the default text editor. + bool PlatformViewText(const std::string& text); + // Forward the keyboard event to the application or frame window to allow + // processing of shortcut keys. + void PlatformHandleKeyboardEvent( + const content::NativeWebKeyboardEvent& event); + // Invoke platform specific file open chooser. + void PlatformRunFileChooser( + content::WebContents* contents, + const content::FileChooserParams& params, + std::vector& files); + // Invoke platform specific handling for the external protocol. + void PlatformHandleExternalProtocol(const GURL& url); + + void OnAddressChange(CefRefPtr frame, + const GURL& url); + void OnLoadStart(CefRefPtr frame, + const GURL& url, + content::PageTransition transition_type); + void OnLoadError(CefRefPtr frame, + const GURL& url, + int error_code, + const string16& error_description); + void OnLoadEnd(CefRefPtr frame, + const GURL& url); + + CefWindowInfo window_info_; + CefBrowserSettings settings_; + CefRefPtr client_; + scoped_ptr web_contents_; + CefWindowHandle opener_; + + // Unique ids used for routing communication to/from the renderer. We keep a + // copy of them as member variables so that we can locate matching browsers in + // a thread safe manner. All access must be protected by the state lock. + int render_process_id_; + int render_view_id_; + + // Unique id for the browser. + int unique_id_; + + // True if the browser has received the page title for the current load. + bool received_page_title_; + + // Used when creating a new popup window. + CefWindowInfo pending_window_info_; + CefBrowserSettings pending_settings_; + CefRefPtr pending_client_; + + // Volatile state information. All access must be protected by the state lock. + base::Lock state_lock_; + bool is_loading_; + bool can_go_back_; + bool can_go_forward_; + bool has_document_; + GURL loading_url_; + CefString devtools_url_http_; + CefString devtools_url_chrome_; + + // Messages we queue while waiting for the RenderView to be ready. We queue + // them here instead of in the RenderProcessHost to ensure that they're sent + // after the CefRenderViewObserver has been created on the renderer side. + std::queue queued_messages_; + bool queue_messages_; + + // Map of unique frame ids to CefFrameHostImpl references. + typedef std::map > FrameMap; + FrameMap frames_; + // The unique frame id currently identified as the main frame. + int64 main_frame_id_; + // The unique frame id currently identified as the focused frame. + int64 focused_frame_id_; + // Used when no other frame exists. Provides limited functionality. + CefRefPtr placeholder_frame_; + + // True if currently in the OnSetFocus callback. Only accessed on the UI + // thread. + bool is_in_onsetfocus_; + + // True if the focus is currently on an editable field on the page. Only + // accessed on the UI thread. + bool focus_on_editable_field_; + + // Used for managing notification subscriptions. + scoped_ptr registrar_; + + // Used for proxying cookie requests. + scoped_refptr request_context_proxy_; + + // Manages response registrations. + scoped_ptr response_manager_; + + // Used for creating and managing JavaScript dialogs. + scoped_ptr dialog_creator_; + + // Used for creating and managing context menus. + scoped_ptr menu_creator_; + + IMPLEMENT_REFCOUNTING(CefBrowserHostImpl); + DISALLOW_EVIL_CONSTRUCTORS(CefBrowserHostImpl); +}; + +#endif // CEF_LIBCEF_BROWSER_BROWSER_HOST_IMPL_H_ diff --git a/libcef/browser/browser_host_impl_gtk.cc b/libcef/browser/browser_host_impl_gtk.cc new file mode 100644 index 000000000..7c0c89475 --- /dev/null +++ b/libcef/browser/browser_host_impl_gtk.cc @@ -0,0 +1,143 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/browser_host_impl.h" + +#include + +#include "libcef/browser/thread_util.h" + +#include "base/bind.h" +#include "content/public/browser/web_contents_view.h" +#include "content/public/common/renderer_preferences.h" + +namespace { + +void DestroyBrowser(CefRefPtr browser) { + browser->DestroyBrowser(); + browser->Release(); +} + +void window_destroyed(GtkWidget* widget, CefBrowserHostImpl* browser) { + // Destroy the browser host after window destruction is complete. + CEF_POST_TASK(CEF_UIT, base::Bind(DestroyBrowser, browser)); +} + +} // namespace + +bool CefBrowserHostImpl::PlatformCreateWindow() { + GtkWidget* window; + GtkWidget* parentView = window_info_.parent_widget; + + if (parentView == NULL) { + // Create a new window. + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_default_size(GTK_WINDOW(window), 800, 600); + + parentView = gtk_vbox_new(FALSE, 0); + + gtk_container_add(GTK_CONTAINER(window), parentView); + gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); + gtk_widget_show_all(GTK_WIDGET(window)); + + window_info_.parent_widget = parentView; + } + + // Add a reference that will be released in the destroy handler. + AddRef(); + + // Parent the TabContents to the browser window. + window_info_.widget = web_contents_->GetView()->GetNativeView(); + gtk_container_add(GTK_CONTAINER(window_info_.parent_widget), + window_info_.widget); + + g_signal_connect(G_OBJECT(window_info_.widget), "destroy", + G_CALLBACK(window_destroyed), this); + + // As an additional requirement on Linux, we must set the colors for the + // render widgets in webkit. + content::RendererPreferences* prefs = + web_contents_->GetMutableRendererPrefs(); + prefs->focus_ring_color = SkColorSetARGB(255, 229, 151, 0); + prefs->thumb_active_color = SkColorSetRGB(244, 244, 244); + prefs->thumb_inactive_color = SkColorSetRGB(234, 234, 234); + prefs->track_color = SkColorSetRGB(211, 211, 211); + + prefs->active_selection_bg_color = SkColorSetRGB(30, 144, 255); + prefs->active_selection_fg_color = SK_ColorWHITE; + prefs->inactive_selection_bg_color = SkColorSetRGB(200, 200, 200); + prefs->inactive_selection_fg_color = SkColorSetRGB(50, 50, 50); + + return true; +} + +void CefBrowserHostImpl::PlatformCloseWindow() { + if (window_info_.widget != NULL) { + GtkWidget* window = + gtk_widget_get_toplevel(GTK_WIDGET(window_info_.widget)); + gtk_widget_destroy(window); + } +} + +void CefBrowserHostImpl::PlatformSizeTo(int width, int height) { + if (window_info_.widget != NULL) { + GtkWidget* window = + gtk_widget_get_toplevel(GTK_WIDGET(window_info_.widget)); + gtk_widget_set_size_request(window, width, height); + } +} + +CefWindowHandle CefBrowserHostImpl::PlatformGetWindowHandle() { + return window_info_.widget; +} + +bool CefBrowserHostImpl::PlatformViewText(const std::string& text) { + CEF_REQUIRE_UIT(); + + char buff[] = "/tmp/CEFSourceXXXXXX"; + int fd = mkstemp(buff); + + if (fd == -1) + return false; + + FILE* srcOutput = fdopen(fd, "w+"); + if (!srcOutput) + return false; + + if (fputs(text.c_str(), srcOutput) < 0) { + fclose(srcOutput); + return false; + } + + fclose(srcOutput); + + std::string newName(buff); + newName.append(".txt"); + if (rename(buff, newName.c_str()) != 0) + return false; + + std::string openCommand("xdg-open "); + openCommand += newName; + + if (system(openCommand.c_str()) != 0) + return false; + + return true; +} + +void CefBrowserHostImpl::PlatformHandleKeyboardEvent( + const content::NativeWebKeyboardEvent& event) { + // TODO(cef): Is something required here to handle shortcut keys? +} + +void CefBrowserHostImpl::PlatformRunFileChooser( + content::WebContents* contents, + const content::FileChooserParams& params, + std::vector& files) { + NOTIMPLEMENTED(); +} + +void CefBrowserHostImpl::PlatformHandleExternalProtocol(const GURL& url) { +} diff --git a/libcef/browser/browser_host_impl_mac.mm b/libcef/browser/browser_host_impl_mac.mm new file mode 100644 index 000000000..4cb3d4ca1 --- /dev/null +++ b/libcef/browser/browser_host_impl_mac.mm @@ -0,0 +1,242 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/browser_host_impl.h" + +#import +#import + +#include "base/file_util.h" +#include "base/mac/mac_util.h" +#include "base/string_util.h" +#include "base/sys_string_conversions.h" +#include "base/threading/thread_restrictions.h" +#include "content/public/browser/native_web_keyboard_event.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/web_contents_view.h" +#include "content/public/common/file_chooser_params.h" +#import "ui/base/cocoa/underlay_opengl_hosting_window.h" +#include "ui/gfx/rect.h" + + +// Wrapper NSView for the native view. Necessary to destroy the browser when +// the view is deleted. +@interface CefBrowserHostView : NSView { + @private + CefBrowserHostImpl* browser_; // weak + bool is_in_onsetfocus_; +} + +@property (nonatomic, assign) CefBrowserHostImpl* browser; + +@end + +@implementation CefBrowserHostView + +@synthesize browser = browser_; + +- (void) dealloc { + if (browser_) { + browser_->DestroyBrowser(); + browser_->Release(); + } + + [super dealloc]; +} + +- (BOOL)acceptsFirstResponder { + return browser_ && browser_->GetWebContents(); +} + +- (BOOL)becomeFirstResponder { + if (browser_ && browser_->GetWebContents()) { + // Avoid re-entering OnSetFocus. + if (!is_in_onsetfocus_) { + is_in_onsetfocus_ = true; + browser_->OnSetFocus(FOCUS_SOURCE_SYSTEM); + is_in_onsetfocus_ = false; + } + } + + return YES; +} + +@end + +namespace { + +// Accept-types to file-types helper. +NSMutableArray* GetFileTypesFromAcceptTypes( + const std::vector& accept_types) { + NSMutableArray* acceptArray = [[NSMutableArray alloc] init]; + for (size_t i=0; iGetView()->GetNativeView(); + [browser_view addSubview:native_view]; + [native_view setFrame:bounds]; + [native_view setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; + [native_view setNeedsDisplay:YES]; + + window_info_.view = browser_view; + + if (newWnd != nil && !window_info_.hidden) { + // Show the window. + [newWnd makeKeyAndOrderFront: nil]; + } + + return true; +} + +void CefBrowserHostImpl::PlatformCloseWindow() { + if (window_info_.view != nil) { + [[window_info_.view window] performSelector:@selector(performClose:) + withObject:nil + afterDelay:0]; + } +} + +void CefBrowserHostImpl::PlatformSizeTo(int width, int height) { + // Not needed; subviews are bound. +} + +CefWindowHandle CefBrowserHostImpl::PlatformGetWindowHandle() { + return window_info_.view; +} + +void CefBrowserHostImpl::PlatformHandleKeyboardEvent( + const content::NativeWebKeyboardEvent& event) { + // Give the top level menu equivalents a chance to handle the event. + if ([event.os_event type] == NSKeyDown) + [[NSApp mainMenu] performKeyEquivalent:event.os_event]; +} + +void CefBrowserHostImpl::PlatformRunFileChooser( + content::WebContents* contents, + const content::FileChooserParams& params, + std::vector& files) { + NSOpenPanel* openPanel = [NSOpenPanel openPanel]; + if (!params.title.empty()) + [openPanel setTitle:base::SysUTF16ToNSString(params.title)]; + + // Consider default file name if any. + FilePath default_file_name(params.default_file_name); + + if (!default_file_name.empty()) { + if (!default_file_name.BaseName().empty()) { + NSString* defaultName = base::SysUTF8ToNSString( + default_file_name.BaseName().value()); + [openPanel setNameFieldStringValue:defaultName]; + } + + if (!default_file_name.DirName().empty()) { + NSString* defaultDir = base::SysUTF8ToNSString( + default_file_name.DirName().value()); + [openPanel setDirectoryURL:[NSURL fileURLWithPath:defaultDir]]; + } + } + + // Consider supported file types + if (!params.accept_types.empty()) { + [openPanel setAllowedFileTypes:GetFileTypesFromAcceptTypes( + params.accept_types)]; + } + + // Further panel configuration. + [openPanel setAllowsOtherFileTypes:YES]; + [openPanel setAllowsMultipleSelection: + (params.mode == content::FileChooserParams::OpenMultiple)]; + [openPanel setCanChooseFiles:YES]; + [openPanel setCanChooseDirectories:NO]; + + // Show panel. + NSView* view = contents->GetNativeView(); + [openPanel beginSheetModalForWindow:[view window] completionHandler:nil]; + if ([openPanel runModal] == NSFileHandlingPanelOKButton) { + NSArray *urls = [openPanel URLs]; + int i, count = [urls count]; + for (i=0; i +#include +#include +#include +#include + +#include "libcef/browser/thread_util.h" + +#include "base/string_util.h" +#include "base/utf_string_conversions.h" +#include "base/win/registry.h" +#include "base/win/windows_version.h" +#include "content/public/browser/native_web_keyboard_event.h" +#include "content/public/browser/web_contents_view.h" +#include "content/public/common/file_chooser_params.h" +#include "ui/base/win/hwnd_util.h" + +#pragma comment(lib, "dwmapi.lib") + +namespace { + +bool IsAeroGlassEnabled() { + if (base::win::GetVersion() < base::win::VERSION_VISTA) + return false; + + BOOL enabled = FALSE; + return SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled; +} + +void SetAeroGlass(HWND hWnd) { + if (!IsAeroGlassEnabled()) + return; + + // Make the whole window transparent. + MARGINS mgMarInset = { -1, -1, -1, -1 }; + DwmExtendFrameIntoClientArea(hWnd, &mgMarInset); +} + +void WriteTextToFile(const std::string& data, const std::wstring& file_path) { + FILE* fp; + errno_t err = _wfopen_s(&fp, file_path.c_str(), L"wt"); + if (err) + return; + fwrite(data.c_str(), 1, data.size(), fp); + fclose(fp); +} + + +// from chrome/browser/views/shell_dialogs_win.cc + +bool RunOpenFileDialog(const std::wstring& filter, HWND owner, FilePath* path) { + OPENFILENAME ofn; + + // We must do this otherwise the ofn's FlagsEx may be initialized to random + // junk in release builds which can cause the Places Bar not to show up! + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = owner; + + wchar_t filename[MAX_PATH]; + base::wcslcpy(filename, path->value().c_str(), arraysize(filename)); + + ofn.lpstrFile = filename; + ofn.nMaxFile = MAX_PATH; + + // We use OFN_NOCHANGEDIR so that the user can rename or delete the directory + // without having to close Chrome first. + ofn.Flags = OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR; + + if (!filter.empty()) { + ofn.lpstrFilter = filter.c_str(); + } + bool success = !!GetOpenFileName(&ofn); + if (success) + *path = FilePath(filename); + return success; +} + +bool RunOpenMultiFileDialog(const std::wstring& filter, HWND owner, + std::vector* paths) { + OPENFILENAME ofn; + + // We must do this otherwise the ofn's FlagsEx may be initialized to random + // junk in release builds which can cause the Places Bar not to show up! + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = owner; + + scoped_array filename(new wchar_t[UNICODE_STRING_MAX_CHARS]); + filename[0] = 0; + + ofn.lpstrFile = filename.get(); + ofn.nMaxFile = UNICODE_STRING_MAX_CHARS; + + // We use OFN_NOCHANGEDIR so that the user can rename or delete the directory + // without having to close Chrome first. + ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_EXPLORER + | OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT; + + if (!filter.empty()) { + ofn.lpstrFilter = filter.c_str(); + } + bool success = !!GetOpenFileName(&ofn); + + if (success) { + std::vector files; + const wchar_t* selection = ofn.lpstrFile; + while (*selection) { // Empty string indicates end of list. + files.push_back(FilePath(selection)); + // Skip over filename and null-terminator. + selection += files.back().value().length() + 1; + } + if (files.empty()) { + success = false; + } else if (files.size() == 1) { + // When there is one file, it contains the path and filename. + paths->swap(files); + } else { + // Otherwise, the first string is the path, and the remainder are + // filenames. + std::vector::iterator path = files.begin(); + for (std::vector::iterator file = path + 1; + file != files.end(); ++file) { + paths->push_back(path->Append(*file)); + } + } + } + return success; +} + + +// According to Mozilla in uriloader/exthandler/win/nsOSHelperAppService.cpp: +// "Some versions of windows (Win2k before SP3, Win XP before SP1) crash in +// ShellExecute on long URLs (bug 161357 on bugzilla.mozilla.org). IE 5 and 6 +// support URLS of 2083 chars in length, 2K is safe." +const int kMaxAddressLengthChars = 2048; + +bool HasExternalHandler(const std::string& scheme) { + base::win::RegKey key; + const std::wstring registry_path = + ASCIIToWide(scheme + "\\shell\\open\\command"); + key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ); + if (key.Valid()) { + DWORD size = 0; + key.ReadValue(NULL, NULL, &size, NULL); + if (size > 2) { + // ShellExecute crashes the process when the command is empty. + // We check for "2" because it always returns the trailing NULL. + return true; + } + } + + return false; +} + +} // namespace + +// static +void CefBrowserHostImpl::RegisterWindowClass() { + // Register the window class + WNDCLASSEX wcex = { + /* cbSize = */ sizeof(WNDCLASSEX), + /* style = */ CS_HREDRAW | CS_VREDRAW, + /* lpfnWndProc = */ CefBrowserHostImpl::WndProc, + /* cbClsExtra = */ 0, + /* cbWndExtra = */ 0, + /* hInstance = */ ::GetModuleHandle(NULL), + /* hIcon = */ NULL, + /* hCursor = */ LoadCursor(NULL, IDC_ARROW), + /* hbrBackground = */ 0, + /* lpszMenuName = */ NULL, + /* lpszClassName = */ CefBrowserHostImpl::GetWndClass(), + /* hIconSm = */ NULL, + }; + RegisterClassEx(&wcex); +} + +// static +LPCTSTR CefBrowserHostImpl::GetWndClass() { + return L"CefBrowserWindow"; +} + +// static +LRESULT CALLBACK CefBrowserHostImpl::WndProc(HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam) { + CefBrowserHostImpl* browser = + static_cast(ui::GetWindowUserData(hwnd)); + + switch (message) { + case WM_CLOSE: + if (browser) { + bool handled(false); + + if (browser->client_.get()) { + CefRefPtr handler = + browser->client_->GetLifeSpanHandler(); + if (handler.get()) { + // Give the client a chance to handle this one. + handled = handler->DoClose(browser); + } + } + + if (handled) + return 0; + + // We are our own parent in this case. + browser->ParentWindowWillClose(); + } + break; + + case WM_DESTROY: + if (browser) { + // Clear the user data pointer. + ui::SetWindowUserData(hwnd, NULL); + + // Destroy the browser. + browser->DestroyBrowser(); + + // Release the reference added in PlatformCreateWindow(). + browser->Release(); + } + return 0; + + case WM_SIZE: + // Minimizing resizes the window to 0x0 which causes our layout to go all + // screwy, so we just ignore it. + if (wParam != SIZE_MINIMIZED && browser) { + // resize the web view window to the full size of the browser window + RECT rc; + GetClientRect(hwnd, &rc); + MoveWindow(browser->GetContentView(), 0, 0, rc.right, rc.bottom, + TRUE); + } + return 0; + + case WM_SETFOCUS: + if (browser) + browser->OnSetFocus(FOCUS_SOURCE_SYSTEM); + return 0; + + case WM_ERASEBKGND: + return 0; + + case WM_DWMCOMPOSITIONCHANGED: + // Message sent to top-level windows when composition has been enabled or + // disabled. + if (browser && browser->window_info_.transparent_painting) + SetAeroGlass(hwnd); + break; + } + + return DefWindowProc(hwnd, message, wParam, lParam); +} + +bool CefBrowserHostImpl::PlatformCreateWindow() { + std::wstring windowName(CefString(&window_info_.window_name)); + + // Create the new browser window. + window_info_.window = CreateWindowEx(window_info_.ex_style, + GetWndClass(), windowName.c_str(), window_info_.style, + window_info_.x, window_info_.y, window_info_.width, + window_info_.height, window_info_.parent_window, window_info_.menu, + ::GetModuleHandle(NULL), NULL); + + // It's possible for CreateWindowEx to fail if the parent window was + // destroyed between the call to CreateBrowser and the above one. + DCHECK(window_info_.window != NULL); + if (!window_info_.window) + return false; + + if (window_info_.transparent_painting && + !(window_info_.style & WS_CHILD)) { + // Transparent top-level windows will be given "sheet of glass" effect. + SetAeroGlass(window_info_.window); + } + + // Set window user data to this object for future reference from the window + // procedure. + ui::SetWindowUserData(window_info_.window, this); + + // Add a reference that will be released in the WM_DESTROY handler. + AddRef(); + + // Parent the TabContents to the browser window. + SetParent(web_contents_->GetView()->GetNativeView(), window_info_.window); + + // Size the web view window to the browser window. + RECT cr; + GetClientRect(window_info_.window, &cr); + + // Respect the WS_VISIBLE window style when setting the window's position. + UINT flags = SWP_NOZORDER | SWP_SHOWWINDOW; + if (!(window_info_.style & WS_VISIBLE)) + flags |= SWP_NOACTIVATE; + + SetWindowPos(GetContentView(), NULL, cr.left, cr.top, cr.right, + cr.bottom, flags); + + return true; +} + +void CefBrowserHostImpl::PlatformCloseWindow() { + if (window_info_.window != NULL) + PostMessage(window_info_.window, WM_CLOSE, 0, 0); +} + +void CefBrowserHostImpl::PlatformSizeTo(int width, int height) { + RECT rect = {0, 0, width, height}; + DWORD style = GetWindowLong(window_info_.window, GWL_STYLE); + DWORD ex_style = GetWindowLong(window_info_.window, GWL_EXSTYLE); + bool has_menu = !(style & WS_CHILD) && (GetMenu(window_info_.window) != NULL); + + // The size value is for the client area. Calculate the whole window size + // based on the current style. + AdjustWindowRectEx(&rect, style, has_menu, ex_style); + + // Size the window. + SetWindowPos(window_info_.window, NULL, 0, 0, rect.right, + rect.bottom, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); +} + +CefWindowHandle CefBrowserHostImpl::PlatformGetWindowHandle() { + return window_info_.window; +} + +bool CefBrowserHostImpl::PlatformViewText(const std::string& text) { + CEF_REQUIRE_UIT(); + + DWORD dwRetVal; + DWORD dwBufSize = 512; + TCHAR lpPathBuffer[512]; + UINT uRetVal; + TCHAR szTempName[512]; + + dwRetVal = GetTempPath(dwBufSize, // length of the buffer + lpPathBuffer); // buffer for path + if (dwRetVal > dwBufSize || (dwRetVal == 0)) + return false; + + // Create a temporary file. + uRetVal = GetTempFileName(lpPathBuffer, // directory for tmp files + TEXT("src"), // temp file name prefix + 0, // create unique name + szTempName); // buffer for name + if (uRetVal == 0) + return false; + + size_t len = wcslen(szTempName); + wcscpy(szTempName + len - 3, L"txt"); + WriteTextToFile(text, szTempName); + + HWND frameWnd = GetAncestor(PlatformGetWindowHandle(), GA_ROOT); + int errorCode = reinterpret_cast(ShellExecute(frameWnd, L"open", + szTempName, NULL, NULL, SW_SHOWNORMAL)); + if (errorCode <= 32) + return false; + + return true; +} + +void CefBrowserHostImpl::PlatformHandleKeyboardEvent( + const content::NativeWebKeyboardEvent& event) { + // Any unhandled keyboard/character messages are sent to DefWindowProc so that + // shortcut keys work correctly. + DefWindowProc(event.os_event.hwnd, event.os_event.message, + event.os_event.wParam, event.os_event.lParam); +} + +void CefBrowserHostImpl::PlatformRunFileChooser( + content::WebContents* contents, + const content::FileChooserParams& params, + std::vector& files) { + if (params.mode == content::FileChooserParams::OpenMultiple) { + RunOpenMultiFileDialog(L"", PlatformGetWindowHandle(), &files); + } else { + FilePath file_name; + if (RunOpenFileDialog(L"", PlatformGetWindowHandle(), &file_name)) + files.push_back(file_name); + } +} + +void CefBrowserHostImpl::PlatformHandleExternalProtocol(const GURL& url) { + if (CEF_CURRENTLY_ON_FILET()) { + if (!HasExternalHandler(url.scheme())) + return; + + const std::string& address = url.spec(); + if (address.length() > kMaxAddressLengthChars) + return; + + ShellExecuteA(NULL, "open", address.c_str(), NULL, NULL, SW_SHOWNORMAL); + } else { + // Execute on the FILE thread. + CEF_POST_TASK(CEF_FILET, + base::Bind(&CefBrowserHostImpl::PlatformHandleExternalProtocol, this, + url)); + } +} diff --git a/libcef/browser/browser_main.cc b/libcef/browser/browser_main.cc new file mode 100644 index 000000000..18074fbc8 --- /dev/null +++ b/libcef/browser/browser_main.cc @@ -0,0 +1,93 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/browser_main.h" + +#include + +#include "libcef/browser/browser_context.h" +#include "libcef/browser/browser_message_loop.h" +#include "libcef/browser/content_browser_client.h" +#include "libcef/browser/devtools_delegate.h" + +#include "base/bind.h" +#include "base/command_line.h" +#include "base/message_loop.h" +#include "base/string_number_conversions.h" +#include "base/threading/thread.h" +#include "base/threading/thread_restrictions.h" +#include "content/browser/browser_process_sub_thread.h" +#include "content/browser/download/download_file_manager.h" +#include "content/browser/download/save_file_manager.h" +#include "content/browser/plugin_service_impl.h" +#include "content/public/browser/gpu_data_manager.h" +#include "content/public/common/content_client.h" +#include "content/public/common/content_switches.h" +#include "net/base/net_module.h" +#include "ui/base/resource/resource_bundle.h" + +namespace { + +base::StringPiece ResourceProvider(int resource_id) { + return content::GetContentClient()->GetDataResource(resource_id, + ui::SCALE_FACTOR_NONE); +} + +} // namespace + +CefBrowserMainParts::CefBrowserMainParts( + const content::MainFunctionParams& parameters) + : BrowserMainParts(), + devtools_delegate_(NULL) { +} + +CefBrowserMainParts::~CefBrowserMainParts() { +} + +void CefBrowserMainParts::PreMainMessageLoopStart() { + if (!MessageLoop::current()) { + // Create the browser message loop. + message_loop_.reset(new CefBrowserMessageLoop()); + message_loop_->set_thread_name("CrBrowserMain"); + } +} + +int CefBrowserMainParts::PreCreateThreads() { + PlatformInitialize(); + net::NetModule::SetResourceProvider(&ResourceProvider); + + // Initialize the GpuDataManager before IO access restrictions are applied and + // before the IO thread is started. + content::GpuDataManager::GetInstance(); + + return 0; +} + +void CefBrowserMainParts::PreMainMessageLoopRun() { + browser_context_.reset(new CefBrowserContext()); + + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) { + std::string port_str = + command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort); + int port; + if (base::StringToInt(port_str, &port) && port > 0 && port < 65535) { + devtools_delegate_ = new CefDevToolsDelegate( + port, + browser_context_->GetRequestContext()); + } else { + DLOG(WARNING) << "Invalid http debugger port number " << port; + } + } +} + +void CefBrowserMainParts::PostMainMessageLoopRun() { + if (devtools_delegate_) + devtools_delegate_->Stop(); + browser_context_.reset(); +} + +void CefBrowserMainParts::PostDestroyThreads() { + PlatformCleanup(); +} diff --git a/libcef/browser/browser_main.h b/libcef/browser/browser_main.h new file mode 100644 index 000000000..ffbad5d32 --- /dev/null +++ b/libcef/browser/browser_main.h @@ -0,0 +1,52 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_ +#define CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_ +#pragma once + +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "base/string_piece.h" +#include "content/public/browser/browser_main_parts.h" + +namespace base { +class Thread; +} + +namespace content { +struct MainFunctionParams; +} + +class CefBrowserContext; +class CefDevToolsDelegate; +class MessageLoop; + +class CefBrowserMainParts : public content::BrowserMainParts { + public: + explicit CefBrowserMainParts(const content::MainFunctionParams& parameters); + virtual ~CefBrowserMainParts(); + + virtual void PreMainMessageLoopStart() OVERRIDE; + virtual int PreCreateThreads() OVERRIDE; + virtual void PreMainMessageLoopRun() OVERRIDE; + virtual void PostMainMessageLoopRun() OVERRIDE; + virtual void PostDestroyThreads() OVERRIDE; + + CefBrowserContext* browser_context() const { return browser_context_.get(); } + CefDevToolsDelegate* devtools_delegate() const { return devtools_delegate_; } + + private: + void PlatformInitialize(); + void PlatformCleanup(); + + scoped_ptr browser_context_; + + scoped_ptr message_loop_; + CefDevToolsDelegate* devtools_delegate_; + + DISALLOW_COPY_AND_ASSIGN(CefBrowserMainParts); +}; + +#endif // CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_ diff --git a/libcef/browser/browser_main_gtk.cc b/libcef/browser/browser_main_gtk.cc new file mode 100644 index 000000000..0f547f331 --- /dev/null +++ b/libcef/browser/browser_main_gtk.cc @@ -0,0 +1,15 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +#include "libcef/browser/browser_main.h" + +#include "base/string_piece.h" + +void CefBrowserMainParts::PlatformInitialize() { +} + +void CefBrowserMainParts::PlatformCleanup() { +} diff --git a/libcef/browser/browser_main_mac.mm b/libcef/browser/browser_main_mac.mm new file mode 100644 index 000000000..19170320f --- /dev/null +++ b/libcef/browser/browser_main_mac.mm @@ -0,0 +1,13 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/browser_main.h" + +#include "base/string_piece.h" + +void CefBrowserMainParts::PlatformInitialize() { +} + +void CefBrowserMainParts::PlatformCleanup() { +} diff --git a/libcef/browser/browser_main_win.cc b/libcef/browser/browser_main_win.cc new file mode 100644 index 000000000..45109e3a4 --- /dev/null +++ b/libcef/browser/browser_main_win.cc @@ -0,0 +1,35 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include +#include +#include + +#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/browser_main.h" + +#include "base/string_piece.h" +#include "base/win/resource_util.h" + +void CefBrowserMainParts::PlatformInitialize() { + HRESULT res; + + // Initialize common controls. + res = CoInitialize(NULL); + DCHECK(SUCCEEDED(res)); + INITCOMMONCONTROLSEX InitCtrlEx; + InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX); + InitCtrlEx.dwICC = ICC_STANDARD_CLASSES; + InitCommonControlsEx(&InitCtrlEx); + + // Start COM stuff. + res = OleInitialize(NULL); + DCHECK(SUCCEEDED(res)); + + // Register the browser window class. + CefBrowserHostImpl::RegisterWindowClass(); +} + +void CefBrowserMainParts::PlatformCleanup() { +} diff --git a/libcef/browser/browser_message_filter.cc b/libcef/browser/browser_message_filter.cc new file mode 100644 index 000000000..72e22bb91 --- /dev/null +++ b/libcef/browser/browser_message_filter.cc @@ -0,0 +1,52 @@ +/// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/browser_message_filter.h" + +#include "libcef/browser/origin_whitelist_impl.h" +#include "libcef/browser/thread_util.h" +#include "libcef/common/cef_messages.h" + +#include "base/compiler_specific.h" +#include "base/bind.h" + +CefBrowserMessageFilter::CefBrowserMessageFilter( + content::RenderProcessHost* host) + : host_(host), + channel_(NULL) { +} + +CefBrowserMessageFilter::~CefBrowserMessageFilter() { +} + +void CefBrowserMessageFilter::OnFilterAdded(IPC::Channel* channel) { + channel_ = channel; +} + +void CefBrowserMessageFilter::OnFilterRemoved() { +} + +bool CefBrowserMessageFilter::OnMessageReceived(const IPC::Message& message) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(CefBrowserMessageFilter, message) + IPC_MESSAGE_HANDLER(CefProcessHostMsg_RenderThreadStarted, + OnRenderThreadStarted) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + return handled; +} + +void CefBrowserMessageFilter::OnRenderThreadStarted() { + // Execute registration on the UI thread. + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBrowserMessageFilter::RegisterOnUIThread, this)); +} + +void CefBrowserMessageFilter::RegisterOnUIThread() { + CEF_REQUIRE_UIT(); + + // Send existing registrations to the new render process. + RegisterCrossOriginWhitelistEntriesWithHost(host_); +} diff --git a/libcef/browser/browser_message_filter.h b/libcef/browser/browser_message_filter.h new file mode 100644 index 000000000..023b6acfb --- /dev/null +++ b/libcef/browser/browser_message_filter.h @@ -0,0 +1,40 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_FILTER_H_ +#define CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_FILTER_H_ + +#include +#include "ipc/ipc_channel_proxy.h" + +namespace content { +class RenderProcessHost; +} + +// This class sends and receives control messages on the browser process. +class CefBrowserMessageFilter : public IPC::ChannelProxy::MessageFilter { + public: + explicit CefBrowserMessageFilter(content::RenderProcessHost* host); + virtual ~CefBrowserMessageFilter(); + + // IPC::ChannelProxy::MessageFilter implementation. + virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; + virtual void OnFilterRemoved() OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + + private: + // Message handlers. + void OnRenderThreadStarted(); + + void RegisterOnUIThread(); + + content::RenderProcessHost* host_; + IPC::Channel* channel_; + + DISALLOW_COPY_AND_ASSIGN(CefBrowserMessageFilter); +}; + + +#endif // CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_FILTER_H_ diff --git a/libcef/browser/browser_message_loop.cc b/libcef/browser/browser_message_loop.cc new file mode 100644 index 000000000..c38b46d55 --- /dev/null +++ b/libcef/browser/browser_message_loop.cc @@ -0,0 +1,46 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/browser_message_loop.h" + +CefBrowserMessageLoop::CefBrowserMessageLoop() + : is_iterating_(true) { +} + +CefBrowserMessageLoop::~CefBrowserMessageLoop() { +#if defined(OS_MACOSX) + // On Mac the MessageLoop::AutoRunState scope in Run() never exits so clear + // the state_ variable to avoid an assertion in the MessageLoop destructor. + state_ = NULL; +#endif +} + +// static +CefBrowserMessageLoop* CefBrowserMessageLoop::current() { + MessageLoop* loop = MessageLoop::current(); + DCHECK_EQ(MessageLoop::TYPE_UI, loop->type()); + return static_cast(loop); +} + +bool CefBrowserMessageLoop::DoIdleWork() { + bool valueToRet = inherited::DoIdleWork(); + if (is_iterating_) + pump_->Quit(); + return valueToRet; +} + +// Do a single interation of the UI message loop. +void CefBrowserMessageLoop::DoMessageLoopIteration() { +#if defined(OS_MACOSX) + Run(); +#else + RunWithDispatcher(NULL); +#endif +} + +// Run the UI message loop. +void CefBrowserMessageLoop::RunMessageLoop() { + is_iterating_ = false; + DoMessageLoopIteration(); +} diff --git a/libcef/browser/browser_message_loop.h b/libcef/browser/browser_message_loop.h new file mode 100644 index 000000000..04bfeb9a5 --- /dev/null +++ b/libcef/browser/browser_message_loop.h @@ -0,0 +1,40 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_LOOP_H_ +#define CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_LOOP_H_ +#pragma once + +#include "base/basictypes.h" +#include "base/message_loop.h" + +// Class used to process events on the current message loop. +class CefBrowserMessageLoop : public MessageLoopForUI { + typedef MessageLoopForUI inherited; + + public: + CefBrowserMessageLoop(); + virtual ~CefBrowserMessageLoop(); + + // Returns the MessageLoopForUI of the current thread. + static CefBrowserMessageLoop* current(); + + virtual bool DoIdleWork(); + + // Do a single interation of the UI message loop. + void DoMessageLoopIteration(); + + // Run the UI message loop. + void RunMessageLoop(); + + bool is_iterating() { return is_iterating_; } + + private: + // True if the message loop is doing one iteration at a time. + bool is_iterating_; + + DISALLOW_COPY_AND_ASSIGN(CefBrowserMessageLoop); +}; + +#endif // CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_LOOP_H_ diff --git a/libcef/browser/browser_settings.cc b/libcef/browser/browser_settings.cc new file mode 100644 index 000000000..33feb8db9 --- /dev/null +++ b/libcef/browser/browser_settings.cc @@ -0,0 +1,190 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/browser_settings.h" + +#include + +#include "include/internal/cef_types_wrappers.h" + +#include "base/file_path.h" +#include "base/utf_string_conversions.h" +#include "content/browser/gpu/gpu_process_host.h" +#include "content/public/browser/gpu_data_manager.h" +#include "webkit/glue/webpreferences.h" + +using webkit_glue::WebPreferences; + +void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web) { + if (cef.standard_font_family.length > 0) { + web.standard_font_family_map[WebPreferences::kCommonScript] = + CefString(&cef.standard_font_family); + } else { + web.standard_font_family_map[WebPreferences::kCommonScript] = + ASCIIToUTF16("Times"); + } + + if (cef.fixed_font_family.length > 0) { + web.fixed_font_family_map[WebPreferences::kCommonScript] = + CefString(&cef.fixed_font_family); + } else { + web.fixed_font_family_map[WebPreferences::kCommonScript] = + ASCIIToUTF16("Courier"); + } + + if (cef.serif_font_family.length > 0) { + web.serif_font_family_map[WebPreferences::kCommonScript] = + CefString(&cef.serif_font_family); + } else { + web.serif_font_family_map[WebPreferences::kCommonScript] = + ASCIIToUTF16("Times"); + } + + if (cef.sans_serif_font_family.length > 0) { + web.sans_serif_font_family_map[WebPreferences::kCommonScript] = + CefString(&cef.sans_serif_font_family); + } else { + web.sans_serif_font_family_map[WebPreferences::kCommonScript] = + ASCIIToUTF16("Helvetica"); + } + + // These two fonts below are picked from the intersection of + // Win XP font list and Vista font list : + // http://www.microsoft.com/typography/fonts/winxp.htm + // http://blogs.msdn.com/michkap/archive/2006/04/04/567881.aspx + // Some of them are installed only with CJK and complex script + // support enabled on Windows XP and are out of consideration here. + // (although we enabled both on our buildbots.) + // They (especially Impact for fantasy) are not typical cursive + // and fantasy fonts, but it should not matter for layout tests + // as long as they're available. + + if (cef.cursive_font_family.length > 0) { + web.cursive_font_family_map[WebPreferences::kCommonScript] = + CefString(&cef.cursive_font_family); + } else { + web.cursive_font_family_map[WebPreferences::kCommonScript] = +#if defined(OS_MACOSX) + ASCIIToUTF16("Apple Chancery"); +#else + ASCIIToUTF16("Comic Sans MS"); +#endif + } + + if (cef.fantasy_font_family.length > 0) { + web.fantasy_font_family_map[WebPreferences::kCommonScript] = + CefString(&cef.fantasy_font_family); + } else { + web.fantasy_font_family_map[WebPreferences::kCommonScript] = +#if defined(OS_MACOSX) + ASCIIToUTF16("Papyrus"); +#else + ASCIIToUTF16("Impact"); +#endif + } + + if (cef.default_font_size > 0) + web.default_font_size = cef.default_font_size; + else + web.default_font_size = 16; + + if (cef.default_fixed_font_size > 0) + web.default_fixed_font_size = cef.default_fixed_font_size; + else + web.default_fixed_font_size = 13; + + if (cef.minimum_font_size > 0) + web.minimum_font_size = cef.minimum_font_size; + else + web.minimum_font_size = 1; + + if (cef.minimum_logical_font_size > 0) + web.minimum_logical_font_size = cef.minimum_logical_font_size; + else + web.minimum_logical_font_size = 9; + + if (cef.default_encoding.length > 0) + web.default_encoding = CefString(&cef.default_encoding); + else + web.default_encoding = "ISO-8859-1"; + + web.javascript_enabled = !cef.javascript_disabled; + web.web_security_enabled = !cef.web_security_disabled; + web.javascript_can_open_windows_automatically = + !cef.javascript_open_windows_disallowed; + web.loads_images_automatically = !cef.image_load_disabled; + web.plugins_enabled = !cef.plugins_disabled; + web.dom_paste_enabled = !cef.dom_paste_disabled; + web.developer_extras_enabled = !cef.developer_tools_disabled; + web.inspector_settings.clear(); + web.site_specific_quirks_enabled = !cef.site_specific_quirks_disabled; + web.shrinks_standalone_images_to_fit = cef.shrink_standalone_images_to_fit; + web.uses_universal_detector = cef.encoding_detector_enabled; + web.text_areas_are_resizable = !cef.text_area_resize_disabled; + web.java_enabled = !cef.java_disabled; + web.allow_scripts_to_close_windows = !cef.javascript_close_windows_disallowed; + web.uses_page_cache = !cef.page_cache_disabled; + web.remote_fonts_enabled = !cef.remote_fonts_disabled; + web.javascript_can_access_clipboard = + !cef.javascript_access_clipboard_disallowed; + web.xss_auditor_enabled = cef.xss_auditor_enabled; + web.local_storage_enabled = !cef.local_storage_disabled; + web.databases_enabled = !cef.databases_disabled; + web.application_cache_enabled = !cef.application_cache_disabled; + web.tabs_to_links = !cef.tab_to_links_disabled; + web.caret_browsing_enabled = cef.caret_browsing_enabled; + web.hyperlink_auditing_enabled = !cef.hyperlink_auditing_disabled; + + web.user_style_sheet_enabled = cef.user_style_sheet_enabled; + + if (cef.user_style_sheet_location.length > 0) { + web.user_style_sheet_location = + GURL(std::string(CefString(&cef.user_style_sheet_location))); + } + + web.author_and_user_styles_enabled = !cef.author_and_user_styles_disabled; + web.allow_universal_access_from_file_urls = + cef.universal_access_from_file_urls_allowed; + web.allow_file_access_from_file_urls = cef.file_access_from_file_urls_allowed; + web.experimental_webgl_enabled = + GpuProcessHost::gpu_enabled() && !cef.webgl_disabled; + web.gl_multisampling_enabled = web.experimental_webgl_enabled; + web.show_composited_layer_borders = false; + web.accelerated_compositing_enabled = + GpuProcessHost::gpu_enabled() && !cef.accelerated_compositing_disabled; + web.accelerated_layers_enabled = !cef.accelerated_layers_disabled; + web.accelerated_video_enabled = !cef.accelerated_video_disabled; + web.accelerated_2d_canvas_enabled = + GpuProcessHost::gpu_enabled() && !cef.accelerated_2d_canvas_disabled; + web.accelerated_painting_enabled = + GpuProcessHost::gpu_enabled() && cef.accelerated_painting_enabled; + web.accelerated_filters_enabled = + GpuProcessHost::gpu_enabled() && cef.accelerated_filters_enabled; + web.accelerated_plugins_enabled = !cef.accelerated_plugins_disabled; + web.memory_info_enabled = false; + web.fullscreen_enabled = cef.fullscreen_enabled; + + // TODO(cef): The GPU black list will need to be initialized. See + // InitializeGpuDataManager() in chrome/browser/chrome_browser_main.cc. + { // Certain GPU features might have been blacklisted. + content::GpuDataManager* gpu_data_manager = + content::GpuDataManager::GetInstance(); + DCHECK(gpu_data_manager); + content::GpuFeatureType blacklist_flags = + gpu_data_manager->GetGpuFeatureType(); + if (blacklist_flags & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) + web.accelerated_compositing_enabled = false; + if (blacklist_flags & content::GPU_FEATURE_TYPE_WEBGL) + web.experimental_webgl_enabled = false; + if (blacklist_flags & content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) + web.accelerated_2d_canvas_enabled = false; + if (blacklist_flags & content::GPU_FEATURE_TYPE_MULTISAMPLING) + web.gl_multisampling_enabled = false; + + // Accelerated video is slower than regular when using a software 3d + // rasterizer. + if (gpu_data_manager->ShouldUseSoftwareRendering()) + web.accelerated_video_enabled = false; + } +} diff --git a/libcef/browser/browser_settings.h b/libcef/browser/browser_settings.h new file mode 100644 index 000000000..8e182259e --- /dev/null +++ b/libcef/browser/browser_settings.h @@ -0,0 +1,18 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_BROWSER_SETTINGS_H_ +#define CEF_LIBCEF_BROWSER_BROWSER_SETTINGS_H_ +#pragma once + +#include "include/internal/cef_types_wrappers.h" + +namespace webkit_glue { +struct WebPreferences; +} + +void BrowserToWebSettings(const CefBrowserSettings& cef, + webkit_glue::WebPreferences& web); + +#endif // CEF_LIBCEF_BROWSER_BROWSER_SETTINGS_H_ diff --git a/libcef/browser/browser_urlrequest_impl.cc b/libcef/browser/browser_urlrequest_impl.cc new file mode 100644 index 000000000..c6742572c --- /dev/null +++ b/libcef/browser/browser_urlrequest_impl.cc @@ -0,0 +1,442 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/browser_urlrequest_impl.h" + +#include + +#include "libcef/browser/browser_context.h" +#include "libcef/browser/context.h" +#include "libcef/browser/thread_util.h" +#include "libcef/common/http_header_utils.h" +#include "libcef/common/request_impl.h" +#include "libcef/common/response_impl.h" + +#include "base/logging.h" +#include "base/message_loop.h" +#include "base/string_util.h" +#include "content/public/common/url_fetcher.h" +#include "net/base/load_flags.h" +#include "net/http/http_response_headers.h" +#include "net/url_request/url_fetcher_delegate.h" +#include "net/url_request/url_request_status.h" + + +namespace { + +class CefURLFetcherDelegate : public net::URLFetcherDelegate { + public: + CefURLFetcherDelegate(CefBrowserURLRequest::Context* context, + int request_flags); + virtual ~CefURLFetcherDelegate(); + + // net::URLFetcherDelegate methods. + virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; + virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, + int64 current, int64 total) OVERRIDE; + virtual void OnURLFetchDownloadData(const net::URLFetcher* source, + scoped_ptr download_data) + OVERRIDE; + virtual bool ShouldSendDownloadData() OVERRIDE; + virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, + int64 current, int64 total) OVERRIDE; + + private: + // The context_ pointer will outlive this object. + CefBrowserURLRequest::Context* context_; + int request_flags_; +}; + +} // namespace + + +// CefBrowserURLRequest::Context ---------------------------------------------- + +class CefBrowserURLRequest::Context + : public base::RefCountedThreadSafe { + public: + Context(CefRefPtr url_request, + CefRefPtr request, + CefRefPtr client) + : url_request_(url_request), + request_(request), + client_(client), + message_loop_proxy_(MessageLoop::current()->message_loop_proxy()), + status_(UR_IO_PENDING), + error_code_(ERR_NONE), + upload_data_size_(0), + got_upload_progress_complete_(false) { + // Mark the request as read-only. + static_cast(request_.get())->SetReadOnly(true); + } + + virtual ~Context() { + if (fetcher_.get()) { + // Delete the fetcher object on the thread that created it. + message_loop_proxy_->DeleteSoon(FROM_HERE, fetcher_.release()); + } + } + + inline bool CalledOnValidThread() { + return message_loop_proxy_->BelongsToCurrentThread(); + } + + bool Start() { + DCHECK(CalledOnValidThread()); + + GURL url = GURL(request_->GetURL().ToString()); + if (!url.is_valid()) + return false; + + std::string method = request_->GetMethod(); + StringToLowerASCII(&method); + net::URLFetcher::RequestType request_type = net::URLFetcher::GET; + if (LowerCaseEqualsASCII(method, "get")) { + } else if (LowerCaseEqualsASCII(method, "post")) { + request_type = net::URLFetcher::POST; + } else if (LowerCaseEqualsASCII(method, "head")) { + request_type = net::URLFetcher::HEAD; + } else if (LowerCaseEqualsASCII(method, "delete")) { + request_type = net::URLFetcher::DELETE_REQUEST; + } else if (LowerCaseEqualsASCII(method, "put")) { + request_type = net::URLFetcher::PUT; + } else { + NOTREACHED() << "invalid request type"; + return false; + } + + fetcher_delegate_.reset( + new CefURLFetcherDelegate(this, request_->GetFlags())); + + fetcher_.reset(content::URLFetcher::Create(url, request_type, + fetcher_delegate_.get())); + fetcher_->SetRequestContext( + _Context->browser_context()->GetRequestContext()); + + CefRequest::HeaderMap headerMap; + request_->GetHeaderMap(headerMap); + + // Extract the Referer header value. + { + CefString referrerStr; + referrerStr.FromASCII(net::HttpRequestHeaders::kReferer); + CefRequest::HeaderMap::iterator it = headerMap.find(referrerStr); + if (it == headerMap.end()) { + fetcher_->SetReferrer(""); + } else { + fetcher_->SetReferrer(it->second); + headerMap.erase(it); + } + } + + std::string content_type; + + // Extract the Content-Type header value. + { + CefString contentTypeStr; + contentTypeStr.FromASCII(net::HttpRequestHeaders::kContentType); + CefRequest::HeaderMap::iterator it = headerMap.find(contentTypeStr); + if (it != headerMap.end()) { + content_type = it->second; + headerMap.erase(it); + } + } + + int64 upload_data_size = 0; + + CefRefPtr post_data = request_->GetPostData(); + if (post_data.get()) { + CefPostData::ElementVector elements; + post_data->GetElements(elements); + if (elements.size() == 1 && elements[0]->GetType() == PDE_TYPE_BYTES) { + CefPostDataElementImpl* impl = + static_cast(elements[0].get()); + + // Default to URL encoding if not specified. + if (content_type.empty()) + content_type = "application/x-www-form-urlencoded"; + + upload_data_size = impl->GetBytesCount(); + fetcher_->SetUploadData(content_type, + std::string(static_cast(impl->GetBytes()), + upload_data_size)); + } else { + NOTIMPLEMENTED() << "multi-part form data is not supported"; + } + } + + std::string first_party_for_cookies = request_->GetFirstPartyForCookies(); + if (!first_party_for_cookies.empty()) + fetcher_->SetFirstPartyForCookies(GURL(first_party_for_cookies)); + + int cef_flags = request_->GetFlags(); + + if (cef_flags & UR_FLAG_NO_RETRY_ON_5XX) + fetcher_->SetAutomaticallyRetryOn5xx(false); + + int load_flags = 0; + + if (cef_flags & UR_FLAG_SKIP_CACHE) + load_flags |= net::LOAD_BYPASS_CACHE; + + if (cef_flags & UR_FLAG_ALLOW_CACHED_CREDENTIALS) { + if (!(cef_flags & UR_FLAG_ALLOW_COOKIES)) { + load_flags |= net::LOAD_DO_NOT_SEND_COOKIES; + load_flags |= net::LOAD_DO_NOT_SAVE_COOKIES; + } + } else { + load_flags |= net::LOAD_DO_NOT_SEND_AUTH_DATA; + load_flags |= net::LOAD_DO_NOT_SEND_COOKIES; + load_flags |= net::LOAD_DO_NOT_SAVE_COOKIES; + } + + if (cef_flags & UR_FLAG_REPORT_UPLOAD_PROGRESS) { + load_flags |= net::LOAD_ENABLE_UPLOAD_PROGRESS; + upload_data_size_ = upload_data_size; + } + + if (cef_flags & UR_FLAG_REPORT_LOAD_TIMING) + load_flags |= net::LOAD_ENABLE_LOAD_TIMING; + + if (cef_flags & UR_FLAG_REPORT_RAW_HEADERS) + load_flags |= net::LOAD_REPORT_RAW_HEADERS; + + fetcher_->SetLoadFlags(load_flags); + + fetcher_->SetExtraRequestHeaders( + HttpHeaderUtils::GenerateHeaders(headerMap)); + + fetcher_->Start(); + + return true; + } + + void Cancel() { + DCHECK(CalledOnValidThread()); + + // The request may already be complete. + if (!fetcher_.get()) + return; + + // Cancel the fetch by deleting the fetcher. + fetcher_.reset(NULL); + + status_ = UR_CANCELED; + error_code_ = ERR_ABORTED; + OnComplete(); + } + + void OnComplete() { + DCHECK(CalledOnValidThread()); + + if (fetcher_.get()) { + const net::URLRequestStatus& status = fetcher_->GetStatus(); + + if (status.is_success()) + NotifyUploadProgressIfNecessary(); + + switch (status.status()) { + case net::URLRequestStatus::SUCCESS: + status_ = UR_SUCCESS; + break; + case net::URLRequestStatus::IO_PENDING: + status_ = UR_IO_PENDING; + break; + case net::URLRequestStatus::HANDLED_EXTERNALLY: + status_ = UR_HANDLED_EXTERNALLY; + break; + case net::URLRequestStatus::CANCELED: + status_ = UR_CANCELED; + break; + case net::URLRequestStatus::FAILED: + status_ = UR_FAILED; + break; + } + + error_code_ = static_cast(status.error()); + + response_ = new CefResponseImpl(); + CefResponseImpl* responseImpl = + static_cast(response_.get()); + + net::HttpResponseHeaders* headers = fetcher_->GetResponseHeaders(); + if (headers) + responseImpl->SetResponseHeaders(*headers); + + responseImpl->SetReadOnly(true); + } + + DCHECK(url_request_.get()); + client_->OnRequestComplete(url_request_.get()); + + if (fetcher_.get()) + fetcher_.reset(NULL); + + // This may result in the Context object being deleted. + url_request_ = NULL; + } + + void OnDownloadProgress(int64 current, int64 total) { + DCHECK(CalledOnValidThread()); + DCHECK(url_request_.get()); + + NotifyUploadProgressIfNecessary(); + + client_->OnDownloadProgress(url_request_.get(), current, total); + } + + void OnDownloadData(scoped_ptr download_data) { + DCHECK(CalledOnValidThread()); + DCHECK(url_request_.get()); + client_->OnDownloadData(url_request_.get(), download_data->c_str(), + download_data->length()); + } + + void OnUploadProgress(int64 current, int64 total) { + DCHECK(CalledOnValidThread()); + DCHECK(url_request_.get()); + if (current == total) + got_upload_progress_complete_ = true; + client_->OnUploadProgress(url_request_.get(), current, total); + } + + CefRefPtr request() { return request_; } + CefRefPtr client() { return client_; } + CefURLRequest::Status status() { return status_; } + CefURLRequest::ErrorCode error_code() { return error_code_; } + CefRefPtr response() { return response_; } + + private: + void NotifyUploadProgressIfNecessary() { + if (!got_upload_progress_complete_ && upload_data_size_ > 0) { + // URLFetcher sends upload notifications using a timer and will not send + // a notification if the request completes too quickly. We therefore + // send the notification here if necessary. + client_->OnUploadProgress(url_request_.get(), upload_data_size_, + upload_data_size_); + got_upload_progress_complete_ = true; + } + } + + // Members only accessed on the initialization thread. + CefRefPtr url_request_; + CefRefPtr request_; + CefRefPtr client_; + scoped_refptr message_loop_proxy_; + scoped_ptr fetcher_; + scoped_ptr fetcher_delegate_; + CefURLRequest::Status status_; + CefURLRequest::ErrorCode error_code_; + CefRefPtr response_; + int64 upload_data_size_; + bool got_upload_progress_complete_; +}; + + +// CefURLFetcherDelegate ------------------------------------------------------ + +namespace { + +CefURLFetcherDelegate::CefURLFetcherDelegate( + CefBrowserURLRequest::Context* context, int request_flags) + : context_(context), + request_flags_(request_flags) { +} + +CefURLFetcherDelegate::~CefURLFetcherDelegate() { +} + +void CefURLFetcherDelegate::OnURLFetchComplete( + const net::URLFetcher* source) { + context_->OnComplete(); +} + +void CefURLFetcherDelegate::OnURLFetchDownloadProgress( + const net::URLFetcher* source, + int64 current, int64 total) { + context_->OnDownloadProgress(current, total); +} + +void CefURLFetcherDelegate::OnURLFetchDownloadData( + const net::URLFetcher* source, + scoped_ptr download_data) { + context_->OnDownloadData(download_data.Pass()); +} + +bool CefURLFetcherDelegate::ShouldSendDownloadData() { + return !(request_flags_ & UR_FLAG_NO_DOWNLOAD_DATA); +} + +void CefURLFetcherDelegate::OnURLFetchUploadProgress( + const net::URLFetcher* source, + int64 current, int64 total) { + if (request_flags_ & UR_FLAG_REPORT_UPLOAD_PROGRESS) + context_->OnUploadProgress(current, total); +} + +} // namespace + + +// CefBrowserURLRequest ------------------------------------------------------- + +CefBrowserURLRequest::CefBrowserURLRequest( + CefRefPtr request, + CefRefPtr client) { + context_ = new Context(this, request, client); +} + +CefBrowserURLRequest::~CefBrowserURLRequest() { +} + +bool CefBrowserURLRequest::Start() { + if (!VerifyContext()) + return false; + return context_->Start(); +} + +CefRefPtr CefBrowserURLRequest::GetRequest() { + if (!VerifyContext()) + return NULL; + return context_->request(); +} + +CefRefPtr CefBrowserURLRequest::GetClient() { + if (!VerifyContext()) + return NULL; + return context_->client(); +} + +CefURLRequest::Status CefBrowserURLRequest::GetRequestStatus() { + if (!VerifyContext()) + return UR_UNKNOWN; + return context_->status(); +} + +CefURLRequest::ErrorCode CefBrowserURLRequest::GetRequestError() { + if (!VerifyContext()) + return ERR_NONE; + return context_->error_code(); +} + +CefRefPtr CefBrowserURLRequest::GetResponse() { + if (!VerifyContext()) + return NULL; + return context_->response(); +} + +void CefBrowserURLRequest::Cancel() { + if (!VerifyContext()) + return; + return context_->Cancel(); +} + +bool CefBrowserURLRequest::VerifyContext() { + DCHECK(context_.get()); + if (!context_->CalledOnValidThread()) { + NOTREACHED() << "called on invalid thread"; + return false; + } + + return true; +} diff --git a/libcef/browser/browser_urlrequest_impl.h b/libcef/browser/browser_urlrequest_impl.h new file mode 100644 index 000000000..e1e186940 --- /dev/null +++ b/libcef/browser/browser_urlrequest_impl.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_BROWSER_URLREQUEST_IMPL_H_ +#define CEF_LIBCEF_BROWSER_BROWSER_URLREQUEST_IMPL_H_ + +#include "include/cef_urlrequest.h" +#include "base/memory/ref_counted.h" + +class CefBrowserURLRequest : public CefURLRequest { + public: + class Context; + + CefBrowserURLRequest(CefRefPtr request, + CefRefPtr client); + virtual ~CefBrowserURLRequest(); + + bool Start(); + + // CefURLRequest methods. + virtual CefRefPtr GetRequest() OVERRIDE; + virtual CefRefPtr GetClient() OVERRIDE; + virtual Status GetRequestStatus() OVERRIDE; + virtual ErrorCode GetRequestError() OVERRIDE; + virtual CefRefPtr GetResponse() OVERRIDE; + virtual void Cancel() OVERRIDE; + + private: + bool VerifyContext(); + + scoped_refptr context_; + + IMPLEMENT_REFCOUNTING(CefBrowserURLRequest); +}; + +#endif // CEF_LIBCEF_BROWSER_BROWSER_URLREQUEST_IMPL_H_ diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/content_browser_client.cc new file mode 100644 index 000000000..4f910f554 --- /dev/null +++ b/libcef/browser/content_browser_client.cc @@ -0,0 +1,148 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/content_browser_client.h" +#include "libcef/browser/browser_context.h" +#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/browser_main.h" +#include "libcef/browser/browser_message_filter.h" +#include "libcef/browser/browser_settings.h" +#include "libcef/browser/context.h" +#include "libcef/browser/resource_dispatcher_host_delegate.h" +#include "libcef/browser/thread_util.h" +#include "libcef/common/cef_switches.h" + +#include "base/command_line.h" +#include "base/file_path.h" +#include "content/public/browser/access_token_store.h" +#include "content/public/browser/media_observer.h" +#include "content/public/browser/render_process_host.h" +#include "content/public/browser/resource_dispatcher_host.h" +#include "content/public/common/content_switches.h" +#include "googleurl/src/gurl.h" + +namespace { + +// In-memory store for access tokens used by geolocation. +class CefAccessTokenStore : public content::AccessTokenStore { + public: + CefAccessTokenStore() {} + + virtual void LoadAccessTokens( + const LoadAccessTokensCallbackType& callback) OVERRIDE { + callback.Run(access_token_set_, + _Context->browser_context()->GetRequestContext()); + } + + virtual void SaveAccessToken( + const GURL& server_url, const string16& access_token) OVERRIDE { + access_token_set_[server_url] = access_token; + } + + private: + AccessTokenSet access_token_set_; +}; + +} // namespace + + +class CefMediaObserver : public content::MediaObserver { + public: + CefMediaObserver() {} + virtual ~CefMediaObserver() {} + + virtual void OnDeleteAudioStream(void* host, int stream_id) OVERRIDE {} + + virtual void OnSetAudioStreamPlaying(void* host, int stream_id, + bool playing) OVERRIDE {} + virtual void OnSetAudioStreamStatus(void* host, int stream_id, + const std::string& status) OVERRIDE {} + virtual void OnSetAudioStreamVolume(void* host, int stream_id, + double volume) OVERRIDE {} + virtual void OnMediaEvent(int render_process_id, + const media::MediaLogEvent& event) OVERRIDE {} + virtual void OnCaptureDevicesOpened( + int render_process_id, + int render_view_id, + const content::MediaStreamDevices& devices) OVERRIDE {} + virtual void OnCaptureDevicesClosed( + int render_process_id, + int render_view_id, + const content::MediaStreamDevices& devices) OVERRIDE {} +}; + + +CefContentBrowserClient::CefContentBrowserClient() + : browser_main_parts_(NULL) { +} + +CefContentBrowserClient::~CefContentBrowserClient() { +} + +content::BrowserMainParts* CefContentBrowserClient::CreateBrowserMainParts( + const content::MainFunctionParams& parameters) { + browser_main_parts_ = new CefBrowserMainParts(parameters); + return browser_main_parts_; +} + +void CefContentBrowserClient::RenderProcessHostCreated( + content::RenderProcessHost* host) { + host->GetChannel()->AddFilter(new CefBrowserMessageFilter(host)); +} + +void CefContentBrowserClient::AppendExtraCommandLineSwitches( + CommandLine* command_line, int child_process_id) { + std::string process_type = + command_line->GetSwitchValueASCII(switches::kProcessType); + if (process_type == switches::kRendererProcess) { + // Propagate the following switches to the renderer command line (along + // with any associated values) if present in the browser command line. + static const char* const kSwitchNames[] = { + switches::kLogFile, + switches::kLogSeverity, + switches::kProductVersion, + switches::kLocale, + switches::kPackFilePath, + switches::kLocalesDirPath, + switches::kPackLoadingDisabled, + }; + const CommandLine& browser_cmd = *CommandLine::ForCurrentProcess(); + command_line->CopySwitchesFrom(browser_cmd, kSwitchNames, + arraysize(kSwitchNames)); + } +} + +content::MediaObserver* CefContentBrowserClient::GetMediaObserver() { + // TODO(cef): Return NULL once it's supported. See crbug.com/116113. + if (!media_observer_.get()) + media_observer_.reset(new CefMediaObserver()); + return media_observer_.get(); +} + +content::AccessTokenStore* CefContentBrowserClient::CreateAccessTokenStore() { + return new CefAccessTokenStore; +} + +void CefContentBrowserClient::ResourceDispatcherHostCreated() { + resource_dispatcher_host_delegate_.reset( + new CefResourceDispatcherHostDelegate()); + content::ResourceDispatcherHost::Get()->SetDelegate( + resource_dispatcher_host_delegate_.get()); +} + +void CefContentBrowserClient::OverrideWebkitPrefs( + content::RenderViewHost* rvh, + const GURL& url, + webkit_glue::WebPreferences* prefs) { + CefRefPtr browser = + CefBrowserHostImpl::GetBrowserForHost(rvh); + DCHECK(browser.get()); + + // Populate WebPreferences based on CefBrowserSettings. + BrowserToWebSettings(browser->settings(), *prefs); +} + +std::string CefContentBrowserClient::GetDefaultDownloadName() { + return "download"; +} diff --git a/libcef/browser/content_browser_client.h b/libcef/browser/content_browser_client.h new file mode 100644 index 000000000..7af9c92e5 --- /dev/null +++ b/libcef/browser/content_browser_client.h @@ -0,0 +1,56 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_CONTENT_BROWSER_CLIENT_H_ +#define CEF_LIBCEF_BROWSER_CONTENT_BROWSER_CLIENT_H_ +#pragma once + +#include +#include +#include + +#include "base/compiler_specific.h" +#include "base/memory/scoped_ptr.h" +#include "content/public/browser/content_browser_client.h" + +class CefBrowserMainParts; +class CefMediaObserver; +class CefResourceDispatcherHostDelegate; + +namespace content { +class SiteInstance; +} + +class CefContentBrowserClient : public content::ContentBrowserClient { + public: + CefContentBrowserClient(); + virtual ~CefContentBrowserClient(); + + CefBrowserMainParts* browser_main_parts() const { + return browser_main_parts_; + } + + virtual content::BrowserMainParts* CreateBrowserMainParts( + const content::MainFunctionParams& parameters) OVERRIDE; + virtual void RenderProcessHostCreated( + content::RenderProcessHost* host) OVERRIDE; + virtual void AppendExtraCommandLineSwitches(CommandLine* command_line, + int child_process_id) OVERRIDE; + virtual content::MediaObserver* GetMediaObserver() OVERRIDE; + virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE; + virtual void ResourceDispatcherHostCreated() OVERRIDE; + virtual void OverrideWebkitPrefs(content::RenderViewHost* rvh, + const GURL& url, + webkit_glue::WebPreferences* prefs) OVERRIDE; + virtual std::string GetDefaultDownloadName() OVERRIDE; + + private: + CefBrowserMainParts* browser_main_parts_; + + scoped_ptr media_observer_; + scoped_ptr + resource_dispatcher_host_delegate_; +}; + +#endif // CEF_LIBCEF_BROWSER_CONTENT_BROWSER_CLIENT_H_ diff --git a/libcef/browser/context.cc b/libcef/browser/context.cc new file mode 100644 index 000000000..f1fa361a8 --- /dev/null +++ b/libcef/browser/context.cc @@ -0,0 +1,401 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/context.h" +#include "libcef/browser/browser_context.h" +#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/browser_main.h" +#include "libcef/browser/browser_message_loop.h" +#include "libcef/browser/content_browser_client.h" +#include "libcef/browser/devtools_scheme_handler.h" +#include "libcef/browser/thread_util.h" +#include "libcef/common/main_delegate.h" + +#include "base/bind.h" +#include "base/command_line.h" +#include "base/file_util.h" +#include "base/synchronization/waitable_event.h" +#include "content/public/app/content_main.h" +#include "content/public/app/content_main_runner.h" +#include "content/public/common/content_switches.h" +#include "sandbox/src/sandbox_types.h" +#include "ui/base/ui_base_switches.h" + +#if defined(OS_MACOSX) +#include "libcef/browser/application_mac.h" +#endif + +#if defined(OS_WIN) +#include "content/public/app/startup_helper_win.h" +#endif + +// Both the CefContext constuctor and the CefContext::RemoveBrowser method need +// to initialize or reset to the same value. +const int kNextBrowserIdReset = 1; + +// Global CefContext pointer +CefRefPtr _Context; + + +int CefExecuteProcess(const CefMainArgs& args, + CefRefPtr application) { + CommandLine command_line(CommandLine::NO_PROGRAM); +#if defined(OS_WIN) + command_line.ParseFromString(::GetCommandLineW()); +#else + command_line.InitFromArgv(args.argc, args.argv); +#endif + + // If no process type is specified then it represents the browser process and + // we do nothing. + std::string process_type = + command_line.GetSwitchValueASCII(switches::kProcessType); + if (process_type.empty()) + return -1; + +#if defined(OS_MACOSX) + // Create the CefCrApplication instance. + CefCrApplicationCreate(); +#endif + + CefMainDelegate main_delegate(application); + + // Execute the secondary process. +#if defined(OS_WIN) + sandbox::SandboxInterfaceInfo sandbox_info = {0}; + content::InitializeSandboxInfo(&sandbox_info); + + return content::ContentMain(args.instance, &sandbox_info, &main_delegate); +#else + return content::ContentMain(args.argc, const_cast(args.argv), + &main_delegate); +#endif +} + +bool CefInitialize(const CefMainArgs& args, + const CefSettings& settings, + CefRefPtr application) { + // Return true if the global context already exists. + if (_Context.get()) + return true; + + if (settings.size != sizeof(cef_settings_t)) { + NOTREACHED() << "invalid CefSettings structure size"; + return false; + } + + // Create the new global context object. + _Context = new CefContext(); + + // Initialize the global context. + return _Context->Initialize(args, settings, application); +} + +void CefShutdown() { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED() << "context not valid"; + return; + } + + // Must always be called on the same thread as Initialize. + if (!_Context->OnInitThread()) { + NOTREACHED() << "called on invalid thread"; + return; + } + + // Shut down the global context. This will block until shutdown is complete. + _Context->Shutdown(); + + // Delete the global context object. + _Context = NULL; +} + +void CefDoMessageLoopWork() { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED() << "context not valid"; + return; + } + + // Must always be called on the same thread as Initialize. + if (!_Context->OnInitThread()) { + NOTREACHED() << "called on invalid thread"; + return; + } + + CefBrowserMessageLoop::current()->DoMessageLoopIteration(); +} + +void CefRunMessageLoop() { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED() << "context not valid"; + return; + } + + // Must always be called on the same thread as Initialize. + if (!_Context->OnInitThread()) { + NOTREACHED() << "called on invalid thread"; + return; + } + + CefBrowserMessageLoop::current()->RunMessageLoop(); +} + +void CefQuitMessageLoop() { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED() << "context not valid"; + return; + } + + // Must always be called on the same thread as Initialize. + if (!_Context->OnInitThread()) { + NOTREACHED() << "called on invalid thread"; + return; + } + + CefBrowserMessageLoop::current()->Quit(); +} + + +// CefContext + +CefContext::CefContext() + : initialized_(false), + shutting_down_(false), + init_thread_id_(0), + next_browser_id_(kNextBrowserIdReset) { +} + +CefContext::~CefContext() { + if (!shutting_down_) + Shutdown(); +} + +bool CefContext::Initialize(const CefMainArgs& args, + const CefSettings& settings, + CefRefPtr application) { + init_thread_id_ = base::PlatformThread::CurrentId(); + settings_ = settings; + + cache_path_ = FilePath(CefString(&settings.cache_path)); + if (!cache_path_.empty() && + !file_util::DirectoryExists(cache_path_) && + !file_util::CreateDirectory(cache_path_)) { + NOTREACHED() << "The cache_path directory could not be created"; + cache_path_ = FilePath(); + } + +#if !defined(OS_WIN) + if (settings.multi_threaded_message_loop) { + NOTIMPLEMENTED() << "multi_threaded_message_loop is not supported."; + return false; + } +#endif + + main_delegate_.reset(new CefMainDelegate(application)); + main_runner_.reset(content::ContentMainRunner::Create()); + + int exit_code; + + // Initialize the content runner. +#if defined(OS_WIN) + sandbox::SandboxInterfaceInfo sandbox_info = {0}; + content::InitializeSandboxInfo(&sandbox_info); + + exit_code = main_runner_->Initialize(args.instance, &sandbox_info, + main_delegate_.get()); +#else + exit_code = main_runner_->Initialize(args.argc, + const_cast(args.argv), + main_delegate_.get()); +#endif + + DCHECK_LT(exit_code, 0); + if (exit_code >= 0) + return false; + + // Run the process. Results in a call to CefMainDelegate::RunProcess() which + // will create the browser runner and message loop without blocking. + exit_code = main_runner_->Run(); + + initialized_ = true; + + // Continue initialization on the UI thread. + CEF_POST_TASK(CEF_UIT, base::Bind(&CefContext::OnContextInitialized, this)); + + return true; +} + +void CefContext::Shutdown() { + // Must always be called on the same thread as Initialize. + DCHECK(OnInitThread()); + + shutting_down_ = true; + + if (settings_.multi_threaded_message_loop) { + // Events that will be used to signal when shutdown is complete. Start in + // non-signaled mode so that the event will block. + base::WaitableEvent uithread_shutdown_event(false, false); + + // Finish shutdown on the UI thread. + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefContext::FinishShutdownOnUIThread, this, + &uithread_shutdown_event)); + + /// Block until UI thread shutdown is complete. + uithread_shutdown_event.Wait(); + + FinalizeShutdown(); + } else { + // Finish shutdown on the current thread, which should be the UI thread. + FinishShutdownOnUIThread(NULL); + + FinalizeShutdown(); + } +} + +bool CefContext::OnInitThread() { + return (base::PlatformThread::CurrentId() == init_thread_id_); +} + +bool CefContext::AddBrowser(CefRefPtr browser) { + bool found = false; + + AutoLock lock_scope(this); + + // check that the browser isn't already in the list before adding + BrowserList::const_iterator it = browserlist_.begin(); + for (; it != browserlist_.end(); ++it) { + if (it->get() == browser.get()) { + found = true; + break; + } + } + + if (!found) { + browser->SetUniqueId(next_browser_id_++); + browserlist_.push_back(browser); + } + + return !found; +} + +bool CefContext::RemoveBrowser(CefRefPtr browser) { + bool deleted = false; + + { + AutoLock lock_scope(this); + + BrowserList::iterator it = browserlist_.begin(); + for (; it != browserlist_.end(); ++it) { + if (it->get() == browser.get()) { + browserlist_.erase(it); + deleted = true; + break; + } + } + + if (browserlist_.empty()) + next_browser_id_ = kNextBrowserIdReset; + } + + return deleted; +} + +CefRefPtr CefContext::GetBrowserByID(int id) { + AutoLock lock_scope(this); + + BrowserList::const_iterator it = browserlist_.begin(); + for (; it != browserlist_.end(); ++it) { + if (it->get()->unique_id() == id) + return it->get(); + } + + DLOG(ERROR) << "No browser matching unique id " << id; + return NULL; +} + +CefRefPtr CefContext::GetBrowserByRoutingID( + int render_process_id, int render_view_id) { + AutoLock lock_scope(this); + + BrowserList::const_iterator it = browserlist_.begin(); + for (; it != browserlist_.end(); ++it) { + if (it->get()->HasIDMatch(render_process_id, render_view_id)) + return it->get(); + } + + DLOG(ERROR) << "No browser matching process id " << render_process_id << + " and view id " << render_view_id; + return NULL; +} + +CefRefPtr CefContext::application() const { + return main_delegate_->content_client()->application(); +} + +CefBrowserContext* CefContext::browser_context() const { + return main_delegate_->browser_client()->browser_main_parts()-> + browser_context(); +} + +CefDevToolsDelegate* CefContext::devtools_delegate() const { + return main_delegate_->browser_client()->browser_main_parts()-> + devtools_delegate(); +} + +void CefContext::OnContextInitialized() { + CEF_REQUIRE_UIT(); + + // Perform DevTools scheme registration. + RegisterDevToolsSchemeHandler(); + + // Notify the handler. + CefRefPtr app = application(); + if (app.get()) { + CefRefPtr handler = + app->GetBrowserProcessHandler(); + if (handler.get()) + handler->OnContextInitialized(); + } +} + +void CefContext::FinishShutdownOnUIThread( + base::WaitableEvent* uithread_shutdown_event) { + CEF_REQUIRE_UIT(); + + BrowserList list; + + { + AutoLock lock_scope(this); + if (!browserlist_.empty()) { + list = browserlist_; + browserlist_.clear(); + } + } + + // Destroy any remaining browser windows. + if (!list.empty()) { + BrowserList::iterator it = list.begin(); + for (; it != list.end(); ++it) + (*it)->DestroyBrowser(); + } + + if (uithread_shutdown_event) + uithread_shutdown_event->Signal(); +} + +void CefContext::FinalizeShutdown() { + // Shut down the browser runner or UI thread. + main_delegate_->ShutdownBrowser(); + + // Shut down the content runner. + main_runner_->Shutdown(); + + main_runner_.reset(NULL); + main_delegate_.reset(NULL); +} diff --git a/libcef/browser/context.h b/libcef/browser/context.h new file mode 100644 index 000000000..874a7e3c6 --- /dev/null +++ b/libcef/browser/context.h @@ -0,0 +1,111 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_CONTEXT_H_ +#define CEF_LIBCEF_BROWSER_CONTEXT_H_ +#pragma once + +#include +#include +#include + +#include "include/cef_app.h" +#include "include/cef_base.h" + +#include "base/file_path.h" +#include "base/memory/scoped_ptr.h" +#include "base/threading/platform_thread.h" + +namespace base { +class WaitableEvent; +} + +namespace content { +class ContentMainRunner; +} + +class CefBrowserContext; +class CefBrowserHostImpl; +class CefDevToolsDelegate; +class CefMainDelegate; + +class CefContext : public CefBase { + public: + typedef std::list > BrowserList; + + CefContext(); + ~CefContext(); + + // These methods will be called on the main application thread. + bool Initialize(const CefMainArgs& args, + const CefSettings& settings, + CefRefPtr application); + void Shutdown(); + + // Returns true if the current thread is the initialization thread. + bool OnInitThread(); + + // Returns true if the context is initialized. + bool initialized() { return initialized_; } + + // Returns true if the context is shutting down. + bool shutting_down() { return shutting_down_; } + + bool AddBrowser(CefRefPtr browser); + bool RemoveBrowser(CefRefPtr browser); + CefRefPtr GetBrowserByID(int id); + CefRefPtr GetBrowserByRoutingID(int render_process_id, + int render_view_id); + BrowserList* GetBrowserList() { return &browserlist_; } + + // Retrieve the path at which cache data will be stored on disk. If empty, + // cache data will be stored in-memory. + const FilePath& cache_path() const { return cache_path_; } + + const CefSettings& settings() const { return settings_; } + CefRefPtr application() const; + CefBrowserContext* browser_context() const; + CefDevToolsDelegate* devtools_delegate() const; + + private: + void OnContextInitialized(); + + // Performs shutdown actions that need to occur on the UI thread before any + // threads are destroyed. + void FinishShutdownOnUIThread(base::WaitableEvent* uithread_shutdown_event); + + // Destroys the main runner and related objects. + void FinalizeShutdown(); + + // Track context state. + bool initialized_; + bool shutting_down_; + + // The thread on which the context was initialized. + base::PlatformThreadId init_thread_id_; + + CefSettings settings_; + FilePath cache_path_; + + // Map of browsers that currently exist. + BrowserList browserlist_; + + // Used for assigning unique IDs to browser instances. + int next_browser_id_; + + scoped_ptr main_delegate_; + scoped_ptr main_runner_; + + IMPLEMENT_REFCOUNTING(CefContext); + IMPLEMENT_LOCKING(CefContext); +}; + +// Global context object pointer. +extern CefRefPtr _Context; + +// Helper macro that returns true if the global context is in a valid state. +#define CONTEXT_STATE_VALID() \ + (_Context.get() && _Context->initialized() && !_Context->shutting_down()) + +#endif // CEF_LIBCEF_BROWSER_CONTEXT_H_ diff --git a/libcef/browser/context_menu_params_impl.cc b/libcef/browser/context_menu_params_impl.cc new file mode 100644 index 000000000..eaed08b0c --- /dev/null +++ b/libcef/browser/context_menu_params_impl.cc @@ -0,0 +1,112 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/browser/context_menu_params_impl.h" + +#include "base/logging.h" + +CefContextMenuParamsImpl::CefContextMenuParamsImpl( + content::ContextMenuParams* value) + : CefValueBase( + value, NULL, kOwnerNoDelete, true, + new CefValueControllerNonThreadSafe()) { + // Indicate that this object owns the controller. + SetOwnsController(); +} + +int CefContextMenuParamsImpl::GetXCoord() { + CEF_VALUE_VERIFY_RETURN(false, 0); + return const_value().x; +} + +int CefContextMenuParamsImpl::GetYCoord() { + CEF_VALUE_VERIFY_RETURN(false, 0); + return const_value().y; +} + +CefContextMenuParamsImpl::TypeFlags CefContextMenuParamsImpl::GetTypeFlags() { + CEF_VALUE_VERIFY_RETURN(false, CM_TYPEFLAG_NONE); + const content::ContextMenuParams& params = const_value(); + int type_flags = CM_TYPEFLAG_NONE; + if (!params.page_url.is_empty()) + type_flags |= CM_TYPEFLAG_PAGE; + if (!params.frame_url.is_empty()) + type_flags |= CM_TYPEFLAG_FRAME; + if (!params.link_url.is_empty()) + type_flags |= CM_TYPEFLAG_LINK; + if (params.media_type != WebKit::WebContextMenuData::MediaTypeNone) + type_flags |= CM_TYPEFLAG_MEDIA; + if (!params.selection_text.empty()) + type_flags |= CM_TYPEFLAG_SELECTION; + if (params.is_editable) + type_flags |= CM_TYPEFLAG_EDITABLE; + return static_cast(type_flags); +} + +CefString CefContextMenuParamsImpl::GetLinkUrl() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().link_url.spec(); +} + +CefString CefContextMenuParamsImpl::GetUnfilteredLinkUrl() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().unfiltered_link_url.spec(); +} + +CefString CefContextMenuParamsImpl::GetSourceUrl() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().src_url.spec(); +} + +bool CefContextMenuParamsImpl::IsImageBlocked() { + CEF_VALUE_VERIFY_RETURN(false, false); + return const_value().is_image_blocked; +} + +CefString CefContextMenuParamsImpl::GetPageUrl() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().page_url.spec(); +} + +CefString CefContextMenuParamsImpl::GetFrameUrl() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().frame_url.spec(); +} + +CefString CefContextMenuParamsImpl::GetFrameCharset() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().frame_charset; +} + +CefContextMenuParamsImpl::MediaType CefContextMenuParamsImpl::GetMediaType() { + CEF_VALUE_VERIFY_RETURN(false, CM_MEDIATYPE_NONE); + return static_cast(const_value().media_type); +} + +CefContextMenuParamsImpl::MediaStateFlags + CefContextMenuParamsImpl::GetMediaStateFlags() { + CEF_VALUE_VERIFY_RETURN(false, CM_MEDIAFLAG_NONE); + return static_cast(const_value().media_flags); +} + +CefString CefContextMenuParamsImpl::GetSelectionText() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().selection_text; +} + +bool CefContextMenuParamsImpl::IsEditable() { + CEF_VALUE_VERIFY_RETURN(false, false); + return const_value().is_editable; +} + +bool CefContextMenuParamsImpl::IsSpeechInputEnabled() { + CEF_VALUE_VERIFY_RETURN(false, false); + return const_value().speech_input_enabled; +} + +CefContextMenuParamsImpl::EditStateFlags + CefContextMenuParamsImpl::GetEditStateFlags() { + CEF_VALUE_VERIFY_RETURN(false, CM_EDITFLAG_NONE); + return static_cast(const_value().edit_flags); +} diff --git a/libcef/browser/context_menu_params_impl.h b/libcef/browser/context_menu_params_impl.h new file mode 100644 index 000000000..2846febc0 --- /dev/null +++ b/libcef/browser/context_menu_params_impl.h @@ -0,0 +1,41 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_CONTEXT_MENU_PARAMS_IMPL_H_ +#define CEF_LIBCEF_BROWSER_CONTEXT_MENU_PARAMS_IMPL_H_ +#pragma once + +#include "include/cef_context_menu_handler.h" +#include "libcef/common/value_base.h" + +#include "content/public/common/context_menu_params.h" + +// CefContextMenuParams implementation. This class is not thread safe. +class CefContextMenuParamsImpl + : public CefValueBase { + public: + explicit CefContextMenuParamsImpl(content::ContextMenuParams* value); + + // CefContextMenuParams methods. + virtual int GetXCoord() OVERRIDE; + virtual int GetYCoord() OVERRIDE; + virtual TypeFlags GetTypeFlags() OVERRIDE; + virtual CefString GetLinkUrl() OVERRIDE; + virtual CefString GetUnfilteredLinkUrl() OVERRIDE; + virtual CefString GetSourceUrl() OVERRIDE; + virtual bool IsImageBlocked() OVERRIDE; + virtual CefString GetPageUrl() OVERRIDE; + virtual CefString GetFrameUrl() OVERRIDE; + virtual CefString GetFrameCharset() OVERRIDE; + virtual MediaType GetMediaType() OVERRIDE; + virtual MediaStateFlags GetMediaStateFlags() OVERRIDE; + virtual CefString GetSelectionText() OVERRIDE; + virtual bool IsEditable() OVERRIDE; + virtual bool IsSpeechInputEnabled() OVERRIDE; + virtual EditStateFlags GetEditStateFlags() OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(CefContextMenuParamsImpl); +}; + +#endif // CEF_LIBCEF_BROWSER_CONTEXT_MENU_PARAMS_IMPL_H_ diff --git a/libcef/browser/cookie_manager_impl.cc b/libcef/browser/cookie_manager_impl.cc new file mode 100644 index 000000000..15d9e5002 --- /dev/null +++ b/libcef/browser/cookie_manager_impl.cc @@ -0,0 +1,454 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/cookie_manager_impl.h" + +#include + +#include "libcef/browser/browser_context.h" +#include "libcef/browser/context.h" +#include "libcef/browser/thread_util.h" +#include "libcef/browser/url_request_context_getter.h" +#include "libcef/common/time_util.h" + +#include "base/bind.h" +#include "base/file_util.h" +#include "base/format_macros.h" +#include "base/logging.h" +#include "base/threading/thread_restrictions.h" +#include "chrome/browser/net/sqlite_persistent_cookie_store.h" +#include "googleurl/src/gurl.h" +#include "net/cookies/cookie_util.h" +#include "net/url_request/url_request_context.h" + +namespace { + +// Callback class for visiting cookies. +class VisitCookiesCallback : public base::RefCounted { + public: + explicit VisitCookiesCallback(net::CookieMonster* cookie_monster, + CefRefPtr visitor) + : cookie_monster_(cookie_monster), + visitor_(visitor) { + } + + void Run(const net::CookieList& list) { + CEF_REQUIRE_IOT(); + + int total = list.size(), count = 0; + + net::CookieList::const_iterator it = list.begin(); + for (; it != list.end(); ++it, ++count) { + CefCookie cookie; + const net::CookieMonster::CanonicalCookie& cc = *(it); + CefCookieManagerImpl::GetCefCookie(cc, cookie); + + bool deleteCookie = false; + bool keepLooping = visitor_->Visit(cookie, count, total, deleteCookie); + if (deleteCookie) { + cookie_monster_->DeleteCanonicalCookieAsync(cc, + net::CookieMonster::DeleteCookieCallback()); + } + if (!keepLooping) + break; + } + } + + private: + scoped_refptr cookie_monster_; + CefRefPtr visitor_; +}; + + +// Methods extracted from net/cookies/cookie_monster.cc + +// Determine the cookie domain to use for setting the specified cookie. +bool GetCookieDomain(const GURL& url, + const net::CookieMonster::ParsedCookie& pc, + std::string* result) { + std::string domain_string; + if (pc.HasDomain()) + domain_string = pc.Domain(); + return net::cookie_util::GetCookieDomainWithString(url, domain_string, + result); +} + +std::string CanonPathWithString(const GURL& url, + const std::string& path_string) { + // The RFC says the path should be a prefix of the current URL path. + // However, Mozilla allows you to set any path for compatibility with + // broken websites. We unfortunately will mimic this behavior. We try + // to be generous and accept cookies with an invalid path attribute, and + // default the path to something reasonable. + + // The path was supplied in the cookie, we'll take it. + if (!path_string.empty() && path_string[0] == '/') + return path_string; + + // The path was not supplied in the cookie or invalid, we will default + // to the current URL path. + // """Defaults to the path of the request URL that generated the + // Set-Cookie response, up to, but not including, the + // right-most /.""" + // How would this work for a cookie on /? We will include it then. + const std::string& url_path = url.path(); + + size_t idx = url_path.find_last_of('/'); + + // The cookie path was invalid or a single '/'. + if (idx == 0 || idx == std::string::npos) + return std::string("/"); + + // Return up to the rightmost '/'. + return url_path.substr(0, idx); +} + +std::string CanonPath(const GURL& url, + const net::CookieMonster::ParsedCookie& pc) { + std::string path_string; + if (pc.HasPath()) + path_string = pc.Path(); + return CanonPathWithString(url, path_string); +} + +base::Time CanonExpiration(const net::CookieMonster::ParsedCookie& pc, + const base::Time& current) { + // First, try the Max-Age attribute. + uint64 max_age = 0; + if (pc.HasMaxAge() && +#ifdef COMPILER_MSVC + sscanf_s( +#else + sscanf( +#endif + pc.MaxAge().c_str(), " %" PRIu64, &max_age) == 1) { + return current + base::TimeDelta::FromSeconds(max_age); + } + + // Try the Expires attribute. + if (pc.HasExpires()) + return net::CookieMonster::ParseCookieTime(pc.Expires()); + + // Invalid or no expiration, persistent cookie. + return base::Time(); +} + +} // namespace + + +CefCookieManagerImpl::CefCookieManagerImpl(bool is_global) + : is_global_(is_global) { +} + +CefCookieManagerImpl::~CefCookieManagerImpl() { +} + +void CefCookieManagerImpl::Initialize(const CefString& path) { + if (is_global_) + SetGlobal(); + else + SetStoragePath(path); +} + +void CefCookieManagerImpl::SetSupportedSchemes( + const std::vector& schemes) { + if (CEF_CURRENTLY_ON_IOT()) { + if (!cookie_monster_) + return; + + if (is_global_) { + // Global changes are handled by the request context. + CefURLRequestContextGetter* getter = + static_cast( + _Context->browser_context()->GetRequestContext()); + + std::vector scheme_vec; + std::vector::const_iterator it = schemes.begin(); + for (; it != schemes.end(); ++it) + scheme_vec.push_back(it->ToString()); + + getter->SetCookieSupportedSchemes(scheme_vec); + return; + } + + supported_schemes_ = schemes; + + if (supported_schemes_.empty()) { + supported_schemes_.push_back("http"); + supported_schemes_.push_back("https"); + } + + std::set scheme_set; + std::vector::const_iterator it = supported_schemes_.begin(); + for (; it != supported_schemes_.end(); ++it) + scheme_set.insert(*it); + + const char** arr = new const char*[scheme_set.size()]; + std::set::const_iterator it2 = scheme_set.begin(); + for (int i = 0; it2 != scheme_set.end(); ++it2, ++i) + arr[i] = it2->c_str(); + + cookie_monster_->SetCookieableSchemes(arr, scheme_set.size()); + + delete [] arr; + } else { + // Execute on the IO thread. + CEF_POST_TASK(CEF_IOT, + base::Bind(&CefCookieManagerImpl::SetSupportedSchemes, + this, schemes)); + } +} + +bool CefCookieManagerImpl::VisitAllCookies( + CefRefPtr visitor) { + if (CEF_CURRENTLY_ON_IOT()) { + if (!cookie_monster_) + return false; + + scoped_refptr callback( + new VisitCookiesCallback(cookie_monster_, visitor)); + + cookie_monster_->GetAllCookiesAsync( + base::Bind(&VisitCookiesCallback::Run, callback.get())); + } else { + // Execute on the IO thread. + CEF_POST_TASK(CEF_IOT, + base::Bind(base::IgnoreResult(&CefCookieManagerImpl::VisitAllCookies), + this, visitor)); + } + + return true; +} + +bool CefCookieManagerImpl::VisitUrlCookies( + const CefString& url, bool includeHttpOnly, + CefRefPtr visitor) { + if (CEF_CURRENTLY_ON_IOT()) { + if (!cookie_monster_) + return false; + + net::CookieOptions options; + if (includeHttpOnly) + options.set_include_httponly(); + + scoped_refptr callback( + new VisitCookiesCallback(cookie_monster_, visitor)); + + GURL gurl = GURL(url.ToString()); + cookie_monster_->GetAllCookiesForURLWithOptionsAsync(gurl, options, + base::Bind(&VisitCookiesCallback::Run, callback.get())); + } else { + // Execute on the IO thread. + CEF_POST_TASK(CEF_IOT, + base::Bind(base::IgnoreResult(&CefCookieManagerImpl::VisitUrlCookies), + this, url, includeHttpOnly, visitor)); + } + + return true; +} + +bool CefCookieManagerImpl::SetCookie(const CefString& url, + const CefCookie& cookie) { + CEF_REQUIRE_IOT_RETURN(false); + + if (!cookie_monster_) + return false; + + GURL gurl = GURL(url.ToString()); + if (!gurl.is_valid()) + return false; + + std::string name = CefString(&cookie.name).ToString(); + std::string value = CefString(&cookie.value).ToString(); + std::string domain = CefString(&cookie.domain).ToString(); + std::string path = CefString(&cookie.path).ToString(); + + base::Time expiration_time; + if (cookie.has_expires) + cef_time_to_basetime(cookie.expires, expiration_time); + + cookie_monster_->SetCookieWithDetailsAsync(gurl, name, value, domain, path, + expiration_time, cookie.secure, cookie.httponly, + net::CookieStore::SetCookiesCallback()); + return true; +} + +bool CefCookieManagerImpl::DeleteCookies(const CefString& url, + const CefString& cookie_name) { + CEF_REQUIRE_IOT_RETURN(false); + + if (!cookie_monster_) + return false; + + if (url.empty()) { + // Delete all cookies. + cookie_monster_->DeleteAllAsync(net::CookieMonster::DeleteCallback()); + return true; + } + + GURL gurl = GURL(url.ToString()); + if (!gurl.is_valid()) + return false; + + if (cookie_name.empty()) { + // Delete all matching host cookies. + cookie_monster_->DeleteAllForHostAsync(gurl, + net::CookieMonster::DeleteCallback()); + } else { + // Delete all matching host and domain cookies. + cookie_monster_->DeleteCookieAsync(gurl, cookie_name, base::Closure()); + } + return true; +} + +bool CefCookieManagerImpl::SetStoragePath(const CefString& path) { + if (CEF_CURRENTLY_ON_IOT()) { + FilePath new_path; + if (!path.empty()) + new_path = FilePath(path); + + if (is_global_) { + // Global path changes are handled by the request context. + CefURLRequestContextGetter* getter = + static_cast( + _Context->browser_context()->GetRequestContext()); + getter->SetCookieStoragePath(new_path); + cookie_monster_ = getter->GetURLRequestContext()->cookie_store()-> + GetCookieMonster(); + return true; + } + + if (cookie_monster_ && ((storage_path_.empty() && path.empty()) || + storage_path_ == new_path)) { + // The path has not changed so don't do anything. + return true; + } + + scoped_refptr persistent_store; + if (!new_path.empty()) { + // TODO(cef): Move directory creation to the blocking pool instead of + // allowing file IO on this thread. + base::ThreadRestrictions::ScopedAllowIO allow_io; + if (file_util::DirectoryExists(new_path) || + file_util::CreateDirectory(new_path)) { + const FilePath& cookie_path = new_path.AppendASCII("Cookies"); + persistent_store = + new SQLitePersistentCookieStore(cookie_path, false, NULL); + } else { + NOTREACHED() << "The cookie storage directory could not be created"; + storage_path_.clear(); + } + } + + // Set the new cookie store that will be used for all new requests. The old + // cookie store, if any, will be automatically flushed and closed when no + // longer referenced. + cookie_monster_ = new net::CookieMonster(persistent_store.get(), NULL); + storage_path_ = new_path; + + // Restore the previously supported schemes. + SetSupportedSchemes(supported_schemes_); + } else { + // Execute on the IO thread. + CEF_POST_TASK(CEF_IOT, + base::Bind(base::IgnoreResult(&CefCookieManagerImpl::SetStoragePath), + this, path)); + } + + return true; +} + +void CefCookieManagerImpl::SetGlobal() { + if (CEF_CURRENTLY_ON_IOT()) { + if (_Context->browser_context()) { + cookie_monster_ = _Context->browser_context()->GetRequestContext()-> + GetURLRequestContext()->cookie_store()->GetCookieMonster(); + DCHECK(cookie_monster_); + } + } else { + // Execute on the IO thread. + CEF_POST_TASK(CEF_IOT, base::Bind(&CefCookieManagerImpl::SetGlobal, this)); + } +} + +// static +bool CefCookieManagerImpl::GetCefCookie( + const net::CookieMonster::CanonicalCookie& cc, + CefCookie& cookie) { + CefString(&cookie.name).FromString(cc.Name()); + CefString(&cookie.value).FromString(cc.Value()); + CefString(&cookie.domain).FromString(cc.Domain()); + CefString(&cookie.path).FromString(cc.Path()); + cookie.secure = cc.IsSecure(); + cookie.httponly = cc.IsHttpOnly(); + cef_time_from_basetime(cc.CreationDate(), cookie.creation); + cef_time_from_basetime(cc.LastAccessDate(), cookie.last_access); + cookie.has_expires = cc.DoesExpire(); + if (cookie.has_expires) + cef_time_from_basetime(cc.ExpiryDate(), cookie.expires); + + return true; +} + +// static +bool CefCookieManagerImpl::GetCefCookie(const GURL& url, + const std::string& cookie_line, + CefCookie& cookie) { + // Parse the cookie. + net::CookieMonster::ParsedCookie pc(cookie_line); + if (!pc.IsValid()) + return false; + + std::string cookie_domain; + if (!GetCookieDomain(url, pc, &cookie_domain)) + return false; + + std::string cookie_path = CanonPath(url, pc); + base::Time creation_time = base::Time::Now(); + base::Time cookie_expires = CanonExpiration(pc, creation_time); + + CefString(&cookie.name).FromString(pc.Name()); + CefString(&cookie.value).FromString(pc.Value()); + CefString(&cookie.domain).FromString(cookie_domain); + CefString(&cookie.path).FromString(cookie_path); + cookie.secure = pc.IsSecure(); + cookie.httponly = pc.IsHttpOnly(); + cef_time_from_basetime(creation_time, cookie.creation); + cef_time_from_basetime(creation_time, cookie.last_access); + cookie.has_expires = !cookie_expires.is_null(); + if (cookie.has_expires) + cef_time_from_basetime(cookie_expires, cookie.expires); + + return true; +} + + +// CefCookieManager methods ---------------------------------------------------- + +// static +CefRefPtr CefCookieManager::GetGlobalManager() { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED() << "context not valid"; + return NULL; + } + + CefRefPtr manager(new CefCookieManagerImpl(true)); + manager->Initialize(CefString()); + return manager.get(); +} + +// static +CefRefPtr CefCookieManager::CreateManager( + const CefString& path) { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED() << "context not valid"; + return NULL; + } + + CefRefPtr manager(new CefCookieManagerImpl(false)); + manager->Initialize(path); + return manager.get(); +} diff --git a/libcef/browser/cookie_manager_impl.h b/libcef/browser/cookie_manager_impl.h new file mode 100644 index 000000000..0c0cdf685 --- /dev/null +++ b/libcef/browser/cookie_manager_impl.h @@ -0,0 +1,51 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_COOKIE_MANAGER_IMPL_H_ +#define CEF_LIBCEF_BROWSER_COOKIE_MANAGER_IMPL_H_ + +#include "include/cef_cookie.h" +#include "base/file_path.h" +#include "net/cookies/cookie_monster.h" + +// Implementation of the CefCookieManager interface. +class CefCookieManagerImpl : public CefCookieManager { + public: + CefCookieManagerImpl(bool is_global); + ~CefCookieManagerImpl(); + + // Initialize the cookie manager. + void Initialize(const CefString& path); + + // CefCookieManager methods. + virtual void SetSupportedSchemes(const std::vector& schemes) + OVERRIDE; + virtual bool VisitAllCookies(CefRefPtr visitor) OVERRIDE; + virtual bool VisitUrlCookies(const CefString& url, bool includeHttpOnly, + CefRefPtr visitor) OVERRIDE; + virtual bool SetCookie(const CefString& url, + const CefCookie& cookie) OVERRIDE; + virtual bool DeleteCookies(const CefString& url, + const CefString& cookie_name) OVERRIDE; + virtual bool SetStoragePath(const CefString& path) OVERRIDE; + + net::CookieMonster* cookie_monster() { return cookie_monster_; } + + static bool GetCefCookie(const net::CookieMonster::CanonicalCookie& cc, + CefCookie& cookie); + static bool GetCefCookie(const GURL& url, const std::string& cookie_line, + CefCookie& cookie); + + private: + void SetGlobal(); + + scoped_refptr cookie_monster_; + bool is_global_; + FilePath storage_path_; + std::vector supported_schemes_; + + IMPLEMENT_REFCOUNTING(CefCookieManagerImpl); +}; + +#endif // CEF_LIBCEF_BROWSER_COOKIE_MANAGER_IMPL_H_ diff --git a/libcef/browser/devtools_delegate.cc b/libcef/browser/devtools_delegate.cc new file mode 100644 index 000000000..86a7dd6f1 --- /dev/null +++ b/libcef/browser/devtools_delegate.cc @@ -0,0 +1,150 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/devtools_delegate.h" +#include "libcef/browser/devtools_scheme_handler.h" + +#include +#include + +#include "base/command_line.h" +#include "base/md5.h" +#include "base/rand_util.h" +#include "base/stringprintf.h" +#include "base/string_number_conversions.h" +#include "base/time.h" +#include "content/public/browser/devtools_http_handler.h" +#include "content/public/browser/render_process_host.h" +#include "content/public/browser/render_view_host.h" +#include "content/public/common/content_client.h" +#include "content/public/common/content_switches.h" +#include "grit/cef_resources.h" +#include "net/base/tcp_listen_socket.h" +#include "net/url_request/url_request_context_getter.h" +#include "ui/base/layout.h" +#include "ui/base/resource/resource_bundle.h" + +namespace { + +class CefDevToolsBindingHandler + : public content::DevToolsHttpHandler::RenderViewHostBinding { + public: + CefDevToolsBindingHandler() { + } + + virtual std::string GetIdentifier(content::RenderViewHost* rvh) OVERRIDE { + int process_id = rvh->GetProcess()->GetID(); + int routing_id = rvh->GetRoutingID(); + + if (random_seed_.empty()) { + // Generate a random seed that is used to make identifier guessing more + // difficult. + random_seed_ = base::StringPrintf("%lf|%u", + base::Time::Now().ToDoubleT(), base::RandInt(0, INT_MAX)); + } + + // Create a key that combines RVH IDs and the random seed. + std::string key = base::StringPrintf("%d|%d|%s", + process_id, + routing_id, + random_seed_.c_str()); + + // Return an MD5 hash of the key. + return base::MD5String(key); + } + + virtual content::RenderViewHost* ForIdentifier( + const std::string& identifier) OVERRIDE { + // Iterate through the existing RVH instances to find a match. + for (content::RenderProcessHost::iterator it( + content::RenderProcessHost::AllHostsIterator()); + !it.IsAtEnd(); it.Advance()) { + content::RenderProcessHost* render_process_host = it.GetCurrentValue(); + DCHECK(render_process_host); + + // Ignore processes that don't have a connection, such as crashed + // contents. + if (!render_process_host->HasConnection()) + continue; + + content::RenderProcessHost::RenderWidgetHostsIterator rwit( + render_process_host->GetRenderWidgetHostsIterator()); + for (; !rwit.IsAtEnd(); rwit.Advance()) { + const content::RenderWidgetHost* widget = rwit.GetCurrentValue(); + DCHECK(widget); + if (!widget || !widget->IsRenderView()) + continue; + + content::RenderViewHost* host = + content::RenderViewHost::From( + const_cast(widget)); + if (GetIdentifier(host) == identifier) + return host; + } + } + + return NULL; + } + + private: + std::string random_seed_; +}; + +} // namespace + +CefDevToolsDelegate::CefDevToolsDelegate( + int port, + net::URLRequestContextGetter* context_getter) { + devtools_http_handler_ = content::DevToolsHttpHandler::Start( + new net::TCPListenSocketFactory("127.0.0.1", port), + "", + context_getter, + this); + + binding_.reset(new CefDevToolsBindingHandler()); + devtools_http_handler_->SetRenderViewHostBinding(binding_.get()); +} + +CefDevToolsDelegate::~CefDevToolsDelegate() { +} + +void CefDevToolsDelegate::Stop() { + // The call below destroys this. + devtools_http_handler_->Stop(); +} + +std::string CefDevToolsDelegate::GetDiscoveryPageHTML() { + return content::GetContentClient()->GetDataResource( + IDR_CEF_DEVTOOLS_DISCOVERY_PAGE, ui::SCALE_FACTOR_NONE).as_string(); +} + +bool CefDevToolsDelegate::BundlesFrontendResources() { + return false; +} + +std::string CefDevToolsDelegate::GetFrontendResourcesBaseURL() { + return kChromeDevToolsURL; +} + +std::string CefDevToolsDelegate::GetDevToolsURL(content::RenderViewHost* rvh, + bool http_scheme) { + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + std::string port_str = + command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort); + DCHECK(!port_str.empty()); + int port; + if (!base::StringToInt(port_str, &port)) + return std::string(); + + std::string page_id = binding_->GetIdentifier(rvh); + std::string host = http_scheme ? + base::StringPrintf("http://localhost:%d/devtools/", port) : + kChromeDevToolsURL; + + return base::StringPrintf( + "%sdevtools.html?ws=localhost:%d/devtools/page/%s", + host.c_str(), + port, + page_id.c_str()); +} diff --git a/libcef/browser/devtools_delegate.h b/libcef/browser/devtools_delegate.h new file mode 100644 index 000000000..f51f46d09 --- /dev/null +++ b/libcef/browser/devtools_delegate.h @@ -0,0 +1,48 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_DELEGATE_H_ +#define CEF_LIBCEF_BROWSER_DEVTOOLS_DELEGATE_H_ +#pragma once + +#include + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "base/memory/scoped_ptr.h" +#include "content/public/browser/devtools_http_handler.h" +#include "content/public/browser/devtools_http_handler_delegate.h" + +namespace net { +class URLRequestContextGetter; +} + +namespace content { +class RenderViewHost; +} + +class CefDevToolsDelegate : public content::DevToolsHttpHandlerDelegate { + public: + CefDevToolsDelegate(int port, net::URLRequestContextGetter* context_getter); + virtual ~CefDevToolsDelegate(); + + // Stops http server. + void Stop(); + + // DevToolsHttpProtocolHandler::Delegate overrides. + virtual std::string GetDiscoveryPageHTML() OVERRIDE; + virtual bool BundlesFrontendResources() OVERRIDE; + virtual std::string GetFrontendResourcesBaseURL() OVERRIDE; + + // Returns the DevTools URL for the specified RenderViewHost. + std::string GetDevToolsURL(content::RenderViewHost* rvh, bool http_scheme); + + private: + content::DevToolsHttpHandler* devtools_http_handler_; + scoped_ptr binding_; + + DISALLOW_COPY_AND_ASSIGN(CefDevToolsDelegate); +}; + +#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DELEGATE_H_ diff --git a/libcef/browser/devtools_scheme_handler.cc b/libcef/browser/devtools_scheme_handler.cc new file mode 100644 index 000000000..26ae1323b --- /dev/null +++ b/libcef/browser/devtools_scheme_handler.cc @@ -0,0 +1,145 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/devtools_scheme_handler.h" + +#include + +#include "include/cef_browser.h" +#include "include/cef_request.h" +#include "include/cef_resource_handler.h" +#include "include/cef_response.h" +#include "include/cef_scheme.h" +#include "include/cef_stream.h" +#include "include/cef_url.h" + +#include "base/file_util.h" +#include "base/string_util.h" +#include "content/public/common/content_client.h" +#include "grit/devtools_resources_map.h" +#include "ui/base/resource/resource_bundle.h" + +const char kChromeDevToolsScheme[] = "chrome-devtools"; +const char kChromeDevToolsHost[] = "devtools"; +const char kChromeDevToolsURL[] = "chrome-devtools://devtools/"; + +namespace { + +static std::string PathWithoutParams(const std::string& path) { + size_t query_position = path.find("?"); + if (query_position != std::string::npos) + return path.substr(0, query_position); + return path; +} + +static std::string GetMimeType(const std::string& filename) { + if (EndsWith(filename, ".html", false)) { + return "text/html"; + } else if (EndsWith(filename, ".css", false)) { + return "text/css"; + } else if (EndsWith(filename, ".js", false)) { + return "application/javascript"; + } else if (EndsWith(filename, ".png", false)) { + return "image/png"; + } else if (EndsWith(filename, ".gif", false)) { + return "image/gif"; + } + NOTREACHED(); + return "text/plain"; +} + +class DevToolsSchemeHandler : public CefResourceHandler { + public: + DevToolsSchemeHandler(const std::string& path, + CefRefPtr reader, + int size) + : path_(path), reader_(reader), size_(size) { + } + + virtual bool ProcessRequest(CefRefPtr request, + CefRefPtr callback) + OVERRIDE { + callback->Continue(); + return true; + } + + virtual void GetResponseHeaders(CefRefPtr response, + int64& response_length, + CefString& redirectUrl) OVERRIDE { + response_length = size_; + + response->SetMimeType(GetMimeType(path_)); + response->SetStatus(200); + } + + virtual bool ReadResponse(void* data_out, + int bytes_to_read, + int& bytes_read, + CefRefPtr callback) + OVERRIDE { + bytes_read = reader_->Read(data_out, 1, bytes_to_read); + return (bytes_read > 0); + } + + virtual void Cancel() OVERRIDE { + } + + private: + std::string path_; + CefRefPtr reader_; + int size_; + + IMPLEMENT_REFCOUNTING(DevToolSSchemeHandler); +}; + +class DevToolsSchemeHandlerFactory : public CefSchemeHandlerFactory { + public: + DevToolsSchemeHandlerFactory() {} + + virtual CefRefPtr Create( + CefRefPtr browser, + CefRefPtr frame, + const CefString& scheme_name, + CefRefPtr request) OVERRIDE { + std::string url = PathWithoutParams(request->GetURL()); + const char* path = &url.c_str()[strlen(kChromeDevToolsURL)]; + + int size = -1; + CefRefPtr reader = GetStreamReader(path, size); + if (!reader.get()) + return NULL; + + return new DevToolsSchemeHandler(path, reader, size); + } + + CefRefPtr GetStreamReader(const char* path, int& size) { + // Create a stream for the grit resource. + for (size_t i = 0; i < kDevtoolsResourcesSize; ++i) { + if (base::strcasecmp(kDevtoolsResources[i].name, path) == 0) { + base::StringPiece piece = + content::GetContentClient()->GetDataResource( + kDevtoolsResources[i].value, ui::SCALE_FACTOR_NONE); + if (!piece.empty()) { + size = piece.size(); + return CefStreamReader::CreateForData(const_cast(piece.data()), + size); + } + } + } + + NOTREACHED() << "Missing DevTools resource: " << path; + return NULL; + } + + IMPLEMENT_REFCOUNTING(DevToolSSchemeHandlerFactory); +}; + +} // namespace + +// Register the DevTools scheme handler. +void RegisterDevToolsSchemeHandler() { + CefRegisterSchemeHandlerFactory(kChromeDevToolsScheme, kChromeDevToolsHost, + new DevToolsSchemeHandlerFactory()); +} diff --git a/libcef/browser/devtools_scheme_handler.h b/libcef/browser/devtools_scheme_handler.h new file mode 100644 index 000000000..f36608586 --- /dev/null +++ b/libcef/browser/devtools_scheme_handler.h @@ -0,0 +1,16 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_SCHEME_HANDLER_H_ +#define CEF_LIBCEF_BROWSER_DEVTOOLS_SCHEME_HANDLER_H_ +#pragma once + +extern const char kChromeDevToolsScheme[]; +extern const char kChromeDevToolsHost[]; +extern const char kChromeDevToolsURL[]; + +// Register the DevTools scheme handler. +void RegisterDevToolsSchemeHandler(); + +#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_SCHEME_HANDLER_H_ diff --git a/libcef/browser/download_item_impl.cc b/libcef/browser/download_item_impl.cc new file mode 100644 index 000000000..826bea231 --- /dev/null +++ b/libcef/browser/download_item_impl.cc @@ -0,0 +1,107 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/browser/download_item_impl.h" + +#include "libcef/common/time_util.h" + +#include "content/public/browser/download_item.h" +#include "googleurl/src/gurl.h" + + +CefDownloadItemImpl::CefDownloadItemImpl(content::DownloadItem* value) + : CefValueBase( + value, NULL, kOwnerNoDelete, true, + new CefValueControllerNonThreadSafe()) { + // Indicate that this object owns the controller. + SetOwnsController(); +} + +bool CefDownloadItemImpl::IsValid() { + return !detached(); +} + +bool CefDownloadItemImpl::IsInProgress() { + CEF_VALUE_VERIFY_RETURN(false, false); + return const_value().IsInProgress(); +} + +bool CefDownloadItemImpl::IsComplete() { + CEF_VALUE_VERIFY_RETURN(false, false); + return const_value().IsComplete(); +} + +bool CefDownloadItemImpl::IsCanceled() { + CEF_VALUE_VERIFY_RETURN(false, false); + return const_value().IsCancelled(); +} + +int64 CefDownloadItemImpl::GetCurrentSpeed() { + CEF_VALUE_VERIFY_RETURN(false, 0); + return const_value().CurrentSpeed(); +} + +int CefDownloadItemImpl::GetPercentComplete() { + CEF_VALUE_VERIFY_RETURN(false, -1); + return const_value().PercentComplete(); +} + +int64 CefDownloadItemImpl::GetTotalBytes() { + CEF_VALUE_VERIFY_RETURN(false, 0); + return const_value().GetTotalBytes(); +} + +int64 CefDownloadItemImpl::GetReceivedBytes() { + CEF_VALUE_VERIFY_RETURN(false, 0); + return const_value().GetReceivedBytes(); +} + +CefTime CefDownloadItemImpl::GetStartTime() { + CefTime time; + CEF_VALUE_VERIFY_RETURN(false, time); + cef_time_from_basetime(const_value().GetStartTime(), time); + return time; +} + +CefTime CefDownloadItemImpl::GetEndTime() { + CefTime time; + CEF_VALUE_VERIFY_RETURN(false, time); + cef_time_from_basetime(const_value().GetEndTime(), time); + return time; +} + +CefString CefDownloadItemImpl::GetFullPath() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().GetFullPath().value(); +} + +int32 CefDownloadItemImpl::GetId() { + CEF_VALUE_VERIFY_RETURN(false, 0); + return const_value().GetId(); +} + +CefString CefDownloadItemImpl::GetURL() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().GetURL().spec(); +} + +CefString CefDownloadItemImpl::GetSuggestedFileName() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().GetSuggestedFilename(); +} + +CefString CefDownloadItemImpl::GetContentDisposition() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().GetContentDisposition(); +} + +CefString CefDownloadItemImpl::GetMimeType() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().GetMimeType(); +} + +CefString CefDownloadItemImpl::GetReferrerCharset() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().GetReferrerCharset(); +} diff --git a/libcef/browser/download_item_impl.h b/libcef/browser/download_item_impl.h new file mode 100644 index 000000000..30016f74b --- /dev/null +++ b/libcef/browser/download_item_impl.h @@ -0,0 +1,45 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_DOWNLOAD_ITEM_IMPL_H_ +#define CEF_LIBCEF_BROWSER_DOWNLOAD_ITEM_IMPL_H_ +#pragma once + +#include "include/cef_download_item.h" +#include "libcef/common/value_base.h" + +namespace content { +class DownloadItem; +} + +// CefDownloadItem implementation +class CefDownloadItemImpl + : public CefValueBase { + public: + explicit CefDownloadItemImpl(content::DownloadItem* value); + + // CefDownloadItem methods. + virtual bool IsValid() OVERRIDE; + virtual bool IsInProgress() OVERRIDE; + virtual bool IsComplete() OVERRIDE; + virtual bool IsCanceled() OVERRIDE; + virtual int64 GetCurrentSpeed() OVERRIDE; + virtual int GetPercentComplete() OVERRIDE; + virtual int64 GetTotalBytes() OVERRIDE; + virtual int64 GetReceivedBytes() OVERRIDE; + virtual CefTime GetStartTime() OVERRIDE; + virtual CefTime GetEndTime() OVERRIDE; + virtual CefString GetFullPath() OVERRIDE; + virtual int32 GetId() OVERRIDE; + virtual CefString GetURL() OVERRIDE; + virtual CefString GetSuggestedFileName() OVERRIDE; + virtual CefString GetContentDisposition() OVERRIDE; + virtual CefString GetMimeType() OVERRIDE; + virtual CefString GetReferrerCharset() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(CefDownloadItemImpl); +}; + +#endif // CEF_LIBCEF_BROWSER_DOWNLOAD_ITEM_IMPL_H_ diff --git a/libcef/browser/download_manager_delegate.cc b/libcef/browser/download_manager_delegate.cc new file mode 100644 index 000000000..702897d14 --- /dev/null +++ b/libcef/browser/download_manager_delegate.cc @@ -0,0 +1,272 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/download_manager_delegate.h" + +#include "include/cef_download_handler.h" +#include "libcef/browser/browser_context.h" +#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/context.h" +#include "libcef/browser/download_item_impl.h" +#include "libcef/browser/thread_util.h" + +#include "base/bind.h" +#include "base/file_util.h" +#include "base/logging.h" +#include "base/path_service.h" +#include "base/string_util.h" +#include "base/utf_string_conversions.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/download_manager.h" +#include "content/public/browser/web_contents.h" +#include "net/base/net_util.h" + +using content::DownloadItem; +using content::DownloadManager; +using content::WebContents; + + +namespace { + +// Helper function to retrieve the CefBrowserHostImpl. +CefRefPtr GetBrowser(DownloadItem* item) { + content::WebContents* contents = item->GetWebContents(); + if (!contents) + return NULL; + + return CefBrowserHostImpl::GetBrowserForContents(contents).get(); +} + +// Helper function to retrieve the CefDownloadHandler. +CefRefPtr GetDownloadHandler( + CefRefPtr browser) { + CefRefPtr client = browser->GetClient(); + if (client.get()) + return client->GetDownloadHandler(); + return NULL; +} + +// Helper function to retrieve the DownloadManager. +scoped_refptr GetDownloadManager() { + return content::BrowserContext::GetDownloadManager( + _Context->browser_context()); +} + + +// CefBeforeDownloadCallback implementation. +class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback { + public: + CefBeforeDownloadCallbackImpl(int32 download_id, + const FilePath& suggested_name) + : download_id_(download_id), + suggested_name_(suggested_name) { + } + + virtual void Continue(const CefString& download_path, + bool show_dialog) OVERRIDE { + if (CEF_CURRENTLY_ON_UIT()) { + if (download_id_ <= 0) + return; + + scoped_refptr manager = GetDownloadManager(); + if (manager) { + FilePath path = FilePath(download_path); + CEF_POST_TASK(CEF_FILET, + base::Bind(&CefBeforeDownloadCallbackImpl::GenerateFilename, + download_id_, suggested_name_, path, show_dialog)); + } + + download_id_ = 0; + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBeforeDownloadCallbackImpl::Continue, this, + download_path, show_dialog)); + } + } + + private: + static void GenerateFilename(int32 download_id, + const FilePath& suggested_name, + const FilePath& download_path, + bool show_dialog) { + FilePath suggested_path = download_path; + if (!suggested_path.empty()) { + // Create the directory if necessary. + FilePath dir_path = suggested_path.DirName(); + if (!file_util::DirectoryExists(dir_path) && + !file_util::CreateDirectory(dir_path)) { + NOTREACHED() << "failed to create the download directory"; + suggested_path.clear(); + } + } + + if (suggested_path.empty()) { + if (PathService::Get(base::DIR_TEMP, &suggested_path)) { + // Use the temp directory. + suggested_path = suggested_path.Append(suggested_name); + } else { + // Use the current working directory. + suggested_path = suggested_name; + } + } + + content::DownloadItem::TargetDisposition disposition = show_dialog ? + DownloadItem::TARGET_DISPOSITION_PROMPT : + DownloadItem::TARGET_DISPOSITION_OVERWRITE; + + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefBeforeDownloadCallbackImpl::RestartDownload, + download_id, suggested_path, disposition)); + } + + static void RestartDownload(int32 download_id, + const FilePath& suggested_path, + DownloadItem::TargetDisposition disposition) { + scoped_refptr manager = GetDownloadManager(); + if (!manager) + return; + + DownloadItem* item = manager->GetActiveDownloadItem(download_id); + if (!item) + return; + + item->OnTargetPathDetermined(suggested_path, + disposition, + content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); + manager->RestartDownload(download_id); + } + + int32 download_id_; + FilePath suggested_name_; + + IMPLEMENT_REFCOUNTING(CefBeforeDownloadCallbackImpl); + DISALLOW_COPY_AND_ASSIGN(CefBeforeDownloadCallbackImpl); +}; + + +// CefDownloadItemCallback implementation. +class CefDownloadItemCallbackImpl : public CefDownloadItemCallback { + public: + explicit CefDownloadItemCallbackImpl(int32 download_id) + : download_id_(download_id) { + } + + virtual void Cancel() OVERRIDE { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefDownloadItemCallbackImpl::DoCancel, this)); + } + + private: + void DoCancel() { + if (download_id_ <= 0) + return; + + scoped_refptr manager = GetDownloadManager(); + if (manager) { + content::DownloadItem* item = + manager->GetActiveDownloadItem(download_id_); + if (item && item->IsInProgress()) + item->Cancel(true); + } + + download_id_ = 0; + } + + int32 download_id_; + + IMPLEMENT_REFCOUNTING(CefDownloadItemCallbackImpl); + DISALLOW_COPY_AND_ASSIGN(CefDownloadItemCallbackImpl); +}; + +} // namespace + + +CefDownloadManagerDelegate::CefDownloadManagerDelegate() { +} + +CefDownloadManagerDelegate::~CefDownloadManagerDelegate() { +} + +bool CefDownloadManagerDelegate::ShouldStartDownload(int32 download_id) { + scoped_refptr manager = GetDownloadManager(); + DownloadItem* item = manager->GetActiveDownloadItem(download_id); + + if (!item->GetForcedFilePath().empty()) { + item->OnTargetPathDetermined( + item->GetForcedFilePath(), + DownloadItem::TARGET_DISPOSITION_OVERWRITE, + content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); + return true; + } + + CefRefPtr browser = GetBrowser(item); + CefRefPtr handler; + if (browser.get()) + handler = GetDownloadHandler(browser); + + if (handler.get()) { + FilePath suggested_name = net::GenerateFileName( + item->GetURL(), + item->GetContentDisposition(), + item->GetReferrerCharset(), + item->GetSuggestedFilename(), + item->GetMimeType(), + "download"); + + CefRefPtr download_item(new CefDownloadItemImpl(item)); + CefRefPtr callback( + new CefBeforeDownloadCallbackImpl(download_id, suggested_name)); + + handler->OnBeforeDownload(browser.get(), download_item.get(), + suggested_name.value(), callback); + + download_item->Detach(NULL); + } + + return false; +} + +void CefDownloadManagerDelegate::ChooseDownloadPath( + content::DownloadItem* item) { + FilePath result; +#if defined(OS_WIN) || defined(OS_MACOSX) + WebContents* web_contents = item->GetWebContents(); + const FilePath suggested_path(item->GetTargetFilePath()); + result = PlatformChooseDownloadPath(web_contents, suggested_path); +#else + NOTIMPLEMENTED(); +#endif + + scoped_refptr manager = GetDownloadManager(); + if (result.empty()) { + manager->FileSelectionCanceled(item->GetId()); + } else { + manager->FileSelected(result, item->GetId()); + } +} + +void CefDownloadManagerDelegate::AddItemToPersistentStore( + DownloadItem* item) { + static int next_id; + scoped_refptr manager = GetDownloadManager(); + manager->OnItemAddedToPersistentStore(item->GetId(), ++next_id); +} + +void CefDownloadManagerDelegate::UpdateItemInPersistentStore( + DownloadItem* item) { + CefRefPtr browser = GetBrowser(item); + CefRefPtr handler; + if (browser.get()) + handler = GetDownloadHandler(browser); + + if (handler.get()) { + CefRefPtr download_item(new CefDownloadItemImpl(item)); + CefRefPtr callback( + new CefDownloadItemCallbackImpl(item->GetId())); + + handler->OnDownloadUpdated(browser.get(), download_item.get(), callback); + + download_item->Detach(NULL); + } +} diff --git a/libcef/browser/download_manager_delegate.h b/libcef/browser/download_manager_delegate.h new file mode 100644 index 000000000..29d5b6589 --- /dev/null +++ b/libcef/browser/download_manager_delegate.h @@ -0,0 +1,43 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ +#define CEF_LIBCEF_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ +#pragma once + +#include "base/compiler_specific.h" +#include "base/memory/ref_counted.h" +#include "content/public/browser/download_manager_delegate.h" + +struct DownloadStateInfo; + +namespace content { +class DownloadManager; +} + +class CefDownloadManagerDelegate + : public content::DownloadManagerDelegate, + public base::RefCountedThreadSafe { + public: + CefDownloadManagerDelegate(); + + // DownloadManagerDelegate methods. + virtual bool ShouldStartDownload(int32 download_id) OVERRIDE; + virtual void ChooseDownloadPath(content::DownloadItem* item) OVERRIDE; + virtual void AddItemToPersistentStore(content::DownloadItem* item) OVERRIDE; + virtual void UpdateItemInPersistentStore( + content::DownloadItem* item) OVERRIDE; + + private: + friend class base::RefCountedThreadSafe; + + virtual ~CefDownloadManagerDelegate(); + + FilePath PlatformChooseDownloadPath(content::WebContents* web_contents, + const FilePath& suggested_path); + + DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate); +}; + +#endif // CEF_LIBCEF_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ diff --git a/libcef/browser/download_manager_delegate_mac.mm b/libcef/browser/download_manager_delegate_mac.mm new file mode 100644 index 000000000..1e6546329 --- /dev/null +++ b/libcef/browser/download_manager_delegate_mac.mm @@ -0,0 +1,41 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/download_manager_delegate.h" + +#import + +#include "base/sys_string_conversions.h" +#include "content/public/browser/web_contents.h" + +FilePath CefDownloadManagerDelegate::PlatformChooseDownloadPath( + content::WebContents* web_contents, + const FilePath& suggested_path) { + FilePath result; + NSSavePanel* savePanel = [NSSavePanel savePanel]; + + if (!suggested_path.BaseName().empty()) { + NSString* defaultName = base::SysUTF8ToNSString( + suggested_path.BaseName().value()); + [savePanel setNameFieldStringValue:defaultName]; + } + + if (!suggested_path.DirName().empty()) { + NSString* defaultDir = base::SysUTF8ToNSString( + suggested_path.DirName().value()); + [savePanel setDirectoryURL:[NSURL fileURLWithPath:defaultDir]]; + } + + NSView* view = web_contents->GetNativeView(); + [savePanel beginSheetModalForWindow:[view window] completionHandler:nil]; + if ([savePanel runModal] == NSFileHandlingPanelOKButton) { + NSURL * url = [savePanel URL]; + NSString* path = [url path]; + result = FilePath([path UTF8String]); + } + [NSApp endSheet:savePanel]; + + return result; +} diff --git a/libcef/browser/download_manager_delegate_win.cc b/libcef/browser/download_manager_delegate_win.cc new file mode 100644 index 000000000..85db4e6f3 --- /dev/null +++ b/libcef/browser/download_manager_delegate_win.cc @@ -0,0 +1,42 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/download_manager_delegate.h" + +#include +#include + +#include "base/string_util.h" +#include "content/public/browser/web_contents.h" + + +FilePath CefDownloadManagerDelegate::PlatformChooseDownloadPath( + content::WebContents* web_contents, + const FilePath& suggested_path) { + FilePath result; + + std::wstring file_part = FilePath(suggested_path).BaseName().value(); + wchar_t file_name[MAX_PATH]; + base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name)); + OPENFILENAME save_as; + ZeroMemory(&save_as, sizeof(save_as)); + save_as.lStructSize = sizeof(OPENFILENAME); + save_as.hwndOwner = web_contents->GetNativeView(); + save_as.lpstrFile = file_name; + save_as.nMaxFile = arraysize(file_name); + + std::wstring directory; + if (!suggested_path.empty()) + directory = suggested_path.DirName().value(); + + save_as.lpstrInitialDir = directory.c_str(); + save_as.Flags = OFN_OVERWRITEPROMPT | OFN_EXPLORER | OFN_ENABLESIZING | + OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST; + + if (GetSaveFileName(&save_as)) + result = FilePath(std::wstring(save_as.lpstrFile)); + + return result; +} diff --git a/libcef/browser/frame_host_impl.cc b/libcef/browser/frame_host_impl.cc new file mode 100644 index 000000000..4618ca15a --- /dev/null +++ b/libcef/browser/frame_host_impl.cc @@ -0,0 +1,240 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/frame_host_impl.h" +#include "include/cef_request.h" +#include "include/cef_stream.h" +#include "include/cef_v8.h" +#include "libcef/common/cef_messages.h" +#include "libcef/browser/browser_host_impl.h" + +namespace { + +// Implementation of CommandResponseHandler for calling a CefStringVisitor. +class StringVisitHandler : public CefResponseManager::Handler { + public: + explicit StringVisitHandler(CefRefPtr visitor) + : visitor_(visitor) { + } + virtual void OnResponse(const Cef_Response_Params& params) OVERRIDE { + visitor_->Visit(params.response); + } + private: + CefRefPtr visitor_; + + IMPLEMENT_REFCOUNTING(StringVisitHandler); +}; + +// Implementation of CommandResponseHandler for calling ViewText(). +class ViewTextHandler : public CefResponseManager::Handler { + public: + explicit ViewTextHandler(CefRefPtr frame) + : frame_(frame) { + } + virtual void OnResponse(const Cef_Response_Params& params) OVERRIDE { + CefRefPtr browser = frame_->GetBrowser(); + if (browser.get()) { + static_cast(browser.get())->ViewText( + params.response); + } + } + private: + CefRefPtr frame_; + + IMPLEMENT_REFCOUNTING(ViewTextHandler); +}; + +} // namespace + +CefFrameHostImpl::CefFrameHostImpl(CefBrowserHostImpl* browser, + int64 frame_id, + bool is_main_frame) + : frame_id_(frame_id), + is_main_frame_(is_main_frame), + browser_(browser), + is_focused_(false), + parent_frame_id_(kInvalidFrameId) { +} + +CefFrameHostImpl::~CefFrameHostImpl() { +} + +bool CefFrameHostImpl::IsValid() { + base::AutoLock lock_scope(state_lock_); + return (browser_ != NULL); +} + +void CefFrameHostImpl::Undo() { + base::AutoLock lock_scope(state_lock_); + if (browser_ && frame_id_ != kInvalidFrameId) + browser_->SendCommand(frame_id_, "Undo", NULL); +} + +void CefFrameHostImpl::Redo() { + base::AutoLock lock_scope(state_lock_); + if (browser_ && frame_id_ != kInvalidFrameId) + browser_->SendCommand(frame_id_, "Redo", NULL); +} + +void CefFrameHostImpl::Cut() { + base::AutoLock lock_scope(state_lock_); + if (browser_ && frame_id_ != kInvalidFrameId) + browser_->SendCommand(frame_id_, "Cut", NULL); +} + +void CefFrameHostImpl::Copy() { + base::AutoLock lock_scope(state_lock_); + if (browser_ && frame_id_ != kInvalidFrameId) + browser_->SendCommand(frame_id_, "Copy", NULL); +} + +void CefFrameHostImpl::Paste() { + base::AutoLock lock_scope(state_lock_); + if (browser_ && frame_id_ != kInvalidFrameId) + browser_->SendCommand(frame_id_, "Paste", NULL); +} + +void CefFrameHostImpl::Delete() { + base::AutoLock lock_scope(state_lock_); + if (browser_ && frame_id_ != kInvalidFrameId) + browser_->SendCommand(frame_id_, "Delete", NULL); +} + +void CefFrameHostImpl::SelectAll() { + base::AutoLock lock_scope(state_lock_); + if (browser_ && frame_id_ != kInvalidFrameId) + browser_->SendCommand(frame_id_, "SelectAll", NULL); +} + +void CefFrameHostImpl::ViewSource() { + base::AutoLock lock_scope(state_lock_); + if (browser_ && frame_id_ != kInvalidFrameId) + browser_->SendCommand(frame_id_, "GetSource", new ViewTextHandler(this)); +} + +void CefFrameHostImpl::GetSource(CefRefPtr visitor) { + base::AutoLock lock_scope(state_lock_); + if (browser_ && frame_id_ != kInvalidFrameId) { + browser_->SendCommand(frame_id_, "GetSource", + new StringVisitHandler(visitor)); + } +} + +void CefFrameHostImpl::GetText(CefRefPtr visitor) { + base::AutoLock lock_scope(state_lock_); + if (browser_ && frame_id_ != kInvalidFrameId) { + browser_->SendCommand(frame_id_, "GetText", + new StringVisitHandler(visitor)); + } +} + +void CefFrameHostImpl::LoadRequest(CefRefPtr request) { + base::AutoLock lock_scope(state_lock_); + if (browser_) + browser_->LoadRequest((is_main_frame_ ? kMainFrameId : frame_id_), request); +} + +void CefFrameHostImpl::LoadURL(const CefString& url) { + base::AutoLock lock_scope(state_lock_); + if (browser_) + browser_->LoadURL((is_main_frame_ ? kMainFrameId : frame_id_), url); +} + +void CefFrameHostImpl::LoadString(const CefString& string, + const CefString& url) { + base::AutoLock lock_scope(state_lock_); + if (browser_) { + browser_->LoadString((is_main_frame_ ? kMainFrameId : frame_id_), string, + url); + } +} + +void CefFrameHostImpl::ExecuteJavaScript(const CefString& jsCode, + const CefString& scriptUrl, + int startLine) { + if (jsCode.empty()) + return; + if (startLine < 0) + startLine = 0; + + base::AutoLock lock_scope(state_lock_); + if (browser_) { + browser_->SendCode((is_main_frame_ ? kMainFrameId : frame_id_), true, + jsCode, scriptUrl, startLine, NULL); + } +} + +bool CefFrameHostImpl::IsMain() { + return is_main_frame_; +} + +bool CefFrameHostImpl::IsFocused() { + base::AutoLock lock_scope(state_lock_); + return is_focused_; +} + +CefString CefFrameHostImpl::GetName() { + base::AutoLock lock_scope(state_lock_); + return name_; +} + +int64 CefFrameHostImpl::GetIdentifier() { + return frame_id_; +} + +CefRefPtr CefFrameHostImpl::GetParent() { + base::AutoLock lock_scope(state_lock_); + + if (is_main_frame_ || parent_frame_id_ == kInvalidFrameId) + return NULL; + + if (browser_) + return browser_->GetFrame(parent_frame_id_); + + return NULL; +} + +CefString CefFrameHostImpl::GetURL() { + base::AutoLock lock_scope(state_lock_); + return url_; +} + +CefRefPtr CefFrameHostImpl::GetBrowser() { + base::AutoLock lock_scope(state_lock_); + return browser_; +} + +void CefFrameHostImpl::SetFocused(bool focused) { + base::AutoLock lock_scope(state_lock_); + is_focused_ = focused; +} + +void CefFrameHostImpl::SetURL(const CefString& url) { + base::AutoLock lock_scope(state_lock_); + url_ = url; +} + +void CefFrameHostImpl::SetName(const CefString& name) { + base::AutoLock lock_scope(state_lock_); + name_ = name; +} + +void CefFrameHostImpl::SetParentId(int64 frame_id) { + base::AutoLock lock_scope(state_lock_); + parent_frame_id_ = frame_id; +} + +CefRefPtr CefFrameHostImpl::GetV8Context() { + NOTREACHED() << "GetV8Context cannot be called from the browser process"; + return NULL; +} + +void CefFrameHostImpl::VisitDOM(CefRefPtr visitor) { + NOTREACHED() << "VisitDOM cannot be called from the browser process"; +} + +void CefFrameHostImpl::Detach() { + base::AutoLock lock_scope(state_lock_); + browser_ = NULL; +} diff --git a/libcef/browser/frame_host_impl.h b/libcef/browser/frame_host_impl.h new file mode 100644 index 000000000..eef827ff0 --- /dev/null +++ b/libcef/browser/frame_host_impl.h @@ -0,0 +1,84 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_FRAME_HOST_IMPL_H_ +#define CEF_LIBCEF_BROWSER_FRAME_HOST_IMPL_H_ +#pragma once + +#include +#include "include/cef_frame.h" +#include "base/synchronization/lock.h" + +class CefBrowserHostImpl; + +// Implementation of CefFrame. CefFrameHostImpl objects are owned by the +// CefBrowerHostImpl and will be detached when the browser is notified that the +// associated renderer WebFrame will close. +class CefFrameHostImpl : public CefFrame { + public: + CefFrameHostImpl(CefBrowserHostImpl* browser, + int64 frame_id, + bool is_main_frame); + virtual ~CefFrameHostImpl(); + + // CefFrame methods + virtual bool IsValid() OVERRIDE; + virtual void Undo() OVERRIDE; + virtual void Redo() OVERRIDE; + virtual void Cut() OVERRIDE; + virtual void Copy() OVERRIDE; + virtual void Paste() OVERRIDE; + virtual void Delete() OVERRIDE; + virtual void SelectAll() OVERRIDE; + virtual void ViewSource() OVERRIDE; + virtual void GetSource(CefRefPtr visitor) OVERRIDE; + virtual void GetText(CefRefPtr visitor) OVERRIDE; + virtual void LoadRequest(CefRefPtr request) OVERRIDE; + virtual void LoadURL(const CefString& url) OVERRIDE; + virtual void LoadString(const CefString& string, + const CefString& url) OVERRIDE; + virtual void ExecuteJavaScript(const CefString& jsCode, + const CefString& scriptUrl, + int startLine) OVERRIDE; + virtual bool IsMain() OVERRIDE; + virtual bool IsFocused() OVERRIDE; + virtual CefString GetName() OVERRIDE; + virtual int64 GetIdentifier() OVERRIDE; + virtual CefRefPtr GetParent() OVERRIDE; + virtual CefString GetURL() OVERRIDE; + virtual CefRefPtr GetBrowser() OVERRIDE; + virtual CefRefPtr GetV8Context() OVERRIDE; + virtual void VisitDOM(CefRefPtr visitor) OVERRIDE; + + void SetFocused(bool focused); + void SetURL(const CefString& url); + void SetName(const CefString& name); + void SetParentId(int64 frame_id); + + // Detach the frame from the browser. + void Detach(); + + // kMainFrameId must be -1 to align with renderer expectations. + static const int64 kMainFrameId = -1; + static const int64 kFocusedFrameId = -2; + static const int64 kUnspecifiedFrameId = -3; + static const int64 kInvalidFrameId = -4; + + protected: + int64 frame_id_; + bool is_main_frame_; + + // Volatile state information. All access must be protected by the state lock. + base::Lock state_lock_; + CefBrowserHostImpl* browser_; + bool is_focused_; + CefString url_; + CefString name_; + int64 parent_frame_id_; + + IMPLEMENT_REFCOUNTING(CefFrameHostImpl); + DISALLOW_EVIL_CONSTRUCTORS(CefFrameHostImpl); +}; + +#endif // CEF_LIBCEF_BROWSER_FRAME_HOST_IMPL_H_ diff --git a/libcef/browser/gtk_util_stub.cc b/libcef/browser/gtk_util_stub.cc new file mode 100644 index 000000000..512087e9b --- /dev/null +++ b/libcef/browser/gtk_util_stub.cc @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +#include "ui/base/events.h" + +// This file includes a selection of methods copied from +// chrome/browser/ui/gtk/gtk_util.cc. + +namespace gtk_util { + +void SetAlwaysShowImage(GtkWidget* image_menu_item) { + gtk_image_menu_item_set_always_show_image( + GTK_IMAGE_MENU_ITEM(image_menu_item), TRUE); +} + +} // namespace gtk_util + + +namespace event_utils { + +int EventFlagsFromGdkState(guint state) { + int flags = 0; + flags |= (state & GDK_LOCK_MASK) ? ui::EF_CAPS_LOCK_DOWN : 0; + flags |= (state & GDK_CONTROL_MASK) ? ui::EF_CONTROL_DOWN : 0; + flags |= (state & GDK_SHIFT_MASK) ? ui::EF_SHIFT_DOWN : 0; + flags |= (state & GDK_MOD1_MASK) ? ui::EF_ALT_DOWN : 0; + flags |= (state & GDK_BUTTON1_MASK) ? ui::EF_LEFT_MOUSE_BUTTON : 0; + flags |= (state & GDK_BUTTON2_MASK) ? ui::EF_MIDDLE_MOUSE_BUTTON : 0; + flags |= (state & GDK_BUTTON3_MASK) ? ui::EF_RIGHT_MOUSE_BUTTON : 0; + return flags; +} + +} // namespace event_utils diff --git a/libcef/browser/javascript_dialog.h b/libcef/browser/javascript_dialog.h new file mode 100644 index 000000000..5a3f5a885 --- /dev/null +++ b/libcef/browser/javascript_dialog.h @@ -0,0 +1,67 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_H_ +#define CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_H_ +#pragma once + +#include "content/public/browser/javascript_dialogs.h" + +#if defined(OS_MACOSX) +#if __OBJC__ +@class CefJavaScriptDialogHelper; +#else +class CefJavaScriptDialogHelper; +#endif // __OBJC__ +#endif // defined(OS_MACOSX) + +class CefJavaScriptDialogCreator; + +class CefJavaScriptDialog { + public: + CefJavaScriptDialog( + CefJavaScriptDialogCreator* creator, + content::JavaScriptMessageType message_type, + const string16& display_url, + const string16& message_text, + const string16& default_prompt_text, + const content::JavaScriptDialogCreator::DialogClosedCallback& callback); + ~CefJavaScriptDialog(); + + // Called to cancel a dialog mid-flight. + void Cancel(); + + // Activate the dialog. + void Activate(); + + private: + CefJavaScriptDialogCreator* creator_; + content::JavaScriptDialogCreator::DialogClosedCallback callback_; + +#if defined(OS_MACOSX) + CefJavaScriptDialogHelper* helper_; // owned +#elif defined(OS_WIN) + content::JavaScriptMessageType message_type_; + HWND dialog_win_; + HWND parent_win_; + string16 message_text_; + string16 default_prompt_text_; + static INT_PTR CALLBACK DialogProc(HWND dialog, UINT message, WPARAM wparam, + LPARAM lparam); + + // Since the message loop we expect to run in isn't going to be nicely + // calling IsDialogMessage(), we need to hook the wnd proc and call it + // ourselves. See http://support.microsoft.com/kb/q187988/ + static bool InstallMessageHook(); + static bool UninstallMessageHook(); + static LRESULT CALLBACK GetMsgProc(int code, WPARAM wparam, LPARAM lparam); + static HHOOK msg_hook_; + static int msg_hook_user_count_; +#endif + + DISALLOW_COPY_AND_ASSIGN(CefJavaScriptDialog); +}; + +#endif // CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_H_ diff --git a/libcef/browser/javascript_dialog_creator.cc b/libcef/browser/javascript_dialog_creator.cc new file mode 100644 index 000000000..91ebb3b95 --- /dev/null +++ b/libcef/browser/javascript_dialog_creator.cc @@ -0,0 +1,204 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/javascript_dialog_creator.h" +#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/javascript_dialog.h" +#include "libcef/browser/thread_util.h" + +#include "base/bind.h" +#include "base/logging.h" +#include "base/utf_string_conversions.h" +#include "net/base/net_util.h" + +namespace { + +class CefJSDialogCallbackImpl : public CefJSDialogCallback { + public: + CefJSDialogCallbackImpl( + const content::JavaScriptDialogCreator::DialogClosedCallback& callback) + : callback_(callback) { + } + ~CefJSDialogCallbackImpl() { + if (!callback_.is_null()) { + // The callback is still pending. Cancel it now. + if (CEF_CURRENTLY_ON_UIT()) { + CancelNow(callback_); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefJSDialogCallbackImpl::CancelNow, callback_)); + } + } + } + + virtual void Continue(bool success, + const CefString& user_input) OVERRIDE { + if (CEF_CURRENTLY_ON_UIT()) { + if (!callback_.is_null()) { + callback_.Run(success, user_input); + callback_.Reset(); + } + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(&CefJSDialogCallbackImpl::Continue, this, success, + user_input)); + } + } + + void Disconnect() { + callback_.Reset(); + } + + private: + static void CancelNow( + const content::JavaScriptDialogCreator::DialogClosedCallback& callback) { + CEF_REQUIRE_UIT(); + callback.Run(false, string16()); + } + + content::JavaScriptDialogCreator::DialogClosedCallback callback_; + + IMPLEMENT_REFCOUNTING(CefJSDialogCallbackImpl); +}; + +} // namespace + + +CefJavaScriptDialogCreator::CefJavaScriptDialogCreator( + CefBrowserHostImpl* browser) + : browser_(browser) { +} + +CefJavaScriptDialogCreator::~CefJavaScriptDialogCreator() { +} + +void CefJavaScriptDialogCreator::RunJavaScriptDialog( + content::WebContents* web_contents, + const GURL& origin_url, + const std::string& accept_lang, + content::JavaScriptMessageType message_type, + const string16& message_text, + const string16& default_prompt_text, + const DialogClosedCallback& callback, + bool* did_suppress_message) { + CefRefPtr client = browser_->GetClient(); + if (client.get()) { + CefRefPtr handler = client->GetJSDialogHandler(); + if (handler.get()) { + *did_suppress_message = false; + + CefRefPtr callbackPtr( + new CefJSDialogCallbackImpl(callback)); + + // Execute the user callback. + bool handled = handler->OnJSDialog(browser_, origin_url.spec(), + accept_lang, + static_cast(message_type), + message_text, default_prompt_text, callbackPtr.get(), + *did_suppress_message); + if (handled) + return; + + callbackPtr->Disconnect(); + if (*did_suppress_message) + return; + } + } + +#if defined(OS_MACOSX) || defined(OS_WIN) + *did_suppress_message = false; + + if (dialog_.get()) { + // One dialog at a time, please. + *did_suppress_message = true; + return; + } + + string16 display_url = net::FormatUrl(origin_url, accept_lang); + + dialog_.reset(new CefJavaScriptDialog(this, + message_type, + display_url, + message_text, + default_prompt_text, + callback)); +#else + // TODO(port): implement CefJavaScriptDialog for other platforms. + *did_suppress_message = true; + return; +#endif +} + +void CefJavaScriptDialogCreator::RunBeforeUnloadDialog( + content::WebContents* web_contents, + const string16& message_text, + bool is_reload, + const DialogClosedCallback& callback) { + CefRefPtr client = browser_->GetClient(); + if (client.get()) { + CefRefPtr handler = client->GetJSDialogHandler(); + if (handler.get()) { + CefRefPtr callbackPtr( + new CefJSDialogCallbackImpl(callback)); + + // Execute the user callback. + bool handled = handler->OnBeforeUnloadDialog(browser_, message_text, + is_reload, callbackPtr.get()); + if (handled) + return; + + callbackPtr->Disconnect(); + } + } + +#if defined(OS_MACOSX) || defined(OS_WIN) + if (dialog_.get()) { + // Seriously!? + callback.Run(true, string16()); + return; + } + + string16 new_message_text = + message_text + + ASCIIToUTF16("\n\nIs it OK to leave/reload this page?"); + + dialog_.reset(new CefJavaScriptDialog(this, + content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, + string16(), // display_url + new_message_text, + string16(), // default_prompt_text + callback)); +#else + // TODO(port): implement CefJavaScriptDialog for other platforms. + callback.Run(true, string16()); + return; +#endif +} + +void CefJavaScriptDialogCreator::ResetJavaScriptState( + content::WebContents* web_contents) { + CefRefPtr client = browser_->GetClient(); + if (client.get()) { + CefRefPtr handler = client->GetJSDialogHandler(); + if (handler.get()) { + // Execute the user callback. + handler->OnResetDialogState(browser_); + } + } + +#if defined(OS_MACOSX) || defined(OS_WIN) + if (dialog_.get()) { + dialog_->Cancel(); + dialog_.reset(); + } +#endif +} + +void CefJavaScriptDialogCreator::DialogClosed(CefJavaScriptDialog* dialog) { +#if defined(OS_MACOSX) || defined(OS_WIN) + DCHECK_EQ(dialog, dialog_.get()); + dialog_.reset(); +#endif +} diff --git a/libcef/browser/javascript_dialog_creator.h b/libcef/browser/javascript_dialog_creator.h new file mode 100644 index 000000000..37a05b5e0 --- /dev/null +++ b/libcef/browser/javascript_dialog_creator.h @@ -0,0 +1,61 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_CREATOR_H_ +#define CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_CREATOR_H_ +#pragma once + +#include + +#include "base/compiler_specific.h" +#include "base/memory/scoped_ptr.h" +#include "content/public/browser/javascript_dialogs.h" + +class CefBrowserHostImpl; +class CefJavaScriptDialog; + +class CefJavaScriptDialogCreator : public content::JavaScriptDialogCreator { + public: + explicit CefJavaScriptDialogCreator(CefBrowserHostImpl* browser); + virtual ~CefJavaScriptDialogCreator(); + + // JavaScriptDialogCreator methods. + virtual void RunJavaScriptDialog( + content::WebContents* web_contents, + const GURL& origin_url, + const std::string& accept_lang, + content::JavaScriptMessageType message_type, + const string16& message_text, + const string16& default_prompt_text, + const DialogClosedCallback& callback, + bool* did_suppress_message) OVERRIDE; + + virtual void RunBeforeUnloadDialog( + content::WebContents* web_contents, + const string16& message_text, + bool is_reload, + const DialogClosedCallback& callback) OVERRIDE; + + virtual void ResetJavaScriptState( + content::WebContents* web_contents) OVERRIDE; + + // Called by the CefJavaScriptDialog when it closes. + void DialogClosed(CefJavaScriptDialog* dialog); + + CefBrowserHostImpl* browser() const { return browser_; } + + private: + // This pointer is guaranteed to outlive the CefJavaScriptDialogCreator. + CefBrowserHostImpl* browser_; + +#if defined(OS_MACOSX) || defined(OS_WIN) + // The dialog being shown. No queueing. + scoped_ptr dialog_; +#endif + + DISALLOW_COPY_AND_ASSIGN(CefJavaScriptDialogCreator); +}; + +#endif // CEF_LIBCEF_BROWSER_JAVASCRIPT_DIALOG_CREATOR_H_ diff --git a/libcef/browser/javascript_dialog_mac.mm b/libcef/browser/javascript_dialog_mac.mm new file mode 100644 index 000000000..fc15339ec --- /dev/null +++ b/libcef/browser/javascript_dialog_mac.mm @@ -0,0 +1,156 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/javascript_dialog.h" +#include "libcef/browser/javascript_dialog_creator.h" + +#import + +#import "base/mac/cocoa_protocols.h" +#import "base/memory/scoped_nsobject.h" +#include "base/sys_string_conversions.h" +#include "base/utf_string_conversions.h" + +// Helper object that receives the notification that the dialog/sheet is +// going away. Is responsible for cleaning itself up. +@interface CefJavaScriptDialogHelper : NSObject { + @private + scoped_nsobject alert_; + NSTextField* textField_; // WEAK; owned by alert_ + + // Copies of the fields in CefJavaScriptDialog because they're private. + CefJavaScriptDialogCreator* creator_; + content::JavaScriptDialogCreator::DialogClosedCallback callback_; +} + +- (id)initHelperWithCreator:(CefJavaScriptDialogCreator*)creator + andCallback:(content::JavaScriptDialogCreator::DialogClosedCallback)callback; +- (NSAlert*)alert; +- (NSTextField*)textField; +- (void)alertDidEnd:(NSAlert*)alert + returnCode:(int)returnCode + contextInfo:(void*)contextInfo; +- (void)cancel; + +@end + +@implementation CefJavaScriptDialogHelper + +- (id)initHelperWithCreator:(CefJavaScriptDialogCreator*)creator + andCallback:(content::JavaScriptDialogCreator::DialogClosedCallback)callback { + if (self = [super init]) { + creator_ = creator; + callback_ = callback; + } + + return self; +} + +- (NSAlert*)alert { + alert_.reset([[NSAlert alloc] init]); + return alert_; +} + +- (NSTextField*)textField { + textField_ = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 300, 22)]; + [[textField_ cell] setLineBreakMode:NSLineBreakByTruncatingTail]; + [alert_ setAccessoryView:textField_]; + [textField_ release]; + + return textField_; +} + +- (void)alertDidEnd:(NSAlert*)alert + returnCode:(int)returnCode + contextInfo:(void*)contextInfo { + if (returnCode == NSRunStoppedResponse) + return; + + bool success = returnCode == NSAlertFirstButtonReturn; + string16 input; + if (textField_) + input = base::SysNSStringToUTF16([textField_ stringValue]); + + CefJavaScriptDialog* native_dialog = + reinterpret_cast(contextInfo); + callback_.Run(success, input); + creator_->DialogClosed(native_dialog); +} + +- (void)cancel { + [NSApp endSheet:[alert_ window]]; + alert_.reset(); +} + +@end + +CefJavaScriptDialog::CefJavaScriptDialog( + CefJavaScriptDialogCreator* creator, + content::JavaScriptMessageType message_type, + const string16& display_url, + const string16& message_text, + const string16& default_prompt_text, + const content::JavaScriptDialogCreator::DialogClosedCallback& callback) + : creator_(creator), + callback_(callback) { + bool text_field = + message_type == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT; + bool one_button = + message_type == content::JAVASCRIPT_MESSAGE_TYPE_ALERT; + + helper_ = + [[CefJavaScriptDialogHelper alloc] initHelperWithCreator:creator + andCallback:callback]; + + // Show the modal dialog. + NSAlert* alert = [helper_ alert]; + NSTextField* field = nil; + if (text_field) { + field = [helper_ textField]; + [field setStringValue:base::SysUTF16ToNSString(default_prompt_text)]; + } + [alert setDelegate:helper_]; + [alert setInformativeText:base::SysUTF16ToNSString(message_text)]; + + string16 label; + switch (message_type) { + case content::JAVASCRIPT_MESSAGE_TYPE_ALERT: + label = ASCIIToUTF16("JavaScript Alert"); + break; + case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT: + label = ASCIIToUTF16("JavaScript Prompt"); + break; + case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: + label = ASCIIToUTF16("JavaScript Confirm"); + break; + } + if (!display_url.empty()) + label += ASCIIToUTF16(" - ") + display_url; + + [alert setMessageText:base::SysUTF16ToNSString(label)]; + + [alert addButtonWithTitle:@"OK"]; + if (!one_button) { + NSButton* other = [alert addButtonWithTitle:@"Cancel"]; + [other setKeyEquivalent:@"\e"]; + } + + [alert + beginSheetModalForWindow:nil // nil here makes it app-modal + modalDelegate:helper_ + didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) + contextInfo:this]; + + if ([alert accessoryView]) + [[alert window] makeFirstResponder:[alert accessoryView]]; +} + +CefJavaScriptDialog::~CefJavaScriptDialog() { + [helper_ release]; +} + +void CefJavaScriptDialog::Cancel() { + [helper_ cancel]; +} diff --git a/libcef/browser/javascript_dialog_win.cc b/libcef/browser/javascript_dialog_win.cc new file mode 100644 index 000000000..14f5eabbe --- /dev/null +++ b/libcef/browser/javascript_dialog_win.cc @@ -0,0 +1,225 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/javascript_dialog.h" +#include "libcef/browser/javascript_dialog_creator.h" +#include "libcef/browser/browser_host_impl.h" +#include "libcef_dll/resource.h" + +#include "base/file_path.h" +#include "base/path_service.h" +#include "base/string_util.h" +#include "base/utf_string_conversions.h" + +class CefJavaScriptDialog; + +HHOOK CefJavaScriptDialog::msg_hook_ = NULL; +int CefJavaScriptDialog::msg_hook_user_count_ = 0; + +INT_PTR CALLBACK CefJavaScriptDialog::DialogProc(HWND dialog, + UINT message, + WPARAM wparam, + LPARAM lparam) { + switch (message) { + case WM_INITDIALOG: { + SetWindowLongPtr(dialog, DWL_USER, static_cast(lparam)); + CefJavaScriptDialog* owner = + reinterpret_cast(lparam); + owner->dialog_win_ = dialog; + SetDlgItemText(dialog, IDC_DIALOGTEXT, owner->message_text_.c_str()); + if (owner->message_type_ == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) + SetDlgItemText(dialog, IDC_PROMPTEDIT, + owner->default_prompt_text_.c_str()); + break; + } + case WM_CLOSE: { + CefJavaScriptDialog* owner = reinterpret_cast( + GetWindowLongPtr(dialog, DWL_USER)); + if (owner) { + owner->Cancel(); + owner->callback_.Run(false, string16()); + owner->creator_->DialogClosed(owner); + + // No need for the system to call DestroyWindow() because it will be + // called by the Cancel() method. + return 0; + } + break; + } + case WM_COMMAND: { + CefJavaScriptDialog* owner = reinterpret_cast( + GetWindowLongPtr(dialog, DWL_USER)); + string16 user_input; + bool finish = false; + bool result; + switch (LOWORD(wparam)) { + case IDOK: + finish = true; + result = true; + if (owner->message_type_ == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) { + size_t length = + GetWindowTextLength(GetDlgItem(dialog, IDC_PROMPTEDIT)) + 1; + GetDlgItemText(dialog, IDC_PROMPTEDIT, + WriteInto(&user_input, length), length); + } + break; + case IDCANCEL: + finish = true; + result = false; + break; + } + if (finish) { + owner->Cancel(); + owner->callback_.Run(result, user_input); + owner->creator_->DialogClosed(owner); + } + break; + } + default: + return DefWindowProc(dialog, message, wparam, lparam); + } + return 0; +} + +CefJavaScriptDialog::CefJavaScriptDialog( + CefJavaScriptDialogCreator* creator, + content::JavaScriptMessageType message_type, + const string16& display_url, + const string16& message_text, + const string16& default_prompt_text, + const content::JavaScriptDialogCreator::DialogClosedCallback& callback) + : creator_(creator), + callback_(callback), + message_text_(message_text), + default_prompt_text_(default_prompt_text), + message_type_(message_type) { + InstallMessageHook(); + + int dialog_type; + if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_ALERT) + dialog_type = IDD_ALERT; + else if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM) + dialog_type = IDD_CONFIRM; + else // JAVASCRIPT_MESSAGE_TYPE_PROMPT + dialog_type = IDD_PROMPT; + + FilePath file_path; + HMODULE hModule = NULL; + + // Try to load the dialog from the DLL. + if (PathService::Get(base::FILE_MODULE, &file_path)) + hModule = ::GetModuleHandle(file_path.value().c_str()); + if (!hModule) + hModule = ::GetModuleHandle(NULL); + DCHECK(hModule); + + parent_win_ = GetAncestor(creator->browser()->GetWindowHandle(), GA_ROOT); + dialog_win_ = CreateDialogParam(hModule, + MAKEINTRESOURCE(dialog_type), + parent_win_, + DialogProc, + reinterpret_cast(this)); + DCHECK(dialog_win_); + + if (!display_url.empty()) { + // Add the display URL to the window title. + TCHAR text[64]; + GetWindowText(dialog_win_, text, sizeof(text)/sizeof(TCHAR)); + + string16 new_window_text = text + ASCIIToUTF16(" - ") + display_url; + SetWindowText(dialog_win_, new_window_text.c_str()); + } + + // Disable the parent window so the user can't interact with it. + if (IsWindowEnabled(parent_win_)) + EnableWindow(parent_win_, FALSE); + + ShowWindow(dialog_win_, SW_SHOWNORMAL); +} + +CefJavaScriptDialog::~CefJavaScriptDialog() { + Cancel(); + UninstallMessageHook(); +} + +void CefJavaScriptDialog::Cancel() { + HWND parent = NULL; + + // Re-enable the parent before closing the popup to avoid focus/activation/ + // z-order issues. + if (parent_win_ && IsWindow(parent_win_) && !IsWindowEnabled(parent_win_)) { + parent = parent_win_; + EnableWindow(parent_win_, TRUE); + parent_win_ = NULL; + } + + if (dialog_win_ && IsWindow(dialog_win_)) { + SetWindowLongPtr(dialog_win_, DWL_USER, NULL); + DestroyWindow(dialog_win_); + dialog_win_ = NULL; + } + + // Return focus to the parent window. + if (parent) + SetFocus(parent); +} + +// static +LRESULT CALLBACK CefJavaScriptDialog::GetMsgProc(int code, WPARAM wparam, + LPARAM lparam) { + // Mostly borrowed from http://support.microsoft.com/kb/q187988/ + // and http://www.codeproject.com/KB/atl/cdialogmessagehook.aspx. + LPMSG msg = reinterpret_cast(lparam); + if (code >= 0 && wparam == PM_REMOVE && + msg->message >= WM_KEYFIRST && msg->message <= WM_KEYLAST) { + HWND hwnd = GetActiveWindow(); + if (::IsWindow(hwnd) && ::IsDialogMessage(hwnd, msg)) { + // The value returned from this hookproc is ignored, and it cannot + // be used to tell Windows the message has been handled. To avoid + // further processing, convert the message to WM_NULL before + // returning. + msg->hwnd = NULL; + msg->message = WM_NULL; + msg->lParam = 0L; + msg->wParam = 0; + } + } + + // Passes the hook information to the next hook procedure in + // the current hook chain. + return ::CallNextHookEx(msg_hook_, code, wparam, lparam); +} + +// static +bool CefJavaScriptDialog::InstallMessageHook() { + msg_hook_user_count_++; + + // Make sure we only call this once. + if (msg_hook_ != NULL) + return true; + + msg_hook_ = ::SetWindowsHookEx(WH_GETMESSAGE, + &CefJavaScriptDialog::GetMsgProc, + NULL, + GetCurrentThreadId()); + DCHECK(msg_hook_ != NULL); + return msg_hook_ != NULL; +} + +// static +bool CefJavaScriptDialog::UninstallMessageHook() { + msg_hook_user_count_--; + DCHECK_GE(msg_hook_user_count_, 0); + + if (msg_hook_user_count_ > 0) + return true; + + DCHECK(msg_hook_ != NULL); + BOOL result = ::UnhookWindowsHookEx(msg_hook_); + DCHECK(result); + msg_hook_ = NULL; + + return result != FALSE; +} diff --git a/libcef/browser/menu_creator.cc b/libcef/browser/menu_creator.cc new file mode 100644 index 000000000..3bcf2a352 --- /dev/null +++ b/libcef/browser/menu_creator.cc @@ -0,0 +1,312 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/menu_creator.h" +#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/context_menu_params_impl.h" + +#include "base/compiler_specific.h" +#include "base/logging.h" +#include "content/public/browser/render_view_host.h" +#include "content/public/browser/render_widget_host_view.h" +#include "content/public/common/content_client.h" +#include "grit/cef_strings.h" + +#if defined(OS_WIN) +#include "libcef/browser/menu_creator_runner_win.h" +#elif defined(OS_MACOSX) +#include "libcef/browser/menu_creator_runner_mac.h" +#elif defined(TOOLKIT_GTK) +#include "libcef/browser/menu_creator_runner_gtk.h" +#endif + +namespace { + +CefString GetLabel(int message_id) { + string16 label = content::GetContentClient()->GetLocalizedString(message_id); + DCHECK(!label.empty()); + return label; +} + +} // namespace + +CefMenuCreator::CefMenuCreator(CefBrowserHostImpl* browser) + : browser_(browser) { + model_ = new CefMenuModelImpl(this); +} + +CefMenuCreator::~CefMenuCreator() { + // The model may outlive the delegate if the context menu is visible when the + // application is closed. + model_->set_delegate(NULL); +} + +bool CefMenuCreator::IsShowingContextMenu() { + content::RenderWidgetHostView* view = + browser_->GetWebContents()->GetRenderWidgetHostView(); + return (view && view->IsShowingContextMenu()); +} + +bool CefMenuCreator::CreateContextMenu( + const content::ContextMenuParams& params) { + if (!CreateRunner()) + return true; + + // The renderer may send the "show context menu" message multiple times, one + // for each right click mouse event it receives. Normally, this doesn't happen + // because mouse events are not forwarded once the context menu is showing. + // However, there's a race - the context menu may not yet be showing when + // the second mouse event arrives. In this case, |HandleContextMenu()| will + // get called multiple times - if so, don't create another context menu. + // TODO(asvitkine): Fix the renderer so that it doesn't do this. + if (IsShowingContextMenu()) + return true; + + params_ = params; + model_->Clear(); + + // Create the default menu model. + CreateDefaultModel(); + + // Give the client a chance to modify the model. + CefRefPtr client = browser_->GetClient(); + if (client.get()) { + CefRefPtr handler = + client->GetContextMenuHandler(); + if (handler.get()) { + CefRefPtr frame; + if (params_.frame_id > 0) + frame = browser_->GetFrame(params_.frame_id); + if (!frame.get()) + frame = browser_->GetMainFrame(); + + CefRefPtr paramsPtr( + new CefContextMenuParamsImpl(¶ms_)); + + handler->OnBeforeContextMenu(browser_, frame, paramsPtr.get(), + model_.get()); + + // Do not keep references to the parameters in the callback. + paramsPtr->Detach(NULL); + DCHECK_EQ(paramsPtr->GetRefCt(), 1); + DCHECK(model_->VerifyRefCount()); + + // Menu is empty so notify the client and return. + if (model_->GetCount() == 0) { + MenuClosed(model_); + return true; + } + } + } + + return runner_->RunContextMenu(this); +} + +bool CefMenuCreator::CreateRunner() { + if (!runner_.get()) { + // Create the menu runner. +#if defined(OS_WIN) + runner_.reset(new CefMenuCreatorRunnerWin); +#elif defined(OS_MACOSX) + runner_.reset(new CefMenuCreatorRunnerMac); +#elif defined(TOOLKIT_GTK) + runner_.reset(new CefMenuCreatorRunnerGtk); +#else + // Need an implementation. + NOTREACHED(); +#endif + } + return (runner_.get() != NULL); +} + +void CefMenuCreator::ExecuteCommand(CefRefPtr source, + int command_id, + cef_event_flags_t event_flags) { + // Give the client a chance to handle the command. + CefRefPtr client = browser_->GetClient(); + if (client.get()) { + CefRefPtr handler = + client->GetContextMenuHandler(); + if (handler.get()) { + CefRefPtr frame; + if (params_.frame_id > 0) + frame = browser_->GetFrame(params_.frame_id); + if (!frame.get()) + frame = browser_->GetMainFrame(); + + CefRefPtr paramsPtr( + new CefContextMenuParamsImpl(¶ms_)); + + bool handled = handler->OnContextMenuCommand(browser_, frame, + paramsPtr.get(), command_id, event_flags); + + // Do not keep references to the parameters in the callback. + paramsPtr->Detach(NULL); + DCHECK_EQ(paramsPtr->GetRefCt(), 1); + + if (handled) + return; + } + } + + // Execute the default command handling. + ExecuteDefaultCommand(command_id); +} + +void CefMenuCreator::MenuWillShow(CefRefPtr source) { + // May be called for sub-menus as well. + if (source.get() != model_.get()) + return; + + // Notify the host before showing the context menu. + content::RenderWidgetHostView* view = + browser_->GetWebContents()->GetRenderWidgetHostView(); + if (view) + view->SetShowingContextMenu(true); +} + +void CefMenuCreator::MenuClosed(CefRefPtr source) { + // May be called for sub-menus as well. + if (source.get() != model_.get()) + return; + + // Notify the client. + CefRefPtr client = browser_->GetClient(); + if (client.get()) { + CefRefPtr handler = + client->GetContextMenuHandler(); + if (handler.get()) { + CefRefPtr frame; + if (params_.frame_id > 0) + frame = browser_->GetFrame(params_.frame_id); + if (!frame.get()) + frame = browser_->GetMainFrame(); + + handler->OnContextMenuDismissed(browser_, frame); + } + } + + if (IsShowingContextMenu()) { + // Notify the host after closing the context menu. + content::RenderWidgetHostView* view = + browser_->GetWebContents()->GetRenderWidgetHostView(); + if (view) + view->SetShowingContextMenu(false); + content::RenderViewHost* rvh = + browser_->GetWebContents()->GetRenderViewHost(); + if (rvh) + rvh->NotifyContextMenuClosed(params_.custom_context); + } +} + +void CefMenuCreator::CreateDefaultModel() { + if (params_.is_editable) { + // Editable node. + model_->AddItem(MENU_ID_UNDO, GetLabel(IDS_MENU_UNDO)); + model_->AddItem(MENU_ID_REDO, GetLabel(IDS_MENU_REDO)); + + model_->AddSeparator(); + model_->AddItem(MENU_ID_CUT, GetLabel(IDS_MENU_CUT)); + model_->AddItem(MENU_ID_COPY, GetLabel(IDS_MENU_COPY)); + model_->AddItem(MENU_ID_PASTE, GetLabel(IDS_MENU_PASTE)); + model_->AddItem(MENU_ID_DELETE, GetLabel(IDS_MENU_DELETE)); + + model_->AddSeparator(); + model_->AddItem(MENU_ID_SELECT_ALL, GetLabel(IDS_MENU_SELECT_ALL)); + + if (!(params_.edit_flags & CM_EDITFLAG_CAN_UNDO)) + model_->SetEnabled(MENU_ID_UNDO, false); + if (!(params_.edit_flags & CM_EDITFLAG_CAN_REDO)) + model_->SetEnabled(MENU_ID_REDO, false); + if (!(params_.edit_flags & CM_EDITFLAG_CAN_CUT)) + model_->SetEnabled(MENU_ID_CUT, false); + if (!(params_.edit_flags & CM_EDITFLAG_CAN_COPY)) + model_->SetEnabled(MENU_ID_COPY, false); + if (!(params_.edit_flags & CM_EDITFLAG_CAN_PASTE)) + model_->SetEnabled(MENU_ID_PASTE, false); + if (!(params_.edit_flags & CM_EDITFLAG_CAN_DELETE)) + model_->SetEnabled(MENU_ID_DELETE, false); + if (!(params_.edit_flags & CM_EDITFLAG_CAN_SELECT_ALL)) + model_->SetEnabled(MENU_ID_SELECT_ALL, false); + } else if (!params_.selection_text.empty()) { + // Something is selected. + model_->AddItem(MENU_ID_COPY, GetLabel(IDS_MENU_COPY)); + } else if (!params_.page_url.is_empty() || !params_.frame_url.is_empty()) { + // Page or frame. + model_->AddItem(MENU_ID_BACK, GetLabel(IDS_MENU_BACK)); + model_->AddItem(MENU_ID_FORWARD, GetLabel(IDS_MENU_FORWARD)); + + model_->AddSeparator(); + model_->AddItem(MENU_ID_PRINT, GetLabel(IDS_MENU_PRINT)); + model_->AddItem(MENU_ID_VIEW_SOURCE, GetLabel(IDS_MENU_VIEW_SOURCE)); + + if (!browser_->CanGoBack()) + model_->SetEnabled(MENU_ID_BACK, false); + if (!browser_->CanGoForward()) + model_->SetEnabled(MENU_ID_FORWARD, false); + + // TODO(cef): Enable once printing is supported. + model_->SetEnabled(MENU_ID_PRINT, false); + } +} + +void CefMenuCreator::ExecuteDefaultCommand(int command_id) { + switch (command_id) { + // Navigation. + case MENU_ID_BACK: + browser_->GoBack(); + break; + case MENU_ID_FORWARD: + browser_->GoForward(); + break; + case MENU_ID_RELOAD: + browser_->Reload(); + break; + case MENU_ID_RELOAD_NOCACHE: + browser_->ReloadIgnoreCache(); + break; + case MENU_ID_STOPLOAD: + browser_->StopLoad(); + break; + + // Editing. + case MENU_ID_UNDO: + browser_->GetFocusedFrame()->Undo(); + break; + case MENU_ID_REDO: + browser_->GetFocusedFrame()->Redo(); + break; + case MENU_ID_CUT: + browser_->GetFocusedFrame()->Cut(); + break; + case MENU_ID_COPY: + browser_->GetFocusedFrame()->Copy(); + break; + case MENU_ID_PASTE: + browser_->GetFocusedFrame()->Paste(); + break; + case MENU_ID_DELETE: + browser_->GetFocusedFrame()->Delete(); + break; + case MENU_ID_SELECT_ALL: + browser_->GetFocusedFrame()->SelectAll(); + break; + + // Miscellaneous. + case MENU_ID_FIND: + // TODO(cef): Implement. + NOTIMPLEMENTED(); + break; + case MENU_ID_PRINT: + // TODO(cef): Implement. + NOTIMPLEMENTED(); + break; + case MENU_ID_VIEW_SOURCE: + browser_->GetFocusedFrame()->ViewSource(); + break; + + default: + break; + } +} diff --git a/libcef/browser/menu_creator.h b/libcef/browser/menu_creator.h new file mode 100644 index 000000000..60c3f2ced --- /dev/null +++ b/libcef/browser/menu_creator.h @@ -0,0 +1,63 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_MENU_MANAGER_H_ +#define CEF_LIBCEF_BROWSER_MENU_MANAGER_H_ +#pragma once + +#include "libcef/browser/menu_model_impl.h" + +#include "base/memory/scoped_ptr.h" +#include "content/public/common/context_menu_params.h" + +class CefBrowserHostImpl; + +class CefMenuCreator : public CefMenuModelImpl::Delegate { + public: + // Used for OS-specific menu implementations. + class Runner { + public: + virtual ~Runner() {} + virtual bool RunContextMenu(CefMenuCreator* manager) =0; + }; + + explicit CefMenuCreator(CefBrowserHostImpl* browser); + virtual ~CefMenuCreator(); + + // Returns true if the context menu is currently showing. + bool IsShowingContextMenu(); + + // Create the context menu. + bool CreateContextMenu(const content::ContextMenuParams& params); + + CefBrowserHostImpl* browser() { return browser_; } + ui::MenuModel* model() { return model_->model(); } + const content::ContextMenuParams& params() const { return params_; } + + private: + // Create the menu runner if it doesn't already exist. + bool CreateRunner(); + + // CefMenuModelImpl::Delegate methods. + virtual void ExecuteCommand(CefRefPtr source, + int command_id, + cef_event_flags_t event_flags) OVERRIDE; + virtual void MenuWillShow(CefRefPtr source) OVERRIDE; + virtual void MenuClosed(CefRefPtr source) OVERRIDE; + + // Create the default menu model. + void CreateDefaultModel(); + // Execute the default command handling. + void ExecuteDefaultCommand(int command_id); + + // CefBrowserHostImpl pointer is guaranteed to outlive this object. + CefBrowserHostImpl* browser_; + CefRefPtr model_; + content::ContextMenuParams params_; + scoped_ptr runner_; + + DISALLOW_COPY_AND_ASSIGN(CefMenuCreator); +}; + +#endif // CEF_LIBCEF_BROWSER_MENU_MANAGER_H_ diff --git a/libcef/browser/menu_creator_runner_gtk.cc b/libcef/browser/menu_creator_runner_gtk.cc new file mode 100644 index 000000000..c2f5fe1ca --- /dev/null +++ b/libcef/browser/menu_creator_runner_gtk.cc @@ -0,0 +1,46 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/menu_creator_runner_gtk.h" +#include "libcef/browser/browser_host_impl.h" + +#include "content/public/browser/render_widget_host_view.h" +#include "content/public/browser/web_contents_view.h" +#include "ui/gfx/point.h" + +namespace { + +class CefMenuDelegate : public MenuGtk::Delegate { + public: + CefMenuDelegate() {} +}; + +} // namespace + + +CefMenuCreatorRunnerGtk::CefMenuCreatorRunnerGtk() { +} + +bool CefMenuCreatorRunnerGtk::RunContextMenu(CefMenuCreator* manager) { + if (!menu_delegate_.get()) + menu_delegate_.reset(new CefMenuDelegate); + + // Create a menu based on the model. + menu_.reset(new MenuGtk(menu_delegate_.get(), manager->model())); + + gfx::Rect bounds; + manager->browser()->GetWebContents()->GetView()->GetContainerBounds(&bounds); + gfx::Point point = bounds.origin(); + point.Offset(manager->params().x, manager->params().y); + + content::RenderWidgetHostView* view = + manager->browser()->GetWebContents()->GetRenderWidgetHostView(); + GdkEventButton* event = view->GetLastMouseDown(); + uint32_t triggering_event_time = event ? event->time : GDK_CURRENT_TIME; + + // Show the menu. Execution will continue asynchronously. + menu_->PopupAsContext(point, triggering_event_time); + + return true; +} diff --git a/libcef/browser/menu_creator_runner_gtk.h b/libcef/browser/menu_creator_runner_gtk.h new file mode 100644 index 000000000..d113ef717 --- /dev/null +++ b/libcef/browser/menu_creator_runner_gtk.h @@ -0,0 +1,26 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_MENU_MANAGER_RUNNER_GTK_H_ +#define CEF_LIBCEF_BROWSER_MENU_MANAGER_RUNNER_GTK_H_ +#pragma once + +#include "libcef/browser/menu_creator.h" + +#include "base/memory/scoped_ptr.h" +#include "chrome/browser/ui/gtk/menu_gtk.h" + +class CefMenuCreatorRunnerGtk: public CefMenuCreator::Runner { + public: + CefMenuCreatorRunnerGtk(); + + // CefMemoryManager::Runner methods. + virtual bool RunContextMenu(CefMenuCreator* manager) OVERRIDE; + + private: + scoped_ptr menu_; + scoped_ptr menu_delegate_; +}; + +#endif // CEF_LIBCEF_BROWSER_MENU_MANAGER_RUNNER_GTK_H_ diff --git a/libcef/browser/menu_creator_runner_mac.h b/libcef/browser/menu_creator_runner_mac.h new file mode 100644 index 000000000..d4ccc6d79 --- /dev/null +++ b/libcef/browser/menu_creator_runner_mac.h @@ -0,0 +1,29 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_MENU_MANAGER_RUNNER_MAC_H_ +#define CEF_LIBCEF_BROWSER_MENU_MANAGER_RUNNER_MAC_H_ +#pragma once + +#include "libcef/browser/menu_creator.h" + +#if __OBJC__ +@class MenuController; +#else +class MenuController; +#endif + +class CefMenuCreatorRunnerMac : public CefMenuCreator::Runner { + public: + CefMenuCreatorRunnerMac(); + virtual ~CefMenuCreatorRunnerMac(); + + // CefMemoryManager::Runner methods. + virtual bool RunContextMenu(CefMenuCreator* manager) OVERRIDE; + + private: + MenuController* menu_controller_; +}; + +#endif // CEF_LIBCEF_BROWSER_MENU_MANAGER_RUNNER_MAC_H_ diff --git a/libcef/browser/menu_creator_runner_mac.mm b/libcef/browser/menu_creator_runner_mac.mm new file mode 100644 index 000000000..663b5fd82 --- /dev/null +++ b/libcef/browser/menu_creator_runner_mac.mm @@ -0,0 +1,68 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/menu_creator_runner_mac.h" +#include "libcef/browser/browser_host_impl.h" + +#include "base/message_loop.h" +#include "base/compiler_specific.h" +#import "base/mac/scoped_sending_event.h" +#import "chrome/browser/ui/cocoa/menu_controller.h" +#include "content/public/browser/web_contents_view.h" + +CefMenuCreatorRunnerMac::CefMenuCreatorRunnerMac() + : menu_controller_(nil) { +} + +CefMenuCreatorRunnerMac::~CefMenuCreatorRunnerMac() { + if (menu_controller_ != nil) + [menu_controller_ release]; +} + +bool CefMenuCreatorRunnerMac::RunContextMenu(CefMenuCreator* manager) { + // Create a menu controller based on the model. + if (menu_controller_ != nil) + [menu_controller_ release]; + menu_controller_ = + [[MenuController alloc] initWithModel:manager->model() + useWithPopUpButtonCell:NO]; + + NSView* parent_view = + manager->browser()->GetWebContents()->GetContentNativeView(); + + // Synthesize an event for the click, as there is no certainty that + // [NSApp currentEvent] will return a valid event. + NSEvent* currentEvent = [NSApp currentEvent]; + NSWindow* window = [parent_view window]; + NSPoint position = [window mouseLocationOutsideOfEventStream]; + NSTimeInterval eventTime = [currentEvent timestamp]; + NSEvent* clickEvent = [NSEvent mouseEventWithType:NSRightMouseDown + location:position + modifierFlags:NSRightMouseDownMask + timestamp:eventTime + windowNumber:[window windowNumber] + context:nil + eventNumber:0 + clickCount:1 + pressure:1.0]; + + { + // Make sure events can be pumped while the menu is up. + MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); + + // One of the events that could be pumped is |window.close()|. + // User-initiated event-tracking loops protect against this by + // setting flags in -[CrApplication sendEvent:], but since + // web-content menus are initiated by IPC message the setup has to + // be done manually. + base::mac::ScopedSendingEvent sendingEventScoper; + + // Show the menu. Blocks until the menu is dismissed. + [NSMenu popUpContextMenu:[menu_controller_ menu] + withEvent:clickEvent + forView:parent_view]; + } + + return true; +} diff --git a/libcef/browser/menu_creator_runner_win.cc b/libcef/browser/menu_creator_runner_win.cc new file mode 100644 index 000000000..79b0eb325 --- /dev/null +++ b/libcef/browser/menu_creator_runner_win.cc @@ -0,0 +1,34 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/menu_creator_runner_win.h" +#include "libcef/browser/browser_host_impl.h" + +#include "base/message_loop.h" +#include "content/public/browser/web_contents_view.h" +#include "ui/gfx/point.h" +#include "ui/views/controls/menu/menu_2.h" + +CefMenuCreatorRunnerWin::CefMenuCreatorRunnerWin() { +} + +bool CefMenuCreatorRunnerWin::RunContextMenu(CefMenuCreator* manager) { + // Create a menu based on the model. + menu_.reset(new views::NativeMenuWin(manager->model(), NULL)); + menu_->Rebuild(); + + // Make sure events can be pumped while the menu is up. + MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); + + gfx::Point screen_point(manager->params().x, manager->params().y); + POINT temp = screen_point.ToPOINT(); + HWND hwnd = manager->browser()->GetWebContents()->GetView()->GetNativeView(); + ClientToScreen(hwnd, &temp); + screen_point = temp; + + // Show the menu. Blocks until the menu is dismissed. + menu_->RunMenuAt(screen_point, views::Menu2::ALIGN_TOPLEFT); + + return true; +} diff --git a/libcef/browser/menu_creator_runner_win.h b/libcef/browser/menu_creator_runner_win.h new file mode 100644 index 000000000..c78e953b6 --- /dev/null +++ b/libcef/browser/menu_creator_runner_win.h @@ -0,0 +1,25 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_MENU_MANAGER_RUNNER_WIN_H_ +#define CEF_LIBCEF_BROWSER_MENU_MANAGER_RUNNER_WIN_H_ +#pragma once + +#include "libcef/browser/menu_creator.h" + +#include "base/memory/scoped_ptr.h" +#include "ui/views/controls/menu/native_menu_win.h" + +class CefMenuCreatorRunnerWin : public CefMenuCreator::Runner { + public: + CefMenuCreatorRunnerWin(); + + // CefMemoryManager::Runner methods. + virtual bool RunContextMenu(CefMenuCreator* manager) OVERRIDE; + + private: + scoped_ptr menu_; +}; + +#endif // CEF_LIBCEF_BROWSER_MENU_MANAGER_RUNNER_WIN_H_ diff --git a/libcef/browser/menu_model_impl.cc b/libcef/browser/menu_model_impl.cc new file mode 100644 index 000000000..10065197a --- /dev/null +++ b/libcef/browser/menu_model_impl.cc @@ -0,0 +1,692 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/menu_model_impl.h" + +#include + +#include "base/bind.h" +#include "base/logging.h" +#include "base/message_loop.h" +#include "ui/base/accelerators/accelerator.h" + +namespace { + +const int kSeparatorId = -1; + +// A simple MenuModel implementation that delegates to CefMenuModelImpl. +class CefSimpleMenuModel : public ui::MenuModel { + public: + // The Delegate can be NULL, though if it is items can't be checked or + // disabled. + explicit CefSimpleMenuModel(CefMenuModelImpl* impl) + : impl_(impl), + menu_model_delegate_(NULL) { + } + + virtual ~CefSimpleMenuModel() { + } + + // MenuModel methods. + virtual bool HasIcons() const OVERRIDE { + return false; + } + + virtual int GetItemCount() const OVERRIDE { + return impl_->GetCount(); + } + + virtual ItemType GetTypeAt(int index) const OVERRIDE { + switch (impl_->GetTypeAt(index)) { + case MENUITEMTYPE_COMMAND: + return TYPE_COMMAND; + case MENUITEMTYPE_CHECK: + return TYPE_CHECK; + case MENUITEMTYPE_RADIO: + return TYPE_RADIO; + case MENUITEMTYPE_SEPARATOR: + return TYPE_SEPARATOR; + case MENUITEMTYPE_SUBMENU: + return TYPE_SUBMENU; + default: + NOTREACHED(); + return TYPE_COMMAND; + } + } + + virtual int GetCommandIdAt(int index) const OVERRIDE { + return impl_->GetCommandIdAt(index); + } + + virtual string16 GetLabelAt(int index) const OVERRIDE { + return impl_->GetLabelAt(index).ToString16(); + } + + virtual bool IsItemDynamicAt(int index) const OVERRIDE { + return false; + } + + virtual bool GetAcceleratorAt(int index, + ui::Accelerator* accelerator) const OVERRIDE { + int key_code = 0; + bool shift_pressed = false; + bool ctrl_pressed = false; + bool alt_pressed = false; + if (impl_->GetAcceleratorAt(index, key_code, shift_pressed, ctrl_pressed, + alt_pressed)) { + int modifiers = 0; + if (shift_pressed) + modifiers |= ui::EF_SHIFT_DOWN; + if (ctrl_pressed) + modifiers |= ui::EF_CONTROL_DOWN; + if (alt_pressed) + modifiers |= ui::EF_ALT_DOWN; + + *accelerator = ui::Accelerator(static_cast(key_code), + modifiers); + return true; + } + return false; + } + + virtual bool IsItemCheckedAt(int index) const OVERRIDE { + return impl_->IsCheckedAt(index); + } + + virtual int GetGroupIdAt(int index) const OVERRIDE { + return impl_->GetGroupIdAt(index); + } + + virtual bool GetIconAt(int index, gfx::ImageSkia* icon) OVERRIDE { + return false; + } + + virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( + int index) const OVERRIDE { + return NULL; + } + + virtual bool IsEnabledAt(int index) const OVERRIDE { + return impl_->IsEnabledAt(index); + } + + virtual bool IsVisibleAt(int index) const OVERRIDE { + return impl_->IsVisibleAt(index); + } + + virtual void HighlightChangedTo(int index) OVERRIDE { + } + + virtual void ActivatedAt(int index) OVERRIDE { + ActivatedAt(index, 0); + } + + virtual void ActivatedAt(int index, int event_flags) OVERRIDE { + impl_->ActivatedAt(index, static_cast(event_flags)); + } + + virtual MenuModel* GetSubmenuModelAt(int index) const OVERRIDE { + CefRefPtr submenu = impl_->GetSubMenuAt(index); + if (submenu.get()) + return static_cast(submenu.get())->model(); + return NULL; + } + + virtual void MenuWillShow() OVERRIDE { + impl_->MenuWillShow(); + } + + virtual void MenuClosed() OVERRIDE { + impl_->MenuClosed(); + } + + virtual void SetMenuModelDelegate( + ui::MenuModelDelegate* menu_model_delegate) OVERRIDE { + menu_model_delegate_ = menu_model_delegate; + } + + private: + CefMenuModelImpl* impl_; + ui::MenuModelDelegate* menu_model_delegate_; + + DISALLOW_COPY_AND_ASSIGN(CefSimpleMenuModel); +}; + +} // namespace + + +struct CefMenuModelImpl::Item { + Item(cef_menu_item_type_t type, + int command_id, + const CefString& label, + int group_id) + : type_(type), + command_id_(command_id), + label_(label), + group_id_(group_id), + enabled_(true), + visible_(true), + checked_(false), + has_accelerator_(false), + key_code_(0), + shift_pressed_(false), + ctrl_pressed_(false), + alt_pressed_(false) { + } + + // Basic information. + cef_menu_item_type_t type_; + int command_id_; + CefString label_; + int group_id_; + CefRefPtr submenu_; + + // State information. + bool enabled_; + bool visible_; + bool checked_; + + // Accelerator information. + bool has_accelerator_; + int key_code_; + bool shift_pressed_; + bool ctrl_pressed_; + bool alt_pressed_; +}; + + +CefMenuModelImpl::CefMenuModelImpl(Delegate* delegate) + : supported_thread_id_(base::PlatformThread::CurrentId()), + delegate_(delegate) { + model_.reset(new CefSimpleMenuModel(this)); +} + +CefMenuModelImpl::~CefMenuModelImpl() { +} + +bool CefMenuModelImpl::Clear() { + if (!VerifyContext()) + return false; + + items_.clear(); + return true; +} + +int CefMenuModelImpl::GetCount() { + if (!VerifyContext()) + return 0; + + return static_cast(items_.size()); +} + +bool CefMenuModelImpl::AddSeparator() { + if (!VerifyContext()) + return false; + + AppendItem(Item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1)); + return true; +} + +bool CefMenuModelImpl::AddItem(int command_id, const CefString& label) { + if (!VerifyContext()) + return false; + + AppendItem(Item(MENUITEMTYPE_COMMAND, command_id, label, -1)); + return true; +} + +bool CefMenuModelImpl::AddCheckItem(int command_id, const CefString& label) { + if (!VerifyContext()) + return false; + + AppendItem(Item(MENUITEMTYPE_CHECK, command_id, label, -1)); + return true; +} + +bool CefMenuModelImpl::AddRadioItem(int command_id, const CefString& label, + int group_id) { + if (!VerifyContext()) + return false; + + AppendItem(Item(MENUITEMTYPE_RADIO, command_id, label, group_id)); + return true; +} + +CefRefPtr CefMenuModelImpl::AddSubMenu(int command_id, + const CefString& label) { + if (!VerifyContext()) + return NULL; + + Item item(MENUITEMTYPE_SUBMENU, command_id, label, -1); + item.submenu_ = new CefMenuModelImpl(delegate_); + AppendItem(item); + return item.submenu_.get(); +} + +bool CefMenuModelImpl::InsertSeparatorAt(int index) { + if (!VerifyContext()) + return false; + + InsertItemAt(Item(MENUITEMTYPE_SEPARATOR, kSeparatorId, CefString(), -1), + index); + return true; +} + +bool CefMenuModelImpl::InsertItemAt(int index, int command_id, + const CefString& label) { + if (!VerifyContext()) + return false; + + InsertItemAt(Item(MENUITEMTYPE_COMMAND, command_id, label, -1), index); + return true; +} + +bool CefMenuModelImpl::InsertCheckItemAt(int index, int command_id, + const CefString& label) { + if (!VerifyContext()) + return false; + + InsertItemAt(Item(MENUITEMTYPE_CHECK, command_id, label, -1), index); + return true; +} + +bool CefMenuModelImpl::InsertRadioItemAt(int index, int command_id, + const CefString& label, int group_id) { + if (!VerifyContext()) + return false; + + InsertItemAt(Item(MENUITEMTYPE_RADIO, command_id, label, -1), index); + return true; +} + +CefRefPtr CefMenuModelImpl::InsertSubMenuAt( + int index, int command_id, const CefString& label) { + if (!VerifyContext()) + return NULL; + + Item item(MENUITEMTYPE_SUBMENU, command_id, label, -1); + item.submenu_ = new CefMenuModelImpl(delegate_); + InsertItemAt(item, index); + return item.submenu_.get(); +} + +bool CefMenuModelImpl::Remove(int command_id) { + return RemoveAt(GetIndexOf(command_id)); +} + +bool CefMenuModelImpl::RemoveAt(int index) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) { + items_.erase(items_.begin()+index); + return true; + } + return false; +} + +int CefMenuModelImpl::GetIndexOf(int command_id) { + if (!VerifyContext()) + return -1; + + for (ItemVector::iterator i = items_.begin(); i != items_.end(); ++i) { + if ((*i).command_id_ == command_id) { + return static_cast(std::distance(items_.begin(), i)); + } + } + return -1; +} + +int CefMenuModelImpl::GetCommandIdAt(int index) { + if (!VerifyContext()) + return -1; + + if (index >= 0 && index < static_cast(items_.size())) + return items_[index].command_id_; + return -1; +} + +bool CefMenuModelImpl::SetCommandIdAt(int index, int command_id) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) { + items_[index].command_id_ = command_id; + return true; + } + return false; +} + +CefString CefMenuModelImpl::GetLabel(int command_id) { + return GetLabelAt(GetIndexOf(command_id)); +} + +CefString CefMenuModelImpl::GetLabelAt(int index) { + if (!VerifyContext()) + return CefString(); + + if (index >= 0 && index < static_cast(items_.size())) + return items_[index].label_; + return CefString(); +} + +bool CefMenuModelImpl::SetLabel(int command_id, const CefString& label) { + return SetLabelAt(GetIndexOf(command_id), label); +} + +bool CefMenuModelImpl::SetLabelAt(int index, const CefString& label) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) { + items_[index].label_ = label; + return true; + } + return false; +} + +CefMenuModelImpl::MenuItemType CefMenuModelImpl::GetType(int command_id) { + return GetTypeAt(GetIndexOf(command_id)); +} + +CefMenuModelImpl::MenuItemType CefMenuModelImpl::GetTypeAt(int index) { + if (!VerifyContext()) + return MENUITEMTYPE_NONE; + + if (index >= 0 && index < static_cast(items_.size())) + return items_[index].type_; + return MENUITEMTYPE_NONE; +} + +int CefMenuModelImpl::GetGroupId(int command_id) { + return GetGroupIdAt(GetIndexOf(command_id)); +} + +int CefMenuModelImpl::GetGroupIdAt(int index) { + if (!VerifyContext()) + return -1; + + if (index >= 0 && index < static_cast(items_.size())) + return items_[index].group_id_; + return -1; +} + +bool CefMenuModelImpl::SetGroupId(int command_id, int group_id) { + return SetGroupIdAt(GetIndexOf(command_id), group_id); +} + +bool CefMenuModelImpl::SetGroupIdAt(int index, int group_id) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) { + items_[index].group_id_ = group_id; + return true; + } + return false; +} + +CefRefPtr CefMenuModelImpl::GetSubMenu(int command_id) { + return GetSubMenuAt(GetIndexOf(command_id)); +} + +CefRefPtr CefMenuModelImpl::GetSubMenuAt(int index) { + if (!VerifyContext()) + return NULL; + + if (index >= 0 && index < static_cast(items_.size())) + return items_[index].submenu_.get(); + return NULL; +} + +bool CefMenuModelImpl::IsVisible(int command_id) { + return IsVisibleAt(GetIndexOf(command_id)); +} + +bool CefMenuModelImpl::IsVisibleAt(int index) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) + return items_[index].visible_; + return false; +} + +bool CefMenuModelImpl::SetVisible(int command_id, bool visible) { + return SetVisibleAt(GetIndexOf(command_id), visible); +} + +bool CefMenuModelImpl::SetVisibleAt(int index, bool visible) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) { + items_[index].visible_ = visible; + return true; + } + return false; +} + +bool CefMenuModelImpl::IsEnabled(int command_id) { + return IsEnabledAt(GetIndexOf(command_id)); +} + +bool CefMenuModelImpl::IsEnabledAt(int index) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) + return items_[index].enabled_; + return false; +} + +bool CefMenuModelImpl::SetEnabled(int command_id, bool enabled) { + return SetEnabledAt(GetIndexOf(command_id), enabled); +} + +bool CefMenuModelImpl::SetEnabledAt(int index, bool enabled) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) { + items_[index].enabled_ = enabled; + return true; + } + return false; +} + +bool CefMenuModelImpl::IsChecked(int command_id) { + return IsCheckedAt(GetIndexOf(command_id)); +} + +bool CefMenuModelImpl::IsCheckedAt(int index) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) + return items_[index].checked_; + return false; +} + +bool CefMenuModelImpl::SetChecked(int command_id, bool checked) { + return SetCheckedAt(GetIndexOf(command_id), checked); +} + +bool CefMenuModelImpl::SetCheckedAt(int index, bool checked) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) { + items_[index].checked_ = checked; + return true; + } + return false; +} + +bool CefMenuModelImpl::HasAccelerator(int command_id) { + return HasAcceleratorAt(GetIndexOf(command_id)); +} + +bool CefMenuModelImpl::HasAcceleratorAt(int index) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) + return items_[index].has_accelerator_; + return false; +} + +bool CefMenuModelImpl::SetAccelerator(int command_id, int key_code, + bool shift_pressed, bool ctrl_pressed, + bool alt_pressed) { + return SetAcceleratorAt(GetIndexOf(command_id), key_code, shift_pressed, + ctrl_pressed, alt_pressed); +} + +bool CefMenuModelImpl::SetAcceleratorAt(int index, int key_code, + bool shift_pressed, bool ctrl_pressed, + bool alt_pressed) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) { + Item& item = items_[index]; + item.has_accelerator_ = true; + item.key_code_ = key_code; + item.shift_pressed_ = shift_pressed; + item.ctrl_pressed_ = ctrl_pressed; + item.alt_pressed_ = alt_pressed; + return true; + } + return false; +} + +bool CefMenuModelImpl::RemoveAccelerator(int command_id) { + return RemoveAcceleratorAt(GetIndexOf(command_id)); +} + +bool CefMenuModelImpl::RemoveAcceleratorAt(int index) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) { + Item& item = items_[index]; + if (item.has_accelerator_) { + item.has_accelerator_ = false; + item.key_code_ = 0; + item.shift_pressed_ = false; + item.ctrl_pressed_ = false; + item.alt_pressed_ = false; + } + return true; + } + return false; +} + +bool CefMenuModelImpl::GetAccelerator(int command_id, int& key_code, + bool& shift_pressed, bool& ctrl_pressed, + bool& alt_pressed) { + return GetAcceleratorAt(GetIndexOf(command_id), key_code, shift_pressed, + ctrl_pressed, alt_pressed); +} + +bool CefMenuModelImpl::GetAcceleratorAt(int index, int& key_code, + bool& shift_pressed, bool& ctrl_pressed, + bool& alt_pressed) { + if (!VerifyContext()) + return false; + + if (index >= 0 && index < static_cast(items_.size())) { + const Item& item = items_[index]; + if (item.has_accelerator_) { + key_code = item.key_code_; + shift_pressed = item.shift_pressed_; + ctrl_pressed = item.ctrl_pressed_; + alt_pressed = item.alt_pressed_; + return true; + } + } + return false; +} + +void CefMenuModelImpl::ActivatedAt(int index, cef_event_flags_t event_flags) { + if (VerifyContext() && delegate_) + delegate_->ExecuteCommand(this, GetCommandIdAt(index), event_flags); +} + +void CefMenuModelImpl::MenuWillShow() { + if (VerifyContext() && delegate_) + delegate_->MenuWillShow(this); +} + +void CefMenuModelImpl::MenuClosed() { + if (!VerifyContext()) + return; + + // Due to how menus work on the different platforms, ActivatedAt will be + // called after this. It's more convenient for the delegate to be called + // afterwards, though, so post a task. + MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&CefMenuModelImpl::OnMenuClosed, this)); +} + +bool CefMenuModelImpl::VerifyRefCount() { + if (!VerifyContext()) + return false; + + if (GetRefCt() != 1) + return false; + + for (ItemVector::iterator i = items_.begin(); i != items_.end(); ++i) { + if ((*i).submenu_.get()) { + if (!(*i).submenu_->VerifyRefCount()) + return false; + } + } + + return true; +} + +void CefMenuModelImpl::AppendItem(const Item& item) { + ValidateItem(item); + items_.push_back(item); +} + +void CefMenuModelImpl::InsertItemAt(const Item& item, int index) { + // Sanitize the index. + if (index < 0) + index = 0; + else if (index > static_cast(items_.size())) + index = items_.size(); + + ValidateItem(item); + items_.insert(items_.begin() + index, item); +} + +void CefMenuModelImpl::ValidateItem(const Item& item) { +#ifndef NDEBUG + if (item.type_ == MENUITEMTYPE_SEPARATOR) { + DCHECK_EQ(item.command_id_, kSeparatorId); + } else { + DCHECK_GE(item.command_id_, 0); + } +#endif // NDEBUG +} + +void CefMenuModelImpl::OnMenuClosed() { + if (delegate_) + delegate_->MenuClosed(this); +} + +bool CefMenuModelImpl::VerifyContext() { + if (base::PlatformThread::CurrentId() != supported_thread_id_) { + // This object should only be accessed from the thread that created it. + NOTREACHED(); + return false; + } + + return true; +} diff --git a/libcef/browser/menu_model_impl.h b/libcef/browser/menu_model_impl.h new file mode 100644 index 000000000..102b68d97 --- /dev/null +++ b/libcef/browser/menu_model_impl.h @@ -0,0 +1,140 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_MENU_MODEL_IMPL_H_ +#define CEF_LIBCEF_BROWSER_MENU_MODEL_IMPL_H_ +#pragma once + +#include + +#include "include/cef_menu_model.h" + +#include "base/memory/scoped_ptr.h" +#include "base/threading/platform_thread.h" +#include "ui/base/models/menu_model.h" + +class CefMenuModelImpl : public CefMenuModel { + public: + class Delegate { + public: + // Perform the action associated with the specified |command_id| and + // optional |event_flags|. + virtual void ExecuteCommand(CefRefPtr source, + int command_id, + cef_event_flags_t event_flags) =0; + + // Notifies the delegate that the menu is about to show. + virtual void MenuWillShow(CefRefPtr source) =0; + + // Notifies the delegate that the menu has closed. + virtual void MenuClosed(CefRefPtr source) =0; + + protected: + virtual ~Delegate() {} + }; + + // The delegate must outlive this class. + explicit CefMenuModelImpl(Delegate* delegate); + virtual ~CefMenuModelImpl(); + + // CefMenuModel methods. + virtual bool Clear() OVERRIDE; + virtual int GetCount() OVERRIDE; + virtual bool AddSeparator() OVERRIDE; + virtual bool AddItem(int command_id, const CefString& label) OVERRIDE; + virtual bool AddCheckItem(int command_id, const CefString& label) OVERRIDE; + virtual bool AddRadioItem(int command_id, const CefString& label, + int group_id) OVERRIDE; + virtual CefRefPtr AddSubMenu(int command_id, + const CefString& label) OVERRIDE; + virtual bool InsertSeparatorAt(int index) OVERRIDE; + virtual bool InsertItemAt(int index, int command_id, + const CefString& label) OVERRIDE; + virtual bool InsertCheckItemAt(int index, int command_id, + const CefString& label) OVERRIDE; + virtual bool InsertRadioItemAt(int index, int command_id, + const CefString& label, int group_id) OVERRIDE; + virtual CefRefPtr InsertSubMenuAt(int index, int command_id, + const CefString& label) OVERRIDE; + virtual bool Remove(int command_id) OVERRIDE; + virtual bool RemoveAt(int index) OVERRIDE; + virtual int GetIndexOf(int command_id) OVERRIDE; + virtual int GetCommandIdAt(int index) OVERRIDE; + virtual bool SetCommandIdAt(int index, int command_id) OVERRIDE; + virtual CefString GetLabel(int command_id) OVERRIDE; + virtual CefString GetLabelAt(int index) OVERRIDE; + virtual bool SetLabel(int command_id, const CefString& label) OVERRIDE; + virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE; + virtual MenuItemType GetType(int command_id) OVERRIDE; + virtual MenuItemType GetTypeAt(int index) OVERRIDE; + virtual int GetGroupId(int command_id) OVERRIDE; + virtual int GetGroupIdAt(int index) OVERRIDE; + virtual bool SetGroupId(int command_id, int group_id) OVERRIDE; + virtual bool SetGroupIdAt(int index, int group_id) OVERRIDE; + virtual CefRefPtr GetSubMenu(int command_id) OVERRIDE; + virtual CefRefPtr GetSubMenuAt(int index) OVERRIDE; + virtual bool IsVisible(int command_id) OVERRIDE; + virtual bool IsVisibleAt(int index) OVERRIDE; + virtual bool SetVisible(int command_id, bool visible) OVERRIDE; + virtual bool SetVisibleAt(int index, bool visible) OVERRIDE; + virtual bool IsEnabled(int command_id) OVERRIDE; + virtual bool IsEnabledAt(int index) OVERRIDE; + virtual bool SetEnabled(int command_id, bool enabled) OVERRIDE; + virtual bool SetEnabledAt(int index, bool enabled) OVERRIDE; + virtual bool IsChecked(int command_id) OVERRIDE; + virtual bool IsCheckedAt(int index) OVERRIDE; + virtual bool SetChecked(int command_id, bool checked) OVERRIDE; + virtual bool SetCheckedAt(int index, bool checked) OVERRIDE; + virtual bool HasAccelerator(int command_id) OVERRIDE; + virtual bool HasAcceleratorAt(int index) OVERRIDE; + virtual bool SetAccelerator(int command_id, int key_code, bool shift_pressed, + bool ctrl_pressed, bool alt_pressed) OVERRIDE; + virtual bool SetAcceleratorAt(int index, int key_code, bool shift_pressed, + bool ctrl_pressed, bool alt_pressed) OVERRIDE; + virtual bool RemoveAccelerator(int command_id) OVERRIDE; + virtual bool RemoveAcceleratorAt(int index) OVERRIDE; + virtual bool GetAccelerator(int command_id, int& key_code, + bool& shift_pressed, bool& ctrl_pressed, bool& alt_pressed) OVERRIDE; + virtual bool GetAcceleratorAt(int index, int& key_code, bool& shift_pressed, + bool& ctrl_pressed, bool& alt_pressed) OVERRIDE; + + // Callbacks from the ui::MenuModel implementation. + void ActivatedAt(int index, cef_event_flags_t event_flags); + void MenuWillShow(); + void MenuClosed(); + + // Verify that only a single reference exists to all CefMenuModelImpl objects. + bool VerifyRefCount(); + + ui::MenuModel* model() { return model_.get(); } + Delegate* delegate() { return delegate_; } + void set_delegate(Delegate* delegate) { delegate_ = NULL; } + + private: + struct Item; + + typedef std::vector ItemVector; + + // Functions for inserting items into |items_|. + void AppendItem(const Item& item); + void InsertItemAt(const Item& item, int index); + void ValidateItem(const Item& item); + + // Notify the delegate that the menu is closed. + void OnMenuClosed(); + + // Verify that the object is being accessed from the correct thread. + bool VerifyContext(); + + base::PlatformThreadId supported_thread_id_; + Delegate* delegate_; + ItemVector items_; + scoped_ptr model_; + + IMPLEMENT_REFCOUNTING(CefMenuModelImpl); + DISALLOW_COPY_AND_ASSIGN(CefMenuModelImpl); +}; + +#endif // CEF_LIBCEF_BROWSER_MENU_MODEL_IMPL_H_ diff --git a/libcef/browser/navigate_params.cc b/libcef/browser/navigate_params.cc new file mode 100644 index 000000000..85222a4d1 --- /dev/null +++ b/libcef/browser/navigate_params.cc @@ -0,0 +1,20 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/navigate_params.h" + +CefNavigateParams::CefNavigateParams( + const GURL& a_url, + content::PageTransition a_transition) + : url(a_url), + frame_id(-1), + disposition(CURRENT_TAB), + transition(a_transition), + is_renderer_initiated(false), + user_gesture(true) { +} + +CefNavigateParams::~CefNavigateParams() { +} diff --git a/libcef/browser/navigate_params.h b/libcef/browser/navigate_params.h new file mode 100644 index 000000000..64b3a0d99 --- /dev/null +++ b/libcef/browser/navigate_params.h @@ -0,0 +1,84 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_NAVIGATE_PARAMS_H_ +#define CEF_LIBCEF_BROWSER_NAVIGATE_PARAMS_H_ +#pragma once + +#include + +#include "content/public/browser/global_request_id.h" +#include "content/public/common/page_transition_types.h" +#include "content/public/common/referrer.h" +#include "googleurl/src/gurl.h" +#include "net/base/upload_data.h" +#include "webkit/glue/window_open_disposition.h" + +// Parameters that tell CefBrowserHostImpl::Navigate() what to do. +struct CefNavigateParams { + CefNavigateParams(const GURL& a_url, + content::PageTransition a_transition); + ~CefNavigateParams(); + + // The following parameters are sent to the renderer via CefMsg_LoadRequest. + // --------------------------------------------------------------------------- + + // Request method. + std::string method; + + // The URL/referrer to be loaded. + GURL url; + content::Referrer referrer; + + // The frame that the request should be loaded in or -1 to use the main frame. + int64 frame_id; + + // Usually the URL of the document in the top-level window, which may be + // checked by the third-party cookie blocking policy. Leaving it empty may + // lead to undesired cookie blocking. Third-party cookie blocking can be + // bypassed by setting first_party_for_cookies = url, but this should ideally + // only be done if there really is no way to determine the correct value. + GURL first_party_for_cookies; + + // Additional HTTP request headers. + std::string headers; + + // net::URLRequest load flags (0 by default). + int load_flags; + + // Upload data (may be NULL). + scoped_refptr upload_data; + + + // The following parameters are used to define browser behavior when servicing + // the navigation request. + // --------------------------------------------------------------------------- + + // The disposition requested by the navigation source. Default is CURRENT_TAB. + WindowOpenDisposition disposition; + + // The transition type of the navigation. + content::PageTransition transition; + + // Whether this navigation was initiated by the renderer process. + bool is_renderer_initiated; + + // If non-empty, the new tab contents encoding is overriden by this value. + std::string override_encoding; + + // If false then the navigation was not initiated by a user gesture. Default + // is true. + bool user_gesture; + + // Refers to a navigation that was parked in the browser in order to be + // transferred to another RVH. Only used in case of a redirection of a request + // to a different site that created a new RVH. + content::GlobalRequestID transferred_global_request_id; + + private: + CefNavigateParams(); +}; + +#endif // CEF_LIBCEF_BROWSER_NAVIGATE_PARAMS_H_ diff --git a/libcef/browser/origin_whitelist_impl.cc b/libcef/browser/origin_whitelist_impl.cc new file mode 100644 index 000000000..4fcd2c65d --- /dev/null +++ b/libcef/browser/origin_whitelist_impl.cc @@ -0,0 +1,254 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/browser/origin_whitelist_impl.h" + +#include +#include + +#include "include/cef_origin_whitelist.h" +#include "libcef/browser/context.h" +#include "libcef/browser/thread_util.h" +#include "libcef/common/cef_messages.h" + +#include "base/bind.h" +#include "base/lazy_instance.h" +#include "content/public/browser/render_process_host.h" +#include "googleurl/src/gurl.h" + +namespace { + +// Class that manages cross-origin whitelist registrations. +class CefOriginWhitelistManager { + public: + CefOriginWhitelistManager() {} + + // Retrieve the singleton instance. + static CefOriginWhitelistManager* GetInstance(); + + bool AddOriginEntry(const std::string& source_origin, + const std::string& target_protocol, + const std::string& target_domain, + bool allow_target_subdomains) { + CEF_REQUIRE_UIT(); + + OriginInfo info; + info.source_origin = source_origin; + info.target_protocol = target_protocol; + info.target_domain = target_domain; + info.allow_target_subdomains = allow_target_subdomains; + + // Verify that the origin entry doesn't already exist. + OriginList::const_iterator it = origin_list_.begin(); + for (; it != origin_list_.end(); ++it) { + if (it->Equals(info)) + return false; + } + + origin_list_.push_back(info); + + SendModifyCrossOriginWhitelistEntry(true, source_origin, target_protocol, + target_domain, allow_target_subdomains); + return true; + } + + bool RemoveOriginEntry(const std::string& source_origin, + const std::string& target_protocol, + const std::string& target_domain, + bool allow_target_subdomains) { + CEF_REQUIRE_UIT(); + + OriginInfo info; + info.source_origin = source_origin; + info.target_protocol = target_protocol; + info.target_domain = target_domain; + info.allow_target_subdomains = allow_target_subdomains; + + bool found = false; + + OriginList::iterator it = origin_list_.begin(); + for (; it != origin_list_.end(); ++it) { + if (it->Equals(info)) { + origin_list_.erase(it); + found = true; + break; + } + } + + if (!found) + return false; + + SendModifyCrossOriginWhitelistEntry(false, source_origin, target_protocol, + target_domain, allow_target_subdomains); + return true; + } + + void ClearOrigins() { + CEF_REQUIRE_UIT(); + + origin_list_.clear(); + + SendClearCrossOriginWhitelist(); + } + + // Send all existing cross-origin registrations to the specified host. + void RegisterOriginsWithHost(content::RenderProcessHost* host) { + CEF_REQUIRE_UIT(); + + if (origin_list_.empty()) + return; + + OriginList::const_iterator it = origin_list_.begin(); + for (; it != origin_list_.end(); ++it) { + host->Send( + new CefProcessMsg_ModifyCrossOriginWhitelistEntry( + true, it->source_origin, it->target_protocol, it->target_domain, + it->allow_target_subdomains)); + } + } + + private: + // Send the modify cross-origin whitelist entry message to all currently + // existing hosts. + void SendModifyCrossOriginWhitelistEntry(bool add, + const std::string& source_origin, + const std::string& target_protocol, + const std::string& target_domain, + bool allow_target_subdomains) { + CEF_REQUIRE_UIT(); + + content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); + for (; !i.IsAtEnd(); i.Advance()) { + i.GetCurrentValue()->Send( + new CefProcessMsg_ModifyCrossOriginWhitelistEntry( + add, source_origin, target_protocol, target_domain, + allow_target_subdomains)); + } + } + + // Send the clear cross-origin whitelists message to all currently existing + // hosts. + void SendClearCrossOriginWhitelist() { + CEF_REQUIRE_UIT(); + + content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); + for (; !i.IsAtEnd(); i.Advance()) { + i.GetCurrentValue()->Send(new CefProcessMsg_ClearCrossOriginWhitelist); + } + } + + struct OriginInfo { + std::string source_origin; + std::string target_protocol; + std::string target_domain; + bool allow_target_subdomains; + + bool Equals(const OriginInfo& info) const { + return (source_origin == info.source_origin && + target_protocol == info.target_protocol && + target_domain == info.target_domain && + allow_target_subdomains == info.allow_target_subdomains); + } + }; + + // List of registered origins. + typedef std::list OriginList; + OriginList origin_list_; + + DISALLOW_EVIL_CONSTRUCTORS(CefOriginWhitelistManager); +}; + +base::LazyInstance g_manager = + LAZY_INSTANCE_INITIALIZER; + +CefOriginWhitelistManager* CefOriginWhitelistManager::GetInstance() { + return g_manager.Pointer(); +} + +} // namespace + +bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin, + const CefString& target_protocol, + const CefString& target_domain, + bool allow_target_subdomains) { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED(); + return false; + } + + std::string source_url = source_origin; + GURL gurl = GURL(source_url); + if (gurl.is_empty() || !gurl.is_valid()) { + NOTREACHED() << "Invalid source_origin URL: " << source_url; + return false; + } + + if (CEF_CURRENTLY_ON_UIT()) { + return CefOriginWhitelistManager::GetInstance()->AddOriginEntry( + source_origin, target_protocol, target_domain, allow_target_subdomains); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(base::IgnoreResult(&CefAddCrossOriginWhitelistEntry), + source_origin, target_protocol, target_domain, + allow_target_subdomains)); + } + + return true; +} + +bool CefRemoveCrossOriginWhitelistEntry(const CefString& source_origin, + const CefString& target_protocol, + const CefString& target_domain, + bool allow_target_subdomains) { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED(); + return false; + } + + std::string source_url = source_origin; + GURL gurl = GURL(source_url); + if (gurl.is_empty() || !gurl.is_valid()) { + NOTREACHED() << "Invalid source_origin URL: " << source_url; + return false; + } + + if (CEF_CURRENTLY_ON_UIT()) { + return CefOriginWhitelistManager::GetInstance()->RemoveOriginEntry( + source_origin, target_protocol, target_domain, allow_target_subdomains); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(base::IgnoreResult(&CefRemoveCrossOriginWhitelistEntry), + source_origin, target_protocol, target_domain, + allow_target_subdomains)); + } + + return true; +} + +bool CefClearCrossOriginWhitelist() { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED(); + return false; + } + + if (CEF_CURRENTLY_ON_UIT()) { + CefOriginWhitelistManager::GetInstance()->ClearOrigins(); + } else { + CEF_POST_TASK(CEF_UIT, + base::Bind(base::IgnoreResult(&CefClearCrossOriginWhitelist))); + } + + return true; +} + +void RegisterCrossOriginWhitelistEntriesWithHost( + content::RenderProcessHost* host) { + CEF_REQUIRE_UIT(); + CefOriginWhitelistManager::GetInstance()->RegisterOriginsWithHost(host); +} diff --git a/libcef/browser/origin_whitelist_impl.h b/libcef/browser/origin_whitelist_impl.h new file mode 100644 index 000000000..b48dfc47e --- /dev/null +++ b/libcef/browser/origin_whitelist_impl.h @@ -0,0 +1,17 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_ORIGIN_WHITELIST_IMPL_H_ +#define CEF_LIBCEF_BROWSER_ORIGIN_WHITELIST_IMPL_H_ + +namespace content { +class RenderProcessHost; +} + +// Called when a new RenderProcessHost is created to send existing cross-origin +// whitelist entry information. +void RegisterCrossOriginWhitelistEntriesWithHost( + content::RenderProcessHost* host); + +#endif // CEF_LIBCEF_BROWSER_ORIGIN_WHITELIST_IMPL_H_ diff --git a/libcef/browser/path_util_impl.cc b/libcef/browser/path_util_impl.cc new file mode 100644 index 000000000..f0832ee8d --- /dev/null +++ b/libcef/browser/path_util_impl.cc @@ -0,0 +1,44 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "include/cef_path_util.h" + +#include "base/file_path.h" +#include "base/logging.h" +#include "base/path_service.h" + +bool CefGetPath(PathKey key, CefString& path) { + int pref_key = base::PATH_START; + switch(key) { + case PK_DIR_CURRENT: + pref_key = base::DIR_CURRENT; + break; + case PK_DIR_EXE: + pref_key = base::DIR_EXE; + break; + case PK_DIR_MODULE: + pref_key = base::DIR_MODULE; + break; + case PK_DIR_TEMP: + pref_key = base::DIR_TEMP; + break; + case PK_FILE_EXE: + pref_key = base::FILE_EXE; + break; + case PK_FILE_MODULE: + pref_key = base::FILE_MODULE; + break; + default: + NOTREACHED() << "invalid argument"; + return false; + } + + FilePath file_path; + if (PathService::Get(pref_key, &file_path)) { + path = file_path.value(); + return true; + } + + return false; +} diff --git a/libcef/browser/process_util_impl.cc b/libcef/browser/process_util_impl.cc new file mode 100644 index 000000000..3ddb407c0 --- /dev/null +++ b/libcef/browser/process_util_impl.cc @@ -0,0 +1,31 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "include/cef_process_util.h" +#include "libcef/common/command_line_impl.h" + +#include "base/logging.h" +#include "base/process_util.h" +#include "content/public/browser/browser_thread.h" + +bool CefLaunchProcess(CefRefPtr command_line) { + if (!command_line.get()) { + NOTREACHED() << "invalid parameter"; + return false; + } + + if (!content::BrowserThread::CurrentlyOn( + content::BrowserThread::PROCESS_LAUNCHER)) { + NOTREACHED() << "called on invalid thread"; + return false; + } + + CefCommandLineImpl* impl = + static_cast(command_line.get()); + + CefValueController::AutoLock lock_scope(impl->controller()); + + base::LaunchOptions options; + return base::LaunchProcess(impl->command_line(), options, NULL); +} diff --git a/libcef/browser/resource_context.cc b/libcef/browser/resource_context.cc new file mode 100644 index 000000000..1bf0908d1 --- /dev/null +++ b/libcef/browser/resource_context.cc @@ -0,0 +1,30 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/resource_context.h" +#include "libcef/browser/thread_util.h" +#include "libcef/browser/url_request_context_getter.h" + +CefResourceContext::CefResourceContext( + CefURLRequestContextGetter* getter) + : getter_(getter) { +} + +CefResourceContext::~CefResourceContext() { + // Destroy the getter after content::ResourceContext has finished destructing. + // Otherwise, the URLRequestContext objects will be deleted before + // ResourceDispatcherHost has canceled any pending URLRequests. + content::BrowserThread::ReleaseSoon( + content::BrowserThread::IO, FROM_HERE, getter_.release()); +} + +net::HostResolver* CefResourceContext::GetHostResolver() { + CEF_REQUIRE_IOT(); + return getter_->host_resolver(); +} + +net::URLRequestContext* CefResourceContext::GetRequestContext() { + CEF_REQUIRE_IOT(); + return getter_->GetURLRequestContext(); +} diff --git a/libcef/browser/resource_context.h b/libcef/browser/resource_context.h new file mode 100644 index 000000000..142944955 --- /dev/null +++ b/libcef/browser/resource_context.h @@ -0,0 +1,31 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_RESOURCE_CONTEXT_H_ +#define CEF_LIBCEF_BROWSER_RESOURCE_CONTEXT_H_ +#pragma once + +#include "base/compiler_specific.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" +#include "content/public/browser/resource_context.h" + +class CefURLRequestContextGetter; + +class CefResourceContext : public content::ResourceContext { + public: + explicit CefResourceContext(CefURLRequestContextGetter* getter); + virtual ~CefResourceContext(); + + private: + // ResourceContext methods. + virtual net::HostResolver* GetHostResolver() OVERRIDE; + virtual net::URLRequestContext* GetRequestContext() OVERRIDE; + + scoped_refptr getter_; + + DISALLOW_COPY_AND_ASSIGN(CefResourceContext); +}; + +#endif // CEF_LIBCEF_BROWSER_RESOURCE_CONTEXT_H_ diff --git a/libcef/browser/resource_dispatcher_host_delegate.cc b/libcef/browser/resource_dispatcher_host_delegate.cc new file mode 100644 index 000000000..3b58ae5e6 --- /dev/null +++ b/libcef/browser/resource_dispatcher_host_delegate.cc @@ -0,0 +1,21 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/resource_dispatcher_host_delegate.h" +#include "libcef/browser/browser_host_impl.h" + +CefResourceDispatcherHostDelegate::CefResourceDispatcherHostDelegate() { +} + +CefResourceDispatcherHostDelegate::~CefResourceDispatcherHostDelegate() { +} + +void CefResourceDispatcherHostDelegate::HandleExternalProtocol(const GURL& url, + int child_id, + int route_id) { + CefRefPtr browser = + CefBrowserHostImpl::GetBrowserByRoutingID(child_id, route_id); + if (browser.get()) + browser->HandleExternalProtocol(url); +} diff --git a/libcef/browser/resource_dispatcher_host_delegate.h b/libcef/browser/resource_dispatcher_host_delegate.h new file mode 100644 index 000000000..4bc6edde7 --- /dev/null +++ b/libcef/browser/resource_dispatcher_host_delegate.h @@ -0,0 +1,27 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ +#define CEF_LIBCEF_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ +#pragma once + +#include "content/public/browser/resource_dispatcher_host_delegate.h" + +// Implements ResourceDispatcherHostDelegate. +class CefResourceDispatcherHostDelegate + : public content::ResourceDispatcherHostDelegate { + public: + CefResourceDispatcherHostDelegate(); + virtual ~CefResourceDispatcherHostDelegate(); + + // ResourceDispatcherHostDelegate methods. + virtual void HandleExternalProtocol(const GURL& url, + int child_id, + int route_id) OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(CefResourceDispatcherHostDelegate); +}; + +#endif // CEF_LIBCEF_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ diff --git a/libcef/browser/resource_request_job.cc b/libcef/browser/resource_request_job.cc new file mode 100644 index 000000000..5f75bfbab --- /dev/null +++ b/libcef/browser/resource_request_job.cc @@ -0,0 +1,520 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/resource_request_job.h" + +#include +#include + +#include "include/cef_callback.h" +#include "libcef/browser/cookie_manager_impl.h" +#include "libcef/browser/thread_util.h" +#include "libcef/common/request_impl.h" +#include "libcef/common/response_impl.h" + +#include "base/logging.h" +#include "net/base/io_buffer.h" +#include "net/base/load_flags.h" +#include "net/http/http_response_headers.h" +#include "net/url_request/url_request.h" +#include "net/url_request/url_request_context.h" + +using net::URLRequestStatus; + +// Client callback for asynchronous response continuation. +class CefResourceRequestJobCallback : public CefCallback { + public: + enum Type { + HEADERS_AVAILABLE, + BYTES_AVAILABLE, + }; + + explicit CefResourceRequestJobCallback(CefResourceRequestJob* job, Type type) + : job_(job), + type_(type), + dest_(NULL), + dest_size_(0) {} + + virtual void Continue() OVERRIDE { + if (CEF_CURRENTLY_ON_IOT()) { + // Currently on IO thread. + // Return early if the callback has already been detached. + if (!job_) + return; + + if (type_ == HEADERS_AVAILABLE) { + // Callback for headers available. + if (!job_->has_response_started()) { + // Send header information. + job_->SendHeaders(); + } + + // This type of callback only ever needs to be called once. + Detach(); + } else if (type_ == BYTES_AVAILABLE) { + // Callback for bytes available. + if (job_->has_response_started() && + job_->GetStatus().is_io_pending()) { + // Read the bytes. They should be available but, if not, wait again. + int bytes_read = 0; + if (job_->ReadRawData(dest_, dest_size_, &bytes_read)) { + if (bytes_read > 0) { + // Clear the IO_PENDING status. + job_->SetStatus(URLRequestStatus()); + + // Notify about the available bytes. + job_->NotifyReadComplete(bytes_read); + + dest_ = NULL; + dest_size_ = 0; + } else { + // All done. + job_->NotifyDone(URLRequestStatus()); + Detach(); + } + } else if (!job_->GetStatus().is_io_pending()) { + // Failed due to an error. + NOTREACHED() << + "ReadRawData returned false without setting IO as pending"; + job_->NotifyDone(URLRequestStatus()); + Detach(); + } + } + } + } else { + // Execute this method on the IO thread. + CEF_POST_TASK(CEF_IOT, + base::Bind(&CefResourceRequestJobCallback::Continue, this)); + } + } + + virtual void Cancel() OVERRIDE { + if (CEF_CURRENTLY_ON_IOT()) { + // Currently on IO thread. + if (job_) + job_->Kill(); + } else { + // Execute this method on the IO thread. + CEF_POST_TASK(CEF_IOT, + base::Bind(&CefResourceRequestJobCallback::Cancel, this)); + } + } + + void Detach() { + CEF_REQUIRE_IOT(); + job_ = NULL; + } + + void SetDestination(net::IOBuffer* dest, int dest_size) { + CEF_REQUIRE_IOT(); + dest_ = dest; + dest_size_ = dest_size; + } + + private: + CefResourceRequestJob* job_; + Type type_; + + net::IOBuffer* dest_; + int dest_size_; + + IMPLEMENT_REFCOUNTING(Callback); +}; + +CefResourceRequestJob::CefResourceRequestJob( + net::URLRequest* request, + CefRefPtr handler) + : net::URLRequestJob(request), + handler_(handler), + remaining_bytes_(0), + response_cookies_save_index_(0), + ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { +} + +CefResourceRequestJob::~CefResourceRequestJob() { +} + +void CefResourceRequestJob::Start() { + CEF_REQUIRE_IOT(); + + cef_request_ = CefRequest::Create(); + + // Populate the request data. + static_cast(cef_request_.get())->Set(request_); + + // Add default headers if not already specified. + const net::URLRequestContext* context = request_->context(); + if (context) { + CefRequest::HeaderMap::const_iterator it; + CefRequest::HeaderMap headerMap; + cef_request_->GetHeaderMap(headerMap); + bool changed = false; + + if (!context->accept_language().empty()) { + it = headerMap.find(net::HttpRequestHeaders::kAcceptLanguage); + if (it == headerMap.end()) { + headerMap.insert( + std::make_pair(net::HttpRequestHeaders::kAcceptLanguage, + context->accept_language())); + } + changed = true; + } + + if (!context->accept_charset().empty()) { + it = headerMap.find(net::HttpRequestHeaders::kAcceptCharset); + if (it == headerMap.end()) { + headerMap.insert( + std::make_pair(net::HttpRequestHeaders::kAcceptCharset, + context->accept_charset())); + } + changed = true; + } + + it = headerMap.find(net::HttpRequestHeaders::kUserAgent); + if (it == headerMap.end()) { + headerMap.insert( + std::make_pair(net::HttpRequestHeaders::kUserAgent, + context->GetUserAgent(request_->url()))); + changed = true; + } + + if (changed) + cef_request_->SetHeaderMap(headerMap); + } + + AddCookieHeaderAndStart(); +} + +void CefResourceRequestJob::Kill() { + CEF_REQUIRE_IOT(); + + // Notify the handler that the request has been canceled. + handler_->Cancel(); + + if (callback_) { + callback_->Detach(); + callback_ = NULL; + } + + net::URLRequestJob::Kill(); +} + +bool CefResourceRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size, + int* bytes_read) { + CEF_REQUIRE_IOT(); + + DCHECK_NE(dest_size, 0); + DCHECK(bytes_read); + + if (remaining_bytes_ == 0) { + // No more data to read. + *bytes_read = 0; + return true; + } else if (remaining_bytes_ > 0 && remaining_bytes_ < dest_size) { + // The handler knows the content size beforehand. + dest_size = static_cast(remaining_bytes_); + } + + if (!callback_.get()) { + // Create the bytes available callback that will be used until the request + // is completed. + callback_ = new CefResourceRequestJobCallback(this, + CefResourceRequestJobCallback::BYTES_AVAILABLE); + } + + // Read response data from the handler. + bool rv = handler_->ReadResponse(dest->data(), dest_size, *bytes_read, + callback_.get()); + if (!rv) { + // The handler has indicated completion of the request. + *bytes_read = 0; + return true; + } else if (*bytes_read == 0) { + if (!GetStatus().is_io_pending()) { + // Report our status as IO pending. + SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); + callback_->SetDestination(dest, dest_size); + } + return false; + } else if (*bytes_read > dest_size) { + // Normalize the return value. + *bytes_read = dest_size; + } + + if (remaining_bytes_ > 0) + remaining_bytes_ -= *bytes_read; + + // Continue calling this method. + return true; +} + +void CefResourceRequestJob::GetResponseInfo(net::HttpResponseInfo* info) { + CEF_REQUIRE_IOT(); + + info->headers = GetResponseHeaders(); +} + +bool CefResourceRequestJob::GetResponseCookies( + std::vector* cookies) { + CEF_REQUIRE_IOT(); + + cookies->clear(); + FetchResponseCookies(cookies); + return true; +} + +bool CefResourceRequestJob::IsRedirectResponse(GURL* location, + int* http_status_code) { + CEF_REQUIRE_IOT(); + + if (redirect_url_.is_valid()) { + // Redirect to the new URL. + *http_status_code = 303; + location->Swap(&redirect_url_); + return true; + } + + if (response_.get()) { + // Check for HTTP 302 or HTTP 303 redirect. + int status = response_->GetStatus(); + if (status == 302 || status == 303) { + CefResponse::HeaderMap headerMap; + response_->GetHeaderMap(headerMap); + CefRequest::HeaderMap::iterator iter = headerMap.find("Location"); + if (iter != headerMap.end()) { + GURL new_url = GURL(std::string(iter->second)); + *http_status_code = status; + location->Swap(&new_url); + return true; + } + } + } + + return false; +} + +bool CefResourceRequestJob::GetMimeType(std::string* mime_type) const { + CEF_REQUIRE_IOT(); + + if (response_.get()) + *mime_type = response_->GetMimeType(); + return true; +} + +void CefResourceRequestJob::SendHeaders() { + CEF_REQUIRE_IOT(); + + // Clear the headers available callback. + callback_ = NULL; + + // We may have been orphaned... + if (!request()) + return; + + response_ = new CefResponseImpl(); + remaining_bytes_ = 0; + + CefString redirectUrl; + + // Get header information from the handler. + handler_->GetResponseHeaders(response_, remaining_bytes_, redirectUrl); + if (!redirectUrl.empty()) { + std::string redirectUrlStr = redirectUrl; + redirect_url_ = GURL(redirectUrlStr); + } + + if (remaining_bytes_ > 0) + set_expected_content_size(remaining_bytes_); + + // Continue processing the request. + SaveCookiesAndNotifyHeadersComplete(); +} + +void CefResourceRequestJob::AddCookieHeaderAndStart() { + // No matter what, we want to report our status as IO pending since we will + // be notifying our consumer asynchronously via OnStartCompleted. + SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); + + // If the request was destroyed, then there is no more work to do. + if (!request_) + return; + + net::CookieStore* cookie_store = + request_->context()->cookie_store(); + if (cookie_store && + !(request_->load_flags() & net::LOAD_DO_NOT_SEND_COOKIES)) { + net::CookieMonster* cookie_monster = cookie_store->GetCookieMonster(); + if (cookie_monster) { + cookie_monster->GetAllCookiesForURLAsync( + request_->url(), + base::Bind(&CefResourceRequestJob::CheckCookiePolicyAndLoad, + weak_factory_.GetWeakPtr())); + } else { + DoLoadCookies(); + } + } else { + DoStartTransaction(); + } +} + +void CefResourceRequestJob::DoLoadCookies() { + net::CookieOptions options; + options.set_include_httponly(); + request_->context()->cookie_store()->GetCookiesWithInfoAsync( + request_->url(), options, + base::Bind(&CefResourceRequestJob::OnCookiesLoaded, + weak_factory_.GetWeakPtr())); +} + +void CefResourceRequestJob::CheckCookiePolicyAndLoad( + const net::CookieList& cookie_list) { + bool can_get_cookies = CanGetCookies(cookie_list); + if (can_get_cookies) { + net::CookieList::const_iterator it = cookie_list.begin(); + for (; it != cookie_list.end(); ++it) { + CefCookie cookie; + if (!CefCookieManagerImpl::GetCefCookie(*it, cookie) || + !handler_->CanGetCookie(cookie)) { + can_get_cookies = false; + break; + } + } + } + + if (can_get_cookies) + DoLoadCookies(); + else + DoStartTransaction(); +} + +void CefResourceRequestJob::OnCookiesLoaded( + const std::string& cookie_line, + const std::vector& cookie_infos) { + if (!cookie_line.empty()) { + CefRequest::HeaderMap headerMap; + cef_request_->GetHeaderMap(headerMap); + headerMap.insert( + std::make_pair(net::HttpRequestHeaders::kCookie, cookie_line)); + cef_request_->SetHeaderMap(headerMap); + } + DoStartTransaction(); +} + +void CefResourceRequestJob::DoStartTransaction() { + // We may have been canceled while retrieving cookies. + if (GetStatus().is_success()) { + StartTransaction(); + } else { + NotifyCanceled(); + } +} + +void CefResourceRequestJob::StartTransaction() { + // Create the callback that will be used to notify when header information is + // available. + callback_ = new CefResourceRequestJobCallback(this, + CefResourceRequestJobCallback::HEADERS_AVAILABLE); + + // Protect against deletion of this object. + base::WeakPtr weak_ptr(weak_factory_.GetWeakPtr()); + + // Handler can decide whether to process the request. + bool rv = handler_->ProcessRequest(cef_request_, callback_.get()); + if (weak_ptr.get() && !rv) { + // Cancel the request. + NotifyCanceled(); + } +} + +net::HttpResponseHeaders* CefResourceRequestJob::GetResponseHeaders() { + DCHECK(response_); + if (!response_headers_.get()) { + CefResponseImpl* responseImpl = + static_cast(response_.get()); + response_headers_ = responseImpl->GetResponseHeaders(); + } + return response_headers_; +} + +void CefResourceRequestJob::SaveCookiesAndNotifyHeadersComplete() { + if (request_->load_flags() & net::LOAD_DO_NOT_SAVE_COOKIES) { + SetStatus(URLRequestStatus()); // Clear the IO_PENDING status + NotifyHeadersComplete(); + return; + } + + response_cookies_.clear(); + response_cookies_save_index_ = 0; + + FetchResponseCookies(&response_cookies_); + + // Now, loop over the response cookies, and attempt to persist each. + SaveNextCookie(); +} + +void CefResourceRequestJob::SaveNextCookie() { + if (response_cookies_save_index_ == response_cookies_.size()) { + response_cookies_.clear(); + response_cookies_save_index_ = 0; + SetStatus(URLRequestStatus()); // Clear the IO_PENDING status + NotifyHeadersComplete(); + return; + } + + // No matter what, we want to report our status as IO pending since we will + // be notifying our consumer asynchronously via OnStartCompleted. + SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); + + net::CookieOptions options; + options.set_include_httponly(); + bool can_set_cookie = CanSetCookie( + response_cookies_[response_cookies_save_index_], &options); + if (can_set_cookie) { + CefCookie cookie; + if (CefCookieManagerImpl::GetCefCookie(request_->url(), + response_cookies_[response_cookies_save_index_], cookie)) { + can_set_cookie = handler_->CanSetCookie(cookie); + } else { + can_set_cookie = false; + } + } + + if (can_set_cookie) { + request_->context()->cookie_store()->SetCookieWithOptionsAsync( + request_->url(), response_cookies_[response_cookies_save_index_], + options, base::Bind(&CefResourceRequestJob::OnCookieSaved, + weak_factory_.GetWeakPtr())); + return; + } + + CookieHandled(); +} + +void CefResourceRequestJob::OnCookieSaved(bool cookie_status) { + CookieHandled(); +} + +void CefResourceRequestJob::CookieHandled() { + response_cookies_save_index_++; + // We may have been canceled within OnSetCookie. + if (GetStatus().is_success()) { + SaveNextCookie(); + } else { + NotifyCanceled(); + } +} + +void CefResourceRequestJob::FetchResponseCookies( + std::vector* cookies) { + const std::string name = "Set-Cookie"; + std::string value; + + void* iter = NULL; + net::HttpResponseHeaders* headers = GetResponseHeaders(); + while (headers->EnumerateHeader(&iter, name, &value)) { + if (!value.empty()) + cookies->push_back(value); + } +} diff --git a/libcef/browser/resource_request_job.h b/libcef/browser/resource_request_job.h new file mode 100644 index 000000000..b66115c87 --- /dev/null +++ b/libcef/browser/resource_request_job.h @@ -0,0 +1,79 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_RESOURCE_REQUEST_JOB_H_ +#define CEF_LIBCEF_BROWSER_RESOURCE_REQUEST_JOB_H_ + +#include + +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "include/cef_request_handler.h" + +#include "net/cookies/cookie_monster.h" +#include "net/url_request/url_request_job.h" + +namespace net { +class HttpResponseHeaders; +class URLRequest; +} + +class CefResourceRequestJobCallback; + +class CefResourceRequestJob : public net::URLRequestJob { + public: + CefResourceRequestJob(net::URLRequest* request, + CefRefPtr handler); + virtual ~CefResourceRequestJob(); + + private: + // net::URLRequestJob methods. + virtual void Start() OVERRIDE; + virtual void Kill() OVERRIDE; + virtual bool ReadRawData(net::IOBuffer* dest, int dest_size, int* bytes_read) + OVERRIDE; + virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE; + virtual bool GetResponseCookies(std::vector* cookies) OVERRIDE; + virtual bool IsRedirectResponse(GURL* location, int* http_status_code) + OVERRIDE; + virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; + + void SendHeaders(); + + // Used for sending cookies with the request. + void AddCookieHeaderAndStart(); + void DoLoadCookies(); + void CheckCookiePolicyAndLoad(const net::CookieList& cookie_list); + void OnCookiesLoaded( + const std::string& cookie_line, + const std::vector& cookie_infos); + void DoStartTransaction(); + void StartTransaction(); + + // Used for saving cookies returned as part of the response. + net::HttpResponseHeaders* GetResponseHeaders(); + void SaveCookiesAndNotifyHeadersComplete(); + void SaveNextCookie(); + void OnCookieSaved(bool cookie_status); + void CookieHandled(); + void FetchResponseCookies(std::vector* cookies); + + CefRefPtr handler_; + CefRefPtr response_; + GURL redirect_url_; + int64 remaining_bytes_; + CefRefPtr cef_request_; + CefRefPtr callback_; + scoped_refptr response_headers_; + std::vector response_cookies_; + size_t response_cookies_save_index_; + base::WeakPtrFactory weak_factory_; + + friend class CefResourceRequestJobCallback; + + DISALLOW_COPY_AND_ASSIGN(CefResourceRequestJob); +}; + +#endif // CEF_LIBCEF_BROWSER_RESOURCE_REQUEST_JOB_H_ diff --git a/libcef/browser/scheme_impl.cc b/libcef/browser/scheme_impl.cc new file mode 100644 index 000000000..631be6d2a --- /dev/null +++ b/libcef/browser/scheme_impl.cc @@ -0,0 +1,316 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +#include "include/cef_browser.h" +#include "include/cef_scheme.h" +#include "libcef/browser/browser_context.h" +#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/context.h" +#include "libcef/browser/devtools_scheme_handler.h" +#include "libcef/browser/resource_request_job.h" +#include "libcef/browser/thread_util.h" +#include "libcef/browser/url_request_context_getter.h" +#include "libcef/common/request_impl.h" +#include "libcef/common/response_impl.h" + +#include "base/bind.h" +#include "base/lazy_instance.h" +#include "base/logging.h" +#include "base/message_loop.h" +#include "base/string_util.h" +#include "base/synchronization/lock.h" +#include "googleurl/src/url_util.h" +#include "net/base/completion_callback.h" +#include "net/base/io_buffer.h" +#include "net/base/upload_data.h" +#include "net/http/http_response_headers.h" +#include "net/http/http_util.h" +#include "net/url_request/url_request.h" +#include "net/url_request/url_request_about_job.h" +#include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_data_job.h" +#include "net/url_request/url_request_error_job.h" +#include "net/url_request/url_request_file_job.h" +#include "net/url_request/url_request_filter.h" +#include "net/url_request/url_request_ftp_job.h" +#include "net/url_request/url_request_http_job.h" +#include "net/url_request/url_request_job.h" +#include "net/url_request/url_request_job_factory.h" + +using net::URLRequestStatus; + +namespace { + +bool IsStandardScheme(const std::string& scheme) { + url_parse::Component scheme_comp(0, scheme.length()); + return url_util::IsStandard(scheme.c_str(), scheme_comp); +} + +// Copied from net/url_request/url_request_job_manager.cc. +struct SchemeToFactory { + const char* scheme; + net::URLRequest::ProtocolFactory* factory; +}; +static const SchemeToFactory kBuiltinFactories[] = { + { "http", net::URLRequestHttpJob::Factory }, + { "https", net::URLRequestHttpJob::Factory }, + { "file", net::URLRequestFileJob::Factory }, + { "ftp", net::URLRequestFtpJob::Factory }, + { "about", net::URLRequestAboutJob::Factory }, + { "data", net::URLRequestDataJob::Factory }, +}; + +bool IsBuiltinScheme(const std::string& scheme) { + for (size_t i = 0; i < arraysize(kBuiltinFactories); ++i) + if (LowerCaseEqualsASCII(scheme, kBuiltinFactories[i].scheme)) + return true; + return false; +} + +net::URLRequestJob* GetBuiltinSchemeRequestJob(net::URLRequest* request, + const std::string& scheme) { + // See if the request should be handled by a built-in protocol factory. + for (size_t i = 0; i < arraysize(kBuiltinFactories); ++i) { + if (scheme == kBuiltinFactories[i].scheme) { + net::URLRequestJob* job = (kBuiltinFactories[i].factory)(request, scheme); + DCHECK(job); // The built-in factories are not expected to fail! + return job; + } + } + + return NULL; +} + +std::string ToLower(const std::string& str) { + std::string str_lower = str; + std::transform(str_lower.begin(), str_lower.end(), str_lower.begin(), + towlower); + return str; +} + +// Class that manages the CefSchemeHandlerFactory instances. +class CefUrlRequestManager { + protected: + // Class used for creating URLRequestJob instances. The lifespan of this + // object is managed by URLRequestJobFactory. + class ProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { + public: + explicit ProtocolHandler(const std::string& scheme) + : scheme_(scheme) {} + + // From net::URLRequestJobFactory::ProtocolHandler + virtual net::URLRequestJob* MaybeCreateJob( + net::URLRequest* request) const OVERRIDE { + CEF_REQUIRE_IOT(); + return CefUrlRequestManager::GetInstance()->GetRequestJob(request, + scheme_); + } + + private: + std::string scheme_; + }; + + public: + CefUrlRequestManager() {} + + // Retrieve the singleton instance. + static CefUrlRequestManager* GetInstance(); + + net::URLRequestJobFactory* GetJobFactory() { + return const_cast( + static_cast( + _Context->browser_context()->GetRequestContext())-> + GetURLRequestContext()->job_factory()); + } + + bool AddFactory(const std::string& scheme, + const std::string& domain, + CefRefPtr factory) { + if (!factory.get()) { + RemoveFactory(scheme, domain); + return true; + } + + CEF_REQUIRE_IOT(); + + std::string scheme_lower = ToLower(scheme); + std::string domain_lower = ToLower(domain); + + // Hostname is only supported for standard schemes. + if (!IsStandardScheme(scheme_lower)) + domain_lower.clear(); + + handler_map_[make_pair(scheme_lower, domain_lower)] = factory; + + net::URLRequestJobFactory* job_factory = GetJobFactory(); + job_factory->SetProtocolHandler(scheme_lower, + new ProtocolHandler(scheme_lower)); + + return true; + } + + void RemoveFactory(const std::string& scheme, + const std::string& domain) { + CEF_REQUIRE_IOT(); + + std::string scheme_lower = ToLower(scheme); + std::string domain_lower = ToLower(domain); + + // Hostname is only supported for standard schemes. + if (!IsStandardScheme(scheme_lower)) + domain_lower.clear(); + + HandlerMap::iterator iter = + handler_map_.find(make_pair(scheme_lower, domain_lower)); + if (iter != handler_map_.end()) + handler_map_.erase(iter); + } + + // Clear all the existing URL handlers and unregister the ProtocolFactory. + void ClearFactories() { + CEF_REQUIRE_IOT(); + + net::URLRequestJobFactory* job_factory = GetJobFactory(); + + // Unregister with the ProtocolFactory. + std::set schemes; + for (HandlerMap::const_iterator i = handler_map_.begin(); + i != handler_map_.end(); ++i) { + schemes.insert(i->first.first); + } + for (std::set::const_iterator scheme = schemes.begin(); + scheme != schemes.end(); ++scheme) { + job_factory->SetProtocolHandler(*scheme, NULL); + } + + handler_map_.clear(); + } + + private: + // Retrieve the matching handler factory, if any. |scheme| will already be in + // lower case. + CefRefPtr GetHandlerFactory( + net::URLRequest* request, const std::string& scheme) { + CefRefPtr factory; + + if (request->url().is_valid() && IsStandardScheme(scheme)) { + // Check for a match with a domain first. + const std::string& domain = request->url().host(); + + HandlerMap::iterator i = handler_map_.find(make_pair(scheme, domain)); + if (i != handler_map_.end()) + factory = i->second; + } + + if (!factory.get()) { + // Check for a match with no specified domain. + HandlerMap::iterator i = + handler_map_.find(make_pair(scheme, std::string())); + if (i != handler_map_.end()) + factory = i->second; + } + + return factory; + } + + // Create the job that will handle the request. |scheme| will already be in + // lower case. + net::URLRequestJob* GetRequestJob(net::URLRequest* request, + const std::string& scheme) { + net::URLRequestJob* job = NULL; + CefRefPtr factory = + GetHandlerFactory(request, scheme); + if (factory) { + CefRefPtr browser = + CefBrowserHostImpl::GetBrowserForRequest(request); + CefRefPtr frame; + if (browser.get()) + frame = browser->GetFrameForRequest(request); + + // Populate the request data. + CefRefPtr requestPtr(new CefRequestImpl()); + requestPtr->Set(request); + + // Call the handler factory to create the handler for the request. + CefRefPtr handler = + factory->Create(browser.get(), frame, scheme, requestPtr.get()); + if (handler.get()) + job = new CefResourceRequestJob(request, handler); + } + + if (!job && IsBuiltinScheme(scheme)) { + // Give the built-in scheme handler a chance to handle the request. + job = GetBuiltinSchemeRequestJob(request, scheme); + } + +#ifndef NDEBUG + if (job) + DLOG(INFO) << "CefUrlRequestManager hit for " << request->url().spec(); +#endif + + return job; + } + + // Map (scheme, domain) to factories. This map will only be accessed on the IO + // thread. + typedef std::map, + CefRefPtr > HandlerMap; + HandlerMap handler_map_; + + DISALLOW_EVIL_CONSTRUCTORS(CefUrlRequestManager); +}; + +base::LazyInstance g_manager = LAZY_INSTANCE_INITIALIZER; + +CefUrlRequestManager* CefUrlRequestManager::GetInstance() { + return g_manager.Pointer(); +} + +} // namespace + + +bool CefRegisterSchemeHandlerFactory( + const CefString& scheme_name, + const CefString& domain_name, + CefRefPtr factory) { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED() << "context not valid"; + return false; + } + + if (CEF_CURRENTLY_ON(CEF_IOT)) { + return CefUrlRequestManager::GetInstance()->AddFactory(scheme_name, + domain_name, + factory); + } else { + CEF_POST_TASK(CEF_IOT, + base::Bind(base::IgnoreResult(&CefRegisterSchemeHandlerFactory), + scheme_name, domain_name, factory)); + return true; + } +} + +bool CefClearSchemeHandlerFactories() { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED() << "context not valid"; + return false; + } + + if (CEF_CURRENTLY_ON(CEF_IOT)) { + CefUrlRequestManager::GetInstance()->ClearFactories(); + + // Re-register the DevTools scheme handler. + RegisterDevToolsSchemeHandler(); + } else { + CEF_POST_TASK(CEF_IOT, + base::Bind(base::IgnoreResult(&CefClearSchemeHandlerFactories))); + } + + return true; +} diff --git a/libcef/browser/sqlite_diagnostics_stub.cc b/libcef/browser/sqlite_diagnostics_stub.cc new file mode 100644 index 000000000..128913b69 --- /dev/null +++ b/libcef/browser/sqlite_diagnostics_stub.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "chrome/browser/diagnostics/sqlite_diagnostics.h" + +// Used by SQLitePersistentCookieStore +sql::ErrorDelegate* GetErrorHandlerForCookieDb() { + return NULL; +} diff --git a/libcef/browser/stream_impl.cc b/libcef/browser/stream_impl.cc new file mode 100644 index 000000000..d095d36d1 --- /dev/null +++ b/libcef/browser/stream_impl.cc @@ -0,0 +1,309 @@ +// Copyright (c) 2008 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/browser/stream_impl.h" +#include +#include "base/logging.h" + +// Static functions + +CefRefPtr CefStreamReader::CreateForFile( + const CefString& fileName) { + CefRefPtr reader; + std::string fileNameStr = fileName; + FILE* file = fopen(fileNameStr.c_str(), "rb"); + if (file) + reader = new CefFileReader(file, true); + return reader; +} + +CefRefPtr CefStreamReader::CreateForData(void* data, + size_t size) { + DCHECK(data != NULL); + DCHECK(size > 0); // NOLINT(readability/check) + CefRefPtr reader; + if (data && size > 0) + reader = new CefBytesReader(data, size, true); + return reader; +} + +CefRefPtr CefStreamReader::CreateForHandler( + CefRefPtr handler) { + DCHECK(handler.get()); + CefRefPtr reader; + if (handler.get()) + reader = new CefHandlerReader(handler); + return reader; +} + +CefRefPtr CefStreamWriter::CreateForFile( + const CefString& fileName) { + DCHECK(!fileName.empty()); + CefRefPtr writer; + std::string fileNameStr = fileName; + FILE* file = fopen(fileNameStr.c_str(), "wb"); + if (file) + writer = new CefFileWriter(file, true); + return writer; +} + +CefRefPtr CefStreamWriter::CreateForHandler( + CefRefPtr handler) { + DCHECK(handler.get()); + CefRefPtr writer; + if (handler.get()) + writer = new CefHandlerWriter(handler); + return writer; +} + + +// CefFileReader + +CefFileReader::CefFileReader(FILE* file, bool close) + : close_(close), file_(file) { +} + +CefFileReader::~CefFileReader() { + AutoLock lock_scope(this); + if (close_) + fclose(file_); +} + +size_t CefFileReader::Read(void* ptr, size_t size, size_t n) { + AutoLock lock_scope(this); + return fread(ptr, size, n, file_); +} + +int CefFileReader::Seek(int64 offset, int whence) { + AutoLock lock_scope(this); +#if defined(OS_WIN) + return _fseeki64(file_, offset, whence); +#else + return fseek(file_, offset, whence); +#endif +} + +int64 CefFileReader::Tell() { + AutoLock lock_scope(this); +#if defined(OS_WIN) + return _ftelli64(file_); +#else + return ftell(file_); +#endif +} + +int CefFileReader::Eof() { + AutoLock lock_scope(this); + return feof(file_); +} + + +// CefFileWriter + +CefFileWriter::CefFileWriter(FILE* file, bool close) + : file_(file), + close_(close) { +} + +CefFileWriter::~CefFileWriter() { + AutoLock lock_scope(this); + if (close_) + fclose(file_); +} + +size_t CefFileWriter::Write(const void* ptr, size_t size, size_t n) { + AutoLock lock_scope(this); + return (size_t)fwrite(ptr, size, n, file_); +} + +int CefFileWriter::Seek(int64 offset, int whence) { + AutoLock lock_scope(this); + return fseek(file_, offset, whence); +} + +int64 CefFileWriter::Tell() { + AutoLock lock_scope(this); + return ftell(file_); +} + +int CefFileWriter::Flush() { + AutoLock lock_scope(this); + return fflush(file_); +} + + +// CefBytesReader + +CefBytesReader::CefBytesReader(void* data, int64 datasize, bool copy) + : data_(NULL), + datasize_(0), + copy_(false), + offset_(0) { + SetData(data, datasize, copy); +} + +CefBytesReader::~CefBytesReader() { + SetData(NULL, 0, false); +} + +size_t CefBytesReader::Read(void* ptr, size_t size, size_t n) { + AutoLock lock_scope(this); + size_t s = (datasize_ - offset_) / size; + size_t ret = (n < s ? n : s); + memcpy(ptr, (reinterpret_cast(data_)) + offset_, ret * size); + offset_ += ret * size; + return ret; +} + +int CefBytesReader::Seek(int64 offset, int whence) { + int rv = -1L; + AutoLock lock_scope(this); + switch (whence) { + case SEEK_CUR: + if (offset_ + offset > datasize_ || offset_ + offset < 0) + break; + offset_ += offset; + rv = 0; + break; + case SEEK_END: { + int64 offset_abs = abs(offset); + if (offset_abs > datasize_) + break; + offset_ = datasize_ - offset_abs; + rv = 0; + break; + } + case SEEK_SET: + if (offset > datasize_ || offset < 0) + break; + offset_ = offset; + rv = 0; + break; + } + + return rv; +} + +int64 CefBytesReader::Tell() { + AutoLock lock_scope(this); + return offset_; +} + +int CefBytesReader::Eof() { + AutoLock lock_scope(this); + return (offset_ >= datasize_); +} + +void CefBytesReader::SetData(void* data, int64 datasize, bool copy) { + AutoLock lock_scope(this); + if (copy_) + free(data_); + + copy_ = copy; + offset_ = 0; + datasize_ = datasize; + + if (copy) { + data_ = malloc(datasize); + DCHECK(data_ != NULL); + if (data_) + memcpy(data_, data, datasize); + } else { + data_ = data; + } +} + + +// CefBytesWriter + +CefBytesWriter::CefBytesWriter(size_t grow) + : grow_(grow), + datasize_(grow), + offset_(0) { + DCHECK(grow > 0); // NOLINT(readability/check) + data_ = malloc(grow); + DCHECK(data_ != NULL); +} + +CefBytesWriter::~CefBytesWriter() { + AutoLock lock_scope(this); + if (data_) + free(data_); +} + +size_t CefBytesWriter::Write(const void* ptr, size_t size, size_t n) { + AutoLock lock_scope(this); + size_t rv; + if (offset_ + static_cast(size * n) >= datasize_ && + Grow(size * n) == 0) { + rv = 0; + } else { + memcpy(reinterpret_cast(data_) + offset_, ptr, size * n); + offset_ += size * n; + rv = n; + } + + return rv; +} + +int CefBytesWriter::Seek(int64 offset, int whence) { + int rv = -1L; + AutoLock lock_scope(this); + switch (whence) { + case SEEK_CUR: + if (offset_ + offset > datasize_ || offset_ + offset < 0) + break; + offset_ += offset; + rv = 0; + break; + case SEEK_END: { + int64 offset_abs = abs(offset); + if (offset_abs > datasize_) + break; + offset_ = datasize_ - offset_abs; + rv = 0; + break; + } + case SEEK_SET: + if (offset > datasize_ || offset < 0) + break; + offset_ = offset; + rv = 0; + break; + } + + return rv; +} + +int64 CefBytesWriter::Tell() { + AutoLock lock_scope(this); + return offset_; +} + +int CefBytesWriter::Flush() { + return 0; +} + +std::string CefBytesWriter::GetDataString() { + AutoLock lock_scope(this); + std::string str(reinterpret_cast(data_), offset_); + return str; +} + +size_t CefBytesWriter::Grow(size_t size) { + AutoLock lock_scope(this); + size_t rv; + size_t s = (size > grow_ ? size : grow_); + void* tmp = realloc(data_, datasize_ + s); + DCHECK(tmp != NULL); + if (tmp) { + data_ = tmp; + datasize_ += s; + rv = datasize_; + } else { + rv = 0; + } + + return rv; +} diff --git a/libcef/browser/stream_impl.h b/libcef/browser/stream_impl.h new file mode 100644 index 000000000..0039b9b2f --- /dev/null +++ b/libcef/browser/stream_impl.h @@ -0,0 +1,154 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_STREAM_IMPL_H_ +#define CEF_LIBCEF_BROWSER_STREAM_IMPL_H_ +#pragma once + +#include +#include +#include "include/cef_stream.h" + +// Implementation of CefStreamReader for files. +class CefFileReader : public CefStreamReader { + public: + CefFileReader(FILE* file, bool close); + virtual ~CefFileReader(); + + virtual size_t Read(void* ptr, size_t size, size_t n) OVERRIDE; + virtual int Seek(int64 offset, int whence) OVERRIDE; + virtual int64 Tell() OVERRIDE; + virtual int Eof() OVERRIDE; + + protected: + bool close_; + FILE* file_; + + IMPLEMENT_REFCOUNTING(CefFileReader); + IMPLEMENT_LOCKING(CefFileReader); +}; + +// Implementation of CefStreamWriter for files. +class CefFileWriter : public CefStreamWriter { + public: + CefFileWriter(FILE* file, bool close); + virtual ~CefFileWriter(); + + virtual size_t Write(const void* ptr, size_t size, size_t n) OVERRIDE; + virtual int Seek(int64 offset, int whence) OVERRIDE; + virtual int64 Tell() OVERRIDE; + virtual int Flush() OVERRIDE; + + protected: + FILE* file_; + bool close_; + + IMPLEMENT_REFCOUNTING(CefFileWriter); + IMPLEMENT_LOCKING(CefFileWriter); +}; + +// Implementation of CefStreamReader for byte buffers. +class CefBytesReader : public CefStreamReader { + public: + CefBytesReader(void* data, int64 datasize, bool copy); + virtual ~CefBytesReader(); + + virtual size_t Read(void* ptr, size_t size, size_t n) OVERRIDE; + virtual int Seek(int64 offset, int whence) OVERRIDE; + virtual int64 Tell() OVERRIDE; + virtual int Eof() OVERRIDE; + + void SetData(void* data, int64 datasize, bool copy); + + void* GetData() { return data_; } + size_t GetDataSize() { return offset_; } + + protected: + void* data_; + int64 datasize_; + bool copy_; + int64 offset_; + + IMPLEMENT_REFCOUNTING(CefBytesReader); + IMPLEMENT_LOCKING(CefBytesReader); +}; + +// Implementation of CefStreamWriter for byte buffers. +class CefBytesWriter : public CefStreamWriter { + public: + explicit CefBytesWriter(size_t grow); + virtual ~CefBytesWriter(); + + virtual size_t Write(const void* ptr, size_t size, size_t n) OVERRIDE; + virtual int Seek(int64 offset, int whence) OVERRIDE; + virtual int64 Tell() OVERRIDE; + virtual int Flush() OVERRIDE; + + void* GetData() { return data_; } + int64 GetDataSize() { return offset_; } + std::string GetDataString(); + + protected: + size_t Grow(size_t size); + + size_t grow_; + void* data_; + int64 datasize_; + int64 offset_; + + IMPLEMENT_REFCOUNTING(CefBytesWriter); + IMPLEMENT_LOCKING(CefBytesWriter); +}; + +// Implementation of CefStreamReader for handlers. +class CefHandlerReader : public CefStreamReader { + public: + explicit CefHandlerReader(CefRefPtr handler) + : handler_(handler) {} + + virtual size_t Read(void* ptr, size_t size, size_t n) OVERRIDE { + return handler_->Read(ptr, size, n); + } + virtual int Seek(int64 offset, int whence) OVERRIDE { + return handler_->Seek(offset, whence); + } + virtual int64 Tell() OVERRIDE { + return handler_->Tell(); + } + virtual int Eof() OVERRIDE { + return handler_->Eof(); + } + + protected: + CefRefPtr handler_; + + IMPLEMENT_REFCOUNTING(CefHandlerReader); +}; + +// Implementation of CefStreamWriter for handlers. +class CefHandlerWriter : public CefStreamWriter { + public: + explicit CefHandlerWriter(CefRefPtr handler) + : handler_(handler) {} + + virtual size_t Write(const void* ptr, size_t size, size_t n) OVERRIDE { + return handler_->Write(ptr, size, n); + } + virtual int Seek(int64 offset, int whence) OVERRIDE { + return handler_->Seek(offset, whence); + } + virtual int64 Tell() OVERRIDE { + return handler_->Tell(); + } + virtual int Flush() OVERRIDE { + return handler_->Flush(); + } + + protected: + CefRefPtr handler_; + + IMPLEMENT_REFCOUNTING(CefHandlerWriter); +}; + +#endif // CEF_LIBCEF_BROWSER_STREAM_IMPL_H_ diff --git a/libcef/browser/thread_util.h b/libcef/browser/thread_util.h new file mode 100644 index 000000000..b9286e9e5 --- /dev/null +++ b/libcef/browser/thread_util.h @@ -0,0 +1,48 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_THREAD_UTIL_H_ +#define CEF_LIBCEF_BROWSER_THREAD_UTIL_H_ +#pragma once + +#include "base/location.h" +#include "base/logging.h" +#include "content/public/browser/browser_thread.h" + +#define CEF_UIT content::BrowserThread::UI +#define CEF_IOT content::BrowserThread::IO +#define CEF_FILET content::BrowserThread::FILE + +#define CEF_CURRENTLY_ON(id) content::BrowserThread::CurrentlyOn(id) +#define CEF_CURRENTLY_ON_UIT() CEF_CURRENTLY_ON(CEF_UIT) +#define CEF_CURRENTLY_ON_IOT() CEF_CURRENTLY_ON(CEF_IOT) +#define CEF_CURRENTLY_ON_FILET() CEF_CURRENTLY_ON(CEF_FILET) + +#define CEF_REQUIRE(id) DCHECK(CEF_CURRENTLY_ON(id)) +#define CEF_REQUIRE_UIT() CEF_REQUIRE(CEF_UIT) +#define CEF_REQUIRE_IOT() CEF_REQUIRE(CEF_IOT) +#define CEF_REQUIRE_FILET() CEF_REQUIRE(CEF_FILET) + +#define CEF_REQUIRE_RETURN(id, var) \ + if (!CEF_CURRENTLY_ON(id)) { \ + NOTREACHED() << "called on invalid thread"; \ + return var; \ + } +#define CEF_REQUIRE_UIT_RETURN(var) CEF_REQUIRE_RETURN(CEF_UIT, var) +#define CEF_REQUIRE_IOT_RETURN(var) CEF_REQUIRE_RETURN(CEF_IOT, var) + +#define CEF_REQUIRE_RETURN_VOID(id) \ + if (!CEF_CURRENTLY_ON(id)) { \ + NOTREACHED() << "called on invalid thread"; \ + return; \ + } +#define CEF_REQUIRE_UIT_RETURN_VOID() CEF_REQUIRE_RETURN_VOID(CEF_UIT) +#define CEF_REQUIRE_IOT_RETURN_VOID() CEF_REQUIRE_RETURN_VOID(CEF_IOT) + +#define CEF_POST_TASK(id, task) \ + content::BrowserThread::PostTask(id, FROM_HERE, task) +#define CEF_POST_DELAYED_TASK(id, task, delay_ms) \ + content::BrowserThread::PostDelayedTask(id, FROM_HERE, task, delay_ms) + +#endif // CEF_LIBCEF_BROWSER_THREAD_UTIL_H_ diff --git a/libcef/browser/url_network_delegate.cc b/libcef/browser/url_network_delegate.cc new file mode 100644 index 000000000..30c6caced --- /dev/null +++ b/libcef/browser/url_network_delegate.cc @@ -0,0 +1,224 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/url_network_delegate.h" + +#include + +#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/thread_util.h" +#include "libcef/common/request_impl.h" + +#include "net/base/net_errors.h" +#include "net/url_request/url_request.h" + +namespace { + +class CefAuthCallbackImpl : public CefAuthCallback { + public: + CefAuthCallbackImpl(const net::NetworkDelegate::AuthCallback& callback, + net::AuthCredentials* credentials) + : callback_(callback), + credentials_(credentials) { + } + ~CefAuthCallbackImpl() { + if (!callback_.is_null()) { + // The auth callback is still pending. Cancel it now. + if (CEF_CURRENTLY_ON_IOT()) { + CancelNow(callback_); + } else { + CEF_POST_TASK(CEF_IOT, + base::Bind(&CefAuthCallbackImpl::CancelNow, callback_)); + } + } + } + + virtual void Continue(const CefString& username, + const CefString& password) OVERRIDE { + if (CEF_CURRENTLY_ON_IOT()) { + if (!callback_.is_null()) { + credentials_->Set(username, password); + callback_.Run(net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_SET_AUTH); + callback_.Reset(); + } + } else { + CEF_POST_TASK(CEF_IOT, + base::Bind(&CefAuthCallbackImpl::Continue, this, username, password)); + } + } + + virtual void Cancel() OVERRIDE { + if (CEF_CURRENTLY_ON_IOT()) { + if (!callback_.is_null()) { + CancelNow(callback_); + callback_.Reset(); + } + } else { + CEF_POST_TASK(CEF_IOT, base::Bind(&CefAuthCallbackImpl::Cancel, this)); + } + } + + void Disconnect() { + callback_.Reset(); + } + + private: + static void CancelNow(const net::NetworkDelegate::AuthCallback& callback) { + CEF_REQUIRE_IOT(); + callback.Run(net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION); + } + + net::NetworkDelegate::AuthCallback callback_; + net::AuthCredentials* credentials_; + + IMPLEMENT_REFCOUNTING(CefAuthCallbackImpl); +}; + +} // namespace + +CefNetworkDelegate::CefNetworkDelegate() { +} + +CefNetworkDelegate::~CefNetworkDelegate() { +} + +int CefNetworkDelegate::OnBeforeURLRequest( + net::URLRequest* request, + const net::CompletionCallback& callback, + GURL* new_url) { + CefRefPtr browser = + CefBrowserHostImpl::GetBrowserForRequest(request); + if (browser.get()) { + CefRefPtr client = browser->GetClient(); + if (client.get()) { + CefRefPtr handler = client->GetRequestHandler(); + if (handler.get()) { + CefRefPtr frame = browser->GetFrameForRequest(request); + + GURL old_url = request->url(); + + // Populate the request data. + CefRefPtr requestPtr(new CefRequestImpl()); + requestPtr->Set(request); + + // Give the client an opportunity to cancel the request. + if (handler->OnBeforeResourceLoad(browser.get(), frame, + requestPtr.get())) { + return net::ERR_ABORTED; + } + + GURL url = GURL(std::string(requestPtr->GetURL())); + if (old_url != url) + new_url ->Swap(&url); + + requestPtr->Get(request); + } + } + } + + return net::OK; +} + +int CefNetworkDelegate::OnBeforeSendHeaders( + net::URLRequest* request, + const net::CompletionCallback& callback, + net::HttpRequestHeaders* headers) { + return net::OK; +} + +void CefNetworkDelegate::OnSendHeaders( + net::URLRequest* request, + const net::HttpRequestHeaders& headers) { +} + +int CefNetworkDelegate::OnHeadersReceived( + net::URLRequest* request, + const net::CompletionCallback& callback, + net::HttpResponseHeaders* original_response_headers, + scoped_refptr* override_response_headers) { + return net::OK; +} + +void CefNetworkDelegate::OnBeforeRedirect(net::URLRequest* request, + const GURL& new_location) { +} + +void CefNetworkDelegate::OnResponseStarted(net::URLRequest* request) { +} + +void CefNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, + int bytes_read) { +} + +void CefNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) { +} + +void CefNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) { +} + +void CefNetworkDelegate::OnPACScriptError(int line_number, + const string16& error) { +} + +net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired( + net::URLRequest* request, + const net::AuthChallengeInfo& auth_info, + const AuthCallback& callback, + net::AuthCredentials* credentials) { + CefRefPtr browser = + CefBrowserHostImpl::GetBrowserForRequest(request); + if (browser.get()) { + CefRefPtr client = browser->GetClient(); + if (client.get()) { + CefRefPtr handler = client->GetRequestHandler(); + if (handler.get()) { + CefRefPtr frame = browser->GetFrameForRequest(request); + + CefRefPtr callbackPtr( + new CefAuthCallbackImpl(callback, credentials)); + if (handler->GetAuthCredentials(browser.get(), + frame, + auth_info.is_proxy, + auth_info.challenger.host(), + auth_info.challenger.port(), + auth_info.realm, + auth_info.scheme, + callbackPtr.get())) { + return AUTH_REQUIRED_RESPONSE_IO_PENDING; + } else { + callbackPtr->Disconnect(); + } + } + } + } + + return AUTH_REQUIRED_RESPONSE_NO_ACTION; +} + +bool CefNetworkDelegate::OnCanGetCookies(const net::URLRequest& request, + const net::CookieList& cookie_list) { + return true; +} + +bool CefNetworkDelegate::OnCanSetCookie(const net::URLRequest& request, + const std::string& cookie_line, + net::CookieOptions* options) { + return true; +} + +bool CefNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, + const FilePath& path) const { + return true; +} + +bool CefNetworkDelegate::OnCanThrottleRequest( + const net::URLRequest& request) const { + return false; +} + +int CefNetworkDelegate::OnBeforeSocketStreamConnect( + net::SocketStream* socket, + const net::CompletionCallback& callback) { + return net::OK; +} diff --git a/libcef/browser/url_network_delegate.h b/libcef/browser/url_network_delegate.h new file mode 100644 index 000000000..5ac5a0e24 --- /dev/null +++ b/libcef/browser/url_network_delegate.h @@ -0,0 +1,64 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_URL_NETWORK_DELEGATE_H_ +#define CEF_LIBCEF_BROWSER_URL_NETWORK_DELEGATE_H_ +#pragma once + +#include "net/base/network_delegate.h" + +// Used for intercepting resource requests, redirects and responses. The single +// instance of this class is managed by CefURLRequestContextGetter. +class CefNetworkDelegate : public net::NetworkDelegate { + public: + CefNetworkDelegate(); + ~CefNetworkDelegate(); + + private: + // net::NetworkDelegate methods. + virtual int OnBeforeURLRequest(net::URLRequest* request, + const net::CompletionCallback& callback, + GURL* new_url) OVERRIDE; + virtual int OnBeforeSendHeaders(net::URLRequest* request, + const net::CompletionCallback& callback, + net::HttpRequestHeaders* headers) OVERRIDE; + virtual void OnSendHeaders(net::URLRequest* request, + const net::HttpRequestHeaders& headers) OVERRIDE; + virtual int OnHeadersReceived( + net::URLRequest* request, + const net::CompletionCallback& callback, + net::HttpResponseHeaders* original_response_headers, + scoped_refptr* override_response_headers) + OVERRIDE; + virtual void OnBeforeRedirect(net::URLRequest* request, + const GURL& new_location) OVERRIDE; + virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; + virtual void OnRawBytesRead(const net::URLRequest& request, int bytes_read) + OVERRIDE; + virtual void OnCompleted(net::URLRequest* request, bool started) OVERRIDE; + virtual void OnURLRequestDestroyed(net::URLRequest* request) OVERRIDE; + virtual void OnPACScriptError(int line_number, const string16& error) + OVERRIDE; + virtual AuthRequiredResponse OnAuthRequired( + net::URLRequest* request, + const net::AuthChallengeInfo& auth_info, + const AuthCallback& callback, + net::AuthCredentials* credentials) OVERRIDE; + virtual bool OnCanGetCookies(const net::URLRequest& request, + const net::CookieList& cookie_list) OVERRIDE; + virtual bool OnCanSetCookie(const net::URLRequest& request, + const std::string& cookie_line, + net::CookieOptions* options) OVERRIDE; + virtual bool OnCanAccessFile(const net::URLRequest& request, + const FilePath& path) const OVERRIDE; + virtual bool OnCanThrottleRequest( + const net::URLRequest& request) const OVERRIDE; + virtual int OnBeforeSocketStreamConnect( + net::SocketStream* stream, + const net::CompletionCallback& callback) OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(CefNetworkDelegate); +}; + +#endif // CEF_LIBCEF_BROWSER_URL_NETWORK_DELEGATE_H_ diff --git a/libcef/browser/url_request_context_getter.cc b/libcef/browser/url_request_context_getter.cc new file mode 100644 index 000000000..7d48032ce --- /dev/null +++ b/libcef/browser/url_request_context_getter.cc @@ -0,0 +1,411 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/url_request_context_getter.h" + +#if defined(OS_WIN) +#include +#endif +#include +#include + +#include "libcef/browser/context.h" +#include "libcef/browser/thread_util.h" +#include "libcef/browser/url_network_delegate.h" +#include "libcef/browser/url_request_context_proxy.h" +#include "libcef/browser/url_request_interceptor.h" + +#include "base/file_util.h" +#include "base/logging.h" +#include "base/stl_util.h" +#include "base/string_split.h" +#include "base/threading/thread_restrictions.h" +#include "base/threading/worker_pool.h" +#include "chrome/browser/net/sqlite_persistent_cookie_store.h" +#include "content/public/browser/browser_thread.h" +#include "net/base/cert_verifier.h" +#include "net/base/default_server_bound_cert_store.h" +#include "net/base/host_resolver.h" +#include "net/base/server_bound_cert_service.h" +#include "net/base/ssl_config_service_defaults.h" +#include "net/cookies/cookie_monster.h" +#include "net/ftp/ftp_network_layer.h" +#include "net/http/http_auth_handler_factory.h" +#include "net/http/http_cache.h" +#include "net/http/http_server_properties_impl.h" +#include "net/proxy/proxy_config_service.h" +#include "net/proxy/proxy_config_service_fixed.h" +#include "net/proxy/proxy_resolver.h" +#include "net/proxy/proxy_service.h" +#include "net/url_request/url_request.h" +#include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_context_storage.h" +#include "net/url_request/url_request_job_factory.h" +#include "net/url_request/url_request_job_manager.h" + +using content::BrowserThread; + +#if defined(OS_WIN) +#pragma comment(lib, "winhttp.lib") +#endif + +namespace { + +#if defined(OS_WIN) + +// ProxyConfigService implementation that does nothing. +class ProxyConfigServiceNull : public net::ProxyConfigService { + public: + ProxyConfigServiceNull() {} + virtual void AddObserver(Observer* observer) OVERRIDE {} + virtual void RemoveObserver(Observer* observer) OVERRIDE {} + virtual ProxyConfigService::ConfigAvailability + GetLatestProxyConfig(net::ProxyConfig* config) OVERRIDE { + return ProxyConfigService::CONFIG_VALID; + } + virtual void OnLazyPoll() OVERRIDE {} + + DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceNull); +}; + +#endif // defined(OS_WIN) + +// ProxyResolver implementation that forewards resolution to a CefProxyHandler. +class CefProxyResolver : public net::ProxyResolver { + public: + explicit CefProxyResolver(CefRefPtr handler) + : ProxyResolver(false), + handler_(handler) {} + virtual ~CefProxyResolver() {} + + virtual int GetProxyForURL(const GURL& url, + net::ProxyInfo* results, + const net::CompletionCallback& callback, + RequestHandle* request, + const net::BoundNetLog& net_log) OVERRIDE { + CefProxyInfo proxy_info; + handler_->GetProxyForUrl(url.spec(), proxy_info); + if (proxy_info.IsDirect()) + results->UseDirect(); + else if (proxy_info.IsNamedProxy()) + results->UseNamedProxy(proxy_info.ProxyList()); + else if (proxy_info.IsPacString()) + results->UsePacString(proxy_info.ProxyList()); + + return net::OK; + } + + virtual int SetPacScript( + const scoped_refptr& pac_script, + const net::CompletionCallback& callback) OVERRIDE { + return net::OK; + } + + virtual void CancelRequest(RequestHandle request) OVERRIDE {} + virtual net::LoadState GetLoadState(RequestHandle request) const OVERRIDE { + return net::LOAD_STATE_IDLE; + } + virtual net::LoadState GetLoadStateThreadSafe(RequestHandle request) const + OVERRIDE { + return net::LOAD_STATE_IDLE; + } + virtual void CancelSetPacScript() OVERRIDE {} + + protected: + CefRefPtr handler_; + + DISALLOW_COPY_AND_ASSIGN(CefProxyResolver); +}; + +} // namespace + +CefURLRequestContextGetter::CefURLRequestContextGetter( + const FilePath& base_path, + MessageLoop* io_loop, + MessageLoop* file_loop) + : base_path_(base_path), + io_loop_(io_loop), + file_loop_(file_loop) { + // Must first be created on the UI thread. + CEF_REQUIRE_UIT(); + +#if !defined(OS_WIN) + // We must create the proxy config service on the UI loop on Linux because it + // must synchronously run on the glib message loop. This will be passed to + // the URLRequestContextStorage on the IO thread in GetURLRequestContext(). + CreateProxyConfigService(); +#endif +} + +CefURLRequestContextGetter::~CefURLRequestContextGetter() { + STLDeleteElements(&url_request_context_proxies_); +} + +net::URLRequestContext* CefURLRequestContextGetter::GetURLRequestContext() { + CEF_REQUIRE_IOT(); + + if (!url_request_context_.get()) { + const FilePath& cache_path = _Context->cache_path(); + + url_request_context_.reset(new net::URLRequestContext()); + storage_.reset( + new net::URLRequestContextStorage(url_request_context_.get())); + + SetCookieStoragePath(cache_path); + + storage_->set_network_delegate(new CefNetworkDelegate); + + storage_->set_server_bound_cert_service(new net::ServerBoundCertService( + new net::DefaultServerBoundCertStore(NULL), + base::WorkerPool::GetTaskRunner(true))); + url_request_context_->set_accept_language("en-us,en"); + url_request_context_->set_accept_charset("iso-8859-1,*,utf-8"); + + storage_->set_host_resolver( + net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, + net::HostResolver::kDefaultRetryAttempts, + NULL)); + storage_->set_cert_verifier(net::CertVerifier::CreateDefault()); + + bool proxy_service_set = false; + + CefRefPtr app = _Context->application(); + if (app.get()) { + CefRefPtr handler = + app->GetBrowserProcessHandler(); + if (handler.get()) { + CefRefPtr proxy_handler = handler->GetProxyHandler(); + if (proxy_handler.get()) { + // The client will provide proxy resolution. + CreateProxyConfigService(); + storage_->set_proxy_service( + new net::ProxyService(proxy_config_service_.release(), + new CefProxyResolver(proxy_handler), NULL)); + proxy_service_set = true; + } + } + } + + // TODO(jam): use v8 if possible, look at chrome code. +#if defined(OS_WIN) + if (!proxy_service_set) { + const CefSettings& settings = _Context->settings(); + if (!settings.auto_detect_proxy_settings_enabled) { + // Using the system proxy resolver on Windows when "Automatically detect + // settings" (auto-detection) is checked under LAN Settings can hurt + // resource loading performance because the call to + // WinHttpGetProxyForUrl in proxy_resolver_winhttp.cc will block the + // IO thread. This is especially true for Windows 7 where auto- + // detection is checked by default. To avoid slow resource loading on + // Windows we only use the system proxy resolver if auto-detection is + // unchecked. + WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config = {0}; + if (WinHttpGetIEProxyConfigForCurrentUser(&ie_config)) { + if (ie_config.fAutoDetect == TRUE) { + storage_->set_proxy_service( + net::ProxyService::CreateWithoutProxyResolver( + new ProxyConfigServiceNull(), NULL)); + proxy_service_set = true; + } + + if (ie_config.lpszAutoConfigUrl) + GlobalFree(ie_config.lpszAutoConfigUrl); + if (ie_config.lpszProxy) + GlobalFree(ie_config.lpszProxy); + if (ie_config.lpszProxyBypass) + GlobalFree(ie_config.lpszProxyBypass); + } + } + } +#endif // defined(OS_WIN) + + if (!proxy_service_set) { + CreateProxyConfigService(); + storage_->set_proxy_service( + net::ProxyService::CreateUsingSystemProxyResolver( + proxy_config_service_.release(), 0, NULL)); + } + + storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults); + + // Add support for single sign-on. + url_security_manager_.reset(net::URLSecurityManager::Create(NULL, NULL)); + + std::vector supported_schemes; + supported_schemes.push_back("basic"); + supported_schemes.push_back("digest"); + supported_schemes.push_back("ntlm"); + supported_schemes.push_back("negotiate"); + + storage_->set_http_auth_handler_factory( + net::HttpAuthHandlerRegistryFactory::Create( + supported_schemes, + url_security_manager_.get(), + url_request_context_->host_resolver(), + std::string(), + false, + false)); + storage_->set_http_server_properties(new net::HttpServerPropertiesImpl); + + net::HttpCache::DefaultBackend* main_backend = + new net::HttpCache::DefaultBackend( + cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE, + cache_path, + 0, + BrowserThread::GetMessageLoopProxyForThread( + BrowserThread::CACHE)); + + net::HttpCache* main_cache = new net::HttpCache( + url_request_context_->host_resolver(), + url_request_context_->cert_verifier(), + url_request_context_->server_bound_cert_service(), + NULL, /* tranport_security_state */ + url_request_context_->proxy_service(), + "", /* ssl_session_cache_shard */ + url_request_context_->ssl_config_service(), + url_request_context_->http_auth_handler_factory(), + NULL, /* network_delegate */ + url_request_context_->http_server_properties(), + NULL, + main_backend, + "" /* trusted_spdy_proxy */); + storage_->set_http_transaction_factory(main_cache); + + storage_->set_ftp_transaction_factory( + new net::FtpNetworkLayer(url_request_context_->host_resolver())); + + storage_->set_job_factory(new net::URLRequestJobFactory); + + request_interceptor_.reset(new CefRequestInterceptor); + } + + return url_request_context_.get(); +} + +scoped_refptr + CefURLRequestContextGetter::GetNetworkTaskRunner() const { + return BrowserThread::GetMessageLoopProxyForThread(CEF_IOT); +} + +net::HostResolver* CefURLRequestContextGetter::host_resolver() { + return url_request_context_->host_resolver(); +} + +void CefURLRequestContextGetter::SetCookieStoragePath(const FilePath& path) { + CEF_REQUIRE_IOT(); + + if (url_request_context_->cookie_store() && + ((cookie_store_path_.empty() && path.empty()) || + cookie_store_path_ == path)) { + // The path has not changed so don't do anything. + return; + } + + scoped_refptr persistent_store; + if (!path.empty()) { + // TODO(cef): Move directory creation to the blocking pool instead of + // allowing file IO on this thread. + base::ThreadRestrictions::ScopedAllowIO allow_io; + if (file_util::DirectoryExists(path) || + file_util::CreateDirectory(path)) { + const FilePath& cookie_path = path.AppendASCII("Cookies"); + persistent_store = + new SQLitePersistentCookieStore(cookie_path, false, NULL); + } else { + NOTREACHED() << "The cookie storage directory could not be created"; + } + } + + // Set the new cookie store that will be used for all new requests. The old + // cookie store, if any, will be automatically flushed and closed when no + // longer referenced. + storage_->set_cookie_store( + new net::CookieMonster(persistent_store.get(), NULL)); + cookie_store_path_ = path; + + // Restore the previously supported schemes. + SetCookieSupportedSchemes(cookie_supported_schemes_); +} + +void CefURLRequestContextGetter::SetCookieSupportedSchemes( + const std::vector& schemes) { + CEF_REQUIRE_IOT(); + + cookie_supported_schemes_ = schemes; + + if (cookie_supported_schemes_.empty()) { + cookie_supported_schemes_.push_back("http"); + cookie_supported_schemes_.push_back("https"); + } + + std::set scheme_set; + std::vector::const_iterator it = + cookie_supported_schemes_.begin(); + for (; it != cookie_supported_schemes_.end(); ++it) + scheme_set.insert(*it); + + const char** arr = new const char*[scheme_set.size()]; + std::set::const_iterator it2 = scheme_set.begin(); + for (int i = 0; it2 != scheme_set.end(); ++it2, ++i) + arr[i] = it2->c_str(); + + url_request_context_->cookie_store()->GetCookieMonster()-> + SetCookieableSchemes(arr, scheme_set.size()); + + delete [] arr; +} + +CefURLRequestContextProxy* + CefURLRequestContextGetter::CreateURLRequestContextProxy() { + CEF_REQUIRE_IOT(); + CefURLRequestContextProxy* proxy = new CefURLRequestContextProxy(this); + url_request_context_proxies_.insert(proxy); + return proxy; +} + +void CefURLRequestContextGetter::ReleaseURLRequestContextProxy( + CefURLRequestContextProxy* proxy) { + CEF_REQUIRE_IOT(); + + // Don't do anything if we're currently shutting down. The proxy objects will + // be deleted when this object is destroyed. + if (_Context->shutting_down()) + return; + + if (proxy->url_requests()->size() == 0) { + // Safe to delete the proxy. + RequestContextProxySet::iterator it = + url_request_context_proxies_.find(proxy); + DCHECK(it != url_request_context_proxies_.end()); + url_request_context_proxies_.erase(it); + delete proxy; + } else { + proxy->increment_delete_try_count(); + if (proxy->delete_try_count() <= 1) { + // Cancel the pending requests. This may result in additional tasks being + // posted on the IO thread. + std::set::iterator it = + proxy->url_requests()->begin(); + for (; it != proxy->url_requests()->end(); ++it) + const_cast(*it)->Cancel(); + + // Try to delete the proxy again later. + CEF_POST_TASK(CEF_IOT, + base::Bind(&CefURLRequestContextGetter::ReleaseURLRequestContextProxy, + this, proxy)); + } else { + NOTREACHED() << + "too many retries to delete URLRequestContext proxy object"; + } + } +} + +void CefURLRequestContextGetter::CreateProxyConfigService() { + if (proxy_config_service_.get()) + return; + + proxy_config_service_.reset( + net::ProxyService::CreateSystemProxyConfigService( + io_loop_->message_loop_proxy(), file_loop_)); +} diff --git a/libcef/browser/url_request_context_getter.h b/libcef/browser/url_request_context_getter.h new file mode 100644 index 000000000..659b0d1f8 --- /dev/null +++ b/libcef/browser/url_request_context_getter.h @@ -0,0 +1,77 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_URL_REQUEST_CONTEXT_GETTER_H_ +#define CEF_LIBCEF_BROWSER_URL_REQUEST_CONTEXT_GETTER_H_ +#pragma once + +#include +#include +#include + +#include "base/compiler_specific.h" +#include "base/file_path.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" +#include "net/url_request/url_request_context_getter.h" + +class CefRequestInterceptor; +class CefURLRequestContextProxy; +class MessageLoop; + +namespace net { +class HostResolver; +class ProxyConfigService; +class URLRequestContextStorage; +class URLRequestJobFactory; +class URLSecurityManager; +} + +class CefURLRequestContextGetter : public net::URLRequestContextGetter { + public: + CefURLRequestContextGetter( + const FilePath& base_path_, + MessageLoop* io_loop, + MessageLoop* file_loop); + virtual ~CefURLRequestContextGetter(); + + // net::URLRequestContextGetter implementation. + virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; + virtual scoped_refptr + GetNetworkTaskRunner() const OVERRIDE; + + net::HostResolver* host_resolver(); + + void SetCookieStoragePath(const FilePath& path); + void SetCookieSupportedSchemes(const std::vector& schemes); + + // Manage URLRequestContext proxy objects. It's important that proxy objects + // not be destroyed while any in-flight URLRequests exist. These methods + // manage that requirement. + CefURLRequestContextProxy* CreateURLRequestContextProxy(); + void ReleaseURLRequestContextProxy(CefURLRequestContextProxy* proxy); + + private: + void CreateProxyConfigService(); + + FilePath base_path_; + MessageLoop* io_loop_; + MessageLoop* file_loop_; + + scoped_ptr proxy_config_service_; + scoped_ptr request_interceptor_; + scoped_ptr storage_; + scoped_ptr url_request_context_; + scoped_ptr url_security_manager_; + + typedef std::set RequestContextProxySet; + RequestContextProxySet url_request_context_proxies_; + + FilePath cookie_store_path_; + std::vector cookie_supported_schemes_; + + DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetter); +}; + +#endif // CEF_LIBCEF_BROWSER_URL_REQUEST_CONTEXT_GETTER_H_ diff --git a/libcef/browser/url_request_context_getter_proxy.cc b/libcef/browser/url_request_context_getter_proxy.cc new file mode 100644 index 000000000..4284ffaf8 --- /dev/null +++ b/libcef/browser/url_request_context_getter_proxy.cc @@ -0,0 +1,153 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/url_request_context_getter_proxy.h" + +#include + +#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/cookie_manager_impl.h" +#include "libcef/browser/thread_util.h" +#include "libcef/browser/url_request_context_getter.h" +#include "libcef/browser/url_request_context_proxy.h" + +#include "base/logging.h" +#include "base/message_loop_proxy.h" +#include "net/cookies/cookie_store.h" +#include "net/url_request/url_request_context.h" + +namespace { + +class CefCookieStoreProxy : public net::CookieStore { + public: + explicit CefCookieStoreProxy(CefBrowserHostImpl* browser, + net::URLRequestContext* parent) + : parent_(parent), + browser_(browser) { + } + + // net::CookieStore methods. + virtual void SetCookieWithOptionsAsync( + const GURL& url, + const std::string& cookie_line, + const net::CookieOptions& options, + const SetCookiesCallback& callback) OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + cookie_store->SetCookieWithOptionsAsync(url, cookie_line, options, + callback); + } + + virtual void GetCookiesWithOptionsAsync( + const GURL& url, const net::CookieOptions& options, + const GetCookiesCallback& callback) OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + cookie_store->GetCookiesWithOptionsAsync(url, options, callback); + } + + void GetCookiesWithInfoAsync( + const GURL& url, + const net::CookieOptions& options, + const GetCookieInfoCallback& callback) OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + cookie_store->GetCookiesWithInfoAsync(url, options, callback); + } + + virtual void DeleteCookieAsync(const GURL& url, + const std::string& cookie_name, + const base::Closure& callback) OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + cookie_store->DeleteCookieAsync(url, cookie_name, callback); + } + + virtual void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin, + const base::Time& delete_end, + const DeleteCallback& callback) + OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + cookie_store->DeleteAllCreatedBetweenAsync(delete_begin, delete_end, + callback); + } + + virtual void DeleteSessionCookiesAsync(const DeleteCallback& callback) + OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + cookie_store->DeleteSessionCookiesAsync(callback); + } + + virtual net::CookieMonster* GetCookieMonster() OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + return cookie_store->GetCookieMonster(); + } + + private: + net::CookieStore* GetCookieStore() { + CEF_REQUIRE_IOT(); + + scoped_refptr cookie_store; + + CefRefPtr client = browser_->GetClient(); + if (client.get()) { + CefRefPtr handler = client->GetRequestHandler(); + if (handler.get()) { + // Get the manager from the handler. + CefRefPtr manager = + handler->GetCookieManager(browser_, + browser_->GetLoadingURL().spec()); + if (manager.get()) { + cookie_store = + reinterpret_cast( + manager.get())->cookie_monster(); + DCHECK(cookie_store); + } + } + } + + if (!cookie_store) { + // Use the global cookie store. + cookie_store = parent_->cookie_store(); + } + + DCHECK(cookie_store); + return cookie_store; + } + + // This pointer is guaranteed by the CefRequestContextProxy object. + net::URLRequestContext* parent_; + CefBrowserHostImpl* browser_; + + DISALLOW_COPY_AND_ASSIGN(CefCookieStoreProxy); +}; + +} // namespace + + +CefURLRequestContextGetterProxy::CefURLRequestContextGetterProxy( + CefBrowserHostImpl* browser, + CefURLRequestContextGetter* parent) + : browser_(browser), + parent_(parent), + context_proxy_(NULL) { + DCHECK(browser); + DCHECK(parent); +} + +CefURLRequestContextGetterProxy::~CefURLRequestContextGetterProxy() { + if (context_proxy_) + parent_->ReleaseURLRequestContextProxy(context_proxy_); +} + +net::URLRequestContext* + CefURLRequestContextGetterProxy::GetURLRequestContext() { + CEF_REQUIRE_IOT(); + if (!context_proxy_) { + context_proxy_ = parent_->CreateURLRequestContextProxy(); + context_proxy_->Initialize(browser_); + } + return context_proxy_; +} + +scoped_refptr + CefURLRequestContextGetterProxy::GetNetworkTaskRunner() const { + return parent_->GetNetworkTaskRunner(); +} diff --git a/libcef/browser/url_request_context_getter_proxy.h b/libcef/browser/url_request_context_getter_proxy.h new file mode 100644 index 000000000..ec6555145 --- /dev/null +++ b/libcef/browser/url_request_context_getter_proxy.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_URL_REQUEST_CONTEXT_GETTER_PROXY_H_ +#define CEF_LIBCEF_BROWSER_URL_REQUEST_CONTEXT_GETTER_PROXY_H_ +#pragma once + +#include "base/memory/scoped_ptr.h" +#include "net/url_request/url_request_context_getter.h" + +class CefBrowserHostImpl; +class CefURLRequestContextGetter; +class CefURLRequestContextProxy; + +class CefURLRequestContextGetterProxy : public net::URLRequestContextGetter { + public: + CefURLRequestContextGetterProxy(CefBrowserHostImpl* browser, + CefURLRequestContextGetter* parent); + virtual ~CefURLRequestContextGetterProxy(); + + // net::URLRequestContextGetter implementation. + virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; + virtual scoped_refptr + GetNetworkTaskRunner() const OVERRIDE; + + private: + CefBrowserHostImpl* browser_; + scoped_refptr parent_; + + // The |context_proxy_| object is owned by |parent_|. + CefURLRequestContextProxy* context_proxy_; + + DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetterProxy); +}; + +#endif // CEF_LIBCEF_BROWSER_URL_REQUEST_CONTEXT_GETTER_PROXY_H_ diff --git a/libcef/browser/url_request_context_proxy.cc b/libcef/browser/url_request_context_proxy.cc new file mode 100644 index 000000000..c2fa68093 --- /dev/null +++ b/libcef/browser/url_request_context_proxy.cc @@ -0,0 +1,164 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/url_request_context_proxy.h" + +#include + +#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/cookie_manager_impl.h" +#include "libcef/browser/thread_util.h" + +#include "base/logging.h" +#include "base/message_loop_proxy.h" +#include "net/cookies/cookie_store.h" +#include "net/url_request/url_request_context_getter.h" + +namespace { + +class CefCookieStoreProxy : public net::CookieStore { + public: + explicit CefCookieStoreProxy(CefBrowserHostImpl* browser, + net::URLRequestContext* parent) + : parent_(parent), + browser_(browser) { + } + + // net::CookieStore methods. + virtual void SetCookieWithOptionsAsync( + const GURL& url, + const std::string& cookie_line, + const net::CookieOptions& options, + const SetCookiesCallback& callback) OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + cookie_store->SetCookieWithOptionsAsync(url, cookie_line, options, + callback); + } + + virtual void GetCookiesWithOptionsAsync( + const GURL& url, const net::CookieOptions& options, + const GetCookiesCallback& callback) OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + cookie_store->GetCookiesWithOptionsAsync(url, options, callback); + } + + void GetCookiesWithInfoAsync( + const GURL& url, + const net::CookieOptions& options, + const GetCookieInfoCallback& callback) OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + cookie_store->GetCookiesWithInfoAsync(url, options, callback); + } + + virtual void DeleteCookieAsync(const GURL& url, + const std::string& cookie_name, + const base::Closure& callback) OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + cookie_store->DeleteCookieAsync(url, cookie_name, callback); + } + + virtual void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin, + const base::Time& delete_end, + const DeleteCallback& callback) + OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + cookie_store->DeleteAllCreatedBetweenAsync(delete_begin, delete_end, + callback); + } + + virtual void DeleteSessionCookiesAsync(const DeleteCallback& callback) + OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + cookie_store->DeleteSessionCookiesAsync(callback); + } + + virtual net::CookieMonster* GetCookieMonster() OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + return cookie_store->GetCookieMonster(); + } + + private: + net::CookieStore* GetCookieStore() { + CEF_REQUIRE_IOT(); + + scoped_refptr cookie_store; + + CefRefPtr client = browser_->GetClient(); + if (client.get()) { + CefRefPtr handler = client->GetRequestHandler(); + if (handler.get()) { + // Get the manager from the handler. + CefRefPtr manager = + handler->GetCookieManager(browser_, + browser_->GetLoadingURL().spec()); + if (manager.get()) { + cookie_store = + reinterpret_cast( + manager.get())->cookie_monster(); + DCHECK(cookie_store); + } + } + } + + if (!cookie_store) { + // Use the global cookie store. + cookie_store = parent_->cookie_store(); + } + + DCHECK(cookie_store); + return cookie_store; + } + + // This pointer is guaranteed by the CefRequestContextProxy object. + net::URLRequestContext* parent_; + CefBrowserHostImpl* browser_; + + DISALLOW_COPY_AND_ASSIGN(CefCookieStoreProxy); +}; + +} // namespace + + +CefURLRequestContextProxy::CefURLRequestContextProxy( + net::URLRequestContextGetter* parent) + : parent_(parent), + delete_try_count_(0) { +} + +CefURLRequestContextProxy::~CefURLRequestContextProxy() { +} + +const std::string& CefURLRequestContextProxy::GetUserAgent(const GURL& url) const { + return parent_->GetURLRequestContext()->GetUserAgent(url); +} + +void CefURLRequestContextProxy::Initialize(CefBrowserHostImpl* browser) { + CEF_REQUIRE_IOT(); + + net::URLRequestContext* context = parent_->GetURLRequestContext(); + + // Cookie store that proxies to the browser implementation. + cookie_store_proxy_ = new CefCookieStoreProxy(browser, context); + set_cookie_store(cookie_store_proxy_); + + // All other values refer to the parent request context. + set_net_log(context->net_log()); + set_host_resolver(context->host_resolver()); + set_cert_verifier(context->cert_verifier()); + set_server_bound_cert_service(context->server_bound_cert_service()); + set_fraudulent_certificate_reporter( + context->fraudulent_certificate_reporter()); + set_proxy_service(context->proxy_service()); + set_ssl_config_service(context->ssl_config_service()); + set_http_auth_handler_factory(context->http_auth_handler_factory()); + set_http_transaction_factory(context->http_transaction_factory()); + set_ftp_transaction_factory(context->ftp_transaction_factory()); + set_network_delegate(context->network_delegate()); + set_http_server_properties(context->http_server_properties()); + set_transport_security_state(context->transport_security_state()); + set_accept_charset(context->accept_charset()); + set_accept_language(context->accept_language()); + set_referrer_charset(context->referrer_charset()); + set_job_factory(context->job_factory()); +} diff --git a/libcef/browser/url_request_context_proxy.h b/libcef/browser/url_request_context_proxy.h new file mode 100644 index 000000000..bde5fc21a --- /dev/null +++ b/libcef/browser/url_request_context_proxy.h @@ -0,0 +1,43 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_URL_REQUEST_CONTEXT_PROXY_H_ +#define CEF_LIBCEF_BROWSER_URL_REQUEST_CONTEXT_PROXY_H_ +#pragma once + +#include "base/memory/scoped_ptr.h" +#include "net/url_request/url_request_context.h" + +class CefBrowserHostImpl; + +namespace net { +class CookieStore; +class URLRequestContextGetter; +} + +class CefURLRequestContextProxy : public net::URLRequestContext { + public: + explicit CefURLRequestContextProxy(net::URLRequestContextGetter* parent); + virtual ~CefURLRequestContextProxy(); + + virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE; + + void Initialize(CefBrowserHostImpl* browser); + + // We may try to delete this proxy multiple times if URLRequests are still + // pending. Keep track of the number of tries so that they don't become + // excessive. + int delete_try_count() const { return delete_try_count_; } + void increment_delete_try_count() { delete_try_count_++; } + + private: + net::URLRequestContextGetter* parent_; + scoped_refptr cookie_store_proxy_; + + int delete_try_count_; + + DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextProxy); +}; + +#endif // CEF_LIBCEF_BROWSER_URL_REQUEST_CONTEXT_PROXY_H_ diff --git a/libcef/browser/url_request_interceptor.cc b/libcef/browser/url_request_interceptor.cc new file mode 100644 index 000000000..fdf32bf81 --- /dev/null +++ b/libcef/browser/url_request_interceptor.cc @@ -0,0 +1,85 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/url_request_interceptor.h" + +#include + +#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/resource_request_job.h" +#include "libcef/browser/thread_util.h" +#include "libcef/common/request_impl.h" + +#include "net/url_request/url_request_job_manager.h" +#include "net/url_request/url_request_redirect_job.h" + +CefRequestInterceptor::CefRequestInterceptor() { + CEF_REQUIRE_IOT(); + net::URLRequestJobManager::GetInstance()->RegisterRequestInterceptor(this); +} + +CefRequestInterceptor::~CefRequestInterceptor() { + CEF_REQUIRE_IOT(); + net::URLRequestJobManager::GetInstance()-> + UnregisterRequestInterceptor(this); +} + +net::URLRequestJob* CefRequestInterceptor::MaybeIntercept( + net::URLRequest* request) { + CefRefPtr browser = + CefBrowserHostImpl::GetBrowserForRequest(request); + if (browser.get()) { + CefRefPtr client = browser->GetClient(); + if (client.get()) { + CefRefPtr handler = client->GetRequestHandler(); + if (handler.get()) { + CefRefPtr frame = browser->GetFrameForRequest(request); + + // Populate the request data. + CefRefPtr req(CefRequest::Create()); + static_cast(req.get())->Set(request); + + // Give the client an opportunity to replace the request. + CefRefPtr resourceHandler = + handler->GetResourceHandler(browser.get(), frame, req); + if (resourceHandler.get()) + return new CefResourceRequestJob(request, resourceHandler); + } + } + } + + return NULL; +} + +net::URLRequestJob* CefRequestInterceptor::MaybeInterceptRedirect( + net::URLRequest* request, const GURL& location) { + CefRefPtr browser = + CefBrowserHostImpl::GetBrowserForRequest(request); + if (browser.get()) { + CefRefPtr client = browser->GetClient(); + if (client.get()) { + CefRefPtr handler = client->GetRequestHandler(); + if (handler.get()) { + CefRefPtr frame = browser->GetFrameForRequest(request); + + // Give the client an opportunity to redirect the request. + CefString newUrlStr = location.spec(); + handler->OnResourceRedirect(browser.get(), frame, request->url().spec(), + newUrlStr); + if (newUrlStr != location.spec()) { + GURL new_url = GURL(std::string(newUrlStr)); + if (!new_url.is_empty() && new_url.is_valid()) + return new net::URLRequestRedirectJob(request, new_url); + } + } + } + } + + return NULL; +} + +net::URLRequestJob* CefRequestInterceptor::MaybeInterceptResponse( + net::URLRequest* request) { + return NULL; +} diff --git a/libcef/browser/url_request_interceptor.h b/libcef/browser/url_request_interceptor.h new file mode 100644 index 000000000..d8f82a4ec --- /dev/null +++ b/libcef/browser/url_request_interceptor.h @@ -0,0 +1,29 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_URL_REQUEST_INTERCEPTOR_H_ +#define CEF_LIBCEF_BROWSER_URL_REQUEST_INTERCEPTOR_H_ +#pragma once + +#include "net/url_request/url_request.h" + +// Used for intercepting resource requests, redirects and responses. The single +// instance of this class is managed by CefURLRequestContextGetter. +class CefRequestInterceptor : public net::URLRequest::Interceptor { + public: + CefRequestInterceptor(); + ~CefRequestInterceptor(); + + // net::URLRequest::Interceptor methods. + virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) + OVERRIDE; + virtual net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request, + const GURL& location) OVERRIDE; + virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request) + OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(CefRequestInterceptor); +}; + +#endif // CEF_LIBCEF_BROWSER_URL_REQUEST_INTERCEPTOR_H_ diff --git a/libcef/browser/web_plugin_impl.cc b/libcef/browser/web_plugin_impl.cc new file mode 100644 index 000000000..b3f5f35df --- /dev/null +++ b/libcef/browser/web_plugin_impl.cc @@ -0,0 +1,75 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "include/cef_web_plugin.h" +#include "libcef/browser/context.h" +#include "libcef/browser/thread_util.h" + +#include "base/bind.h" +#include "base/file_path.h" +#include "content/browser/plugin_service_impl.h" + +namespace { + +class CefWebPluginInfoImpl : public CefWebPluginInfo { + public: + explicit CefWebPluginInfoImpl(const webkit::WebPluginInfo& plugin_info) + : plugin_info_(plugin_info) { + } + + virtual CefString GetName() OVERRIDE { + return plugin_info_.name; + } + + virtual CefString GetPath() OVERRIDE { + return plugin_info_.path.value(); + } + + virtual CefString GetVersion() OVERRIDE { + return plugin_info_.version; + } + + virtual CefString GetDescription() OVERRIDE { + return plugin_info_.desc; + } + + private: + webkit::WebPluginInfo plugin_info_; + + IMPLEMENT_REFCOUNTING(CefWebPluginInfoImpl); +}; + +void PluginsCallbackImpl( + CefRefPtr visitor, + const std::vector& all_plugins) { + CEF_REQUIRE_UIT(); + + int count = 0; + int total = static_cast(all_plugins.size()); + + std::vector::const_iterator it = all_plugins.begin(); + for (; it != all_plugins.end(); ++it, ++count) { + CefRefPtr info(new CefWebPluginInfoImpl(*it)); + if (!visitor->Visit(info.get(), count, total)) + break; + } +} + +} // namespace + +void CefVisitWebPluginInfo(CefRefPtr visitor) { + // Verify that the context is in a valid state. + if (!CONTEXT_STATE_VALID()) { + NOTREACHED() << "context not valid"; + return; + } + + if (CEF_CURRENTLY_ON_UIT()) { + PluginServiceImpl::GetInstance()->GetPlugins( + base::Bind(PluginsCallbackImpl, visitor)); + } else { + // Execute on the UI thread. + CEF_POST_TASK(CEF_UIT, base::Bind(CefVisitWebPluginInfo, visitor)); + } +} diff --git a/libcef/browser/xml_reader_impl.cc b/libcef/browser/xml_reader_impl.cc new file mode 100644 index 000000000..b66ea6326 --- /dev/null +++ b/libcef/browser/xml_reader_impl.cc @@ -0,0 +1,446 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/browser/xml_reader_impl.h" +#include "include/cef_stream.h" +#include "base/logging.h" + +// Static functions + +// static +CefRefPtr CefXmlReader::Create(CefRefPtr stream, + EncodingType encodingType, + const CefString& URI) { + CefRefPtr impl(new CefXmlReaderImpl()); + if (!impl->Initialize(stream, encodingType, URI)) + return NULL; + return impl.get(); +} + + +// CefXmlReaderImpl + +namespace { + +/** + * xmlInputReadCallback: + * @context: an Input context + * @buffer: the buffer to store data read + * @len: the length of the buffer in bytes + * + * Callback used in the I/O Input API to read the resource + * + * Returns the number of bytes read or -1 in case of error + */ +int XMLCALL xml_read_callback(void * context, char * buffer, int len) { + CefRefPtr reader(static_cast(context)); + return reader->Read(buffer, 1, len); +} + +/** + * xmlTextReaderErrorFunc: + * @arg: the user argument + * @msg: the message + * @severity: the severity of the error + * @locator: a locator indicating where the error occured + * + * Signature of an error callback from a reader parser + */ +void XMLCALL xml_error_callback(void *arg, const char *msg, + xmlParserSeverities severity, + xmlTextReaderLocatorPtr locator) { + if (!msg) + return; + + std::string error_str(msg); + if (!error_str.empty() && error_str[error_str.length()-1] == '\n') + error_str.resize(error_str.length()-1); + + std::stringstream ss; + ss << error_str << ", line " << xmlTextReaderLocatorLineNumber(locator); + + LOG(INFO) << ss.str(); + + CefRefPtr impl(static_cast(arg)); + impl->AppendError(ss.str()); +} + +/** + * xmlStructuredErrorFunc: + * @userData: user provided data for the error callback + * @error: the error being raised. + * + * Signature of the function to use when there is an error and + * the module handles the new error reporting mechanism. + */ +void XMLCALL xml_structured_error_callback(void *userData, xmlErrorPtr error) { + if (!error->message) + return; + + std::string error_str(error->message); + if (!error_str.empty() && error_str[error_str.length()-1] == '\n') + error_str.resize(error_str.length()-1); + + std::stringstream ss; + ss << error_str << ", line " << error->line; + + LOG(INFO) << ss.str(); + + CefRefPtr impl(static_cast(userData)); + impl->AppendError(ss.str()); +} + +CefString xmlCharToString(const xmlChar* xmlStr, bool free) { + if (!xmlStr) + return CefString(); + + const char* str = reinterpret_cast(xmlStr); + CefString wstr = std::string(str); + + if (free) + xmlFree(const_cast(xmlStr)); + + return wstr; +} + +} // namespace + +CefXmlReaderImpl::CefXmlReaderImpl() + : supported_thread_id_(base::PlatformThread::CurrentId()), reader_(NULL) { +} + +CefXmlReaderImpl::~CefXmlReaderImpl() { + if (reader_ != NULL) { + if (!VerifyContext()) { + // Close() is supposed to be called directly. We'll try to free the reader + // now on the wrong thread but there's no guarantee this call won't crash. + xmlFreeTextReader(reader_); + } else { + Close(); + } + } +} + +bool CefXmlReaderImpl::Initialize(CefRefPtr stream, + EncodingType encodingType, + const CefString& URI) { + xmlCharEncoding enc = XML_CHAR_ENCODING_NONE; + switch (encodingType) { + case XML_ENCODING_UTF8: + enc = XML_CHAR_ENCODING_UTF8; + break; + case XML_ENCODING_UTF16LE: + enc = XML_CHAR_ENCODING_UTF16LE; + break; + case XML_ENCODING_UTF16BE: + enc = XML_CHAR_ENCODING_UTF16BE; + break; + case XML_ENCODING_ASCII: + enc = XML_CHAR_ENCODING_ASCII; + break; + default: + break; + } + + // Create the input buffer. + xmlParserInputBufferPtr input_buffer = xmlAllocParserInputBuffer(enc); + if (!input_buffer) + return false; + + input_buffer->context = stream.get(); + input_buffer->readcallback = xml_read_callback; + + // Create the text reader. + std::string uriStr = URI; + reader_ = xmlNewTextReader(input_buffer, uriStr.c_str()); + if (!reader_) { + // Free the input buffer. + xmlFreeParserInputBuffer(input_buffer); + return false; + } + + // Keep a reference to the stream. + stream_ = stream; + + // Register the error callbacks. + xmlTextReaderSetErrorHandler(reader_, xml_error_callback, this); + xmlTextReaderSetStructuredErrorHandler(reader_, + xml_structured_error_callback, this); + + return true; +} + +bool CefXmlReaderImpl::MoveToNextNode() { + if (!VerifyContext()) + return false; + + return xmlTextReaderRead(reader_) == 1 ? true : false; +} + +bool CefXmlReaderImpl::Close() { + if (!VerifyContext()) + return false; + + // The input buffer will be freed automatically. + xmlFreeTextReader(reader_); + reader_ = NULL; + return true; +} + +bool CefXmlReaderImpl::HasError() { + if (!VerifyContext()) + return false; + + return !error_buf_.str().empty(); +} + +CefString CefXmlReaderImpl::GetError() { + if (!VerifyContext()) + return CefString(); + + return error_buf_.str(); +} + +CefXmlReader::NodeType CefXmlReaderImpl::GetType() { + if (!VerifyContext()) + return XML_NODE_UNSUPPORTED; + + switch (xmlTextReaderNodeType(reader_)) { + case XML_READER_TYPE_ELEMENT: + return XML_NODE_ELEMENT_START; + case XML_READER_TYPE_END_ELEMENT: + return XML_NODE_ELEMENT_END; + case XML_READER_TYPE_ATTRIBUTE: + return XML_NODE_ATTRIBUTE; + case XML_READER_TYPE_TEXT: + return XML_NODE_TEXT; + case XML_READER_TYPE_SIGNIFICANT_WHITESPACE: + case XML_READER_TYPE_WHITESPACE: + return XML_NODE_WHITESPACE; + case XML_READER_TYPE_CDATA: + return XML_NODE_CDATA; + case XML_READER_TYPE_ENTITY_REFERENCE: + return XML_NODE_ENTITY_REFERENCE; + case XML_READER_TYPE_PROCESSING_INSTRUCTION: + return XML_NODE_PROCESSING_INSTRUCTION; + case XML_READER_TYPE_COMMENT: + return XML_NODE_COMMENT; + case XML_READER_TYPE_DOCUMENT_TYPE: + return XML_NODE_DOCUMENT_TYPE; + default: + break; + } + + return XML_NODE_UNSUPPORTED; +} + +int CefXmlReaderImpl::GetDepth() { + if (!VerifyContext()) + return -1; + + return xmlTextReaderDepth(reader_); +} + +CefString CefXmlReaderImpl::GetLocalName() { + if (!VerifyContext()) + return CefString(); + + return xmlCharToString(xmlTextReaderConstLocalName(reader_), false); +} + +CefString CefXmlReaderImpl::GetPrefix() { + if (!VerifyContext()) + return CefString(); + + return xmlCharToString(xmlTextReaderConstPrefix(reader_), false); +} + +CefString CefXmlReaderImpl::GetQualifiedName() { + if (!VerifyContext()) + return CefString(); + + return xmlCharToString(xmlTextReaderConstName(reader_), false); +} + +CefString CefXmlReaderImpl::GetNamespaceURI() { + if (!VerifyContext()) + return CefString(); + + return xmlCharToString(xmlTextReaderConstNamespaceUri(reader_), false); +} + +CefString CefXmlReaderImpl::GetBaseURI() { + if (!VerifyContext()) + return CefString(); + + return xmlCharToString(xmlTextReaderConstBaseUri(reader_), false); +} + +CefString CefXmlReaderImpl::GetXmlLang() { + if (!VerifyContext()) + return CefString(); + + return xmlCharToString(xmlTextReaderConstXmlLang(reader_), false); +} + +bool CefXmlReaderImpl::IsEmptyElement() { + if (!VerifyContext()) + return false; + + return xmlTextReaderIsEmptyElement(reader_) == 1 ? true : false; +} + +bool CefXmlReaderImpl::HasValue() { + if (!VerifyContext()) + return false; + + if (xmlTextReaderNodeType(reader_) == XML_READER_TYPE_ENTITY_REFERENCE) { + // Provide special handling to return entity reference values. + return true; + } else { + return xmlTextReaderHasValue(reader_) == 1 ? true : false; + } +} + +CefString CefXmlReaderImpl::GetValue() { + if (!VerifyContext()) + return CefString(); + + if (xmlTextReaderNodeType(reader_) == XML_READER_TYPE_ENTITY_REFERENCE) { + // Provide special handling to return entity reference values. + xmlNodePtr node = xmlTextReaderCurrentNode(reader_); + if (node->content != NULL) + return xmlCharToString(node->content, false); + return CefString(); + } else { + return xmlCharToString(xmlTextReaderConstValue(reader_), false); + } +} + +bool CefXmlReaderImpl::HasAttributes() { + if (!VerifyContext()) + return false; + + return xmlTextReaderHasAttributes(reader_) == 1 ? true : false; +} + +size_t CefXmlReaderImpl::GetAttributeCount() { + if (!VerifyContext()) + return 0; + + return xmlTextReaderAttributeCount(reader_); +} + +CefString CefXmlReaderImpl::GetAttribute(int index) { + if (!VerifyContext()) + return CefString(); + + return xmlCharToString(xmlTextReaderGetAttributeNo(reader_, index), true); +} + +CefString CefXmlReaderImpl::GetAttribute(const CefString& qualifiedName) { + if (!VerifyContext()) + return CefString(); + + std::string qualifiedNameStr = qualifiedName; + return xmlCharToString(xmlTextReaderGetAttribute(reader_, + BAD_CAST qualifiedNameStr.c_str()), true); +} + +CefString CefXmlReaderImpl::GetAttribute(const CefString& localName, + const CefString& namespaceURI) { + if (!VerifyContext()) + return CefString(); + + std::string localNameStr = localName; + std::string namespaceURIStr = namespaceURI; + return xmlCharToString(xmlTextReaderGetAttributeNs(reader_, + BAD_CAST localNameStr.c_str(), BAD_CAST namespaceURIStr.c_str()), true); +} + +CefString CefXmlReaderImpl::GetInnerXml() { + if (!VerifyContext()) + return CefString(); + + return xmlCharToString(xmlTextReaderReadInnerXml(reader_), true); +} + +CefString CefXmlReaderImpl::GetOuterXml() { + if (!VerifyContext()) + return CefString(); + + return xmlCharToString(xmlTextReaderReadOuterXml(reader_), true); +} + +int CefXmlReaderImpl::GetLineNumber() { + if (!VerifyContext()) + return -1; + + return xmlTextReaderGetParserLineNumber(reader_); +} + +bool CefXmlReaderImpl::MoveToAttribute(int index) { + if (!VerifyContext()) + return false; + + return xmlTextReaderMoveToAttributeNo(reader_, index) == 1 ? true : false; +} + +bool CefXmlReaderImpl::MoveToAttribute(const CefString& qualifiedName) { + if (!VerifyContext()) + return false; + + std::string qualifiedNameStr = qualifiedName; + return xmlTextReaderMoveToAttribute(reader_, + BAD_CAST qualifiedNameStr.c_str()) == 1 ? true : false; +} + +bool CefXmlReaderImpl::MoveToAttribute(const CefString& localName, + const CefString& namespaceURI) { + if (!VerifyContext()) + return false; + + std::string localNameStr = localName; + std::string namespaceURIStr = namespaceURI; + return xmlTextReaderMoveToAttributeNs(reader_, + BAD_CAST localNameStr.c_str(), BAD_CAST namespaceURIStr.c_str()) == 1 ? + true : false; +} + +bool CefXmlReaderImpl::MoveToFirstAttribute() { + if (!VerifyContext()) + return false; + + return xmlTextReaderMoveToFirstAttribute(reader_) == 1 ? true : false; +} + +bool CefXmlReaderImpl::MoveToNextAttribute() { + if (!VerifyContext()) + return false; + + return xmlTextReaderMoveToNextAttribute(reader_) == 1 ? true : false; +} + +bool CefXmlReaderImpl::MoveToCarryingElement() { + if (!VerifyContext()) + return false; + + return xmlTextReaderMoveToElement(reader_) == 1 ? true : false; +} + +void CefXmlReaderImpl::AppendError(const CefString& error_str) { + if (!error_buf_.str().empty()) + error_buf_ << L"\n"; + error_buf_ << error_str; +} + +bool CefXmlReaderImpl::VerifyContext() { + if (base::PlatformThread::CurrentId() != supported_thread_id_) { + // This object should only be accessed from the thread that created it. + NOTREACHED(); + return false; + } + + return (reader_ != NULL); +} diff --git a/libcef/browser/xml_reader_impl.h b/libcef/browser/xml_reader_impl.h new file mode 100644 index 000000000..b81733ca3 --- /dev/null +++ b/libcef/browser/xml_reader_impl.h @@ -0,0 +1,73 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_XML_READER_IMPL_H_ +#define CEF_LIBCEF_BROWSER_XML_READER_IMPL_H_ +#pragma once + +#include +#include + +#include "include/cef_xml_reader.h" +#include "base/threading/platform_thread.h" + +// Implementation of CefXmlReader +class CefXmlReaderImpl : public CefXmlReader { + public: + CefXmlReaderImpl(); + ~CefXmlReaderImpl(); + + // Initialize the reader context. + bool Initialize(CefRefPtr stream, + EncodingType encodingType, const CefString& URI); + + virtual bool MoveToNextNode() OVERRIDE; + virtual bool Close() OVERRIDE; + virtual bool HasError() OVERRIDE; + virtual CefString GetError() OVERRIDE; + virtual NodeType GetType() OVERRIDE; + virtual int GetDepth() OVERRIDE; + virtual CefString GetLocalName() OVERRIDE; + virtual CefString GetPrefix() OVERRIDE; + virtual CefString GetQualifiedName() OVERRIDE; + virtual CefString GetNamespaceURI() OVERRIDE; + virtual CefString GetBaseURI() OVERRIDE; + virtual CefString GetXmlLang() OVERRIDE; + virtual bool IsEmptyElement() OVERRIDE; + virtual bool HasValue() OVERRIDE; + virtual CefString GetValue() OVERRIDE; + virtual bool HasAttributes() OVERRIDE; + virtual size_t GetAttributeCount() OVERRIDE; + virtual CefString GetAttribute(int index) OVERRIDE; + virtual CefString GetAttribute(const CefString& qualifiedName) OVERRIDE; + virtual CefString GetAttribute(const CefString& localName, + const CefString& namespaceURI) OVERRIDE; + virtual CefString GetInnerXml() OVERRIDE; + virtual CefString GetOuterXml() OVERRIDE; + virtual int GetLineNumber() OVERRIDE; + virtual bool MoveToAttribute(int index) OVERRIDE; + virtual bool MoveToAttribute(const CefString& qualifiedName) OVERRIDE; + virtual bool MoveToAttribute(const CefString& localName, + const CefString& namespaceURI) OVERRIDE; + virtual bool MoveToFirstAttribute() OVERRIDE; + virtual bool MoveToNextAttribute() OVERRIDE; + virtual bool MoveToCarryingElement() OVERRIDE; + + // Add another line to the error string. + void AppendError(const CefString& error_str); + + // Verify that the reader exists and is being accessed from the correct + // thread. + bool VerifyContext(); + + protected: + base::PlatformThreadId supported_thread_id_; + CefRefPtr stream_; + xmlTextReaderPtr reader_; + std::stringstream error_buf_; + + IMPLEMENT_REFCOUNTING(CefXMLReaderImpl); +}; + +#endif // CEF_LIBCEF_BROWSER_XML_READER_IMPL_H_ diff --git a/libcef/browser/zip_reader_impl.cc b/libcef/browser/zip_reader_impl.cc new file mode 100644 index 000000000..dca92ae36 --- /dev/null +++ b/libcef/browser/zip_reader_impl.cc @@ -0,0 +1,280 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/browser/zip_reader_impl.h" +#include +#include "include/cef_stream.h" +#include "base/logging.h" + +// Static functions + +// static +CefRefPtr CefZipReader::Create( + CefRefPtr stream) { + CefRefPtr impl(new CefZipReaderImpl()); + if (!impl->Initialize(stream)) + return NULL; + return impl.get(); +} + + +// CefZipReaderImpl + +namespace { + +voidpf ZCALLBACK zlib_open_callback OF((voidpf opaque, const void* filename, + int mode)) { + // The stream is already implicitly open so just return the pointer. + return opaque; +} + +uLong ZCALLBACK zlib_read_callback OF((voidpf opaque, voidpf stream, void* buf, + uLong size)) { + CefRefPtr reader(static_cast(opaque)); + return reader->Read(buf, 1, size); +} + +ZPOS64_T ZCALLBACK zlib_tell_callback OF((voidpf opaque, voidpf stream)) { + CefRefPtr reader(static_cast(opaque)); + return reader->Tell(); +} + +long ZCALLBACK zlib_seek_callback OF((voidpf opaque, // NOLINT(runtime/int) + voidpf stream, ZPOS64_T offset, + int origin)) { + CefRefPtr reader(static_cast(opaque)); + int whence; + switch (origin) { + case ZLIB_FILEFUNC_SEEK_CUR: + whence = SEEK_CUR; + break; + case ZLIB_FILEFUNC_SEEK_END: + whence = SEEK_END; + break; + case ZLIB_FILEFUNC_SEEK_SET: + whence = SEEK_SET; + break; + default: + NOTREACHED(); + return -1; + } + return reader->Seek(offset, whence); +} + +int ZCALLBACK zlib_close_callback OF((voidpf opaque, voidpf stream)) { + CefRefPtr reader(static_cast(opaque)); + // Release the reference added by CefZipReaderImpl::Initialize(). + reader->Release(); + return 0; +} + +int ZCALLBACK zlib_error_callback OF((voidpf opaque, voidpf stream)) { + return 0; +} + +} // namespace + +CefZipReaderImpl::CefZipReaderImpl() + : supported_thread_id_(base::PlatformThread::CurrentId()), reader_(NULL), + has_fileopen_(false), + has_fileinfo_(false), + filesize_(0), + filemodified_(0) { +} + +CefZipReaderImpl::~CefZipReaderImpl() { + if (reader_ != NULL) { + if (!VerifyContext()) { + // Close() is supposed to be called directly. We'll try to free the reader + // now on the wrong thread but there's no guarantee this call won't crash. + if (has_fileopen_) + unzCloseCurrentFile(reader_); + unzClose(reader_); + } else { + Close(); + } + } +} + +bool CefZipReaderImpl::Initialize(CefRefPtr stream) { + zlib_filefunc64_def filefunc_def; + filefunc_def.zopen64_file = zlib_open_callback; + filefunc_def.zread_file = zlib_read_callback; + filefunc_def.zwrite_file = NULL; + filefunc_def.ztell64_file = zlib_tell_callback; + filefunc_def.zseek64_file = zlib_seek_callback; + filefunc_def.zclose_file = zlib_close_callback; + filefunc_def.zerror_file = zlib_error_callback; + filefunc_def.opaque = stream.get(); + + // Add a reference that will be released by zlib_close_callback(). + stream->AddRef(); + + reader_ = unzOpen2_64("", &filefunc_def); + return (reader_ != NULL); +} + +bool CefZipReaderImpl::MoveToFirstFile() { + if (!VerifyContext()) + return false; + + if (has_fileopen_) + CloseFile(); + + has_fileinfo_ = false; + + return (unzGoToFirstFile(reader_) == UNZ_OK); +} + +bool CefZipReaderImpl::MoveToNextFile() { + if (!VerifyContext()) + return false; + + if (has_fileopen_) + CloseFile(); + + has_fileinfo_ = false; + + return (unzGoToNextFile(reader_) == UNZ_OK); +} + +bool CefZipReaderImpl::MoveToFile(const CefString& fileName, + bool caseSensitive) { + if (!VerifyContext()) + return false; + + if (has_fileopen_) + CloseFile(); + + has_fileinfo_ = false; + + std::string fileNameStr = fileName; + return (unzLocateFile(reader_, fileNameStr.c_str(), + (caseSensitive ? 1 : 2)) == UNZ_OK); +} + +bool CefZipReaderImpl::Close() { + if (!VerifyContext()) + return false; + + if (has_fileopen_) + CloseFile(); + + int result = unzClose(reader_); + reader_ = NULL; + return (result == UNZ_OK); +} + +CefString CefZipReaderImpl::GetFileName() { + if (!VerifyContext() || !GetFileInfo()) + return CefString(); + + return filename_; +} + +int64 CefZipReaderImpl::GetFileSize() { + if (!VerifyContext() || !GetFileInfo()) + return -1; + + return filesize_; +} + +time_t CefZipReaderImpl::GetFileLastModified() { + if (!VerifyContext() || !GetFileInfo()) + return 0; + + return filemodified_; +} + +bool CefZipReaderImpl::OpenFile(const CefString& password) { + if (!VerifyContext()) + return false; + + if (has_fileopen_) + CloseFile(); + + bool ret; + + if (password.empty()) { + ret = (unzOpenCurrentFile(reader_) == UNZ_OK); + } else { + std::string passwordStr = password; + ret = (unzOpenCurrentFilePassword(reader_, passwordStr.c_str()) == UNZ_OK); + } + + if (ret) + has_fileopen_ = true; + return ret; +} + +bool CefZipReaderImpl::CloseFile() { + if (!VerifyContext() || !has_fileopen_) + return false; + + has_fileopen_ = false; + has_fileinfo_ = false; + + return (unzCloseCurrentFile(reader_) == UNZ_OK); +} + +int CefZipReaderImpl::ReadFile(void* buffer, size_t bufferSize) { + if (!VerifyContext() || !has_fileopen_) + return -1; + + return unzReadCurrentFile(reader_, buffer, bufferSize); +} + +int64 CefZipReaderImpl::Tell() { + if (!VerifyContext() || !has_fileopen_) + return -1; + + return unztell64(reader_); +} + +bool CefZipReaderImpl::Eof() { + if (!VerifyContext() || !has_fileopen_) + return true; + + return (unzeof(reader_) == 1 ? true : false); +} + +bool CefZipReaderImpl::GetFileInfo() { + if (has_fileinfo_) + return true; + + char file_name[512] = {0}; + unz_file_info file_info; + memset(&file_info, 0, sizeof(file_info)); + + if (unzGetCurrentFileInfo(reader_, &file_info, file_name, sizeof(file_name), + NULL, 0, NULL, 0) != UNZ_OK) { + return false; + } + + has_fileinfo_ = true; + filename_ = std::string(file_name); + filesize_ = file_info.uncompressed_size; + + struct tm time; + memset(&time, 0, sizeof(time)); + time.tm_sec = file_info.tmu_date.tm_sec; + time.tm_min = file_info.tmu_date.tm_min; + time.tm_hour = file_info.tmu_date.tm_hour; + time.tm_mday = file_info.tmu_date.tm_mday; + time.tm_mon = file_info.tmu_date.tm_mon; + time.tm_year = file_info.tmu_date.tm_year; + filemodified_ = mktime(&time); + + return true; +} + +bool CefZipReaderImpl::VerifyContext() { + if (base::PlatformThread::CurrentId() != supported_thread_id_) { + // This object should only be accessed from the thread that created it. + NOTREACHED(); + return false; + } + + return (reader_ != NULL); +} diff --git a/libcef/browser/zip_reader_impl.h b/libcef/browser/zip_reader_impl.h new file mode 100644 index 000000000..d53d157a0 --- /dev/null +++ b/libcef/browser/zip_reader_impl.h @@ -0,0 +1,55 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_ZIP_READER_IMPL_H_ +#define CEF_LIBCEF_BROWSER_ZIP_READER_IMPL_H_ +#pragma once + +#include + +#include "include/cef_zip_reader.h" +#include "base/threading/platform_thread.h" +#include "third_party/zlib/contrib/minizip/unzip.h" + +// Implementation of CefZipReader +class CefZipReaderImpl : public CefZipReader { + public: + CefZipReaderImpl(); + ~CefZipReaderImpl(); + + // Initialize the reader context. + bool Initialize(CefRefPtr stream); + + virtual bool MoveToFirstFile(); + virtual bool MoveToNextFile(); + virtual bool MoveToFile(const CefString& fileName, bool caseSensitive); + virtual bool Close(); + virtual CefString GetFileName(); + virtual int64 GetFileSize(); + virtual time_t GetFileLastModified(); + virtual bool OpenFile(const CefString& password); + virtual bool CloseFile(); + virtual int ReadFile(void* buffer, size_t bufferSize); + virtual int64 Tell(); + virtual bool Eof(); + + bool GetFileInfo(); + + // Verify that the reader exists and is being accessed from the correct + // thread. + bool VerifyContext(); + + protected: + base::PlatformThreadId supported_thread_id_; + unzFile reader_; + bool has_fileopen_; + bool has_fileinfo_; + CefString filename_; + int64 filesize_; + time_t filemodified_; + + IMPLEMENT_REFCOUNTING(CefZipReaderImpl); +}; + +#endif // CEF_LIBCEF_BROWSER_ZIP_READER_IMPL_H_ diff --git a/libcef/common/cef_message_generator.cc b/libcef/common/cef_message_generator.cc new file mode 100644 index 000000000..6e16dc1d4 --- /dev/null +++ b/libcef/common/cef_message_generator.cc @@ -0,0 +1,33 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Get basic type definitions. +#define IPC_MESSAGE_IMPL +#include "libcef/common/cef_message_generator.h" + +// Generate constructors. +#include "ipc/struct_constructor_macros.h" +#include "libcef/common/cef_message_generator.h" + +// Generate destructors. +#include "ipc/struct_destructor_macros.h" +#include "libcef/common/cef_message_generator.h" + +// Generate param traits write methods. +#include "ipc/param_traits_write_macros.h" +namespace IPC { +#include "libcef/common/cef_message_generator.h" +} // namespace IPC + +// Generate param traits read methods. +#include "ipc/param_traits_read_macros.h" +namespace IPC { +#include "libcef/common/cef_message_generator.h" +} // namespace IPC + +// Generate param traits log methods. +#include "ipc/param_traits_log_macros.h" +namespace IPC { +#include "libcef/common/cef_message_generator.h" +} // namespace IPC diff --git a/libcef/common/cef_message_generator.h b/libcef/common/cef_message_generator.h new file mode 100644 index 000000000..124361160 --- /dev/null +++ b/libcef/common/cef_message_generator.h @@ -0,0 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Multiply-included file, hence no include guard. + +#include "libcef/common/cef_messages.h" diff --git a/libcef/common/cef_messages.h b/libcef/common/cef_messages.h new file mode 100644 index 000000000..ef1455a89 --- /dev/null +++ b/libcef/common/cef_messages.h @@ -0,0 +1,171 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// IPC messages for CEF. +// Multiply-included message file, hence no include guard. + +#include "base/shared_memory.h" +#include "base/values.h" +#include "content/public/common/common_param_traits.h" +#include "content/public/common/referrer.h" +#include "ipc/ipc_message_macros.h" +#include "net/base/upload_data.h" + +// TODO(cef): Re-using the message start for extensions may be problematic in +// the future. It would be better if ipc_message_utils.h contained a value +// reserved for consumers of the content API. +// See: http://crbug.com/110911 +#define IPC_MESSAGE_START ExtensionMsgStart + + +// Common types. + +// Parameters structure for a request. +IPC_STRUCT_BEGIN(Cef_Request_Params) + // Unique request id to match requests and responses. + IPC_STRUCT_MEMBER(int, request_id) + + // Unique id of the target frame. -1 if unknown / invalid. + IPC_STRUCT_MEMBER(int64, frame_id) + + // True if the request is user-initiated instead of internal. + IPC_STRUCT_MEMBER(bool, user_initiated) + + // True if a response is expected. + IPC_STRUCT_MEMBER(bool, expect_response) + + // Message name. + IPC_STRUCT_MEMBER(std::string, name) + + // List of message arguments. + IPC_STRUCT_MEMBER(ListValue, arguments) +IPC_STRUCT_END() + +// Parameters structure for a response. +IPC_STRUCT_BEGIN(Cef_Response_Params) + // Unique request id to match requests and responses. + IPC_STRUCT_MEMBER(int, request_id) + + // True if a response ack is expected. + IPC_STRUCT_MEMBER(bool, expect_response_ack) + + // True on success. + IPC_STRUCT_MEMBER(bool, success) + + // Response or error string depending on the value of |success|. + IPC_STRUCT_MEMBER(std::string, response) +IPC_STRUCT_END() + + + +// Messages sent from the browser to the renderer. + +// Tell the renderer which browser window it's being attached to. +IPC_MESSAGE_ROUTED2(CefMsg_UpdateBrowserWindowId, + int /* browser_id */, + bool /* is_popup */) + +// Parameters for a resource request. +IPC_STRUCT_BEGIN(CefMsg_LoadRequest_Params) + // The request method: GET, POST, etc. + IPC_STRUCT_MEMBER(std::string, method) + + // The requested URL. + IPC_STRUCT_MEMBER(GURL, url) + + // The URL to send in the "Referer" header field. Can be empty if there is + // no referrer. + IPC_STRUCT_MEMBER(GURL, referrer) + // One of the WebKit::WebReferrerPolicy values. + IPC_STRUCT_MEMBER(int, referrer_policy) + + // Identifies the frame within the RenderView that sent the request. + // -1 if unknown / invalid. + IPC_STRUCT_MEMBER(int64, frame_id) + + // Usually the URL of the document in the top-level window, which may be + // checked by the third-party cookie blocking policy. Leaving it empty may + // lead to undesired cookie blocking. Third-party cookie blocking can be + // bypassed by setting first_party_for_cookies = url, but this should ideally + // only be done if there really is no way to determine the correct value. + IPC_STRUCT_MEMBER(GURL, first_party_for_cookies) + + // Additional HTTP request headers. + IPC_STRUCT_MEMBER(std::string, headers) + + // net::URLRequest load flags (0 by default). + IPC_STRUCT_MEMBER(int, load_flags) + + // Optional upload data (may be null). + IPC_STRUCT_MEMBER(scoped_refptr, upload_data) +IPC_STRUCT_END() + +// Tell the renderer to load a request. +IPC_MESSAGE_ROUTED1(CefMsg_LoadRequest, + CefMsg_LoadRequest_Params) + +// Sent when the browser has a request for the renderer. The renderer may +// respond with a CefHostMsg_Response. +IPC_MESSAGE_ROUTED1(CefMsg_Request, + Cef_Request_Params) + +// Optional message sent in response to a CefHostMsg_Request. +IPC_MESSAGE_ROUTED1(CefMsg_Response, + Cef_Response_Params) + +// Optional Ack message sent to the browser to notify that a CefHostMsg_Response +// has been processed. +IPC_MESSAGE_ROUTED1(CefMsg_ResponseAck, + int /* request_id */) + +// Sent to child processes to add or remove a cross-origin whitelist entry. +IPC_MESSAGE_CONTROL5(CefProcessMsg_ModifyCrossOriginWhitelistEntry, + bool /* add */, + std::string /* source_origin */, + std::string /* target_protocol */, + std::string /* target_domain */, + bool /* allow_target_subdomains */) + +// Sent to child processes to clear the cross-origin whitelist. +IPC_MESSAGE_CONTROL0(CefProcessMsg_ClearCrossOriginWhitelist) + + +// Messages sent from the renderer to the browser. + +// Sent when the render thread has started and all filters are attached. +IPC_MESSAGE_CONTROL0(CefProcessHostMsg_RenderThreadStarted) + +// Sent when a frame is identified for the first time. +IPC_MESSAGE_ROUTED3(CefHostMsg_FrameIdentified, + int64 /* frame_id */, + int64 /* parent_frame_id */, + string16 /* frame_name */) + +// Sent when a frame has been detached. +IPC_MESSAGE_ROUTED1(CefHostMsg_FrameDetached, + int64 /* frame_id */) + +// Sent when a new frame has been given focus. +IPC_MESSAGE_ROUTED1(CefHostMsg_FrameFocusChange, + int64 /* frame_id */) + +// Sent when a new URL is about to be loaded in the main frame. Used for the +// cookie manager. +IPC_MESSAGE_ROUTED1(CefHostMsg_LoadingURLChange, + GURL /* loading_url */) + +// Sent when the renderer has a request for the browser. The browser may respond +// with a CefMsg_Response. +IPC_MESSAGE_ROUTED1(CefHostMsg_Request, + Cef_Request_Params) + +// Optional message sent in response to a CefMsg_Request. +IPC_MESSAGE_ROUTED1(CefHostMsg_Response, + Cef_Response_Params) + +// Optional Ack message sent to the browser to notify that a CefMsg_Response +// has been processed. +IPC_MESSAGE_ROUTED1(CefHostMsg_ResponseAck, + int /* request_id */) diff --git a/libcef/common/cef_switches.cc b/libcef/common/cef_switches.cc new file mode 100644 index 000000000..a626df51e --- /dev/null +++ b/libcef/common/cef_switches.cc @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/common/cef_switches.h" + +namespace switches { + +// Product version string. +const char kProductVersion[] = "product-version"; + +// Locale string. +const char kLocale[] = "locale"; + +// Log file path. +const char kLogFile[] = "log-file"; + +// Severity of messages to log. +const char kLogSeverity[] = "log-severity"; +const char kLogSeverity_Verbose[] = "verbose"; +const char kLogSeverity_Info[] = "info"; +const char kLogSeverity_Warning[] = "warning"; +const char kLogSeverity_Error[] = "error"; +const char kLogSeverity_ErrorReport[] = "error-report"; +const char kLogSeverity_Disable[] = "disable"; + +// Path to cef.pak file. +const char kPackFilePath[] = "pack-file-path"; + +// Path to locales directory. +const char kLocalesDirPath[] = "locales-dir-path"; + +// Path to locales directory. +const char kPackLoadingDisabled[] = "pack-loading-disabled"; + +} // namespace switches diff --git a/libcef/common/cef_switches.h b/libcef/common/cef_switches.h new file mode 100644 index 000000000..27ec00474 --- /dev/null +++ b/libcef/common/cef_switches.h @@ -0,0 +1,29 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +// Defines all the "cef" command-line switches. + +#ifndef CEF_LIBCEF_COMMON_CEF_SWITCHES_H_ +#define CEF_LIBCEF_COMMON_CEF_SWITCHES_H_ +#pragma once + +namespace switches { + +extern const char kProductVersion[]; +extern const char kLocale[]; +extern const char kLogFile[]; +extern const char kLogSeverity[]; +extern const char kLogSeverity_Verbose[]; +extern const char kLogSeverity_Info[]; +extern const char kLogSeverity_Warning[]; +extern const char kLogSeverity_Error[]; +extern const char kLogSeverity_ErrorReport[]; +extern const char kLogSeverity_Disable[]; +extern const char kPackFilePath[]; +extern const char kLocalesDirPath[]; +extern const char kPackLoadingDisabled[]; + +} // namespace switches + +#endif // CEF_LIBCEF_COMMON_CEF_SWITCHES_H_ diff --git a/libcef/common/command_line_impl.cc b/libcef/common/command_line_impl.cc new file mode 100644 index 000000000..bbbdcf3b4 --- /dev/null +++ b/libcef/common/command_line_impl.cc @@ -0,0 +1,146 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/common/command_line_impl.h" + +#include "base/file_path.h" +#include "base/logging.h" + +CefCommandLineImpl::CefCommandLineImpl(CommandLine* value, + bool will_delete, + bool read_only) + : CefValueBase( + value, NULL, will_delete ? kOwnerWillDelete : kOwnerNoDelete, + read_only, NULL) { +} + +bool CefCommandLineImpl::IsValid() { + return !detached(); +} + +bool CefCommandLineImpl::IsReadOnly() { + return read_only(); +} + +CefRefPtr CefCommandLineImpl::Copy() { + CEF_VALUE_VERIFY_RETURN(false, NULL); + return new CefCommandLineImpl( + new CommandLine(const_value().argv()), true, false); +} + +void CefCommandLineImpl::InitFromArgv(int argc, const char* const* argv) { +#if !defined(OS_WIN) + CEF_VALUE_VERIFY_RETURN_VOID(true); + mutable_value()->InitFromArgv(argc, argv); +#else + NOTREACHED() << "method not supported on this platform"; +#endif +} + +void CefCommandLineImpl::InitFromString(const CefString& command_line) { +#if defined(OS_WIN) + CEF_VALUE_VERIFY_RETURN_VOID(true); + mutable_value()->ParseFromString(command_line); +#else + NOTREACHED() << "method not supported on this platform"; +#endif +} + +void CefCommandLineImpl::Reset() { + CEF_VALUE_VERIFY_RETURN_VOID(true); + CommandLine::StringVector argv; + argv.push_back(mutable_value()->GetProgram().value()); + mutable_value()->InitFromArgv(argv); + + const CommandLine::SwitchMap& map = mutable_value()->GetSwitches(); + const_cast(&map)->clear(); +} + +CefString CefCommandLineImpl::GetCommandLineString() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().GetCommandLineString(); +} + +CefString CefCommandLineImpl::GetProgram() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().GetProgram().value(); +} + +void CefCommandLineImpl::SetProgram(const CefString& program) { + CEF_VALUE_VERIFY_RETURN_VOID(true); + mutable_value()->SetProgram(FilePath(program)); +} + +bool CefCommandLineImpl::HasSwitches() { + CEF_VALUE_VERIFY_RETURN(false, false); + return (const_value().GetSwitches().size() > 0); +} + +bool CefCommandLineImpl::HasSwitch(const CefString& name) { + CEF_VALUE_VERIFY_RETURN(false, false); + return const_value().HasSwitch(name); +} + +CefString CefCommandLineImpl::GetSwitchValue(const CefString& name) { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().GetSwitchValueNative(name); +} + +void CefCommandLineImpl::GetSwitches(SwitchMap& switches) { + CEF_VALUE_VERIFY_RETURN_VOID(false); + const CommandLine::SwitchMap& map = const_value().GetSwitches(); + CommandLine::SwitchMap::const_iterator it = map.begin(); + for (; it != map.end(); ++it) + switches.insert(std::make_pair(it->first, it->second)); +} + +void CefCommandLineImpl::AppendSwitch(const CefString& name) { + CEF_VALUE_VERIFY_RETURN_VOID(true); + mutable_value()->AppendSwitch(name); +} + +void CefCommandLineImpl::AppendSwitchWithValue(const CefString& name, + const CefString& value) { + CEF_VALUE_VERIFY_RETURN_VOID(true); + mutable_value()->AppendSwitchNative(name, value); +} + +bool CefCommandLineImpl::HasArguments() { + CEF_VALUE_VERIFY_RETURN(false, false); + return (const_value().GetArgs().size() > 0); +} + +void CefCommandLineImpl::GetArguments(ArgumentList& arguments) { + CEF_VALUE_VERIFY_RETURN_VOID(false); + const CommandLine::StringVector& vec = const_value().GetArgs(); + CommandLine::StringVector::const_iterator it = vec.begin(); + for (; it != vec.end(); ++it) + arguments.push_back(*it); +} + +void CefCommandLineImpl::AppendArgument(const CefString& argument) { + CEF_VALUE_VERIFY_RETURN_VOID(true); + mutable_value()->AppendArgNative(argument); +} + + +// CefCommandLine implementation. + +// static +CefRefPtr CefCommandLine::CreateCommandLine() { + return new CefCommandLineImpl( + new CommandLine(CommandLine::NO_PROGRAM), true, false); +} + +// static +CefRefPtr CefCommandLine::GetGlobalCommandLine() { + // Uses a singleton reference object. + static CefRefPtr commandLinePtr; + if (!commandLinePtr.get()) { + CommandLine* command_line = CommandLine::ForCurrentProcess(); + if (command_line) + commandLinePtr = new CefCommandLineImpl(command_line, false, true); + } + return commandLinePtr.get(); +} diff --git a/libcef/common/command_line_impl.h b/libcef/common/command_line_impl.h new file mode 100644 index 000000000..be9cf73cf --- /dev/null +++ b/libcef/common/command_line_impl.h @@ -0,0 +1,48 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_COMMAND_LINE_IMPL_H_ +#define CEF_LIBCEF_COMMON_COMMAND_LINE_IMPL_H_ +#pragma once + +#include "include/cef_command_line.h" +#include "libcef/common/value_base.h" + +#include "base/command_line.h" + +// CefCommandLine implementation +class CefCommandLineImpl : public CefValueBase { + public: + CefCommandLineImpl(CommandLine* value, + bool will_delete, + bool read_only); + + // CefCommandLine methods. + virtual bool IsValid() OVERRIDE; + virtual bool IsReadOnly() OVERRIDE; + virtual CefRefPtr Copy() OVERRIDE; + virtual void InitFromArgv(int argc, const char* const* argv) OVERRIDE; + virtual void InitFromString(const CefString& command_line) OVERRIDE; + virtual void Reset() OVERRIDE; + virtual CefString GetCommandLineString() OVERRIDE; + virtual CefString GetProgram() OVERRIDE; + virtual void SetProgram(const CefString& program) OVERRIDE; + virtual bool HasSwitches() OVERRIDE; + virtual bool HasSwitch(const CefString& name) OVERRIDE; + virtual CefString GetSwitchValue(const CefString& name) OVERRIDE; + virtual void GetSwitches(SwitchMap& switches) OVERRIDE; + virtual void AppendSwitch(const CefString& name) OVERRIDE; + virtual void AppendSwitchWithValue(const CefString& name, + const CefString& value) OVERRIDE; + virtual bool HasArguments() OVERRIDE; + virtual void GetArguments(ArgumentList& arguments) OVERRIDE; + virtual void AppendArgument(const CefString& argument) OVERRIDE; + + // Must hold the controller lock while using this value. + const CommandLine& command_line() { return const_value(); } + + DISALLOW_COPY_AND_ASSIGN(CefCommandLineImpl); +}; + +#endif // CEF_LIBCEF_COMMON_COMMAND_LINE_IMPL_H_ diff --git a/libcef/common/content_client.cc b/libcef/common/content_client.cc new file mode 100644 index 000000000..1770cf2cc --- /dev/null +++ b/libcef/common/content_client.cc @@ -0,0 +1,160 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/common/content_client.h" +#include "include/cef_stream.h" +#include "include/cef_version.h" +#include "libcef/browser/devtools_scheme_handler.h" +#include "libcef/common/cef_switches.h" +#include "libcef/common/scheme_registrar_impl.h" +#include "libcef/renderer/content_renderer_client.h" + +#include "base/command_line.h" +#include "base/logging.h" +#include "base/string_piece.h" +#include "base/stringprintf.h" +#include "content/public/common/content_switches.h" +#include "ui/base/resource/resource_bundle.h" +#include "webkit/glue/user_agent.h" + +CefContentClient::CefContentClient(CefRefPtr application) + : application_(application), + pack_loading_disabled_(false), + allow_pack_file_load_(false) { +} + +CefContentClient::~CefContentClient() { +} + +// static +CefContentClient* CefContentClient::Get() { + return static_cast(content::GetContentClient()); +} + +void CefContentClient::AddAdditionalSchemes( + std::vector* standard_schemes, + std::vector* savable_schemes) { + if (application_.get()) { + CefRefPtr schemeRegistrar( + new CefSchemeRegistrarImpl()); + application_->OnRegisterCustomSchemes(schemeRegistrar.get()); + schemeRegistrar->GetStandardSchemes(standard_schemes); + + // No references to the registar should be kept. + schemeRegistrar->Detach(); + DCHECK(schemeRegistrar->VerifyRefCount()); + } + + standard_schemes->push_back(kChromeDevToolsScheme); + if (CefContentRendererClient::Get()) { + // Register the DevTools scheme with WebKit. + CefContentRendererClient::Get()->AddCustomScheme(kChromeDevToolsScheme, + true, false); + } +} + +std::string CefContentClient::GetUserAgent() const { + std::string product_version; + + static CommandLine& command_line = *CommandLine::ForCurrentProcess(); + if (command_line.HasSwitch(switches::kProductVersion)) { + product_version = + command_line.GetSwitchValueASCII(switches::kProductVersion); + } else { + product_version = base::StringPrintf("Chrome/%d.%d.%d.%d", + CHROME_VERSION_MAJOR, CHROME_VERSION_MINOR, CHROME_VERSION_BUILD, + CHROME_VERSION_PATCH); + } + + return webkit_glue::BuildUserAgentFromProduct(product_version); +} + +string16 CefContentClient::GetLocalizedString(int message_id) const { + string16 value = + ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); + if (value.empty()) + LOG(ERROR) << "No localized string available for id " << message_id; + + return value; +} + +base::StringPiece CefContentClient::GetDataResource( + int resource_id, + ui::ScaleFactor scale_factor) const { + base::StringPiece value = + ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id, + scale_factor); + if (value.empty()) + LOG(ERROR) << "No data resource available for id " << resource_id; + + return value; +} + +FilePath CefContentClient::GetPathForResourcePack( + const FilePath& pack_path, + ui::ScaleFactor scale_factor) { + // Only allow the cef pack file to load. + if (!pack_loading_disabled_ && allow_pack_file_load_) + return pack_path; + return FilePath(); +} + +FilePath CefContentClient::GetPathForLocalePack(const FilePath& pack_path, + const std::string& locale) { + if (!pack_loading_disabled_) + return pack_path; + return FilePath(); +} + +gfx::Image CefContentClient::GetImageNamed(int resource_id) { + return gfx::Image(); +} + +gfx::Image CefContentClient::GetNativeImageNamed( + int resource_id, + ui::ResourceBundle::ImageRTL rtl) { + return gfx::Image(); +} + +base::RefCountedStaticMemory* CefContentClient::LoadDataResourceBytes( + int resource_id, + ui::ScaleFactor scale_factor) { + return NULL; +} + +bool CefContentClient::GetRawDataResource(int resource_id, + ui::ScaleFactor scale_factor, + base::StringPiece* value) { + if (application_.get()) { + CefRefPtr handler = + application_->GetResourceBundleHandler(); + if (handler.get()) { + void* data = NULL; + size_t data_size = 0; + if (handler->GetDataResource(resource_id, data, data_size)) + *value = base::StringPiece(static_cast(data), data_size); + } + } + + return (pack_loading_disabled_ || !value->empty()); +} + +bool CefContentClient::GetLocalizedString(int message_id, string16* value) { + if (application_.get()) { + CefRefPtr handler = + application_->GetResourceBundleHandler(); + if (handler.get()) { + CefString cef_str; + if (handler->GetLocalizedString(message_id, cef_str)) + *value = cef_str; + } + } + + return (pack_loading_disabled_ || !value->empty()); +} + +scoped_ptr CefContentClient::GetFont( + ui::ResourceBundle::FontStyle style) { + return scoped_ptr(); +} diff --git a/libcef/common/content_client.h b/libcef/common/content_client.h new file mode 100644 index 000000000..095d81b6d --- /dev/null +++ b/libcef/common/content_client.h @@ -0,0 +1,69 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_CONTENT_CLIENT_H_ +#define CEF_LIBCEF_COMMON_CONTENT_CLIENT_H_ +#pragma once + +#include +#include + +#include "include/cef_app.h" + +#include "base/compiler_specific.h" +#include "content/public/common/content_client.h" +#include "ui/base/resource/resource_bundle.h" + +class CefContentClient : public content::ContentClient, + public ui::ResourceBundle::Delegate { + public: + explicit CefContentClient(CefRefPtr application); + virtual ~CefContentClient(); + + // Returns the singleton CefContentClient instance. + static CefContentClient* Get(); + + // content::ContentClient methods. + virtual void AddAdditionalSchemes( + std::vector* standard_schemes, + std::vector* savable_schemes) OVERRIDE; + virtual std::string GetUserAgent() const OVERRIDE; + virtual string16 GetLocalizedString(int message_id) const OVERRIDE; + virtual base::StringPiece GetDataResource( + int resource_id, + ui::ScaleFactor scale_factor) const OVERRIDE; + + CefRefPtr application() const { return application_; } + + void set_pack_loading_disabled(bool val) { pack_loading_disabled_ = val; } + bool pack_loading_disabled() const { return pack_loading_disabled_; } + void set_allow_pack_file_load(bool val) { allow_pack_file_load_ = val; } + + private: + // ui::ResourceBundle::Delegate methods. + virtual FilePath GetPathForResourcePack( + const FilePath& pack_path, + ui::ScaleFactor scale_factor) OVERRIDE; + virtual FilePath GetPathForLocalePack(const FilePath& pack_path, + const std::string& locale) OVERRIDE; + virtual gfx::Image GetImageNamed(int resource_id) OVERRIDE; + virtual gfx::Image GetNativeImageNamed( + int resource_id, + ui::ResourceBundle::ImageRTL rtl) OVERRIDE; + virtual base::RefCountedStaticMemory* LoadDataResourceBytes( + int resource_id, + ui::ScaleFactor scale_factor) OVERRIDE; + virtual bool GetRawDataResource(int resource_id, + ui::ScaleFactor scale_factor, + base::StringPiece* value) OVERRIDE; + virtual bool GetLocalizedString(int message_id, string16* value) OVERRIDE; + virtual scoped_ptr GetFont( + ui::ResourceBundle::FontStyle style) OVERRIDE; + + CefRefPtr application_; + bool pack_loading_disabled_; + bool allow_pack_file_load_; +}; + +#endif // CEF_LIBCEF_COMMON_CONTENT_CLIENT_H_ diff --git a/libcef/common/http_header_utils.cc b/libcef/common/http_header_utils.cc new file mode 100644 index 000000000..249833bc5 --- /dev/null +++ b/libcef/common/http_header_utils.cc @@ -0,0 +1,43 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/common/http_header_utils.h" +#include "net/http/http_response_headers.h" +#include "net/http/http_util.h" + +using net::HttpResponseHeaders; + +namespace HttpHeaderUtils { + +std::string GenerateHeaders(const HeaderMap& map) { + std::string headers; + + for (HeaderMap::const_iterator header = map.begin(); + header != map.end(); + ++header) { + const CefString& key = header->first; + const CefString& value = header->second; + + if (!key.empty()) { + // Delimit with "\r\n". + if (!headers.empty()) + headers += "\r\n"; + + headers += std::string(key) + ": " + std::string(value); + } + } + + return headers; +} + +void ParseHeaders(const std::string& header_str, HeaderMap& map) { + // Parse the request header values + for (net::HttpUtil::HeadersIterator i(header_str.begin(), + header_str.end(), "\n"); + i.GetNext(); ) { + map.insert(std::make_pair(i.name(), i.values())); + } +} + +} // namespace HttpHeaderUtils diff --git a/libcef/common/http_header_utils.h b/libcef/common/http_header_utils.h new file mode 100644 index 000000000..579b4a9cf --- /dev/null +++ b/libcef/common/http_header_utils.h @@ -0,0 +1,22 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_HTTP_HEADER_UTILS_H_ +#define CEF_LIBCEF_COMMON_HTTP_HEADER_UTILS_H_ +#pragma once + +#include + +#include "include/cef_request.h" + +namespace HttpHeaderUtils { + +typedef CefRequest::HeaderMap HeaderMap; + +std::string GenerateHeaders(const HeaderMap& map); +void ParseHeaders(const std::string& header_str, HeaderMap& map); + +}; // namespace HttpHeaderUtils + +#endif // CEF_LIBCEF_COMMON_HTTP_HEADER_UTILS_H_ diff --git a/libcef/common/main_delegate.cc b/libcef/common/main_delegate.cc new file mode 100644 index 000000000..9f0f34852 --- /dev/null +++ b/libcef/common/main_delegate.cc @@ -0,0 +1,421 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/common/main_delegate.h" +#include "libcef/browser/content_browser_client.h" +#include "libcef/browser/context.h" +#include "libcef/common/cef_switches.h" +#include "libcef/common/command_line_impl.h" +#include "libcef/renderer/content_renderer_client.h" + +#include "base/command_line.h" +#include "base/file_path.h" +#include "base/file_util.h" +#include "base/path_service.h" +#include "base/string_number_conversions.h" +#include "base/string_util.h" +#include "base/synchronization/waitable_event.h" +#include "base/threading/thread.h" +#include "content/public/browser/browser_main_runner.h" +#include "content/public/browser/render_process_host.h" +#include "content/public/common/content_switches.h" +#include "content/public/common/main_function_params.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/base/ui_base_paths.h" + +#if defined(OS_WIN) +#include // NOLINT(build/include_order) +#endif + +#if defined(OS_MACOSX) +#include "base/mac/bundle_locations.h" +#include "base/mac/foundation_util.h" +#include "content/public/common/content_paths.h" +#endif + +namespace { + +#if defined(OS_MACOSX) + +FilePath GetFrameworksPath() { + // Start out with the path to the running executable. + FilePath execPath; + PathService::Get(base::FILE_EXE, &execPath); + + // Get the main bundle path. + FilePath bundlePath = base::mac::GetAppBundlePath(execPath); + + // Go into the Contents/Frameworks directory. + return bundlePath.Append(FILE_PATH_LITERAL("Contents")) + .Append(FILE_PATH_LITERAL("Frameworks")); +} + +// The framework bundle path is used for loading resources, libraries, etc. +FilePath GetFrameworkBundlePath() { + return GetFrameworksPath().Append( + FILE_PATH_LITERAL("Chromium Embedded Framework.framework")); +} + +FilePath GetDefaultPackPath() { + return GetFrameworkBundlePath().Append(FILE_PATH_LITERAL("Resources")); +} + +void OverrideFrameworkBundlePath() { + base::mac::SetOverrideFrameworkBundlePath(GetFrameworkBundlePath()); +} + +void OverrideChildProcessPath() { + // Retrieve the name of the running executable. + FilePath path; + PathService::Get(base::FILE_EXE, &path); + + std::string name = path.BaseName().value(); + + FilePath helper_path = GetFrameworksPath() + .Append(FILE_PATH_LITERAL(name+" Helper.app")) + .Append(FILE_PATH_LITERAL("Contents")) + .Append(FILE_PATH_LITERAL("MacOS")) + .Append(FILE_PATH_LITERAL(name+" Helper")); + + PathService::Override(content::CHILD_PROCESS_EXE, helper_path); +} + +#else // !defined(OS_MACOSX) + +FilePath GetDefaultPackPath() { + FilePath pak_dir; + PathService::Get(base::DIR_MODULE, &pak_dir); + return pak_dir; +} + +#endif // !defined(OS_MACOSX) + +// Used to run the UI on a separate thread. +class CefUIThread : public base::Thread { + public: + explicit CefUIThread(const content::MainFunctionParams& main_function_params) + : base::Thread("CefUIThread"), + main_function_params_(main_function_params) { + } + + virtual void Init() OVERRIDE { +#if defined(OS_WIN) + // Initializes the COM library on the current thread. + CoInitialize(NULL); +#endif + + // Use our own browser process runner. + browser_runner_.reset(content::BrowserMainRunner::Create()); + + // Initialize browser process state. Uses the current thread's mesage loop. + int exit_code = browser_runner_->Initialize(main_function_params_); + CHECK_EQ(exit_code, -1); + } + + virtual void CleanUp() OVERRIDE { + browser_runner_->Shutdown(); + browser_runner_.reset(NULL); + +#if defined(OS_WIN) + // Closes the COM library on the current thread. CoInitialize must + // be balanced by a corresponding call to CoUninitialize. + CoUninitialize(); +#endif + } + + protected: + content::MainFunctionParams main_function_params_; + scoped_ptr browser_runner_; +}; + +} // namespace + +CefMainDelegate::CefMainDelegate(CefRefPtr application) + : content_client_(application) { +} + +CefMainDelegate::~CefMainDelegate() { +} + +bool CefMainDelegate::BasicStartupComplete(int* exit_code) { +#if defined(OS_MACOSX) + OverrideFrameworkBundlePath(); +#endif + + CommandLine* command_line = CommandLine::ForCurrentProcess(); + std::string process_type = + command_line->GetSwitchValueASCII(switches::kProcessType); + + if (process_type.empty()) { + // In the browser process. Populate the global command-line object. + const CefSettings& settings = _Context->settings(); + + if (settings.command_line_args_disabled) { + // Remove any existing command-line arguments. + CommandLine::StringVector argv; + argv.push_back(command_line->GetProgram().value()); + command_line->InitFromArgv(argv); + + const CommandLine::SwitchMap& map = command_line->GetSwitches(); + const_cast(&map)->clear(); + } + + if (settings.single_process) + command_line->AppendSwitch(switches::kSingleProcess); + + if (settings.browser_subprocess_path.length > 0) { + FilePath file_path = + FilePath(CefString(&settings.browser_subprocess_path)); + if (!file_path.empty()) { + command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, + file_path); + } + } + + if (settings.user_agent.length > 0) { + command_line->AppendSwitchASCII(switches::kUserAgent, + CefString(&settings.user_agent)); + } else if (settings.product_version.length > 0) { + command_line->AppendSwitchASCII(switches::kProductVersion, + CefString(&settings.product_version)); + } + + if (settings.locale.length > 0) { + command_line->AppendSwitchASCII(switches::kLocale, + CefString(&settings.locale)); + } + + if (settings.log_file.length > 0) { + FilePath file_path = FilePath(CefString(&settings.log_file)); + if (!file_path.empty()) + command_line->AppendSwitchPath(switches::kLogFile, file_path); + } + + if (settings.log_severity != LOGSEVERITY_DEFAULT) { + std::string log_severity; + switch (settings.log_severity) { + case LOGSEVERITY_VERBOSE: + log_severity = switches::kLogSeverity_Verbose; + break; + case LOGSEVERITY_INFO: + log_severity = switches::kLogSeverity_Info; + break; + case LOGSEVERITY_WARNING: + log_severity = switches::kLogSeverity_Warning; + break; + case LOGSEVERITY_ERROR: + log_severity = switches::kLogSeverity_Error; + break; + case LOGSEVERITY_ERROR_REPORT: + log_severity = switches::kLogSeverity_ErrorReport; + break; + case LOGSEVERITY_DISABLE: + log_severity = switches::kLogSeverity_Disable; + break; + default: + break; + } + if (!log_severity.empty()) + command_line->AppendSwitchASCII(switches::kLogSeverity, log_severity); + } + + if (settings.javascript_flags.length > 0) { + command_line->AppendSwitchASCII(switches::kJavaScriptFlags, + CefString(&settings.javascript_flags)); + } + + if (settings.pack_loading_disabled) { + command_line->AppendSwitch(switches::kPackLoadingDisabled); + } else { + if (settings.pack_file_path.length > 0) { + FilePath file_path = FilePath(CefString(&settings.pack_file_path)); + if (!file_path.empty()) + command_line->AppendSwitchPath(switches::kPackFilePath, file_path); + } + + if (settings.locales_dir_path.length > 0) { + FilePath file_path = FilePath(CefString(&settings.locales_dir_path)); + if (!file_path.empty()) + command_line->AppendSwitchPath(switches::kLocalesDirPath, file_path); + } + } + + if (settings.remote_debugging_port >= 1024 && + settings.remote_debugging_port <= 65535) { + command_line->AppendSwitchASCII(switches::kRemoteDebuggingPort, + base::IntToString(settings.remote_debugging_port)); + } + + // TODO(cef): Figure out how to support the sandbox. + if (!command_line->HasSwitch(switches::kNoSandbox)) + command_line->AppendSwitch(switches::kNoSandbox); + } + + if (content_client_.application().get()) { + // Give the application a chance to view/modify the command line. + CefRefPtr commandLinePtr( + new CefCommandLineImpl(command_line, false, false)); + content_client_.application()->OnBeforeCommandLineProcessing( + CefString(process_type), commandLinePtr.get()); + commandLinePtr->Detach(NULL); + } + + // Initialize logging. + FilePath log_file = command_line->GetSwitchValuePath(switches::kLogFile); + std::string log_severity_str = + command_line->GetSwitchValueASCII(switches::kLogSeverity); + + logging::LogSeverity log_severity = logging::LOG_INFO; + if (!log_severity_str.empty()) { + if (LowerCaseEqualsASCII(log_severity_str, + switches::kLogSeverity_Verbose)) { + log_severity = logging::LOG_VERBOSE; + } else if (LowerCaseEqualsASCII(log_severity_str, + switches::kLogSeverity_Warning)) { + log_severity = logging::LOG_WARNING; + } else if (LowerCaseEqualsASCII(log_severity_str, + switches::kLogSeverity_Error)) { + log_severity = logging::LOG_ERROR; + } else if (LowerCaseEqualsASCII(log_severity_str, + switches::kLogSeverity_ErrorReport)) { + log_severity = logging::LOG_ERROR_REPORT; + } else if (LowerCaseEqualsASCII(log_severity_str, + switches::kLogSeverity_Disable)) { + log_severity = LOGSEVERITY_DISABLE; + } + } + + logging::LoggingDestination logging_dest; + if (log_severity == LOGSEVERITY_DISABLE) { + logging_dest = logging::LOG_NONE; + } else { +#if defined(OS_WIN) + logging_dest = logging::LOG_ONLY_TO_FILE; +#else + logging_dest = logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG; +#endif + logging::SetMinLogLevel(log_severity); + } + + logging::InitLogging(log_file.value().c_str(), logging_dest, + logging::DONT_LOCK_LOG_FILE, logging::APPEND_TO_OLD_LOG_FILE, + logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + + content::SetContentClient(&content_client_); + + return false; +} + +void CefMainDelegate::PreSandboxStartup() { +#if defined(OS_MACOSX) + OverrideChildProcessPath(); +#endif + + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + if (command_line.HasSwitch(switches::kPackLoadingDisabled)) + content_client_.set_pack_loading_disabled(true); + + InitializeResourceBundle(); +} + +int CefMainDelegate::RunProcess( + const std::string& process_type, + const content::MainFunctionParams& main_function_params) { + if (process_type.empty()) { + const CefSettings& settings = _Context->settings(); + if (!settings.multi_threaded_message_loop) { + // Use our own browser process runner. + browser_runner_.reset(content::BrowserMainRunner::Create()); + + // Initialize browser process state. Results in a call to + // CefBrowserMain::PreMainMessageLoopStart() which creates the UI message + // loop. + int exit_code = browser_runner_->Initialize(main_function_params); + if (exit_code >= 0) + return exit_code; + } else { + // Run the UI on a separate thread. + scoped_ptr thread; + thread.reset(new CefUIThread(main_function_params)); + base::Thread::Options options; + options.message_loop_type = MessageLoop::TYPE_UI; + if (!thread->StartWithOptions(options)) { + NOTREACHED() << "failed to start UI thread"; + return 1; + } + ui_thread_.swap(thread); + } + + return 0; + } + + return -1; +} + +void CefMainDelegate::ProcessExiting(const std::string& process_type) { + ResourceBundle::CleanupSharedInstance(); +} + + +content::ContentBrowserClient* CefMainDelegate::CreateContentBrowserClient() { + browser_client_.reset(new CefContentBrowserClient); + return browser_client_.get(); +} + +content::ContentRendererClient* + CefMainDelegate::CreateContentRendererClient() { + renderer_client_.reset(new CefContentRendererClient); + return renderer_client_.get(); +} + +void CefMainDelegate::ShutdownBrowser() { + if (browser_runner_.get()) { + browser_runner_->Shutdown(); + browser_runner_.reset(NULL); + } + if (ui_thread_.get()) { + // Blocks until the thread has stopped. + ui_thread_->Stop(); + ui_thread_.reset(); + } +} + +void CefMainDelegate::InitializeResourceBundle() { + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + FilePath pak_file, locales_dir; + + if (!content_client_.pack_loading_disabled()) { + if (command_line.HasSwitch(switches::kPackFilePath)) + pak_file = command_line.GetSwitchValuePath(switches::kPackFilePath); + + if (pak_file.empty()) + pak_file = GetDefaultPackPath().Append(FILE_PATH_LITERAL("cef.pak")); + + if (command_line.HasSwitch(switches::kLocalesDirPath)) + locales_dir = command_line.GetSwitchValuePath(switches::kLocalesDirPath); + + if (!locales_dir.empty()) + PathService::Override(ui::DIR_LOCALES, locales_dir); + } + + std::string locale = command_line.GetSwitchValueASCII(switches::kLocale); + if (locale.empty()) + locale = "en-US"; + + const std::string loaded_locale = + ui::ResourceBundle::InitSharedInstanceWithLocale(locale, + &content_client_); + if (!content_client_.pack_loading_disabled()) { + CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale; + + if (file_util::PathExists(pak_file)) { + content_client_.set_allow_pack_file_load(true); + ResourceBundle::GetSharedInstance().AddDataPack( + pak_file, ui::SCALE_FACTOR_NONE); + content_client_.set_allow_pack_file_load(false); + } else { + NOTREACHED() << "Could not load cef.pak"; + } + } +} diff --git a/libcef/common/main_delegate.h b/libcef/common/main_delegate.h new file mode 100644 index 000000000..d532b69b5 --- /dev/null +++ b/libcef/common/main_delegate.h @@ -0,0 +1,66 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_MAIN_DELEGATE_H_ +#define CEF_LIBCEF_COMMON_MAIN_DELEGATE_H_ +#pragma once + +#include + +#include "libcef/common/content_client.h" +#include "include/cef_app.h" + +#include "base/compiler_specific.h" +#include "base/memory/scoped_ptr.h" +#include "content/public/app/content_main_delegate.h" + +namespace base { +class Thread; +} + +namespace content { +class BrowserMainRunner; +} + +class CefContentBrowserClient; +class CefContentRendererClient; +class CefContentPluginClient; +class CefContentUtilityClient; +class MessageLoop; + +class CefMainDelegate : public content::ContentMainDelegate { + public: + explicit CefMainDelegate(CefRefPtr application); + virtual ~CefMainDelegate(); + + virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; + virtual void PreSandboxStartup() OVERRIDE; + virtual int RunProcess( + const std::string& process_type, + const content::MainFunctionParams& main_function_params) OVERRIDE; + virtual void ProcessExiting(const std::string& process_type) OVERRIDE; + virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; + virtual content::ContentRendererClient* + CreateContentRendererClient() OVERRIDE; + + // Shut down the browser runner. + void ShutdownBrowser(); + + CefContentBrowserClient* browser_client() { return browser_client_.get(); } + CefContentClient* content_client() { return &content_client_; } + + private: + void InitializeResourceBundle(); + + scoped_ptr browser_runner_; + scoped_ptr ui_thread_; + + scoped_ptr browser_client_; + scoped_ptr renderer_client_; + CefContentClient content_client_; + + DISALLOW_COPY_AND_ASSIGN(CefMainDelegate); +}; + +#endif // CEF_LIBCEF_COMMON_MAIN_DELEGATE_H_ diff --git a/libcef/common/process_message_impl.cc b/libcef/common/process_message_impl.cc new file mode 100644 index 000000000..e6dabd87e --- /dev/null +++ b/libcef/common/process_message_impl.cc @@ -0,0 +1,76 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/common/process_message_impl.h" +#include "libcef/common/cef_messages.h" +#include "libcef/common/values_impl.h" + +#include "base/logging.h" + +namespace { + +void CopyList(const base::ListValue& source, + base::ListValue& target) { + base::ListValue::const_iterator it = source.begin(); + for (; it != source.end(); ++it) + target.Append((*it)->DeepCopy()); +} + +void CopyValue(const Cef_Request_Params& source, + Cef_Request_Params& target) { + target.name = source.name; + CopyList(source.arguments, target.arguments); +} + +} // namespace + +// static +CefRefPtr CefProcessMessage::Create(const CefString& name) { + Cef_Request_Params* params = new Cef_Request_Params(); + params->name = name; + return new CefProcessMessageImpl(params, true, false); +} + +CefProcessMessageImpl::CefProcessMessageImpl(Cef_Request_Params* value, + bool will_delete, + bool read_only) + : CefValueBase( + value, NULL, will_delete ? kOwnerWillDelete : kOwnerNoDelete, + read_only, NULL) { +} + +bool CefProcessMessageImpl::CopyTo(Cef_Request_Params& target) { + CEF_VALUE_VERIFY_RETURN(false, false); + CopyValue(const_value(), target); + return true; +} + +bool CefProcessMessageImpl::IsValid() { + return !detached(); +} + +bool CefProcessMessageImpl::IsReadOnly() { + return read_only(); +} + +CefRefPtr CefProcessMessageImpl::Copy() { + CEF_VALUE_VERIFY_RETURN(false, NULL); + Cef_Request_Params* params = new Cef_Request_Params(); + CopyValue(const_value(), *params); + return new CefProcessMessageImpl(params, true, false); +} + +CefString CefProcessMessageImpl::GetName() { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + return const_value().name; +} + +CefRefPtr CefProcessMessageImpl::GetArgumentList() { + CEF_VALUE_VERIFY_RETURN(false, NULL); + return CefListValueImpl::GetOrCreateRef( + const_cast(&(const_value().arguments)), + const_cast(&const_value()), + read_only(), + controller()); +} diff --git a/libcef/common/process_message_impl.h b/libcef/common/process_message_impl.h new file mode 100644 index 000000000..28e078a90 --- /dev/null +++ b/libcef/common/process_message_impl.h @@ -0,0 +1,35 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_PROCESS_MESSAGE_IMPL_H_ +#define CEF_LIBCEF_COMMON_PROCESS_MESSAGE_IMPL_H_ +#pragma once + +#include "include/cef_process_message.h" +#include "libcef/common/value_base.h" + +struct Cef_Request_Params; + +// CefProcessMessage implementation +class CefProcessMessageImpl + : public CefValueBase { + public: + CefProcessMessageImpl(Cef_Request_Params* value, + bool will_delete, + bool read_only); + + // Copies the underlying value to the specified |target| structure. + bool CopyTo(Cef_Request_Params& target); + + // CefProcessMessage methods. + virtual bool IsValid() OVERRIDE; + virtual bool IsReadOnly() OVERRIDE; + virtual CefRefPtr Copy() OVERRIDE; + virtual CefString GetName() OVERRIDE; + virtual CefRefPtr GetArgumentList() OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(CefProcessMessageImpl); +}; + +#endif // CEF_LIBCEF_COMMON_PROCESS_MESSAGE_IMPL_H_ diff --git a/libcef/common/request_impl.cc b/libcef/common/request_impl.cc new file mode 100644 index 000000000..830524105 --- /dev/null +++ b/libcef/common/request_impl.cc @@ -0,0 +1,653 @@ +// Copyright (c) 2008-2009 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include +#include + +#include "libcef/common/http_header_utils.h" +#include "libcef/common/request_impl.h" + +#include "base/logging.h" +#include "net/url_request/url_request.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.h" + + +#define CHECK_READONLY_RETURN(val) \ + if (read_only_) { \ + NOTREACHED() << "object is read only"; \ + return val; \ + } + +#define CHECK_READONLY_RETURN_VOID() \ + if (read_only_) { \ + NOTREACHED() << "object is read only"; \ + return; \ + } + + +// CefRequest ----------------------------------------------------------------- + +// static +CefRefPtr CefRequest::Create() { + CefRefPtr request(new CefRequestImpl()); + return request; +} + + +// CefRequestImpl ------------------------------------------------------------- + +CefRequestImpl::CefRequestImpl() + : method_("GET"), + flags_(UR_FLAG_NONE), + read_only_(false) { +} + +bool CefRequestImpl::IsReadOnly() { + AutoLock lock_scope(this); + return read_only_; +} + +CefString CefRequestImpl::GetURL() { + AutoLock lock_scope(this); + return url_; +} + +void CefRequestImpl::SetURL(const CefString& url) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + url_ = url; +} + +CefString CefRequestImpl::GetMethod() { + AutoLock lock_scope(this); + return method_; +} + +void CefRequestImpl::SetMethod(const CefString& method) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + method_ = method; +} + +CefRefPtr CefRequestImpl::GetPostData() { + AutoLock lock_scope(this); + return postdata_; +} + +void CefRequestImpl::SetPostData(CefRefPtr postData) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + postdata_ = postData; +} + +void CefRequestImpl::GetHeaderMap(HeaderMap& headerMap) { + AutoLock lock_scope(this); + headerMap = headermap_; +} + +void CefRequestImpl::SetHeaderMap(const HeaderMap& headerMap) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + headermap_ = headerMap; +} + +void CefRequestImpl::Set(const CefString& url, + const CefString& method, + CefRefPtr postData, + const HeaderMap& headerMap) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + url_ = url; + method_ = method; + postdata_ = postData; + headermap_ = headerMap; +} + +int CefRequestImpl::GetFlags() { + AutoLock lock_scope(this); + return flags_; +} +void CefRequestImpl::SetFlags(int flags) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + flags_ = flags; +} + +CefString CefRequestImpl::GetFirstPartyForCookies() { + AutoLock lock_scope(this); + return first_party_for_cookies_; +} +void CefRequestImpl::SetFirstPartyForCookies(const CefString& url) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + first_party_for_cookies_ = url; +} + +void CefRequestImpl::Set(net::URLRequest* request) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + + url_ = request->url().spec(); + method_ = request->method(); + first_party_for_cookies_ = request->first_party_for_cookies().spec(); + + net::HttpRequestHeaders headers = request->extra_request_headers(); + + // Ensure that we do not send username and password fields in the referrer. + GURL referrer(request->GetSanitizedReferrer()); + + // Strip Referer from request_info_.extra_headers to prevent, e.g., plugins + // from overriding headers that are controlled using other means. Otherwise a + // plugin could set a referrer although sending the referrer is inhibited. + headers.RemoveHeader(net::HttpRequestHeaders::kReferer); + + // Our consumer should have made sure that this is a safe referrer. See for + // instance WebCore::FrameLoader::HideReferrer. + if (referrer.is_valid()) + headers.SetHeader(net::HttpRequestHeaders::kReferer, referrer.spec()); + + // Transfer request headers + GetHeaderMap(headers, headermap_); + + // Transfer post data, if any + net::UploadData* data = request->get_upload(); + if (data) { + postdata_ = CefPostData::Create(); + static_cast(postdata_.get())->Set(*data); + } else if (postdata_.get()) { + postdata_ = NULL; + } +} + +void CefRequestImpl::Get(net::URLRequest* request) { + AutoLock lock_scope(this); + + request->set_method(method_); + if (!first_party_for_cookies_.empty()) { + request->set_first_party_for_cookies( + GURL(std::string(first_party_for_cookies_))); + } + + CefString referrerStr; + referrerStr.FromASCII(net::HttpRequestHeaders::kReferer); + HeaderMap headerMap = headermap_; + HeaderMap::iterator it = headerMap.find(referrerStr); + if (it == headerMap.end()) { + request->set_referrer(""); + } else { + request->set_referrer(it->second); + headerMap.erase(it); + } + net::HttpRequestHeaders headers; + headers.AddHeadersFromString(HttpHeaderUtils::GenerateHeaders(headerMap)); + request->SetExtraRequestHeaders(headers); + + if (postdata_.get()) { + net::UploadData* upload = new net::UploadData(); + static_cast(postdata_.get())->Get(*upload); + request->set_upload(upload); + } else if (request->get_upload()) { + request->set_upload(NULL); + } +} + +void CefRequestImpl::Set(const WebKit::WebURLRequest& request) { + DCHECK(!request.isNull()); + + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + + url_ = request.url().spec().utf16(); + method_ = request.httpMethod(); + + const WebKit::WebHTTPBody& body = request.httpBody(); + if (!body.isNull()) { + postdata_ = new CefPostDataImpl(); + static_cast(postdata_.get())->Set(body); + } else if (postdata_.get()) { + postdata_ = NULL; + } + + headermap_.clear(); + GetHeaderMap(request, headermap_); + + flags_ = UR_FLAG_NONE; + if (request.cachePolicy() == WebKit::WebURLRequest::ReloadIgnoringCacheData) + flags_ |= UR_FLAG_SKIP_CACHE; + if (request.allowStoredCredentials()) + flags_ |= UR_FLAG_ALLOW_CACHED_CREDENTIALS; + if (request.allowCookies()) + flags_ |= UR_FLAG_ALLOW_COOKIES; + if (request.reportUploadProgress()) + flags_ |= UR_FLAG_REPORT_UPLOAD_PROGRESS; + if (request.reportLoadTiming()) + flags_ |= UR_FLAG_REPORT_LOAD_TIMING; + if (request.reportRawHeaders()) + flags_ |= UR_FLAG_REPORT_RAW_HEADERS; + + first_party_for_cookies_ = request.firstPartyForCookies().spec().utf16(); +} + +void CefRequestImpl::Get(WebKit::WebURLRequest& request) { + request.initialize(); + AutoLock lock_scope(this); + + GURL gurl = GURL(url_.ToString()); + request.setURL(WebKit::WebURL(gurl)); + + std::string method(method_); + request.setHTTPMethod(WebKit::WebString::fromUTF8(method.c_str())); + request.setTargetType(WebKit::WebURLRequest::TargetIsMainFrame); + + WebKit::WebHTTPBody body; + if (postdata_.get()) { + body.initialize(); + static_cast(postdata_.get())->Get(body); + request.setHTTPBody(body); + } + + SetHeaderMap(headermap_, request); + + request.setCachePolicy((flags_ & UR_FLAG_SKIP_CACHE) ? + WebKit::WebURLRequest::ReloadIgnoringCacheData : + WebKit::WebURLRequest::UseProtocolCachePolicy); + + #define SETBOOLFLAG(obj, flags, method, FLAG) \ + obj.method((flags & (FLAG)) == (FLAG)) + + SETBOOLFLAG(request, flags_, setAllowStoredCredentials, + UR_FLAG_ALLOW_CACHED_CREDENTIALS); + SETBOOLFLAG(request, flags_, setAllowCookies, + UR_FLAG_ALLOW_COOKIES); + SETBOOLFLAG(request, flags_, setReportUploadProgress, + UR_FLAG_REPORT_UPLOAD_PROGRESS); + SETBOOLFLAG(request, flags_, setReportLoadTiming, + UR_FLAG_REPORT_LOAD_TIMING); + SETBOOLFLAG(request, flags_, setReportRawHeaders, + UR_FLAG_REPORT_RAW_HEADERS); + + if (!first_party_for_cookies_.empty()) { + GURL gurl = GURL(first_party_for_cookies_.ToString()); + request.setFirstPartyForCookies(WebKit::WebURL(gurl)); + } +} + +void CefRequestImpl::SetReadOnly(bool read_only) { + AutoLock lock_scope(this); + if (read_only_ == read_only) + return; + + read_only_ = read_only; + + if (postdata_.get()) + static_cast(postdata_.get())->SetReadOnly(read_only); +} + +// static +void CefRequestImpl::GetHeaderMap(const net::HttpRequestHeaders& headers, + HeaderMap& map) { + if (headers.IsEmpty()) + return; + + net::HttpRequestHeaders::Iterator it(headers); + do { + map.insert(std::make_pair(it.name(), it.value())); + } while (it.GetNext()); +} + + +// static +void CefRequestImpl::GetHeaderMap(const WebKit::WebURLRequest& request, + HeaderMap& map) { + class HeaderVisitor : public WebKit::WebHTTPHeaderVisitor { + public: + explicit HeaderVisitor(HeaderMap* map) : map_(map) {} + + virtual void visitHeader(const WebKit::WebString& name, + const WebKit::WebString& value) { + map_->insert(std::make_pair(string16(name), string16(value))); + } + + private: + HeaderMap* map_; + }; + + HeaderVisitor visitor(&map); + request.visitHTTPHeaderFields(&visitor); +} + +// static +void CefRequestImpl::SetHeaderMap(const HeaderMap& map, + WebKit::WebURLRequest& request) { + HeaderMap::const_iterator it = map.begin(); + for (; it != map.end(); ++it) + request.setHTTPHeaderField(string16(it->first), string16(it->second)); +} + +// CefPostData ---------------------------------------------------------------- + +// static +CefRefPtr CefPostData::Create() { + CefRefPtr postdata(new CefPostDataImpl()); + return postdata; +} + + +// CefPostDataImpl ------------------------------------------------------------ + +CefPostDataImpl::CefPostDataImpl() + : read_only_(false) { +} + +bool CefPostDataImpl::IsReadOnly() { + AutoLock lock_scope(this); + return read_only_; +} + +size_t CefPostDataImpl::GetElementCount() { + AutoLock lock_scope(this); + return elements_.size(); +} + +void CefPostDataImpl::GetElements(ElementVector& elements) { + AutoLock lock_scope(this); + elements = elements_; +} + +bool CefPostDataImpl::RemoveElement(CefRefPtr element) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN(false); + + ElementVector::iterator it = elements_.begin(); + for (; it != elements_.end(); ++it) { + if (it->get() == element.get()) { + elements_.erase(it); + return true; + } + } + + return false; +} + +bool CefPostDataImpl::AddElement(CefRefPtr element) { + bool found = false; + + AutoLock lock_scope(this); + CHECK_READONLY_RETURN(false); + + // check that the element isn't already in the list before adding + ElementVector::const_iterator it = elements_.begin(); + for (; it != elements_.end(); ++it) { + if (it->get() == element.get()) { + found = true; + break; + } + } + + if (!found) + elements_.push_back(element); + + return !found; +} + +void CefPostDataImpl::RemoveElements() { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + elements_.clear(); +} + +void CefPostDataImpl::Set(net::UploadData& data) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + + CefRefPtr postelem; + + std::vector* elements = data.elements(); + std::vector::const_iterator it = elements->begin(); + for (; it != elements->end(); ++it) { + postelem = CefPostDataElement::Create(); + static_cast(postelem.get())->Set(*it); + AddElement(postelem); + } +} + +void CefPostDataImpl::Get(net::UploadData& data) { + AutoLock lock_scope(this); + + net::UploadData::Element element; + std::vector data_elements; + ElementVector::const_iterator it = elements_.begin(); + for (; it != elements_.end(); ++it) { + static_cast(it->get())->Get(element); + data_elements.push_back(element); + } + data.SetElements(data_elements); +} + +void CefPostDataImpl::Set(const WebKit::WebHTTPBody& data) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + + CefRefPtr postelem; + WebKit::WebHTTPBody::Element element; + size_t size = data.elementCount(); + for (size_t i = 0; i < size; ++i) { + if (data.elementAt(i, element)) { + postelem = CefPostDataElement::Create(); + static_cast(postelem.get())->Set(element); + AddElement(postelem); + } + } +} + +void CefPostDataImpl::Get(WebKit::WebHTTPBody& data) { + AutoLock lock_scope(this); + + WebKit::WebHTTPBody::Element element; + ElementVector::iterator it = elements_.begin(); + for (; it != elements_.end(); ++it) { + static_cast(it->get())->Get(element); + if (element.type == WebKit::WebHTTPBody::Element::TypeData) { + data.appendData(element.data); + } else if (element.type == WebKit::WebHTTPBody::Element::TypeFile) { + data.appendFile(element.filePath); + } else { + NOTREACHED(); + } + } +} + +void CefPostDataImpl::SetReadOnly(bool read_only) { + AutoLock lock_scope(this); + if (read_only_ == read_only) + return; + + read_only_ = read_only; + + ElementVector::const_iterator it = elements_.begin(); + for (; it != elements_.end(); ++it) { + static_cast(it->get())->SetReadOnly(read_only); + } +} + +// CefPostDataElement --------------------------------------------------------- + +// static +CefRefPtr CefPostDataElement::Create() { + CefRefPtr element(new CefPostDataElementImpl()); + return element; +} + + +// CefPostDataElementImpl ----------------------------------------------------- + +CefPostDataElementImpl::CefPostDataElementImpl() + : type_(PDE_TYPE_EMPTY), + read_only_(false) { + memset(&data_, 0, sizeof(data_)); +} + +CefPostDataElementImpl::~CefPostDataElementImpl() { + Cleanup(); +} + +bool CefPostDataElementImpl::IsReadOnly() { + AutoLock lock_scope(this); + return read_only_; +} + +void CefPostDataElementImpl::SetToEmpty() { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + + Cleanup(); +} + +void CefPostDataElementImpl::SetToFile(const CefString& fileName) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + + // Clear any data currently in the element + SetToEmpty(); + + // Assign the new data + type_ = PDE_TYPE_FILE; + cef_string_copy(fileName.c_str(), fileName.length(), &data_.filename); +} + +void CefPostDataElementImpl::SetToBytes(size_t size, const void* bytes) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + + // Clear any data currently in the element + SetToEmpty(); + + // Assign the new data + void* data = malloc(size); + DCHECK(data != NULL); + if (data == NULL) + return; + + memcpy(data, bytes, size); + + type_ = PDE_TYPE_BYTES; + data_.bytes.bytes = data; + data_.bytes.size = size; +} + +CefPostDataElement::Type CefPostDataElementImpl::GetType() { + AutoLock lock_scope(this); + return type_; +} + +CefString CefPostDataElementImpl::GetFile() { + AutoLock lock_scope(this); + DCHECK(type_ == PDE_TYPE_FILE); + CefString filename; + if (type_ == PDE_TYPE_FILE) + filename.FromString(data_.filename.str, data_.filename.length, false); + return filename; +} + +size_t CefPostDataElementImpl::GetBytesCount() { + AutoLock lock_scope(this); + DCHECK(type_ == PDE_TYPE_BYTES); + size_t size = 0; + if (type_ == PDE_TYPE_BYTES) + size = data_.bytes.size; + return size; +} + +size_t CefPostDataElementImpl::GetBytes(size_t size, void* bytes) { + AutoLock lock_scope(this); + DCHECK(type_ == PDE_TYPE_BYTES); + size_t rv = 0; + if (type_ == PDE_TYPE_BYTES) { + rv = (size < data_.bytes.size ? size : data_.bytes.size); + memcpy(bytes, data_.bytes.bytes, rv); + } + return rv; +} + +void CefPostDataElementImpl::Set(const net::UploadData::Element& element) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + + if (element.type() == net::UploadData::TYPE_BYTES) { + SetToBytes(element.bytes().size(), + static_cast( + std::string(element.bytes().begin(), + element.bytes().end()).c_str())); + } else if (element.type() == net::UploadData::TYPE_FILE) { + SetToFile(element.file_path().value()); + } else { + NOTREACHED(); + } +} + +void CefPostDataElementImpl::Get(net::UploadData::Element& element) { + AutoLock lock_scope(this); + + if (type_ == PDE_TYPE_BYTES) { + element.SetToBytes(static_cast(data_.bytes.bytes), data_.bytes.size); + } else if (type_ == PDE_TYPE_FILE) { + FilePath path = FilePath(CefString(&data_.filename)); + element.SetToFilePath(path); + } else { + NOTREACHED(); + } +} + +void CefPostDataElementImpl::Set(const WebKit::WebHTTPBody::Element& element) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + + if (element.type == WebKit::WebHTTPBody::Element::TypeData) { + SetToBytes(element.data.size(), + static_cast(element.data.data())); + } else if (element.type == WebKit::WebHTTPBody::Element::TypeFile) { + SetToFile(string16(element.filePath)); + } else { + NOTREACHED(); + } +} + +void CefPostDataElementImpl::Get(WebKit::WebHTTPBody::Element& element) { + AutoLock lock_scope(this); + + if (type_ == PDE_TYPE_BYTES) { + element.type = WebKit::WebHTTPBody::Element::TypeData; + element.data.assign( + static_cast(data_.bytes.bytes), data_.bytes.size); + } else if (type_ == PDE_TYPE_FILE) { + element.type = WebKit::WebHTTPBody::Element::TypeFile; + element.filePath.assign(string16(CefString(&data_.filename))); + } else { + NOTREACHED(); + } +} + +void CefPostDataElementImpl::SetReadOnly(bool read_only) { + AutoLock lock_scope(this); + if (read_only_ == read_only) + return; + + read_only_ = read_only; +} + +void CefPostDataElementImpl::Cleanup() { + if (type_ == PDE_TYPE_EMPTY) + return; + + if (type_ == PDE_TYPE_BYTES) + free(data_.bytes.bytes); + else if (type_ == PDE_TYPE_FILE) + cef_string_clear(&data_.filename); + type_ = PDE_TYPE_EMPTY; + memset(&data_, 0, sizeof(data_)); +} diff --git a/libcef/common/request_impl.h b/libcef/common/request_impl.h new file mode 100644 index 000000000..64295f8f4 --- /dev/null +++ b/libcef/common/request_impl.h @@ -0,0 +1,157 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_REQUEST_IMPL_H_ +#define CEF_LIBCEF_COMMON_REQUEST_IMPL_H_ +#pragma once + +#include "include/cef_request.h" +#include "net/base/upload_data.h" +#include "net/http/http_request_headers.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPBody.h" + +namespace net { +class URLRequest; +}; + +namespace WebKit { +class WebURLRequest; +} + +// Implementation of CefRequest +class CefRequestImpl : public CefRequest { + public: + CefRequestImpl(); + ~CefRequestImpl() {} + + virtual bool IsReadOnly() OVERRIDE; + virtual CefString GetURL() OVERRIDE; + virtual void SetURL(const CefString& url) OVERRIDE; + virtual CefString GetMethod() OVERRIDE; + virtual void SetMethod(const CefString& method) OVERRIDE; + virtual CefRefPtr GetPostData() OVERRIDE; + virtual void SetPostData(CefRefPtr postData) OVERRIDE; + virtual void GetHeaderMap(HeaderMap& headerMap) OVERRIDE; + virtual void SetHeaderMap(const HeaderMap& headerMap) OVERRIDE; + virtual void Set(const CefString& url, + const CefString& method, + CefRefPtr postData, + const HeaderMap& headerMap) OVERRIDE; + virtual int GetFlags() OVERRIDE; + virtual void SetFlags(int flags) OVERRIDE; + virtual CefString GetFirstPartyForCookies() OVERRIDE; + virtual void SetFirstPartyForCookies(const CefString& url) OVERRIDE; + + // Populate this object from the URLRequest object. + void Set(net::URLRequest* request); + + // Populate the URLRequest object from this object. + void Get(net::URLRequest* request); + + // Populate this object from a WebURLRequest object. + void Set(const WebKit::WebURLRequest& request); + + // Populate the WebURLRequest object from this object. + void Get(WebKit::WebURLRequest& request); + + void SetReadOnly(bool read_only); + + static void GetHeaderMap(const net::HttpRequestHeaders& headers, + HeaderMap& map); + static void GetHeaderMap(const WebKit::WebURLRequest& request, + HeaderMap& map); + static void SetHeaderMap(const HeaderMap& map, + WebKit::WebURLRequest& request); + + protected: + CefString url_; + CefString method_; + CefRefPtr postdata_; + HeaderMap headermap_; + + // The below members are used by CefURLRequest. + int flags_; + CefString first_party_for_cookies_; + + // True if this object is read-only. + bool read_only_; + + IMPLEMENT_REFCOUNTING(CefRequestImpl); + IMPLEMENT_LOCKING(CefRequestImpl); +}; + +// Implementation of CefPostData +class CefPostDataImpl : public CefPostData { + public: + CefPostDataImpl(); + ~CefPostDataImpl() {} + + virtual bool IsReadOnly() OVERRIDE; + virtual size_t GetElementCount() OVERRIDE; + virtual void GetElements(ElementVector& elements) OVERRIDE; + virtual bool RemoveElement(CefRefPtr element) OVERRIDE; + virtual bool AddElement(CefRefPtr element) OVERRIDE; + virtual void RemoveElements(); + + void Set(net::UploadData& data); + void Get(net::UploadData& data); + void Set(const WebKit::WebHTTPBody& data); + void Get(WebKit::WebHTTPBody& data); + + void SetReadOnly(bool read_only); + + protected: + ElementVector elements_; + + // True if this object is read-only. + bool read_only_; + + IMPLEMENT_REFCOUNTING(CefPostDataImpl); + IMPLEMENT_LOCKING(CefPostDataImpl); +}; + +// Implementation of CefPostDataElement +class CefPostDataElementImpl : public CefPostDataElement { + public: + CefPostDataElementImpl(); + ~CefPostDataElementImpl(); + + virtual bool IsReadOnly() OVERRIDE; + virtual void SetToEmpty() OVERRIDE; + virtual void SetToFile(const CefString& fileName) OVERRIDE; + virtual void SetToBytes(size_t size, const void* bytes) OVERRIDE; + virtual Type GetType() OVERRIDE; + virtual CefString GetFile() OVERRIDE; + virtual size_t GetBytesCount() OVERRIDE; + virtual size_t GetBytes(size_t size, void* bytes) OVERRIDE; + + void* GetBytes() { return data_.bytes.bytes; } + + void Set(const net::UploadData::Element& element); + void Get(net::UploadData::Element& element); + void Set(const WebKit::WebHTTPBody::Element& element); + void Get(WebKit::WebHTTPBody::Element& element); + + void SetReadOnly(bool read_only); + + protected: + void Cleanup(); + + Type type_; + union { + struct { + void* bytes; + size_t size; + } bytes; + cef_string_t filename; + } data_; + + // True if this object is read-only. + bool read_only_; + + IMPLEMENT_REFCOUNTING(CefPostDataElementImpl); + IMPLEMENT_LOCKING(CefPostDataElementImpl); +}; + +#endif // CEF_LIBCEF_COMMON_REQUEST_IMPL_H_ diff --git a/libcef/common/response_impl.cc b/libcef/common/response_impl.cc new file mode 100644 index 000000000..ce22b1dc3 --- /dev/null +++ b/libcef/common/response_impl.cc @@ -0,0 +1,204 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/common/response_impl.h" + +#include + +#include "base/logging.h" +#include "base/stringprintf.h" +#include "net/http/http_request_headers.h" +#include "net/http/http_response_headers.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLResponse.h" + + +#define CHECK_READONLY_RETURN_VOID() \ + if (read_only_) { \ + NOTREACHED() << "object is read only"; \ + return; \ + } + + +// CefResponse ---------------------------------------------------------------- + +// static +CefRefPtr CefResponse::Create() { + CefRefPtr response(new CefResponseImpl()); + return response; +} + + +// CefResponseImpl ------------------------------------------------------------ + +CefResponseImpl::CefResponseImpl() + : status_code_(0), + read_only_(false) { +} + +bool CefResponseImpl::IsReadOnly() { + AutoLock lock_scope(this); + return read_only_; +} + +int CefResponseImpl::GetStatus() { + AutoLock lock_scope(this); + return status_code_; +} + +void CefResponseImpl::SetStatus(int status) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + status_code_ = status; +} + +CefString CefResponseImpl::GetStatusText() { + AutoLock lock_scope(this); + return status_text_; +} + +void CefResponseImpl::SetStatusText(const CefString& statusText) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + status_text_ = statusText; +} + +CefString CefResponseImpl::GetMimeType() { + AutoLock lock_scope(this); + return mime_type_; +} + +void CefResponseImpl::SetMimeType(const CefString& mimeType) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + mime_type_ = mimeType; +} + +CefString CefResponseImpl::GetHeader(const CefString& name) { + AutoLock lock_scope(this); + + CefString value; + + HeaderMap::const_iterator it = header_map_.find(name); + if (it != header_map_.end()) + value = it->second; + + return value; +} + +void CefResponseImpl::GetHeaderMap(HeaderMap& map) { + AutoLock lock_scope(this); + map = header_map_; +} + +void CefResponseImpl::SetHeaderMap(const HeaderMap& headerMap) { + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + header_map_ = headerMap; +} + +net::HttpResponseHeaders* CefResponseImpl::GetResponseHeaders() { + AutoLock lock_scope(this); + + std::string response; + std::string status_text; + bool has_content_type_header = false; + + if (!status_text_.empty()) + status_text = status_text_; + else + status_text = (status_code_ == 200)?"OK":"ERROR"; + + base::SStringPrintf(&response, "HTTP/1.1 %d %s", status_code_, + status_text.c_str()); + if (header_map_.size() > 0) { + for (HeaderMap::const_iterator header = header_map_.begin(); + header != header_map_.end(); + ++header) { + const CefString& key = header->first; + const CefString& value = header->second; + + if (!key.empty()) { + // Delimit with "\0" as required by net::HttpResponseHeaders. + std::string key_str(key); + std::string value_str(value); + base::StringAppendF(&response, "%c%s: %s", '\0', key_str.c_str(), + value_str.c_str()); + + if (!has_content_type_header && + key_str == net::HttpRequestHeaders::kContentType) { + has_content_type_header = true; + } + } + } + } + + if (!has_content_type_header) { + std::string mime_type; + if (!mime_type_.empty()) + mime_type = mime_type_; + else + mime_type = "text/html"; + + base::StringAppendF(&response, "%c%s: %s", '\0', + net::HttpRequestHeaders::kContentType, mime_type.c_str()); + } + + return new net::HttpResponseHeaders(response); +} + +void CefResponseImpl::SetResponseHeaders( + const net::HttpResponseHeaders& headers) { + AutoLock lock_scope(this); + + header_map_.empty(); + + void* iter = NULL; + std::string name, value; + while (headers.EnumerateHeaderLines(&iter, &name, &value)) + header_map_.insert(std::make_pair(name, value)); + + status_code_ = headers.response_code(); + status_text_ = headers.GetStatusText(); + + std::string mime_type; + if (headers.GetMimeType(&mime_type)) + mime_type_ = mime_type; +} + +void CefResponseImpl::Set(const WebKit::WebURLResponse& response) { + DCHECK(!response.isNull()); + + AutoLock lock_scope(this); + CHECK_READONLY_RETURN_VOID(); + + WebKit::WebString str; + status_code_ = response.httpStatusCode(); + str = response.httpStatusText(); + status_text_ = CefString(str); + str = response.mimeType(); + mime_type_ = CefString(str); + + class HeaderVisitor : public WebKit::WebHTTPHeaderVisitor { + public: + explicit HeaderVisitor(HeaderMap* map) : map_(map) {} + + virtual void visitHeader(const WebKit::WebString& name, + const WebKit::WebString& value) { + map_->insert(std::make_pair(string16(name), string16(value))); + } + + private: + HeaderMap* map_; + }; + + HeaderVisitor visitor(&header_map_); + response.visitHTTPHeaderFields(&visitor); +} + +void CefResponseImpl::SetReadOnly(bool read_only) { + AutoLock lock_scope(this); + read_only_ = read_only; +} diff --git a/libcef/common/response_impl.h b/libcef/common/response_impl.h new file mode 100644 index 000000000..e14e0eecf --- /dev/null +++ b/libcef/common/response_impl.h @@ -0,0 +1,55 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_RESPONSE_IMPL_H_ +#define CEF_LIBCEF_COMMON_RESPONSE_IMPL_H_ +#pragma once + +#include "include/cef_response.h" + +namespace net { +class HttpResponseHeaders; +} + +namespace WebKit { +class WebURLResponse; +} + +// Implementation of CefResponse. +class CefResponseImpl : public CefResponse { + public: + CefResponseImpl(); + ~CefResponseImpl() {} + + // CefResponse methods. + virtual bool IsReadOnly() OVERRIDE; + virtual int GetStatus() OVERRIDE; + virtual void SetStatus(int status) OVERRIDE; + virtual CefString GetStatusText() OVERRIDE; + virtual void SetStatusText(const CefString& statusText) OVERRIDE; + virtual CefString GetMimeType() OVERRIDE; + virtual void SetMimeType(const CefString& mimeType) OVERRIDE; + virtual CefString GetHeader(const CefString& name) OVERRIDE; + virtual void GetHeaderMap(HeaderMap& headerMap) OVERRIDE; + virtual void SetHeaderMap(const HeaderMap& headerMap) OVERRIDE; + + net::HttpResponseHeaders* GetResponseHeaders(); + void SetResponseHeaders(const net::HttpResponseHeaders& headers); + + void Set(const WebKit::WebURLResponse& response); + + void SetReadOnly(bool read_only); + + protected: + int status_code_; + CefString status_text_; + CefString mime_type_; + HeaderMap header_map_; + bool read_only_; + + IMPLEMENT_REFCOUNTING(CefResponseImpl); + IMPLEMENT_LOCKING(CefResponseImpl); +}; + +#endif // CEF_LIBCEF_COMMON_RESPONSE_IMPL_H_ diff --git a/libcef/common/response_manager.cc b/libcef/common/response_manager.cc new file mode 100644 index 000000000..b6c5d14c8 --- /dev/null +++ b/libcef/common/response_manager.cc @@ -0,0 +1,54 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/common/response_manager.h" +#include "libcef/common/cef_messages.h" + +#include "base/logging.h" + +CefResponseManager::CefResponseManager() + : next_request_id_(0) { +} + +int CefResponseManager::GetNextRequestId() { + DCHECK(CalledOnValidThread()); + return ++next_request_id_; +} + +int CefResponseManager::RegisterHandler(CefRefPtr handler) { + DCHECK(CalledOnValidThread()); + int request_id = GetNextRequestId(); + handlers_.insert(std::make_pair(request_id, handler)); + return request_id; +} + +bool CefResponseManager::RunHandler(const Cef_Response_Params& params) { + DCHECK(CalledOnValidThread()); + DCHECK_GT(params.request_id, 0); + HandlerMap::iterator it = handlers_.find(params.request_id); + if (it != handlers_.end()) { + it->second->OnResponse(params); + handlers_.erase(it); + return true; + } + return false; +} + +void CefResponseManager::RegisterAckHandler(int request_id, + CefRefPtr handler) { + DCHECK(CalledOnValidThread()); + ack_handlers_.insert(std::make_pair(request_id, handler)); +} + +bool CefResponseManager::RunAckHandler(int request_id) { + DCHECK(CalledOnValidThread()); + DCHECK_GT(request_id, 0); + AckHandlerMap::iterator it = ack_handlers_.find(request_id); + if (it != ack_handlers_.end()) { + it->second->OnResponseAck(); + ack_handlers_.erase(it); + return true; + } + return false; +} diff --git a/libcef/common/response_manager.h b/libcef/common/response_manager.h new file mode 100644 index 000000000..ee383cc83 --- /dev/null +++ b/libcef/common/response_manager.h @@ -0,0 +1,62 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_RESPONSE_MANAGER_H_ +#define CEF_LIBCEF_COMMON_RESPONSE_MANAGER_H_ +#pragma once + +#include +#include "include/cef_base.h" +#include "base/threading/non_thread_safe.h" + +struct Cef_Response_Params; + +// This class is not thread-safe. +class CefResponseManager : base::NonThreadSafe { + public: + // Used for handling response messages. + class Handler : public virtual CefBase { + public: + virtual void OnResponse(const Cef_Response_Params& params) =0; + }; + + // Used for handling response ack messages. + class AckHandler : public virtual CefBase { + public: + virtual void OnResponseAck() =0; + }; + + CefResponseManager(); + + // Returns the next unique request id. + int GetNextRequestId(); + + // Register a response handler and return the unique request id. + int RegisterHandler(CefRefPtr handler); + + // Run the response handler for the specified request id. Returns true if a + // handler was run. + bool RunHandler(const Cef_Response_Params& params); + + // Register a response ack handler for the specified request id. + void RegisterAckHandler(int request_id, CefRefPtr handler); + + // Run the response ack handler for the specified request id. Returns true if + // a handler was run. + bool RunAckHandler(int request_id); + + private: + // Used for generating unique request ids. + int next_request_id_; + + // Map of unique request ids to Handler references. + typedef std::map > HandlerMap; + HandlerMap handlers_; + + // Map of unique request ids to AckHandler references. + typedef std::map > AckHandlerMap; + AckHandlerMap ack_handlers_; +}; + +#endif // CEF_LIBCEF_COMMON_RESPONSE_MANAGER_H_ diff --git a/libcef/common/scheme_registrar_impl.cc b/libcef/common/scheme_registrar_impl.cc new file mode 100644 index 000000000..280ab4b48 --- /dev/null +++ b/libcef/common/scheme_registrar_impl.cc @@ -0,0 +1,67 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/common/scheme_registrar_impl.h" + +#include + +#include "libcef/renderer/content_renderer_client.h" + +#include "base/bind.h" +#include "base/logging.h" + +CefSchemeRegistrarImpl::CefSchemeRegistrarImpl() + : supported_thread_id_(base::PlatformThread::CurrentId()) { +} + +bool CefSchemeRegistrarImpl::AddCustomScheme( + const CefString& scheme_name, + bool is_standard, + bool is_local, + bool is_display_isolated) { + if (!VerifyContext()) + return false; + + if (is_standard) + standard_schemes_.push_back(scheme_name); + + if (CefContentRendererClient::Get()) { + // Register the custom scheme with WebKit. + CefContentRendererClient::Get()->AddCustomScheme(scheme_name, is_local, + is_display_isolated); + } + + return true; +} + +void CefSchemeRegistrarImpl::GetStandardSchemes( + std::vector* standard_schemes) { + if (!VerifyContext()) + return; + + if (standard_schemes_.empty()) + return; + + standard_schemes->insert(standard_schemes->end(), standard_schemes_.begin(), + standard_schemes_.end()); +} + +bool CefSchemeRegistrarImpl::VerifyRefCount() { + return (GetRefCt() == 1); +} + +void CefSchemeRegistrarImpl::Detach() { + if (VerifyContext()) + supported_thread_id_ = base::kInvalidThreadId; +} + +bool CefSchemeRegistrarImpl::VerifyContext() { + if (base::PlatformThread::CurrentId() != supported_thread_id_) { + // This object should only be accessed from the thread that created it. + NOTREACHED(); + return false; + } + + return true; +} diff --git a/libcef/common/scheme_registrar_impl.h b/libcef/common/scheme_registrar_impl.h new file mode 100644 index 000000000..ad7d01186 --- /dev/null +++ b/libcef/common/scheme_registrar_impl.h @@ -0,0 +1,46 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_SCHEME_REGISTRAR_IMPL_H_ +#define CEF_LIBCEF_COMMON_SCHEME_REGISTRAR_IMPL_H_ +#pragma once + +#include +#include + +#include "include/cef_scheme.h" + +#include "base/threading/platform_thread.h" + +class CefSchemeRegistrarImpl : public CefSchemeRegistrar { + public: + CefSchemeRegistrarImpl(); + + // CefSchemeRegistrar methods. + virtual bool AddCustomScheme(const CefString& scheme_name, + bool is_standard, + bool is_local, + bool is_display_isolated) OVERRIDE; + + void GetStandardSchemes(std::vector* standard_schemes); + + // Verify that only a single reference exists to all CefSchemeRegistrarImpl + // objects. + bool VerifyRefCount(); + + void Detach(); + + private: + // Verify that the object is being accessed from the correct thread. + bool VerifyContext(); + + base::PlatformThreadId supported_thread_id_; + + std::vector standard_schemes_; + + IMPLEMENT_REFCOUNTING(CefSchemeRegistrarImpl); + DISALLOW_COPY_AND_ASSIGN(CefSchemeRegistrarImpl); +}; + +#endif // CEF_LIBCEF_COMMON_SCHEME_REGISTRAR_IMPL_H_ diff --git a/libcef/common/string_list_impl.cc b/libcef/common/string_list_impl.cc new file mode 100644 index 000000000..8db72cbeb --- /dev/null +++ b/libcef/common/string_list_impl.cc @@ -0,0 +1,57 @@ +// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include +#include "include/internal/cef_string_list.h" +#include "base/logging.h" + +typedef std::vector StringList; + +CEF_EXPORT cef_string_list_t cef_string_list_alloc() { + return new StringList; +} + +CEF_EXPORT int cef_string_list_size(cef_string_list_t list) { + DCHECK(list); + StringList* impl = reinterpret_cast(list); + return impl->size(); +} + +CEF_EXPORT int cef_string_list_value(cef_string_list_t list, int index, + cef_string_t* value) { + DCHECK(list); + DCHECK(value); + StringList* impl = reinterpret_cast(list); + DCHECK_GE(index, 0); + DCHECK_LT(index, static_cast(impl->size())); + if (index < 0 || index >= static_cast(impl->size())) + return false; + const CefString& str = (*impl)[index]; + return cef_string_copy(str.c_str(), str.length(), value); +} + +CEF_EXPORT void cef_string_list_append(cef_string_list_t list, + const cef_string_t* value) { + DCHECK(list); + StringList* impl = reinterpret_cast(list); + impl->push_back(CefString(value)); +} + +CEF_EXPORT void cef_string_list_clear(cef_string_list_t list) { + DCHECK(list); + StringList* impl = reinterpret_cast(list); + impl->clear(); +} + +CEF_EXPORT void cef_string_list_free(cef_string_list_t list) { + DCHECK(list); + StringList* impl = reinterpret_cast(list); + delete impl; +} + +CEF_EXPORT cef_string_list_t cef_string_list_copy(cef_string_list_t list) { + DCHECK(list); + StringList* impl = reinterpret_cast(list); + return new StringList(*impl); +} diff --git a/libcef/common/string_map_impl.cc b/libcef/common/string_map_impl.cc new file mode 100644 index 000000000..9538ab05e --- /dev/null +++ b/libcef/common/string_map_impl.cc @@ -0,0 +1,92 @@ +// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include +#include "include/internal/cef_string_map.h" +#include "base/logging.h" + +typedef std::map StringMap; + +CEF_EXPORT cef_string_map_t cef_string_map_alloc() { + return new StringMap; +} + +CEF_EXPORT int cef_string_map_size(cef_string_map_t map) { + DCHECK(map); + StringMap* impl = reinterpret_cast(map); + return impl->size(); +} + +CEF_EXPORT int cef_string_map_find(cef_string_map_t map, + const cef_string_t* key, + cef_string_t* value) { + DCHECK(map); + DCHECK(value); + StringMap* impl = reinterpret_cast(map); + StringMap::const_iterator it = impl->find(CefString(key)); + if (it == impl->end()) + return 0; + + const CefString& val = it->second; + return cef_string_set(val.c_str(), val.length(), value, true); +} + +CEF_EXPORT int cef_string_map_key(cef_string_map_t map, int index, + cef_string_t* key) { + DCHECK(map); + DCHECK(key); + StringMap* impl = reinterpret_cast(map); + DCHECK_GE(index, 0); + DCHECK_LT(index, static_cast(impl->size())); + if (index < 0 || index >= static_cast(impl->size())) + return 0; + + StringMap::const_iterator it = impl->begin(); + for (int ct = 0; it != impl->end(); ++it, ct++) { + if (ct == index) + return cef_string_set(it->first.c_str(), it->first.length(), key, true); + } + return 0; +} + +CEF_EXPORT int cef_string_map_value(cef_string_map_t map, int index, + cef_string_t* value) { + DCHECK(map); + DCHECK(value); + StringMap* impl = reinterpret_cast(map); + DCHECK_GE(index, 0); + DCHECK_LT(index, static_cast(impl->size())); + if (index < 0 || index >= static_cast(impl->size())) + return 0; + + StringMap::const_iterator it = impl->begin(); + for (int ct = 0; it != impl->end(); ++it, ct++) { + if (ct == index) { + return cef_string_set(it->second.c_str(), it->second.length(), value, + true); + } + } + return 0; +} + +CEF_EXPORT int cef_string_map_append(cef_string_map_t map, + const cef_string_t* key, + const cef_string_t* value) { + DCHECK(map); + StringMap* impl = reinterpret_cast(map); + impl->insert(std::make_pair(CefString(key), CefString(value))); + return 1; +} + +CEF_EXPORT void cef_string_map_clear(cef_string_map_t map) { + DCHECK(map); + StringMap* impl = reinterpret_cast(map); + impl->clear(); +} + +CEF_EXPORT void cef_string_map_free(cef_string_map_t map) { + DCHECK(map); + StringMap* impl = reinterpret_cast(map); + delete impl; +} diff --git a/libcef/common/string_multimap_impl.cc b/libcef/common/string_multimap_impl.cc new file mode 100644 index 000000000..594ca90dd --- /dev/null +++ b/libcef/common/string_multimap_impl.cc @@ -0,0 +1,116 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include +#include "include/internal/cef_string_multimap.h" +#include "base/logging.h" + +typedef std::multimap StringMultimap; + +CEF_EXPORT cef_string_multimap_t cef_string_multimap_alloc() { + return new StringMultimap; +} + +CEF_EXPORT int cef_string_multimap_size(cef_string_multimap_t map) { + DCHECK(map); + StringMultimap* impl = reinterpret_cast(map); + return impl->size(); +} + +CEF_EXPORT int cef_string_multimap_find_count(cef_string_multimap_t map, + const cef_string_t* key) { + DCHECK(map); + DCHECK(key); + StringMultimap* impl = reinterpret_cast(map); + return impl->count(CefString(key)); +} + +CEF_EXPORT int cef_string_multimap_enumerate(cef_string_multimap_t map, + const cef_string_t* key, + int value_index, + cef_string_t* value) { + DCHECK(map); + DCHECK(key); + DCHECK(value); + + StringMultimap* impl = reinterpret_cast(map); + CefString key_str(key); + + DCHECK_GE(value_index, 0); + DCHECK_LT(value_index, static_cast(impl->count(key_str))); + if (value_index < 0 || value_index >= static_cast(impl->count(key_str))) + return 0; + + std::pair range_it = + impl->equal_range(key_str); + + int count = value_index; + while (count-- && range_it.first != range_it.second) + range_it.first++; + + if (range_it.first == range_it.second) + return 0; + + const CefString& val = range_it.first->second; + return cef_string_set(val.c_str(), val.length(), value, true); +} + +CEF_EXPORT int cef_string_multimap_key(cef_string_multimap_t map, int index, + cef_string_t* key) { + DCHECK(map); + DCHECK(key); + StringMultimap* impl = reinterpret_cast(map); + DCHECK_GE(index, 0); + DCHECK_LT(index, static_cast(impl->size())); + if (index < 0 || index >= static_cast(impl->size())) + return 0; + + StringMultimap::const_iterator it = impl->begin(); + for (int ct = 0; it != impl->end(); ++it, ct++) { + if (ct == index) + return cef_string_set(it->first.c_str(), it->first.length(), key, true); + } + return 0; +} + +CEF_EXPORT int cef_string_multimap_value(cef_string_multimap_t map, int index, + cef_string_t* value) { + DCHECK(map); + DCHECK(value); + StringMultimap* impl = reinterpret_cast(map); + DCHECK_GE(index, 0); + DCHECK_LT(index, static_cast(impl->size())); + if (index < 0 || index >= static_cast(impl->size())) + return 0; + + StringMultimap::const_iterator it = impl->begin(); + for (int ct = 0; it != impl->end(); ++it, ct++) { + if (ct == index) { + return cef_string_set(it->second.c_str(), it->second.length(), value, + true); + } + } + return 0; +} + +CEF_EXPORT int cef_string_multimap_append(cef_string_multimap_t map, + const cef_string_t* key, + const cef_string_t* value) { + DCHECK(map); + StringMultimap* impl = reinterpret_cast(map); + impl->insert(std::make_pair(CefString(key), CefString(value))); + return 1; +} + +CEF_EXPORT void cef_string_multimap_clear(cef_string_multimap_t map) { + DCHECK(map); + StringMultimap* impl = reinterpret_cast(map); + impl->clear(); +} + +CEF_EXPORT void cef_string_multimap_free(cef_string_multimap_t map) { + DCHECK(map); + StringMultimap* impl = reinterpret_cast(map); + delete impl; +} diff --git a/libcef/common/string_types_impl.cc b/libcef/common/string_types_impl.cc new file mode 100644 index 000000000..cf82d381f --- /dev/null +++ b/libcef/common/string_types_impl.cc @@ -0,0 +1,269 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "include/internal/cef_string_types.h" +#include "base/logging.h" +#include "base/string16.h" +#include "base/utf_string_conversions.h" + +namespace { + +void string_wide_dtor(wchar_t* str) { + delete [] str; +} + +void string_utf8_dtor(char* str) { + delete [] str; +} + +void string_utf16_dtor(char16* str) { + delete [] str; +} + +} // namespace + +CEF_EXPORT int cef_string_wide_set(const wchar_t* src, size_t src_len, + cef_string_wide_t* output, int copy) { + cef_string_wide_clear(output); + + if (copy) { + if (src && src_len > 0) { + output->str = new wchar_t[src_len+1]; + if (!output->str) + return 0; + + memcpy(output->str, src, src_len * sizeof(wchar_t)); + output->str[src_len] = 0; + output->length = src_len; + output->dtor = string_wide_dtor; + } + } else { + output->str = const_cast(src); + output->length = src_len; + output->dtor = NULL; + } + return 1; +} + +CEF_EXPORT int cef_string_utf8_set(const char* src, size_t src_len, + cef_string_utf8_t* output, int copy) { + cef_string_utf8_clear(output); + if (copy) { + if (src && src_len > 0) { + output->str = new char[src_len+1]; + if (!output->str) + return 0; + + memcpy(output->str, src, src_len * sizeof(char)); + output->str[src_len] = 0; + output->length = src_len; + output->dtor = string_utf8_dtor; + } + } else { + output->str = const_cast(src); + output->length = src_len; + output->dtor = NULL; + } + return 1; +} + +CEF_EXPORT int cef_string_utf16_set(const char16* src, size_t src_len, + cef_string_utf16_t* output, int copy) { + cef_string_utf16_clear(output); + + if (copy) { + if (src && src_len > 0) { + output->str = new char16[src_len+1]; + if (!output->str) + return 0; + + memcpy(output->str, src, src_len * sizeof(char16)); + output->str[src_len] = 0; + output->length = src_len; + output->dtor = string_utf16_dtor; + } + } else { + output->str = const_cast(src); + output->length = src_len; + output->dtor = NULL; + } + return 1; +} + +CEF_EXPORT void cef_string_wide_clear(cef_string_wide_t* str) { + DCHECK(str != NULL); + if (str->dtor && str->str) + str->dtor(str->str); + + str->str = NULL; + str->length = 0; + str->dtor = NULL; +} + +CEF_EXPORT void cef_string_utf8_clear(cef_string_utf8_t* str) { + DCHECK(str != NULL); + if (str->dtor && str->str) + str->dtor(str->str); + + str->str = NULL; + str->length = 0; + str->dtor = NULL; +} + +CEF_EXPORT void cef_string_utf16_clear(cef_string_utf16_t* str) { + DCHECK(str != NULL); + if (str->dtor && str->str) + str->dtor(str->str); + + str->str = NULL; + str->length = 0; + str->dtor = NULL; +} + +CEF_EXPORT int cef_string_wide_cmp(const cef_string_wide_t* str1, + const cef_string_wide_t* str2) { + if (str1->length == 0 && str2->length == 0) + return 0; + int r = wcsncmp(str1->str, str2->str, std::min(str1->length, str2->length)); + if (r == 0) { + if (str1->length > str2->length) + return 1; + else if (str1->length < str2->length) + return -1; + } + return r; +} + +CEF_EXPORT int cef_string_utf8_cmp(const cef_string_utf8_t* str1, + const cef_string_utf8_t* str2) { + if (str1->length == 0 && str2->length == 0) + return 0; + int r = strncmp(str1->str, str2->str, std::min(str1->length, str2->length)); + if (r == 0) { + if (str1->length > str2->length) + return 1; + else if (str1->length < str2->length) + return -1; + } + return r; +} + +CEF_EXPORT int cef_string_utf16_cmp(const cef_string_utf16_t* str1, + const cef_string_utf16_t* str2) { + if (str1->length == 0 && str2->length == 0) + return 0; +#if defined(WCHAR_T_IS_UTF32) + int r = base::c16memcmp(str1->str, str2->str, std::min(str1->length, + str2->length)); +#else + int r = wcsncmp(str1->str, str2->str, std::min(str1->length, str2->length)); +#endif + if (r == 0) { + if (str1->length > str2->length) + return 1; + else if (str1->length < str2->length) + return -1; + } + return r; +} + +CEF_EXPORT int cef_string_wide_to_utf8(const wchar_t* src, size_t src_len, + cef_string_utf8_t* output) { + std::string str; + bool ret = WideToUTF8(src, src_len, &str); + if (!cef_string_utf8_set(str.c_str(), str.length(), output, true)) + return false; + return ret; +} + +CEF_EXPORT int cef_string_utf8_to_wide(const char* src, size_t src_len, + cef_string_wide_t* output) { + std::wstring str; + bool ret = UTF8ToWide(src, src_len, &str); + if (!cef_string_wide_set(str.c_str(), str.length(), output, true)) + return false; + return ret; +} + +CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src, size_t src_len, + cef_string_utf16_t* output) { + string16 str; + bool ret = WideToUTF16(src, src_len, &str); + if (!cef_string_utf16_set(str.c_str(), str.length(), output, true)) + return false; + return ret; +} + +CEF_EXPORT int cef_string_utf16_to_wide(const char16* src, size_t src_len, + cef_string_wide_t* output) { + std::wstring str; + bool ret = UTF16ToWide(src, src_len, &str); + if (!cef_string_wide_set(str.c_str(), str.length(), output, true)) + return false; + return ret; +} + +CEF_EXPORT int cef_string_utf8_to_utf16(const char* src, size_t src_len, + cef_string_utf16_t* output) { + string16 str; + bool ret = UTF8ToUTF16(src, src_len, &str); + if (!cef_string_utf16_set(str.c_str(), str.length(), output, true)) + return false; + return ret; +} + +CEF_EXPORT int cef_string_utf16_to_utf8(const char16* src, size_t src_len, + cef_string_utf8_t* output) { + std::string str; + bool ret = UTF16ToUTF8(src, src_len, &str); + if (!cef_string_utf8_set(str.c_str(), str.length(), output, true)) + return false; + return ret; +} + +CEF_EXPORT int cef_string_ascii_to_wide(const char* src, size_t src_len, + cef_string_wide_t* output) { + std::wstring str = ASCIIToWide(std::string(src, src_len)); + return cef_string_wide_set(str.c_str(), str.length(), output, true); +} + +CEF_EXPORT int cef_string_ascii_to_utf16(const char* src, size_t src_len, + cef_string_utf16_t* output) { + string16 str = ASCIIToUTF16(std::string(src, src_len)); + return cef_string_utf16_set(str.c_str(), str.length(), output, true); +} + +CEF_EXPORT cef_string_userfree_wide_t cef_string_userfree_wide_alloc() { + cef_string_wide_t* s = new cef_string_wide_t; + memset(s, 0, sizeof(cef_string_wide_t)); + return s; +} + +CEF_EXPORT cef_string_userfree_utf8_t cef_string_userfree_utf8_alloc() { + cef_string_utf8_t* s = new cef_string_utf8_t; + memset(s, 0, sizeof(cef_string_utf8_t)); + return s; +} + +CEF_EXPORT cef_string_userfree_utf16_t cef_string_userfree_utf16_alloc() { + cef_string_utf16_t* s = new cef_string_utf16_t; + memset(s, 0, sizeof(cef_string_utf16_t)); + return s; +} + +CEF_EXPORT void cef_string_userfree_wide_free(cef_string_userfree_wide_t str) { + cef_string_wide_clear(str); + delete str; +} + +CEF_EXPORT void cef_string_userfree_utf8_free(cef_string_userfree_utf8_t str) { + cef_string_utf8_clear(str); + delete str; +} + +CEF_EXPORT void cef_string_userfree_utf16_free( + cef_string_userfree_utf16_t str) { + cef_string_utf16_clear(str); + delete str; +} diff --git a/libcef/common/task_impl.cc b/libcef/common/task_impl.cc new file mode 100644 index 000000000..c2c034830 --- /dev/null +++ b/libcef/common/task_impl.cc @@ -0,0 +1,106 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "include/cef_task.h" +#include "libcef/browser/thread_util.h" +#include "libcef/renderer/thread_util.h" + +#include "base/bind.h" + +using content::BrowserThread; + +namespace { + +const int kRenderThreadId = -1; +const int kInvalidThreadId = -10; + +int GetThreadId(CefThreadId threadId) { + int id = kInvalidThreadId; + + switch (threadId) { + case TID_UI: + id = BrowserThread::UI; + break; + case TID_DB: + id = BrowserThread::DB; + break; + case TID_FILE: + id = BrowserThread::FILE; + break; + case TID_FILE_USER_BLOCKING: + id = BrowserThread::FILE_USER_BLOCKING; + break; + case TID_PROCESS_LAUNCHER: + id = BrowserThread::PROCESS_LAUNCHER; + break; + case TID_CACHE: + id = BrowserThread::CACHE; + break; + case TID_IO: + id = BrowserThread::IO; + break; + case TID_RENDERER: + id = kRenderThreadId; + break; + default: + NOTREACHED() << "invalid thread id " << threadId; + return kInvalidThreadId; + }; + + if (id >= 0) { + // Verify that we're on the browser process. + if (content::GetContentClient()->browser()) + return id; + NOTREACHED() << "called on invalid process"; + } else if (id == kRenderThreadId) { + // Verify that we're on the renderer process. + if (content::GetContentClient()->renderer()) + return id; + NOTREACHED() << "called on invalid process"; + } + + return kInvalidThreadId; +} + +} // namespace + +bool CefCurrentlyOn(CefThreadId threadId) { + int id = GetThreadId(threadId); + if (id >= 0) { + // Browser process. + return CEF_CURRENTLY_ON(static_cast(id)); + } else if (id == kRenderThreadId) { + // Renderer process. + return CEF_CURRENTLY_ON_RT(); + } + return false; +} + +bool CefPostTask(CefThreadId threadId, CefRefPtr task) { + int id = GetThreadId(threadId); + if (id >= 0) { + // Browser process. + return CEF_POST_TASK(static_cast(id), + base::Bind(&CefTask::Execute, task, threadId)); + } else if (id == kRenderThreadId) { + // Renderer process. + return CEF_POST_TASK_RT(base::Bind(&CefTask::Execute, task, threadId)); + } + return false; +} + +bool CefPostDelayedTask(CefThreadId threadId, CefRefPtr task, + int64 delay_ms) { + int id = GetThreadId(threadId); + if (id >= 0) { + // Browser process. + return CEF_POST_DELAYED_TASK(static_cast(id), + base::Bind(&CefTask::Execute, task, threadId), delay_ms); + } else if (id == kRenderThreadId) { + // Renderer process. + return CEF_POST_DELAYED_TASK_RT( + base::Bind(&CefTask::Execute, task, threadId), delay_ms); + } + return false; +} diff --git a/libcef/common/time_impl.cc b/libcef/common/time_impl.cc new file mode 100644 index 000000000..1037915a2 --- /dev/null +++ b/libcef/common/time_impl.cc @@ -0,0 +1,69 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/common/time_util.h" + +void cef_time_to_basetime(const cef_time_t& cef_time, base::Time& time) { + base::Time::Exploded exploded; + exploded.year = cef_time.year; + exploded.month = cef_time.month; + exploded.day_of_week = cef_time.day_of_week; + exploded.day_of_month = cef_time.day_of_month; + exploded.hour = cef_time.hour; + exploded.minute = cef_time.minute; + exploded.second = cef_time.second; + exploded.millisecond = cef_time.millisecond; + time = base::Time::FromUTCExploded(exploded); +} + +void cef_time_from_basetime(const base::Time& time, cef_time_t& cef_time) { + base::Time::Exploded exploded; + time.UTCExplode(&exploded); + cef_time.year = exploded.year; + cef_time.month = exploded.month; + cef_time.day_of_week = exploded.day_of_week; + cef_time.day_of_month = exploded.day_of_month; + cef_time.hour = exploded.hour; + cef_time.minute = exploded.minute; + cef_time.second = exploded.second; + cef_time.millisecond = exploded.millisecond; +} + +CEF_EXPORT int cef_time_to_timet(const cef_time_t* cef_time, time_t* time) { + if (!cef_time || !time) + return 0; + + base::Time base_time; + cef_time_to_basetime(*cef_time, base_time); + *time = base_time.ToTimeT(); + return 1; +} + +CEF_EXPORT int cef_time_from_timet(time_t time, cef_time_t* cef_time) { + if (!cef_time) + return 0; + + base::Time base_time = base::Time::FromTimeT(time); + cef_time_from_basetime(base_time, *cef_time); + return 1; +} + +CEF_EXPORT int cef_time_to_doublet(const cef_time_t* cef_time, double* time) { + if (!cef_time || !time) + return 0; + + base::Time base_time; + cef_time_to_basetime(*cef_time, base_time); + *time = base_time.ToDoubleT(); + return 1; +} + +CEF_EXPORT int cef_time_from_doublet(double time, cef_time_t* cef_time) { + if (!cef_time) + return 0; + + base::Time base_time = base::Time::FromDoubleT(time); + cef_time_from_basetime(base_time, *cef_time); + return 1; +} diff --git a/libcef/common/time_util.h b/libcef/common/time_util.h new file mode 100644 index 000000000..fb010ff6c --- /dev/null +++ b/libcef/common/time_util.h @@ -0,0 +1,16 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_TIME_UTIL_H_ +#define CEF_LIBCEF_COMMON_TIME_UTIL_H_ +#pragma once + +#include "include/internal/cef_time.h" +#include "base/time.h" + +// Converts cef_time_t to/from a base::Time object. +void cef_time_to_basetime(const cef_time_t& cef_time, base::Time& time); +void cef_time_from_basetime(const base::Time& time, cef_time_t& cef_time); + +#endif // CEF_LIBCEF_COMMON_TIME_UTIL_H_ diff --git a/libcef/common/tracker.cc b/libcef/common/tracker.cc new file mode 100644 index 000000000..6ed19e891 --- /dev/null +++ b/libcef/common/tracker.cc @@ -0,0 +1,83 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/common/tracker.h" + +// CefTrackNode implementation. + +CefTrackNode::CefTrackNode() + : track_next_(NULL), + track_prev_(NULL) { +} + +CefTrackNode::~CefTrackNode() { +} + +void CefTrackNode::InsertTrackPrev(CefTrackNode* object) { + if (track_prev_) + track_prev_->SetTrackNext(object); + object->SetTrackNext(this); + object->SetTrackPrev(track_prev_); + track_prev_ = object; +} + +void CefTrackNode::InsertTrackNext(CefTrackNode* object) { + if (track_next_) + track_next_->SetTrackPrev(object); + object->SetTrackPrev(this); + object->SetTrackNext(track_next_); + track_next_ = object; +} + +void CefTrackNode::RemoveTracking() { + if (track_next_) + track_next_->SetTrackPrev(track_prev_); + if (track_prev_) + track_prev_->SetTrackNext(track_next_); + track_next_ = NULL; + track_prev_ = NULL; +} + + +// CefTrackManager implementation. + +CefTrackManager::CefTrackManager() + : object_count_(0) { +} + +CefTrackManager::~CefTrackManager() { + DeleteAll(); +} + +void CefTrackManager::Add(CefTrackNode* object) { + AutoLock lock_scope(this); + if (!object->IsTracked()) { + tracker_.InsertTrackNext(object); + ++object_count_; + } +} + +bool CefTrackManager::Delete(CefTrackNode* object) { + AutoLock lock_scope(this); + if (object->IsTracked()) { + object->RemoveTracking(); + delete object; + --object_count_; + return true; + } + return false; +} + +void CefTrackManager::DeleteAll() { + AutoLock lock_scope(this); + CefTrackNode* next; + do { + next = tracker_.GetTrackNext(); + if (next) { + next->RemoveTracking(); + delete next; + } + } while (next != NULL); + object_count_ = 0; +} diff --git a/libcef/common/tracker.h b/libcef/common/tracker.h new file mode 100644 index 000000000..741d5c5e1 --- /dev/null +++ b/libcef/common/tracker.h @@ -0,0 +1,74 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_TRACKER_H_ +#define CEF_LIBCEF_COMMON_TRACKER_H_ +#pragma once + +#include "include/cef_base.h" + +// Class extended by objects that must be tracked. After creating a tracked +// object you should add it to the appropriate track manager. +class CefTrackNode { + public: + CefTrackNode(); + virtual ~CefTrackNode(); + + // Returns true if the object is currently being tracked. + inline bool IsTracked() { return (track_prev_ || track_next_); } + + private: + inline CefTrackNode* GetTrackPrev() { return track_prev_; } + inline void SetTrackPrev(CefTrackNode* base) { track_prev_ = base; } + inline CefTrackNode* GetTrackNext() { return track_next_; } + inline void SetTrackNext(CefTrackNode* base) { track_next_ = base; } + + // Insert a new object into the tracking list before this object. + void InsertTrackPrev(CefTrackNode* object); + + // Insert a new object into the tracking list after this object. + void InsertTrackNext(CefTrackNode* object); + + // Remove this object from the tracking list. + void RemoveTracking(); + + private: + CefTrackNode* track_next_; + CefTrackNode* track_prev_; + + friend class CefTrackManager; +}; + +// Class used to manage tracked objects. A single instance of this class +// should be created for each intended usage. Any objects that have not been +// removed by explicit calls to the Destroy() method will be removed when the +// manager object is destroyed. A manager object can be created as either a +// member variable of another class or by using lazy initialization: +// base::LazyInstance g_singleton = LAZY_INSTANCE_INITIALIZER; +class CefTrackManager : public CefBase { + public: + CefTrackManager(); + virtual ~CefTrackManager(); + + // Add an object to be tracked by this manager. + void Add(CefTrackNode* object); + + // Delete an object tracked by this manager. + bool Delete(CefTrackNode* object); + + // Delete all objects tracked by this manager. + void DeleteAll(); + + // Returns the number of objects currently being tracked. + inline int GetCount() { return object_count_; } + + private: + CefTrackNode tracker_; + int object_count_; + + IMPLEMENT_REFCOUNTING(CefTrackManager); + IMPLEMENT_LOCKING(CefTrackManager); +}; + +#endif // CEF_LIBCEF_COMMON_TRACKER_H_ diff --git a/libcef/common/url_impl.cc b/libcef/common/url_impl.cc new file mode 100644 index 000000000..cc9d7a964 --- /dev/null +++ b/libcef/common/url_impl.cc @@ -0,0 +1,68 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include +#include "include/cef_url.h" +#include "googleurl/src/gurl.h" + +bool CefParseURL(const CefString& url, + CefURLParts& parts) { + GURL gurl(url.ToString()); + if (!gurl.is_valid()) + return false; + + CefString(&parts.spec).FromString(gurl.spec()); + CefString(&parts.scheme).FromString(gurl.scheme()); + CefString(&parts.username).FromString(gurl.username()); + CefString(&parts.password).FromString(gurl.password()); + CefString(&parts.host).FromString(gurl.host()); + CefString(&parts.port).FromString(gurl.port()); + CefString(&parts.path).FromString(gurl.path()); + CefString(&parts.query).FromString(gurl.query()); + + return true; +} + +bool CefCreateURL(const CefURLParts& parts, + CefString& url) { + std::string spec = CefString(parts.spec.str, parts.spec.length, false); + std::string scheme = CefString(parts.scheme.str, parts.scheme.length, false); + std::string username = + CefString(parts.username.str, parts.username.length, false); + std::string password = + CefString(parts.password.str, parts.password.length, false); + std::string host = CefString(parts.host.str, parts.host.length, false); + std::string port = CefString(parts.port.str, parts.port.length, false); + std::string path = CefString(parts.path.str, parts.path.length, false); + std::string query = CefString(parts.query.str, parts.query.length, false); + + GURL gurl; + if (!spec.empty()) { + gurl = GURL(spec); + } else if (!scheme.empty() && !host.empty()) { + std::stringstream ss; + ss << scheme << "://"; + if (!username.empty()) { + ss << username; + if (!password.empty()) + ss << ":" << password; + ss << "@"; + } + ss << host; + if (!port.empty()) + ss << ":" << port; + if (!path.empty()) + ss << path; + if (!query.empty()) + ss << "?" << query; + gurl = GURL(ss.str()); + } + + if (gurl.is_valid()) { + url = gurl.spec(); + return true; + } + + return false; +} diff --git a/libcef/common/urlrequest_impl.cc b/libcef/common/urlrequest_impl.cc new file mode 100644 index 000000000..de47161aa --- /dev/null +++ b/libcef/common/urlrequest_impl.cc @@ -0,0 +1,45 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "include/cef_urlrequest.h" +#include "libcef/browser/browser_urlrequest_impl.h" +#include "libcef/renderer/render_urlrequest_impl.h" + +#include "base/logging.h" +#include "base/message_loop.h" +#include "content/public/common/content_client.h" + +// static +CefRefPtr CefURLRequest::Create( + CefRefPtr request, + CefRefPtr client) { + if (!request.get() || !client.get()) { + NOTREACHED() << "called with invalid parameters"; + return NULL; + } + + if (!MessageLoop::current()) { + NOTREACHED() << "called on invalid thread"; + return NULL; + } + + if (content::GetContentClient()->browser()) { + // In the browser process. + CefRefPtr impl = + new CefBrowserURLRequest(request, client); + if (impl->Start()) + return impl.get(); + return NULL; + } else if (content::GetContentClient()->renderer()) { + // In the render process. + CefRefPtr impl = + new CefRenderURLRequest(request, client); + if (impl->Start()) + return impl.get(); + return NULL; + } else { + NOTREACHED() << "called in unsupported process"; + return NULL; + } +} diff --git a/libcef/common/value_base.cc b/libcef/common/value_base.cc new file mode 100644 index 000000000..5ca561488 --- /dev/null +++ b/libcef/common/value_base.cc @@ -0,0 +1,201 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/common/value_base.h" + + +CefValueController::CefValueController() + : owner_value_(NULL), + owner_object_(NULL) { +} + +CefValueController::~CefValueController() { + // Everything should already have been removed. + DCHECK(!owner_value_ && !owner_object_); + DCHECK(reference_map_.empty()); + DCHECK(dependency_map_.empty()); +} + +void CefValueController::SetOwner(void* value, Object* object) { + DCHECK(value && object); + + // Controller should already be locked. + DCHECK(locked()); + + // Owner should only be set once. + DCHECK(!owner_value_ && !owner_object_); + + owner_value_ = value; + owner_object_ = object; +} + +void CefValueController::AddReference(void* value, Object* object) { + DCHECK(value && object); + + // Controller should already be locked. + DCHECK(locked()); + + // Controller should currently have an owner. + DCHECK(owner_value_); + + // Values should only be added once. + DCHECK(reference_map_.find(value) == reference_map_.end()); + DCHECK(value != owner_value_); + + reference_map_.insert(std::make_pair(value, object)); +} + +void CefValueController::Remove(void* value, bool notify_object) { + DCHECK(value); + + // Controller should already be locked. + DCHECK(locked()); + + // Controller should currently have an owner. + DCHECK(owner_value_); + + if (value == owner_value_) { + // Should never notify when removing the owner object. + DCHECK(!notify_object); + + owner_value_ = NULL; + owner_object_ = NULL; + + // Remove all references. + if (reference_map_.size() > 0) { + ReferenceMap::iterator it = reference_map_.begin(); + for (; it != reference_map_.end(); ++it) + it->second->OnControlRemoved(); + reference_map_.clear(); + } + + // Remove all dependencies. + dependency_map_.clear(); + } else { + ReferenceMap::iterator it = reference_map_.find(value); + if (it != reference_map_.end()) { + // Remove the reference. + if (notify_object) + it->second->OnControlRemoved(); + reference_map_.erase(it); + } + } +} + +CefValueController::Object* CefValueController::Get(void* value) { + DCHECK(value); + + // Controller should already be locked. + DCHECK(locked()); + + if (value == owner_value_) { + return owner_object_; + } else { + ReferenceMap::iterator it = reference_map_.find(value); + if (it != reference_map_.end()) + return it->second; + return NULL; + } +} + +void CefValueController::AddDependency(void* parent, void* child) { + DCHECK(parent && child && parent != child); + + // Controller should already be locked. + DCHECK(locked()); + + DependencyMap::iterator it = dependency_map_.find(parent); + if (it == dependency_map_.end()) { + // New set. + DependencySet set; + set.insert(child); + dependency_map_.insert(std::make_pair(parent, set)); + } else if (it->second.find(child) == it->second.end()) { + // Update existing set. + it->second.insert(child); + } +} + +void CefValueController::RemoveDependencies(void* value) { + DCHECK(value); + + // Controller should already be locked. + DCHECK(locked()); + + if (dependency_map_.empty()) + return; + + DependencyMap::iterator it_dependency = dependency_map_.find(value); + if (it_dependency == dependency_map_.end()) + return; + + // Start with the set of dependencies for the current value. + DependencySet remove_set = it_dependency->second; + dependency_map_.erase(it_dependency); + + DependencySet::iterator it_value; + ReferenceMap::iterator it_reference; + + while (remove_set.size() > 0) { + it_value = remove_set.begin(); + value = *it_value; + remove_set.erase(it_value); + + // Does the current value have dependencies? + it_dependency = dependency_map_.find(value); + if (it_dependency != dependency_map_.end()) { + // Append the dependency set to the remove set. + remove_set.insert(it_dependency->second.begin(), + it_dependency->second.end()); + dependency_map_.erase(it_dependency); + } + + // Does the current value have a reference? + it_reference = reference_map_.find(value); + if (it_reference != reference_map_.end()) { + // Remove the reference. + it_reference->second->OnControlRemoved(); + reference_map_.erase(it_reference); + } + } +} + +void CefValueController::TakeFrom(CefValueController* other) { + DCHECK(other); + + // Both controllers should already be locked. + DCHECK(locked()); + DCHECK(other->locked()); + + if (!other->reference_map_.empty()) { + // Transfer references from the other to this. + ReferenceMap::iterator it = other->reference_map_.begin(); + for (; it != other->reference_map_.end(); ++it) { + // References should only be added once. + DCHECK(reference_map_.find(it->first) == reference_map_.end()); + reference_map_.insert(std::make_pair(it->first, it->second)); + } + other->reference_map_.empty(); + } + + if (!other->dependency_map_.empty()) { + // Transfer dependencies from the other to this. + DependencyMap::iterator it_other = other->dependency_map_.begin(); + for (; it_other != other->dependency_map_.end(); ++it_other) { + DependencyMap::iterator it_me = dependency_map_.find(it_other->first); + if (it_me == dependency_map_.end()) { + // All children are new. + dependency_map_.insert( + std::make_pair(it_other->first, it_other->second)); + } else { + // Evaluate each child. + DependencySet::iterator it_other_set = it_other->second.begin(); + for (; it_other_set != it_other->second.end(); ++it_other_set) { + if (it_me->second.find(*it_other_set) == it_me->second.end()) + it_me->second.insert(*it_other_set); + } + } + } + } +} diff --git a/libcef/common/value_base.h b/libcef/common/value_base.h new file mode 100644 index 000000000..f6f9f7a39 --- /dev/null +++ b/libcef/common/value_base.h @@ -0,0 +1,415 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_VALUE_BASE_H_ +#define CEF_LIBCEF_COMMON_VALUE_BASE_H_ +#pragma once + +#include +#include +#include "include/cef_base.h" + +#include "base/logging.h" +#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" +#include "base/synchronization/lock.h" +#include "base/threading/platform_thread.h" + + +// Controller implementation base class. +class CefValueController + : public base::RefCountedThreadSafe { + public: + // Implemented by a class controlled using the access controller. + class Object { + public: + virtual ~Object() {} + + // Called when the value has been removed. + virtual void OnControlRemoved() =0; + }; + + // Encapsulates context locking and verification logic. + class AutoLock { + public: + explicit AutoLock(CefValueController* impl) + : impl_(impl), + verified_(impl && impl->VerifyThread()) { + DCHECK(impl); + if (verified_) + impl_->lock(); + } + virtual ~AutoLock() { + if (verified_) + impl_->unlock(); + } + + inline bool verified() { return verified_; } + + private: + scoped_refptr impl_; + bool verified_; + + DISALLOW_COPY_AND_ASSIGN(AutoLock); + }; + + CefValueController(); + virtual ~CefValueController(); + + // Returns true if this controller is thread safe. + virtual bool thread_safe() =0; + + // Returns true if the current thread is allowed to access this controller. + virtual bool on_correct_thread() =0; + + // Lock the controller. + virtual void lock() =0; + + // Unlock the controller. + virtual void unlock() =0; + + // Returns true if the controller is locked on the current thread. + virtual bool locked() =0; + + // Verify that the current thread is correct for accessing the controller. + inline bool VerifyThread() { + if (!thread_safe() && !on_correct_thread()) { + // This object should only be accessed from the thread that created it. + NOTREACHED() << "object accessed from incorrect thread."; + return false; + } + return true; + } + + // The controller must already be locked before calling the below methods. + + // Set the owner for this controller. + void SetOwner(void* value, Object* object); + + // Add a reference value and associated object. + void AddReference(void* value, Object* object); + + // Remove the value. If |notify_object| is true the removed object will be + // notified. If |value| is the owner all reference objects will be removed. + // If |value| has dependencies those objects will also be removed. + void Remove(void* value, bool notify_object); + + // Returns the object for the specified value. + Object* Get(void* value); + + // Add a dependency between |parent| and |child|. + void AddDependency(void* parent, void* child); + + // Recursively removes any dependent values. + void RemoveDependencies(void* value); + + // Takes ownership of all references and dependencies currently controlled by + // |other|. The |other| controller must already be locked. + void TakeFrom(CefValueController* other); + + private: + // Owner object. + void* owner_value_; + Object* owner_object_; + + // Map of reference objects. + typedef std::map ReferenceMap; + ReferenceMap reference_map_; + + // Map of dependency objects. + typedef std::set DependencySet; + typedef std::map DependencyMap; + DependencyMap dependency_map_; + + DISALLOW_COPY_AND_ASSIGN(CefValueController); +}; + +// Thread-safe access control implementation. +class CefValueControllerThreadSafe : public CefValueController { + public: + explicit CefValueControllerThreadSafe() + : locked_thread_id_(0) {} + + // CefValueController methods. + virtual bool thread_safe() OVERRIDE { return true; } + virtual bool on_correct_thread() OVERRIDE { return true; } + virtual void lock() OVERRIDE { + lock_.Acquire(); + locked_thread_id_ = base::PlatformThread::CurrentId(); + } + virtual void unlock() OVERRIDE { + locked_thread_id_ = 0; + lock_.Release(); + } + virtual bool locked() OVERRIDE { + return (locked_thread_id_ == base::PlatformThread::CurrentId()); + } + + private: + base::Lock lock_; + base::PlatformThreadId locked_thread_id_; + + DISALLOW_COPY_AND_ASSIGN(CefValueControllerThreadSafe); +}; + +// Non-thread-safe access control implementation. +class CefValueControllerNonThreadSafe : public CefValueController { + public: + explicit CefValueControllerNonThreadSafe() + : thread_id_(base::PlatformThread::CurrentId()) {} + + // CefValueController methods. + virtual bool thread_safe() OVERRIDE { return false; } + virtual bool on_correct_thread() OVERRIDE { + return (thread_id_ == base::PlatformThread::CurrentId()); + } + virtual void lock() OVERRIDE {} + virtual void unlock() OVERRIDE {} + virtual bool locked() OVERRIDE { return on_correct_thread(); } + + private: + base::PlatformThreadId thread_id_; + + DISALLOW_COPY_AND_ASSIGN(CefValueControllerNonThreadSafe); +}; + + +// Helper macros for verifying context. + +#define CEF_VALUE_VERIFY_RETURN_VOID_EX(object, modify) \ + if (!VerifyAttached()) \ + return; \ + AutoLock auto_lock(object, modify); \ + if (!auto_lock.verified()) \ + return; + +#define CEF_VALUE_VERIFY_RETURN_VOID(modify) \ + CEF_VALUE_VERIFY_RETURN_VOID_EX(this, modify) + +#define CEF_VALUE_VERIFY_RETURN_EX(object, modify, error_val) \ + if (!VerifyAttached()) \ + return error_val; \ + AutoLock auto_lock(object, modify); \ + if (!auto_lock.verified()) \ + return error_val; + +#define CEF_VALUE_VERIFY_RETURN(modify, error_val) \ + CEF_VALUE_VERIFY_RETURN_EX(this, modify, error_val) + + +// Template class for implementing CEF wrappers of other types. +template +class CefValueBase : public CefType, public CefValueController::Object { + public: + // Specifies how the value will be used. + enum ValueMode { + // A reference to a value managed by an existing controller. These values + // can be safely detached but ownership should not be transferred (make a + // copy of the value instead). + kReference, + + // The value has its own controller and will be deleted on destruction. + // These values can only be detached to another controller otherwise any + // references will not be properly managed. + kOwnerWillDelete, + + // The value has its own controller and will not be deleted on destruction. + // This should only be used for global values or scope-limited values that + // will be explicitly detached. + kOwnerNoDelete, + }; + + // Create a new object. + // If |read_only| is true mutable access will not be allowed. + // If |parent_value| is non-NULL and the value mode is kReference a dependency + // will be added. + CefValueBase(ValueType* value, + void* parent_value, + ValueMode value_mode, + bool read_only, + CefValueController* controller) + : value_(value), + value_mode_(value_mode), + read_only_(read_only), + controller_(controller) { + DCHECK(value_); + + // Specifying a parent value for a non-reference doesn't make sense. + DCHECK(!(!reference() && parent_value)); + + if (!reference() && !controller_) { + // For owned values default to using a new multi-threaded controller. + controller_ = new CefValueControllerThreadSafe(); + SetOwnsController(); + } + + // A controller is required. + DCHECK(controller_); + + if (reference()) { + // Register the reference with the controller. + controller_->AddReference(value_, this); + + // Add a dependency on the parent value. + if (parent_value) + controller_->AddDependency(parent_value, value_); + } + } + virtual ~CefValueBase() { + if (controller_ && value_) + Delete(); + } + + // True if the underlying value is referenced instead of owned. + inline bool reference() const { return (value_mode_ == kReference); } + + // True if the underlying value will be deleted. + inline bool will_delete() const { return (value_mode_ == kOwnerWillDelete); } + + // True if access to the underlying value is read-only. + inline bool read_only() const { return read_only_; } + + // True if the underlying value has been detached. + inline bool detached() { return (controller_ == NULL); } + + // Returns the controller. + inline CefValueController* controller() { return controller_; } + + // Deletes the underlying value. + void Delete() { + CEF_VALUE_VERIFY_RETURN_VOID(false); + + // Remove the object from the controller. If this is the owner object any + // references will be detached. + controller()->Remove(value_, false); + + if (will_delete()) { + // Remove any dependencies. + controller()->RemoveDependencies(value_); + + // Delete the value. + DeleteValue(value_); + } + + controller_ = NULL; + value_ = NULL; + } + + // Detaches the underlying value and returns a pointer to it. If this is an + // owner and a |new_controller| value is specified any existing references + // will be passed to the new controller. + ValueType* Detach(CefValueController* new_controller) { + CEF_VALUE_VERIFY_RETURN(false, NULL); + + // A |new_controller| value is required for mode kOwnerWillDelete. + DCHECK(!will_delete() || new_controller); + + if (new_controller && !reference()) { + // Pass any existing references and dependencies to the new controller. + // They will be removed from this controller. + new_controller->TakeFrom(controller()); + } + + // Remove the object from the controller. If this is the owner object any + // references will be detached. + controller()->Remove(value_, false); + controller_ = NULL; + + // Return the old value. + ValueType* old_val = value_; + value_ = NULL; + return old_val; + } + + // Verify that the value is attached. + inline bool VerifyAttached() { + if (detached()) { + // This object should not be accessed after being detached. + NOTREACHED() << "object accessed after being detached."; + return false; + } + return true; + } + + protected: + // CefValueController::Object methods. + virtual void OnControlRemoved() { + DCHECK(controller()->locked()); + + // Only references should be removed in this manner. + DCHECK(reference()); + + controller_ = NULL; + value_ = NULL; + } + + // Override to customize value deletion. + virtual void DeleteValue(ValueType* value) { delete value; } + + // Returns a mutable reference to the value. + inline ValueType* mutable_value() { + DCHECK(value_); + DCHECK(!read_only_); + DCHECK(controller()->locked()); + return value_; + } + // Returns a const reference to the value. + inline const ValueType& const_value() { + DCHECK(value_); + DCHECK(controller()->locked()); + return *value_; + } + + // Verify that the value can be accessed. + inline bool VerifyAccess(bool modify) { + // The controller must already be locked. + DCHECK(controller()->locked()); + + if (read_only() && modify) { + // This object cannot be modified. + NOTREACHED() << "mutation attempted on read-only object."; + return false; + } + + return true; + } + + // Used to indicate that this object owns the controller. + inline void SetOwnsController() { + CefValueController::AutoLock lock_scope(controller_); + if (lock_scope.verified()) + controller_->SetOwner(value_, this); + } + + // Encapsulates value locking and verification logic. + class AutoLock { + public: + explicit AutoLock(CefValueBase* impl, bool modify) + : auto_lock_(impl->controller()), + verified_(auto_lock_.verified() && impl->VerifyAccess(modify)) { + } + virtual ~AutoLock() {} + + inline bool verified() { return verified_; } + + private: + CefValueController::AutoLock auto_lock_; + bool verified_; + + DISALLOW_COPY_AND_ASSIGN(AutoLock); + }; + + private: + ValueType* value_; + ValueMode value_mode_; + bool read_only_; + scoped_refptr controller_; + + IMPLEMENT_REFCOUNTING(CefValueBase); + + DISALLOW_COPY_AND_ASSIGN(CefValueBase); +}; + + +#endif // CEF_LIBCEF_COMMON_VALUE_BASE_H_ diff --git a/libcef/common/values_impl.cc b/libcef/common/values_impl.cc new file mode 100644 index 000000000..483194c30 --- /dev/null +++ b/libcef/common/values_impl.cc @@ -0,0 +1,812 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/common/values_impl.h" + +#include +#include + + +// CefBinaryValueImpl implementation. + +CefRefPtr CefBinaryValue::Create(const void* data, + size_t data_size) { + DCHECK(data); + DCHECK_GT(data_size, (size_t)0); + if (!data || data_size == 0) + return NULL; + + return new CefBinaryValueImpl(static_cast(const_cast(data)), + data_size, true); +} + +// static +CefRefPtr CefBinaryValueImpl::GetOrCreateRef( + base::BinaryValue* value, + void* parent_value, + CefValueController* controller) { + DCHECK(value); + DCHECK(parent_value); + DCHECK(controller); + + CefValueController::Object* object = controller->Get(value); + if (object) + return static_cast(object); + + return new CefBinaryValueImpl(value, parent_value, + CefBinaryValueImpl::kReference, controller); +} + +base::BinaryValue* CefBinaryValueImpl::CopyValue() { + CEF_VALUE_VERIFY_RETURN(false, NULL); + return const_value().DeepCopy(); +} + +base::BinaryValue* CefBinaryValueImpl::CopyOrDetachValue( + CefValueController* new_controller) { + base::BinaryValue* new_value; + + if (!will_delete()) { + // Copy the value. + new_value = CopyValue(); + } else { + // Take ownership of the value. + new_value = Detach(new_controller); + } + + DCHECK(new_value); + return new_value; +} + +bool CefBinaryValueImpl::IsValid() { + return !detached(); +} + +bool CefBinaryValueImpl::IsOwned() { + return !will_delete(); +} + +CefRefPtr CefBinaryValueImpl::Copy() { + CEF_VALUE_VERIFY_RETURN(false, NULL); + return new CefBinaryValueImpl(const_value().DeepCopy(), NULL, + CefBinaryValueImpl::kOwnerWillDelete, NULL); +} + +size_t CefBinaryValueImpl::GetSize() { + CEF_VALUE_VERIFY_RETURN(false, 0); + return const_value().GetSize(); +} + +size_t CefBinaryValueImpl::GetData(void* buffer, + size_t buffer_size, + size_t data_offset) { + DCHECK(buffer); + DCHECK_GT(buffer_size, (size_t)0); + if (!buffer || buffer_size == 0) + return 0; + + CEF_VALUE_VERIFY_RETURN(false, 0); + + size_t size = const_value().GetSize(); + DCHECK_LT(data_offset, size); + if (data_offset >= size) + return 0; + + size = std::min(buffer_size, size-data_offset); + const char* data = const_value().GetBuffer(); + memcpy(buffer, data+data_offset, size); + return size; +} + +CefBinaryValueImpl::CefBinaryValueImpl(base::BinaryValue* value, + void* parent_value, + ValueMode value_mode, + CefValueController* controller) + : CefValueBase( + value, parent_value, value_mode, true, controller) { +} + +CefBinaryValueImpl::CefBinaryValueImpl(char* data, + size_t data_size, + bool copy) + : CefValueBase( + copy ? base::BinaryValue::CreateWithCopiedBuffer(data, data_size) : + base::BinaryValue::Create(data, data_size), + NULL, kOwnerWillDelete, true, NULL) { +} + + +// CefDictionaryValueImpl implementation. + +// static +CefRefPtr CefDictionaryValue::Create() { + return new CefDictionaryValueImpl(new base::DictionaryValue(), + NULL, CefDictionaryValueImpl::kOwnerWillDelete, false, NULL); +} + +// static +CefRefPtr CefDictionaryValueImpl::GetOrCreateRef( + base::DictionaryValue* value, + void* parent_value, + bool read_only, + CefValueController* controller) { + CefValueController::Object* object = controller->Get(value); + if (object) + return static_cast(object); + + return new CefDictionaryValueImpl(value, parent_value, + CefDictionaryValueImpl::kReference, read_only, controller); +} + +base::DictionaryValue* CefDictionaryValueImpl::CopyValue() { + CEF_VALUE_VERIFY_RETURN(false, NULL); + return const_value().DeepCopy(); +} + +base::DictionaryValue* CefDictionaryValueImpl::CopyOrDetachValue( + CefValueController* new_controller) { + base::DictionaryValue* new_value; + + if (!will_delete()) { + // Copy the value. + new_value = CopyValue(); + } else { + // Take ownership of the value. + new_value = Detach(new_controller); + } + + DCHECK(new_value); + return new_value; +} + +bool CefDictionaryValueImpl::IsValid() { + return !detached(); +} + +bool CefDictionaryValueImpl::IsOwned() { + return !will_delete(); +} + +bool CefDictionaryValueImpl::IsReadOnly() { + return read_only(); +} + +CefRefPtr CefDictionaryValueImpl::Copy( + bool exclude_empty_children) { + CEF_VALUE_VERIFY_RETURN(false, NULL); + + base::DictionaryValue* value; + if (exclude_empty_children) { + value = const_cast( + const_value()).DeepCopyWithoutEmptyChildren(); + } else { + value = const_value().DeepCopy(); + } + + return new CefDictionaryValueImpl(value, NULL, + CefDictionaryValueImpl::kOwnerWillDelete, false, NULL); +} + +size_t CefDictionaryValueImpl::GetSize() { + CEF_VALUE_VERIFY_RETURN(false, 0); + return const_value().size(); +} + +bool CefDictionaryValueImpl::Clear() { + CEF_VALUE_VERIFY_RETURN(true, false); + + // Detach any dependent values. + controller()->RemoveDependencies(mutable_value()); + + mutable_value()->Clear(); + return true; +} + +bool CefDictionaryValueImpl::HasKey(const CefString& key) { + CEF_VALUE_VERIFY_RETURN(false, 0); + return const_value().HasKey(key); +} + +bool CefDictionaryValueImpl::GetKeys(KeyList& keys) { + CEF_VALUE_VERIFY_RETURN(false, 0); + + base::DictionaryValue::key_iterator it = const_value().begin_keys(); + for (; it != const_value().end_keys(); ++it) + keys.push_back(*it); + + return true; +} + +bool CefDictionaryValueImpl::Remove(const CefString& key) { + CEF_VALUE_VERIFY_RETURN(true, false); + return RemoveInternal(key); +} + +CefValueType CefDictionaryValueImpl::GetType(const CefString& key) { + CEF_VALUE_VERIFY_RETURN(false, VTYPE_INVALID); + + base::Value* out_value = NULL; + if (const_value().GetWithoutPathExpansion(key, &out_value)) { + switch (out_value->GetType()) { + case base::Value::TYPE_NULL: + return VTYPE_NULL; + case base::Value::TYPE_BOOLEAN: + return VTYPE_BOOL; + case base::Value::TYPE_INTEGER: + return VTYPE_INT; + case base::Value::TYPE_DOUBLE: + return VTYPE_DOUBLE; + case base::Value::TYPE_STRING: + return VTYPE_STRING; + case base::Value::TYPE_BINARY: + return VTYPE_BINARY; + case base::Value::TYPE_DICTIONARY: + return VTYPE_DICTIONARY; + case base::Value::TYPE_LIST: + return VTYPE_LIST; + } + } + + return VTYPE_INVALID; +} + +bool CefDictionaryValueImpl::GetBool(const CefString& key) { + CEF_VALUE_VERIFY_RETURN(false, false); + + base::Value* out_value = NULL; + bool ret_value = false; + + if (const_value().GetWithoutPathExpansion(key, &out_value)) + out_value->GetAsBoolean(&ret_value); + + return ret_value; +} + +int CefDictionaryValueImpl::GetInt(const CefString& key) { + CEF_VALUE_VERIFY_RETURN(false, 0); + + base::Value* out_value = NULL; + int ret_value = 0; + + if (const_value().GetWithoutPathExpansion(key, &out_value)) + out_value->GetAsInteger(&ret_value); + + return ret_value; +} + +double CefDictionaryValueImpl::GetDouble(const CefString& key) { + CEF_VALUE_VERIFY_RETURN(false, 0); + + base::Value* out_value = NULL; + double ret_value = 0; + + if (const_value().GetWithoutPathExpansion(key, &out_value)) + out_value->GetAsDouble(&ret_value); + + return ret_value; +} + +CefString CefDictionaryValueImpl::GetString(const CefString& key) { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + + base::Value* out_value = NULL; + string16 ret_value; + + if (const_value().GetWithoutPathExpansion(key, &out_value)) + out_value->GetAsString(&ret_value); + + return ret_value; +} + +CefRefPtr CefDictionaryValueImpl::GetBinary( + const CefString& key) { + CEF_VALUE_VERIFY_RETURN(false, NULL); + + base::Value* out_value = NULL; + + if (const_value().GetWithoutPathExpansion(key, &out_value) && + out_value->IsType(base::Value::TYPE_BINARY)) { + base::BinaryValue* binary_value = + static_cast(out_value); + return CefBinaryValueImpl::GetOrCreateRef(binary_value, + const_cast(&const_value()), controller()); + } + + return NULL; +} + +CefRefPtr CefDictionaryValueImpl::GetDictionary( + const CefString& key) { + CEF_VALUE_VERIFY_RETURN(false, NULL); + + base::Value* out_value = NULL; + + if (const_value().GetWithoutPathExpansion(key, &out_value) && + out_value->IsType(base::Value::TYPE_DICTIONARY)) { + base::DictionaryValue* dict_value = + static_cast(out_value); + return CefDictionaryValueImpl::GetOrCreateRef( + dict_value, + const_cast(&const_value()), + read_only(), + controller()); + } + + return NULL; +} + +CefRefPtr CefDictionaryValueImpl::GetList(const CefString& key) { + CEF_VALUE_VERIFY_RETURN(false, NULL); + + base::Value* out_value = NULL; + + if (const_value().GetWithoutPathExpansion(key, &out_value) && + out_value->IsType(base::Value::TYPE_LIST)) { + base::ListValue* list_value = static_cast(out_value); + return CefListValueImpl::GetOrCreateRef( + list_value, + const_cast(&const_value()), + read_only(), + controller()); + } + + return NULL; +} + +bool CefDictionaryValueImpl::SetNull(const CefString& key) { + CEF_VALUE_VERIFY_RETURN(true, false); + RemoveInternal(key); + mutable_value()->SetWithoutPathExpansion(key, base::Value::CreateNullValue()); + return true; +} + +bool CefDictionaryValueImpl::SetBool(const CefString& key, bool value) { + CEF_VALUE_VERIFY_RETURN(true, false); + RemoveInternal(key); + mutable_value()->SetWithoutPathExpansion(key, + base::Value::CreateBooleanValue(value)); + return true; +} + +bool CefDictionaryValueImpl::SetInt(const CefString& key, int value) { + CEF_VALUE_VERIFY_RETURN(true, false); + RemoveInternal(key); + mutable_value()->SetWithoutPathExpansion(key, + base::Value::CreateIntegerValue(value)); + return true; +} + +bool CefDictionaryValueImpl::SetDouble(const CefString& key, double value) { + CEF_VALUE_VERIFY_RETURN(true, false); + RemoveInternal(key); + mutable_value()->SetWithoutPathExpansion(key, + base::Value::CreateDoubleValue(value)); + return true; +} + +bool CefDictionaryValueImpl::SetString(const CefString& key, + const CefString& value) { + CEF_VALUE_VERIFY_RETURN(true, false); + RemoveInternal(key); + mutable_value()->SetWithoutPathExpansion(key, + base::Value::CreateStringValue(value.ToString16())); + return true; +} + +bool CefDictionaryValueImpl::SetBinary(const CefString& key, + CefRefPtr value) { + CEF_VALUE_VERIFY_RETURN(true, false); + RemoveInternal(key); + + CefBinaryValueImpl* impl = static_cast(value.get()); + DCHECK(impl); + + mutable_value()->SetWithoutPathExpansion(key, + impl->CopyOrDetachValue(controller())); + return true; +} + +bool CefDictionaryValueImpl::SetDictionary( + const CefString& key, CefRefPtr value) { + CEF_VALUE_VERIFY_RETURN(true, false); + RemoveInternal(key); + + CefDictionaryValueImpl* impl = + static_cast(value.get()); + DCHECK(impl); + + mutable_value()->SetWithoutPathExpansion(key, + impl->CopyOrDetachValue(controller())); + return true; +} + +bool CefDictionaryValueImpl::SetList(const CefString& key, + CefRefPtr value) { + CEF_VALUE_VERIFY_RETURN(true, false); + RemoveInternal(key); + + CefListValueImpl* impl = static_cast(value.get()); + DCHECK(impl); + + mutable_value()->SetWithoutPathExpansion(key, + impl->CopyOrDetachValue(controller())); + return true; +} + +bool CefDictionaryValueImpl::RemoveInternal(const CefString& key) { + base::Value* out_value = NULL; + if (!mutable_value()->RemoveWithoutPathExpansion(key, &out_value)) + return false; + + // Remove the value. + controller()->Remove(out_value, true); + + // Only list and dictionary types may have dependencies. + if (out_value->IsType(base::Value::TYPE_LIST) || + out_value->IsType(base::Value::TYPE_DICTIONARY)) { + controller()->RemoveDependencies(out_value); + } + + delete out_value; + return true; +} + +CefDictionaryValueImpl::CefDictionaryValueImpl( + base::DictionaryValue* value, + void* parent_value, + ValueMode value_mode, + bool read_only, + CefValueController* controller) + : CefValueBase( + value, parent_value, value_mode, read_only, controller) { +} + + +// CefListValueImpl implementation. + +// static +CefRefPtr CefListValue::Create() { + return new CefListValueImpl(new base::ListValue(), + NULL, CefListValueImpl::kOwnerWillDelete, false, NULL); +} + +// static +CefRefPtr CefListValueImpl::GetOrCreateRef( + base::ListValue* value, + void* parent_value, + bool read_only, + CefValueController* controller) { + CefValueController::Object* object = controller->Get(value); + if (object) + return static_cast(object); + + return new CefListValueImpl(value, parent_value, + CefListValueImpl::kReference, read_only, controller); +} + +base::ListValue* CefListValueImpl::CopyValue() { + CEF_VALUE_VERIFY_RETURN(false, NULL); + return const_value().DeepCopy(); +} + +base::ListValue* CefListValueImpl::CopyOrDetachValue( + CefValueController* new_controller) { + base::ListValue* new_value; + + if (!will_delete()) { + // Copy the value. + new_value = CopyValue(); + } else { + // Take ownership of the value. + new_value = Detach(new_controller); + } + + DCHECK(new_value); + return new_value; +} + +bool CefListValueImpl::IsValid() { + return !detached(); +} + +bool CefListValueImpl::IsOwned() { + return !will_delete(); +} + +bool CefListValueImpl::IsReadOnly() { + return read_only(); +} + +CefRefPtr CefListValueImpl::Copy() { + CEF_VALUE_VERIFY_RETURN(false, NULL); + + return new CefListValueImpl(const_value().DeepCopy(), NULL, + CefListValueImpl::kOwnerWillDelete, false, NULL); +} + +bool CefListValueImpl::SetSize(size_t size) { + CEF_VALUE_VERIFY_RETURN(true, false); + + size_t current_size = const_value().GetSize(); + if (size < current_size) { + // Clean up any values above the requested size. + for (size_t i = current_size-1; i >= size; --i) + RemoveInternal(i); + } else if (size > 0) { + // Expand the list size. + mutable_value()->Set(size-1, base::Value::CreateNullValue()); + } + return true; +} + +size_t CefListValueImpl::GetSize() { + CEF_VALUE_VERIFY_RETURN(false, 0); + return const_value().GetSize(); +} + +bool CefListValueImpl::Clear() { + CEF_VALUE_VERIFY_RETURN(true, false); + + // Detach any dependent values. + controller()->RemoveDependencies(mutable_value()); + + mutable_value()->Clear(); + return true; +} + +bool CefListValueImpl::Remove(int index) { + CEF_VALUE_VERIFY_RETURN(true, false); + return RemoveInternal(index); +} + +CefValueType CefListValueImpl::GetType(int index) { + CEF_VALUE_VERIFY_RETURN(false, VTYPE_INVALID); + + base::Value* out_value = NULL; + if (const_value().Get(index, &out_value)) { + switch (out_value->GetType()) { + case base::Value::TYPE_NULL: + return VTYPE_NULL; + case base::Value::TYPE_BOOLEAN: + return VTYPE_BOOL; + case base::Value::TYPE_INTEGER: + return VTYPE_INT; + case base::Value::TYPE_DOUBLE: + return VTYPE_DOUBLE; + case base::Value::TYPE_STRING: + return VTYPE_STRING; + case base::Value::TYPE_BINARY: + return VTYPE_BINARY; + case base::Value::TYPE_DICTIONARY: + return VTYPE_DICTIONARY; + case base::Value::TYPE_LIST: + return VTYPE_LIST; + } + } + + return VTYPE_INVALID; +} + +bool CefListValueImpl::GetBool(int index) { + CEF_VALUE_VERIFY_RETURN(false, false); + + base::Value* out_value = NULL; + bool ret_value = false; + + if (const_value().Get(index, &out_value)) + out_value->GetAsBoolean(&ret_value); + + return ret_value; +} + +int CefListValueImpl::GetInt(int index) { + CEF_VALUE_VERIFY_RETURN(false, 0); + + base::Value* out_value = NULL; + int ret_value = 0; + + if (const_value().Get(index, &out_value)) + out_value->GetAsInteger(&ret_value); + + return ret_value; +} + +double CefListValueImpl::GetDouble(int index) { + CEF_VALUE_VERIFY_RETURN(false, 0); + + base::Value* out_value = NULL; + double ret_value = 0; + + if (const_value().Get(index, &out_value)) + out_value->GetAsDouble(&ret_value); + + return ret_value; +} + +CefString CefListValueImpl::GetString(int index) { + CEF_VALUE_VERIFY_RETURN(false, CefString()); + + base::Value* out_value = NULL; + string16 ret_value; + + if (const_value().Get(index, &out_value)) + out_value->GetAsString(&ret_value); + + return ret_value; +} + +CefRefPtr CefListValueImpl::GetBinary(int index) { + CEF_VALUE_VERIFY_RETURN(false, NULL); + + base::Value* out_value = NULL; + + if (const_value().Get(index, &out_value) && + out_value->IsType(base::Value::TYPE_BINARY)) { + base::BinaryValue* binary_value = + static_cast(out_value); + return CefBinaryValueImpl::GetOrCreateRef(binary_value, + const_cast(&const_value()), controller()); + } + + return NULL; +} + +CefRefPtr CefListValueImpl::GetDictionary(int index) { + CEF_VALUE_VERIFY_RETURN(false, NULL); + + base::Value* out_value = NULL; + + if (const_value().Get(index, &out_value) && + out_value->IsType(base::Value::TYPE_DICTIONARY)) { + base::DictionaryValue* dict_value = + static_cast(out_value); + return CefDictionaryValueImpl::GetOrCreateRef( + dict_value, + const_cast(&const_value()), + read_only(), + controller()); + } + + return NULL; +} + +CefRefPtr CefListValueImpl::GetList(int index) { + CEF_VALUE_VERIFY_RETURN(false, NULL); + + base::Value* out_value = NULL; + + if (const_value().Get(index, &out_value) && + out_value->IsType(base::Value::TYPE_LIST)) { + base::ListValue* list_value = static_cast(out_value); + return CefListValueImpl::GetOrCreateRef( + list_value, + const_cast(&const_value()), + read_only(), + controller()); + } + + return NULL; +} + +bool CefListValueImpl::SetNull(int index) { + CEF_VALUE_VERIFY_RETURN(true, false); + base::Value* new_value = base::Value::CreateNullValue(); + if (RemoveInternal(index)) + mutable_value()->Insert(index, new_value); + else + mutable_value()->Set(index, new_value); + return true; +} + +bool CefListValueImpl::SetBool(int index, bool value) { + CEF_VALUE_VERIFY_RETURN(true, false); + base::Value* new_value = base::Value::CreateBooleanValue(value); + if (RemoveInternal(index)) + mutable_value()->Insert(index, new_value); + else + mutable_value()->Set(index, new_value); + return true; +} + +bool CefListValueImpl::SetInt(int index, int value) { + CEF_VALUE_VERIFY_RETURN(true, false); + base::Value* new_value = base::Value::CreateIntegerValue(value); + if (RemoveInternal(index)) + mutable_value()->Insert(index, new_value); + else + mutable_value()->Set(index, new_value); + return true; +} + +bool CefListValueImpl::SetDouble(int index, double value) { + CEF_VALUE_VERIFY_RETURN(true, false); + base::Value* new_value = base::Value::CreateDoubleValue(value); + if (RemoveInternal(index)) + mutable_value()->Insert(index, new_value); + else + mutable_value()->Set(index, new_value); + return true; +} + +bool CefListValueImpl::SetString(int index, const CefString& value) { + CEF_VALUE_VERIFY_RETURN(true, false); + base::Value* new_value = base::Value::CreateStringValue(value.ToString16()); + if (RemoveInternal(index)) + mutable_value()->Insert(index, new_value); + else + mutable_value()->Set(index, new_value); + return true; +} + +bool CefListValueImpl::SetBinary(int index, CefRefPtr value) { + CEF_VALUE_VERIFY_RETURN(true, false); + + CefBinaryValueImpl* impl = static_cast(value.get()); + DCHECK(impl); + + base::Value* new_value = impl->CopyOrDetachValue(controller()); + if (RemoveInternal(index)) + mutable_value()->Insert(index, new_value); + else + mutable_value()->Set(index, new_value); + return true; +} + +bool CefListValueImpl::SetDictionary(int index, + CefRefPtr value) { + CEF_VALUE_VERIFY_RETURN(true, false); + + CefDictionaryValueImpl* impl = + static_cast(value.get()); + DCHECK(impl); + + base::Value* new_value = impl->CopyOrDetachValue(controller()); + if (RemoveInternal(index)) + mutable_value()->Insert(index, new_value); + else + mutable_value()->Set(index, new_value); + return true; +} + +bool CefListValueImpl::SetList(int index, CefRefPtr value) { + CEF_VALUE_VERIFY_RETURN(true, false); + + CefListValueImpl* impl = static_cast(value.get()); + DCHECK(impl); + + base::Value* new_value = impl->CopyOrDetachValue(controller()); + if (RemoveInternal(index)) + mutable_value()->Insert(index, new_value); + else + mutable_value()->Set(index, new_value); + return true; +} + +bool CefListValueImpl::RemoveInternal(int index) { + base::Value* out_value = NULL; + if (!mutable_value()->Remove(index, &out_value)) + return false; + + // Remove the value. + controller()->Remove(out_value, true); + + // Only list and dictionary types may have dependencies. + if (out_value->IsType(base::Value::TYPE_LIST) || + out_value->IsType(base::Value::TYPE_DICTIONARY)) { + controller()->RemoveDependencies(out_value); + } + + delete out_value; + return true; +} + +CefListValueImpl::CefListValueImpl( + base::ListValue* value, + void* parent_value, + ValueMode value_mode, + bool read_only, + CefValueController* controller) + : CefValueBase( + value, parent_value, value_mode, read_only, controller) { +} diff --git a/libcef/common/values_impl.h b/libcef/common/values_impl.h new file mode 100644 index 000000000..0d58caa95 --- /dev/null +++ b/libcef/common/values_impl.h @@ -0,0 +1,194 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_VALUES_IMPL_H_ +#define CEF_LIBCEF_COMMON_VALUES_IMPL_H_ +#pragma once + +#include + +#include "include/cef_values.h" +#include "libcef/common/value_base.h" + +#include "base/values.h" +#include "base/threading/platform_thread.h" + + +// CefBinaryValue implementation +class CefBinaryValueImpl + : public CefValueBase { + public: + // Get or create a reference value. + static CefRefPtr GetOrCreateRef( + base::BinaryValue* value, + void* parent_value, + CefValueController* controller); + + // Return a copy of the value. + base::BinaryValue* CopyValue(); + + // If a reference return a copy of the value otherwise detach the value to the + // specified |new_controller|. + base::BinaryValue* CopyOrDetachValue(CefValueController* new_controller); + + // CefBinaryValue methods. + virtual bool IsValid() OVERRIDE; + virtual bool IsOwned() OVERRIDE; + virtual CefRefPtr Copy() OVERRIDE; + virtual size_t GetSize() OVERRIDE; + virtual size_t GetData(void* buffer, + size_t buffer_size, + size_t data_offset) OVERRIDE; + + private: + // See the CefValueBase constructor for usage. Binary values are always + // read-only. + CefBinaryValueImpl(base::BinaryValue* value, + void* parent_value, + ValueMode value_mode, + CefValueController* controller); + // If |copy| is false this object will take ownership of the specified |data| + // buffer instead of copying it. + CefBinaryValueImpl(char* data, + size_t data_size, + bool copy); + + // For the Create() method. + friend class CefBinaryValue; + + DISALLOW_COPY_AND_ASSIGN(CefBinaryValueImpl); +}; + + +// CefDictionaryValue implementation +class CefDictionaryValueImpl + : public CefValueBase { + public: + // Get or create a reference value. + static CefRefPtr GetOrCreateRef( + base::DictionaryValue* value, + void* parent_value, + bool read_only, + CefValueController* controller); + + // Return a copy of the value. + base::DictionaryValue* CopyValue(); + + // If a reference return a copy of the value otherwise detach the value to the + // specified |new_controller|. + base::DictionaryValue* CopyOrDetachValue(CefValueController* new_controller); + + // CefDictionaryValue methods. + virtual bool IsValid() OVERRIDE; + virtual bool IsOwned() OVERRIDE; + virtual bool IsReadOnly() OVERRIDE; + virtual CefRefPtr Copy( + bool exclude_empty_children) OVERRIDE; + virtual size_t GetSize() OVERRIDE; + virtual bool Clear() OVERRIDE; + virtual bool HasKey(const CefString& key) OVERRIDE; + virtual bool GetKeys(KeyList& keys) OVERRIDE; + virtual bool Remove(const CefString& key) OVERRIDE; + virtual CefValueType GetType(const CefString& key) OVERRIDE; + virtual bool GetBool(const CefString& key) OVERRIDE; + virtual int GetInt(const CefString& key) OVERRIDE; + virtual double GetDouble(const CefString& key) OVERRIDE; + virtual CefString GetString(const CefString& key) OVERRIDE; + virtual CefRefPtr GetBinary(const CefString& key) OVERRIDE; + virtual CefRefPtr GetDictionary( + const CefString& key) OVERRIDE; + virtual CefRefPtr GetList(const CefString& key) OVERRIDE; + virtual bool SetNull(const CefString& key) OVERRIDE; + virtual bool SetBool(const CefString& key, bool value) OVERRIDE; + virtual bool SetInt(const CefString& key, int value) OVERRIDE; + virtual bool SetDouble(const CefString& key, double value) OVERRIDE; + virtual bool SetString(const CefString& key, + const CefString& value) OVERRIDE; + virtual bool SetBinary(const CefString& key, + CefRefPtr value) OVERRIDE; + virtual bool SetDictionary(const CefString& key, + CefRefPtr value) OVERRIDE; + virtual bool SetList(const CefString& key, + CefRefPtr value) OVERRIDE; + + private: + // See the CefValueBase constructor for usage. + CefDictionaryValueImpl(base::DictionaryValue* value, + void* parent_value, + ValueMode value_mode, + bool read_only, + CefValueController* controller); + + bool RemoveInternal(const CefString& key); + + // For the Create() method. + friend class CefDictionaryValue; + + DISALLOW_COPY_AND_ASSIGN(CefDictionaryValueImpl); +}; + + +// CefListValue implementation +class CefListValueImpl + : public CefValueBase { + public: + // Get or create a reference value. + static CefRefPtr GetOrCreateRef( + base::ListValue* value, + void* parent_value, + bool read_only, + CefValueController* controller); + + // Return a copy of the value. + base::ListValue* CopyValue(); + + // If a reference return a copy of the value otherwise detach the value to the + // specified |new_controller|. + base::ListValue* CopyOrDetachValue(CefValueController* new_controller); + + /// CefListValue methods. + virtual bool IsValid() OVERRIDE; + virtual bool IsOwned() OVERRIDE; + virtual bool IsReadOnly() OVERRIDE; + virtual CefRefPtr Copy() OVERRIDE; + virtual bool SetSize(size_t size) OVERRIDE; + virtual size_t GetSize() OVERRIDE; + virtual bool Clear() OVERRIDE; + virtual bool Remove(int index) OVERRIDE; + virtual CefValueType GetType(int index) OVERRIDE; + virtual bool GetBool(int index) OVERRIDE; + virtual int GetInt(int index) OVERRIDE; + virtual double GetDouble(int index) OVERRIDE; + virtual CefString GetString(int index) OVERRIDE; + virtual CefRefPtr GetBinary(int index) OVERRIDE; + virtual CefRefPtr GetDictionary(int index) OVERRIDE; + virtual CefRefPtr GetList(int index) OVERRIDE; + virtual bool SetNull(int index) OVERRIDE; + virtual bool SetBool(int index, bool value) OVERRIDE; + virtual bool SetInt(int index, int value) OVERRIDE; + virtual bool SetDouble(int index, double value) OVERRIDE; + virtual bool SetString(int index, const CefString& value) OVERRIDE; + virtual bool SetBinary(int index, CefRefPtr value) OVERRIDE; + virtual bool SetDictionary(int index, + CefRefPtr value) OVERRIDE; + virtual bool SetList(int index, CefRefPtr value) OVERRIDE; + + private: + // See the CefValueBase constructor for usage. + CefListValueImpl(base::ListValue* value, + void* parent_value, + ValueMode value_mode, + bool read_only, + CefValueController* controller); + + bool RemoveInternal(int index); + + // For the Create() method. + friend class CefListValue; + + DISALLOW_COPY_AND_ASSIGN(CefListValueImpl); +}; + + +#endif // CEF_LIBCEF_COMMON_VALUES_IMPL_H_ diff --git a/libcef/renderer/browser_impl.cc b/libcef/renderer/browser_impl.cc new file mode 100644 index 000000000..4c214dd02 --- /dev/null +++ b/libcef/renderer/browser_impl.cc @@ -0,0 +1,690 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/renderer/browser_impl.h" + +#include +#include + +#include "libcef/common/cef_messages.h" +#include "libcef/common/content_client.h" +#include "libcef/common/process_message_impl.h" +#include "libcef/common/response_manager.h" +#include "libcef/renderer/content_renderer_client.h" +#include "libcef/renderer/dom_document_impl.h" +#include "libcef/renderer/thread_util.h" +#include "libcef/renderer/webkit_glue.h" + +#include "base/string16.h" +#include "base/string_util.h" +#include "base/utf_string_conversions.h" +#include "content/public/renderer/document_state.h" +#include "content/public/renderer/navigation_state.h" +#include "content/public/renderer/render_view.h" +#include "net/http/http_util.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" +#include "webkit/glue/webkit_glue.h" + +using WebKit::WebFrame; +using WebKit::WebScriptSource; +using WebKit::WebString; +using WebKit::WebURL; +using WebKit::WebView; + +namespace { + +const int64 kInvalidBrowserId = -1; +const int64 kInvalidFrameId = -1; + +} // namespace + + +// CefBrowserImpl static methods. +// ----------------------------------------------------------------------------- + +// static +CefRefPtr CefBrowserImpl::GetBrowserForView( + content::RenderView* view) { + return CefContentRendererClient::Get()->GetBrowserForView(view); +} + +// static +CefRefPtr CefBrowserImpl::GetBrowserForMainFrame( + WebKit::WebFrame* frame) { + return CefContentRendererClient::Get()->GetBrowserForMainFrame(frame); +} + + +// CefBrowser methods. +// ----------------------------------------------------------------------------- + +CefRefPtr CefBrowserImpl::GetHost() { + NOTREACHED() << "GetHost cannot be called from the render process"; + return NULL; +} + +bool CefBrowserImpl::CanGoBack() { + CEF_REQUIRE_RT_RETURN(false); + + return webkit_glue::CanGoBackOrForward(render_view()->GetWebView(), -1); +} + +void CefBrowserImpl::GoBack() { + CEF_REQUIRE_RT_RETURN_VOID(); + + webkit_glue::GoBackOrForward(render_view()->GetWebView(), -1); +} + +bool CefBrowserImpl::CanGoForward() { + CEF_REQUIRE_RT_RETURN(false); + + return webkit_glue::CanGoBackOrForward(render_view()->GetWebView(), 1); +} + +void CefBrowserImpl::GoForward() { + CEF_REQUIRE_RT_RETURN_VOID(); + + webkit_glue::GoBackOrForward(render_view()->GetWebView(), 1); +} + +bool CefBrowserImpl::IsLoading() { + CEF_REQUIRE_RT_RETURN(false); + + if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) + return render_view()->GetWebView()->mainFrame()->isLoading(); + return false; +} + +void CefBrowserImpl::Reload() { + CEF_REQUIRE_RT_RETURN_VOID(); + + if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) + render_view()->GetWebView()->mainFrame()->reload(false); +} + +void CefBrowserImpl::ReloadIgnoreCache() { + CEF_REQUIRE_RT_RETURN_VOID(); + + if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) + render_view()->GetWebView()->mainFrame()->reload(true); +} + +void CefBrowserImpl::StopLoad() { + CEF_REQUIRE_RT_RETURN_VOID(); + + if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) + render_view()->GetWebView()->mainFrame()->stopLoading(); +} + +int CefBrowserImpl::GetIdentifier() { + CEF_REQUIRE_RT_RETURN(0); + + return browser_window_id(); +} + +bool CefBrowserImpl::IsPopup() { + CEF_REQUIRE_RT_RETURN(false); + + return is_popup_; +} + +bool CefBrowserImpl::HasDocument() { + CEF_REQUIRE_RT_RETURN(false); + + if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) + return !render_view()->GetWebView()->mainFrame()->document().isNull(); + return false; +} + +CefRefPtr CefBrowserImpl::GetMainFrame() { + CEF_REQUIRE_RT_RETURN(NULL); + + if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) + return GetWebFrameImpl(render_view()->GetWebView()->mainFrame()).get(); + return NULL; +} + +CefRefPtr CefBrowserImpl::GetFocusedFrame() { + CEF_REQUIRE_RT_RETURN(NULL); + + if (render_view()->GetWebView() && + render_view()->GetWebView()->focusedFrame()) { + return GetWebFrameImpl(render_view()->GetWebView()->focusedFrame()).get(); + } + return NULL; +} + +CefRefPtr CefBrowserImpl::GetFrame(int64 identifier) { + CEF_REQUIRE_RT_RETURN(NULL); + + return GetWebFrameImpl(identifier).get(); +} + +CefRefPtr CefBrowserImpl::GetFrame(const CefString& name) { + CEF_REQUIRE_RT_RETURN(NULL); + + if (render_view()->GetWebView()) { + WebFrame* frame = + render_view()->GetWebView()->findFrameByName(name.ToString16()); + if (frame) + return GetWebFrameImpl(frame).get(); + } + + return NULL; +} + +size_t CefBrowserImpl::GetFrameCount() { + CEF_REQUIRE_RT_RETURN(0); + + int count = 0; + + if (render_view()->GetWebView()) { + WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); + if (main_frame) { + WebFrame* cur = main_frame; + do { + count++; + cur = cur->traverseNext(true); + } while (cur != main_frame); + } + } + + return count; +} + +void CefBrowserImpl::GetFrameIdentifiers(std::vector& identifiers) { + CEF_REQUIRE_RT_RETURN_VOID(); + + if (render_view()->GetWebView()) { + WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); + if (main_frame) { + WebFrame* cur = main_frame; + do { + identifiers.push_back(cur->identifier()); + cur = cur->traverseNext(true); + } while (cur != main_frame); + } + } +} + +void CefBrowserImpl::GetFrameNames(std::vector& names) { + CEF_REQUIRE_RT_RETURN_VOID(); + + if (render_view()->GetWebView()) { + WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); + if (main_frame) { + WebFrame* cur = main_frame; + do { + names.push_back(CefString(cur->name().utf8())); + cur = cur->traverseNext(true); + } while (cur != main_frame); + } + } +} + +bool CefBrowserImpl::SendProcessMessage(CefProcessId target_process, + CefRefPtr message) { + DCHECK_EQ(PID_BROWSER, target_process); + DCHECK(message.get()); + + Cef_Request_Params params; + CefProcessMessageImpl* impl = + static_cast(message.get()); + if (impl->CopyTo(params)) { + DCHECK(!params.name.empty()); + + params.frame_id = -1; + params.user_initiated = true; + params.request_id = -1; + params.expect_response = false; + + return Send(new CefHostMsg_Request(routing_id(), params)); + } + + return false; +} + + +// CefBrowserImpl public methods. +// ----------------------------------------------------------------------------- + +CefBrowserImpl::CefBrowserImpl(content::RenderView* render_view) + : content::RenderViewObserver(render_view), + browser_window_id_(kInvalidBrowserId), + is_popup_(false), + last_focused_frame_id_(kInvalidFrameId) { + response_manager_.reset(new CefResponseManager); +} + +CefBrowserImpl::~CefBrowserImpl() { +} + +void CefBrowserImpl::LoadRequest(const CefMsg_LoadRequest_Params& params) { + CefRefPtr framePtr = GetWebFrameImpl(params.frame_id); + if (!framePtr.get()) + return; + + WebFrame* web_frame = framePtr->web_frame(); + + WebKit::WebURLRequest request(params.url); + + // DidCreateDataSource checks for this value. + request.setRequestorID(-1); + + if (!params.method.empty()) + request.setHTTPMethod(ASCIIToUTF16(params.method)); + + if (params.referrer.is_valid()) { + WebString referrer = WebKit::WebSecurityPolicy::generateReferrerHeader( + static_cast(params.referrer_policy), + params.url, + WebString::fromUTF8(params.referrer.spec())); + if (!referrer.isEmpty()) + request.setHTTPHeaderField(WebString::fromUTF8("Referer"), referrer); + } + + if (params.first_party_for_cookies.is_valid()) + request.setFirstPartyForCookies(params.first_party_for_cookies); + + if (!params.headers.empty()) { + for (net::HttpUtil::HeadersIterator i(params.headers.begin(), + params.headers.end(), "\n"); + i.GetNext(); ) { + request.addHTTPHeaderField(WebString::fromUTF8(i.name()), + WebString::fromUTF8(i.values())); + } + } + + if (params.upload_data.get()) { + string16 method = request.httpMethod(); + if (method == ASCIIToUTF16("GET") || method == ASCIIToUTF16("HEAD")) + request.setHTTPMethod(ASCIIToUTF16("POST")); + + if (request.httpHeaderField(ASCIIToUTF16("Content-Type")).length() == 0) { + request.setHTTPHeaderField( + ASCIIToUTF16("Content-Type"), + ASCIIToUTF16("application/x-www-form-urlencoded")); + } + + WebKit::WebHTTPBody body; + body.initialize(); + + std::vector* elements = + params.upload_data->elements(); + std::vector::const_iterator it = + elements->begin(); + for (; it != elements->end(); ++it) { + const net::UploadData::Element& element = *it; + if (element.type() == net::UploadData::TYPE_BYTES) { + WebKit::WebData data; + data.assign(std::string(element.bytes().begin(), + element.bytes().end()).c_str(), + element.bytes().size()); + body.appendData(data); + } else if (element.type() == net::UploadData::TYPE_FILE) { + body.appendFile(webkit_glue::FilePathToWebString(element.file_path())); + } else { + NOTREACHED(); + } + } + + request.setHTTPBody(body); + } + + web_frame->loadRequest(request); +} + +CefRefPtr CefBrowserImpl::GetWebFrameImpl( + WebKit::WebFrame* frame) { + DCHECK(frame); + int64 frame_id = frame->identifier(); + + // Frames are re-used between page loads. Only add the frame to the map once. + FrameMap::const_iterator it = frames_.find(frame_id); + if (it != frames_.end()) + return it->second; + + CefRefPtr framePtr(new CefFrameImpl(this, frame)); + frames_.insert(std::make_pair(frame_id, framePtr)); + + int64 parent_id = frame->parent() == NULL ? + kInvalidFrameId : frame->parent()->identifier(); + string16 name = frame->name(); + + // Notify the browser that the frame has been identified. + Send(new CefHostMsg_FrameIdentified(routing_id(), frame_id, parent_id, name)); + + return framePtr; +} + +CefRefPtr CefBrowserImpl::GetWebFrameImpl(int64 frame_id) { + if (frame_id == kInvalidFrameId) { + if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) + return GetWebFrameImpl(render_view()->GetWebView()->mainFrame()); + return NULL; + } + + // Check if we already know about the frame. + FrameMap::const_iterator it = frames_.find(frame_id); + if (it != frames_.end()) + return it->second; + + if (render_view()->GetWebView()) { + // Check if the frame exists but we don't know about it yet. + WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); + if (main_frame) { + WebFrame* cur = main_frame; + do { + if (cur->identifier() == frame_id) + return GetWebFrameImpl(cur); + cur = cur->traverseNext(true); + } while (cur != main_frame); + } + } + + return NULL; +} + +void CefBrowserImpl::AddFrameObject(int64 frame_id, + CefTrackNode* tracked_object) { + CefRefPtr manager; + + if (!frame_objects_.empty()) { + FrameObjectMap::const_iterator it = frame_objects_.find(frame_id); + if (it != frame_objects_.end()) + manager = it->second; + } + + if (!manager.get()) { + manager = new CefTrackManager(); + frame_objects_.insert(std::make_pair(frame_id, manager)); + } + + manager->Add(tracked_object); +} + + +// RenderViewObserver methods. +// ----------------------------------------------------------------------------- + +void CefBrowserImpl::OnDestruct() { + // Notify that the browser window has been destroyed. + CefRefPtr app = CefContentClient::Get()->application(); + if (app.get()) { + CefRefPtr handler = + app->GetRenderProcessHandler(); + if (handler.get()) + handler->OnBrowserDestroyed(this); + } + + response_manager_.reset(NULL); + + CefContentRendererClient::Get()->OnBrowserDestroyed(this); +} + +void CefBrowserImpl::DidStartProvisionalLoad(WebKit::WebFrame* frame) { + // Send the frame creation notification if necessary. + GetWebFrameImpl(frame); +} + +void CefBrowserImpl::FrameDetached(WebFrame* frame) { + int64 frame_id = frame->identifier(); + + { + // Remove the frame from the map. + FrameMap::iterator it = frames_.find(frame_id); + DCHECK(it != frames_.end()); + it->second->Detach(); + frames_.erase(it); + } + + if (!frame_objects_.empty()) { + // Remove any tracked objects associated with the frame. + FrameObjectMap::iterator it = frame_objects_.find(frame_id); + if (it != frame_objects_.end()) + frame_objects_.erase(it); + } + + // Notify the browser that the frame has detached. + Send(new CefHostMsg_FrameDetached(routing_id(), frame_id)); +} + +void CefBrowserImpl::FocusedNodeChanged(const WebKit::WebNode& node) { + // Notify the handler. + CefRefPtr app = CefContentClient::Get()->application(); + if (app.get()) { + CefRefPtr handler = + app->GetRenderProcessHandler(); + if (handler.get()) { + if (node.isNull()) { + handler->OnFocusedNodeChanged(this, GetFocusedFrame(), NULL); + } else { + const WebKit::WebDocument& document = node.document(); + if (!document.isNull()) { + WebKit::WebFrame* frame = document.frame(); + CefRefPtr documentImpl = + new CefDOMDocumentImpl(this, frame); + handler->OnFocusedNodeChanged(this, + GetWebFrameImpl(frame).get(), + documentImpl->GetOrCreateNode(node)); + documentImpl->Detach(); + } + } + } + } + + // TODO(cef): This method is being used as a work-around for identifying frame + // focus changes. The ideal approach would be implementating delegation from + // ChromeClientImpl::focusedFrameChanged(). + + WebFrame* focused_frame = NULL; + + // Try to identify the focused frame from the node. + if (!node.isNull()) { + const WebKit::WebDocument& document = node.document(); + if (!document.isNull()) + focused_frame = document.frame(); + } + + if (focused_frame == NULL && render_view()->GetWebView()) { + // Try to identify the global focused frame. + focused_frame = render_view()->GetWebView()->focusedFrame(); + } + + int64 frame_id = kInvalidFrameId; + if (focused_frame != NULL) + frame_id = focused_frame->identifier(); + + // Don't send a message if the focused frame has not changed. + if (frame_id == last_focused_frame_id_) + return; + + last_focused_frame_id_ = frame_id; + Send(new CefHostMsg_FrameFocusChange(routing_id(), frame_id)); +} + +void CefBrowserImpl::DidCreateDataSource(WebKit::WebFrame* frame, + WebKit::WebDataSource* ds) { + const WebKit::WebURLRequest& request = ds->request(); + if (request.requestorID() == -1) { + // Mark the request as browser-initiated so + // RenderViewImpl::decidePolicyForNavigation won't attempt to fork it. + content::DocumentState* document_state = + content::DocumentState::FromDataSource(ds); + document_state->set_navigation_state( + content::NavigationState::CreateBrowserInitiated(-1, -1, + content::PAGE_TRANSITION_LINK)); + } + + if (frame->parent() == 0) { + GURL url = ds->request().url(); + if (!url.is_empty()) { + // Notify that the loading URL has changed. + Send(new CefHostMsg_LoadingURLChange(routing_id(), url)); + } + } +} + +bool CefBrowserImpl::OnMessageReceived(const IPC::Message& message) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(CefBrowserImpl, message) + IPC_MESSAGE_HANDLER(CefMsg_UpdateBrowserWindowId, + OnUpdateBrowserWindowId) + IPC_MESSAGE_HANDLER(CefMsg_Request, OnRequest) + IPC_MESSAGE_HANDLER(CefMsg_Response, OnResponse) + IPC_MESSAGE_HANDLER(CefMsg_ResponseAck, OnResponseAck) + IPC_MESSAGE_HANDLER(CefMsg_LoadRequest, LoadRequest) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + return handled; +} + + +// RenderViewObserver::OnMessageReceived message handlers. +// ----------------------------------------------------------------------------- + +void CefBrowserImpl::OnUpdateBrowserWindowId(int window_id, bool is_popup) { + // This message should only be sent one time. + DCHECK(browser_window_id_ == kInvalidBrowserId); + + browser_window_id_ = window_id; + is_popup_ = is_popup; + + // Notify that the browser window has been created. + CefRefPtr app = CefContentClient::Get()->application(); + if (app.get()) { + CefRefPtr handler = + app->GetRenderProcessHandler(); + if (handler.get()) + handler->OnBrowserCreated(this); + } +} + +void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) { + bool success = false; + std::string response; + bool expect_response_ack = false; + + if (params.user_initiated) { + // Give the user a chance to handle the request. + CefRefPtr app = CefContentClient::Get()->application(); + if (app.get()) { + CefRefPtr handler = + app->GetRenderProcessHandler(); + if (handler.get()) { + CefRefPtr message( + new CefProcessMessageImpl(const_cast(¶ms), + false, true)); + success = handler->OnProcessMessageReceived(this, PID_BROWSER, + message.get()); + message->Detach(NULL); + } + } + } else if (params.name == "execute-code") { + // Execute code. + CefRefPtr framePtr = GetWebFrameImpl(params.frame_id); + if (framePtr.get()) { + WebFrame* web_frame = framePtr->web_frame(); + if (web_frame) { + DCHECK_EQ(params.arguments.GetSize(), (size_t)4); + + bool is_javascript = false; + string16 code, script_url; + int script_start_line = 0; + + params.arguments.GetBoolean(0, &is_javascript); + params.arguments.GetString(1, &code); + DCHECK(!code.empty()); + params.arguments.GetString(2, &script_url); + params.arguments.GetInteger(3, &script_start_line); + DCHECK_GE(script_start_line, 0); + + if (is_javascript) { + web_frame->executeScript( + WebScriptSource(code, + GURL(UTF16ToUTF8(script_url)), + script_start_line)); + success = true; + } else { + // TODO(cef): implement support for CSS code. + NOTIMPLEMENTED(); + } + } + } + } else if (params.name == "execute-command") { + // Execute command. + CefRefPtr framePtr = GetWebFrameImpl(params.frame_id); + if (framePtr.get()) { + WebFrame* web_frame = framePtr->web_frame(); + if (web_frame) { + DCHECK_EQ(params.arguments.GetSize(), (size_t)1); + + string16 command; + + params.arguments.GetString(0, &command); + DCHECK(!command.empty()); + + if (LowerCaseEqualsASCII(command, "getsource")) { + response = web_frame->contentAsMarkup().utf8(); + success = true; + } else if (LowerCaseEqualsASCII(command, "gettext")) { + response = UTF16ToUTF8(webkit_glue::DumpDocumentText(web_frame)); + success = true; + } else if (web_frame->executeCommand(command)) { + success = true; + } + } + } + } else if (params.name == "load-string") { + // Load a string. + CefRefPtr framePtr = GetWebFrameImpl(params.frame_id); + if (framePtr.get()) { + WebFrame* web_frame = framePtr->web_frame(); + if (web_frame) { + DCHECK_EQ(params.arguments.GetSize(), (size_t)2); + + string16 string, url; + + params.arguments.GetString(0, &string); + params.arguments.GetString(1, &url); + + web_frame->loadHTMLString(UTF16ToUTF8(string), GURL(UTF16ToUTF8(url))); + } + } + } else { + // Invalid request. + NOTREACHED(); + } + + if (params.expect_response) { + DCHECK_GE(params.request_id, 0); + + // Send a response to the browser. + Cef_Response_Params response_params; + response_params.request_id = params.request_id; + response_params.success = success; + response_params.response = response; + response_params.expect_response_ack = expect_response_ack; + Send(new CefHostMsg_Response(routing_id(), response_params)); + } +} + +void CefBrowserImpl::OnResponse(const Cef_Response_Params& params) { + response_manager_->RunHandler(params); + if (params.expect_response_ack) + Send(new CefHostMsg_ResponseAck(routing_id(), params.request_id)); +} + +void CefBrowserImpl::OnResponseAck(int request_id) { + response_manager_->RunAckHandler(request_id); +} diff --git a/libcef/renderer/browser_impl.h b/libcef/renderer/browser_impl.h new file mode 100644 index 000000000..1dac457fd --- /dev/null +++ b/libcef/renderer/browser_impl.h @@ -0,0 +1,135 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_RENDERER_BROWSER_IMPL_H_ +#define CEF_LIBCEF_RENDERER_BROWSER_IMPL_H_ +#pragma once + +#include +#include +#include + +#include "include/cef_browser.h" +#include "include/cef_client.h" +#include "libcef/common/tracker.h" +#include "libcef/renderer/frame_impl.h" + +#include "base/memory/scoped_ptr.h" +#include "content/public/renderer/render_view_observer.h" + +class GURL; +struct CefMsg_LoadRequest_Params; +struct Cef_Request_Params; +struct Cef_Response_Params; +class CefContentRendererClient; +class CefResponseManager; + +namespace base { +class ListValue; +} + +namespace WebKit { +class WebFrame; +} + +// Renderer plumbing for CEF features. There is a one-to-one relationship +// between RenderView on the renderer side and RenderViewHost on the browser +// side. +// +// RenderViewObserver: Interface for observing RenderView notifications and IPC +// messages. IPC messages received by the RenderView will be forwarded to this +// RenderViewObserver implementation. IPC messages sent using +// RenderViewObserver::Send() will be forwarded to the RenderView. Use +// RenderViewObserver::routing_id() when sending IPC messages. +class CefBrowserImpl : public CefBrowser, + public content::RenderViewObserver { + public: + // Returns the browser associated with the specified RenderView. + static CefRefPtr GetBrowserForView(content::RenderView* view); + // Returns the browser associated with the specified main WebFrame. + static CefRefPtr GetBrowserForMainFrame( + WebKit::WebFrame* frame); + + // CefBrowser methods. + virtual CefRefPtr GetHost() OVERRIDE; + virtual bool CanGoBack() OVERRIDE; + virtual void GoBack() OVERRIDE; + virtual bool CanGoForward() OVERRIDE; + virtual void GoForward() OVERRIDE; + virtual bool IsLoading() OVERRIDE; + virtual void Reload() OVERRIDE; + virtual void ReloadIgnoreCache() OVERRIDE; + virtual void StopLoad() OVERRIDE; + virtual int GetIdentifier() OVERRIDE; + virtual bool IsPopup() OVERRIDE; + virtual bool HasDocument() OVERRIDE; + virtual CefRefPtr GetMainFrame() OVERRIDE; + virtual CefRefPtr GetFocusedFrame() OVERRIDE; + virtual CefRefPtr GetFrame(int64 identifier) OVERRIDE; + virtual CefRefPtr GetFrame(const CefString& name) OVERRIDE; + virtual size_t GetFrameCount() OVERRIDE; + virtual void GetFrameIdentifiers(std::vector& identifiers) OVERRIDE; + virtual void GetFrameNames(std::vector& names) OVERRIDE; + virtual bool SendProcessMessage( + CefProcessId target_process, + CefRefPtr message) OVERRIDE; + + explicit CefBrowserImpl(content::RenderView* render_view); + virtual ~CefBrowserImpl(); + + void LoadRequest(const CefMsg_LoadRequest_Params& params); + + // Returns the matching CefFrameImpl reference or creates a new one. + CefRefPtr GetWebFrameImpl(WebKit::WebFrame* frame); + CefRefPtr GetWebFrameImpl(int64 frame_id); + + // Frame objects will be deleted immediately before the frame is closed. + void AddFrameObject(int64 frame_id, CefTrackNode* tracked_object); + + int browser_window_id() const { return browser_window_id_; } + content::RenderView* render_view() { + return content::RenderViewObserver::render_view(); + } + + private: + // RenderViewObserver methods. + virtual void OnDestruct() OVERRIDE; + virtual void DidStartProvisionalLoad(WebKit::WebFrame* frame) OVERRIDE; + virtual void FrameDetached(WebKit::WebFrame* frame) OVERRIDE; + virtual void FocusedNodeChanged(const WebKit::WebNode& node) OVERRIDE; + virtual void DidCreateDataSource(WebKit::WebFrame* frame, + WebKit::WebDataSource* ds) OVERRIDE; + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + + // RenderViewObserver::OnMessageReceived message handlers. + void OnUpdateBrowserWindowId(int window_id, bool is_popup); + void OnRequest(const Cef_Request_Params& params); + void OnResponse(const Cef_Response_Params& params); + void OnResponseAck(int request_id); + + // Id number of browser window which RenderView is attached to. + int browser_window_id_; + bool is_popup_; + + // Id of the last frame that had focus. + int64 last_focused_frame_id_; + + // Map of unique frame ids to CefFrameImpl references. + typedef std::map > FrameMap; + FrameMap frames_; + + // Map of unique frame ids to CefTrackManager objects that need to be cleaned + // up when the frame is deleted. + typedef std::map > FrameObjectMap; + FrameObjectMap frame_objects_; + + // Manages response registrations. + scoped_ptr response_manager_; + + IMPLEMENT_REFCOUNTING(CefBrowserImpl); + DISALLOW_COPY_AND_ASSIGN(CefBrowserImpl); +}; + +#endif // CEF_LIBCEF_RENDERER_BROWSER_IMPL_H_ diff --git a/libcef/renderer/content_renderer_client.cc b/libcef/renderer/content_renderer_client.cc new file mode 100644 index 000000000..142141175 --- /dev/null +++ b/libcef/renderer/content_renderer_client.cc @@ -0,0 +1,225 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/renderer/content_renderer_client.h" + +#include "libcef/common/cef_messages.h" +#include "libcef/common/content_client.h" +#include "libcef/renderer/browser_impl.h" +#include "libcef/renderer/render_process_observer.h" +#include "libcef/renderer/thread_util.h" +#include "libcef/renderer/v8_impl.h" + +#include "content/common/child_thread.h" +#include "content/public/renderer/render_thread.h" +#include "content/public/renderer/render_view.h" +#include "ipc/ipc_sync_channel.h" +#include "third_party/WebKit/Source/Platform/chromium/public/WebPrerenderingSupport.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPrerendererClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" +#include "v8/include/v8.h" + + +namespace { + +// Stub implementation of WebKit::WebPrerenderingSupport. +class CefPrerenderingSupport : public WebKit::WebPrerenderingSupport { + public: + virtual ~CefPrerenderingSupport() {} + + private: + virtual void add(const WebKit::WebPrerender& prerender) OVERRIDE {} + virtual void cancel(const WebKit::WebPrerender& prerender) OVERRIDE {} + virtual void abandon(const WebKit::WebPrerender& prerender) OVERRIDE {} +}; + +// Stub implementation of WebKit::WebPrerendererClient. +class CefPrerendererClient : public content::RenderViewObserver, + public WebKit::WebPrerendererClient { + public: + explicit CefPrerendererClient(content::RenderView* render_view) + : content::RenderViewObserver(render_view) { + DCHECK(render_view); + render_view->GetWebView()->setPrerendererClient(this); + } + + private: + virtual ~CefPrerendererClient() {} + + virtual void willAddPrerender(WebKit::WebPrerender* prerender) OVERRIDE {} +}; + +} // namespace + +struct CefContentRendererClient::SchemeInfo { + std::string scheme_name; + bool is_local; + bool is_display_isolated; +}; + +CefContentRendererClient::CefContentRendererClient() { +} + +CefContentRendererClient::~CefContentRendererClient() { +} + +// static +CefContentRendererClient* CefContentRendererClient::Get() { + return static_cast( + content::GetContentClient()->renderer()); +} + +CefRefPtr CefContentRendererClient::GetBrowserForView( + content::RenderView* view) { + CEF_REQUIRE_RT_RETURN(NULL); + + BrowserMap::const_iterator it = browsers_.find(view); + if (it != browsers_.end()) + return it->second; + return NULL; +} + +CefRefPtr CefContentRendererClient::GetBrowserForMainFrame( + WebKit::WebFrame* frame) { + CEF_REQUIRE_RT_RETURN(NULL); + + BrowserMap::const_iterator it = browsers_.begin(); + for (; it != browsers_.end(); ++it) { + content::RenderView* render_view = it->second->render_view(); + if (render_view && render_view->GetWebView() && + render_view->GetWebView()->mainFrame() == frame) { + return it->second; + } + } + + return NULL; +} + +void CefContentRendererClient::OnBrowserDestroyed(CefBrowserImpl* browser) { + BrowserMap::iterator it = browsers_.begin(); + for (; it != browsers_.end(); ++it) { + if (it->second.get() == browser) { + browsers_.erase(it); + return; + } + } + + // No browser was found in the map. + NOTREACHED(); +} + +void CefContentRendererClient::AddCustomScheme( + const std::string& scheme_name, + bool is_local, + bool is_display_isolated) { + SchemeInfo info = {scheme_name, is_local, is_display_isolated}; + scheme_info_list_.push_back(info); +} + +void CefContentRendererClient::RegisterCustomSchemes() { + if (scheme_info_list_.empty()) + return; + + SchemeInfoList::const_iterator it = scheme_info_list_.begin(); + for (; it != scheme_info_list_.end(); ++it) { + const SchemeInfo& info = *it; + if (info.is_local) { + WebKit::WebSecurityPolicy::registerURLSchemeAsLocal( + WebKit::WebString::fromUTF8(info.scheme_name)); + } + if (info.is_display_isolated) { + WebKit::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated( + WebKit::WebString::fromUTF8(info.scheme_name)); + } + } +} + +void CefContentRendererClient::RenderThreadStarted() { + render_loop_ = base::MessageLoopProxy::current(); + observer_.reset(new CefRenderProcessObserver()); + + content::RenderThread* thread = content::RenderThread::Get(); + thread->AddObserver(observer_.get()); + + WebKit::WebPrerenderingSupport::initialize(new CefPrerenderingSupport()); + + thread->Send(new CefProcessHostMsg_RenderThreadStarted); + + // Notify the render process handler. + CefRefPtr application = CefContentClient::Get()->application(); + if (application.get()) { + CefRefPtr handler = + application->GetRenderProcessHandler(); + if (handler.get()) + handler->OnRenderThreadCreated(); + } +} + +void CefContentRendererClient::RenderViewCreated( + content::RenderView* render_view) { + CefRefPtr browser = new CefBrowserImpl(render_view); + browsers_.insert(std::make_pair(render_view, browser)); + + new CefPrerendererClient(render_view); +} + +void CefContentRendererClient::DidCreateScriptContext( + WebKit::WebFrame* frame, v8::Handle context, + int extension_group, int world_id) { + // Notify the render process handler. + CefRefPtr application = CefContentClient::Get()->application(); + if (!application.get()) + return; + + CefRefPtr handler = + application->GetRenderProcessHandler(); + if (!handler.get()) + return; + + CefRefPtr browserPtr = + CefBrowserImpl::GetBrowserForMainFrame(frame->top()); + DCHECK(browserPtr.get()); + if (!browserPtr.get()) + return; + + CefRefPtr framePtr = browserPtr->GetWebFrameImpl(frame); + + v8::HandleScope handle_scope; + v8::Context::Scope scope(context); + + CefRefPtr contextPtr(new CefV8ContextImpl(context)); + + handler->OnContextCreated(browserPtr.get(), framePtr.get(), contextPtr); +} + +void CefContentRendererClient::WillReleaseScriptContext( + WebKit::WebFrame* frame, v8::Handle context, int world_id) { + // Notify the render process handler. + CefRefPtr application = CefContentClient::Get()->application(); + if (!application.get()) + return; + + CefRefPtr handler = + application->GetRenderProcessHandler(); + if (!handler.get()) + return; + + CefRefPtr browserPtr = + CefBrowserImpl::GetBrowserForMainFrame(frame->top()); + DCHECK(browserPtr.get()); + if (!browserPtr.get()) + return; + + CefRefPtr framePtr = browserPtr->GetWebFrameImpl(frame); + + v8::HandleScope handle_scope; + v8::Context::Scope scope(context); + + CefRefPtr contextPtr(new CefV8ContextImpl(context)); + + handler->OnContextReleased(browserPtr.get(), framePtr.get(), contextPtr); +} diff --git a/libcef/renderer/content_renderer_client.h b/libcef/renderer/content_renderer_client.h new file mode 100644 index 000000000..a38adb46d --- /dev/null +++ b/libcef/renderer/content_renderer_client.h @@ -0,0 +1,76 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_RENDERER_CONTENT_RENDERER_CLIENT_H_ +#define CEF_LIBCEF_RENDERER_CONTENT_RENDERER_CLIENT_H_ +#pragma once + +#include +#include +#include + +#include "libcef/renderer/browser_impl.h" + +#include "base/compiler_specific.h" +#include "base/memory/scoped_ptr.h" +#include "base/message_loop_proxy.h" +#include "content/public/renderer/content_renderer_client.h" + +class CefRenderProcessObserver; + + +class CefContentRendererClient : public content::ContentRendererClient { + public: + CefContentRendererClient(); + virtual ~CefContentRendererClient(); + + // Returns the singleton CefContentRendererClient instance. + static CefContentRendererClient* Get(); + + // Returns the browser associated with the specified RenderView. + CefRefPtr GetBrowserForView(content::RenderView* view); + + // Returns the browser associated with the specified main WebFrame. + CefRefPtr GetBrowserForMainFrame(WebKit::WebFrame* frame); + + // Called from CefBrowserImpl::OnDestruct(). + void OnBrowserDestroyed(CefBrowserImpl* browser); + + // Add a custom scheme registration. + void AddCustomScheme(const std::string& scheme_name, + bool is_local, + bool is_display_isolated); + + // Register the custom schemes with WebKit. + void RegisterCustomSchemes(); + + // Render thread message loop proxy. + base::MessageLoopProxy* render_loop() const { return render_loop_.get(); } + + private: + // ContentRendererClient implementation. + virtual void RenderThreadStarted() OVERRIDE; + virtual void RenderViewCreated(content::RenderView* render_view) OVERRIDE; + virtual void DidCreateScriptContext(WebKit::WebFrame* frame, + v8::Handle context, + int extension_group, + int world_id) OVERRIDE; + virtual void WillReleaseScriptContext(WebKit::WebFrame* frame, + v8::Handle context, + int world_id) OVERRIDE; + + scoped_refptr render_loop_; + scoped_ptr observer_; + + // Map of RenderView pointers to CefBrowserImpl references. + typedef std::map > BrowserMap; + BrowserMap browsers_; + + // Information about custom schemes that need to be registered with WebKit. + struct SchemeInfo; + typedef std::list SchemeInfoList; + SchemeInfoList scheme_info_list_; +}; + +#endif // CEF_LIBCEF_RENDERER_CONTENT_RENDERER_CLIENT_H_ diff --git a/libcef/renderer/dom_document_impl.cc b/libcef/renderer/dom_document_impl.cc new file mode 100644 index 000000000..a178c5133 --- /dev/null +++ b/libcef/renderer/dom_document_impl.cc @@ -0,0 +1,262 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/renderer/dom_document_impl.h" +#include "libcef/renderer/dom_node_impl.h" +#include "libcef/renderer/thread_util.h" + +#include "base/logging.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" + +using WebKit::WebDocument; +using WebKit::WebElement; +using WebKit::WebFrame; +using WebKit::WebNode; +using WebKit::WebRange; +using WebKit::WebString; +using WebKit::WebURL; + + +CefDOMDocumentImpl::CefDOMDocumentImpl(CefBrowserImpl* browser, + WebFrame* frame) + : browser_(browser), + frame_(frame) { + const WebDocument& document = frame_->document(); + DCHECK(!document.isNull()); +} + +CefDOMDocumentImpl::~CefDOMDocumentImpl() { + CEF_REQUIRE_RT(); + + // Verify that the Detach() method has been called. + DCHECK(frame_ == NULL); +} + +CefDOMDocumentImpl::Type CefDOMDocumentImpl::GetType() { + if (!VerifyContext()) + return DOM_DOCUMENT_TYPE_UNKNOWN; + + const WebDocument& document = frame_->document(); + if (document.isHTMLDocument()) + return DOM_DOCUMENT_TYPE_HTML; + if (document.isXHTMLDocument()) + return DOM_DOCUMENT_TYPE_XHTML; + if (document.isPluginDocument()) + return DOM_DOCUMENT_TYPE_PLUGIN; + return DOM_DOCUMENT_TYPE_UNKNOWN; +} + +CefRefPtr CefDOMDocumentImpl::GetDocument() { + const WebDocument& document = frame_->document(); + return GetOrCreateNode(document.document()); +} + +CefRefPtr CefDOMDocumentImpl::GetBody() { + const WebDocument& document = frame_->document(); + return GetOrCreateNode(document.body()); +} + +CefRefPtr CefDOMDocumentImpl::GetHead() { + WebDocument document = frame_->document(); + return GetOrCreateNode(document.head()); +} + +CefString CefDOMDocumentImpl::GetTitle() { + CefString str; + if (!VerifyContext()) + return str; + + const WebDocument& document = frame_->document(); + const WebString& title = document.title(); + if (!title.isNull()) + str = title; + + return str; +} + +CefRefPtr CefDOMDocumentImpl::GetElementById(const CefString& id) { + const WebDocument& document = frame_->document(); + return GetOrCreateNode(document.getElementById(string16(id))); +} + +CefRefPtr CefDOMDocumentImpl::GetFocusedNode() { + const WebDocument& document = frame_->document(); + return GetOrCreateNode(document.focusedNode()); +} + +bool CefDOMDocumentImpl::HasSelection() { + if (!VerifyContext()) + return false; + + return frame_->hasSelection(); +} + +CefRefPtr CefDOMDocumentImpl::GetSelectionStartNode() { + if (!VerifyContext() || !frame_->hasSelection()) + return NULL; + + const WebRange& range = frame_->selectionRange(); + if (range.isNull()) + return NULL; + + int exceptionCode; + return GetOrCreateNode(range.startContainer(exceptionCode)); +} + +int CefDOMDocumentImpl::GetSelectionStartOffset() { + if (!VerifyContext() || !frame_->hasSelection()) + return 0; + + const WebRange& range = frame_->selectionRange(); + if (range.isNull()) + return 0; + + return range.startOffset(); +} + +CefRefPtr CefDOMDocumentImpl::GetSelectionEndNode() { + if (!VerifyContext() || !frame_->hasSelection()) + return NULL; + + const WebRange& range = frame_->selectionRange(); + if (range.isNull()) + return NULL; + + int exceptionCode; + return GetOrCreateNode(range.endContainer(exceptionCode)); +} + +int CefDOMDocumentImpl::GetSelectionEndOffset() { + if (!VerifyContext() || !frame_->hasSelection()) + return 0; + + const WebRange& range = frame_->selectionRange(); + if (range.isNull()) + return 0; + + return range.endOffset(); +} + +CefString CefDOMDocumentImpl::GetSelectionAsMarkup() { + CefString str; + if (!VerifyContext() || !frame_->hasSelection()) + return str; + + const WebString& markup = frame_->selectionAsMarkup(); + if (!markup.isNull()) + str = markup; + + return str; +} + +CefString CefDOMDocumentImpl::GetSelectionAsText() { + CefString str; + if (!VerifyContext() || !frame_->hasSelection()) + return str; + + const WebString& text = frame_->selectionAsText(); + if (!text.isNull()) + str = text; + + return str; +} + +CefString CefDOMDocumentImpl::GetBaseURL() { + CefString str; + if (!VerifyContext()) + return str; + + const WebDocument& document = frame_->document(); + const WebURL& url = document.baseURL(); + if (!url.isNull()) { + GURL gurl = url; + str = gurl.spec(); + } + + return str; +} + +CefString CefDOMDocumentImpl::GetCompleteURL(const CefString& partialURL) { + CefString str; + if (!VerifyContext()) + return str; + + const WebDocument& document = frame_->document(); + const WebURL& url = document.completeURL(string16(partialURL)); + if (!url.isNull()) { + GURL gurl = url; + str = gurl.spec(); + } + + return str; +} + +CefRefPtr CefDOMDocumentImpl::GetOrCreateNode( + const WebKit::WebNode& node) { + if (!VerifyContext()) + return NULL; + + // Nodes may potentially be null. + if (node.isNull()) + return NULL; + + if (!node_map_.empty()) { + // Locate the existing node, if any. + NodeMap::const_iterator it = node_map_.find(node); + if (it != node_map_.end()) + return it->second; + } + + // Create the new node object. + CefRefPtr nodeImpl(new CefDOMNodeImpl(this, node)); + node_map_.insert(std::make_pair(node, nodeImpl)); + return nodeImpl; +} + +void CefDOMDocumentImpl::RemoveNode(const WebKit::WebNode& node) { + if (!VerifyContext()) + return; + + if (!node_map_.empty()) { + NodeMap::iterator it = node_map_.find(node); + if (it != node_map_.end()) + node_map_.erase(it); + } +} + +void CefDOMDocumentImpl::Detach() { + if (!VerifyContext()) + return; + + // If you hit this assert it means that you are keeping references to node + // objects beyond the valid scope. + DCHECK(node_map_.empty()); + + // If you hit this assert it means that you are keeping references to this + // document object beyond the valid scope. + DCHECK_EQ(GetRefCt(), 1); + + if (!node_map_.empty()) { + NodeMap::const_iterator it = node_map_.begin(); + for (; it != node_map_.end(); ++it) + static_cast(it->second)->Detach(); + node_map_.clear(); + } + + frame_ = NULL; +} + +bool CefDOMDocumentImpl::VerifyContext() { + if (!CEF_CURRENTLY_ON_RT() || frame_ == NULL) { + NOTREACHED(); + return false; + } + return true; +} diff --git a/libcef/renderer/dom_document_impl.h b/libcef/renderer/dom_document_impl.h new file mode 100644 index 000000000..966da1943 --- /dev/null +++ b/libcef/renderer/dom_document_impl.h @@ -0,0 +1,66 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_DOM_DOCUMENT_IMPL_H_ +#define CEF_LIBCEF_DOM_DOCUMENT_IMPL_H_ +#pragma once + +#include +#include "include/cef_dom.h" + +namespace WebKit { +class WebFrame; +class WebNode; +}; + +class CefBrowserImpl; + +class CefDOMDocumentImpl : public CefDOMDocument { + public: + CefDOMDocumentImpl(CefBrowserImpl* browser, + WebKit::WebFrame* frame); + virtual ~CefDOMDocumentImpl(); + + // CefDOMDocument methods. + virtual Type GetType() OVERRIDE; + virtual CefRefPtr GetDocument() OVERRIDE; + virtual CefRefPtr GetBody() OVERRIDE; + virtual CefRefPtr GetHead() OVERRIDE; + virtual CefString GetTitle() OVERRIDE; + virtual CefRefPtr GetElementById(const CefString& id) OVERRIDE; + virtual CefRefPtr GetFocusedNode() OVERRIDE; + virtual bool HasSelection() OVERRIDE; + virtual CefRefPtr GetSelectionStartNode() OVERRIDE; + virtual int GetSelectionStartOffset() OVERRIDE; + virtual CefRefPtr GetSelectionEndNode() OVERRIDE; + virtual int GetSelectionEndOffset() OVERRIDE; + virtual CefString GetSelectionAsMarkup() OVERRIDE; + virtual CefString GetSelectionAsText() OVERRIDE; + virtual CefString GetBaseURL() OVERRIDE; + virtual CefString GetCompleteURL(const CefString& partialURL) OVERRIDE; + + CefBrowserImpl* GetBrowser() { return browser_; } + WebKit::WebFrame* GetFrame() { return frame_; } + + // The document maintains a map of all existing node objects. + CefRefPtr GetOrCreateNode(const WebKit::WebNode& node); + void RemoveNode(const WebKit::WebNode& node); + + // Must be called before the object is destroyed. + void Detach(); + + // Verify that the object exists and is being accessed on the UI thread. + bool VerifyContext(); + + protected: + CefBrowserImpl* browser_; + WebKit::WebFrame* frame_; + + typedef std::map NodeMap; + NodeMap node_map_; + + IMPLEMENT_REFCOUNTING(CefDOMDocumentImpl); +}; + +#endif // CEF_LIBCEF_DOM_DOCUMENT_IMPL_H_ diff --git a/libcef/renderer/dom_event_impl.cc b/libcef/renderer/dom_event_impl.cc new file mode 100644 index 000000000..3b5349cb1 --- /dev/null +++ b/libcef/renderer/dom_event_impl.cc @@ -0,0 +1,160 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/renderer/dom_event_impl.h" +#include "libcef/renderer/dom_document_impl.h" +#include "libcef/renderer/thread_util.h" + +#include "base/logging.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEvent.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" + +using WebKit::WebDOMEvent; +using WebKit::WebString; + + +CefDOMEventImpl::CefDOMEventImpl(CefRefPtr document, + const WebKit::WebDOMEvent& event) + : document_(document), + event_(event) { + DCHECK(!event_.isNull()); +} + +CefDOMEventImpl::~CefDOMEventImpl() { + CEF_REQUIRE_RT(); + DCHECK(event_.isNull()); +} + +CefString CefDOMEventImpl::GetType() { + CefString str; + if (!VerifyContext()) + return str; + + const WebString& type = event_.type(); + if (!type.isNull()) + str = type; + + return str; +} + +CefDOMEventImpl::Category CefDOMEventImpl::GetCategory() { + if (!VerifyContext()) + return DOM_EVENT_CATEGORY_UNKNOWN; + + int flags = 0; + if (event_.isUIEvent()) + flags |= DOM_EVENT_CATEGORY_UI; + if (event_.isMouseEvent()) + flags |= DOM_EVENT_CATEGORY_MOUSE; + if (event_.isMutationEvent()) + flags |= DOM_EVENT_CATEGORY_MUTATION; + if (event_.isKeyboardEvent()) + flags |= DOM_EVENT_CATEGORY_KEYBOARD; + if (event_.isTextEvent()) + flags |= DOM_EVENT_CATEGORY_TEXT; + if (event_.isCompositionEvent()) + flags |= DOM_EVENT_CATEGORY_COMPOSITION; + if (event_.isDragEvent()) + flags |= DOM_EVENT_CATEGORY_DRAG; + if (event_.isClipboardEvent()) + flags |= DOM_EVENT_CATEGORY_CLIPBOARD; + if (event_.isMessageEvent()) + flags |= DOM_EVENT_CATEGORY_MESSAGE; + if (event_.isWheelEvent()) + flags |= DOM_EVENT_CATEGORY_WHEEL; + if (event_.isBeforeTextInsertedEvent()) + flags |= DOM_EVENT_CATEGORY_BEFORE_TEXT_INSERTED; + if (event_.isOverflowEvent()) + flags |= DOM_EVENT_CATEGORY_OVERFLOW; + if (event_.isPageTransitionEvent()) + flags |= DOM_EVENT_CATEGORY_PAGE_TRANSITION; + if (event_.isPopStateEvent()) + flags |= DOM_EVENT_CATEGORY_POPSTATE; + if (event_.isProgressEvent()) + flags |= DOM_EVENT_CATEGORY_PROGRESS; + if (event_.isXMLHttpRequestProgressEvent()) + flags |= DOM_EVENT_CATEGORY_XMLHTTPREQUEST_PROGRESS; + if (event_.isWebKitAnimationEvent()) + flags |= DOM_EVENT_CATEGORY_WEBKIT_ANIMATION; + if (event_.isWebKitTransitionEvent()) + flags |= DOM_EVENT_CATEGORY_WEBKIT_TRANSITION; + if (event_.isBeforeLoadEvent()) + flags |= DOM_EVENT_CATEGORY_BEFORE_LOAD; + + return static_cast(flags); +} + +CefDOMEventImpl::Phase CefDOMEventImpl::GetPhase() { + if (!VerifyContext()) + return DOM_EVENT_PHASE_UNKNOWN; + + switch (event_.eventPhase()) { + case WebDOMEvent::CapturingPhase: + return DOM_EVENT_PHASE_CAPTURING; + case WebDOMEvent::AtTarget: + return DOM_EVENT_PHASE_AT_TARGET; + case WebDOMEvent::BubblingPhase: + return DOM_EVENT_PHASE_BUBBLING; + } + + return DOM_EVENT_PHASE_UNKNOWN; +} + +bool CefDOMEventImpl::CanBubble() { + if (!VerifyContext()) + return false; + + return event_.bubbles(); +} + +bool CefDOMEventImpl::CanCancel() { + if (!VerifyContext()) + return false; + + return event_.cancelable(); +} + +CefRefPtr CefDOMEventImpl::GetDocument() { + if (!VerifyContext()) + return NULL; + + return document_.get(); +} + +CefRefPtr CefDOMEventImpl::GetTarget() { + if (!VerifyContext()) + return NULL; + + return document_->GetOrCreateNode(event_.target()); +} + +CefRefPtr CefDOMEventImpl::GetCurrentTarget() { + if (!VerifyContext()) + return NULL; + + return document_->GetOrCreateNode(event_.currentTarget()); +} + +void CefDOMEventImpl::Detach() { + // If you hit this assert it means that you are keeping references to this + // event object beyond the valid scope. + DCHECK_EQ(GetRefCt(), 1); + + document_ = NULL; + event_.assign(WebDOMEvent()); +} + +bool CefDOMEventImpl::VerifyContext() { + if (!document_.get()) { + NOTREACHED(); + return false; + } + if (!document_->VerifyContext()) + return false; + if (event_.isNull()) { + NOTREACHED(); + return false; + } + return true; +} diff --git a/libcef/renderer/dom_event_impl.h b/libcef/renderer/dom_event_impl.h new file mode 100644 index 000000000..b427c4b59 --- /dev/null +++ b/libcef/renderer/dom_event_impl.h @@ -0,0 +1,43 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_DOM_EVENT_IMPL_H_ +#define CEF_LIBCEF_DOM_EVENT_IMPL_H_ +#pragma once + +#include "include/cef_dom.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEvent.h" + +class CefDOMDocumentImpl; + +class CefDOMEventImpl : public CefDOMEvent { + public: + CefDOMEventImpl(CefRefPtr document, + const WebKit::WebDOMEvent& event); + virtual ~CefDOMEventImpl(); + + // CefDOMEvent methods. + virtual CefString GetType() OVERRIDE; + virtual Category GetCategory() OVERRIDE; + virtual Phase GetPhase() OVERRIDE; + virtual bool CanBubble() OVERRIDE; + virtual bool CanCancel() OVERRIDE; + virtual CefRefPtr GetDocument() OVERRIDE; + virtual CefRefPtr GetTarget() OVERRIDE; + virtual CefRefPtr GetCurrentTarget() OVERRIDE; + + // Will be called from CefDOMEventListenerWrapper::handleEvent(). + void Detach(); + + // Verify that the object exists and is being accessed on the UI thread. + bool VerifyContext(); + + protected: + CefRefPtr document_; + WebKit::WebDOMEvent event_; + + IMPLEMENT_REFCOUNTING(CefDOMEventImpl); +}; + +#endif // CEF_LIBCEF_DOM_EVENT_IMPL_H_ diff --git a/libcef/renderer/dom_node_impl.cc b/libcef/renderer/dom_node_impl.cc new file mode 100644 index 000000000..bc3b6b6d7 --- /dev/null +++ b/libcef/renderer/dom_node_impl.cc @@ -0,0 +1,485 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/renderer/dom_node_impl.h" +#include "libcef/common/tracker.h" +#include "libcef/renderer/browser_impl.h" +#include "libcef/renderer/dom_document_impl.h" +#include "libcef/renderer/dom_event_impl.h" +#include "libcef/renderer/thread_util.h" + +#include "base/logging.h" +#include "base/string_util.h" +#include "base/utf_string_conversions.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEvent.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEventListener.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSelectElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" + +using WebKit::WebDocument; +using WebKit::WebDOMEvent; +using WebKit::WebDOMEventListener; +using WebKit::WebElement; +using WebKit::WebFrame; +using WebKit::WebFormControlElement; +using WebKit::WebInputElement; +using WebKit::WebNode; +using WebKit::WebSelectElement; +using WebKit::WebString; + +namespace { + +// Wrapper implementation for WebDOMEventListener. +class CefDOMEventListenerWrapper : public WebDOMEventListener, + public CefTrackNode { + public: + CefDOMEventListenerWrapper(CefBrowserImpl* browser, WebFrame* frame, + CefRefPtr listener) + : browser_(browser), + frame_(frame), + listener_(listener) { + // Cause this object to be deleted immediately before the frame is closed. + browser->AddFrameObject(frame->identifier(), this); + } + virtual ~CefDOMEventListenerWrapper() { + CEF_REQUIRE_RT(); + } + + virtual void handleEvent(const WebDOMEvent& event) { + CefRefPtr documentImpl; + CefRefPtr eventImpl; + + if (!event.isNull()) { + // Create CefDOMDocumentImpl and CefDOMEventImpl objects that are valid + // only for the scope of this method. + const WebDocument& document = frame_->document(); + if (!document.isNull()) { + documentImpl = new CefDOMDocumentImpl(browser_, frame_); + eventImpl = new CefDOMEventImpl(documentImpl, event); + } + } + + listener_->HandleEvent(eventImpl.get()); + + if (eventImpl.get()) + eventImpl->Detach(); + if (documentImpl.get()) + documentImpl->Detach(); + } + + protected: + CefBrowserImpl* browser_; + WebFrame* frame_; + CefRefPtr listener_; +}; + +} // namespace + + +CefDOMNodeImpl::CefDOMNodeImpl(CefRefPtr document, + const WebKit::WebNode& node) + : document_(document), + node_(node) { +} + +CefDOMNodeImpl::~CefDOMNodeImpl() { + CEF_REQUIRE_RT(); + + if (document_.get() && !node_.isNull()) { + // Remove the node from the document. + document_->RemoveNode(node_); + } +} + +CefDOMNodeImpl::Type CefDOMNodeImpl::GetType() { + if (!VerifyContext()) + return DOM_NODE_TYPE_UNSUPPORTED; + + switch (node_.nodeType()) { + case WebNode::ElementNode: + return DOM_NODE_TYPE_ELEMENT; + case WebNode::AttributeNode: + return DOM_NODE_TYPE_ATTRIBUTE; + case WebNode::TextNode: + return DOM_NODE_TYPE_TEXT; + case WebNode::CDataSectionNode: + return DOM_NODE_TYPE_CDATA_SECTION; + case WebNode::EntityReferenceNode: + return DOM_NODE_TYPE_ENTITY_REFERENCE; + case WebNode::EntityNode: + return DOM_NODE_TYPE_ENTITY; + case WebNode::ProcessingInstructionsNode: + return DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS; + case WebNode::CommentNode: + return DOM_NODE_TYPE_COMMENT; + case WebNode::DocumentNode: + return DOM_NODE_TYPE_DOCUMENT; + case WebNode::DocumentTypeNode: + return DOM_NODE_TYPE_DOCUMENT_TYPE; + case WebNode::DocumentFragmentNode: + return DOM_NODE_TYPE_DOCUMENT_FRAGMENT; + case WebNode::NotationNode: + return DOM_NODE_TYPE_NOTATION; + case WebNode::XPathNamespaceNode: + return DOM_NODE_TYPE_XPATH_NAMESPACE; + default: + return DOM_NODE_TYPE_UNSUPPORTED; + } +} + +bool CefDOMNodeImpl::IsText() { + if (!VerifyContext()) + return false; + + return node_.isTextNode(); +} + +bool CefDOMNodeImpl::IsElement() { + if (!VerifyContext()) + return false; + + return node_.isElementNode(); +} + +// Logic copied from RenderViewImpl::IsEditableNode. +bool CefDOMNodeImpl::IsEditable() { + if (!VerifyContext()) + return false; + + if (node_.isContentEditable()) + return true; + + if (node_.isElementNode()) { + const WebElement& element = node_.toConst(); + if (element.isTextFormControlElement()) + return true; + + // Also return true if it has an ARIA role of 'textbox'. + for (unsigned i = 0; i < element.attributeCount(); ++i) { + if (LowerCaseEqualsASCII(element.attributeLocalName(i), "role")) { + if (LowerCaseEqualsASCII(element.attributeValue(i), "textbox")) + return true; + break; + } + } + } + + return false; +} + +bool CefDOMNodeImpl::IsFormControlElement() { + if (!VerifyContext()) + return false; + + if (node_.isElementNode()) { + const WebElement& element = node_.toConst(); + return element.isFormControlElement(); + } + + return false; +} + +CefString CefDOMNodeImpl::GetFormControlElementType() { + CefString str; + if (!VerifyContext()) + return str; + + if (node_.isElementNode()) { + const WebElement& element = node_.toConst(); + if (element.isFormControlElement()) { + // Retrieve the type from the form control element. + const WebFormControlElement& formElement = + node_.toConst(); + + const string16& form_control_type = formElement.formControlType(); + str = form_control_type; + } + } + + return str; +} + +bool CefDOMNodeImpl::IsSame(CefRefPtr that) { + if (!VerifyContext()) + return false; + + CefDOMNodeImpl* impl = static_cast(that.get()); + if (!impl || !impl->VerifyContext()) + return false; + + return node_.equals(impl->node_); +} + +CefString CefDOMNodeImpl::GetName() { + CefString str; + if (!VerifyContext()) + return str; + + const WebString& name = node_.nodeName(); + if (!name.isNull()) + str = name; + + return str; +} + +CefString CefDOMNodeImpl::GetValue() { + CefString str; + if (!VerifyContext()) + return str; + + if (node_.isElementNode()) { + const WebElement& element = node_.toConst(); + if (element.isFormControlElement()) { + // Retrieve the value from the form control element. + const WebFormControlElement& formElement = + node_.toConst(); + + string16 value; + const string16& form_control_type = formElement.formControlType(); + if (form_control_type == ASCIIToUTF16("text")) { + const WebInputElement& input_element = + formElement.toConst(); + value = input_element.value(); + } else if (form_control_type == ASCIIToUTF16("select-one")) { + const WebSelectElement& select_element = + formElement.toConst(); + value = select_element.value(); + } + + TrimWhitespace(value, TRIM_LEADING, &value); + str = value; + } + } + + if (str.empty()) { + const WebString& value = node_.nodeValue(); + if (!value.isNull()) + str = value; + } + + return str; +} + +bool CefDOMNodeImpl::SetValue(const CefString& value) { + if (!VerifyContext()) + return false; + + if (node_.isElementNode()) + return false; + + return node_.setNodeValue(string16(value)); +} + +CefString CefDOMNodeImpl::GetAsMarkup() { + CefString str; + if (!VerifyContext()) + return str; + + const WebString& markup = node_.createMarkup(); + if (!markup.isNull()) + str = markup; + + return str; +} + +CefRefPtr CefDOMNodeImpl::GetDocument() { + if (!VerifyContext()) + return NULL; + + return document_.get(); +} + +CefRefPtr CefDOMNodeImpl::GetParent() { + if (!VerifyContext()) + return NULL; + + return document_->GetOrCreateNode(node_.parentNode()); +} + +CefRefPtr CefDOMNodeImpl::GetPreviousSibling() { + if (!VerifyContext()) + return NULL; + + return document_->GetOrCreateNode(node_.previousSibling()); +} + +CefRefPtr CefDOMNodeImpl::GetNextSibling() { + if (!VerifyContext()) + return NULL; + + return document_->GetOrCreateNode(node_.nextSibling()); +} + +bool CefDOMNodeImpl::HasChildren() { + if (!VerifyContext()) + return false; + + return node_.hasChildNodes(); +} + +CefRefPtr CefDOMNodeImpl::GetFirstChild() { + if (!VerifyContext()) + return NULL; + + return document_->GetOrCreateNode(node_.firstChild()); +} + +CefRefPtr CefDOMNodeImpl::GetLastChild() { + if (!VerifyContext()) + return NULL; + + return document_->GetOrCreateNode(node_.lastChild()); +} + +void CefDOMNodeImpl::AddEventListener(const CefString& eventType, + CefRefPtr listener, + bool useCapture) { + if (!VerifyContext()) + return; + + node_.addEventListener(string16(eventType), + new CefDOMEventListenerWrapper(document_->GetBrowser(), + document_->GetFrame(), listener), + useCapture); +} + +CefString CefDOMNodeImpl::GetElementTagName() { + CefString str; + if (!VerifyContext()) + return str; + + if (!node_.isElementNode()) { + NOTREACHED(); + return str; + } + + const WebElement& element = node_.toConst(); + const WebString& tagname = element.tagName(); + if (!tagname.isNull()) + str = tagname; + + return str; +} + +bool CefDOMNodeImpl::HasElementAttributes() { + if (!VerifyContext()) + return false; + + if (!node_.isElementNode()) { + NOTREACHED(); + return false; + } + + const WebElement& element = node_.toConst(); + return (element.attributeCount() > 0); +} + +bool CefDOMNodeImpl::HasElementAttribute(const CefString& attrName) { + if (!VerifyContext()) + return false; + + if (!node_.isElementNode()) { + NOTREACHED(); + return false; + } + + const WebElement& element = node_.toConst(); + return element.hasAttribute(string16(attrName)); +} + +CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) { + CefString str; + if (!VerifyContext()) + return str; + + if (!node_.isElementNode()) { + NOTREACHED(); + return str; + } + + const WebElement& element = node_.toConst(); + const WebString& attr = element.getAttribute(string16(attrName)); + if (!attr.isNull()) + str = attr; + + return str; +} + +void CefDOMNodeImpl::GetElementAttributes(AttributeMap& attrMap) { + if (!VerifyContext()) + return; + + if (!node_.isElementNode()) { + NOTREACHED(); + return; + } + + const WebElement& element = node_.toConst(); + unsigned int len = element.attributeCount(); + if (len == 0) + return; + + for (unsigned int i = 0; i < len; ++i) { + string16 name = element.attributeLocalName(i); + string16 value = element.attributeValue(i); + attrMap.insert(std::make_pair(name, value)); + } +} + +bool CefDOMNodeImpl::SetElementAttribute(const CefString& attrName, + const CefString& value) { + if (!VerifyContext()) + return false; + + if (!node_.isElementNode()) { + NOTREACHED(); + return false; + } + + WebElement element = node_.to(); + return element.setAttribute(string16(attrName), string16(value)); +} + +CefString CefDOMNodeImpl::GetElementInnerText() { + CefString str; + if (!VerifyContext()) + return str; + + if (!node_.isElementNode()) { + NOTREACHED(); + return str; + } + + WebElement element = node_.to(); + const WebString& text = element.innerText(); + if (!text.isNull()) + str = text; + + return str; +} + +void CefDOMNodeImpl::Detach() { + document_ = NULL; + node_.assign(WebNode()); +} + +bool CefDOMNodeImpl::VerifyContext() { + if (!document_.get()) { + NOTREACHED(); + return false; + } + if (!document_->VerifyContext()) + return false; + if (node_.isNull()) { + NOTREACHED(); + return false; + } + return true; +} diff --git a/libcef/renderer/dom_node_impl.h b/libcef/renderer/dom_node_impl.h new file mode 100644 index 000000000..4a641a9d8 --- /dev/null +++ b/libcef/renderer/dom_node_impl.h @@ -0,0 +1,64 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_DOM_NODE_IMPL_H_ +#define CEF_LIBCEF_DOM_NODE_IMPL_H_ +#pragma once + +#include "include/cef_dom.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" + +class CefDOMDocumentImpl; + +class CefDOMNodeImpl : public CefDOMNode { + public: + CefDOMNodeImpl(CefRefPtr document, + const WebKit::WebNode& node); + virtual ~CefDOMNodeImpl(); + + // CefDOMNode methods. + virtual Type GetType() OVERRIDE; + virtual bool IsText() OVERRIDE; + virtual bool IsElement() OVERRIDE; + virtual bool IsEditable() OVERRIDE; + virtual bool IsFormControlElement() OVERRIDE; + virtual CefString GetFormControlElementType() OVERRIDE; + virtual bool IsSame(CefRefPtr that) OVERRIDE; + virtual CefString GetName() OVERRIDE; + virtual CefString GetValue() OVERRIDE; + virtual bool SetValue(const CefString& value) OVERRIDE; + virtual CefString GetAsMarkup() OVERRIDE; + virtual CefRefPtr GetDocument() OVERRIDE; + virtual CefRefPtr GetParent() OVERRIDE; + virtual CefRefPtr GetPreviousSibling() OVERRIDE; + virtual CefRefPtr GetNextSibling() OVERRIDE; + virtual bool HasChildren() OVERRIDE; + virtual CefRefPtr GetFirstChild() OVERRIDE; + virtual CefRefPtr GetLastChild() OVERRIDE; + virtual void AddEventListener(const CefString& eventType, + CefRefPtr listener, + bool useCapture) OVERRIDE; + virtual CefString GetElementTagName() OVERRIDE; + virtual bool HasElementAttributes() OVERRIDE; + virtual bool HasElementAttribute(const CefString& attrName) OVERRIDE; + virtual CefString GetElementAttribute(const CefString& attrName) OVERRIDE; + virtual void GetElementAttributes(AttributeMap& attrMap) OVERRIDE; + virtual bool SetElementAttribute(const CefString& attrName, + const CefString& value) OVERRIDE; + virtual CefString GetElementInnerText() OVERRIDE; + + // Will be called from CefDOMDocumentImpl::Detach(). + void Detach(); + + // Verify that the object exists and is being accessed on the UI thread. + bool VerifyContext(); + + protected: + CefRefPtr document_; + WebKit::WebNode node_; + + IMPLEMENT_REFCOUNTING(CefDOMNodeImpl); +}; + +#endif // CEF_LIBCEF_DOM_NODE_IMPL_H_ diff --git a/libcef/renderer/frame_impl.cc b/libcef/renderer/frame_impl.cc new file mode 100644 index 000000000..3be3c7f59 --- /dev/null +++ b/libcef/renderer/frame_impl.cc @@ -0,0 +1,271 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/renderer/frame_impl.h" + +#include "libcef/common/cef_messages.h" +#include "libcef/common/http_header_utils.h" +#include "libcef/common/request_impl.h" +#include "libcef/renderer/browser_impl.h" +#include "libcef/renderer/dom_document_impl.h" +#include "libcef/renderer/thread_util.h" +#include "libcef/renderer/v8_impl.h" +#include "libcef/renderer/webkit_glue.h" + +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" +#include "webkit/glue/webkit_glue.h" + +using WebKit::WebString; + +CefFrameImpl::CefFrameImpl(CefBrowserImpl* browser, + WebKit::WebFrame* frame) + : browser_(browser), + frame_(frame), + frame_id_(frame->identifier()) { +} + +CefFrameImpl::~CefFrameImpl() { +} + +bool CefFrameImpl::IsValid() { + CEF_REQUIRE_RT_RETURN(false); + + return (frame_ != NULL); +} + +void CefFrameImpl::Undo() { + CEF_REQUIRE_RT_RETURN_VOID(); + if (frame_) + frame_->executeCommand(WebString::fromUTF8("Undo")); +} + +void CefFrameImpl::Redo() { + CEF_REQUIRE_RT_RETURN_VOID(); + if (frame_) + frame_->executeCommand(WebString::fromUTF8("Redo")); +} + +void CefFrameImpl::Cut() { + CEF_REQUIRE_RT_RETURN_VOID(); + if (frame_) + frame_->executeCommand(WebString::fromUTF8("Cut")); +} + +void CefFrameImpl::Copy() { + CEF_REQUIRE_RT_RETURN_VOID(); + if (frame_) + frame_->executeCommand(WebString::fromUTF8("Copy")); +} + +void CefFrameImpl::Paste() { + CEF_REQUIRE_RT_RETURN_VOID(); + if (frame_) + frame_->executeCommand(WebString::fromUTF8("Paste")); +} + +void CefFrameImpl::Delete() { + CEF_REQUIRE_RT_RETURN_VOID(); + if (frame_) + frame_->executeCommand(WebString::fromUTF8("Delete")); +} + +void CefFrameImpl::SelectAll() { + CEF_REQUIRE_RT_RETURN_VOID(); + if (frame_) + frame_->executeCommand(WebString::fromUTF8("SelectAll")); +} + +void CefFrameImpl::ViewSource() { + NOTREACHED() << "ViewSource cannot be called from the renderer process"; +} + +void CefFrameImpl::GetSource(CefRefPtr visitor) { + CEF_REQUIRE_RT_RETURN_VOID(); + + if (frame_) { + CefString content = std::string(frame_->contentAsMarkup().utf8()); + visitor->Visit(content); + } +} + +void CefFrameImpl::GetText(CefRefPtr visitor) { + CEF_REQUIRE_RT_RETURN_VOID(); + + if (frame_) { + CefString content = webkit_glue::DumpDocumentText(frame_); + visitor->Visit(content); + } +} + +void CefFrameImpl::LoadRequest(CefRefPtr request) { + CEF_REQUIRE_RT_RETURN_VOID(); + + if (!browser_) + return; + + CefMsg_LoadRequest_Params params; + params.url = GURL(std::string(request->GetURL())); + params.method = request->GetMethod(); + params.frame_id = frame_id_; + params.first_party_for_cookies = + GURL(std::string(request->GetFirstPartyForCookies())); + + CefRequest::HeaderMap headerMap; + request->GetHeaderMap(headerMap); + if (!headerMap.empty()) + params.headers = HttpHeaderUtils::GenerateHeaders(headerMap); + + CefRefPtr postData = request->GetPostData(); + if (postData.get()) { + CefPostDataImpl* impl = static_cast(postData.get()); + params.upload_data = new net::UploadData(); + impl->Get(*params.upload_data.get()); + } + + params.load_flags = request->GetFlags(); + + browser_->LoadRequest(params); +} + +void CefFrameImpl::LoadURL(const CefString& url) { + CEF_REQUIRE_RT_RETURN_VOID(); + + if (!browser_) + return; + + CefMsg_LoadRequest_Params params; + params.url = GURL(url.ToString()); + params.method = "GET"; + params.frame_id = frame_id_; + + browser_->LoadRequest(params); +} + +void CefFrameImpl::LoadString(const CefString& string, + const CefString& url) { + CEF_REQUIRE_RT_RETURN_VOID(); + + if (frame_) { + GURL gurl = GURL(url.ToString()); + frame_->loadHTMLString(string.ToString(), gurl); + } +} + +void CefFrameImpl::ExecuteJavaScript(const CefString& jsCode, + const CefString& scriptUrl, + int startLine) { + CEF_REQUIRE_RT_RETURN_VOID(); + + if (jsCode.empty()) + return; + if (startLine < 0) + startLine = 0; + + if (frame_) { + GURL gurl = GURL(scriptUrl.ToString()); + frame_->executeScript( + WebKit::WebScriptSource(jsCode.ToString16(), gurl, startLine)); + } +} + +bool CefFrameImpl::IsMain() { + CEF_REQUIRE_RT_RETURN(false); + + if (frame_) + return (frame_->parent() == NULL); + return false; +} + +bool CefFrameImpl::IsFocused() { + CEF_REQUIRE_RT_RETURN(false); + + if (frame_ && frame_->view()) + return (frame_->view()->focusedFrame() == frame_); + return false; +} + +CefString CefFrameImpl::GetName() { + CefString name; + CEF_REQUIRE_RT_RETURN(name); + + if (frame_) + name = frame_->name(); + return name; +} + +int64 CefFrameImpl::GetIdentifier() { + CEF_REQUIRE_RT_RETURN(0); + + return frame_id_; +} + +CefRefPtr CefFrameImpl::GetParent() { + CEF_REQUIRE_RT_RETURN(NULL); + + if (frame_) { + WebKit::WebFrame* parent = frame_->parent(); + if (parent) + return browser_->GetWebFrameImpl(parent).get(); + } + + return NULL; +} + +CefString CefFrameImpl::GetURL() { + CefString url; + CEF_REQUIRE_RT_RETURN(url); + + if (frame_) { + GURL gurl = frame_->document().url(); + url = gurl.spec(); + } + return url; +} + +CefRefPtr CefFrameImpl::GetBrowser() { + CEF_REQUIRE_RT_RETURN(NULL); + + return browser_; +} + +CefRefPtr CefFrameImpl::GetV8Context() { + CEF_REQUIRE_RT_RETURN(NULL); + + if (frame_) { + v8::HandleScope handle_scope; + return new CefV8ContextImpl(webkit_glue::GetV8Context(frame_)); + } else { + return NULL; + } +} + +void CefFrameImpl::VisitDOM(CefRefPtr visitor) { + CEF_REQUIRE_RT_RETURN_VOID(); + + if (!frame_) + return; + + // Create a CefDOMDocumentImpl object that is valid only for the scope of this + // method. + CefRefPtr documentImpl; + const WebKit::WebDocument& document = frame_->document(); + if (!document.isNull()) + documentImpl = new CefDOMDocumentImpl(browser_, frame_); + + visitor->Visit(documentImpl.get()); + + if (documentImpl.get()) + documentImpl->Detach(); +} + +void CefFrameImpl::Detach() { + browser_ = NULL; + frame_ = NULL; +} diff --git a/libcef/renderer/frame_impl.h b/libcef/renderer/frame_impl.h new file mode 100644 index 000000000..2d06678d2 --- /dev/null +++ b/libcef/renderer/frame_impl.h @@ -0,0 +1,70 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_RENDERER_FRAME_IMPL_H_ +#define CEF_LIBCEF_RENDERER_FRAME_IMPL_H_ +#pragma once + +#include +#include "include/cef_frame.h" +#include "include/cef_v8.h" + +class CefBrowserImpl; + +namespace WebKit { +class WebFrame; +} + +// Implementation of CefFrame. CefFrameImpl objects are owned by the +// CefBrowerImpl and will be detached when the browser is notified that the +// associated renderer WebFrame will close. +class CefFrameImpl : public CefFrame { + public: + CefFrameImpl(CefBrowserImpl* browser, + WebKit::WebFrame* frame); + virtual ~CefFrameImpl(); + + // CefFrame implementation. + virtual bool IsValid() OVERRIDE; + virtual void Undo() OVERRIDE; + virtual void Redo() OVERRIDE; + virtual void Cut() OVERRIDE; + virtual void Copy() OVERRIDE; + virtual void Paste() OVERRIDE; + virtual void Delete() OVERRIDE; + virtual void SelectAll() OVERRIDE; + virtual void ViewSource() OVERRIDE; + virtual void GetSource(CefRefPtr visitor) OVERRIDE; + virtual void GetText(CefRefPtr visitor) OVERRIDE; + virtual void LoadRequest(CefRefPtr request) OVERRIDE; + virtual void LoadURL(const CefString& url) OVERRIDE; + virtual void LoadString(const CefString& string, + const CefString& url) OVERRIDE; + virtual void ExecuteJavaScript(const CefString& jsCode, + const CefString& scriptUrl, + int startLine) OVERRIDE; + virtual bool IsMain() OVERRIDE; + virtual bool IsFocused() OVERRIDE; + virtual CefString GetName() OVERRIDE; + virtual int64 GetIdentifier() OVERRIDE; + virtual CefRefPtr GetParent() OVERRIDE; + virtual CefString GetURL() OVERRIDE; + virtual CefRefPtr GetBrowser() OVERRIDE; + virtual CefRefPtr GetV8Context() OVERRIDE; + virtual void VisitDOM(CefRefPtr visitor) OVERRIDE; + + void Detach(); + + WebKit::WebFrame* web_frame() const { return frame_; } + + protected: + CefBrowserImpl* browser_; + WebKit::WebFrame* frame_; + int64 frame_id_; + + IMPLEMENT_REFCOUNTING(CefFrameImpl); + DISALLOW_EVIL_CONSTRUCTORS(CefFrameImpl); +}; + +#endif // CEF_LIBCEF_RENDERER_FRAME_IMPL_H_ diff --git a/libcef/renderer/render_process_observer.cc b/libcef/renderer/render_process_observer.cc new file mode 100644 index 000000000..ac1d8fa6d --- /dev/null +++ b/libcef/renderer/render_process_observer.cc @@ -0,0 +1,90 @@ +/// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/renderer/render_process_observer.h" +#include "libcef/common/cef_messages.h" +#include "libcef/common/content_client.h" +#include "libcef/renderer/content_renderer_client.h" + +#include "base/bind.h" +#include "base/path_service.h" +#include "googleurl/src/gurl.h" +#include "googleurl/src/url_util.h" +#include "media/base/media.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" + +CefRenderProcessObserver::CefRenderProcessObserver() { + // Note that under Linux, the media library will normally already have + // been initialized by the Zygote before this instance became a Renderer. + FilePath media_path; + PathService::Get(base::DIR_MODULE, &media_path); + if (!media_path.empty()) + media::InitializeMediaLibrary(media_path); +} + +CefRenderProcessObserver::~CefRenderProcessObserver() { +} + +bool CefRenderProcessObserver::OnControlMessageReceived( + const IPC::Message& message) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(CefRenderProcessObserver, message) + IPC_MESSAGE_HANDLER(CefProcessMsg_ModifyCrossOriginWhitelistEntry, + OnModifyCrossOriginWhitelistEntry) + IPC_MESSAGE_HANDLER(CefProcessMsg_ClearCrossOriginWhitelist, + OnClearCrossOriginWhitelist) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + return handled; +} + +void CefRenderProcessObserver::WebKitInitialized() { + WebKit::WebRuntimeFeatures::enableMediaPlayer( + media::IsMediaLibraryInitialized()); + + // TODO(cef): Enable these once the implementation supports it. + WebKit::WebRuntimeFeatures::enableNotifications(false); + + // Register any custom schemes with WebKit. + CefContentRendererClient::Get()->RegisterCustomSchemes(); + + // Notify the render process handler. + CefRefPtr application = CefContentClient::Get()->application(); + if (application.get()) { + CefRefPtr handler = + application->GetRenderProcessHandler(); + if (handler.get()) + handler->OnWebKitInitialized(); + } +} + +void CefRenderProcessObserver::OnModifyCrossOriginWhitelistEntry( + bool add, + const std::string& source_origin, + const std::string& target_protocol, + const std::string& target_domain, + bool allow_target_subdomains) { + GURL gurl = GURL(source_origin); + if (add) { + WebKit::WebSecurityPolicy::addOriginAccessWhitelistEntry( + gurl, + WebKit::WebString::fromUTF8(target_protocol), + WebKit::WebString::fromUTF8(target_domain), + allow_target_subdomains); + } else { + WebKit::WebSecurityPolicy::removeOriginAccessWhitelistEntry( + gurl, + WebKit::WebString::fromUTF8(target_protocol), + WebKit::WebString::fromUTF8(target_domain), + allow_target_subdomains); + } +} + +void CefRenderProcessObserver::OnClearCrossOriginWhitelist() { + WebKit::WebSecurityPolicy::resetOriginAccessWhitelists(); +} diff --git a/libcef/renderer/render_process_observer.h b/libcef/renderer/render_process_observer.h new file mode 100644 index 000000000..7b86a9967 --- /dev/null +++ b/libcef/renderer/render_process_observer.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_RENDERER_RENDER_PROCESS_OBSERVER_H_ +#define CEF_LIBCEF_RENDERER_RENDER_PROCESS_OBSERVER_H_ + +#include +#include "base/memory/ref_counted.h" +#include "content/public/renderer/render_process_observer.h" + +// This class sends and receives control messages on the renderer process. +class CefRenderProcessObserver : public content::RenderProcessObserver { + public: + CefRenderProcessObserver(); + virtual ~CefRenderProcessObserver(); + + // RenderProcessObserver implementation. + virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; + virtual void WebKitInitialized() OVERRIDE; + + private: + // Message handlers called on the render thread. + void OnModifyCrossOriginWhitelistEntry(bool add, + const std::string& source_origin, + const std::string& target_protocol, + const std::string& target_domain, + bool allow_target_subdomains); + void OnClearCrossOriginWhitelist(); + + DISALLOW_COPY_AND_ASSIGN(CefRenderProcessObserver); +}; + + +#endif // CEF_LIBCEF_RENDERER_RENDER_PROCESS_OBSERVER_H_ diff --git a/libcef/renderer/render_urlrequest_impl.cc b/libcef/renderer/render_urlrequest_impl.cc new file mode 100644 index 000000000..f20ecd547 --- /dev/null +++ b/libcef/renderer/render_urlrequest_impl.cc @@ -0,0 +1,375 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/renderer/render_urlrequest_impl.h" +#include "libcef/common/request_impl.h" +#include "libcef/common/response_impl.h" + +#include "base/logging.h" +#include "base/message_loop.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLLoader.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLResponse.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" + +using WebKit::WebString; +using WebKit::WebURL; +using WebKit::WebURLError; +using WebKit::WebURLLoader; +using WebKit::WebURLRequest; +using WebKit::WebURLResponse; + + +namespace { + +class CefWebURLLoaderClient : public WebKit::WebURLLoaderClient { + public: + CefWebURLLoaderClient(CefRenderURLRequest::Context* context, + int request_flags); + virtual ~CefWebURLLoaderClient(); + + // WebKit::WebURLLoaderClient methods. + virtual void willSendRequest( + WebURLLoader* loader, + WebURLRequest& newRequest, + const WebURLResponse& redirectResponse) OVERRIDE; + virtual void didSendData( + WebURLLoader* loader, + unsigned long long bytesSent, + unsigned long long totalBytesToBeSent) OVERRIDE; + virtual void didReceiveResponse( + WebURLLoader* loader, + const WebURLResponse& response) OVERRIDE; + virtual void didDownloadData(WebURLLoader* loader, + int dataLength) OVERRIDE; + virtual void didReceiveData(WebURLLoader* loader, + const char* data, + int dataLength, + int encodedDataLength) OVERRIDE; + virtual void didReceiveCachedMetadata(WebURLLoader* loader, + const char* data, + int dataLength) OVERRIDE; + virtual void didFinishLoading(WebURLLoader* loader, + double finishTime) OVERRIDE; + virtual void didFail(WebURLLoader* loader, + const WebURLError& error) OVERRIDE; + + protected: + // The context_ pointer will outlive this object. + CefRenderURLRequest::Context* context_; + int request_flags_; +}; + +} // namespace + + +// CefRenderURLRequest::Context ----------------------------------------------- + +class CefRenderURLRequest::Context + : public base::RefCountedThreadSafe { + public: + Context(CefRefPtr url_request, + CefRefPtr request, + CefRefPtr client) + : url_request_(url_request), + request_(request), + client_(client), + message_loop_proxy_(MessageLoop::current()->message_loop_proxy()), + status_(UR_IO_PENDING), + error_code_(ERR_NONE), + upload_data_size_(0), + got_upload_progress_complete_(false), + download_data_received_(0), + download_data_total_(-1) { + // Mark the request as read-only. + static_cast(request_.get())->SetReadOnly(true); + } + + virtual ~Context() { + } + + inline bool CalledOnValidThread() { + return message_loop_proxy_->BelongsToCurrentThread(); + } + + bool Start() { + DCHECK(CalledOnValidThread()); + + GURL url = GURL(request_->GetURL().ToString()); + if (!url.is_valid()) + return false; + + loader_.reset(WebKit::webKitPlatformSupport()->createURLLoader()); + url_client_.reset(new CefWebURLLoaderClient(this, request_->GetFlags())); + + WebURLRequest urlRequest; + static_cast(request_.get())->Get(urlRequest); + + if (urlRequest.reportUploadProgress()) { + // Attempt to determine the upload data size. + CefRefPtr post_data = request_->GetPostData(); + if (post_data.get()) { + CefPostData::ElementVector elements; + post_data->GetElements(elements); + if (elements.size() == 1 && elements[0]->GetType() == PDE_TYPE_BYTES) { + CefPostDataElementImpl* impl = + static_cast(elements[0].get()); + upload_data_size_ = impl->GetBytesCount(); + } + } + } + + loader_->loadAsynchronously(urlRequest, url_client_.get()); + return true; + } + + void Cancel() { + DCHECK(CalledOnValidThread()); + + // The request may already be complete. + if (!loader_.get() || status_ != UR_IO_PENDING) + return; + + status_ = UR_CANCELED; + error_code_ = ERR_ABORTED; + + // Will result in a call to OnError(). + loader_->cancel(); + } + + void OnResponse(const WebURLResponse& response) { + DCHECK(CalledOnValidThread()); + + response_ = CefResponse::Create(); + CefResponseImpl* responseImpl = + static_cast(response_.get()); + responseImpl->Set(response); + responseImpl->SetReadOnly(true); + + download_data_total_ = response.expectedContentLength(); + } + + void OnError(const WebURLError& error) { + DCHECK(CalledOnValidThread()); + + if (status_ == UR_IO_PENDING) { + status_ = UR_FAILED; + error_code_ = static_cast(error.reason); + } + + OnComplete(); + } + + void OnComplete() { + DCHECK(CalledOnValidThread()); + + if (status_ == UR_IO_PENDING) { + status_ = UR_SUCCESS; + NotifyUploadProgressIfNecessary(); + } + + if (loader_.get()) + loader_.reset(NULL); + + DCHECK(url_request_.get()); + client_->OnRequestComplete(url_request_.get()); + + // This may result in the Context object being deleted. + url_request_ = NULL; + } + + void OnDownloadProgress(int64 current) { + DCHECK(CalledOnValidThread()); + DCHECK(url_request_.get()); + + NotifyUploadProgressIfNecessary(); + + download_data_received_ += current; + client_->OnDownloadProgress(url_request_.get(), download_data_received_, + download_data_total_); + } + + void OnDownloadData(const char* data, int dataLength) { + DCHECK(CalledOnValidThread()); + DCHECK(url_request_.get()); + client_->OnDownloadData(url_request_.get(), data, dataLength); + } + + void OnUploadProgress(int64 current, int64 total) { + DCHECK(CalledOnValidThread()); + DCHECK(url_request_.get()); + if (current == total) + got_upload_progress_complete_ = true; + client_->OnUploadProgress(url_request_.get(), current, total); + } + + CefRefPtr request() { return request_; } + CefRefPtr client() { return client_; } + CefURLRequest::Status status() { return status_; } + CefURLRequest::ErrorCode error_code() { return error_code_; } + CefRefPtr response() { return response_; } + + private: + void NotifyUploadProgressIfNecessary() { + if (!got_upload_progress_complete_ && upload_data_size_ > 0) { + // URLFetcher sends upload notifications using a timer and will not send + // a notification if the request completes too quickly. We therefore + // send the notification here if necessary. + client_->OnUploadProgress(url_request_.get(), upload_data_size_, + upload_data_size_); + got_upload_progress_complete_ = true; + } + } + + // Members only accessed on the initialization thread. + CefRefPtr url_request_; + CefRefPtr request_; + CefRefPtr client_; + scoped_refptr message_loop_proxy_; + CefURLRequest::Status status_; + CefURLRequest::ErrorCode error_code_; + CefRefPtr response_; + scoped_ptr loader_; + scoped_ptr url_client_; + int64 upload_data_size_; + bool got_upload_progress_complete_; + int64 download_data_received_; + int64 download_data_total_; +}; + + +// CefWebURLLoaderClient -------------------------------------------------- + +namespace { + +CefWebURLLoaderClient::CefWebURLLoaderClient( + CefRenderURLRequest::Context* context, + int request_flags) + : context_(context), + request_flags_(request_flags) { +} + +CefWebURLLoaderClient::~CefWebURLLoaderClient() { +} + +void CefWebURLLoaderClient::willSendRequest( + WebURLLoader* loader, + WebURLRequest& newRequest, + const WebURLResponse& redirectResponse) { +} + +void CefWebURLLoaderClient::didSendData( + WebURLLoader* loader, + unsigned long long bytesSent, + unsigned long long totalBytesToBeSent) { + if (request_flags_ & UR_FLAG_REPORT_UPLOAD_PROGRESS) + context_->OnUploadProgress(bytesSent, totalBytesToBeSent); +} + +void CefWebURLLoaderClient::didReceiveResponse( + WebURLLoader* loader, + const WebURLResponse& response) { + context_->OnResponse(response); +} + +void CefWebURLLoaderClient::didDownloadData(WebURLLoader* loader, + int dataLength) { +} + +void CefWebURLLoaderClient::didReceiveData(WebURLLoader* loader, + const char* data, + int dataLength, + int encodedDataLength) { + context_->OnDownloadProgress(dataLength); + + if (!(request_flags_ & UR_FLAG_NO_DOWNLOAD_DATA)) + context_->OnDownloadData(data, dataLength); +} + +void CefWebURLLoaderClient::didReceiveCachedMetadata(WebURLLoader* loader, + const char* data, + int dataLength) { +} + +void CefWebURLLoaderClient::didFinishLoading(WebURLLoader* loader, + double finishTime) { + context_->OnComplete(); +} + +void CefWebURLLoaderClient::didFail(WebURLLoader* loader, + const WebURLError& error) { + context_->OnError(error); +} + + +} // namespace + + +// CefRenderURLRequest -------------------------------------------------------- + +CefRenderURLRequest::CefRenderURLRequest( + CefRefPtr request, + CefRefPtr client) { + context_ = new Context(this, request, client); +} + +CefRenderURLRequest::~CefRenderURLRequest() { +} + +bool CefRenderURLRequest::Start() { + if (!VerifyContext()) + return false; + return context_->Start(); +} + +CefRefPtr CefRenderURLRequest::GetRequest() { + if (!VerifyContext()) + return NULL; + return context_->request(); +} + +CefRefPtr CefRenderURLRequest::GetClient() { + if (!VerifyContext()) + return NULL; + return context_->client(); +} + +CefURLRequest::Status CefRenderURLRequest::GetRequestStatus() { + if (!VerifyContext()) + return UR_UNKNOWN; + return context_->status(); +} + +CefURLRequest::ErrorCode CefRenderURLRequest::GetRequestError() { + if (!VerifyContext()) + return ERR_NONE; + return context_->error_code(); +} + +CefRefPtr CefRenderURLRequest::GetResponse() { + if (!VerifyContext()) + return NULL; + return context_->response(); +} + +void CefRenderURLRequest::Cancel() { + if (!VerifyContext()) + return; + return context_->Cancel(); +} + +bool CefRenderURLRequest::VerifyContext() { + DCHECK(context_.get()); + if (!context_->CalledOnValidThread()) { + NOTREACHED() << "called on invalid thread"; + return false; + } + + return true; +} diff --git a/libcef/renderer/render_urlrequest_impl.h b/libcef/renderer/render_urlrequest_impl.h new file mode 100644 index 000000000..b529b100c --- /dev/null +++ b/libcef/renderer/render_urlrequest_impl.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_RENDERER_RENDER_URLREQUEST_IMPL_H_ +#define CEF_LIBCEF_RENDERER_RENDER_URLREQUEST_IMPL_H_ + +#include "include/cef_urlrequest.h" +#include "base/memory/ref_counted.h" + +class CefRenderURLRequest : public CefURLRequest { + public: + class Context; + + CefRenderURLRequest(CefRefPtr request, + CefRefPtr client); + virtual ~CefRenderURLRequest(); + + bool Start(); + + // CefURLRequest methods. + virtual CefRefPtr GetRequest() OVERRIDE; + virtual CefRefPtr GetClient() OVERRIDE; + virtual Status GetRequestStatus() OVERRIDE; + virtual ErrorCode GetRequestError() OVERRIDE; + virtual CefRefPtr GetResponse() OVERRIDE; + virtual void Cancel() OVERRIDE; + + private: + bool VerifyContext(); + + scoped_refptr context_; + + IMPLEMENT_REFCOUNTING(CefBrowserURLRequest); +}; + +#endif // CEF_LIBCEF_RENDERER_RENDER_URLREQUEST_IMPL_H_ diff --git a/libcef/renderer/thread_util.h b/libcef/renderer/thread_util.h new file mode 100644 index 000000000..9cdc02dea --- /dev/null +++ b/libcef/renderer/thread_util.h @@ -0,0 +1,57 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_RENDERER_THREAD_UTIL_H_ +#define CEF_LIBCEF_RENDERER_THREAD_UTIL_H_ +#pragma once + +#include "libcef/renderer/content_renderer_client.h" + +#include "base/location.h" +#include "base/logging.h" +#include "content/public/renderer/render_thread.h" + +#define CEF_CURRENTLY_ON_RT() (!!content::RenderThread::Get()) + +#define CEF_REQUIRE_RT() DCHECK(CEF_CURRENTLY_ON_RT()) + +#define CEF_REQUIRE_RT_RETURN(var) \ + if (!CEF_CURRENTLY_ON_RT()) { \ + NOTREACHED() << "called on invalid thread"; \ + return var; \ + } + +#define CEF_REQUIRE_RT_RETURN_VOID() \ + if (!CEF_CURRENTLY_ON_RT()) { \ + NOTREACHED() << "called on invalid thread"; \ + return; \ + } + +#define CEF_RENDER_LOOP() (CefContentRendererClient::Get()->render_loop()) + +#define CEF_POST_TASK_RT(task) \ + CEF_RENDER_LOOP()->PostTask(FROM_HERE, task) +#define CEF_POST_DELAYED_TASK_RT(task, delay_ms) \ + CEF_RENDER_LOOP()->PostDelayedTask(FROM_HERE, task, delay_ms) + +// Use this template in conjuction with RefCountedThreadSafe when you want to +// ensure that an object is deleted on the render thread. +struct CefDeleteOnRenderThread { + template + static void Destruct(const T* x) { + if (CEF_CURRENTLY_ON_RT()) { + delete x; + } else { + if (!CEF_RENDER_LOOP()->DeleteSoon(FROM_HERE, x)) { +#if defined(UNIT_TEST) + // Only logged under unit testing because leaks at shutdown + // are acceptable under normal circumstances. + LOG(ERROR) << "DeleteSoon failed on thread " << thread; +#endif // UNIT_TEST + } + } + } +}; + +#endif // CEF_LIBCEF_RENDERER_THREAD_UTIL_H_ diff --git a/libcef/renderer/v8_impl.cc b/libcef/renderer/v8_impl.cc new file mode 100644 index 000000000..c364817cb --- /dev/null +++ b/libcef/renderer/v8_impl.cc @@ -0,0 +1,1318 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include + +#include "base/compiler_specific.h" + +#include "third_party/WebKit/Source/WebCore/config.h" +MSVC_PUSH_WARNING_LEVEL(0); +#include "V8Proxy.h" // NOLINT(build/include) +#include "V8RecursionScope.h" // NOLINT(build/include) +MSVC_POP_WARNING(); +#undef LOG + +#include "libcef/renderer/v8_impl.h" + +#include "libcef/common/tracker.h" +#include "libcef/renderer/browser_impl.h" +#include "libcef/renderer/thread_util.h" + +#include "base/bind.h" +#include "base/lazy_instance.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h" + +namespace { + +static const char kCefTrackObject[] = "Cef::TrackObject"; + +// Memory manager. + +base::LazyInstance g_v8_tracker = LAZY_INSTANCE_INITIALIZER; + +class V8TrackObject : public CefTrackNode { + public: + V8TrackObject() + : external_memory_(0) { + } + ~V8TrackObject() { + if (external_memory_ != 0) + v8::V8::AdjustAmountOfExternalAllocatedMemory(-external_memory_); + } + + inline int GetExternallyAllocatedMemory() { + return external_memory_; + } + + int AdjustExternallyAllocatedMemory(int change_in_bytes) { + int new_value = external_memory_ + change_in_bytes; + if (new_value < 0) { + NOTREACHED() << "External memory usage cannot be less than 0 bytes"; + change_in_bytes = -(external_memory_); + new_value = 0; + } + + if (change_in_bytes != 0) + v8::V8::AdjustAmountOfExternalAllocatedMemory(change_in_bytes); + external_memory_ = new_value; + + return new_value; + } + + inline void SetAccessor(CefRefPtr accessor) { + accessor_ = accessor; + } + + inline CefRefPtr GetAccessor() { + return accessor_; + } + + inline void SetHandler(CefRefPtr handler) { + handler_ = handler; + } + + inline CefRefPtr GetHandler() { + return handler_; + } + + inline void SetUserData(CefRefPtr user_data) { + user_data_ = user_data; + } + + inline CefRefPtr GetUserData() { + return user_data_; + } + + // Attach this track object to the specified V8 object. + void AttachTo(v8::Handle object) { + object->SetHiddenValue(v8::String::New(kCefTrackObject), + v8::External::Wrap(this)); + } + + // Retrieve the track object for the specified V8 object. + static V8TrackObject* Unwrap(v8::Handle object) { + v8::Local value = + object->GetHiddenValue(v8::String::New(kCefTrackObject)); + if (!value.IsEmpty()) + return static_cast(v8::External::Unwrap(value)); + + return NULL; + } + + private: + CefRefPtr accessor_; + CefRefPtr handler_; + CefRefPtr user_data_; + int external_memory_; +}; + +class V8TrackString : public CefTrackNode { + public: + explicit V8TrackString(const std::string& str) : string_(str) {} + const char* GetString() { return string_.c_str(); } + + private: + std::string string_; +}; + +void TrackAdd(CefTrackNode* object) { + g_v8_tracker.Pointer()->Add(object); +} + +void TrackDelete(CefTrackNode* object) { + g_v8_tracker.Pointer()->Delete(object); +} + +// Callback for weak persistent reference destruction. +void TrackDestructor(v8::Persistent object, void* parameter) { + if (parameter) + TrackDelete(static_cast(parameter)); + + object.Dispose(); + object.Clear(); +} + +// Convert a CefString to a V8::String. +v8::Handle GetV8String(const CefString& str) { +#if defined(CEF_STRING_TYPE_UTF16) + // Already a UTF16 string. + return v8::String::New( + reinterpret_cast( + const_cast(str.c_str())), + str.length()); +#elif defined(CEF_STRING_TYPE_UTF8) + // Already a UTF8 string. + return v8::String::New(const_cast(str.c_str()), str.length()); +#else + // Convert the string to UTF8. + std::string tmpStr = str; + return v8::String::New(tmpStr.c_str(), tmpStr.length()); +#endif +} + +#if defined(CEF_STRING_TYPE_UTF16) +void v8impl_string_dtor(char16* str) { + delete [] str; +} +#elif defined(CEF_STRING_TYPE_UTF8) +void v8impl_string_dtor(char* str) { + delete [] str; +} +#endif + +// Convert a v8::String to CefString. +void GetCefString(v8::Handle str, CefString& out) { +#if defined(CEF_STRING_TYPE_WIDE) + // Allocate enough space for a worst-case conversion. + int len = str->Utf8Length(); + if (len == 0) + return; + char* buf = new char[len + 1]; + str->WriteUtf8(buf, len + 1); + + // Perform conversion to the wide type. + cef_string_t* retws = out.GetWritableStruct(); + cef_string_utf8_to_wide(buf, len, retws); + + delete [] buf; +#else // !defined(CEF_STRING_TYPE_WIDE) +#if defined(CEF_STRING_TYPE_UTF16) + int len = str->Length(); + if (len == 0) + return; + char16* buf = new char16[len + 1]; + str->Write(reinterpret_cast(buf), 0, len + 1); +#else + // Allocate enough space for a worst-case conversion. + int len = str->Utf8Length(); + if (len == 0) + return; + char* buf = new char[len + 1]; + str->WriteUtf8(buf, len + 1); +#endif + + // Don't perform an extra string copy. + out.clear(); + cef_string_t* retws = out.GetWritableStruct(); + retws->str = buf; + retws->length = len; + retws->dtor = v8impl_string_dtor; +#endif // !defined(CEF_STRING_TYPE_WIDE) +} + +// V8 function callback. +v8::Handle FunctionCallbackImpl(const v8::Arguments& args) { + v8::HandleScope handle_scope; + + CefV8Handler* handler = + static_cast(v8::External::Unwrap(args.Data())); + + CefV8ValueList params; + for (int i = 0; i < args.Length(); i++) + params.push_back(new CefV8ValueImpl(args[i])); + + CefString func_name; + GetCefString(v8::Handle::Cast(args.Callee()->GetName()), + func_name); + CefRefPtr object = new CefV8ValueImpl(args.This()); + CefRefPtr retval; + CefString exception; + + if (handler->Execute(func_name, object, params, retval, exception)) { + if (!exception.empty()) { + return v8::ThrowException(v8::Exception::Error(GetV8String(exception))); + } else { + CefV8ValueImpl* rv = static_cast(retval.get()); + if (rv) + return rv->GetHandle(); + } + } + + return v8::Undefined(); +} + +// V8 Accessor callbacks +v8::Handle AccessorGetterCallbackImpl(v8::Local property, + const v8::AccessorInfo& info) { + v8::HandleScope handle_scope; + + v8::Handle obj = info.This(); + + CefRefPtr accessorPtr; + + V8TrackObject* tracker = V8TrackObject::Unwrap(obj); + if (tracker) + accessorPtr = tracker->GetAccessor(); + + if (accessorPtr.get()) { + CefRefPtr retval; + CefRefPtr object = new CefV8ValueImpl(obj); + CefString name, exception; + GetCefString(property, name); + if (accessorPtr->Get(name, object, retval, exception)) { + if (!exception.empty()) { + return v8::ThrowException( + v8::Exception::Error(GetV8String(exception))); + } else { + CefV8ValueImpl* rv = static_cast(retval.get()); + if (rv) + return rv->GetHandle(); + } + } + } + + return v8::Undefined(); +} + +void AccessorSetterCallbackImpl(v8::Local property, + v8::Local value, + const v8::AccessorInfo& info) { + v8::HandleScope handle_scope; + + v8::Handle obj = info.This(); + + CefRefPtr accessorPtr; + + V8TrackObject* tracker = V8TrackObject::Unwrap(obj); + if (tracker) + accessorPtr = tracker->GetAccessor(); + + if (accessorPtr.get()) { + CefRefPtr object = new CefV8ValueImpl(obj); + CefRefPtr cefValue = new CefV8ValueImpl(value); + CefString name, exception; + GetCefString(property, name); + accessorPtr->Set(name, object, cefValue, exception); + if (!exception.empty()) { + v8::ThrowException(v8::Exception::Error(GetV8String(exception))); + return; + } + } +} + +// V8 extension registration. + +class ExtensionWrapper : public v8::Extension { + public: + ExtensionWrapper(const char* extension_name, + const char* javascript_code, + CefV8Handler* handler) + : v8::Extension(extension_name, javascript_code), handler_(handler) { + if (handler) { + // The reference will be released when the process exits. + V8TrackObject* object = new V8TrackObject; + object->SetHandler(handler); + TrackAdd(object); + } + } + + virtual v8::Handle GetNativeFunction( + v8::Handle name) { + if (!handler_) + return v8::Handle(); + + return v8::FunctionTemplate::New(FunctionCallbackImpl, + v8::External::Wrap(handler_)); + } + + private: + CefV8Handler* handler_; +}; + +class CefV8ExceptionImpl : public CefV8Exception { + public: + explicit CefV8ExceptionImpl(v8::Handle message) + : line_number_(0), + start_position_(0), + end_position_(0), + start_column_(0), + end_column_(0) { + if (message.IsEmpty()) + return; + + GetCefString(message->Get(), message_); + GetCefString(message->GetSourceLine(), source_line_); + + if (!message->GetScriptResourceName().IsEmpty()) + GetCefString(message->GetScriptResourceName()->ToString(), script_); + + line_number_ = message->GetLineNumber(); + start_position_ = message->GetStartPosition(); + end_position_ = message->GetEndPosition(); + start_column_ = message->GetStartColumn(); + end_column_ = message->GetEndColumn(); + } + + virtual CefString GetMessage() OVERRIDE { return message_; } + virtual CefString GetSourceLine() OVERRIDE { return source_line_; } + virtual CefString GetScriptResourceName() OVERRIDE { return script_; } + virtual int GetLineNumber() OVERRIDE { return line_number_; } + virtual int GetStartPosition() OVERRIDE { return start_position_; } + virtual int GetEndPosition() OVERRIDE { return end_position_; } + virtual int GetStartColumn() OVERRIDE { return start_column_; } + virtual int GetEndColumn() OVERRIDE { return end_column_; } + + protected: + CefString message_; + CefString source_line_; + CefString script_; + int line_number_; + int start_position_; + int end_position_; + int start_column_; + int end_column_; + + IMPLEMENT_REFCOUNTING(CefV8ExceptionImpl); +}; + +} // namespace + + +// Global functions. + +bool CefRegisterExtension(const CefString& extension_name, + const CefString& javascript_code, + CefRefPtr handler) { + // Verify that this method was called on the correct thread. + CEF_REQUIRE_RT_RETURN(false); + + V8TrackString* name = new V8TrackString(extension_name); + TrackAdd(name); + V8TrackString* code = new V8TrackString(javascript_code); + TrackAdd(code); + + ExtensionWrapper* wrapper = new ExtensionWrapper(name->GetString(), + code->GetString(), handler.get()); + + content::RenderThread::Get()->RegisterExtension(wrapper); + return true; +} + + +// CefV8Context implementation. + +// static +CefRefPtr CefV8Context::GetCurrentContext() { + CefRefPtr context; + CEF_REQUIRE_RT_RETURN(context); + if (v8::Context::InContext()) { + v8::HandleScope handle_scope; + context = new CefV8ContextImpl(v8::Context::GetCurrent()); + } + return context; +} + +// static +CefRefPtr CefV8Context::GetEnteredContext() { + CefRefPtr context; + CEF_REQUIRE_RT_RETURN(context); + if (v8::Context::InContext()) { + v8::HandleScope handle_scope; + context = new CefV8ContextImpl(v8::Context::GetEntered()); + } + return context; +} + +// static +bool CefV8Context::InContext() { + CEF_REQUIRE_RT_RETURN(false); + return v8::Context::InContext(); +} + + +// CefV8ContextImpl implementation. + +#define CEF_V8_REQUIRE_OBJECT_RETURN(ret) \ + if (!GetHandle()->IsObject()) { \ + NOTREACHED() << "V8 value is not an object"; \ + return ret; \ + } + +#define CEF_V8_REQUIRE_ARRAY_RETURN(ret) \ + if (!GetHandle()->IsArray()) { \ + NOTREACHED() << "V8 value is not an array"; \ + return ret; \ + } + +#define CEF_V8_REQUIRE_FUNCTION_RETURN(ret) \ + if (!GetHandle()->IsFunction()) { \ + NOTREACHED() << "V8 value is not a function"; \ + return ret; \ + } + +CefV8ContextImpl::CefV8ContextImpl(v8::Handle context) +#ifndef NDEBUG + : enter_count_(0) +#endif +{ // NOLINT(whitespace/braces) + v8_context_ = new CefV8ContextHandle(context); +} + +CefV8ContextImpl::~CefV8ContextImpl() { + DLOG_ASSERT(0 == enter_count_); +} + +CefRefPtr CefV8ContextImpl::GetBrowser() { + CefRefPtr browser; + CEF_REQUIRE_RT_RETURN(browser); + + WebKit::WebFrame* webframe = GetWebFrame(); + if (webframe) + browser = CefBrowserImpl::GetBrowserForMainFrame(webframe->top()); + + return browser; +} + +CefRefPtr CefV8ContextImpl::GetFrame() { + CefRefPtr frame; + CEF_REQUIRE_RT_RETURN(frame); + + WebKit::WebFrame* webframe = GetWebFrame(); + if (webframe) { + CefRefPtr browser = + CefBrowserImpl::GetBrowserForMainFrame(webframe->top()); + frame = browser->GetFrame(webframe->identifier()); + } + + return frame; +} + +CefRefPtr CefV8ContextImpl::GetGlobal() { + CEF_REQUIRE_RT_RETURN(NULL); + + v8::HandleScope handle_scope; + v8::Context::Scope context_scope(v8_context_->GetHandle()); + return new CefV8ValueImpl(v8_context_->GetHandle()->Global()); +} + +bool CefV8ContextImpl::Enter() { + CEF_REQUIRE_RT_RETURN(false); + v8_context_->GetHandle()->Enter(); +#ifndef NDEBUG + ++enter_count_; +#endif + return true; +} + +bool CefV8ContextImpl::Exit() { + CEF_REQUIRE_RT_RETURN(false); + DLOG_ASSERT(enter_count_ > 0); + v8_context_->GetHandle()->Exit(); +#ifndef NDEBUG + --enter_count_; +#endif + return true; +} + +bool CefV8ContextImpl::IsSame(CefRefPtr that) { + CEF_REQUIRE_RT_RETURN(false); + + v8::HandleScope handle_scope; + + v8::Local thatHandle; + v8::Local thisHandle = GetContext(); + + CefV8ContextImpl* impl = static_cast(that.get()); + if (impl) + thatHandle = impl->GetContext(); + + return (thisHandle == thatHandle); +} + +bool CefV8ContextImpl::Eval(const CefString& code, + CefRefPtr& retval, + CefRefPtr& exception) { + CEF_REQUIRE_RT_RETURN(NULL); + + if (code.empty()) { + NOTREACHED() << "invalid input parameter"; + return false; + } + + v8::HandleScope handle_scope; + v8::Context::Scope context_scope(v8_context_->GetHandle()); + v8::Local obj = v8_context_->GetHandle()->Global(); + + // Retrieve the eval function. + v8::Local val = obj->Get(v8::String::New("eval")); + if (val.IsEmpty() || !val->IsFunction()) + return false; + + v8::Local func = v8::Local::Cast(val); + v8::Handle code_val = GetV8String(code); + + v8::TryCatch try_catch; + try_catch.SetVerbose(true); + v8::Local func_rv; + + retval = NULL; + exception = NULL; + + // Execute the function call using the V8Proxy so that inspector + // instrumentation works. + WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(); + DCHECK(proxy); + if (proxy) + func_rv = proxy->callFunction(func, obj, 1, &code_val); + + if (try_catch.HasCaught()) { + exception = new CefV8ExceptionImpl(try_catch.Message()); + return false; + } else if (!func_rv.IsEmpty()) { + retval = new CefV8ValueImpl(func_rv); + } + return true; +} + +v8::Local CefV8ContextImpl::GetContext() { + return v8::Local::New(v8_context_->GetHandle()); +} + +WebKit::WebFrame* CefV8ContextImpl::GetWebFrame() { + v8::HandleScope handle_scope; + v8::Context::Scope context_scope(v8_context_->GetHandle()); + WebKit::WebFrame* frame = WebKit::WebFrame::frameForCurrentContext(); + return frame; +} + + +// CefV8ValueHandle + +// Custom destructor for a v8 value handle which gets called only on the UI +// thread. +CefV8ValueHandle::~CefV8ValueHandle() { + if (tracker_) { + TrackAdd(tracker_); + v8_handle_.MakeWeak(tracker_, TrackDestructor); + } else { + v8_handle_.Dispose(); + v8_handle_.Clear(); + } + tracker_ = NULL; +} + + +// CefV8Value + +// static +CefRefPtr CefV8Value::CreateUndefined() { + CEF_REQUIRE_RT_RETURN(NULL); + v8::HandleScope handle_scope; + return new CefV8ValueImpl(v8::Undefined()); +} + +// static +CefRefPtr CefV8Value::CreateNull() { + CEF_REQUIRE_RT_RETURN(NULL); + v8::HandleScope handle_scope; + return new CefV8ValueImpl(v8::Null()); +} + +// static +CefRefPtr CefV8Value::CreateBool(bool value) { + CEF_REQUIRE_RT_RETURN(NULL); + v8::HandleScope handle_scope; + return new CefV8ValueImpl(v8::Boolean::New(value)); +} + +// static +CefRefPtr CefV8Value::CreateInt(int32 value) { + CEF_REQUIRE_RT_RETURN(NULL); + v8::HandleScope handle_scope; + return new CefV8ValueImpl(v8::Int32::New(value)); +} + +// static +CefRefPtr CefV8Value::CreateUInt(uint32 value) { + CEF_REQUIRE_RT_RETURN(NULL); + v8::HandleScope handle_scope; + return new CefV8ValueImpl(v8::Int32::NewFromUnsigned(value)); +} + +// static +CefRefPtr CefV8Value::CreateDouble(double value) { + CEF_REQUIRE_RT_RETURN(NULL); + v8::HandleScope handle_scope; + return new CefV8ValueImpl(v8::Number::New(value)); +} + +// static +CefRefPtr CefV8Value::CreateDate(const CefTime& date) { + CEF_REQUIRE_RT_RETURN(NULL); + v8::HandleScope handle_scope; + // Convert from seconds to milliseconds. + return new CefV8ValueImpl(v8::Date::New(date.GetDoubleT() * 1000)); +} + +// static +CefRefPtr CefV8Value::CreateString(const CefString& value) { + CEF_REQUIRE_RT_RETURN(NULL); + v8::HandleScope handle_scope; + return new CefV8ValueImpl(GetV8String(value)); +} + +// static +CefRefPtr CefV8Value::CreateObject( + CefRefPtr accessor) { + CEF_REQUIRE_RT_RETURN(NULL); + + v8::HandleScope handle_scope; + + v8::Local context = v8::Context::GetCurrent(); + if (context.IsEmpty()) { + NOTREACHED() << "not currently in a V8 context"; + return NULL; + } + + // Create the new V8 object. + v8::Local obj = v8::Object::New(); + + // Create a tracker object that will cause the user data and/or accessor + // reference to be released when the V8 object is destroyed. + V8TrackObject* tracker = new V8TrackObject; + tracker->SetAccessor(accessor); + + // Attach the tracker object. + tracker->AttachTo(obj); + + return new CefV8ValueImpl(obj, tracker); +} + +// static +CefRefPtr CefV8Value::CreateArray(int length) { + CEF_REQUIRE_RT_RETURN(NULL); + + v8::HandleScope handle_scope; + + v8::Local context = v8::Context::GetCurrent(); + if (context.IsEmpty()) { + NOTREACHED() << "not currently in a V8 context"; + return NULL; + } + + // Create a tracker object that will cause the user data reference to be + // released when the V8 object is destroyed. + V8TrackObject* tracker = new V8TrackObject; + + // Create the new V8 array. + v8::Local arr = v8::Array::New(length); + + // Attach the tracker object. + tracker->AttachTo(arr); + + return new CefV8ValueImpl(arr, tracker); +} + +// static +CefRefPtr CefV8Value::CreateFunction( + const CefString& name, + CefRefPtr handler) { + CEF_REQUIRE_RT_RETURN(NULL); + + if (!handler.get()) { + NOTREACHED() << "invalid parameter"; + return NULL; + } + + v8::HandleScope handle_scope; + + v8::Local context = v8::Context::GetCurrent(); + if (context.IsEmpty()) { + NOTREACHED() << "not currently in a V8 context"; + return NULL; + } + + // Create a new V8 function template. + v8::Local tmpl = v8::FunctionTemplate::New(); + + v8::Local data = v8::External::Wrap(handler.get()); + + // Set the function handler callback. + tmpl->SetCallHandler(FunctionCallbackImpl, data); + + // Retrieve the function object and set the name. + v8::Local func = tmpl->GetFunction(); + if (func.IsEmpty()) { + NOTREACHED() << "failed to create V8 function"; + return NULL; + } + + func->SetName(GetV8String(name)); + + // Create a tracker object that will cause the user data and/or handler + // reference to be released when the V8 object is destroyed. + V8TrackObject* tracker = new V8TrackObject; + tracker->SetHandler(handler); + + // Attach the tracker object. + tracker->AttachTo(func); + + // Create the CefV8ValueImpl and provide a tracker object that will cause + // the handler reference to be released when the V8 object is destroyed. + return new CefV8ValueImpl(func, tracker); +} + + +// CefV8ValueImpl + +CefV8ValueImpl::CefV8ValueImpl(v8::Handle value, + CefTrackNode* tracker) + : rethrow_exceptions_(false) { + v8_value_ = new CefV8ValueHandle(value, tracker); +} + +CefV8ValueImpl::~CefV8ValueImpl() { +} + +bool CefV8ValueImpl::IsUndefined() { + CEF_REQUIRE_RT_RETURN(false); + return GetHandle()->IsUndefined(); +} + +bool CefV8ValueImpl::IsNull() { + CEF_REQUIRE_RT_RETURN(false); + return GetHandle()->IsNull(); +} + +bool CefV8ValueImpl::IsBool() { + CEF_REQUIRE_RT_RETURN(false); + return (GetHandle()->IsBoolean() || GetHandle()->IsTrue() + || GetHandle()->IsFalse()); +} + +bool CefV8ValueImpl::IsInt() { + CEF_REQUIRE_RT_RETURN(false); + return GetHandle()->IsInt32(); +} + +bool CefV8ValueImpl::IsUInt() { + CEF_REQUIRE_RT_RETURN(false); + return GetHandle()->IsUint32(); +} + +bool CefV8ValueImpl::IsDouble() { + CEF_REQUIRE_RT_RETURN(false); + return GetHandle()->IsNumber(); +} + +bool CefV8ValueImpl::IsDate() { + CEF_REQUIRE_RT_RETURN(false); + return GetHandle()->IsDate(); +} + +bool CefV8ValueImpl::IsString() { + CEF_REQUIRE_RT_RETURN(false); + return GetHandle()->IsString(); +} + +bool CefV8ValueImpl::IsObject() { + CEF_REQUIRE_RT_RETURN(false); + return GetHandle()->IsObject(); +} + +bool CefV8ValueImpl::IsArray() { + CEF_REQUIRE_RT_RETURN(false); + return GetHandle()->IsArray(); +} + +bool CefV8ValueImpl::IsFunction() { + CEF_REQUIRE_RT_RETURN(false); + return GetHandle()->IsFunction(); +} + +bool CefV8ValueImpl::IsSame(CefRefPtr that) { + CEF_REQUIRE_RT_RETURN(false); + + v8::HandleScope handle_scope; + + v8::Handle thatHandle; + v8::Handle thisHandle = GetHandle(); + + CefV8ValueImpl* impl = static_cast(that.get()); + if (impl) + thatHandle = impl->GetHandle(); + + return (thisHandle == thatHandle); +} + +bool CefV8ValueImpl::GetBoolValue() { + CEF_REQUIRE_RT_RETURN(false); + if (GetHandle()->IsTrue()) { + return true; + } else if (GetHandle()->IsFalse()) { + return false; + } else { + v8::HandleScope handle_scope; + v8::Local val = GetHandle()->ToBoolean(); + return val->Value(); + } +} + +int32 CefV8ValueImpl::GetIntValue() { + CEF_REQUIRE_RT_RETURN(0); + v8::HandleScope handle_scope; + v8::Local val = GetHandle()->ToInt32(); + return val->Value(); +} + +uint32 CefV8ValueImpl::GetUIntValue() { + CEF_REQUIRE_RT_RETURN(0); + v8::HandleScope handle_scope; + v8::Local val = GetHandle()->ToUint32(); + return val->Value(); +} + +double CefV8ValueImpl::GetDoubleValue() { + CEF_REQUIRE_RT_RETURN(0.); + v8::HandleScope handle_scope; + v8::Local val = GetHandle()->ToNumber(); + return val->Value(); +} + +CefTime CefV8ValueImpl::GetDateValue() { + CEF_REQUIRE_RT_RETURN(CefTime(0.)); + v8::HandleScope handle_scope; + v8::Local val = GetHandle()->ToNumber(); + // Convert from milliseconds to seconds. + return CefTime(val->Value() / 1000); +} + +CefString CefV8ValueImpl::GetStringValue() { + CefString rv; + CEF_REQUIRE_RT_RETURN(rv); + v8::HandleScope handle_scope; + GetCefString(GetHandle()->ToString(), rv); + return rv; +} + +bool CefV8ValueImpl::IsUserCreated() { + CEF_REQUIRE_RT_RETURN(false); + CEF_V8_REQUIRE_OBJECT_RETURN(false); + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + + V8TrackObject* tracker = V8TrackObject::Unwrap(obj); + return (tracker != NULL); +} + +bool CefV8ValueImpl::HasException() { + CEF_REQUIRE_RT_RETURN(false); + CEF_V8_REQUIRE_OBJECT_RETURN(false); + + return (last_exception_.get() != NULL); +} + +CefRefPtr CefV8ValueImpl::GetException() { + CEF_REQUIRE_RT_RETURN(NULL); + CEF_V8_REQUIRE_OBJECT_RETURN(NULL); + + return last_exception_; +} + +bool CefV8ValueImpl::ClearException() { + CEF_REQUIRE_RT_RETURN(NULL); + CEF_V8_REQUIRE_OBJECT_RETURN(NULL); + + last_exception_ = NULL; + return true; +} + +bool CefV8ValueImpl::WillRethrowExceptions() { + CEF_REQUIRE_RT_RETURN(false); + CEF_V8_REQUIRE_OBJECT_RETURN(false); + + return rethrow_exceptions_; +} + +bool CefV8ValueImpl::SetRethrowExceptions(bool rethrow) { + CEF_REQUIRE_RT_RETURN(false); + CEF_V8_REQUIRE_OBJECT_RETURN(false); + + rethrow_exceptions_ = rethrow; + return true; +} + +bool CefV8ValueImpl::HasValue(const CefString& key) { + CEF_REQUIRE_RT_RETURN(false); + CEF_V8_REQUIRE_OBJECT_RETURN(false); + + if (key.empty()) { + NOTREACHED() << "invalid input parameter"; + return false; + } + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + return obj->Has(GetV8String(key)); +} + +bool CefV8ValueImpl::HasValue(int index) { + CEF_REQUIRE_RT_RETURN(false); + CEF_V8_REQUIRE_OBJECT_RETURN(false); + + if (index < 0) { + NOTREACHED() << "invalid input parameter"; + return false; + } + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + return obj->Has(index); +} + +bool CefV8ValueImpl::DeleteValue(const CefString& key) { + CEF_REQUIRE_RT_RETURN(false); + CEF_V8_REQUIRE_OBJECT_RETURN(false); + + if (key.empty()) { + NOTREACHED() << "invalid input parameter"; + return false; + } + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + + v8::TryCatch try_catch; + try_catch.SetVerbose(true); + bool del = obj->Delete(GetV8String(key)); + return (!HasCaught(try_catch) && del); +} + +bool CefV8ValueImpl::DeleteValue(int index) { + CEF_REQUIRE_RT_RETURN(false); + CEF_V8_REQUIRE_OBJECT_RETURN(false); + + if (index < 0) { + NOTREACHED() << "invalid input parameter"; + return false; + } + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + + v8::TryCatch try_catch; + try_catch.SetVerbose(true); + bool del = obj->Delete(index); + return (!HasCaught(try_catch) && del); +} + +CefRefPtr CefV8ValueImpl::GetValue(const CefString& key) { + CEF_REQUIRE_RT_RETURN(NULL); + CEF_V8_REQUIRE_OBJECT_RETURN(NULL); + + if (key.empty()) { + NOTREACHED() << "invalid input parameter"; + return NULL; + } + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + + v8::TryCatch try_catch; + try_catch.SetVerbose(true); + v8::Local value = obj->Get(GetV8String(key)); + if (!HasCaught(try_catch) && !value.IsEmpty()) + return new CefV8ValueImpl(value); + return NULL; +} + +CefRefPtr CefV8ValueImpl::GetValue(int index) { + CEF_REQUIRE_RT_RETURN(NULL); + CEF_V8_REQUIRE_OBJECT_RETURN(NULL); + + if (index < 0) { + NOTREACHED() << "invalid input parameter"; + return NULL; + } + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + + v8::TryCatch try_catch; + try_catch.SetVerbose(true); + v8::Local value = obj->Get(v8::Number::New(index)); + if (!HasCaught(try_catch) && !value.IsEmpty()) + return new CefV8ValueImpl(value); + return NULL; +} + +bool CefV8ValueImpl::SetValue(const CefString& key, + CefRefPtr value, + PropertyAttribute attribute) { + CEF_REQUIRE_RT_RETURN(false); + CEF_V8_REQUIRE_OBJECT_RETURN(false); + + CefV8ValueImpl* impl = static_cast(value.get()); + if (impl && !key.empty()) { + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + + v8::TryCatch try_catch; + try_catch.SetVerbose(true); + bool set = obj->Set(GetV8String(key), impl->GetHandle(), + static_cast(attribute)); + return (!HasCaught(try_catch) && set); + } else { + NOTREACHED() << "invalid input parameter"; + return false; + } +} + +bool CefV8ValueImpl::SetValue(int index, CefRefPtr value) { + CEF_REQUIRE_RT_RETURN(false); + CEF_V8_REQUIRE_OBJECT_RETURN(false); + + if (index < 0) { + NOTREACHED() << "invalid input parameter"; + return false; + } + + CefV8ValueImpl* impl = static_cast(value.get()); + if (impl) { + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + + v8::TryCatch try_catch; + try_catch.SetVerbose(true); + bool set = obj->Set(index, impl->GetHandle()); + return (!HasCaught(try_catch) && set); + } else { + NOTREACHED() << "invalid input parameter"; + return false; + } +} + +bool CefV8ValueImpl::SetValue(const CefString& key, AccessControl settings, + PropertyAttribute attribute) { + CEF_REQUIRE_RT_RETURN(false); + CEF_V8_REQUIRE_OBJECT_RETURN(false); + + if (key.empty()) { + NOTREACHED() << "invalid input parameter"; + return false; + } + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + + CefRefPtr accessorPtr; + + V8TrackObject* tracker = V8TrackObject::Unwrap(obj); + if (tracker) + accessorPtr = tracker->GetAccessor(); + + // Verify that an accessor exists for this object. + if (!accessorPtr.get()) + return false; + + v8::AccessorGetter getter = AccessorGetterCallbackImpl; + v8::AccessorSetter setter = (attribute & V8_PROPERTY_ATTRIBUTE_READONLY) ? + NULL : AccessorSetterCallbackImpl; + + v8::TryCatch try_catch; + try_catch.SetVerbose(true); + bool set = obj->SetAccessor(GetV8String(key), getter, setter, obj, + static_cast(settings), + static_cast(attribute)); + return (!HasCaught(try_catch) && set); +} + +bool CefV8ValueImpl::GetKeys(std::vector& keys) { + CEF_REQUIRE_RT_RETURN(false); + CEF_V8_REQUIRE_OBJECT_RETURN(false); + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + v8::Local arr_keys = obj->GetPropertyNames(); + uint32_t len = arr_keys->Length(); + for (uint32_t i = 0; i < len; ++i) { + v8::Local value = arr_keys->Get(v8::Integer::New(i)); + CefString str; + GetCefString(value->ToString(), str); + keys.push_back(str); + } + return true; +} + +bool CefV8ValueImpl::SetUserData(CefRefPtr user_data) { + CEF_REQUIRE_RT_RETURN(false); + CEF_V8_REQUIRE_OBJECT_RETURN(false); + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + + V8TrackObject* tracker = V8TrackObject::Unwrap(obj); + if (tracker) { + tracker->SetUserData(user_data); + return true; + } + + return false; +} + +CefRefPtr CefV8ValueImpl::GetUserData() { + CEF_REQUIRE_RT_RETURN(NULL); + CEF_V8_REQUIRE_OBJECT_RETURN(NULL); + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + + V8TrackObject* tracker = V8TrackObject::Unwrap(obj); + if (tracker) + return tracker->GetUserData(); + + return NULL; +} + +int CefV8ValueImpl::GetExternallyAllocatedMemory() { + CEF_REQUIRE_RT_RETURN(0); + CEF_V8_REQUIRE_OBJECT_RETURN(0); + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + + V8TrackObject* tracker = V8TrackObject::Unwrap(obj); + if (tracker) + return tracker->GetExternallyAllocatedMemory(); + + return 0; +} + +int CefV8ValueImpl::AdjustExternallyAllocatedMemory(int change_in_bytes) { + CEF_REQUIRE_RT_RETURN(0); + CEF_V8_REQUIRE_OBJECT_RETURN(0); + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + + V8TrackObject* tracker = V8TrackObject::Unwrap(obj); + if (tracker) + return tracker->AdjustExternallyAllocatedMemory(change_in_bytes); + + return 0; +} + +int CefV8ValueImpl::GetArrayLength() { + CEF_REQUIRE_RT_RETURN(0); + CEF_V8_REQUIRE_ARRAY_RETURN(0); + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + v8::Local arr = v8::Local::Cast(obj); + return arr->Length(); +} + +CefString CefV8ValueImpl::GetFunctionName() { + CefString rv; + CEF_REQUIRE_RT_RETURN(rv); + CEF_V8_REQUIRE_FUNCTION_RETURN(rv); + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + v8::Local func = v8::Local::Cast(obj); + GetCefString(v8::Handle::Cast(func->GetName()), rv); + return rv; +} + +CefRefPtr CefV8ValueImpl::GetFunctionHandler() { + CEF_REQUIRE_RT_RETURN(NULL); + CEF_V8_REQUIRE_FUNCTION_RETURN(NULL); + + v8::HandleScope handle_scope; + v8::Local obj = GetHandle()->ToObject(); + + V8TrackObject* tracker = V8TrackObject::Unwrap(obj); + if (tracker) + return tracker->GetHandler(); + + return NULL; +} + +CefRefPtr CefV8ValueImpl::ExecuteFunction( + CefRefPtr object, + const CefV8ValueList& arguments) { + // An empty context value defaults to the current context. + CefRefPtr context; + return ExecuteFunctionWithContext(context, object, arguments); +} + +CefRefPtr CefV8ValueImpl::ExecuteFunctionWithContext( + CefRefPtr context, + CefRefPtr object, + const CefV8ValueList& arguments) { + CEF_REQUIRE_RT_RETURN(NULL); + CEF_V8_REQUIRE_FUNCTION_RETURN(NULL); + + v8::HandleScope handle_scope; + + v8::Local context_local; + if (context.get()) { + CefV8ContextImpl* context_impl = + static_cast(context.get()); + context_local = context_impl->GetContext(); + } else { + context_local = v8::Context::GetCurrent(); + } + + v8::Context::Scope context_scope(context_local); + + v8::Local obj = GetHandle()->ToObject(); + v8::Local func = v8::Local::Cast(obj); + v8::Handle recv; + + // Default to the global object if no object or a non-object was provided. + if (object.get() && object->IsObject()) { + CefV8ValueImpl* recv_impl = static_cast(object.get()); + recv = v8::Handle::Cast(recv_impl->GetHandle()); + } else { + recv = context_local->Global(); + } + + int argc = arguments.size(); + v8::Handle *argv = NULL; + if (argc > 0) { + argv = new v8::Handle[argc]; + for (int i = 0; i < argc; ++i) + argv[i] = static_cast(arguments[i].get())->GetHandle(); + } + + CefRefPtr retval; + + { + v8::TryCatch try_catch; + try_catch.SetVerbose(true); + v8::Local func_rv; + + // Execute the function call using the V8Proxy so that inspector + // instrumentation works. + WebCore::V8Proxy* proxy = WebCore::V8Proxy::retrieve(); + DCHECK(proxy); + if (proxy) + func_rv = proxy->callFunction(func, recv, argc, argv); + + if (!HasCaught(try_catch) && !func_rv.IsEmpty()) + retval = new CefV8ValueImpl(func_rv); + } + + if (argv) + delete [] argv; + + return retval; +} + +bool CefV8ValueImpl::HasCaught(v8::TryCatch& try_catch) { + if (try_catch.HasCaught()) { + last_exception_ = new CefV8ExceptionImpl(try_catch.Message()); + if (rethrow_exceptions_) + try_catch.ReThrow(); + return true; + } else { + if (last_exception_.get()) + last_exception_ = NULL; + return false; + } +} diff --git a/libcef/renderer/v8_impl.h b/libcef/renderer/v8_impl.h new file mode 100644 index 000000000..f1e7b001d --- /dev/null +++ b/libcef/renderer/v8_impl.h @@ -0,0 +1,187 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_RENDERER_V8_IMPL_H_ +#define CEF_LIBCEF_RENDERER_V8_IMPL_H_ +#pragma once + +#include + +#include "include/cef_v8.h" +#include "libcef/renderer/thread_util.h" + +#include "v8/include/v8.h" +#include "base/memory/ref_counted.h" + +class CefTrackNode; + +namespace WebKit { +class WebFrame; +}; + +// Template for V8 Handle types. This class is used to ensure that V8 objects +// are only released on the UI thread. +template +class CefReleaseV8HandleOnUIThread + : public base::RefCountedThreadSafe, + CefDeleteOnRenderThread> { + public: + typedef v8::Handle handleType; + typedef v8::Persistent persistentType; + typedef CefReleaseV8HandleOnUIThread superType; + + explicit CefReleaseV8HandleOnUIThread(handleType v) { + v8_handle_ = persistentType::New(v); + } + virtual ~CefReleaseV8HandleOnUIThread() { + } + + handleType GetHandle() { + return v8_handle_; + } + + persistentType v8_handle_; +}; + +// Special class for a v8::Context to ensure that it is deleted from the UI +// thread. +class CefV8ContextHandle : public CefReleaseV8HandleOnUIThread { + public: + explicit CefV8ContextHandle(handleType context) + : superType(context) { + } + + // Context handles are disposed rather than makeweak. + ~CefV8ContextHandle() { + v8_handle_.Dispose(); + v8_handle_.Clear(); + } +}; + +class CefV8ContextImpl : public CefV8Context { + public: + explicit CefV8ContextImpl(v8::Handle context); + virtual ~CefV8ContextImpl(); + + virtual CefRefPtr GetBrowser() OVERRIDE; + virtual CefRefPtr GetFrame() OVERRIDE; + virtual CefRefPtr GetGlobal() OVERRIDE; + virtual bool Enter() OVERRIDE; + virtual bool Exit() OVERRIDE; + virtual bool IsSame(CefRefPtr that) OVERRIDE; + virtual bool Eval(const CefString& code, + CefRefPtr& retval, + CefRefPtr& exception) OVERRIDE; + + v8::Local GetContext(); + WebKit::WebFrame* GetWebFrame(); + + protected: + scoped_refptr v8_context_; + +#ifndef NDEBUG + // Used in debug builds to catch missing Exits in destructor. + int enter_count_; +#endif + + IMPLEMENT_REFCOUNTING(CefV8ContextImpl); +}; + +// Special class for a v8::Value to ensure that it is deleted from the UI +// thread. +class CefV8ValueHandle: public CefReleaseV8HandleOnUIThread { + public: + CefV8ValueHandle(handleType value, CefTrackNode* tracker) + : superType(value), + tracker_(tracker) { + } + // Destructor implementation is provided in v8_impl.cc. + ~CefV8ValueHandle(); + + CefTrackNode* GetTracker() { + return tracker_; + } + + private: + // For Object and Function types, we need to hold on to a reference to their + // internal data or function handler objects that are reference counted. + CefTrackNode* tracker_; + + DISALLOW_COPY_AND_ASSIGN(CefV8ValueHandle); +}; + +class CefV8ValueImpl : public CefV8Value { + public: + CefV8ValueImpl(v8::Handle value, CefTrackNode* tracker = NULL); + virtual ~CefV8ValueImpl(); + + virtual bool IsUndefined() OVERRIDE; + virtual bool IsNull() OVERRIDE; + virtual bool IsBool() OVERRIDE; + virtual bool IsInt() OVERRIDE; + virtual bool IsUInt() OVERRIDE; + virtual bool IsDouble() OVERRIDE; + virtual bool IsDate() OVERRIDE; + virtual bool IsString() OVERRIDE; + virtual bool IsObject() OVERRIDE; + virtual bool IsArray() OVERRIDE; + virtual bool IsFunction() OVERRIDE; + virtual bool IsSame(CefRefPtr value) OVERRIDE; + virtual bool GetBoolValue() OVERRIDE; + virtual int32 GetIntValue() OVERRIDE; + virtual uint32 GetUIntValue() OVERRIDE; + virtual double GetDoubleValue() OVERRIDE; + virtual CefTime GetDateValue() OVERRIDE; + virtual CefString GetStringValue() OVERRIDE; + virtual bool IsUserCreated() OVERRIDE; + virtual bool HasException() OVERRIDE; + virtual CefRefPtr GetException() OVERRIDE; + virtual bool ClearException() OVERRIDE; + virtual bool WillRethrowExceptions() OVERRIDE; + virtual bool SetRethrowExceptions(bool rethrow) OVERRIDE; + virtual bool HasValue(const CefString& key) OVERRIDE; + virtual bool HasValue(int index) OVERRIDE; + virtual bool DeleteValue(const CefString& key) OVERRIDE; + virtual bool DeleteValue(int index) OVERRIDE; + virtual CefRefPtr GetValue(const CefString& key) OVERRIDE; + virtual CefRefPtr GetValue(int index) OVERRIDE; + virtual bool SetValue(const CefString& key, CefRefPtr value, + PropertyAttribute attribute) OVERRIDE; + virtual bool SetValue(int index, CefRefPtr value) OVERRIDE; + virtual bool SetValue(const CefString& key, AccessControl settings, + PropertyAttribute attribute) OVERRIDE; + virtual bool GetKeys(std::vector& keys) OVERRIDE; + virtual bool SetUserData(CefRefPtr user_data) OVERRIDE; + virtual CefRefPtr GetUserData() OVERRIDE; + virtual int GetExternallyAllocatedMemory() OVERRIDE; + virtual int AdjustExternallyAllocatedMemory(int change_in_bytes) OVERRIDE; + virtual int GetArrayLength() OVERRIDE; + virtual CefString GetFunctionName() OVERRIDE; + virtual CefRefPtr GetFunctionHandler() OVERRIDE; + virtual CefRefPtr ExecuteFunction( + CefRefPtr object, + const CefV8ValueList& arguments) OVERRIDE; + virtual CefRefPtr ExecuteFunctionWithContext( + CefRefPtr context, + CefRefPtr object, + const CefV8ValueList& arguments) OVERRIDE; + + inline v8::Handle GetHandle() { + DCHECK(v8_value_.get()); + return v8_value_->GetHandle(); + } + + protected: + // Test for and record any exception. + bool HasCaught(v8::TryCatch& try_catch); + + scoped_refptr v8_value_; + CefRefPtr last_exception_; + bool rethrow_exceptions_; + + IMPLEMENT_REFCOUNTING(CefV8ValueImpl); + DISALLOW_COPY_AND_ASSIGN(CefV8ValueImpl); +}; + +#endif // CEF_LIBCEF_RENDERER_V8_IMPL_H_ diff --git a/libcef/renderer/webkit_glue.cc b/libcef/renderer/webkit_glue.cc new file mode 100644 index 000000000..36dceb255 --- /dev/null +++ b/libcef/renderer/webkit_glue.cc @@ -0,0 +1,40 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/renderer/webkit_glue.h" + +#include "base/compiler_specific.h" + +#include "third_party/WebKit/Source/WebCore/config.h" +MSVC_PUSH_WARNING_LEVEL(0); +#include "Page.h" +#include "third_party/WebKit/Source/WebKit/chromium/src/WebFrameImpl.h" +#include "third_party/WebKit/Source/WebKit/chromium/src/WebViewImpl.h" +MSVC_POP_WARNING(); +#undef LOG + +namespace webkit_glue { + +bool CanGoBackOrForward(WebKit::WebView* view, int distance) { + if (!view) + return false; + WebKit::WebViewImpl* impl = reinterpret_cast(view); + return impl->page()->canGoBackOrForward(distance); +} + +void GoBackOrForward(WebKit::WebView* view, int distance) { + if (!view) + return; + WebKit::WebViewImpl* impl = reinterpret_cast(view); + impl->page()->goBackOrForward(distance); +} + +v8::Handle GetV8Context(WebKit::WebFrame* frame) { + WebKit::WebFrameImpl* impl = static_cast(frame); + WebCore::Frame* core_frame = impl->frame(); + return WebCore::V8Proxy::context(core_frame); +} + +} // webkit_glue diff --git a/libcef/renderer/webkit_glue.h b/libcef/renderer/webkit_glue.h new file mode 100644 index 000000000..73107f587 --- /dev/null +++ b/libcef/renderer/webkit_glue.h @@ -0,0 +1,27 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_RENDERER_WEBKIT_GLUE_H_ +#define CEF_LIBCEF_RENDERER_WEBKIT_GLUE_H_ + +#include +#include "v8/include/v8.h" + +namespace WebKit { +class WebFrame; +class WebView; +} + +namespace webkit_glue { + +bool CanGoBackOrForward(WebKit::WebView* view, int distance); +void GoBackOrForward(WebKit::WebView* view, int distance); + +// Retrieve the V8 context associated with the frame. +v8::Handle GetV8Context(WebKit::WebFrame* frame); + +} // webkit_glue + +#endif // CEF_LIBCEF_RENDERER_WEBKIT_GLUE_H_ diff --git a/libcef/resources/cef_resources.grd b/libcef/resources/cef_resources.grd new file mode 100644 index 000000000..90c8a4e66 --- /dev/null +++ b/libcef/resources/cef_resources.grd @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/libcef/resources/cef_strings.grd b/libcef/resources/cef_strings.grd new file mode 100644 index 000000000..fc952a2d4 --- /dev/null +++ b/libcef/resources/cef_strings.grd @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &Back + + + &Forward + + + &Reload + + + Reload no cache + + + &Stop + + + &Undo + + + &Redo + + + Cu&t + + + &Copy + + + &Paste + + + &Delete + + + Select &all + + + &Find... + + + &Print... + + + View Source... + + + + diff --git a/libcef/resources/devtools_discovery_page.html b/libcef/resources/devtools_discovery_page.html new file mode 100644 index 000000000..f7abd383e --- /dev/null +++ b/libcef/resources/devtools_discovery_page.html @@ -0,0 +1,54 @@ + + +CEF remote debugging + + + + + +
    Inspectable WebContents
    +
    + + diff --git a/cef/libcef_dll/cef_logging.h b/libcef_dll/cef_logging.h similarity index 100% rename from cef/libcef_dll/cef_logging.h rename to libcef_dll/cef_logging.h diff --git a/libcef_dll/cpptoc/app_cpptoc.cc b/libcef_dll/cpptoc/app_cpptoc.cc new file mode 100644 index 000000000..d699d148b --- /dev/null +++ b/libcef_dll/cpptoc/app_cpptoc.cc @@ -0,0 +1,124 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/app_cpptoc.h" +#include "libcef_dll/cpptoc/browser_process_handler_cpptoc.h" +#include "libcef_dll/cpptoc/render_process_handler_cpptoc.h" +#include "libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h" +#include "libcef_dll/ctocpp/command_line_ctocpp.h" +#include "libcef_dll/ctocpp/scheme_registrar_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK app_on_before_command_line_processing(struct _cef_app_t* self, + const cef_string_t* process_type, + struct _cef_command_line_t* command_line) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: command_line; type: refptr_diff + DCHECK(command_line); + if (!command_line) + return; + // Unverified params: process_type + + // Execute + CefAppCppToC::Get(self)->OnBeforeCommandLineProcessing( + CefString(process_type), + CefCommandLineCToCpp::Wrap(command_line)); +} + +void CEF_CALLBACK app_on_register_custom_schemes(struct _cef_app_t* self, + struct _cef_scheme_registrar_t* registrar) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: registrar; type: refptr_diff + DCHECK(registrar); + if (!registrar) + return; + + // Execute + CefAppCppToC::Get(self)->OnRegisterCustomSchemes( + CefSchemeRegistrarCToCpp::Wrap(registrar)); +} + +struct _cef_resource_bundle_handler_t* CEF_CALLBACK app_get_resource_bundle_handler( + struct _cef_app_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefAppCppToC::Get( + self)->GetResourceBundleHandler(); + + // Return type: refptr_same + return CefResourceBundleHandlerCppToC::Wrap(_retval); +} + +struct _cef_browser_process_handler_t* CEF_CALLBACK app_get_browser_process_handler( + struct _cef_app_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefAppCppToC::Get( + self)->GetBrowserProcessHandler(); + + // Return type: refptr_same + return CefBrowserProcessHandlerCppToC::Wrap(_retval); +} + +struct _cef_render_process_handler_t* CEF_CALLBACK app_get_render_process_handler( + struct _cef_app_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefAppCppToC::Get( + self)->GetRenderProcessHandler(); + + // Return type: refptr_same + return CefRenderProcessHandlerCppToC::Wrap(_retval); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefAppCppToC::CefAppCppToC(CefApp* cls) + : CefCppToC(cls) { + struct_.struct_.on_before_command_line_processing = + app_on_before_command_line_processing; + struct_.struct_.on_register_custom_schemes = app_on_register_custom_schemes; + struct_.struct_.get_resource_bundle_handler = app_get_resource_bundle_handler; + struct_.struct_.get_browser_process_handler = app_get_browser_process_handler; + struct_.struct_.get_render_process_handler = app_get_render_process_handler; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/cef/libcef_dll/cpptoc/app_cpptoc.h b/libcef_dll/cpptoc/app_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/app_cpptoc.h rename to libcef_dll/cpptoc/app_cpptoc.h diff --git a/libcef_dll/cpptoc/auth_callback_cpptoc.cc b/libcef_dll/cpptoc/auth_callback_cpptoc.cc new file mode 100644 index 000000000..f9186a67b --- /dev/null +++ b/libcef_dll/cpptoc/auth_callback_cpptoc.cc @@ -0,0 +1,65 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/auth_callback_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK auth_callback_cont(struct _cef_auth_callback_t* self, + const cef_string_t* username, const cef_string_t* password) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: username; type: string_byref_const + DCHECK(username); + if (!username) + return; + // Verify param: password; type: string_byref_const + DCHECK(password); + if (!password) + return; + + // Execute + CefAuthCallbackCppToC::Get(self)->Continue( + CefString(username), + CefString(password)); +} + +void CEF_CALLBACK auth_callback_cancel(struct _cef_auth_callback_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefAuthCallbackCppToC::Get(self)->Cancel(); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefAuthCallbackCppToC::CefAuthCallbackCppToC(CefAuthCallback* cls) + : CefCppToC( + cls) { + struct_.struct_.cont = auth_callback_cont; + struct_.struct_.cancel = auth_callback_cancel; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/auth_callback_cpptoc.h b/libcef_dll/cpptoc/auth_callback_cpptoc.h new file mode 100644 index 000000000..a8bcded5b --- /dev/null +++ b/libcef_dll/cpptoc/auth_callback_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_AUTH_CALLBACK_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_AUTH_CALLBACK_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_request_handler.h" +#include "include/capi/cef_request_handler_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefAuthCallbackCppToC + : public CefCppToC { + public: + explicit CefAuthCallbackCppToC(CefAuthCallback* cls); + virtual ~CefAuthCallbackCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_AUTH_CALLBACK_CPPTOC_H_ + diff --git a/cef/libcef_dll/cpptoc/base_cpptoc.h b/libcef_dll/cpptoc/base_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/base_cpptoc.h rename to libcef_dll/cpptoc/base_cpptoc.h diff --git a/libcef_dll/cpptoc/before_download_callback_cpptoc.cc b/libcef_dll/cpptoc/before_download_callback_cpptoc.cc new file mode 100644 index 000000000..8d922bfee --- /dev/null +++ b/libcef_dll/cpptoc/before_download_callback_cpptoc.cc @@ -0,0 +1,49 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/before_download_callback_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK before_download_callback_cont( + struct _cef_before_download_callback_t* self, + const cef_string_t* download_path, int show_dialog) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Unverified params: download_path + + // Execute + CefBeforeDownloadCallbackCppToC::Get(self)->Continue( + CefString(download_path), + show_dialog?true:false); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefBeforeDownloadCallbackCppToC::CefBeforeDownloadCallbackCppToC( + CefBeforeDownloadCallback* cls) + : CefCppToC(cls) { + struct_.struct_.cont = before_download_callback_cont; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = + 0; +#endif + diff --git a/libcef_dll/cpptoc/before_download_callback_cpptoc.h b/libcef_dll/cpptoc/before_download_callback_cpptoc.h new file mode 100644 index 000000000..a4bea8390 --- /dev/null +++ b/libcef_dll/cpptoc/before_download_callback_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_BEFORE_DOWNLOAD_CALLBACK_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_BEFORE_DOWNLOAD_CALLBACK_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_download_handler.h" +#include "include/capi/cef_download_handler_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefBeforeDownloadCallbackCppToC + : public CefCppToC { + public: + explicit CefBeforeDownloadCallbackCppToC(CefBeforeDownloadCallback* cls); + virtual ~CefBeforeDownloadCallbackCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_BEFORE_DOWNLOAD_CALLBACK_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/binary_value_cpptoc.cc b/libcef_dll/cpptoc/binary_value_cpptoc.cc new file mode 100644 index 000000000..0929b1614 --- /dev/null +++ b/libcef_dll/cpptoc/binary_value_cpptoc.cc @@ -0,0 +1,134 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/binary_value_cpptoc.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_binary_value_t* cef_binary_value_create(const void* data, + size_t data_size) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: data; type: simple_byaddr + DCHECK(data); + if (!data) + return NULL; + + // Execute + CefRefPtr _retval = CefBinaryValue::Create( + data, + data_size); + + // Return type: refptr_same + return CefBinaryValueCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK binary_value_is_valid(struct _cef_binary_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefBinaryValueCppToC::Get(self)->IsValid(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK binary_value_is_owned(struct _cef_binary_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefBinaryValueCppToC::Get(self)->IsOwned(); + + // Return type: bool + return _retval; +} + +struct _cef_binary_value_t* CEF_CALLBACK binary_value_copy( + struct _cef_binary_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefBinaryValueCppToC::Get(self)->Copy(); + + // Return type: refptr_same + return CefBinaryValueCppToC::Wrap(_retval); +} + +size_t CEF_CALLBACK binary_value_get_size(struct _cef_binary_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + size_t _retval = CefBinaryValueCppToC::Get(self)->GetSize(); + + // Return type: simple + return _retval; +} + +size_t CEF_CALLBACK binary_value_get_data(struct _cef_binary_value_t* self, + void* buffer, size_t buffer_size, size_t data_offset) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: buffer; type: simple_byaddr + DCHECK(buffer); + if (!buffer) + return 0; + + // Execute + size_t _retval = CefBinaryValueCppToC::Get(self)->GetData( + buffer, + buffer_size, + data_offset); + + // Return type: simple + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefBinaryValueCppToC::CefBinaryValueCppToC(CefBinaryValue* cls) + : CefCppToC(cls) { + struct_.struct_.is_valid = binary_value_is_valid; + struct_.struct_.is_owned = binary_value_is_owned; + struct_.struct_.copy = binary_value_copy; + struct_.struct_.get_size = binary_value_get_size; + struct_.struct_.get_data = binary_value_get_data; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/binary_value_cpptoc.h b/libcef_dll/cpptoc/binary_value_cpptoc.h new file mode 100644 index 000000000..bc85f1ccf --- /dev/null +++ b/libcef_dll/cpptoc/binary_value_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_BINARY_VALUE_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_BINARY_VALUE_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_values.h" +#include "include/capi/cef_values_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefBinaryValueCppToC + : public CefCppToC { + public: + explicit CefBinaryValueCppToC(CefBinaryValue* cls); + virtual ~CefBinaryValueCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_BINARY_VALUE_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/browser_cpptoc.cc b/libcef_dll/cpptoc/browser_cpptoc.cc new file mode 100644 index 000000000..6d024f278 --- /dev/null +++ b/libcef_dll/cpptoc/browser_cpptoc.cc @@ -0,0 +1,369 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/browser_host_cpptoc.h" +#include "libcef_dll/cpptoc/frame_cpptoc.h" +#include "libcef_dll/cpptoc/process_message_cpptoc.h" +#include "libcef_dll/transfer_util.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +struct _cef_browser_host_t* CEF_CALLBACK browser_get_host( + struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefBrowserCppToC::Get(self)->GetHost(); + + // Return type: refptr_same + return CefBrowserHostCppToC::Wrap(_retval); +} + +int CEF_CALLBACK browser_can_go_back(struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefBrowserCppToC::Get(self)->CanGoBack(); + + // Return type: bool + return _retval; +} + +void CEF_CALLBACK browser_go_back(struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefBrowserCppToC::Get(self)->GoBack(); +} + +int CEF_CALLBACK browser_can_go_forward(struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefBrowserCppToC::Get(self)->CanGoForward(); + + // Return type: bool + return _retval; +} + +void CEF_CALLBACK browser_go_forward(struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefBrowserCppToC::Get(self)->GoForward(); +} + +int CEF_CALLBACK browser_is_loading(struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefBrowserCppToC::Get(self)->IsLoading(); + + // Return type: bool + return _retval; +} + +void CEF_CALLBACK browser_reload(struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefBrowserCppToC::Get(self)->Reload(); +} + +void CEF_CALLBACK browser_reload_ignore_cache(struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefBrowserCppToC::Get(self)->ReloadIgnoreCache(); +} + +void CEF_CALLBACK browser_stop_load(struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefBrowserCppToC::Get(self)->StopLoad(); +} + +int CEF_CALLBACK browser_get_identifier(struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefBrowserCppToC::Get(self)->GetIdentifier(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK browser_is_popup(struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefBrowserCppToC::Get(self)->IsPopup(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK browser_has_document(struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefBrowserCppToC::Get(self)->HasDocument(); + + // Return type: bool + return _retval; +} + +struct _cef_frame_t* CEF_CALLBACK browser_get_main_frame( + struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefBrowserCppToC::Get(self)->GetMainFrame(); + + // Return type: refptr_same + return CefFrameCppToC::Wrap(_retval); +} + +struct _cef_frame_t* CEF_CALLBACK browser_get_focused_frame( + struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefBrowserCppToC::Get(self)->GetFocusedFrame(); + + // Return type: refptr_same + return CefFrameCppToC::Wrap(_retval); +} + +struct _cef_frame_t* CEF_CALLBACK browser_get_frame_byident( + struct _cef_browser_t* self, int64 identifier) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefBrowserCppToC::Get(self)->GetFrame( + identifier); + + // Return type: refptr_same + return CefFrameCppToC::Wrap(_retval); +} + +struct _cef_frame_t* CEF_CALLBACK browser_get_frame(struct _cef_browser_t* self, + const cef_string_t* name) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: name; type: string_byref_const + DCHECK(name); + if (!name) + return NULL; + + // Execute + CefRefPtr _retval = CefBrowserCppToC::Get(self)->GetFrame( + CefString(name)); + + // Return type: refptr_same + return CefFrameCppToC::Wrap(_retval); +} + +size_t CEF_CALLBACK browser_get_frame_count(struct _cef_browser_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + size_t _retval = CefBrowserCppToC::Get(self)->GetFrameCount(); + + // Return type: simple + return _retval; +} + +void CEF_CALLBACK browser_get_frame_identifiers(struct _cef_browser_t* self, + size_t* identifiersCount, int64* identifiers) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: identifiers; type: simple_vec_byref + DCHECK(identifiersCount && (*identifiersCount == 0 || identifiers)); + if (!identifiersCount || (*identifiersCount > 0 && !identifiers)) + return; + + // Translate param: identifiers; type: simple_vec_byref + std::vector identifiersList; + if (identifiersCount && *identifiersCount > 0 && identifiers) { + for (size_t i = 0; i < *identifiersCount; ++i) { + identifiersList.push_back(identifiers[i]); + } + } + + // Execute + CefBrowserCppToC::Get(self)->GetFrameIdentifiers( + identifiersList); + + // Restore param: identifiers; type: simple_vec_byref + if (identifiersCount && identifiers) { + *identifiersCount = std::min(identifiersList.size(), *identifiersCount); + if (*identifiersCount > 0) { + for (size_t i = 0; i < *identifiersCount; ++i) { + identifiers[i] = identifiersList[i]; + } + } + } +} + +void CEF_CALLBACK browser_get_frame_names(struct _cef_browser_t* self, + cef_string_list_t names) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: names; type: string_vec_byref + DCHECK(names); + if (!names) + return; + + // Translate param: names; type: string_vec_byref + std::vector namesList; + transfer_string_list_contents(names, namesList); + + // Execute + CefBrowserCppToC::Get(self)->GetFrameNames( + namesList); + + // Restore param: names; type: string_vec_byref + cef_string_list_clear(names); + transfer_string_list_contents(namesList, names); +} + +int CEF_CALLBACK browser_send_process_message(struct _cef_browser_t* self, + enum cef_process_id_t target_process, + struct _cef_process_message_t* message) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: message; type: refptr_same + DCHECK(message); + if (!message) + return 0; + + // Execute + bool _retval = CefBrowserCppToC::Get(self)->SendProcessMessage( + target_process, + CefProcessMessageCppToC::Unwrap(message)); + + // Return type: bool + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefBrowserCppToC::CefBrowserCppToC(CefBrowser* cls) + : CefCppToC(cls) { + struct_.struct_.get_host = browser_get_host; + struct_.struct_.can_go_back = browser_can_go_back; + struct_.struct_.go_back = browser_go_back; + struct_.struct_.can_go_forward = browser_can_go_forward; + struct_.struct_.go_forward = browser_go_forward; + struct_.struct_.is_loading = browser_is_loading; + struct_.struct_.reload = browser_reload; + struct_.struct_.reload_ignore_cache = browser_reload_ignore_cache; + struct_.struct_.stop_load = browser_stop_load; + struct_.struct_.get_identifier = browser_get_identifier; + struct_.struct_.is_popup = browser_is_popup; + struct_.struct_.has_document = browser_has_document; + struct_.struct_.get_main_frame = browser_get_main_frame; + struct_.struct_.get_focused_frame = browser_get_focused_frame; + struct_.struct_.get_frame_byident = browser_get_frame_byident; + struct_.struct_.get_frame = browser_get_frame; + struct_.struct_.get_frame_count = browser_get_frame_count; + struct_.struct_.get_frame_identifiers = browser_get_frame_identifiers; + struct_.struct_.get_frame_names = browser_get_frame_names; + struct_.struct_.send_process_message = browser_send_process_message; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/browser_cpptoc.h b/libcef_dll/cpptoc/browser_cpptoc.h new file mode 100644 index 000000000..eb8994163 --- /dev/null +++ b/libcef_dll/cpptoc/browser_cpptoc.h @@ -0,0 +1,38 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_BROWSER_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_BROWSER_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_browser.h" +#include "include/capi/cef_browser_capi.h" +#include "include/cef_client.h" +#include "include/capi/cef_client_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefBrowserCppToC + : public CefCppToC { + public: + explicit CefBrowserCppToC(CefBrowser* cls); + virtual ~CefBrowserCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_BROWSER_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/browser_host_cpptoc.cc b/libcef_dll/cpptoc/browser_host_cpptoc.cc new file mode 100644 index 000000000..7110b3f49 --- /dev/null +++ b/libcef_dll/cpptoc/browser_host_cpptoc.cc @@ -0,0 +1,266 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/browser_host_cpptoc.h" +#include "libcef_dll/ctocpp/client_ctocpp.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT int cef_browser_host_create_browser( + const cef_window_info_t* windowInfo, struct _cef_client_t* client, + const cef_string_t* url, const struct _cef_browser_settings_t* settings) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: windowInfo; type: struct_byref_const + DCHECK(windowInfo); + if (!windowInfo) + return 0; + // Verify param: client; type: refptr_diff + DCHECK(client); + if (!client) + return 0; + // Verify param: settings; type: struct_byref_const + DCHECK(settings); + if (!settings) + return 0; + // Unverified params: url + + // Translate param: windowInfo; type: struct_byref_const + CefWindowInfo windowInfoObj; + if (windowInfo) + windowInfoObj.Set(*windowInfo, false); + // Translate param: settings; type: struct_byref_const + CefBrowserSettings settingsObj; + if (settings) + settingsObj.Set(*settings, false); + + // Execute + bool _retval = CefBrowserHost::CreateBrowser( + windowInfoObj, + CefClientCToCpp::Wrap(client), + CefString(url), + settingsObj); + + // Return type: bool + return _retval; +} + +CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync( + const cef_window_info_t* windowInfo, struct _cef_client_t* client, + const cef_string_t* url, const struct _cef_browser_settings_t* settings) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: windowInfo; type: struct_byref_const + DCHECK(windowInfo); + if (!windowInfo) + return NULL; + // Verify param: client; type: refptr_diff + DCHECK(client); + if (!client) + return NULL; + // Verify param: settings; type: struct_byref_const + DCHECK(settings); + if (!settings) + return NULL; + // Unverified params: url + + // Translate param: windowInfo; type: struct_byref_const + CefWindowInfo windowInfoObj; + if (windowInfo) + windowInfoObj.Set(*windowInfo, false); + // Translate param: settings; type: struct_byref_const + CefBrowserSettings settingsObj; + if (settings) + settingsObj.Set(*settings, false); + + // Execute + CefRefPtr _retval = CefBrowserHost::CreateBrowserSync( + windowInfoObj, + CefClientCToCpp::Wrap(client), + CefString(url), + settingsObj); + + // Return type: refptr_same + return CefBrowserCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +cef_browser_t* CEF_CALLBACK browser_host_get_browser( + struct _cef_browser_host_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefBrowserHostCppToC::Get(self)->GetBrowser(); + + // Return type: refptr_same + return CefBrowserCppToC::Wrap(_retval); +} + +void CEF_CALLBACK browser_host_parent_window_will_close( + struct _cef_browser_host_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefBrowserHostCppToC::Get(self)->ParentWindowWillClose(); +} + +void CEF_CALLBACK browser_host_close_browser(struct _cef_browser_host_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefBrowserHostCppToC::Get(self)->CloseBrowser(); +} + +void CEF_CALLBACK browser_host_set_focus(struct _cef_browser_host_t* self, + int enable) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefBrowserHostCppToC::Get(self)->SetFocus( + enable?true:false); +} + +cef_window_handle_t CEF_CALLBACK browser_host_get_window_handle( + struct _cef_browser_host_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + cef_window_handle_t _retval = CefBrowserHostCppToC::Get( + self)->GetWindowHandle(); + + // Return type: simple + return _retval; +} + +cef_window_handle_t CEF_CALLBACK browser_host_get_opener_window_handle( + struct _cef_browser_host_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + cef_window_handle_t _retval = CefBrowserHostCppToC::Get( + self)->GetOpenerWindowHandle(); + + // Return type: simple + return _retval; +} + +struct _cef_client_t* CEF_CALLBACK browser_host_get_client( + struct _cef_browser_host_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefBrowserHostCppToC::Get(self)->GetClient(); + + // Return type: refptr_diff + return CefClientCToCpp::Unwrap(_retval); +} + +cef_string_userfree_t CEF_CALLBACK browser_host_get_dev_tools_url( + struct _cef_browser_host_t* self, int http_scheme) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefBrowserHostCppToC::Get(self)->GetDevToolsURL( + http_scheme?true:false); + + // Return type: string + return _retval.DetachToUserFree(); +} + +double CEF_CALLBACK browser_host_get_zoom_level( + struct _cef_browser_host_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + double _retval = CefBrowserHostCppToC::Get(self)->GetZoomLevel(); + + // Return type: simple + return _retval; +} + +void CEF_CALLBACK browser_host_set_zoom_level(struct _cef_browser_host_t* self, + double zoomLevel) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefBrowserHostCppToC::Get(self)->SetZoomLevel( + zoomLevel); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefBrowserHostCppToC::CefBrowserHostCppToC(CefBrowserHost* cls) + : CefCppToC(cls) { + struct_.struct_.get_browser = browser_host_get_browser; + struct_.struct_.parent_window_will_close = + browser_host_parent_window_will_close; + struct_.struct_.close_browser = browser_host_close_browser; + struct_.struct_.set_focus = browser_host_set_focus; + struct_.struct_.get_window_handle = browser_host_get_window_handle; + struct_.struct_.get_opener_window_handle = + browser_host_get_opener_window_handle; + struct_.struct_.get_client = browser_host_get_client; + struct_.struct_.get_dev_tools_url = browser_host_get_dev_tools_url; + struct_.struct_.get_zoom_level = browser_host_get_zoom_level; + struct_.struct_.set_zoom_level = browser_host_set_zoom_level; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/browser_host_cpptoc.h b/libcef_dll/cpptoc/browser_host_cpptoc.h new file mode 100644 index 000000000..e81a489bf --- /dev/null +++ b/libcef_dll/cpptoc/browser_host_cpptoc.h @@ -0,0 +1,39 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_BROWSER_HOST_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_BROWSER_HOST_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_browser.h" +#include "include/capi/cef_browser_capi.h" +#include "include/cef_client.h" +#include "include/capi/cef_client_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefBrowserHostCppToC + : public CefCppToC { + public: + explicit CefBrowserHostCppToC(CefBrowserHost* cls); + virtual ~CefBrowserHostCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_BROWSER_HOST_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/browser_process_handler_cpptoc.cc b/libcef_dll/cpptoc/browser_process_handler_cpptoc.cc new file mode 100644 index 000000000..fbfdfcd4a --- /dev/null +++ b/libcef_dll/cpptoc/browser_process_handler_cpptoc.cc @@ -0,0 +1,63 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_process_handler_cpptoc.h" +#include "libcef_dll/cpptoc/proxy_handler_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +struct _cef_proxy_handler_t* CEF_CALLBACK browser_process_handler_get_proxy_handler( + struct _cef_browser_process_handler_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefBrowserProcessHandlerCppToC::Get( + self)->GetProxyHandler(); + + // Return type: refptr_same + return CefProxyHandlerCppToC::Wrap(_retval); +} + +void CEF_CALLBACK browser_process_handler_on_context_initialized( + struct _cef_browser_process_handler_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefBrowserProcessHandlerCppToC::Get(self)->OnContextInitialized(); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefBrowserProcessHandlerCppToC::CefBrowserProcessHandlerCppToC( + CefBrowserProcessHandler* cls) + : CefCppToC(cls) { + struct_.struct_.get_proxy_handler = browser_process_handler_get_proxy_handler; + struct_.struct_.on_context_initialized = + browser_process_handler_on_context_initialized; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/browser_process_handler_cpptoc.h b/libcef_dll/cpptoc/browser_process_handler_cpptoc.h new file mode 100644 index 000000000..e9047dd07 --- /dev/null +++ b/libcef_dll/cpptoc/browser_process_handler_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_BROWSER_PROCESS_HANDLER_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_BROWSER_PROCESS_HANDLER_CPPTOC_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_browser_process_handler.h" +#include "include/capi/cef_browser_process_handler_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed wrapper-side only. +class CefBrowserProcessHandlerCppToC + : public CefCppToC { + public: + explicit CefBrowserProcessHandlerCppToC(CefBrowserProcessHandler* cls); + virtual ~CefBrowserProcessHandlerCppToC() {} +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_BROWSER_PROCESS_HANDLER_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/callback_cpptoc.cc b/libcef_dll/cpptoc/callback_cpptoc.cc new file mode 100644 index 000000000..e7200c976 --- /dev/null +++ b/libcef_dll/cpptoc/callback_cpptoc.cc @@ -0,0 +1,53 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/callback_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK callback_cont(struct _cef_callback_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefCallbackCppToC::Get(self)->Continue(); +} + +void CEF_CALLBACK callback_cancel(struct _cef_callback_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefCallbackCppToC::Get(self)->Cancel(); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefCallbackCppToC::CefCallbackCppToC(CefCallback* cls) + : CefCppToC(cls) { + struct_.struct_.cont = callback_cont; + struct_.struct_.cancel = callback_cancel; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/callback_cpptoc.h b/libcef_dll/cpptoc/callback_cpptoc.h new file mode 100644 index 000000000..7bfd70a29 --- /dev/null +++ b/libcef_dll/cpptoc/callback_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_CALLBACK_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_CALLBACK_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_callback.h" +#include "include/capi/cef_callback_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefCallbackCppToC + : public CefCppToC { + public: + explicit CefCallbackCppToC(CefCallback* cls); + virtual ~CefCallbackCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_CALLBACK_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/client_cpptoc.cc b/libcef_dll/cpptoc/client_cpptoc.cc new file mode 100644 index 000000000..14a894155 --- /dev/null +++ b/libcef_dll/cpptoc/client_cpptoc.cc @@ -0,0 +1,240 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/client_cpptoc.h" +#include "libcef_dll/cpptoc/context_menu_handler_cpptoc.h" +#include "libcef_dll/cpptoc/display_handler_cpptoc.h" +#include "libcef_dll/cpptoc/download_handler_cpptoc.h" +#include "libcef_dll/cpptoc/focus_handler_cpptoc.h" +#include "libcef_dll/cpptoc/geolocation_handler_cpptoc.h" +#include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h" +#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h" +#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h" +#include "libcef_dll/cpptoc/load_handler_cpptoc.h" +#include "libcef_dll/cpptoc/request_handler_cpptoc.h" +#include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/process_message_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +struct _cef_context_menu_handler_t* CEF_CALLBACK client_get_context_menu_handler( + struct _cef_client_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefClientCppToC::Get( + self)->GetContextMenuHandler(); + + // Return type: refptr_same + return CefContextMenuHandlerCppToC::Wrap(_retval); +} + +struct _cef_display_handler_t* CEF_CALLBACK client_get_display_handler( + struct _cef_client_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefClientCppToC::Get( + self)->GetDisplayHandler(); + + // Return type: refptr_same + return CefDisplayHandlerCppToC::Wrap(_retval); +} + +struct _cef_download_handler_t* CEF_CALLBACK client_get_download_handler( + struct _cef_client_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefClientCppToC::Get( + self)->GetDownloadHandler(); + + // Return type: refptr_same + return CefDownloadHandlerCppToC::Wrap(_retval); +} + +struct _cef_focus_handler_t* CEF_CALLBACK client_get_focus_handler( + struct _cef_client_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefClientCppToC::Get( + self)->GetFocusHandler(); + + // Return type: refptr_same + return CefFocusHandlerCppToC::Wrap(_retval); +} + +struct _cef_geolocation_handler_t* CEF_CALLBACK client_get_geolocation_handler( + struct _cef_client_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefClientCppToC::Get( + self)->GetGeolocationHandler(); + + // Return type: refptr_same + return CefGeolocationHandlerCppToC::Wrap(_retval); +} + +struct _cef_jsdialog_handler_t* CEF_CALLBACK client_get_jsdialog_handler( + struct _cef_client_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefClientCppToC::Get( + self)->GetJSDialogHandler(); + + // Return type: refptr_same + return CefJSDialogHandlerCppToC::Wrap(_retval); +} + +struct _cef_keyboard_handler_t* CEF_CALLBACK client_get_keyboard_handler( + struct _cef_client_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefClientCppToC::Get( + self)->GetKeyboardHandler(); + + // Return type: refptr_same + return CefKeyboardHandlerCppToC::Wrap(_retval); +} + +struct _cef_life_span_handler_t* CEF_CALLBACK client_get_life_span_handler( + struct _cef_client_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefClientCppToC::Get( + self)->GetLifeSpanHandler(); + + // Return type: refptr_same + return CefLifeSpanHandlerCppToC::Wrap(_retval); +} + +struct _cef_load_handler_t* CEF_CALLBACK client_get_load_handler( + struct _cef_client_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefClientCppToC::Get( + self)->GetLoadHandler(); + + // Return type: refptr_same + return CefLoadHandlerCppToC::Wrap(_retval); +} + +struct _cef_request_handler_t* CEF_CALLBACK client_get_request_handler( + struct _cef_client_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefClientCppToC::Get( + self)->GetRequestHandler(); + + // Return type: refptr_same + return CefRequestHandlerCppToC::Wrap(_retval); +} + +int CEF_CALLBACK client_on_process_message_received(struct _cef_client_t* self, + cef_browser_t* browser, enum cef_process_id_t source_process, + struct _cef_process_message_t* message) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return 0; + // Verify param: message; type: refptr_diff + DCHECK(message); + if (!message) + return 0; + + // Execute + bool _retval = CefClientCppToC::Get(self)->OnProcessMessageReceived( + CefBrowserCToCpp::Wrap(browser), + source_process, + CefProcessMessageCToCpp::Wrap(message)); + + // Return type: bool + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefClientCppToC::CefClientCppToC(CefClient* cls) + : CefCppToC(cls) { + struct_.struct_.get_context_menu_handler = client_get_context_menu_handler; + struct_.struct_.get_display_handler = client_get_display_handler; + struct_.struct_.get_download_handler = client_get_download_handler; + struct_.struct_.get_focus_handler = client_get_focus_handler; + struct_.struct_.get_geolocation_handler = client_get_geolocation_handler; + struct_.struct_.get_jsdialog_handler = client_get_jsdialog_handler; + struct_.struct_.get_keyboard_handler = client_get_keyboard_handler; + struct_.struct_.get_life_span_handler = client_get_life_span_handler; + struct_.struct_.get_load_handler = client_get_load_handler; + struct_.struct_.get_request_handler = client_get_request_handler; + struct_.struct_.on_process_message_received = + client_on_process_message_received; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/cef/libcef_dll/cpptoc/client_cpptoc.h b/libcef_dll/cpptoc/client_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/client_cpptoc.h rename to libcef_dll/cpptoc/client_cpptoc.h diff --git a/libcef_dll/cpptoc/command_line_cpptoc.cc b/libcef_dll/cpptoc/command_line_cpptoc.cc new file mode 100644 index 000000000..26a0e6bba --- /dev/null +++ b/libcef_dll/cpptoc/command_line_cpptoc.cc @@ -0,0 +1,384 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/command_line_cpptoc.h" +#include "libcef_dll/transfer_util.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_command_line_t* cef_command_line_create() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefCommandLine::CreateCommandLine(); + + // Return type: refptr_same + return CefCommandLineCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_command_line_t* cef_command_line_get_global() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefCommandLine::GetGlobalCommandLine(); + + // Return type: refptr_same + return CefCommandLineCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK command_line_is_valid(struct _cef_command_line_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefCommandLineCppToC::Get(self)->IsValid(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK command_line_is_read_only(struct _cef_command_line_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefCommandLineCppToC::Get(self)->IsReadOnly(); + + // Return type: bool + return _retval; +} + +struct _cef_command_line_t* CEF_CALLBACK command_line_copy( + struct _cef_command_line_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefCommandLineCppToC::Get(self)->Copy(); + + // Return type: refptr_same + return CefCommandLineCppToC::Wrap(_retval); +} + +void CEF_CALLBACK command_line_init_from_argv(struct _cef_command_line_t* self, + int argc, const char* const* argv) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: argv; type: simple_byaddr + DCHECK(argv); + if (!argv) + return; + + // Execute + CefCommandLineCppToC::Get(self)->InitFromArgv( + argc, + argv); +} + +void CEF_CALLBACK command_line_init_from_string( + struct _cef_command_line_t* self, const cef_string_t* command_line) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: command_line; type: string_byref_const + DCHECK(command_line); + if (!command_line) + return; + + // Execute + CefCommandLineCppToC::Get(self)->InitFromString( + CefString(command_line)); +} + +void CEF_CALLBACK command_line_reset(struct _cef_command_line_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefCommandLineCppToC::Get(self)->Reset(); +} + +cef_string_userfree_t CEF_CALLBACK command_line_get_command_line_string( + struct _cef_command_line_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefCommandLineCppToC::Get(self)->GetCommandLineString(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK command_line_get_program( + struct _cef_command_line_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefCommandLineCppToC::Get(self)->GetProgram(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +void CEF_CALLBACK command_line_set_program(struct _cef_command_line_t* self, + const cef_string_t* program) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: program; type: string_byref_const + DCHECK(program); + if (!program) + return; + + // Execute + CefCommandLineCppToC::Get(self)->SetProgram( + CefString(program)); +} + +int CEF_CALLBACK command_line_has_switches(struct _cef_command_line_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefCommandLineCppToC::Get(self)->HasSwitches(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK command_line_has_switch(struct _cef_command_line_t* self, + const cef_string_t* name) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: name; type: string_byref_const + DCHECK(name); + if (!name) + return 0; + + // Execute + bool _retval = CefCommandLineCppToC::Get(self)->HasSwitch( + CefString(name)); + + // Return type: bool + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK command_line_get_switch_value( + struct _cef_command_line_t* self, const cef_string_t* name) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: name; type: string_byref_const + DCHECK(name); + if (!name) + return NULL; + + // Execute + CefString _retval = CefCommandLineCppToC::Get(self)->GetSwitchValue( + CefString(name)); + + // Return type: string + return _retval.DetachToUserFree(); +} + +void CEF_CALLBACK command_line_get_switches(struct _cef_command_line_t* self, + cef_string_map_t switches) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: switches; type: string_map_single_byref + DCHECK(switches); + if (!switches) + return; + + // Translate param: switches; type: string_map_single_byref + std::map switchesMap; + transfer_string_map_contents(switches, switchesMap); + + // Execute + CefCommandLineCppToC::Get(self)->GetSwitches( + switchesMap); + + // Restore param: switches; type: string_map_single_byref + cef_string_map_clear(switches); + transfer_string_map_contents(switchesMap, switches); +} + +void CEF_CALLBACK command_line_append_switch(struct _cef_command_line_t* self, + const cef_string_t* name) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: name; type: string_byref_const + DCHECK(name); + if (!name) + return; + + // Execute + CefCommandLineCppToC::Get(self)->AppendSwitch( + CefString(name)); +} + +void CEF_CALLBACK command_line_append_switch_with_value( + struct _cef_command_line_t* self, const cef_string_t* name, + const cef_string_t* value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: name; type: string_byref_const + DCHECK(name); + if (!name) + return; + // Verify param: value; type: string_byref_const + DCHECK(value); + if (!value) + return; + + // Execute + CefCommandLineCppToC::Get(self)->AppendSwitchWithValue( + CefString(name), + CefString(value)); +} + +int CEF_CALLBACK command_line_has_arguments(struct _cef_command_line_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefCommandLineCppToC::Get(self)->HasArguments(); + + // Return type: bool + return _retval; +} + +void CEF_CALLBACK command_line_get_arguments(struct _cef_command_line_t* self, + cef_string_list_t arguments) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: arguments; type: string_vec_byref + DCHECK(arguments); + if (!arguments) + return; + + // Translate param: arguments; type: string_vec_byref + std::vector argumentsList; + transfer_string_list_contents(arguments, argumentsList); + + // Execute + CefCommandLineCppToC::Get(self)->GetArguments( + argumentsList); + + // Restore param: arguments; type: string_vec_byref + cef_string_list_clear(arguments); + transfer_string_list_contents(argumentsList, arguments); +} + +void CEF_CALLBACK command_line_append_argument(struct _cef_command_line_t* self, + const cef_string_t* argument) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: argument; type: string_byref_const + DCHECK(argument); + if (!argument) + return; + + // Execute + CefCommandLineCppToC::Get(self)->AppendArgument( + CefString(argument)); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefCommandLineCppToC::CefCommandLineCppToC(CefCommandLine* cls) + : CefCppToC(cls) { + struct_.struct_.is_valid = command_line_is_valid; + struct_.struct_.is_read_only = command_line_is_read_only; + struct_.struct_.copy = command_line_copy; + struct_.struct_.init_from_argv = command_line_init_from_argv; + struct_.struct_.init_from_string = command_line_init_from_string; + struct_.struct_.reset = command_line_reset; + struct_.struct_.get_command_line_string = + command_line_get_command_line_string; + struct_.struct_.get_program = command_line_get_program; + struct_.struct_.set_program = command_line_set_program; + struct_.struct_.has_switches = command_line_has_switches; + struct_.struct_.has_switch = command_line_has_switch; + struct_.struct_.get_switch_value = command_line_get_switch_value; + struct_.struct_.get_switches = command_line_get_switches; + struct_.struct_.append_switch = command_line_append_switch; + struct_.struct_.append_switch_with_value = + command_line_append_switch_with_value; + struct_.struct_.has_arguments = command_line_has_arguments; + struct_.struct_.get_arguments = command_line_get_arguments; + struct_.struct_.append_argument = command_line_append_argument; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/command_line_cpptoc.h b/libcef_dll/cpptoc/command_line_cpptoc.h new file mode 100644 index 000000000..1d98acd79 --- /dev/null +++ b/libcef_dll/cpptoc/command_line_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_COMMAND_LINE_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_COMMAND_LINE_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_command_line.h" +#include "include/capi/cef_command_line_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefCommandLineCppToC + : public CefCppToC { + public: + explicit CefCommandLineCppToC(CefCommandLine* cls); + virtual ~CefCommandLineCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_COMMAND_LINE_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/context_menu_handler_cpptoc.cc b/libcef_dll/cpptoc/context_menu_handler_cpptoc.cc new file mode 100644 index 000000000..a09c3bc39 --- /dev/null +++ b/libcef_dll/cpptoc/context_menu_handler_cpptoc.cc @@ -0,0 +1,132 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/context_menu_handler_cpptoc.h" +#include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/context_menu_params_ctocpp.h" +#include "libcef_dll/ctocpp/frame_ctocpp.h" +#include "libcef_dll/ctocpp/menu_model_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK context_menu_handler_on_before_context_menu( + struct _cef_context_menu_handler_t* self, cef_browser_t* browser, + struct _cef_frame_t* frame, struct _cef_context_menu_params_t* params, + struct _cef_menu_model_t* model) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame); + if (!frame) + return; + // Verify param: params; type: refptr_diff + DCHECK(params); + if (!params) + return; + // Verify param: model; type: refptr_diff + DCHECK(model); + if (!model) + return; + + // Execute + CefContextMenuHandlerCppToC::Get(self)->OnBeforeContextMenu( + CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame), + CefContextMenuParamsCToCpp::Wrap(params), + CefMenuModelCToCpp::Wrap(model)); +} + +int CEF_CALLBACK context_menu_handler_on_context_menu_command( + struct _cef_context_menu_handler_t* self, cef_browser_t* browser, + struct _cef_frame_t* frame, struct _cef_context_menu_params_t* params, + int command_id, enum cef_event_flags_t event_flags) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return 0; + // Verify param: frame; type: refptr_diff + DCHECK(frame); + if (!frame) + return 0; + // Verify param: params; type: refptr_diff + DCHECK(params); + if (!params) + return 0; + + // Execute + bool _retval = CefContextMenuHandlerCppToC::Get(self)->OnContextMenuCommand( + CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame), + CefContextMenuParamsCToCpp::Wrap(params), + command_id, + event_flags); + + // Return type: bool + return _retval; +} + +void CEF_CALLBACK context_menu_handler_on_context_menu_dismissed( + struct _cef_context_menu_handler_t* self, cef_browser_t* browser, + struct _cef_frame_t* frame) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame); + if (!frame) + return; + + // Execute + CefContextMenuHandlerCppToC::Get(self)->OnContextMenuDismissed( + CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame)); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefContextMenuHandlerCppToC::CefContextMenuHandlerCppToC( + CefContextMenuHandler* cls) + : CefCppToC(cls) { + struct_.struct_.on_before_context_menu = + context_menu_handler_on_before_context_menu; + struct_.struct_.on_context_menu_command = + context_menu_handler_on_context_menu_command; + struct_.struct_.on_context_menu_dismissed = + context_menu_handler_on_context_menu_dismissed; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/context_menu_handler_cpptoc.h b/libcef_dll/cpptoc/context_menu_handler_cpptoc.h new file mode 100644 index 000000000..eba5d929c --- /dev/null +++ b/libcef_dll/cpptoc/context_menu_handler_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_CONTEXT_MENU_HANDLER_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_CONTEXT_MENU_HANDLER_CPPTOC_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_context_menu_handler.h" +#include "include/capi/cef_context_menu_handler_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed wrapper-side only. +class CefContextMenuHandlerCppToC + : public CefCppToC { + public: + explicit CefContextMenuHandlerCppToC(CefContextMenuHandler* cls); + virtual ~CefContextMenuHandlerCppToC() {} +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_CONTEXT_MENU_HANDLER_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/context_menu_params_cpptoc.cc b/libcef_dll/cpptoc/context_menu_params_cpptoc.cc new file mode 100644 index 000000000..f9c7c8d77 --- /dev/null +++ b/libcef_dll/cpptoc/context_menu_params_cpptoc.cc @@ -0,0 +1,296 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/context_menu_params_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK context_menu_params_get_xcoord( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefContextMenuParamsCppToC::Get(self)->GetXCoord(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK context_menu_params_get_ycoord( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefContextMenuParamsCppToC::Get(self)->GetYCoord(); + + // Return type: simple + return _retval; +} + +enum cef_context_menu_type_flags_t CEF_CALLBACK context_menu_params_get_type_flags( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return CM_TYPEFLAG_NONE; + + // Execute + cef_context_menu_type_flags_t _retval = CefContextMenuParamsCppToC::Get( + self)->GetTypeFlags(); + + // Return type: simple + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK context_menu_params_get_link_url( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefContextMenuParamsCppToC::Get(self)->GetLinkUrl(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK context_menu_params_get_unfiltered_link_url( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefContextMenuParamsCppToC::Get( + self)->GetUnfilteredLinkUrl(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK context_menu_params_get_source_url( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefContextMenuParamsCppToC::Get(self)->GetSourceUrl(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int CEF_CALLBACK context_menu_params_is_image_blocked( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefContextMenuParamsCppToC::Get(self)->IsImageBlocked(); + + // Return type: bool + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK context_menu_params_get_page_url( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefContextMenuParamsCppToC::Get(self)->GetPageUrl(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK context_menu_params_get_frame_url( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefContextMenuParamsCppToC::Get(self)->GetFrameUrl(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK context_menu_params_get_frame_charset( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefContextMenuParamsCppToC::Get(self)->GetFrameCharset(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +enum cef_context_menu_media_type_t CEF_CALLBACK context_menu_params_get_media_type( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return CM_MEDIATYPE_NONE; + + // Execute + cef_context_menu_media_type_t _retval = CefContextMenuParamsCppToC::Get( + self)->GetMediaType(); + + // Return type: simple + return _retval; +} + +enum cef_context_menu_media_state_flags_t CEF_CALLBACK context_menu_params_get_media_state_flags( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return CM_MEDIAFLAG_NONE; + + // Execute + cef_context_menu_media_state_flags_t _retval = + CefContextMenuParamsCppToC::Get(self)->GetMediaStateFlags(); + + // Return type: simple + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK context_menu_params_get_selection_text( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefContextMenuParamsCppToC::Get(self)->GetSelectionText(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int CEF_CALLBACK context_menu_params_is_editable( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefContextMenuParamsCppToC::Get(self)->IsEditable(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK context_menu_params_is_speech_input_enabled( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefContextMenuParamsCppToC::Get(self)->IsSpeechInputEnabled(); + + // Return type: bool + return _retval; +} + +enum cef_context_menu_edit_state_flags_t CEF_CALLBACK context_menu_params_get_edit_state_flags( + struct _cef_context_menu_params_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return CM_EDITFLAG_NONE; + + // Execute + cef_context_menu_edit_state_flags_t _retval = CefContextMenuParamsCppToC::Get( + self)->GetEditStateFlags(); + + // Return type: simple + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefContextMenuParamsCppToC::CefContextMenuParamsCppToC( + CefContextMenuParams* cls) + : CefCppToC(cls) { + struct_.struct_.get_xcoord = context_menu_params_get_xcoord; + struct_.struct_.get_ycoord = context_menu_params_get_ycoord; + struct_.struct_.get_type_flags = context_menu_params_get_type_flags; + struct_.struct_.get_link_url = context_menu_params_get_link_url; + struct_.struct_.get_unfiltered_link_url = + context_menu_params_get_unfiltered_link_url; + struct_.struct_.get_source_url = context_menu_params_get_source_url; + struct_.struct_.is_image_blocked = context_menu_params_is_image_blocked; + struct_.struct_.get_page_url = context_menu_params_get_page_url; + struct_.struct_.get_frame_url = context_menu_params_get_frame_url; + struct_.struct_.get_frame_charset = context_menu_params_get_frame_charset; + struct_.struct_.get_media_type = context_menu_params_get_media_type; + struct_.struct_.get_media_state_flags = + context_menu_params_get_media_state_flags; + struct_.struct_.get_selection_text = context_menu_params_get_selection_text; + struct_.struct_.is_editable = context_menu_params_is_editable; + struct_.struct_.is_speech_input_enabled = + context_menu_params_is_speech_input_enabled; + struct_.struct_.get_edit_state_flags = + context_menu_params_get_edit_state_flags; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/context_menu_params_cpptoc.h b/libcef_dll/cpptoc/context_menu_params_cpptoc.h new file mode 100644 index 000000000..790f2e6fc --- /dev/null +++ b/libcef_dll/cpptoc/context_menu_params_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_CONTEXT_MENU_PARAMS_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_CONTEXT_MENU_PARAMS_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_context_menu_handler.h" +#include "include/capi/cef_context_menu_handler_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefContextMenuParamsCppToC + : public CefCppToC { + public: + explicit CefContextMenuParamsCppToC(CefContextMenuParams* cls); + virtual ~CefContextMenuParamsCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_CONTEXT_MENU_PARAMS_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/cookie_manager_cpptoc.cc b/libcef_dll/cpptoc/cookie_manager_cpptoc.cc new file mode 100644 index 000000000..5af5020de --- /dev/null +++ b/libcef_dll/cpptoc/cookie_manager_cpptoc.cc @@ -0,0 +1,200 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h" +#include "libcef_dll/ctocpp/cookie_visitor_ctocpp.h" +#include "libcef_dll/transfer_util.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefCookieManager::GetGlobalManager(); + + // Return type: refptr_same + return CefCookieManagerCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_create_manager( + const cef_string_t* path) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Unverified params: path + + // Execute + CefRefPtr _retval = CefCookieManager::CreateManager( + CefString(path)); + + // Return type: refptr_same + return CefCookieManagerCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK cookie_manager_set_supported_schemes( + struct _cef_cookie_manager_t* self, cef_string_list_t schemes) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: schemes; type: string_vec_byref_const + DCHECK(schemes); + if (!schemes) + return; + + // Translate param: schemes; type: string_vec_byref_const + std::vector schemesList; + transfer_string_list_contents(schemes, schemesList); + + // Execute + CefCookieManagerCppToC::Get(self)->SetSupportedSchemes( + schemesList); +} + +int CEF_CALLBACK cookie_manager_visit_all_cookies( + struct _cef_cookie_manager_t* self, + struct _cef_cookie_visitor_t* visitor) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: visitor; type: refptr_diff + DCHECK(visitor); + if (!visitor) + return 0; + + // Execute + bool _retval = CefCookieManagerCppToC::Get(self)->VisitAllCookies( + CefCookieVisitorCToCpp::Wrap(visitor)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK cookie_manager_visit_url_cookies( + struct _cef_cookie_manager_t* self, const cef_string_t* url, + int includeHttpOnly, struct _cef_cookie_visitor_t* visitor) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: url; type: string_byref_const + DCHECK(url); + if (!url) + return 0; + // Verify param: visitor; type: refptr_diff + DCHECK(visitor); + if (!visitor) + return 0; + + // Execute + bool _retval = CefCookieManagerCppToC::Get(self)->VisitUrlCookies( + CefString(url), + includeHttpOnly?true:false, + CefCookieVisitorCToCpp::Wrap(visitor)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK cookie_manager_set_cookie(struct _cef_cookie_manager_t* self, + const cef_string_t* url, const struct _cef_cookie_t* cookie) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: url; type: string_byref_const + DCHECK(url); + if (!url) + return 0; + // Verify param: cookie; type: struct_byref_const + DCHECK(cookie); + if (!cookie) + return 0; + + // Translate param: cookie; type: struct_byref_const + CefCookie cookieObj; + if (cookie) + cookieObj.Set(*cookie, false); + + // Execute + bool _retval = CefCookieManagerCppToC::Get(self)->SetCookie( + CefString(url), + cookieObj); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK cookie_manager_delete_cookies( + struct _cef_cookie_manager_t* self, const cef_string_t* url, + const cef_string_t* cookie_name) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Unverified params: url, cookie_name + + // Execute + bool _retval = CefCookieManagerCppToC::Get(self)->DeleteCookies( + CefString(url), + CefString(cookie_name)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK cookie_manager_set_storage_path( + struct _cef_cookie_manager_t* self, const cef_string_t* path) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Unverified params: path + + // Execute + bool _retval = CefCookieManagerCppToC::Get(self)->SetStoragePath( + CefString(path)); + + // Return type: bool + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefCookieManagerCppToC::CefCookieManagerCppToC(CefCookieManager* cls) + : CefCppToC( + cls) { + struct_.struct_.set_supported_schemes = cookie_manager_set_supported_schemes; + struct_.struct_.visit_all_cookies = cookie_manager_visit_all_cookies; + struct_.struct_.visit_url_cookies = cookie_manager_visit_url_cookies; + struct_.struct_.set_cookie = cookie_manager_set_cookie; + struct_.struct_.delete_cookies = cookie_manager_delete_cookies; + struct_.struct_.set_storage_path = cookie_manager_set_storage_path; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/cookie_manager_cpptoc.h b/libcef_dll/cpptoc/cookie_manager_cpptoc.h new file mode 100644 index 000000000..cacc919f4 --- /dev/null +++ b/libcef_dll/cpptoc/cookie_manager_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_COOKIE_MANAGER_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_COOKIE_MANAGER_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_cookie.h" +#include "include/capi/cef_cookie_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefCookieManagerCppToC + : public CefCppToC { + public: + explicit CefCookieManagerCppToC(CefCookieManager* cls); + virtual ~CefCookieManagerCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_COOKIE_MANAGER_CPPTOC_H_ + diff --git a/cef/libcef_dll/cpptoc/cookie_visitor_cpptoc.cc b/libcef_dll/cpptoc/cookie_visitor_cpptoc.cc similarity index 100% rename from cef/libcef_dll/cpptoc/cookie_visitor_cpptoc.cc rename to libcef_dll/cpptoc/cookie_visitor_cpptoc.cc diff --git a/cef/libcef_dll/cpptoc/cookie_visitor_cpptoc.h b/libcef_dll/cpptoc/cookie_visitor_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/cookie_visitor_cpptoc.h rename to libcef_dll/cpptoc/cookie_visitor_cpptoc.h diff --git a/cef/libcef_dll/cpptoc/cpptoc.h b/libcef_dll/cpptoc/cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/cpptoc.h rename to libcef_dll/cpptoc/cpptoc.h diff --git a/libcef_dll/cpptoc/dictionary_value_cpptoc.cc b/libcef_dll/cpptoc/dictionary_value_cpptoc.cc new file mode 100644 index 000000000..23f883c62 --- /dev/null +++ b/libcef_dll/cpptoc/dictionary_value_cpptoc.cc @@ -0,0 +1,577 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/binary_value_cpptoc.h" +#include "libcef_dll/cpptoc/dictionary_value_cpptoc.h" +#include "libcef_dll/cpptoc/list_value_cpptoc.h" +#include "libcef_dll/transfer_util.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_dictionary_value_t* cef_dictionary_value_create() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefDictionaryValue::Create(); + + // Return type: refptr_same + return CefDictionaryValueCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK dictionary_value_is_valid( + struct _cef_dictionary_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->IsValid(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK dictionary_value_is_owned( + struct _cef_dictionary_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->IsOwned(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK dictionary_value_is_read_only( + struct _cef_dictionary_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->IsReadOnly(); + + // Return type: bool + return _retval; +} + +struct _cef_dictionary_value_t* CEF_CALLBACK dictionary_value_copy( + struct _cef_dictionary_value_t* self, int exclude_empty_children) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDictionaryValueCppToC::Get( + self)->Copy( + exclude_empty_children?true:false); + + // Return type: refptr_same + return CefDictionaryValueCppToC::Wrap(_retval); +} + +size_t CEF_CALLBACK dictionary_value_get_size( + struct _cef_dictionary_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + size_t _retval = CefDictionaryValueCppToC::Get(self)->GetSize(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK dictionary_value_clear(struct _cef_dictionary_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->Clear(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK dictionary_value_has_key(struct _cef_dictionary_value_t* self, + const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->HasKey( + CefString(key)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK dictionary_value_get_keys(struct _cef_dictionary_value_t* self, + cef_string_list_t keys) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: keys; type: string_vec_byref + DCHECK(keys); + if (!keys) + return 0; + + // Translate param: keys; type: string_vec_byref + std::vector keysList; + transfer_string_list_contents(keys, keysList); + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->GetKeys( + keysList); + + // Restore param: keys; type: string_vec_byref + cef_string_list_clear(keys); + transfer_string_list_contents(keysList, keys); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK dictionary_value_remove(struct _cef_dictionary_value_t* self, + const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->Remove( + CefString(key)); + + // Return type: bool + return _retval; +} + +enum cef_value_type_t CEF_CALLBACK dictionary_value_get_type( + struct _cef_dictionary_value_t* self, const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return VTYPE_INVALID; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return VTYPE_INVALID; + + // Execute + cef_value_type_t _retval = CefDictionaryValueCppToC::Get(self)->GetType( + CefString(key)); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK dictionary_value_get_bool(struct _cef_dictionary_value_t* self, + const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->GetBool( + CefString(key)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK dictionary_value_get_int(struct _cef_dictionary_value_t* self, + const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + + // Execute + int _retval = CefDictionaryValueCppToC::Get(self)->GetInt( + CefString(key)); + + // Return type: simple + return _retval; +} + +double CEF_CALLBACK dictionary_value_get_double( + struct _cef_dictionary_value_t* self, const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + + // Execute + double _retval = CefDictionaryValueCppToC::Get(self)->GetDouble( + CefString(key)); + + // Return type: simple + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK dictionary_value_get_string( + struct _cef_dictionary_value_t* self, const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return NULL; + + // Execute + CefString _retval = CefDictionaryValueCppToC::Get(self)->GetString( + CefString(key)); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_binary_value_t* CEF_CALLBACK dictionary_value_get_binary( + struct _cef_dictionary_value_t* self, const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return NULL; + + // Execute + CefRefPtr _retval = CefDictionaryValueCppToC::Get( + self)->GetBinary( + CefString(key)); + + // Return type: refptr_same + return CefBinaryValueCppToC::Wrap(_retval); +} + +struct _cef_dictionary_value_t* CEF_CALLBACK dictionary_value_get_dictionary( + struct _cef_dictionary_value_t* self, const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return NULL; + + // Execute + CefRefPtr _retval = CefDictionaryValueCppToC::Get( + self)->GetDictionary( + CefString(key)); + + // Return type: refptr_same + return CefDictionaryValueCppToC::Wrap(_retval); +} + +struct _cef_list_value_t* CEF_CALLBACK dictionary_value_get_list( + struct _cef_dictionary_value_t* self, const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return NULL; + + // Execute + CefRefPtr _retval = CefDictionaryValueCppToC::Get( + self)->GetList( + CefString(key)); + + // Return type: refptr_same + return CefListValueCppToC::Wrap(_retval); +} + +int CEF_CALLBACK dictionary_value_set_null(struct _cef_dictionary_value_t* self, + const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->SetNull( + CefString(key)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK dictionary_value_set_bool(struct _cef_dictionary_value_t* self, + const cef_string_t* key, int value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->SetBool( + CefString(key), + value?true:false); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK dictionary_value_set_int(struct _cef_dictionary_value_t* self, + const cef_string_t* key, int value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->SetInt( + CefString(key), + value); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK dictionary_value_set_double( + struct _cef_dictionary_value_t* self, const cef_string_t* key, + double value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->SetDouble( + CefString(key), + value); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK dictionary_value_set_string( + struct _cef_dictionary_value_t* self, const cef_string_t* key, + const cef_string_t* value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + // Unverified params: value + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->SetString( + CefString(key), + CefString(value)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK dictionary_value_set_binary( + struct _cef_dictionary_value_t* self, const cef_string_t* key, + cef_binary_value_t* value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + // Verify param: value; type: refptr_same + DCHECK(value); + if (!value) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->SetBinary( + CefString(key), + CefBinaryValueCppToC::Unwrap(value)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK dictionary_value_set_dictionary( + struct _cef_dictionary_value_t* self, const cef_string_t* key, + struct _cef_dictionary_value_t* value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + // Verify param: value; type: refptr_same + DCHECK(value); + if (!value) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->SetDictionary( + CefString(key), + CefDictionaryValueCppToC::Unwrap(value)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK dictionary_value_set_list(struct _cef_dictionary_value_t* self, + const cef_string_t* key, struct _cef_list_value_t* value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + // Verify param: value; type: refptr_same + DCHECK(value); + if (!value) + return 0; + + // Execute + bool _retval = CefDictionaryValueCppToC::Get(self)->SetList( + CefString(key), + CefListValueCppToC::Unwrap(value)); + + // Return type: bool + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefDictionaryValueCppToC::CefDictionaryValueCppToC(CefDictionaryValue* cls) + : CefCppToC(cls) { + struct_.struct_.is_valid = dictionary_value_is_valid; + struct_.struct_.is_owned = dictionary_value_is_owned; + struct_.struct_.is_read_only = dictionary_value_is_read_only; + struct_.struct_.copy = dictionary_value_copy; + struct_.struct_.get_size = dictionary_value_get_size; + struct_.struct_.clear = dictionary_value_clear; + struct_.struct_.has_key = dictionary_value_has_key; + struct_.struct_.get_keys = dictionary_value_get_keys; + struct_.struct_.remove = dictionary_value_remove; + struct_.struct_.get_type = dictionary_value_get_type; + struct_.struct_.get_bool = dictionary_value_get_bool; + struct_.struct_.get_int = dictionary_value_get_int; + struct_.struct_.get_double = dictionary_value_get_double; + struct_.struct_.get_string = dictionary_value_get_string; + struct_.struct_.get_binary = dictionary_value_get_binary; + struct_.struct_.get_dictionary = dictionary_value_get_dictionary; + struct_.struct_.get_list = dictionary_value_get_list; + struct_.struct_.set_null = dictionary_value_set_null; + struct_.struct_.set_bool = dictionary_value_set_bool; + struct_.struct_.set_int = dictionary_value_set_int; + struct_.struct_.set_double = dictionary_value_set_double; + struct_.struct_.set_string = dictionary_value_set_string; + struct_.struct_.set_binary = dictionary_value_set_binary; + struct_.struct_.set_dictionary = dictionary_value_set_dictionary; + struct_.struct_.set_list = dictionary_value_set_list; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/dictionary_value_cpptoc.h b/libcef_dll/cpptoc/dictionary_value_cpptoc.h new file mode 100644 index 000000000..8614d1392 --- /dev/null +++ b/libcef_dll/cpptoc/dictionary_value_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_DICTIONARY_VALUE_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_DICTIONARY_VALUE_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_values.h" +#include "include/capi/cef_values_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefDictionaryValueCppToC + : public CefCppToC { + public: + explicit CefDictionaryValueCppToC(CefDictionaryValue* cls); + virtual ~CefDictionaryValueCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_DICTIONARY_VALUE_CPPTOC_H_ + diff --git a/cef/libcef_dll/cpptoc/display_handler_cpptoc.cc b/libcef_dll/cpptoc/display_handler_cpptoc.cc similarity index 83% rename from cef/libcef_dll/cpptoc/display_handler_cpptoc.cc rename to libcef_dll/cpptoc/display_handler_cpptoc.cc index 5b6f6ef51..36a21e4e9 100644 --- a/cef/libcef_dll/cpptoc/display_handler_cpptoc.cc +++ b/libcef_dll/cpptoc/display_handler_cpptoc.cc @@ -17,9 +17,9 @@ // MEMBER FUNCTIONS - Body may be edited by hand. -void CEF_CALLBACK display_handler_on_nav_state_change( - struct _cef_display_handler_t* self, cef_browser_t* browser, int canGoBack, - int canGoForward) { +void CEF_CALLBACK display_handler_on_loading_state_change( + struct _cef_display_handler_t* self, cef_browser_t* browser, int isLoading, + int canGoBack, int canGoForward) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING DCHECK(self); @@ -31,8 +31,9 @@ void CEF_CALLBACK display_handler_on_nav_state_change( return; // Execute - CefDisplayHandlerCppToC::Get(self)->OnNavStateChange( + CefDisplayHandlerCppToC::Get(self)->OnLoadingStateChange( CefBrowserCToCpp::Wrap(browser), + isLoading?true:false, canGoBack?true:false, canGoForward?true:false); } @@ -65,31 +66,6 @@ void CEF_CALLBACK display_handler_on_address_change( CefString(url)); } -void CEF_CALLBACK display_handler_on_contents_size_change( - struct _cef_display_handler_t* self, cef_browser_t* browser, - struct _cef_frame_t* frame, int width, int height) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return; - // Verify param: frame; type: refptr_diff - DCHECK(frame); - if (!frame) - return; - - // Execute - CefDisplayHandlerCppToC::Get(self)->OnContentsSizeChange( - CefBrowserCToCpp::Wrap(browser), - CefFrameCToCpp::Wrap(frame), - width, - height); -} - void CEF_CALLBACK display_handler_on_title_change( struct _cef_display_handler_t* self, cef_browser_t* browser, const cef_string_t* title) { @@ -187,10 +163,9 @@ int CEF_CALLBACK display_handler_on_console_message( CefDisplayHandlerCppToC::CefDisplayHandlerCppToC(CefDisplayHandler* cls) : CefCppToC(cls) { - struct_.struct_.on_nav_state_change = display_handler_on_nav_state_change; + struct_.struct_.on_loading_state_change = + display_handler_on_loading_state_change; struct_.struct_.on_address_change = display_handler_on_address_change; - struct_.struct_.on_contents_size_change = - display_handler_on_contents_size_change; struct_.struct_.on_title_change = display_handler_on_title_change; struct_.struct_.on_tooltip = display_handler_on_tooltip; struct_.struct_.on_status_message = display_handler_on_status_message; diff --git a/cef/libcef_dll/cpptoc/display_handler_cpptoc.h b/libcef_dll/cpptoc/display_handler_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/display_handler_cpptoc.h rename to libcef_dll/cpptoc/display_handler_cpptoc.h diff --git a/libcef_dll/cpptoc/domdocument_cpptoc.cc b/libcef_dll/cpptoc/domdocument_cpptoc.cc new file mode 100644 index 000000000..403f8d812 --- /dev/null +++ b/libcef_dll/cpptoc/domdocument_cpptoc.cc @@ -0,0 +1,303 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/domdocument_cpptoc.h" +#include "libcef_dll/cpptoc/domnode_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +enum cef_dom_document_type_t CEF_CALLBACK domdocument_get_type( + struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return DOM_DOCUMENT_TYPE_UNKNOWN; + + // Execute + cef_dom_document_type_t _retval = CefDOMDocumentCppToC::Get(self)->GetType(); + + // Return type: simple + return _retval; +} + +struct _cef_domnode_t* CEF_CALLBACK domdocument_get_document( + struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMDocumentCppToC::Get(self)->GetDocument( + ); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + +struct _cef_domnode_t* CEF_CALLBACK domdocument_get_body( + struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMDocumentCppToC::Get(self)->GetBody(); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + +struct _cef_domnode_t* CEF_CALLBACK domdocument_get_head( + struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMDocumentCppToC::Get(self)->GetHead(); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + +cef_string_userfree_t CEF_CALLBACK domdocument_get_title( + struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDOMDocumentCppToC::Get(self)->GetTitle(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +struct _cef_domnode_t* CEF_CALLBACK domdocument_get_element_by_id( + struct _cef_domdocument_t* self, const cef_string_t* id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: id; type: string_byref_const + DCHECK(id); + if (!id) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMDocumentCppToC::Get( + self)->GetElementById( + CefString(id)); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + +struct _cef_domnode_t* CEF_CALLBACK domdocument_get_focused_node( + struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMDocumentCppToC::Get( + self)->GetFocusedNode(); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + +int CEF_CALLBACK domdocument_has_selection(struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDOMDocumentCppToC::Get(self)->HasSelection(); + + // Return type: bool + return _retval; +} + +struct _cef_domnode_t* CEF_CALLBACK domdocument_get_selection_start_node( + struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMDocumentCppToC::Get( + self)->GetSelectionStartNode(); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + +int CEF_CALLBACK domdocument_get_selection_start_offset( + struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefDOMDocumentCppToC::Get(self)->GetSelectionStartOffset(); + + // Return type: simple + return _retval; +} + +struct _cef_domnode_t* CEF_CALLBACK domdocument_get_selection_end_node( + struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMDocumentCppToC::Get( + self)->GetSelectionEndNode(); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + +int CEF_CALLBACK domdocument_get_selection_end_offset( + struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefDOMDocumentCppToC::Get(self)->GetSelectionEndOffset(); + + // Return type: simple + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK domdocument_get_selection_as_markup( + struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDOMDocumentCppToC::Get(self)->GetSelectionAsMarkup(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK domdocument_get_selection_as_text( + struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDOMDocumentCppToC::Get(self)->GetSelectionAsText(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK domdocument_get_base_url( + struct _cef_domdocument_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDOMDocumentCppToC::Get(self)->GetBaseURL(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK domdocument_get_complete_url( + struct _cef_domdocument_t* self, const cef_string_t* partialURL) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: partialURL; type: string_byref_const + DCHECK(partialURL); + if (!partialURL) + return NULL; + + // Execute + CefString _retval = CefDOMDocumentCppToC::Get(self)->GetCompleteURL( + CefString(partialURL)); + + // Return type: string + return _retval.DetachToUserFree(); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefDOMDocumentCppToC::CefDOMDocumentCppToC(CefDOMDocument* cls) + : CefCppToC(cls) { + struct_.struct_.get_type = domdocument_get_type; + struct_.struct_.get_document = domdocument_get_document; + struct_.struct_.get_body = domdocument_get_body; + struct_.struct_.get_head = domdocument_get_head; + struct_.struct_.get_title = domdocument_get_title; + struct_.struct_.get_element_by_id = domdocument_get_element_by_id; + struct_.struct_.get_focused_node = domdocument_get_focused_node; + struct_.struct_.has_selection = domdocument_has_selection; + struct_.struct_.get_selection_start_node = + domdocument_get_selection_start_node; + struct_.struct_.get_selection_start_offset = + domdocument_get_selection_start_offset; + struct_.struct_.get_selection_end_node = domdocument_get_selection_end_node; + struct_.struct_.get_selection_end_offset = + domdocument_get_selection_end_offset; + struct_.struct_.get_selection_as_markup = domdocument_get_selection_as_markup; + struct_.struct_.get_selection_as_text = domdocument_get_selection_as_text; + struct_.struct_.get_base_url = domdocument_get_base_url; + struct_.struct_.get_complete_url = domdocument_get_complete_url; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/domdocument_cpptoc.h b/libcef_dll/cpptoc/domdocument_cpptoc.h new file mode 100644 index 000000000..a35fcdd7a --- /dev/null +++ b/libcef_dll/cpptoc/domdocument_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_DOMDOCUMENT_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_DOMDOCUMENT_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_dom.h" +#include "include/capi/cef_dom_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefDOMDocumentCppToC + : public CefCppToC { + public: + explicit CefDOMDocumentCppToC(CefDOMDocument* cls); + virtual ~CefDOMDocumentCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_DOMDOCUMENT_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/domevent_cpptoc.cc b/libcef_dll/cpptoc/domevent_cpptoc.cc new file mode 100644 index 000000000..051898cab --- /dev/null +++ b/libcef_dll/cpptoc/domevent_cpptoc.cc @@ -0,0 +1,159 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/domdocument_cpptoc.h" +#include "libcef_dll/cpptoc/domevent_cpptoc.h" +#include "libcef_dll/cpptoc/domnode_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +cef_string_userfree_t CEF_CALLBACK domevent_get_type( + struct _cef_domevent_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDOMEventCppToC::Get(self)->GetType(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +enum cef_dom_event_category_t CEF_CALLBACK domevent_get_category( + struct _cef_domevent_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return DOM_EVENT_CATEGORY_UNKNOWN; + + // Execute + cef_dom_event_category_t _retval = CefDOMEventCppToC::Get(self)->GetCategory( + ); + + // Return type: simple + return _retval; +} + +enum cef_dom_event_phase_t CEF_CALLBACK domevent_get_phase( + struct _cef_domevent_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return DOM_EVENT_PHASE_UNKNOWN; + + // Execute + cef_dom_event_phase_t _retval = CefDOMEventCppToC::Get(self)->GetPhase(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK domevent_can_bubble(struct _cef_domevent_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDOMEventCppToC::Get(self)->CanBubble(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK domevent_can_cancel(struct _cef_domevent_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDOMEventCppToC::Get(self)->CanCancel(); + + // Return type: bool + return _retval; +} + +cef_domdocument_t* CEF_CALLBACK domevent_get_document( + struct _cef_domevent_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMEventCppToC::Get(self)->GetDocument( + ); + + // Return type: refptr_same + return CefDOMDocumentCppToC::Wrap(_retval); +} + +cef_domnode_t* CEF_CALLBACK domevent_get_target(struct _cef_domevent_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMEventCppToC::Get(self)->GetTarget(); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + +cef_domnode_t* CEF_CALLBACK domevent_get_current_target( + struct _cef_domevent_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMEventCppToC::Get( + self)->GetCurrentTarget(); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefDOMEventCppToC::CefDOMEventCppToC(CefDOMEvent* cls) + : CefCppToC(cls) { + struct_.struct_.get_type = domevent_get_type; + struct_.struct_.get_category = domevent_get_category; + struct_.struct_.get_phase = domevent_get_phase; + struct_.struct_.can_bubble = domevent_can_bubble; + struct_.struct_.can_cancel = domevent_can_cancel; + struct_.struct_.get_document = domevent_get_document; + struct_.struct_.get_target = domevent_get_target; + struct_.struct_.get_current_target = domevent_get_current_target; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/domevent_cpptoc.h b/libcef_dll/cpptoc/domevent_cpptoc.h new file mode 100644 index 000000000..aec1540ec --- /dev/null +++ b/libcef_dll/cpptoc/domevent_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_DOMEVENT_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_DOMEVENT_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_dom.h" +#include "include/capi/cef_dom_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefDOMEventCppToC + : public CefCppToC { + public: + explicit CefDOMEventCppToC(CefDOMEvent* cls); + virtual ~CefDOMEventCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_DOMEVENT_CPPTOC_H_ + diff --git a/cef/libcef_dll/cpptoc/domevent_listener_cpptoc.cc b/libcef_dll/cpptoc/domevent_listener_cpptoc.cc similarity index 100% rename from cef/libcef_dll/cpptoc/domevent_listener_cpptoc.cc rename to libcef_dll/cpptoc/domevent_listener_cpptoc.cc diff --git a/cef/libcef_dll/cpptoc/domevent_listener_cpptoc.h b/libcef_dll/cpptoc/domevent_listener_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/domevent_listener_cpptoc.h rename to libcef_dll/cpptoc/domevent_listener_cpptoc.h diff --git a/libcef_dll/cpptoc/domnode_cpptoc.cc b/libcef_dll/cpptoc/domnode_cpptoc.cc new file mode 100644 index 000000000..f38caee38 --- /dev/null +++ b/libcef_dll/cpptoc/domnode_cpptoc.cc @@ -0,0 +1,494 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/domdocument_cpptoc.h" +#include "libcef_dll/cpptoc/domnode_cpptoc.h" +#include "libcef_dll/ctocpp/domevent_listener_ctocpp.h" +#include "libcef_dll/transfer_util.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +enum cef_dom_node_type_t CEF_CALLBACK domnode_get_type( + struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return DOM_NODE_TYPE_UNSUPPORTED; + + // Execute + cef_dom_node_type_t _retval = CefDOMNodeCppToC::Get(self)->GetType(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK domnode_is_text(struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDOMNodeCppToC::Get(self)->IsText(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK domnode_is_element(struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDOMNodeCppToC::Get(self)->IsElement(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK domnode_is_editable(struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDOMNodeCppToC::Get(self)->IsEditable(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK domnode_is_form_control_element(struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDOMNodeCppToC::Get(self)->IsFormControlElement(); + + // Return type: bool + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK domnode_get_form_control_element_type( + struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDOMNodeCppToC::Get(self)->GetFormControlElementType(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int CEF_CALLBACK domnode_is_same(struct _cef_domnode_t* self, + struct _cef_domnode_t* that) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: that; type: refptr_same + DCHECK(that); + if (!that) + return 0; + + // Execute + bool _retval = CefDOMNodeCppToC::Get(self)->IsSame( + CefDOMNodeCppToC::Unwrap(that)); + + // Return type: bool + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK domnode_get_name( + struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDOMNodeCppToC::Get(self)->GetName(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK domnode_get_value( + struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDOMNodeCppToC::Get(self)->GetValue(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int CEF_CALLBACK domnode_set_value(struct _cef_domnode_t* self, + const cef_string_t* value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: value; type: string_byref_const + DCHECK(value); + if (!value) + return 0; + + // Execute + bool _retval = CefDOMNodeCppToC::Get(self)->SetValue( + CefString(value)); + + // Return type: bool + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK domnode_get_as_markup( + struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDOMNodeCppToC::Get(self)->GetAsMarkup(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_domdocument_t* CEF_CALLBACK domnode_get_document( + struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMNodeCppToC::Get(self)->GetDocument( + ); + + // Return type: refptr_same + return CefDOMDocumentCppToC::Wrap(_retval); +} + +struct _cef_domnode_t* CEF_CALLBACK domnode_get_parent( + struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMNodeCppToC::Get(self)->GetParent(); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + +struct _cef_domnode_t* CEF_CALLBACK domnode_get_previous_sibling( + struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMNodeCppToC::Get( + self)->GetPreviousSibling(); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + +struct _cef_domnode_t* CEF_CALLBACK domnode_get_next_sibling( + struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMNodeCppToC::Get(self)->GetNextSibling(); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + +int CEF_CALLBACK domnode_has_children(struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDOMNodeCppToC::Get(self)->HasChildren(); + + // Return type: bool + return _retval; +} + +struct _cef_domnode_t* CEF_CALLBACK domnode_get_first_child( + struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMNodeCppToC::Get(self)->GetFirstChild(); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + +struct _cef_domnode_t* CEF_CALLBACK domnode_get_last_child( + struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefDOMNodeCppToC::Get(self)->GetLastChild(); + + // Return type: refptr_same + return CefDOMNodeCppToC::Wrap(_retval); +} + +void CEF_CALLBACK domnode_add_event_listener(struct _cef_domnode_t* self, + const cef_string_t* eventType, struct _cef_domevent_listener_t* listener, + int useCapture) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: eventType; type: string_byref_const + DCHECK(eventType); + if (!eventType) + return; + // Verify param: listener; type: refptr_diff + DCHECK(listener); + if (!listener) + return; + + // Execute + CefDOMNodeCppToC::Get(self)->AddEventListener( + CefString(eventType), + CefDOMEventListenerCToCpp::Wrap(listener), + useCapture?true:false); +} + +cef_string_userfree_t CEF_CALLBACK domnode_get_element_tag_name( + struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDOMNodeCppToC::Get(self)->GetElementTagName(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int CEF_CALLBACK domnode_has_element_attributes(struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDOMNodeCppToC::Get(self)->HasElementAttributes(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK domnode_has_element_attribute(struct _cef_domnode_t* self, + const cef_string_t* attrName) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: attrName; type: string_byref_const + DCHECK(attrName); + if (!attrName) + return 0; + + // Execute + bool _retval = CefDOMNodeCppToC::Get(self)->HasElementAttribute( + CefString(attrName)); + + // Return type: bool + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK domnode_get_element_attribute( + struct _cef_domnode_t* self, const cef_string_t* attrName) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: attrName; type: string_byref_const + DCHECK(attrName); + if (!attrName) + return NULL; + + // Execute + CefString _retval = CefDOMNodeCppToC::Get(self)->GetElementAttribute( + CefString(attrName)); + + // Return type: string + return _retval.DetachToUserFree(); +} + +void CEF_CALLBACK domnode_get_element_attributes(struct _cef_domnode_t* self, + cef_string_map_t attrMap) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: attrMap; type: string_map_single_byref + DCHECK(attrMap); + if (!attrMap) + return; + + // Translate param: attrMap; type: string_map_single_byref + std::map attrMapMap; + transfer_string_map_contents(attrMap, attrMapMap); + + // Execute + CefDOMNodeCppToC::Get(self)->GetElementAttributes( + attrMapMap); + + // Restore param: attrMap; type: string_map_single_byref + cef_string_map_clear(attrMap); + transfer_string_map_contents(attrMapMap, attrMap); +} + +int CEF_CALLBACK domnode_set_element_attribute(struct _cef_domnode_t* self, + const cef_string_t* attrName, const cef_string_t* value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: attrName; type: string_byref_const + DCHECK(attrName); + if (!attrName) + return 0; + // Verify param: value; type: string_byref_const + DCHECK(value); + if (!value) + return 0; + + // Execute + bool _retval = CefDOMNodeCppToC::Get(self)->SetElementAttribute( + CefString(attrName), + CefString(value)); + + // Return type: bool + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK domnode_get_element_inner_text( + struct _cef_domnode_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDOMNodeCppToC::Get(self)->GetElementInnerText(); + + // Return type: string + return _retval.DetachToUserFree(); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefDOMNodeCppToC::CefDOMNodeCppToC(CefDOMNode* cls) + : CefCppToC(cls) { + struct_.struct_.get_type = domnode_get_type; + struct_.struct_.is_text = domnode_is_text; + struct_.struct_.is_element = domnode_is_element; + struct_.struct_.is_editable = domnode_is_editable; + struct_.struct_.is_form_control_element = domnode_is_form_control_element; + struct_.struct_.get_form_control_element_type = + domnode_get_form_control_element_type; + struct_.struct_.is_same = domnode_is_same; + struct_.struct_.get_name = domnode_get_name; + struct_.struct_.get_value = domnode_get_value; + struct_.struct_.set_value = domnode_set_value; + struct_.struct_.get_as_markup = domnode_get_as_markup; + struct_.struct_.get_document = domnode_get_document; + struct_.struct_.get_parent = domnode_get_parent; + struct_.struct_.get_previous_sibling = domnode_get_previous_sibling; + struct_.struct_.get_next_sibling = domnode_get_next_sibling; + struct_.struct_.has_children = domnode_has_children; + struct_.struct_.get_first_child = domnode_get_first_child; + struct_.struct_.get_last_child = domnode_get_last_child; + struct_.struct_.add_event_listener = domnode_add_event_listener; + struct_.struct_.get_element_tag_name = domnode_get_element_tag_name; + struct_.struct_.has_element_attributes = domnode_has_element_attributes; + struct_.struct_.has_element_attribute = domnode_has_element_attribute; + struct_.struct_.get_element_attribute = domnode_get_element_attribute; + struct_.struct_.get_element_attributes = domnode_get_element_attributes; + struct_.struct_.set_element_attribute = domnode_set_element_attribute; + struct_.struct_.get_element_inner_text = domnode_get_element_inner_text; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/domnode_cpptoc.h b/libcef_dll/cpptoc/domnode_cpptoc.h new file mode 100644 index 000000000..1da9af779 --- /dev/null +++ b/libcef_dll/cpptoc/domnode_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_DOMNODE_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_DOMNODE_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_dom.h" +#include "include/capi/cef_dom_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefDOMNodeCppToC + : public CefCppToC { + public: + explicit CefDOMNodeCppToC(CefDOMNode* cls); + virtual ~CefDOMNodeCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_DOMNODE_CPPTOC_H_ + diff --git a/cef/libcef_dll/cpptoc/domvisitor_cpptoc.cc b/libcef_dll/cpptoc/domvisitor_cpptoc.cc similarity index 100% rename from cef/libcef_dll/cpptoc/domvisitor_cpptoc.cc rename to libcef_dll/cpptoc/domvisitor_cpptoc.cc diff --git a/cef/libcef_dll/cpptoc/domvisitor_cpptoc.h b/libcef_dll/cpptoc/domvisitor_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/domvisitor_cpptoc.h rename to libcef_dll/cpptoc/domvisitor_cpptoc.h diff --git a/libcef_dll/cpptoc/download_handler_cpptoc.cc b/libcef_dll/cpptoc/download_handler_cpptoc.cc new file mode 100644 index 000000000..28113de7c --- /dev/null +++ b/libcef_dll/cpptoc/download_handler_cpptoc.cc @@ -0,0 +1,100 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/download_handler_cpptoc.h" +#include "libcef_dll/ctocpp/before_download_callback_ctocpp.h" +#include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/download_item_ctocpp.h" +#include "libcef_dll/ctocpp/download_item_callback_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK download_handler_on_before_download( + struct _cef_download_handler_t* self, cef_browser_t* browser, + struct _cef_download_item_t* download_item, + const cef_string_t* suggested_name, + cef_before_download_callback_t* callback) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: download_item; type: refptr_diff + DCHECK(download_item); + if (!download_item) + return; + // Verify param: suggested_name; type: string_byref_const + DCHECK(suggested_name); + if (!suggested_name) + return; + // Verify param: callback; type: refptr_diff + DCHECK(callback); + if (!callback) + return; + + // Execute + CefDownloadHandlerCppToC::Get(self)->OnBeforeDownload( + CefBrowserCToCpp::Wrap(browser), + CefDownloadItemCToCpp::Wrap(download_item), + CefString(suggested_name), + CefBeforeDownloadCallbackCToCpp::Wrap(callback)); +} + +void CEF_CALLBACK download_handler_on_download_updated( + struct _cef_download_handler_t* self, cef_browser_t* browser, + struct _cef_download_item_t* download_item, + cef_download_item_callback_t* callback) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: download_item; type: refptr_diff + DCHECK(download_item); + if (!download_item) + return; + // Verify param: callback; type: refptr_diff + DCHECK(callback); + if (!callback) + return; + + // Execute + CefDownloadHandlerCppToC::Get(self)->OnDownloadUpdated( + CefBrowserCToCpp::Wrap(browser), + CefDownloadItemCToCpp::Wrap(download_item), + CefDownloadItemCallbackCToCpp::Wrap(callback)); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefDownloadHandlerCppToC::CefDownloadHandlerCppToC(CefDownloadHandler* cls) + : CefCppToC(cls) { + struct_.struct_.on_before_download = download_handler_on_before_download; + struct_.struct_.on_download_updated = download_handler_on_download_updated; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/cef/libcef_dll/cpptoc/download_handler_cpptoc.h b/libcef_dll/cpptoc/download_handler_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/download_handler_cpptoc.h rename to libcef_dll/cpptoc/download_handler_cpptoc.h diff --git a/libcef_dll/cpptoc/download_item_callback_cpptoc.cc b/libcef_dll/cpptoc/download_item_callback_cpptoc.cc new file mode 100644 index 000000000..241c1b53a --- /dev/null +++ b/libcef_dll/cpptoc/download_item_callback_cpptoc.cc @@ -0,0 +1,44 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/download_item_callback_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK download_item_callback_cancel( + struct _cef_download_item_callback_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefDownloadItemCallbackCppToC::Get(self)->Cancel(); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefDownloadItemCallbackCppToC::CefDownloadItemCallbackCppToC( + CefDownloadItemCallback* cls) + : CefCppToC(cls) { + struct_.struct_.cancel = download_item_callback_cancel; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/download_item_callback_cpptoc.h b/libcef_dll/cpptoc/download_item_callback_cpptoc.h new file mode 100644 index 000000000..1afc07b93 --- /dev/null +++ b/libcef_dll/cpptoc/download_item_callback_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_DOWNLOAD_ITEM_CALLBACK_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_DOWNLOAD_ITEM_CALLBACK_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_download_handler.h" +#include "include/capi/cef_download_handler_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefDownloadItemCallbackCppToC + : public CefCppToC { + public: + explicit CefDownloadItemCallbackCppToC(CefDownloadItemCallback* cls); + virtual ~CefDownloadItemCallbackCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_DOWNLOAD_ITEM_CALLBACK_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/download_item_cpptoc.cc b/libcef_dll/cpptoc/download_item_cpptoc.cc new file mode 100644 index 000000000..923e64467 --- /dev/null +++ b/libcef_dll/cpptoc/download_item_cpptoc.cc @@ -0,0 +1,300 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/download_item_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK download_item_is_valid(struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDownloadItemCppToC::Get(self)->IsValid(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK download_item_is_in_progress( + struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDownloadItemCppToC::Get(self)->IsInProgress(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK download_item_is_complete(struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDownloadItemCppToC::Get(self)->IsComplete(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK download_item_is_canceled(struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefDownloadItemCppToC::Get(self)->IsCanceled(); + + // Return type: bool + return _retval; +} + +int64 CEF_CALLBACK download_item_get_current_speed( + struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int64 _retval = CefDownloadItemCppToC::Get(self)->GetCurrentSpeed(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK download_item_get_percent_complete( + struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefDownloadItemCppToC::Get(self)->GetPercentComplete(); + + // Return type: simple + return _retval; +} + +int64 CEF_CALLBACK download_item_get_total_bytes( + struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int64 _retval = CefDownloadItemCppToC::Get(self)->GetTotalBytes(); + + // Return type: simple + return _retval; +} + +int64 CEF_CALLBACK download_item_get_received_bytes( + struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int64 _retval = CefDownloadItemCppToC::Get(self)->GetReceivedBytes(); + + // Return type: simple + return _retval; +} + +cef_time_t CEF_CALLBACK download_item_get_start_time( + struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return CefTime(); + + // Execute + cef_time_t _retval = CefDownloadItemCppToC::Get(self)->GetStartTime(); + + // Return type: simple + return _retval; +} + +cef_time_t CEF_CALLBACK download_item_get_end_time( + struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return CefTime(); + + // Execute + cef_time_t _retval = CefDownloadItemCppToC::Get(self)->GetEndTime(); + + // Return type: simple + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK download_item_get_full_path( + struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDownloadItemCppToC::Get(self)->GetFullPath(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int32 CEF_CALLBACK download_item_get_id(struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int32 _retval = CefDownloadItemCppToC::Get(self)->GetId(); + + // Return type: simple + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK download_item_get_url( + struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDownloadItemCppToC::Get(self)->GetURL(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK download_item_get_suggested_file_name( + struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDownloadItemCppToC::Get(self)->GetSuggestedFileName(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK download_item_get_content_disposition( + struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDownloadItemCppToC::Get(self)->GetContentDisposition(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK download_item_get_mime_type( + struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDownloadItemCppToC::Get(self)->GetMimeType(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK download_item_get_referrer_charset( + struct _cef_download_item_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefDownloadItemCppToC::Get(self)->GetReferrerCharset(); + + // Return type: string + return _retval.DetachToUserFree(); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefDownloadItemCppToC::CefDownloadItemCppToC(CefDownloadItem* cls) + : CefCppToC( + cls) { + struct_.struct_.is_valid = download_item_is_valid; + struct_.struct_.is_in_progress = download_item_is_in_progress; + struct_.struct_.is_complete = download_item_is_complete; + struct_.struct_.is_canceled = download_item_is_canceled; + struct_.struct_.get_current_speed = download_item_get_current_speed; + struct_.struct_.get_percent_complete = download_item_get_percent_complete; + struct_.struct_.get_total_bytes = download_item_get_total_bytes; + struct_.struct_.get_received_bytes = download_item_get_received_bytes; + struct_.struct_.get_start_time = download_item_get_start_time; + struct_.struct_.get_end_time = download_item_get_end_time; + struct_.struct_.get_full_path = download_item_get_full_path; + struct_.struct_.get_id = download_item_get_id; + struct_.struct_.get_url = download_item_get_url; + struct_.struct_.get_suggested_file_name = + download_item_get_suggested_file_name; + struct_.struct_.get_content_disposition = + download_item_get_content_disposition; + struct_.struct_.get_mime_type = download_item_get_mime_type; + struct_.struct_.get_referrer_charset = download_item_get_referrer_charset; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/download_item_cpptoc.h b/libcef_dll/cpptoc/download_item_cpptoc.h new file mode 100644 index 000000000..c19ac48a2 --- /dev/null +++ b/libcef_dll/cpptoc/download_item_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_DOWNLOAD_ITEM_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_DOWNLOAD_ITEM_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_download_item.h" +#include "include/capi/cef_download_item_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefDownloadItemCppToC + : public CefCppToC { + public: + explicit CefDownloadItemCppToC(CefDownloadItem* cls); + virtual ~CefDownloadItemCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_DOWNLOAD_ITEM_CPPTOC_H_ + diff --git a/cef/libcef_dll/cpptoc/focus_handler_cpptoc.cc b/libcef_dll/cpptoc/focus_handler_cpptoc.cc similarity index 78% rename from cef/libcef_dll/cpptoc/focus_handler_cpptoc.cc rename to libcef_dll/cpptoc/focus_handler_cpptoc.cc index bffe00bb5..e33ff796b 100644 --- a/cef/libcef_dll/cpptoc/focus_handler_cpptoc.cc +++ b/libcef_dll/cpptoc/focus_handler_cpptoc.cc @@ -12,8 +12,6 @@ #include "libcef_dll/cpptoc/focus_handler_cpptoc.h" #include "libcef_dll/ctocpp/browser_ctocpp.h" -#include "libcef_dll/ctocpp/domnode_ctocpp.h" -#include "libcef_dll/ctocpp/frame_ctocpp.h" // MEMBER FUNCTIONS - Body may be edited by hand. @@ -37,7 +35,7 @@ void CEF_CALLBACK focus_handler_on_take_focus(struct _cef_focus_handler_t* self, } int CEF_CALLBACK focus_handler_on_set_focus(struct _cef_focus_handler_t* self, - cef_browser_t* browser, enum cef_handler_focus_source_t source) { + cef_browser_t* browser, enum cef_focus_source_t source) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING DCHECK(self); @@ -57,9 +55,8 @@ int CEF_CALLBACK focus_handler_on_set_focus(struct _cef_focus_handler_t* self, return _retval; } -void CEF_CALLBACK focus_handler_on_focused_node_changed( - struct _cef_focus_handler_t* self, cef_browser_t* browser, - struct _cef_frame_t* frame, cef_domnode_t* node) { +void CEF_CALLBACK focus_handler_on_got_focus(struct _cef_focus_handler_t* self, + cef_browser_t* browser) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING DCHECK(self); @@ -69,13 +66,10 @@ void CEF_CALLBACK focus_handler_on_focused_node_changed( DCHECK(browser); if (!browser) return; - // Unverified params: frame, node // Execute - CefFocusHandlerCppToC::Get(self)->OnFocusedNodeChanged( - CefBrowserCToCpp::Wrap(browser), - CefFrameCToCpp::Wrap(frame), - CefDOMNodeCToCpp::Wrap(node)); + CefFocusHandlerCppToC::Get(self)->OnGotFocus( + CefBrowserCToCpp::Wrap(browser)); } @@ -86,8 +80,7 @@ CefFocusHandlerCppToC::CefFocusHandlerCppToC(CefFocusHandler* cls) cls) { struct_.struct_.on_take_focus = focus_handler_on_take_focus; struct_.struct_.on_set_focus = focus_handler_on_set_focus; - struct_.struct_.on_focused_node_changed = - focus_handler_on_focused_node_changed; + struct_.struct_.on_got_focus = focus_handler_on_got_focus; } #ifndef NDEBUG diff --git a/cef/libcef_dll/cpptoc/focus_handler_cpptoc.h b/libcef_dll/cpptoc/focus_handler_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/focus_handler_cpptoc.h rename to libcef_dll/cpptoc/focus_handler_cpptoc.h diff --git a/libcef_dll/cpptoc/frame_cpptoc.cc b/libcef_dll/cpptoc/frame_cpptoc.cc new file mode 100644 index 000000000..87d756d76 --- /dev/null +++ b/libcef_dll/cpptoc/frame_cpptoc.cc @@ -0,0 +1,401 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/frame_cpptoc.h" +#include "libcef_dll/cpptoc/request_cpptoc.h" +#include "libcef_dll/cpptoc/v8context_cpptoc.h" +#include "libcef_dll/ctocpp/domvisitor_ctocpp.h" +#include "libcef_dll/ctocpp/string_visitor_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK frame_is_valid(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefFrameCppToC::Get(self)->IsValid(); + + // Return type: bool + return _retval; +} + +void CEF_CALLBACK frame_undo(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefFrameCppToC::Get(self)->Undo(); +} + +void CEF_CALLBACK frame_redo(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefFrameCppToC::Get(self)->Redo(); +} + +void CEF_CALLBACK frame_cut(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefFrameCppToC::Get(self)->Cut(); +} + +void CEF_CALLBACK frame_copy(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefFrameCppToC::Get(self)->Copy(); +} + +void CEF_CALLBACK frame_paste(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefFrameCppToC::Get(self)->Paste(); +} + +void CEF_CALLBACK frame_del(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefFrameCppToC::Get(self)->Delete(); +} + +void CEF_CALLBACK frame_select_all(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefFrameCppToC::Get(self)->SelectAll(); +} + +void CEF_CALLBACK frame_view_source(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefFrameCppToC::Get(self)->ViewSource(); +} + +void CEF_CALLBACK frame_get_source(struct _cef_frame_t* self, + struct _cef_string_visitor_t* visitor) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: visitor; type: refptr_diff + DCHECK(visitor); + if (!visitor) + return; + + // Execute + CefFrameCppToC::Get(self)->GetSource( + CefStringVisitorCToCpp::Wrap(visitor)); +} + +void CEF_CALLBACK frame_get_text(struct _cef_frame_t* self, + struct _cef_string_visitor_t* visitor) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: visitor; type: refptr_diff + DCHECK(visitor); + if (!visitor) + return; + + // Execute + CefFrameCppToC::Get(self)->GetText( + CefStringVisitorCToCpp::Wrap(visitor)); +} + +void CEF_CALLBACK frame_load_request(struct _cef_frame_t* self, + struct _cef_request_t* request) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: request; type: refptr_same + DCHECK(request); + if (!request) + return; + + // Execute + CefFrameCppToC::Get(self)->LoadRequest( + CefRequestCppToC::Unwrap(request)); +} + +void CEF_CALLBACK frame_load_url(struct _cef_frame_t* self, + const cef_string_t* url) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: url; type: string_byref_const + DCHECK(url); + if (!url) + return; + + // Execute + CefFrameCppToC::Get(self)->LoadURL( + CefString(url)); +} + +void CEF_CALLBACK frame_load_string(struct _cef_frame_t* self, + const cef_string_t* string_val, const cef_string_t* url) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: string_val; type: string_byref_const + DCHECK(string_val); + if (!string_val) + return; + // Verify param: url; type: string_byref_const + DCHECK(url); + if (!url) + return; + + // Execute + CefFrameCppToC::Get(self)->LoadString( + CefString(string_val), + CefString(url)); +} + +void CEF_CALLBACK frame_execute_java_script(struct _cef_frame_t* self, + const cef_string_t* code, const cef_string_t* script_url, + int start_line) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: code; type: string_byref_const + DCHECK(code); + if (!code) + return; + // Unverified params: script_url + + // Execute + CefFrameCppToC::Get(self)->ExecuteJavaScript( + CefString(code), + CefString(script_url), + start_line); +} + +int CEF_CALLBACK frame_is_main(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefFrameCppToC::Get(self)->IsMain(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK frame_is_focused(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefFrameCppToC::Get(self)->IsFocused(); + + // Return type: bool + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK frame_get_name(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefFrameCppToC::Get(self)->GetName(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int64 CEF_CALLBACK frame_get_identifier(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int64 _retval = CefFrameCppToC::Get(self)->GetIdentifier(); + + // Return type: simple + return _retval; +} + +struct _cef_frame_t* CEF_CALLBACK frame_get_parent(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefFrameCppToC::Get(self)->GetParent(); + + // Return type: refptr_same + return CefFrameCppToC::Wrap(_retval); +} + +cef_string_userfree_t CEF_CALLBACK frame_get_url(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefFrameCppToC::Get(self)->GetURL(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_browser_t* CEF_CALLBACK frame_get_browser(struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefFrameCppToC::Get(self)->GetBrowser(); + + // Return type: refptr_same + return CefBrowserCppToC::Wrap(_retval); +} + +struct _cef_v8context_t* CEF_CALLBACK frame_get_v8context( + struct _cef_frame_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefFrameCppToC::Get(self)->GetV8Context(); + + // Return type: refptr_same + return CefV8ContextCppToC::Wrap(_retval); +} + +void CEF_CALLBACK frame_visit_dom(struct _cef_frame_t* self, + cef_domvisitor_t* visitor) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: visitor; type: refptr_diff + DCHECK(visitor); + if (!visitor) + return; + + // Execute + CefFrameCppToC::Get(self)->VisitDOM( + CefDOMVisitorCToCpp::Wrap(visitor)); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefFrameCppToC::CefFrameCppToC(CefFrame* cls) + : CefCppToC(cls) { + struct_.struct_.is_valid = frame_is_valid; + struct_.struct_.undo = frame_undo; + struct_.struct_.redo = frame_redo; + struct_.struct_.cut = frame_cut; + struct_.struct_.copy = frame_copy; + struct_.struct_.paste = frame_paste; + struct_.struct_.del = frame_del; + struct_.struct_.select_all = frame_select_all; + struct_.struct_.view_source = frame_view_source; + struct_.struct_.get_source = frame_get_source; + struct_.struct_.get_text = frame_get_text; + struct_.struct_.load_request = frame_load_request; + struct_.struct_.load_url = frame_load_url; + struct_.struct_.load_string = frame_load_string; + struct_.struct_.execute_java_script = frame_execute_java_script; + struct_.struct_.is_main = frame_is_main; + struct_.struct_.is_focused = frame_is_focused; + struct_.struct_.get_name = frame_get_name; + struct_.struct_.get_identifier = frame_get_identifier; + struct_.struct_.get_parent = frame_get_parent; + struct_.struct_.get_url = frame_get_url; + struct_.struct_.get_browser = frame_get_browser; + struct_.struct_.get_v8context = frame_get_v8context; + struct_.struct_.visit_dom = frame_visit_dom; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = + 0; +#endif + diff --git a/libcef_dll/cpptoc/frame_cpptoc.h b/libcef_dll/cpptoc/frame_cpptoc.h new file mode 100644 index 000000000..0392777de --- /dev/null +++ b/libcef_dll/cpptoc/frame_cpptoc.h @@ -0,0 +1,40 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_FRAME_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_FRAME_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_frame.h" +#include "include/capi/cef_frame_capi.h" +#include "include/cef_browser.h" +#include "include/capi/cef_browser_capi.h" +#include "include/cef_v8.h" +#include "include/capi/cef_v8_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefFrameCppToC + : public CefCppToC { + public: + explicit CefFrameCppToC(CefFrame* cls); + virtual ~CefFrameCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_FRAME_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/geolocation_callback_cpptoc.cc b/libcef_dll/cpptoc/geolocation_callback_cpptoc.cc new file mode 100644 index 000000000..477aee284 --- /dev/null +++ b/libcef_dll/cpptoc/geolocation_callback_cpptoc.cc @@ -0,0 +1,45 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/geolocation_callback_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK geolocation_callback_cont( + struct _cef_geolocation_callback_t* self, int allow) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefGeolocationCallbackCppToC::Get(self)->Continue( + allow?true:false); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefGeolocationCallbackCppToC::CefGeolocationCallbackCppToC( + CefGeolocationCallback* cls) + : CefCppToC(cls) { + struct_.struct_.cont = geolocation_callback_cont; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/geolocation_callback_cpptoc.h b/libcef_dll/cpptoc/geolocation_callback_cpptoc.h new file mode 100644 index 000000000..b4f6d32e4 --- /dev/null +++ b/libcef_dll/cpptoc/geolocation_callback_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_CALLBACK_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_CALLBACK_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_geolocation_handler.h" +#include "include/capi/cef_geolocation_handler_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefGeolocationCallbackCppToC + : public CefCppToC { + public: + explicit CefGeolocationCallbackCppToC(CefGeolocationCallback* cls); + virtual ~CefGeolocationCallbackCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_CALLBACK_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/geolocation_handler_cpptoc.cc b/libcef_dll/cpptoc/geolocation_handler_cpptoc.cc new file mode 100644 index 000000000..432fc8e30 --- /dev/null +++ b/libcef_dll/cpptoc/geolocation_handler_cpptoc.cc @@ -0,0 +1,91 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/geolocation_handler_cpptoc.h" +#include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/geolocation_callback_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK geolocation_handler_on_request_geolocation_permission( + struct _cef_geolocation_handler_t* self, cef_browser_t* browser, + const cef_string_t* requesting_url, int request_id, + cef_geolocation_callback_t* callback) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: requesting_url; type: string_byref_const + DCHECK(requesting_url); + if (!requesting_url) + return; + // Verify param: callback; type: refptr_diff + DCHECK(callback); + if (!callback) + return; + + // Execute + CefGeolocationHandlerCppToC::Get(self)->OnRequestGeolocationPermission( + CefBrowserCToCpp::Wrap(browser), + CefString(requesting_url), + request_id, + CefGeolocationCallbackCToCpp::Wrap(callback)); +} + +void CEF_CALLBACK geolocation_handler_on_cancel_geolocation_permission( + struct _cef_geolocation_handler_t* self, cef_browser_t* browser, + const cef_string_t* requesting_url, int request_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: requesting_url; type: string_byref_const + DCHECK(requesting_url); + if (!requesting_url) + return; + + // Execute + CefGeolocationHandlerCppToC::Get(self)->OnCancelGeolocationPermission( + CefBrowserCToCpp::Wrap(browser), + CefString(requesting_url), + request_id); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefGeolocationHandlerCppToC::CefGeolocationHandlerCppToC( + CefGeolocationHandler* cls) + : CefCppToC(cls) { + struct_.struct_.on_request_geolocation_permission = + geolocation_handler_on_request_geolocation_permission; + struct_.struct_.on_cancel_geolocation_permission = + geolocation_handler_on_cancel_geolocation_permission; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/geolocation_handler_cpptoc.h b/libcef_dll/cpptoc/geolocation_handler_cpptoc.h new file mode 100644 index 000000000..9774ff4db --- /dev/null +++ b/libcef_dll/cpptoc/geolocation_handler_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_HANDLER_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_HANDLER_CPPTOC_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_geolocation_handler.h" +#include "include/capi/cef_geolocation_handler_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed wrapper-side only. +class CefGeolocationHandlerCppToC + : public CefCppToC { + public: + explicit CefGeolocationHandlerCppToC(CefGeolocationHandler* cls); + virtual ~CefGeolocationHandlerCppToC() {} +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_GEOLOCATION_HANDLER_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc b/libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc new file mode 100644 index 000000000..487d9a510 --- /dev/null +++ b/libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc @@ -0,0 +1,46 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/jsdialog_callback_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK jsdialog_callback_cont(struct _cef_jsdialog_callback_t* self, + int success, const cef_string_t* user_input) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Unverified params: user_input + + // Execute + CefJSDialogCallbackCppToC::Get(self)->Continue( + success?true:false, + CefString(user_input)); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefJSDialogCallbackCppToC::CefJSDialogCallbackCppToC(CefJSDialogCallback* cls) + : CefCppToC(cls) { + struct_.struct_.cont = jsdialog_callback_cont; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/jsdialog_callback_cpptoc.h b/libcef_dll/cpptoc/jsdialog_callback_cpptoc.h new file mode 100644 index 000000000..c6c7719ea --- /dev/null +++ b/libcef_dll/cpptoc/jsdialog_callback_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_JSDIALOG_CALLBACK_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_JSDIALOG_CALLBACK_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_jsdialog_handler.h" +#include "include/capi/cef_jsdialog_handler_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefJSDialogCallbackCppToC + : public CefCppToC { + public: + explicit CefJSDialogCallbackCppToC(CefJSDialogCallback* cls); + virtual ~CefJSDialogCallbackCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_JSDIALOG_CALLBACK_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc b/libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc new file mode 100644 index 000000000..b75d13c3a --- /dev/null +++ b/libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc @@ -0,0 +1,136 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h" +#include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/jsdialog_callback_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK jsdialog_handler_on_jsdialog( + struct _cef_jsdialog_handler_t* self, cef_browser_t* browser, + const cef_string_t* origin_url, const cef_string_t* accept_lang, + enum cef_jsdialog_type_t dialog_type, const cef_string_t* message_text, + const cef_string_t* default_prompt_text, cef_jsdialog_callback_t* callback, + int* suppress_message) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return 0; + // Verify param: origin_url; type: string_byref_const + DCHECK(origin_url); + if (!origin_url) + return 0; + // Verify param: callback; type: refptr_diff + DCHECK(callback); + if (!callback) + return 0; + // Verify param: suppress_message; type: bool_byref + DCHECK(suppress_message); + if (!suppress_message) + return 0; + // Unverified params: accept_lang, message_text, default_prompt_text + + // Translate param: suppress_message; type: bool_byref + bool suppress_messageBool = ( + suppress_message && *suppress_message)?true:false; + + // Execute + bool _retval = CefJSDialogHandlerCppToC::Get(self)->OnJSDialog( + CefBrowserCToCpp::Wrap(browser), + CefString(origin_url), + CefString(accept_lang), + dialog_type, + CefString(message_text), + CefString(default_prompt_text), + CefJSDialogCallbackCToCpp::Wrap(callback), + suppress_messageBool); + + // Restore param: suppress_message; type: bool_byref + if (suppress_message) + *suppress_message = suppress_messageBool?true:false; + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK jsdialog_handler_on_before_unload_dialog( + struct _cef_jsdialog_handler_t* self, cef_browser_t* browser, + const cef_string_t* message_text, int is_reload, + cef_jsdialog_callback_t* callback) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return 0; + // Verify param: callback; type: refptr_diff + DCHECK(callback); + if (!callback) + return 0; + // Unverified params: message_text + + // Execute + bool _retval = CefJSDialogHandlerCppToC::Get(self)->OnBeforeUnloadDialog( + CefBrowserCToCpp::Wrap(browser), + CefString(message_text), + is_reload?true:false, + CefJSDialogCallbackCToCpp::Wrap(callback)); + + // Return type: bool + return _retval; +} + +void CEF_CALLBACK jsdialog_handler_on_reset_dialog_state( + struct _cef_jsdialog_handler_t* self, cef_browser_t* browser) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + + // Execute + CefJSDialogHandlerCppToC::Get(self)->OnResetDialogState( + CefBrowserCToCpp::Wrap(browser)); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefJSDialogHandlerCppToC::CefJSDialogHandlerCppToC(CefJSDialogHandler* cls) + : CefCppToC(cls) { + struct_.struct_.on_jsdialog = jsdialog_handler_on_jsdialog; + struct_.struct_.on_before_unload_dialog = + jsdialog_handler_on_before_unload_dialog; + struct_.struct_.on_reset_dialog_state = + jsdialog_handler_on_reset_dialog_state; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/cef/libcef_dll/cpptoc/jsdialog_handler_cpptoc.h b/libcef_dll/cpptoc/jsdialog_handler_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/jsdialog_handler_cpptoc.h rename to libcef_dll/cpptoc/jsdialog_handler_cpptoc.h diff --git a/libcef_dll/cpptoc/keyboard_handler_cpptoc.cc b/libcef_dll/cpptoc/keyboard_handler_cpptoc.cc new file mode 100644 index 000000000..95779c88b --- /dev/null +++ b/libcef_dll/cpptoc/keyboard_handler_cpptoc.cc @@ -0,0 +1,110 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h" +#include "libcef_dll/ctocpp/browser_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK keyboard_handler_on_pre_key_event( + struct _cef_keyboard_handler_t* self, cef_browser_t* browser, + const struct _cef_key_event_t* event, cef_event_handle_t os_event, + int* is_keyboard_shortcut) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return 0; + // Verify param: event; type: struct_byref_const + DCHECK(event); + if (!event) + return 0; + // Verify param: is_keyboard_shortcut; type: bool_byaddr + DCHECK(is_keyboard_shortcut); + if (!is_keyboard_shortcut) + return 0; + + // Translate param: event; type: struct_byref_const + CefKeyEvent eventObj; + if (event) + eventObj.Set(*event, false); + // Translate param: is_keyboard_shortcut; type: bool_byaddr + bool is_keyboard_shortcutBool = ( + is_keyboard_shortcut && *is_keyboard_shortcut)?true:false; + + // Execute + bool _retval = CefKeyboardHandlerCppToC::Get(self)->OnPreKeyEvent( + CefBrowserCToCpp::Wrap(browser), + eventObj, + os_event, + &is_keyboard_shortcutBool); + + // Restore param: is_keyboard_shortcut; type: bool_byaddr + if (is_keyboard_shortcut) + *is_keyboard_shortcut = is_keyboard_shortcutBool?true:false; + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK keyboard_handler_on_key_event( + struct _cef_keyboard_handler_t* self, cef_browser_t* browser, + const struct _cef_key_event_t* event, cef_event_handle_t os_event) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return 0; + // Verify param: event; type: struct_byref_const + DCHECK(event); + if (!event) + return 0; + + // Translate param: event; type: struct_byref_const + CefKeyEvent eventObj; + if (event) + eventObj.Set(*event, false); + + // Execute + bool _retval = CefKeyboardHandlerCppToC::Get(self)->OnKeyEvent( + CefBrowserCToCpp::Wrap(browser), + eventObj, + os_event); + + // Return type: bool + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefKeyboardHandlerCppToC::CefKeyboardHandlerCppToC(CefKeyboardHandler* cls) + : CefCppToC(cls) { + struct_.struct_.on_pre_key_event = keyboard_handler_on_pre_key_event; + struct_.struct_.on_key_event = keyboard_handler_on_key_event; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/cef/libcef_dll/cpptoc/keyboard_handler_cpptoc.h b/libcef_dll/cpptoc/keyboard_handler_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/keyboard_handler_cpptoc.h rename to libcef_dll/cpptoc/keyboard_handler_cpptoc.h diff --git a/cef/libcef_dll/cpptoc/life_span_handler_cpptoc.cc b/libcef_dll/cpptoc/life_span_handler_cpptoc.cc similarity index 100% rename from cef/libcef_dll/cpptoc/life_span_handler_cpptoc.cc rename to libcef_dll/cpptoc/life_span_handler_cpptoc.cc diff --git a/cef/libcef_dll/cpptoc/life_span_handler_cpptoc.h b/libcef_dll/cpptoc/life_span_handler_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/life_span_handler_cpptoc.h rename to libcef_dll/cpptoc/life_span_handler_cpptoc.h diff --git a/libcef_dll/cpptoc/list_value_cpptoc.cc b/libcef_dll/cpptoc/list_value_cpptoc.cc new file mode 100644 index 000000000..6682a92fc --- /dev/null +++ b/libcef_dll/cpptoc/list_value_cpptoc.cc @@ -0,0 +1,528 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/binary_value_cpptoc.h" +#include "libcef_dll/cpptoc/dictionary_value_cpptoc.h" +#include "libcef_dll/cpptoc/list_value_cpptoc.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_list_value_t* cef_list_value_create() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefListValue::Create(); + + // Return type: refptr_same + return CefListValueCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK list_value_is_valid(struct _cef_list_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->IsValid(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK list_value_is_owned(struct _cef_list_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->IsOwned(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK list_value_is_read_only(struct _cef_list_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->IsReadOnly(); + + // Return type: bool + return _retval; +} + +struct _cef_list_value_t* CEF_CALLBACK list_value_copy( + struct _cef_list_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefListValueCppToC::Get(self)->Copy(); + + // Return type: refptr_same + return CefListValueCppToC::Wrap(_retval); +} + +int CEF_CALLBACK list_value_set_size(struct _cef_list_value_t* self, + size_t size) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->SetSize( + size); + + // Return type: bool + return _retval; +} + +size_t CEF_CALLBACK list_value_get_size(struct _cef_list_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + size_t _retval = CefListValueCppToC::Get(self)->GetSize(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK list_value_clear(struct _cef_list_value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->Clear(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK list_value_remove(struct _cef_list_value_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->Remove( + index); + + // Return type: bool + return _retval; +} + +enum cef_value_type_t CEF_CALLBACK list_value_get_type( + struct _cef_list_value_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return VTYPE_INVALID; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return VTYPE_INVALID; + + // Execute + cef_value_type_t _retval = CefListValueCppToC::Get(self)->GetType( + index); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK list_value_get_bool(struct _cef_list_value_t* self, + int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->GetBool( + index); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK list_value_get_int(struct _cef_list_value_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + + // Execute + int _retval = CefListValueCppToC::Get(self)->GetInt( + index); + + // Return type: simple + return _retval; +} + +double CEF_CALLBACK list_value_get_double(struct _cef_list_value_t* self, + int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + + // Execute + double _retval = CefListValueCppToC::Get(self)->GetDouble( + index); + + // Return type: simple + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK list_value_get_string( + struct _cef_list_value_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return NULL; + + // Execute + CefString _retval = CefListValueCppToC::Get(self)->GetString( + index); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_binary_value_t* CEF_CALLBACK list_value_get_binary( + struct _cef_list_value_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return NULL; + + // Execute + CefRefPtr _retval = CefListValueCppToC::Get(self)->GetBinary( + index); + + // Return type: refptr_same + return CefBinaryValueCppToC::Wrap(_retval); +} + +cef_dictionary_value_t* CEF_CALLBACK list_value_get_dictionary( + struct _cef_list_value_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return NULL; + + // Execute + CefRefPtr _retval = CefListValueCppToC::Get( + self)->GetDictionary( + index); + + // Return type: refptr_same + return CefDictionaryValueCppToC::Wrap(_retval); +} + +struct _cef_list_value_t* CEF_CALLBACK list_value_get_list( + struct _cef_list_value_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return NULL; + + // Execute + CefRefPtr _retval = CefListValueCppToC::Get(self)->GetList( + index); + + // Return type: refptr_same + return CefListValueCppToC::Wrap(_retval); +} + +int CEF_CALLBACK list_value_set_null(struct _cef_list_value_t* self, + int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->SetNull( + index); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK list_value_set_bool(struct _cef_list_value_t* self, int index, + int value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->SetBool( + index, + value?true:false); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK list_value_set_int(struct _cef_list_value_t* self, int index, + int value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->SetInt( + index, + value); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK list_value_set_double(struct _cef_list_value_t* self, + int index, double value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->SetDouble( + index, + value); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK list_value_set_string(struct _cef_list_value_t* self, + int index, const cef_string_t* value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + // Unverified params: value + + // Execute + bool _retval = CefListValueCppToC::Get(self)->SetString( + index, + CefString(value)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK list_value_set_binary(struct _cef_list_value_t* self, + int index, cef_binary_value_t* value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + // Verify param: value; type: refptr_same + DCHECK(value); + if (!value) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->SetBinary( + index, + CefBinaryValueCppToC::Unwrap(value)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK list_value_set_dictionary(struct _cef_list_value_t* self, + int index, cef_dictionary_value_t* value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + // Verify param: value; type: refptr_same + DCHECK(value); + if (!value) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->SetDictionary( + index, + CefDictionaryValueCppToC::Unwrap(value)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK list_value_set_list(struct _cef_list_value_t* self, int index, + struct _cef_list_value_t* value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + // Verify param: value; type: refptr_same + DCHECK(value); + if (!value) + return 0; + + // Execute + bool _retval = CefListValueCppToC::Get(self)->SetList( + index, + CefListValueCppToC::Unwrap(value)); + + // Return type: bool + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefListValueCppToC::CefListValueCppToC(CefListValue* cls) + : CefCppToC(cls) { + struct_.struct_.is_valid = list_value_is_valid; + struct_.struct_.is_owned = list_value_is_owned; + struct_.struct_.is_read_only = list_value_is_read_only; + struct_.struct_.copy = list_value_copy; + struct_.struct_.set_size = list_value_set_size; + struct_.struct_.get_size = list_value_get_size; + struct_.struct_.clear = list_value_clear; + struct_.struct_.remove = list_value_remove; + struct_.struct_.get_type = list_value_get_type; + struct_.struct_.get_bool = list_value_get_bool; + struct_.struct_.get_int = list_value_get_int; + struct_.struct_.get_double = list_value_get_double; + struct_.struct_.get_string = list_value_get_string; + struct_.struct_.get_binary = list_value_get_binary; + struct_.struct_.get_dictionary = list_value_get_dictionary; + struct_.struct_.get_list = list_value_get_list; + struct_.struct_.set_null = list_value_set_null; + struct_.struct_.set_bool = list_value_set_bool; + struct_.struct_.set_int = list_value_set_int; + struct_.struct_.set_double = list_value_set_double; + struct_.struct_.set_string = list_value_set_string; + struct_.struct_.set_binary = list_value_set_binary; + struct_.struct_.set_dictionary = list_value_set_dictionary; + struct_.struct_.set_list = list_value_set_list; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/list_value_cpptoc.h b/libcef_dll/cpptoc/list_value_cpptoc.h new file mode 100644 index 000000000..a38f90335 --- /dev/null +++ b/libcef_dll/cpptoc/list_value_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_LIST_VALUE_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_LIST_VALUE_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_values.h" +#include "include/capi/cef_values_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefListValueCppToC + : public CefCppToC { + public: + explicit CefListValueCppToC(CefListValue* cls); + virtual ~CefListValueCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_LIST_VALUE_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/load_handler_cpptoc.cc b/libcef_dll/cpptoc/load_handler_cpptoc.cc new file mode 100644 index 000000000..c68f442cd --- /dev/null +++ b/libcef_dll/cpptoc/load_handler_cpptoc.cc @@ -0,0 +1,155 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/load_handler_cpptoc.h" +#include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/frame_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK load_handler_on_load_start(struct _cef_load_handler_t* self, + cef_browser_t* browser, cef_frame_t* frame) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame); + if (!frame) + return; + + // Execute + CefLoadHandlerCppToC::Get(self)->OnLoadStart( + CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame)); +} + +void CEF_CALLBACK load_handler_on_load_end(struct _cef_load_handler_t* self, + cef_browser_t* browser, cef_frame_t* frame, int httpStatusCode) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame); + if (!frame) + return; + + // Execute + CefLoadHandlerCppToC::Get(self)->OnLoadEnd( + CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame), + httpStatusCode); +} + +void CEF_CALLBACK load_handler_on_load_error(struct _cef_load_handler_t* self, + cef_browser_t* browser, cef_frame_t* frame, enum cef_errorcode_t errorCode, + const cef_string_t* errorText, const cef_string_t* failedUrl) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame); + if (!frame) + return; + // Verify param: failedUrl; type: string_byref_const + DCHECK(failedUrl); + if (!failedUrl) + return; + // Unverified params: errorText + + // Execute + CefLoadHandlerCppToC::Get(self)->OnLoadError( + CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame), + errorCode, + CefString(errorText), + CefString(failedUrl)); +} + +void CEF_CALLBACK load_handler_on_render_process_terminated( + struct _cef_load_handler_t* self, cef_browser_t* browser, + enum cef_termination_status_t status) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + + // Execute + CefLoadHandlerCppToC::Get(self)->OnRenderProcessTerminated( + CefBrowserCToCpp::Wrap(browser), + status); +} + +void CEF_CALLBACK load_handler_on_plugin_crashed( + struct _cef_load_handler_t* self, cef_browser_t* browser, + const cef_string_t* plugin_path) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: plugin_path; type: string_byref_const + DCHECK(plugin_path); + if (!plugin_path) + return; + + // Execute + CefLoadHandlerCppToC::Get(self)->OnPluginCrashed( + CefBrowserCToCpp::Wrap(browser), + CefString(plugin_path)); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefLoadHandlerCppToC::CefLoadHandlerCppToC(CefLoadHandler* cls) + : CefCppToC(cls) { + struct_.struct_.on_load_start = load_handler_on_load_start; + struct_.struct_.on_load_end = load_handler_on_load_end; + struct_.struct_.on_load_error = load_handler_on_load_error; + struct_.struct_.on_render_process_terminated = + load_handler_on_render_process_terminated; + struct_.struct_.on_plugin_crashed = load_handler_on_plugin_crashed; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/cef/libcef_dll/cpptoc/load_handler_cpptoc.h b/libcef_dll/cpptoc/load_handler_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/load_handler_cpptoc.h rename to libcef_dll/cpptoc/load_handler_cpptoc.h diff --git a/libcef_dll/cpptoc/menu_model_cpptoc.cc b/libcef_dll/cpptoc/menu_model_cpptoc.cc new file mode 100644 index 000000000..95519c86a --- /dev/null +++ b/libcef_dll/cpptoc/menu_model_cpptoc.cc @@ -0,0 +1,1020 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/menu_model_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK menu_model_clear(struct _cef_menu_model_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->Clear(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_get_count(struct _cef_menu_model_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefMenuModelCppToC::Get(self)->GetCount(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK menu_model_add_separator(struct _cef_menu_model_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->AddSeparator(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_add_item(struct _cef_menu_model_t* self, + int command_id, const cef_string_t* label) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: label; type: string_byref_const + DCHECK(label); + if (!label) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->AddItem( + command_id, + CefString(label)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_add_check_item(struct _cef_menu_model_t* self, + int command_id, const cef_string_t* label) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: label; type: string_byref_const + DCHECK(label); + if (!label) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->AddCheckItem( + command_id, + CefString(label)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_add_radio_item(struct _cef_menu_model_t* self, + int command_id, const cef_string_t* label, int group_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: label; type: string_byref_const + DCHECK(label); + if (!label) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->AddRadioItem( + command_id, + CefString(label), + group_id); + + // Return type: bool + return _retval; +} + +struct _cef_menu_model_t* CEF_CALLBACK menu_model_add_sub_menu( + struct _cef_menu_model_t* self, int command_id, + const cef_string_t* label) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: label; type: string_byref_const + DCHECK(label); + if (!label) + return NULL; + + // Execute + CefRefPtr _retval = CefMenuModelCppToC::Get(self)->AddSubMenu( + command_id, + CefString(label)); + + // Return type: refptr_same + return CefMenuModelCppToC::Wrap(_retval); +} + +int CEF_CALLBACK menu_model_insert_separator_at(struct _cef_menu_model_t* self, + int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->InsertSeparatorAt( + index); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_insert_item_at(struct _cef_menu_model_t* self, + int index, int command_id, const cef_string_t* label) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: label; type: string_byref_const + DCHECK(label); + if (!label) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->InsertItemAt( + index, + command_id, + CefString(label)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_insert_check_item_at(struct _cef_menu_model_t* self, + int index, int command_id, const cef_string_t* label) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: label; type: string_byref_const + DCHECK(label); + if (!label) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->InsertCheckItemAt( + index, + command_id, + CefString(label)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_insert_radio_item_at(struct _cef_menu_model_t* self, + int index, int command_id, const cef_string_t* label, int group_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: label; type: string_byref_const + DCHECK(label); + if (!label) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->InsertRadioItemAt( + index, + command_id, + CefString(label), + group_id); + + // Return type: bool + return _retval; +} + +struct _cef_menu_model_t* CEF_CALLBACK menu_model_insert_sub_menu_at( + struct _cef_menu_model_t* self, int index, int command_id, + const cef_string_t* label) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: label; type: string_byref_const + DCHECK(label); + if (!label) + return NULL; + + // Execute + CefRefPtr _retval = CefMenuModelCppToC::Get( + self)->InsertSubMenuAt( + index, + command_id, + CefString(label)); + + // Return type: refptr_same + return CefMenuModelCppToC::Wrap(_retval); +} + +int CEF_CALLBACK menu_model_remove(struct _cef_menu_model_t* self, + int command_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->Remove( + command_id); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_remove_at(struct _cef_menu_model_t* self, + int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->RemoveAt( + index); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_get_index_of(struct _cef_menu_model_t* self, + int command_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefMenuModelCppToC::Get(self)->GetIndexOf( + command_id); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK menu_model_get_command_id_at(struct _cef_menu_model_t* self, + int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefMenuModelCppToC::Get(self)->GetCommandIdAt( + index); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK menu_model_set_command_id_at(struct _cef_menu_model_t* self, + int index, int command_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->SetCommandIdAt( + index, + command_id); + + // Return type: bool + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK menu_model_get_label( + struct _cef_menu_model_t* self, int command_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefMenuModelCppToC::Get(self)->GetLabel( + command_id); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK menu_model_get_label_at( + struct _cef_menu_model_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefMenuModelCppToC::Get(self)->GetLabelAt( + index); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int CEF_CALLBACK menu_model_set_label(struct _cef_menu_model_t* self, + int command_id, const cef_string_t* label) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: label; type: string_byref_const + DCHECK(label); + if (!label) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->SetLabel( + command_id, + CefString(label)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_set_label_at(struct _cef_menu_model_t* self, + int index, const cef_string_t* label) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: label; type: string_byref_const + DCHECK(label); + if (!label) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->SetLabelAt( + index, + CefString(label)); + + // Return type: bool + return _retval; +} + +enum cef_menu_item_type_t CEF_CALLBACK menu_model_get_type( + struct _cef_menu_model_t* self, int command_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return MENUITEMTYPE_NONE; + + // Execute + cef_menu_item_type_t _retval = CefMenuModelCppToC::Get(self)->GetType( + command_id); + + // Return type: simple + return _retval; +} + +enum cef_menu_item_type_t CEF_CALLBACK menu_model_get_type_at( + struct _cef_menu_model_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return MENUITEMTYPE_NONE; + + // Execute + cef_menu_item_type_t _retval = CefMenuModelCppToC::Get(self)->GetTypeAt( + index); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK menu_model_get_group_id(struct _cef_menu_model_t* self, + int command_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefMenuModelCppToC::Get(self)->GetGroupId( + command_id); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK menu_model_get_group_id_at(struct _cef_menu_model_t* self, + int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefMenuModelCppToC::Get(self)->GetGroupIdAt( + index); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK menu_model_set_group_id(struct _cef_menu_model_t* self, + int command_id, int group_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->SetGroupId( + command_id, + group_id); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_set_group_id_at(struct _cef_menu_model_t* self, + int index, int group_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->SetGroupIdAt( + index, + group_id); + + // Return type: bool + return _retval; +} + +struct _cef_menu_model_t* CEF_CALLBACK menu_model_get_sub_menu( + struct _cef_menu_model_t* self, int command_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefMenuModelCppToC::Get(self)->GetSubMenu( + command_id); + + // Return type: refptr_same + return CefMenuModelCppToC::Wrap(_retval); +} + +struct _cef_menu_model_t* CEF_CALLBACK menu_model_get_sub_menu_at( + struct _cef_menu_model_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefMenuModelCppToC::Get(self)->GetSubMenuAt( + index); + + // Return type: refptr_same + return CefMenuModelCppToC::Wrap(_retval); +} + +int CEF_CALLBACK menu_model_is_visible(struct _cef_menu_model_t* self, + int command_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->IsVisible( + command_id); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_is_visible_at(struct _cef_menu_model_t* self, + int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->IsVisibleAt( + index); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_set_visible(struct _cef_menu_model_t* self, + int command_id, int visible) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->SetVisible( + command_id, + visible?true:false); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_set_visible_at(struct _cef_menu_model_t* self, + int index, int visible) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->SetVisibleAt( + index, + visible?true:false); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_is_enabled(struct _cef_menu_model_t* self, + int command_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->IsEnabled( + command_id); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_is_enabled_at(struct _cef_menu_model_t* self, + int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->IsEnabledAt( + index); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_set_enabled(struct _cef_menu_model_t* self, + int command_id, int enabled) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->SetEnabled( + command_id, + enabled?true:false); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_set_enabled_at(struct _cef_menu_model_t* self, + int index, int enabled) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->SetEnabledAt( + index, + enabled?true:false); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_is_checked(struct _cef_menu_model_t* self, + int command_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->IsChecked( + command_id); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_is_checked_at(struct _cef_menu_model_t* self, + int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->IsCheckedAt( + index); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_set_checked(struct _cef_menu_model_t* self, + int command_id, int checked) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->SetChecked( + command_id, + checked?true:false); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_set_checked_at(struct _cef_menu_model_t* self, + int index, int checked) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->SetCheckedAt( + index, + checked?true:false); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_has_accelerator(struct _cef_menu_model_t* self, + int command_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->HasAccelerator( + command_id); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_has_accelerator_at(struct _cef_menu_model_t* self, + int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->HasAcceleratorAt( + index); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_set_accelerator(struct _cef_menu_model_t* self, + int command_id, int key_code, int shift_pressed, int ctrl_pressed, + int alt_pressed) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->SetAccelerator( + command_id, + key_code, + shift_pressed?true:false, + ctrl_pressed?true:false, + alt_pressed?true:false); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_set_accelerator_at(struct _cef_menu_model_t* self, + int index, int key_code, int shift_pressed, int ctrl_pressed, + int alt_pressed) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->SetAcceleratorAt( + index, + key_code, + shift_pressed?true:false, + ctrl_pressed?true:false, + alt_pressed?true:false); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_remove_accelerator(struct _cef_menu_model_t* self, + int command_id) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->RemoveAccelerator( + command_id); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_remove_accelerator_at( + struct _cef_menu_model_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->RemoveAcceleratorAt( + index); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_get_accelerator(struct _cef_menu_model_t* self, + int command_id, int* key_code, int* shift_pressed, int* ctrl_pressed, + int* alt_pressed) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key_code; type: simple_byref + DCHECK(key_code); + if (!key_code) + return 0; + // Verify param: shift_pressed; type: bool_byref + DCHECK(shift_pressed); + if (!shift_pressed) + return 0; + // Verify param: ctrl_pressed; type: bool_byref + DCHECK(ctrl_pressed); + if (!ctrl_pressed) + return 0; + // Verify param: alt_pressed; type: bool_byref + DCHECK(alt_pressed); + if (!alt_pressed) + return 0; + + // Translate param: key_code; type: simple_byref + int key_codeVal = key_code?*key_code:0; + // Translate param: shift_pressed; type: bool_byref + bool shift_pressedBool = (shift_pressed && *shift_pressed)?true:false; + // Translate param: ctrl_pressed; type: bool_byref + bool ctrl_pressedBool = (ctrl_pressed && *ctrl_pressed)?true:false; + // Translate param: alt_pressed; type: bool_byref + bool alt_pressedBool = (alt_pressed && *alt_pressed)?true:false; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->GetAccelerator( + command_id, + key_codeVal, + shift_pressedBool, + ctrl_pressedBool, + alt_pressedBool); + + // Restore param: key_code; type: simple_byref + if (key_code) + *key_code = key_codeVal; + // Restore param: shift_pressed; type: bool_byref + if (shift_pressed) + *shift_pressed = shift_pressedBool?true:false; + // Restore param: ctrl_pressed; type: bool_byref + if (ctrl_pressed) + *ctrl_pressed = ctrl_pressedBool?true:false; + // Restore param: alt_pressed; type: bool_byref + if (alt_pressed) + *alt_pressed = alt_pressedBool?true:false; + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK menu_model_get_accelerator_at(struct _cef_menu_model_t* self, + int index, int* key_code, int* shift_pressed, int* ctrl_pressed, + int* alt_pressed) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key_code; type: simple_byref + DCHECK(key_code); + if (!key_code) + return 0; + // Verify param: shift_pressed; type: bool_byref + DCHECK(shift_pressed); + if (!shift_pressed) + return 0; + // Verify param: ctrl_pressed; type: bool_byref + DCHECK(ctrl_pressed); + if (!ctrl_pressed) + return 0; + // Verify param: alt_pressed; type: bool_byref + DCHECK(alt_pressed); + if (!alt_pressed) + return 0; + + // Translate param: key_code; type: simple_byref + int key_codeVal = key_code?*key_code:0; + // Translate param: shift_pressed; type: bool_byref + bool shift_pressedBool = (shift_pressed && *shift_pressed)?true:false; + // Translate param: ctrl_pressed; type: bool_byref + bool ctrl_pressedBool = (ctrl_pressed && *ctrl_pressed)?true:false; + // Translate param: alt_pressed; type: bool_byref + bool alt_pressedBool = (alt_pressed && *alt_pressed)?true:false; + + // Execute + bool _retval = CefMenuModelCppToC::Get(self)->GetAcceleratorAt( + index, + key_codeVal, + shift_pressedBool, + ctrl_pressedBool, + alt_pressedBool); + + // Restore param: key_code; type: simple_byref + if (key_code) + *key_code = key_codeVal; + // Restore param: shift_pressed; type: bool_byref + if (shift_pressed) + *shift_pressed = shift_pressedBool?true:false; + // Restore param: ctrl_pressed; type: bool_byref + if (ctrl_pressed) + *ctrl_pressed = ctrl_pressedBool?true:false; + // Restore param: alt_pressed; type: bool_byref + if (alt_pressed) + *alt_pressed = alt_pressedBool?true:false; + + // Return type: bool + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefMenuModelCppToC::CefMenuModelCppToC(CefMenuModel* cls) + : CefCppToC(cls) { + struct_.struct_.clear = menu_model_clear; + struct_.struct_.get_count = menu_model_get_count; + struct_.struct_.add_separator = menu_model_add_separator; + struct_.struct_.add_item = menu_model_add_item; + struct_.struct_.add_check_item = menu_model_add_check_item; + struct_.struct_.add_radio_item = menu_model_add_radio_item; + struct_.struct_.add_sub_menu = menu_model_add_sub_menu; + struct_.struct_.insert_separator_at = menu_model_insert_separator_at; + struct_.struct_.insert_item_at = menu_model_insert_item_at; + struct_.struct_.insert_check_item_at = menu_model_insert_check_item_at; + struct_.struct_.insert_radio_item_at = menu_model_insert_radio_item_at; + struct_.struct_.insert_sub_menu_at = menu_model_insert_sub_menu_at; + struct_.struct_.remove = menu_model_remove; + struct_.struct_.remove_at = menu_model_remove_at; + struct_.struct_.get_index_of = menu_model_get_index_of; + struct_.struct_.get_command_id_at = menu_model_get_command_id_at; + struct_.struct_.set_command_id_at = menu_model_set_command_id_at; + struct_.struct_.get_label = menu_model_get_label; + struct_.struct_.get_label_at = menu_model_get_label_at; + struct_.struct_.set_label = menu_model_set_label; + struct_.struct_.set_label_at = menu_model_set_label_at; + struct_.struct_.get_type = menu_model_get_type; + struct_.struct_.get_type_at = menu_model_get_type_at; + struct_.struct_.get_group_id = menu_model_get_group_id; + struct_.struct_.get_group_id_at = menu_model_get_group_id_at; + struct_.struct_.set_group_id = menu_model_set_group_id; + struct_.struct_.set_group_id_at = menu_model_set_group_id_at; + struct_.struct_.get_sub_menu = menu_model_get_sub_menu; + struct_.struct_.get_sub_menu_at = menu_model_get_sub_menu_at; + struct_.struct_.is_visible = menu_model_is_visible; + struct_.struct_.is_visible_at = menu_model_is_visible_at; + struct_.struct_.set_visible = menu_model_set_visible; + struct_.struct_.set_visible_at = menu_model_set_visible_at; + struct_.struct_.is_enabled = menu_model_is_enabled; + struct_.struct_.is_enabled_at = menu_model_is_enabled_at; + struct_.struct_.set_enabled = menu_model_set_enabled; + struct_.struct_.set_enabled_at = menu_model_set_enabled_at; + struct_.struct_.is_checked = menu_model_is_checked; + struct_.struct_.is_checked_at = menu_model_is_checked_at; + struct_.struct_.set_checked = menu_model_set_checked; + struct_.struct_.set_checked_at = menu_model_set_checked_at; + struct_.struct_.has_accelerator = menu_model_has_accelerator; + struct_.struct_.has_accelerator_at = menu_model_has_accelerator_at; + struct_.struct_.set_accelerator = menu_model_set_accelerator; + struct_.struct_.set_accelerator_at = menu_model_set_accelerator_at; + struct_.struct_.remove_accelerator = menu_model_remove_accelerator; + struct_.struct_.remove_accelerator_at = menu_model_remove_accelerator_at; + struct_.struct_.get_accelerator = menu_model_get_accelerator; + struct_.struct_.get_accelerator_at = menu_model_get_accelerator_at; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/menu_model_cpptoc.h b/libcef_dll/cpptoc/menu_model_cpptoc.h new file mode 100644 index 000000000..35c6149dc --- /dev/null +++ b/libcef_dll/cpptoc/menu_model_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_MENU_MODEL_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_MENU_MODEL_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_menu_model.h" +#include "include/capi/cef_menu_model_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefMenuModelCppToC + : public CefCppToC { + public: + explicit CefMenuModelCppToC(CefMenuModel* cls); + virtual ~CefMenuModelCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_MENU_MODEL_CPPTOC_H_ + diff --git a/cef/libcef_dll/cpptoc/permission_handler_cpptoc.cc b/libcef_dll/cpptoc/permission_handler_cpptoc.cc similarity index 100% rename from cef/libcef_dll/cpptoc/permission_handler_cpptoc.cc rename to libcef_dll/cpptoc/permission_handler_cpptoc.cc diff --git a/cef/libcef_dll/cpptoc/permission_handler_cpptoc.h b/libcef_dll/cpptoc/permission_handler_cpptoc.h similarity index 90% rename from cef/libcef_dll/cpptoc/permission_handler_cpptoc.h rename to libcef_dll/cpptoc/permission_handler_cpptoc.h index a7e2f44af..6c8d2f86d 100644 --- a/cef/libcef_dll/cpptoc/permission_handler_cpptoc.h +++ b/libcef_dll/cpptoc/permission_handler_cpptoc.h @@ -20,6 +20,10 @@ #include "include/cef_permission_handler.h" #include "include/capi/cef_permission_handler_capi.h" +#include "include/cef_browser.h" +#include "include/capi/cef_browser_capi.h" +#include "include/cef_frame.h" +#include "include/capi/cef_frame_capi.h" #include "libcef_dll/cpptoc/cpptoc.h" // Wrap a C++ class with a C structure. diff --git a/libcef_dll/cpptoc/post_data_cpptoc.cc b/libcef_dll/cpptoc/post_data_cpptoc.cc new file mode 100644 index 000000000..bf51e349c --- /dev/null +++ b/libcef_dll/cpptoc/post_data_cpptoc.cc @@ -0,0 +1,163 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/post_data_cpptoc.h" +#include "libcef_dll/cpptoc/post_data_element_cpptoc.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_post_data_t* cef_post_data_create() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefPostData::Create(); + + // Return type: refptr_same + return CefPostDataCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK post_data_is_read_only(struct _cef_post_data_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefPostDataCppToC::Get(self)->IsReadOnly(); + + // Return type: bool + return _retval; +} + +size_t CEF_CALLBACK post_data_get_element_count(struct _cef_post_data_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + size_t _retval = CefPostDataCppToC::Get(self)->GetElementCount(); + + // Return type: simple + return _retval; +} + +void CEF_CALLBACK post_data_get_elements(struct _cef_post_data_t* self, + size_t* elementsCount, struct _cef_post_data_element_t** elements) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: elements; type: refptr_vec_same_byref + DCHECK(elementsCount && (*elementsCount == 0 || elements)); + if (!elementsCount || (*elementsCount > 0 && !elements)) + return; + + // Translate param: elements; type: refptr_vec_same_byref + std::vector > elementsList; + if (elementsCount && *elementsCount > 0 && elements) { + for (size_t i = 0; i < *elementsCount; ++i) { + elementsList.push_back(CefPostDataElementCppToC::Unwrap(elements[i])); + } + } + + // Execute + CefPostDataCppToC::Get(self)->GetElements( + elementsList); + + // Restore param: elements; type: refptr_vec_same_byref + if (elementsCount && elements) { + *elementsCount = std::min(elementsList.size(), *elementsCount); + if (*elementsCount > 0) { + for (size_t i = 0; i < *elementsCount; ++i) { + elements[i] = CefPostDataElementCppToC::Wrap(elementsList[i]); + } + } + } +} + +int CEF_CALLBACK post_data_remove_element(struct _cef_post_data_t* self, + struct _cef_post_data_element_t* element) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: element; type: refptr_same + DCHECK(element); + if (!element) + return 0; + + // Execute + bool _retval = CefPostDataCppToC::Get(self)->RemoveElement( + CefPostDataElementCppToC::Unwrap(element)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK post_data_add_element(struct _cef_post_data_t* self, + struct _cef_post_data_element_t* element) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: element; type: refptr_same + DCHECK(element); + if (!element) + return 0; + + // Execute + bool _retval = CefPostDataCppToC::Get(self)->AddElement( + CefPostDataElementCppToC::Unwrap(element)); + + // Return type: bool + return _retval; +} + +void CEF_CALLBACK post_data_remove_elements(struct _cef_post_data_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefPostDataCppToC::Get(self)->RemoveElements(); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefPostDataCppToC::CefPostDataCppToC(CefPostData* cls) + : CefCppToC(cls) { + struct_.struct_.is_read_only = post_data_is_read_only; + struct_.struct_.get_element_count = post_data_get_element_count; + struct_.struct_.get_elements = post_data_get_elements; + struct_.struct_.remove_element = post_data_remove_element; + struct_.struct_.add_element = post_data_add_element; + struct_.struct_.remove_elements = post_data_remove_elements; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/post_data_cpptoc.h b/libcef_dll/cpptoc/post_data_cpptoc.h new file mode 100644 index 000000000..a97ebbecc --- /dev/null +++ b/libcef_dll/cpptoc/post_data_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_POST_DATA_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_POST_DATA_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_request.h" +#include "include/capi/cef_request_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefPostDataCppToC + : public CefCppToC { + public: + explicit CefPostDataCppToC(CefPostData* cls); + virtual ~CefPostDataCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_POST_DATA_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/post_data_element_cpptoc.cc b/libcef_dll/cpptoc/post_data_element_cpptoc.cc new file mode 100644 index 000000000..8a3eca338 --- /dev/null +++ b/libcef_dll/cpptoc/post_data_element_cpptoc.cc @@ -0,0 +1,180 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/post_data_element_cpptoc.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_post_data_element_t* cef_post_data_element_create() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefPostDataElement::Create(); + + // Return type: refptr_same + return CefPostDataElementCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK post_data_element_is_read_only( + struct _cef_post_data_element_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefPostDataElementCppToC::Get(self)->IsReadOnly(); + + // Return type: bool + return _retval; +} + +void CEF_CALLBACK post_data_element_set_to_empty( + struct _cef_post_data_element_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefPostDataElementCppToC::Get(self)->SetToEmpty(); +} + +void CEF_CALLBACK post_data_element_set_to_file( + struct _cef_post_data_element_t* self, const cef_string_t* fileName) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: fileName; type: string_byref_const + DCHECK(fileName); + if (!fileName) + return; + + // Execute + CefPostDataElementCppToC::Get(self)->SetToFile( + CefString(fileName)); +} + +void CEF_CALLBACK post_data_element_set_to_bytes( + struct _cef_post_data_element_t* self, size_t size, const void* bytes) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: bytes; type: simple_byaddr + DCHECK(bytes); + if (!bytes) + return; + + // Execute + CefPostDataElementCppToC::Get(self)->SetToBytes( + size, + bytes); +} + +enum cef_postdataelement_type_t CEF_CALLBACK post_data_element_get_type( + struct _cef_post_data_element_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return PDE_TYPE_EMPTY; + + // Execute + cef_postdataelement_type_t _retval = CefPostDataElementCppToC::Get( + self)->GetType(); + + // Return type: simple + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK post_data_element_get_file( + struct _cef_post_data_element_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefPostDataElementCppToC::Get(self)->GetFile(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +size_t CEF_CALLBACK post_data_element_get_bytes_count( + struct _cef_post_data_element_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + size_t _retval = CefPostDataElementCppToC::Get(self)->GetBytesCount(); + + // Return type: simple + return _retval; +} + +size_t CEF_CALLBACK post_data_element_get_bytes( + struct _cef_post_data_element_t* self, size_t size, void* bytes) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: bytes; type: simple_byaddr + DCHECK(bytes); + if (!bytes) + return 0; + + // Execute + size_t _retval = CefPostDataElementCppToC::Get(self)->GetBytes( + size, + bytes); + + // Return type: simple + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefPostDataElementCppToC::CefPostDataElementCppToC(CefPostDataElement* cls) + : CefCppToC(cls) { + struct_.struct_.is_read_only = post_data_element_is_read_only; + struct_.struct_.set_to_empty = post_data_element_set_to_empty; + struct_.struct_.set_to_file = post_data_element_set_to_file; + struct_.struct_.set_to_bytes = post_data_element_set_to_bytes; + struct_.struct_.get_type = post_data_element_get_type; + struct_.struct_.get_file = post_data_element_get_file; + struct_.struct_.get_bytes_count = post_data_element_get_bytes_count; + struct_.struct_.get_bytes = post_data_element_get_bytes; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/post_data_element_cpptoc.h b/libcef_dll/cpptoc/post_data_element_cpptoc.h new file mode 100644 index 000000000..72d14e436 --- /dev/null +++ b/libcef_dll/cpptoc/post_data_element_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_POST_DATA_ELEMENT_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_POST_DATA_ELEMENT_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_request.h" +#include "include/capi/cef_request_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefPostDataElementCppToC + : public CefCppToC { + public: + explicit CefPostDataElementCppToC(CefPostDataElement* cls); + virtual ~CefPostDataElementCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_POST_DATA_ELEMENT_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/process_message_cpptoc.cc b/libcef_dll/cpptoc/process_message_cpptoc.cc new file mode 100644 index 000000000..7a07088cc --- /dev/null +++ b/libcef_dll/cpptoc/process_message_cpptoc.cc @@ -0,0 +1,132 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/list_value_cpptoc.h" +#include "libcef_dll/cpptoc/process_message_cpptoc.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_process_message_t* cef_process_message_create( + const cef_string_t* name) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: name; type: string_byref_const + DCHECK(name); + if (!name) + return NULL; + + // Execute + CefRefPtr _retval = CefProcessMessage::Create( + CefString(name)); + + // Return type: refptr_same + return CefProcessMessageCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK process_message_is_valid(struct _cef_process_message_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefProcessMessageCppToC::Get(self)->IsValid(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK process_message_is_read_only( + struct _cef_process_message_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefProcessMessageCppToC::Get(self)->IsReadOnly(); + + // Return type: bool + return _retval; +} + +struct _cef_process_message_t* CEF_CALLBACK process_message_copy( + struct _cef_process_message_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefProcessMessageCppToC::Get( + self)->Copy(); + + // Return type: refptr_same + return CefProcessMessageCppToC::Wrap(_retval); +} + +cef_string_userfree_t CEF_CALLBACK process_message_get_name( + struct _cef_process_message_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefProcessMessageCppToC::Get(self)->GetName(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +struct _cef_list_value_t* CEF_CALLBACK process_message_get_argument_list( + struct _cef_process_message_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefProcessMessageCppToC::Get( + self)->GetArgumentList(); + + // Return type: refptr_same + return CefListValueCppToC::Wrap(_retval); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefProcessMessageCppToC::CefProcessMessageCppToC(CefProcessMessage* cls) + : CefCppToC(cls) { + struct_.struct_.is_valid = process_message_is_valid; + struct_.struct_.is_read_only = process_message_is_read_only; + struct_.struct_.copy = process_message_copy; + struct_.struct_.get_name = process_message_get_name; + struct_.struct_.get_argument_list = process_message_get_argument_list; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/process_message_cpptoc.h b/libcef_dll/cpptoc/process_message_cpptoc.h new file mode 100644 index 000000000..ec56823ac --- /dev/null +++ b/libcef_dll/cpptoc/process_message_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_PROCESS_MESSAGE_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_PROCESS_MESSAGE_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_process_message.h" +#include "include/capi/cef_process_message_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefProcessMessageCppToC + : public CefCppToC { + public: + explicit CefProcessMessageCppToC(CefProcessMessage* cls); + virtual ~CefProcessMessageCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_PROCESS_MESSAGE_CPPTOC_H_ + diff --git a/cef/libcef_dll/cpptoc/proxy_handler_cpptoc.cc b/libcef_dll/cpptoc/proxy_handler_cpptoc.cc similarity index 100% rename from cef/libcef_dll/cpptoc/proxy_handler_cpptoc.cc rename to libcef_dll/cpptoc/proxy_handler_cpptoc.cc diff --git a/cef/libcef_dll/cpptoc/proxy_handler_cpptoc.h b/libcef_dll/cpptoc/proxy_handler_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/proxy_handler_cpptoc.h rename to libcef_dll/cpptoc/proxy_handler_cpptoc.h diff --git a/cef/libcef_dll/cpptoc/read_handler_cpptoc.cc b/libcef_dll/cpptoc/read_handler_cpptoc.cc similarity index 100% rename from cef/libcef_dll/cpptoc/read_handler_cpptoc.cc rename to libcef_dll/cpptoc/read_handler_cpptoc.cc diff --git a/cef/libcef_dll/cpptoc/read_handler_cpptoc.h b/libcef_dll/cpptoc/read_handler_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/read_handler_cpptoc.h rename to libcef_dll/cpptoc/read_handler_cpptoc.h diff --git a/libcef_dll/cpptoc/render_process_handler_cpptoc.cc b/libcef_dll/cpptoc/render_process_handler_cpptoc.cc new file mode 100644 index 000000000..904b83fd5 --- /dev/null +++ b/libcef_dll/cpptoc/render_process_handler_cpptoc.cc @@ -0,0 +1,215 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/render_process_handler_cpptoc.h" +#include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/domnode_ctocpp.h" +#include "libcef_dll/ctocpp/frame_ctocpp.h" +#include "libcef_dll/ctocpp/process_message_ctocpp.h" +#include "libcef_dll/ctocpp/v8context_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK render_process_handler_on_render_thread_created( + struct _cef_render_process_handler_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefRenderProcessHandlerCppToC::Get(self)->OnRenderThreadCreated(); +} + +void CEF_CALLBACK render_process_handler_on_web_kit_initialized( + struct _cef_render_process_handler_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefRenderProcessHandlerCppToC::Get(self)->OnWebKitInitialized(); +} + +void CEF_CALLBACK render_process_handler_on_browser_created( + struct _cef_render_process_handler_t* self, cef_browser_t* browser) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + + // Execute + CefRenderProcessHandlerCppToC::Get(self)->OnBrowserCreated( + CefBrowserCToCpp::Wrap(browser)); +} + +void CEF_CALLBACK render_process_handler_on_browser_destroyed( + struct _cef_render_process_handler_t* self, cef_browser_t* browser) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + + // Execute + CefRenderProcessHandlerCppToC::Get(self)->OnBrowserDestroyed( + CefBrowserCToCpp::Wrap(browser)); +} + +void CEF_CALLBACK render_process_handler_on_context_created( + struct _cef_render_process_handler_t* self, cef_browser_t* browser, + cef_frame_t* frame, struct _cef_v8context_t* context) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame); + if (!frame) + return; + // Verify param: context; type: refptr_diff + DCHECK(context); + if (!context) + return; + + // Execute + CefRenderProcessHandlerCppToC::Get(self)->OnContextCreated( + CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame), + CefV8ContextCToCpp::Wrap(context)); +} + +void CEF_CALLBACK render_process_handler_on_context_released( + struct _cef_render_process_handler_t* self, cef_browser_t* browser, + cef_frame_t* frame, struct _cef_v8context_t* context) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame); + if (!frame) + return; + // Verify param: context; type: refptr_diff + DCHECK(context); + if (!context) + return; + + // Execute + CefRenderProcessHandlerCppToC::Get(self)->OnContextReleased( + CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame), + CefV8ContextCToCpp::Wrap(context)); +} + +void CEF_CALLBACK render_process_handler_on_focused_node_changed( + struct _cef_render_process_handler_t* self, cef_browser_t* browser, + cef_frame_t* frame, cef_domnode_t* node) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Unverified params: frame, node + + // Execute + CefRenderProcessHandlerCppToC::Get(self)->OnFocusedNodeChanged( + CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame), + CefDOMNodeCToCpp::Wrap(node)); +} + +int CEF_CALLBACK render_process_handler_on_process_message_received( + struct _cef_render_process_handler_t* self, cef_browser_t* browser, + enum cef_process_id_t source_process, cef_process_message_t* message) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return 0; + // Verify param: message; type: refptr_diff + DCHECK(message); + if (!message) + return 0; + + // Execute + bool _retval = CefRenderProcessHandlerCppToC::Get( + self)->OnProcessMessageReceived( + CefBrowserCToCpp::Wrap(browser), + source_process, + CefProcessMessageCToCpp::Wrap(message)); + + // Return type: bool + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefRenderProcessHandlerCppToC::CefRenderProcessHandlerCppToC( + CefRenderProcessHandler* cls) + : CefCppToC(cls) { + struct_.struct_.on_render_thread_created = + render_process_handler_on_render_thread_created; + struct_.struct_.on_web_kit_initialized = + render_process_handler_on_web_kit_initialized; + struct_.struct_.on_browser_created = + render_process_handler_on_browser_created; + struct_.struct_.on_browser_destroyed = + render_process_handler_on_browser_destroyed; + struct_.struct_.on_context_created = + render_process_handler_on_context_created; + struct_.struct_.on_context_released = + render_process_handler_on_context_released; + struct_.struct_.on_focused_node_changed = + render_process_handler_on_focused_node_changed; + struct_.struct_.on_process_message_received = + render_process_handler_on_process_message_received; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/render_process_handler_cpptoc.h b/libcef_dll/cpptoc/render_process_handler_cpptoc.h new file mode 100644 index 000000000..838819783 --- /dev/null +++ b/libcef_dll/cpptoc/render_process_handler_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_RENDER_PROCESS_HANDLER_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_RENDER_PROCESS_HANDLER_CPPTOC_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_render_process_handler.h" +#include "include/capi/cef_render_process_handler_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed wrapper-side only. +class CefRenderProcessHandlerCppToC + : public CefCppToC { + public: + explicit CefRenderProcessHandlerCppToC(CefRenderProcessHandler* cls); + virtual ~CefRenderProcessHandlerCppToC() {} +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_RENDER_PROCESS_HANDLER_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/request_cpptoc.cc b/libcef_dll/cpptoc/request_cpptoc.cc new file mode 100644 index 000000000..2d943d715 --- /dev/null +++ b/libcef_dll/cpptoc/request_cpptoc.cc @@ -0,0 +1,308 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/post_data_cpptoc.h" +#include "libcef_dll/cpptoc/request_cpptoc.h" +#include "libcef_dll/transfer_util.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_request_t* cef_request_create() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefRequest::Create(); + + // Return type: refptr_same + return CefRequestCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK request_is_read_only(struct _cef_request_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefRequestCppToC::Get(self)->IsReadOnly(); + + // Return type: bool + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK request_get_url( + struct _cef_request_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefRequestCppToC::Get(self)->GetURL(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +void CEF_CALLBACK request_set_url(struct _cef_request_t* self, + const cef_string_t* url) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: url; type: string_byref_const + DCHECK(url); + if (!url) + return; + + // Execute + CefRequestCppToC::Get(self)->SetURL( + CefString(url)); +} + +cef_string_userfree_t CEF_CALLBACK request_get_method( + struct _cef_request_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefRequestCppToC::Get(self)->GetMethod(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +void CEF_CALLBACK request_set_method(struct _cef_request_t* self, + const cef_string_t* method) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: method; type: string_byref_const + DCHECK(method); + if (!method) + return; + + // Execute + CefRequestCppToC::Get(self)->SetMethod( + CefString(method)); +} + +struct _cef_post_data_t* CEF_CALLBACK request_get_post_data( + struct _cef_request_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefRequestCppToC::Get(self)->GetPostData(); + + // Return type: refptr_same + return CefPostDataCppToC::Wrap(_retval); +} + +void CEF_CALLBACK request_set_post_data(struct _cef_request_t* self, + struct _cef_post_data_t* postData) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: postData; type: refptr_same + DCHECK(postData); + if (!postData) + return; + + // Execute + CefRequestCppToC::Get(self)->SetPostData( + CefPostDataCppToC::Unwrap(postData)); +} + +void CEF_CALLBACK request_get_header_map(struct _cef_request_t* self, + cef_string_multimap_t headerMap) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: headerMap; type: string_map_multi_byref + DCHECK(headerMap); + if (!headerMap) + return; + + // Translate param: headerMap; type: string_map_multi_byref + std::multimap headerMapMultimap; + transfer_string_multimap_contents(headerMap, headerMapMultimap); + + // Execute + CefRequestCppToC::Get(self)->GetHeaderMap( + headerMapMultimap); + + // Restore param: headerMap; type: string_map_multi_byref + cef_string_multimap_clear(headerMap); + transfer_string_multimap_contents(headerMapMultimap, headerMap); +} + +void CEF_CALLBACK request_set_header_map(struct _cef_request_t* self, + cef_string_multimap_t headerMap) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: headerMap; type: string_map_multi_byref_const + DCHECK(headerMap); + if (!headerMap) + return; + + // Translate param: headerMap; type: string_map_multi_byref_const + std::multimap headerMapMultimap; + transfer_string_multimap_contents(headerMap, headerMapMultimap); + + // Execute + CefRequestCppToC::Get(self)->SetHeaderMap( + headerMapMultimap); +} + +void CEF_CALLBACK request_set(struct _cef_request_t* self, + const cef_string_t* url, const cef_string_t* method, + struct _cef_post_data_t* postData, cef_string_multimap_t headerMap) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: url; type: string_byref_const + DCHECK(url); + if (!url) + return; + // Verify param: method; type: string_byref_const + DCHECK(method); + if (!method) + return; + // Verify param: headerMap; type: string_map_multi_byref_const + DCHECK(headerMap); + if (!headerMap) + return; + // Unverified params: postData + + // Translate param: headerMap; type: string_map_multi_byref_const + std::multimap headerMapMultimap; + transfer_string_multimap_contents(headerMap, headerMapMultimap); + + // Execute + CefRequestCppToC::Get(self)->Set( + CefString(url), + CefString(method), + CefPostDataCppToC::Unwrap(postData), + headerMapMultimap); +} + +int CEF_CALLBACK request_get_flags(struct _cef_request_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return UR_FLAG_NONE; + + // Execute + int _retval = CefRequestCppToC::Get(self)->GetFlags(); + + // Return type: simple + return _retval; +} + +void CEF_CALLBACK request_set_flags(struct _cef_request_t* self, int flags) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefRequestCppToC::Get(self)->SetFlags( + flags); +} + +cef_string_userfree_t CEF_CALLBACK request_get_first_party_for_cookies( + struct _cef_request_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefRequestCppToC::Get(self)->GetFirstPartyForCookies(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +void CEF_CALLBACK request_set_first_party_for_cookies( + struct _cef_request_t* self, const cef_string_t* url) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: url; type: string_byref_const + DCHECK(url); + if (!url) + return; + + // Execute + CefRequestCppToC::Get(self)->SetFirstPartyForCookies( + CefString(url)); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefRequestCppToC::CefRequestCppToC(CefRequest* cls) + : CefCppToC(cls) { + struct_.struct_.is_read_only = request_is_read_only; + struct_.struct_.get_url = request_get_url; + struct_.struct_.set_url = request_set_url; + struct_.struct_.get_method = request_get_method; + struct_.struct_.set_method = request_set_method; + struct_.struct_.get_post_data = request_get_post_data; + struct_.struct_.set_post_data = request_set_post_data; + struct_.struct_.get_header_map = request_get_header_map; + struct_.struct_.set_header_map = request_set_header_map; + struct_.struct_.set = request_set; + struct_.struct_.get_flags = request_get_flags; + struct_.struct_.set_flags = request_set_flags; + struct_.struct_.get_first_party_for_cookies = + request_get_first_party_for_cookies; + struct_.struct_.set_first_party_for_cookies = + request_set_first_party_for_cookies; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/request_cpptoc.h b/libcef_dll/cpptoc/request_cpptoc.h new file mode 100644 index 000000000..00c9c2042 --- /dev/null +++ b/libcef_dll/cpptoc/request_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_REQUEST_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_REQUEST_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_request.h" +#include "include/capi/cef_request_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefRequestCppToC + : public CefCppToC { + public: + explicit CefRequestCppToC(CefRequest* cls); + virtual ~CefRequestCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_REQUEST_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/request_handler_cpptoc.cc b/libcef_dll/cpptoc/request_handler_cpptoc.cc new file mode 100644 index 000000000..0f85a02d8 --- /dev/null +++ b/libcef_dll/cpptoc/request_handler_cpptoc.cc @@ -0,0 +1,252 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/request_handler_cpptoc.h" +#include "libcef_dll/cpptoc/resource_handler_cpptoc.h" +#include "libcef_dll/ctocpp/auth_callback_ctocpp.h" +#include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h" +#include "libcef_dll/ctocpp/frame_ctocpp.h" +#include "libcef_dll/ctocpp/request_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK request_handler_on_before_resource_load( + struct _cef_request_handler_t* self, cef_browser_t* browser, + cef_frame_t* frame, cef_request_t* request) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return 0; + // Verify param: frame; type: refptr_diff + DCHECK(frame); + if (!frame) + return 0; + // Verify param: request; type: refptr_diff + DCHECK(request); + if (!request) + return 0; + + // Execute + bool _retval = CefRequestHandlerCppToC::Get(self)->OnBeforeResourceLoad( + CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame), + CefRequestCToCpp::Wrap(request)); + + // Return type: bool + return _retval; +} + +struct _cef_resource_handler_t* CEF_CALLBACK request_handler_get_resource_handler( + struct _cef_request_handler_t* self, cef_browser_t* browser, + cef_frame_t* frame, cef_request_t* request) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return NULL; + // Verify param: frame; type: refptr_diff + DCHECK(frame); + if (!frame) + return NULL; + // Verify param: request; type: refptr_diff + DCHECK(request); + if (!request) + return NULL; + + // Execute + CefRefPtr _retval = CefRequestHandlerCppToC::Get( + self)->GetResourceHandler( + CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame), + CefRequestCToCpp::Wrap(request)); + + // Return type: refptr_same + return CefResourceHandlerCppToC::Wrap(_retval); +} + +void CEF_CALLBACK request_handler_on_resource_redirect( + struct _cef_request_handler_t* self, cef_browser_t* browser, + cef_frame_t* frame, const cef_string_t* old_url, cef_string_t* new_url) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame); + if (!frame) + return; + // Verify param: old_url; type: string_byref_const + DCHECK(old_url); + if (!old_url) + return; + // Verify param: new_url; type: string_byref + DCHECK(new_url); + if (!new_url) + return; + + // Translate param: new_url; type: string_byref + CefString new_urlStr(new_url); + + // Execute + CefRequestHandlerCppToC::Get(self)->OnResourceRedirect( + CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame), + CefString(old_url), + new_urlStr); +} + +int CEF_CALLBACK request_handler_get_auth_credentials( + struct _cef_request_handler_t* self, cef_browser_t* browser, + cef_frame_t* frame, int isProxy, const cef_string_t* host, int port, + const cef_string_t* realm, const cef_string_t* scheme, + cef_auth_callback_t* callback) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return 0; + // Verify param: frame; type: refptr_diff + DCHECK(frame); + if (!frame) + return 0; + // Verify param: host; type: string_byref_const + DCHECK(host); + if (!host) + return 0; + // Verify param: scheme; type: string_byref_const + DCHECK(scheme); + if (!scheme) + return 0; + // Verify param: callback; type: refptr_diff + DCHECK(callback); + if (!callback) + return 0; + // Unverified params: realm + + // Execute + bool _retval = CefRequestHandlerCppToC::Get(self)->GetAuthCredentials( + CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame), + isProxy?true:false, + CefString(host), + port, + CefString(realm), + CefString(scheme), + CefAuthCallbackCToCpp::Wrap(callback)); + + // Return type: bool + return _retval; +} + +cef_cookie_manager_t* CEF_CALLBACK request_handler_get_cookie_manager( + struct _cef_request_handler_t* self, cef_browser_t* browser, + const cef_string_t* main_url) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return NULL; + // Verify param: main_url; type: string_byref_const + DCHECK(main_url); + if (!main_url) + return NULL; + + // Execute + CefRefPtr _retval = CefRequestHandlerCppToC::Get( + self)->GetCookieManager( + CefBrowserCToCpp::Wrap(browser), + CefString(main_url)); + + // Return type: refptr_diff + return CefCookieManagerCToCpp::Unwrap(_retval); +} + +void CEF_CALLBACK request_handler_on_protocol_execution( + struct _cef_request_handler_t* self, cef_browser_t* browser, + const cef_string_t* url, int* allow_os_execution) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: browser; type: refptr_diff + DCHECK(browser); + if (!browser) + return; + // Verify param: url; type: string_byref_const + DCHECK(url); + if (!url) + return; + // Verify param: allow_os_execution; type: bool_byref + DCHECK(allow_os_execution); + if (!allow_os_execution) + return; + + // Translate param: allow_os_execution; type: bool_byref + bool allow_os_executionBool = ( + allow_os_execution && *allow_os_execution)?true:false; + + // Execute + CefRequestHandlerCppToC::Get(self)->OnProtocolExecution( + CefBrowserCToCpp::Wrap(browser), + CefString(url), + allow_os_executionBool); + + // Restore param: allow_os_execution; type: bool_byref + if (allow_os_execution) + *allow_os_execution = allow_os_executionBool?true:false; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefRequestHandlerCppToC::CefRequestHandlerCppToC(CefRequestHandler* cls) + : CefCppToC(cls) { + struct_.struct_.on_before_resource_load = + request_handler_on_before_resource_load; + struct_.struct_.get_resource_handler = request_handler_get_resource_handler; + struct_.struct_.on_resource_redirect = request_handler_on_resource_redirect; + struct_.struct_.get_auth_credentials = request_handler_get_auth_credentials; + struct_.struct_.get_cookie_manager = request_handler_get_cookie_manager; + struct_.struct_.on_protocol_execution = request_handler_on_protocol_execution; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/cef/libcef_dll/cpptoc/request_handler_cpptoc.h b/libcef_dll/cpptoc/request_handler_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/request_handler_cpptoc.h rename to libcef_dll/cpptoc/request_handler_cpptoc.h diff --git a/cef/libcef_dll/cpptoc/resource_bundle_handler_cpptoc.cc b/libcef_dll/cpptoc/resource_bundle_handler_cpptoc.cc similarity index 100% rename from cef/libcef_dll/cpptoc/resource_bundle_handler_cpptoc.cc rename to libcef_dll/cpptoc/resource_bundle_handler_cpptoc.cc diff --git a/cef/libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h b/libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h rename to libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h diff --git a/libcef_dll/cpptoc/resource_handler_cpptoc.cc b/libcef_dll/cpptoc/resource_handler_cpptoc.cc new file mode 100644 index 000000000..bac30539f --- /dev/null +++ b/libcef_dll/cpptoc/resource_handler_cpptoc.cc @@ -0,0 +1,203 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/resource_handler_cpptoc.h" +#include "libcef_dll/ctocpp/callback_ctocpp.h" +#include "libcef_dll/ctocpp/request_ctocpp.h" +#include "libcef_dll/ctocpp/response_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK resource_handler_process_request( + struct _cef_resource_handler_t* self, cef_request_t* request, + cef_callback_t* callback) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: request; type: refptr_diff + DCHECK(request); + if (!request) + return 0; + // Verify param: callback; type: refptr_diff + DCHECK(callback); + if (!callback) + return 0; + + // Execute + bool _retval = CefResourceHandlerCppToC::Get(self)->ProcessRequest( + CefRequestCToCpp::Wrap(request), + CefCallbackCToCpp::Wrap(callback)); + + // Return type: bool + return _retval; +} + +void CEF_CALLBACK resource_handler_get_response_headers( + struct _cef_resource_handler_t* self, struct _cef_response_t* response, + int64* response_length, cef_string_t* redirectUrl) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: response; type: refptr_diff + DCHECK(response); + if (!response) + return; + // Verify param: response_length; type: simple_byref + DCHECK(response_length); + if (!response_length) + return; + // Verify param: redirectUrl; type: string_byref + DCHECK(redirectUrl); + if (!redirectUrl) + return; + + // Translate param: response_length; type: simple_byref + int64 response_lengthVal = response_length?*response_length:0; + // Translate param: redirectUrl; type: string_byref + CefString redirectUrlStr(redirectUrl); + + // Execute + CefResourceHandlerCppToC::Get(self)->GetResponseHeaders( + CefResponseCToCpp::Wrap(response), + response_lengthVal, + redirectUrlStr); + + // Restore param: response_length; type: simple_byref + if (response_length) + *response_length = response_lengthVal; +} + +int CEF_CALLBACK resource_handler_read_response( + struct _cef_resource_handler_t* self, void* data_out, int bytes_to_read, + int* bytes_read, cef_callback_t* callback) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: data_out; type: simple_byaddr + DCHECK(data_out); + if (!data_out) + return 0; + // Verify param: bytes_read; type: simple_byref + DCHECK(bytes_read); + if (!bytes_read) + return 0; + // Verify param: callback; type: refptr_diff + DCHECK(callback); + if (!callback) + return 0; + + // Translate param: bytes_read; type: simple_byref + int bytes_readVal = bytes_read?*bytes_read:0; + + // Execute + bool _retval = CefResourceHandlerCppToC::Get(self)->ReadResponse( + data_out, + bytes_to_read, + bytes_readVal, + CefCallbackCToCpp::Wrap(callback)); + + // Restore param: bytes_read; type: simple_byref + if (bytes_read) + *bytes_read = bytes_readVal; + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK resource_handler_can_get_cookie( + struct _cef_resource_handler_t* self, const struct _cef_cookie_t* cookie) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: cookie; type: struct_byref_const + DCHECK(cookie); + if (!cookie) + return 0; + + // Translate param: cookie; type: struct_byref_const + CefCookie cookieObj; + if (cookie) + cookieObj.Set(*cookie, false); + + // Execute + bool _retval = CefResourceHandlerCppToC::Get(self)->CanGetCookie( + cookieObj); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK resource_handler_can_set_cookie( + struct _cef_resource_handler_t* self, const struct _cef_cookie_t* cookie) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: cookie; type: struct_byref_const + DCHECK(cookie); + if (!cookie) + return 0; + + // Translate param: cookie; type: struct_byref_const + CefCookie cookieObj; + if (cookie) + cookieObj.Set(*cookie, false); + + // Execute + bool _retval = CefResourceHandlerCppToC::Get(self)->CanSetCookie( + cookieObj); + + // Return type: bool + return _retval; +} + +void CEF_CALLBACK resource_handler_cancel( + struct _cef_resource_handler_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefResourceHandlerCppToC::Get(self)->Cancel(); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefResourceHandlerCppToC::CefResourceHandlerCppToC(CefResourceHandler* cls) + : CefCppToC(cls) { + struct_.struct_.process_request = resource_handler_process_request; + struct_.struct_.get_response_headers = resource_handler_get_response_headers; + struct_.struct_.read_response = resource_handler_read_response; + struct_.struct_.can_get_cookie = resource_handler_can_get_cookie; + struct_.struct_.can_set_cookie = resource_handler_can_set_cookie; + struct_.struct_.cancel = resource_handler_cancel; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/resource_handler_cpptoc.h b/libcef_dll/cpptoc/resource_handler_cpptoc.h new file mode 100644 index 000000000..99e64dd90 --- /dev/null +++ b/libcef_dll/cpptoc/resource_handler_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_RESOURCE_HANDLER_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_RESOURCE_HANDLER_CPPTOC_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_resource_handler.h" +#include "include/capi/cef_resource_handler_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed wrapper-side only. +class CefResourceHandlerCppToC + : public CefCppToC { + public: + explicit CefResourceHandlerCppToC(CefResourceHandler* cls); + virtual ~CefResourceHandlerCppToC() {} +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_RESOURCE_HANDLER_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/response_cpptoc.cc b/libcef_dll/cpptoc/response_cpptoc.cc new file mode 100644 index 000000000..95bbe9223 --- /dev/null +++ b/libcef_dll/cpptoc/response_cpptoc.cc @@ -0,0 +1,224 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/response_cpptoc.h" +#include "libcef_dll/transfer_util.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_response_t* cef_response_create() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefResponse::Create(); + + // Return type: refptr_same + return CefResponseCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK response_is_read_only(struct _cef_response_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefResponseCppToC::Get(self)->IsReadOnly(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK response_get_status(struct _cef_response_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefResponseCppToC::Get(self)->GetStatus(); + + // Return type: simple + return _retval; +} + +void CEF_CALLBACK response_set_status(struct _cef_response_t* self, + int status) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefResponseCppToC::Get(self)->SetStatus( + status); +} + +cef_string_userfree_t CEF_CALLBACK response_get_status_text( + struct _cef_response_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefResponseCppToC::Get(self)->GetStatusText(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +void CEF_CALLBACK response_set_status_text(struct _cef_response_t* self, + const cef_string_t* statusText) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: statusText; type: string_byref_const + DCHECK(statusText); + if (!statusText) + return; + + // Execute + CefResponseCppToC::Get(self)->SetStatusText( + CefString(statusText)); +} + +cef_string_userfree_t CEF_CALLBACK response_get_mime_type( + struct _cef_response_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefResponseCppToC::Get(self)->GetMimeType(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +void CEF_CALLBACK response_set_mime_type(struct _cef_response_t* self, + const cef_string_t* mimeType) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: mimeType; type: string_byref_const + DCHECK(mimeType); + if (!mimeType) + return; + + // Execute + CefResponseCppToC::Get(self)->SetMimeType( + CefString(mimeType)); +} + +cef_string_userfree_t CEF_CALLBACK response_get_header( + struct _cef_response_t* self, const cef_string_t* name) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: name; type: string_byref_const + DCHECK(name); + if (!name) + return NULL; + + // Execute + CefString _retval = CefResponseCppToC::Get(self)->GetHeader( + CefString(name)); + + // Return type: string + return _retval.DetachToUserFree(); +} + +void CEF_CALLBACK response_get_header_map(struct _cef_response_t* self, + cef_string_multimap_t headerMap) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: headerMap; type: string_map_multi_byref + DCHECK(headerMap); + if (!headerMap) + return; + + // Translate param: headerMap; type: string_map_multi_byref + std::multimap headerMapMultimap; + transfer_string_multimap_contents(headerMap, headerMapMultimap); + + // Execute + CefResponseCppToC::Get(self)->GetHeaderMap( + headerMapMultimap); + + // Restore param: headerMap; type: string_map_multi_byref + cef_string_multimap_clear(headerMap); + transfer_string_multimap_contents(headerMapMultimap, headerMap); +} + +void CEF_CALLBACK response_set_header_map(struct _cef_response_t* self, + cef_string_multimap_t headerMap) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: headerMap; type: string_map_multi_byref_const + DCHECK(headerMap); + if (!headerMap) + return; + + // Translate param: headerMap; type: string_map_multi_byref_const + std::multimap headerMapMultimap; + transfer_string_multimap_contents(headerMap, headerMapMultimap); + + // Execute + CefResponseCppToC::Get(self)->SetHeaderMap( + headerMapMultimap); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefResponseCppToC::CefResponseCppToC(CefResponse* cls) + : CefCppToC(cls) { + struct_.struct_.is_read_only = response_is_read_only; + struct_.struct_.get_status = response_get_status; + struct_.struct_.set_status = response_set_status; + struct_.struct_.get_status_text = response_get_status_text; + struct_.struct_.set_status_text = response_set_status_text; + struct_.struct_.get_mime_type = response_get_mime_type; + struct_.struct_.set_mime_type = response_set_mime_type; + struct_.struct_.get_header = response_get_header; + struct_.struct_.get_header_map = response_get_header_map; + struct_.struct_.set_header_map = response_set_header_map; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/response_cpptoc.h b/libcef_dll/cpptoc/response_cpptoc.h new file mode 100644 index 000000000..7397974e6 --- /dev/null +++ b/libcef_dll/cpptoc/response_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_RESPONSE_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_RESPONSE_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_response.h" +#include "include/capi/cef_response_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefResponseCppToC + : public CefCppToC { + public: + explicit CefResponseCppToC(CefResponse* cls); + virtual ~CefResponseCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_RESPONSE_CPPTOC_H_ + diff --git a/cef/libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc b/libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc similarity index 79% rename from cef/libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc rename to libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc index 258543110..698527aa0 100644 --- a/cef/libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc +++ b/libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc @@ -10,26 +10,24 @@ // for more information. // -#include "libcef_dll/cpptoc/scheme_handler_cpptoc.h" +#include "libcef_dll/cpptoc/resource_handler_cpptoc.h" #include "libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h" #include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/frame_ctocpp.h" #include "libcef_dll/ctocpp/request_ctocpp.h" // MEMBER FUNCTIONS - Body may be edited by hand. -struct _cef_scheme_handler_t* CEF_CALLBACK scheme_handler_factory_create( +cef_resource_handler_t* CEF_CALLBACK scheme_handler_factory_create( struct _cef_scheme_handler_factory_t* self, cef_browser_t* browser, - const cef_string_t* scheme_name, cef_request_t* request) { + cef_frame_t* frame, const cef_string_t* scheme_name, + cef_request_t* request) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING DCHECK(self); if (!self) return NULL; - // Verify param: browser; type: refptr_diff - DCHECK(browser); - if (!browser) - return NULL; // Verify param: scheme_name; type: string_byref_const DCHECK(scheme_name); if (!scheme_name) @@ -38,16 +36,18 @@ struct _cef_scheme_handler_t* CEF_CALLBACK scheme_handler_factory_create( DCHECK(request); if (!request) return NULL; + // Unverified params: browser, frame // Execute - CefRefPtr _retval = CefSchemeHandlerFactoryCppToC::Get( + CefRefPtr _retval = CefSchemeHandlerFactoryCppToC::Get( self)->Create( CefBrowserCToCpp::Wrap(browser), + CefFrameCToCpp::Wrap(frame), CefString(scheme_name), CefRequestCToCpp::Wrap(request)); // Return type: refptr_same - return CefSchemeHandlerCppToC::Wrap(_retval); + return CefResourceHandlerCppToC::Wrap(_retval); } diff --git a/cef/libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h b/libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h rename to libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h diff --git a/libcef_dll/cpptoc/scheme_registrar_cpptoc.cc b/libcef_dll/cpptoc/scheme_registrar_cpptoc.cc new file mode 100644 index 000000000..eb9de78c1 --- /dev/null +++ b/libcef_dll/cpptoc/scheme_registrar_cpptoc.cc @@ -0,0 +1,55 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/scheme_registrar_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK scheme_registrar_add_custom_scheme( + struct _cef_scheme_registrar_t* self, const cef_string_t* scheme_name, + int is_standard, int is_local, int is_display_isolated) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: scheme_name; type: string_byref_const + DCHECK(scheme_name); + if (!scheme_name) + return 0; + + // Execute + bool _retval = CefSchemeRegistrarCppToC::Get(self)->AddCustomScheme( + CefString(scheme_name), + is_standard?true:false, + is_local?true:false, + is_display_isolated?true:false); + + // Return type: bool + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefSchemeRegistrarCppToC::CefSchemeRegistrarCppToC(CefSchemeRegistrar* cls) + : CefCppToC(cls) { + struct_.struct_.add_custom_scheme = scheme_registrar_add_custom_scheme; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/scheme_registrar_cpptoc.h b/libcef_dll/cpptoc/scheme_registrar_cpptoc.h new file mode 100644 index 000000000..cbcd2d6a5 --- /dev/null +++ b/libcef_dll/cpptoc/scheme_registrar_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_SCHEME_REGISTRAR_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_SCHEME_REGISTRAR_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_scheme.h" +#include "include/capi/cef_scheme_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefSchemeRegistrarCppToC + : public CefCppToC { + public: + explicit CefSchemeRegistrarCppToC(CefSchemeRegistrar* cls); + virtual ~CefSchemeRegistrarCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_SCHEME_REGISTRAR_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/stream_reader_cpptoc.cc b/libcef_dll/cpptoc/stream_reader_cpptoc.cc new file mode 100644 index 000000000..bfaf07f2b --- /dev/null +++ b/libcef_dll/cpptoc/stream_reader_cpptoc.cc @@ -0,0 +1,157 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/stream_reader_cpptoc.h" +#include "libcef_dll/ctocpp/read_handler_ctocpp.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_stream_reader_t* cef_stream_reader_create_for_file( + const cef_string_t* fileName) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: fileName; type: string_byref_const + DCHECK(fileName); + if (!fileName) + return NULL; + + // Execute + CefRefPtr _retval = CefStreamReader::CreateForFile( + CefString(fileName)); + + // Return type: refptr_same + return CefStreamReaderCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_stream_reader_t* cef_stream_reader_create_for_data(void* data, + size_t size) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: data; type: simple_byaddr + DCHECK(data); + if (!data) + return NULL; + + // Execute + CefRefPtr _retval = CefStreamReader::CreateForData( + data, + size); + + // Return type: refptr_same + return CefStreamReaderCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_stream_reader_t* cef_stream_reader_create_for_handler( + cef_read_handler_t* handler) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: handler; type: refptr_diff + DCHECK(handler); + if (!handler) + return NULL; + + // Execute + CefRefPtr _retval = CefStreamReader::CreateForHandler( + CefReadHandlerCToCpp::Wrap(handler)); + + // Return type: refptr_same + return CefStreamReaderCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +size_t CEF_CALLBACK stream_reader_read(struct _cef_stream_reader_t* self, + void* ptr, size_t size, size_t n) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: ptr; type: simple_byaddr + DCHECK(ptr); + if (!ptr) + return 0; + + // Execute + size_t _retval = CefStreamReaderCppToC::Get(self)->Read( + ptr, + size, + n); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK stream_reader_seek(struct _cef_stream_reader_t* self, + int64 offset, int whence) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefStreamReaderCppToC::Get(self)->Seek( + offset, + whence); + + // Return type: simple + return _retval; +} + +int64 CEF_CALLBACK stream_reader_tell(struct _cef_stream_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int64 _retval = CefStreamReaderCppToC::Get(self)->Tell(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK stream_reader_eof(struct _cef_stream_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefStreamReaderCppToC::Get(self)->Eof(); + + // Return type: simple + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefStreamReaderCppToC::CefStreamReaderCppToC(CefStreamReader* cls) + : CefCppToC( + cls) { + struct_.struct_.read = stream_reader_read; + struct_.struct_.seek = stream_reader_seek; + struct_.struct_.tell = stream_reader_tell; + struct_.struct_.eof = stream_reader_eof; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/stream_reader_cpptoc.h b/libcef_dll/cpptoc/stream_reader_cpptoc.h new file mode 100644 index 000000000..3dee6cad0 --- /dev/null +++ b/libcef_dll/cpptoc/stream_reader_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_STREAM_READER_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_STREAM_READER_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_stream.h" +#include "include/capi/cef_stream_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefStreamReaderCppToC + : public CefCppToC { + public: + explicit CefStreamReaderCppToC(CefStreamReader* cls); + virtual ~CefStreamReaderCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_STREAM_READER_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/stream_writer_cpptoc.cc b/libcef_dll/cpptoc/stream_writer_cpptoc.cc new file mode 100644 index 000000000..6c4c5b2dd --- /dev/null +++ b/libcef_dll/cpptoc/stream_writer_cpptoc.cc @@ -0,0 +1,139 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/stream_writer_cpptoc.h" +#include "libcef_dll/ctocpp/write_handler_ctocpp.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_stream_writer_t* cef_stream_writer_create_for_file( + const cef_string_t* fileName) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: fileName; type: string_byref_const + DCHECK(fileName); + if (!fileName) + return NULL; + + // Execute + CefRefPtr _retval = CefStreamWriter::CreateForFile( + CefString(fileName)); + + // Return type: refptr_same + return CefStreamWriterCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_stream_writer_t* cef_stream_writer_create_for_handler( + cef_write_handler_t* handler) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: handler; type: refptr_diff + DCHECK(handler); + if (!handler) + return NULL; + + // Execute + CefRefPtr _retval = CefStreamWriter::CreateForHandler( + CefWriteHandlerCToCpp::Wrap(handler)); + + // Return type: refptr_same + return CefStreamWriterCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +size_t CEF_CALLBACK stream_writer_write(struct _cef_stream_writer_t* self, + const void* ptr, size_t size, size_t n) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: ptr; type: simple_byaddr + DCHECK(ptr); + if (!ptr) + return 0; + + // Execute + size_t _retval = CefStreamWriterCppToC::Get(self)->Write( + ptr, + size, + n); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK stream_writer_seek(struct _cef_stream_writer_t* self, + int64 offset, int whence) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefStreamWriterCppToC::Get(self)->Seek( + offset, + whence); + + // Return type: simple + return _retval; +} + +int64 CEF_CALLBACK stream_writer_tell(struct _cef_stream_writer_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int64 _retval = CefStreamWriterCppToC::Get(self)->Tell(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK stream_writer_flush(struct _cef_stream_writer_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefStreamWriterCppToC::Get(self)->Flush(); + + // Return type: simple + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefStreamWriterCppToC::CefStreamWriterCppToC(CefStreamWriter* cls) + : CefCppToC( + cls) { + struct_.struct_.write = stream_writer_write; + struct_.struct_.seek = stream_writer_seek; + struct_.struct_.tell = stream_writer_tell; + struct_.struct_.flush = stream_writer_flush; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/stream_writer_cpptoc.h b/libcef_dll/cpptoc/stream_writer_cpptoc.h new file mode 100644 index 000000000..b10d2f670 --- /dev/null +++ b/libcef_dll/cpptoc/stream_writer_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_STREAM_WRITER_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_STREAM_WRITER_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_stream.h" +#include "include/capi/cef_stream_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefStreamWriterCppToC + : public CefCppToC { + public: + explicit CefStreamWriterCppToC(CefStreamWriter* cls); + virtual ~CefStreamWriterCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_STREAM_WRITER_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/string_visitor_cpptoc.cc b/libcef_dll/cpptoc/string_visitor_cpptoc.cc new file mode 100644 index 000000000..b1bdf5144 --- /dev/null +++ b/libcef_dll/cpptoc/string_visitor_cpptoc.cc @@ -0,0 +1,48 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/string_visitor_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK string_visitor_visit(struct _cef_string_visitor_t* self, + const cef_string_t* string) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: string; type: string_byref_const + DCHECK(string); + if (!string) + return; + + // Execute + CefStringVisitorCppToC::Get(self)->Visit( + CefString(string)); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefStringVisitorCppToC::CefStringVisitorCppToC(CefStringVisitor* cls) + : CefCppToC( + cls) { + struct_.struct_.visit = string_visitor_visit; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/string_visitor_cpptoc.h b/libcef_dll/cpptoc/string_visitor_cpptoc.h new file mode 100644 index 000000000..7e9c08759 --- /dev/null +++ b/libcef_dll/cpptoc/string_visitor_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_STRING_VISITOR_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_STRING_VISITOR_CPPTOC_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_string_visitor.h" +#include "include/capi/cef_string_visitor_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed wrapper-side only. +class CefStringVisitorCppToC + : public CefCppToC { + public: + explicit CefStringVisitorCppToC(CefStringVisitor* cls); + virtual ~CefStringVisitorCppToC() {} +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_STRING_VISITOR_CPPTOC_H_ + diff --git a/cef/libcef_dll/cpptoc/task_cpptoc.cc b/libcef_dll/cpptoc/task_cpptoc.cc similarity index 100% rename from cef/libcef_dll/cpptoc/task_cpptoc.cc rename to libcef_dll/cpptoc/task_cpptoc.cc diff --git a/cef/libcef_dll/cpptoc/task_cpptoc.h b/libcef_dll/cpptoc/task_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/task_cpptoc.h rename to libcef_dll/cpptoc/task_cpptoc.h diff --git a/libcef_dll/cpptoc/urlrequest_client_cpptoc.cc b/libcef_dll/cpptoc/urlrequest_client_cpptoc.cc new file mode 100644 index 000000000..b7e931eb0 --- /dev/null +++ b/libcef_dll/cpptoc/urlrequest_client_cpptoc.cc @@ -0,0 +1,116 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/urlrequest_client_cpptoc.h" +#include "libcef_dll/ctocpp/urlrequest_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +void CEF_CALLBACK urlrequest_client_on_request_complete( + struct _cef_urlrequest_client_t* self, cef_urlrequest_t* request) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: request; type: refptr_diff + DCHECK(request); + if (!request) + return; + + // Execute + CefURLRequestClientCppToC::Get(self)->OnRequestComplete( + CefURLRequestCToCpp::Wrap(request)); +} + +void CEF_CALLBACK urlrequest_client_on_upload_progress( + struct _cef_urlrequest_client_t* self, cef_urlrequest_t* request, + uint64 current, uint64 total) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: request; type: refptr_diff + DCHECK(request); + if (!request) + return; + + // Execute + CefURLRequestClientCppToC::Get(self)->OnUploadProgress( + CefURLRequestCToCpp::Wrap(request), + current, + total); +} + +void CEF_CALLBACK urlrequest_client_on_download_progress( + struct _cef_urlrequest_client_t* self, cef_urlrequest_t* request, + uint64 current, uint64 total) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: request; type: refptr_diff + DCHECK(request); + if (!request) + return; + + // Execute + CefURLRequestClientCppToC::Get(self)->OnDownloadProgress( + CefURLRequestCToCpp::Wrap(request), + current, + total); +} + +void CEF_CALLBACK urlrequest_client_on_download_data( + struct _cef_urlrequest_client_t* self, cef_urlrequest_t* request, + const void* data, size_t data_length) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + // Verify param: request; type: refptr_diff + DCHECK(request); + if (!request) + return; + // Verify param: data; type: simple_byaddr + DCHECK(data); + if (!data) + return; + + // Execute + CefURLRequestClientCppToC::Get(self)->OnDownloadData( + CefURLRequestCToCpp::Wrap(request), + data, + data_length); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefURLRequestClientCppToC::CefURLRequestClientCppToC(CefURLRequestClient* cls) + : CefCppToC(cls) { + struct_.struct_.on_request_complete = urlrequest_client_on_request_complete; + struct_.struct_.on_upload_progress = urlrequest_client_on_upload_progress; + struct_.struct_.on_download_progress = urlrequest_client_on_download_progress; + struct_.struct_.on_download_data = urlrequest_client_on_download_data; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/urlrequest_client_cpptoc.h b/libcef_dll/cpptoc/urlrequest_client_cpptoc.h new file mode 100644 index 000000000..faac3d89d --- /dev/null +++ b/libcef_dll/cpptoc/urlrequest_client_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_URLREQUEST_CLIENT_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_URLREQUEST_CLIENT_CPPTOC_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_urlrequest.h" +#include "include/capi/cef_urlrequest_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed wrapper-side only. +class CefURLRequestClientCppToC + : public CefCppToC { + public: + explicit CefURLRequestClientCppToC(CefURLRequestClient* cls); + virtual ~CefURLRequestClientCppToC() {} +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_URLREQUEST_CLIENT_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/urlrequest_cpptoc.cc b/libcef_dll/cpptoc/urlrequest_cpptoc.cc new file mode 100644 index 000000000..506ee8085 --- /dev/null +++ b/libcef_dll/cpptoc/urlrequest_cpptoc.cc @@ -0,0 +1,152 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/request_cpptoc.h" +#include "libcef_dll/cpptoc/response_cpptoc.h" +#include "libcef_dll/cpptoc/urlrequest_cpptoc.h" +#include "libcef_dll/ctocpp/urlrequest_client_ctocpp.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_urlrequest_t* cef_urlrequest_create(cef_request_t* request, + struct _cef_urlrequest_client_t* client) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: request; type: refptr_same + DCHECK(request); + if (!request) + return NULL; + // Verify param: client; type: refptr_diff + DCHECK(client); + if (!client) + return NULL; + + // Execute + CefRefPtr _retval = CefURLRequest::Create( + CefRequestCppToC::Unwrap(request), + CefURLRequestClientCToCpp::Wrap(client)); + + // Return type: refptr_same + return CefURLRequestCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +cef_request_t* CEF_CALLBACK urlrequest_get_request( + struct _cef_urlrequest_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefURLRequestCppToC::Get(self)->GetRequest(); + + // Return type: refptr_same + return CefRequestCppToC::Wrap(_retval); +} + +struct _cef_urlrequest_client_t* CEF_CALLBACK urlrequest_get_client( + struct _cef_urlrequest_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefURLRequestCppToC::Get( + self)->GetClient(); + + // Return type: refptr_diff + return CefURLRequestClientCToCpp::Unwrap(_retval); +} + +enum cef_urlrequest_status_t CEF_CALLBACK urlrequest_get_request_status( + struct _cef_urlrequest_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return UR_UNKNOWN; + + // Execute + cef_urlrequest_status_t _retval = CefURLRequestCppToC::Get( + self)->GetRequestStatus(); + + // Return type: simple + return _retval; +} + +enum cef_errorcode_t CEF_CALLBACK urlrequest_get_request_error( + struct _cef_urlrequest_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return ERR_NONE; + + // Execute + cef_errorcode_t _retval = CefURLRequestCppToC::Get(self)->GetRequestError(); + + // Return type: simple + return _retval; +} + +cef_response_t* CEF_CALLBACK urlrequest_get_response( + struct _cef_urlrequest_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefURLRequestCppToC::Get(self)->GetResponse( + ); + + // Return type: refptr_same + return CefResponseCppToC::Wrap(_retval); +} + +void CEF_CALLBACK urlrequest_cancel(struct _cef_urlrequest_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return; + + // Execute + CefURLRequestCppToC::Get(self)->Cancel(); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefURLRequestCppToC::CefURLRequestCppToC(CefURLRequest* cls) + : CefCppToC(cls) { + struct_.struct_.get_request = urlrequest_get_request; + struct_.struct_.get_client = urlrequest_get_client; + struct_.struct_.get_request_status = urlrequest_get_request_status; + struct_.struct_.get_request_error = urlrequest_get_request_error; + struct_.struct_.get_response = urlrequest_get_response; + struct_.struct_.cancel = urlrequest_cancel; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/urlrequest_cpptoc.h b/libcef_dll/cpptoc/urlrequest_cpptoc.h new file mode 100644 index 000000000..fc26a30c4 --- /dev/null +++ b/libcef_dll/cpptoc/urlrequest_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_URLREQUEST_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_URLREQUEST_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_urlrequest.h" +#include "include/capi/cef_urlrequest_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefURLRequestCppToC + : public CefCppToC { + public: + explicit CefURLRequestCppToC(CefURLRequest* cls); + virtual ~CefURLRequestCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_URLREQUEST_CPPTOC_H_ + diff --git a/cef/libcef_dll/cpptoc/v8accessor_cpptoc.cc b/libcef_dll/cpptoc/v8accessor_cpptoc.cc similarity index 100% rename from cef/libcef_dll/cpptoc/v8accessor_cpptoc.cc rename to libcef_dll/cpptoc/v8accessor_cpptoc.cc diff --git a/cef/libcef_dll/cpptoc/v8accessor_cpptoc.h b/libcef_dll/cpptoc/v8accessor_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/v8accessor_cpptoc.h rename to libcef_dll/cpptoc/v8accessor_cpptoc.h diff --git a/libcef_dll/cpptoc/v8context_cpptoc.cc b/libcef_dll/cpptoc/v8context_cpptoc.cc new file mode 100644 index 000000000..6aa3149ee --- /dev/null +++ b/libcef_dll/cpptoc/v8context_cpptoc.cc @@ -0,0 +1,228 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/frame_cpptoc.h" +#include "libcef_dll/cpptoc/v8context_cpptoc.h" +#include "libcef_dll/cpptoc/v8exception_cpptoc.h" +#include "libcef_dll/cpptoc/v8value_cpptoc.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_v8context_t* cef_v8context_get_current_context() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefV8Context::GetCurrentContext(); + + // Return type: refptr_same + return CefV8ContextCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_v8context_t* cef_v8context_get_entered_context() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefV8Context::GetEnteredContext(); + + // Return type: refptr_same + return CefV8ContextCppToC::Wrap(_retval); +} + +CEF_EXPORT int cef_v8context_in_context() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + bool _retval = CefV8Context::InContext(); + + // Return type: bool + return _retval; +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +cef_browser_t* CEF_CALLBACK v8context_get_browser( + struct _cef_v8context_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefV8ContextCppToC::Get(self)->GetBrowser(); + + // Return type: refptr_same + return CefBrowserCppToC::Wrap(_retval); +} + +cef_frame_t* CEF_CALLBACK v8context_get_frame(struct _cef_v8context_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefV8ContextCppToC::Get(self)->GetFrame(); + + // Return type: refptr_same + return CefFrameCppToC::Wrap(_retval); +} + +struct _cef_v8value_t* CEF_CALLBACK v8context_get_global( + struct _cef_v8context_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefV8ContextCppToC::Get(self)->GetGlobal(); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +int CEF_CALLBACK v8context_enter(struct _cef_v8context_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ContextCppToC::Get(self)->Enter(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8context_exit(struct _cef_v8context_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ContextCppToC::Get(self)->Exit(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8context_is_same(struct _cef_v8context_t* self, + struct _cef_v8context_t* that) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: that; type: refptr_same + DCHECK(that); + if (!that) + return 0; + + // Execute + bool _retval = CefV8ContextCppToC::Get(self)->IsSame( + CefV8ContextCppToC::Unwrap(that)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8context_eval(struct _cef_v8context_t* self, + const cef_string_t* code, struct _cef_v8value_t** retval, + struct _cef_v8exception_t** exception) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: code; type: string_byref_const + DCHECK(code); + if (!code) + return 0; + // Verify param: retval; type: refptr_same_byref + DCHECK(retval); + if (!retval) + return 0; + // Verify param: exception; type: refptr_same_byref + DCHECK(exception); + if (!exception) + return 0; + + // Translate param: retval; type: refptr_same_byref + CefRefPtr retvalPtr; + if (retval && *retval) + retvalPtr = CefV8ValueCppToC::Unwrap(*retval); + CefV8Value* retvalOrig = retvalPtr.get(); + // Translate param: exception; type: refptr_same_byref + CefRefPtr exceptionPtr; + if (exception && *exception) + exceptionPtr = CefV8ExceptionCppToC::Unwrap(*exception); + CefV8Exception* exceptionOrig = exceptionPtr.get(); + + // Execute + bool _retval = CefV8ContextCppToC::Get(self)->Eval( + CefString(code), + retvalPtr, + exceptionPtr); + + // Restore param: retval; type: refptr_same_byref + if (retval) { + if (retvalPtr.get()) { + if (retvalPtr.get() != retvalOrig) { + *retval = CefV8ValueCppToC::Wrap(retvalPtr); + } + } else { + *retval = NULL; + } + } + // Restore param: exception; type: refptr_same_byref + if (exception) { + if (exceptionPtr.get()) { + if (exceptionPtr.get() != exceptionOrig) { + *exception = CefV8ExceptionCppToC::Wrap(exceptionPtr); + } + } else { + *exception = NULL; + } + } + + // Return type: bool + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefV8ContextCppToC::CefV8ContextCppToC(CefV8Context* cls) + : CefCppToC(cls) { + struct_.struct_.get_browser = v8context_get_browser; + struct_.struct_.get_frame = v8context_get_frame; + struct_.struct_.get_global = v8context_get_global; + struct_.struct_.enter = v8context_enter; + struct_.struct_.exit = v8context_exit; + struct_.struct_.is_same = v8context_is_same; + struct_.struct_.eval = v8context_eval; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/v8context_cpptoc.h b/libcef_dll/cpptoc/v8context_cpptoc.h new file mode 100644 index 000000000..c19fff2ad --- /dev/null +++ b/libcef_dll/cpptoc/v8context_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_V8CONTEXT_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_V8CONTEXT_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_v8.h" +#include "include/capi/cef_v8_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefV8ContextCppToC + : public CefCppToC { + public: + explicit CefV8ContextCppToC(CefV8Context* cls); + virtual ~CefV8ContextCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_V8CONTEXT_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/v8exception_cpptoc.cc b/libcef_dll/cpptoc/v8exception_cpptoc.cc new file mode 100644 index 000000000..264fa8da9 --- /dev/null +++ b/libcef_dll/cpptoc/v8exception_cpptoc.cc @@ -0,0 +1,154 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/v8exception_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +cef_string_userfree_t CEF_CALLBACK v8exception_get_message( + struct _cef_v8exception_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefV8ExceptionCppToC::Get(self)->GetMessage(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK v8exception_get_source_line( + struct _cef_v8exception_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefV8ExceptionCppToC::Get(self)->GetSourceLine(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK v8exception_get_script_resource_name( + struct _cef_v8exception_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefV8ExceptionCppToC::Get(self)->GetScriptResourceName(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int CEF_CALLBACK v8exception_get_line_number(struct _cef_v8exception_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefV8ExceptionCppToC::Get(self)->GetLineNumber(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK v8exception_get_start_position( + struct _cef_v8exception_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefV8ExceptionCppToC::Get(self)->GetStartPosition(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK v8exception_get_end_position(struct _cef_v8exception_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefV8ExceptionCppToC::Get(self)->GetEndPosition(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK v8exception_get_start_column(struct _cef_v8exception_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefV8ExceptionCppToC::Get(self)->GetStartColumn(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK v8exception_get_end_column(struct _cef_v8exception_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefV8ExceptionCppToC::Get(self)->GetEndColumn(); + + // Return type: simple + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefV8ExceptionCppToC::CefV8ExceptionCppToC(CefV8Exception* cls) + : CefCppToC(cls) { + struct_.struct_.get_message = v8exception_get_message; + struct_.struct_.get_source_line = v8exception_get_source_line; + struct_.struct_.get_script_resource_name = + v8exception_get_script_resource_name; + struct_.struct_.get_line_number = v8exception_get_line_number; + struct_.struct_.get_start_position = v8exception_get_start_position; + struct_.struct_.get_end_position = v8exception_get_end_position; + struct_.struct_.get_start_column = v8exception_get_start_column; + struct_.struct_.get_end_column = v8exception_get_end_column; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/v8exception_cpptoc.h b/libcef_dll/cpptoc/v8exception_cpptoc.h new file mode 100644 index 000000000..040d782a4 --- /dev/null +++ b/libcef_dll/cpptoc/v8exception_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_V8EXCEPTION_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_V8EXCEPTION_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_v8.h" +#include "include/capi/cef_v8_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefV8ExceptionCppToC + : public CefCppToC { + public: + explicit CefV8ExceptionCppToC(CefV8Exception* cls); + virtual ~CefV8ExceptionCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_V8EXCEPTION_CPPTOC_H_ + diff --git a/cef/libcef_dll/cpptoc/v8handler_cpptoc.cc b/libcef_dll/cpptoc/v8handler_cpptoc.cc similarity index 100% rename from cef/libcef_dll/cpptoc/v8handler_cpptoc.cc rename to libcef_dll/cpptoc/v8handler_cpptoc.cc diff --git a/cef/libcef_dll/cpptoc/v8handler_cpptoc.h b/libcef_dll/cpptoc/v8handler_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/v8handler_cpptoc.h rename to libcef_dll/cpptoc/v8handler_cpptoc.h diff --git a/libcef_dll/cpptoc/v8value_cpptoc.cc b/libcef_dll/cpptoc/v8value_cpptoc.cc new file mode 100644 index 000000000..0ebed8c85 --- /dev/null +++ b/libcef_dll/cpptoc/v8value_cpptoc.cc @@ -0,0 +1,973 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/v8context_cpptoc.h" +#include "libcef_dll/cpptoc/v8exception_cpptoc.h" +#include "libcef_dll/cpptoc/v8value_cpptoc.h" +#include "libcef_dll/ctocpp/base_ctocpp.h" +#include "libcef_dll/ctocpp/v8accessor_ctocpp.h" +#include "libcef_dll/ctocpp/v8handler_ctocpp.h" +#include "libcef_dll/transfer_util.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_v8value_t* cef_v8value_create_undefined() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefV8Value::CreateUndefined(); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_v8value_t* cef_v8value_create_null() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefV8Value::CreateNull(); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_v8value_t* cef_v8value_create_bool(int value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefV8Value::CreateBool( + value?true:false); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_v8value_t* cef_v8value_create_int(int32 value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefV8Value::CreateInt( + value); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_v8value_t* cef_v8value_create_uint(uint32 value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefV8Value::CreateUInt( + value); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_v8value_t* cef_v8value_create_double(double value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefV8Value::CreateDouble( + value); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_v8value_t* cef_v8value_create_date(const cef_time_t* date) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: date; type: simple_byref_const + DCHECK(date); + if (!date) + return NULL; + + // Translate param: date; type: simple_byref_const + CefTime dateVal = date?*date:CefTime(); + + // Execute + CefRefPtr _retval = CefV8Value::CreateDate( + dateVal); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_v8value_t* cef_v8value_create_string(const cef_string_t* value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Unverified params: value + + // Execute + CefRefPtr _retval = CefV8Value::CreateString( + CefString(value)); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_v8value_t* cef_v8value_create_object( + cef_v8accessor_t* accessor) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Unverified params: accessor + + // Execute + CefRefPtr _retval = CefV8Value::CreateObject( + CefV8AccessorCToCpp::Wrap(accessor)); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_v8value_t* cef_v8value_create_array(int length) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRefPtr _retval = CefV8Value::CreateArray( + length); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +CEF_EXPORT cef_v8value_t* cef_v8value_create_function(const cef_string_t* name, + cef_v8handler_t* handler) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: name; type: string_byref_const + DCHECK(name); + if (!name) + return NULL; + // Verify param: handler; type: refptr_diff + DCHECK(handler); + if (!handler) + return NULL; + + // Execute + CefRefPtr _retval = CefV8Value::CreateFunction( + CefString(name), + CefV8HandlerCToCpp::Wrap(handler)); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK v8value_is_undefined(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->IsUndefined(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_is_null(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->IsNull(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_is_bool(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->IsBool(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_is_int(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->IsInt(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_is_uint(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->IsUInt(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_is_double(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->IsDouble(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_is_date(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->IsDate(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_is_string(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->IsString(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_is_object(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->IsObject(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_is_array(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->IsArray(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_is_function(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->IsFunction(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_is_same(struct _cef_v8value_t* self, + struct _cef_v8value_t* that) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: that; type: refptr_same + DCHECK(that); + if (!that) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->IsSame( + CefV8ValueCppToC::Unwrap(that)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_get_bool_value(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->GetBoolValue(); + + // Return type: bool + return _retval; +} + +int32 CEF_CALLBACK v8value_get_int_value(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int32 _retval = CefV8ValueCppToC::Get(self)->GetIntValue(); + + // Return type: simple + return _retval; +} + +uint32 CEF_CALLBACK v8value_get_uint_value(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + uint32 _retval = CefV8ValueCppToC::Get(self)->GetUIntValue(); + + // Return type: simple + return _retval; +} + +double CEF_CALLBACK v8value_get_double_value(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + double _retval = CefV8ValueCppToC::Get(self)->GetDoubleValue(); + + // Return type: simple + return _retval; +} + +cef_time_t CEF_CALLBACK v8value_get_date_value(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return CefTime(); + + // Execute + cef_time_t _retval = CefV8ValueCppToC::Get(self)->GetDateValue(); + + // Return type: simple + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK v8value_get_string_value( + struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefV8ValueCppToC::Get(self)->GetStringValue(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int CEF_CALLBACK v8value_is_user_created(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->IsUserCreated(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_has_exception(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->HasException(); + + // Return type: bool + return _retval; +} + +cef_v8exception_t* CEF_CALLBACK v8value_get_exception( + struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefV8ValueCppToC::Get(self)->GetException( + ); + + // Return type: refptr_same + return CefV8ExceptionCppToC::Wrap(_retval); +} + +int CEF_CALLBACK v8value_clear_exception(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->ClearException(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_will_rethrow_exceptions(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->WillRethrowExceptions(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_set_rethrow_exceptions(struct _cef_v8value_t* self, + int rethrow) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->SetRethrowExceptions( + rethrow?true:false); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_has_value_bykey(struct _cef_v8value_t* self, + const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->HasValue( + CefString(key)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_has_value_byindex(struct _cef_v8value_t* self, + int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->HasValue( + index); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_delete_value_bykey(struct _cef_v8value_t* self, + const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->DeleteValue( + CefString(key)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_delete_value_byindex(struct _cef_v8value_t* self, + int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->DeleteValue( + index); + + // Return type: bool + return _retval; +} + +struct _cef_v8value_t* CEF_CALLBACK v8value_get_value_bykey( + struct _cef_v8value_t* self, const cef_string_t* key) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return NULL; + + // Execute + CefRefPtr _retval = CefV8ValueCppToC::Get(self)->GetValue( + CefString(key)); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +struct _cef_v8value_t* CEF_CALLBACK v8value_get_value_byindex( + struct _cef_v8value_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return NULL; + + // Execute + CefRefPtr _retval = CefV8ValueCppToC::Get(self)->GetValue( + index); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +int CEF_CALLBACK v8value_set_value_bykey(struct _cef_v8value_t* self, + const cef_string_t* key, struct _cef_v8value_t* value, + enum cef_v8_propertyattribute_t attribute) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + // Verify param: value; type: refptr_same + DCHECK(value); + if (!value) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->SetValue( + CefString(key), + CefV8ValueCppToC::Unwrap(value), + attribute); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_set_value_byindex(struct _cef_v8value_t* self, + int index, struct _cef_v8value_t* value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + // Verify param: value; type: refptr_same + DCHECK(value); + if (!value) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->SetValue( + index, + CefV8ValueCppToC::Unwrap(value)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_set_value_byaccessor(struct _cef_v8value_t* self, + const cef_string_t* key, enum cef_v8_accesscontrol_t settings, + enum cef_v8_propertyattribute_t attribute) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: key; type: string_byref_const + DCHECK(key); + if (!key) + return 0; + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->SetValue( + CefString(key), + settings, + attribute); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_get_keys(struct _cef_v8value_t* self, + cef_string_list_t keys) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: keys; type: string_vec_byref + DCHECK(keys); + if (!keys) + return 0; + + // Translate param: keys; type: string_vec_byref + std::vector keysList; + transfer_string_list_contents(keys, keysList); + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->GetKeys( + keysList); + + // Restore param: keys; type: string_vec_byref + cef_string_list_clear(keys); + transfer_string_list_contents(keysList, keys); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK v8value_set_user_data(struct _cef_v8value_t* self, + cef_base_t* user_data) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Unverified params: user_data + + // Execute + bool _retval = CefV8ValueCppToC::Get(self)->SetUserData( + CefBaseCToCpp::Wrap(user_data)); + + // Return type: bool + return _retval; +} + +cef_base_t* CEF_CALLBACK v8value_get_user_data(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefV8ValueCppToC::Get(self)->GetUserData(); + + // Return type: refptr_diff + return CefBaseCToCpp::Unwrap(_retval); +} + +int CEF_CALLBACK v8value_get_externally_allocated_memory( + struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefV8ValueCppToC::Get(self)->GetExternallyAllocatedMemory(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK v8value_adjust_externally_allocated_memory( + struct _cef_v8value_t* self, int change_in_bytes) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefV8ValueCppToC::Get(self)->AdjustExternallyAllocatedMemory( + change_in_bytes); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK v8value_get_array_length(struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefV8ValueCppToC::Get(self)->GetArrayLength(); + + // Return type: simple + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK v8value_get_function_name( + struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefV8ValueCppToC::Get(self)->GetFunctionName(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_v8handler_t* CEF_CALLBACK v8value_get_function_handler( + struct _cef_v8value_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefRefPtr _retval = CefV8ValueCppToC::Get( + self)->GetFunctionHandler(); + + // Return type: refptr_diff + return CefV8HandlerCToCpp::Unwrap(_retval); +} + +struct _cef_v8value_t* CEF_CALLBACK v8value_execute_function( + struct _cef_v8value_t* self, struct _cef_v8value_t* object, + size_t argumentsCount, struct _cef_v8value_t* const* arguments) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: arguments; type: refptr_vec_same_byref_const + DCHECK(argumentsCount == 0 || arguments); + if (argumentsCount > 0 && !arguments) + return NULL; + // Unverified params: object + + // Translate param: arguments; type: refptr_vec_same_byref_const + std::vector > argumentsList; + if (argumentsCount > 0) { + for (size_t i = 0; i < argumentsCount; ++i) { + argumentsList.push_back(CefV8ValueCppToC::Unwrap(arguments[i])); + } + } + + // Execute + CefRefPtr _retval = CefV8ValueCppToC::Get(self)->ExecuteFunction( + CefV8ValueCppToC::Unwrap(object), + argumentsList); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + +struct _cef_v8value_t* CEF_CALLBACK v8value_execute_function_with_context( + struct _cef_v8value_t* self, cef_v8context_t* context, + struct _cef_v8value_t* object, size_t argumentsCount, + struct _cef_v8value_t* const* arguments) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: context; type: refptr_same + DCHECK(context); + if (!context) + return NULL; + // Verify param: arguments; type: refptr_vec_same_byref_const + DCHECK(argumentsCount == 0 || arguments); + if (argumentsCount > 0 && !arguments) + return NULL; + // Unverified params: object + + // Translate param: arguments; type: refptr_vec_same_byref_const + std::vector > argumentsList; + if (argumentsCount > 0) { + for (size_t i = 0; i < argumentsCount; ++i) { + argumentsList.push_back(CefV8ValueCppToC::Unwrap(arguments[i])); + } + } + + // Execute + CefRefPtr _retval = CefV8ValueCppToC::Get( + self)->ExecuteFunctionWithContext( + CefV8ContextCppToC::Unwrap(context), + CefV8ValueCppToC::Unwrap(object), + argumentsList); + + // Return type: refptr_same + return CefV8ValueCppToC::Wrap(_retval); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefV8ValueCppToC::CefV8ValueCppToC(CefV8Value* cls) + : CefCppToC(cls) { + struct_.struct_.is_undefined = v8value_is_undefined; + struct_.struct_.is_null = v8value_is_null; + struct_.struct_.is_bool = v8value_is_bool; + struct_.struct_.is_int = v8value_is_int; + struct_.struct_.is_uint = v8value_is_uint; + struct_.struct_.is_double = v8value_is_double; + struct_.struct_.is_date = v8value_is_date; + struct_.struct_.is_string = v8value_is_string; + struct_.struct_.is_object = v8value_is_object; + struct_.struct_.is_array = v8value_is_array; + struct_.struct_.is_function = v8value_is_function; + struct_.struct_.is_same = v8value_is_same; + struct_.struct_.get_bool_value = v8value_get_bool_value; + struct_.struct_.get_int_value = v8value_get_int_value; + struct_.struct_.get_uint_value = v8value_get_uint_value; + struct_.struct_.get_double_value = v8value_get_double_value; + struct_.struct_.get_date_value = v8value_get_date_value; + struct_.struct_.get_string_value = v8value_get_string_value; + struct_.struct_.is_user_created = v8value_is_user_created; + struct_.struct_.has_exception = v8value_has_exception; + struct_.struct_.get_exception = v8value_get_exception; + struct_.struct_.clear_exception = v8value_clear_exception; + struct_.struct_.will_rethrow_exceptions = v8value_will_rethrow_exceptions; + struct_.struct_.set_rethrow_exceptions = v8value_set_rethrow_exceptions; + struct_.struct_.has_value_bykey = v8value_has_value_bykey; + struct_.struct_.has_value_byindex = v8value_has_value_byindex; + struct_.struct_.delete_value_bykey = v8value_delete_value_bykey; + struct_.struct_.delete_value_byindex = v8value_delete_value_byindex; + struct_.struct_.get_value_bykey = v8value_get_value_bykey; + struct_.struct_.get_value_byindex = v8value_get_value_byindex; + struct_.struct_.set_value_bykey = v8value_set_value_bykey; + struct_.struct_.set_value_byindex = v8value_set_value_byindex; + struct_.struct_.set_value_byaccessor = v8value_set_value_byaccessor; + struct_.struct_.get_keys = v8value_get_keys; + struct_.struct_.set_user_data = v8value_set_user_data; + struct_.struct_.get_user_data = v8value_get_user_data; + struct_.struct_.get_externally_allocated_memory = + v8value_get_externally_allocated_memory; + struct_.struct_.adjust_externally_allocated_memory = + v8value_adjust_externally_allocated_memory; + struct_.struct_.get_array_length = v8value_get_array_length; + struct_.struct_.get_function_name = v8value_get_function_name; + struct_.struct_.get_function_handler = v8value_get_function_handler; + struct_.struct_.execute_function = v8value_execute_function; + struct_.struct_.execute_function_with_context = + v8value_execute_function_with_context; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/v8value_cpptoc.h b/libcef_dll/cpptoc/v8value_cpptoc.h new file mode 100644 index 000000000..086bda36d --- /dev/null +++ b/libcef_dll/cpptoc/v8value_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_V8VALUE_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_V8VALUE_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_v8.h" +#include "include/capi/cef_v8_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefV8ValueCppToC + : public CefCppToC { + public: + explicit CefV8ValueCppToC(CefV8Value* cls); + virtual ~CefV8ValueCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_V8VALUE_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/web_plugin_info_cpptoc.cc b/libcef_dll/cpptoc/web_plugin_info_cpptoc.cc new file mode 100644 index 000000000..46caf75f6 --- /dev/null +++ b/libcef_dll/cpptoc/web_plugin_info_cpptoc.cc @@ -0,0 +1,94 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +cef_string_userfree_t CEF_CALLBACK web_plugin_info_get_name( + struct _cef_web_plugin_info_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefWebPluginInfoCppToC::Get(self)->GetName(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK web_plugin_info_get_path( + struct _cef_web_plugin_info_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefWebPluginInfoCppToC::Get(self)->GetPath(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK web_plugin_info_get_version( + struct _cef_web_plugin_info_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefWebPluginInfoCppToC::Get(self)->GetVersion(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK web_plugin_info_get_description( + struct _cef_web_plugin_info_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefWebPluginInfoCppToC::Get(self)->GetDescription(); + + // Return type: string + return _retval.DetachToUserFree(); +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefWebPluginInfoCppToC::CefWebPluginInfoCppToC(CefWebPluginInfo* cls) + : CefCppToC(cls) { + struct_.struct_.get_name = web_plugin_info_get_name; + struct_.struct_.get_path = web_plugin_info_get_path; + struct_.struct_.get_version = web_plugin_info_get_version; + struct_.struct_.get_description = web_plugin_info_get_description; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/web_plugin_info_cpptoc.h b/libcef_dll/cpptoc/web_plugin_info_cpptoc.h new file mode 100644 index 000000000..9ede6a894 --- /dev/null +++ b/libcef_dll/cpptoc/web_plugin_info_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_WEB_PLUGIN_INFO_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_WEB_PLUGIN_INFO_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_web_plugin.h" +#include "include/capi/cef_web_plugin_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefWebPluginInfoCppToC + : public CefCppToC { + public: + explicit CefWebPluginInfoCppToC(CefWebPluginInfo* cls); + virtual ~CefWebPluginInfoCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_WEB_PLUGIN_INFO_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.cc b/libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.cc new file mode 100644 index 000000000..35593acab --- /dev/null +++ b/libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.cc @@ -0,0 +1,56 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h" +#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h" + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK web_plugin_info_visitor_visit( + struct _cef_web_plugin_info_visitor_t* self, cef_web_plugin_info_t* info, + int count, int total) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: info; type: refptr_diff + DCHECK(info); + if (!info) + return 0; + + // Execute + bool _retval = CefWebPluginInfoVisitorCppToC::Get(self)->Visit( + CefWebPluginInfoCToCpp::Wrap(info), + count, + total); + + // Return type: bool + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefWebPluginInfoVisitorCppToC::CefWebPluginInfoVisitorCppToC( + CefWebPluginInfoVisitor* cls) + : CefCppToC(cls) { + struct_.struct_.visit = web_plugin_info_visitor_visit; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h b/libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h new file mode 100644 index 000000000..420c74460 --- /dev/null +++ b/libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_WEB_PLUGIN_INFO_VISITOR_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_WEB_PLUGIN_INFO_VISITOR_CPPTOC_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_web_plugin.h" +#include "include/capi/cef_web_plugin_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed wrapper-side only. +class CefWebPluginInfoVisitorCppToC + : public CefCppToC { + public: + explicit CefWebPluginInfoVisitorCppToC(CefWebPluginInfoVisitor* cls); + virtual ~CefWebPluginInfoVisitorCppToC() {} +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_WEB_PLUGIN_INFO_VISITOR_CPPTOC_H_ + diff --git a/cef/libcef_dll/cpptoc/write_handler_cpptoc.cc b/libcef_dll/cpptoc/write_handler_cpptoc.cc similarity index 100% rename from cef/libcef_dll/cpptoc/write_handler_cpptoc.cc rename to libcef_dll/cpptoc/write_handler_cpptoc.cc diff --git a/cef/libcef_dll/cpptoc/write_handler_cpptoc.h b/libcef_dll/cpptoc/write_handler_cpptoc.h similarity index 100% rename from cef/libcef_dll/cpptoc/write_handler_cpptoc.h rename to libcef_dll/cpptoc/write_handler_cpptoc.h diff --git a/libcef_dll/cpptoc/xml_reader_cpptoc.cc b/libcef_dll/cpptoc/xml_reader_cpptoc.cc new file mode 100644 index 000000000..a80c32b2e --- /dev/null +++ b/libcef_dll/cpptoc/xml_reader_cpptoc.cc @@ -0,0 +1,558 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/stream_reader_cpptoc.h" +#include "libcef_dll/cpptoc/xml_reader_cpptoc.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_xml_reader_t* cef_xml_reader_create(cef_stream_reader_t* stream, + enum cef_xml_encoding_type_t encodingType, const cef_string_t* URI) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: stream; type: refptr_same + DCHECK(stream); + if (!stream) + return NULL; + // Verify param: URI; type: string_byref_const + DCHECK(URI); + if (!URI) + return NULL; + + // Execute + CefRefPtr _retval = CefXmlReader::Create( + CefStreamReaderCppToC::Unwrap(stream), + encodingType, + CefString(URI)); + + // Return type: refptr_same + return CefXmlReaderCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK xml_reader_move_to_next_node(struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefXmlReaderCppToC::Get(self)->MoveToNextNode(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK xml_reader_close(struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefXmlReaderCppToC::Get(self)->Close(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK xml_reader_has_error(struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefXmlReaderCppToC::Get(self)->HasError(); + + // Return type: bool + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK xml_reader_get_error( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefXmlReaderCppToC::Get(self)->GetError(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +enum cef_xml_node_type_t CEF_CALLBACK xml_reader_get_type( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return XML_NODE_UNSUPPORTED; + + // Execute + cef_xml_node_type_t _retval = CefXmlReaderCppToC::Get(self)->GetType(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK xml_reader_get_depth(struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefXmlReaderCppToC::Get(self)->GetDepth(); + + // Return type: simple + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK xml_reader_get_local_name( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefXmlReaderCppToC::Get(self)->GetLocalName(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK xml_reader_get_prefix( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefXmlReaderCppToC::Get(self)->GetPrefix(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK xml_reader_get_qualified_name( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefXmlReaderCppToC::Get(self)->GetQualifiedName(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK xml_reader_get_namespace_uri( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefXmlReaderCppToC::Get(self)->GetNamespaceURI(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK xml_reader_get_base_uri( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefXmlReaderCppToC::Get(self)->GetBaseURI(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK xml_reader_get_xml_lang( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefXmlReaderCppToC::Get(self)->GetXmlLang(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int CEF_CALLBACK xml_reader_is_empty_element(struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefXmlReaderCppToC::Get(self)->IsEmptyElement(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK xml_reader_has_value(struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefXmlReaderCppToC::Get(self)->HasValue(); + + // Return type: bool + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK xml_reader_get_value( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefXmlReaderCppToC::Get(self)->GetValue(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int CEF_CALLBACK xml_reader_has_attributes(struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefXmlReaderCppToC::Get(self)->HasAttributes(); + + // Return type: bool + return _retval; +} + +size_t CEF_CALLBACK xml_reader_get_attribute_count( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + size_t _retval = CefXmlReaderCppToC::Get(self)->GetAttributeCount(); + + // Return type: simple + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK xml_reader_get_attribute_byindex( + struct _cef_xml_reader_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return NULL; + + // Execute + CefString _retval = CefXmlReaderCppToC::Get(self)->GetAttribute( + index); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK xml_reader_get_attribute_byqname( + struct _cef_xml_reader_t* self, const cef_string_t* qualifiedName) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: qualifiedName; type: string_byref_const + DCHECK(qualifiedName); + if (!qualifiedName) + return NULL; + + // Execute + CefString _retval = CefXmlReaderCppToC::Get(self)->GetAttribute( + CefString(qualifiedName)); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK xml_reader_get_attribute_bylname( + struct _cef_xml_reader_t* self, const cef_string_t* localName, + const cef_string_t* namespaceURI) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + // Verify param: localName; type: string_byref_const + DCHECK(localName); + if (!localName) + return NULL; + // Verify param: namespaceURI; type: string_byref_const + DCHECK(namespaceURI); + if (!namespaceURI) + return NULL; + + // Execute + CefString _retval = CefXmlReaderCppToC::Get(self)->GetAttribute( + CefString(localName), + CefString(namespaceURI)); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK xml_reader_get_inner_xml( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefXmlReaderCppToC::Get(self)->GetInnerXml(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +cef_string_userfree_t CEF_CALLBACK xml_reader_get_outer_xml( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefXmlReaderCppToC::Get(self)->GetOuterXml(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int CEF_CALLBACK xml_reader_get_line_number(struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int _retval = CefXmlReaderCppToC::Get(self)->GetLineNumber(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK xml_reader_move_to_attribute_byindex( + struct _cef_xml_reader_t* self, int index) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + + // Execute + bool _retval = CefXmlReaderCppToC::Get(self)->MoveToAttribute( + index); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK xml_reader_move_to_attribute_byqname( + struct _cef_xml_reader_t* self, const cef_string_t* qualifiedName) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: qualifiedName; type: string_byref_const + DCHECK(qualifiedName); + if (!qualifiedName) + return 0; + + // Execute + bool _retval = CefXmlReaderCppToC::Get(self)->MoveToAttribute( + CefString(qualifiedName)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK xml_reader_move_to_attribute_bylname( + struct _cef_xml_reader_t* self, const cef_string_t* localName, + const cef_string_t* namespaceURI) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: localName; type: string_byref_const + DCHECK(localName); + if (!localName) + return 0; + // Verify param: namespaceURI; type: string_byref_const + DCHECK(namespaceURI); + if (!namespaceURI) + return 0; + + // Execute + bool _retval = CefXmlReaderCppToC::Get(self)->MoveToAttribute( + CefString(localName), + CefString(namespaceURI)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK xml_reader_move_to_first_attribute( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefXmlReaderCppToC::Get(self)->MoveToFirstAttribute(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK xml_reader_move_to_next_attribute( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefXmlReaderCppToC::Get(self)->MoveToNextAttribute(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK xml_reader_move_to_carrying_element( + struct _cef_xml_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefXmlReaderCppToC::Get(self)->MoveToCarryingElement(); + + // Return type: bool + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefXmlReaderCppToC::CefXmlReaderCppToC(CefXmlReader* cls) + : CefCppToC(cls) { + struct_.struct_.move_to_next_node = xml_reader_move_to_next_node; + struct_.struct_.close = xml_reader_close; + struct_.struct_.has_error = xml_reader_has_error; + struct_.struct_.get_error = xml_reader_get_error; + struct_.struct_.get_type = xml_reader_get_type; + struct_.struct_.get_depth = xml_reader_get_depth; + struct_.struct_.get_local_name = xml_reader_get_local_name; + struct_.struct_.get_prefix = xml_reader_get_prefix; + struct_.struct_.get_qualified_name = xml_reader_get_qualified_name; + struct_.struct_.get_namespace_uri = xml_reader_get_namespace_uri; + struct_.struct_.get_base_uri = xml_reader_get_base_uri; + struct_.struct_.get_xml_lang = xml_reader_get_xml_lang; + struct_.struct_.is_empty_element = xml_reader_is_empty_element; + struct_.struct_.has_value = xml_reader_has_value; + struct_.struct_.get_value = xml_reader_get_value; + struct_.struct_.has_attributes = xml_reader_has_attributes; + struct_.struct_.get_attribute_count = xml_reader_get_attribute_count; + struct_.struct_.get_attribute_byindex = xml_reader_get_attribute_byindex; + struct_.struct_.get_attribute_byqname = xml_reader_get_attribute_byqname; + struct_.struct_.get_attribute_bylname = xml_reader_get_attribute_bylname; + struct_.struct_.get_inner_xml = xml_reader_get_inner_xml; + struct_.struct_.get_outer_xml = xml_reader_get_outer_xml; + struct_.struct_.get_line_number = xml_reader_get_line_number; + struct_.struct_.move_to_attribute_byindex = + xml_reader_move_to_attribute_byindex; + struct_.struct_.move_to_attribute_byqname = + xml_reader_move_to_attribute_byqname; + struct_.struct_.move_to_attribute_bylname = + xml_reader_move_to_attribute_bylname; + struct_.struct_.move_to_first_attribute = xml_reader_move_to_first_attribute; + struct_.struct_.move_to_next_attribute = xml_reader_move_to_next_attribute; + struct_.struct_.move_to_carrying_element = + xml_reader_move_to_carrying_element; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/xml_reader_cpptoc.h b/libcef_dll/cpptoc/xml_reader_cpptoc.h new file mode 100644 index 000000000..1674b2faf --- /dev/null +++ b/libcef_dll/cpptoc/xml_reader_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_XML_READER_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_XML_READER_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_xml_reader.h" +#include "include/capi/cef_xml_reader_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefXmlReaderCppToC + : public CefCppToC { + public: + explicit CefXmlReaderCppToC(CefXmlReader* cls); + virtual ~CefXmlReaderCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_XML_READER_CPPTOC_H_ + diff --git a/libcef_dll/cpptoc/zip_reader_cpptoc.cc b/libcef_dll/cpptoc/zip_reader_cpptoc.cc new file mode 100644 index 000000000..57335e96f --- /dev/null +++ b/libcef_dll/cpptoc/zip_reader_cpptoc.cc @@ -0,0 +1,249 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/stream_reader_cpptoc.h" +#include "libcef_dll/cpptoc/zip_reader_cpptoc.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT cef_zip_reader_t* cef_zip_reader_create( + cef_stream_reader_t* stream) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: stream; type: refptr_same + DCHECK(stream); + if (!stream) + return NULL; + + // Execute + CefRefPtr _retval = CefZipReader::Create( + CefStreamReaderCppToC::Unwrap(stream)); + + // Return type: refptr_same + return CefZipReaderCppToC::Wrap(_retval); +} + + +// MEMBER FUNCTIONS - Body may be edited by hand. + +int CEF_CALLBACK zip_reader_move_to_first_file(struct _cef_zip_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefZipReaderCppToC::Get(self)->MoveToFirstFile(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK zip_reader_move_to_next_file(struct _cef_zip_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefZipReaderCppToC::Get(self)->MoveToNextFile(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK zip_reader_move_to_file(struct _cef_zip_reader_t* self, + const cef_string_t* fileName, int caseSensitive) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: fileName; type: string_byref_const + DCHECK(fileName); + if (!fileName) + return 0; + + // Execute + bool _retval = CefZipReaderCppToC::Get(self)->MoveToFile( + CefString(fileName), + caseSensitive?true:false); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK zip_reader_close(struct _cef_zip_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefZipReaderCppToC::Get(self)->Close(); + + // Return type: bool + return _retval; +} + +cef_string_userfree_t CEF_CALLBACK zip_reader_get_file_name( + struct _cef_zip_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return NULL; + + // Execute + CefString _retval = CefZipReaderCppToC::Get(self)->GetFileName(); + + // Return type: string + return _retval.DetachToUserFree(); +} + +int64 CEF_CALLBACK zip_reader_get_file_size(struct _cef_zip_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int64 _retval = CefZipReaderCppToC::Get(self)->GetFileSize(); + + // Return type: simple + return _retval; +} + +time_t CEF_CALLBACK zip_reader_get_file_last_modified( + struct _cef_zip_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + time_t _retval = CefZipReaderCppToC::Get(self)->GetFileLastModified(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK zip_reader_open_file(struct _cef_zip_reader_t* self, + const cef_string_t* password) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Unverified params: password + + // Execute + bool _retval = CefZipReaderCppToC::Get(self)->OpenFile( + CefString(password)); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK zip_reader_close_file(struct _cef_zip_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefZipReaderCppToC::Get(self)->CloseFile(); + + // Return type: bool + return _retval; +} + +int CEF_CALLBACK zip_reader_read_file(struct _cef_zip_reader_t* self, + void* buffer, size_t bufferSize) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + // Verify param: buffer; type: simple_byaddr + DCHECK(buffer); + if (!buffer) + return 0; + + // Execute + int _retval = CefZipReaderCppToC::Get(self)->ReadFile( + buffer, + bufferSize); + + // Return type: simple + return _retval; +} + +int64 CEF_CALLBACK zip_reader_tell(struct _cef_zip_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + int64 _retval = CefZipReaderCppToC::Get(self)->Tell(); + + // Return type: simple + return _retval; +} + +int CEF_CALLBACK zip_reader_eof(struct _cef_zip_reader_t* self) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + DCHECK(self); + if (!self) + return 0; + + // Execute + bool _retval = CefZipReaderCppToC::Get(self)->Eof(); + + // Return type: bool + return _retval; +} + + +// CONSTRUCTOR - Do not edit by hand. + +CefZipReaderCppToC::CefZipReaderCppToC(CefZipReader* cls) + : CefCppToC(cls) { + struct_.struct_.move_to_first_file = zip_reader_move_to_first_file; + struct_.struct_.move_to_next_file = zip_reader_move_to_next_file; + struct_.struct_.move_to_file = zip_reader_move_to_file; + struct_.struct_.close = zip_reader_close; + struct_.struct_.get_file_name = zip_reader_get_file_name; + struct_.struct_.get_file_size = zip_reader_get_file_size; + struct_.struct_.get_file_last_modified = zip_reader_get_file_last_modified; + struct_.struct_.open_file = zip_reader_open_file; + struct_.struct_.close_file = zip_reader_close_file; + struct_.struct_.read_file = zip_reader_read_file; + struct_.struct_.tell = zip_reader_tell; + struct_.struct_.eof = zip_reader_eof; +} + +#ifndef NDEBUG +template<> long CefCppToC::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/cpptoc/zip_reader_cpptoc.h b/libcef_dll/cpptoc/zip_reader_cpptoc.h new file mode 100644 index 000000000..2bfbbada8 --- /dev/null +++ b/libcef_dll/cpptoc/zip_reader_cpptoc.h @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CPPTOC_ZIP_READER_CPPTOC_H_ +#define CEF_LIBCEF_DLL_CPPTOC_ZIP_READER_CPPTOC_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_zip_reader.h" +#include "include/capi/cef_zip_reader_capi.h" +#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +// This class may be instantiated and accessed DLL-side only. +class CefZipReaderCppToC + : public CefCppToC { + public: + explicit CefZipReaderCppToC(CefZipReader* cls); + virtual ~CefZipReaderCppToC() {} +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CPPTOC_ZIP_READER_CPPTOC_H_ + diff --git a/libcef_dll/ctocpp/app_ctocpp.cc b/libcef_dll/ctocpp/app_ctocpp.cc new file mode 100644 index 000000000..0b3ea5405 --- /dev/null +++ b/libcef_dll/ctocpp/app_ctocpp.cc @@ -0,0 +1,105 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/command_line_cpptoc.h" +#include "libcef_dll/cpptoc/scheme_registrar_cpptoc.h" +#include "libcef_dll/ctocpp/app_ctocpp.h" +#include "libcef_dll/ctocpp/browser_process_handler_ctocpp.h" +#include "libcef_dll/ctocpp/render_process_handler_ctocpp.h" +#include "libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefAppCToCpp::OnBeforeCommandLineProcessing(const CefString& process_type, + CefRefPtr command_line) { + if (CEF_MEMBER_MISSING(struct_, on_before_command_line_processing)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: command_line; type: refptr_diff + DCHECK(command_line.get()); + if (!command_line.get()) + return; + // Unverified params: process_type + + // Execute + struct_->on_before_command_line_processing(struct_, + process_type.GetStruct(), + CefCommandLineCppToC::Wrap(command_line)); +} + +void CefAppCToCpp::OnRegisterCustomSchemes( + CefRefPtr registrar) { + if (CEF_MEMBER_MISSING(struct_, on_register_custom_schemes)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: registrar; type: refptr_diff + DCHECK(registrar.get()); + if (!registrar.get()) + return; + + // Execute + struct_->on_register_custom_schemes(struct_, + CefSchemeRegistrarCppToC::Wrap(registrar)); +} + +CefRefPtr CefAppCToCpp::GetResourceBundleHandler() { + if (CEF_MEMBER_MISSING(struct_, get_resource_bundle_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_resource_bundle_handler_t* _retval = struct_->get_resource_bundle_handler( + struct_); + + // Return type: refptr_same + return CefResourceBundleHandlerCToCpp::Wrap(_retval); +} + +CefRefPtr CefAppCToCpp::GetBrowserProcessHandler() { + if (CEF_MEMBER_MISSING(struct_, get_browser_process_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_browser_process_handler_t* _retval = struct_->get_browser_process_handler( + struct_); + + // Return type: refptr_same + return CefBrowserProcessHandlerCToCpp::Wrap(_retval); +} + +CefRefPtr CefAppCToCpp::GetRenderProcessHandler() { + if (CEF_MEMBER_MISSING(struct_, get_render_process_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_render_process_handler_t* _retval = struct_->get_render_process_handler( + struct_); + + // Return type: refptr_same + return CefRenderProcessHandlerCToCpp::Wrap(_retval); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/app_ctocpp.h b/libcef_dll/ctocpp/app_ctocpp.h new file mode 100644 index 000000000..8707addca --- /dev/null +++ b/libcef_dll/ctocpp/app_ctocpp.h @@ -0,0 +1,48 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_APP_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_APP_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_app.h" +#include "include/capi/cef_app_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefAppCToCpp + : public CefCToCpp { + public: + explicit CefAppCToCpp(cef_app_t* str) + : CefCToCpp(str) {} + virtual ~CefAppCToCpp() {} + + // CefApp methods + virtual void OnBeforeCommandLineProcessing(const CefString& process_type, + CefRefPtr command_line) OVERRIDE; + virtual void OnRegisterCustomSchemes( + CefRefPtr registrar) OVERRIDE; + virtual CefRefPtr GetResourceBundleHandler( + ) OVERRIDE; + virtual CefRefPtr GetBrowserProcessHandler( + ) OVERRIDE; + virtual CefRefPtr GetRenderProcessHandler() OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_APP_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/auth_callback_ctocpp.cc b/libcef_dll/ctocpp/auth_callback_ctocpp.cc new file mode 100644 index 000000000..a914971b2 --- /dev/null +++ b/libcef_dll/ctocpp/auth_callback_ctocpp.cc @@ -0,0 +1,55 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/auth_callback_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefAuthCallbackCToCpp::Continue(const CefString& username, + const CefString& password) { + if (CEF_MEMBER_MISSING(struct_, cont)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: username; type: string_byref_const + DCHECK(!username.empty()); + if (username.empty()) + return; + // Verify param: password; type: string_byref_const + DCHECK(!password.empty()); + if (password.empty()) + return; + + // Execute + struct_->cont(struct_, + username.GetStruct(), + password.GetStruct()); +} + +void CefAuthCallbackCToCpp::Cancel() { + if (CEF_MEMBER_MISSING(struct_, cancel)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->cancel(struct_); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/auth_callback_ctocpp.h b/libcef_dll/ctocpp/auth_callback_ctocpp.h new file mode 100644 index 000000000..7bc3a281a --- /dev/null +++ b/libcef_dll/ctocpp/auth_callback_ctocpp.h @@ -0,0 +1,44 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_AUTH_CALLBACK_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_AUTH_CALLBACK_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_request_handler.h" +#include "include/capi/cef_request_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefAuthCallbackCToCpp + : public CefCToCpp { + public: + explicit CefAuthCallbackCToCpp(cef_auth_callback_t* str) + : CefCToCpp( + str) {} + virtual ~CefAuthCallbackCToCpp() {} + + // CefAuthCallback methods + virtual void Continue(const CefString& username, + const CefString& password) OVERRIDE; + virtual void Cancel() OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_AUTH_CALLBACK_CTOCPP_H_ + diff --git a/cef/libcef_dll/ctocpp/base_ctocpp.h b/libcef_dll/ctocpp/base_ctocpp.h similarity index 100% rename from cef/libcef_dll/ctocpp/base_ctocpp.h rename to libcef_dll/ctocpp/base_ctocpp.h diff --git a/libcef_dll/ctocpp/before_download_callback_ctocpp.cc b/libcef_dll/ctocpp/before_download_callback_ctocpp.cc new file mode 100644 index 000000000..1bc27870b --- /dev/null +++ b/libcef_dll/ctocpp/before_download_callback_ctocpp.cc @@ -0,0 +1,39 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/before_download_callback_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefBeforeDownloadCallbackCToCpp::Continue(const CefString& download_path, + bool show_dialog) { + if (CEF_MEMBER_MISSING(struct_, cont)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Unverified params: download_path + + // Execute + struct_->cont(struct_, + download_path.GetStruct(), + show_dialog); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = + 0; +#endif + diff --git a/libcef_dll/ctocpp/before_download_callback_ctocpp.h b/libcef_dll/ctocpp/before_download_callback_ctocpp.h new file mode 100644 index 000000000..ad8106a2b --- /dev/null +++ b/libcef_dll/ctocpp/before_download_callback_ctocpp.h @@ -0,0 +1,43 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_BEFORE_DOWNLOAD_CALLBACK_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_BEFORE_DOWNLOAD_CALLBACK_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_download_handler.h" +#include "include/capi/cef_download_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefBeforeDownloadCallbackCToCpp + : public CefCToCpp { + public: + explicit CefBeforeDownloadCallbackCToCpp(cef_before_download_callback_t* str) + : CefCToCpp(str) {} + virtual ~CefBeforeDownloadCallbackCToCpp() {} + + // CefBeforeDownloadCallback methods + virtual void Continue(const CefString& download_path, + bool show_dialog) OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_BEFORE_DOWNLOAD_CALLBACK_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/binary_value_ctocpp.cc b/libcef_dll/ctocpp/binary_value_ctocpp.cc new file mode 100644 index 000000000..4e62a8385 --- /dev/null +++ b/libcef_dll/ctocpp/binary_value_ctocpp.cc @@ -0,0 +1,118 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/binary_value_ctocpp.h" + + +// STATIC METHODS - Body may be edited by hand. + +CefRefPtr CefBinaryValue::Create(const void* data, + size_t data_size) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: data; type: simple_byaddr + DCHECK(data); + if (!data) + return NULL; + + // Execute + cef_binary_value_t* _retval = cef_binary_value_create( + data, + data_size); + + // Return type: refptr_same + return CefBinaryValueCToCpp::Wrap(_retval); +} + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefBinaryValueCToCpp::IsValid() { + if (CEF_MEMBER_MISSING(struct_, is_valid)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_valid(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefBinaryValueCToCpp::IsOwned() { + if (CEF_MEMBER_MISSING(struct_, is_owned)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_owned(struct_); + + // Return type: bool + return _retval?true:false; +} + +CefRefPtr CefBinaryValueCToCpp::Copy() { + if (CEF_MEMBER_MISSING(struct_, copy)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_binary_value_t* _retval = struct_->copy(struct_); + + // Return type: refptr_same + return CefBinaryValueCToCpp::Wrap(_retval); +} + +size_t CefBinaryValueCToCpp::GetSize() { + if (CEF_MEMBER_MISSING(struct_, get_size)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + size_t _retval = struct_->get_size(struct_); + + // Return type: simple + return _retval; +} + +size_t CefBinaryValueCToCpp::GetData(void* buffer, size_t buffer_size, + size_t data_offset) { + if (CEF_MEMBER_MISSING(struct_, get_data)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: buffer; type: simple_byaddr + DCHECK(buffer); + if (!buffer) + return 0; + + // Execute + size_t _retval = struct_->get_data(struct_, + buffer, + buffer_size, + data_offset); + + // Return type: simple + return _retval; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/binary_value_ctocpp.h b/libcef_dll/ctocpp/binary_value_ctocpp.h new file mode 100644 index 000000000..89b604bfa --- /dev/null +++ b/libcef_dll/ctocpp/binary_value_ctocpp.h @@ -0,0 +1,47 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_BINARY_VALUE_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_BINARY_VALUE_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_values.h" +#include "include/capi/cef_values_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefBinaryValueCToCpp + : public CefCToCpp { + public: + explicit CefBinaryValueCToCpp(cef_binary_value_t* str) + : CefCToCpp( + str) {} + virtual ~CefBinaryValueCToCpp() {} + + // CefBinaryValue methods + virtual bool IsValid() OVERRIDE; + virtual bool IsOwned() OVERRIDE; + virtual CefRefPtr Copy() OVERRIDE; + virtual size_t GetSize() OVERRIDE; + virtual size_t GetData(void* buffer, size_t buffer_size, + size_t data_offset) OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_BINARY_VALUE_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/browser_ctocpp.cc b/libcef_dll/ctocpp/browser_ctocpp.cc new file mode 100644 index 000000000..3cc245e40 --- /dev/null +++ b/libcef_dll/ctocpp/browser_ctocpp.cc @@ -0,0 +1,323 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/browser_host_ctocpp.h" +#include "libcef_dll/ctocpp/frame_ctocpp.h" +#include "libcef_dll/ctocpp/process_message_ctocpp.h" +#include "libcef_dll/transfer_util.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +CefRefPtr CefBrowserCToCpp::GetHost() { + if (CEF_MEMBER_MISSING(struct_, get_host)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_browser_host_t* _retval = struct_->get_host(struct_); + + // Return type: refptr_same + return CefBrowserHostCToCpp::Wrap(_retval); +} + +bool CefBrowserCToCpp::CanGoBack() { + if (CEF_MEMBER_MISSING(struct_, can_go_back)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->can_go_back(struct_); + + // Return type: bool + return _retval?true:false; +} + +void CefBrowserCToCpp::GoBack() { + if (CEF_MEMBER_MISSING(struct_, go_back)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->go_back(struct_); +} + +bool CefBrowserCToCpp::CanGoForward() { + if (CEF_MEMBER_MISSING(struct_, can_go_forward)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->can_go_forward(struct_); + + // Return type: bool + return _retval?true:false; +} + +void CefBrowserCToCpp::GoForward() { + if (CEF_MEMBER_MISSING(struct_, go_forward)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->go_forward(struct_); +} + +bool CefBrowserCToCpp::IsLoading() { + if (CEF_MEMBER_MISSING(struct_, is_loading)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_loading(struct_); + + // Return type: bool + return _retval?true:false; +} + +void CefBrowserCToCpp::Reload() { + if (CEF_MEMBER_MISSING(struct_, reload)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->reload(struct_); +} + +void CefBrowserCToCpp::ReloadIgnoreCache() { + if (CEF_MEMBER_MISSING(struct_, reload_ignore_cache)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->reload_ignore_cache(struct_); +} + +void CefBrowserCToCpp::StopLoad() { + if (CEF_MEMBER_MISSING(struct_, stop_load)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->stop_load(struct_); +} + +int CefBrowserCToCpp::GetIdentifier() { + if (CEF_MEMBER_MISSING(struct_, get_identifier)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->get_identifier(struct_); + + // Return type: simple + return _retval; +} + +bool CefBrowserCToCpp::IsPopup() { + if (CEF_MEMBER_MISSING(struct_, is_popup)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_popup(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefBrowserCToCpp::HasDocument() { + if (CEF_MEMBER_MISSING(struct_, has_document)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->has_document(struct_); + + // Return type: bool + return _retval?true:false; +} + +CefRefPtr CefBrowserCToCpp::GetMainFrame() { + if (CEF_MEMBER_MISSING(struct_, get_main_frame)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_frame_t* _retval = struct_->get_main_frame(struct_); + + // Return type: refptr_same + return CefFrameCToCpp::Wrap(_retval); +} + +CefRefPtr CefBrowserCToCpp::GetFocusedFrame() { + if (CEF_MEMBER_MISSING(struct_, get_focused_frame)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_frame_t* _retval = struct_->get_focused_frame(struct_); + + // Return type: refptr_same + return CefFrameCToCpp::Wrap(_retval); +} + +CefRefPtr CefBrowserCToCpp::GetFrame(int64 identifier) { + if (CEF_MEMBER_MISSING(struct_, get_frame_byident)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_frame_t* _retval = struct_->get_frame_byident(struct_, + identifier); + + // Return type: refptr_same + return CefFrameCToCpp::Wrap(_retval); +} + +CefRefPtr CefBrowserCToCpp::GetFrame(const CefString& name) { + if (CEF_MEMBER_MISSING(struct_, get_frame)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: name; type: string_byref_const + DCHECK(!name.empty()); + if (name.empty()) + return NULL; + + // Execute + cef_frame_t* _retval = struct_->get_frame(struct_, + name.GetStruct()); + + // Return type: refptr_same + return CefFrameCToCpp::Wrap(_retval); +} + +size_t CefBrowserCToCpp::GetFrameCount() { + if (CEF_MEMBER_MISSING(struct_, get_frame_count)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + size_t _retval = struct_->get_frame_count(struct_); + + // Return type: simple + return _retval; +} + +void CefBrowserCToCpp::GetFrameIdentifiers(std::vector& identifiers) { + if (CEF_MEMBER_MISSING(struct_, get_frame_identifiers)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Translate param: identifiers; type: simple_vec_byref + size_t identifiersSize = identifiers.size(); + size_t identifiersCount = std::max(GetFrameCount(), identifiersSize); + int64* identifiersList = NULL; + if (identifiersCount > 0) { + identifiersList = new int64[identifiersCount]; + DCHECK(identifiersList); + if (identifiersList) { + memset(identifiersList, 0, sizeof(int64)*identifiersCount); + } + if (identifiersList && identifiersSize > 0) { + for (size_t i = 0; i < identifiersSize; ++i) { + identifiersList[i] = identifiers[i]; + } + } + } + + // Execute + struct_->get_frame_identifiers(struct_, + &identifiersCount, + identifiersList); + + // Restore param:identifiers; type: simple_vec_byref + identifiers.clear(); + if (identifiersCount > 0 && identifiersList) { + for (size_t i = 0; i < identifiersCount; ++i) { + identifiers.push_back(identifiersList[i]); + } + delete [] identifiersList; + } +} + +void CefBrowserCToCpp::GetFrameNames(std::vector& names) { + if (CEF_MEMBER_MISSING(struct_, get_frame_names)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Translate param: names; type: string_vec_byref + cef_string_list_t namesList = cef_string_list_alloc(); + DCHECK(namesList); + if (namesList) + transfer_string_list_contents(names, namesList); + + // Execute + struct_->get_frame_names(struct_, + namesList); + + // Restore param:names; type: string_vec_byref + if (namesList) { + names.clear(); + transfer_string_list_contents(namesList, names); + cef_string_list_free(namesList); + } +} + +bool CefBrowserCToCpp::SendProcessMessage(CefProcessId target_process, + CefRefPtr message) { + if (CEF_MEMBER_MISSING(struct_, send_process_message)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: message; type: refptr_same + DCHECK(message.get()); + if (!message.get()) + return false; + + // Execute + int _retval = struct_->send_process_message(struct_, + target_process, + CefProcessMessageCToCpp::Unwrap(message)); + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/browser_ctocpp.h b/libcef_dll/ctocpp/browser_ctocpp.h new file mode 100644 index 000000000..9b0375243 --- /dev/null +++ b/libcef_dll/ctocpp/browser_ctocpp.h @@ -0,0 +1,63 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_BROWSER_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include +#include "include/cef_browser.h" +#include "include/capi/cef_browser_capi.h" +#include "include/cef_client.h" +#include "include/capi/cef_client_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefBrowserCToCpp + : public CefCToCpp { + public: + explicit CefBrowserCToCpp(cef_browser_t* str) + : CefCToCpp(str) {} + virtual ~CefBrowserCToCpp() {} + + // CefBrowser methods + virtual CefRefPtr GetHost() OVERRIDE; + virtual bool CanGoBack() OVERRIDE; + virtual void GoBack() OVERRIDE; + virtual bool CanGoForward() OVERRIDE; + virtual void GoForward() OVERRIDE; + virtual bool IsLoading() OVERRIDE; + virtual void Reload() OVERRIDE; + virtual void ReloadIgnoreCache() OVERRIDE; + virtual void StopLoad() OVERRIDE; + virtual int GetIdentifier() OVERRIDE; + virtual bool IsPopup() OVERRIDE; + virtual bool HasDocument() OVERRIDE; + virtual CefRefPtr GetMainFrame() OVERRIDE; + virtual CefRefPtr GetFocusedFrame() OVERRIDE; + virtual CefRefPtr GetFrame(int64 identifier) OVERRIDE; + virtual CefRefPtr GetFrame(const CefString& name) OVERRIDE; + virtual size_t GetFrameCount() OVERRIDE; + virtual void GetFrameIdentifiers(std::vector& identifiers) OVERRIDE; + virtual void GetFrameNames(std::vector& names) OVERRIDE; + virtual bool SendProcessMessage(CefProcessId target_process, + CefRefPtr message) OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_BROWSER_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/browser_host_ctocpp.cc b/libcef_dll/ctocpp/browser_host_ctocpp.cc new file mode 100644 index 000000000..c1ce07257 --- /dev/null +++ b/libcef_dll/ctocpp/browser_host_ctocpp.cc @@ -0,0 +1,195 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/client_cpptoc.h" +#include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/browser_host_ctocpp.h" + + +// STATIC METHODS - Body may be edited by hand. + +bool CefBrowserHost::CreateBrowser(const CefWindowInfo& windowInfo, + CefRefPtr client, const CefString& url, + const CefBrowserSettings& settings) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: client; type: refptr_diff + DCHECK(client.get()); + if (!client.get()) + return false; + // Unverified params: url + + // Execute + int _retval = cef_browser_host_create_browser( + &windowInfo, + CefClientCppToC::Wrap(client), + url.GetStruct(), + &settings); + + // Return type: bool + return _retval?true:false; +} + +CefRefPtr CefBrowserHost::CreateBrowserSync( + const CefWindowInfo& windowInfo, CefRefPtr client, + const CefString& url, const CefBrowserSettings& settings) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: client; type: refptr_diff + DCHECK(client.get()); + if (!client.get()) + return NULL; + // Unverified params: url + + // Execute + cef_browser_t* _retval = cef_browser_host_create_browser_sync( + &windowInfo, + CefClientCppToC::Wrap(client), + url.GetStruct(), + &settings); + + // Return type: refptr_same + return CefBrowserCToCpp::Wrap(_retval); +} + + +// VIRTUAL METHODS - Body may be edited by hand. + +CefRefPtr CefBrowserHostCToCpp::GetBrowser() { + if (CEF_MEMBER_MISSING(struct_, get_browser)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_browser_t* _retval = struct_->get_browser(struct_); + + // Return type: refptr_same + return CefBrowserCToCpp::Wrap(_retval); +} + +void CefBrowserHostCToCpp::ParentWindowWillClose() { + if (CEF_MEMBER_MISSING(struct_, parent_window_will_close)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->parent_window_will_close(struct_); +} + +void CefBrowserHostCToCpp::CloseBrowser() { + if (CEF_MEMBER_MISSING(struct_, close_browser)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->close_browser(struct_); +} + +void CefBrowserHostCToCpp::SetFocus(bool enable) { + if (CEF_MEMBER_MISSING(struct_, set_focus)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->set_focus(struct_, + enable); +} + +CefWindowHandle CefBrowserHostCToCpp::GetWindowHandle() { + if (CEF_MEMBER_MISSING(struct_, get_window_handle)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_window_handle_t _retval = struct_->get_window_handle(struct_); + + // Return type: simple + return _retval; +} + +CefWindowHandle CefBrowserHostCToCpp::GetOpenerWindowHandle() { + if (CEF_MEMBER_MISSING(struct_, get_opener_window_handle)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_window_handle_t _retval = struct_->get_opener_window_handle(struct_); + + // Return type: simple + return _retval; +} + +CefRefPtr CefBrowserHostCToCpp::GetClient() { + if (CEF_MEMBER_MISSING(struct_, get_client)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_client_t* _retval = struct_->get_client(struct_); + + // Return type: refptr_diff + return CefClientCppToC::Unwrap(_retval); +} + +CefString CefBrowserHostCToCpp::GetDevToolsURL(bool http_scheme) { + if (CEF_MEMBER_MISSING(struct_, get_dev_tools_url)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_dev_tools_url(struct_, + http_scheme); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +double CefBrowserHostCToCpp::GetZoomLevel() { + if (CEF_MEMBER_MISSING(struct_, get_zoom_level)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + double _retval = struct_->get_zoom_level(struct_); + + // Return type: simple + return _retval; +} + +void CefBrowserHostCToCpp::SetZoomLevel(double zoomLevel) { + if (CEF_MEMBER_MISSING(struct_, set_zoom_level)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->set_zoom_level(struct_, + zoomLevel); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/browser_host_ctocpp.h b/libcef_dll/ctocpp/browser_host_ctocpp.h new file mode 100644 index 000000000..d533e16f8 --- /dev/null +++ b/libcef_dll/ctocpp/browser_host_ctocpp.h @@ -0,0 +1,53 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_browser.h" +#include "include/capi/cef_browser_capi.h" +#include "include/cef_client.h" +#include "include/capi/cef_client_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefBrowserHostCToCpp + : public CefCToCpp { + public: + explicit CefBrowserHostCToCpp(cef_browser_host_t* str) + : CefCToCpp( + str) {} + virtual ~CefBrowserHostCToCpp() {} + + // CefBrowserHost methods + virtual CefRefPtr GetBrowser() OVERRIDE; + virtual void ParentWindowWillClose() OVERRIDE; + virtual void CloseBrowser() OVERRIDE; + virtual void SetFocus(bool enable) OVERRIDE; + virtual CefWindowHandle GetWindowHandle() OVERRIDE; + virtual CefWindowHandle GetOpenerWindowHandle() OVERRIDE; + virtual CefRefPtr GetClient() OVERRIDE; + virtual CefString GetDevToolsURL(bool http_scheme) OVERRIDE; + virtual double GetZoomLevel() OVERRIDE; + virtual void SetZoomLevel(double zoomLevel) OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/browser_process_handler_ctocpp.cc b/libcef_dll/ctocpp/browser_process_handler_ctocpp.cc new file mode 100644 index 000000000..4f51ae702 --- /dev/null +++ b/libcef_dll/ctocpp/browser_process_handler_ctocpp.cc @@ -0,0 +1,47 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/browser_process_handler_ctocpp.h" +#include "libcef_dll/ctocpp/proxy_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +CefRefPtr CefBrowserProcessHandlerCToCpp::GetProxyHandler() { + if (CEF_MEMBER_MISSING(struct_, get_proxy_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_proxy_handler_t* _retval = struct_->get_proxy_handler(struct_); + + // Return type: refptr_same + return CefProxyHandlerCToCpp::Wrap(_retval); +} + +void CefBrowserProcessHandlerCToCpp::OnContextInitialized() { + if (CEF_MEMBER_MISSING(struct_, on_context_initialized)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->on_context_initialized(struct_); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/browser_process_handler_ctocpp.h b/libcef_dll/ctocpp/browser_process_handler_ctocpp.h new file mode 100644 index 000000000..25913aa3b --- /dev/null +++ b/libcef_dll/ctocpp/browser_process_handler_ctocpp.h @@ -0,0 +1,43 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_PROCESS_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_BROWSER_PROCESS_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_browser_process_handler.h" +#include "include/capi/cef_browser_process_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefBrowserProcessHandlerCToCpp + : public CefCToCpp { + public: + explicit CefBrowserProcessHandlerCToCpp(cef_browser_process_handler_t* str) + : CefCToCpp(str) {} + virtual ~CefBrowserProcessHandlerCToCpp() {} + + // CefBrowserProcessHandler methods + virtual CefRefPtr GetProxyHandler() OVERRIDE; + virtual void OnContextInitialized() OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_BROWSER_PROCESS_HANDLER_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/callback_ctocpp.cc b/libcef_dll/ctocpp/callback_ctocpp.cc new file mode 100644 index 000000000..6c622ecc0 --- /dev/null +++ b/libcef_dll/ctocpp/callback_ctocpp.cc @@ -0,0 +1,43 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/callback_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefCallbackCToCpp::Continue() { + if (CEF_MEMBER_MISSING(struct_, cont)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->cont(struct_); +} + +void CefCallbackCToCpp::Cancel() { + if (CEF_MEMBER_MISSING(struct_, cancel)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->cancel(struct_); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/callback_ctocpp.h b/libcef_dll/ctocpp/callback_ctocpp.h new file mode 100644 index 000000000..3581e286d --- /dev/null +++ b/libcef_dll/ctocpp/callback_ctocpp.h @@ -0,0 +1,41 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_CALLBACK_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_CALLBACK_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_callback.h" +#include "include/capi/cef_callback_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefCallbackCToCpp + : public CefCToCpp { + public: + explicit CefCallbackCToCpp(cef_callback_t* str) + : CefCToCpp(str) {} + virtual ~CefCallbackCToCpp() {} + + // CefCallback methods + virtual void Continue() OVERRIDE; + virtual void Cancel() OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_CALLBACK_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/client_ctocpp.cc b/libcef_dll/ctocpp/client_ctocpp.cc new file mode 100644 index 000000000..2d3b7a60c --- /dev/null +++ b/libcef_dll/ctocpp/client_ctocpp.cc @@ -0,0 +1,193 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/process_message_cpptoc.h" +#include "libcef_dll/ctocpp/client_ctocpp.h" +#include "libcef_dll/ctocpp/context_menu_handler_ctocpp.h" +#include "libcef_dll/ctocpp/display_handler_ctocpp.h" +#include "libcef_dll/ctocpp/download_handler_ctocpp.h" +#include "libcef_dll/ctocpp/focus_handler_ctocpp.h" +#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h" +#include "libcef_dll/ctocpp/jsdialog_handler_ctocpp.h" +#include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h" +#include "libcef_dll/ctocpp/life_span_handler_ctocpp.h" +#include "libcef_dll/ctocpp/load_handler_ctocpp.h" +#include "libcef_dll/ctocpp/request_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +CefRefPtr CefClientCToCpp::GetContextMenuHandler() { + if (CEF_MEMBER_MISSING(struct_, get_context_menu_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_context_menu_handler_t* _retval = struct_->get_context_menu_handler( + struct_); + + // Return type: refptr_same + return CefContextMenuHandlerCToCpp::Wrap(_retval); +} + +CefRefPtr CefClientCToCpp::GetDisplayHandler() { + if (CEF_MEMBER_MISSING(struct_, get_display_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_display_handler_t* _retval = struct_->get_display_handler(struct_); + + // Return type: refptr_same + return CefDisplayHandlerCToCpp::Wrap(_retval); +} + +CefRefPtr CefClientCToCpp::GetDownloadHandler() { + if (CEF_MEMBER_MISSING(struct_, get_download_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_download_handler_t* _retval = struct_->get_download_handler(struct_); + + // Return type: refptr_same + return CefDownloadHandlerCToCpp::Wrap(_retval); +} + +CefRefPtr CefClientCToCpp::GetFocusHandler() { + if (CEF_MEMBER_MISSING(struct_, get_focus_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_focus_handler_t* _retval = struct_->get_focus_handler(struct_); + + // Return type: refptr_same + return CefFocusHandlerCToCpp::Wrap(_retval); +} + +CefRefPtr CefClientCToCpp::GetGeolocationHandler() { + if (CEF_MEMBER_MISSING(struct_, get_geolocation_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_geolocation_handler_t* _retval = struct_->get_geolocation_handler( + struct_); + + // Return type: refptr_same + return CefGeolocationHandlerCToCpp::Wrap(_retval); +} + +CefRefPtr CefClientCToCpp::GetJSDialogHandler() { + if (CEF_MEMBER_MISSING(struct_, get_jsdialog_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_jsdialog_handler_t* _retval = struct_->get_jsdialog_handler(struct_); + + // Return type: refptr_same + return CefJSDialogHandlerCToCpp::Wrap(_retval); +} + +CefRefPtr CefClientCToCpp::GetKeyboardHandler() { + if (CEF_MEMBER_MISSING(struct_, get_keyboard_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_keyboard_handler_t* _retval = struct_->get_keyboard_handler(struct_); + + // Return type: refptr_same + return CefKeyboardHandlerCToCpp::Wrap(_retval); +} + +CefRefPtr CefClientCToCpp::GetLifeSpanHandler() { + if (CEF_MEMBER_MISSING(struct_, get_life_span_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_life_span_handler_t* _retval = struct_->get_life_span_handler(struct_); + + // Return type: refptr_same + return CefLifeSpanHandlerCToCpp::Wrap(_retval); +} + +CefRefPtr CefClientCToCpp::GetLoadHandler() { + if (CEF_MEMBER_MISSING(struct_, get_load_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_load_handler_t* _retval = struct_->get_load_handler(struct_); + + // Return type: refptr_same + return CefLoadHandlerCToCpp::Wrap(_retval); +} + +CefRefPtr CefClientCToCpp::GetRequestHandler() { + if (CEF_MEMBER_MISSING(struct_, get_request_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_request_handler_t* _retval = struct_->get_request_handler(struct_); + + // Return type: refptr_same + return CefRequestHandlerCToCpp::Wrap(_retval); +} + +bool CefClientCToCpp::OnProcessMessageReceived(CefRefPtr browser, + CefProcessId source_process, CefRefPtr message) { + if (CEF_MEMBER_MISSING(struct_, on_process_message_received)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + // Verify param: message; type: refptr_diff + DCHECK(message.get()); + if (!message.get()) + return false; + + // Execute + int _retval = struct_->on_process_message_received(struct_, + CefBrowserCppToC::Wrap(browser), + source_process, + CefProcessMessageCppToC::Wrap(message)); + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/client_ctocpp.h b/libcef_dll/ctocpp/client_ctocpp.h new file mode 100644 index 000000000..c2cf17c8e --- /dev/null +++ b/libcef_dll/ctocpp/client_ctocpp.h @@ -0,0 +1,52 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_CLIENT_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_CLIENT_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_client.h" +#include "include/capi/cef_client_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefClientCToCpp + : public CefCToCpp { + public: + explicit CefClientCToCpp(cef_client_t* str) + : CefCToCpp(str) {} + virtual ~CefClientCToCpp() {} + + // CefClient methods + virtual CefRefPtr GetContextMenuHandler() OVERRIDE; + virtual CefRefPtr GetDisplayHandler() OVERRIDE; + virtual CefRefPtr GetDownloadHandler() OVERRIDE; + virtual CefRefPtr GetFocusHandler() OVERRIDE; + virtual CefRefPtr GetGeolocationHandler() OVERRIDE; + virtual CefRefPtr GetJSDialogHandler() OVERRIDE; + virtual CefRefPtr GetKeyboardHandler() OVERRIDE; + virtual CefRefPtr GetLifeSpanHandler() OVERRIDE; + virtual CefRefPtr GetLoadHandler() OVERRIDE; + virtual CefRefPtr GetRequestHandler() OVERRIDE; + virtual bool OnProcessMessageReceived(CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_CLIENT_CTOCPP_H_ + diff --git a/cef/libcef_dll/ctocpp/command_line_ctocpp.cc b/libcef_dll/ctocpp/command_line_ctocpp.cc similarity index 82% rename from cef/libcef_dll/ctocpp/command_line_ctocpp.cc rename to libcef_dll/ctocpp/command_line_ctocpp.cc index 7bbc1d313..5838c777b 100644 --- a/cef/libcef_dll/ctocpp/command_line_ctocpp.cc +++ b/libcef_dll/ctocpp/command_line_ctocpp.cc @@ -34,9 +34,65 @@ CefRefPtr CefCommandLine::CreateCommandLine() { return CefCommandLineCToCpp::Wrap(_retval); } +CefRefPtr CefCommandLine::GetGlobalCommandLine() { + int build_revision = cef_build_revision(); + if (build_revision != CEF_REVISION) { + // The libcef build revision does not match the CEF API revision. + DCHECK(false); + return NULL; + } + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_command_line_t* _retval = cef_command_line_get_global(); + + // Return type: refptr_same + return CefCommandLineCToCpp::Wrap(_retval); +} + // VIRTUAL METHODS - Body may be edited by hand. +bool CefCommandLineCToCpp::IsValid() { + if (CEF_MEMBER_MISSING(struct_, is_valid)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_valid(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefCommandLineCToCpp::IsReadOnly() { + if (CEF_MEMBER_MISSING(struct_, is_read_only)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_read_only(struct_); + + // Return type: bool + return _retval?true:false; +} + +CefRefPtr CefCommandLineCToCpp::Copy() { + if (CEF_MEMBER_MISSING(struct_, copy)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_command_line_t* _retval = struct_->copy(struct_); + + // Return type: refptr_same + return CefCommandLineCToCpp::Wrap(_retval); +} + void CefCommandLineCToCpp::InitFromArgv(int argc, const char* const* argv) { if (CEF_MEMBER_MISSING(struct_, init_from_argv)) return; @@ -70,6 +126,16 @@ void CefCommandLineCToCpp::InitFromString(const CefString& command_line) { command_line.GetStruct()); } +void CefCommandLineCToCpp::Reset() { + if (CEF_MEMBER_MISSING(struct_, reset)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->reset(struct_); +} + CefString CefCommandLineCToCpp::GetCommandLineString() { if (CEF_MEMBER_MISSING(struct_, get_command_line_string)) return CefString(); diff --git a/cef/libcef_dll/ctocpp/command_line_ctocpp.h b/libcef_dll/ctocpp/command_line_ctocpp.h similarity index 93% rename from cef/libcef_dll/ctocpp/command_line_ctocpp.h rename to libcef_dll/ctocpp/command_line_ctocpp.h index f66c7be1f..9156aec7d 100644 --- a/cef/libcef_dll/ctocpp/command_line_ctocpp.h +++ b/libcef_dll/ctocpp/command_line_ctocpp.h @@ -34,8 +34,12 @@ class CefCommandLineCToCpp virtual ~CefCommandLineCToCpp() {} // CefCommandLine methods + virtual bool IsValid() OVERRIDE; + virtual bool IsReadOnly() OVERRIDE; + virtual CefRefPtr Copy() OVERRIDE; virtual void InitFromArgv(int argc, const char* const* argv) OVERRIDE; virtual void InitFromString(const CefString& command_line) OVERRIDE; + virtual void Reset() OVERRIDE; virtual CefString GetCommandLineString() OVERRIDE; virtual CefString GetProgram() OVERRIDE; virtual void SetProgram(const CefString& program) OVERRIDE; diff --git a/libcef_dll/ctocpp/context_menu_handler_ctocpp.cc b/libcef_dll/ctocpp/context_menu_handler_ctocpp.cc new file mode 100644 index 000000000..e4bd6c3af --- /dev/null +++ b/libcef_dll/ctocpp/context_menu_handler_ctocpp.cc @@ -0,0 +1,116 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/context_menu_params_cpptoc.h" +#include "libcef_dll/cpptoc/frame_cpptoc.h" +#include "libcef_dll/cpptoc/menu_model_cpptoc.h" +#include "libcef_dll/ctocpp/context_menu_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefContextMenuHandlerCToCpp::OnBeforeContextMenu( + CefRefPtr browser, CefRefPtr frame, + CefRefPtr params, CefRefPtr model) { + if (CEF_MEMBER_MISSING(struct_, on_before_context_menu)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return; + // Verify param: params; type: refptr_diff + DCHECK(params.get()); + if (!params.get()) + return; + // Verify param: model; type: refptr_diff + DCHECK(model.get()); + if (!model.get()) + return; + + // Execute + struct_->on_before_context_menu(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + CefContextMenuParamsCppToC::Wrap(params), + CefMenuModelCppToC::Wrap(model)); +} + +bool CefContextMenuHandlerCToCpp::OnContextMenuCommand( + CefRefPtr browser, CefRefPtr frame, + CefRefPtr params, int command_id, + EventFlags event_flags) { + if (CEF_MEMBER_MISSING(struct_, on_context_menu_command)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return false; + // Verify param: params; type: refptr_diff + DCHECK(params.get()); + if (!params.get()) + return false; + + // Execute + int _retval = struct_->on_context_menu_command(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + CefContextMenuParamsCppToC::Wrap(params), + command_id, + event_flags); + + // Return type: bool + return _retval?true:false; +} + +void CefContextMenuHandlerCToCpp::OnContextMenuDismissed( + CefRefPtr browser, CefRefPtr frame) { + if (CEF_MEMBER_MISSING(struct_, on_context_menu_dismissed)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return; + + // Execute + struct_->on_context_menu_dismissed(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame)); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/context_menu_handler_ctocpp.h b/libcef_dll/ctocpp/context_menu_handler_ctocpp.h new file mode 100644 index 000000000..a3f1b8a74 --- /dev/null +++ b/libcef_dll/ctocpp/context_menu_handler_ctocpp.h @@ -0,0 +1,49 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_CONTEXT_MENU_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_CONTEXT_MENU_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_context_menu_handler.h" +#include "include/capi/cef_context_menu_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefContextMenuHandlerCToCpp + : public CefCToCpp { + public: + explicit CefContextMenuHandlerCToCpp(cef_context_menu_handler_t* str) + : CefCToCpp(str) {} + virtual ~CefContextMenuHandlerCToCpp() {} + + // CefContextMenuHandler methods + virtual void OnBeforeContextMenu(CefRefPtr browser, + CefRefPtr frame, CefRefPtr params, + CefRefPtr model) OVERRIDE; + virtual bool OnContextMenuCommand(CefRefPtr browser, + CefRefPtr frame, CefRefPtr params, + int command_id, EventFlags event_flags) OVERRIDE; + virtual void OnContextMenuDismissed(CefRefPtr browser, + CefRefPtr frame) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_CONTEXT_MENU_HANDLER_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/context_menu_params_ctocpp.cc b/libcef_dll/ctocpp/context_menu_params_ctocpp.cc new file mode 100644 index 000000000..e70638aef --- /dev/null +++ b/libcef_dll/ctocpp/context_menu_params_ctocpp.cc @@ -0,0 +1,249 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/context_menu_params_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +int CefContextMenuParamsCToCpp::GetXCoord() { + if (CEF_MEMBER_MISSING(struct_, get_xcoord)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->get_xcoord(struct_); + + // Return type: simple + return _retval; +} + +int CefContextMenuParamsCToCpp::GetYCoord() { + if (CEF_MEMBER_MISSING(struct_, get_ycoord)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->get_ycoord(struct_); + + // Return type: simple + return _retval; +} + +CefContextMenuParams::TypeFlags CefContextMenuParamsCToCpp::GetTypeFlags() { + if (CEF_MEMBER_MISSING(struct_, get_type_flags)) + return CM_TYPEFLAG_NONE; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_context_menu_type_flags_t _retval = struct_->get_type_flags(struct_); + + // Return type: simple + return _retval; +} + +CefString CefContextMenuParamsCToCpp::GetLinkUrl() { + if (CEF_MEMBER_MISSING(struct_, get_link_url)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_link_url(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +CefString CefContextMenuParamsCToCpp::GetUnfilteredLinkUrl() { + if (CEF_MEMBER_MISSING(struct_, get_unfiltered_link_url)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_unfiltered_link_url(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +CefString CefContextMenuParamsCToCpp::GetSourceUrl() { + if (CEF_MEMBER_MISSING(struct_, get_source_url)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_source_url(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +bool CefContextMenuParamsCToCpp::IsImageBlocked() { + if (CEF_MEMBER_MISSING(struct_, is_image_blocked)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_image_blocked(struct_); + + // Return type: bool + return _retval?true:false; +} + +CefString CefContextMenuParamsCToCpp::GetPageUrl() { + if (CEF_MEMBER_MISSING(struct_, get_page_url)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_page_url(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +CefString CefContextMenuParamsCToCpp::GetFrameUrl() { + if (CEF_MEMBER_MISSING(struct_, get_frame_url)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_frame_url(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +CefString CefContextMenuParamsCToCpp::GetFrameCharset() { + if (CEF_MEMBER_MISSING(struct_, get_frame_charset)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_frame_charset(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +CefContextMenuParams::MediaType CefContextMenuParamsCToCpp::GetMediaType() { + if (CEF_MEMBER_MISSING(struct_, get_media_type)) + return CM_MEDIATYPE_NONE; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_context_menu_media_type_t _retval = struct_->get_media_type(struct_); + + // Return type: simple + return _retval; +} + +CefContextMenuParams::MediaStateFlags CefContextMenuParamsCToCpp::GetMediaStateFlags( + ) { + if (CEF_MEMBER_MISSING(struct_, get_media_state_flags)) + return CM_MEDIAFLAG_NONE; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_context_menu_media_state_flags_t _retval = struct_->get_media_state_flags( + struct_); + + // Return type: simple + return _retval; +} + +CefString CefContextMenuParamsCToCpp::GetSelectionText() { + if (CEF_MEMBER_MISSING(struct_, get_selection_text)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_selection_text(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +bool CefContextMenuParamsCToCpp::IsEditable() { + if (CEF_MEMBER_MISSING(struct_, is_editable)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_editable(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefContextMenuParamsCToCpp::IsSpeechInputEnabled() { + if (CEF_MEMBER_MISSING(struct_, is_speech_input_enabled)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_speech_input_enabled(struct_); + + // Return type: bool + return _retval?true:false; +} + +CefContextMenuParams::EditStateFlags CefContextMenuParamsCToCpp::GetEditStateFlags( + ) { + if (CEF_MEMBER_MISSING(struct_, get_edit_state_flags)) + return CM_EDITFLAG_NONE; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_context_menu_edit_state_flags_t _retval = struct_->get_edit_state_flags( + struct_); + + // Return type: simple + return _retval; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/context_menu_params_ctocpp.h b/libcef_dll/ctocpp/context_menu_params_ctocpp.h new file mode 100644 index 000000000..dd1e782c1 --- /dev/null +++ b/libcef_dll/ctocpp/context_menu_params_ctocpp.h @@ -0,0 +1,57 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_CONTEXT_MENU_PARAMS_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_CONTEXT_MENU_PARAMS_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_context_menu_handler.h" +#include "include/capi/cef_context_menu_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefContextMenuParamsCToCpp + : public CefCToCpp { + public: + explicit CefContextMenuParamsCToCpp(cef_context_menu_params_t* str) + : CefCToCpp(str) {} + virtual ~CefContextMenuParamsCToCpp() {} + + // CefContextMenuParams methods + virtual int GetXCoord() OVERRIDE; + virtual int GetYCoord() OVERRIDE; + virtual TypeFlags GetTypeFlags() OVERRIDE; + virtual CefString GetLinkUrl() OVERRIDE; + virtual CefString GetUnfilteredLinkUrl() OVERRIDE; + virtual CefString GetSourceUrl() OVERRIDE; + virtual bool IsImageBlocked() OVERRIDE; + virtual CefString GetPageUrl() OVERRIDE; + virtual CefString GetFrameUrl() OVERRIDE; + virtual CefString GetFrameCharset() OVERRIDE; + virtual MediaType GetMediaType() OVERRIDE; + virtual MediaStateFlags GetMediaStateFlags() OVERRIDE; + virtual CefString GetSelectionText() OVERRIDE; + virtual bool IsEditable() OVERRIDE; + virtual bool IsSpeechInputEnabled() OVERRIDE; + virtual EditStateFlags GetEditStateFlags() OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_CONTEXT_MENU_PARAMS_CTOCPP_H_ + diff --git a/cef/libcef_dll/ctocpp/cookie_manager_ctocpp.cc b/libcef_dll/ctocpp/cookie_manager_ctocpp.cc similarity index 100% rename from cef/libcef_dll/ctocpp/cookie_manager_ctocpp.cc rename to libcef_dll/ctocpp/cookie_manager_ctocpp.cc diff --git a/cef/libcef_dll/ctocpp/cookie_manager_ctocpp.h b/libcef_dll/ctocpp/cookie_manager_ctocpp.h similarity index 100% rename from cef/libcef_dll/ctocpp/cookie_manager_ctocpp.h rename to libcef_dll/ctocpp/cookie_manager_ctocpp.h diff --git a/libcef_dll/ctocpp/cookie_visitor_ctocpp.cc b/libcef_dll/ctocpp/cookie_visitor_ctocpp.cc new file mode 100644 index 000000000..e5d9e4072 --- /dev/null +++ b/libcef_dll/ctocpp/cookie_visitor_ctocpp.cc @@ -0,0 +1,47 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/cookie_visitor_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefCookieVisitorCToCpp::Visit(const CefCookie& cookie, int count, + int total, bool& deleteCookie) { + if (CEF_MEMBER_MISSING(struct_, visit)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Translate param: deleteCookie; type: bool_byref + int deleteCookieInt = deleteCookie; + + // Execute + int _retval = struct_->visit(struct_, + &cookie, + count, + total, + &deleteCookieInt); + + // Restore param:deleteCookie; type: bool_byref + deleteCookie = deleteCookieInt?true:false; + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/cookie_visitor_ctocpp.h b/libcef_dll/ctocpp/cookie_visitor_ctocpp.h new file mode 100644 index 000000000..41969281f --- /dev/null +++ b/libcef_dll/ctocpp/cookie_visitor_ctocpp.h @@ -0,0 +1,43 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_COOKIE_VISITOR_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_COOKIE_VISITOR_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_cookie.h" +#include "include/capi/cef_cookie_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefCookieVisitorCToCpp + : public CefCToCpp { + public: + explicit CefCookieVisitorCToCpp(cef_cookie_visitor_t* str) + : CefCToCpp(str) {} + virtual ~CefCookieVisitorCToCpp() {} + + // CefCookieVisitor methods + virtual bool Visit(const CefCookie& cookie, int count, int total, + bool& deleteCookie) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_COOKIE_VISITOR_CTOCPP_H_ + diff --git a/cef/libcef_dll/ctocpp/ctocpp.h b/libcef_dll/ctocpp/ctocpp.h similarity index 100% rename from cef/libcef_dll/ctocpp/ctocpp.h rename to libcef_dll/ctocpp/ctocpp.h diff --git a/libcef_dll/ctocpp/dictionary_value_ctocpp.cc b/libcef_dll/ctocpp/dictionary_value_ctocpp.cc new file mode 100644 index 000000000..8fa08e686 --- /dev/null +++ b/libcef_dll/ctocpp/dictionary_value_ctocpp.cc @@ -0,0 +1,517 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/binary_value_ctocpp.h" +#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h" +#include "libcef_dll/ctocpp/list_value_ctocpp.h" +#include "libcef_dll/transfer_util.h" + + +// STATIC METHODS - Body may be edited by hand. + +CefRefPtr CefDictionaryValue::Create() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_dictionary_value_t* _retval = cef_dictionary_value_create(); + + // Return type: refptr_same + return CefDictionaryValueCToCpp::Wrap(_retval); +} + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefDictionaryValueCToCpp::IsValid() { + if (CEF_MEMBER_MISSING(struct_, is_valid)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_valid(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefDictionaryValueCToCpp::IsOwned() { + if (CEF_MEMBER_MISSING(struct_, is_owned)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_owned(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefDictionaryValueCToCpp::IsReadOnly() { + if (CEF_MEMBER_MISSING(struct_, is_read_only)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_read_only(struct_); + + // Return type: bool + return _retval?true:false; +} + +CefRefPtr CefDictionaryValueCToCpp::Copy( + bool exclude_empty_children) { + if (CEF_MEMBER_MISSING(struct_, copy)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_dictionary_value_t* _retval = struct_->copy(struct_, + exclude_empty_children); + + // Return type: refptr_same + return CefDictionaryValueCToCpp::Wrap(_retval); +} + +size_t CefDictionaryValueCToCpp::GetSize() { + if (CEF_MEMBER_MISSING(struct_, get_size)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + size_t _retval = struct_->get_size(struct_); + + // Return type: simple + return _retval; +} + +bool CefDictionaryValueCToCpp::Clear() { + if (CEF_MEMBER_MISSING(struct_, clear)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->clear(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefDictionaryValueCToCpp::HasKey(const CefString& key) { + if (CEF_MEMBER_MISSING(struct_, has_key)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return false; + + // Execute + int _retval = struct_->has_key(struct_, + key.GetStruct()); + + // Return type: bool + return _retval?true:false; +} + +bool CefDictionaryValueCToCpp::GetKeys(KeyList& keys) { + if (CEF_MEMBER_MISSING(struct_, get_keys)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Translate param: keys; type: string_vec_byref + cef_string_list_t keysList = cef_string_list_alloc(); + DCHECK(keysList); + if (keysList) + transfer_string_list_contents(keys, keysList); + + // Execute + int _retval = struct_->get_keys(struct_, + keysList); + + // Restore param:keys; type: string_vec_byref + if (keysList) { + keys.clear(); + transfer_string_list_contents(keysList, keys); + cef_string_list_free(keysList); + } + + // Return type: bool + return _retval?true:false; +} + +bool CefDictionaryValueCToCpp::Remove(const CefString& key) { + if (CEF_MEMBER_MISSING(struct_, remove)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return false; + + // Execute + int _retval = struct_->remove(struct_, + key.GetStruct()); + + // Return type: bool + return _retval?true:false; +} + +CefValueType CefDictionaryValueCToCpp::GetType(const CefString& key) { + if (CEF_MEMBER_MISSING(struct_, get_type)) + return VTYPE_INVALID; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return VTYPE_INVALID; + + // Execute + cef_value_type_t _retval = struct_->get_type(struct_, + key.GetStruct()); + + // Return type: simple + return _retval; +} + +bool CefDictionaryValueCToCpp::GetBool(const CefString& key) { + if (CEF_MEMBER_MISSING(struct_, get_bool)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return false; + + // Execute + int _retval = struct_->get_bool(struct_, + key.GetStruct()); + + // Return type: bool + return _retval?true:false; +} + +int CefDictionaryValueCToCpp::GetInt(const CefString& key) { + if (CEF_MEMBER_MISSING(struct_, get_int)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return 0; + + // Execute + int _retval = struct_->get_int(struct_, + key.GetStruct()); + + // Return type: simple + return _retval; +} + +double CefDictionaryValueCToCpp::GetDouble(const CefString& key) { + if (CEF_MEMBER_MISSING(struct_, get_double)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return 0; + + // Execute + double _retval = struct_->get_double(struct_, + key.GetStruct()); + + // Return type: simple + return _retval; +} + +CefString CefDictionaryValueCToCpp::GetString(const CefString& key) { + if (CEF_MEMBER_MISSING(struct_, get_string)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return CefString(); + + // Execute + cef_string_userfree_t _retval = struct_->get_string(struct_, + key.GetStruct()); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +CefRefPtr CefDictionaryValueCToCpp::GetBinary( + const CefString& key) { + if (CEF_MEMBER_MISSING(struct_, get_binary)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return NULL; + + // Execute + cef_binary_value_t* _retval = struct_->get_binary(struct_, + key.GetStruct()); + + // Return type: refptr_same + return CefBinaryValueCToCpp::Wrap(_retval); +} + +CefRefPtr CefDictionaryValueCToCpp::GetDictionary( + const CefString& key) { + if (CEF_MEMBER_MISSING(struct_, get_dictionary)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return NULL; + + // Execute + cef_dictionary_value_t* _retval = struct_->get_dictionary(struct_, + key.GetStruct()); + + // Return type: refptr_same + return CefDictionaryValueCToCpp::Wrap(_retval); +} + +CefRefPtr CefDictionaryValueCToCpp::GetList( + const CefString& key) { + if (CEF_MEMBER_MISSING(struct_, get_list)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return NULL; + + // Execute + cef_list_value_t* _retval = struct_->get_list(struct_, + key.GetStruct()); + + // Return type: refptr_same + return CefListValueCToCpp::Wrap(_retval); +} + +bool CefDictionaryValueCToCpp::SetNull(const CefString& key) { + if (CEF_MEMBER_MISSING(struct_, set_null)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return false; + + // Execute + int _retval = struct_->set_null(struct_, + key.GetStruct()); + + // Return type: bool + return _retval?true:false; +} + +bool CefDictionaryValueCToCpp::SetBool(const CefString& key, bool value) { + if (CEF_MEMBER_MISSING(struct_, set_bool)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return false; + + // Execute + int _retval = struct_->set_bool(struct_, + key.GetStruct(), + value); + + // Return type: bool + return _retval?true:false; +} + +bool CefDictionaryValueCToCpp::SetInt(const CefString& key, int value) { + if (CEF_MEMBER_MISSING(struct_, set_int)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return false; + + // Execute + int _retval = struct_->set_int(struct_, + key.GetStruct(), + value); + + // Return type: bool + return _retval?true:false; +} + +bool CefDictionaryValueCToCpp::SetDouble(const CefString& key, double value) { + if (CEF_MEMBER_MISSING(struct_, set_double)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return false; + + // Execute + int _retval = struct_->set_double(struct_, + key.GetStruct(), + value); + + // Return type: bool + return _retval?true:false; +} + +bool CefDictionaryValueCToCpp::SetString(const CefString& key, + const CefString& value) { + if (CEF_MEMBER_MISSING(struct_, set_string)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return false; + // Unverified params: value + + // Execute + int _retval = struct_->set_string(struct_, + key.GetStruct(), + value.GetStruct()); + + // Return type: bool + return _retval?true:false; +} + +bool CefDictionaryValueCToCpp::SetBinary(const CefString& key, + CefRefPtr value) { + if (CEF_MEMBER_MISSING(struct_, set_binary)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return false; + // Verify param: value; type: refptr_same + DCHECK(value.get()); + if (!value.get()) + return false; + + // Execute + int _retval = struct_->set_binary(struct_, + key.GetStruct(), + CefBinaryValueCToCpp::Unwrap(value)); + + // Return type: bool + return _retval?true:false; +} + +bool CefDictionaryValueCToCpp::SetDictionary(const CefString& key, + CefRefPtr value) { + if (CEF_MEMBER_MISSING(struct_, set_dictionary)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return false; + // Verify param: value; type: refptr_same + DCHECK(value.get()); + if (!value.get()) + return false; + + // Execute + int _retval = struct_->set_dictionary(struct_, + key.GetStruct(), + CefDictionaryValueCToCpp::Unwrap(value)); + + // Return type: bool + return _retval?true:false; +} + +bool CefDictionaryValueCToCpp::SetList(const CefString& key, + CefRefPtr value) { + if (CEF_MEMBER_MISSING(struct_, set_list)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: key; type: string_byref_const + DCHECK(!key.empty()); + if (key.empty()) + return false; + // Verify param: value; type: refptr_same + DCHECK(value.get()); + if (!value.get()) + return false; + + // Execute + int _retval = struct_->set_list(struct_, + key.GetStruct(), + CefListValueCToCpp::Unwrap(value)); + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/dictionary_value_ctocpp.h b/libcef_dll/ctocpp/dictionary_value_ctocpp.h new file mode 100644 index 000000000..d3959def4 --- /dev/null +++ b/libcef_dll/ctocpp/dictionary_value_ctocpp.h @@ -0,0 +1,71 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_DICTIONARY_VALUE_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_DICTIONARY_VALUE_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_values.h" +#include "include/capi/cef_values_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefDictionaryValueCToCpp + : public CefCToCpp { + public: + explicit CefDictionaryValueCToCpp(cef_dictionary_value_t* str) + : CefCToCpp(str) {} + virtual ~CefDictionaryValueCToCpp() {} + + // CefDictionaryValue methods + virtual bool IsValid() OVERRIDE; + virtual bool IsOwned() OVERRIDE; + virtual bool IsReadOnly() OVERRIDE; + virtual CefRefPtr Copy( + bool exclude_empty_children) OVERRIDE; + virtual size_t GetSize() OVERRIDE; + virtual bool Clear() OVERRIDE; + virtual bool HasKey(const CefString& key) OVERRIDE; + virtual bool GetKeys(KeyList& keys) OVERRIDE; + virtual bool Remove(const CefString& key) OVERRIDE; + virtual CefValueType GetType(const CefString& key) OVERRIDE; + virtual bool GetBool(const CefString& key) OVERRIDE; + virtual int GetInt(const CefString& key) OVERRIDE; + virtual double GetDouble(const CefString& key) OVERRIDE; + virtual CefString GetString(const CefString& key) OVERRIDE; + virtual CefRefPtr GetBinary(const CefString& key) OVERRIDE; + virtual CefRefPtr GetDictionary( + const CefString& key) OVERRIDE; + virtual CefRefPtr GetList(const CefString& key) OVERRIDE; + virtual bool SetNull(const CefString& key) OVERRIDE; + virtual bool SetBool(const CefString& key, bool value) OVERRIDE; + virtual bool SetInt(const CefString& key, int value) OVERRIDE; + virtual bool SetDouble(const CefString& key, double value) OVERRIDE; + virtual bool SetString(const CefString& key, const CefString& value) OVERRIDE; + virtual bool SetBinary(const CefString& key, + CefRefPtr value) OVERRIDE; + virtual bool SetDictionary(const CefString& key, + CefRefPtr value) OVERRIDE; + virtual bool SetList(const CefString& key, + CefRefPtr value) OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_DICTIONARY_VALUE_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/display_handler_ctocpp.cc b/libcef_dll/ctocpp/display_handler_ctocpp.cc new file mode 100644 index 000000000..3066b6714 --- /dev/null +++ b/libcef_dll/ctocpp/display_handler_ctocpp.cc @@ -0,0 +1,158 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/frame_cpptoc.h" +#include "libcef_dll/ctocpp/display_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefDisplayHandlerCToCpp::OnLoadingStateChange( + CefRefPtr browser, bool isLoading, bool canGoBack, + bool canGoForward) { + if (CEF_MEMBER_MISSING(struct_, on_loading_state_change)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + + // Execute + struct_->on_loading_state_change(struct_, + CefBrowserCppToC::Wrap(browser), + isLoading, + canGoBack, + canGoForward); +} + +void CefDisplayHandlerCToCpp::OnAddressChange(CefRefPtr browser, + CefRefPtr frame, const CefString& url) { + if (CEF_MEMBER_MISSING(struct_, on_address_change)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return; + // Verify param: url; type: string_byref_const + DCHECK(!url.empty()); + if (url.empty()) + return; + + // Execute + struct_->on_address_change(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + url.GetStruct()); +} + +void CefDisplayHandlerCToCpp::OnTitleChange(CefRefPtr browser, + const CefString& title) { + if (CEF_MEMBER_MISSING(struct_, on_title_change)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Unverified params: title + + // Execute + struct_->on_title_change(struct_, + CefBrowserCppToC::Wrap(browser), + title.GetStruct()); +} + +bool CefDisplayHandlerCToCpp::OnTooltip(CefRefPtr browser, + CefString& text) { + if (CEF_MEMBER_MISSING(struct_, on_tooltip)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + // Unverified params: text + + // Execute + int _retval = struct_->on_tooltip(struct_, + CefBrowserCppToC::Wrap(browser), + text.GetWritableStruct()); + + // Return type: bool + return _retval?true:false; +} + +void CefDisplayHandlerCToCpp::OnStatusMessage(CefRefPtr browser, + const CefString& value, StatusType type) { + if (CEF_MEMBER_MISSING(struct_, on_status_message)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Unverified params: value + + // Execute + struct_->on_status_message(struct_, + CefBrowserCppToC::Wrap(browser), + value.GetStruct(), + type); +} + +bool CefDisplayHandlerCToCpp::OnConsoleMessage(CefRefPtr browser, + const CefString& message, const CefString& source, int line) { + if (CEF_MEMBER_MISSING(struct_, on_console_message)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + // Unverified params: message, source + + // Execute + int _retval = struct_->on_console_message(struct_, + CefBrowserCppToC::Wrap(browser), + message.GetStruct(), + source.GetStruct(), + line); + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/display_handler_ctocpp.h b/libcef_dll/ctocpp/display_handler_ctocpp.h new file mode 100644 index 000000000..830d4b5b0 --- /dev/null +++ b/libcef_dll/ctocpp/display_handler_ctocpp.h @@ -0,0 +1,53 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_DISPLAY_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_DISPLAY_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_display_handler.h" +#include "include/capi/cef_display_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefDisplayHandlerCToCpp + : public CefCToCpp { + public: + explicit CefDisplayHandlerCToCpp(cef_display_handler_t* str) + : CefCToCpp(str) {} + virtual ~CefDisplayHandlerCToCpp() {} + + // CefDisplayHandler methods + virtual void OnLoadingStateChange(CefRefPtr browser, + bool isLoading, bool canGoBack, bool canGoForward) OVERRIDE; + virtual void OnAddressChange(CefRefPtr browser, + CefRefPtr frame, const CefString& url) OVERRIDE; + virtual void OnTitleChange(CefRefPtr browser, + const CefString& title) OVERRIDE; + virtual bool OnTooltip(CefRefPtr browser, + CefString& text) OVERRIDE; + virtual void OnStatusMessage(CefRefPtr browser, + const CefString& value, StatusType type) OVERRIDE; + virtual bool OnConsoleMessage(CefRefPtr browser, + const CefString& message, const CefString& source, int line) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_DISPLAY_HANDLER_CTOCPP_H_ + diff --git a/cef/libcef_dll/ctocpp/domdocument_ctocpp.cc b/libcef_dll/ctocpp/domdocument_ctocpp.cc similarity index 100% rename from cef/libcef_dll/ctocpp/domdocument_ctocpp.cc rename to libcef_dll/ctocpp/domdocument_ctocpp.cc diff --git a/cef/libcef_dll/ctocpp/domdocument_ctocpp.h b/libcef_dll/ctocpp/domdocument_ctocpp.h similarity index 100% rename from cef/libcef_dll/ctocpp/domdocument_ctocpp.h rename to libcef_dll/ctocpp/domdocument_ctocpp.h diff --git a/cef/libcef_dll/ctocpp/domevent_ctocpp.cc b/libcef_dll/ctocpp/domevent_ctocpp.cc similarity index 100% rename from cef/libcef_dll/ctocpp/domevent_ctocpp.cc rename to libcef_dll/ctocpp/domevent_ctocpp.cc diff --git a/cef/libcef_dll/ctocpp/domevent_ctocpp.h b/libcef_dll/ctocpp/domevent_ctocpp.h similarity index 100% rename from cef/libcef_dll/ctocpp/domevent_ctocpp.h rename to libcef_dll/ctocpp/domevent_ctocpp.h diff --git a/libcef_dll/ctocpp/domevent_listener_ctocpp.cc b/libcef_dll/ctocpp/domevent_listener_ctocpp.cc new file mode 100644 index 000000000..3186604b1 --- /dev/null +++ b/libcef_dll/ctocpp/domevent_listener_ctocpp.cc @@ -0,0 +1,40 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/domevent_cpptoc.h" +#include "libcef_dll/ctocpp/domevent_listener_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefDOMEventListenerCToCpp::HandleEvent(CefRefPtr event) { + if (CEF_MEMBER_MISSING(struct_, handle_event)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: event; type: refptr_diff + DCHECK(event.get()); + if (!event.get()) + return; + + // Execute + struct_->handle_event(struct_, + CefDOMEventCppToC::Wrap(event)); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/domevent_listener_ctocpp.h b/libcef_dll/ctocpp/domevent_listener_ctocpp.h new file mode 100644 index 000000000..9d90727f3 --- /dev/null +++ b/libcef_dll/ctocpp/domevent_listener_ctocpp.h @@ -0,0 +1,42 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_DOMEVENT_LISTENER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_DOMEVENT_LISTENER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_dom.h" +#include "include/capi/cef_dom_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefDOMEventListenerCToCpp + : public CefCToCpp { + public: + explicit CefDOMEventListenerCToCpp(cef_domevent_listener_t* str) + : CefCToCpp(str) {} + virtual ~CefDOMEventListenerCToCpp() {} + + // CefDOMEventListener methods + virtual void HandleEvent(CefRefPtr event) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_DOMEVENT_LISTENER_CTOCPP_H_ + diff --git a/cef/libcef_dll/ctocpp/domnode_ctocpp.cc b/libcef_dll/ctocpp/domnode_ctocpp.cc similarity index 97% rename from cef/libcef_dll/ctocpp/domnode_ctocpp.cc rename to libcef_dll/ctocpp/domnode_ctocpp.cc index 1dfb6a90c..3a0abe7f4 100644 --- a/cef/libcef_dll/ctocpp/domnode_ctocpp.cc +++ b/libcef_dll/ctocpp/domnode_ctocpp.cc @@ -57,6 +57,19 @@ bool CefDOMNodeCToCpp::IsElement() { return _retval?true:false; } +bool CefDOMNodeCToCpp::IsEditable() { + if (CEF_MEMBER_MISSING(struct_, is_editable)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_editable(struct_); + + // Return type: bool + return _retval?true:false; +} + bool CefDOMNodeCToCpp::IsFormControlElement() { if (CEF_MEMBER_MISSING(struct_, is_form_control_element)) return false; diff --git a/cef/libcef_dll/ctocpp/domnode_ctocpp.h b/libcef_dll/ctocpp/domnode_ctocpp.h similarity index 98% rename from cef/libcef_dll/ctocpp/domnode_ctocpp.h rename to libcef_dll/ctocpp/domnode_ctocpp.h index 90311251d..6bedac7ba 100644 --- a/cef/libcef_dll/ctocpp/domnode_ctocpp.h +++ b/libcef_dll/ctocpp/domnode_ctocpp.h @@ -35,6 +35,7 @@ class CefDOMNodeCToCpp virtual Type GetType() OVERRIDE; virtual bool IsText() OVERRIDE; virtual bool IsElement() OVERRIDE; + virtual bool IsEditable() OVERRIDE; virtual bool IsFormControlElement() OVERRIDE; virtual CefString GetFormControlElementType() OVERRIDE; virtual bool IsSame(CefRefPtr that) OVERRIDE; diff --git a/libcef_dll/ctocpp/domvisitor_ctocpp.cc b/libcef_dll/ctocpp/domvisitor_ctocpp.cc new file mode 100644 index 000000000..b652d633f --- /dev/null +++ b/libcef_dll/ctocpp/domvisitor_ctocpp.cc @@ -0,0 +1,40 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/domdocument_cpptoc.h" +#include "libcef_dll/ctocpp/domvisitor_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefDOMVisitorCToCpp::Visit(CefRefPtr document) { + if (CEF_MEMBER_MISSING(struct_, visit)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: document; type: refptr_diff + DCHECK(document.get()); + if (!document.get()) + return; + + // Execute + struct_->visit(struct_, + CefDOMDocumentCppToC::Wrap(document)); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/domvisitor_ctocpp.h b/libcef_dll/ctocpp/domvisitor_ctocpp.h new file mode 100644 index 000000000..c2005ff48 --- /dev/null +++ b/libcef_dll/ctocpp/domvisitor_ctocpp.h @@ -0,0 +1,40 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_DOMVISITOR_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_DOMVISITOR_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_dom.h" +#include "include/capi/cef_dom_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefDOMVisitorCToCpp + : public CefCToCpp { + public: + explicit CefDOMVisitorCToCpp(cef_domvisitor_t* str) + : CefCToCpp(str) {} + virtual ~CefDOMVisitorCToCpp() {} + + // CefDOMVisitor methods + virtual void Visit(CefRefPtr document) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_DOMVISITOR_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/download_handler_ctocpp.cc b/libcef_dll/ctocpp/download_handler_ctocpp.cc new file mode 100644 index 000000000..102e2be5b --- /dev/null +++ b/libcef_dll/ctocpp/download_handler_ctocpp.cc @@ -0,0 +1,88 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/before_download_callback_cpptoc.h" +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/download_item_cpptoc.h" +#include "libcef_dll/cpptoc/download_item_callback_cpptoc.h" +#include "libcef_dll/ctocpp/download_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefDownloadHandlerCToCpp::OnBeforeDownload(CefRefPtr browser, + CefRefPtr download_item, const CefString& suggested_name, + CefRefPtr callback) { + if (CEF_MEMBER_MISSING(struct_, on_before_download)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: download_item; type: refptr_diff + DCHECK(download_item.get()); + if (!download_item.get()) + return; + // Verify param: suggested_name; type: string_byref_const + DCHECK(!suggested_name.empty()); + if (suggested_name.empty()) + return; + // Verify param: callback; type: refptr_diff + DCHECK(callback.get()); + if (!callback.get()) + return; + + // Execute + struct_->on_before_download(struct_, + CefBrowserCppToC::Wrap(browser), + CefDownloadItemCppToC::Wrap(download_item), + suggested_name.GetStruct(), + CefBeforeDownloadCallbackCppToC::Wrap(callback)); +} + +void CefDownloadHandlerCToCpp::OnDownloadUpdated(CefRefPtr browser, + CefRefPtr download_item, + CefRefPtr callback) { + if (CEF_MEMBER_MISSING(struct_, on_download_updated)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: download_item; type: refptr_diff + DCHECK(download_item.get()); + if (!download_item.get()) + return; + // Verify param: callback; type: refptr_diff + DCHECK(callback.get()); + if (!callback.get()) + return; + + // Execute + struct_->on_download_updated(struct_, + CefBrowserCppToC::Wrap(browser), + CefDownloadItemCppToC::Wrap(download_item), + CefDownloadItemCallbackCppToC::Wrap(callback)); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/download_handler_ctocpp.h b/libcef_dll/ctocpp/download_handler_ctocpp.h new file mode 100644 index 000000000..f4f0f24c9 --- /dev/null +++ b/libcef_dll/ctocpp/download_handler_ctocpp.h @@ -0,0 +1,48 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_DOWNLOAD_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_DOWNLOAD_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_download_handler.h" +#include "include/capi/cef_download_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefDownloadHandlerCToCpp + : public CefCToCpp { + public: + explicit CefDownloadHandlerCToCpp(cef_download_handler_t* str) + : CefCToCpp(str) {} + virtual ~CefDownloadHandlerCToCpp() {} + + // CefDownloadHandler methods + virtual void OnBeforeDownload(CefRefPtr browser, + CefRefPtr download_item, + const CefString& suggested_name, + CefRefPtr callback) OVERRIDE; + virtual void OnDownloadUpdated(CefRefPtr browser, + CefRefPtr download_item, + CefRefPtr callback) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_DOWNLOAD_HANDLER_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/download_item_callback_ctocpp.cc b/libcef_dll/ctocpp/download_item_callback_ctocpp.cc new file mode 100644 index 000000000..99981cf0a --- /dev/null +++ b/libcef_dll/ctocpp/download_item_callback_ctocpp.cc @@ -0,0 +1,33 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/download_item_callback_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefDownloadItemCallbackCToCpp::Cancel() { + if (CEF_MEMBER_MISSING(struct_, cancel)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->cancel(struct_); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/download_item_callback_ctocpp.h b/libcef_dll/ctocpp/download_item_callback_ctocpp.h new file mode 100644 index 000000000..1a05a07d4 --- /dev/null +++ b/libcef_dll/ctocpp/download_item_callback_ctocpp.h @@ -0,0 +1,42 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_DOWNLOAD_ITEM_CALLBACK_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_DOWNLOAD_ITEM_CALLBACK_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_download_handler.h" +#include "include/capi/cef_download_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefDownloadItemCallbackCToCpp + : public CefCToCpp { + public: + explicit CefDownloadItemCallbackCToCpp(cef_download_item_callback_t* str) + : CefCToCpp(str) {} + virtual ~CefDownloadItemCallbackCToCpp() {} + + // CefDownloadItemCallback methods + virtual void Cancel() OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_DOWNLOAD_ITEM_CALLBACK_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/download_item_ctocpp.cc b/libcef_dll/ctocpp/download_item_ctocpp.cc new file mode 100644 index 000000000..f49712d37 --- /dev/null +++ b/libcef_dll/ctocpp/download_item_ctocpp.cc @@ -0,0 +1,256 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/download_item_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefDownloadItemCToCpp::IsValid() { + if (CEF_MEMBER_MISSING(struct_, is_valid)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_valid(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefDownloadItemCToCpp::IsInProgress() { + if (CEF_MEMBER_MISSING(struct_, is_in_progress)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_in_progress(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefDownloadItemCToCpp::IsComplete() { + if (CEF_MEMBER_MISSING(struct_, is_complete)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_complete(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefDownloadItemCToCpp::IsCanceled() { + if (CEF_MEMBER_MISSING(struct_, is_canceled)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_canceled(struct_); + + // Return type: bool + return _retval?true:false; +} + +int64 CefDownloadItemCToCpp::GetCurrentSpeed() { + if (CEF_MEMBER_MISSING(struct_, get_current_speed)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int64 _retval = struct_->get_current_speed(struct_); + + // Return type: simple + return _retval; +} + +int CefDownloadItemCToCpp::GetPercentComplete() { + if (CEF_MEMBER_MISSING(struct_, get_percent_complete)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->get_percent_complete(struct_); + + // Return type: simple + return _retval; +} + +int64 CefDownloadItemCToCpp::GetTotalBytes() { + if (CEF_MEMBER_MISSING(struct_, get_total_bytes)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int64 _retval = struct_->get_total_bytes(struct_); + + // Return type: simple + return _retval; +} + +int64 CefDownloadItemCToCpp::GetReceivedBytes() { + if (CEF_MEMBER_MISSING(struct_, get_received_bytes)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int64 _retval = struct_->get_received_bytes(struct_); + + // Return type: simple + return _retval; +} + +CefTime CefDownloadItemCToCpp::GetStartTime() { + if (CEF_MEMBER_MISSING(struct_, get_start_time)) + return CefTime(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_time_t _retval = struct_->get_start_time(struct_); + + // Return type: simple + return _retval; +} + +CefTime CefDownloadItemCToCpp::GetEndTime() { + if (CEF_MEMBER_MISSING(struct_, get_end_time)) + return CefTime(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_time_t _retval = struct_->get_end_time(struct_); + + // Return type: simple + return _retval; +} + +CefString CefDownloadItemCToCpp::GetFullPath() { + if (CEF_MEMBER_MISSING(struct_, get_full_path)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_full_path(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +int32 CefDownloadItemCToCpp::GetId() { + if (CEF_MEMBER_MISSING(struct_, get_id)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int32 _retval = struct_->get_id(struct_); + + // Return type: simple + return _retval; +} + +CefString CefDownloadItemCToCpp::GetURL() { + if (CEF_MEMBER_MISSING(struct_, get_url)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_url(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +CefString CefDownloadItemCToCpp::GetSuggestedFileName() { + if (CEF_MEMBER_MISSING(struct_, get_suggested_file_name)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_suggested_file_name(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +CefString CefDownloadItemCToCpp::GetContentDisposition() { + if (CEF_MEMBER_MISSING(struct_, get_content_disposition)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_content_disposition(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +CefString CefDownloadItemCToCpp::GetMimeType() { + if (CEF_MEMBER_MISSING(struct_, get_mime_type)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_mime_type(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +CefString CefDownloadItemCToCpp::GetReferrerCharset() { + if (CEF_MEMBER_MISSING(struct_, get_referrer_charset)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_referrer_charset(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/download_item_ctocpp.h b/libcef_dll/ctocpp/download_item_ctocpp.h new file mode 100644 index 000000000..ff42472ba --- /dev/null +++ b/libcef_dll/ctocpp/download_item_ctocpp.h @@ -0,0 +1,58 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_DOWNLOAD_ITEM_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_DOWNLOAD_ITEM_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_download_item.h" +#include "include/capi/cef_download_item_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefDownloadItemCToCpp + : public CefCToCpp { + public: + explicit CefDownloadItemCToCpp(cef_download_item_t* str) + : CefCToCpp( + str) {} + virtual ~CefDownloadItemCToCpp() {} + + // CefDownloadItem methods + virtual bool IsValid() OVERRIDE; + virtual bool IsInProgress() OVERRIDE; + virtual bool IsComplete() OVERRIDE; + virtual bool IsCanceled() OVERRIDE; + virtual int64 GetCurrentSpeed() OVERRIDE; + virtual int GetPercentComplete() OVERRIDE; + virtual int64 GetTotalBytes() OVERRIDE; + virtual int64 GetReceivedBytes() OVERRIDE; + virtual CefTime GetStartTime() OVERRIDE; + virtual CefTime GetEndTime() OVERRIDE; + virtual CefString GetFullPath() OVERRIDE; + virtual int32 GetId() OVERRIDE; + virtual CefString GetURL() OVERRIDE; + virtual CefString GetSuggestedFileName() OVERRIDE; + virtual CefString GetContentDisposition() OVERRIDE; + virtual CefString GetMimeType() OVERRIDE; + virtual CefString GetReferrerCharset() OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_DOWNLOAD_ITEM_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/focus_handler_ctocpp.cc b/libcef_dll/ctocpp/focus_handler_ctocpp.cc new file mode 100644 index 000000000..9b2176eef --- /dev/null +++ b/libcef_dll/ctocpp/focus_handler_ctocpp.cc @@ -0,0 +1,79 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/ctocpp/focus_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefFocusHandlerCToCpp::OnTakeFocus(CefRefPtr browser, + bool next) { + if (CEF_MEMBER_MISSING(struct_, on_take_focus)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + + // Execute + struct_->on_take_focus(struct_, + CefBrowserCppToC::Wrap(browser), + next); +} + +bool CefFocusHandlerCToCpp::OnSetFocus(CefRefPtr browser, + FocusSource source) { + if (CEF_MEMBER_MISSING(struct_, on_set_focus)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + + // Execute + int _retval = struct_->on_set_focus(struct_, + CefBrowserCppToC::Wrap(browser), + source); + + // Return type: bool + return _retval?true:false; +} + +void CefFocusHandlerCToCpp::OnGotFocus(CefRefPtr browser) { + if (CEF_MEMBER_MISSING(struct_, on_got_focus)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + + // Execute + struct_->on_got_focus(struct_, + CefBrowserCppToC::Wrap(browser)); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/focus_handler_ctocpp.h b/libcef_dll/ctocpp/focus_handler_ctocpp.h new file mode 100644 index 000000000..978237e2b --- /dev/null +++ b/libcef_dll/ctocpp/focus_handler_ctocpp.h @@ -0,0 +1,45 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_FOCUS_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_FOCUS_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_focus_handler.h" +#include "include/capi/cef_focus_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefFocusHandlerCToCpp + : public CefCToCpp { + public: + explicit CefFocusHandlerCToCpp(cef_focus_handler_t* str) + : CefCToCpp( + str) {} + virtual ~CefFocusHandlerCToCpp() {} + + // CefFocusHandler methods + virtual void OnTakeFocus(CefRefPtr browser, bool next) OVERRIDE; + virtual bool OnSetFocus(CefRefPtr browser, + FocusSource source) OVERRIDE; + virtual void OnGotFocus(CefRefPtr browser) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_FOCUS_HANDLER_CTOCPP_H_ + diff --git a/cef/libcef_dll/ctocpp/frame_ctocpp.cc b/libcef_dll/ctocpp/frame_ctocpp.cc similarity index 83% rename from cef/libcef_dll/ctocpp/frame_ctocpp.cc rename to libcef_dll/ctocpp/frame_ctocpp.cc index 59c47cafa..10c437fcf 100644 --- a/cef/libcef_dll/ctocpp/frame_ctocpp.cc +++ b/libcef_dll/ctocpp/frame_ctocpp.cc @@ -11,15 +11,28 @@ // #include "libcef_dll/cpptoc/domvisitor_cpptoc.h" +#include "libcef_dll/cpptoc/string_visitor_cpptoc.h" #include "libcef_dll/ctocpp/browser_ctocpp.h" #include "libcef_dll/ctocpp/frame_ctocpp.h" #include "libcef_dll/ctocpp/request_ctocpp.h" -#include "libcef_dll/ctocpp/stream_reader_ctocpp.h" #include "libcef_dll/ctocpp/v8context_ctocpp.h" // VIRTUAL METHODS - Body may be edited by hand. +bool CefFrameCToCpp::IsValid() { + if (CEF_MEMBER_MISSING(struct_, is_valid)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_valid(struct_); + + // Return type: bool + return _retval?true:false; +} + void CefFrameCToCpp::Undo() { if (CEF_MEMBER_MISSING(struct_, undo)) return; @@ -90,16 +103,6 @@ void CefFrameCToCpp::SelectAll() { struct_->select_all(struct_); } -void CefFrameCToCpp::Print() { - if (CEF_MEMBER_MISSING(struct_, print)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - struct_->print(struct_); -} - void CefFrameCToCpp::ViewSource() { if (CEF_MEMBER_MISSING(struct_, view_source)) return; @@ -110,34 +113,36 @@ void CefFrameCToCpp::ViewSource() { struct_->view_source(struct_); } -CefString CefFrameCToCpp::GetSource() { +void CefFrameCToCpp::GetSource(CefRefPtr visitor) { if (CEF_MEMBER_MISSING(struct_, get_source)) - return CefString(); + return; // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - // Execute - cef_string_userfree_t _retval = struct_->get_source(struct_); + // Verify param: visitor; type: refptr_diff + DCHECK(visitor.get()); + if (!visitor.get()) + return; - // Return type: string - CefString _retvalStr; - _retvalStr.AttachToUserFree(_retval); - return _retvalStr; + // Execute + struct_->get_source(struct_, + CefStringVisitorCppToC::Wrap(visitor)); } -CefString CefFrameCToCpp::GetText() { +void CefFrameCToCpp::GetText(CefRefPtr visitor) { if (CEF_MEMBER_MISSING(struct_, get_text)) - return CefString(); + return; // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - // Execute - cef_string_userfree_t _retval = struct_->get_text(struct_); + // Verify param: visitor; type: refptr_diff + DCHECK(visitor.get()); + if (!visitor.get()) + return; - // Return type: string - CefString _retvalStr; - _retvalStr.AttachToUserFree(_retval); - return _retvalStr; + // Execute + struct_->get_text(struct_, + CefStringVisitorCppToC::Wrap(visitor)); } void CefFrameCToCpp::LoadRequest(CefRefPtr request) { @@ -194,46 +199,24 @@ void CefFrameCToCpp::LoadString(const CefString& string_val, url.GetStruct()); } -void CefFrameCToCpp::LoadStream(CefRefPtr stream, - const CefString& url) { - if (CEF_MEMBER_MISSING(struct_, load_stream)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: stream; type: refptr_same - DCHECK(stream.get()); - if (!stream.get()) - return; - // Verify param: url; type: string_byref_const - DCHECK(!url.empty()); - if (url.empty()) - return; - - // Execute - struct_->load_stream(struct_, - CefStreamReaderCToCpp::Unwrap(stream), - url.GetStruct()); -} - -void CefFrameCToCpp::ExecuteJavaScript(const CefString& jsCode, - const CefString& scriptUrl, int startLine) { +void CefFrameCToCpp::ExecuteJavaScript(const CefString& code, + const CefString& script_url, int start_line) { if (CEF_MEMBER_MISSING(struct_, execute_java_script)) return; // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - // Verify param: jsCode; type: string_byref_const - DCHECK(!jsCode.empty()); - if (jsCode.empty()) + // Verify param: code; type: string_byref_const + DCHECK(!code.empty()); + if (code.empty()) return; - // Unverified params: scriptUrl + // Unverified params: script_url // Execute struct_->execute_java_script(struct_, - jsCode.GetStruct(), - scriptUrl.GetStruct(), - startLine); + code.GetStruct(), + script_url.GetStruct(), + start_line); } bool CefFrameCToCpp::IsMain() { @@ -331,6 +314,19 @@ CefRefPtr CefFrameCToCpp::GetBrowser() { return CefBrowserCToCpp::Wrap(_retval); } +CefRefPtr CefFrameCToCpp::GetV8Context() { + if (CEF_MEMBER_MISSING(struct_, get_v8context)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_v8context_t* _retval = struct_->get_v8context(struct_); + + // Return type: refptr_same + return CefV8ContextCToCpp::Wrap(_retval); +} + void CefFrameCToCpp::VisitDOM(CefRefPtr visitor) { if (CEF_MEMBER_MISSING(struct_, visit_dom)) return; @@ -347,19 +343,6 @@ void CefFrameCToCpp::VisitDOM(CefRefPtr visitor) { CefDOMVisitorCppToC::Wrap(visitor)); } -CefRefPtr CefFrameCToCpp::GetV8Context() { - if (CEF_MEMBER_MISSING(struct_, get_v8context)) - return NULL; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_v8context_t* _retval = struct_->get_v8context(struct_); - - // Return type: refptr_same - return CefV8ContextCToCpp::Wrap(_retval); -} - #ifndef NDEBUG template<> long CefCToCpp::DebugObjCt = diff --git a/cef/libcef_dll/ctocpp/frame_ctocpp.h b/libcef_dll/ctocpp/frame_ctocpp.h similarity index 87% rename from cef/libcef_dll/ctocpp/frame_ctocpp.h rename to libcef_dll/ctocpp/frame_ctocpp.h index 091d85cad..97e1f846c 100644 --- a/cef/libcef_dll/ctocpp/frame_ctocpp.h +++ b/libcef_dll/ctocpp/frame_ctocpp.h @@ -36,6 +36,7 @@ class CefFrameCToCpp virtual ~CefFrameCToCpp() {} // CefFrame methods + virtual bool IsValid() OVERRIDE; virtual void Undo() OVERRIDE; virtual void Redo() OVERRIDE; virtual void Cut() OVERRIDE; @@ -43,18 +44,15 @@ class CefFrameCToCpp virtual void Paste() OVERRIDE; virtual void Delete() OVERRIDE; virtual void SelectAll() OVERRIDE; - virtual void Print() OVERRIDE; virtual void ViewSource() OVERRIDE; - virtual CefString GetSource() OVERRIDE; - virtual CefString GetText() OVERRIDE; + virtual void GetSource(CefRefPtr visitor) OVERRIDE; + virtual void GetText(CefRefPtr visitor) OVERRIDE; virtual void LoadRequest(CefRefPtr request) OVERRIDE; virtual void LoadURL(const CefString& url) OVERRIDE; virtual void LoadString(const CefString& string_val, const CefString& url) OVERRIDE; - virtual void LoadStream(CefRefPtr stream, - const CefString& url) OVERRIDE; - virtual void ExecuteJavaScript(const CefString& jsCode, - const CefString& scriptUrl, int startLine) OVERRIDE; + virtual void ExecuteJavaScript(const CefString& code, + const CefString& script_url, int start_line) OVERRIDE; virtual bool IsMain() OVERRIDE; virtual bool IsFocused() OVERRIDE; virtual CefString GetName() OVERRIDE; @@ -62,8 +60,8 @@ class CefFrameCToCpp virtual CefRefPtr GetParent() OVERRIDE; virtual CefString GetURL() OVERRIDE; virtual CefRefPtr GetBrowser() OVERRIDE; - virtual void VisitDOM(CefRefPtr visitor) OVERRIDE; virtual CefRefPtr GetV8Context() OVERRIDE; + virtual void VisitDOM(CefRefPtr visitor) OVERRIDE; }; #endif // USING_CEF_SHARED diff --git a/libcef_dll/ctocpp/geolocation_callback_ctocpp.cc b/libcef_dll/ctocpp/geolocation_callback_ctocpp.cc new file mode 100644 index 000000000..b46dc0e4d --- /dev/null +++ b/libcef_dll/ctocpp/geolocation_callback_ctocpp.cc @@ -0,0 +1,34 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/geolocation_callback_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefGeolocationCallbackCToCpp::Continue(bool allow) { + if (CEF_MEMBER_MISSING(struct_, cont)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->cont(struct_, + allow); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/geolocation_callback_ctocpp.h b/libcef_dll/ctocpp/geolocation_callback_ctocpp.h new file mode 100644 index 000000000..743887926 --- /dev/null +++ b/libcef_dll/ctocpp/geolocation_callback_ctocpp.h @@ -0,0 +1,42 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_CALLBACK_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_CALLBACK_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_geolocation_handler.h" +#include "include/capi/cef_geolocation_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefGeolocationCallbackCToCpp + : public CefCToCpp { + public: + explicit CefGeolocationCallbackCToCpp(cef_geolocation_callback_t* str) + : CefCToCpp(str) {} + virtual ~CefGeolocationCallbackCToCpp() {} + + // CefGeolocationCallback methods + virtual void Continue(bool allow) OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_CALLBACK_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/geolocation_handler_ctocpp.cc b/libcef_dll/ctocpp/geolocation_handler_ctocpp.cc new file mode 100644 index 000000000..c1831a638 --- /dev/null +++ b/libcef_dll/ctocpp/geolocation_handler_ctocpp.cc @@ -0,0 +1,78 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/geolocation_callback_cpptoc.h" +#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefGeolocationHandlerCToCpp::OnRequestGeolocationPermission( + CefRefPtr browser, const CefString& requesting_url, + int request_id, CefRefPtr callback) { + if (CEF_MEMBER_MISSING(struct_, on_request_geolocation_permission)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: requesting_url; type: string_byref_const + DCHECK(!requesting_url.empty()); + if (requesting_url.empty()) + return; + // Verify param: callback; type: refptr_diff + DCHECK(callback.get()); + if (!callback.get()) + return; + + // Execute + struct_->on_request_geolocation_permission(struct_, + CefBrowserCppToC::Wrap(browser), + requesting_url.GetStruct(), + request_id, + CefGeolocationCallbackCppToC::Wrap(callback)); +} + +void CefGeolocationHandlerCToCpp::OnCancelGeolocationPermission( + CefRefPtr browser, const CefString& requesting_url, + int request_id) { + if (CEF_MEMBER_MISSING(struct_, on_cancel_geolocation_permission)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: requesting_url; type: string_byref_const + DCHECK(!requesting_url.empty()); + if (requesting_url.empty()) + return; + + // Execute + struct_->on_cancel_geolocation_permission(struct_, + CefBrowserCppToC::Wrap(browser), + requesting_url.GetStruct(), + request_id); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/geolocation_handler_ctocpp.h b/libcef_dll/ctocpp/geolocation_handler_ctocpp.h new file mode 100644 index 000000000..20b63bb2e --- /dev/null +++ b/libcef_dll/ctocpp/geolocation_handler_ctocpp.h @@ -0,0 +1,46 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_geolocation_handler.h" +#include "include/capi/cef_geolocation_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefGeolocationHandlerCToCpp + : public CefCToCpp { + public: + explicit CefGeolocationHandlerCToCpp(cef_geolocation_handler_t* str) + : CefCToCpp(str) {} + virtual ~CefGeolocationHandlerCToCpp() {} + + // CefGeolocationHandler methods + virtual void OnRequestGeolocationPermission(CefRefPtr browser, + const CefString& requesting_url, int request_id, + CefRefPtr callback) OVERRIDE; + virtual void OnCancelGeolocationPermission(CefRefPtr browser, + const CefString& requesting_url, int request_id) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_GEOLOCATION_HANDLER_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc b/libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc new file mode 100644 index 000000000..1930adc63 --- /dev/null +++ b/libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc @@ -0,0 +1,38 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/jsdialog_callback_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefJSDialogCallbackCToCpp::Continue(bool success, + const CefString& user_input) { + if (CEF_MEMBER_MISSING(struct_, cont)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Unverified params: user_input + + // Execute + struct_->cont(struct_, + success, + user_input.GetStruct()); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/jsdialog_callback_ctocpp.h b/libcef_dll/ctocpp/jsdialog_callback_ctocpp.h new file mode 100644 index 000000000..4c20701e4 --- /dev/null +++ b/libcef_dll/ctocpp/jsdialog_callback_ctocpp.h @@ -0,0 +1,42 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_JSDIALOG_CALLBACK_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_JSDIALOG_CALLBACK_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_jsdialog_handler.h" +#include "include/capi/cef_jsdialog_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefJSDialogCallbackCToCpp + : public CefCToCpp { + public: + explicit CefJSDialogCallbackCToCpp(cef_jsdialog_callback_t* str) + : CefCToCpp(str) {} + virtual ~CefJSDialogCallbackCToCpp() {} + + // CefJSDialogCallback methods + virtual void Continue(bool success, const CefString& user_input) OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_JSDIALOG_CALLBACK_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/jsdialog_handler_ctocpp.cc b/libcef_dll/ctocpp/jsdialog_handler_ctocpp.cc new file mode 100644 index 000000000..971222994 --- /dev/null +++ b/libcef_dll/ctocpp/jsdialog_handler_ctocpp.cc @@ -0,0 +1,116 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/jsdialog_callback_cpptoc.h" +#include "libcef_dll/ctocpp/jsdialog_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefJSDialogHandlerCToCpp::OnJSDialog(CefRefPtr browser, + const CefString& origin_url, const CefString& accept_lang, + JSDialogType dialog_type, const CefString& message_text, + const CefString& default_prompt_text, + CefRefPtr callback, bool& suppress_message) { + if (CEF_MEMBER_MISSING(struct_, on_jsdialog)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + // Verify param: origin_url; type: string_byref_const + DCHECK(!origin_url.empty()); + if (origin_url.empty()) + return false; + // Verify param: callback; type: refptr_diff + DCHECK(callback.get()); + if (!callback.get()) + return false; + // Unverified params: accept_lang, message_text, default_prompt_text + + // Translate param: suppress_message; type: bool_byref + int suppress_messageInt = suppress_message; + + // Execute + int _retval = struct_->on_jsdialog(struct_, + CefBrowserCppToC::Wrap(browser), + origin_url.GetStruct(), + accept_lang.GetStruct(), + dialog_type, + message_text.GetStruct(), + default_prompt_text.GetStruct(), + CefJSDialogCallbackCppToC::Wrap(callback), + &suppress_messageInt); + + // Restore param:suppress_message; type: bool_byref + suppress_message = suppress_messageInt?true:false; + + // Return type: bool + return _retval?true:false; +} + +bool CefJSDialogHandlerCToCpp::OnBeforeUnloadDialog( + CefRefPtr browser, const CefString& message_text, + bool is_reload, CefRefPtr callback) { + if (CEF_MEMBER_MISSING(struct_, on_before_unload_dialog)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + // Verify param: callback; type: refptr_diff + DCHECK(callback.get()); + if (!callback.get()) + return false; + // Unverified params: message_text + + // Execute + int _retval = struct_->on_before_unload_dialog(struct_, + CefBrowserCppToC::Wrap(browser), + message_text.GetStruct(), + is_reload, + CefJSDialogCallbackCppToC::Wrap(callback)); + + // Return type: bool + return _retval?true:false; +} + +void CefJSDialogHandlerCToCpp::OnResetDialogState( + CefRefPtr browser) { + if (CEF_MEMBER_MISSING(struct_, on_reset_dialog_state)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + + // Execute + struct_->on_reset_dialog_state(struct_, + CefBrowserCppToC::Wrap(browser)); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/jsdialog_handler_ctocpp.h b/libcef_dll/ctocpp/jsdialog_handler_ctocpp.h new file mode 100644 index 000000000..69a046d8b --- /dev/null +++ b/libcef_dll/ctocpp/jsdialog_handler_ctocpp.h @@ -0,0 +1,51 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_JSDIALOG_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_JSDIALOG_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_jsdialog_handler.h" +#include "include/capi/cef_jsdialog_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefJSDialogHandlerCToCpp + : public CefCToCpp { + public: + explicit CefJSDialogHandlerCToCpp(cef_jsdialog_handler_t* str) + : CefCToCpp(str) {} + virtual ~CefJSDialogHandlerCToCpp() {} + + // CefJSDialogHandler methods + virtual bool OnJSDialog(CefRefPtr browser, + const CefString& origin_url, const CefString& accept_lang, + JSDialogType dialog_type, const CefString& message_text, + const CefString& default_prompt_text, + CefRefPtr callback, + bool& suppress_message) OVERRIDE; + virtual bool OnBeforeUnloadDialog(CefRefPtr browser, + const CefString& message_text, bool is_reload, + CefRefPtr callback) OVERRIDE; + virtual void OnResetDialogState(CefRefPtr browser) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_JSDIALOG_HANDLER_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/keyboard_handler_ctocpp.cc b/libcef_dll/ctocpp/keyboard_handler_ctocpp.cc new file mode 100644 index 000000000..f5d93cb32 --- /dev/null +++ b/libcef_dll/ctocpp/keyboard_handler_ctocpp.cc @@ -0,0 +1,81 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefKeyboardHandlerCToCpp::OnPreKeyEvent(CefRefPtr browser, + const CefKeyEvent& event, CefEventHandle os_event, + bool* is_keyboard_shortcut) { + if (CEF_MEMBER_MISSING(struct_, on_pre_key_event)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + // Verify param: is_keyboard_shortcut; type: bool_byaddr + DCHECK(is_keyboard_shortcut); + if (!is_keyboard_shortcut) + return false; + + // Translate param: is_keyboard_shortcut; type: bool_byaddr + int is_keyboard_shortcutInt = is_keyboard_shortcut?*is_keyboard_shortcut:0; + + // Execute + int _retval = struct_->on_pre_key_event(struct_, + CefBrowserCppToC::Wrap(browser), + &event, + os_event, + &is_keyboard_shortcutInt); + + // Restore param:is_keyboard_shortcut; type: bool_byaddr + if (is_keyboard_shortcut) + *is_keyboard_shortcut = is_keyboard_shortcutInt?true:false; + + // Return type: bool + return _retval?true:false; +} + +bool CefKeyboardHandlerCToCpp::OnKeyEvent(CefRefPtr browser, + const CefKeyEvent& event, CefEventHandle os_event) { + if (CEF_MEMBER_MISSING(struct_, on_key_event)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + + // Execute + int _retval = struct_->on_key_event(struct_, + CefBrowserCppToC::Wrap(browser), + &event, + os_event); + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/keyboard_handler_ctocpp.h b/libcef_dll/ctocpp/keyboard_handler_ctocpp.h new file mode 100644 index 000000000..32e0f9373 --- /dev/null +++ b/libcef_dll/ctocpp/keyboard_handler_ctocpp.h @@ -0,0 +1,46 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_KEYBOARD_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_KEYBOARD_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_keyboard_handler.h" +#include "include/capi/cef_keyboard_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefKeyboardHandlerCToCpp + : public CefCToCpp { + public: + explicit CefKeyboardHandlerCToCpp(cef_keyboard_handler_t* str) + : CefCToCpp(str) {} + virtual ~CefKeyboardHandlerCToCpp() {} + + // CefKeyboardHandler methods + virtual bool OnPreKeyEvent(CefRefPtr browser, + const CefKeyEvent& event, CefEventHandle os_event, + bool* is_keyboard_shortcut) OVERRIDE; + virtual bool OnKeyEvent(CefRefPtr browser, + const CefKeyEvent& event, CefEventHandle os_event) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_KEYBOARD_HANDLER_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/life_span_handler_ctocpp.cc b/libcef_dll/ctocpp/life_span_handler_ctocpp.cc new file mode 100644 index 000000000..4db810135 --- /dev/null +++ b/libcef_dll/ctocpp/life_span_handler_ctocpp.cc @@ -0,0 +1,138 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/ctocpp/client_ctocpp.h" +#include "libcef_dll/ctocpp/life_span_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefLifeSpanHandlerCToCpp::OnBeforePopup( + CefRefPtr parentBrowser, const CefPopupFeatures& popupFeatures, + CefWindowInfo& windowInfo, const CefString& url, + CefRefPtr& client, CefBrowserSettings& settings) { + if (CEF_MEMBER_MISSING(struct_, on_before_popup)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: parentBrowser; type: refptr_diff + DCHECK(parentBrowser.get()); + if (!parentBrowser.get()) + return false; + // Unverified params: url + + // Translate param: client; type: refptr_same_byref + cef_client_t* clientStruct = NULL; + if (client.get()) + clientStruct = CefClientCToCpp::Unwrap(client); + cef_client_t* clientOrig = clientStruct; + + // Execute + int _retval = struct_->on_before_popup(struct_, + CefBrowserCppToC::Wrap(parentBrowser), + &popupFeatures, + &windowInfo, + url.GetStruct(), + &clientStruct, + &settings); + + // Restore param:client; type: refptr_same_byref + if (clientStruct) { + if (clientStruct != clientOrig) { + client = CefClientCToCpp::Wrap(clientStruct); + } + } else { + client = NULL; + } + + // Return type: bool + return _retval?true:false; +} + +void CefLifeSpanHandlerCToCpp::OnAfterCreated(CefRefPtr browser) { + if (CEF_MEMBER_MISSING(struct_, on_after_created)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + + // Execute + struct_->on_after_created(struct_, + CefBrowserCppToC::Wrap(browser)); +} + +bool CefLifeSpanHandlerCToCpp::RunModal(CefRefPtr browser) { + if (CEF_MEMBER_MISSING(struct_, run_modal)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + + // Execute + int _retval = struct_->run_modal(struct_, + CefBrowserCppToC::Wrap(browser)); + + // Return type: bool + return _retval?true:false; +} + +bool CefLifeSpanHandlerCToCpp::DoClose(CefRefPtr browser) { + if (CEF_MEMBER_MISSING(struct_, do_close)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + + // Execute + int _retval = struct_->do_close(struct_, + CefBrowserCppToC::Wrap(browser)); + + // Return type: bool + return _retval?true:false; +} + +void CefLifeSpanHandlerCToCpp::OnBeforeClose(CefRefPtr browser) { + if (CEF_MEMBER_MISSING(struct_, on_before_close)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + + // Execute + struct_->on_before_close(struct_, + CefBrowserCppToC::Wrap(browser)); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/life_span_handler_ctocpp.h b/libcef_dll/ctocpp/life_span_handler_ctocpp.h new file mode 100644 index 000000000..7b5e45b48 --- /dev/null +++ b/libcef_dll/ctocpp/life_span_handler_ctocpp.h @@ -0,0 +1,51 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_LIFE_SPAN_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_LIFE_SPAN_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_life_span_handler.h" +#include "include/capi/cef_life_span_handler_capi.h" +#include "include/cef_client.h" +#include "include/capi/cef_client_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefLifeSpanHandlerCToCpp + : public CefCToCpp { + public: + explicit CefLifeSpanHandlerCToCpp(cef_life_span_handler_t* str) + : CefCToCpp(str) {} + virtual ~CefLifeSpanHandlerCToCpp() {} + + // CefLifeSpanHandler methods + virtual bool OnBeforePopup(CefRefPtr parentBrowser, + const CefPopupFeatures& popupFeatures, CefWindowInfo& windowInfo, + const CefString& url, CefRefPtr& client, + CefBrowserSettings& settings) OVERRIDE; + virtual void OnAfterCreated(CefRefPtr browser) OVERRIDE; + virtual bool RunModal(CefRefPtr browser) OVERRIDE; + virtual bool DoClose(CefRefPtr browser) OVERRIDE; + virtual void OnBeforeClose(CefRefPtr browser) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_LIFE_SPAN_HANDLER_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/list_value_ctocpp.cc b/libcef_dll/ctocpp/list_value_ctocpp.cc new file mode 100644 index 000000000..8ec9e2651 --- /dev/null +++ b/libcef_dll/ctocpp/list_value_ctocpp.cc @@ -0,0 +1,476 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/binary_value_ctocpp.h" +#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h" +#include "libcef_dll/ctocpp/list_value_ctocpp.h" + + +// STATIC METHODS - Body may be edited by hand. + +CefRefPtr CefListValue::Create() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_list_value_t* _retval = cef_list_value_create(); + + // Return type: refptr_same + return CefListValueCToCpp::Wrap(_retval); +} + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefListValueCToCpp::IsValid() { + if (CEF_MEMBER_MISSING(struct_, is_valid)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_valid(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefListValueCToCpp::IsOwned() { + if (CEF_MEMBER_MISSING(struct_, is_owned)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_owned(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefListValueCToCpp::IsReadOnly() { + if (CEF_MEMBER_MISSING(struct_, is_read_only)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_read_only(struct_); + + // Return type: bool + return _retval?true:false; +} + +CefRefPtr CefListValueCToCpp::Copy() { + if (CEF_MEMBER_MISSING(struct_, copy)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_list_value_t* _retval = struct_->copy(struct_); + + // Return type: refptr_same + return CefListValueCToCpp::Wrap(_retval); +} + +bool CefListValueCToCpp::SetSize(size_t size) { + if (CEF_MEMBER_MISSING(struct_, set_size)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->set_size(struct_, + size); + + // Return type: bool + return _retval?true:false; +} + +size_t CefListValueCToCpp::GetSize() { + if (CEF_MEMBER_MISSING(struct_, get_size)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + size_t _retval = struct_->get_size(struct_); + + // Return type: simple + return _retval; +} + +bool CefListValueCToCpp::Clear() { + if (CEF_MEMBER_MISSING(struct_, clear)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->clear(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefListValueCToCpp::Remove(int index) { + if (CEF_MEMBER_MISSING(struct_, remove)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return false; + + // Execute + int _retval = struct_->remove(struct_, + index); + + // Return type: bool + return _retval?true:false; +} + +CefValueType CefListValueCToCpp::GetType(int index) { + if (CEF_MEMBER_MISSING(struct_, get_type)) + return VTYPE_INVALID; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return VTYPE_INVALID; + + // Execute + cef_value_type_t _retval = struct_->get_type(struct_, + index); + + // Return type: simple + return _retval; +} + +bool CefListValueCToCpp::GetBool(int index) { + if (CEF_MEMBER_MISSING(struct_, get_bool)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return false; + + // Execute + int _retval = struct_->get_bool(struct_, + index); + + // Return type: bool + return _retval?true:false; +} + +int CefListValueCToCpp::GetInt(int index) { + if (CEF_MEMBER_MISSING(struct_, get_int)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + + // Execute + int _retval = struct_->get_int(struct_, + index); + + // Return type: simple + return _retval; +} + +double CefListValueCToCpp::GetDouble(int index) { + if (CEF_MEMBER_MISSING(struct_, get_double)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return 0; + + // Execute + double _retval = struct_->get_double(struct_, + index); + + // Return type: simple + return _retval; +} + +CefString CefListValueCToCpp::GetString(int index) { + if (CEF_MEMBER_MISSING(struct_, get_string)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return CefString(); + + // Execute + cef_string_userfree_t _retval = struct_->get_string(struct_, + index); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +CefRefPtr CefListValueCToCpp::GetBinary(int index) { + if (CEF_MEMBER_MISSING(struct_, get_binary)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return NULL; + + // Execute + cef_binary_value_t* _retval = struct_->get_binary(struct_, + index); + + // Return type: refptr_same + return CefBinaryValueCToCpp::Wrap(_retval); +} + +CefRefPtr CefListValueCToCpp::GetDictionary(int index) { + if (CEF_MEMBER_MISSING(struct_, get_dictionary)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return NULL; + + // Execute + cef_dictionary_value_t* _retval = struct_->get_dictionary(struct_, + index); + + // Return type: refptr_same + return CefDictionaryValueCToCpp::Wrap(_retval); +} + +CefRefPtr CefListValueCToCpp::GetList(int index) { + if (CEF_MEMBER_MISSING(struct_, get_list)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return NULL; + + // Execute + cef_list_value_t* _retval = struct_->get_list(struct_, + index); + + // Return type: refptr_same + return CefListValueCToCpp::Wrap(_retval); +} + +bool CefListValueCToCpp::SetNull(int index) { + if (CEF_MEMBER_MISSING(struct_, set_null)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return false; + + // Execute + int _retval = struct_->set_null(struct_, + index); + + // Return type: bool + return _retval?true:false; +} + +bool CefListValueCToCpp::SetBool(int index, bool value) { + if (CEF_MEMBER_MISSING(struct_, set_bool)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return false; + + // Execute + int _retval = struct_->set_bool(struct_, + index, + value); + + // Return type: bool + return _retval?true:false; +} + +bool CefListValueCToCpp::SetInt(int index, int value) { + if (CEF_MEMBER_MISSING(struct_, set_int)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return false; + + // Execute + int _retval = struct_->set_int(struct_, + index, + value); + + // Return type: bool + return _retval?true:false; +} + +bool CefListValueCToCpp::SetDouble(int index, double value) { + if (CEF_MEMBER_MISSING(struct_, set_double)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return false; + + // Execute + int _retval = struct_->set_double(struct_, + index, + value); + + // Return type: bool + return _retval?true:false; +} + +bool CefListValueCToCpp::SetString(int index, const CefString& value) { + if (CEF_MEMBER_MISSING(struct_, set_string)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return false; + // Unverified params: value + + // Execute + int _retval = struct_->set_string(struct_, + index, + value.GetStruct()); + + // Return type: bool + return _retval?true:false; +} + +bool CefListValueCToCpp::SetBinary(int index, CefRefPtr value) { + if (CEF_MEMBER_MISSING(struct_, set_binary)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return false; + // Verify param: value; type: refptr_same + DCHECK(value.get()); + if (!value.get()) + return false; + + // Execute + int _retval = struct_->set_binary(struct_, + index, + CefBinaryValueCToCpp::Unwrap(value)); + + // Return type: bool + return _retval?true:false; +} + +bool CefListValueCToCpp::SetDictionary(int index, + CefRefPtr value) { + if (CEF_MEMBER_MISSING(struct_, set_dictionary)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return false; + // Verify param: value; type: refptr_same + DCHECK(value.get()); + if (!value.get()) + return false; + + // Execute + int _retval = struct_->set_dictionary(struct_, + index, + CefDictionaryValueCToCpp::Unwrap(value)); + + // Return type: bool + return _retval?true:false; +} + +bool CefListValueCToCpp::SetList(int index, CefRefPtr value) { + if (CEF_MEMBER_MISSING(struct_, set_list)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: index; type: simple_byval + DCHECK_GE(index, 0); + if (index < 0) + return false; + // Verify param: value; type: refptr_same + DCHECK(value.get()); + if (!value.get()) + return false; + + // Execute + int _retval = struct_->set_list(struct_, + index, + CefListValueCToCpp::Unwrap(value)); + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/list_value_ctocpp.h b/libcef_dll/ctocpp/list_value_ctocpp.h new file mode 100644 index 000000000..086ea5b82 --- /dev/null +++ b/libcef_dll/ctocpp/list_value_ctocpp.h @@ -0,0 +1,64 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_LIST_VALUE_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_LIST_VALUE_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_values.h" +#include "include/capi/cef_values_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefListValueCToCpp + : public CefCToCpp { + public: + explicit CefListValueCToCpp(cef_list_value_t* str) + : CefCToCpp(str) {} + virtual ~CefListValueCToCpp() {} + + // CefListValue methods + virtual bool IsValid() OVERRIDE; + virtual bool IsOwned() OVERRIDE; + virtual bool IsReadOnly() OVERRIDE; + virtual CefRefPtr Copy() OVERRIDE; + virtual bool SetSize(size_t size) OVERRIDE; + virtual size_t GetSize() OVERRIDE; + virtual bool Clear() OVERRIDE; + virtual bool Remove(int index) OVERRIDE; + virtual CefValueType GetType(int index) OVERRIDE; + virtual bool GetBool(int index) OVERRIDE; + virtual int GetInt(int index) OVERRIDE; + virtual double GetDouble(int index) OVERRIDE; + virtual CefString GetString(int index) OVERRIDE; + virtual CefRefPtr GetBinary(int index) OVERRIDE; + virtual CefRefPtr GetDictionary(int index) OVERRIDE; + virtual CefRefPtr GetList(int index) OVERRIDE; + virtual bool SetNull(int index) OVERRIDE; + virtual bool SetBool(int index, bool value) OVERRIDE; + virtual bool SetInt(int index, int value) OVERRIDE; + virtual bool SetDouble(int index, double value) OVERRIDE; + virtual bool SetString(int index, const CefString& value) OVERRIDE; + virtual bool SetBinary(int index, CefRefPtr value) OVERRIDE; + virtual bool SetDictionary(int index, + CefRefPtr value) OVERRIDE; + virtual bool SetList(int index, CefRefPtr value) OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_LIST_VALUE_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/load_handler_ctocpp.cc b/libcef_dll/ctocpp/load_handler_ctocpp.cc new file mode 100644 index 000000000..c853f0cd3 --- /dev/null +++ b/libcef_dll/ctocpp/load_handler_ctocpp.cc @@ -0,0 +1,141 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/frame_cpptoc.h" +#include "libcef_dll/ctocpp/load_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefLoadHandlerCToCpp::OnLoadStart(CefRefPtr browser, + CefRefPtr frame) { + if (CEF_MEMBER_MISSING(struct_, on_load_start)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return; + + // Execute + struct_->on_load_start(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame)); +} + +void CefLoadHandlerCToCpp::OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, int httpStatusCode) { + if (CEF_MEMBER_MISSING(struct_, on_load_end)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return; + + // Execute + struct_->on_load_end(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + httpStatusCode); +} + +void CefLoadHandlerCToCpp::OnLoadError(CefRefPtr browser, + CefRefPtr frame, ErrorCode errorCode, const CefString& errorText, + const CefString& failedUrl) { + if (CEF_MEMBER_MISSING(struct_, on_load_error)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return; + // Verify param: failedUrl; type: string_byref_const + DCHECK(!failedUrl.empty()); + if (failedUrl.empty()) + return; + // Unverified params: errorText + + // Execute + struct_->on_load_error(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + errorCode, + errorText.GetStruct(), + failedUrl.GetStruct()); +} + +void CefLoadHandlerCToCpp::OnRenderProcessTerminated( + CefRefPtr browser, TerminationStatus status) { + if (CEF_MEMBER_MISSING(struct_, on_render_process_terminated)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + + // Execute + struct_->on_render_process_terminated(struct_, + CefBrowserCppToC::Wrap(browser), + status); +} + +void CefLoadHandlerCToCpp::OnPluginCrashed(CefRefPtr browser, + const CefString& plugin_path) { + if (CEF_MEMBER_MISSING(struct_, on_plugin_crashed)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: plugin_path; type: string_byref_const + DCHECK(!plugin_path.empty()); + if (plugin_path.empty()) + return; + + // Execute + struct_->on_plugin_crashed(struct_, + CefBrowserCppToC::Wrap(browser), + plugin_path.GetStruct()); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/load_handler_ctocpp.h b/libcef_dll/ctocpp/load_handler_ctocpp.h new file mode 100644 index 000000000..4d7515913 --- /dev/null +++ b/libcef_dll/ctocpp/load_handler_ctocpp.h @@ -0,0 +1,52 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_LOAD_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_LOAD_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_load_handler.h" +#include "include/capi/cef_load_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefLoadHandlerCToCpp + : public CefCToCpp { + public: + explicit CefLoadHandlerCToCpp(cef_load_handler_t* str) + : CefCToCpp( + str) {} + virtual ~CefLoadHandlerCToCpp() {} + + // CefLoadHandler methods + virtual void OnLoadStart(CefRefPtr browser, + CefRefPtr frame) OVERRIDE; + virtual void OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, int httpStatusCode) OVERRIDE; + virtual void OnLoadError(CefRefPtr browser, + CefRefPtr frame, ErrorCode errorCode, + const CefString& errorText, const CefString& failedUrl) OVERRIDE; + virtual void OnRenderProcessTerminated(CefRefPtr browser, + TerminationStatus status) OVERRIDE; + virtual void OnPluginCrashed(CefRefPtr browser, + const CefString& plugin_path) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_LOAD_HANDLER_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/menu_model_ctocpp.cc b/libcef_dll/ctocpp/menu_model_ctocpp.cc new file mode 100644 index 000000000..eea4a5dcb --- /dev/null +++ b/libcef_dll/ctocpp/menu_model_ctocpp.cc @@ -0,0 +1,839 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/menu_model_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefMenuModelCToCpp::Clear() { + if (CEF_MEMBER_MISSING(struct_, clear)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->clear(struct_); + + // Return type: bool + return _retval?true:false; +} + +int CefMenuModelCToCpp::GetCount() { + if (CEF_MEMBER_MISSING(struct_, get_count)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->get_count(struct_); + + // Return type: simple + return _retval; +} + +bool CefMenuModelCToCpp::AddSeparator() { + if (CEF_MEMBER_MISSING(struct_, add_separator)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->add_separator(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::AddItem(int command_id, const CefString& label) { + if (CEF_MEMBER_MISSING(struct_, add_item)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: label; type: string_byref_const + DCHECK(!label.empty()); + if (label.empty()) + return false; + + // Execute + int _retval = struct_->add_item(struct_, + command_id, + label.GetStruct()); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::AddCheckItem(int command_id, const CefString& label) { + if (CEF_MEMBER_MISSING(struct_, add_check_item)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: label; type: string_byref_const + DCHECK(!label.empty()); + if (label.empty()) + return false; + + // Execute + int _retval = struct_->add_check_item(struct_, + command_id, + label.GetStruct()); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::AddRadioItem(int command_id, const CefString& label, + int group_id) { + if (CEF_MEMBER_MISSING(struct_, add_radio_item)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: label; type: string_byref_const + DCHECK(!label.empty()); + if (label.empty()) + return false; + + // Execute + int _retval = struct_->add_radio_item(struct_, + command_id, + label.GetStruct(), + group_id); + + // Return type: bool + return _retval?true:false; +} + +CefRefPtr CefMenuModelCToCpp::AddSubMenu(int command_id, + const CefString& label) { + if (CEF_MEMBER_MISSING(struct_, add_sub_menu)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: label; type: string_byref_const + DCHECK(!label.empty()); + if (label.empty()) + return NULL; + + // Execute + cef_menu_model_t* _retval = struct_->add_sub_menu(struct_, + command_id, + label.GetStruct()); + + // Return type: refptr_same + return CefMenuModelCToCpp::Wrap(_retval); +} + +bool CefMenuModelCToCpp::InsertSeparatorAt(int index) { + if (CEF_MEMBER_MISSING(struct_, insert_separator_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->insert_separator_at(struct_, + index); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::InsertItemAt(int index, int command_id, + const CefString& label) { + if (CEF_MEMBER_MISSING(struct_, insert_item_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: label; type: string_byref_const + DCHECK(!label.empty()); + if (label.empty()) + return false; + + // Execute + int _retval = struct_->insert_item_at(struct_, + index, + command_id, + label.GetStruct()); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::InsertCheckItemAt(int index, int command_id, + const CefString& label) { + if (CEF_MEMBER_MISSING(struct_, insert_check_item_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: label; type: string_byref_const + DCHECK(!label.empty()); + if (label.empty()) + return false; + + // Execute + int _retval = struct_->insert_check_item_at(struct_, + index, + command_id, + label.GetStruct()); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::InsertRadioItemAt(int index, int command_id, + const CefString& label, int group_id) { + if (CEF_MEMBER_MISSING(struct_, insert_radio_item_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: label; type: string_byref_const + DCHECK(!label.empty()); + if (label.empty()) + return false; + + // Execute + int _retval = struct_->insert_radio_item_at(struct_, + index, + command_id, + label.GetStruct(), + group_id); + + // Return type: bool + return _retval?true:false; +} + +CefRefPtr CefMenuModelCToCpp::InsertSubMenuAt(int index, + int command_id, const CefString& label) { + if (CEF_MEMBER_MISSING(struct_, insert_sub_menu_at)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: label; type: string_byref_const + DCHECK(!label.empty()); + if (label.empty()) + return NULL; + + // Execute + cef_menu_model_t* _retval = struct_->insert_sub_menu_at(struct_, + index, + command_id, + label.GetStruct()); + + // Return type: refptr_same + return CefMenuModelCToCpp::Wrap(_retval); +} + +bool CefMenuModelCToCpp::Remove(int command_id) { + if (CEF_MEMBER_MISSING(struct_, remove)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->remove(struct_, + command_id); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::RemoveAt(int index) { + if (CEF_MEMBER_MISSING(struct_, remove_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->remove_at(struct_, + index); + + // Return type: bool + return _retval?true:false; +} + +int CefMenuModelCToCpp::GetIndexOf(int command_id) { + if (CEF_MEMBER_MISSING(struct_, get_index_of)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->get_index_of(struct_, + command_id); + + // Return type: simple + return _retval; +} + +int CefMenuModelCToCpp::GetCommandIdAt(int index) { + if (CEF_MEMBER_MISSING(struct_, get_command_id_at)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->get_command_id_at(struct_, + index); + + // Return type: simple + return _retval; +} + +bool CefMenuModelCToCpp::SetCommandIdAt(int index, int command_id) { + if (CEF_MEMBER_MISSING(struct_, set_command_id_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->set_command_id_at(struct_, + index, + command_id); + + // Return type: bool + return _retval?true:false; +} + +CefString CefMenuModelCToCpp::GetLabel(int command_id) { + if (CEF_MEMBER_MISSING(struct_, get_label)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_label(struct_, + command_id); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +CefString CefMenuModelCToCpp::GetLabelAt(int index) { + if (CEF_MEMBER_MISSING(struct_, get_label_at)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_label_at(struct_, + index); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +bool CefMenuModelCToCpp::SetLabel(int command_id, const CefString& label) { + if (CEF_MEMBER_MISSING(struct_, set_label)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: label; type: string_byref_const + DCHECK(!label.empty()); + if (label.empty()) + return false; + + // Execute + int _retval = struct_->set_label(struct_, + command_id, + label.GetStruct()); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::SetLabelAt(int index, const CefString& label) { + if (CEF_MEMBER_MISSING(struct_, set_label_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: label; type: string_byref_const + DCHECK(!label.empty()); + if (label.empty()) + return false; + + // Execute + int _retval = struct_->set_label_at(struct_, + index, + label.GetStruct()); + + // Return type: bool + return _retval?true:false; +} + +CefMenuModel::MenuItemType CefMenuModelCToCpp::GetType(int command_id) { + if (CEF_MEMBER_MISSING(struct_, get_type)) + return MENUITEMTYPE_NONE; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_menu_item_type_t _retval = struct_->get_type(struct_, + command_id); + + // Return type: simple + return _retval; +} + +CefMenuModel::MenuItemType CefMenuModelCToCpp::GetTypeAt(int index) { + if (CEF_MEMBER_MISSING(struct_, get_type_at)) + return MENUITEMTYPE_NONE; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_menu_item_type_t _retval = struct_->get_type_at(struct_, + index); + + // Return type: simple + return _retval; +} + +int CefMenuModelCToCpp::GetGroupId(int command_id) { + if (CEF_MEMBER_MISSING(struct_, get_group_id)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->get_group_id(struct_, + command_id); + + // Return type: simple + return _retval; +} + +int CefMenuModelCToCpp::GetGroupIdAt(int index) { + if (CEF_MEMBER_MISSING(struct_, get_group_id_at)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->get_group_id_at(struct_, + index); + + // Return type: simple + return _retval; +} + +bool CefMenuModelCToCpp::SetGroupId(int command_id, int group_id) { + if (CEF_MEMBER_MISSING(struct_, set_group_id)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->set_group_id(struct_, + command_id, + group_id); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::SetGroupIdAt(int index, int group_id) { + if (CEF_MEMBER_MISSING(struct_, set_group_id_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->set_group_id_at(struct_, + index, + group_id); + + // Return type: bool + return _retval?true:false; +} + +CefRefPtr CefMenuModelCToCpp::GetSubMenu(int command_id) { + if (CEF_MEMBER_MISSING(struct_, get_sub_menu)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_menu_model_t* _retval = struct_->get_sub_menu(struct_, + command_id); + + // Return type: refptr_same + return CefMenuModelCToCpp::Wrap(_retval); +} + +CefRefPtr CefMenuModelCToCpp::GetSubMenuAt(int index) { + if (CEF_MEMBER_MISSING(struct_, get_sub_menu_at)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_menu_model_t* _retval = struct_->get_sub_menu_at(struct_, + index); + + // Return type: refptr_same + return CefMenuModelCToCpp::Wrap(_retval); +} + +bool CefMenuModelCToCpp::IsVisible(int command_id) { + if (CEF_MEMBER_MISSING(struct_, is_visible)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_visible(struct_, + command_id); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::IsVisibleAt(int index) { + if (CEF_MEMBER_MISSING(struct_, is_visible_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_visible_at(struct_, + index); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::SetVisible(int command_id, bool visible) { + if (CEF_MEMBER_MISSING(struct_, set_visible)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->set_visible(struct_, + command_id, + visible); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::SetVisibleAt(int index, bool visible) { + if (CEF_MEMBER_MISSING(struct_, set_visible_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->set_visible_at(struct_, + index, + visible); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::IsEnabled(int command_id) { + if (CEF_MEMBER_MISSING(struct_, is_enabled)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_enabled(struct_, + command_id); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::IsEnabledAt(int index) { + if (CEF_MEMBER_MISSING(struct_, is_enabled_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_enabled_at(struct_, + index); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::SetEnabled(int command_id, bool enabled) { + if (CEF_MEMBER_MISSING(struct_, set_enabled)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->set_enabled(struct_, + command_id, + enabled); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::SetEnabledAt(int index, bool enabled) { + if (CEF_MEMBER_MISSING(struct_, set_enabled_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->set_enabled_at(struct_, + index, + enabled); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::IsChecked(int command_id) { + if (CEF_MEMBER_MISSING(struct_, is_checked)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_checked(struct_, + command_id); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::IsCheckedAt(int index) { + if (CEF_MEMBER_MISSING(struct_, is_checked_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_checked_at(struct_, + index); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::SetChecked(int command_id, bool checked) { + if (CEF_MEMBER_MISSING(struct_, set_checked)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->set_checked(struct_, + command_id, + checked); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::SetCheckedAt(int index, bool checked) { + if (CEF_MEMBER_MISSING(struct_, set_checked_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->set_checked_at(struct_, + index, + checked); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::HasAccelerator(int command_id) { + if (CEF_MEMBER_MISSING(struct_, has_accelerator)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->has_accelerator(struct_, + command_id); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::HasAcceleratorAt(int index) { + if (CEF_MEMBER_MISSING(struct_, has_accelerator_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->has_accelerator_at(struct_, + index); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::SetAccelerator(int command_id, int key_code, + bool shift_pressed, bool ctrl_pressed, bool alt_pressed) { + if (CEF_MEMBER_MISSING(struct_, set_accelerator)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->set_accelerator(struct_, + command_id, + key_code, + shift_pressed, + ctrl_pressed, + alt_pressed); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::SetAcceleratorAt(int index, int key_code, + bool shift_pressed, bool ctrl_pressed, bool alt_pressed) { + if (CEF_MEMBER_MISSING(struct_, set_accelerator_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->set_accelerator_at(struct_, + index, + key_code, + shift_pressed, + ctrl_pressed, + alt_pressed); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::RemoveAccelerator(int command_id) { + if (CEF_MEMBER_MISSING(struct_, remove_accelerator)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->remove_accelerator(struct_, + command_id); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::RemoveAcceleratorAt(int index) { + if (CEF_MEMBER_MISSING(struct_, remove_accelerator_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->remove_accelerator_at(struct_, + index); + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::GetAccelerator(int command_id, int& key_code, + bool& shift_pressed, bool& ctrl_pressed, bool& alt_pressed) { + if (CEF_MEMBER_MISSING(struct_, get_accelerator)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Translate param: shift_pressed; type: bool_byref + int shift_pressedInt = shift_pressed; + // Translate param: ctrl_pressed; type: bool_byref + int ctrl_pressedInt = ctrl_pressed; + // Translate param: alt_pressed; type: bool_byref + int alt_pressedInt = alt_pressed; + + // Execute + int _retval = struct_->get_accelerator(struct_, + command_id, + &key_code, + &shift_pressedInt, + &ctrl_pressedInt, + &alt_pressedInt); + + // Restore param:shift_pressed; type: bool_byref + shift_pressed = shift_pressedInt?true:false; + // Restore param:ctrl_pressed; type: bool_byref + ctrl_pressed = ctrl_pressedInt?true:false; + // Restore param:alt_pressed; type: bool_byref + alt_pressed = alt_pressedInt?true:false; + + // Return type: bool + return _retval?true:false; +} + +bool CefMenuModelCToCpp::GetAcceleratorAt(int index, int& key_code, + bool& shift_pressed, bool& ctrl_pressed, bool& alt_pressed) { + if (CEF_MEMBER_MISSING(struct_, get_accelerator_at)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Translate param: shift_pressed; type: bool_byref + int shift_pressedInt = shift_pressed; + // Translate param: ctrl_pressed; type: bool_byref + int ctrl_pressedInt = ctrl_pressed; + // Translate param: alt_pressed; type: bool_byref + int alt_pressedInt = alt_pressed; + + // Execute + int _retval = struct_->get_accelerator_at(struct_, + index, + &key_code, + &shift_pressedInt, + &ctrl_pressedInt, + &alt_pressedInt); + + // Restore param:shift_pressed; type: bool_byref + shift_pressed = shift_pressedInt?true:false; + // Restore param:ctrl_pressed; type: bool_byref + ctrl_pressed = ctrl_pressedInt?true:false; + // Restore param:alt_pressed; type: bool_byref + alt_pressed = alt_pressedInt?true:false; + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/menu_model_ctocpp.h b/libcef_dll/ctocpp/menu_model_ctocpp.h new file mode 100644 index 000000000..892da8ca6 --- /dev/null +++ b/libcef_dll/ctocpp/menu_model_ctocpp.h @@ -0,0 +1,98 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_MENU_MODEL_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_MENU_MODEL_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_menu_model.h" +#include "include/capi/cef_menu_model_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefMenuModelCToCpp + : public CefCToCpp { + public: + explicit CefMenuModelCToCpp(cef_menu_model_t* str) + : CefCToCpp(str) {} + virtual ~CefMenuModelCToCpp() {} + + // CefMenuModel methods + virtual bool Clear() OVERRIDE; + virtual int GetCount() OVERRIDE; + virtual bool AddSeparator() OVERRIDE; + virtual bool AddItem(int command_id, const CefString& label) OVERRIDE; + virtual bool AddCheckItem(int command_id, const CefString& label) OVERRIDE; + virtual bool AddRadioItem(int command_id, const CefString& label, + int group_id) OVERRIDE; + virtual CefRefPtr AddSubMenu(int command_id, + const CefString& label) OVERRIDE; + virtual bool InsertSeparatorAt(int index) OVERRIDE; + virtual bool InsertItemAt(int index, int command_id, + const CefString& label) OVERRIDE; + virtual bool InsertCheckItemAt(int index, int command_id, + const CefString& label) OVERRIDE; + virtual bool InsertRadioItemAt(int index, int command_id, + const CefString& label, int group_id) OVERRIDE; + virtual CefRefPtr InsertSubMenuAt(int index, int command_id, + const CefString& label) OVERRIDE; + virtual bool Remove(int command_id) OVERRIDE; + virtual bool RemoveAt(int index) OVERRIDE; + virtual int GetIndexOf(int command_id) OVERRIDE; + virtual int GetCommandIdAt(int index) OVERRIDE; + virtual bool SetCommandIdAt(int index, int command_id) OVERRIDE; + virtual CefString GetLabel(int command_id) OVERRIDE; + virtual CefString GetLabelAt(int index) OVERRIDE; + virtual bool SetLabel(int command_id, const CefString& label) OVERRIDE; + virtual bool SetLabelAt(int index, const CefString& label) OVERRIDE; + virtual MenuItemType GetType(int command_id) OVERRIDE; + virtual MenuItemType GetTypeAt(int index) OVERRIDE; + virtual int GetGroupId(int command_id) OVERRIDE; + virtual int GetGroupIdAt(int index) OVERRIDE; + virtual bool SetGroupId(int command_id, int group_id) OVERRIDE; + virtual bool SetGroupIdAt(int index, int group_id) OVERRIDE; + virtual CefRefPtr GetSubMenu(int command_id) OVERRIDE; + virtual CefRefPtr GetSubMenuAt(int index) OVERRIDE; + virtual bool IsVisible(int command_id) OVERRIDE; + virtual bool IsVisibleAt(int index) OVERRIDE; + virtual bool SetVisible(int command_id, bool visible) OVERRIDE; + virtual bool SetVisibleAt(int index, bool visible) OVERRIDE; + virtual bool IsEnabled(int command_id) OVERRIDE; + virtual bool IsEnabledAt(int index) OVERRIDE; + virtual bool SetEnabled(int command_id, bool enabled) OVERRIDE; + virtual bool SetEnabledAt(int index, bool enabled) OVERRIDE; + virtual bool IsChecked(int command_id) OVERRIDE; + virtual bool IsCheckedAt(int index) OVERRIDE; + virtual bool SetChecked(int command_id, bool checked) OVERRIDE; + virtual bool SetCheckedAt(int index, bool checked) OVERRIDE; + virtual bool HasAccelerator(int command_id) OVERRIDE; + virtual bool HasAcceleratorAt(int index) OVERRIDE; + virtual bool SetAccelerator(int command_id, int key_code, bool shift_pressed, + bool ctrl_pressed, bool alt_pressed) OVERRIDE; + virtual bool SetAcceleratorAt(int index, int key_code, bool shift_pressed, + bool ctrl_pressed, bool alt_pressed) OVERRIDE; + virtual bool RemoveAccelerator(int command_id) OVERRIDE; + virtual bool RemoveAcceleratorAt(int index) OVERRIDE; + virtual bool GetAccelerator(int command_id, int& key_code, + bool& shift_pressed, bool& ctrl_pressed, bool& alt_pressed) OVERRIDE; + virtual bool GetAcceleratorAt(int index, int& key_code, bool& shift_pressed, + bool& ctrl_pressed, bool& alt_pressed) OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_MENU_MODEL_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/permission_handler_ctocpp.cc b/libcef_dll/ctocpp/permission_handler_ctocpp.cc new file mode 100644 index 000000000..700e91b39 --- /dev/null +++ b/libcef_dll/ctocpp/permission_handler_ctocpp.cc @@ -0,0 +1,56 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/frame_cpptoc.h" +#include "libcef_dll/ctocpp/permission_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefPermissionHandlerCToCpp::OnBeforeScriptExtensionLoad( + CefRefPtr browser, CefRefPtr frame, + const CefString& extensionName) { + if (CEF_MEMBER_MISSING(struct_, on_before_script_extension_load)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return false; + // Verify param: extensionName; type: string_byref_const + DCHECK(!extensionName.empty()); + if (extensionName.empty()) + return false; + + // Execute + int _retval = struct_->on_before_script_extension_load(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + extensionName.GetStruct()); + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/permission_handler_ctocpp.h b/libcef_dll/ctocpp/permission_handler_ctocpp.h new file mode 100644 index 000000000..0bffa2a81 --- /dev/null +++ b/libcef_dll/ctocpp/permission_handler_ctocpp.h @@ -0,0 +1,47 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_PERMISSION_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_PERMISSION_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_permission_handler.h" +#include "include/capi/cef_permission_handler_capi.h" +#include "include/cef_browser.h" +#include "include/capi/cef_browser_capi.h" +#include "include/cef_frame.h" +#include "include/capi/cef_frame_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefPermissionHandlerCToCpp + : public CefCToCpp { + public: + explicit CefPermissionHandlerCToCpp(cef_permission_handler_t* str) + : CefCToCpp(str) {} + virtual ~CefPermissionHandlerCToCpp() {} + + // CefPermissionHandler methods + virtual bool OnBeforeScriptExtensionLoad(CefRefPtr browser, + CefRefPtr frame, const CefString& extensionName) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_PERMISSION_HANDLER_CTOCPP_H_ + diff --git a/cef/libcef_dll/ctocpp/post_data_ctocpp.cc b/libcef_dll/ctocpp/post_data_ctocpp.cc similarity index 91% rename from cef/libcef_dll/ctocpp/post_data_ctocpp.cc rename to libcef_dll/ctocpp/post_data_ctocpp.cc index 0a0c593cf..f698c8893 100644 --- a/cef/libcef_dll/ctocpp/post_data_ctocpp.cc +++ b/libcef_dll/ctocpp/post_data_ctocpp.cc @@ -16,7 +16,7 @@ // STATIC METHODS - Body may be edited by hand. -CefRefPtr CefPostData::CreatePostData() { +CefRefPtr CefPostData::Create() { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Execute @@ -29,6 +29,19 @@ CefRefPtr CefPostData::CreatePostData() { // VIRTUAL METHODS - Body may be edited by hand. +bool CefPostDataCToCpp::IsReadOnly() { + if (CEF_MEMBER_MISSING(struct_, is_read_only)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_read_only(struct_); + + // Return type: bool + return _retval?true:false; +} + size_t CefPostDataCToCpp::GetElementCount() { if (CEF_MEMBER_MISSING(struct_, get_element_count)) return 0; diff --git a/cef/libcef_dll/ctocpp/post_data_ctocpp.h b/libcef_dll/ctocpp/post_data_ctocpp.h similarity index 97% rename from cef/libcef_dll/ctocpp/post_data_ctocpp.h rename to libcef_dll/ctocpp/post_data_ctocpp.h index 505980dfd..12e9e36ac 100644 --- a/cef/libcef_dll/ctocpp/post_data_ctocpp.h +++ b/libcef_dll/ctocpp/post_data_ctocpp.h @@ -32,6 +32,7 @@ class CefPostDataCToCpp virtual ~CefPostDataCToCpp() {} // CefPostData methods + virtual bool IsReadOnly() OVERRIDE; virtual size_t GetElementCount() OVERRIDE; virtual void GetElements(ElementVector& elements) OVERRIDE; virtual bool RemoveElement(CefRefPtr element) OVERRIDE; diff --git a/cef/libcef_dll/ctocpp/post_data_element_ctocpp.cc b/libcef_dll/ctocpp/post_data_element_ctocpp.cc similarity index 90% rename from cef/libcef_dll/ctocpp/post_data_element_ctocpp.cc rename to libcef_dll/ctocpp/post_data_element_ctocpp.cc index b931ecbca..005072fc4 100644 --- a/cef/libcef_dll/ctocpp/post_data_element_ctocpp.cc +++ b/libcef_dll/ctocpp/post_data_element_ctocpp.cc @@ -15,7 +15,7 @@ // STATIC METHODS - Body may be edited by hand. -CefRefPtr CefPostDataElement::CreatePostDataElement() { +CefRefPtr CefPostDataElement::Create() { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Execute @@ -28,6 +28,19 @@ CefRefPtr CefPostDataElement::CreatePostDataElement() { // VIRTUAL METHODS - Body may be edited by hand. +bool CefPostDataElementCToCpp::IsReadOnly() { + if (CEF_MEMBER_MISSING(struct_, is_read_only)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_read_only(struct_); + + // Return type: bool + return _retval?true:false; +} + void CefPostDataElementCToCpp::SetToEmpty() { if (CEF_MEMBER_MISSING(struct_, set_to_empty)) return; diff --git a/cef/libcef_dll/ctocpp/post_data_element_ctocpp.h b/libcef_dll/ctocpp/post_data_element_ctocpp.h similarity index 97% rename from cef/libcef_dll/ctocpp/post_data_element_ctocpp.h rename to libcef_dll/ctocpp/post_data_element_ctocpp.h index 2840dbdbd..7c7e2c143 100644 --- a/cef/libcef_dll/ctocpp/post_data_element_ctocpp.h +++ b/libcef_dll/ctocpp/post_data_element_ctocpp.h @@ -34,6 +34,7 @@ class CefPostDataElementCToCpp virtual ~CefPostDataElementCToCpp() {} // CefPostDataElement methods + virtual bool IsReadOnly() OVERRIDE; virtual void SetToEmpty() OVERRIDE; virtual void SetToFile(const CefString& fileName) OVERRIDE; virtual void SetToBytes(size_t size, const void* bytes) OVERRIDE; diff --git a/libcef_dll/ctocpp/process_message_ctocpp.cc b/libcef_dll/ctocpp/process_message_ctocpp.cc new file mode 100644 index 000000000..fdf6dd21e --- /dev/null +++ b/libcef_dll/ctocpp/process_message_ctocpp.cc @@ -0,0 +1,110 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/list_value_ctocpp.h" +#include "libcef_dll/ctocpp/process_message_ctocpp.h" + + +// STATIC METHODS - Body may be edited by hand. + +CefRefPtr CefProcessMessage::Create(const CefString& name) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: name; type: string_byref_const + DCHECK(!name.empty()); + if (name.empty()) + return NULL; + + // Execute + cef_process_message_t* _retval = cef_process_message_create( + name.GetStruct()); + + // Return type: refptr_same + return CefProcessMessageCToCpp::Wrap(_retval); +} + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefProcessMessageCToCpp::IsValid() { + if (CEF_MEMBER_MISSING(struct_, is_valid)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_valid(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefProcessMessageCToCpp::IsReadOnly() { + if (CEF_MEMBER_MISSING(struct_, is_read_only)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_read_only(struct_); + + // Return type: bool + return _retval?true:false; +} + +CefRefPtr CefProcessMessageCToCpp::Copy() { + if (CEF_MEMBER_MISSING(struct_, copy)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_process_message_t* _retval = struct_->copy(struct_); + + // Return type: refptr_same + return CefProcessMessageCToCpp::Wrap(_retval); +} + +CefString CefProcessMessageCToCpp::GetName() { + if (CEF_MEMBER_MISSING(struct_, get_name)) + return CefString(); + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_string_userfree_t _retval = struct_->get_name(struct_); + + // Return type: string + CefString _retvalStr; + _retvalStr.AttachToUserFree(_retval); + return _retvalStr; +} + +CefRefPtr CefProcessMessageCToCpp::GetArgumentList() { + if (CEF_MEMBER_MISSING(struct_, get_argument_list)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_list_value_t* _retval = struct_->get_argument_list(struct_); + + // Return type: refptr_same + return CefListValueCToCpp::Wrap(_retval); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/process_message_ctocpp.h b/libcef_dll/ctocpp/process_message_ctocpp.h new file mode 100644 index 000000000..ed572d7c0 --- /dev/null +++ b/libcef_dll/ctocpp/process_message_ctocpp.h @@ -0,0 +1,46 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_PROCESS_MESSAGE_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_PROCESS_MESSAGE_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_process_message.h" +#include "include/capi/cef_process_message_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefProcessMessageCToCpp + : public CefCToCpp { + public: + explicit CefProcessMessageCToCpp(cef_process_message_t* str) + : CefCToCpp(str) {} + virtual ~CefProcessMessageCToCpp() {} + + // CefProcessMessage methods + virtual bool IsValid() OVERRIDE; + virtual bool IsReadOnly() OVERRIDE; + virtual CefRefPtr Copy() OVERRIDE; + virtual CefString GetName() OVERRIDE; + virtual CefRefPtr GetArgumentList() OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_PROCESS_MESSAGE_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/proxy_handler_ctocpp.cc b/libcef_dll/ctocpp/proxy_handler_ctocpp.cc new file mode 100644 index 000000000..bdb490cea --- /dev/null +++ b/libcef_dll/ctocpp/proxy_handler_ctocpp.cc @@ -0,0 +1,41 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/proxy_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefProxyHandlerCToCpp::GetProxyForUrl(const CefString& url, + CefProxyInfo& proxy_info) { + if (CEF_MEMBER_MISSING(struct_, get_proxy_for_url)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: url; type: string_byref_const + DCHECK(!url.empty()); + if (url.empty()) + return; + + // Execute + struct_->get_proxy_for_url(struct_, + url.GetStruct(), + &proxy_info); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/proxy_handler_ctocpp.h b/libcef_dll/ctocpp/proxy_handler_ctocpp.h new file mode 100644 index 000000000..bf37ee4cd --- /dev/null +++ b/libcef_dll/ctocpp/proxy_handler_ctocpp.h @@ -0,0 +1,43 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_PROXY_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_PROXY_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_proxy_handler.h" +#include "include/capi/cef_proxy_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefProxyHandlerCToCpp + : public CefCToCpp { + public: + explicit CefProxyHandlerCToCpp(cef_proxy_handler_t* str) + : CefCToCpp( + str) {} + virtual ~CefProxyHandlerCToCpp() {} + + // CefProxyHandler methods + virtual void GetProxyForUrl(const CefString& url, + CefProxyInfo& proxy_info) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_PROXY_HANDLER_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/read_handler_ctocpp.cc b/libcef_dll/ctocpp/read_handler_ctocpp.cc new file mode 100644 index 000000000..483b8699f --- /dev/null +++ b/libcef_dll/ctocpp/read_handler_ctocpp.cc @@ -0,0 +1,85 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/read_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +size_t CefReadHandlerCToCpp::Read(void* ptr, size_t size, size_t n) { + if (CEF_MEMBER_MISSING(struct_, read)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: ptr; type: simple_byaddr + DCHECK(ptr); + if (!ptr) + return 0; + + // Execute + size_t _retval = struct_->read(struct_, + ptr, + size, + n); + + // Return type: simple + return _retval; +} + +int CefReadHandlerCToCpp::Seek(int64 offset, int whence) { + if (CEF_MEMBER_MISSING(struct_, seek)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->seek(struct_, + offset, + whence); + + // Return type: simple + return _retval; +} + +int64 CefReadHandlerCToCpp::Tell() { + if (CEF_MEMBER_MISSING(struct_, tell)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int64 _retval = struct_->tell(struct_); + + // Return type: simple + return _retval; +} + +int CefReadHandlerCToCpp::Eof() { + if (CEF_MEMBER_MISSING(struct_, eof)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->eof(struct_); + + // Return type: simple + return _retval; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/read_handler_ctocpp.h b/libcef_dll/ctocpp/read_handler_ctocpp.h new file mode 100644 index 000000000..6e56c44b5 --- /dev/null +++ b/libcef_dll/ctocpp/read_handler_ctocpp.h @@ -0,0 +1,45 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_READ_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_READ_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_stream.h" +#include "include/capi/cef_stream_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefReadHandlerCToCpp + : public CefCToCpp { + public: + explicit CefReadHandlerCToCpp(cef_read_handler_t* str) + : CefCToCpp( + str) {} + virtual ~CefReadHandlerCToCpp() {} + + // CefReadHandler methods + virtual size_t Read(void* ptr, size_t size, size_t n) OVERRIDE; + virtual int Seek(int64 offset, int whence) OVERRIDE; + virtual int64 Tell() OVERRIDE; + virtual int Eof() OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_READ_HANDLER_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/render_process_handler_ctocpp.cc b/libcef_dll/ctocpp/render_process_handler_ctocpp.cc new file mode 100644 index 000000000..9f0be5cee --- /dev/null +++ b/libcef_dll/ctocpp/render_process_handler_ctocpp.cc @@ -0,0 +1,186 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/domnode_cpptoc.h" +#include "libcef_dll/cpptoc/frame_cpptoc.h" +#include "libcef_dll/cpptoc/process_message_cpptoc.h" +#include "libcef_dll/cpptoc/v8context_cpptoc.h" +#include "libcef_dll/ctocpp/render_process_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefRenderProcessHandlerCToCpp::OnRenderThreadCreated() { + if (CEF_MEMBER_MISSING(struct_, on_render_thread_created)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->on_render_thread_created(struct_); +} + +void CefRenderProcessHandlerCToCpp::OnWebKitInitialized() { + if (CEF_MEMBER_MISSING(struct_, on_web_kit_initialized)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->on_web_kit_initialized(struct_); +} + +void CefRenderProcessHandlerCToCpp::OnBrowserCreated( + CefRefPtr browser) { + if (CEF_MEMBER_MISSING(struct_, on_browser_created)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + + // Execute + struct_->on_browser_created(struct_, + CefBrowserCppToC::Wrap(browser)); +} + +void CefRenderProcessHandlerCToCpp::OnBrowserDestroyed( + CefRefPtr browser) { + if (CEF_MEMBER_MISSING(struct_, on_browser_destroyed)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + + // Execute + struct_->on_browser_destroyed(struct_, + CefBrowserCppToC::Wrap(browser)); +} + +void CefRenderProcessHandlerCToCpp::OnContextCreated( + CefRefPtr browser, CefRefPtr frame, + CefRefPtr context) { + if (CEF_MEMBER_MISSING(struct_, on_context_created)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return; + // Verify param: context; type: refptr_diff + DCHECK(context.get()); + if (!context.get()) + return; + + // Execute + struct_->on_context_created(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + CefV8ContextCppToC::Wrap(context)); +} + +void CefRenderProcessHandlerCToCpp::OnContextReleased( + CefRefPtr browser, CefRefPtr frame, + CefRefPtr context) { + if (CEF_MEMBER_MISSING(struct_, on_context_released)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return; + // Verify param: context; type: refptr_diff + DCHECK(context.get()); + if (!context.get()) + return; + + // Execute + struct_->on_context_released(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + CefV8ContextCppToC::Wrap(context)); +} + +void CefRenderProcessHandlerCToCpp::OnFocusedNodeChanged( + CefRefPtr browser, CefRefPtr frame, + CefRefPtr node) { + if (CEF_MEMBER_MISSING(struct_, on_focused_node_changed)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Unverified params: frame, node + + // Execute + struct_->on_focused_node_changed(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + CefDOMNodeCppToC::Wrap(node)); +} + +bool CefRenderProcessHandlerCToCpp::OnProcessMessageReceived( + CefRefPtr browser, CefProcessId source_process, + CefRefPtr message) { + if (CEF_MEMBER_MISSING(struct_, on_process_message_received)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + // Verify param: message; type: refptr_diff + DCHECK(message.get()); + if (!message.get()) + return false; + + // Execute + int _retval = struct_->on_process_message_received(struct_, + CefBrowserCppToC::Wrap(browser), + source_process, + CefProcessMessageCppToC::Wrap(message)); + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/render_process_handler_ctocpp.h b/libcef_dll/ctocpp/render_process_handler_ctocpp.h new file mode 100644 index 000000000..d488a81b6 --- /dev/null +++ b/libcef_dll/ctocpp/render_process_handler_ctocpp.h @@ -0,0 +1,54 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_RENDER_PROCESS_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_RENDER_PROCESS_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_render_process_handler.h" +#include "include/capi/cef_render_process_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefRenderProcessHandlerCToCpp + : public CefCToCpp { + public: + explicit CefRenderProcessHandlerCToCpp(cef_render_process_handler_t* str) + : CefCToCpp(str) {} + virtual ~CefRenderProcessHandlerCToCpp() {} + + // CefRenderProcessHandler methods + virtual void OnRenderThreadCreated() OVERRIDE; + virtual void OnWebKitInitialized() OVERRIDE; + virtual void OnBrowserCreated(CefRefPtr browser) OVERRIDE; + virtual void OnBrowserDestroyed(CefRefPtr browser) OVERRIDE; + virtual void OnContextCreated(CefRefPtr browser, + CefRefPtr frame, CefRefPtr context) OVERRIDE; + virtual void OnContextReleased(CefRefPtr browser, + CefRefPtr frame, CefRefPtr context) OVERRIDE; + virtual void OnFocusedNodeChanged(CefRefPtr browser, + CefRefPtr frame, CefRefPtr node) OVERRIDE; + virtual bool OnProcessMessageReceived(CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_RENDER_PROCESS_HANDLER_CTOCPP_H_ + diff --git a/cef/libcef_dll/ctocpp/request_ctocpp.cc b/libcef_dll/ctocpp/request_ctocpp.cc similarity index 93% rename from cef/libcef_dll/ctocpp/request_ctocpp.cc rename to libcef_dll/ctocpp/request_ctocpp.cc index e34c508ea..bb686ac62 100644 --- a/cef/libcef_dll/ctocpp/request_ctocpp.cc +++ b/libcef_dll/ctocpp/request_ctocpp.cc @@ -17,7 +17,7 @@ // STATIC METHODS - Body may be edited by hand. -CefRefPtr CefRequest::CreateRequest() { +CefRefPtr CefRequest::Create() { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Execute @@ -30,6 +30,19 @@ CefRefPtr CefRequest::CreateRequest() { // VIRTUAL METHODS - Body may be edited by hand. +bool CefRequestCToCpp::IsReadOnly() { + if (CEF_MEMBER_MISSING(struct_, is_read_only)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_read_only(struct_); + + // Return type: bool + return _retval?true:false; +} + CefString CefRequestCToCpp::GetURL() { if (CEF_MEMBER_MISSING(struct_, get_url)) return CefString(); @@ -201,20 +214,20 @@ void CefRequestCToCpp::Set(const CefString& url, const CefString& method, cef_string_multimap_free(headerMapMultimap); } -CefRequest::RequestFlags CefRequestCToCpp::GetFlags() { +int CefRequestCToCpp::GetFlags() { if (CEF_MEMBER_MISSING(struct_, get_flags)) - return WUR_FLAG_NONE; + return UR_FLAG_NONE; // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Execute - cef_weburlrequest_flags_t _retval = struct_->get_flags(struct_); + int _retval = struct_->get_flags(struct_); // Return type: simple return _retval; } -void CefRequestCToCpp::SetFlags(RequestFlags flags) { +void CefRequestCToCpp::SetFlags(int flags) { if (CEF_MEMBER_MISSING(struct_, set_flags)) return; diff --git a/cef/libcef_dll/ctocpp/request_ctocpp.h b/libcef_dll/ctocpp/request_ctocpp.h similarity index 94% rename from cef/libcef_dll/ctocpp/request_ctocpp.h rename to libcef_dll/ctocpp/request_ctocpp.h index 77be93ba2..18731c6a9 100644 --- a/cef/libcef_dll/ctocpp/request_ctocpp.h +++ b/libcef_dll/ctocpp/request_ctocpp.h @@ -32,6 +32,7 @@ class CefRequestCToCpp virtual ~CefRequestCToCpp() {} // CefRequest methods + virtual bool IsReadOnly() OVERRIDE; virtual CefString GetURL() OVERRIDE; virtual void SetURL(const CefString& url) OVERRIDE; virtual CefString GetMethod() OVERRIDE; @@ -42,8 +43,8 @@ class CefRequestCToCpp virtual void SetHeaderMap(const HeaderMap& headerMap) OVERRIDE; virtual void Set(const CefString& url, const CefString& method, CefRefPtr postData, const HeaderMap& headerMap) OVERRIDE; - virtual RequestFlags GetFlags() OVERRIDE; - virtual void SetFlags(RequestFlags flags) OVERRIDE; + virtual int GetFlags() OVERRIDE; + virtual void SetFlags(int flags) OVERRIDE; virtual CefString GetFirstPartyForCookies() OVERRIDE; virtual void SetFirstPartyForCookies(const CefString& url) OVERRIDE; }; diff --git a/libcef_dll/ctocpp/request_handler_ctocpp.cc b/libcef_dll/ctocpp/request_handler_ctocpp.cc new file mode 100644 index 000000000..14dadcbd1 --- /dev/null +++ b/libcef_dll/ctocpp/request_handler_ctocpp.cc @@ -0,0 +1,219 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/auth_callback_cpptoc.h" +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h" +#include "libcef_dll/cpptoc/frame_cpptoc.h" +#include "libcef_dll/cpptoc/request_cpptoc.h" +#include "libcef_dll/ctocpp/request_handler_ctocpp.h" +#include "libcef_dll/ctocpp/resource_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefRequestHandlerCToCpp::OnBeforeResourceLoad( + CefRefPtr browser, CefRefPtr frame, + CefRefPtr request) { + if (CEF_MEMBER_MISSING(struct_, on_before_resource_load)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return false; + // Verify param: request; type: refptr_diff + DCHECK(request.get()); + if (!request.get()) + return false; + + // Execute + int _retval = struct_->on_before_resource_load(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + CefRequestCppToC::Wrap(request)); + + // Return type: bool + return _retval?true:false; +} + +CefRefPtr CefRequestHandlerCToCpp::GetResourceHandler( + CefRefPtr browser, CefRefPtr frame, + CefRefPtr request) { + if (CEF_MEMBER_MISSING(struct_, get_resource_handler)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return NULL; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return NULL; + // Verify param: request; type: refptr_diff + DCHECK(request.get()); + if (!request.get()) + return NULL; + + // Execute + cef_resource_handler_t* _retval = struct_->get_resource_handler(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + CefRequestCppToC::Wrap(request)); + + // Return type: refptr_same + return CefResourceHandlerCToCpp::Wrap(_retval); +} + +void CefRequestHandlerCToCpp::OnResourceRedirect(CefRefPtr browser, + CefRefPtr frame, const CefString& old_url, CefString& new_url) { + if (CEF_MEMBER_MISSING(struct_, on_resource_redirect)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return; + // Verify param: old_url; type: string_byref_const + DCHECK(!old_url.empty()); + if (old_url.empty()) + return; + + // Execute + struct_->on_resource_redirect(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + old_url.GetStruct(), + new_url.GetWritableStruct()); +} + +bool CefRequestHandlerCToCpp::GetAuthCredentials(CefRefPtr browser, + CefRefPtr frame, bool isProxy, const CefString& host, int port, + const CefString& realm, const CefString& scheme, + CefRefPtr callback) { + if (CEF_MEMBER_MISSING(struct_, get_auth_credentials)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return false; + // Verify param: frame; type: refptr_diff + DCHECK(frame.get()); + if (!frame.get()) + return false; + // Verify param: host; type: string_byref_const + DCHECK(!host.empty()); + if (host.empty()) + return false; + // Verify param: scheme; type: string_byref_const + DCHECK(!scheme.empty()); + if (scheme.empty()) + return false; + // Verify param: callback; type: refptr_diff + DCHECK(callback.get()); + if (!callback.get()) + return false; + // Unverified params: realm + + // Execute + int _retval = struct_->get_auth_credentials(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + isProxy, + host.GetStruct(), + port, + realm.GetStruct(), + scheme.GetStruct(), + CefAuthCallbackCppToC::Wrap(callback)); + + // Return type: bool + return _retval?true:false; +} + +CefRefPtr CefRequestHandlerCToCpp::GetCookieManager( + CefRefPtr browser, const CefString& main_url) { + if (CEF_MEMBER_MISSING(struct_, get_cookie_manager)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return NULL; + // Verify param: main_url; type: string_byref_const + DCHECK(!main_url.empty()); + if (main_url.empty()) + return NULL; + + // Execute + cef_cookie_manager_t* _retval = struct_->get_cookie_manager(struct_, + CefBrowserCppToC::Wrap(browser), + main_url.GetStruct()); + + // Return type: refptr_diff + return CefCookieManagerCppToC::Unwrap(_retval); +} + +void CefRequestHandlerCToCpp::OnProtocolExecution(CefRefPtr browser, + const CefString& url, bool& allow_os_execution) { + if (CEF_MEMBER_MISSING(struct_, on_protocol_execution)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: browser; type: refptr_diff + DCHECK(browser.get()); + if (!browser.get()) + return; + // Verify param: url; type: string_byref_const + DCHECK(!url.empty()); + if (url.empty()) + return; + + // Translate param: allow_os_execution; type: bool_byref + int allow_os_executionInt = allow_os_execution; + + // Execute + struct_->on_protocol_execution(struct_, + CefBrowserCppToC::Wrap(browser), + url.GetStruct(), + &allow_os_executionInt); + + // Restore param:allow_os_execution; type: bool_byref + allow_os_execution = allow_os_executionInt?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/request_handler_ctocpp.h b/libcef_dll/ctocpp/request_handler_ctocpp.h new file mode 100644 index 000000000..84ff8afc4 --- /dev/null +++ b/libcef_dll/ctocpp/request_handler_ctocpp.h @@ -0,0 +1,57 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_REQUEST_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_REQUEST_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_request_handler.h" +#include "include/capi/cef_request_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefRequestHandlerCToCpp + : public CefCToCpp { + public: + explicit CefRequestHandlerCToCpp(cef_request_handler_t* str) + : CefCToCpp(str) {} + virtual ~CefRequestHandlerCToCpp() {} + + // CefRequestHandler methods + virtual bool OnBeforeResourceLoad(CefRefPtr browser, + CefRefPtr frame, CefRefPtr request) OVERRIDE; + virtual CefRefPtr GetResourceHandler( + CefRefPtr browser, CefRefPtr frame, + CefRefPtr request) OVERRIDE; + virtual void OnResourceRedirect(CefRefPtr browser, + CefRefPtr frame, const CefString& old_url, + CefString& new_url) OVERRIDE; + virtual bool GetAuthCredentials(CefRefPtr browser, + CefRefPtr frame, bool isProxy, const CefString& host, int port, + const CefString& realm, const CefString& scheme, + CefRefPtr callback) OVERRIDE; + virtual CefRefPtr GetCookieManager( + CefRefPtr browser, const CefString& main_url) OVERRIDE; + virtual void OnProtocolExecution(CefRefPtr browser, + const CefString& url, bool& allow_os_execution) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_REQUEST_HANDLER_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/resource_bundle_handler_ctocpp.cc b/libcef_dll/ctocpp/resource_bundle_handler_ctocpp.cc new file mode 100644 index 000000000..27e996570 --- /dev/null +++ b/libcef_dll/ctocpp/resource_bundle_handler_ctocpp.cc @@ -0,0 +1,56 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefResourceBundleHandlerCToCpp::GetLocalizedString(int message_id, + CefString& string) { + if (CEF_MEMBER_MISSING(struct_, get_localized_string)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->get_localized_string(struct_, + message_id, + string.GetWritableStruct()); + + // Return type: bool + return _retval?true:false; +} + +bool CefResourceBundleHandlerCToCpp::GetDataResource(int resource_id, + void*& data, size_t& data_size) { + if (CEF_MEMBER_MISSING(struct_, get_data_resource)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->get_data_resource(struct_, + resource_id, + &data, + &data_size); + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h b/libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h new file mode 100644 index 000000000..73279e7fc --- /dev/null +++ b/libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h @@ -0,0 +1,44 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_RESOURCE_BUNDLE_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_RESOURCE_BUNDLE_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_resource_bundle_handler.h" +#include "include/capi/cef_resource_bundle_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefResourceBundleHandlerCToCpp + : public CefCToCpp { + public: + explicit CefResourceBundleHandlerCToCpp(cef_resource_bundle_handler_t* str) + : CefCToCpp(str) {} + virtual ~CefResourceBundleHandlerCToCpp() {} + + // CefResourceBundleHandler methods + virtual bool GetLocalizedString(int message_id, CefString& string) OVERRIDE; + virtual bool GetDataResource(int resource_id, void*& data, + size_t& data_size) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_RESOURCE_BUNDLE_HANDLER_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/resource_handler_ctocpp.cc b/libcef_dll/ctocpp/resource_handler_ctocpp.cc new file mode 100644 index 000000000..6b4444a24 --- /dev/null +++ b/libcef_dll/ctocpp/resource_handler_ctocpp.cc @@ -0,0 +1,136 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/callback_cpptoc.h" +#include "libcef_dll/cpptoc/request_cpptoc.h" +#include "libcef_dll/cpptoc/response_cpptoc.h" +#include "libcef_dll/ctocpp/resource_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefResourceHandlerCToCpp::ProcessRequest(CefRefPtr request, + CefRefPtr callback) { + if (CEF_MEMBER_MISSING(struct_, process_request)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: request; type: refptr_diff + DCHECK(request.get()); + if (!request.get()) + return false; + // Verify param: callback; type: refptr_diff + DCHECK(callback.get()); + if (!callback.get()) + return false; + + // Execute + int _retval = struct_->process_request(struct_, + CefRequestCppToC::Wrap(request), + CefCallbackCppToC::Wrap(callback)); + + // Return type: bool + return _retval?true:false; +} + +void CefResourceHandlerCToCpp::GetResponseHeaders( + CefRefPtr response, int64& response_length, + CefString& redirectUrl) { + if (CEF_MEMBER_MISSING(struct_, get_response_headers)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: response; type: refptr_diff + DCHECK(response.get()); + if (!response.get()) + return; + + // Execute + struct_->get_response_headers(struct_, + CefResponseCppToC::Wrap(response), + &response_length, + redirectUrl.GetWritableStruct()); +} + +bool CefResourceHandlerCToCpp::ReadResponse(void* data_out, int bytes_to_read, + int& bytes_read, CefRefPtr callback) { + if (CEF_MEMBER_MISSING(struct_, read_response)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: data_out; type: simple_byaddr + DCHECK(data_out); + if (!data_out) + return false; + // Verify param: callback; type: refptr_diff + DCHECK(callback.get()); + if (!callback.get()) + return false; + + // Execute + int _retval = struct_->read_response(struct_, + data_out, + bytes_to_read, + &bytes_read, + CefCallbackCppToC::Wrap(callback)); + + // Return type: bool + return _retval?true:false; +} + +bool CefResourceHandlerCToCpp::CanGetCookie(const CefCookie& cookie) { + if (CEF_MEMBER_MISSING(struct_, can_get_cookie)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->can_get_cookie(struct_, + &cookie); + + // Return type: bool + return _retval?true:false; +} + +bool CefResourceHandlerCToCpp::CanSetCookie(const CefCookie& cookie) { + if (CEF_MEMBER_MISSING(struct_, can_set_cookie)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->can_set_cookie(struct_, + &cookie); + + // Return type: bool + return _retval?true:false; +} + +void CefResourceHandlerCToCpp::Cancel() { + if (CEF_MEMBER_MISSING(struct_, cancel)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->cancel(struct_); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/resource_handler_ctocpp.h b/libcef_dll/ctocpp/resource_handler_ctocpp.h new file mode 100644 index 000000000..018c57f5f --- /dev/null +++ b/libcef_dll/ctocpp/resource_handler_ctocpp.h @@ -0,0 +1,50 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_RESOURCE_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_RESOURCE_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_resource_handler.h" +#include "include/capi/cef_resource_handler_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefResourceHandlerCToCpp + : public CefCToCpp { + public: + explicit CefResourceHandlerCToCpp(cef_resource_handler_t* str) + : CefCToCpp(str) {} + virtual ~CefResourceHandlerCToCpp() {} + + // CefResourceHandler methods + virtual bool ProcessRequest(CefRefPtr request, + CefRefPtr callback) OVERRIDE; + virtual void GetResponseHeaders(CefRefPtr response, + int64& response_length, CefString& redirectUrl) OVERRIDE; + virtual bool ReadResponse(void* data_out, int bytes_to_read, int& bytes_read, + CefRefPtr callback) OVERRIDE; + virtual bool CanGetCookie(const CefCookie& cookie) OVERRIDE; + virtual bool CanSetCookie(const CefCookie& cookie) OVERRIDE; + virtual void Cancel() OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_RESOURCE_HANDLER_CTOCPP_H_ + diff --git a/cef/libcef_dll/ctocpp/response_ctocpp.cc b/libcef_dll/ctocpp/response_ctocpp.cc similarity index 89% rename from cef/libcef_dll/ctocpp/response_ctocpp.cc rename to libcef_dll/ctocpp/response_ctocpp.cc index e5bfc0286..25cc12671 100644 --- a/cef/libcef_dll/ctocpp/response_ctocpp.cc +++ b/libcef_dll/ctocpp/response_ctocpp.cc @@ -14,8 +14,34 @@ #include "libcef_dll/transfer_util.h" +// STATIC METHODS - Body may be edited by hand. + +CefRefPtr CefResponse::Create() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_response_t* _retval = cef_response_create(); + + // Return type: refptr_same + return CefResponseCToCpp::Wrap(_retval); +} + + // VIRTUAL METHODS - Body may be edited by hand. +bool CefResponseCToCpp::IsReadOnly() { + if (CEF_MEMBER_MISSING(struct_, is_read_only)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_read_only(struct_); + + // Return type: bool + return _retval?true:false; +} + int CefResponseCToCpp::GetStatus() { if (CEF_MEMBER_MISSING(struct_, get_status)) return 0; diff --git a/cef/libcef_dll/ctocpp/response_ctocpp.h b/libcef_dll/ctocpp/response_ctocpp.h similarity index 97% rename from cef/libcef_dll/ctocpp/response_ctocpp.h rename to libcef_dll/ctocpp/response_ctocpp.h index 8ec8a1fc2..280e840d2 100644 --- a/cef/libcef_dll/ctocpp/response_ctocpp.h +++ b/libcef_dll/ctocpp/response_ctocpp.h @@ -32,6 +32,7 @@ class CefResponseCToCpp virtual ~CefResponseCToCpp() {} // CefResponse methods + virtual bool IsReadOnly() OVERRIDE; virtual int GetStatus() OVERRIDE; virtual void SetStatus(int status) OVERRIDE; virtual CefString GetStatusText() OVERRIDE; diff --git a/libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc b/libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc new file mode 100644 index 000000000..1005c06db --- /dev/null +++ b/libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc @@ -0,0 +1,56 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/frame_cpptoc.h" +#include "libcef_dll/cpptoc/request_cpptoc.h" +#include "libcef_dll/ctocpp/resource_handler_ctocpp.h" +#include "libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +CefRefPtr CefSchemeHandlerFactoryCToCpp::Create( + CefRefPtr browser, CefRefPtr frame, + const CefString& scheme_name, CefRefPtr request) { + if (CEF_MEMBER_MISSING(struct_, create)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: scheme_name; type: string_byref_const + DCHECK(!scheme_name.empty()); + if (scheme_name.empty()) + return NULL; + // Verify param: request; type: refptr_diff + DCHECK(request.get()); + if (!request.get()) + return NULL; + // Unverified params: browser, frame + + // Execute + cef_resource_handler_t* _retval = struct_->create(struct_, + CefBrowserCppToC::Wrap(browser), + CefFrameCppToC::Wrap(frame), + scheme_name.GetStruct(), + CefRequestCppToC::Wrap(request)); + + // Return type: refptr_same + return CefResourceHandlerCToCpp::Wrap(_retval); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h b/libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h new file mode 100644 index 000000000..50a092e3b --- /dev/null +++ b/libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h @@ -0,0 +1,44 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_SCHEME_HANDLER_FACTORY_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_SCHEME_HANDLER_FACTORY_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_scheme.h" +#include "include/capi/cef_scheme_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefSchemeHandlerFactoryCToCpp + : public CefCToCpp { + public: + explicit CefSchemeHandlerFactoryCToCpp(cef_scheme_handler_factory_t* str) + : CefCToCpp(str) {} + virtual ~CefSchemeHandlerFactoryCToCpp() {} + + // CefSchemeHandlerFactory methods + virtual CefRefPtr Create(CefRefPtr browser, + CefRefPtr frame, const CefString& scheme_name, + CefRefPtr request) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_SCHEME_HANDLER_FACTORY_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/scheme_registrar_ctocpp.cc b/libcef_dll/ctocpp/scheme_registrar_ctocpp.cc new file mode 100644 index 000000000..c4222499f --- /dev/null +++ b/libcef_dll/ctocpp/scheme_registrar_ctocpp.cc @@ -0,0 +1,46 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/scheme_registrar_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefSchemeRegistrarCToCpp::AddCustomScheme(const CefString& scheme_name, + bool is_standard, bool is_local, bool is_display_isolated) { + if (CEF_MEMBER_MISSING(struct_, add_custom_scheme)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: scheme_name; type: string_byref_const + DCHECK(!scheme_name.empty()); + if (scheme_name.empty()) + return false; + + // Execute + int _retval = struct_->add_custom_scheme(struct_, + scheme_name.GetStruct(), + is_standard, + is_local, + is_display_isolated); + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/scheme_registrar_ctocpp.h b/libcef_dll/ctocpp/scheme_registrar_ctocpp.h new file mode 100644 index 000000000..336f94cca --- /dev/null +++ b/libcef_dll/ctocpp/scheme_registrar_ctocpp.h @@ -0,0 +1,43 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_SCHEME_REGISTRAR_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_SCHEME_REGISTRAR_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_scheme.h" +#include "include/capi/cef_scheme_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefSchemeRegistrarCToCpp + : public CefCToCpp { + public: + explicit CefSchemeRegistrarCToCpp(cef_scheme_registrar_t* str) + : CefCToCpp(str) {} + virtual ~CefSchemeRegistrarCToCpp() {} + + // CefSchemeRegistrar methods + virtual bool AddCustomScheme(const CefString& scheme_name, bool is_standard, + bool is_local, bool is_display_isolated) OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_SCHEME_REGISTRAR_CTOCPP_H_ + diff --git a/cef/libcef_dll/ctocpp/stream_reader_ctocpp.cc b/libcef_dll/ctocpp/stream_reader_ctocpp.cc similarity index 100% rename from cef/libcef_dll/ctocpp/stream_reader_ctocpp.cc rename to libcef_dll/ctocpp/stream_reader_ctocpp.cc diff --git a/cef/libcef_dll/ctocpp/stream_reader_ctocpp.h b/libcef_dll/ctocpp/stream_reader_ctocpp.h similarity index 100% rename from cef/libcef_dll/ctocpp/stream_reader_ctocpp.h rename to libcef_dll/ctocpp/stream_reader_ctocpp.h diff --git a/cef/libcef_dll/ctocpp/stream_writer_ctocpp.cc b/libcef_dll/ctocpp/stream_writer_ctocpp.cc similarity index 100% rename from cef/libcef_dll/ctocpp/stream_writer_ctocpp.cc rename to libcef_dll/ctocpp/stream_writer_ctocpp.cc diff --git a/cef/libcef_dll/ctocpp/stream_writer_ctocpp.h b/libcef_dll/ctocpp/stream_writer_ctocpp.h similarity index 100% rename from cef/libcef_dll/ctocpp/stream_writer_ctocpp.h rename to libcef_dll/ctocpp/stream_writer_ctocpp.h diff --git a/libcef_dll/ctocpp/string_visitor_ctocpp.cc b/libcef_dll/ctocpp/string_visitor_ctocpp.cc new file mode 100644 index 000000000..acf755f4c --- /dev/null +++ b/libcef_dll/ctocpp/string_visitor_ctocpp.cc @@ -0,0 +1,39 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/string_visitor_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefStringVisitorCToCpp::Visit(const CefString& string) { + if (CEF_MEMBER_MISSING(struct_, visit)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: string; type: string_byref_const + DCHECK(!string.empty()); + if (string.empty()) + return; + + // Execute + struct_->visit(struct_, + string.GetStruct()); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/string_visitor_ctocpp.h b/libcef_dll/ctocpp/string_visitor_ctocpp.h new file mode 100644 index 000000000..c5871d48a --- /dev/null +++ b/libcef_dll/ctocpp/string_visitor_ctocpp.h @@ -0,0 +1,42 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_STRING_VISITOR_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_STRING_VISITOR_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_string_visitor.h" +#include "include/capi/cef_string_visitor_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefStringVisitorCToCpp + : public CefCToCpp { + public: + explicit CefStringVisitorCToCpp(cef_string_visitor_t* str) + : CefCToCpp(str) {} + virtual ~CefStringVisitorCToCpp() {} + + // CefStringVisitor methods + virtual void Visit(const CefString& string) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_STRING_VISITOR_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/task_ctocpp.cc b/libcef_dll/ctocpp/task_ctocpp.cc new file mode 100644 index 000000000..0a2e48a89 --- /dev/null +++ b/libcef_dll/ctocpp/task_ctocpp.cc @@ -0,0 +1,33 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/task_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefTaskCToCpp::Execute(CefThreadId threadId) { + if (CEF_MEMBER_MISSING(struct_, execute)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->execute(struct_, + threadId); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/task_ctocpp.h b/libcef_dll/ctocpp/task_ctocpp.h new file mode 100644 index 000000000..58dce8a2a --- /dev/null +++ b/libcef_dll/ctocpp/task_ctocpp.h @@ -0,0 +1,40 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_TASK_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_TASK_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_task.h" +#include "include/capi/cef_task_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefTaskCToCpp + : public CefCToCpp { + public: + explicit CefTaskCToCpp(cef_task_t* str) + : CefCToCpp(str) {} + virtual ~CefTaskCToCpp() {} + + // CefTask methods + virtual void Execute(CefThreadId threadId) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_TASK_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/urlrequest_client_ctocpp.cc b/libcef_dll/ctocpp/urlrequest_client_ctocpp.cc new file mode 100644 index 000000000..a3a1644f1 --- /dev/null +++ b/libcef_dll/ctocpp/urlrequest_client_ctocpp.cc @@ -0,0 +1,102 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/urlrequest_cpptoc.h" +#include "libcef_dll/ctocpp/urlrequest_client_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +void CefURLRequestClientCToCpp::OnRequestComplete( + CefRefPtr request) { + if (CEF_MEMBER_MISSING(struct_, on_request_complete)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: request; type: refptr_diff + DCHECK(request.get()); + if (!request.get()) + return; + + // Execute + struct_->on_request_complete(struct_, + CefURLRequestCppToC::Wrap(request)); +} + +void CefURLRequestClientCToCpp::OnUploadProgress( + CefRefPtr request, uint64 current, uint64 total) { + if (CEF_MEMBER_MISSING(struct_, on_upload_progress)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: request; type: refptr_diff + DCHECK(request.get()); + if (!request.get()) + return; + + // Execute + struct_->on_upload_progress(struct_, + CefURLRequestCppToC::Wrap(request), + current, + total); +} + +void CefURLRequestClientCToCpp::OnDownloadProgress( + CefRefPtr request, uint64 current, uint64 total) { + if (CEF_MEMBER_MISSING(struct_, on_download_progress)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: request; type: refptr_diff + DCHECK(request.get()); + if (!request.get()) + return; + + // Execute + struct_->on_download_progress(struct_, + CefURLRequestCppToC::Wrap(request), + current, + total); +} + +void CefURLRequestClientCToCpp::OnDownloadData(CefRefPtr request, + const void* data, size_t data_length) { + if (CEF_MEMBER_MISSING(struct_, on_download_data)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: request; type: refptr_diff + DCHECK(request.get()); + if (!request.get()) + return; + // Verify param: data; type: simple_byaddr + DCHECK(data); + if (!data) + return; + + // Execute + struct_->on_download_data(struct_, + CefURLRequestCppToC::Wrap(request), + data, + data_length); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/urlrequest_client_ctocpp.h b/libcef_dll/ctocpp/urlrequest_client_ctocpp.h new file mode 100644 index 000000000..987aaffc5 --- /dev/null +++ b/libcef_dll/ctocpp/urlrequest_client_ctocpp.h @@ -0,0 +1,48 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_URLREQUEST_CLIENT_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_URLREQUEST_CLIENT_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_urlrequest.h" +#include "include/capi/cef_urlrequest_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefURLRequestClientCToCpp + : public CefCToCpp { + public: + explicit CefURLRequestClientCToCpp(cef_urlrequest_client_t* str) + : CefCToCpp(str) {} + virtual ~CefURLRequestClientCToCpp() {} + + // CefURLRequestClient methods + virtual void OnRequestComplete(CefRefPtr request) OVERRIDE; + virtual void OnUploadProgress(CefRefPtr request, + uint64 current, uint64 total) OVERRIDE; + virtual void OnDownloadProgress(CefRefPtr request, + uint64 current, uint64 total) OVERRIDE; + virtual void OnDownloadData(CefRefPtr request, + const void* data, size_t data_length) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_URLREQUEST_CLIENT_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/urlrequest_ctocpp.cc b/libcef_dll/ctocpp/urlrequest_ctocpp.cc new file mode 100644 index 000000000..9292295a5 --- /dev/null +++ b/libcef_dll/ctocpp/urlrequest_ctocpp.cc @@ -0,0 +1,126 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/urlrequest_client_cpptoc.h" +#include "libcef_dll/ctocpp/request_ctocpp.h" +#include "libcef_dll/ctocpp/response_ctocpp.h" +#include "libcef_dll/ctocpp/urlrequest_ctocpp.h" + + +// STATIC METHODS - Body may be edited by hand. + +CefRefPtr CefURLRequest::Create(CefRefPtr request, + CefRefPtr client) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: request; type: refptr_same + DCHECK(request.get()); + if (!request.get()) + return NULL; + // Verify param: client; type: refptr_diff + DCHECK(client.get()); + if (!client.get()) + return NULL; + + // Execute + cef_urlrequest_t* _retval = cef_urlrequest_create( + CefRequestCToCpp::Unwrap(request), + CefURLRequestClientCppToC::Wrap(client)); + + // Return type: refptr_same + return CefURLRequestCToCpp::Wrap(_retval); +} + + +// VIRTUAL METHODS - Body may be edited by hand. + +CefRefPtr CefURLRequestCToCpp::GetRequest() { + if (CEF_MEMBER_MISSING(struct_, get_request)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_request_t* _retval = struct_->get_request(struct_); + + // Return type: refptr_same + return CefRequestCToCpp::Wrap(_retval); +} + +CefRefPtr CefURLRequestCToCpp::GetClient() { + if (CEF_MEMBER_MISSING(struct_, get_client)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_urlrequest_client_t* _retval = struct_->get_client(struct_); + + // Return type: refptr_diff + return CefURLRequestClientCppToC::Unwrap(_retval); +} + +CefURLRequest::Status CefURLRequestCToCpp::GetRequestStatus() { + if (CEF_MEMBER_MISSING(struct_, get_request_status)) + return UR_UNKNOWN; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_urlrequest_status_t _retval = struct_->get_request_status(struct_); + + // Return type: simple + return _retval; +} + +CefURLRequest::ErrorCode CefURLRequestCToCpp::GetRequestError() { + if (CEF_MEMBER_MISSING(struct_, get_request_error)) + return ERR_NONE; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_errorcode_t _retval = struct_->get_request_error(struct_); + + // Return type: simple + return _retval; +} + +CefRefPtr CefURLRequestCToCpp::GetResponse() { + if (CEF_MEMBER_MISSING(struct_, get_response)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_response_t* _retval = struct_->get_response(struct_); + + // Return type: refptr_same + return CefResponseCToCpp::Wrap(_retval); +} + +void CefURLRequestCToCpp::Cancel() { + if (CEF_MEMBER_MISSING(struct_, cancel)) + return; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + struct_->cancel(struct_); +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/urlrequest_ctocpp.h b/libcef_dll/ctocpp/urlrequest_ctocpp.h new file mode 100644 index 000000000..f13c7c638 --- /dev/null +++ b/libcef_dll/ctocpp/urlrequest_ctocpp.h @@ -0,0 +1,45 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_URLREQUEST_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_URLREQUEST_CTOCPP_H_ +#pragma once + +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED + +#include "include/cef_urlrequest.h" +#include "include/capi/cef_urlrequest_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed wrapper-side only. +class CefURLRequestCToCpp + : public CefCToCpp { + public: + explicit CefURLRequestCToCpp(cef_urlrequest_t* str) + : CefCToCpp(str) {} + virtual ~CefURLRequestCToCpp() {} + + // CefURLRequest methods + virtual CefRefPtr GetRequest() OVERRIDE; + virtual CefRefPtr GetClient() OVERRIDE; + virtual Status GetRequestStatus() OVERRIDE; + virtual ErrorCode GetRequestError() OVERRIDE; + virtual CefRefPtr GetResponse() OVERRIDE; + virtual void Cancel() OVERRIDE; +}; + +#endif // USING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_URLREQUEST_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/v8accessor_ctocpp.cc b/libcef_dll/ctocpp/v8accessor_ctocpp.cc new file mode 100644 index 000000000..f3b9b6e56 --- /dev/null +++ b/libcef_dll/ctocpp/v8accessor_ctocpp.cc @@ -0,0 +1,99 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/v8value_cpptoc.h" +#include "libcef_dll/ctocpp/v8accessor_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefV8AccessorCToCpp::Get(const CefString& name, + const CefRefPtr object, CefRefPtr& retval, + CefString& exception) { + if (CEF_MEMBER_MISSING(struct_, get)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: name; type: string_byref_const + DCHECK(!name.empty()); + if (name.empty()) + return false; + // Verify param: object; type: refptr_diff + DCHECK(object.get()); + if (!object.get()) + return false; + + // Translate param: retval; type: refptr_diff_byref + cef_v8value_t* retvalStruct = NULL; + if (retval.get()) + retvalStruct = CefV8ValueCppToC::Wrap(retval); + cef_v8value_t* retvalOrig = retvalStruct; + + // Execute + int _retval = struct_->get(struct_, + name.GetStruct(), + CefV8ValueCppToC::Wrap(object), + &retvalStruct, + exception.GetWritableStruct()); + + // Restore param:retval; type: refptr_diff_byref + if (retvalStruct) { + if (retvalStruct != retvalOrig) { + retval = CefV8ValueCppToC::Unwrap(retvalStruct); + } + } else { + retval = NULL; + } + + // Return type: bool + return _retval?true:false; +} + +bool CefV8AccessorCToCpp::Set(const CefString& name, + const CefRefPtr object, const CefRefPtr value, + CefString& exception) { + if (CEF_MEMBER_MISSING(struct_, set)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: name; type: string_byref_const + DCHECK(!name.empty()); + if (name.empty()) + return false; + // Verify param: object; type: refptr_diff + DCHECK(object.get()); + if (!object.get()) + return false; + // Verify param: value; type: refptr_diff + DCHECK(value.get()); + if (!value.get()) + return false; + + // Execute + int _retval = struct_->set(struct_, + name.GetStruct(), + CefV8ValueCppToC::Wrap(object), + CefV8ValueCppToC::Wrap(value), + exception.GetWritableStruct()); + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/v8accessor_ctocpp.h b/libcef_dll/ctocpp/v8accessor_ctocpp.h new file mode 100644 index 000000000..3ae106e93 --- /dev/null +++ b/libcef_dll/ctocpp/v8accessor_ctocpp.h @@ -0,0 +1,43 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_V8ACCESSOR_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_V8ACCESSOR_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_v8.h" +#include "include/capi/cef_v8_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefV8AccessorCToCpp + : public CefCToCpp { + public: + explicit CefV8AccessorCToCpp(cef_v8accessor_t* str) + : CefCToCpp(str) {} + virtual ~CefV8AccessorCToCpp() {} + + // CefV8Accessor methods + virtual bool Get(const CefString& name, const CefRefPtr object, + CefRefPtr& retval, CefString& exception) OVERRIDE; + virtual bool Set(const CefString& name, const CefRefPtr object, + const CefRefPtr value, CefString& exception) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_V8ACCESSOR_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/v8context_ctocpp.cc b/libcef_dll/ctocpp/v8context_ctocpp.cc new file mode 100644 index 000000000..bc1e0559b --- /dev/null +++ b/libcef_dll/ctocpp/v8context_ctocpp.cc @@ -0,0 +1,194 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/frame_ctocpp.h" +#include "libcef_dll/ctocpp/v8context_ctocpp.h" +#include "libcef_dll/ctocpp/v8exception_ctocpp.h" +#include "libcef_dll/ctocpp/v8value_ctocpp.h" + + +// STATIC METHODS - Body may be edited by hand. + +CefRefPtr CefV8Context::GetCurrentContext() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_v8context_t* _retval = cef_v8context_get_current_context(); + + // Return type: refptr_same + return CefV8ContextCToCpp::Wrap(_retval); +} + +CefRefPtr CefV8Context::GetEnteredContext() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_v8context_t* _retval = cef_v8context_get_entered_context(); + + // Return type: refptr_same + return CefV8ContextCToCpp::Wrap(_retval); +} + +bool CefV8Context::InContext() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = cef_v8context_in_context(); + + // Return type: bool + return _retval?true:false; +} + + +// VIRTUAL METHODS - Body may be edited by hand. + +CefRefPtr CefV8ContextCToCpp::GetBrowser() { + if (CEF_MEMBER_MISSING(struct_, get_browser)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_browser_t* _retval = struct_->get_browser(struct_); + + // Return type: refptr_same + return CefBrowserCToCpp::Wrap(_retval); +} + +CefRefPtr CefV8ContextCToCpp::GetFrame() { + if (CEF_MEMBER_MISSING(struct_, get_frame)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_frame_t* _retval = struct_->get_frame(struct_); + + // Return type: refptr_same + return CefFrameCToCpp::Wrap(_retval); +} + +CefRefPtr CefV8ContextCToCpp::GetGlobal() { + if (CEF_MEMBER_MISSING(struct_, get_global)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_v8value_t* _retval = struct_->get_global(struct_); + + // Return type: refptr_same + return CefV8ValueCToCpp::Wrap(_retval); +} + +bool CefV8ContextCToCpp::Enter() { + if (CEF_MEMBER_MISSING(struct_, enter)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->enter(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefV8ContextCToCpp::Exit() { + if (CEF_MEMBER_MISSING(struct_, exit)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->exit(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefV8ContextCToCpp::IsSame(CefRefPtr that) { + if (CEF_MEMBER_MISSING(struct_, is_same)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: that; type: refptr_same + DCHECK(that.get()); + if (!that.get()) + return false; + + // Execute + int _retval = struct_->is_same(struct_, + CefV8ContextCToCpp::Unwrap(that)); + + // Return type: bool + return _retval?true:false; +} + +bool CefV8ContextCToCpp::Eval(const CefString& code, + CefRefPtr& retval, CefRefPtr& exception) { + if (CEF_MEMBER_MISSING(struct_, eval)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: code; type: string_byref_const + DCHECK(!code.empty()); + if (code.empty()) + return false; + + // Translate param: retval; type: refptr_same_byref + cef_v8value_t* retvalStruct = NULL; + if (retval.get()) + retvalStruct = CefV8ValueCToCpp::Unwrap(retval); + cef_v8value_t* retvalOrig = retvalStruct; + // Translate param: exception; type: refptr_same_byref + cef_v8exception_t* exceptionStruct = NULL; + if (exception.get()) + exceptionStruct = CefV8ExceptionCToCpp::Unwrap(exception); + cef_v8exception_t* exceptionOrig = exceptionStruct; + + // Execute + int _retval = struct_->eval(struct_, + code.GetStruct(), + &retvalStruct, + &exceptionStruct); + + // Restore param:retval; type: refptr_same_byref + if (retvalStruct) { + if (retvalStruct != retvalOrig) { + retval = CefV8ValueCToCpp::Wrap(retvalStruct); + } + } else { + retval = NULL; + } + // Restore param:exception; type: refptr_same_byref + if (exceptionStruct) { + if (exceptionStruct != exceptionOrig) { + exception = CefV8ExceptionCToCpp::Wrap(exceptionStruct); + } + } else { + exception = NULL; + } + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/cef/libcef_dll/ctocpp/v8context_ctocpp.h b/libcef_dll/ctocpp/v8context_ctocpp.h similarity index 92% rename from cef/libcef_dll/ctocpp/v8context_ctocpp.h rename to libcef_dll/ctocpp/v8context_ctocpp.h index a128e7fd6..314082fee 100644 --- a/cef/libcef_dll/ctocpp/v8context_ctocpp.h +++ b/libcef_dll/ctocpp/v8context_ctocpp.h @@ -38,6 +38,8 @@ class CefV8ContextCToCpp virtual bool Enter() OVERRIDE; virtual bool Exit() OVERRIDE; virtual bool IsSame(CefRefPtr that) OVERRIDE; + virtual bool Eval(const CefString& code, CefRefPtr& retval, + CefRefPtr& exception) OVERRIDE; }; #endif // USING_CEF_SHARED diff --git a/cef/libcef_dll/ctocpp/v8exception_ctocpp.cc b/libcef_dll/ctocpp/v8exception_ctocpp.cc similarity index 100% rename from cef/libcef_dll/ctocpp/v8exception_ctocpp.cc rename to libcef_dll/ctocpp/v8exception_ctocpp.cc diff --git a/cef/libcef_dll/ctocpp/v8exception_ctocpp.h b/libcef_dll/ctocpp/v8exception_ctocpp.h similarity index 100% rename from cef/libcef_dll/ctocpp/v8exception_ctocpp.h rename to libcef_dll/ctocpp/v8exception_ctocpp.h diff --git a/libcef_dll/ctocpp/v8handler_ctocpp.cc b/libcef_dll/ctocpp/v8handler_ctocpp.cc new file mode 100644 index 000000000..9b9c2a790 --- /dev/null +++ b/libcef_dll/ctocpp/v8handler_ctocpp.cc @@ -0,0 +1,84 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/v8value_cpptoc.h" +#include "libcef_dll/ctocpp/v8handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefV8HandlerCToCpp::Execute(const CefString& name, + CefRefPtr object, const CefV8ValueList& arguments, + CefRefPtr& retval, CefString& exception) { + if (CEF_MEMBER_MISSING(struct_, execute)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: name; type: string_byref_const + DCHECK(!name.empty()); + if (name.empty()) + return false; + // Verify param: object; type: refptr_diff + DCHECK(object.get()); + if (!object.get()) + return false; + + // Translate param: arguments; type: refptr_vec_diff_byref_const + const size_t argumentsCount = arguments.size(); + cef_v8value_t** argumentsList = NULL; + if (argumentsCount > 0) { + argumentsList = new cef_v8value_t*[argumentsCount]; + DCHECK(argumentsList); + if (argumentsList) { + for (size_t i = 0; i < argumentsCount; ++i) { + argumentsList[i] = CefV8ValueCppToC::Wrap(arguments[i]); + } + } + } + // Translate param: retval; type: refptr_diff_byref + cef_v8value_t* retvalStruct = NULL; + if (retval.get()) + retvalStruct = CefV8ValueCppToC::Wrap(retval); + cef_v8value_t* retvalOrig = retvalStruct; + + // Execute + int _retval = struct_->execute(struct_, + name.GetStruct(), + CefV8ValueCppToC::Wrap(object), + argumentsCount, + argumentsList, + &retvalStruct, + exception.GetWritableStruct()); + + // Restore param:arguments; type: refptr_vec_diff_byref_const + if (argumentsList) + delete [] argumentsList; + // Restore param:retval; type: refptr_diff_byref + if (retvalStruct) { + if (retvalStruct != retvalOrig) { + retval = CefV8ValueCppToC::Unwrap(retvalStruct); + } + } else { + retval = NULL; + } + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/v8handler_ctocpp.h b/libcef_dll/ctocpp/v8handler_ctocpp.h new file mode 100644 index 000000000..ea3bba1c3 --- /dev/null +++ b/libcef_dll/ctocpp/v8handler_ctocpp.h @@ -0,0 +1,42 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_V8HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_V8HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_v8.h" +#include "include/capi/cef_v8_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefV8HandlerCToCpp + : public CefCToCpp { + public: + explicit CefV8HandlerCToCpp(cef_v8handler_t* str) + : CefCToCpp(str) {} + virtual ~CefV8HandlerCToCpp() {} + + // CefV8Handler methods + virtual bool Execute(const CefString& name, CefRefPtr object, + const CefV8ValueList& arguments, CefRefPtr& retval, + CefString& exception) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_V8HANDLER_CTOCPP_H_ + diff --git a/cef/libcef_dll/ctocpp/v8value_ctocpp.cc b/libcef_dll/ctocpp/v8value_ctocpp.cc similarity index 81% rename from cef/libcef_dll/ctocpp/v8value_ctocpp.cc rename to libcef_dll/ctocpp/v8value_ctocpp.cc index a1ea37c4a..39076c824 100644 --- a/cef/libcef_dll/ctocpp/v8value_ctocpp.cc +++ b/libcef_dll/ctocpp/v8value_ctocpp.cc @@ -52,7 +52,7 @@ CefRefPtr CefV8Value::CreateBool(bool value) { return CefV8ValueCToCpp::Wrap(_retval); } -CefRefPtr CefV8Value::CreateInt(int value) { +CefRefPtr CefV8Value::CreateInt(int32 value) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Execute @@ -63,6 +63,17 @@ CefRefPtr CefV8Value::CreateInt(int value) { return CefV8ValueCToCpp::Wrap(_retval); } +CefRefPtr CefV8Value::CreateUInt(uint32 value) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_v8value_t* _retval = cef_v8value_create_uint( + value); + + // Return type: refptr_same + return CefV8ValueCToCpp::Wrap(_retval); +} + CefRefPtr CefV8Value::CreateDouble(double value) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING @@ -98,26 +109,26 @@ CefRefPtr CefV8Value::CreateString(const CefString& value) { return CefV8ValueCToCpp::Wrap(_retval); } -CefRefPtr CefV8Value::CreateObject(CefRefPtr user_data, +CefRefPtr CefV8Value::CreateObject( CefRefPtr accessor) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - // Unverified params: user_data, accessor + // Unverified params: accessor // Execute - cef_v8value_t* _retval = cef_v8value_create_object_with_accessor( - CefBaseCppToC::Wrap(user_data), + cef_v8value_t* _retval = cef_v8value_create_object( CefV8AccessorCppToC::Wrap(accessor)); // Return type: refptr_same return CefV8ValueCToCpp::Wrap(_retval); } -CefRefPtr CefV8Value::CreateArray() { +CefRefPtr CefV8Value::CreateArray(int length) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Execute - cef_v8value_t* _retval = cef_v8value_create_array(); + cef_v8value_t* _retval = cef_v8value_create_array( + length); // Return type: refptr_same return CefV8ValueCToCpp::Wrap(_retval); @@ -200,6 +211,19 @@ bool CefV8ValueCToCpp::IsInt() { return _retval?true:false; } +bool CefV8ValueCToCpp::IsUInt() { + if (CEF_MEMBER_MISSING(struct_, is_uint)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_uint(struct_); + + // Return type: bool + return _retval?true:false; +} + bool CefV8ValueCToCpp::IsDouble() { if (CEF_MEMBER_MISSING(struct_, is_double)) return false; @@ -310,14 +334,27 @@ bool CefV8ValueCToCpp::GetBoolValue() { return _retval?true:false; } -int CefV8ValueCToCpp::GetIntValue() { +int32 CefV8ValueCToCpp::GetIntValue() { if (CEF_MEMBER_MISSING(struct_, get_int_value)) return 0; // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Execute - int _retval = struct_->get_int_value(struct_); + int32 _retval = struct_->get_int_value(struct_); + + // Return type: simple + return _retval; +} + +uint32 CefV8ValueCToCpp::GetUIntValue() { + if (CEF_MEMBER_MISSING(struct_, get_uint_value)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + uint32 _retval = struct_->get_uint_value(struct_); // Return type: simple return _retval; @@ -364,6 +401,85 @@ CefString CefV8ValueCToCpp::GetStringValue() { return _retvalStr; } +bool CefV8ValueCToCpp::IsUserCreated() { + if (CEF_MEMBER_MISSING(struct_, is_user_created)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->is_user_created(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefV8ValueCToCpp::HasException() { + if (CEF_MEMBER_MISSING(struct_, has_exception)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->has_exception(struct_); + + // Return type: bool + return _retval?true:false; +} + +CefRefPtr CefV8ValueCToCpp::GetException() { + if (CEF_MEMBER_MISSING(struct_, get_exception)) + return NULL; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_v8exception_t* _retval = struct_->get_exception(struct_); + + // Return type: refptr_same + return CefV8ExceptionCToCpp::Wrap(_retval); +} + +bool CefV8ValueCToCpp::ClearException() { + if (CEF_MEMBER_MISSING(struct_, clear_exception)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->clear_exception(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefV8ValueCToCpp::WillRethrowExceptions() { + if (CEF_MEMBER_MISSING(struct_, will_rethrow_exceptions)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->will_rethrow_exceptions(struct_); + + // Return type: bool + return _retval?true:false; +} + +bool CefV8ValueCToCpp::SetRethrowExceptions(bool rethrow) { + if (CEF_MEMBER_MISSING(struct_, set_rethrow_exceptions)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->set_rethrow_exceptions(struct_, + rethrow); + + // Return type: bool + return _retval?true:false; +} + bool CefV8ValueCToCpp::HasValue(const CefString& key) { if (CEF_MEMBER_MISSING(struct_, has_value_bykey)) return false; @@ -577,6 +693,22 @@ bool CefV8ValueCToCpp::GetKeys(std::vector& keys) { return _retval?true:false; } +bool CefV8ValueCToCpp::SetUserData(CefRefPtr user_data) { + if (CEF_MEMBER_MISSING(struct_, set_user_data)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Unverified params: user_data + + // Execute + int _retval = struct_->set_user_data(struct_, + CefBaseCppToC::Wrap(user_data)); + + // Return type: bool + return _retval?true:false; +} + CefRefPtr CefV8ValueCToCpp::GetUserData() { if (CEF_MEMBER_MISSING(struct_, get_user_data)) return NULL; @@ -658,11 +790,10 @@ CefRefPtr CefV8ValueCToCpp::GetFunctionHandler() { return CefV8HandlerCppToC::Unwrap(_retval); } -bool CefV8ValueCToCpp::ExecuteFunction(CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefRefPtr& exception, bool rethrow_exception) { +CefRefPtr CefV8ValueCToCpp::ExecuteFunction( + CefRefPtr object, const CefV8ValueList& arguments) { if (CEF_MEMBER_MISSING(struct_, execute_function)) - return false; + return NULL; // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING @@ -680,63 +811,33 @@ bool CefV8ValueCToCpp::ExecuteFunction(CefRefPtr object, } } } - // Translate param: retval; type: refptr_same_byref - cef_v8value_t* retvalStruct = NULL; - if (retval.get()) - retvalStruct = CefV8ValueCToCpp::Unwrap(retval); - cef_v8value_t* retvalOrig = retvalStruct; - // Translate param: exception; type: refptr_same_byref - cef_v8exception_t* exceptionStruct = NULL; - if (exception.get()) - exceptionStruct = CefV8ExceptionCToCpp::Unwrap(exception); - cef_v8exception_t* exceptionOrig = exceptionStruct; // Execute - int _retval = struct_->execute_function(struct_, + cef_v8value_t* _retval = struct_->execute_function(struct_, CefV8ValueCToCpp::Unwrap(object), argumentsCount, - argumentsList, - &retvalStruct, - &exceptionStruct, - rethrow_exception); + argumentsList); // Restore param:arguments; type: refptr_vec_same_byref_const if (argumentsList) delete [] argumentsList; - // Restore param:retval; type: refptr_same_byref - if (retvalStruct) { - if (retvalStruct != retvalOrig) { - retval = CefV8ValueCToCpp::Wrap(retvalStruct); - } - } else { - retval = NULL; - } - // Restore param:exception; type: refptr_same_byref - if (exceptionStruct) { - if (exceptionStruct != exceptionOrig) { - exception = CefV8ExceptionCToCpp::Wrap(exceptionStruct); - } - } else { - exception = NULL; - } - // Return type: bool - return _retval?true:false; + // Return type: refptr_same + return CefV8ValueCToCpp::Wrap(_retval); } -bool CefV8ValueCToCpp::ExecuteFunctionWithContext( +CefRefPtr CefV8ValueCToCpp::ExecuteFunctionWithContext( CefRefPtr context, CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefRefPtr& exception, bool rethrow_exception) { + const CefV8ValueList& arguments) { if (CEF_MEMBER_MISSING(struct_, execute_function_with_context)) - return false; + return NULL; // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Verify param: context; type: refptr_same DCHECK(context.get()); if (!context.get()) - return false; + return NULL; // Unverified params: object // Translate param: arguments; type: refptr_vec_same_byref_const @@ -751,49 +852,20 @@ bool CefV8ValueCToCpp::ExecuteFunctionWithContext( } } } - // Translate param: retval; type: refptr_same_byref - cef_v8value_t* retvalStruct = NULL; - if (retval.get()) - retvalStruct = CefV8ValueCToCpp::Unwrap(retval); - cef_v8value_t* retvalOrig = retvalStruct; - // Translate param: exception; type: refptr_same_byref - cef_v8exception_t* exceptionStruct = NULL; - if (exception.get()) - exceptionStruct = CefV8ExceptionCToCpp::Unwrap(exception); - cef_v8exception_t* exceptionOrig = exceptionStruct; // Execute - int _retval = struct_->execute_function_with_context(struct_, + cef_v8value_t* _retval = struct_->execute_function_with_context(struct_, CefV8ContextCToCpp::Unwrap(context), CefV8ValueCToCpp::Unwrap(object), argumentsCount, - argumentsList, - &retvalStruct, - &exceptionStruct, - rethrow_exception); + argumentsList); // Restore param:arguments; type: refptr_vec_same_byref_const if (argumentsList) delete [] argumentsList; - // Restore param:retval; type: refptr_same_byref - if (retvalStruct) { - if (retvalStruct != retvalOrig) { - retval = CefV8ValueCToCpp::Wrap(retvalStruct); - } - } else { - retval = NULL; - } - // Restore param:exception; type: refptr_same_byref - if (exceptionStruct) { - if (exceptionStruct != exceptionOrig) { - exception = CefV8ExceptionCToCpp::Wrap(exceptionStruct); - } - } else { - exception = NULL; - } - // Return type: bool - return _retval?true:false; + // Return type: refptr_same + return CefV8ValueCToCpp::Wrap(_retval); } diff --git a/cef/libcef_dll/ctocpp/v8value_ctocpp.h b/libcef_dll/ctocpp/v8value_ctocpp.h similarity index 79% rename from cef/libcef_dll/ctocpp/v8value_ctocpp.h rename to libcef_dll/ctocpp/v8value_ctocpp.h index 80766b72a..15efb7941 100644 --- a/cef/libcef_dll/ctocpp/v8value_ctocpp.h +++ b/libcef_dll/ctocpp/v8value_ctocpp.h @@ -37,6 +37,7 @@ class CefV8ValueCToCpp virtual bool IsNull() OVERRIDE; virtual bool IsBool() OVERRIDE; virtual bool IsInt() OVERRIDE; + virtual bool IsUInt() OVERRIDE; virtual bool IsDouble() OVERRIDE; virtual bool IsDate() OVERRIDE; virtual bool IsString() OVERRIDE; @@ -45,10 +46,17 @@ class CefV8ValueCToCpp virtual bool IsFunction() OVERRIDE; virtual bool IsSame(CefRefPtr that) OVERRIDE; virtual bool GetBoolValue() OVERRIDE; - virtual int GetIntValue() OVERRIDE; + virtual int32 GetIntValue() OVERRIDE; + virtual uint32 GetUIntValue() OVERRIDE; virtual double GetDoubleValue() OVERRIDE; virtual CefTime GetDateValue() OVERRIDE; virtual CefString GetStringValue() OVERRIDE; + virtual bool IsUserCreated() OVERRIDE; + virtual bool HasException() OVERRIDE; + virtual CefRefPtr GetException() OVERRIDE; + virtual bool ClearException() OVERRIDE; + virtual bool WillRethrowExceptions() OVERRIDE; + virtual bool SetRethrowExceptions(bool rethrow) OVERRIDE; virtual bool HasValue(const CefString& key) OVERRIDE; virtual bool HasValue(int index) OVERRIDE; virtual bool DeleteValue(const CefString& key) OVERRIDE; @@ -61,19 +69,18 @@ class CefV8ValueCToCpp virtual bool SetValue(const CefString& key, AccessControl settings, PropertyAttribute attribute) OVERRIDE; virtual bool GetKeys(std::vector& keys) OVERRIDE; + virtual bool SetUserData(CefRefPtr user_data) OVERRIDE; virtual CefRefPtr GetUserData() OVERRIDE; virtual int GetExternallyAllocatedMemory() OVERRIDE; virtual int AdjustExternallyAllocatedMemory(int change_in_bytes) OVERRIDE; virtual int GetArrayLength() OVERRIDE; virtual CefString GetFunctionName() OVERRIDE; virtual CefRefPtr GetFunctionHandler() OVERRIDE; - virtual bool ExecuteFunction(CefRefPtr object, - const CefV8ValueList& arguments, CefRefPtr& retval, - CefRefPtr& exception, bool rethrow_exception) OVERRIDE; - virtual bool ExecuteFunctionWithContext(CefRefPtr context, - CefRefPtr object, const CefV8ValueList& arguments, - CefRefPtr& retval, CefRefPtr& exception, - bool rethrow_exception) OVERRIDE; + virtual CefRefPtr ExecuteFunction(CefRefPtr object, + const CefV8ValueList& arguments) OVERRIDE; + virtual CefRefPtr ExecuteFunctionWithContext( + CefRefPtr context, CefRefPtr object, + const CefV8ValueList& arguments) OVERRIDE; }; #endif // USING_CEF_SHARED diff --git a/cef/libcef_dll/ctocpp/web_plugin_info_ctocpp.cc b/libcef_dll/ctocpp/web_plugin_info_ctocpp.cc similarity index 100% rename from cef/libcef_dll/ctocpp/web_plugin_info_ctocpp.cc rename to libcef_dll/ctocpp/web_plugin_info_ctocpp.cc diff --git a/cef/libcef_dll/ctocpp/web_plugin_info_ctocpp.h b/libcef_dll/ctocpp/web_plugin_info_ctocpp.h similarity index 100% rename from cef/libcef_dll/ctocpp/web_plugin_info_ctocpp.h rename to libcef_dll/ctocpp/web_plugin_info_ctocpp.h diff --git a/libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.cc b/libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.cc new file mode 100644 index 000000000..08032993f --- /dev/null +++ b/libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.cc @@ -0,0 +1,46 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h" +#include "libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +bool CefWebPluginInfoVisitorCToCpp::Visit(CefRefPtr info, + int count, int total) { + if (CEF_MEMBER_MISSING(struct_, visit)) + return false; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: info; type: refptr_diff + DCHECK(info.get()); + if (!info.get()) + return false; + + // Execute + int _retval = struct_->visit(struct_, + CefWebPluginInfoCppToC::Wrap(info), + count, + total); + + // Return type: bool + return _retval?true:false; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h b/libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h new file mode 100644 index 000000000..fdec21c6c --- /dev/null +++ b/libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h @@ -0,0 +1,43 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_WEB_PLUGIN_INFO_VISITOR_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_WEB_PLUGIN_INFO_VISITOR_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_web_plugin.h" +#include "include/capi/cef_web_plugin_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefWebPluginInfoVisitorCToCpp + : public CefCToCpp { + public: + explicit CefWebPluginInfoVisitorCToCpp(cef_web_plugin_info_visitor_t* str) + : CefCToCpp(str) {} + virtual ~CefWebPluginInfoVisitorCToCpp() {} + + // CefWebPluginInfoVisitor methods + virtual bool Visit(CefRefPtr info, int count, + int total) OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_WEB_PLUGIN_INFO_VISITOR_CTOCPP_H_ + diff --git a/libcef_dll/ctocpp/write_handler_ctocpp.cc b/libcef_dll/ctocpp/write_handler_ctocpp.cc new file mode 100644 index 000000000..df8f3db97 --- /dev/null +++ b/libcef_dll/ctocpp/write_handler_ctocpp.cc @@ -0,0 +1,85 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "libcef_dll/ctocpp/write_handler_ctocpp.h" + + +// VIRTUAL METHODS - Body may be edited by hand. + +size_t CefWriteHandlerCToCpp::Write(const void* ptr, size_t size, size_t n) { + if (CEF_MEMBER_MISSING(struct_, write)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: ptr; type: simple_byaddr + DCHECK(ptr); + if (!ptr) + return 0; + + // Execute + size_t _retval = struct_->write(struct_, + ptr, + size, + n); + + // Return type: simple + return _retval; +} + +int CefWriteHandlerCToCpp::Seek(int64 offset, int whence) { + if (CEF_MEMBER_MISSING(struct_, seek)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->seek(struct_, + offset, + whence); + + // Return type: simple + return _retval; +} + +int64 CefWriteHandlerCToCpp::Tell() { + if (CEF_MEMBER_MISSING(struct_, tell)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int64 _retval = struct_->tell(struct_); + + // Return type: simple + return _retval; +} + +int CefWriteHandlerCToCpp::Flush() { + if (CEF_MEMBER_MISSING(struct_, flush)) + return 0; + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = struct_->flush(struct_); + + // Return type: simple + return _retval; +} + + +#ifndef NDEBUG +template<> long CefCToCpp::DebugObjCt = 0; +#endif + diff --git a/libcef_dll/ctocpp/write_handler_ctocpp.h b/libcef_dll/ctocpp/write_handler_ctocpp.h new file mode 100644 index 000000000..95713abe9 --- /dev/null +++ b/libcef_dll/ctocpp/write_handler_ctocpp.h @@ -0,0 +1,45 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#ifndef CEF_LIBCEF_DLL_CTOCPP_WRITE_HANDLER_CTOCPP_H_ +#define CEF_LIBCEF_DLL_CTOCPP_WRITE_HANDLER_CTOCPP_H_ +#pragma once + +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED + +#include "include/cef_stream.h" +#include "include/capi/cef_stream_capi.h" +#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +// This class may be instantiated and accessed DLL-side only. +class CefWriteHandlerCToCpp + : public CefCToCpp { + public: + explicit CefWriteHandlerCToCpp(cef_write_handler_t* str) + : CefCToCpp( + str) {} + virtual ~CefWriteHandlerCToCpp() {} + + // CefWriteHandler methods + virtual size_t Write(const void* ptr, size_t size, size_t n) OVERRIDE; + virtual int Seek(int64 offset, int whence) OVERRIDE; + virtual int64 Tell() OVERRIDE; + virtual int Flush() OVERRIDE; +}; + +#endif // BUILDING_CEF_SHARED +#endif // CEF_LIBCEF_DLL_CTOCPP_WRITE_HANDLER_CTOCPP_H_ + diff --git a/cef/libcef_dll/ctocpp/xml_reader_ctocpp.cc b/libcef_dll/ctocpp/xml_reader_ctocpp.cc similarity index 100% rename from cef/libcef_dll/ctocpp/xml_reader_ctocpp.cc rename to libcef_dll/ctocpp/xml_reader_ctocpp.cc diff --git a/cef/libcef_dll/ctocpp/xml_reader_ctocpp.h b/libcef_dll/ctocpp/xml_reader_ctocpp.h similarity index 100% rename from cef/libcef_dll/ctocpp/xml_reader_ctocpp.h rename to libcef_dll/ctocpp/xml_reader_ctocpp.h diff --git a/cef/libcef_dll/ctocpp/zip_reader_ctocpp.cc b/libcef_dll/ctocpp/zip_reader_ctocpp.cc similarity index 100% rename from cef/libcef_dll/ctocpp/zip_reader_ctocpp.cc rename to libcef_dll/ctocpp/zip_reader_ctocpp.cc diff --git a/cef/libcef_dll/ctocpp/zip_reader_ctocpp.h b/libcef_dll/ctocpp/zip_reader_ctocpp.h similarity index 100% rename from cef/libcef_dll/ctocpp/zip_reader_ctocpp.h rename to libcef_dll/ctocpp/zip_reader_ctocpp.h diff --git a/libcef_dll/libcef_dll.cc b/libcef_dll/libcef_dll.cc new file mode 100644 index 000000000..342fa2260 --- /dev/null +++ b/libcef_dll/libcef_dll.cc @@ -0,0 +1,514 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "include/cef_app.h" +#include "include/capi/cef_app_capi.h" +#include "include/cef_origin_whitelist.h" +#include "include/capi/cef_origin_whitelist_capi.h" +#include "include/cef_path_util.h" +#include "include/capi/cef_path_util_capi.h" +#include "include/cef_process_util.h" +#include "include/capi/cef_process_util_capi.h" +#include "include/cef_scheme.h" +#include "include/capi/cef_scheme_capi.h" +#include "include/cef_task.h" +#include "include/capi/cef_task_capi.h" +#include "include/cef_url.h" +#include "include/capi/cef_url_capi.h" +#include "include/cef_v8.h" +#include "include/capi/cef_v8_capi.h" +#include "include/cef_web_plugin.h" +#include "include/capi/cef_web_plugin_capi.h" +#include "libcef_dll/cpptoc/auth_callback_cpptoc.h" +#include "libcef_dll/cpptoc/before_download_callback_cpptoc.h" +#include "libcef_dll/cpptoc/binary_value_cpptoc.h" +#include "libcef_dll/cpptoc/browser_cpptoc.h" +#include "libcef_dll/cpptoc/browser_host_cpptoc.h" +#include "libcef_dll/cpptoc/callback_cpptoc.h" +#include "libcef_dll/cpptoc/command_line_cpptoc.h" +#include "libcef_dll/cpptoc/context_menu_params_cpptoc.h" +#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h" +#include "libcef_dll/cpptoc/domdocument_cpptoc.h" +#include "libcef_dll/cpptoc/domevent_cpptoc.h" +#include "libcef_dll/cpptoc/domnode_cpptoc.h" +#include "libcef_dll/cpptoc/dictionary_value_cpptoc.h" +#include "libcef_dll/cpptoc/download_item_cpptoc.h" +#include "libcef_dll/cpptoc/download_item_callback_cpptoc.h" +#include "libcef_dll/cpptoc/frame_cpptoc.h" +#include "libcef_dll/cpptoc/geolocation_callback_cpptoc.h" +#include "libcef_dll/cpptoc/jsdialog_callback_cpptoc.h" +#include "libcef_dll/cpptoc/list_value_cpptoc.h" +#include "libcef_dll/cpptoc/menu_model_cpptoc.h" +#include "libcef_dll/cpptoc/process_message_cpptoc.h" +#include "libcef_dll/cpptoc/scheme_registrar_cpptoc.h" +#include "libcef_dll/cpptoc/stream_reader_cpptoc.h" +#include "libcef_dll/cpptoc/stream_writer_cpptoc.h" +#include "libcef_dll/cpptoc/urlrequest_cpptoc.h" +#include "libcef_dll/cpptoc/v8context_cpptoc.h" +#include "libcef_dll/cpptoc/v8exception_cpptoc.h" +#include "libcef_dll/cpptoc/v8value_cpptoc.h" +#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h" +#include "libcef_dll/cpptoc/xml_reader_cpptoc.h" +#include "libcef_dll/cpptoc/zip_reader_cpptoc.h" +#include "libcef_dll/ctocpp/app_ctocpp.h" +#include "libcef_dll/ctocpp/browser_process_handler_ctocpp.h" +#include "libcef_dll/ctocpp/context_menu_handler_ctocpp.h" +#include "libcef_dll/ctocpp/cookie_visitor_ctocpp.h" +#include "libcef_dll/ctocpp/domevent_listener_ctocpp.h" +#include "libcef_dll/ctocpp/domvisitor_ctocpp.h" +#include "libcef_dll/ctocpp/display_handler_ctocpp.h" +#include "libcef_dll/ctocpp/download_handler_ctocpp.h" +#include "libcef_dll/ctocpp/focus_handler_ctocpp.h" +#include "libcef_dll/ctocpp/geolocation_handler_ctocpp.h" +#include "libcef_dll/ctocpp/jsdialog_handler_ctocpp.h" +#include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h" +#include "libcef_dll/ctocpp/life_span_handler_ctocpp.h" +#include "libcef_dll/ctocpp/load_handler_ctocpp.h" +#include "libcef_dll/ctocpp/proxy_handler_ctocpp.h" +#include "libcef_dll/ctocpp/read_handler_ctocpp.h" +#include "libcef_dll/ctocpp/render_process_handler_ctocpp.h" +#include "libcef_dll/ctocpp/request_handler_ctocpp.h" +#include "libcef_dll/ctocpp/resource_bundle_handler_ctocpp.h" +#include "libcef_dll/ctocpp/resource_handler_ctocpp.h" +#include "libcef_dll/ctocpp/scheme_handler_factory_ctocpp.h" +#include "libcef_dll/ctocpp/string_visitor_ctocpp.h" +#include "libcef_dll/ctocpp/task_ctocpp.h" +#include "libcef_dll/ctocpp/urlrequest_client_ctocpp.h" +#include "libcef_dll/ctocpp/v8accessor_ctocpp.h" +#include "libcef_dll/ctocpp/v8handler_ctocpp.h" +#include "libcef_dll/ctocpp/web_plugin_info_visitor_ctocpp.h" +#include "libcef_dll/ctocpp/write_handler_ctocpp.h" + + +// GLOBAL FUNCTIONS - Body may be edited by hand. + +CEF_EXPORT int cef_execute_process(const struct _cef_main_args_t* args, + struct _cef_app_t* application) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: args; type: struct_byref_const + DCHECK(args); + if (!args) + return 0; + // Unverified params: application + + // Translate param: args; type: struct_byref_const + CefMainArgs argsObj; + if (args) + argsObj.Set(*args, false); + + // Execute + int _retval = CefExecuteProcess( + argsObj, + CefAppCToCpp::Wrap(application)); + + // Return type: simple + return _retval; +} + +CEF_EXPORT int cef_initialize(const struct _cef_main_args_t* args, + const struct _cef_settings_t* settings, struct _cef_app_t* application) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: args; type: struct_byref_const + DCHECK(args); + if (!args) + return 0; + // Verify param: settings; type: struct_byref_const + DCHECK(settings); + if (!settings) + return 0; + // Unverified params: application + + // Translate param: args; type: struct_byref_const + CefMainArgs argsObj; + if (args) + argsObj.Set(*args, false); + // Translate param: settings; type: struct_byref_const + CefSettings settingsObj; + if (settings) + settingsObj.Set(*settings, false); + + // Execute + bool _retval = CefInitialize( + argsObj, + settingsObj, + CefAppCToCpp::Wrap(application)); + + // Return type: bool + return _retval; +} + +CEF_EXPORT void cef_shutdown() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefShutdown(); + +#ifndef NDEBUG + // Check that all wrapper objects have been destroyed + DCHECK_EQ(CefAuthCallbackCppToC::DebugObjCt, 0); + DCHECK_EQ(CefBeforeDownloadCallbackCppToC::DebugObjCt, 0); + DCHECK_EQ(CefBinaryValueCppToC::DebugObjCt, 0); + DCHECK_EQ(CefBrowserCppToC::DebugObjCt, 0); + DCHECK_EQ(CefBrowserHostCppToC::DebugObjCt, 0); + DCHECK_EQ(CefBrowserProcessHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefCallbackCppToC::DebugObjCt, 0); + DCHECK_EQ(CefContextMenuHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefContextMenuParamsCppToC::DebugObjCt, 0); + DCHECK_EQ(CefCookieManagerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefCookieVisitorCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefDOMDocumentCppToC::DebugObjCt, 0); + DCHECK_EQ(CefDOMEventCppToC::DebugObjCt, 0); + DCHECK_EQ(CefDOMEventListenerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefDOMNodeCppToC::DebugObjCt, 0); + DCHECK_EQ(CefDOMVisitorCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefDictionaryValueCppToC::DebugObjCt, 0); + DCHECK_EQ(CefDisplayHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefDownloadHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefDownloadItemCallbackCppToC::DebugObjCt, 0); + DCHECK_EQ(CefDownloadItemCppToC::DebugObjCt, 0); + DCHECK_EQ(CefFocusHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefFrameCppToC::DebugObjCt, 0); + DCHECK_EQ(CefGeolocationCallbackCppToC::DebugObjCt, 0); + DCHECK_EQ(CefGeolocationHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefJSDialogCallbackCppToC::DebugObjCt, 0); + DCHECK_EQ(CefJSDialogHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefKeyboardHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefLifeSpanHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefListValueCppToC::DebugObjCt, 0); + DCHECK_EQ(CefLoadHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefMenuModelCppToC::DebugObjCt, 0); + DCHECK_EQ(CefProcessMessageCppToC::DebugObjCt, 0); + DCHECK_EQ(CefProxyHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefReadHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefRenderProcessHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefRequestHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefResourceBundleHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefResourceHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefSchemeHandlerFactoryCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefSchemeRegistrarCppToC::DebugObjCt, 0); + DCHECK_EQ(CefStreamReaderCppToC::DebugObjCt, 0); + DCHECK_EQ(CefStreamWriterCppToC::DebugObjCt, 0); + DCHECK_EQ(CefStringVisitorCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefTaskCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefURLRequestClientCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefURLRequestCppToC::DebugObjCt, 0); + DCHECK_EQ(CefV8AccessorCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefV8ContextCppToC::DebugObjCt, 0); + DCHECK_EQ(CefV8ExceptionCppToC::DebugObjCt, 0); + DCHECK_EQ(CefV8HandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefV8ValueCppToC::DebugObjCt, 0); + DCHECK_EQ(CefWebPluginInfoCppToC::DebugObjCt, 0); + DCHECK_EQ(CefWebPluginInfoVisitorCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefWriteHandlerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefXmlReaderCppToC::DebugObjCt, 0); + DCHECK_EQ(CefZipReaderCppToC::DebugObjCt, 0); +#endif // !NDEBUG +} + +CEF_EXPORT void cef_do_message_loop_work() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefDoMessageLoopWork(); +} + +CEF_EXPORT void cef_run_message_loop() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefRunMessageLoop(); +} + +CEF_EXPORT void cef_quit_message_loop() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + CefQuitMessageLoop(); +} + +CEF_EXPORT int cef_add_cross_origin_whitelist_entry( + const cef_string_t* source_origin, const cef_string_t* target_protocol, + const cef_string_t* target_domain, int allow_target_subdomains) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: source_origin; type: string_byref_const + DCHECK(source_origin); + if (!source_origin) + return 0; + // Verify param: target_protocol; type: string_byref_const + DCHECK(target_protocol); + if (!target_protocol) + return 0; + // Unverified params: target_domain + + // Execute + bool _retval = CefAddCrossOriginWhitelistEntry( + CefString(source_origin), + CefString(target_protocol), + CefString(target_domain), + allow_target_subdomains?true:false); + + // Return type: bool + return _retval; +} + +CEF_EXPORT int cef_remove_cross_origin_whitelist_entry( + const cef_string_t* source_origin, const cef_string_t* target_protocol, + const cef_string_t* target_domain, int allow_target_subdomains) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: source_origin; type: string_byref_const + DCHECK(source_origin); + if (!source_origin) + return 0; + // Verify param: target_protocol; type: string_byref_const + DCHECK(target_protocol); + if (!target_protocol) + return 0; + // Unverified params: target_domain + + // Execute + bool _retval = CefRemoveCrossOriginWhitelistEntry( + CefString(source_origin), + CefString(target_protocol), + CefString(target_domain), + allow_target_subdomains?true:false); + + // Return type: bool + return _retval; +} + +CEF_EXPORT int cef_clear_cross_origin_whitelist() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + bool _retval = CefClearCrossOriginWhitelist(); + + // Return type: bool + return _retval; +} + +CEF_EXPORT int cef_get_path(enum cef_path_key_t key, cef_string_t* path) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: path; type: string_byref + DCHECK(path); + if (!path) + return 0; + + // Translate param: path; type: string_byref + CefString pathStr(path); + + // Execute + bool _retval = CefGetPath( + key, + pathStr); + + // Return type: bool + return _retval; +} + +CEF_EXPORT int cef_launch_process(struct _cef_command_line_t* command_line) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: command_line; type: refptr_same + DCHECK(command_line); + if (!command_line) + return 0; + + // Execute + bool _retval = CefLaunchProcess( + CefCommandLineCppToC::Unwrap(command_line)); + + // Return type: bool + return _retval; +} + +CEF_EXPORT int cef_register_scheme_handler_factory( + const cef_string_t* scheme_name, const cef_string_t* domain_name, + struct _cef_scheme_handler_factory_t* factory) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: scheme_name; type: string_byref_const + DCHECK(scheme_name); + if (!scheme_name) + return 0; + // Unverified params: domain_name, factory + + // Execute + bool _retval = CefRegisterSchemeHandlerFactory( + CefString(scheme_name), + CefString(domain_name), + CefSchemeHandlerFactoryCToCpp::Wrap(factory)); + + // Return type: bool + return _retval; +} + +CEF_EXPORT int cef_clear_scheme_handler_factories() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + bool _retval = CefClearSchemeHandlerFactories(); + + // Return type: bool + return _retval; +} + +CEF_EXPORT int cef_currently_on(cef_thread_id_t threadId) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + bool _retval = CefCurrentlyOn( + threadId); + + // Return type: bool + return _retval; +} + +CEF_EXPORT int cef_post_task(cef_thread_id_t threadId, + struct _cef_task_t* task) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: task; type: refptr_diff + DCHECK(task); + if (!task) + return 0; + + // Execute + bool _retval = CefPostTask( + threadId, + CefTaskCToCpp::Wrap(task)); + + // Return type: bool + return _retval; +} + +CEF_EXPORT int cef_post_delayed_task(cef_thread_id_t threadId, + struct _cef_task_t* task, int64 delay_ms) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: task; type: refptr_diff + DCHECK(task); + if (!task) + return 0; + + // Execute + bool _retval = CefPostDelayedTask( + threadId, + CefTaskCToCpp::Wrap(task), + delay_ms); + + // Return type: bool + return _retval; +} + +CEF_EXPORT int cef_parse_url(const cef_string_t* url, + struct _cef_urlparts_t* parts) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: url; type: string_byref_const + DCHECK(url); + if (!url) + return 0; + // Verify param: parts; type: struct_byref + DCHECK(parts); + if (!parts) + return 0; + + // Translate param: parts; type: struct_byref + CefURLParts partsObj; + if (parts) + partsObj.AttachTo(*parts); + + // Execute + bool _retval = CefParseURL( + CefString(url), + partsObj); + + // Restore param: parts; type: struct_byref + if (parts) + partsObj.DetachTo(*parts); + + // Return type: bool + return _retval; +} + +CEF_EXPORT int cef_create_url(const struct _cef_urlparts_t* parts, + cef_string_t* url) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: parts; type: struct_byref_const + DCHECK(parts); + if (!parts) + return 0; + // Verify param: url; type: string_byref + DCHECK(url); + if (!url) + return 0; + + // Translate param: parts; type: struct_byref_const + CefURLParts partsObj; + if (parts) + partsObj.Set(*parts, false); + // Translate param: url; type: string_byref + CefString urlStr(url); + + // Execute + bool _retval = CefCreateURL( + partsObj, + urlStr); + + // Return type: bool + return _retval; +} + +CEF_EXPORT int cef_register_extension(const cef_string_t* extension_name, + const cef_string_t* javascript_code, struct _cef_v8handler_t* handler) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: extension_name; type: string_byref_const + DCHECK(extension_name); + if (!extension_name) + return 0; + // Verify param: javascript_code; type: string_byref_const + DCHECK(javascript_code); + if (!javascript_code) + return 0; + // Unverified params: handler + + // Execute + bool _retval = CefRegisterExtension( + CefString(extension_name), + CefString(javascript_code), + CefV8HandlerCToCpp::Wrap(handler)); + + // Return type: bool + return _retval; +} + +CEF_EXPORT void cef_visit_web_plugin_info( + struct _cef_web_plugin_info_visitor_t* visitor) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: visitor; type: refptr_diff + DCHECK(visitor); + if (!visitor) + return; + + // Execute + CefVisitWebPluginInfo( + CefWebPluginInfoVisitorCToCpp::Wrap(visitor)); +} + diff --git a/libcef_dll/libcef_dll.rc b/libcef_dll/libcef_dll.rc new file mode 100644 index 000000000..569469e9b --- /dev/null +++ b/libcef_dll/libcef_dll.rc @@ -0,0 +1,143 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#include "include/cef_version.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#include ""include/version.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ALERT DIALOGEX 0, 0, 241, 76 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "JavaScript Alert" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,184,55,50,14 + LTEXT "",IDC_DIALOGTEXT,16,17,210,30 +END + +IDD_CONFIRM DIALOGEX 0, 0, 241, 76 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "JavaScript Confirm" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + PUSHBUTTON "Cancel",IDCANCEL,184,55,50,14 + DEFPUSHBUTTON "OK",IDOK,131,55,50,14 + LTEXT "",IDC_DIALOGTEXT,16,17,210,30 +END + +IDD_PROMPT DIALOGEX 0, 0, 241, 76 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "JavaScript Prompt" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,131,55,50,14 + LTEXT "",IDC_DIALOGTEXT,16,17,210,18 + PUSHBUTTON "Cancel",IDCANCEL,184,55,50,14 + EDITTEXT IDC_PROMPTEDIT,15,33,210,14,ES_AUTOHSCROLL +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 3,CHROME_VERSION_BUILD,CEF_REVISION,0 + PRODUCTVERSION 3,CHROME_VERSION_BUILD,CEF_REVISION,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "Chromium Embedded Framework (CEF) Dynamic Link Library" + VALUE "FileVersion", "3." MAKE_STRING(CHROME_VERSION_BUILD) "." MAKE_STRING(CEF_REVISION) + VALUE "InternalName", "libcef" + VALUE "LegalCopyright", "Copyright (C) " MAKE_STRING(COPYRIGHT_YEAR) " The Chromium Embedded Framework Authors" + VALUE "OriginalFilename", "libcef.dll" + VALUE "ProductName", "Chromium Embedded Framework (CEF) Dynamic Link Library" + VALUE "ProductVersion", "3." MAKE_STRING(CHROME_VERSION_BUILD) "." MAKE_STRING(CEF_REVISION) + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/libcef_dll/libcef_dll2.cc b/libcef_dll/libcef_dll2.cc new file mode 100644 index 000000000..1f5272029 --- /dev/null +++ b/libcef_dll/libcef_dll2.cc @@ -0,0 +1,12 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// + +#include "include/cef_version.h" +#include "cef_logging.h" + +CEF_EXPORT int cef_build_revision() +{ + return CEF_REVISION; +} diff --git a/libcef_dll/resource.h b/libcef_dll/resource.h new file mode 100644 index 000000000..cbeef193d --- /dev/null +++ b/libcef_dll/resource.h @@ -0,0 +1,26 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by libcef_dll.rc +// + +// Avoid files associated with MacOS +#define _X86_ + +#define IDD_ALERT 130 +#define IDD_CONFIRM 131 +#define IDD_PROMPT 132 +#define IDC_PROMPTEDIT 1000 +#define IDC_DIALOGTEXT 1001 + + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 130 +#define _APS_NEXT_COMMAND_VALUE 32000 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/cef/libcef_dll/transfer_util.cpp b/libcef_dll/transfer_util.cpp similarity index 100% rename from cef/libcef_dll/transfer_util.cpp rename to libcef_dll/transfer_util.cpp diff --git a/cef/libcef_dll/transfer_util.h b/libcef_dll/transfer_util.h similarity index 100% rename from cef/libcef_dll/transfer_util.h rename to libcef_dll/transfer_util.h diff --git a/cef/libcef_dll/wrapper/cef_byte_read_handler.cc b/libcef_dll/wrapper/cef_byte_read_handler.cc similarity index 100% rename from cef/libcef_dll/wrapper/cef_byte_read_handler.cc rename to libcef_dll/wrapper/cef_byte_read_handler.cc diff --git a/libcef_dll/wrapper/cef_stream_resource_handler.cc b/libcef_dll/wrapper/cef_stream_resource_handler.cc new file mode 100644 index 000000000..91f5e94cf --- /dev/null +++ b/libcef_dll/wrapper/cef_stream_resource_handler.cc @@ -0,0 +1,62 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "include/wrapper/cef_stream_resource_handler.h" +#include "include/cef_callback.h" +#include "include/cef_request.h" +#include "include/cef_stream.h" +#include "libcef_dll/cef_logging.h" + +CefStreamResourceHandler::CefStreamResourceHandler( + const CefString& mime_type, + CefRefPtr stream) + : status_code_(200), + mime_type_(mime_type), + stream_(stream) { + DCHECK(!mime_type_.empty()); + DCHECK(stream_.get()); +} + +CefStreamResourceHandler::CefStreamResourceHandler( + int status_code, + const CefString& mime_type, + CefResponse::HeaderMap header_map, + CefRefPtr stream) + : status_code_(status_code), + mime_type_(mime_type), + header_map_(header_map), + stream_(stream) { + DCHECK(!mime_type_.empty()); + DCHECK(stream_.get()); +} + +bool CefStreamResourceHandler::ProcessRequest(CefRefPtr request, + CefRefPtr callback) { + callback->Continue(); + return true; +} + +void CefStreamResourceHandler::GetResponseHeaders( + CefRefPtr response, + int64& response_length, + CefString& redirectUrl) { + response->SetStatus(status_code_); + response->SetMimeType(mime_type_); + + if (!header_map_.empty()) + response->SetHeaderMap(header_map_); + + response_length = -1; +} + +bool CefStreamResourceHandler::ReadResponse(void* data_out, + int bytes_to_read, + int& bytes_read, + CefRefPtr callback) { + bytes_read = stream_->Read(data_out, 1, bytes_to_read); + return (bytes_read > 0); +} + +void CefStreamResourceHandler::Cancel() { +} diff --git a/cef/libcef_dll/wrapper/cef_xml_object.cc b/libcef_dll/wrapper/cef_xml_object.cc similarity index 100% rename from cef/libcef_dll/wrapper/cef_xml_object.cc rename to libcef_dll/wrapper/cef_xml_object.cc diff --git a/cef/libcef_dll/wrapper/cef_zip_archive.cc b/libcef_dll/wrapper/cef_zip_archive.cc similarity index 100% rename from cef/libcef_dll/wrapper/cef_zip_archive.cc rename to libcef_dll/wrapper/cef_zip_archive.cc diff --git a/libcef_dll/wrapper/libcef_dll_wrapper.cc b/libcef_dll/wrapper/libcef_dll_wrapper.cc new file mode 100644 index 000000000..87e9973a5 --- /dev/null +++ b/libcef_dll/wrapper/libcef_dll_wrapper.cc @@ -0,0 +1,466 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +#include "include/cef_app.h" +#include "include/capi/cef_app_capi.h" +#include "include/cef_origin_whitelist.h" +#include "include/capi/cef_origin_whitelist_capi.h" +#include "include/cef_path_util.h" +#include "include/capi/cef_path_util_capi.h" +#include "include/cef_process_util.h" +#include "include/capi/cef_process_util_capi.h" +#include "include/cef_scheme.h" +#include "include/capi/cef_scheme_capi.h" +#include "include/cef_task.h" +#include "include/capi/cef_task_capi.h" +#include "include/cef_url.h" +#include "include/capi/cef_url_capi.h" +#include "include/cef_v8.h" +#include "include/capi/cef_v8_capi.h" +#include "include/cef_web_plugin.h" +#include "include/capi/cef_web_plugin_capi.h" +#include "include/cef_version.h" +#include "libcef_dll/cpptoc/app_cpptoc.h" +#include "libcef_dll/cpptoc/browser_process_handler_cpptoc.h" +#include "libcef_dll/cpptoc/context_menu_handler_cpptoc.h" +#include "libcef_dll/cpptoc/cookie_visitor_cpptoc.h" +#include "libcef_dll/cpptoc/domevent_listener_cpptoc.h" +#include "libcef_dll/cpptoc/domvisitor_cpptoc.h" +#include "libcef_dll/cpptoc/display_handler_cpptoc.h" +#include "libcef_dll/cpptoc/download_handler_cpptoc.h" +#include "libcef_dll/cpptoc/focus_handler_cpptoc.h" +#include "libcef_dll/cpptoc/geolocation_handler_cpptoc.h" +#include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h" +#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h" +#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h" +#include "libcef_dll/cpptoc/load_handler_cpptoc.h" +#include "libcef_dll/cpptoc/proxy_handler_cpptoc.h" +#include "libcef_dll/cpptoc/read_handler_cpptoc.h" +#include "libcef_dll/cpptoc/render_process_handler_cpptoc.h" +#include "libcef_dll/cpptoc/request_handler_cpptoc.h" +#include "libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h" +#include "libcef_dll/cpptoc/resource_handler_cpptoc.h" +#include "libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h" +#include "libcef_dll/cpptoc/string_visitor_cpptoc.h" +#include "libcef_dll/cpptoc/task_cpptoc.h" +#include "libcef_dll/cpptoc/urlrequest_client_cpptoc.h" +#include "libcef_dll/cpptoc/v8accessor_cpptoc.h" +#include "libcef_dll/cpptoc/v8handler_cpptoc.h" +#include "libcef_dll/cpptoc/web_plugin_info_visitor_cpptoc.h" +#include "libcef_dll/cpptoc/write_handler_cpptoc.h" +#include "libcef_dll/ctocpp/auth_callback_ctocpp.h" +#include "libcef_dll/ctocpp/before_download_callback_ctocpp.h" +#include "libcef_dll/ctocpp/binary_value_ctocpp.h" +#include "libcef_dll/ctocpp/browser_ctocpp.h" +#include "libcef_dll/ctocpp/browser_host_ctocpp.h" +#include "libcef_dll/ctocpp/callback_ctocpp.h" +#include "libcef_dll/ctocpp/command_line_ctocpp.h" +#include "libcef_dll/ctocpp/context_menu_params_ctocpp.h" +#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h" +#include "libcef_dll/ctocpp/domdocument_ctocpp.h" +#include "libcef_dll/ctocpp/domevent_ctocpp.h" +#include "libcef_dll/ctocpp/domnode_ctocpp.h" +#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h" +#include "libcef_dll/ctocpp/download_item_ctocpp.h" +#include "libcef_dll/ctocpp/download_item_callback_ctocpp.h" +#include "libcef_dll/ctocpp/frame_ctocpp.h" +#include "libcef_dll/ctocpp/geolocation_callback_ctocpp.h" +#include "libcef_dll/ctocpp/jsdialog_callback_ctocpp.h" +#include "libcef_dll/ctocpp/list_value_ctocpp.h" +#include "libcef_dll/ctocpp/menu_model_ctocpp.h" +#include "libcef_dll/ctocpp/process_message_ctocpp.h" +#include "libcef_dll/ctocpp/scheme_registrar_ctocpp.h" +#include "libcef_dll/ctocpp/stream_reader_ctocpp.h" +#include "libcef_dll/ctocpp/stream_writer_ctocpp.h" +#include "libcef_dll/ctocpp/urlrequest_ctocpp.h" +#include "libcef_dll/ctocpp/v8context_ctocpp.h" +#include "libcef_dll/ctocpp/v8exception_ctocpp.h" +#include "libcef_dll/ctocpp/v8value_ctocpp.h" +#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h" +#include "libcef_dll/ctocpp/xml_reader_ctocpp.h" +#include "libcef_dll/ctocpp/zip_reader_ctocpp.h" + +// Define used to facilitate parsing. +#define CEF_GLOBAL + + +// GLOBAL METHODS - Body may be edited by hand. + +CEF_GLOBAL int CefExecuteProcess(const CefMainArgs& args, + CefRefPtr application) { + int build_revision = cef_build_revision(); + if (build_revision != CEF_REVISION) { + // The libcef build revision does not match the CEF API revision. + DCHECK(false); + return 0; + } + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Unverified params: application + + // Execute + int _retval = cef_execute_process( + &args, + CefAppCppToC::Wrap(application)); + + // Return type: simple + return _retval; +} + +CEF_GLOBAL bool CefInitialize(const CefMainArgs& args, + const CefSettings& settings, CefRefPtr application) { + int build_revision = cef_build_revision(); + if (build_revision != CEF_REVISION) { + // The libcef build revision does not match the CEF API revision. + DCHECK(false); + return false; + } + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Unverified params: application + + // Execute + int _retval = cef_initialize( + &args, + &settings, + CefAppCppToC::Wrap(application)); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL void CefShutdown() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_shutdown(); + +#ifndef NDEBUG + // Check that all wrapper objects have been destroyed + DCHECK_EQ(CefAuthCallbackCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefBeforeDownloadCallbackCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefBinaryValueCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefBrowserCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefBrowserHostCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefBrowserProcessHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefCallbackCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefContextMenuHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefContextMenuParamsCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefCookieManagerCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefCookieVisitorCppToC::DebugObjCt, 0); + DCHECK_EQ(CefDOMDocumentCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefDOMEventCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefDOMEventListenerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefDOMNodeCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefDOMVisitorCppToC::DebugObjCt, 0); + DCHECK_EQ(CefDictionaryValueCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefDisplayHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefDownloadHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefDownloadItemCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefDownloadItemCallbackCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefFocusHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefFrameCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefGeolocationCallbackCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefGeolocationHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefJSDialogCallbackCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefJSDialogHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefKeyboardHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefLifeSpanHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefListValueCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefLoadHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefMenuModelCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefProcessMessageCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefProxyHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefReadHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefRenderProcessHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefRequestHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefResourceBundleHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefResourceHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefSchemeHandlerFactoryCppToC::DebugObjCt, 0); + DCHECK_EQ(CefSchemeRegistrarCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefStreamReaderCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefStreamWriterCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefStringVisitorCppToC::DebugObjCt, 0); + DCHECK_EQ(CefTaskCppToC::DebugObjCt, 0); + DCHECK_EQ(CefURLRequestCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefURLRequestClientCppToC::DebugObjCt, 0); + DCHECK_EQ(CefV8AccessorCppToC::DebugObjCt, 0); + DCHECK_EQ(CefV8ContextCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefV8ExceptionCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefV8HandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefV8ValueCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefWebPluginInfoCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefWebPluginInfoVisitorCppToC::DebugObjCt, 0); + DCHECK_EQ(CefWriteHandlerCppToC::DebugObjCt, 0); + DCHECK_EQ(CefXmlReaderCToCpp::DebugObjCt, 0); + DCHECK_EQ(CefZipReaderCToCpp::DebugObjCt, 0); +#endif // !NDEBUG +} + +CEF_GLOBAL void CefDoMessageLoopWork() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_do_message_loop_work(); +} + +CEF_GLOBAL void CefRunMessageLoop() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_run_message_loop(); +} + +CEF_GLOBAL void CefQuitMessageLoop() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + cef_quit_message_loop(); +} + +CEF_GLOBAL bool CefAddCrossOriginWhitelistEntry(const CefString& source_origin, + const CefString& target_protocol, const CefString& target_domain, + bool allow_target_subdomains) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: source_origin; type: string_byref_const + DCHECK(!source_origin.empty()); + if (source_origin.empty()) + return false; + // Verify param: target_protocol; type: string_byref_const + DCHECK(!target_protocol.empty()); + if (target_protocol.empty()) + return false; + // Unverified params: target_domain + + // Execute + int _retval = cef_add_cross_origin_whitelist_entry( + source_origin.GetStruct(), + target_protocol.GetStruct(), + target_domain.GetStruct(), + allow_target_subdomains); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL bool CefRemoveCrossOriginWhitelistEntry( + const CefString& source_origin, const CefString& target_protocol, + const CefString& target_domain, bool allow_target_subdomains) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: source_origin; type: string_byref_const + DCHECK(!source_origin.empty()); + if (source_origin.empty()) + return false; + // Verify param: target_protocol; type: string_byref_const + DCHECK(!target_protocol.empty()); + if (target_protocol.empty()) + return false; + // Unverified params: target_domain + + // Execute + int _retval = cef_remove_cross_origin_whitelist_entry( + source_origin.GetStruct(), + target_protocol.GetStruct(), + target_domain.GetStruct(), + allow_target_subdomains); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL bool CefClearCrossOriginWhitelist() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = cef_clear_cross_origin_whitelist(); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL bool CefGetPath(PathKey key, CefString& path) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = cef_get_path( + key, + path.GetWritableStruct()); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL bool CefLaunchProcess(CefRefPtr command_line) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: command_line; type: refptr_same + DCHECK(command_line.get()); + if (!command_line.get()) + return false; + + // Execute + int _retval = cef_launch_process( + CefCommandLineCToCpp::Unwrap(command_line)); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL bool CefRegisterSchemeHandlerFactory(const CefString& scheme_name, + const CefString& domain_name, + CefRefPtr factory) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: scheme_name; type: string_byref_const + DCHECK(!scheme_name.empty()); + if (scheme_name.empty()) + return false; + // Unverified params: domain_name, factory + + // Execute + int _retval = cef_register_scheme_handler_factory( + scheme_name.GetStruct(), + domain_name.GetStruct(), + CefSchemeHandlerFactoryCppToC::Wrap(factory)); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL bool CefClearSchemeHandlerFactories() { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = cef_clear_scheme_handler_factories(); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL bool CefCurrentlyOn(CefThreadId threadId) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = cef_currently_on( + threadId); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL bool CefPostTask(CefThreadId threadId, CefRefPtr task) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: task; type: refptr_diff + DCHECK(task.get()); + if (!task.get()) + return false; + + // Execute + int _retval = cef_post_task( + threadId, + CefTaskCppToC::Wrap(task)); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL bool CefPostDelayedTask(CefThreadId threadId, + CefRefPtr task, int64 delay_ms) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: task; type: refptr_diff + DCHECK(task.get()); + if (!task.get()) + return false; + + // Execute + int _retval = cef_post_delayed_task( + threadId, + CefTaskCppToC::Wrap(task), + delay_ms); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL bool CefParseURL(const CefString& url, CefURLParts& parts) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: url; type: string_byref_const + DCHECK(!url.empty()); + if (url.empty()) + return false; + + // Execute + int _retval = cef_parse_url( + url.GetStruct(), + &parts); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL bool CefCreateURL(const CefURLParts& parts, CefString& url) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Execute + int _retval = cef_create_url( + &parts, + url.GetWritableStruct()); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL bool CefRegisterExtension(const CefString& extension_name, + const CefString& javascript_code, CefRefPtr handler) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: extension_name; type: string_byref_const + DCHECK(!extension_name.empty()); + if (extension_name.empty()) + return false; + // Verify param: javascript_code; type: string_byref_const + DCHECK(!javascript_code.empty()); + if (javascript_code.empty()) + return false; + // Unverified params: handler + + // Execute + int _retval = cef_register_extension( + extension_name.GetStruct(), + javascript_code.GetStruct(), + CefV8HandlerCppToC::Wrap(handler)); + + // Return type: bool + return _retval?true:false; +} + +CEF_GLOBAL void CefVisitWebPluginInfo( + CefRefPtr visitor) { + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + + // Verify param: visitor; type: refptr_diff + DCHECK(visitor.get()); + if (!visitor.get()) + return; + + // Execute + cef_visit_web_plugin_info( + CefWebPluginInfoVisitorCppToC::Wrap(visitor)); +} + diff --git a/libcef_dll/wrapper/libcef_dll_wrapper2.cc b/libcef_dll/wrapper/libcef_dll_wrapper2.cc new file mode 100644 index 000000000..dc8ba7b02 --- /dev/null +++ b/libcef_dll/wrapper/libcef_dll_wrapper2.cc @@ -0,0 +1,4 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + diff --git a/patch/README.txt b/patch/README.txt new file mode 100644 index 000000000..f96fe36a4 --- /dev/null +++ b/patch/README.txt @@ -0,0 +1,20 @@ +There may be instances where CEF requires changes to the Chromium/WebKit code +base that are not desired by the Chromium/WebKit projects as a whole. To address +this situation the CEF project adds a patch capability as part of the CEF GYP +project generation step. The patch capability works as follows: + +1. The CEF developer creates one or more patch files containing all required + changes to the Chromium/WebKit code base and places those patch files in the + "patches" subdirectory. +2. The CEF developer adds an entry for each patch file in the "patch.cfg" file. +3. CEF applies the patches to the Chromium/WebKit source tree using the + patcher.py tool in the tools directory. If necessary the patcher.py tool + also rewrites the "patch_state.h" file which defines the CEF_PATCHES_APPLIED + preprocessor value. + +To disable automatic application of patches to the Chromium/WebKit code base +create an empty "NOPATCH" file in the "patch" directory. Sections of the CEF +code base that otherwise require patches will be disabled using the +CEF_PATCHES_APPLIED preprocessor value defined in the "patch_state.h" file. Be +warned that not applying all required patches may break important CEF +functionality. diff --git a/patch/patch.cfg b/patch/patch.cfg new file mode 100644 index 000000000..a2229a76b --- /dev/null +++ b/patch/patch.cfg @@ -0,0 +1,40 @@ +# Each map in the list associates a patch file name with a target path and +# optional condition. All paths in the patch file must be relative to the +# target path. Each map should include a comment linking to the code review +# or bug report that the patch relates to. If a condition is provided the +# patch will only be applied if an environment variable with the specified +# name exists. + +patches = [ + { + # Necessary for grit integration + 'name': 'gritsettings', + 'path': '../tools/gritsettings/', + }, + { + # http://codereview.chromium.org/8086022/ + 'name': 'build', + 'path': '../build/', + }, + { + # http://code.google.com/p/gyp/issues/detail?id=223 + 'name': 'tools_gyp', + 'path': '../tools/gyp/', + }, + { + # http://code.google.com/p/chromiumembedded/issues/detail?id=642 + 'name': 'renderer_main_642', + 'path': '../content/renderer/', + }, + { + # http://code.google.com/p/chromiumembedded/issues/detail?id=642 + 'name': 'window_impl_642', + 'path': '../ui/base/win/', + }, + { + # http://code.google.com/p/chromiumembedded/issues/detail?id=364 + 'name': 'spi_webcore_364', + 'path': '../third_party/WebKit/Source/WebCore/', + 'condition': 'CEF_SPI_BUILD', + }, +] diff --git a/patch/patch_state.h b/patch/patch_state.h new file mode 100644 index 000000000..c4ee7135a --- /dev/null +++ b/patch/patch_state.h @@ -0,0 +1,6 @@ +// This file is generated by the patch tool and should not be edited manually. +#ifndef _PATCH_STATE_H +#define _PATCH_STATE_H +// Patches have been applied to the Chromium/WebKit source base. +#define CEF_PATCHES_APPLIED 1 +#endif // _PATCH_STATE_H diff --git a/patch/patches/build.patch b/patch/patches/build.patch new file mode 100644 index 000000000..e73ddb02c --- /dev/null +++ b/patch/patches/build.patch @@ -0,0 +1,27 @@ +Index: common.gypi +=================================================================== +--- common.gypi (revision 102269) ++++ common.gypi (working copy) +@@ -9,6 +9,9 @@ + # Variables expected to be overriden on the GYP command line (-D) or by + # ~/.gyp/include.gypi. + 'variables': { ++ # Directory for CEF source files. This will be set by cef.gypi. ++ 'cef_directory%' : '', ++ + # Putting a variables dict inside another variables dict looks kind of + # weird. This is done so that 'host_arch', 'chromeos', etc are defined as + # variables within the outer variables dict here. This is necessary +Index: mac/strip_save_dsym +=================================================================== +--- mac/strip_save_dsym (revision 102269) ++++ mac/strip_save_dsym (working copy) +@@ -48,7 +48,7 @@ + "bundle"] + macho_types_re = "Mach-O (?:64-bit )?(?:" + "|".join(macho_types) + ")" + +- file_cmd = subprocess.Popen(["/usr/bin/file", "-b", "--", macho], ++ file_cmd = subprocess.Popen(["/usr/bin/file", "-b", "-L", "--", macho], + stdout=subprocess.PIPE) + + archs = [] diff --git a/patch/patches/gritsettings.patch b/patch/patches/gritsettings.patch new file mode 100644 index 000000000..b9863299a --- /dev/null +++ b/patch/patches/gritsettings.patch @@ -0,0 +1,17 @@ +Index: resource_ids +=================================================================== +--- resource_ids (revision 131752) ++++ resource_ids (working copy) +@@ -16,6 +16,12 @@ + { + "SRCDIR": "../..", + ++ "cef/libcef/resources/cef_resources.grd": { ++ "includes": [26000], ++ }, ++ "cef/libcef/resources/cef_strings.grd": { ++ "messages": [26500], ++ }, + "chrome/browser/browser_resources.grd": { + "includes": [500], + }, diff --git a/patch/patches/renderer_main_642.patch b/patch/patches/renderer_main_642.patch new file mode 100644 index 000000000..16fc4517c --- /dev/null +++ b/patch/patches/renderer_main_642.patch @@ -0,0 +1,13 @@ +Index: renderer_main.cc +=================================================================== +--- renderer_main.cc (revision 144645) ++++ renderer_main.cc (working copy) +@@ -246,7 +246,7 @@ + if (!no_sandbox) { + run_loop = platform.EnableSandbox(); + } else { +- LOG(ERROR) << "Running without renderer sandbox"; ++ //LOG(ERROR) << "Running without renderer sandbox"; + } + #if defined(OS_POSIX) && !defined(OS_MACOSX) + RenderProcessImpl render_process; diff --git a/patch/patches/spi_webcore_364.patch b/patch/patches/spi_webcore_364.patch new file mode 100644 index 000000000..9242a628d --- /dev/null +++ b/patch/patches/spi_webcore_364.patch @@ -0,0 +1,35 @@ +Index: page/FrameView.cpp +=================================================================== +--- page/FrameView.cpp (revision 103399) ++++ page/FrameView.cpp (working copy) +@@ -176,10 +176,12 @@ + m_page = page; + m_page->addScrollableArea(this); + ++#if 0 + if (m_frame == m_page->mainFrame()) { + ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); + ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); + } ++#endif + } + } + } +Index: platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.mm +=================================================================== +--- platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.mm (revision 101144) ++++ platform/chromium/ScrollbarOverlayUtilitiesChromiumMac.mm (working copy) +@@ -356,9 +356,13 @@ + + bool isScrollbarOverlayAPIAvailable() + { ++#if 0 + static bool apiAvailable = [lookUpNSScrollerImpClass() respondsToSelector:@selector(scrollerImpWithStyle:controlSize:horizontal:replacingScrollerImp:)] && + [lookUpNSScrollerImpPairClass() instancesRespondToSelector:@selector(scrollerStyle)]; + return apiAvailable; ++#else ++ return false; ++#endif + } + + #endif // USE(WK_SCROLLBAR_PAINTER) diff --git a/patch/patches/tools_gyp.patch b/patch/patches/tools_gyp.patch new file mode 100644 index 000000000..77beae74f --- /dev/null +++ b/patch/patches/tools_gyp.patch @@ -0,0 +1,14 @@ +Index: pylib/gyp/input.py +=================================================================== +--- pylib/gyp/input.py (revision 1402) ++++ pylib/gyp/input.py (working copy) +@@ -684,7 +684,8 @@ + # that don't load quickly, this can be faster than + # atom), i->instance)) { +- LOG(ERROR) << "Failed to unregister class " << i->name.c_str() +- << ". Error = " << GetLastError(); ++ //LOG(ERROR) << "Failed to unregister class " << i->name.c_str() ++ // << ". Error = " << GetLastError(); + } + } + } diff --git a/script/atom.githubapp.com b/script/atom.githubapp.com deleted file mode 100644 index ba0363c02..000000000 --- a/script/atom.githubapp.com +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEA5+pXspHed0hoB1Jel8mWmwGUzjSQsrzTmOA6rrlr1hbr9w9d -FGq8raUR3XAvALjpySYtLqzSVD5uFXTC0L/rdunH/w3PTdm5tVjvtOGi9TXF0F/L -fItXCHyTzGFGjomQQvO1GCKRcqhtF9rZHXJB3Ad4YRyN0AIpbCXzSWT9lUneVjvY -l1KIpzO1/ji2d7L3IbdnWi4vRyOUwvTVT4TFPcisWC3MnjB+EcnoYMYVsFJ/qrlP -32q+YRzNBezXawC15sOqX1sSCq79pyJC/x4X8CzxYAWtTx8e01TNlAbu6Btubfc4 -a+J7EG4aCywZRvEFJZHuJM2tJ76c5PXVgH+7DQIDAQABAoIBAGkA8K4YX5qwfPF7 -uPqOupL6N07Z+/4Bgui/9bHwoEOx4yrcmO9KmJ0ilSEmzxFLqAZ8M47jjuO31I4A -bMipbMpNdVElBoygHPZgC0BhvS+7JhJ/nRmJ2WEtTpoGHTUiUeAOihsgY6x/V82q -OA2eEvW1qCqIDCl3IRwnXq0Hfc1eZRL31zE9QaTi7Jbept7SvGWudBFGwREiS9VI -CzjnvQxrdKcXaa5q6cdGmkJhgoPDkU1H7FVPWZ/n+iGsK2wFPfCkbykBt++mqEW5 -TLJvd+gGbhCBJRwNSnfsZ6CMs8Ly+LTJ8RjBIkfTyOOl6tECUSuU4CpNRfv3HzSo -5wy97eECgYEA9wfDcnvLM/KcQ5N8GdGDIlI2WBxwQPY93rcvTinKO2M6pMDDognX -USSD/HBFs/cWnRihDOtpl8HOl8j9BXKfSJKXiWKj++u6rmG9eJ9UOfQ7sZrkic6N -AatHRpuE0J0fmgQUE1a+VG3VheLtOTunpT9PM6UDYL4XcxsdHUlbH9kCgYEA8FYU -lCsbFZGwYD2oG10o11ofFKTtRC9pTgDm9GM5k7I54uLKn08tdXs962D6gMnS2teE -bRzz5lidwrioykyCTDWVyjwySShCFgim7tXyldrlin4FVgOH4s7E7oi6rTv1BpV3 -mNaxvjfozGmd6z44skQOmqdt4S5Y9ph0NF/+aFUCgYBn8WRT77L5EMSfypcVZgr/ -jgg/2veA3hv6cqn9AaiOhJpQaKvoqqtnAS5oMfWiW/2v7IUXopazvGDpjTCp8ikD -qGsK6+6EOhQ6+/V1o9UU7aeQe9ReCANdCGzdUOL5xKNfcwffe0hqzixiQbH/uxI3 -fgQdfvmE43eKf4YopI0rQQKBgQCXTeoYueaMNrMuc8Kgr46lvTPyAD7rfVmzZPgB -hXJbHIo634KmtucsnhEGXYB3khfv9FyHgQG/06xGSZDiAzbImbeaoTkbO4AXdQz7 -MbBOTYfTH7FmTETBMmFitqunoiaJJZIso4U09ufVwOxNjFePSy9Sh/OyH0acwK/v -xTtaHQKBgDoJ2fVbPTASjHx8W5lTZrAySvjC+AmwH710mpgDzWd6XYmQxZMzh7I0 -zykIellBiqKqrNmXBv2DUwgpunXm2CLwavxlsFgg1wfTY9qVBf1ztSFXtOsdMe/2 -j2n/f3jqMeOkPzSXeDqZL67fh4KcegEevpwsYoIHij0FAVlXEuoq ------END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/script/cibuild b/script/cibuild deleted file mode 100755 index f28e89e4c..000000000 --- a/script/cibuild +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby - -sha = `git rev-parse HEAD`.chop -key = File.expand_path('../atom.githubapp.com', __FILE__) -system 'chmod', '600', key - -system 'ssh', - '-l', 'github', - '-i', key, - '-o', 'StrictHostKeyChecking=no', - '-p', '6000', - 'atom.githubapp.com', - "cd /Users/github/code/atom && git fetch -q origin && git reset -q --hard #{sha} && rake test && rake benchmark" - -exit $?.exitstatus \ No newline at end of file diff --git a/spec/app/atom-spec.coffee b/spec/app/atom-spec.coffee deleted file mode 100644 index 51bfa8e74..000000000 --- a/spec/app/atom-spec.coffee +++ /dev/null @@ -1,45 +0,0 @@ -Atom = require 'atom' -fs = require 'fs' -_ = require 'underscore' - -describe "Atom", -> - beforeEach -> - spyOn(Atom.prototype, "setUpKeymap") - - describe ".open(path)", -> - newWindow = null - - afterEach -> - newWindow?.close() - - describe "when opening a file", -> - it "displays it in a new window with the contents of the file loaded", -> - filePath = null - - filePath = require.resolve 'fixtures/sample.txt' - previousWindowCount = atom.windows.length - - atom.open filePath - - waitsFor "window to open", -> - atom.windows.length > previousWindowCount - - runs -> - expect(atom.windows.length).toBe previousWindowCount + 1 - newWindow = _.last(atom.windows) - expect(newWindow.rootView.getActiveEditor().getPath()).toEqual filePath - expect(newWindow.rootView.getActiveEditor().getText()).toEqual fs.read(filePath) - - describe ".windowOpened(window)", -> - atom = null - - beforeEach -> - atom = new Atom - - it "adds the window to the windows array if it isn't already present", -> - atom.windowOpened window - atom.windowOpened window - expect(atom.windows).toEqual [window] - - - diff --git a/spec/app/buffer-spec.coffee b/spec/app/buffer-spec.coffee deleted file mode 100644 index d66fb62c2..000000000 --- a/spec/app/buffer-spec.coffee +++ /dev/null @@ -1,624 +0,0 @@ -Project = require 'project' -Buffer = require 'buffer' -fs = require 'fs' - -describe 'Buffer', -> - [filePath, fileContents, buffer] = [] - - beforeEach -> - filePath = require.resolve('fixtures/sample.js') - fileContents = fs.read(filePath) - buffer = new Buffer(filePath) - - afterEach -> - buffer?.release() - - describe 'constructor', -> - beforeEach -> - buffer.release() - - describe "when given a path", -> - describe "when a file exists for the path", -> - it "loads the contents of that file", -> - filePath = require.resolve 'fixtures/sample.txt' - buffer = new Buffer(filePath) - expect(buffer.getText()).toBe fs.read(filePath) - - it "is not modified and has no undo history", -> - buffer = new Buffer(filePath) - expect(buffer.isModified()).toBeFalsy() - expect(buffer.undoManager.undoHistory.length).toBe 0 - - describe "when no file exists for the path", -> - it "throws an exception", -> - buffer = null - filePath = "does-not-exist.txt" - expect(fs.exists(filePath)).toBeFalsy() - expect(-> new Buffer(filePath)).toThrow() - - describe "when no path is given", -> - it "creates an empty buffer", -> - buffer = new Buffer - expect(buffer.getText()).toBe "" - - describe "path-change event", -> - [path, newPath, bufferToChange, eventHandler] = [] - - beforeEach -> - path = fs.join(require.resolve("fixtures/"), "atom-manipulate-me") - newPath = "#{path}-i-moved" - fs.write(path, "") - bufferToChange = new Buffer(path) - eventHandler = jasmine.createSpy('eventHandler') - bufferToChange.on 'path-change', eventHandler - - afterEach -> - bufferToChange.destroy() - fs.remove(path) if fs.exists(path) - fs.remove(newPath) if fs.exists(newPath) - - it "triggers a `path-change` event when path is changed", -> - bufferToChange.saveAs(newPath) - expect(eventHandler).toHaveBeenCalledWith(bufferToChange) - - it "triggers a `path-change` event when the file is moved", -> - fs.remove(newPath) if fs.exists(newPath) - fs.move(path, newPath) - - waitsFor "buffer path change", -> - eventHandler.callCount > 0 - - runs -> - expect(eventHandler).toHaveBeenCalledWith(bufferToChange) - - it "triggers a `path-change` event when the file is removed", -> - fs.remove(path) - - waitsFor "buffer path change", -> - eventHandler.callCount > 0 - - describe "when the buffer's file is modified (via another process)", -> - path = null - beforeEach -> - path = "/tmp/tmp.txt" - fs.write(path, "first") - buffer.release() - buffer = new Buffer(path).retain() - - afterEach -> - fs.remove(path) - - it "does not trigger a contents-change event when Atom modifies the file", -> - buffer.insert([0,0], "HELLO!") - changeHandler = jasmine.createSpy("buffer changed") - buffer.on "change", changeHandler - buffer.save() - - waits 30 - runs -> - expect(changeHandler).not.toHaveBeenCalled() - - describe "when the buffer is unmodified", -> - it "triggers 'change' event and buffer remains unmodified", -> - changeHandler = jasmine.createSpy('changeHandler') - buffer.on 'change', changeHandler - fs.write(path, "second") - - expect(changeHandler.callCount).toBe 0 - waitsFor "file to trigger change event", -> - changeHandler.callCount > 0 - - runs -> - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual [[0, 0], [0, 5]] - expect(event.newRange).toEqual [[0, 0], [0, 6]] - expect(event.oldText).toBe "first" - expect(event.newText).toBe "second" - expect(buffer.isModified()).toBeFalsy() - - describe "when the buffer is modified", -> - it "sets modifiedOnDisk to be true", -> - fileChangeHandler = jasmine.createSpy('fileChange') - buffer.file.on 'contents-change', fileChangeHandler - - buffer.insert([0, 0], "a change") - fs.write(path, "second") - - expect(fileChangeHandler.callCount).toBe 0 - waitsFor "file to trigger contents-change event", -> - fileChangeHandler.callCount > 0 - - runs -> - expect(buffer.isModifiedOnDisk()).toBeTruthy() - - describe "when the buffer's file is deleted (via another process)", -> - it "no longer has a path", -> - path = "/tmp/atom-file-to-delete.txt" - fs.write(path, '') - bufferToDelete = new Buffer(path) - expect(bufferToDelete.getPath()).toBe path - - fs.remove(path) - - waitsFor "file to be removed", -> - not bufferToDelete.getPath() - - describe ".isModified()", -> - beforeEach -> - buffer.destroy() - waitsFor "file to be removed", -> - not bufferToDelete.getPath() - - describe ".isModified()", -> - it "returns true when user changes buffer", -> - expect(buffer.isModified()).toBeFalsy() - buffer.insert([0,0], "hi") - expect(buffer.isModified()).toBe true - - it "returns false after modified buffer is saved", -> - filePath = "/tmp/atom-tmp-file" - fs.write(filePath, '') - buffer.release() - buffer = new Buffer(filePath) - expect(buffer.isModified()).toBe false - - buffer.insert([0,0], "hi") - expect(buffer.isModified()).toBe true - - buffer.save() - expect(buffer.isModified()).toBe false - - describe ".getLines()", -> - it "returns an array of lines in the text contents", -> - expect(buffer.getLines().length).toBe fileContents.split("\n").length - expect(buffer.getLines().join('\n')).toBe fileContents - - describe ".change(range, string)", -> - changeHandler = null - - beforeEach -> - changeHandler = jasmine.createSpy('changeHandler') - buffer.on 'change', changeHandler - - describe "when used to insert (called with an empty range and a non-empty string)", -> - describe "when the given string has no newlines", -> - it "inserts the string at the location of the given range", -> - range = [[3, 4], [3, 4]] - buffer.change range, "foo" - - expect(buffer.lineForRow(2)).toBe " if (items.length <= 1) return items;" - expect(buffer.lineForRow(3)).toBe " foovar pivot = items.shift(), current, left = [], right = [];" - expect(buffer.lineForRow(4)).toBe " while(items.length > 0) {" - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual range - expect(event.newRange).toEqual [[3, 4], [3, 7]] - expect(event.oldText).toBe "" - expect(event.newText).toBe "foo" - - describe "when the given string has newlines", -> - it "inserts the lines at the location of the given range", -> - range = [[3, 4], [3, 4]] - - buffer.change range, "foo\n\nbar\nbaz" - - expect(buffer.lineForRow(2)).toBe " if (items.length <= 1) return items;" - expect(buffer.lineForRow(3)).toBe " foo" - expect(buffer.lineForRow(4)).toBe "" - expect(buffer.lineForRow(5)).toBe "bar" - expect(buffer.lineForRow(6)).toBe "bazvar pivot = items.shift(), current, left = [], right = [];" - expect(buffer.lineForRow(7)).toBe " while(items.length > 0) {" - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual range - expect(event.newRange).toEqual [[3, 4], [6, 3]] - expect(event.oldText).toBe "" - expect(event.newText).toBe "foo\n\nbar\nbaz" - - describe "when used to remove (called with a non-empty range and an empty string)", -> - describe "when the range is contained within a single line", -> - it "removes the characters within the range", -> - range = [[3, 4], [3, 7]] - buffer.change range, "" - - expect(buffer.lineForRow(2)).toBe " if (items.length <= 1) return items;" - expect(buffer.lineForRow(3)).toBe " pivot = items.shift(), current, left = [], right = [];" - expect(buffer.lineForRow(4)).toBe " while(items.length > 0) {" - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual range - expect(event.newRange).toEqual [[3, 4], [3, 4]] - expect(event.oldText).toBe "var" - expect(event.newText).toBe "" - - describe "when the range spans 2 lines", -> - it "removes the characters within the range and joins the lines", -> - range = [[3, 16], [4, 4]] - buffer.change range, "" - - expect(buffer.lineForRow(2)).toBe " if (items.length <= 1) return items;" - expect(buffer.lineForRow(3)).toBe " var pivot = while(items.length > 0) {" - expect(buffer.lineForRow(4)).toBe " current = items.shift();" - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual range - expect(event.newRange).toEqual [[3, 16], [3, 16]] - expect(event.oldText).toBe "items.shift(), current, left = [], right = [];\n " - expect(event.newText).toBe "" - - describe "when the range spans more than 2 lines", -> - it "removes the characters within the range, joining the first and last line and removing the lines in-between", -> - buffer.change [[3, 16], [11, 9]], "" - - expect(buffer.lineForRow(2)).toBe " if (items.length <= 1) return items;" - expect(buffer.lineForRow(3)).toBe " var pivot = sort(Array.apply(this, arguments));" - expect(buffer.lineForRow(4)).toBe "};" - - describe "when used to replace text with other text (called with non-empty range and non-empty string)", -> - it "replaces the old text with the new text", -> - range = [[3, 16], [11, 9]] - oldText = buffer.getTextInRange(range) - - buffer.change range, "foo\nbar" - - expect(buffer.lineForRow(2)).toBe " if (items.length <= 1) return items;" - expect(buffer.lineForRow(3)).toBe " var pivot = foo" - expect(buffer.lineForRow(4)).toBe "barsort(Array.apply(this, arguments));" - expect(buffer.lineForRow(5)).toBe "};" - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual range - expect(event.newRange).toEqual [[3, 16], [4, 3]] - expect(event.oldText).toBe oldText - expect(event.newText).toBe "foo\nbar" - - it "allows a 'change' event handler to safely undo the change", -> - buffer.on 'change', -> buffer.undo() - buffer.change([0, 0], "hello") - expect(buffer.lineForRow(0)).toBe "var quicksort = function () {" - - describe ".setText(text)", -> - it "changes the entire contents of the buffer and emits a change event", -> - lastRow = buffer.getLastRow() - expectedPreRange = [[0,0], [lastRow, buffer.lineForRow(lastRow).length]] - changeHandler = jasmine.createSpy('changeHandler') - buffer.on 'change', changeHandler - - newText = "I know you are.\nBut what am I?" - buffer.setText(newText) - - expect(buffer.getText()).toBe newText - expect(changeHandler).toHaveBeenCalled() - - [event] = changeHandler.argsForCall[0] - expect(event.newText).toBe newText - expect(event.oldRange).toEqual expectedPreRange - expect(event.newRange).toEqual [[0, 0], [1, 14]] - - describe ".save()", -> - beforeEach -> - buffer.release() - - describe "when the buffer has a path", -> - filePath = null - - beforeEach -> - filePath = '/tmp/temp.txt' - fs.write(filePath, "") - buffer = new Buffer filePath - - afterEach -> - fs.remove filePath if fs.exists(filePath) - - it "saves the contents of the buffer to the path", -> - buffer.setText 'Buffer contents!' - buffer.save() - expect(fs.read(filePath)).toEqual 'Buffer contents!' - - it "fires beforeSave and afterSave events around the call to fs.write", -> - events = [] - beforeSave1 = -> events.push('beforeSave1') - beforeSave2 = -> events.push('beforeSave2') - afterSave1 = -> events.push('afterSave1') - afterSave2 = -> events.push('afterSave2') - - buffer.on 'before-save', beforeSave1 - buffer.on 'before-save', beforeSave2 - spyOn(fs, 'write').andCallFake -> events.push 'fs.write' - buffer.on 'after-save', afterSave1 - buffer.on 'after-save', afterSave2 - - buffer.save() - expect(events).toEqual ['beforeSave1', 'beforeSave2', 'fs.write', 'afterSave1', 'afterSave2'] - - describe "when the buffer has no path", -> - it "throws an exception", -> - buffer = new Buffer - expect(-> buffer.save()).toThrow() - - describe "reload()", -> - it "loads text from disk are sets @modified and @modifiedOnDisk to false", -> - buffer.modified = true - buffer.modifiedOnDisk = true - buffer.setText("abc") - - buffer.reload() - expect(buffer.modifed).toBeFalsy() - expect(buffer.modifiedOnDisk).toBeFalsy() - expect(buffer.getText()).toBe(fileContents) - - describe ".saveAs(path)", -> - [filePath, saveAsBuffer] = [] - - afterEach -> - saveAsBuffer.release() - - it "saves the contents of the buffer to the path", -> - filePath = '/tmp/temp.txt' - fs.remove filePath if fs.exists(filePath) - - saveAsBuffer = new Buffer().retain() - eventHandler = jasmine.createSpy('eventHandler') - saveAsBuffer.on 'path-change', eventHandler - - saveAsBuffer.setText 'Buffer contents!' - saveAsBuffer.saveAs(filePath) - expect(fs.read(filePath)).toEqual 'Buffer contents!' - - expect(eventHandler).toHaveBeenCalledWith(saveAsBuffer) - - it "stops listening to events on previous path and begins listening to events on new path", -> - originalPath = "/tmp/original.txt" - newPath = "/tmp/new.txt" - fs.write(originalPath, "") - - saveAsBuffer = new Buffer(originalPath).retain() - changeHandler = jasmine.createSpy('changeHandler') - saveAsBuffer.on 'change', changeHandler - saveAsBuffer.saveAs(newPath) - expect(changeHandler).not.toHaveBeenCalled() - - fs.write(originalPath, "should not trigger buffer event") - waits 20 - runs -> - expect(changeHandler).not.toHaveBeenCalled() - fs.write(newPath, "should trigger buffer event") - - waitsFor -> - changeHandler.callCount > 0 - - describe ".getTextInRange(range)", -> - describe "when range is empty", -> - it "returns an empty string", -> - range = [[1,1], [1,1]] - expect(buffer.getTextInRange(range)).toBe "" - - describe "when range spans one line", -> - it "returns characters in range", -> - range = [[2,8], [2,13]] - expect(buffer.getTextInRange(range)).toBe "items" - - lineLength = buffer.lineForRow(2).length - range = [[2,0], [2,lineLength]] - expect(buffer.getTextInRange(range)).toBe " if (items.length <= 1) return items;" - - describe "when range spans multiple lines", -> - it "returns characters in range (including newlines)", -> - lineLength = buffer.lineForRow(2).length - range = [[2,0], [3,0]] - expect(buffer.getTextInRange(range)).toBe " if (items.length <= 1) return items;\n" - - lineLength = buffer.lineForRow(2).length - range = [[2,10], [4,10]] - expect(buffer.getTextInRange(range)).toBe "ems.length <= 1) return items;\n var pivot = items.shift(), current, left = [], right = [];\n while(" - - describe ".scanInRange(range, regex, fn)", -> - describe "when given a regex with no global flag", -> - it "calls the iterator with the first match for the given regex in the given range", -> - matches = [] - ranges = [] - buffer.scanInRange /cu(rr)ent/, [[4,0], [6,44]], (match, range) -> - matches.push(match) - ranges.push(range) - - expect(matches.length).toBe 1 - expect(ranges.length).toBe 1 - - expect(matches[0][0]).toBe 'current' - expect(matches[0][1]).toBe 'rr' - expect(ranges[0]).toEqual [[5,6], [5,13]] - - describe "when given a regex with a global flag", -> - it "calls the iterator with each match for the given regex in the given range", -> - matches = [] - ranges = [] - buffer.scanInRange /cu(rr)ent/g, [[4,0], [6,59]], (match, range) -> - matches.push(match) - ranges.push(range) - - expect(matches.length).toBe 3 - expect(ranges.length).toBe 3 - - expect(matches[0][0]).toBe 'current' - expect(matches[0][1]).toBe 'rr' - expect(ranges[0]).toEqual [[5,6], [5,13]] - - expect(matches[1][0]).toBe 'current' - expect(matches[1][1]).toBe 'rr' - expect(ranges[1]).toEqual [[6,6], [6,13]] - - expect(matches[2][0]).toBe 'current' - expect(matches[2][1]).toBe 'rr' - expect(ranges[2]).toEqual [[6,34], [6,41]] - - describe "when the last regex match exceeds the end of the range", -> - describe "when the portion of the match within the range also matches the regex", -> - it "calls the iterator with the truncated match", -> - matches = [] - ranges = [] - buffer.scanInRange /cu(r*)/g, [[4,0], [6,9]], (match, range) -> - matches.push(match) - ranges.push(range) - - expect(matches.length).toBe 2 - expect(ranges.length).toBe 2 - - expect(matches[0][0]).toBe 'curr' - expect(matches[0][1]).toBe 'rr' - expect(ranges[0]).toEqual [[5,6], [5,10]] - - expect(matches[1][0]).toBe 'cur' - expect(matches[1][1]).toBe 'r' - expect(ranges[1]).toEqual [[6,6], [6,9]] - - describe "when the portion of the match within the range does not matches the regex", -> - it "calls the iterator with the truncated match", -> - matches = [] - ranges = [] - buffer.scanInRange /cu(r*)e/g, [[4,0], [6,9]], (match, range) -> - matches.push(match) - ranges.push(range) - - expect(matches.length).toBe 1 - expect(ranges.length).toBe 1 - - expect(matches[0][0]).toBe 'curre' - expect(matches[0][1]).toBe 'rr' - expect(ranges[0]).toEqual [[5,6], [5,11]] - - describe "when the iterator calls the 'replace' control function with a replacement string", -> - it "replaces each occurrence of the regex match with the string", -> - ranges = [] - buffer.scanInRange /cu(rr)ent/g, [[4,0], [6,59]], (match, range, { replace }) -> - ranges.push(range) - replace("foo") - - expect(ranges[0]).toEqual [[5,6], [5,13]] - expect(ranges[1]).toEqual [[6,6], [6,13]] - expect(ranges[2]).toEqual [[6,30], [6,37]] - - expect(buffer.lineForRow(5)).toBe ' foo = items.shift();' - expect(buffer.lineForRow(6)).toBe ' foo < pivot ? left.push(foo) : right.push(current);' - - it "allows the match to be replaced with the empty string", -> - buffer.scanInRange /current/g, [[4,0], [6,59]], (match, range, { replace }) -> - replace("") - - expect(buffer.lineForRow(5)).toBe ' = items.shift();' - expect(buffer.lineForRow(6)).toBe ' < pivot ? left.push() : right.push(current);' - - describe "when the iterator calls the 'stop' control function", -> - it "stops the traversal", -> - ranges = [] - buffer.scanInRange /cu(rr)ent/g, [[4,0], [6,59]], (match, range, { stop }) -> - ranges.push(range) - stop() if ranges.length == 2 - - expect(ranges.length).toBe 2 - - describe ".backwardsScanInRange(range, regex, fn)", -> - describe "when given a regex with no global flag", -> - it "calls the iterator with the last match for the given regex in the given range", -> - matches = [] - ranges = [] - buffer.backwardsScanInRange /cu(rr)ent/, [[4,0], [6,44]], (match, range) -> - matches.push(match) - ranges.push(range) - - expect(matches.length).toBe 1 - expect(ranges.length).toBe 1 - - expect(matches[0][0]).toBe 'current' - expect(matches[0][1]).toBe 'rr' - expect(ranges[0]).toEqual [[6,34], [6,41]] - - describe "when given a regex with a global flag", -> - it "calls the iterator with each match for the given regex in the given range, starting with the last match", -> - matches = [] - ranges = [] - buffer.backwardsScanInRange /cu(rr)ent/g, [[4,0], [6,59]], (match, range) -> - matches.push(match) - ranges.push(range) - - expect(matches.length).toBe 3 - expect(ranges.length).toBe 3 - - expect(matches[0][0]).toBe 'current' - expect(matches[0][1]).toBe 'rr' - expect(ranges[0]).toEqual [[6,34], [6,41]] - - expect(matches[1][0]).toBe 'current' - expect(matches[1][1]).toBe 'rr' - expect(ranges[1]).toEqual [[6,6], [6,13]] - - expect(matches[2][0]).toBe 'current' - expect(matches[2][1]).toBe 'rr' - expect(ranges[2]).toEqual [[5,6], [5,13]] - - describe "when the iterator calls the 'replace' control function with a replacement string", -> - it "replaces each occurrence of the regex match with the string", -> - ranges = [] - buffer.backwardsScanInRange /cu(rr)ent/g, [[4,0], [6,59]], (match, range, { replace }) -> - ranges.push(range) - replace("foo") unless range.start.isEqual([6,6]) - - expect(ranges[0]).toEqual [[6,34], [6,41]] - expect(ranges[1]).toEqual [[6,6], [6,13]] - expect(ranges[2]).toEqual [[5,6], [5,13]] - - expect(buffer.lineForRow(5)).toBe ' foo = items.shift();' - expect(buffer.lineForRow(6)).toBe ' current < pivot ? left.push(foo) : right.push(current);' - - describe "when the iterator calls the 'stop' control function", -> - it "stops the traversal", -> - ranges = [] - buffer.backwardsScanInRange /cu(rr)ent/g, [[4,0], [6,59]], (match, range, { stop }) -> - ranges.push(range) - stop() if ranges.length == 2 - - expect(ranges.length).toBe 2 - expect(ranges[0]).toEqual [[6,34], [6,41]] - expect(ranges[1]).toEqual [[6,6], [6,13]] - - describe ".characterIndexForPosition(position)", -> - it "returns the total number of charachters that precede the given position", -> - expect(buffer.characterIndexForPosition([0, 0])).toBe 0 - expect(buffer.characterIndexForPosition([0, 1])).toBe 1 - expect(buffer.characterIndexForPosition([0, 29])).toBe 29 - expect(buffer.characterIndexForPosition([1, 0])).toBe 30 - expect(buffer.characterIndexForPosition([2, 0])).toBe 61 - expect(buffer.characterIndexForPosition([12, 2])).toBe 408 - - describe ".positionForCharacterIndex(position)", -> - it "returns the position based on charachter index", -> - expect(buffer.positionForCharacterIndex(0)).toEqual [0, 0] - expect(buffer.positionForCharacterIndex(1)).toEqual [0, 1] - expect(buffer.positionForCharacterIndex(29)).toEqual [0, 29] - expect(buffer.positionForCharacterIndex(30)).toEqual [1, 0] - expect(buffer.positionForCharacterIndex(61)).toEqual [2, 0] - expect(buffer.positionForCharacterIndex(408)).toEqual [12, 2] - - describe "anchors", -> - [anchor, destroyHandler] = [] - - beforeEach -> - destroyHandler = jasmine.createSpy("destroyHandler") - anchor = buffer.addAnchorAtPosition([4, 25]) - anchor.on 'destroy', destroyHandler - - describe "when a buffer change precedes an anchor", -> - it "moves the anchor in accordance with the change", -> - buffer.delete([[3, 0], [4, 10]]) - expect(anchor.getBufferPosition()).toEqual [3, 15] - expect(destroyHandler).not.toHaveBeenCalled() - - describe "when a buffer change surrounds an anchor", -> - it "destroys the anchor", -> - buffer.delete([[3, 0], [5, 0]]) - expect(destroyHandler).toHaveBeenCalled() - expect(buffer.getAnchors().indexOf(anchor)).toBe -1 diff --git a/spec/app/directory-spec.coffee b/spec/app/directory-spec.coffee deleted file mode 100644 index f42f65a34..000000000 --- a/spec/app/directory-spec.coffee +++ /dev/null @@ -1,67 +0,0 @@ -Directory = require 'directory' -fs = require 'fs' - -describe "Directory", -> - directory = null - - beforeEach -> - directory = new Directory(require.resolve('fixtures')) - - afterEach -> - directory.off() - - describe "when the contents of the directory change on disk", -> - temporaryFilePath = null - - beforeEach -> - temporaryFilePath = fs.join(require.resolve('fixtures'), 'temporary') - fs.remove(temporaryFilePath) if fs.exists(temporaryFilePath) - - afterEach -> - fs.remove(temporaryFilePath) if fs.exists(temporaryFilePath) - - it "triggers 'contents-change' event handlers", -> - changeHandler = null - - runs -> - changeHandler = jasmine.createSpy('changeHandler') - directory.on 'contents-change', changeHandler - fs.write(temporaryFilePath, '') - - waitsFor "first change", -> changeHandler.callCount > 0 - - runs -> - changeHandler.reset() - fs.remove(temporaryFilePath) - - waitsFor "second change", -> changeHandler.callCount > 0 - - describe "when the directory unsubscribes from events", -> - temporaryFilePath = null - - beforeEach -> - temporaryFilePath = fs.join(directory.path, 'temporary') - fs.remove(temporaryFilePath) if fs.exists(temporaryFilePath) - - afterEach -> - fs.remove(temporaryFilePath) if fs.exists(temporaryFilePath) - - it "no longer triggers events", -> - changeHandler = null - - runs -> - changeHandler = jasmine.createSpy('changeHandler') - directory.on 'contents-change', changeHandler - fs.write(temporaryFilePath, '') - - waitsFor "change event", -> changeHandler.callCount > 0 - - runs -> - changeHandler.reset() - directory.off() - waits 20 - - runs -> fs.remove(temporaryFilePath) - waits 20 - runs -> expect(changeHandler.callCount).toBe 0 - diff --git a/spec/app/display-buffer-spec.coffee b/spec/app/display-buffer-spec.coffee deleted file mode 100644 index 562501b2b..000000000 --- a/spec/app/display-buffer-spec.coffee +++ /dev/null @@ -1,651 +0,0 @@ -DisplayBuffer = require 'display-buffer' -Buffer = require 'buffer' - -describe "DisplayBuffer", -> - [editSession, displayBuffer, buffer, changeHandler, tabText] = [] - beforeEach -> - tabText = ' ' - editSession = fixturesProject.buildEditSessionForPath('sample.js', { tabText }) - { buffer, displayBuffer } = editSession - changeHandler = jasmine.createSpy 'changeHandler' - displayBuffer.on 'change', changeHandler - - afterEach -> - editSession.destroy() - - describe "when the buffer changes", -> - it "renders line numbers correctly", -> - originalLineCount = displayBuffer.lineCount() - oneHundredLines = [0..100].join("\n") - buffer.insert([0,0], oneHundredLines) - expect(displayBuffer.lineCount()).toBe 100 + originalLineCount - - describe "soft wrapping", -> - beforeEach -> - displayBuffer.setSoftWrapColumn(50) - changeHandler.reset() - - describe "rendering of soft-wrapped lines", -> - describe "when the line is shorter than the max line length", -> - it "renders the line unchanged", -> - expect(displayBuffer.lineForRow(0).text).toBe buffer.lineForRow(0) - - describe "when the line is empty", -> - it "renders the empty line", -> - expect(displayBuffer.lineForRow(13).text).toBe '' - - describe "when there is a non-whitespace character at the max length boundary", -> - describe "when there is whitespace before the boundary", -> - it "wraps the line at the end of the first whitespace preceding the boundary", -> - expect(displayBuffer.lineForRow(10).text).toBe ' return ' - expect(displayBuffer.lineForRow(11).text).toBe 'sort(left).concat(pivot).concat(sort(right));' - - describe "when there is no whitespace before the boundary", -> - it "wraps the line exactly at the boundary since there's no more graceful place to wrap it", -> - buffer.change([[0, 0], [1, 0]], 'abcdefghijklmnopqrstuvwxyz\n') - displayBuffer.setSoftWrapColumn(10) - expect(displayBuffer.lineForRow(0).text).toBe 'abcdefghij' - expect(displayBuffer.lineForRow(1).text).toBe 'klmnopqrst' - expect(displayBuffer.lineForRow(2).text).toBe 'uvwxyz' - - describe "when there is a whitespace character at the max length boundary", -> - it "wraps the line at the first non-whitespace character following the boundary", -> - expect(displayBuffer.lineForRow(3).text).toBe ' var pivot = items.shift(), current, left = [], ' - expect(displayBuffer.lineForRow(4).text).toBe 'right = [];' - - describe "when the buffer changes", -> - describe "when buffer lines are updated", -> - describe "when the update makes a soft-wrapped line shorter than the max line length", -> - it "rewraps the line and emits a change event", -> - buffer.delete([[6, 24], [6, 42]]) - expect(displayBuffer.lineForRow(7).text).toBe ' current < pivot ? : right.push(current);' - expect(displayBuffer.lineForRow(8).text).toBe ' }' - - expect(changeHandler).toHaveBeenCalled() - [[event]]= changeHandler.argsForCall - expect(event.oldRange).toEqual([[7, 0], [8, 20]]) - expect(event.newRange).toEqual([[7, 0], [7, 47]]) - expect(event.lineNumbersChanged).toBeTruthy() - - describe "when the update causes a line to softwrap an additional time", -> - it "rewraps the line and emits a change event", -> - buffer.insert([6, 28], '1234567890') - expect(displayBuffer.lineForRow(7).text).toBe ' current < pivot ? ' - expect(displayBuffer.lineForRow(8).text).toBe 'left1234567890.push(current) : ' - expect(displayBuffer.lineForRow(9).text).toBe 'right.push(current);' - expect(displayBuffer.lineForRow(10).text).toBe ' }' - - expect(changeHandler).toHaveBeenCalled() - [[event]] = changeHandler.argsForCall - expect(event.oldRange).toEqual([[7, 0], [8, 20]]) - expect(event.newRange).toEqual([[7, 0], [9, 20]]) - expect(event.lineNumbersChanged).toBeTruthy() - - describe "when buffer lines are inserted", -> - it "inserts / updates wrapped lines and emits a change event", -> - buffer.insert([6, 21], '1234567890 abcdefghij 1234567890\nabcdefghij') - expect(displayBuffer.lineForRow(7).text).toBe ' current < pivot1234567890 abcdefghij ' - expect(displayBuffer.lineForRow(8).text).toBe '1234567890' - expect(displayBuffer.lineForRow(9).text).toBe 'abcdefghij ? left.push(current) : ' - expect(displayBuffer.lineForRow(10).text).toBe 'right.push(current);' - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual([[7, 0], [8, 20]]) - expect(event.newRange).toEqual([[7, 0], [10, 20]]) - expect(event.lineNumbersChanged).toBeTruthy() - - describe "when buffer lines are removed", -> - it "removes lines and emits a change event", -> - buffer.change([[3, 21], [7, 5]], ';') - expect(displayBuffer.lineForRow(3).text).toBe ' var pivot = items;' - expect(displayBuffer.lineForRow(4).text).toBe ' return ' - expect(displayBuffer.lineForRow(5).text).toBe 'sort(left).concat(pivot).concat(sort(right));' - expect(displayBuffer.lineForRow(6).text).toBe ' };' - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual([[3, 0], [9, 5]]) - expect(event.newRange).toEqual([[3, 0], [3, 22]]) - expect(event.lineNumbersChanged).toBeTruthy() - - describe "position translation", -> - it "translates positions accounting for wrapped lines", -> - # before any wrapped lines - expect(displayBuffer.screenPositionForBufferPosition([0, 5])).toEqual([0, 5]) - expect(displayBuffer.bufferPositionForScreenPosition([0, 5])).toEqual([0, 5]) - expect(displayBuffer.screenPositionForBufferPosition([0, 29])).toEqual([0, 29]) - expect(displayBuffer.bufferPositionForScreenPosition([0, 29])).toEqual([0, 29]) - - # on a wrapped line - expect(displayBuffer.screenPositionForBufferPosition([3, 5])).toEqual([3, 5]) - expect(displayBuffer.bufferPositionForScreenPosition([3, 5])).toEqual([3, 5]) - expect(displayBuffer.screenPositionForBufferPosition([3, 50])).toEqual([3, 50]) - expect(displayBuffer.screenPositionForBufferPosition([3, 51])).toEqual([4, 0]) - expect(displayBuffer.bufferPositionForScreenPosition([4, 0])).toEqual([3, 51]) - expect(displayBuffer.bufferPositionForScreenPosition([3, 50])).toEqual([3, 50]) - expect(displayBuffer.screenPositionForBufferPosition([3, 62])).toEqual([4, 11]) - expect(displayBuffer.bufferPositionForScreenPosition([4, 11])).toEqual([3, 62]) - - # following a wrapped line - expect(displayBuffer.screenPositionForBufferPosition([4, 5])).toEqual([5, 5]) - expect(displayBuffer.bufferPositionForScreenPosition([5, 5])).toEqual([4, 5]) - - describe ".setSoftWrapColumn(length)", -> - it "changes the length at which lines are wrapped and emits a change event for all screen lines", -> - displayBuffer.setSoftWrapColumn(40) - expect(tokensText displayBuffer.lineForRow(4).tokens).toBe 'left = [], right = [];' - expect(tokensText displayBuffer.lineForRow(5).tokens).toBe ' while(items.length > 0) {' - expect(tokensText displayBuffer.lineForRow(12).tokens).toBe 'sort(left).concat(pivot).concat(sort(rig' - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual([[0, 0], [15, 2]]) - expect(event.newRange).toEqual([[0, 0], [18, 2]]) - expect(event.lineNumbersChanged).toBeTruthy() - - describe "structural folding", -> - describe "the foldable flag on screen lines", -> - it "sets 'foldable' to true for screen lines that start a foldable region", -> - expect(displayBuffer.lineForRow(0).foldable).toBeTruthy() - expect(displayBuffer.lineForRow(1).foldable).toBeTruthy() - expect(displayBuffer.lineForRow(2).foldable).toBeFalsy() - expect(displayBuffer.lineForRow(3).foldable).toBeFalsy() - - describe "when a foldable line is wrapped", -> - it "only marks the first screen line as foldable", -> - displayBuffer.setSoftWrapColumn(20) - expect(displayBuffer.lineForRow(0).foldable).toBeTruthy() - expect(displayBuffer.lineForRow(1).foldable).toBeFalsy() - expect(displayBuffer.lineForRow(2).foldable).toBeTruthy() - expect(displayBuffer.lineForRow(3).foldable).toBeFalsy() - - describe ".unfoldAll()", -> - it "unfolds every folded line", -> - displayBuffer.foldBufferRow(0) - displayBuffer.foldBufferRow(1) - - displayBuffer.unfoldAll() - expect(Object.keys(displayBuffer.activeFolds).length).toBe 0 - - describe ".foldAll()", -> - it "folds every foldable line", -> - displayBuffer.foldAll() - fold = displayBuffer.lineForRow(0).fold - expect(fold).toBeDefined() - expect([fold.startRow, fold.endRow]).toEqual [0,12] - - expect(Object.keys(displayBuffer.activeFolds).length).toBe(3) - expect(displayBuffer.activeFolds[1].length).toBe(1) - expect(displayBuffer.activeFolds[4].length).toBe(1) - - it "doesn't fold lines that are already folded", -> - displayBuffer.foldBufferRow(4) - displayBuffer.foldAll() - expect(Object.keys(displayBuffer.activeFolds).length).toBe(3) - expect(displayBuffer.activeFolds[0].length).toBe(1) - expect(displayBuffer.activeFolds[1].length).toBe(1) - expect(displayBuffer.activeFolds[4].length).toBe(1) - - describe ".foldBufferRow(bufferRow)", -> - describe "when bufferRow can be folded", -> - it "creates a fold based on the syntactic region starting at the given row", -> - displayBuffer.foldBufferRow(1) - fold = displayBuffer.lineForRow(1).fold - expect(fold.startRow).toBe 1 - expect(fold.endRow).toBe 9 - - describe "when bufferRow can't be folded", -> - it "searches upward for the first row that begins a syntatic region containing the given buffer row (and folds it)", -> - displayBuffer.foldBufferRow(8) - fold = displayBuffer.lineForRow(1).fold - expect(fold.startRow).toBe 1 - expect(fold.endRow).toBe 9 - - describe "when the bufferRow is already folded", -> - it "searches upward for the first row that begins a syntatic region containing the folded row (and folds it)", -> - displayBuffer.foldBufferRow(2) - expect(displayBuffer.lineForRow(1).fold).toBeDefined() - expect(displayBuffer.lineForRow(0).fold).not.toBeDefined() - - displayBuffer.foldBufferRow(1) - expect(displayBuffer.lineForRow(0).fold).toBeDefined() - - describe ".unfoldBufferRow(bufferRow)", -> - describe "when bufferRow can be unfolded", -> - it "destroys a fold based on the syntactic region starting at the given row", -> - displayBuffer.foldBufferRow(1) - expect(displayBuffer.lineForRow(1).fold).toBeDefined() - - displayBuffer.unfoldBufferRow(1) - expect(displayBuffer.lineForRow(1).fold).toBeUndefined() - - describe "when bufferRow can't be unfolded", -> - it "does not throw an error", -> - expect(displayBuffer.lineForRow(1).fold).toBeUndefined() - displayBuffer.unfoldBufferRow(1) - expect(displayBuffer.lineForRow(1).fold).toBeUndefined() - - describe "primitive folding", -> - editSession2 = null - - beforeEach -> - editSession2 = fixturesProject.buildEditSessionForPath('two-hundred.txt') - { buffer, displayBuffer } = editSession2 - displayBuffer.on 'change', changeHandler - - afterEach -> - editSession2.destroy() - - describe "when folds are created and destroyed", -> - describe "when a fold spans multiple lines", -> - it "replaces the lines spanned by the fold with a placeholder that references the fold object", -> - fold = displayBuffer.createFold(4, 7) - - [line4, line5] = displayBuffer.linesForRows(4, 5) - expect(line4.fold).toBe fold - expect(line4.text).toMatch /^4-+/ - expect(line4.bufferDelta).toEqual [4, 0] - expect(line4.screenDelta).toEqual [1, 0] - expect(line5.text).toBe '8' - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual [[4, 0], [7, 1]] - expect(event.newRange).toEqual [[4, 0], [4, 101]] - expect(event.lineNumbersChanged).toBeTruthy() - changeHandler.reset() - - fold.destroy() - [line4, line5] = displayBuffer.linesForRows(4, 5) - expect(line4.fold).toBeUndefined() - expect(line4.text).toMatch /^4-+/ - expect(line4.bufferDelta).toEqual [1, 0] - expect(line4.screenDelta).toEqual [1, 0] - expect(line5.text).toBe '5' - - expect(changeHandler).toHaveBeenCalled() - [[event]] = changeHandler.argsForCall - expect(event.oldRange).toEqual [[4, 0], [4, 101]] - expect(event.newRange).toEqual [[4, 0], [7, 1]] - expect(event.lineNumbersChanged).toBeTruthy() - - describe "when a fold spans a single line", -> - it "renders a fold placeholder for the folded line but does not skip any lines", -> - fold = displayBuffer.createFold(4, 4) - - [line4, line5] = displayBuffer.linesForRows(4, 5) - expect(line4.fold).toBe fold - expect(line4.text).toMatch /^4-+/ - expect(line4.bufferDelta).toEqual [1, 0] - expect(line4.screenDelta).toEqual [1, 0] - expect(line5.text).toBe '5' - - expect(changeHandler).toHaveBeenCalled() - [[event]] = changeHandler.argsForCall - expect(event.oldRange).toEqual [[4, 0], [4, 101]] - expect(event.newRange).toEqual [[4, 0], [4, 101]] - - # Line numbers don't actually change, but it's not worth the complexity to have this - # be false for single line folds since they are so rare - expect(event.lineNumbersChanged).toBeTruthy() - changeHandler.reset() - - fold.destroy() - - [line4, line5] = displayBuffer.linesForRows(4, 5) - expect(line4.fold).toBeUndefined() - expect(line4.text).toMatch /^4-+/ - expect(line4.bufferDelta).toEqual [1, 0] - expect(line4.screenDelta).toEqual [1, 0] - expect(line5.text).toBe '5' - - expect(changeHandler).toHaveBeenCalled() - [[event]] = changeHandler.argsForCall - expect(event.oldRange).toEqual [[4, 0], [4, 101]] - expect(event.newRange).toEqual [[4, 0], [4, 101]] - expect(event.lineNumbersChanged).toBeTruthy() - changeHandler.reset() - - describe "when a fold is nested within another fold", -> - it "does not render the placeholder for the inner fold until the outer fold is destroyed", -> - innerFold = displayBuffer.createFold(6, 7) - outerFold = displayBuffer.createFold(4, 8) - - [line4, line5] = displayBuffer.linesForRows(4, 5) - expect(line4.fold).toBe outerFold - expect(line4.text).toMatch /4-+/ - expect(line4.bufferDelta).toEqual [5, 0] - expect(line4.screenDelta).toEqual [1, 0] - expect(line5.text).toMatch /9-+/ - - outerFold.destroy() - - [line4, line5, line6, line7] = displayBuffer.linesForRows(4, 7) - expect(line4.fold).toBeUndefined() - expect(line4.text).toMatch /^4-+/ - expect(line4.bufferDelta).toEqual [1, 0] - expect(line4.screenDelta).toEqual [1, 0] - expect(line5.text).toBe '5' - expect(line6.fold).toBe innerFold - expect(line6.text).toBe '6' - expect(line6.bufferDelta).toEqual [2, 0] - expect(line6.screenDelta).toEqual [1, 0] - expect(line7.text).toBe '8' - - it "allows the outer fold to start at the same location as the inner fold", -> - innerFold = displayBuffer.createFold(4, 6) - outerFold = displayBuffer.createFold(4, 8) - - [line4, line5] = displayBuffer.linesForRows(4, 5) - expect(line4.fold).toBe outerFold - expect(line4.text).toMatch /4-+/ - expect(line4.bufferDelta).toEqual [5, 0] - expect(line4.screenDelta).toEqual [1, 0] - expect(line5.text).toMatch /9-+/ - - describe "when creating a fold where one already exists", -> - it "returns existing fold and does't create new fold", -> - fold = displayBuffer.createFold(0,10) - expect(displayBuffer.activeFolds[0].length).toBe 1 - - newFold = displayBuffer.createFold(0,10) - expect(newFold).toBe fold - expect(displayBuffer.activeFolds[0].length).toBe 1 - - describe "when a fold is created inside an existing folded region", -> - it "creates/destroys the fold, but does not trigger change event", -> - outerFold = displayBuffer.createFold(0, 10) - changeHandler.reset() - - innerFold = displayBuffer.createFold(2, 5) - expect(changeHandler).not.toHaveBeenCalled() - [line0, line1] = displayBuffer.linesForRows(0, 1) - expect(line0.fold).toBe outerFold - expect(line1.fold).toBeUndefined() - - changeHandler.reset() - innerFold.destroy() - expect(changeHandler).not.toHaveBeenCalled() - [line0, line1] = displayBuffer.linesForRows(0, 1) - expect(line0.fold).toBe outerFold - expect(line1.fold).toBeUndefined() - - describe "when the buffer changes", -> - [fold1, fold2] = [] - beforeEach -> - fold1 = displayBuffer.createFold(2, 4) - fold2 = displayBuffer.createFold(6, 8) - changeHandler.reset() - - describe "when the old range surrounds a fold", -> - it "removes the fold and replaces the selection with the new text", -> - buffer.change([[1, 0], [5, 1]], 'party!') - - expect(displayBuffer.lineForRow(0).text).toBe "0" - expect(displayBuffer.lineForRow(1).text).toBe "party!" - expect(displayBuffer.lineForRow(2).fold).toBe fold2 - expect(displayBuffer.lineForRow(3).text).toMatch /^9-+/ - - expect(changeHandler).toHaveBeenCalled() - [[event]] = changeHandler.argsForCall - expect(event.oldRange).toEqual [[1, 0], [3, 1]] - expect(event.newRange).toEqual [[1, 0], [1, 6]] - expect(event.lineNumbersChanged).toBeTruthy() - - describe "when the old range surrounds two nested folds", -> - it "removes both folds and replaces the selection with the new text", -> - displayBuffer.createFold(2, 9) - changeHandler.reset() - - buffer.change([[1, 0], [10, 0]], 'goodbye') - - expect(displayBuffer.lineForRow(0).text).toBe "0" - expect(displayBuffer.lineForRow(1).text).toBe "goodbye10" - expect(displayBuffer.lineForRow(2).text).toBe "11" - - expect(changeHandler).toHaveBeenCalled() - [[event]] = changeHandler.argsForCall - expect(event.oldRange).toEqual [[1, 0], [3, 2]] - expect(event.newRange).toEqual [[1, 0], [1, 9]] - expect(event.lineNumbersChanged).toBeTruthy() - - describe "when multiple changes happen above the fold", -> - it "repositions folds correctly", -> - buffer.delete([[1, 1], [2, 0]]) - buffer.insert([0, 1], "\nnew") - - expect(fold1.startRow).toBe 2 - expect(fold1.endRow).toBe 4 - - describe "when the old range precedes lines with a fold", -> - describe "when the new range precedes lines with a fold", -> - it "updates the buffer and re-positions subsequent folds", -> - buffer.change([[0, 0], [1, 1]], 'abc') - - expect(displayBuffer.lineForRow(0).text).toBe "abc" - expect(displayBuffer.lineForRow(1).fold).toBe fold1 - expect(displayBuffer.lineForRow(2).text).toBe "5" - expect(displayBuffer.lineForRow(3).fold).toBe fold2 - expect(displayBuffer.lineForRow(4).text).toMatch /^9-+/ - - expect(changeHandler).toHaveBeenCalled() - [[event]] = changeHandler.argsForCall - expect(event.oldRange).toEqual [[0, 0], [1, 1]] - expect(event.newRange).toEqual [[0, 0], [0, 3]] - expect(event.lineNumbersChanged).toBeTruthy() - changeHandler.reset() - - fold1.destroy() - expect(displayBuffer.lineForRow(0).text).toBe "abc" - expect(displayBuffer.lineForRow(1).text).toBe "2" - expect(displayBuffer.lineForRow(3).text).toMatch /^4-+/ - expect(displayBuffer.lineForRow(4).text).toBe "5" - expect(displayBuffer.lineForRow(5).fold).toBe fold2 - expect(displayBuffer.lineForRow(6).text).toMatch /^9-+/ - - expect(changeHandler).toHaveBeenCalled() - [[event]] = changeHandler.argsForCall - expect(event.oldRange).toEqual [[1, 0], [1, 1]] - expect(event.newRange).toEqual [[1, 0], [3, 101]] - expect(event.lineNumbersChanged).toBeTruthy() - - describe "when the old range straddles the beginning of a fold", -> - it "replaces lines in the portion of the range that precedes the fold and adjusts the end of the fold to encompass additional lines", -> - buffer.change([[1, 1], [3, 0]], "a\nb\nc\nd\n") - - expect(fold1.startRow).toBe 2 - expect(fold1.endRow).toBe 6 - - expect(displayBuffer.lineForRow(1).text).toBe '1a' - expect(displayBuffer.lineForRow(2).text).toBe 'b' - expect(displayBuffer.lineForRow(2).fold).toBe fold1 - - describe "when the old range follows a fold", -> - it "re-positions the screen ranges for the change event based on the preceding fold", -> - buffer.change([[10, 0], [11, 0]], 'abc') - - expect(displayBuffer.lineForRow(1).text).toBe "1" - expect(displayBuffer.lineForRow(2).fold).toBe fold1 - expect(displayBuffer.lineForRow(3).text).toBe "5" - expect(displayBuffer.lineForRow(4).fold).toBe fold2 - expect(displayBuffer.lineForRow(5).text).toMatch /^9-+/ - - expect(changeHandler).toHaveBeenCalled() - [[event]] = changeHandler.argsForCall - expect(event.oldRange).toEqual [[6, 0], [7, 2]] # Expands ranges to encompes entire line - expect(event.newRange).toEqual [[6, 0], [6, 5]] - expect(event.lineNumbersChanged).toBeTruthy() - - describe "when the old range is inside a fold", -> - describe "when the end of the new range precedes the end of the fold", -> - it "updates the fold and ensures the change is present when the fold is destroyed", -> - buffer.insert([3, 0], '\n') - expect(fold1.startRow).toBe 2 - expect(fold1.endRow).toBe 5 - - expect(displayBuffer.lineForRow(1).text).toBe "1" - expect(displayBuffer.lineForRow(2).text).toBe "2" - expect(displayBuffer.lineForRow(2).fold).toBe fold1 - expect(displayBuffer.lineForRow(2).bufferDelta).toEqual [4, 0] - expect(displayBuffer.lineForRow(3).text).toMatch "5" - expect(displayBuffer.lineForRow(4).fold).toBe fold2 - expect(displayBuffer.lineForRow(5).text).toMatch /^9-+/ - - expect(changeHandler).toHaveBeenCalled() - [[event]] = changeHandler.argsForCall - expect(event.oldRange).toEqual [[2, 0], [2, 1]] - expect(event.newRange).toEqual [[2, 0], [2, 1]] - expect(event.lineNumbersChanged).toBeTruthy() - - describe "when the end of the new range exceeds the end of the fold", -> - it "expands the fold to contain all the inserted lines", -> - buffer.change([[3, 0], [4, 0]], 'a\nb\nc\nd\n') - expect(fold1.startRow).toBe 2 - expect(fold1.endRow).toBe 7 - - expect(displayBuffer.lineForRow(1).text).toBe "1" - expect(displayBuffer.lineForRow(2).text).toBe "2" - expect(displayBuffer.lineForRow(2).fold).toBe fold1 - expect(displayBuffer.lineForRow(2).bufferDelta).toEqual [6, 0] - expect(displayBuffer.lineForRow(3).text).toMatch "5" - expect(displayBuffer.lineForRow(4).fold).toBe fold2 - expect(displayBuffer.lineForRow(5).text).toMatch /^9-+/ - - expect(changeHandler).toHaveBeenCalled() - [[event]] = changeHandler.argsForCall - expect(event.oldRange).toEqual [[2, 0], [2, 1]] - expect(event.newRange).toEqual [[2, 0], [2, 1]] - expect(event.lineNumbersChanged).toBeTruthy() - - describe "when the old range straddles the end of the fold", -> - describe "when the end of the new range precedes the end of the fold", -> - it "shortens the fold so its end matches the end of the new range", -> - fold2.destroy() - buffer.change([[3, 0], [6, 0]], 'a\n') - - expect(fold1.startRow).toBe 2 - expect(fold1.endRow).toBe 4 - - describe "when the old range is contained to a single line in-between two folds", -> - it "re-renders the line with the placeholder and re-positions the second fold", -> - buffer.insert([5, 0], 'abc\n') - - expect(displayBuffer.lineForRow(1).text).toBe "1" - expect(displayBuffer.lineForRow(2).fold).toBe fold1 - expect(displayBuffer.lineForRow(3).text).toMatch "abc" - expect(displayBuffer.lineForRow(4).text).toBe "5" - expect(displayBuffer.lineForRow(5).fold).toBe fold2 - expect(displayBuffer.lineForRow(6).text).toMatch /^9-+/ - - expect(changeHandler).toHaveBeenCalled() - [[event]] = changeHandler.argsForCall - expect(event.oldRange).toEqual [[3, 0], [3, 1]] - expect(event.newRange).toEqual [[3, 0], [4, 1]] - expect(event.lineNumbersChanged).toBeTruthy() - - describe "position translation", -> - it "translates positions to account for folded lines and characters and the placeholder", -> - displayBuffer.createFold(4, 7) - - # preceding fold: identity - expect(displayBuffer.screenPositionForBufferPosition([3, 0])).toEqual [3, 0] - expect(displayBuffer.screenPositionForBufferPosition([4, 0])).toEqual [4, 0] - - expect(displayBuffer.bufferPositionForScreenPosition([3, 0])).toEqual [3, 0] - expect(displayBuffer.bufferPositionForScreenPosition([4, 0])).toEqual [4, 0] - - # inside of fold: translate to the start of the fold - expect(displayBuffer.screenPositionForBufferPosition([4, 35])).toEqual [4, 0] - expect(displayBuffer.screenPositionForBufferPosition([5, 5])).toEqual [4, 0] - - # following fold - expect(displayBuffer.screenPositionForBufferPosition([8, 0])).toEqual [5, 0] - expect(displayBuffer.screenPositionForBufferPosition([11, 2])).toEqual [8, 2] - - expect(displayBuffer.bufferPositionForScreenPosition([5, 0])).toEqual [8, 0] - expect(displayBuffer.bufferPositionForScreenPosition([9, 2])).toEqual [12, 2] - - describe ".destroyFoldsContainingBufferRow(row)", -> - it "destroys all folds containing the given row", -> - displayBuffer.createFold(2, 4) - displayBuffer.createFold(2, 6) - displayBuffer.createFold(7, 8) - displayBuffer.createFold(1, 9) - displayBuffer.createFold(11, 12) - - expect(displayBuffer.lineForRow(1).text).toBe '1' - expect(displayBuffer.lineForRow(2).text).toBe '10' - - displayBuffer.destroyFoldsContainingBufferRow(2) - expect(displayBuffer.lineForRow(1).text).toBe '1' - expect(displayBuffer.lineForRow(2).text).toBe '2' - expect(displayBuffer.lineForRow(7).fold).toBeDefined() - expect(displayBuffer.lineForRow(8).text).toMatch /^9-+/ - expect(displayBuffer.lineForRow(10).fold).toBeDefined() - - describe ".clipScreenPosition(screenPosition, wrapBeyondNewlines: false, wrapAtSoftNewlines: false, skipAtomicTokens: false)", -> - beforeEach -> - displayBuffer.setSoftWrapColumn(50) - - it "allows valid positions", -> - expect(displayBuffer.clipScreenPosition([4, 5])).toEqual [4, 5] - expect(displayBuffer.clipScreenPosition([4, 11])).toEqual [4, 11] - - it "disallows negative positions", -> - expect(displayBuffer.clipScreenPosition([-1, -1])).toEqual [0, 0] - expect(displayBuffer.clipScreenPosition([-1, 10])).toEqual [0, 0] - expect(displayBuffer.clipScreenPosition([0, -1])).toEqual [0, 0] - - it "disallows positions beyond the last row", -> - expect(displayBuffer.clipScreenPosition([1000, 0])).toEqual [15, 2] - expect(displayBuffer.clipScreenPosition([1000, 1000])).toEqual [15, 2] - - describe "when wrapBeyondNewlines is false (the default)", -> - it "wraps positions beyond the end of hard newlines to the end of the line", -> - expect(displayBuffer.clipScreenPosition([1, 10000])).toEqual [1, 30] - expect(displayBuffer.clipScreenPosition([4, 30])).toEqual [4, 11] - expect(displayBuffer.clipScreenPosition([4, 1000])).toEqual [4, 11] - - describe "when wrapBeyondNewlines is true", -> - it "wraps positions past the end of hard newlines to the next line", -> - expect(displayBuffer.clipScreenPosition([0, 29], wrapBeyondNewlines: true)).toEqual [0, 29] - expect(displayBuffer.clipScreenPosition([0, 30], wrapBeyondNewlines: true)).toEqual [1, 0] - expect(displayBuffer.clipScreenPosition([0, 1000], wrapBeyondNewlines: true)).toEqual [1, 0] - - it "wraps positions in the middle of fold lines to the next screen line", -> - displayBuffer.createFold(3, 5) - expect(displayBuffer.clipScreenPosition([3, 5], wrapBeyondNewlines: true)).toEqual [4, 0] - - describe "when wrapAtSoftNewlines is false (the default)", -> - it "clips positions at the end of soft-wrapped lines to the character preceding the end of the line", -> - expect(displayBuffer.clipScreenPosition([3, 50])).toEqual [3, 50] - expect(displayBuffer.clipScreenPosition([3, 51])).toEqual [3, 50] - expect(displayBuffer.clipScreenPosition([3, 58])).toEqual [3, 50] - expect(displayBuffer.clipScreenPosition([3, 1000])).toEqual [3, 50] - - describe "when wrapAtSoftNewlines is true", -> - it "wraps positions at the end of soft-wrapped lines to the next screen line", -> - expect(displayBuffer.clipScreenPosition([3, 50], wrapAtSoftNewlines: true)).toEqual [3, 50] - expect(displayBuffer.clipScreenPosition([3, 51], wrapAtSoftNewlines: true)).toEqual [4, 0] - expect(displayBuffer.clipScreenPosition([3, 58], wrapAtSoftNewlines: true)).toEqual [4, 0] - expect(displayBuffer.clipScreenPosition([3, 1000], wrapAtSoftNewlines: true)).toEqual [4, 0] - - describe "when skipAtomicTokens is false (the default)", -> - it "clips screen positions in the middle of atomic tab characters to the beginning of the character", -> - buffer.insert([0, 0], '\t') - expect(displayBuffer.clipScreenPosition([0, 0])).toEqual [0, 0] - expect(displayBuffer.clipScreenPosition([0, 1])).toEqual [0, 0] - expect(displayBuffer.clipScreenPosition([0, tabText.length])).toEqual [0, tabText.length] - - describe "when skipAtomicTokens is true", -> - it "clips screen positions in the middle of atomic tab characters to the end of the character", -> - buffer.insert([0, 0], '\t') - expect(displayBuffer.clipScreenPosition([0, 0], skipAtomicTokens: true)).toEqual [0, 0] - expect(displayBuffer.clipScreenPosition([0, 1], skipAtomicTokens: true)).toEqual [0, tabText.length] - expect(displayBuffer.clipScreenPosition([0, tabText.length], skipAtomicTokens: true)).toEqual [0, tabText.length] - - describe ".maxLineLength()", -> - it "returns the length of the longest screen line", -> - expect(displayBuffer.maxLineLength()).toBe 65 - diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee deleted file mode 100644 index 6b0c0dcc2..000000000 --- a/spec/app/edit-session-spec.coffee +++ /dev/null @@ -1,1463 +0,0 @@ -Project = require 'project' -Buffer = require 'buffer' -EditSession = require 'edit-session' - -describe "EditSession", -> - [buffer, editSession, lineLengths] = [] - - beforeEach -> - buffer = new Buffer() - editSession = fixturesProject.buildEditSessionForPath('sample.js', autoIndent: false) - buffer = editSession.buffer - lineLengths = buffer.getLines().map (line) -> line.length - - afterEach -> - fixturesProject.destroy() - - describe "cursor movement", -> - describe ".setCursorScreenPosition(screenPosition)", -> - it "clears a goal column established by vertical movement", -> - # set a goal column by moving down - editSession.setCursorScreenPosition(row: 3, column: lineLengths[3]) - editSession.moveCursorDown() - expect(editSession.getCursorScreenPosition().column).not.toBe 6 - - # clear the goal column by explicitly setting the cursor position - editSession.setCursorScreenPosition([4,6]) - expect(editSession.getCursorScreenPosition().column).toBe 6 - - editSession.moveCursorDown() - expect(editSession.getCursorScreenPosition().column).toBe 6 - - it "merges multiple cursors", -> - editSession.setCursorScreenPosition([0, 0]) - editSession.addCursorAtScreenPosition([0, 1]) - [cursor1, cursor2] = editSession.getCursors() - editSession.setCursorScreenPosition([4, 7]) - expect(editSession.getCursors().length).toBe 1 - expect(editSession.getCursors()).toEqual [cursor1] - expect(editSession.getCursorScreenPosition()).toEqual [4, 7] - - describe "when soft-wrap is enabled and code is folded", -> - beforeEach -> - editSession.setSoftWrapColumn(50) - editSession.createFold(2, 3) - - it "positions the cursor at the buffer position that corresponds to the given screen position", -> - editSession.setCursorScreenPosition([9, 0]) - expect(editSession.getCursorBufferPosition()).toEqual [8, 11] - - describe ".moveCursorUp()", -> - it "moves the cursor up", -> - editSession.setCursorScreenPosition([2, 2]) - editSession.moveCursorUp() - expect(editSession.getCursorScreenPosition()).toEqual [1, 2] - - it "retains the goal column across lines of differing length", -> - expect(lineLengths[6]).toBeGreaterThan(32) - editSession.setCursorScreenPosition(row: 6, column: 32) - - editSession.moveCursorUp() - expect(editSession.getCursorScreenPosition().column).toBe lineLengths[5] - - editSession.moveCursorUp() - expect(editSession.getCursorScreenPosition().column).toBe lineLengths[4] - - editSession.moveCursorUp() - expect(editSession.getCursorScreenPosition().column).toBe 32 - - describe "when the cursor is on the first line", -> - it "moves the cursor to the beginning of the line, but retains the goal column", -> - editSession.setCursorScreenPosition(row: 0, column: 4) - editSession.moveCursorUp() - expect(editSession.getCursorScreenPosition()).toEqual(row: 0, column: 0) - - editSession.moveCursorDown() - expect(editSession.getCursorScreenPosition()).toEqual(row: 1, column: 4) - - it "merges cursors when they overlap", -> - editSession.addCursorAtScreenPosition([1, 0]) - [cursor1, cursor2] = editSession.getCursors() - - editSession.moveCursorUp() - expect(editSession.getCursors()).toEqual [cursor1] - expect(cursor1.getBufferPosition()).toEqual [0,0] - - describe ".moveCursorDown()", -> - it "moves the cursor down", -> - editSession.setCursorScreenPosition([2, 2]) - editSession.moveCursorDown() - expect(editSession.getCursorScreenPosition()).toEqual [3, 2] - - it "retains the goal column across lines of differing length", -> - editSession.setCursorScreenPosition(row: 3, column: lineLengths[3]) - - editSession.moveCursorDown() - expect(editSession.getCursorScreenPosition().column).toBe lineLengths[4] - - editSession.moveCursorDown() - expect(editSession.getCursorScreenPosition().column).toBe lineLengths[5] - - editSession.moveCursorDown() - expect(editSession.getCursorScreenPosition().column).toBe lineLengths[3] - - describe "when the cursor is on the last line", -> - it "moves the cursor to the end of line, but retains the goal column when moving back up", -> - lastLineIndex = buffer.getLines().length - 1 - lastLine = buffer.lineForRow(lastLineIndex) - expect(lastLine.length).toBeGreaterThan(0) - - editSession.setCursorScreenPosition(row: lastLineIndex, column: 1) - editSession.moveCursorDown() - expect(editSession.getCursorScreenPosition()).toEqual(row: lastLineIndex, column: lastLine.length) - - editSession.moveCursorUp() - expect(editSession.getCursorScreenPosition().column).toBe 1 - - it "retains a goal column of 0 when moving back up", -> - lastLineIndex = buffer.getLines().length - 1 - lastLine = buffer.lineForRow(lastLineIndex) - expect(lastLine.length).toBeGreaterThan(0) - - editSession.setCursorScreenPosition(row: lastLineIndex, column: 0) - editSession.moveCursorDown() - editSession.moveCursorUp() - expect(editSession.getCursorScreenPosition().column).toBe 0 - - it "merges cursors when they overlap", -> - editSession.setCursorScreenPosition([12, 2]) - editSession.addCursorAtScreenPosition([11, 2]) - [cursor1, cursor2] = editSession.getCursors() - - editSession.moveCursorDown() - expect(editSession.getCursors()).toEqual [cursor1] - expect(cursor1.getBufferPosition()).toEqual [12,2] - - describe ".moveCursorLeft()", -> - it "moves the cursor by one column to the left", -> - editSession.setCursorScreenPosition([3, 3]) - editSession.moveCursorLeft() - expect(editSession.getCursorScreenPosition()).toEqual [3, 2] - - describe "when the cursor is in the first column", -> - describe "when there is a previous line", -> - it "wraps to the end of the previous line", -> - editSession.setCursorScreenPosition(row: 1, column: 0) - editSession.moveCursorLeft() - expect(editSession.getCursorScreenPosition()).toEqual(row: 0, column: buffer.lineForRow(0).length) - - describe "when the cursor is on the first line", -> - it "remains in the same position (0,0)", -> - editSession.setCursorScreenPosition(row: 0, column: 0) - editSession.moveCursorLeft() - expect(editSession.getCursorScreenPosition()).toEqual(row: 0, column: 0) - - it "merges cursors when they overlap", -> - editSession.setCursorScreenPosition([0, 0]) - editSession.addCursorAtScreenPosition([0, 1]) - - [cursor1, cursor2] = editSession.getCursors() - editSession.moveCursorLeft() - expect(editSession.getCursors()).toEqual [cursor1] - expect(cursor1.getBufferPosition()).toEqual [0,0] - - describe ".moveCursorRight()", -> - it "moves the cursor by one column to the right", -> - editSession.setCursorScreenPosition([3, 3]) - editSession.moveCursorRight() - expect(editSession.getCursorScreenPosition()).toEqual [3, 4] - - describe "when the cursor is on the last column of a line", -> - describe "when there is a subsequent line", -> - it "wraps to the beginning of the next line", -> - editSession.setCursorScreenPosition(row: 0, column: buffer.lineForRow(0).length) - editSession.moveCursorRight() - expect(editSession.getCursorScreenPosition()).toEqual(row: 1, column: 0) - - describe "when the cursor is on the last line", -> - it "remains in the same position", -> - lastLineIndex = buffer.getLines().length - 1 - lastLine = buffer.lineForRow(lastLineIndex) - expect(lastLine.length).toBeGreaterThan(0) - - lastPosition = { row: lastLineIndex, column: lastLine.length } - editSession.setCursorScreenPosition(lastPosition) - editSession.moveCursorRight() - - expect(editSession.getCursorScreenPosition()).toEqual(lastPosition) - - it "merges cursors when they overlap", -> - editSession.setCursorScreenPosition([12, 2]) - editSession.addCursorAtScreenPosition([12, 1]) - [cursor1, cursor2] = editSession.getCursors() - - editSession.moveCursorRight() - expect(editSession.getCursors()).toEqual [cursor1] - expect(cursor1.getBufferPosition()).toEqual [12,2] - - describe ".moveCursorToTop()", -> - it "moves the cursor to the top of the buffer", -> - editSession.setCursorScreenPosition [11,1] - editSession.addCursorAtScreenPosition [12,0] - editSession.moveCursorToTop() - expect(editSession.getCursors().length).toBe 1 - expect(editSession.getCursorBufferPosition()).toEqual [0,0] - - describe ".moveCursorToBottom()", -> - it "moves the cusor to the bottom of the buffer", -> - editSession.setCursorScreenPosition [0,0] - editSession.addCursorAtScreenPosition [1,0] - editSession.moveCursorToBottom() - expect(editSession.getCursors().length).toBe 1 - expect(editSession.getCursorBufferPosition()).toEqual [12,2] - - describe ".moveCursorToBeginningOfLine()", -> - it "moves cursor to the beginning of line", -> - editSession.setCursorScreenPosition [0,5] - editSession.addCursorAtScreenPosition [1,7] - editSession.moveCursorToBeginningOfLine() - expect(editSession.getCursors().length).toBe 2 - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,0] - expect(cursor2.getBufferPosition()).toEqual [1,0] - - describe ".moveCursorToEndOfLine()", -> - it "moves cursor to the end of line", -> - editSession.setCursorScreenPosition [0,0] - editSession.addCursorAtScreenPosition [1,0] - editSession.moveCursorToEndOfLine() - expect(editSession.getCursors().length).toBe 2 - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,29] - expect(cursor2.getBufferPosition()).toEqual [1,30] - - describe ".moveCursorToFirstCharacterOfLine()", -> - it "moves to the first character of the current line or the beginning of the line if it's already on the first character", -> - editSession.setCursorScreenPosition [0,5] - editSession.addCursorAtScreenPosition [1,7] - - editSession.moveCursorToFirstCharacterOfLine() - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,0] - expect(cursor2.getBufferPosition()).toEqual [1,2] - - editSession.moveCursorToFirstCharacterOfLine() - expect(cursor1.getBufferPosition()).toEqual [0,0] - expect(cursor2.getBufferPosition()).toEqual [1,0] - - it "does not throw an exception on an empty line", -> - editSession.setCursorBufferPosition([10, 0]) - editSession.moveCursorToFirstCharacterOfLine() - - describe ".moveCursorToNextWord()", -> - it "moves the cursor to the next word or the end of file if there is no next word", -> - editSession.setCursorBufferPosition [2, 5] - editSession.addCursorAtBufferPosition [3, 60] - [cursor1, cursor2] = editSession.getCursors() - - editSession.moveCursorToNextWord() - expect(cursor1.getBufferPosition()).toEqual [2, 7] - expect(cursor2.getBufferPosition()).toEqual [4, 4] - - buffer.insert([12, 2], ' ') - cursor1.setBufferPosition([12, 1]) - editSession.moveCursorToNextWord() - expect(cursor1.getBufferPosition()).toEqual [12, 5] - - describe ".moveCursorToBeginningOfWord()", -> - it "moves the cursor to the beginning of the word", -> - editSession.setCursorBufferPosition [0, 8] - editSession.addCursorAtBufferPosition [1, 12] - editSession.addCursorAtBufferPosition [3, 0] - [cursor1, cursor2, cursor3] = editSession.getCursors() - - editSession.moveCursorToBeginningOfWord() - - expect(cursor1.getBufferPosition()).toEqual [0, 4] - expect(cursor2.getBufferPosition()).toEqual [1, 11] - expect(cursor3.getBufferPosition()).toEqual [2, 39] - - it "does not fail at position [0, 0]", -> - editSession.setCursorBufferPosition([0, 0]) - editSession.moveCursorToBeginningOfWord() - - describe ".moveCursorToEndOfWord()", -> - it "moves the cursor to the end of the word", -> - editSession.setCursorBufferPosition [0, 6] - editSession.addCursorAtBufferPosition [1, 10] - editSession.addCursorAtBufferPosition [2, 40] - [cursor1, cursor2, cursor3] = editSession.getCursors() - - editSession.moveCursorToEndOfWord() - - expect(cursor1.getBufferPosition()).toEqual [0, 13] - expect(cursor2.getBufferPosition()).toEqual [1, 12] - expect(cursor3.getBufferPosition()).toEqual [3, 7] - - describe "selection", -> - selection = null - - beforeEach -> - selection = editSession.getSelection() - - describe ".selectUp/Down/Left/Right()", -> - it "expands each selection to its cursor's new location", -> - editSession.setSelectedBufferRanges([[[0,9], [0,13]], [[3,16], [3,21]]]) - [selection1, selection2] = editSession.getSelections() - - editSession.selectRight() - expect(selection1.getBufferRange()).toEqual [[0,9], [0,14]] - expect(selection2.getBufferRange()).toEqual [[3,16], [3,22]] - - editSession.selectLeft() - editSession.selectLeft() - expect(selection1.getBufferRange()).toEqual [[0,9], [0,12]] - expect(selection2.getBufferRange()).toEqual [[3,16], [3,20]] - - editSession.selectDown() - expect(selection1.getBufferRange()).toEqual [[0,9], [1,12]] - expect(selection2.getBufferRange()).toEqual [[3,16], [4,20]] - - editSession.selectUp() - expect(selection1.getBufferRange()).toEqual [[0,9], [0,12]] - expect(selection2.getBufferRange()).toEqual [[3,16], [3,20]] - - it "merges selections when they intersect when moving down", -> - editSession.setSelectedBufferRanges([[[0,9], [0,13]], [[1,10], [1,20]], [[2,15], [3,25]]]) - [selection1, selection2, selection3] = editSession.getSelections() - - editSession.selectDown() - expect(editSession.getSelections()).toEqual [selection1] - expect(selection1.getScreenRange()).toEqual([[0, 9], [4, 25]]) - expect(selection1.isReversed()).toBeFalsy() - - it "merges selections when they intersect when moving up", -> - editSession.setSelectedBufferRanges([[[0,9], [0,13]], [[1,10], [1,20]]], reverse: true) - [selection1, selection2] = editSession.getSelections() - - editSession.selectUp() - expect(editSession.getSelections()).toEqual [selection1] - expect(selection1.getScreenRange()).toEqual([[0, 0], [1, 20]]) - expect(selection1.isReversed()).toBeTruthy() - - it "merges selections when they intersect when moving left", -> - editSession.setSelectedBufferRanges([[[0,9], [0,13]], [[0,14], [1,20]]], reverse: true) - [selection1, selection2] = editSession.getSelections() - - editSession.selectLeft() - expect(editSession.getSelections()).toEqual [selection1] - expect(selection1.getScreenRange()).toEqual([[0, 8], [1, 20]]) - expect(selection1.isReversed()).toBeTruthy() - - it "merges selections when they intersect when moving right", -> - editSession.setSelectedBufferRanges([[[0,9], [0,13]], [[0,14], [1,20]]]) - [selection1, selection2] = editSession.getSelections() - - editSession.selectRight() - expect(editSession.getSelections()).toEqual [selection1] - expect(selection1.getScreenRange()).toEqual([[0, 9], [1, 21]]) - expect(selection1.isReversed()).toBeFalsy() - - describe ".selectToScreenPosition(screenPosition)", -> - it "expands the last selection to the given position", -> - editSession.setSelectedBufferRange([[3, 0], [4, 5]]) - editSession.addCursorAtScreenPosition([5, 5]) - editSession.selectToScreenPosition([6, 1]) - - selections = editSession.getSelections() - expect(selections.length).toBe 2 - [selection1, selection2] = selections - expect(selection1.getScreenRange()).toEqual [[3, 0], [4, 5]] - expect(selection2.getScreenRange()).toEqual [[5, 5], [6, 1]] - - it "merges selections if they intersect, maintaining the directionality of the last selection", -> - editSession.setCursorScreenPosition([4, 10]) - editSession.selectToScreenPosition([5, 27]) - editSession.addCursorAtScreenPosition([3, 10]) - editSession.selectToScreenPosition([6, 27]) - - selections = editSession.getSelections() - expect(selections.length).toBe 1 - [selection1] = selections - expect(selection1.getScreenRange()).toEqual [[3, 10], [6, 27]] - expect(selection1.isReversed()).toBeFalsy() - - editSession.addCursorAtScreenPosition([7, 4]) - editSession.selectToScreenPosition([4, 11]) - - selections = editSession.getSelections() - expect(selections.length).toBe 1 - [selection1] = selections - expect(selection1.getScreenRange()).toEqual [[3, 10], [7, 4]] - expect(selection1.isReversed()).toBeTruthy() - - describe ".selectToTop()", -> - it "selects text from cusor position to the top of the buffer", -> - editSession.setCursorScreenPosition [11,2] - editSession.addCursorAtScreenPosition [10,0] - editSession.selectToTop() - expect(editSession.getCursors().length).toBe 1 - expect(editSession.getCursorBufferPosition()).toEqual [0,0] - expect(editSession.getSelection().getBufferRange()).toEqual [[0,0], [11,2]] - expect(editSession.getSelection().isReversed()).toBeTruthy() - - describe ".selectToBottom()", -> - it "selects text from cusor position to the bottom of the buffer", -> - editSession.setCursorScreenPosition [10,0] - editSession.addCursorAtScreenPosition [9,3] - editSession.selectToBottom() - expect(editSession.getCursors().length).toBe 1 - expect(editSession.getCursorBufferPosition()).toEqual [12,2] - expect(editSession.getSelection().getBufferRange()).toEqual [[9,3], [12,2]] - expect(editSession.getSelection().isReversed()).toBeFalsy() - - describe ".selectAll()", -> - it "selects the entire buffer", -> - editSession.selectAll() - expect(editSession.getSelection().getBufferRange()).toEqual buffer.getRange() - - describe ".selectToBeginningOfLine()", -> - it "selects text from cusor position to beginning of line", -> - editSession.setCursorScreenPosition [12,2] - editSession.addCursorAtScreenPosition [11,3] - - editSession.selectToBeginningOfLine() - - expect(editSession.getCursors().length).toBe 2 - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [12,0] - expect(cursor2.getBufferPosition()).toEqual [11,0] - - expect(editSession.getSelections().length).toBe 2 - [selection1, selection2] = editSession.getSelections() - expect(selection1.getBufferRange()).toEqual [[12,0], [12,2]] - expect(selection1.isReversed()).toBeTruthy() - expect(selection2.getBufferRange()).toEqual [[11,0], [11,3]] - expect(selection2.isReversed()).toBeTruthy() - - describe ".selectToEndOfLine()", -> - it "selects text from cusor position to end of line", -> - editSession.setCursorScreenPosition [12,0] - editSession.addCursorAtScreenPosition [11,3] - - editSession.selectToEndOfLine() - - expect(editSession.getCursors().length).toBe 2 - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [12,2] - expect(cursor2.getBufferPosition()).toEqual [11,44] - - expect(editSession.getSelections().length).toBe 2 - [selection1, selection2] = editSession.getSelections() - expect(selection1.getBufferRange()).toEqual [[12,0], [12,2]] - expect(selection1.isReversed()).toBeFalsy() - expect(selection2.getBufferRange()).toEqual [[11,3], [11,44]] - expect(selection2.isReversed()).toBeFalsy() - - describe ".selectLine()", -> - it "selects the entire line at given row", -> - editSession.setCursorScreenPosition([1, 2]) - editSession.selectLine() - expect(editSession.getSelectedText()).toBe " var sort = function(items) {" - - describe ".selectToBeginningOfWord()", -> - it "selects text from cusor position to beginning of word", -> - editSession.setCursorScreenPosition [0,13] - editSession.addCursorAtScreenPosition [3,49] - - editSession.selectToBeginningOfWord() - - expect(editSession.getCursors().length).toBe 2 - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,4] - expect(cursor2.getBufferPosition()).toEqual [3,47] - - expect(editSession.getSelections().length).toBe 2 - [selection1, selection2] = editSession.getSelections() - expect(selection1.getBufferRange()).toEqual [[0,4], [0,13]] - expect(selection1.isReversed()).toBeTruthy() - expect(selection2.getBufferRange()).toEqual [[3,47], [3,49]] - expect(selection2.isReversed()).toBeTruthy() - - describe ".selectToEndOfWord()", -> - it "selects text from cusor position to end of word", -> - editSession.setCursorScreenPosition [0,4] - editSession.addCursorAtScreenPosition [3,48] - - editSession.selectToEndOfWord() - - expect(editSession.getCursors().length).toBe 2 - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,13] - expect(cursor2.getBufferPosition()).toEqual [3,50] - - expect(editSession.getSelections().length).toBe 2 - [selection1, selection2] = editSession.getSelections() - expect(selection1.getBufferRange()).toEqual [[0,4], [0,13]] - expect(selection1.isReversed()).toBeFalsy() - expect(selection2.getBufferRange()).toEqual [[3,48], [3,50]] - expect(selection2.isReversed()).toBeFalsy() - - describe ".selectWord()", -> - describe "when the cursor is inside a word", -> - it "selects the entire word", -> - editSession.setCursorScreenPosition([0, 8]) - editSession.selectWord() - expect(editSession.getSelectedText()).toBe 'quicksort' - - describe "when the cursor is on beginning of a word", -> - it "selects the entire word", -> - editSession.setCursorScreenPosition([0, 4]) - editSession.selectWord() - expect(editSession.getSelectedText()).toBe 'quicksort' - - describe "when the cursor is at the end of a word", -> - it "selects the entire word", -> - editSession.setCursorScreenPosition([0, 13]) - editSession.selectWord() - expect(editSession.getSelectedText()).toBe 'quicksort' - - describe "when the cursor is not on a word", -> - it "selects nothing", -> - editSession.setCursorScreenPosition([5, 2]) - editSession.selectWord() - expect(editSession.getSelectedText()).toBe '' - - describe ".setSelectedBufferRanges(ranges)", -> - it "clears existing selections and creates selections for each of the given ranges", -> - editSession.setSelectedBufferRanges([[[2, 2], [3, 3]], [[4, 4], [5, 5]]]) - expect(editSession.getSelectedBufferRanges()).toEqual [[[2, 2], [3, 3]], [[4, 4], [5, 5]]] - - editSession.setSelectedBufferRanges([[[5, 5], [6, 6]]]) - expect(editSession.getSelectedBufferRanges()).toEqual [[[5, 5], [6, 6]]] - - it "merges intersecting selections", -> - editSession.setSelectedBufferRanges([[[2, 2], [3, 3]], [[3, 0], [5, 5]]]) - expect(editSession.getSelectedBufferRanges()).toEqual [[[2, 2], [5, 5]]] - - it "recyles existing selection instances", -> - selection = editSession.getSelection() - editSession.setSelectedBufferRanges([[[2, 2], [3, 3]], [[4, 4], [5, 5]]]) - - [selection1, selection2] = editSession.getSelections() - expect(selection1).toBe selection - expect(selection1.getBufferRange()).toEqual [[2, 2], [3, 3]] - - describe "when the preserveFolds option is false (the default)", -> - it "removes folds that contain the selections", -> - editSession.setSelectedBufferRange([[0,0], [0,0]]) - editSession.createFold(1, 4) - editSession.createFold(2, 3) - editSession.createFold(6, 8) - editSession.createFold(10, 11) - - editSession.setSelectedBufferRanges([[[2, 2], [3, 3]], [[6, 6], [7, 7]]]) - expect(editSession.lineForScreenRow(1).fold).toBeUndefined() - expect(editSession.lineForScreenRow(2).fold).toBeUndefined() - expect(editSession.lineForScreenRow(6).fold).toBeUndefined() - expect(editSession.lineForScreenRow(10).fold).toBeDefined() - - describe "when the preserve folds option is true", -> - it "does not remove folds that contain the selections", -> - editSession.setSelectedBufferRange([[0,0], [0,0]]) - editSession.createFold(1, 4) - editSession.setSelectedBufferRanges([[[2, 2], [3, 3]]], preserveFolds: true) - expect(editSession.lineForScreenRow(1).fold).toBeDefined() - - describe "when the cursor is moved while there is a selection", -> - makeSelection = -> selection.setBufferRange [[1, 2], [1, 5]] - - it "clears the selection", -> - makeSelection() - editSession.moveCursorDown() - expect(selection.isEmpty()).toBeTruthy() - - makeSelection() - editSession.moveCursorUp() - expect(selection.isEmpty()).toBeTruthy() - - makeSelection() - editSession.moveCursorLeft() - expect(selection.isEmpty()).toBeTruthy() - - makeSelection() - editSession.moveCursorRight() - expect(selection.isEmpty()).toBeTruthy() - - makeSelection() - editSession.setCursorScreenPosition([3, 3]) - expect(selection.isEmpty()).toBeTruthy() - - describe "buffer manipulation", -> - describe ".insertText(text)", -> - describe "when there are multiple empty selections", -> - describe "when the cursors are on the same line", -> - it "inserts the given text at the location of each cursor and moves the cursors to the end of each cursor's inserted text", -> - editSession.setCursorScreenPosition([1, 2]) - editSession.addCursorAtScreenPosition([1, 5]) - - editSession.insertText('xxx') - - expect(buffer.lineForRow(1)).toBe ' xxxvarxxx sort = function(items) {' - [cursor1, cursor2] = editSession.getCursors() - - expect(cursor1.getBufferPosition()).toEqual [1, 5] - expect(cursor2.getBufferPosition()).toEqual [1, 11] - - describe "when the cursors are on different lines", -> - it "inserts the given text at the location of each cursor and moves the cursors to the end of each cursor's inserted text", -> - editSession.setCursorScreenPosition([1, 2]) - editSession.addCursorAtScreenPosition([2, 4]) - - editSession.insertText('xxx') - - expect(buffer.lineForRow(1)).toBe ' xxxvar sort = function(items) {' - expect(buffer.lineForRow(2)).toBe ' xxxif (items.length <= 1) return items;' - [cursor1, cursor2] = editSession.getCursors() - - expect(cursor1.getBufferPosition()).toEqual [1, 5] - expect(cursor2.getBufferPosition()).toEqual [2, 7] - - describe "when there are multiple non-empty selections", -> - describe "when the selections are on the same line", -> - it "replaces each selection range with the inserted characters", -> - editSession.setSelectedBufferRanges([[[0,4], [0,13]], [[0,22], [0,24]]]) - editSession.insertText("x") - - [cursor1, cursor2] = editSession.getCursors() - [selection1, selection2] = editSession.getSelections() - - expect(cursor1.getScreenPosition()).toEqual [0, 5] - expect(cursor2.getScreenPosition()).toEqual [0, 15] - expect(selection1.isEmpty()).toBeTruthy() - expect(selection2.isEmpty()).toBeTruthy() - - expect(editSession.lineForBufferRow(0)).toBe "var x = functix () {" - - describe "when the selections are on different lines", -> - it "replaces each selection with the given text, clears the selections, and places the cursor at the end of each selection's inserted text", -> - editSession.setSelectedBufferRanges([[[1, 0], [1, 2]], [[2, 0], [2, 4]]]) - - editSession.insertText('xxx') - - expect(buffer.lineForRow(1)).toBe 'xxxvar sort = function(items) {' - expect(buffer.lineForRow(2)).toBe 'xxxif (items.length <= 1) return items;' - [selection1, selection2] = editSession.getSelections() - - expect(selection1.isEmpty()).toBeTruthy() - expect(selection1.cursor.getBufferPosition()).toEqual [1, 3] - expect(selection2.isEmpty()).toBeTruthy() - expect(selection2.cursor.getBufferPosition()).toEqual [2, 3] - - describe "when there is a selection that ends on a folded line", -> - it "destroys the selection", -> - editSession.createFold(2,4) - editSession.setSelectedBufferRange([[1,0], [2,0]]) - editSession.insertText('holy cow') - expect(editSession.lineForScreenRow(2).fold).toBeUndefined() - - describe "when auto-indent is enabled", -> - beforeEach -> - editSession.setAutoIndent(true) - - describe "when a single newline is inserted", -> - describe "when the newline is inserted on a line that starts a new level of indentation", -> - it "auto-indents the new line to one additional level of indentation beyond the preceding line", -> - editSession.setCursorBufferPosition([1, Infinity]) - editSession.insertText('\n') - expect(buffer.indentationForRow(2)).toBe buffer.indentationForRow(1) + 2 - - describe "when the newline is inserted on a normal line", -> - it "auto-indents the new line to the same level of indentation as the preceding line", -> - editSession.setCursorBufferPosition([5, 13]) - editSession.insertText('\n') - expect(buffer.indentationForRow(6)).toBe buffer.indentationForRow(5) - - describe "when text with newlines is inserted", -> - describe "when the new line matches an outdent pattern", -> - describe "when the preceding line matches an auto-indent pattern", -> - it "auto-decreases the indentation of the line to match that of the preceding line", -> - editSession.setCursorBufferPosition([1, 30]) - editSession.insertText '\n}' - expect(buffer.indentationForRow(2)).toBe 2 - - describe "when the preceding does not match an outo-indent pattern", -> - it "auto-decreases the indentation of the line to be one level below that of the preceding line", -> - editSession.setCursorBufferPosition([3, Infinity]) - editSession.insertText '\n}' - expect(buffer.indentationForRow(4)).toBe 2 - - describe "when the portion of the line preceding the inserted text is blank", -> - it "auto-increases the indentation of the first line, then fully auto-indents the subsequent lines", -> - editSession.setCursorBufferPosition([5, 2]) - editSession.insertText """ - if (true) { - console.log("It's true!") - }\n - """ - expect(buffer.indentationForRow(5)).toBe buffer.indentationForRow(4) + 2 - expect(buffer.indentationForRow(6)).toBe buffer.indentationForRow(5) + 2 - expect(buffer.indentationForRow(7)).toBe buffer.indentationForRow(4) + 2 - expect(buffer.indentationForRow(8)).toBe buffer.indentationForRow(4) + 2 - - describe "when the portion of the line preceding the inserted text is non-blank", -> - it "fully auto-indents lines subsequent to the first inserted line", -> - buffer.delete([[5, 0], [5, 2]]) - editSession.setCursorBufferPosition([5, Infinity]) - editSession.insertText """ - if (true) { - console.log("It's true!") - } - """ - expect(buffer.indentationForRow(5)).toBe 4 - expect(buffer.indentationForRow(6)).toBe 6 - expect(buffer.indentationForRow(7)).toBe 4 - - describe "when text without newlines is inserted", -> - describe "when the current line matches an auto-outdent pattern", -> - describe "when the preceding line matches an auto-indent pattern", -> - it "auto-decreases the indentation of the line to match that of the preceding line", -> - editSession.setCursorBufferPosition([2, 4]) - editSession.insertText '\n' - editSession.setCursorBufferPosition([2, 4]) - expect(buffer.indentationForRow(2)).toBe buffer.indentationForRow(1) + 2 - editSession.insertText ' }' - expect(buffer.indentationForRow(2)).toBe buffer.indentationForRow(1) - - describe "when the preceding does not match an outo-indent pattern", -> - it "auto-decreases the indentation of the line to be one level below that of the preceding line", -> - editSession.setCursorBufferPosition([3, Infinity]) - editSession.insertText '\n' - expect(buffer.indentationForRow(4)).toBe buffer.indentationForRow(3) - editSession.insertText ' }' - expect(buffer.indentationForRow(4)).toBe buffer.indentationForRow(3) - 2 - - describe "when the current line does not match an auto-outdent pattern", -> - it "leaves the line unchanged", -> - editSession.setCursorBufferPosition([2, 4]) - expect(buffer.indentationForRow(2)).toBe buffer.indentationForRow(1) + 2 - editSession.insertText 'foo' - expect(buffer.indentationForRow(2)).toBe buffer.indentationForRow(1) + 2 - - describe ".insertNewline()", -> - describe "when there is a single cursor", -> - describe "when the cursor is at the beginning of a line", -> - it "inserts an empty line before it", -> - editSession.setCursorScreenPosition(row: 1, column: 0) - - editSession.insertNewline() - - expect(buffer.lineForRow(1)).toBe '' - expect(editSession.getCursorScreenPosition()).toEqual(row: 2, column: 0) - - describe "when the cursor is in the middle of a line", -> - it "splits the current line to form a new line", -> - editSession.setCursorScreenPosition(row: 1, column: 6) - originalLine = buffer.lineForRow(1) - lineBelowOriginalLine = buffer.lineForRow(2) - - editSession.insertNewline() - - expect(buffer.lineForRow(1)).toBe originalLine[0...6] - expect(buffer.lineForRow(2)).toBe originalLine[6..] - expect(buffer.lineForRow(3)).toBe lineBelowOriginalLine - expect(editSession.getCursorScreenPosition()).toEqual(row: 2, column: 0) - - describe "when the cursor is on the end of a line", -> - it "inserts an empty line after it", -> - editSession.setCursorScreenPosition(row: 1, column: buffer.lineForRow(1).length) - - editSession.insertNewline() - - expect(buffer.lineForRow(2)).toBe '' - expect(editSession.getCursorScreenPosition()).toEqual(row: 2, column: 0) - - describe "when there are multiple cursors", -> - describe "when the cursors are on the same line", -> - it "breaks the line at the cursor locations", -> - editSession.setCursorScreenPosition([3, 13]) - editSession.addCursorAtScreenPosition([3, 38]) - - editSession.insertNewline() - - expect(editSession.lineForBufferRow(3)).toBe " var pivot" - expect(editSession.lineForBufferRow(4)).toBe " = items.shift(), current" - expect(editSession.lineForBufferRow(5)).toBe ", left = [], right = [];" - expect(editSession.lineForBufferRow(6)).toBe " while(items.length > 0) {" - - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [4, 0] - expect(cursor2.getBufferPosition()).toEqual [5, 0] - - describe "when the cursors are on different lines", -> - it "inserts newlines at each cursor location", -> - editSession.setCursorScreenPosition([3, 0]) - editSession.addCursorAtScreenPosition([6, 0]) - - editSession.insertText("\n") - expect(editSession.lineForBufferRow(3)).toBe "" - expect(editSession.lineForBufferRow(4)).toBe " var pivot = items.shift(), current, left = [], right = [];" - expect(editSession.lineForBufferRow(5)).toBe " while(items.length > 0) {" - expect(editSession.lineForBufferRow(6)).toBe " current = items.shift();" - expect(editSession.lineForBufferRow(7)).toBe "" - expect(editSession.lineForBufferRow(8)).toBe " current < pivot ? left.push(current) : right.push(current);" - expect(editSession.lineForBufferRow(9)).toBe " }" - - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [4,0] - expect(cursor2.getBufferPosition()).toEqual [8,0] - - describe ".insertNewlineBelow()", -> - xit "inserts a newline below the cursor's current line, autoindents it, and moves the cursor to the end of the line", -> - editSession.setAutoIndent(true) - editSession.insertNewlineBelow() - expect(buffer.lineForRow(0)).toBe "var quicksort = function () {" - expect(buffer.lineForRow(1)).toBe " " - expect(editSession.getCursorBufferPosition()).toEqual [1, 2] - - describe ".backspace()", -> - describe "when there is a single cursor", -> - changeScreenRangeHandler = null - - beforeEach -> - selection = editSession.getLastSelection() - changeScreenRangeHandler = jasmine.createSpy('changeScreenRangeHandler') - selection.on 'change-screen-range', changeScreenRangeHandler - - describe "when the cursor is on the middle of the line", -> - it "removes the character before the cursor", -> - editSession.setCursorScreenPosition(row: 1, column: 7) - expect(buffer.lineForRow(1)).toBe " var sort = function(items) {" - - editSession.backspace() - - line = buffer.lineForRow(1) - expect(line).toBe " var ort = function(items) {" - expect(editSession.getCursorScreenPosition()).toEqual {row: 1, column: 6} - expect(changeScreenRangeHandler).toHaveBeenCalled() - - describe "when the cursor is at the beginning of a line", -> - it "joins it with the line above", -> - originalLine0 = buffer.lineForRow(0) - expect(originalLine0).toBe "var quicksort = function () {" - expect(buffer.lineForRow(1)).toBe " var sort = function(items) {" - - editSession.setCursorScreenPosition(row: 1, column: 0) - editSession.backspace() - - line0 = buffer.lineForRow(0) - line1 = buffer.lineForRow(1) - expect(line0).toBe "var quicksort = function () { var sort = function(items) {" - expect(line1).toBe " if (items.length <= 1) return items;" - expect(editSession.getCursorScreenPosition()).toEqual [0, originalLine0.length] - - expect(changeScreenRangeHandler).toHaveBeenCalled() - - describe "when the cursor is at the first column of the first line", -> - it "does nothing, but doesn't raise an error", -> - editSession.setCursorScreenPosition(row: 0, column: 0) - editSession.backspace() - - describe "when the cursor is on the first column of a line below a fold", -> - it "absorbs the current line into the fold", -> - editSession.setCursorScreenPosition([4,0]) - editSession.foldCurrentRow() - editSession.setCursorScreenPosition([5,0]) - editSession.backspace() - - expect(buffer.lineForRow(7)).toBe " } return sort(left).concat(pivot).concat(sort(right));" - expect(buffer.lineForRow(8)).toBe " };" - - describe "when the cursor is in the middle of a line below a fold", -> - it "backspaces as normal", -> - editSession.setCursorScreenPosition([4,0]) - editSession.foldCurrentRow() - editSession.setCursorScreenPosition([5,5]) - editSession.backspace() - - expect(buffer.lineForRow(7)).toBe " }" - expect(buffer.lineForRow(8)).toBe " eturn sort(left).concat(pivot).concat(sort(right));" - - describe "when the cursor is on a folded screen line", -> - it "deletes all of the folded lines along with the fold", -> - editSession.setCursorBufferPosition([3, 0]) - editSession.foldCurrentRow() - editSession.backspace() - expect(buffer.lineForRow(1)).toBe "" - expect(buffer.lineForRow(2)).toBe " return sort(Array.apply(this, arguments));" - expect(editSession.getCursorScreenPosition()).toEqual [1, 0] - - describe "when there are multiple cursors", -> - describe "when cursors are on the same line", -> - it "removes the characters preceding each cursor", -> - editSession.setCursorScreenPosition([3, 13]) - editSession.addCursorAtScreenPosition([3, 38]) - - editSession.backspace() - - expect(editSession.lineForBufferRow(3)).toBe " var pivo = items.shift(), curren, left = [], right = [];" - - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [3, 12] - expect(cursor2.getBufferPosition()).toEqual [3, 36] - - [selection1, selection2] = editSession.getSelections() - expect(selection1.isEmpty()).toBeTruthy() - expect(selection2.isEmpty()).toBeTruthy() - - describe "when cursors are on different lines", -> - describe "when the cursors are in the middle of their lines", -> - it "removes the characters preceding each cursor", -> - editSession.setCursorScreenPosition([3, 13]) - editSession.addCursorAtScreenPosition([4, 10]) - - editSession.backspace() - - expect(editSession.lineForBufferRow(3)).toBe " var pivo = items.shift(), current, left = [], right = [];" - expect(editSession.lineForBufferRow(4)).toBe " whileitems.length > 0) {" - - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [3, 12] - expect(cursor2.getBufferPosition()).toEqual [4, 9] - - [selection1, selection2] = editSession.getSelections() - expect(selection1.isEmpty()).toBeTruthy() - expect(selection2.isEmpty()).toBeTruthy() - - describe "when the cursors are on the first column of their lines", -> - it "removes the newlines preceding each cursor", -> - editSession.setCursorScreenPosition([3, 0]) - editSession.addCursorAtScreenPosition([6, 0]) - - editSession.backspace() - expect(editSession.lineForBufferRow(2)).toBe " if (items.length <= 1) return items; var pivot = items.shift(), current, left = [], right = [];" - expect(editSession.lineForBufferRow(3)).toBe " while(items.length > 0) {" - expect(editSession.lineForBufferRow(4)).toBe " current = items.shift(); current < pivot ? left.push(current) : right.push(current);" - expect(editSession.lineForBufferRow(5)).toBe " }" - - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [2,40] - expect(cursor2.getBufferPosition()).toEqual [4,30] - - describe "when there is a single selection", -> - it "deletes the selection, but not the character before it", -> - editSession.setSelectedBufferRange([[0,5], [0,9]]) - editSession.backspace() - expect(editSession.buffer.lineForRow(0)).toBe 'var qsort = function () {' - - describe "when the selection ends on a folded line", -> - it "destroys the fold", -> - editSession.setSelectedBufferRange([[3,0], [4,0]]) - editSession.foldBufferRow(4) - editSession.backspace() - - expect(buffer.lineForRow(3)).toBe " return sort(left).concat(pivot).concat(sort(right));" - expect(buffer.lineForRow(4)).toBe " };" - expect(editSession.getCursorScreenPosition()).toEqual [3, 0] - - describe "when there are multiple selections", -> - it "removes all selected text", -> - editSession.setSelectedBufferRanges([[[0,4], [0,13]], [[0,16], [0,24]]]) - editSession.backspace() - expect(editSession.lineForBufferRow(0)).toBe 'var = () {' - - describe ".backspaceToBeginningOfWord()", -> - describe "when no text is selected", -> - it "deletes all text between the cursor and the beginning of the word", -> - editSession.setCursorBufferPosition([1, 24]) - editSession.addCursorAtBufferPosition([2, 5]) - [cursor1, cursor2] = editSession.getCursors() - - editSession.backspaceToBeginningOfWord() - expect(buffer.lineForRow(1)).toBe ' var sort = function(ems) {' - expect(buffer.lineForRow(2)).toBe ' f (items.length <= 1) return items;' - expect(cursor1.getBufferPosition()).toEqual [1, 22] - expect(cursor2.getBufferPosition()).toEqual [2, 4] - - editSession.backspaceToBeginningOfWord() - expect(buffer.lineForRow(1)).toBe ' var sort = functionems) f (items.length <= 1) return items;' - expect(cursor1.getBufferPosition()).toEqual [1, 21] - expect(cursor2.getBufferPosition()).toEqual [1, 26] - - describe "when text is selected", -> - it "deletes only selected text", -> - editSession.setSelectedBufferRanges([[[1, 24], [1, 27]], [[2, 0], [2, 4]]]) - editSession.backspaceToBeginningOfWord() - expect(buffer.lineForRow(1)).toBe ' var sort = function(it) {' - expect(buffer.lineForRow(2)).toBe 'if (items.length <= 1) return items;' - - describe ".delete()", -> - describe "when there is a single cursor", -> - describe "when the cursor is on the middle of a line", -> - it "deletes the character following the cursor", -> - editSession.setCursorScreenPosition([1, 6]) - editSession.delete() - expect(buffer.lineForRow(1)).toBe ' var ort = function(items) {' - - describe "when the cursor is on the end of a line", -> - it "joins the line with the following line", -> - editSession.setCursorScreenPosition([1, buffer.lineForRow(1).length]) - editSession.delete() - expect(buffer.lineForRow(1)).toBe ' var sort = function(items) { if (items.length <= 1) return items;' - - describe "when the cursor is on the last column of the last line", -> - it "does nothing, but doesn't raise an error", -> - editSession.setCursorScreenPosition([12, buffer.lineForRow(12).length]) - editSession.delete() - expect(buffer.lineForRow(12)).toBe '};' - - describe "when the cursor is on the end of a line above a fold", -> - it "only deletes the lines inside the fold", -> - editSession.foldBufferRow(4) - editSession.setCursorScreenPosition([3, Infinity]) - cursorPositionBefore = editSession.getCursorScreenPosition() - - editSession.delete() - - expect(buffer.lineForRow(3)).toBe " var pivot = items.shift(), current, left = [], right = [];" - expect(buffer.lineForRow(4)).toBe " return sort(left).concat(pivot).concat(sort(right));" - expect(editSession.getCursorScreenPosition()).toEqual cursorPositionBefore - - describe "when the cursor is in the middle a line above a fold", -> - it "deletes as normal", -> - editSession.foldBufferRow(4) - editSession.setCursorScreenPosition([3, 4]) - cursorPositionBefore = editSession.getCursorScreenPosition() - - editSession.delete() - - expect(buffer.lineForRow(3)).toBe " ar pivot = items.shift(), current, left = [], right = [];" - expect(editSession.lineForScreenRow(4).fold).toBeDefined() - expect(editSession.getCursorScreenPosition()).toEqual [3, 4] - - describe "when the cursor is on a folded line", -> - it "removes the lines contained by the fold", -> - editSession.setSelectedBufferRange([[2, 0], [2, 0]]) - editSession.createFold(2,4) - editSession.createFold(2,6) - oldLine7 = buffer.lineForRow(7) - oldLine8 = buffer.lineForRow(8) - - editSession.delete() - expect(editSession.lineForScreenRow(2).text).toBe oldLine7 - expect(editSession.lineForScreenRow(3).text).toBe oldLine8 - - describe "when there are multiple cursors", -> - describe "when cursors are on the same line", -> - it "removes the characters following each cursor", -> - editSession.setCursorScreenPosition([3, 13]) - editSession.addCursorAtScreenPosition([3, 38]) - - editSession.delete() - - expect(editSession.lineForBufferRow(3)).toBe " var pivot= items.shift(), current left = [], right = [];" - - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [3, 13] - expect(cursor2.getBufferPosition()).toEqual [3, 37] - - [selection1, selection2] = editSession.getSelections() - expect(selection1.isEmpty()).toBeTruthy() - expect(selection2.isEmpty()).toBeTruthy() - - describe "when cursors are on different lines", -> - describe "when the cursors are in the middle of the lines", -> - it "removes the characters following each cursor", -> - editSession.setCursorScreenPosition([3, 13]) - editSession.addCursorAtScreenPosition([4, 10]) - - editSession.delete() - - expect(editSession.lineForBufferRow(3)).toBe " var pivot= items.shift(), current, left = [], right = [];" - expect(editSession.lineForBufferRow(4)).toBe " while(tems.length > 0) {" - - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [3, 13] - expect(cursor2.getBufferPosition()).toEqual [4, 10] - - [selection1, selection2] = editSession.getSelections() - expect(selection1.isEmpty()).toBeTruthy() - expect(selection2.isEmpty()).toBeTruthy() - - describe "when the cursors are at the end of their lines", -> - it "removes the newlines following each cursor", -> - editSession.setCursorScreenPosition([0, 29]) - editSession.addCursorAtScreenPosition([1, 30]) - - editSession.delete() - - expect(editSession.lineForBufferRow(0)).toBe "var quicksort = function () { var sort = function(items) { if (items.length <= 1) return items;" - - [cursor1, cursor2] = editSession.getCursors() - expect(cursor1.getBufferPosition()).toEqual [0,29] - expect(cursor2.getBufferPosition()).toEqual [0,59] - - describe "when there is a single selection", -> - it "deletes the selection, but not the character following it", -> - editSession.setSelectedBufferRanges([[[1, 24], [1, 27]], [[2, 0], [2, 4]]]) - editSession.delete() - expect(buffer.lineForRow(1)).toBe ' var sort = function(it) {' - expect(buffer.lineForRow(2)).toBe 'if (items.length <= 1) return items;' - expect(editSession.getSelection().isEmpty()).toBeTruthy() - - describe "when there are multiple selections", -> - describe "when selections are on the same line", -> - it "removes all selected text", -> - editSession.setSelectedBufferRanges([[[0,4], [0,13]], [[0,16], [0,24]]]) - editSession.delete() - expect(editSession.lineForBufferRow(0)).toBe 'var = () {' - - describe ".deleteToEndOfWord()", -> - describe "when no text is selected", -> - it "deletes to the end of the word", -> - editSession.setCursorBufferPosition([1, 24]) - editSession.addCursorAtBufferPosition([2, 5]) - [cursor1, cursor2] = editSession.getCursors() - - editSession.deleteToEndOfWord() - expect(buffer.lineForRow(1)).toBe ' var sort = function(it) {' - expect(buffer.lineForRow(2)).toBe ' i (items.length <= 1) return items;' - expect(cursor1.getBufferPosition()).toEqual [1, 24] - expect(cursor2.getBufferPosition()).toEqual [2, 5] - - editSession.deleteToEndOfWord() - expect(buffer.lineForRow(1)).toBe ' var sort = function(it {' - expect(buffer.lineForRow(2)).toBe ' iitems.length <= 1) return items;' - expect(cursor1.getBufferPosition()).toEqual [1, 24] - expect(cursor2.getBufferPosition()).toEqual [2, 5] - - describe "when text is selected", -> - it "deletes only selected text", -> - editSession.setSelectedBufferRange([[1, 24], [1, 27]]) - editSession.deleteToEndOfWord() - expect(buffer.lineForRow(1)).toBe ' var sort = function(it) {' - - describe ".indent()", -> - describe "when nothing is selected", -> - describe "if 'softTabs' is true (the default)", -> - it "inserts the value of 'tabText' into the buffer", -> - tabRegex = new RegExp("^#{editSession.tabText}") - expect(buffer.lineForRow(0)).not.toMatch(tabRegex) - editSession.indent() - expect(buffer.lineForRow(0)).toMatch(tabRegex) - - xdescribe "when auto-indent is on and the line only contains whitespace", -> - describe "when the preceding line opens a new level of indentation", -> - it "increases the level of indentation by one", -> - buffer.insert([5, 0], " \n") - editSession.tabText = " " - editSession.setCursorBufferPosition [5, 2] - editSession.setAutoIndent(true) - editSession.indent() - expect(buffer.lineForRow(5)).toMatch /^\s+$/ - expect(buffer.lineForRow(5).length).toBe 6 - expect(editSession.getCursorBufferPosition()).toEqual [5, 6] - - describe "when there are empty lines preceding the current line", -> - it "bases indentation on the first non-blank preceding line", -> - buffer.insert([5, 0], "\n\n\n \n") - editSession.tabText = " " - editSession.setCursorBufferPosition [8, 2] - editSession.setAutoIndent(true) - editSession.indent() - expect(buffer.lineForRow(8)).toMatch /^\s+$/ - expect(buffer.lineForRow(8).length).toBe 6 - expect(editSession.getCursorBufferPosition()).toEqual [8, 6] - - it "properly indents the line", -> - buffer.insert([7, 0], " \n") - editSession.tabText = " " - editSession.setCursorBufferPosition [7, 2] - editSession.setAutoIndent(true) - editSession.indent() - expect(buffer.lineForRow(7)).toMatch /^\s+$/ - expect(buffer.lineForRow(7).length).toBe 6 - expect(editSession.getCursorBufferPosition()).toEqual [7, 6] - - it "allows for additional indentation if the cursor is beyond the proper indentation point", -> - buffer.insert([7, 0], " \n") - editSession.tabText = " " - editSession.setCursorBufferPosition [7, 6] - editSession.setAutoIndent(true) - editSession.indent() - expect(buffer.lineForRow(7)).toMatch /^\s+$/ - expect(buffer.lineForRow(7).length).toBe 8 - expect(editSession.getCursorBufferPosition()).toEqual [7, 8] - - describe "if editSession.softTabs is false", -> - it "inserts a tab character into the buffer", -> - editSession.setSoftTabs(false) - expect(buffer.lineForRow(0)).not.toMatch(/^\t/) - editSession.indent() - expect(buffer.lineForRow(0)).toMatch(/^\t/) - expect(editSession.getCursorBufferPosition()).toEqual [0, 1] - expect(editSession.getCursorScreenPosition()).toEqual [0, editSession.tabText.length] - - editSession.indent() - expect(buffer.lineForRow(0)).toMatch(/^\t\t/) - expect(editSession.getCursorBufferPosition()).toEqual [0, 2] - expect(editSession.getCursorScreenPosition()).toEqual [0, editSession.tabText.length * 2] - - describe "pasteboard operations", -> - pasteboard = null - beforeEach -> - pasteboard = 'first' - spyOn($native, 'writeToPasteboard').andCallFake (text) -> pasteboard = text - spyOn($native, 'readFromPasteboard').andCallFake -> pasteboard - editSession.setSelectedBufferRanges([[[0, 4], [0, 13]], [[1, 6], [1, 10]]]) - - describe ".cutSelectedText()", -> - it "removes the selected text from the buffer and places it on the pasteboard", -> - editSession.cutSelectedText() - expect(buffer.lineForRow(0)).toBe "var = function () {" - expect(buffer.lineForRow(1)).toBe " var = function(items) {" - - expect($native.readFromPasteboard()).toBe 'quicksort\nsort' - - describe ".cutToEndOfLine()", -> - describe "when nothing is selected", -> - it "cuts up to the end of the line", -> - editSession.setCursorBufferPosition([2, 20]) - editSession.addCursorAtBufferPosition([3, 20]) - editSession.cutToEndOfLine() - expect(buffer.lineForRow(2)).toBe ' if (items.length' - expect(buffer.lineForRow(3)).toBe ' var pivot = item' - expect(pasteboard).toBe ' <= 1) return items;\ns.shift(), current, left = [], right = [];' - - describe "when text is selected", -> - it "only cuts the selected text, not to the end of the line", -> - editSession.setSelectedBufferRanges([[[2,20], [2, 30]], [[3, 20], [3, 20]]]) - - editSession.cutToEndOfLine() - - expect(buffer.lineForRow(2)).toBe ' if (items.lengthurn items;' - expect(buffer.lineForRow(3)).toBe ' var pivot = item' - expect(pasteboard).toBe ' <= 1) ret\ns.shift(), current, left = [], right = [];' - - describe ".copySelectedText()", -> - it "copies selected text onto the clipboard", -> - editSession.copySelectedText() - expect(buffer.lineForRow(0)).toBe "var quicksort = function () {" - expect(buffer.lineForRow(1)).toBe " var sort = function(items) {" - expect($native.readFromPasteboard()).toBe 'quicksort\nsort' - - describe ".pasteText()", -> - it "pastes text into the buffer", -> - editSession.pasteText() - expect(editSession.buffer.lineForRow(0)).toBe "var first = function () {" - expect(buffer.lineForRow(1)).toBe " var first = function(items) {" - - describe ".indentSelectedRows()", -> - tabLength = null - - beforeEach -> - tabLength = editSession.tabText.length - - describe "when nothing is selected", -> - it "indents line and retains selection", -> - editSession.setSelectedBufferRange([[0,3], [0,3]]) - editSession.indentSelectedRows() - expect(buffer.lineForRow(0)).toBe "#{editSession.tabText}var quicksort = function () {" - expect(editSession.getSelectedBufferRange()).toEqual [[0, 3 + tabLength], [0, 3 + tabLength]] - - describe "when one line is selected", -> - it "indents line and retains selection", -> - editSession.setSelectedBufferRange([[0,4], [0,14]]) - editSession.indentSelectedRows() - expect(buffer.lineForRow(0)).toBe "#{editSession.tabText}var quicksort = function () {" - expect(editSession.getSelectedBufferRange()).toEqual [[0, 4 + tabLength], [0, 14 + tabLength]] - - describe "when multiple lines are selected", -> - it "indents selected lines (that are not empty) and retains selection", -> - editSession.setSelectedBufferRange([[9,1], [11,15]]) - editSession.indentSelectedRows() - expect(buffer.lineForRow(9)).toBe " };" - expect(buffer.lineForRow(10)).toBe "" - expect(buffer.lineForRow(11)).toBe " return sort(Array.apply(this, arguments));" - expect(editSession.getSelectedBufferRange()).toEqual [[9, 1 + tabLength], [11, 15 + tabLength]] - - describe ".outdentSelectedRows()", -> - tabLength = null - - beforeEach -> - editSession.tabText = " " - tabLength = editSession.tabText.length - - describe "when nothing is selected", -> - it "outdents line and retains selection", -> - editSession.setSelectedBufferRange([[1,3], [1,3]]) - editSession.outdentSelectedRows() - expect(buffer.lineForRow(1)).toBe "var sort = function(items) {" - expect(editSession.getSelectedBufferRange()).toEqual [[1, 3 - tabLength], [1, 3 - tabLength]] - - describe "when one line is selected", -> - it "outdents line and retains editSession", -> - editSession.setSelectedBufferRange([[1,4], [1,14]]) - editSession.outdentSelectedRows() - expect(buffer.lineForRow(1)).toBe "var sort = function(items) {" - expect(editSession.getSelectedBufferRange()).toEqual [[1, 4 - tabLength], [1, 14 - tabLength]] - - describe "when multiple lines are selected", -> - it "outdents selected lines and retains editSession", -> - editSession.setSelectedBufferRange([[0,1], [3,15]]) - editSession.outdentSelectedRows() - expect(buffer.lineForRow(0)).toBe "var quicksort = function () {" - expect(buffer.lineForRow(1)).toBe "var sort = function(items) {" - expect(buffer.lineForRow(2)).toBe " if (items.length <= 1) return items;" - expect(editSession.getSelectedBufferRange()).toEqual [[0, 1], [3, 15 - tabLength]] - - describe ".toggleLineCommentsInSelection()", -> - it "toggles comments on the selected lines", -> - editSession.setSelectedBufferRange([[4, 5], [7, 5]]) - editSession.toggleLineCommentsInSelection() - - expect(buffer.lineForRow(4)).toBe "// while(items.length > 0) {" - expect(buffer.lineForRow(5)).toBe "// current = items.shift();" - expect(buffer.lineForRow(6)).toBe "// current < pivot ? left.push(current) : right.push(current);" - expect(buffer.lineForRow(7)).toBe "// }" - expect(editSession.getSelectedBufferRange()).toEqual [[4, 8], [7, 8]] - - editSession.toggleLineCommentsInSelection() - expect(buffer.lineForRow(4)).toBe " while(items.length > 0) {" - expect(buffer.lineForRow(5)).toBe " current = items.shift();" - expect(buffer.lineForRow(6)).toBe " current < pivot ? left.push(current) : right.push(current);" - expect(buffer.lineForRow(7)).toBe " }" - - it "preserves selection emptiness", -> - editSession.setSelectedBufferRange([[4, 0], [4, 0]]) - editSession.toggleLineCommentsInSelection() - expect(editSession.getSelection().isEmpty()).toBeTruthy() - - describe ".undo() and .redo()", -> - it "undoes/redoes the last change", -> - editSession.insertText("foo") - editSession.undo() - expect(buffer.lineForRow(0)).not.toContain "foo" - - editSession.redo() - expect(buffer.lineForRow(0)).toContain "foo" - - it "batches the undo / redo of changes caused by multiple cursors", -> - editSession.setCursorScreenPosition([0, 0]) - editSession.addCursorAtScreenPosition([1, 0]) - - editSession.insertText("foo") - editSession.backspace() - - expect(buffer.lineForRow(0)).toContain "fovar" - expect(buffer.lineForRow(1)).toContain "fo " - - editSession.undo() - - expect(buffer.lineForRow(0)).toContain "foo" - expect(buffer.lineForRow(1)).toContain "foo" - - editSession.redo() - - expect(buffer.lineForRow(0)).not.toContain "foo" - expect(buffer.lineForRow(0)).toContain "fovar" - - it "restores the selected ranges after undo and redo", -> - editSession.setSelectedBufferRanges([[[1, 6], [1, 10]], [[1, 22], [1, 27]]]) - editSession.delete() - editSession.delete() - - selections = editSession.getSelections() - expect(buffer.lineForRow(1)).toBe ' var = function( {' - - expect(editSession.getSelectedBufferRanges()).toEqual [[[1, 6], [1, 6]], [[1, 17], [1, 17]]] - - editSession.undo() - expect(editSession.getSelectedBufferRanges()).toEqual [[[1, 6], [1, 6]], [[1, 18], [1, 18]]] - - editSession.undo() - expect(editSession.getSelectedBufferRanges()).toEqual [[[1, 6], [1, 10]], [[1, 22], [1, 27]]] - - editSession.redo() - expect(editSession.getSelectedBufferRanges()).toEqual [[[1, 6], [1, 6]], [[1, 18], [1, 18]]] - - it "restores selected ranges even when the change occurred in another edit session", -> - otherEditSession = fixturesProject.buildEditSessionForPath(editSession.getPath()) - otherEditSession.setSelectedBufferRange([[2, 2], [3, 3]]) - otherEditSession.delete() - - editSession.undo() - - expect(editSession.getSelectedBufferRange()).toEqual [[2, 2], [3, 3]] - expect(otherEditSession.getSelectedBufferRange()).toEqual [[3, 3], [3, 3]] - - describe "when the buffer is changed (via its direct api, rather than via than edit session)", -> - it "moves the cursor so it is in the same relative position of the buffer", -> - expect(editSession.getCursorScreenPosition()).toEqual [0, 0] - editSession.addCursorAtScreenPosition([0, 5]) - editSession.addCursorAtScreenPosition([1, 0]) - [cursor1, cursor2, cursor3] = editSession.getCursors() - - buffer.insert([0, 1], 'abc') - - expect(cursor1.getScreenPosition()).toEqual [0, 0] - expect(cursor2.getScreenPosition()).toEqual [0, 8] - expect(cursor3.getScreenPosition()).toEqual [1, 0] - - it "does not destroy cursor or selection anchors when a change encompasses them", -> - cursor = editSession.getLastCursor() - cursor.setBufferPosition [3, 3] - editSession.buffer.delete([[3, 1], [3, 5]]) - expect(cursor.getBufferPosition()).toEqual [3, 1] - expect(editSession.getAnchors().indexOf(cursor.anchor)).not.toBe -1 - - selection = editSession.getLastSelection() - selection.setBufferRange [[3, 5], [3, 10]] - editSession.buffer.delete [[3, 3], [3, 8]] - expect(selection.getBufferRange()).toEqual [[3, 3], [3, 5]] - expect(editSession.getAnchors().indexOf(selection.anchor)).not.toBe -1 - - it "merges cursors when the change causes them to overlap", -> - editSession.setCursorScreenPosition([0, 0]) - editSession.addCursorAtScreenPosition([0, 1]) - editSession.addCursorAtScreenPosition([1, 1]) - - [cursor1, cursor2, cursor3] = editSession.getCursors() - expect(editSession.getCursors().length).toBe 3 - - buffer.delete([[0, 0], [0, 1]]) - - expect(editSession.getCursors().length).toBe 2 - expect(editSession.getCursors()).toEqual [cursor1, cursor3] - expect(cursor1.getBufferPosition()).toEqual [0,0] - expect(cursor3.getBufferPosition()).toEqual [1,1] - - describe "folding", -> - describe "structural folding", -> - it "maintains cursor buffer position when a fold is created/destroyed", -> - editSession.setCursorBufferPosition([5,5]) - editSession.foldAll() - expect(editSession.getCursorBufferPosition()).toEqual([5,5]) - - describe "anchors", -> - [anchor, destroyHandler] = [] - - beforeEach -> - destroyHandler = jasmine.createSpy("destroyHandler") - anchor = editSession.addAnchorAtBufferPosition([4, 25]) - anchor.on 'destroy', destroyHandler - - describe "when a buffer change precedes an anchor", -> - it "moves the anchor in accordance with the change", -> - editSession.setSelectedBufferRange([[3, 0], [4, 10]]) - editSession.delete() - expect(anchor.getBufferPosition()).toEqual [3, 15] - expect(destroyHandler).not.toHaveBeenCalled() - - describe "when a buffer change surrounds an anchor", -> - it "destroys the anchor", -> - editSession.setSelectedBufferRange([[3, 0], [5, 0]]) - editSession.delete() - expect(destroyHandler).toHaveBeenCalled() - expect(editSession.getAnchors().indexOf(anchor)).toBe -1 - - describe ".clipBufferPosition(bufferPosition)", -> - it "clips the given position to a valid position", -> - expect(editSession.clipBufferPosition([-1, -1])).toEqual [0,0] - expect(editSession.clipBufferPosition([Infinity, Infinity])).toEqual [12,2] - expect(editSession.clipBufferPosition([8, 57])).toEqual [8, 56] diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee deleted file mode 100644 index e8ae4ecae..000000000 --- a/spec/app/editor-spec.coffee +++ /dev/null @@ -1,1646 +0,0 @@ -RootView = require 'root-view' -EditSession = require 'edit-session' -Buffer = require 'buffer' -Editor = require 'editor' -Range = require 'range' -Project = require 'project' -$ = require 'jquery' -{$$} = require 'space-pen' -_ = require 'underscore' -fs = require 'fs' - -describe "Editor", -> - [rootView, project, buffer, editor, cachedLineHeight] = [] - - getLineHeight = -> - return cachedLineHeight if cachedLineHeight? - editorForMeasurement = new Editor(editSession: rootView.project.buildEditSessionForPath('sample.js')) - editorForMeasurement.attachToDom() - cachedLineHeight = editorForMeasurement.lineHeight - editorForMeasurement.remove() - cachedLineHeight - - beforeEach -> - rootView = new RootView(require.resolve('fixtures/sample.js')) - project = rootView.project - editor = rootView.getActiveEditor() - buffer = editor.getBuffer() - - editor.attachToDom = ({ heightInLines } = {}) -> - heightInLines ?= this.getBuffer().getLineCount() - this.height(getLineHeight() * heightInLines) - $('#jasmine-content').append(this) - - editor.lineOverdraw = 2 - editor.enableKeymap() - editor.isFocused = true - - afterEach -> - rootView.remove() - - describe "construction", -> - it "throws an error if no editor session is given", -> - expect(-> new Editor).toThrow() - - describe ".copy()", -> - it "builds a new editor with the same edit sessions, cursor position, and scroll position as the receiver", -> - rootView.attachToDom() - rootView.height(8 * editor.lineHeight) - rootView.width(50 * editor.charWidth) - - editor.edit(rootView.project.buildEditSessionForPath('two-hundred.txt')) - editor.setCursorScreenPosition([5, 1]) - editor.scrollTop(1.5 * editor.lineHeight) - editor.scrollView.scrollLeft(44) - - # proves this test covers serialization and deserialization - spyOn(editor, 'serialize').andCallThrough() - spyOn(Editor, 'deserialize').andCallThrough() - - newEditor = editor.copy() - expect(editor.serialize).toHaveBeenCalled() - expect(Editor.deserialize).toHaveBeenCalled() - - expect(newEditor.getBuffer()).toBe editor.getBuffer() - expect(newEditor.getCursorScreenPosition()).toEqual editor.getCursorScreenPosition() - expect(newEditor.editSessions).toEqual(editor.editSessions) - expect(newEditor.activeEditSession).toEqual(editor.activeEditSession) - expect(newEditor.getActiveEditSessionIndex()).toEqual(editor.getActiveEditSessionIndex()) - - newEditor.height(editor.height()) - newEditor.width(editor.width()) - rootView.remove() - newEditor.attachToDom() - expect(newEditor.scrollTop()).toBe editor.scrollTop() - expect(newEditor.scrollView.scrollLeft()).toBe 44 - - describe "when the editor is attached to the dom", -> - it "calculates line height and char width and updates the pixel position of the cursor", -> - expect(editor.lineHeight).toBeNull() - expect(editor.charWidth).toBeNull() - editor.setCursorScreenPosition(row: 2, column: 2) - - editor.attachToDom() - - expect(editor.lineHeight).not.toBeNull() - expect(editor.charWidth).not.toBeNull() - expect(editor.find('.cursor').offset()).toEqual pagePixelPositionForPoint(editor, [2, 2]) - - it "is focused", -> - editor.attachToDom() - expect(editor).toMatchSelector ":has(:focus)" - - describe "when the editor recieves focus", -> - it "focuses the hidden input", -> - editor.attachToDom() - editor.focus() - expect(editor).not.toMatchSelector ':focus' - expect(editor.hiddenInput).toMatchSelector ':focus' - - describe "when the hidden input is focused / unfocused", -> - it "assigns the isFocused flag on the editor and also adds/removes the .focused css class", -> - editor.attachToDom() - editor.isFocused = false - editor.hiddenInput.focus() - expect(editor.isFocused).toBeTruthy() - expect(editor).toHaveClass('focused') - - editor.hiddenInput.focusout() - expect(editor.isFocused).toBeFalsy() - expect(editor).not.toHaveClass('focused') - - describe "when the activeEditSession's file is modified on disk", -> - it "triggers an alert", -> - path = "/tmp/atom-changed-file.txt" - fs.write(path, "") - editSession = project.buildEditSessionForPath(path) - editor.edit(editSession) - editor.insertText("now the buffer is modified") - - fileChangeHandler = jasmine.createSpy('fileChange') - editSession.buffer.file.on 'contents-change', fileChangeHandler - - spyOn($native, "alert") - - fs.write(path, "a file change") - - waitsFor "file to trigger contents-change event", -> - fileChangeHandler.callCount > 0 - - runs -> - expect($native.alert).toHaveBeenCalled() - - describe ".remove()", -> - it "removes subscriptions from all edit session buffers", -> - previousEditSession = editor.activeEditSession - otherEditSession = rootView.project.buildEditSessionForPath(rootView.project.resolve('sample.txt')) - expect(previousEditSession.buffer.subscriptionCount()).toBeGreaterThan 1 - - editor.edit(otherEditSession) - expect(otherEditSession.buffer.subscriptionCount()).toBeGreaterThan 1 - - editor.remove() - expect(previousEditSession.buffer.subscriptionCount()).toBe 0 - expect(otherEditSession.buffer.subscriptionCount()).toBe 0 - - describe "when 'close' is triggered", -> - it "closes active edit session and loads next edit session", -> - editor.edit(rootView.project.buildEditSessionForPath()) - editSession = editor.activeEditSession - spyOn(editSession, 'destroy').andCallThrough() - spyOn(editor, "remove").andCallThrough() - editor.trigger "close" - expect(editSession.destroy).toHaveBeenCalled() - expect(editor.remove).not.toHaveBeenCalled() - expect(editor.getBuffer()).toBe buffer - - it "calls remove on the editor if there is one edit session and mini is false", -> - editSession = editor.activeEditSession - expect(editor.mini).toBeFalsy() - expect(editor.editSessions.length).toBe 1 - spyOn(editor, 'remove').andCallThrough() - editor.trigger 'close' - spyOn(editSession, 'destroy').andCallThrough() - expect(editor.remove).toHaveBeenCalled() - - miniEditor = new Editor(mini: true) - spyOn(miniEditor, 'remove').andCallThrough() - miniEditor.trigger 'close' - expect(miniEditor.remove).not.toHaveBeenCalled() - - describe "when buffer is modified", -> - it "triggers an alert and does not close the session", -> - spyOn(editor, 'remove').andCallThrough() - spyOn($native, 'alert') - editor.insertText("I AM CHANGED!") - editor.trigger "close" - expect(editor.remove).not.toHaveBeenCalled() - expect($native.alert).toHaveBeenCalled() - - describe ".edit(editSession)", -> - otherEditSession = null - - beforeEach -> - otherEditSession = rootView.project.buildEditSessionForPath() - - describe "when the edit session wasn't previously assigned to this editor", -> - it "adds edit session to editor", -> - originalEditSessionCount = editor.editSessions.length - editor.edit(otherEditSession) - expect(editor.activeEditSession).toBe otherEditSession - expect(editor.editSessions.length).toBe originalEditSessionCount + 1 - - describe "when the edit session was previously assigned to this editor", -> - it "restores the previous edit session associated with the editor", -> - previousEditSession = editor.activeEditSession - - editor.edit(otherEditSession) - expect(editor.activeEditSession).not.toBe previousEditSession - - editor.edit(previousEditSession) - expect(editor.activeEditSession).toBe previousEditSession - - it "handles buffer manipulation correctly after switching to a new edit session", -> - editor.attachToDom() - editor.insertText("abc\n") - expect(editor.lineElementForScreenRow(0).text()).toBe 'abc' - - editor.edit(otherEditSession) - expect(editor.lineElementForScreenRow(0).html()).toBe ' ' - - editor.insertText("def\n") - expect(editor.lineElementForScreenRow(0).text()).toBe 'def' - - describe "switching edit sessions", -> - [session0, session1, session2] = [] - - beforeEach -> - session0 = editor.activeEditSession - - editor.edit(rootView.project.buildEditSessionForPath('sample.txt')) - session1 = editor.activeEditSession - - editor.edit(rootView.project.buildEditSessionForPath('two-hundred.txt')) - session2 = editor.activeEditSession - - describe ".setActiveEditSessionIndex(index)", -> - it "restores the buffer, cursors, selections, and scroll position of the edit session associated with the index", -> - editor.attachToDom(heightInLines: 10) - editor.setSelectedBufferRange([[40, 0], [43, 1]]) - expect(editor.getSelection().getScreenRange()).toEqual [[40, 0], [43, 1]] - previousScrollHeight = editor.verticalScrollbar.prop('scrollHeight') - editor.scrollTop(750) - expect(editor.scrollTop()).toBe 750 - - editor.setActiveEditSessionIndex(0) - expect(editor.getBuffer()).toBe session0.buffer - - editor.setActiveEditSessionIndex(2) - expect(editor.getBuffer()).toBe session2.buffer - expect(editor.getCursorScreenPosition()).toEqual [43, 1] - expect(editor.verticalScrollbar.prop('scrollHeight')).toBe previousScrollHeight - expect(editor.scrollTop()).toBe 750 - expect(editor.getSelection().getScreenRange()).toEqual [[40, 0], [43, 1]] - expect(editor.getSelectionView().find('.selection')).toExist() - - editor.setActiveEditSessionIndex(0) - editor.activeEditSession.selectToEndOfLine() - expect(editor.getSelectionView().find('.selection')).toExist() - - it "triggers alert if edit session's file changed on disk", -> - path = "/tmp/atom-changed-file.txt" - fs.write(path, "") - editSession = project.buildEditSessionForPath(path) - editor.edit editSession - editSession.insertText("a buffer change") - - bufferContentsChangeHandler = jasmine.createSpy('fileChange') - editSession.on 'buffer-contents-change-on-disk', bufferContentsChangeHandler - - spyOn($native, "alert") - - fs.write(path, "a file change") - - waitsFor "file to trigger contents-change event", -> - bufferContentsChangeHandler.callCount > 0 - - runs -> - expect($native.alert).toHaveBeenCalled() - - describe ".loadNextEditSession()", -> - it "loads the next editor state and wraps to beginning when end is reached", -> - expect(editor.activeEditSession).toBe session2 - editor.loadNextEditSession() - expect(editor.activeEditSession).toBe session0 - editor.loadNextEditSession() - expect(editor.activeEditSession).toBe session1 - editor.loadNextEditSession() - expect(editor.activeEditSession).toBe session2 - - describe ".loadPreviousEditSession()", -> - it "loads the next editor state and wraps to beginning when end is reached", -> - expect(editor.activeEditSession).toBe session2 - editor.loadPreviousEditSession() - expect(editor.activeEditSession).toBe session1 - editor.loadPreviousEditSession() - expect(editor.activeEditSession).toBe session0 - editor.loadPreviousEditSession() - expect(editor.activeEditSession).toBe session2 - - describe ".save()", -> - describe "when the current buffer has a path", -> - tempFilePath = null - - beforeEach -> - rootView.remove() - - tempFilePath = '/tmp/atom-temp.txt' - fs.write(tempFilePath, "") - rootView = new RootView(tempFilePath) - editor = rootView.getActiveEditor() - project = rootView.project - - expect(editor.getPath()).toBe tempFilePath - - afterEach -> - expect(fs.remove(tempFilePath)) - - it "saves the current buffer to disk", -> - editor.getBuffer().setText 'Edited!' - expect(fs.read(tempFilePath)).not.toBe "Edited!" - - editor.save() - - expect(fs.exists(tempFilePath)).toBeTruthy() - expect(fs.read(tempFilePath)).toBe 'Edited!' - - describe "when the current buffer has no path", -> - selectedFilePath = null - beforeEach -> - editor.edit(rootView.project.buildEditSessionForPath()) - - expect(editor.getPath()).toBeUndefined() - editor.getBuffer().setText 'Save me to a new path' - spyOn($native, 'saveDialog').andCallFake -> selectedFilePath - - it "presents a 'save as' dialog", -> - editor.save() - expect($native.saveDialog).toHaveBeenCalled() - - describe "when a path is chosen", -> - it "saves the buffer to the chosen path", -> - selectedFilePath = '/tmp/temp.txt' - - editor.save() - - expect(fs.exists(selectedFilePath)).toBeTruthy() - expect(fs.read(selectedFilePath)).toBe 'Save me to a new path' - - describe "when dialog is cancelled", -> - it "does not save the buffer", -> - selectedFilePath = null - editor.save() - expect(fs.exists(selectedFilePath)).toBeFalsy() - - describe ".scrollTop(n)", -> - beforeEach -> - editor.attachToDom(heightInLines: 5) - expect(editor.verticalScrollbar.scrollTop()).toBe 0 - - describe "when called with a scroll top argument", -> - it "sets the scrollTop of the vertical scrollbar and sets scrollTop on the line numbers and lines", -> - editor.scrollTop(100) - expect(editor.verticalScrollbar.scrollTop()).toBe 100 - expect(editor.scrollView.scrollTop()).toBe 0 - expect(editor.renderedLines.css('top')).toBe "-100px" - expect(editor.gutter.lineNumbers.css('top')).toBe "-100px" - - editor.scrollTop(120) - expect(editor.verticalScrollbar.scrollTop()).toBe 120 - expect(editor.scrollView.scrollTop()).toBe 0 - expect(editor.renderedLines.css('top')).toBe "-120px" - expect(editor.gutter.lineNumbers.css('top')).toBe "-120px" - - it "does not allow negative scrollTops to be assigned", -> - editor.scrollTop(-100) - expect(editor.scrollTop()).toBe 0 - - it "doesn't do anything if the scrollTop hasn't changed", -> - editor.scrollTop(100) - spyOn(editor.verticalScrollbar, 'scrollTop') - spyOn(editor.renderedLines, 'css') - spyOn(editor.gutter.lineNumbers, 'css') - - editor.scrollTop(100) - expect(editor.verticalScrollbar.scrollTop).not.toHaveBeenCalled() - expect(editor.renderedLines.css).not.toHaveBeenCalled() - expect(editor.gutter.lineNumbers.css).not.toHaveBeenCalled() - - describe "when the 'adjustVerticalScrollbar' option is false (defaults to true)", -> - it "doesn't adjust the scrollTop of the vertical scrollbar", -> - editor.scrollTop(100, adjustVerticalScrollbar: false) - expect(editor.verticalScrollbar.scrollTop()).toBe 0 - expect(editor.renderedLines.css('top')).toBe "-100px" - expect(editor.gutter.lineNumbers.css('top')).toBe "-100px" - - describe "when called with no argument", -> - it "returns the last assigned value or 0 if none has been assigned", -> - expect(editor.scrollTop()).toBe 0 - editor.scrollTop(50) - expect(editor.scrollTop()).toBe 50 - - describe "split methods", -> - describe "when inside a pane", -> - fakePane = null - beforeEach -> - fakePane = { splitUp: jasmine.createSpy('splitUp').andReturn({}), remove: -> } - spyOn(editor, 'pane').andReturn(fakePane) - - it "calls the corresponding split method on the containing pane with a new editor containing a copy of the active edit session", -> - editor.edit project.buildEditSessionForPath("sample.txt") - editor.splitUp() - expect(fakePane.splitUp).toHaveBeenCalled() - [newEditor] = fakePane.splitUp.argsForCall[0] - expect(newEditor.editSessions.length).toEqual 1 - expect(newEditor.activeEditSession.buffer).toBe editor.activeEditSession.buffer - newEditor.remove() - - describe "when not inside a pane", -> - it "does not split the editor, but doesn't throw an exception", -> - editor.splitUp().remove() - editor.splitDown().remove() - editor.splitLeft().remove() - editor.splitRight().remove() - - describe "editor-open event", -> - it 'only triggers an editor-open event when it is first added to the DOM', -> - openHandler = jasmine.createSpy('openHandler') - editor.on 'editor-open', openHandler - - editor.simulateDomAttachment() - expect(openHandler).toHaveBeenCalled() - [event, eventEditor] = openHandler.argsForCall[0] - expect(eventEditor).toBe editor - - openHandler.reset() - editor.simulateDomAttachment() - expect(openHandler).not.toHaveBeenCalled() - - describe "editor-path-change event", -> - path = null - beforeEach -> - path = "/tmp/something.txt" - fs.write(path, path) - - afterEach -> - fs.remove(path) if fs.exists(path) - - it "emits event when buffer's path is changed", -> - eventHandler = jasmine.createSpy('eventHandler') - editor.on 'editor-path-change', eventHandler - editor.getBuffer().saveAs(path) - expect(eventHandler).toHaveBeenCalled() - - it "emits event when editor receives a new buffer", -> - eventHandler = jasmine.createSpy('eventHandler') - editor.on 'editor-path-change', eventHandler - editor.edit(rootView.project.buildEditSessionForPath(path)) - expect(eventHandler).toHaveBeenCalled() - - it "stops listening to events on previously set buffers", -> - eventHandler = jasmine.createSpy('eventHandler') - oldBuffer = editor.getBuffer() - editor.on 'editor-path-change', eventHandler - - editor.edit(rootView.project.buildEditSessionForPath(path)) - expect(eventHandler).toHaveBeenCalled() - - eventHandler.reset() - oldBuffer.saveAs("/tmp/atom-bad.txt") - expect(eventHandler).not.toHaveBeenCalled() - - eventHandler.reset() - editor.getBuffer().saveAs("/tmp/atom-new.txt") - expect(eventHandler).toHaveBeenCalled() - - describe "font size", -> - it "sets the initial font size based on the value assigned to the root view", -> - rootView.setFontSize(20) - rootView.simulateDomAttachment() - newEditor = editor.splitRight() - expect(editor.css('font-size')).toBe '20px' - expect(newEditor.css('font-size')).toBe '20px' - - describe "when the font size changes on the view", -> - it "updates the font sizes of editors and recalculates dimensions critical to cursor positioning", -> - rootView.attachToDom() - rootView.setFontSize(10) - lineHeightBefore = editor.lineHeight - charWidthBefore = editor.charWidth - editor.setCursorScreenPosition [5, 5] - - rootView.setFontSize(30) - expect(editor.css('font-size')).toBe '30px' - expect(editor.lineHeight).toBeGreaterThan lineHeightBefore - expect(editor.charWidth).toBeGreaterThan charWidthBefore - expect(editor.getCursorView().position()).toEqual { top: 5 * editor.lineHeight, left: 5 * editor.charWidth } - - # ensure we clean up font size subscription - editor.trigger('close') - rootView.setFontSize(22) - expect(editor.css('font-size')).toBe '30px' - - it "updates the gutter width and font size", -> - rootView.attachToDom() - originalFontSize = rootView.getFontSize() - originalGutterWidth = editor.gutter.width() - - rootView.setFontSize(originalFontSize * 4) - expect(editor.gutter.css('font-size')).toBe "#{originalFontSize * 4}px" - expect(editor.gutter.width()).toBe(originalGutterWidth * 4) - - it "updates lines if there are unrendered lines", -> - editor.attachToDom(heightInLines: 5) - originalLineCount = editor.renderedLines.find(".line").length - expect(originalLineCount).toBeGreaterThan 0 - editor.setFontSize(10) - expect(editor.renderedLines.find(".line").length).toBeGreaterThan originalLineCount - - describe "mouse events", -> - beforeEach -> - editor.attachToDom() - editor.css(position: 'absolute', top: 10, left: 10) - - describe "single-click", -> - it "re-positions the cursor to the clicked row / column", -> - expect(editor.getCursorScreenPosition()).toEqual(row: 0, column: 0) - - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [3, 10]) - expect(editor.getCursorScreenPosition()).toEqual(row: 3, column: 10) - - describe "when the lines are scrolled to the right", -> - it "re-positions the cursor on the clicked location", -> - setEditorWidthInChars(editor, 30) - expect(editor.getCursorScreenPosition()).toEqual(row: 0, column: 0) - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [3, 30]) # scrolls lines to the right - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [3, 50]) - expect(editor.getCursorBufferPosition()).toEqual(row: 3, column: 50) - - describe "double-click", -> - it "selects the word under the cursor", -> - expect(editor.getCursorScreenPosition()).toEqual(row: 0, column: 0) - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [0, 8], originalEvent: {detail: 1}) - editor.renderedLines.trigger 'mouseup' - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [0, 8], originalEvent: {detail: 2}) - editor.renderedLines.trigger 'mouseup' - expect(editor.getSelectedText()).toBe "quicksort" - - describe "triple/quardruple/etc-click", -> - it "selects the line under the cursor", -> - expect(editor.getCursorScreenPosition()).toEqual(row: 0, column: 0) - - # Triple click - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [1, 8], originalEvent: {detail: 1}) - editor.renderedLines.trigger 'mouseup' - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [1, 8], originalEvent: {detail: 2}) - editor.renderedLines.trigger 'mouseup' - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [1, 8], originalEvent: {detail: 3}) - editor.renderedLines.trigger 'mouseup' - expect(editor.getSelectedText()).toBe " var sort = function(items) {" - - # Quad click - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [2, 3], originalEvent: {detail: 1}) - editor.renderedLines.trigger 'mouseup' - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [2, 3], originalEvent: {detail: 2}) - editor.renderedLines.trigger 'mouseup' - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [2, 3], originalEvent: {detail: 3}) - editor.renderedLines.trigger 'mouseup' - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [2, 3], originalEvent: {detail: 4}) - editor.renderedLines.trigger 'mouseup' - expect(editor.getSelectedText()).toBe " if (items.length <= 1) return items;" - - describe "shift-click", -> - it "selects from the cursor's current location to the clicked location", -> - editor.setCursorScreenPosition([4, 7]) - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [5, 24], shiftKey: true) - expect(editor.getSelection().getScreenRange()).toEqual [[4, 7], [5, 24]] - - describe "shift-double-click", -> - it "expands the selection to include the double-clicked word", -> - editor.setCursorScreenPosition([4, 7]) - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [5, 24], shiftKey: true, originalEvent: { detail: 1 }) - editor.renderedLines.trigger 'mouseup' - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [5, 24], shiftKey: true, originalEvent: { detail: 2 }) - editor.renderedLines.trigger 'mouseup' - expect(editor.getSelection().getScreenRange()).toEqual [[4, 7], [5, 27]] - - describe "shift-triple-click", -> - it "expands the selection to include the triple-clicked line", -> - editor.setCursorScreenPosition([4, 7]) - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [5, 24], shiftKey: true, originalEvent: { detail: 1 }) - editor.renderedLines.trigger 'mouseup' - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [5, 24], shiftKey: true, originalEvent: { detail: 2 }) - editor.renderedLines.trigger 'mouseup' - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [5, 24], shiftKey: true, originalEvent: { detail: 3 }) - editor.renderedLines.trigger 'mouseup' - expect(editor.getSelection().getScreenRange()).toEqual [[4, 7], [5, 30]] - - describe "meta-click", -> - it "places an additional cursor", -> - editor.attachToDom() - setEditorHeightInLines(editor, 5) - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [3, 0]) - editor.scrollTop(editor.lineHeight * 6) - - spyOn(editor, "scrollTo").andCallThrough() - - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [6, 0], metaKey: true) - expect(editor.scrollTo.callCount).toBe 1 - - [cursor1, cursor2] = editor.getCursorViews() - expect(cursor1.position()).toEqual(top: 3 * editor.lineHeight, left: 0) - expect(cursor1.getBufferPosition()).toEqual [3, 0] - expect(cursor2.position()).toEqual(top: 6 * editor.lineHeight, left: 0) - expect(cursor2.getBufferPosition()).toEqual [6, 0] - - describe "click and drag", -> - it "creates a selection from the initial click to mouse cursor's location ", -> - editor.attachToDom() - editor.css(position: 'absolute', top: 10, left: 10) - - # start - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [4, 10]) - - # moving changes selection - editor.renderedLines.trigger mousemoveEvent(editor: editor, point: [5, 27]) - - range = editor.getSelection().getScreenRange() - expect(range.start).toEqual({row: 4, column: 10}) - expect(range.end).toEqual({row: 5, column: 27}) - expect(editor.getCursorScreenPosition()).toEqual(row: 5, column: 27) - - # mouse up may occur outside of editor, but still need to halt selection - $(document).trigger 'mouseup' - - # moving after mouse up should not change selection - editor.renderedLines.trigger mousemoveEvent(editor: editor, point: [8, 8]) - - range = editor.getSelection().getScreenRange() - expect(range.start).toEqual({row: 4, column: 10}) - expect(range.end).toEqual({row: 5, column: 27}) - expect(editor.getCursorScreenPosition()).toEqual(row: 5, column: 27) - - describe "double-click and drag", -> - it "creates a selection from the word underneath an initial double click to mouse's new location ", -> - editor.attachToDom() - editor.css(position: 'absolute', top: 10, left: 10) - - # double click - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [4, 7], originalEvent: {detail: 1}) - $(document).trigger 'mouseup' - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [4, 7], originalEvent: {detail: 2}) - - # moving changes selection - editor.renderedLines.trigger mousemoveEvent(editor: editor, point: [5, 27]) - - range = editor.getSelection().getScreenRange() - expect(range.start).toEqual({row: 4, column: 4}) - expect(range.end).toEqual({row: 5, column: 27}) - expect(editor.getCursorScreenPosition()).toEqual(row: 5, column: 27) - - # mouse up may occur outside of editor, but still need to halt selection - $(document).trigger 'mouseup' - - # moving after mouse up should not change selection - editor.renderedLines.trigger mousemoveEvent(editor: editor, point: [8, 8]) - - range = editor.getSelection().getScreenRange() - expect(range.start).toEqual({row: 4, column: 4}) - expect(range.end).toEqual({row: 5, column: 27}) - expect(editor.getCursorScreenPosition()).toEqual(row: 5, column: 27) - - describe "trip-click and drag", -> - it "creates a selection from the line underneath an initial triple click to mouse's new location ", -> - editor.attachToDom() - editor.css(position: 'absolute', top: 10, left: 10) - - # double click - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [4, 7], originalEvent: {detail: 1}) - $(document).trigger 'mouseup' - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [4, 7], originalEvent: {detail: 2}) - $(document).trigger 'mouseup' - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [4, 7], originalEvent: {detail: 3}) - - # moving changes selection - editor.renderedLines.trigger mousemoveEvent(editor: editor, point: [5, 27]) - - range = editor.getSelection().getScreenRange() - expect(range.start).toEqual({row: 4, column: 0}) - expect(range.end).toEqual({row: 5, column: 27}) - expect(editor.getCursorScreenPosition()).toEqual(row: 5, column: 27) - - # mouse up may occur outside of editor, but still need to halt selection - $(document).trigger 'mouseup' - - # moving after mouse up should not change selection - editor.renderedLines.trigger mousemoveEvent(editor: editor, point: [8, 8]) - - range = editor.getSelection().getScreenRange() - expect(range.start).toEqual({row: 4, column: 0}) - expect(range.end).toEqual({row: 5, column: 27}) - expect(editor.getCursorScreenPosition()).toEqual(row: 5, column: 27) - - describe "meta-click and drag", -> - it "adds an additional selection", -> - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [4, 10]) - editor.renderedLines.trigger mousemoveEvent(editor: editor, point: [5, 27]) - editor.renderedLines.trigger 'mouseup' - - editor.renderedLines.trigger mousedownEvent(editor: editor, point: [6, 10], metaKey: true) - editor.renderedLines.trigger mousemoveEvent(editor: editor, point: [8, 27], metaKey: true) - editor.renderedLines.trigger 'mouseup' - - selections = editor.getSelections() - expect(selections.length).toBe 2 - [selection1, selection2] = selections - expect(selection1.getScreenRange()).toEqual [[4, 10], [5, 27]] - expect(selection2.getScreenRange()).toEqual [[6, 10], [8, 27]] - - describe "when text input events are triggered on the hidden input element", -> - it "inserts the typed character at the cursor position, both in the buffer and the pre element", -> - editor.attachToDom() - editor.setCursorScreenPosition(row: 1, column: 6) - - expect(buffer.lineForRow(1).charAt(6)).not.toBe 'q' - - editor.hiddenInput.textInput 'q' - - expect(buffer.lineForRow(1).charAt(6)).toBe 'q' - expect(editor.getCursorScreenPosition()).toEqual(row: 1, column: 7) - expect(editor.renderedLines.find('.line:eq(1)')).toHaveText buffer.lineForRow(1) - - describe "selection rendering", -> - [charWidth, lineHeight, selection, selectionView] = [] - - beforeEach -> - editor.attachToDom() - editor.width(500) - { charWidth, lineHeight } = editor - selection = editor.getSelection() - selectionView = editor.getSelectionView() - - describe "when a selection is added", -> - it "adds a selection view for it with the proper regions", -> - editor.activeEditSession.addSelectionForBufferRange([[2, 7], [2, 25]]) - selectionViews = editor.getSelectionViews() - expect(selectionViews.length).toBe 2 - expect(selectionViews[1].regions.length).toBe 1 - region = selectionViews[1].regions[0] - expect(region.position().top).toBe(2 * lineHeight) - expect(region.position().left).toBe(7 * charWidth) - expect(region.height()).toBe lineHeight - expect(region.width()).toBe((25 - 7) * charWidth) - - describe "when a selection changes", -> - describe "when the selection is within a single line", -> - it "covers the selection's range with a single region", -> - selection.setBufferRange(new Range({row: 2, column: 7}, {row: 2, column: 25})) - - expect(selectionView.regions.length).toBe 1 - region = selectionView.regions[0] - expect(region.position().top).toBe(2 * lineHeight) - expect(region.position().left).toBe(7 * charWidth) - expect(region.height()).toBe lineHeight - expect(region.width()).toBe((25 - 7) * charWidth) - - describe "when the selection spans 2 lines", -> - it "covers the selection's range with 2 regions", -> - selection.setBufferRange(new Range({row: 2, column: 7}, {row: 3, column: 25})) - - expect(selectionView.regions.length).toBe 2 - - region1 = selectionView.regions[0] - expect(region1.position().top).toBe(2 * lineHeight) - expect(region1.position().left).toBe(7 * charWidth) - expect(region1.height()).toBe lineHeight - expect(region1.width()).toBe(editor.renderedLines.width() - region1.position().left) - - region2 = selectionView.regions[1] - expect(region2.position().top).toBe(3 * lineHeight) - expect(region2.position().left).toBe(0) - expect(region2.height()).toBe lineHeight - expect(region2.width()).toBe(25 * charWidth) - - describe "when the selection spans more than 2 lines", -> - it "covers the selection's range with 3 regions", -> - selection.setBufferRange(new Range({row: 2, column: 7}, {row: 6, column: 25})) - - expect(selectionView.regions.length).toBe 3 - - region1 = selectionView.regions[0] - expect(region1.position().top).toBe(2 * lineHeight) - expect(region1.position().left).toBe(7 * charWidth) - expect(region1.height()).toBe lineHeight - expect(region1.width()).toBe(editor.renderedLines.width() - region1.position().left) - - region2 = selectionView.regions[1] - expect(region2.position().top).toBe(3 * lineHeight) - expect(region2.position().left).toBe(0) - expect(region2.height()).toBe(3 * lineHeight) - expect(region2.width()).toBe(editor.renderedLines.width()) - - # resizes with the editor - expect(editor.width()).toBeLessThan(800) - editor.width(800) - expect(region2.width()).toBe(editor.renderedLines.width()) - - region3 = selectionView.regions[2] - expect(region3.position().top).toBe(6 * lineHeight) - expect(region3.position().left).toBe(0) - expect(region3.height()).toBe lineHeight - expect(region3.width()).toBe(25 * charWidth) - - it "clears previously drawn regions before creating new ones", -> - selection.setBufferRange(new Range({row: 2, column: 7}, {row: 4, column: 25})) - expect(selectionView.regions.length).toBe 3 - expect(selectionView.find('.selection').length).toBe 3 - - selectionView.updateAppearance() - expect(selectionView.regions.length).toBe 3 - expect(selectionView.find('.selection').length).toBe 3 - - describe "when a selection merges with another selection", -> - it "removes the merged selection view", -> - editSession = editor.activeEditSession - editSession.setCursorScreenPosition([4, 10]) - editSession.selectToScreenPosition([5, 27]) - editSession.addCursorAtScreenPosition([3, 10]) - editSession.selectToScreenPosition([6, 27]) - - expect(editor.getSelectionViews().length).toBe 1 - expect(editor.find('.selection').length).toBe 3 - - describe "cursor rendering", -> - describe "when the cursor moves", -> - charWidth = null - - beforeEach -> - editor.attachToDom() - editor.vScrollMargin = 3 - editor.hScrollMargin = 5 - {charWidth} = editor - - it "repositions the cursor's view on screen", -> - editor.setCursorScreenPosition(row: 2, column: 2) - expect(editor.getCursorView().position()).toEqual(top: 2 * editor.lineHeight, left: 2 * editor.charWidth) - - it "removes the idle class while moving, then adds it back when it stops", -> - cursorView = editor.getCursorView() - advanceClock(200) - - expect(cursorView).toHaveClass 'idle' - editor.setCursorScreenPosition([1, 2]) - expect(cursorView).not.toHaveClass 'idle' - - window.advanceClock(200) - expect(cursorView).toHaveClass 'idle' - - editor.setCursorScreenPosition([1, 3]) - advanceClock(100) - - editor.setCursorScreenPosition([1, 4]) - advanceClock(100) - expect(cursorView).not.toHaveClass 'idle' - - advanceClock(100) - expect(cursorView).toHaveClass 'idle' - - describe "auto-scrolling", -> - it "only auto-scrolls when the last cursor is moved", -> - editor.setCursorBufferPosition([11,0]) - editor.addCursorAtBufferPosition([6,50]) - [cursor1, cursor2] = editor.getCursors() - - spyOn(editor, 'scrollTo') - cursor1.setScreenPosition([10, 10]) - expect(editor.scrollTo).not.toHaveBeenCalled() - - cursor2.setScreenPosition([11, 11]) - expect(editor.scrollTo).toHaveBeenCalled() - - describe "when the last cursor exceeds the upper or lower scroll margins", -> - describe "when the editor is taller than twice the vertical scroll margin", -> - it "sets the scrollTop so the cursor remains within the scroll margin", -> - setEditorHeightInLines(editor, 10) - - _.times 6, -> editor.moveCursorDown() - expect(editor.scrollTop()).toBe(0) - - editor.moveCursorDown() - expect(editor.scrollTop()).toBe(editor.lineHeight) - - editor.moveCursorDown() - expect(editor.scrollTop()).toBe(editor.lineHeight * 2) - - _.times 3, -> editor.moveCursorUp() - - editor.moveCursorUp() - expect(editor.scrollTop()).toBe(editor.lineHeight) - - editor.moveCursorUp() - expect(editor.scrollTop()).toBe(0) - - describe "when the editor is shorter than twice the vertical scroll margin", -> - it "sets the scrollTop based on a reduced scroll margin, which prevents a jerky tug-of-war between upper and lower scroll margins", -> - setEditorHeightInLines(editor, 5) - - _.times 3, -> editor.moveCursorDown() - - expect(editor.scrollTop()).toBe(editor.lineHeight) - - editor.moveCursorUp() - expect(editor.renderedLines.css('top')).toBe "0px" - - describe "when the last cursor exceeds the right or left scroll margins", -> - describe "when soft-wrap is disabled", -> - describe "when the editor is wider than twice the horizontal scroll margin", -> - it "sets the scrollView's scrollLeft so the cursor remains within the scroll margin", -> - setEditorWidthInChars(editor, 30) - - # moving right - editor.setCursorScreenPosition([2, 24]) - expect(editor.scrollView.scrollLeft()).toBe 0 - - editor.setCursorScreenPosition([2, 25]) - expect(editor.scrollView.scrollLeft()).toBe charWidth - - editor.setCursorScreenPosition([2, 28]) - expect(editor.scrollView.scrollLeft()).toBe charWidth * 4 - - # moving left - editor.setCursorScreenPosition([2, 9]) - expect(editor.scrollView.scrollLeft()).toBe charWidth * 4 - - editor.setCursorScreenPosition([2, 8]) - expect(editor.scrollView.scrollLeft()).toBe charWidth * 3 - - editor.setCursorScreenPosition([2, 5]) - expect(editor.scrollView.scrollLeft()).toBe 0 - - describe "when the editor is narrower than twice the horizontal scroll margin", -> - it "sets the scrollView's scrollLeft based on a reduced horizontal scroll margin, to prevent a jerky tug-of-war between right and left scroll margins", -> - editor.hScrollMargin = 6 - setEditorWidthInChars(editor, 7) - - editor.setCursorScreenPosition([2, 3]) - window.advanceClock() - expect(editor.scrollView.scrollLeft()).toBe(0) - - editor.setCursorScreenPosition([2, 4]) - window.advanceClock() - expect(editor.scrollView.scrollLeft()).toBe(charWidth) - - editor.setCursorScreenPosition([2, 3]) - window.advanceClock() - expect(editor.scrollView.scrollLeft()).toBe(0) - - describe "when soft-wrap is enabled", -> - beforeEach -> - editor.setSoftWrap(true) - - it "does not scroll the buffer horizontally", -> - editor.width(charWidth * 30) - - # moving right - editor.setCursorScreenPosition([2, 24]) - expect(editor.scrollView.scrollLeft()).toBe 0 - - editor.setCursorScreenPosition([2, 25]) - expect(editor.scrollView.scrollLeft()).toBe 0 - - editor.setCursorScreenPosition([2, 28]) - expect(editor.scrollView.scrollLeft()).toBe 0 - - # moving left - editor.setCursorScreenPosition([2, 9]) - expect(editor.scrollView.scrollLeft()).toBe 0 - - editor.setCursorScreenPosition([2, 8]) - expect(editor.scrollView.scrollLeft()).toBe 0 - - editor.setCursorScreenPosition([2, 5]) - expect(editor.scrollView.scrollLeft()).toBe 0 - - describe "text rendering", -> - describe "when all lines in the buffer are visible on screen", -> - beforeEach -> - editor.attachToDom() - expect(editor.height()).toBe buffer.getLineCount() * editor.lineHeight - - it "creates a line element for each line in the buffer with the html-escaped text of the line", -> - expect(editor.renderedLines.find('.line').length).toEqual(buffer.getLineCount()) - expect(buffer.lineForRow(2)).toContain('<') - expect(editor.renderedLines.find('.line:eq(2)').html()).toContain '<' - - # renders empty lines with a non breaking space - expect(buffer.lineForRow(10)).toBe '' - expect(editor.renderedLines.find('.line:eq(10)').html()).toBe ' ' - - it "syntax highlights code based on the file type", -> - line1 = editor.renderedLines.find('.line:first') - expect(line1.find('span:eq(0)')).toMatchSelector '.storage-type-js' - expect(line1.find('span:eq(0)').text()).toBe 'var' - expect(line1.find('span:eq(1)')).toMatchSelector '.source-js' - expect(line1.find('span:eq(1)').text()).toBe ' ' - expect(line1.find('span:eq(2)')).toMatchSelector '.entity-name-function-js' - expect(line1.find('span:eq(2)').text()).toBe 'quicksort' - expect(line1.find('span:eq(4)')).toMatchSelector '.keyword-operator-js' - expect(line1.find('span:eq(4)').text()).toBe '=' - - line12 = editor.renderedLines.find('.line:eq(11)') - expect(line12.find('span:eq(1)')).toMatchSelector '.keyword' - - describe "when lines are updated in the buffer", -> - it "syntax highlights the updated lines", -> - expect(editor.renderedLines.find('.line:eq(0) span:eq(0)')).toMatchSelector '.storage-type-js' - buffer.insert([0, 0], "q") - expect(editor.renderedLines.find('.line:eq(0) span:eq(0)')).not.toMatchSelector '.storage-type-js' - - # verify that re-highlighting can occur below the changed line - buffer.insert([5,0], "/* */") - buffer.insert([1,0], "/*") - expect(editor.renderedLines.find('.line:eq(2) span:eq(0)')).toMatchSelector '.comment' - - describe "when soft-wrap is enabled", -> - beforeEach -> - setEditorHeightInLines(editor, 20) - setEditorWidthInChars(editor, 50) - editor.setSoftWrap(true) - expect(editor.activeEditSession.softWrapColumn).toBe 50 - - it "wraps lines that are too long to fit within the editor's width, adjusting cursor positioning accordingly", -> - expect(editor.renderedLines.find('.line').length).toBe 16 - expect(editor.renderedLines.find('.line:eq(3)').text()).toBe " var pivot = items.shift(), current, left = [], " - expect(editor.renderedLines.find('.line:eq(4)').text()).toBe "right = [];" - - editor.setCursorBufferPosition([3, 51]) - expect(editor.find('.cursor').offset()).toEqual(editor.renderedLines.find('.line:eq(4)').offset()) - - editor.setCursorBufferPosition([4, 0]) - expect(editor.find('.cursor').offset()).toEqual(editor.renderedLines.find('.line:eq(5)').offset()) - - editor.getSelection().setBufferRange(new Range([6, 30], [6, 55])) - [region1, region2] = editor.getSelectionView().regions - expect(region1.offset().top).toBe(editor.renderedLines.find('.line:eq(7)').offset().top) - expect(region2.offset().top).toBe(editor.renderedLines.find('.line:eq(8)').offset().top) - - it "handles changes to wrapped lines correctly", -> - buffer.insert([6, 28], '1234567') - expect(editor.renderedLines.find('.line:eq(7)').text()).toBe ' current < pivot ? left1234567.push(current) ' - expect(editor.renderedLines.find('.line:eq(8)').text()).toBe ': right.push(current);' - expect(editor.renderedLines.find('.line:eq(9)').text()).toBe ' }' - - it "changes the max line length and repositions the cursor when the window size changes", -> - editor.setCursorBufferPosition([3, 60]) - setEditorWidthInChars(editor, 40) - $(window).trigger 'resize' - expect(editor.renderedLines.find('.line').length).toBe 19 - expect(editor.renderedLines.find('.line:eq(4)').text()).toBe "left = [], right = [];" - expect(editor.renderedLines.find('.line:eq(5)').text()).toBe " while(items.length > 0) {" - expect(editor.bufferPositionForScreenPosition(editor.getCursorScreenPosition())).toEqual [3, 60] - - it "does not wrap the lines of any newly assigned buffers", -> - otherEditSession = rootView.project.buildEditSessionForPath() - otherEditSession.buffer.setText([1..100].join('')) - editor.edit(otherEditSession) - expect(editor.renderedLines.find('.line').length).toBe(1) - - it "unwraps lines and cancels window resize listener when softwrap is disabled", -> - editor.toggleSoftWrap() - expect(editor.renderedLines.find('.line:eq(3)').text()).toBe ' var pivot = items.shift(), current, left = [], right = [];' - - spyOn(editor, 'setSoftWrapColumn') - $(window).trigger 'resize' - expect(editor.setSoftWrapColumn).not.toHaveBeenCalled() - - it "allows the cursor to move down to the last line", -> - _.times editor.getLastScreenRow(), -> editor.moveCursorDown() - expect(editor.getCursorScreenPosition()).toEqual [editor.getLastScreenRow(), 0] - editor.moveCursorDown() - expect(editor.getCursorScreenPosition()).toEqual [editor.getLastScreenRow(), 2] - - it "allows the cursor to move up to a shorter soft wrapped line", -> - editor.setCursorScreenPosition([11, 15]) - editor.moveCursorUp() - expect(editor.getCursorScreenPosition()).toEqual [10, 10] - editor.moveCursorUp() - editor.moveCursorUp() - expect(editor.getCursorScreenPosition()).toEqual [8, 15] - - it "it allows the cursor to wrap when moving horizontally past the beginning / end of a wrapped line", -> - editor.setCursorScreenPosition([11, 0]) - editor.moveCursorLeft() - expect(editor.getCursorScreenPosition()).toEqual [10, 10] - - editor.moveCursorRight() - expect(editor.getCursorScreenPosition()).toEqual [11, 0] - - it "calls .setSoftWrapColumn() when the editor is attached because now its dimensions are available to calculate it", -> - otherEditor = new Editor(editSession: rootView.project.buildEditSessionForPath('sample.js')) - spyOn(otherEditor, 'setSoftWrapColumn') - - otherEditor.setSoftWrap(true) - expect(otherEditor.setSoftWrapColumn).not.toHaveBeenCalled() - - otherEditor.simulateDomAttachment() - expect(otherEditor.setSoftWrapColumn).toHaveBeenCalled() - - describe "when some lines at the end of the buffer are not visible on screen", -> - beforeEach -> - editor.attachToDom(heightInLines: 5.5) - - it "only renders the visible lines plus the overdrawn lines, setting the padding-bottom of the lines element to account for the missing lines", -> - expect(editor.renderedLines.find('.line').length).toBe 8 - expectedPaddingBottom = (buffer.getLineCount() - 8) * editor.lineHeight - expect(editor.renderedLines.css('padding-bottom')).toBe "#{expectedPaddingBottom}px" - expect(editor.renderedLines.find('.line:first').text()).toBe buffer.lineForRow(0) - expect(editor.renderedLines.find('.line:last').text()).toBe buffer.lineForRow(7) - - it "renders additional lines when the editor is resized", -> - setEditorHeightInLines(editor, 10) - $(window).trigger 'resize' - - expect(editor.renderedLines.find('.line').length).toBe 12 - expect(editor.renderedLines.find('.line:first').text()).toBe buffer.lineForRow(0) - expect(editor.renderedLines.find('.line:last').text()).toBe buffer.lineForRow(11) - - it "renders correctly when scrolling after text is added to the buffer", -> - editor.insertText("1\n") - _.times 4, -> editor.moveCursorDown() - expect(editor.renderedLines.find('.line:eq(2)').text()).toBe editor.lineForBufferRow(2) - expect(editor.renderedLines.find('.line:eq(7)').text()).toBe editor.lineForBufferRow(7) - - it "renders correctly when scrolling after text is removed from buffer", -> - editor.getBuffer().delete([[0,0],[1,0]]) - expect(editor.renderedLines.find('.line:eq(0)').text()).toBe editor.lineForBufferRow(0) - expect(editor.renderedLines.find('.line:eq(5)').text()).toBe editor.lineForBufferRow(5) - - editor.scrollTop(3 * editor.lineHeight) - expect(editor.renderedLines.find('.line:first').text()).toBe editor.lineForBufferRow(1) - expect(editor.renderedLines.find('.line:last').text()).toBe editor.lineForBufferRow(10) - - describe "when creating and destroying folds that are longer than the visible lines", -> - describe "when the cursor precedes the fold when it is destroyed", -> - it "renders lines and line numbers correctly", -> - scrollHeightBeforeFold = editor.scrollView.prop('scrollHeight') - fold = editor.createFold(1, 9) - fold.destroy() - expect(editor.scrollView.prop('scrollHeight')).toBe scrollHeightBeforeFold - - expect(editor.renderedLines.find('.line').length).toBe 8 - expect(editor.renderedLines.find('.line:last').text()).toBe buffer.lineForRow(7) - - expect(editor.gutter.find('.line-number').length).toBe 8 - expect(editor.gutter.find('.line-number:last').text()).toBe '8' - - editor.scrollTop(4 * editor.lineHeight) - expect(editor.renderedLines.find('.line').length).toBe 10 - expect(editor.renderedLines.find('.line:last').text()).toBe buffer.lineForRow(11) - - describe "when the cursor follows the fold when it is destroyed", -> - it "renders lines and line numbers correctly", -> - fold = editor.createFold(1, 9) - editor.setCursorBufferPosition([10, 0]) - fold.destroy() - - expect(editor.renderedLines.find('.line').length).toBe 8 - expect(editor.renderedLines.find('.line:last').text()).toBe buffer.lineForRow(12) - - expect(editor.gutter.find('.line-number').length).toBe 8 - expect(editor.gutter.find('.line-number:last').text()).toBe '13' - - editor.scrollTop(4 * editor.lineHeight) - - expect(editor.renderedLines.find('.line').length).toBe 10 - expect(editor.renderedLines.find('.line:last').text()).toBe buffer.lineForRow(11) - - describe "when scrolling vertically", -> - describe "when scrolling less than the editor's height", -> - it "draws new lines and removes old lines when the last visible line will exceed the last rendered line", -> - expect(editor.renderedLines.find('.line').length).toBe 8 - - editor.scrollTop(editor.lineHeight * 1.5) - expect(editor.renderedLines.find('.line').length).toBe 8 - expect(editor.renderedLines.find('.line:first').text()).toBe buffer.lineForRow(0) - expect(editor.renderedLines.find('.line:last').text()).toBe buffer.lineForRow(7) - - editor.scrollTop(editor.lineHeight * 3.5) # first visible row will be 3, last will be 8 - expect(editor.renderedLines.find('.line').length).toBe 10 - expect(editor.renderedLines.find('.line:first').text()).toBe buffer.lineForRow(1) - expect(editor.renderedLines.find('.line:last').html()).toBe ' ' # line 10 is blank - expect(editor.gutter.find('.line-number:first').text()).toBe '2' - expect(editor.gutter.find('.line-number:last').text()).toBe '11' - - # here we don't scroll far enough to trigger additional rendering - editor.scrollTop(editor.lineHeight * 5.5) # first visible row will be 5, last will be 10 - expect(editor.renderedLines.find('.line').length).toBe 10 - expect(editor.renderedLines.find('.line:first').text()).toBe buffer.lineForRow(1) - expect(editor.renderedLines.find('.line:last').html()).toBe ' ' # line 10 is blank - expect(editor.gutter.find('.line-number:first').text()).toBe '2' - expect(editor.gutter.find('.line-number:last').text()).toBe '11' - - editor.scrollTop(editor.lineHeight * 7.5) # first visible row is 7, last will be 12 - expect(editor.renderedLines.find('.line').length).toBe 8 - expect(editor.renderedLines.find('.line:first').text()).toBe buffer.lineForRow(5) - expect(editor.renderedLines.find('.line:last').text()).toBe buffer.lineForRow(12) - - editor.scrollTop(editor.lineHeight * 3.5) # first visible row will be 3, last will be 8 - expect(editor.renderedLines.find('.line').length).toBe 10 - expect(editor.renderedLines.find('.line:first').text()).toBe buffer.lineForRow(1) - expect(editor.renderedLines.find('.line:last').html()).toBe ' ' # line 10 is blank - - editor.scrollTop(0) - expect(editor.renderedLines.find('.line').length).toBe 8 - expect(editor.renderedLines.find('.line:first').text()).toBe buffer.lineForRow(0) - expect(editor.renderedLines.find('.line:last').text()).toBe buffer.lineForRow(7) - - describe "when scrolling more than the editors height", -> - it "removes lines that are offscreen and not in range of the overdraw and builds lines that become visible", -> - editor.scrollTop(editor.scrollView.prop('scrollHeight') - editor.scrollView.height()) - expect(editor.renderedLines.find('.line').length).toBe 8 - expect(editor.renderedLines.find('.line:first').text()).toBe buffer.lineForRow(5) - expect(editor.renderedLines.find('.line:last').text()).toBe buffer.lineForRow(12) - - editor.verticalScrollbar.scrollBottom(0) - editor.verticalScrollbar.trigger 'scroll' - expect(editor.renderedLines.find('.line').length).toBe 8 - expect(editor.renderedLines.find('.line:first').text()).toBe buffer.lineForRow(0) - expect(editor.renderedLines.find('.line:last').text()).toBe buffer.lineForRow(7) - - it "adjusts the vertical padding of the lines element to account for non-rendered lines", -> - editor.scrollTop(editor.lineHeight * 3) - firstVisibleBufferRow = 3 - expectedPaddingTop = (firstVisibleBufferRow - editor.lineOverdraw) * editor.lineHeight - expect(editor.renderedLines.css('padding-top')).toBe "#{expectedPaddingTop}px" - - lastVisibleBufferRow = Math.ceil(3 + 5.5) # scroll top in lines + height in lines - lastOverdrawnRow = lastVisibleBufferRow + editor.lineOverdraw - expectedPaddingBottom = ((buffer.getLineCount() - lastOverdrawnRow) * editor.lineHeight) - expect(editor.renderedLines.css('padding-bottom')).toBe "#{expectedPaddingBottom}px" - - editor.scrollToBottom() - # scrolled to bottom, first visible row is 5 and first rendered row is 3 - firstVisibleBufferRow = Math.floor(buffer.getLineCount() - 5.5) - firstOverdrawnBufferRow = firstVisibleBufferRow - editor.lineOverdraw - expectedPaddingTop = firstOverdrawnBufferRow * editor.lineHeight - expect(editor.renderedLines.css('padding-top')).toBe "#{expectedPaddingTop}px" - expect(editor.renderedLines.css('padding-bottom')).toBe "0px" - - describe "when lines are added", -> - beforeEach -> - editor.attachToDom(heightInLines: 5) - spyOn(editor, "scrollTo") - - describe "when the change the precedes the first rendered row", -> - it "inserts and removes rendered lines to account for upstream change", -> - editor.scrollToBottom() - expect(editor.renderedLines.find(".line").length).toBe 7 - expect(editor.renderedLines.find(".line:first").text()).toBe buffer.lineForRow(6) - expect(editor.renderedLines.find(".line:last").text()).toBe buffer.lineForRow(12) - - buffer.change([[1,0], [3,0]], "1\n2\n3\n") - expect(editor.renderedLines.find(".line").length).toBe 8 - expect(editor.renderedLines.find(".line:first").text()).toBe buffer.lineForRow(6) - expect(editor.renderedLines.find(".line:last").text()).toBe buffer.lineForRow(13) - - describe "when the change straddles the first rendered row", -> - it "doesn't render rows that were not previously rendered", -> - editor.scrollToBottom() - - expect(editor.renderedLines.find(".line").length).toBe 7 - expect(editor.renderedLines.find(".line:first").text()).toBe buffer.lineForRow(6) - expect(editor.renderedLines.find(".line:last").text()).toBe buffer.lineForRow(12) - - buffer.change([[2,0], [7,0]], "2\n3\n4\n5\n6\n7\n8\n9\n") - expect(editor.renderedLines.find(".line").length).toBe 9 - expect(editor.renderedLines.find(".line:first").text()).toBe buffer.lineForRow(6) - expect(editor.renderedLines.find(".line:last").text()).toBe buffer.lineForRow(14) - - describe "when the change straddles the last rendered row", -> - it "doesn't render rows that were not previously rendered", -> - buffer.change([[2,0], [7,0]], "2\n3\n4\n5\n6\n7\n8\n") - expect(editor.renderedLines.find(".line").length).toBe 7 - expect(editor.renderedLines.find(".line:first").text()).toBe buffer.lineForRow(0) - expect(editor.renderedLines.find(".line:last").text()).toBe buffer.lineForRow(6) - - describe "when the change the follows the last rendered row", -> - it "does not change the rendered lines", -> - buffer.change([[12,0], [12,0]], "12\n13\n14\n") - expect(editor.renderedLines.find(".line").length).toBe 7 - expect(editor.renderedLines.find(".line:first").text()).toBe buffer.lineForRow(0) - expect(editor.renderedLines.find(".line:last").text()).toBe buffer.lineForRow(6) - - it "increases the width of the rendered lines element to be either the width of the longest line or the width of the scrollView (whichever is longer)", -> - maxLineLength = editor.maxScreenLineLength() - setEditorWidthInChars(editor, maxLineLength) - widthBefore = editor.renderedLines.width() - expect(widthBefore).toBe editor.scrollView.width() - buffer.change([[12,0], [12,0]], [1..maxLineLength*2].join('')) - expect(editor.renderedLines.width()).toBeGreaterThan widthBefore - - describe "when lines are removed", -> - beforeEach -> - editor.attachToDom(heightInLines: 5) - spyOn(editor, "scrollTo") - - it "sets the rendered screen line's width to either the max line length or the scollView's width (whichever is greater)", -> - maxLineLength = editor.maxScreenLineLength() - setEditorWidthInChars(editor, maxLineLength) - buffer.change([[12,0], [12,0]], [1..maxLineLength*2].join('')) - expect(editor.renderedLines.width()).toBeGreaterThan editor.scrollView.width() - widthBefore = editor.renderedLines.width() - buffer.delete([[12, 0], [12, Infinity]]) - expect(editor.renderedLines.width()).toBe editor.scrollView.width() - - describe "when the change the precedes the first rendered row", -> - it "removes rendered lines to account for upstream change", -> - editor.scrollToBottom() - expect(editor.renderedLines.find(".line").length).toBe 7 - expect(editor.renderedLines.find(".line:first").text()).toBe buffer.lineForRow(6) - expect(editor.renderedLines.find(".line:last").text()).toBe buffer.lineForRow(12) - - buffer.change([[1,0], [2,0]], "") - expect(editor.renderedLines.find(".line").length).toBe 6 - expect(editor.renderedLines.find(".line:first").text()).toBe buffer.lineForRow(6) - expect(editor.renderedLines.find(".line:last").text()).toBe buffer.lineForRow(11) - - describe "when the change straddles the first rendered row", -> - it "renders the correct rows", -> - editor.scrollToBottom() - expect(editor.renderedLines.find(".line").length).toBe 7 - expect(editor.renderedLines.find(".line:first").text()).toBe buffer.lineForRow(6) - expect(editor.renderedLines.find(".line:last").text()).toBe buffer.lineForRow(12) - - buffer.change([[7,0], [11,0]], "1\n2\n") - expect(editor.renderedLines.find(".line").length).toBe 5 - expect(editor.renderedLines.find(".line:first").text()).toBe buffer.lineForRow(6) - expect(editor.renderedLines.find(".line:last").text()).toBe buffer.lineForRow(10) - - describe "when the change straddles the last rendered row", -> - it "renders the correct rows", -> - buffer.change([[2,0], [7,0]], "") - expect(editor.renderedLines.find(".line").length).toBe 7 - expect(editor.renderedLines.find(".line:first").text()).toBe buffer.lineForRow(0) - expect(editor.renderedLines.find(".line:last").text()).toBe buffer.lineForRow(6) - - describe "when the change the follows the last rendered row", -> - it "does not change the rendered lines", -> - buffer.change([[10,0], [12,0]], "") - expect(editor.renderedLines.find(".line").length).toBe 7 - expect(editor.renderedLines.find(".line:first").text()).toBe buffer.lineForRow(0) - expect(editor.renderedLines.find(".line:last").text()).toBe buffer.lineForRow(6) - - describe "when the last line is removed when the editor is scrolled to the bottom", -> - it "reduces the editor's scrollTop (due to the reduced total scroll height) and renders the correct screen lines", -> - editor.setCursorScreenPosition([Infinity, Infinity]) - editor.insertText('\n\n\n') - editor.scrollToBottom() - - expect(buffer.getLineCount()).toBe 16 - - initialScrollTop = editor.scrollTop() - expect(editor.firstRenderedScreenRow).toBe 9 - expect(editor.lastRenderedScreenRow).toBe 15 - - editor.backspace() - - expect(editor.scrollTop()).toBeLessThan initialScrollTop - expect(editor.firstRenderedScreenRow).toBe 9 - expect(editor.lastRenderedScreenRow).toBe 14 - - expect(editor.find('.line').length).toBe 6 - - editor.backspace() - expect(editor.firstRenderedScreenRow).toBe 9 - expect(editor.lastRenderedScreenRow).toBe 13 - - expect(editor.find('.line').length).toBe 5 - - editor.backspace() - expect(editor.firstRenderedScreenRow).toBe 6 - expect(editor.lastRenderedScreenRow).toBe 12 - - expect(editor.find('.line').length).toBe 7 - - describe "when folding leaves less then a screen worth of text (regression)", -> - it "renders lines properly", -> - editor.lineOverdraw = 1 - editor.attachToDom(heightInLines: 5) - editor.activeEditSession.foldBufferRow(4) - editor.activeEditSession.foldBufferRow(0) - - expect(editor.renderedLines.find('.line').length).toBe 1 - expect(editor.renderedLines.find('.line').text()).toBe buffer.lineForRow(0) - - describe "when autoscrolling at the end of the document", -> - it "renders lines properly", -> - editor.edit(rootView.project.buildEditSessionForPath('two-hundred.txt')) - editor.attachToDom(heightInLines: 5.5) - - expect(editor.renderedLines.find('.line').length).toBe 8 - - editor.moveCursorToBottom() - - expect(editor.renderedLines.find('.line').length).toBe 8 - - describe "when line has a character that could push it to be too tall (regression)", -> - it "does renders the line at a consistent height", -> - rootView.attachToDom() - buffer.insert([0, 0], "–") - expect(editor.find('.line:eq(0)').outerHeight()).toBe editor.find('.line:eq(1)').outerHeight() - - describe ".spliceLineElements(startRow, rowCount, lineElements)", -> - elements = null - - beforeEach -> - editor.attachToDom() - elements = $$ -> - @div "A", class: 'line' - @div "B", class: 'line' - - describe "when the start row is 0", -> - describe "when the row count is 0", -> - it "inserts the given elements before the first row", -> - editor.spliceLineElements 0, 0, elements - - expect(editor.renderedLines.find('.line:eq(0)').text()).toBe 'A' - expect(editor.renderedLines.find('.line:eq(1)').text()).toBe 'B' - expect(editor.renderedLines.find('.line:eq(2)').text()).toBe 'var quicksort = function () {' - - describe "when the row count is > 0", -> - it "replaces the initial rows with the given elements", -> - editor.spliceLineElements 0, 2, elements - - expect(editor.renderedLines.find('.line:eq(0)').text()).toBe 'A' - expect(editor.renderedLines.find('.line:eq(1)').text()).toBe 'B' - expect(editor.renderedLines.find('.line:eq(2)').text()).toBe ' if (items.length <= 1) return items;' - - describe "when the start row is less than the last row", -> - describe "when the row count is 0", -> - it "inserts the elements at the specified location", -> - editor.spliceLineElements 2, 0, elements - - expect(editor.renderedLines.find('.line:eq(2)').text()).toBe 'A' - expect(editor.renderedLines.find('.line:eq(3)').text()).toBe 'B' - expect(editor.renderedLines.find('.line:eq(4)').text()).toBe ' if (items.length <= 1) return items;' - - describe "when the row count is > 0", -> - it "replaces the elements at the specified location", -> - editor.spliceLineElements 2, 2, elements - - expect(editor.renderedLines.find('.line:eq(2)').text()).toBe 'A' - expect(editor.renderedLines.find('.line:eq(3)').text()).toBe 'B' - expect(editor.renderedLines.find('.line:eq(4)').text()).toBe ' while(items.length > 0) {' - - describe "when the start row is the last row", -> - it "appends the elements to the end of the lines", -> - editor.spliceLineElements 13, 0, elements - - expect(editor.renderedLines.find('.line:eq(12)').text()).toBe '};' - expect(editor.renderedLines.find('.line:eq(13)').text()).toBe 'A' - expect(editor.renderedLines.find('.line:eq(14)').text()).toBe 'B' - expect(editor.renderedLines.find('.line:eq(15)')).not.toExist() - - describe "gutter rendering", -> - beforeEach -> - editor.attachToDom(heightInLines: 5.5) - - it "creates a line number element for each visible line, plus overdraw", -> - expect(editor.gutter.find('.line-number').length).toBe 8 - expect(editor.gutter.find('.line-number:first').text()).toBe "1" - expect(editor.gutter.find('.line-number:last').text()).toBe "8" - - # here we don't scroll far enough to trigger additional rendering - editor.scrollTop(editor.lineHeight * 1.5) - expect(editor.renderedLines.find('.line').length).toBe 8 - expect(editor.gutter.find('.line-number:first').text()).toBe "1" - expect(editor.gutter.find('.line-number:last').text()).toBe "8" - - editor.scrollTop(editor.lineHeight * 3.5) - expect(editor.renderedLines.find('.line').length).toBe 10 - expect(editor.gutter.find('.line-number:first').text()).toBe "2" - expect(editor.gutter.find('.line-number:last').text()).toBe "11" - - describe "width", -> - it "sets the width based on last line number", -> - expect(editor.gutter.lineNumbers.outerWidth()).toBe editor.charWidth * 2 - - it "updates the width when total number of lines gains a digit", -> - oneHundredLines = [0..100].join("\n") - editor.insertText(oneHundredLines) - expect(editor.gutter.lineNumbers.outerWidth()).toBe editor.charWidth * 3 - - describe "when lines are inserted", -> - it "re-renders the correct line number range in the gutter", -> - spyOn(editor, 'scrollTo') - editor.scrollTop(3 * editor.lineHeight) - expect(editor.gutter.find('.line-number:first').text()).toBe '2' - expect(editor.gutter.find('.line-number:last').text()).toBe '11' - - buffer.insert([6, 0], '\n') - - expect(editor.gutter.find('.line-number:first').text()).toBe '2' - expect(editor.gutter.find('.line-number:last').text()).toBe '11' - - describe "when the insertion of lines causes the editor to scroll", -> - it "renders line numbers correctly", -> - oneHundredLines = [0..100].join("\n") - editor.insertText(oneHundredLines) - expect(editor.gutter.lineNumbers.find('.line-number').length).toBe 6 + editor.lineOverdraw * 2 - - describe "when wrapping is on", -> - it "renders a • instead of line number for wrapped portions of lines", -> - editor.setSoftWrapColumn(50) - expect(editor.gutter.find('.line-number').length).toEqual(8) - expect(editor.gutter.find('.line-number:eq(3)').text()).toBe '4' - expect(editor.gutter.find('.line-number:eq(4)').text()).toBe '•' - expect(editor.gutter.find('.line-number:eq(5)').text()).toBe '5' - - describe "when there are folds", -> - it "skips line numbers covered by the fold and updates them when the fold changes", -> - editor.createFold(3, 5) - expect(editor.gutter.find('.line-number:eq(3)').text()).toBe '4' - expect(editor.gutter.find('.line-number:eq(4)').text()).toBe '7' - - buffer.insert([4,0], "\n\n") - expect(editor.gutter.find('.line-number:eq(3)').text()).toBe '4' - expect(editor.gutter.find('.line-number:eq(4)').text()).toBe '9' - - buffer.delete([[3,0], [6,0]]) - expect(editor.gutter.find('.line-number:eq(3)').text()).toBe '4' - expect(editor.gutter.find('.line-number:eq(4)').text()).toBe '6' - - it "redraws gutter numbers when lines are unfolded", -> - setEditorHeightInLines(editor, 20) - fold = editor.createFold(2, 12) - expect(editor.gutter.find('.line-number').length).toBe 3 - - fold.destroy() - expect(editor.gutter.find('.line-number').length).toBe 13 - - describe "when the scrollView is scrolled to the right", -> - it "adds a drop shadow to the gutter", -> - editor.attachToDom() - editor.width(100) - - expect(editor.gutter).not.toHaveClass('drop-shadow') - - editor.scrollView.scrollLeft(10) - editor.scrollView.trigger('scroll') - - expect(editor.gutter).toHaveClass('drop-shadow') - - editor.scrollView.scrollLeft(0) - editor.scrollView.trigger('scroll') - - expect(editor.gutter).not.toHaveClass('drop-shadow') - - describe "when the editor is scrolled vertically", -> - it "adjusts the padding-top to account for non-rendered line numbers", -> - editor.scrollTop(editor.lineHeight * 3.5) - expect(editor.gutter.lineNumbers.css('padding-top')).toBe "#{editor.lineHeight * 1}px" - expect(editor.gutter.lineNumbers.css('padding-bottom')).toBe "#{editor.lineHeight * 2}px" - expect(editor.renderedLines.find('.line').length).toBe 10 - expect(editor.gutter.find('.line-number:first').text()).toBe "2" - expect(editor.gutter.find('.line-number:last').text()).toBe "11" - - describe "folding", -> - beforeEach -> - editSession = rootView.project.buildEditSessionForPath('two-hundred.txt') - buffer = editSession.buffer - editor.edit(editSession) - editor.attachToDom() - - describe "when a fold-selection event is triggered", -> - it "folds the lines covered by the selection into a single line with a fold class", -> - editor.getSelection().setBufferRange(new Range([4, 29], [7, 4])) - editor.trigger 'fold-selection' - - expect(editor.renderedLines.find('.line:eq(4)')).toHaveClass('fold') - expect(editor.renderedLines.find('.line:eq(5)').text()).toBe '8' - - expect(editor.getSelection().isEmpty()).toBeTruthy() - expect(editor.getCursorScreenPosition()).toEqual [5, 0] - - describe "when a fold placeholder line is clicked", -> - it "removes the associated fold and places the cursor at its beginning", -> - editor.setCursorBufferPosition([3,0]) - editor.trigger 'fold-current-row' - - editor.find('.fold.line').mousedown() - - expect(editor.find('.fold')).not.toExist() - expect(editor.renderedLines.find('.line:eq(4)').text()).toMatch /4-+/ - expect(editor.renderedLines.find('.line:eq(5)').text()).toMatch /5/ - - expect(editor.getCursorBufferPosition()).toEqual [3, 0] - - describe "when the unfold-current-row event is triggered when the cursor is on a fold placeholder line", -> - it "removes the associated fold and places the cursor at its beginning", -> - editor.setCursorBufferPosition([3,0]) - editor.trigger 'fold-current-row' - - editor.setCursorBufferPosition([3,0]) - editor.trigger 'unfold-current-row' - - expect(editor.find('.fold')).not.toExist() - expect(editor.renderedLines.find('.line:eq(4)').text()).toMatch /4-+/ - expect(editor.renderedLines.find('.line:eq(5)').text()).toMatch /5/ - - expect(editor.getCursorBufferPosition()).toEqual [3, 0] - - describe "when a selection starts/stops intersecting a fold", -> - it "adds/removes the 'selected' class to the fold's line element and hides the cursor if it is on the fold line", -> - editor.createFold(2, 4) - - editor.setSelectedBufferRange([[1, 0], [2, 0]], preserveFolds: true, reverse: true) - expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.selected') - - editor.setSelectedBufferRange([[1, 0], [1, 1]], preserveFolds: true) - expect(editor.lineElementForScreenRow(2)).not.toMatchSelector('.fold.selected') - - editor.setSelectedBufferRange([[1, 0], [5, 0]], preserveFolds: true) - expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.selected') - - editor.setCursorScreenPosition([3,0]) - expect(editor.lineElementForScreenRow(2)).not.toMatchSelector('.fold.selected') - - editor.setCursorScreenPosition([2,0]) - expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.selected') - expect(editor.find('.cursor').css('display')).toBe 'none' - - editor.setCursorScreenPosition([3,0]) - expect(editor.find('.cursor').css('display')).toBe 'block' - - describe "when a selected fold is scrolled into view (and the fold line was not previously rendered)", -> - it "renders the fold's line element with the 'selected' class", -> - setEditorHeightInLines(editor, 5) - editor.renderLines() # re-render lines so certain lines are not rendered - - editor.createFold(2, 4) - editor.setSelectedBufferRange([[1, 0], [5, 0]], preserveFolds: true) - expect(editor.renderedLines.find('.fold.selected')).toExist() - - editor.scrollToBottom() - expect(editor.renderedLines.find('.fold.selected')).not.toExist() - - editor.scrollTop(0) - expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.selected') - - describe ".getOpenBufferPaths()", -> - it "returns the paths of all non-anonymous buffers with edit sessions on this editor", -> - editor.edit(project.buildEditSessionForPath('sample.txt')) - editor.edit(project.buildEditSessionForPath('two-hundred.txt')) - editor.edit(project.buildEditSessionForPath()) - paths = editor.getOpenBufferPaths().map (path) -> project.relativize(path) - expect(paths).toEqual = ['sample.js', 'sample.txt', 'two-hundred.txt'] diff --git a/spec/app/event-emitter-spec.coffee b/spec/app/event-emitter-spec.coffee deleted file mode 100644 index 05f318749..000000000 --- a/spec/app/event-emitter-spec.coffee +++ /dev/null @@ -1,158 +0,0 @@ -_ = require 'underscore' -EventEmitter = require 'event-emitter' - -describe "EventEmitter mixin", -> - [object, fooHandler1, fooHandler2, barHandler] = [] - - beforeEach -> - object = {} - _.extend(object, EventEmitter) - - fooHandler1 = jasmine.createSpy('fooHandler1') - fooHandler2 = jasmine.createSpy('fooHandler2') - barHandler = jasmine.createSpy('barHandler') - - object.on 'foo', fooHandler1 - object.on 'foo', fooHandler2 - object.on 'bar', barHandler - - describe ".trigger", -> - describe "when called with a non-namespaced event name", -> - it "triggers all handlers registered for the given event name", -> - object.trigger 'foo', 'data' - expect(fooHandler1).toHaveBeenCalledWith('data') - expect(fooHandler2).toHaveBeenCalledWith('data') - expect(barHandler).not.toHaveBeenCalled() - - fooHandler1.reset() - fooHandler2.reset() - - object.trigger 'bar', 'stuff' - expect(barHandler).toHaveBeenCalledWith('stuff') - - describe "when there are namespaced handlers", -> - it "triggers only handlers registered with the given namespace / event combination", -> - barHandler2 = jasmine.createSpy('barHandler2') - object.on('bar.ns1', barHandler2) - - object.trigger('bar') - - expect(barHandler).toHaveBeenCalled() - expect(barHandler2).toHaveBeenCalled() - barHandler.reset() - barHandler2.reset() - - object.trigger('bar.ns1') - - expect(barHandler).not.toHaveBeenCalled() - expect(barHandler2).toHaveBeenCalled() - - it "does not raise exceptions when called with non-existent events / namespaces", -> - object.trigger('junk') - object.trigger('junk.garbage') - - describe ".off", -> - describe "when called with no arguments", -> - it "removes all subscriptions", -> - object.off() - object.trigger 'foo' - expect(fooHandler1).not.toHaveBeenCalled() - expect(fooHandler2).not.toHaveBeenCalled() - - describe "when called with a non-namespaced event name", -> - it "removes all handlers for that event name", -> - object.off 'foo' - object.trigger 'foo' - expect(fooHandler1).not.toHaveBeenCalled() - expect(fooHandler2).not.toHaveBeenCalled() - - describe "when called with a non-namespaced event name and a handler function", -> - it "removes the specific handler", -> - object.off 'foo', fooHandler1 - object.trigger 'foo' - expect(fooHandler1).not.toHaveBeenCalled() - expect(fooHandler2).toHaveBeenCalled() - - describe "when there are namespaced event handlers", -> - [barHandler2, bazHandler1, bazHandler2, bazHandler3] = [] - - beforeEach -> - barHandler2 = jasmine.createSpy('barHandler2') - bazHandler1 = jasmine.createSpy('bazHandler1') - bazHandler2 = jasmine.createSpy('bazHandler2') - bazHandler3 = jasmine.createSpy('bazHandler3') - - object.on 'bar.ns1', barHandler2 - object.on 'baz.ns1', bazHandler1 - object.on 'baz.ns1', bazHandler2 - object.on 'baz.ns2', bazHandler3 - - describe "when called with a namespaced event name", -> - it "removes all handlers in that namespace", -> - object.trigger 'baz' - - expect(bazHandler1).toHaveBeenCalled() - expect(bazHandler2).toHaveBeenCalled() - expect(bazHandler3).toHaveBeenCalled() - - bazHandler1.reset() - bazHandler2.reset() - bazHandler3.reset() - - object.off 'baz.ns1' - object.trigger 'baz' - object.trigger 'baz.ns1' - - expect(bazHandler1).not.toHaveBeenCalled() - expect(bazHandler2).not.toHaveBeenCalled() - expect(bazHandler3).toHaveBeenCalled() - - describe "when called with just a namespace", -> - it "removes all handlers for all events on that namespace", -> - object.trigger 'bar' - expect(barHandler).toHaveBeenCalled() - expect(barHandler2).toHaveBeenCalled() - - barHandler.reset() - barHandler2.reset() - - object.trigger 'baz' - expect(bazHandler1).toHaveBeenCalled() - expect(bazHandler2).toHaveBeenCalled() - expect(bazHandler3).toHaveBeenCalled() - - bazHandler1.reset() - bazHandler2.reset() - bazHandler3.reset() - - object.off '.ns1' - - object.trigger 'bar' - object.trigger 'bar.ns1' - expect(barHandler).toHaveBeenCalled() - expect(barHandler2).not.toHaveBeenCalled() - - object.trigger 'baz' - object.trigger 'baz.ns1' - - expect(bazHandler1).not.toHaveBeenCalled() - expect(bazHandler2).not.toHaveBeenCalled() - expect(bazHandler3).toHaveBeenCalled() - - describe "when called with event names and namespaces that don't exist", -> - it "does not raise an exception", -> - object.off 'junk' - object.off '.garbage' - object.off 'junk.garbage' - - describe ".subscriptionCount()", -> - it "returns the total number of subscriptions on the object", -> - expect(object.subscriptionCount()).toBe 3 - - object.on 'baz', -> - expect(object.subscriptionCount()).toBe 4 - - object.off 'foo' - expect(object.subscriptionCount()).toBe 2 - - diff --git a/spec/app/file-spec.coffee b/spec/app/file-spec.coffee deleted file mode 100644 index 8f49ca60e..000000000 --- a/spec/app/file-spec.coffee +++ /dev/null @@ -1,87 +0,0 @@ -File = require 'file' -fs = require 'fs' - -describe 'File', -> - [path, file] = [] - - beforeEach -> - path = fs.join(require.resolve('fixtures'), "atom-file-test.txt") # Don't put in /tmp because /tmp symlinks to /private/tmp and screws up the rename test - fs.remove(path) if fs.exists(path) - fs.write(path, "this is old!") - file = new File(path) - - afterEach -> - file.off() - fs.remove(path) if fs.exists(path) - - describe "when the contents of the file change", -> - it "triggers 'contents-change' event handlers", -> - changeHandler = null - changeHandler = jasmine.createSpy('changeHandler') - file.on 'contents-change', changeHandler - fs.write(file.getPath(), "this is new!") - - waitsFor "change event", -> - changeHandler.callCount > 0 - - runs -> - changeHandler.reset() - fs.write(file.getPath(), "this is newer!") - - waitsFor "second change event", -> - changeHandler.callCount > 0 - - describe "when the file is removed", -> - it "triggers 'remove' event handlers", -> - removeHandler = null - removeHandler = jasmine.createSpy('removeHandler') - file.on 'remove', removeHandler - fs.remove(file.getPath()) - - waitsFor "remove event", -> - removeHandler.callCount > 0 - - describe "when a file is moved (via the filesystem)", -> - newPath = null - - beforeEach -> - newPath = fs.join(fs.directory(path), "atom-file-was-moved-test.txt") - - afterEach -> - if fs.exists(newPath) - fs.remove(newPath) - waitsFor "remove event", (done) -> file.on 'remove', done - - it "it updates its path", -> - moveHandler = null - moveHandler = jasmine.createSpy('moveHandler') - file.on 'move', moveHandler - - fs.move(path, newPath) - - waitsFor "move event", -> - moveHandler.callCount > 0 - - runs -> - expect(file.getPath()).toBe newPath - - it "maintains 'contents-change' events set on previous path", -> - moveHandler = null - moveHandler = jasmine.createSpy('moveHandler') - file.on 'move', moveHandler - changeHandler = null - changeHandler = jasmine.createSpy('changeHandler') - file.on 'contents-change', changeHandler - - fs.move(path, newPath) - - waitsFor "move event", -> - moveHandler.callCount > 0 - - runs -> - expect(changeHandler).not.toHaveBeenCalled() - fs.write(file.getPath(), "this is new!") - - waitsFor "change event", -> - changeHandler.callCount > 0 - diff --git a/spec/app/keymap-spec.coffee b/spec/app/keymap-spec.coffee deleted file mode 100644 index f50875bdb..000000000 --- a/spec/app/keymap-spec.coffee +++ /dev/null @@ -1,320 +0,0 @@ -Keymap = require 'keymap' -$ = require 'jquery' - -describe "Keymap", -> - fragment = null - keymap = null - - beforeEach -> - keymap = new Keymap - fragment = $ """ -
    -
    -
    -
    -
    - """ - - describe ".handleKeyEvent(event)", -> - deleteCharHandler = null - insertCharHandler = null - - beforeEach -> - keymap.bindKeys '.command-mode', 'x': 'deleteChar' - keymap.bindKeys '.insert-mode', 'x': 'insertChar' - - deleteCharHandler = jasmine.createSpy 'deleteCharHandler' - insertCharHandler = jasmine.createSpy 'insertCharHandler' - fragment.on 'deleteChar', deleteCharHandler - fragment.on 'insertChar', insertCharHandler - - it "adds a 'keystrokes' string to the event object", -> - event = keydownEvent('x', altKey: true, metaKey: true) - keymap.handleKeyEvent(event) - expect(event.keystrokes).toBe 'alt-meta-x' - - describe "when no binding matches the event's keystroke", -> - it "returns true, so the event continues to propagate", -> - expect(keymap.handleKeyEvent(keydownEvent('0', target: fragment[0]))).toBeTruthy() - - describe "when at least one binding fully matches the event's keystroke", -> - describe "when the event's target node matches a selector with a matching binding", -> - it "triggers the command event associated with that binding on the target node and returns false", -> - result = keymap.handleKeyEvent(keydownEvent('x', target: fragment[0])) - expect(result).toBe(false) - expect(deleteCharHandler).toHaveBeenCalled() - expect(insertCharHandler).not.toHaveBeenCalled() - - deleteCharHandler.reset() - fragment.removeClass('command-mode').addClass('insert-mode') - - event = keydownEvent('x', target: fragment[0]) - keymap.handleKeyEvent(event) - expect(deleteCharHandler).not.toHaveBeenCalled() - expect(insertCharHandler).toHaveBeenCalled() - commandEvent = insertCharHandler.argsForCall[0][0] - expect(commandEvent.keyEvent).toBe event - expect(event.keystrokes).toBe 'x' - - describe "when the event's target node *descends* from a selector with a matching binding", -> - it "triggers the command event associated with that binding on the target node and returns false", -> - target = fragment.find('.child-node')[0] - result = keymap.handleKeyEvent(keydownEvent('x', target: target)) - expect(result).toBe(false) - expect(deleteCharHandler).toHaveBeenCalled() - expect(insertCharHandler).not.toHaveBeenCalled() - - deleteCharHandler.reset() - fragment.removeClass('command-mode').addClass('insert-mode') - - keymap.handleKeyEvent(keydownEvent('x', target: target)) - expect(deleteCharHandler).not.toHaveBeenCalled() - expect(insertCharHandler).toHaveBeenCalled() - - describe "when the event's target node descends from multiple nodes that match selectors with a binding", -> - beforeEach -> - keymap.bindKeys '.child-node', 'x': 'foo' - - it "only triggers bindings on selectors associated with the closest ancestor node", -> - fooHandler = jasmine.createSpy 'fooHandler' - fragment.on 'foo', fooHandler - - target = fragment.find('.grandchild-node')[0] - keymap.handleKeyEvent(keydownEvent('x', target: target)) - expect(fooHandler).toHaveBeenCalled() - expect(deleteCharHandler).not.toHaveBeenCalled() - expect(insertCharHandler).not.toHaveBeenCalled() - - describe "when 'abortKeyBinding' is called on the triggered event", -> - it "aborts the current event and tries again with the next-most-specific key binding", -> - fooHandler1 = jasmine.createSpy('fooHandler1').andCallFake (e) -> - expect(deleteCharHandler).not.toHaveBeenCalled() - e.abortKeyBinding() - fooHandler2 = jasmine.createSpy('fooHandler2') - - fragment.find('.child-node').on 'foo', fooHandler1 - fragment.on 'foo', fooHandler2 - - target = fragment.find('.grandchild-node')[0] - keymap.handleKeyEvent(keydownEvent('x', target: target)) - expect(fooHandler1).toHaveBeenCalled() - expect(fooHandler2).not.toHaveBeenCalled() - expect(deleteCharHandler).toHaveBeenCalled() - - describe "when the event bubbles to a node that matches multiple selectors", -> - describe "when the matching selectors differ in specificity", -> - it "triggers the binding for the most specific selector", -> - keymap.bindKeys 'div .child-node', 'x': 'foo' - keymap.bindKeys '.command-mode .child-node', 'x': 'baz' - keymap.bindKeys '.child-node', 'x': 'bar' - - fooHandler = jasmine.createSpy 'fooHandler' - barHandler = jasmine.createSpy 'barHandler' - bazHandler = jasmine.createSpy 'bazHandler' - fragment.on 'foo', fooHandler - fragment.on 'bar', barHandler - fragment.on 'baz', bazHandler - - target = fragment.find('.grandchild-node')[0] - keymap.handleKeyEvent(keydownEvent('x', target: target)) - - expect(fooHandler).not.toHaveBeenCalled() - expect(barHandler).not.toHaveBeenCalled() - expect(bazHandler).toHaveBeenCalled() - - describe "when the matching selectors have the same specificity", -> - it "triggers the bindings for the most recently declared selector", -> - keymap.bindKeys '.child-node', 'x': 'foo', 'y': 'baz' - keymap.bindKeys '.child-node', 'x': 'bar' - - fooHandler = jasmine.createSpy 'fooHandler' - barHandler = jasmine.createSpy 'barHandler' - bazHandler = jasmine.createSpy 'bazHandler' - fragment.on 'foo', fooHandler - fragment.on 'bar', barHandler - fragment.on 'baz', bazHandler - - target = fragment.find('.grandchild-node')[0] - keymap.handleKeyEvent(keydownEvent('x', target: target)) - - expect(barHandler).toHaveBeenCalled() - expect(fooHandler).not.toHaveBeenCalled() - - keymap.handleKeyEvent(keydownEvent('y', target: target)) - expect(bazHandler).toHaveBeenCalled() - - describe "when at least one binding partially matches the event's keystroke", -> - [quitHandler, closeOtherWindowsHandler] = [] - - beforeEach -> - keymap.bindKeys "*", - 'ctrl-x ctrl-c': 'quit' - 'ctrl-x 1': 'close-other-windows' - - quitHandler = jasmine.createSpy('quitHandler') - closeOtherWindowsHandler = jasmine.createSpy('closeOtherWindowsHandler') - fragment.on 'quit', quitHandler - fragment.on 'close-other-windows', closeOtherWindowsHandler - - it "only matches entire keystroke patters", -> - expect(keymap.handleKeyEvent(keydownEvent('c', target: fragment[0]))).toBeTruthy() - - describe "when the event's target node matches a selector with a partially matching multi-stroke binding", -> - describe "when a second keystroke added to the first to match a multi-stroke binding completely", -> - it "triggers the event associated with the matched multi-stroke binding", -> - expect(keymap.handleKeyEvent(keydownEvent('x', target: fragment[0], ctrlKey: true))).toBeFalsy() - expect(keymap.handleKeyEvent(keydownEvent('c', target: fragment[0], ctrlKey: true))).toBeFalsy() - - expect(quitHandler).toHaveBeenCalled() - expect(closeOtherWindowsHandler).not.toHaveBeenCalled() - quitHandler.reset() - - expect(keymap.handleKeyEvent(keydownEvent('x', target: fragment[0], ctrlKey: true))).toBeFalsy() - expect(keymap.handleKeyEvent(keydownEvent('1', target: fragment[0]))).toBeFalsy() - - expect(quitHandler).not.toHaveBeenCalled() - expect(closeOtherWindowsHandler).toHaveBeenCalled() - - describe "when a second keystroke added to the first doesn't match any bindings", -> - it "clears the queued keystrokes without triggering any events", -> - expect(keymap.handleKeyEvent(keydownEvent('x', target: fragment[0], ctrlKey: true))).toBeFalsy() - expect(keymap.handleKeyEvent(keydownEvent('c', target: fragment[0]))).toBeFalsy() - expect(quitHandler).not.toHaveBeenCalled() - expect(closeOtherWindowsHandler).not.toHaveBeenCalled() - - expect(keymap.handleKeyEvent(keydownEvent('c', target: fragment[0]))).toBeTruthy() - - describe "when the event's target node descends from multiple nodes that match selectors with a partial binding match", -> - it "allows any of the bindings to be triggered upon a second keystroke, favoring the most specific selector", -> - keymap.bindKeys ".grandchild-node", 'ctrl-x ctrl-c': 'more-specific-quit' - grandchildNode = fragment.find('.grandchild-node')[0] - moreSpecificQuitHandler = jasmine.createSpy('moreSpecificQuitHandler') - fragment.on 'more-specific-quit', moreSpecificQuitHandler - - expect(keymap.handleKeyEvent(keydownEvent('x', target: grandchildNode, ctrlKey: true))).toBeFalsy() - expect(keymap.handleKeyEvent(keydownEvent('1', target: grandchildNode))).toBeFalsy() - expect(quitHandler).not.toHaveBeenCalled() - expect(moreSpecificQuitHandler).not.toHaveBeenCalled() - expect(closeOtherWindowsHandler).toHaveBeenCalled() - closeOtherWindowsHandler.reset() - - expect(keymap.handleKeyEvent(keydownEvent('x', target: grandchildNode, ctrlKey: true))).toBeFalsy() - expect(keymap.handleKeyEvent(keydownEvent('c', target: grandchildNode, ctrlKey: true))).toBeFalsy() - expect(quitHandler).not.toHaveBeenCalled() - expect(closeOtherWindowsHandler).not.toHaveBeenCalled() - expect(moreSpecificQuitHandler).toHaveBeenCalled() - - describe "when there is a complete binding with a less specific selector", -> - it "favors the more specific partial match", -> - - describe "when there is a complete binding with a more specific selector", -> - it "favors the more specific complete match", -> - - describe ".bindKeys(selector, fnOrMap)", -> - describe "when called with a selector and a hash", -> - it "normalizes the key patterns in the hash to put the modifiers in alphabetical order", -> - fooHandler = jasmine.createSpy('fooHandler') - fragment.on 'foo', fooHandler - keymap.bindKeys '*', 'ctrl-alt-delete': 'foo' - result = keymap.handleKeyEvent(keydownEvent('delete', ctrlKey: true, altKey: true, target: fragment[0])) - expect(result).toBe(false) - expect(fooHandler).toHaveBeenCalled() - - fooHandler.reset() - keymap.bindKeys '*', 'ctrl-alt--': 'foo' - result = keymap.handleKeyEvent(keydownEvent('-', ctrlKey: true, altKey: true, target: fragment[0])) - expect(result).toBe(false) - expect(fooHandler).toHaveBeenCalled() - - describe "when called with a selector and a function", -> - it "calls the given function when selector matches", -> - handler = jasmine.createSpy 'handler' - keymap.bindKeys '.child-node', handler - - target = fragment.find('.grandchild-node')[0] - event = keydownEvent('y', target: target) - keymap.handleKeyEvent event - - expect(handler).toHaveBeenCalledWith(event) - - describe "when the function returns a command string", -> - it "triggers the command event on the target and stops propagating the event", -> - keymap.bindKeys '*', 'x': 'foo' - keymap.bindKeys '*', -> 'bar' - fooHandler = jasmine.createSpy('fooHandler') - barHandler = jasmine.createSpy('barHandler') - fragment.on 'foo', fooHandler - fragment.on 'bar', barHandler - - target = fragment.find('.child-node')[0] - keymap.handleKeyEvent(keydownEvent('x', target: target)) - - expect(fooHandler).not.toHaveBeenCalled() - expect(barHandler).toHaveBeenCalled() - - describe "when the function returns false", -> - it "stops propagating the event", -> - keymap.bindKeys '*', 'x': 'foo' - keymap.bindKeys '*', -> false - fooHandler = jasmine.createSpy('fooHandler') - fragment.on 'foo', fooHandler - - target = fragment.find('.child-node')[0] - keymap.handleKeyEvent(keydownEvent('x', target: target)) - - expect(fooHandler).not.toHaveBeenCalled() - - describe "when the function returns anything other than a string or false", -> - it "continues to propagate the event", -> - keymap.bindKeys '*', 'x': 'foo' - keymap.bindKeys '*', -> undefined - fooHandler = jasmine.createSpy('fooHandler') - fragment.on 'foo', fooHandler - - target = fragment.find('.child-node')[0] - keymap.handleKeyEvent(keydownEvent('x', target: target)) - - expect(fooHandler).toHaveBeenCalled() - - describe ".keystrokeStringForEvent(event)", -> - describe "when no modifiers are pressed", -> - it "returns a string that identifies the key pressed", -> - expect(keymap.keystrokeStringForEvent(keydownEvent('a'))).toBe 'a' - expect(keymap.keystrokeStringForEvent(keydownEvent('['))).toBe '[' - expect(keymap.keystrokeStringForEvent(keydownEvent('*'))).toBe '*' - expect(keymap.keystrokeStringForEvent(keydownEvent('left'))).toBe 'left' - expect(keymap.keystrokeStringForEvent(keydownEvent('\b'))).toBe 'backspace' - - describe "when ctrl, alt or meta is pressed with a non-modifier key", -> - it "returns a string that identifies the key pressed", -> - expect(keymap.keystrokeStringForEvent(keydownEvent('a', altKey: true))).toBe 'alt-a' - expect(keymap.keystrokeStringForEvent(keydownEvent('[', metaKey: true))).toBe 'meta-[' - expect(keymap.keystrokeStringForEvent(keydownEvent('*', ctrlKey: true))).toBe 'ctrl-*' - expect(keymap.keystrokeStringForEvent(keydownEvent('left', ctrlKey: true, metaKey: true, altKey: true))).toBe 'alt-ctrl-meta-left' - - describe "when shift is pressed when a non-modifer key", -> - it "returns a string that identifies the key pressed", -> - expect(keymap.keystrokeStringForEvent(keydownEvent('A', shiftKey: true))).toBe 'A' - expect(keymap.keystrokeStringForEvent(keydownEvent('{', shiftKey: true))).toBe '{' - expect(keymap.keystrokeStringForEvent(keydownEvent('left', shiftKey: true))).toBe 'shift-left' - expect(keymap.keystrokeStringForEvent(keydownEvent('Left', shiftKey: true))).toBe 'shift-left' - - describe ".bindingsForElement(element)", -> - it "returns the matching bindings for the element", -> - keymap.bindKeys '.command-mode', 'c': 'c' - keymap.bindKeys '.grandchild-node', 'g': 'g' - - bindings = keymap.bindingsForElement(fragment.find('.grandchild-node')) - expect(Object.keys(bindings).length).toBe 2 - expect(bindings['c']).toEqual "c" - expect(bindings['g']).toEqual "g" - - describe "when multiple bindings match a keystroke", -> - it "only returns bindings that match the most specific selector", -> - keymap.bindKeys '.command-mode', 'g': 'command-mode' - keymap.bindKeys '.command-mode .grandchild-node', 'g': 'command-and-grandchild-node' - keymap.bindKeys '.grandchild-node', 'g': 'grandchild-node' - - bindings = keymap.bindingsForElement(fragment.find('.grandchild-node')) - expect(Object.keys(bindings).length).toBe 1 - expect(bindings['g']).toEqual "command-and-grandchild-node" diff --git a/spec/app/language-mode-spec.coffee b/spec/app/language-mode-spec.coffee deleted file mode 100644 index c90bb6cd9..000000000 --- a/spec/app/language-mode-spec.coffee +++ /dev/null @@ -1,139 +0,0 @@ -Project = require 'project' -Buffer = require 'buffer' -EditSession = require 'edit-session' - -describe "LanguageMode", -> - [editSession, buffer, languageMode] = [] - - afterEach -> - editSession.destroy() - - describe "common behavior", -> - beforeEach -> - editSession = fixturesProject.buildEditSessionForPath('sample.js', autoIndent: false) - { buffer, languageMode } = editSession - - describe "matching character insertion", -> - beforeEach -> - editSession.buffer.setText("") - - describe "when there is non-whitespace after the cursor", -> - it "does not insert a matching bracket", -> - editSession.buffer.setText("ab") - editSession.setCursorBufferPosition([0, 1]) - editSession.insertText("(") - - expect(editSession.buffer.getText()).toBe "a(b" - - describe "when there are multiple cursors", -> - it "inserts ) at each cursor", -> - editSession.buffer.setText("()\nab\n[]\n12") - editSession.setCursorBufferPosition([3, 1]) - editSession.addCursorAtBufferPosition([2, 1]) - editSession.addCursorAtBufferPosition([1, 1]) - editSession.addCursorAtBufferPosition([0, 1]) - editSession.insertText ')' - - expect(editSession.buffer.getText()).toBe "())\na)b\n[)]\n1)2" - - describe "when ( is inserted", -> - it "inserts a matching ) following the cursor", -> - editSession.insertText '(' - expect(buffer.lineForRow(0)).toMatch /^\(\)/ - - describe "when [ is inserted", -> - it "inserts a matching ] following the cursor", -> - editSession.insertText '[' - expect(buffer.lineForRow(0)).toMatch /^\[\]/ - - describe "when { is inserted", -> - it "inserts a matching ) following the cursor", -> - editSession.insertText '{' - expect(buffer.lineForRow(0)).toMatch /^\{\}/ - - describe "when \" is inserted", -> - it "inserts a matching \" following the cursor", -> - editSession.insertText '"' - expect(buffer.lineForRow(0)).toMatch /^""/ - - describe "when ' is inserted", -> - it "inserts a matching ' following the cursor", -> - editSession.insertText "'" - expect(buffer.lineForRow(0)).toMatch /^''/ - - describe "when ) is inserted before a )", -> - it "moves the cursor one column to the right instead of inserting a new )", -> - editSession.insertText '() ' - editSession.setCursorBufferPosition([0, 1]) - editSession.insertText ')' - expect(buffer.lineForRow(0)).toBe "() " - expect(editSession.getCursorBufferPosition().column).toBe 2 - - describe "javascript", -> - beforeEach -> - editSession = fixturesProject.buildEditSessionForPath('sample.js', autoIndent: false) - { buffer, languageMode } = editSession - - describe ".toggleLineCommentsInRange(range)", -> - it "comments/uncomments lines in the given range", -> - languageMode.toggleLineCommentsInRange([[4, 5], [7, 8]]) - expect(buffer.lineForRow(4)).toBe "// while(items.length > 0) {" - expect(buffer.lineForRow(5)).toBe "// current = items.shift();" - expect(buffer.lineForRow(6)).toBe "// current < pivot ? left.push(current) : right.push(current);" - expect(buffer.lineForRow(7)).toBe "// }" - - languageMode.toggleLineCommentsInRange([[4, 5], [5, 8]]) - expect(buffer.lineForRow(4)).toBe " while(items.length > 0) {" - expect(buffer.lineForRow(5)).toBe " current = items.shift();" - expect(buffer.lineForRow(6)).toBe "// current < pivot ? left.push(current) : right.push(current);" - expect(buffer.lineForRow(7)).toBe "// }" - - describe "fold suggestion", -> - describe ".doesBufferRowStartFold(bufferRow)", -> - it "returns true only when the buffer row starts a foldable region", -> - expect(languageMode.doesBufferRowStartFold(0)).toBeTruthy() - expect(languageMode.doesBufferRowStartFold(1)).toBeTruthy() - expect(languageMode.doesBufferRowStartFold(2)).toBeFalsy() - expect(languageMode.doesBufferRowStartFold(3)).toBeFalsy() - - describe ".rowRangeForFoldAtBufferRow(bufferRow)", -> - it "returns the start/end rows of the foldable region starting at the given row", -> - expect(languageMode.rowRangeForFoldAtBufferRow(0)).toEqual [0, 12] - expect(languageMode.rowRangeForFoldAtBufferRow(1)).toEqual [1, 9] - expect(languageMode.rowRangeForFoldAtBufferRow(2)).toBeNull() - expect(languageMode.rowRangeForFoldAtBufferRow(4)).toEqual [4, 7] - - describe "coffeescript", -> - beforeEach -> - editSession = fixturesProject.buildEditSessionForPath('coffee.coffee', autoIndent: false) - { buffer, languageMode } = editSession - - describe ".toggleLineCommentsInRange(range)", -> - it "comments/uncomments lines in the given range", -> - languageMode.toggleLineCommentsInRange([[4, 5], [7, 8]]) - expect(buffer.lineForRow(4)).toBe "# pivot = items.shift()" - expect(buffer.lineForRow(5)).toBe "# left = []" - expect(buffer.lineForRow(6)).toBe "# right = []" - expect(buffer.lineForRow(7)).toBe "# " - - languageMode.toggleLineCommentsInRange([[4, 5], [5, 8]]) - expect(buffer.lineForRow(4)).toBe " pivot = items.shift()" - expect(buffer.lineForRow(5)).toBe " left = []" - expect(buffer.lineForRow(6)).toBe "# right = []" - expect(buffer.lineForRow(7)).toBe "# " - - describe "fold suggestion", -> - describe ".doesBufferRowStartFold(bufferRow)", -> - it "returns true only when the buffer row starts a foldable region", -> - expect(languageMode.doesBufferRowStartFold(0)).toBeTruthy() - expect(languageMode.doesBufferRowStartFold(1)).toBeTruthy() - expect(languageMode.doesBufferRowStartFold(2)).toBeFalsy() - expect(languageMode.doesBufferRowStartFold(3)).toBeFalsy() - expect(languageMode.doesBufferRowStartFold(19)).toBeTruthy() - - describe ".rowRangeForFoldAtBufferRow(bufferRow)", -> - it "returns the start/end rows of the foldable region starting at the given row", -> - expect(languageMode.rowRangeForFoldAtBufferRow(0)).toEqual [0, 20] - expect(languageMode.rowRangeForFoldAtBufferRow(1)).toEqual [1, 17] - expect(languageMode.rowRangeForFoldAtBufferRow(2)).toBeNull() - expect(languageMode.rowRangeForFoldAtBufferRow(19)).toEqual [19, 20] diff --git a/spec/app/line-map-spec.coffee b/spec/app/line-map-spec.coffee deleted file mode 100644 index 93620828f..000000000 --- a/spec/app/line-map-spec.coffee +++ /dev/null @@ -1,216 +0,0 @@ -LineMap = require 'line-map' -ScreenLine = require 'screen-line' -Buffer = require 'buffer' -TokenizedBuffer = require 'tokenized-buffer' -Point = require 'point' - -describe "LineMap", -> - [editSession, tokenizedBuffer, map] = [] - [line0, line1, line2, line3, line4] = [] - - beforeEach -> - editSession = fixturesProject.buildEditSessionForPath('sample.js') - { buffer, tokenizedBuffer } = editSession - map = new LineMap - [line0, line1, line2, line3, line4] = tokenizedBuffer.linesForScreenRows(0, 4) - - afterEach -> - editSession.destroy() - - describe ".insertAtBufferRow(row, lineFragments)", -> - it "inserts the given line fragments before the specified buffer row", -> - map.insertAtBufferRow(0, [line2, line3]) - map.insertAtBufferRow(0, [line0, line1]) - map.insertAtBufferRow(4, [line4]) - - expect(map.lineForScreenRow(0)).toEqual line0 - expect(map.lineForScreenRow(1)).toEqual line1 - expect(map.lineForScreenRow(2)).toEqual line2 - expect(map.lineForScreenRow(3)).toEqual line3 - expect(map.lineForScreenRow(4)).toEqual line4 - - it "allows for partial line fragments on the row following the insertion", -> - [line0a, line0b] = line0.splitAt(10) - map.insertAtBufferRow(0, [line0a, line0b]) - map.insertAtBufferRow(0, [line1]) - - expect(map.lineForScreenRow(0)).toEqual line1 - expect(map.lineForScreenRow(1)).toEqual line0a.concat(line0b) - - describe ".spliceAtBufferRow(bufferRow, rowCount, lineFragments)", -> - describe "when called with a row count of 0", -> - it "inserts the given line fragments before the specified buffer row", -> - map.insertAtBufferRow(0, [line0, line1]) - map.spliceAtBufferRow(1, 0, [line3, line4]) - - expect(map.lineForScreenRow(0)).toEqual line0 - expect(map.lineForScreenRow(1)).toEqual line3 - expect(map.lineForScreenRow(2)).toEqual line4 - expect(map.lineForScreenRow(3)).toEqual line1 - - map.spliceAtBufferRow(0, 0, [line2]) - expect(map.lineForScreenRow(0)).toEqual line2 - - describe "when called with a row count of 1", -> - describe "when the specified buffer row is spanned by a single line fragment", -> - it "replaces the spanning line fragment with the given line fragments", -> - map.insertAtBufferRow(0, [line0, line1, line2]) - map.spliceAtBufferRow(1, 1, [line3, line4]) - - expect(map.bufferLineCount()).toBe 4 - expect(map.lineForScreenRow(0)).toEqual line0 - expect(map.lineForScreenRow(1)).toEqual line3 - expect(map.lineForScreenRow(2)).toEqual line4 - expect(map.lineForScreenRow(3)).toEqual line2 - - map.spliceAtBufferRow(2, 1, [line0]) - expect(map.lineForScreenRow(2)).toEqual line0 - expect(map.lineForScreenRow(3)).toEqual line2 - - describe "when the specified buffer row is spanned by multiple line fragments", -> - it "replaces all spanning line fragments with the given line fragments", -> - [line1a, line1b] = line1.splitAt(10) - [line3a, line3b] = line3.splitAt(10) - - map.insertAtBufferRow(0, [line0, line1a, line1b, line2]) - map.spliceAtBufferRow(1, 1, [line3a, line3b, line4]) - - expect(map.bufferLineCount()).toBe 4 - expect(map.lineForScreenRow(0)).toEqual line0 - expect(map.lineForScreenRow(1)).toEqual line3a.concat(line3b) - expect(map.lineForScreenRow(2)).toEqual line4 - expect(map.lineForScreenRow(3)).toEqual line2 - - describe "when the row following the specified buffer row is spanned by multiple line fragments", -> - it "replaces the specified row, but no portion of the following row", -> - [line3a, line3b] = line3.splitAt(10) - - map.insertAtBufferRow(0, [line0, line1, line2, line3a, line3b]) - map.spliceAtBufferRow(2, 1, [line4]) - - expect(map.lineForScreenRow(0)).toEqual line0 - expect(map.lineForScreenRow(1)).toEqual line1 - expect(map.lineForScreenRow(2)).toEqual line4 - expect(map.lineForScreenRow(3)).toEqual line3a.concat(line3b) - - describe "when called with a row count greater than 1", -> - it "replaces all line fragments spanning the multiple buffer rows with the given line fragments", -> - [line1a, line1b] = line1.splitAt(10) - [line3a, line3b] = line3.splitAt(10) - - map.insertAtBufferRow(0, [line0, line1a, line1b, line2]) - map.spliceAtBufferRow(1, 2, [line3a, line3b, line4]) - - expect(map.bufferLineCount()).toBe 3 - expect(map.lineForScreenRow(0)).toEqual line0 - expect(map.lineForScreenRow(1)).toEqual line3a.concat(line3b) - expect(map.lineForScreenRow(2)).toEqual line4 - - describe ".spliceAtScreenRow(startRow, rowCount, lineFragemnts)", -> - describe "when called with a row count of 0", -> - it "inserts the given line fragments before the specified buffer row", -> - map.insertAtBufferRow(0, [line0, line1, line2]) - map.spliceAtScreenRow(1, 0, [line3, line4]) - - expect(map.lineForScreenRow(0)).toEqual line0 - expect(map.lineForScreenRow(1)).toEqual line3 - expect(map.lineForScreenRow(2)).toEqual line4 - expect(map.lineForScreenRow(3)).toEqual line1 - expect(map.lineForScreenRow(4)).toEqual line2 - - describe "when called with a row count of 1", -> - describe "when the specified screen row is spanned by a single line fragment", -> - it "replaces the spanning line fragment with the given line fragments", -> - map.insertAtBufferRow(0, [line0, line1, line2]) - map.spliceAtScreenRow(1, 1, [line3, line4]) - - expect(map.bufferLineCount()).toBe 4 - expect(map.lineForScreenRow(0)).toEqual line0 - expect(map.lineForScreenRow(1)).toEqual line3 - expect(map.lineForScreenRow(2)).toEqual line4 - expect(map.lineForScreenRow(3)).toEqual line2 - - describe "when the specified screen row is spanned by multiple line fragments", -> - it "replaces all spanning line fragments with the given line fragments", -> - [line0a, line0b] = line0.splitAt(10) - [line3a, line3b] = line3.splitAt(10) - - map.insertAtBufferRow(0, [line0a, line0b, line1, line2]) - map.spliceAtScreenRow(0, 1, [line3a, line3b, line4]) - - expect(map.bufferLineCount()).toBe 4 - expect(map.lineForScreenRow(0)).toEqual line3a.concat(line3b) - expect(map.lineForScreenRow(1)).toEqual line4 - expect(map.lineForScreenRow(2)).toEqual line1 - expect(map.lineForScreenRow(3)).toEqual line2 - - describe "when called with a row count greater than 1", -> - it "replaces all line fragments spanning the multiple buffer rows with the given line fragments", -> - [line1a, line1b] = line1.splitAt(10) - [line3a, line3b] = line3.splitAt(10) - - map.insertAtBufferRow(0, [line0, line1a, line1b, line2]) - map.spliceAtScreenRow(1, 2, [line3a, line3b, line4]) - - expect(map.bufferLineCount()).toBe 3 - expect(map.lineForScreenRow(0)).toEqual line0 - expect(map.lineForScreenRow(1)).toEqual line3a.concat(line3b) - expect(map.lineForScreenRow(2)).toEqual line4 - - describe ".linesForScreenRows(startRow, endRow)", -> - it "returns lines for the given row range, concatenating fragments that belong on a single screen line", -> - [line1a, line1b] = line1.splitAt(11) - [line3a, line3b] = line3.splitAt(15) - map.insertAtBufferRow(0, [line0, line1a, line1b, line2, line3a, line3b, line4]) - - expect(map.linesForScreenRows(1, 3)).toEqual [line1, line2, line3] - # repeating assertion to cover a regression where this method mutated lines - expect(map.linesForScreenRows(1, 3)).toEqual [line1, line2, line3] - - describe ".lineForBufferRow(bufferRow)", -> - it "returns the concatenated screen line fragments that comprise the given buffer row", -> - line1Text = line1.text - [line1a, line1b] = line1.splitAt(11) - line1a.screenDelta = new Point(1, 0) - - map.insertAtBufferRow(0, [line0, line1a, line1b, line2]) - - expect(map.lineForBufferRow(0).text).toBe line0.text - expect(map.lineForBufferRow(1).text).toBe line1Text - - describe ".screenPositionForBufferPosition(bufferPosition)", -> - beforeEach -> - # line1a-line3b describes a fold - [line1a, line1b] = line1.splitAt(10) - [line3a, line3b] = line3.splitAt(20) - line1a.bufferDelta.row = 2 - line1a.bufferDelta.column = 20 - - # line4a-line4b describes a wrapped line - [line4a, line4b] = line4.splitAt(20) - line4a.screenDelta = new Point(1, 0) - - map.insertAtBufferRow(0, [line0, line1a, line3b, line4a, line4b]) - - it "translates the given buffer position based on buffer and screen deltas of the line fragments in the map", -> - expect(map.screenPositionForBufferPosition([0, 0])).toEqual [0, 0] - expect(map.screenPositionForBufferPosition([0, 5])).toEqual [0, 5] - expect(map.screenPositionForBufferPosition([1, 5])).toEqual [1, 5] - expect(map.screenPositionForBufferPosition([3, 20])).toEqual [1, 10] - expect(map.screenPositionForBufferPosition([3, 30])).toEqual [1, 20] - expect(map.screenPositionForBufferPosition([4, 5])).toEqual [2, 5] - - it "wraps buffer positions at the end of a screen line to the end end of the next screen line", -> - expect(map.screenPositionForBufferPosition([4, 20])).toEqual [3, 0] - - describe ".screenLineCount()", -> - it "returns the total of all inserted screen row deltas", -> - [line1a, line1b] = line1.splitAt(10) - [line3a, line3b] = line3.splitAt(10) - line1a.screenDelta = new Point(1, 0) - line3a.screenDelta = new Point(1, 0) - - map.insertAtBufferRow(0, [line0, line1a, line1b, line2]) - - expect(map.screenLineCount()).toBe 4 - diff --git a/spec/app/native-spec.coffee b/spec/app/native-spec.coffee deleted file mode 100644 index 14302fce8..000000000 --- a/spec/app/native-spec.coffee +++ /dev/null @@ -1,6 +0,0 @@ -describe 'Native', -> - describe '$native.getPlatform()', -> - it 'returns a non-empty value', -> - platform = $native.getPlatform() - expect(platform).not.toBe '' - expect(platform.length).toBeGreaterThan(0) diff --git a/spec/app/point-spec.coffee b/spec/app/point-spec.coffee deleted file mode 100644 index 322bac5f2..000000000 --- a/spec/app/point-spec.coffee +++ /dev/null @@ -1,27 +0,0 @@ -Point = require 'point' - -describe "Point", -> - describe ".isEqual(value)", -> - describe "when given value is a Point", -> - it "returns true when the rows and columns match", -> - expect(new Point(1,2)).toEqual new Point(1,2) - expect(new Point(2,1)).not.toEqual new Point(1,2) - - describe "when given value is an Array", -> - it "returns true only when index zero matches row and index one matches column", -> - expect(new Point(1,2)).toEqual [1,2] - expect(new Point(2,1)).not.toEqual [1,2] - - describe "when one of the points has a row or column that is NaN", -> - it "returns false", -> - expect(new Point(1, 3)).not.toEqual new Point(NaN, 3) - expect(new Point(1, 3)).not.toEqual new Point(1, NaN) - - describe "compare", -> - it "returns 1, 0, or -1 based on whether the given point precedes, equals, or follows the receivers location in the buffer", -> - expect(new Point(5, 0).compare(new Point(5, 0))).toBe 0 - expect(new Point(5, 0).compare(new Point(6, 0))).toBe -1 - expect(new Point(5, 0).compare(new Point(5, 1))).toBe -1 - expect(new Point(5, 0).compare(new Point(6, 1))).toBe -1 - expect(new Point(5, 5).compare(new Point(4, 1))).toBe 1 - expect(new Point(5, 5).compare(new Point(5, 3))).toBe 1 diff --git a/spec/app/project-spec.coffee b/spec/app/project-spec.coffee deleted file mode 100644 index bea202ef1..000000000 --- a/spec/app/project-spec.coffee +++ /dev/null @@ -1,175 +0,0 @@ -Project = require 'project' -fs = require 'fs' - -describe "Project", -> - project = null - beforeEach -> - project = new Project(require.resolve('fixtures/dir')) - - afterEach -> - project.destroy() - - describe "when editSession is destroyed", -> - it "removes edit session and calls destroy on buffer (if buffer is not referenced by other edit sessions)", -> - editSession = project.buildEditSessionForPath("a") - anotherEditSession = project.buildEditSessionForPath("a") - - expect(project.editSessions.length).toBe 2 - expect(editSession.buffer).toBe anotherEditSession.buffer - - editSession.destroy() - expect(project.editSessions.length).toBe 1 - - anotherEditSession.destroy() - expect(project.editSessions.length).toBe 0 - - describe ".buildEditSessionForPath(path)", -> - [absolutePath, newBufferHandler, newEditSessionHandler] = [] - beforeEach -> - absolutePath = require.resolve('fixtures/dir/a') - newBufferHandler = jasmine.createSpy('newBufferHandler') - project.on 'new-buffer', newBufferHandler - newEditSessionHandler = jasmine.createSpy('newEditSessionHandler') - project.on 'new-edit-session', newEditSessionHandler - - describe "when given an absolute path that hasn't been opened previously", -> - it "returns a new edit session for the given path and emits 'new-buffer' and 'new-edit-session' events", -> - editSession = project.buildEditSessionForPath(absolutePath) - expect(editSession.buffer.getPath()).toBe absolutePath - expect(newBufferHandler).toHaveBeenCalledWith editSession.buffer - expect(newEditSessionHandler).toHaveBeenCalledWith editSession - - describe "when given a relative path that hasn't been opened previously", -> - it "returns a new edit session for the given path (relative to the project root) and emits 'new-buffer' and 'new-edit-session' events", -> - editSession = project.buildEditSessionForPath('a') - expect(editSession.buffer.getPath()).toBe absolutePath - expect(newBufferHandler).toHaveBeenCalledWith editSession.buffer - expect(newEditSessionHandler).toHaveBeenCalledWith editSession - - describe "when passed the path to a buffer that has already been opened", -> - it "returns a new edit session containing previously opened buffer and emits a 'new-edit-session' event", -> - editSession = project.buildEditSessionForPath(absolutePath) - newBufferHandler.reset() - expect(project.buildEditSessionForPath(absolutePath).buffer).toBe editSession.buffer - expect(project.buildEditSessionForPath('a').buffer).toBe editSession.buffer - expect(newBufferHandler).not.toHaveBeenCalled() - expect(newEditSessionHandler).toHaveBeenCalledWith editSession - - describe "when not passed a path", -> - it "returns a new edit session and emits 'new-buffer' and 'new-edit-session' events", -> - editSession = project.buildEditSessionForPath() - expect(editSession.buffer.getPath()).toBeUndefined() - expect(newBufferHandler).toHaveBeenCalledWith(editSession.buffer) - expect(newEditSessionHandler).toHaveBeenCalledWith editSession - - describe ".bufferForPath(path)", -> - describe "when opening a previously opened path", -> - it "does not create a new buffer", -> - buffer = project.bufferForPath("a").retain() - expect(project.bufferForPath("a")).toBe buffer - - alternativeBuffer = project.bufferForPath("b").retain().release() - expect(alternativeBuffer).not.toBe buffer - buffer.release() - - it "creates a new buffer if the previous buffer was destroyed", -> - buffer = project.bufferForPath("a").retain().release() - expect(project.bufferForPath("a").retain().release()).not.toBe buffer - - describe ".resolve(path)", -> - it "returns an absolute path based on the project's root", -> - absolutePath = require.resolve('fixtures/dir/a') - expect(project.resolve('a')).toBe absolutePath - expect(project.resolve(absolutePath + '/../a')).toBe absolutePath - expect(project.resolve('a/../a')).toBe absolutePath - - describe ".relativize(path)", -> - it "returns an relative path based on the project's root", -> - absolutePath = require.resolve('fixtures/dir') - expect(project.relativize(fs.join(absolutePath, "b"))).toBe "b" - expect(project.relativize(fs.join(absolutePath, "b/file.coffee"))).toBe "b/file.coffee" - expect(project.relativize(fs.join(absolutePath, "file.coffee"))).toBe "file.coffee" - - describe ".setPath(path)", -> - describe "when path is a file", -> - it "sets its path to the files parent directory and updates the root directory", -> - project.setPath(require.resolve('fixtures/dir/a')) - expect(project.getPath()).toEqual require.resolve('fixtures/dir') - expect(project.getRootDirectory().path).toEqual require.resolve('fixtures/dir') - - describe "when path is a directory", -> - it "sets its path to the directory and updates the root directory", -> - project.setPath(require.resolve('fixtures/dir/a-dir')) - expect(project.getPath()).toEqual require.resolve('fixtures/dir/a-dir') - expect(project.getRootDirectory().path).toEqual require.resolve('fixtures/dir/a-dir') - - describe "when path is null", -> - it "sets its path and root directory to null", -> - project.setPath(null) - expect(project.getPath()?).toBeFalsy() - expect(project.getRootDirectory()?).toBeFalsy() - - describe ".getFilePaths()", -> - it "ignores files that return true from atom.ignorePath(path)", -> - spyOn(project, 'ignorePath').andCallFake (path) -> fs.base(path).match /a$/ - - project.getFilePaths().done (paths) -> - expect(paths).not.toContain('a') - expect(paths).toContain('b') - - describe ".scan(options, callback)", -> - describe "when called with a regex", -> - it "calls the callback with all regex matches in all files in the project", -> - matches = [] - waitsForPromise -> - project.scan /(a)+/, ({path, match, range}) -> - matches.push({path, match, range}) - - runs -> - expect(matches[0]).toEqual - path: project.resolve('a') - match: 'aaa' - range: [[0, 0], [0, 3]] - - expect(matches[1]).toEqual - path: project.resolve('a') - match: 'aa' - range: [[1, 3], [1, 5]] - - it "works on evil filenames", -> - project.setPath(require.resolve('fixtures/evil-files')) - paths = [] - matches = [] - waitsForPromise -> - project.scan /evil/, ({path, match, range}) -> - paths.push(path) - matches.push(match) - - runs -> - expect(paths.length).toBe 5 - matches.forEach (match) -> expect(match).toEqual 'evil' - expect(paths[0]).toMatch /a_file_with_utf8.txt$/ - expect(paths[1]).toMatch /file with spaces.txt$/ - expect(paths[2]).toMatch /goddam\nnewlines$/m - expect(paths[3]).toMatch /quote".txt$/m - expect(fs.base(paths[4])).toBe "utfa\u0306.md" - - it "handles breaks in the search subprocess's output following the filename", -> - spyOn $native, 'exec' - - iterator = jasmine.createSpy('iterator') - project.scan /a+/, iterator - - stdout = $native.exec.argsForCall[0][1].stdout - stdout ":#{require.resolve('fixtures/dir/a')}\n" - stdout "1;0 3:aaa bbb\n2;3 2:cc aa cc\n" - - expect(iterator.argsForCall[0][0]).toEqual - path: project.resolve('a') - match: 'aaa' - range: [[0, 0], [0, 3]] - - expect(iterator.argsForCall[1][0]).toEqual - path: project.resolve('a') - match: 'aa' - range: [[1, 3], [1, 5]] diff --git a/spec/app/range-spec.coffee b/spec/app/range-spec.coffee deleted file mode 100644 index 780962a5f..000000000 --- a/spec/app/range-spec.coffee +++ /dev/null @@ -1,34 +0,0 @@ -Range = require 'range' -Point = require 'point' - -describe "Range", -> - describe "constructor", -> - it "ensures that @start <= @end", -> - range1 = new Range(new Point(0, 1), new Point(0, 4)) - expect(range1.start).toEqual(row: 0, column: 1) - - range2 = new Range(new Point(1, 4), new Point(0, 1)) - expect(range2.start).toEqual(row: 0, column: 1) - - describe ".isEmpty()", -> - it "returns true if @start equals @end", -> - expect(new Range(new Point(1, 1), new Point(1, 1)).isEmpty()).toBeTruthy() - expect(new Range(new Point(1, 1), new Point(1, 2)).isEmpty()).toBeFalsy() - - describe ".intersectsWith(otherRange)", -> - it "returns true if the ranges intersect or share an endpoint", -> - expect(new Range([1, 1], [2, 10]).intersectsWith(new Range([2, 1], [3, 10]))).toBeTruthy() - expect(new Range([2, 1], [3, 10]).intersectsWith(new Range([1, 1], [2, 10]))).toBeTruthy() - expect(new Range([2, 1], [3, 10]).intersectsWith(new Range([2, 5], [3, 1]))).toBeTruthy() - expect(new Range([2, 5], [3, 1]).intersectsWith(new Range([2, 1], [3, 10]))).toBeTruthy() - expect(new Range([2, 5], [3, 1]).intersectsWith(new Range([3, 1], [3, 10]))).toBeTruthy() - expect(new Range([3, 1], [3, 10]).intersectsWith(new Range([2, 5], [3, 1]))).toBeTruthy() - expect(new Range([2, 5], [3, 1]).intersectsWith(new Range([3, 2], [3, 10]))).toBeFalsy() - expect(new Range([3, 2], [3, 10]).intersectsWith(new Range([2, 5], [3, 1]))).toBeFalsy() - - describe ".union(otherRange)", -> - it "returns the union of the two ranges", -> - expect(new Range([1, 1], [2, 10]).union(new Range([2, 1], [3, 10]))).toEqual [[1, 1], [3, 10]] - expect(new Range([2, 1], [3, 10]).union(new Range([1, 1], [2, 10]))).toEqual [[1, 1], [3, 10]] - expect(new Range([2, 1], [3, 10]).union(new Range([2, 5], [3, 1]))).toEqual [[2, 1], [3, 10]] - expect(new Range([2, 5], [3, 1]).union(new Range([2, 1], [3, 10]))).toEqual [[2, 1], [3, 10]] diff --git a/spec/app/root-view-spec.coffee b/spec/app/root-view-spec.coffee deleted file mode 100644 index 194a78eea..000000000 --- a/spec/app/root-view-spec.coffee +++ /dev/null @@ -1,626 +0,0 @@ -$ = require 'jquery' -fs = require 'fs' -RootView = require 'root-view' -Buffer = require 'buffer' -Editor = require 'editor' -{View} = require 'space-pen' - -describe "RootView", -> - rootView = null - path = null - - beforeEach -> - path = require.resolve 'fixtures/dir/a' - rootView = new RootView(path) - rootView.enableKeymap() - rootView.focus() - - afterEach -> - rootView.remove() - - describe "initialize(pathToOpen)", -> - describe "when called with a pathToOpen", -> - describe "when pathToOpen references a file", -> - it "creates a project for the file's parent directory, then sets the document.title and opens the file in an editor", -> - expect(rootView.project.getPath()).toBe fs.directory(path) - expect(rootView.getEditors().length).toBe 1 - expect(rootView.getEditors()[0]).toHaveClass 'active' - expect(rootView.getActiveEditor().getPath()).toBe path - expect(rootView.getActiveEditor().editSessions.length).toBe 1 - expect(document.title).toBe path - - describe "when pathToOpen references a directory", -> - beforeEach -> - rootView.remove() - - it "creates a project for the directory and sets the document.title, but does not open an editor", -> - path = require.resolve 'fixtures/dir' - rootView = new RootView(path) - rootView.focus() - - expect(rootView.project.getPath()).toBe path - expect(rootView.getEditors().length).toBe 0 - expect(document.title).toBe path - - describe "when called with view state data returned from a previous call to RootView.prototype.serialize", -> - viewState = null - - describe "when the serialized RootView has an unsaved buffer", -> - buffer = null - - beforeEach -> - rootView.remove() - rootView = new RootView - rootView.open() - editor1 = rootView.getActiveEditor() - buffer = editor1.getBuffer() - editor1.splitRight() - viewState = rootView.serialize() - - it "constructs the view with the same panes", -> - rootView = RootView.deserialize(viewState) - expect(rootView.project.getPath()?).toBeFalsy() - expect(rootView.getEditors().length).toBe 2 - expect(rootView.getActiveEditor().getText()).toBe buffer.getText() - expect(document.title).toBe 'untitled' - - describe "when the serialized RootView has a project", -> - beforeEach -> - path = require.resolve 'fixtures' - rootView.remove() - rootView = new RootView(path) - rootView.open('dir/a') - - editor1 = rootView.getActiveEditor() - editor2 = editor1.splitRight() - editor3 = editor2.splitRight() - editor4 = editor2.splitDown() - editor2.edit(rootView.project.buildEditSessionForPath('dir/b')) - editor3.edit(rootView.project.buildEditSessionForPath('sample.js')) - editor3.setCursorScreenPosition([2, 3]) - editor4.edit(rootView.project.buildEditSessionForPath('sample.txt')) - editor4.setCursorScreenPosition([0, 2]) - rootView.attachToDom() - editor2.focus() - viewState = rootView.serialize() - rootView.remove() - - it "constructs the view with the same project and panes", -> - rootView = RootView.deserialize(viewState) - rootView.attachToDom() - - expect(rootView.getEditors().length).toBe 4 - editor1 = rootView.panes.find('.row > .pane .editor:eq(0)').view() - editor3 = rootView.panes.find('.row > .pane .editor:eq(1)').view() - editor2 = rootView.panes.find('.row > .column > .pane .editor:eq(0)').view() - editor4 = rootView.panes.find('.row > .column > .pane .editor:eq(1)').view() - - expect(editor1.getPath()).toBe require.resolve('fixtures/dir/a') - expect(editor2.getPath()).toBe require.resolve('fixtures/dir/b') - expect(editor3.getPath()).toBe require.resolve('fixtures/sample.js') - expect(editor3.getCursorScreenPosition()).toEqual [2, 3] - expect(editor4.getPath()).toBe require.resolve('fixtures/sample.txt') - expect(editor4.getCursorScreenPosition()).toEqual [0, 2] - - # ensure adjust pane dimensions is called - expect(editor1.width()).toBeGreaterThan 0 - expect(editor2.width()).toBeGreaterThan 0 - expect(editor3.width()).toBeGreaterThan 0 - expect(editor4.width()).toBeGreaterThan 0 - - # ensure correct editor is focused again - expect(editor2.isFocused).toBeTruthy() - expect(editor1.isFocused).toBeFalsy() - expect(editor3.isFocused).toBeFalsy() - expect(editor4.isFocused).toBeFalsy() - - expect(document.title).toBe editor2.getPath() - - describe "when called with no pathToOpen", -> - it "opens no buffer", -> - rootView.remove() - rootView = new RootView - expect(rootView.getEditors().length).toBe 0 - expect(document.title).toBe 'untitled' - - describe ".serialize()", -> - it "absorbs exceptions that are thrown by extension serialize methods", -> - spyOn(console, 'error') - - rootView.activateExtension( - name: "bad-egg" - activate: -> - serialize: -> throw new Error("I'm broken") - ) - - rootView.activateExtension( - name: "good-egg" - activate: -> - serialize: -> "I still get called" - ) - - data = rootView.serialize() - expect(data.extensionStates['good-egg']).toBe "I still get called" - expect(data.extensionStates['bad-egg']).toBeUndefined() - expect(console.error).toHaveBeenCalled() - - describe "focus", -> - it "can receive focus if there is no active editor, but otherwise hands off focus to the active editor", -> - rootView.remove() - rootView = new RootView(require.resolve 'fixtures') - rootView.attachToDom() - expect(rootView).toMatchSelector(':focus') - - rootView.open() # create an editor - expect(rootView).not.toMatchSelector(':focus') - expect(rootView.getActiveEditor().isFocused).toBeTruthy() - - rootView.focus() - expect(rootView).not.toMatchSelector(':focus') - expect(rootView.getActiveEditor().isFocused).toBeTruthy() - - describe "panes", -> - [pane1, newPaneContent] = [] - - beforeEach -> - rootView.attachToDom() - rootView.width(800) - rootView.height(600) - pane1 = rootView.find('.pane').view() - pane1.attr('id', 'pane-1') - newPaneContent = $("
    New pane content
    ") - spyOn(newPaneContent, 'focus') - - describe "vertical splits", -> - describe "when .splitRight(view) is called on a pane", -> - it "places a new pane to the right of the current pane in a .row div", -> - expect(rootView.panes.find('.row')).not.toExist() - - pane2 = pane1.splitRight(newPaneContent) - expect(newPaneContent.focus).toHaveBeenCalled() - - expect(rootView.panes.find('.row')).toExist() - expect(rootView.panes.find('.row .pane').length).toBe 2 - [leftPane, rightPane] = rootView.panes.find('.row .pane').map -> $(this) - expect(rightPane[0]).toBe pane2[0] - expect(leftPane.attr('id')).toBe 'pane-1' - expect(rightPane.html()).toBe "
    New pane content
    " - - expectedColumnWidth = Math.floor(rootView.panes.width() / 2) - expect(leftPane.outerWidth()).toBe expectedColumnWidth - expect(rightPane.position().left).toBe expectedColumnWidth - expect(rightPane.outerWidth()).toBe expectedColumnWidth - - pane2.remove() - - expect(rootView.panes.find('.row')).not.toExist() - expect(rootView.panes.find('.pane').length).toBe 1 - expect(pane1.outerWidth()).toBe rootView.panes.width() - - describe "when splitLeft(view) is called on a pane", -> - it "places a new pane to the left of the current pane in a .row div", -> - expect(rootView.find('.row')).not.toExist() - - pane2 = pane1.splitLeft(newPaneContent) - expect(newPaneContent.focus).toHaveBeenCalled() - - expect(rootView.find('.row')).toExist() - expect(rootView.find('.row .pane').length).toBe 2 - [leftPane, rightPane] = rootView.find('.row .pane').map -> $(this) - expect(leftPane[0]).toBe pane2[0] - expect(rightPane.attr('id')).toBe 'pane-1' - expect(leftPane.html()).toBe "
    New pane content
    " - - expectedColumnWidth = Math.floor(rootView.panes.width() / 2) - expect(leftPane.outerWidth()).toBe expectedColumnWidth - expect(rightPane.position().left).toBe expectedColumnWidth - expect(rightPane.outerWidth()).toBe expectedColumnWidth - - pane2.remove() - - expect(rootView.panes.find('.row')).not.toExist() - expect(rootView.panes.find('.pane').length).toBe 1 - expect(pane1.outerWidth()).toBe rootView.panes.width() - expect(pane1.position().left).toBe 0 - - describe "horizontal splits", -> - describe "when splitUp(view) is called on a pane", -> - it "places a new pane above the current pane in a .column div", -> - expect(rootView.find('.column')).not.toExist() - - pane2 = pane1.splitUp(newPaneContent) - expect(newPaneContent.focus).toHaveBeenCalled() - - expect(rootView.find('.column')).toExist() - expect(rootView.find('.column .pane').length).toBe 2 - [topPane, bottomPane] = rootView.find('.column .pane').map -> $(this) - expect(topPane[0]).toBe pane2[0] - expect(bottomPane.attr('id')).toBe 'pane-1' - expect(topPane.html()).toBe "
    New pane content
    " - - expectedRowHeight = Math.floor(rootView.panes.height() / 2) - expect(topPane.outerHeight()).toBe expectedRowHeight - expect(bottomPane.position().top).toBe expectedRowHeight - expect(bottomPane.outerHeight()).toBe expectedRowHeight - - pane2.remove() - - expect(rootView.panes.find('.column')).not.toExist() - expect(rootView.panes.find('.pane').length).toBe 1 - expect(pane1.outerHeight()).toBe rootView.panes.height() - expect(pane1.position().top).toBe 0 - - describe "when splitDown(view) is called on a pane", -> - it "places a new pane below the current pane in a .column div", -> - expect(rootView.find('.column')).not.toExist() - - pane2 = pane1.splitDown(newPaneContent) - expect(newPaneContent.focus).toHaveBeenCalled() - - expect(rootView.find('.column')).toExist() - expect(rootView.find('.column .pane').length).toBe 2 - [topPane, bottomPane] = rootView.find('.column .pane').map -> $(this) - expect(bottomPane[0]).toBe pane2[0] - expect(topPane.attr('id')).toBe 'pane-1' - expect(bottomPane.html()).toBe "
    New pane content
    " - - expectedRowHeight = Math.floor(rootView.panes.height() / 2) - expect(topPane.outerHeight()).toBe expectedRowHeight - expect(bottomPane.position().top).toBe expectedRowHeight - expect(bottomPane.outerHeight()).toBe expectedRowHeight - - pane2.remove() - - expect(rootView.panes.find('.column')).not.toExist() - expect(rootView.panes.find('.pane').length).toBe 1 - expect(pane1.outerHeight()).toBe rootView.panes.height() - - describe "layout of nested vertical and horizontal splits", -> - it "lays out rows and columns with a consistent width", -> - pane1.html("1") - - pane1 - .splitLeft("2") - .splitUp("3") - .splitLeft("4") - .splitDown("5") - - row1 = rootView.panes.children(':eq(0)') - expect(row1.children().length).toBe 2 - column1 = row1.children(':eq(0)').view() - pane1 = row1.children(':eq(1)').view() - expect(column1.outerWidth()).toBe Math.floor(2/3 * rootView.panes.width()) - expect(column1.outerHeight()).toBe rootView.height() - expect(pane1.outerWidth()).toBe Math.floor(1/3 * rootView.panes.width()) - expect(pane1.outerHeight()).toBe rootView.height() - expect(pane1.position().left).toBe column1.outerWidth() - - expect(column1.children().length).toBe 2 - row2 = column1.children(':eq(0)').view() - pane2 = column1.children(':eq(1)').view() - expect(row2.outerWidth()).toBe column1.outerWidth() - expect(row2.height()).toBe Math.floor(2/3 * rootView.panes.height()) - expect(pane2.outerWidth()).toBe column1.outerWidth() - expect(pane2.outerHeight()).toBe Math.floor(1/3 * rootView.panes.height()) - expect(pane2.position().top).toBe row2.height() - - expect(row2.children().length).toBe 2 - column3 = row2.children(':eq(0)').view() - pane3 = row2.children(':eq(1)').view() - expect(column3.outerWidth()).toBe Math.floor(1/3 * rootView.panes.width()) - expect(column3.outerHeight()).toBe row2.outerHeight() - expect(pane3.outerWidth()).toBe Math.floor(1/3 * rootView.panes.width()) - expect(pane3.height()).toBe row2.outerHeight() - expect(pane3.position().left).toBe column3.width() - - expect(column3.children().length).toBe 2 - pane4 = column3.children(':eq(0)').view() - pane5 = column3.children(':eq(1)').view() - expect(pane4.outerWidth()).toBe column3.width() - expect(pane4.outerHeight()).toBe Math.floor(1/3 * rootView.panes.height()) - expect(pane5.outerWidth()).toBe column3.width() - expect(pane5.position().top).toBe pane4.outerHeight() - expect(pane5.outerHeight()).toBe Math.floor(1/3 * rootView.panes.height()) - - pane5.remove() - - expect(column3.parent()).not.toExist() - expect(pane2.outerHeight()).toBe Math.floor(1/2 * rootView.panes.height()) - expect(pane3.outerHeight()).toBe Math.floor(1/2 * rootView.panes.height()) - expect(pane4.outerHeight()).toBe Math.floor(1/2 * rootView.panes.height()) - - pane4.remove() - expect(row2.parent()).not.toExist() - expect(pane1.outerWidth()).toBe Math.floor(1/2 * rootView.panes.width()) - expect(pane2.outerWidth()).toBe Math.floor(1/2 * rootView.panes.width()) - expect(pane3.outerWidth()).toBe Math.floor(1/2 * rootView.panes.width()) - - pane3.remove() - expect(column1.parent()).not.toExist() - expect(pane2.outerHeight()).toBe rootView.panes.height() - - pane2.remove() - expect(row1.parent()).not.toExist() - expect(rootView.panes.children().length).toBe 1 - expect(rootView.panes.children('.pane').length).toBe 1 - expect(pane1.outerWidth()).toBe rootView.panes.width() - - describe ".focusNextPane()", -> - it "focuses the wrapped view of the pane after the currently focused pane", -> - class DummyView extends View - @content: (number) -> @div(number, tabindex: -1) - - view1 = pane1.wrappedView - view2 = new DummyView(2) - view3 = new DummyView(3) - pane2 = pane1.splitDown(view2) - pane3 = pane2.splitRight(view3) - rootView.attachToDom() - view1.focus() - - spyOn(view1, 'focus').andCallThrough() - spyOn(view2, 'focus').andCallThrough() - spyOn(view3, 'focus').andCallThrough() - - rootView.focusNextPane() - expect(view2.focus).toHaveBeenCalled() - rootView.focusNextPane() - expect(view3.focus).toHaveBeenCalled() - rootView.focusNextPane() - expect(view1.focus).toHaveBeenCalled() - - describe "extensions", -> - extension = null - - beforeEach -> - extension = - name: 'extension' - deactivate: -> - activate: jasmine.createSpy("activate") - serialize: -> "it worked" - - describe ".activateExtension(extension)", -> - it "calls activate on the extension", -> - rootView.activateExtension(extension) - expect(extension.activate).toHaveBeenCalledWith(rootView, undefined) - - it "calls activate on the extension with its previous state", -> - rootView.activateExtension(extension) - extension.activate.reset() - - newRootView = RootView.deserialize(rootView.serialize()) - newRootView.activateExtension(extension) - expect(extension.activate).toHaveBeenCalledWith(newRootView, "it worked") - newRootView.remove() - - it "throws an exception if the extension has no 'name' property", -> - expect(-> rootView.activateExtension({ activate: -> })).toThrow() - - describe ".deactivateExtension(extension)", -> - it "deactivates and removes the extension from the extension list", -> - rootView.activateExtension(extension) - expect(rootView.extensions[extension.name]).toBeTruthy() - spyOn(extension, "deactivate").andCallThrough() - rootView.deactivateExtension(extension) - expect(extension.deactivate).toHaveBeenCalled() - expect(rootView.extensions[extension.name]).toBeFalsy() - - it "is called when the rootView is deactivated to deactivate all extensions", -> - rootView.activateExtension(extension) - spyOn(rootView, "deactivateExtension").andCallThrough() - spyOn(extension, "deactivate").andCallThrough() - rootView.deactivate() - expect(rootView.deactivateExtension).toHaveBeenCalled() - expect(extension.deactivate).toHaveBeenCalled() - - describe "keymap wiring", -> - commandHandler = null - beforeEach -> - commandHandler = jasmine.createSpy('commandHandler') - rootView.on('foo-command', commandHandler) - - window.keymap.bindKeys('*', 'x': 'foo-command') - - describe "when a keydown event is triggered on the RootView (not originating from Ace)", -> - it "triggers matching keybindings for that event", -> - event = keydownEvent 'x', target: rootView[0] - - rootView.trigger(event) - expect(commandHandler).toHaveBeenCalled() - - describe ".activeKeybindings()", -> - originalKeymap = null - keymap = null - editor = null - - beforeEach -> - rootView.attachToDom() - editor = rootView.getActiveEditor() - keymap = new (require 'keymap') - originalKeymap = window.keymap - window.keymap = keymap - - afterEach -> - window.keymap = originalKeymap - - it "returns all keybindings available for focused element", -> - editor.on 'test-event-a', => # nothing - - keymap.bindKeys ".editor", - "meta-a": "test-event-a" - "meta-b": "test-event-b" - - keybindings = rootView.activeKeybindings() - expect(Object.keys(keybindings).length).toBe 2 - expect(keybindings["meta-a"]).toEqual "test-event-a" - - describe "when the focused editor changes", -> - it "changes the document.title and emits an active-editor-path-change event", -> - pathChangeHandler = jasmine.createSpy 'pathChangeHandler' - rootView.on 'active-editor-path-change', pathChangeHandler - - editor1 = rootView.getActiveEditor() - expect(document.title).toBe path - - editor2 = rootView.getActiveEditor().splitLeft() - - path = rootView.project.resolve('b') - editor2.edit(rootView.project.buildEditSessionForPath(path)) - expect(pathChangeHandler).toHaveBeenCalled() - expect(document.title).toBe rootView.project.resolve(path) - - pathChangeHandler.reset() - editor1.getBuffer().saveAs("/tmp/should-not-be-title.txt") - expect(pathChangeHandler).not.toHaveBeenCalled() - expect(document.title).toBe rootView.project.resolve(path) - - it "creates a project if there isn't one yet and the buffer was previously unsaved", -> - rootView.remove() - rootView = new RootView - rootView.open() - expect(rootView.project.getPath()?).toBeFalsy() - rootView.getActiveEditor().getBuffer().saveAs('/tmp/ignore-me') - expect(rootView.project.getPath()).toBe '/tmp' - - describe "when editors are focused", -> - it "triggers 'active-editor-path-change' events if the path of the active editor actually changes", -> - pathChangeHandler = jasmine.createSpy 'pathChangeHandler' - rootView.on 'active-editor-path-change', pathChangeHandler - - editor1 = rootView.getActiveEditor() - editor2 = rootView.getActiveEditor().splitLeft() - - rootView.open(require.resolve('fixtures/sample.txt')) - expect(pathChangeHandler).toHaveBeenCalled() - pathChangeHandler.reset() - - editor1.focus() - expect(pathChangeHandler).toHaveBeenCalled() - pathChangeHandler.reset() - - rootView.focus() - expect(pathChangeHandler).not.toHaveBeenCalled() - - editor2.edit(editor1.activeEditSession.copy()) - editor2.focus() - expect(pathChangeHandler).not.toHaveBeenCalled() - - describe "when the last editor is removed", -> - it "updates the title to the project path", -> - rootView.getEditors()[0].remove() - expect(document.title).toBe rootView.project.getPath() - - describe "font size adjustment", -> - it "increases/decreases font size when increase/decrease-font-size events are triggered", -> - fontSizeBefore = rootView.getFontSize() - rootView.trigger 'increase-font-size' - expect(rootView.getFontSize()).toBe fontSizeBefore + 1 - rootView.trigger 'increase-font-size' - expect(rootView.getFontSize()).toBe fontSizeBefore + 2 - rootView.trigger 'decrease-font-size' - expect(rootView.getFontSize()).toBe fontSizeBefore + 1 - rootView.trigger 'decrease-font-size' - expect(rootView.getFontSize()).toBe fontSizeBefore - - it "does not allow the font size to be less than 1", -> - rootView.setFontSize(1) - expect(rootView.getFontSize()).toBe 1 - - rootView.setFontSize(0) - expect(rootView.getFontSize()).toBe 1 - - describe ".open(path, options)", -> - describe "when there is no active editor", -> - beforeEach -> - rootView.getActiveEditor().destroyActiveEditSession() - expect(rootView.getActiveEditor()).toBeUndefined() - - describe "when called with no path", -> - it "opens / returns an edit session for an empty buffer in a new editor", -> - editSession = rootView.open() - expect(rootView.getActiveEditor()).toBeDefined() - expect(rootView.getActiveEditor().getPath()).toBeUndefined() - expect(editSession).toBe rootView.getActiveEditor().activeEditSession - - describe "when called with a path", -> - it "opens a buffer with the given path in a new editor", -> - editSession = rootView.open('b') - expect(rootView.getActiveEditor()).toBeDefined() - expect(rootView.getActiveEditor().getPath()).toBe require.resolve('fixtures/dir/b') - expect(editSession).toBe rootView.getActiveEditor().activeEditSession - - describe "when there is an active editor", -> - beforeEach -> - expect(rootView.getActiveEditor()).toBeDefined() - - describe "when called with no path", -> - it "opens an empty buffer in the active editor", -> - editSession = rootView.open() - expect(rootView.getActiveEditor().getPath()).toBeUndefined() - expect(editSession).toBe rootView.getActiveEditor().activeEditSession - - describe "when called with a path", -> - [editor1, editor2] = [] - beforeEach -> - rootView.attachToDom() - editor1 = rootView.getActiveEditor() - editor2 = editor1.splitRight() - rootView.open('b') - editor2.loadPreviousEditSession() - editor1.focus() - - describe "when allowActiveEditorChange is false (the default)", -> - activeEditor = null - beforeEach -> - activeEditor = rootView.getActiveEditor() - - describe "when the active editor has an edit session for the given path", -> - it "re-activates the existing edit session", -> - expect(activeEditor.getPath()).toBe require.resolve('fixtures/dir/a') - previousEditSession = activeEditor.activeEditSession - - editSession = rootView.open('b') - expect(activeEditor.activeEditSession).not.toBe previousEditSession - expect(editSession).toBe rootView.getActiveEditor().activeEditSession - - editSession = rootView.open('a') - expect(activeEditor.activeEditSession).toBe previousEditSession - expect(editSession).toBe previousEditSession - - describe "when the active editor does not have an edit session for the given path", -> - it "creates a new edit session for the given path in the active editor", -> - editSession = rootView.open('b') - expect(activeEditor.editSessions.length).toBe 2 - expect(editSession).toBe rootView.getActiveEditor().activeEditSession - - describe "when the 'allowActiveEditorChange' option is true", -> - describe "when the active editor has an edit session for the given path", -> - it "re-activates the existing edit session regardless of whether any other editor also has an edit session for the path", -> - activeEditor = rootView.getActiveEditor() - expect(activeEditor.getPath()).toBe require.resolve('fixtures/dir/a') - previousEditSession = activeEditor.activeEditSession - - editSession = rootView.open('b') - expect(activeEditor.activeEditSession).not.toBe previousEditSession - expect(editSession).toBe activeEditor.activeEditSession - - editSession = rootView.open('a', allowActiveEditorChange: true) - expect(activeEditor.activeEditSession).toBe previousEditSession - expect(editSession).toBe activeEditor.activeEditSession - - describe "when the active editor does *not* have an edit session for the given path", -> - describe "when another editor has an edit session for the path", -> - it "focuses the other editor and activates its edit session for the path", -> - expect(rootView.getActiveEditor()).toBe editor1 - editSession = rootView.open('b', allowActiveEditorChange: true) - expect(rootView.getActiveEditor()).toBe editor2 - expect(editor2.getPath()).toBe require.resolve('fixtures/dir/b') - expect(editSession).toBe rootView.getActiveEditor().activeEditSession - - describe "when no other editor has an edit session for the path either", -> - it "creates a new edit session for the path on the current active editor", -> - path = require.resolve('fixtures/sample.js') - editSession = rootView.open(path, allowActiveEditorChange: true) - expect(rootView.getActiveEditor()).toBe editor1 - expect(editor1.getPath()).toBe path - expect(editSession).toBe rootView.getActiveEditor().activeEditSession diff --git a/spec/app/screen-line-spec.coffee b/spec/app/screen-line-spec.coffee deleted file mode 100644 index a3275866f..000000000 --- a/spec/app/screen-line-spec.coffee +++ /dev/null @@ -1,114 +0,0 @@ -_ = require 'underscore' -Buffer = require 'buffer' -TokenizedBuffer = require 'tokenized-buffer' - -describe "ScreenLine", -> - [editSession, buffer, tabText, screenLine, tokenizedBuffer] = [] - - beforeEach -> - tabText = ' ' - editSession = fixturesProject.buildEditSessionForPath('sample.js') - { buffer, tokenizedBuffer } = editSession - screenLine = tokenizedBuffer.lineForScreenRow(3) - - afterEach -> - editSession.destroy() - - describe ".splitAt(column)", -> - it "breaks the line fragment into two fragments", -> - [left, right] = screenLine.splitAt(31) - expect(left.text).toBe ' var pivot = items.shift(), ' - expect(tokensText left.tokens).toBe left.text - - expect(right.text).toBe 'current, left = [], right = [];' - expect(tokensText right.tokens).toBe right.text - - it "splits tokens if they straddle the split boundary", -> - [left, right] = screenLine.splitAt(34) - expect(left.text).toBe ' var pivot = items.shift(), cur' - expect(tokensText left.tokens).toBe left.text - - expect(right.text).toBe 'rent, left = [], right = [];' - expect(tokensText right.tokens).toBe right.text - - expect(_.last(left.tokens).type).toBe right.tokens[0].type - - it "ensures the returned fragments cover the span of the original line", -> - [left, right] = screenLine.splitAt(15) - expect(left.bufferDelta).toEqual [0, 15] - expect(left.screenDelta).toEqual [0, 15] - - expect(right.bufferDelta).toEqual [1, 0] - expect(right.screenDelta).toEqual [1, 0] - - [left2, right2] = left.splitAt(5) - expect(left2.bufferDelta).toEqual [0, 5] - expect(left2.screenDelta).toEqual [0, 5] - - expect(right2.bufferDelta).toEqual [0, 10] - expect(right2.screenDelta).toEqual [0, 10] - - describe "if splitting at 0", -> - it "returns an empty line fragment for the left half", -> - left = screenLine.splitAt(0)[0] - expect(left.text).toBe '' - expect(left.tokens).toEqual [] - expect(left.bufferDelta).toEqual [0, 0] - expect(left.screenDelta).toEqual [0, 0] - - describe "if splitting at a column equal to the line length", -> - it "returns an empty line fragment that spans a row for the right half", -> - [left, right] = screenLine.splitAt(screenLine.text.length) - - expect(left.text).toBe screenLine.text - expect(left.screenDelta).toEqual [0, screenLine.text.length] - expect(left.bufferDelta).toEqual [0, screenLine.text.length] - - expect(right.text).toBe '' - expect(right.screenDelta).toEqual [1, 0] - expect(right.bufferDelta).toEqual [1, 0] - - describe ".concat(otherFragment)", -> - it "returns the concatenation of the receiver and the given fragment", -> - [left, right] = screenLine.splitAt(14) - expect(left.concat(right)).toEqual screenLine - - concatenated = screenLine.concat(tokenizedBuffer.lineForScreenRow(4)) - expect(concatenated.text).toBe ' var pivot = items.shift(), current, left = [], right = []; while(items.length > 0) {' - expect(tokensText concatenated.tokens).toBe concatenated.text - expect(concatenated.screenDelta).toEqual [2, 0] - expect(concatenated.bufferDelta).toEqual [2, 0] - - describe ".translateColumn(sourceDeltaType, targetDeltaType, sourceColumn, skipAtomicTokens: false)", -> - beforeEach -> - buffer.insert([0, 13], '\t') - buffer.insert([0, 0], '\t\t') - screenLine = tokenizedBuffer.lineForScreenRow(0) - - describe "when translating from buffer to screen coordinates", -> - it "accounts for tab characters being wider on screen", -> - expect(screenLine.translateColumn('bufferDelta', 'screenDelta', 0)).toBe 0 - expect(screenLine.translateColumn('bufferDelta', 'screenDelta', 1)).toBe 2 - expect(screenLine.translateColumn('bufferDelta', 'screenDelta', 2)).toBe 4 - expect(screenLine.translateColumn('bufferDelta', 'screenDelta', 3)).toBe 5 - expect(screenLine.translateColumn('bufferDelta', 'screenDelta', 15)).toBe 17 - expect(screenLine.translateColumn('bufferDelta', 'screenDelta', 16)).toBe 19 - - describe "when translating from screen coordinates to buffer coordinates", -> - describe "when skipAtomicTokens is false (the default)", -> - it "clips positions in the middle of tab tokens to the beginning", -> - expect(screenLine.translateColumn('screenDelta', 'bufferDelta', 0)).toBe 0 - expect(screenLine.translateColumn('screenDelta', 'bufferDelta', 1)).toBe 0 - expect(screenLine.translateColumn('screenDelta', 'bufferDelta', 2)).toBe 1 - expect(screenLine.translateColumn('screenDelta', 'bufferDelta', 3)).toBe 1 - expect(screenLine.translateColumn('screenDelta', 'bufferDelta', 4)).toBe 2 - expect(screenLine.translateColumn('screenDelta', 'bufferDelta', 5)).toBe 3 - - describe "when skipAtomicTokens is true", -> - it "clips positions in the middle of tab tokens to the end", -> - expect(screenLine.translateColumn('screenDelta', 'bufferDelta', 0, skipAtomicTokens: true)).toBe 0 - expect(screenLine.translateColumn('screenDelta', 'bufferDelta', 1, skipAtomicTokens: true)).toBe 1 - expect(screenLine.translateColumn('screenDelta', 'bufferDelta', 2, skipAtomicTokens: true)).toBe 1 - expect(screenLine.translateColumn('screenDelta', 'bufferDelta', 3, skipAtomicTokens: true)).toBe 2 - expect(screenLine.translateColumn('screenDelta', 'bufferDelta', 5, skipAtomicTokens: true)).toBe 3 - diff --git a/spec/app/selection-spec.coffee b/spec/app/selection-spec.coffee deleted file mode 100644 index a43ad7f1e..000000000 --- a/spec/app/selection-spec.coffee +++ /dev/null @@ -1,77 +0,0 @@ -Buffer = require 'buffer' -EditSession = require 'edit-session' -Range = require 'range' - -describe "Selection", -> - [buffer, editSession, selection] = [] - - beforeEach -> - buffer = new Buffer(require.resolve('fixtures/sample.js')) - editSession = new EditSession(buffer: buffer, tabText: ' ') - selection = editSession.getSelection() - - afterEach -> - buffer.destroy() - - describe ".deleteSelectedText()", -> - describe "when nothing is selected", -> - it "deletes nothing", -> - selection.setBufferRange new Range([0,3], [0,3]) - selection.deleteSelectedText() - expect(buffer.lineForRow(0)).toBe "var quicksort = function () {" - - describe "when one line is selected", -> - it "deletes selected text and clears the selection", -> - selection.setBufferRange new Range([0,4], [0,14]) - selection.deleteSelectedText() - expect(buffer.lineForRow(0)).toBe "var = function () {" - - endOfLine = buffer.lineForRow(0).length - selection.setBufferRange new Range([0,0], [0, endOfLine]) - selection.deleteSelectedText() - expect(buffer.lineForRow(0)).toBe "" - - expect(selection.isEmpty()).toBeTruthy() - - describe "when multiple lines are selected", -> - it "deletes selected text and clears the selection", -> - selection.setBufferRange new Range([0,1], [2,39]) - selection.deleteSelectedText() - expect(buffer.lineForRow(0)).toBe "v;" - expect(selection.isEmpty()).toBeTruthy() - - describe "when the cursor precedes the anchor", -> - it "it deletes selected text and clears the selection", -> - selection.cursor.setScreenPosition [0,13] - selection.selectToScreenPosition [0,4] - - selection.delete() - expect(buffer.lineForRow(0)).toBe "var = function () {" - expect(selection.isEmpty()).toBeTruthy() - - describe ".isReversed()", -> - it "returns true if the cursor precedes the anchor", -> - selection.cursor.setScreenPosition([0, 20]) - selection.selectToScreenPosition([0, 10]) - expect(selection.isReversed()).toBeTruthy() - - selection.selectToScreenPosition([0, 25]) - expect(selection.isReversed()).toBeFalsy() - - describe "when only the selection's anchor is moved (regression)", -> - it "emits the 'change-screen-range' event", -> - selection.setBufferRange([[2, 0], [2, 10]], reverse: true) - changeScreenRangeHandler = jasmine.createSpy('changeScreenRangeHandler') - selection.on 'change-screen-range', changeScreenRangeHandler - - buffer.insert([2, 5], 'abc') - expect(changeScreenRangeHandler).toHaveBeenCalled() - - describe "when the selection is destroyed", -> - it "destroys its cursor and its anchor's cursor", -> - selection.setBufferRange([[2, 0], [2, 10]]) - - selection.destroy() - - expect(editSession.getAnchors().indexOf(selection.anchor)).toBe -1 - expect(editSession.getAnchors().indexOf(selection.cursor.anchor)).toBe -1 diff --git a/spec/app/status-bar-spec.coffee b/spec/app/status-bar-spec.coffee deleted file mode 100644 index 9beefc5cf..000000000 --- a/spec/app/status-bar-spec.coffee +++ /dev/null @@ -1,50 +0,0 @@ -$ = require 'jquery' -RootView = require 'root-view' -StatusBar = require 'status-bar' - -describe "StatusBar", -> - [rootView, editor, statusBar] = [] - - beforeEach -> - rootView = new RootView(require.resolve('fixtures/sample.js')) - rootView.simulateDomAttachment() - StatusBar.activate(rootView) - editor = rootView.getActiveEditor() - statusBar = rootView.find('.status-bar').view() - - afterEach -> - rootView.remove() - - describe "@initialize", -> - it "appends a status bar to all existing and new editors", -> - expect(rootView.panes.find('.pane').length).toBe 1 - expect(rootView.panes.find('.pane > .status-bar').length).toBe 1 - editor.splitRight() - expect(rootView.find('.pane').length).toBe 2 - expect(rootView.panes.find('.pane > .status-bar').length).toBe 2 - - describe ".initialize(editor)", -> - it "displays the editor's buffer path and cursor buffer position", -> - expect(statusBar.currentPath.text()).toBe 'sample.js' - expect(statusBar.cursorPosition.text()).toBe '1,1' - - describe "when associated with an unsaved buffer", -> - it "displays 'untitled' instead of the buffer's path, but still displays the buffer position", -> - rootView.remove() - rootView = new RootView - rootView.open() - rootView.simulateDomAttachment() - StatusBar.activate(rootView) - statusBar = rootView.find('.status-bar').view() - expect(statusBar.currentPath.text()).toBe 'untitled' - expect(statusBar.cursorPosition.text()).toBe '1,1' - - describe "when the associated editor's path changes", -> - it "updates the path in the status bar", -> - rootView.open(require.resolve 'fixtures/sample.txt') - expect(statusBar.currentPath.text()).toBe 'sample.txt' - - describe "when the associated editor's cursor position changes", -> - it "updates the cursor position in the status bar", -> - editor.setCursorScreenPosition([1, 2]) - expect(statusBar.cursorPosition.text()).toBe '2,3' diff --git a/spec/app/text-mate-bundle-spec.coffee b/spec/app/text-mate-bundle-spec.coffee deleted file mode 100644 index 1af162a5d..000000000 --- a/spec/app/text-mate-bundle-spec.coffee +++ /dev/null @@ -1,8 +0,0 @@ -TextMateBundle = require 'text-mate-bundle' - -describe "TextMateBundle", -> - describe ".getPreferenceInScope(scope, preferenceName)", -> - it "returns the preference by the given name in the given scope or undefined if there isn't one", -> - expect(TextMateBundle.getPreferenceInScope('source.coffee', 'decreaseIndentPattern')).toBe '^\\s*(\\}|\\]|else|catch|finally)$' - expect(TextMateBundle.getPreferenceInScope('source.coffee', 'shellVariables')).toBeDefined() - diff --git a/spec/app/text-mate-grammar-spec.coffee b/spec/app/text-mate-grammar-spec.coffee deleted file mode 100644 index f1bc40b33..000000000 --- a/spec/app/text-mate-grammar-spec.coffee +++ /dev/null @@ -1,143 +0,0 @@ -TextMateGrammar = require 'text-mate-grammar' -TextMateBundle = require 'text-mate-bundle' -plist = require 'plist' -fs = require 'fs' -_ = require 'underscore' - -describe "TextMateGrammar", -> - grammar = null - - beforeEach -> - coffeePlist = fs.read(require.resolve 'CoffeeScriptBundle.tmbundle/Syntaxes/CoffeeScript.tmLanguage') - grammar = TextMateBundle.grammarForFileName("hello.coffee") - - describe ".getLineTokens(line, currentRule)", -> - describe "when the entire line matches a single pattern with no capture groups", -> - it "returns a single token with the correct scope", -> - {tokens} = grammar.getLineTokens("return") - - expect(tokens.length).toBe 1 - [token] = tokens - expect(token.scopes).toEqual ['source.coffee', 'keyword.control.coffee'] - - describe "when the entire line matches a single pattern with capture groups", -> - it "returns a single token with the correct scope", -> - {tokens} = grammar.getLineTokens("new foo.bar.Baz") - - expect(tokens.length).toBe 3 - [newOperator, whitespace, className] = tokens - expect(newOperator).toEqual value: 'new', scopes: ['source.coffee', 'meta.class.instance.constructor', 'keyword.operator.new.coffee'] - expect(whitespace).toEqual value: ' ', scopes: ['source.coffee', 'meta.class.instance.constructor'] - expect(className).toEqual value: 'foo.bar.Baz', scopes: ['source.coffee', 'meta.class.instance.constructor', 'entity.name.type.instance.coffee'] - - describe "when the line doesn't match any patterns", -> - it "returns the entire line as a single simple token with the grammar's scope", -> - textGrammar = TextMateBundle.grammarForFileName('foo.txt') - {tokens} = textGrammar.getLineTokens("abc def") - expect(tokens.length).toBe 1 - - describe "when the line matches multiple patterns", -> - it "returns multiple tokens, filling in regions that don't match patterns with tokens in the grammar's global scope", -> - {tokens} = grammar.getLineTokens(" return new foo.bar.Baz ") - - expect(tokens.length).toBe 7 - - expect(tokens[0]).toEqual value: ' ', scopes: ['source.coffee'] - expect(tokens[1]).toEqual value: 'return', scopes: ['source.coffee', 'keyword.control.coffee'] - expect(tokens[2]).toEqual value: ' ', scopes: ['source.coffee'] - expect(tokens[3]).toEqual value: 'new', scopes: ['source.coffee', 'meta.class.instance.constructor', 'keyword.operator.new.coffee'] - expect(tokens[4]).toEqual value: ' ', scopes: ['source.coffee', 'meta.class.instance.constructor'] - expect(tokens[5]).toEqual value: 'foo.bar.Baz', scopes: ['source.coffee', 'meta.class.instance.constructor', 'entity.name.type.instance.coffee'] - expect(tokens[6]).toEqual value: ' ', scopes: ['source.coffee'] - - describe "when the line matches a begin/end pattern", -> - it "returns tokens based on the beginCaptures, endCaptures and the child scope", -> - {tokens} = grammar.getLineTokens("'''single-quoted heredoc'''") - - expect(tokens.length).toBe 3 - - expect(tokens[0]).toEqual value: "'''", scopes: ['source.coffee', 'string.quoted.heredoc.coffee', 'punctuation.definition.string.begin.coffee'] - expect(tokens[1]).toEqual value: "single-quoted heredoc", scopes: ['source.coffee', 'string.quoted.heredoc.coffee'] - expect(tokens[2]).toEqual value: "'''", scopes: ['source.coffee', 'string.quoted.heredoc.coffee', 'punctuation.definition.string.end.coffee'] - - describe "when begin/end pattern spans multiple lines", -> - it "uses the currentRule returned by the first line to parse the second line", -> - {tokens: firstTokens, stack} = grammar.getLineTokens("'''single-quoted") - {tokens: secondTokens, stack} = grammar.getLineTokens("heredoc'''", stack) - - expect(firstTokens.length).toBe 2 - expect(secondTokens.length).toBe 2 - - expect(firstTokens[0]).toEqual value: "'''", scopes: ['source.coffee', 'string.quoted.heredoc.coffee', 'punctuation.definition.string.begin.coffee'] - expect(firstTokens[1]).toEqual value: "single-quoted", scopes: ['source.coffee', 'string.quoted.heredoc.coffee'] - - expect(secondTokens[0]).toEqual value: "heredoc", scopes: ['source.coffee', 'string.quoted.heredoc.coffee'] - expect(secondTokens[1]).toEqual value: "'''", scopes: ['source.coffee', 'string.quoted.heredoc.coffee', 'punctuation.definition.string.end.coffee'] - - describe "when the line matches a pattern with optional capture groups", -> - it "only returns tokens for capture groups that matched", -> - {tokens} = grammar.getLineTokens("class Quicksort") - expect(tokens.length).toBe 3 - expect(tokens[0].value).toBe "class" - expect(tokens[1].value).toBe " " - expect(tokens[2].value).toBe "Quicksort" - - describe "when the line matches a rule with nested capture groups and lookahead capture groups beyond the scope of the overall match", -> - it "creates distinct tokens for nested captures and does not return tokens beyond the scope of the overall capture", -> - {tokens} = grammar.getLineTokens(" destroy: ->") - expect(tokens.length).toBe 6 - expect(tokens[0]).toEqual(value: ' ', scopes: ["source.coffee", "meta.function.coffee"]) - expect(tokens[1]).toEqual(value: 'destro', scopes: ["source.coffee", "meta.function.coffee", "entity.name.function.coffee"]) - # this dangling 'y' with a duplicated scope looks wrong, but textmate yields the same behavior. probably a quirk in the coffee grammar. - expect(tokens[2]).toEqual(value: 'y', scopes: ["source.coffee", "meta.function.coffee", "entity.name.function.coffee", "entity.name.function.coffee"]) - expect(tokens[3]).toEqual(value: ':', scopes: ["source.coffee", "keyword.operator.coffee"]) - expect(tokens[4]).toEqual(value: ' ', scopes: ["source.coffee"]) - expect(tokens[5]).toEqual(value: '->', scopes: ["source.coffee", "storage.type.function.coffee"]) - - describe "when the line matches a begin/end pattern that contains sub-patterns", -> - it "returns tokens within the begin/end scope based on the sub-patterns", -> - {tokens} = grammar.getLineTokens('"""heredoc with character escape \\t"""') - - expect(tokens.length).toBe 4 - - expect(tokens[0]).toEqual value: '"""', scopes: ['source.coffee', 'string.quoted.double.heredoc.coffee', 'punctuation.definition.string.begin.coffee'] - expect(tokens[1]).toEqual value: "heredoc with character escape ", scopes: ['source.coffee', 'string.quoted.double.heredoc.coffee'] - expect(tokens[2]).toEqual value: "\\t", scopes: ['source.coffee', 'string.quoted.double.heredoc.coffee', 'constant.character.escape.coffee'] - expect(tokens[3]).toEqual value: '"""', scopes: ['source.coffee', 'string.quoted.double.heredoc.coffee', 'punctuation.definition.string.end.coffee'] - - describe "when the line matches a pattern that includes a rule", -> - it "returns tokens based on the included rule", -> - {tokens} = grammar.getLineTokens("7777777") - expect(tokens.length).toBe 1 - expect(tokens[0]).toEqual value: '7777777', scopes: ['source.coffee', 'constant.numeric.coffee'] - - describe "when the line is an interpolated string", -> - it "returns the correct tokens", -> - {tokens} = grammar.getLineTokens('"the value is #{@x} my friend"') - - expect(tokens[0]).toEqual value: '"', scopes: ["source.coffee","string.quoted.double.coffee","punctuation.definition.string.begin.coffee"] - expect(tokens[1]).toEqual value: "the value is ", scopes: ["source.coffee","string.quoted.double.coffee"] - expect(tokens[2]).toEqual value: '#{', scopes: ["source.coffee","string.quoted.double.coffee","source.coffee.embedded.source","punctuation.section.embedded.coffee"] - expect(tokens[3]).toEqual value: "@x", scopes: ["source.coffee","string.quoted.double.coffee","source.coffee.embedded.source","variable.other.readwrite.instance.coffee"] - expect(tokens[4]).toEqual value: "}", scopes: ["source.coffee","string.quoted.double.coffee","source.coffee.embedded.source","punctuation.section.embedded.coffee"] - expect(tokens[5]).toEqual value: " my friend", scopes: ["source.coffee","string.quoted.double.coffee"] - expect(tokens[6]).toEqual value: '"', scopes: ["source.coffee","string.quoted.double.coffee","punctuation.definition.string.end.coffee"] - - describe "when the line has an interpolated string inside an interpolated string", -> - it "returns the correct tokens", -> - {tokens} = grammar.getLineTokens('"#{"#{@x}"}"') - - expect(tokens[0]).toEqual value: '"', scopes: ["source.coffee","string.quoted.double.coffee","punctuation.definition.string.begin.coffee"] - expect(tokens[1]).toEqual value: '#{', scopes: ["source.coffee","string.quoted.double.coffee","source.coffee.embedded.source","punctuation.section.embedded.coffee"] - expect(tokens[2]).toEqual value: '"', scopes: ["source.coffee","string.quoted.double.coffee","source.coffee.embedded.source","string.quoted.double.coffee","punctuation.definition.string.begin.coffee"] - expect(tokens[3]).toEqual value: '#{', scopes: ["source.coffee","string.quoted.double.coffee","source.coffee.embedded.source","string.quoted.double.coffee","source.coffee.embedded.source","punctuation.section.embedded.coffee"] - expect(tokens[4]).toEqual value: '@x', scopes: ["source.coffee","string.quoted.double.coffee","source.coffee.embedded.source","string.quoted.double.coffee","source.coffee.embedded.source","variable.other.readwrite.instance.coffee"] - expect(tokens[5]).toEqual value: '}', scopes: ["source.coffee","string.quoted.double.coffee","source.coffee.embedded.source","string.quoted.double.coffee","source.coffee.embedded.source","punctuation.section.embedded.coffee"] - expect(tokens[6]).toEqual value: '"', scopes: ["source.coffee","string.quoted.double.coffee","source.coffee.embedded.source","string.quoted.double.coffee","punctuation.definition.string.end.coffee"] - expect(tokens[7]).toEqual value: '}', scopes: ["source.coffee","string.quoted.double.coffee","source.coffee.embedded.source","punctuation.section.embedded.coffee"] - expect(tokens[8]).toEqual value: '"', scopes: ["source.coffee","string.quoted.double.coffee","punctuation.definition.string.end.coffee"] - - describe "when the line is empty", -> - it "returns a single token which has the global scope", -> - {tokens} = grammar.getLineTokens('') - expect(tokens[0]).toEqual value: '', scopes: ["source.coffee"] diff --git a/spec/app/text-mate-theme-spec.coffee b/spec/app/text-mate-theme-spec.coffee deleted file mode 100644 index 43c176174..000000000 --- a/spec/app/text-mate-theme-spec.coffee +++ /dev/null @@ -1,65 +0,0 @@ -fs = require 'fs' -plist = require 'plist' -TextMateTheme = require 'text-mate-theme' - -describe "TextMateTheme", -> - theme = null - beforeEach -> - theme = TextMateTheme.getTheme('Twilight') - - describe "@getNames()", -> - it "returns an array of available theme names", -> - names = TextMateTheme.getNames() - expect(names).toContain("Twilight") - expect(names).toContain("Blackboard") - - describe "@activate(name)", -> - it "activates a theme by name", -> - spyOn theme, 'activate' - TextMateTheme.activate('Twilight') - expect(theme.activate).toHaveBeenCalled() - - describe ".activate()", -> - it "applies the theme's stylesheet to the current window", -> - spyOn window, 'applyStylesheet' - theme.activate() - expect(window.applyStylesheet).toHaveBeenCalledWith(theme.name, theme.getStylesheet()) - - describe ".getRulesets()", -> - rulesets = null - - beforeEach -> - rulesets = theme.getRulesets() - - it "returns rulesets representing the theme's global style settings", -> - expect(rulesets[0]).toEqual - selector: '.editor' - properties: - 'background-color': '#141414' - 'color': '#F8F8F8' - - expect(rulesets[1]).toEqual - selector: '.editor.focused .cursor' - properties: - 'border-color': '#A7A7A7' - - expect(rulesets[2]).toEqual - selector: '.editor.focused .selection' - properties: - 'background-color': "rgba(221, 240, 255, 51)" - - it "returns an array of objects representing the theme's scope selectors", -> - expect(rulesets[11]).toEqual - comment: "Invalid – Deprecated" - selector: ".invalid-deprecated" - properties: - 'color': "#D2A8A1" - # 'font-style': 'italic' - 'text-decoration': 'underline' - - expect(rulesets[12]).toEqual - comment: "Invalid – Illegal" - selector: ".invalid-illegal" - properties: - 'color': "#F8F8F8" - 'background-color': 'rgba(86, 45, 86, 191)' diff --git a/spec/app/token-spec.coffee b/spec/app/token-spec.coffee deleted file mode 100644 index 7685522ea..000000000 --- a/spec/app/token-spec.coffee +++ /dev/null @@ -1,20 +0,0 @@ -_ = require 'underscore' -Buffer = require 'buffer' -TokenizedBuffer = require 'tokenized-buffer' - -describe "Token", -> - [editSession, token] = [] - - beforeEach -> - tabText = ' ' - editSession = fixturesProject.buildEditSessionForPath('sample.js') - { tokenizedBuffer } = editSession - screenLine = tokenizedBuffer.lineForScreenRow(3) - token = _.last(screenLine.tokens) - - afterEach -> - editSession.destroy() - - describe ".getCssClassString()", -> - it "returns a class for every scope prefix, replacing . characters in scope names with --", -> - expect(token.getCssClassString()).toBe 'source source-js punctuation punctuation-terminator punctuation-terminator-statement punctuation-terminator-statement-js' diff --git a/spec/app/tokenized-buffer-spec.coffee b/spec/app/tokenized-buffer-spec.coffee deleted file mode 100644 index 8eec05c09..000000000 --- a/spec/app/tokenized-buffer-spec.coffee +++ /dev/null @@ -1,175 +0,0 @@ -TokenizedBuffer = require 'tokenized-buffer' -LanguageMode = require 'language-mode' -Buffer = require 'buffer' -Range = require 'range' - -describe "TokenizedBuffer", -> - [editSession, tokenizedBuffer, buffer] = [] - - beforeEach -> - editSession = fixturesProject.buildEditSessionForPath('sample.js', autoIndent: false) - { tokenizedBuffer, buffer } = editSession - - afterEach -> - editSession.destroy() - - describe ".findOpeningBracket(closingBufferPosition)", -> - it "returns the position of the matching bracket, skipping any nested brackets", -> - expect(tokenizedBuffer.findOpeningBracket([9, 2])).toEqual [1, 29] - - describe ".findClosingBracket(startBufferPosition)", -> - it "returns the position of the matching bracket, skipping any nested brackets", -> - expect(tokenizedBuffer.findClosingBracket([1, 29])).toEqual [9, 2] - - describe "tokenization", -> - it "tokenizes all the lines in the buffer on construction", -> - expect(tokenizedBuffer.lineForScreenRow(0).tokens[0]).toEqual(value: 'var', scopes: ['source.js', 'storage.type.js']) - expect(tokenizedBuffer.lineForScreenRow(11).tokens[1]).toEqual(value: 'return', scopes: ['source.js', 'keyword.control.js']) - - describe "when the buffer changes", -> - changeHandler = null - - beforeEach -> - changeHandler = jasmine.createSpy('changeHandler') - tokenizedBuffer.on "change", changeHandler - - describe "when lines are updated, but none are added or removed", -> - it "updates tokens for each of the changed lines", -> - range = new Range([0, 0], [2, 0]) - buffer.change(range, "foo()\n7\n") - - expect(tokenizedBuffer.lineForScreenRow(0).tokens[1]).toEqual(value: '(', scopes: ['source.js', 'meta.brace.round.js']) - expect(tokenizedBuffer.lineForScreenRow(1).tokens[0]).toEqual(value: '7', scopes: ['source.js', 'constant.numeric.js']) - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - - expect(event.oldRange).toEqual range - expect(event.newRange).toEqual new Range([0, 0], [2,0]) - - # line 2 is unchanged - expect(tokenizedBuffer.lineForScreenRow(2).tokens[1]).toEqual(value: 'if', scopes: ['source.js', 'keyword.control.js']) - - it "updates tokens for lines beyond the changed lines if needed", -> - buffer.insert([5, 30], '/* */') - changeHandler.reset() - - buffer.insert([2, 0], '/*') - expect(tokenizedBuffer.lineForScreenRow(3).tokens[0].scopes).toEqual ['source.js', 'comment.block.js'] - expect(tokenizedBuffer.lineForScreenRow(4).tokens[0].scopes).toEqual ['source.js', 'comment.block.js'] - expect(tokenizedBuffer.lineForScreenRow(5).tokens[0].scopes).toEqual ['source.js', 'comment.block.js'] - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual new Range([2, 0], [5, buffer.lineForRow(5).length]) - expect(event.newRange).toEqual new Range([2, 0], [5, buffer.lineForRow(5).length]) - - it "resumes highlighting with the state of the previous line", -> - buffer.insert([0, 0], '/*') - buffer.insert([5, 0], '*/') - - buffer.insert([1, 0], 'var ') - expect(tokenizedBuffer.lineForScreenRow(1).tokens[0].scopes).toEqual ['source.js', 'comment.block.js'] - - describe "when lines are both updated and removed", -> - it "updates tokens to reflect the removed lines", -> - range = new Range([1, 0], [3, 0]) - buffer.change(range, "foo()") - - # previous line 0 remains - expect(tokenizedBuffer.lineForScreenRow(0).tokens[0]).toEqual(value: 'var', scopes: ['source.js', 'storage.type.js']) - - # previous line 3 should be combined with input to form line 1 - expect(tokenizedBuffer.lineForScreenRow(1).tokens[0]).toEqual(value: 'foo', scopes: ['source.js']) - expect(tokenizedBuffer.lineForScreenRow(1).tokens[6]).toEqual(value: '=', scopes: ['source.js', 'keyword.operator.js']) - - # lines below deleted regions should be shifted upward - expect(tokenizedBuffer.lineForScreenRow(2).tokens[1]).toEqual(value: 'while', scopes: ['source.js', 'keyword.control.js']) - expect(tokenizedBuffer.lineForScreenRow(3).tokens[1]).toEqual(value: '=', scopes: ['source.js', 'keyword.operator.js']) - expect(tokenizedBuffer.lineForScreenRow(4).tokens[1]).toEqual(value: '<', scopes: ['source.js', 'keyword.operator.js']) - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual range - expect(event.newRange).toEqual new Range([1, 0], [1, 5]) - - it "updates tokens for lines beyond the changed lines if needed", -> - buffer.insert([5, 30], '/* */') - changeHandler.reset() - - buffer.change(new Range([2, 0], [3, 0]), '/*') - expect(tokenizedBuffer.lineForScreenRow(2).tokens[0].scopes).toEqual ['source.js', 'comment.block.js', 'punctuation.definition.comment.js'] - expect(tokenizedBuffer.lineForScreenRow(3).tokens[0].scopes).toEqual ['source.js', 'comment.block.js'] - expect(tokenizedBuffer.lineForScreenRow(4).tokens[0].scopes).toEqual ['source.js', 'comment.block.js'] - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual new Range([2, 0], [5, buffer.lineForRow(4).length]) - expect(event.newRange).toEqual new Range([2, 0], [4, buffer.lineForRow(4).length]) - - describe "when lines are both updated and inserted", -> - it "updates tokens to reflect the inserted lines", -> - range = new Range([1, 0], [2, 0]) - buffer.change(range, "foo()\nbar()\nbaz()\nquux()") - - # previous line 0 remains - expect(tokenizedBuffer.lineForScreenRow(0).tokens[0]).toEqual( value: 'var', scopes: ['source.js', 'storage.type.js']) - - # 3 new lines inserted - expect(tokenizedBuffer.lineForScreenRow(1).tokens[0]).toEqual(value: 'foo', scopes: ['source.js']) - expect(tokenizedBuffer.lineForScreenRow(2).tokens[0]).toEqual(value: 'bar', scopes: ['source.js']) - expect(tokenizedBuffer.lineForScreenRow(3).tokens[0]).toEqual(value: 'baz', scopes: ['source.js']) - - # previous line 2 is joined with quux() on line 4 - expect(tokenizedBuffer.lineForScreenRow(4).tokens[0]).toEqual(value: 'quux', scopes: ['source.js']) - expect(tokenizedBuffer.lineForScreenRow(4).tokens[4]).toEqual(value: 'if', scopes: ['source.js', 'keyword.control.js']) - - # previous line 3 is pushed down to become line 5 - expect(tokenizedBuffer.lineForScreenRow(5).tokens[3]).toEqual(value: '=', scopes: ['source.js', 'keyword.operator.js']) - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual range - expect(event.newRange).toEqual new Range([1, 0], [4, 6]) - - it "updates tokens for lines beyond the changed lines if needed", -> - buffer.insert([5, 30], '/* */') - changeHandler.reset() - - buffer.insert([2, 0], '/*\nabcde\nabcder') - expect(tokenizedBuffer.lineForScreenRow(2).tokens[0].scopes).toEqual ['source.js', 'comment.block.js', 'punctuation.definition.comment.js'] - expect(tokenizedBuffer.lineForScreenRow(3).tokens[0].scopes).toEqual ['source.js', 'comment.block.js'] - expect(tokenizedBuffer.lineForScreenRow(4).tokens[0].scopes).toEqual ['source.js', 'comment.block.js'] - expect(tokenizedBuffer.lineForScreenRow(5).tokens[0].scopes).toEqual ['source.js', 'comment.block.js'] - expect(tokenizedBuffer.lineForScreenRow(6).tokens[0].scopes).toEqual ['source.js', 'comment.block.js'] - expect(tokenizedBuffer.lineForScreenRow(7).tokens[0].scopes).toEqual ['source.js', 'comment.block.js'] - expect(tokenizedBuffer.lineForScreenRow(8).tokens[0].scopes).not.toBe ['source.js', 'comment.block.js'] - - expect(changeHandler).toHaveBeenCalled() - [event] = changeHandler.argsForCall[0] - expect(event.oldRange).toEqual new Range([2, 0], [5, buffer.lineForRow(7).length]) - expect(event.newRange).toEqual new Range([2, 0], [7, buffer.lineForRow(7).length]) - - describe "when the buffer contains tab characters", -> - tabText = ' ' - editSession2 = null - - beforeEach -> - editSession2 = fixturesProject.buildEditSessionForPath('sample-with-tabs.coffee', { tabText }) - { buffer, tokenizedBuffer } = editSession2 - - afterEach -> - editSession2.destroy() - - it "always renders each tab as its own atomic token containing tabText", -> - screenLine0 = tokenizedBuffer.lineForScreenRow(0) - expect(screenLine0.text).toBe "# Econ 101#{tabText}" - { tokens } = screenLine0 - expect(tokens.length).toBe 3 - expect(tokens[0].value).toBe "#" - expect(tokens[1].value).toBe " Econ 101" - expect(tokens[2].value).toBe tabText - expect(tokens[2].scopes).toEqual tokens[1].scopes - expect(tokens[2].isAtomic).toBeTruthy() - - expect(tokenizedBuffer.lineForScreenRow(2).text).toBe "#{tabText} buy()#{tabText}while supply > demand" diff --git a/spec/app/undo-manager-spec.coffee b/spec/app/undo-manager-spec.coffee deleted file mode 100644 index 307412a74..000000000 --- a/spec/app/undo-manager-spec.coffee +++ /dev/null @@ -1,100 +0,0 @@ -UndoManager = require 'undo-manager' -Buffer = require 'buffer' -Range = require 'range' - -describe "UndoManager", -> - [buffer, undoManager] = [] - - beforeEach -> - buffer = new Buffer(require.resolve('fixtures/sample.js')) - undoManager = buffer.undoManager - - afterEach -> - buffer.destroy() - - describe ".undo()", -> - it "undoes the last change", -> - buffer.change(new Range([0, 5], [0, 9]), '') - buffer.insert([0, 6], 'h') - buffer.insert([0, 10], 'y') - expect(buffer.lineForRow(0)).toContain 'qshorty' - - undoManager.undo() - expect(buffer.lineForRow(0)).toContain 'qshort' - expect(buffer.lineForRow(0)).not.toContain 'qshorty' - - undoManager.undo() - expect(buffer.lineForRow(0)).toContain 'qsort' - - undoManager.undo() - expect(buffer.lineForRow(0)).toContain 'quicksort' - - it "does not throw an exception when there is nothing to undo", -> - undoManager.undo() - - describe ".redo()", -> - beforeEach -> - buffer.change(new Range([0, 5], [0, 9]), '') - buffer.insert([0, 6], 'h') - buffer.insert([0, 10], 'y') - undoManager.undo() - undoManager.undo() - expect(buffer.lineForRow(0)).toContain 'qsort' - - it "redoes the last undone change", -> - undoManager.redo() - expect(buffer.lineForRow(0)).toContain 'qshort' - - undoManager.redo() - expect(buffer.lineForRow(0)).toContain 'qshorty' - - undoManager.undo() - expect(buffer.lineForRow(0)).toContain 'qshort' - - it "does not throw an exception when there is nothing to redo", -> - undoManager.redo() - undoManager.redo() - undoManager.redo() - - it "discards the redo history when there is a new change following an undo", -> - buffer.insert([0, 6], 'p') - expect(buffer.getText()).toContain 'qsport' - - undoManager.redo() - expect(buffer.getText()).toContain 'qsport' - - describe "transact(fn)", -> - it "causes changes in the transaction to be undone simultaneously", -> - buffer.insert([0, 0], "foo") - - undoManager.transact -> - undoManager.transact -> - buffer.insert([1, 2], "111") - buffer.insert([1, 9], "222") - - expect(buffer.lineForRow(1)).toBe ' 111var 222sort = function(items) {' - - undoManager.undo() - expect(buffer.lineForRow(1)).toBe ' var sort = function(items) {' - expect(buffer.lineForRow(0)).toContain 'foo' - - undoManager.undo() - - expect(buffer.lineForRow(0)).not.toContain 'foo' - - undoManager.redo() - expect(buffer.lineForRow(0)).toContain 'foo' - - undoManager.redo() - expect(buffer.lineForRow(1)).toBe ' 111var 222sort = function(items) {' - - undoManager.undo() - expect(buffer.lineForRow(1)).toBe ' var sort = function(items) {' - - it "does not record empty transactions", -> - buffer.insert([0,0], "foo") - undoManager.transact -> - - undoManager.undo() - expect(buffer.lineForRow(0)).not.toContain("foo") - diff --git a/spec/app/window-spec.coffee b/spec/app/window-spec.coffee deleted file mode 100644 index baa14f409..000000000 --- a/spec/app/window-spec.coffee +++ /dev/null @@ -1,64 +0,0 @@ -$ = require 'jquery' -fs = require 'fs' - -describe "Window", -> - beforeEach -> - window.startup() - - afterEach -> - window.shutdown() - delete atom.rootViewStates[$windowNumber] - $(window).off 'beforeunload' - - describe ".close()", -> - it "is triggered by the 'close' event", -> - spyOn window, 'close' - $(window).trigger 'close' - expect(window.close).toHaveBeenCalled() - - describe ".reload()", -> - it "returns false when no buffers are modified", -> - spyOn($native, "reload") - window.reload() - expect($native.reload).toHaveBeenCalled() - - it "shows alert when a modifed buffer exists", -> - rootView.getActiveEditor().insertText("hi") - spyOn($native, "alert") - spyOn($native, "reload") - window.reload() - expect($native.reload).not.toHaveBeenCalled() - expect($native.alert).toHaveBeenCalled() - - describe "requireStylesheet(path)", -> - it "synchronously loads the stylesheet at the given path and installs a style tag for it in the head", -> - $('head style[id*="atom.css"]').remove() - lengthBefore = $('head style').length - requireStylesheet('atom.css') - expect($('head style').length).toBe lengthBefore + 1 - - styleElt = $('head style[id*="atom.css"]') - - fullPath = require.resolve('atom.css') - expect(styleElt.attr('id')).toBe fullPath - expect(styleElt.text()).toBe fs.read(fullPath) - - # doesn't append twice - requireStylesheet('atom.css') - expect($('head style').length).toBe lengthBefore + 1 - - describe "before the window is unloaded", -> - it "saves the serialized state of the root view to the atom object so it can be rehydrated after reload", -> - expect(atom.rootViewStates[$windowNumber]).toBeUndefined() - expectedState = window.rootView.serialize() - $(window).trigger 'beforeunload' - expect(atom.rootViewStates[$windowNumber]).toEqual JSON.stringify(expectedState) - - it "unsubscribes from all buffers", -> - editor1 = rootView.getActiveEditor() - editor2 = editor1.splitRight() - expect(window.rootView.getEditors().length).toBe 2 - - $(window).trigger 'beforeunload' - - expect(editor1.getBuffer().subscriptionCount()).toBe 0 diff --git a/spec/extensions/autocomplete-spec.coffee b/spec/extensions/autocomplete-spec.coffee deleted file mode 100644 index 442390f47..000000000 --- a/spec/extensions/autocomplete-spec.coffee +++ /dev/null @@ -1,430 +0,0 @@ -$ = require 'jquery' -Autocomplete = require 'autocomplete' -Buffer = require 'buffer' -Editor = require 'editor' -RootView = require 'root-view' - -describe "Autocomplete", -> - autocomplete = null - editor = null - miniEditor = null - - beforeEach -> - editor = new Editor(editSession: fixturesProject.buildEditSessionForPath('sample.js')) - autocomplete = new Autocomplete(editor) - miniEditor = autocomplete.miniEditor - - afterEach -> - editor?.remove() - - describe "@activate(rootView)", -> - it "activates autocomplete on all existing and future editors (but not on autocomplete's own mini editor)", -> - rootView = new RootView(require.resolve('fixtures/sample.js')) - rootView.simulateDomAttachment() - Autocomplete.activate(rootView) - leftEditor = rootView.getActiveEditor() - rightEditor = rootView.getActiveEditor().splitRight() - - spyOn(Autocomplete.prototype, 'initialize') - - leftEditor.trigger 'autocomplete:attach' - expect(leftEditor.find('.autocomplete')).toExist() - expect(rightEditor.find('.autocomplete')).not.toExist() - - leftEditor.trigger 'autocomplete:cancel' - rightEditor.trigger 'autocomplete:attach' - expect(leftEditor.find('.autocomplete')).not.toExist() - expect(rightEditor.find('.autocomplete')).toExist() - - expect(Autocomplete.prototype.initialize).not.toHaveBeenCalled() - - rootView.deactivate() - - describe 'autocomplete:attach event', -> - it "shows autocomplete view and focuses its mini-editor", -> - expect(editor.find('.autocomplete')).not.toExist() - - editor.trigger "autocomplete:attach" - expect(editor.find('.autocomplete')).toExist() - expect(autocomplete.editor.isFocused).toBeFalsy() - expect(autocomplete.miniEditor.isFocused).toBeTruthy() - - describe "when no text is selected", -> - it 'autocompletes word when there is only a prefix', -> - editor.getBuffer().insert([10,0] ,"extra:s:extra") - editor.setCursorBufferPosition([10,7]) - autocomplete.attach() - - expect(editor.lineForBufferRow(10)).toBe "extra:sort:extra" - expect(editor.getCursorBufferPosition()).toEqual [10,10] - expect(editor.getSelection().getBufferRange()).toEqual [[10,7], [10,10]] - - expect(autocomplete.matchesList.find('li').length).toBe 2 - expect(autocomplete.matchesList.find('li:eq(0)')).toHaveText('sort') - expect(autocomplete.matchesList.find('li:eq(1)')).toHaveText('shift') - - it 'autocompletes word when there is only a suffix', -> - editor.getBuffer().insert([10,0] ,"extra:e:extra") - editor.setCursorBufferPosition([10,6]) - autocomplete.attach() - - expect(editor.lineForBufferRow(10)).toBe "extra:while:extra" - expect(editor.getCursorBufferPosition()).toEqual [10,10] - expect(editor.getSelection().getBufferRange()).toEqual [[10,6], [10,10]] - - expect(autocomplete.matchesList.find('li').length).toBe 1 - expect(autocomplete.matchesList.find('li:eq(0)')).toHaveText('while') - - it 'autocompletes word when there is a prefix and suffix', -> - editor.getBuffer().insert([8,43] ,"q") - editor.setCursorBufferPosition([8,44]) - autocomplete.attach() - - expect(editor.lineForBufferRow(8)).toBe " return sort(left).concat(pivot).concat(quicksort(right));" - expect(editor.getCursorBufferPosition()).toEqual [8,48] - expect(editor.getSelection().getBufferRange()).toEqual [[8,44], [8,48]] - - expect(autocomplete.matchesList.find('li').length).toBe 1 - expect(autocomplete.matchesList.find('li:eq(0)')).toHaveText('quicksort') - - it "show's that there are no matches found when there is no prefix or suffix", -> - editor.setCursorBufferPosition([10, 0]) - autocomplete.attach() - - expect(autocomplete.matchesList.find('li').length).toBe 1 - expect(autocomplete.matchesList.find('li:eq(0)')).toHaveText "No matches found" - - describe "when text is selected", -> - it 'autocompletes word when there is only a prefix', -> - editor.getBuffer().insert([10,0] ,"extra:sort:extra") - editor.setSelectedBufferRange [[10,7], [10,10]] - autocomplete.attach() - - expect(editor.lineForBufferRow(10)).toBe "extra:shift:extra" - expect(editor.getCursorBufferPosition()).toEqual [10,11] - expect(editor.getSelection().getBufferRange()).toEqual [[10,7],[10,11]] - - expect(autocomplete.matchesList.find('li').length).toBe 1 - expect(autocomplete.matchesList.find('li:eq(0)')).toHaveText('shift') - - it 'autocompletes word when there is only a suffix', -> - editor.getBuffer().insert([10,0] ,"extra:current:extra") - editor.setSelectedBufferRange [[10,6],[10,12]] - autocomplete.attach() - - expect(editor.lineForBufferRow(10)).toBe "extra:quicksort:extra" - expect(editor.getCursorBufferPosition()).toEqual [10,14] - expect(editor.getSelection().getBufferRange()).toEqual [[10,6],[10,14]] - - expect(autocomplete.matchesList.find('li').length).toBe 7 - expect(autocomplete.matchesList.find('li:contains(current)')).not.toExist() - - it 'autocompletes word when there is a prefix and suffix', -> - editor.setSelectedBufferRange [[5,7],[5,12]] - autocomplete.attach() - - expect(editor.lineForBufferRow(5)).toBe " concat = items.shift();" - expect(editor.getCursorBufferPosition()).toEqual [5,11] - expect(editor.getSelection().getBufferRange()).toEqual [[5,7], [5,11]] - - expect(autocomplete.matchesList.find('li').length).toBe 1 - expect(autocomplete.matchesList.find('li:eq(0)')).toHaveText('concat') - - describe 'autocomplete:confirm event', -> - it 'replaces selection with selected match, moves the cursor to the end of the match, and removes the autocomplete menu', -> - editor.getBuffer().insert([10,0] ,"extra:sort:extra") - editor.setSelectedBufferRange [[10,7], [10,9]] - autocomplete.attach() - miniEditor.trigger "autocomplete:confirm" - - expect(editor.lineForBufferRow(10)).toBe "extra:shift:extra" - expect(editor.getCursorBufferPosition()).toEqual [10,11] - expect(editor.getSelection().isEmpty()).toBeTruthy() - expect(editor.find('.autocomplete')).not.toExist() - - describe "when there are no matches", -> - it "closes the menu without changing the buffer", -> - editor.getBuffer().insert([10,0] ,"xxx") - editor.setCursorBufferPosition [10, 3] - autocomplete.attach() - expect(autocomplete.matchesList.find('li').length).toBe 1 - expect(autocomplete.matchesList.find('li')).toHaveText ('No matches found') - - miniEditor.trigger "autocomplete:confirm" - - expect(editor.lineForBufferRow(10)).toBe "xxx" - expect(editor.getCursorBufferPosition()).toEqual [10,3] - expect(editor.getSelection().isEmpty()).toBeTruthy() - expect(editor.find('.autocomplete')).not.toExist() - - describe 'autocomplete:cancel event', -> - it 'does not replace selection, removes autocomplete view and returns focus to editor', -> - editor.getBuffer().insert([10,0] ,"extra:so:extra") - editor.setSelectedBufferRange [[10,7], [10,8]] - originalSelectionBufferRange = editor.getSelection().getBufferRange() - - autocomplete.attach() - editor.setCursorBufferPosition [0, 0] # even if selection changes before cancel, it should work - miniEditor.trigger "autocomplete:cancel" - - expect(editor.lineForBufferRow(10)).toBe "extra:so:extra" - expect(editor.getSelection().getBufferRange()).toEqual originalSelectionBufferRange - expect(editor.find('.autocomplete')).not.toExist() - - it "does not clear out a previously confirmed selection when canceling with an empty list", -> - editor.getBuffer().insert([10, 0], "sort\n") - editor.setCursorBufferPosition([10, 0]) - - autocomplete.attach() - miniEditor.trigger 'autocomplete:confirm' - expect(editor.lineForBufferRow(10)).toBe 'quicksort' - - editor.setCursorBufferPosition([11, 0]) - autocomplete.attach() - miniEditor.trigger 'autocomplete:cancel' - expect(editor.lineForBufferRow(10)).toBe 'quicksort' - - describe 'move-up event', -> - it "highlights the previous match and replaces the selection with it", -> - editor.getBuffer().insert([10,0] ,"extra:t:extra") - editor.setCursorBufferPosition([10,6]) - autocomplete.attach() - - miniEditor.trigger "move-up" - expect(editor.lineForBufferRow(10)).toBe "extra:concat:extra" - expect(autocomplete.find('li:eq(0)')).not.toHaveClass('selected') - expect(autocomplete.find('li:eq(1)')).not.toHaveClass('selected') - expect(autocomplete.find('li:eq(7)')).toHaveClass('selected') - - miniEditor.trigger "move-up" - expect(editor.lineForBufferRow(10)).toBe "extra:right:extra" - expect(autocomplete.find('li:eq(0)')).not.toHaveClass('selected') - expect(autocomplete.find('li:eq(7)')).not.toHaveClass('selected') - expect(autocomplete.find('li:eq(6)')).toHaveClass('selected') - - it "scrolls to the selected match if it is out of view", -> - editor.getBuffer().insert([10,0] ,"t") - editor.setCursorBufferPosition([10, 0]) - editor.attachToDom() - autocomplete.attach() - - matchesList = autocomplete.matchesList - matchesList.height(100) - expect(matchesList.height()).toBeLessThan matchesList[0].scrollHeight - - matchCount = matchesList.find('li').length - miniEditor.trigger 'move-up' - expect(matchesList.scrollBottom()).toBe matchesList[0].scrollHeight - - miniEditor.trigger 'move-up' for i in [1...matchCount] - expect(matchesList.scrollTop()).toBe 0 - - describe 'move-down event', -> - it "highlights the next match and replaces the selection with it", -> - editor.getBuffer().insert([10,0] ,"extra:s:extra") - editor.setCursorBufferPosition([10,7]) - autocomplete.attach() - - miniEditor.trigger "move-down" - expect(editor.lineForBufferRow(10)).toBe "extra:shift:extra" - expect(autocomplete.find('li:eq(0)')).not.toHaveClass('selected') - expect(autocomplete.find('li:eq(1)')).toHaveClass('selected') - - miniEditor.trigger "move-down" - expect(editor.lineForBufferRow(10)).toBe "extra:sort:extra" - expect(autocomplete.find('li:eq(0)')).toHaveClass('selected') - expect(autocomplete.find('li:eq(1)')).not.toHaveClass('selected') - - it "scrolls to the selected match if it is out of view", -> - editor.getBuffer().insert([10,0] ,"t") - editor.setCursorBufferPosition([10, 0]) - editor.attachToDom() - autocomplete.attach() - - matchesList = autocomplete.matchesList - matchesList.height(100) - expect(matchesList.height()).toBeLessThan matchesList[0].scrollHeight - - matchCount = matchesList.find('li').length - miniEditor.trigger 'move-down' for i in [1...matchCount] - expect(matchesList.scrollBottom()).toBe matchesList[0].scrollHeight - - miniEditor.trigger 'move-down' - expect(matchesList.scrollTop()).toBe 0 - - describe "when a match is clicked in the match list", -> - it "selects and confirms the match", -> - editor.getBuffer().insert([10,0] ,"t") - editor.setCursorBufferPosition([10, 0]) - autocomplete.attach() - - matchToSelect = autocomplete.matchesList.find('li:eq(1)') - matchToSelect.mousedown() - expect(matchToSelect).toMatchSelector('.selected') - matchToSelect.mouseup() - - expect(autocomplete.parent()).not.toExist() - expect(editor.lineForBufferRow(10)).toBe matchToSelect.text() - - it "cancels the autocomplete when clicking on the 'No matches found' li", -> - editor.getBuffer().insert([10,0] ,"t") - editor.setCursorBufferPosition([10, 0]) - autocomplete.attach() - - miniEditor.insertText('xxx') - autocomplete.matchesList.find('li').mousedown().mouseup() - - expect(autocomplete.parent()).not.toExist() - expect(editor.lineForBufferRow(10)).toBe "t" - - describe "when the mini-editor receives keyboard input", -> - describe "when text is removed from the mini-editor", -> - it "reloads the match list based on the mini-editor's text", -> - editor.getBuffer().insert([10,0] ,"t") - editor.setCursorBufferPosition([10,0]) - autocomplete.attach() - - expect(autocomplete.matchesList.find('li').length).toBe 8 - miniEditor.textInput('c') - expect(autocomplete.matchesList.find('li').length).toBe 3 - miniEditor.backspace() - expect(autocomplete.matchesList.find('li').length).toBe 8 - - describe "when the text contains only word characters", -> - it "narrows the list of completions with the fuzzy match algorithm", -> - editor.getBuffer().insert([10,0] ,"t") - editor.setCursorBufferPosition([10,0]) - autocomplete.attach() - - expect(autocomplete.matchesList.find('li').length).toBe 8 - miniEditor.textInput('i') - expect(autocomplete.matchesList.find('li').length).toBe 4 - expect(autocomplete.matchesList.find('li:eq(0)')).toHaveText 'pivot' - expect(autocomplete.matchesList.find('li:eq(0)')).toHaveClass 'selected' - expect(autocomplete.matchesList.find('li:eq(1)')).toHaveText 'shift' - expect(autocomplete.matchesList.find('li:eq(2)')).toHaveText 'right' - expect(autocomplete.matchesList.find('li:eq(3)')).toHaveText 'quicksort' - expect(editor.lineForBufferRow(10)).toEqual 'pivot' - - miniEditor.textInput('o') - expect(autocomplete.matchesList.find('li').length).toBe 2 - expect(autocomplete.matchesList.find('li:eq(0)')).toHaveText 'pivot' - expect(autocomplete.matchesList.find('li:eq(1)')).toHaveText 'quicksort' - - describe "when a non-word character is typed in the mini-editor", -> - it "immediately confirms the current completion choice and inserts that character into the buffer", -> - editor.getBuffer().insert([10,0] ,"t") - editor.setCursorBufferPosition([10,0]) - autocomplete.attach() - - miniEditor.textInput('iv') - expect(autocomplete.matchesList.find('li:eq(0)')).toHaveText 'pivot' - - miniEditor.textInput(' ') - expect(autocomplete.parent()).not.toExist() - expect(editor.lineForBufferRow(10)).toEqual 'pivot ' - - describe 'when the mini-editor loses focus before the selection is confirmed', -> - it "cancels the autocomplete", -> - editor.attachToDom() - autocomplete.attach() - spyOn(autocomplete, "cancel") - - editor.focus() - - expect(autocomplete.cancel).toHaveBeenCalled() - - describe 'when changes are made to the buffer', -> - describe "when the autocomplete menu is detached", -> - it 'updates word list', -> - spyOn(autocomplete, 'buildWordList') - editor.getBuffer().change([[0,4],[0,13]], "sauron") - expect(autocomplete.buildWordList).toHaveBeenCalled() - - describe "when the autocomplete menu is attached and the change was caused by autocomplete itself", -> - it 'does not rebuild the word list', -> - editor.getBuffer().insert([10,0] ,"extra:s:extra") - - spyOn(autocomplete, 'buildWordList') - editor.setCursorBufferPosition([10,7]) - autocomplete.attach() - expect(autocomplete.buildWordList).not.toHaveBeenCalled() - - describe "when a new edit session is assigned on editor", -> - it 'creates and uses a new word list based on new buffer', -> - wordList = autocomplete.wordList - expect(wordList).toContain "quicksort" - expect(wordList).not.toContain "Some" - - editor.edit(fixturesProject.buildEditSessionForPath('sample.txt')) - - wordList = autocomplete.wordList - expect(wordList).not.toContain "quicksort" - expect(wordList).toContain "Some" - - it 'stops listening to previous buffers change events', -> - previousBuffer = editor.getBuffer() - editor.edit(fixturesProject.buildEditSessionForPath('sample.txt')) - spyOn(autocomplete, "buildWordList") - - previousBuffer.change([[0,0],[0,1]], "sauron") - - expect(autocomplete.buildWordList).not.toHaveBeenCalled() - - describe 'when the editor is removed', -> - it 'removes event listeners from its buffer', -> - spyOn(autocomplete, 'buildWordList').andCallThrough() - editor.getBuffer().insert([0,0], "s") - expect(autocomplete.buildWordList).toHaveBeenCalled() - - autocomplete.buildWordList.reset() - editor.remove() - editor.getBuffer().insert([0,0], "s") - expect(autocomplete.buildWordList).not.toHaveBeenCalled() - editor = null - - describe ".attach()", -> - beforeEach -> - editor.attachToDom() - setEditorHeightInLines(editor, 13) - editor.renderLines() # Ensures the editor only has 13 lines visible - - editor.setCursorBufferPosition [1, 1] - - describe "when the autocomplete view fits below the cursor", -> - it "adds the autocomplete view to the editor below the cursor", -> - cursorPixelPosition = editor.pixelPositionForScreenPosition(editor.getCursorScreenPosition()) - autocomplete.attach() - expect(editor.find('.autocomplete')).toExist() - - expect(autocomplete.position().top).toBe cursorPixelPosition.top + editor.lineHeight - expect(autocomplete.position().left).toBe cursorPixelPosition.left - - describe "when the autocomplete view does not fit below the cursor", -> - it "adds the autocomplete view to the editor above the cursor", -> - editor.setCursorScreenPosition([11, 0]) - editor.insertText('t ') - editor.setCursorScreenPosition([11, 0]) - cursorPixelPosition = editor.pixelPositionForScreenPosition(editor.getCursorScreenPosition()) - autocomplete.attach() - - expect(autocomplete.parent()).toExist() - autocompleteBottom = autocomplete.position().top + autocomplete.outerHeight() - expect(autocompleteBottom).toBe cursorPixelPosition.top - expect(autocomplete.position().left).toBe cursorPixelPosition.left - - describe ".detach()", -> - it "clears the mini-editor and unbinds autocomplete event handlers for move-up and move-down", -> - autocomplete.attach() - miniEditor.setText('foo') - - autocomplete.detach() - expect(miniEditor.getText()).toBe '' - - editor.trigger 'move-down' - expect(editor.getCursorBufferPosition().row).toBe 1 - - editor.trigger 'move-up' - expect(editor.getCursorBufferPosition().row).toBe 0 - - diff --git a/spec/extensions/command-interpreter-spec.coffee b/spec/extensions/command-interpreter-spec.coffee deleted file mode 100644 index 0fea210c7..000000000 --- a/spec/extensions/command-interpreter-spec.coffee +++ /dev/null @@ -1,351 +0,0 @@ -CommandInterpreter = require 'command-panel/command-interpreter' -Project = require 'project' -Buffer = require 'buffer' -EditSession = require 'edit-session' - -describe "CommandInterpreter", -> - [project, interpreter, editSession, buffer, anchorCountBefore] = [] - - beforeEach -> - project = new Project(fixturesProject.resolve('dir/')) - interpreter = new CommandInterpreter(fixturesProject) - editSession = fixturesProject.buildEditSessionForPath('sample.js') - buffer = editSession.buffer - - afterEach -> - editSession?.destroy() - expect(buffer.getAnchors().length).toBe 0 - - describe "addresses", -> - beforeEach -> - editSession.addSelectionForBufferRange([[7,0], [7,11]]) - editSession.addSelectionForBufferRange([[8,0], [8,11]]) - - describe "a line address", -> - it "selects the specified line", -> - waitsForPromise -> interpreter.eval('4', editSession) - runs -> - expect(editSession.getSelections().length).toBe 1 - expect(editSession.getSelection().getBufferRange()).toEqual [[3, 0], [4, 0]] - - describe "0", -> - it "selects the zero-length string at the start of the file", -> - waitsForPromise -> interpreter.eval('0', editSession) - runs -> - expect(editSession.getSelections().length).toBe 1 - expect(editSession.getSelection().getBufferRange()).toEqual [[0,0], [0,0]] - - interpreter.eval('0,1', editSession) - expect(editSession.getSelections().length).toBe 1 - expect(editSession.getSelection().getBufferRange()).toEqual [[0,0], [1,0]] - - describe "$", -> - it "selects EOF", -> - waitsForPromise -> interpreter.eval('$', editSession) - runs -> - expect(editSession.getSelections().length).toBe 1 - expect(editSession.getSelection().getBufferRange()).toEqual [[12,2], [12,2]] - - waitsForPromise -> interpreter.eval('1,$', editSession) - runs -> - expect(editSession.getSelections().length).toBe 1 - expect(editSession.getSelection().getBufferRange()).toEqual [[0,0], [12,2]] - - describe ".", -> - describe "when a single selection", -> - it 'maintains the current selection', -> - editSession.clearSelections() - - waitsForPromise -> - editSession.setSelectedBufferRange([[1,1], [2,2]]) - interpreter.eval('.', editSession) - - runs -> - expect(editSession.getSelection().getBufferRange()).toEqual [[1,1], [2,2]] - - waitsForPromise -> - editSession.setSelectedBufferRange([[1,1], [2,2]]) - interpreter.eval('.,', editSession) - - runs -> - expect(editSession.getSelection().getBufferRange()).toEqual [[1,1], [12,2]] - - waitsForPromise -> - editSession.setSelectedBufferRange([[1,1], [2,2]]) - interpreter.eval(',.', editSession) - - runs -> - expect(editSession.getSelection().getBufferRange()).toEqual [[0,0], [2,2]] - - describe "with multiple selections", -> - it "maintains the current selections", -> - preSelections = editSession.getSelections() - expect(preSelections.length).toBe 3 - [preRange1, preRange2, preRange3] = preSelections.map (s) -> s.getScreenRange() - - waitsForPromise -> interpreter.eval('.', editSession) - - runs -> - selections = editSession.getSelections() - expect(selections.length).toBe 3 - [selection1, selection2, selection3] = selections - expect(selection1.getScreenRange()).toEqual preRange1 - expect(selection2.getScreenRange()).toEqual preRange2 - expect(selection3.getScreenRange()).toEqual preRange3 - - describe "/regex/", -> - beforeEach -> - editSession.clearSelections() - - it 'selects text matching regex after current selection', -> - waitsForPromise -> - editSession.setSelectedBufferRange([[4,16], [4,20]]) - interpreter.eval('/pivot/', editSession) - - runs -> - expect(editSession.getSelection().getBufferRange()).toEqual [[6,16], [6,21]] - - it 'does not require the trailing slash', -> - waitsForPromise -> - editSession.setSelectedBufferRange([[4,16], [4,20]]) - interpreter.eval('/pivot', editSession) - - runs -> - expect(editSession.getSelection().getBufferRange()).toEqual [[6,16], [6,21]] - - it "searches from the end of each selection in the buffer", -> - waitsForPromise -> - editSession.clearSelections() - editSession.setSelectedBufferRange([[4,16], [4,20]]) - editSession.addSelectionForBufferRange([[1,16], [2,20]]) - expect(editSession.getSelections().length).toBe 2 - interpreter.eval('/pivot', editSession) - - runs -> - selections = editSession.getSelections() - expect(selections.length).toBe 2 - expect(selections[0].getBufferRange()).toEqual [[3,8], [3,13]] - expect(selections[1].getBufferRange()).toEqual [[6,16], [6,21]] - - it "wraps around to the beginning of the buffer, but doesn't infinitely loop if no matches are found", -> - waitsForPromise -> - editSession.setSelectedBufferRange([[10, 0], [10,3]]) - interpreter.eval('/pivot', editSession) - - runs -> - expect(editSession.getSelection().getBufferRange()).toEqual [[3,8], [3,13]] - - waitsForPromise -> - interpreter.eval('/mike tyson', editSession) - - runs -> - expect(editSession.getSelection().getBufferRange()).toEqual [[3,8], [3,13]] - - it "searches in reverse when prefixed with a -", -> - waitsForPromise -> - editSession.setSelectedBufferRange([[6, 16], [6, 22]]) - interpreter.eval('-/pivot', editSession) - - runs -> - expect(editSession.getSelection().getBufferRange()).toEqual [[3,8], [3,13]] - - it "removes folds that contain the selections", -> - waitsForPromise -> - editSession.createFold(5, 6) - editSession.createFold(10, 11) - editSession.setSelectedBufferRange([[4,16], [4,20]]) - interpreter.eval('/pivot/', editSession) - - runs -> - expect(editSession.getSelection().getBufferRange()).toEqual [[6,16], [6,21]] - expect(editSession.lineForScreenRow(5).fold).toBeUndefined() - expect(editSession.lineForScreenRow(10).fold).toBeDefined() - - describe "address range", -> - describe "when two addresses are specified", -> - it "selects from the begining of the left address to the end of the right address", -> - waitsForPromise -> interpreter.eval('4,7', editSession) - - runs -> - expect(editSession.getSelections().length).toBe 1 - expect(editSession.getSelection().getBufferRange()).toEqual [[3, 0], [7, 0]] - - describe "when the left address is unspecified", -> - it "selects from the begining of buffer to the end of the right address", -> - waitsForPromise -> interpreter.eval(',7', editSession) - runs -> - expect(editSession.getSelections().length).toBe 1 - expect(editSession.getSelection().getBufferRange()).toEqual [[0, 0], [7, 0]] - - describe "when the right address is unspecified", -> - it "selects from the begining of left address to the end file", -> - waitsForPromise -> interpreter.eval('4,', editSession) - runs -> - expect(editSession.getSelections().length).toBe 1 - expect(editSession.getSelection().getBufferRange()).toEqual [[3, 0], [12, 2]] - - describe "when the neither address is specified", -> - it "selects the entire file", -> - waitsForPromise -> interpreter.eval(',', editSession) - runs -> - expect(editSession.getSelections().length).toBe 1 - expect(editSession.getSelection().getBufferRange()).toEqual [[0, 0], [12, 2]] - - describe "x/regex/", -> - it "sets the current selection to every match of the regex in the current selection", -> - waitsForPromise -> interpreter.eval('6,7 x/current/', editSession) - - runs -> - selections = editSession.getSelections() - expect(selections.length).toBe 4 - - expect(selections[0].getBufferRange()).toEqual [[5,6], [5,13]] - expect(selections[1].getBufferRange()).toEqual [[6,6], [6,13]] - expect(selections[2].getBufferRange()).toEqual [[6,34], [6,41]] - expect(selections[3].getBufferRange()).toEqual [[6,56], [6,63]] - - describe "when matching /$/", -> - it "matches the end of each line in the selected region", -> - waitsForPromise -> interpreter.eval('6,8 x/$/', editSession) - - runs -> - cursors = editSession.getCursors() - expect(cursors.length).toBe 3 - - expect(cursors[0].getBufferPosition()).toEqual [5, 30] - expect(cursors[1].getBufferPosition()).toEqual [6, 65] - expect(cursors[2].getBufferPosition()).toEqual [7, 5] - - describe "when text is initially selected", -> - it "loops through current selections and selects text matching the regex", -> - waitsForPromise -> - editSession.setSelectedBufferRange [[3,0], [3,62]] - editSession.addSelectionForBufferRange [[6,0], [6,65]] - interpreter.eval('x/current', editSession) - - runs -> - selections = editSession.getSelections() - expect(selections.length).toBe 4 - - expect(selections[0].getBufferRange()).toEqual [[3,31], [3,38]] - expect(selections[1].getBufferRange()).toEqual [[6,6], [6,13]] - expect(selections[2].getBufferRange()).toEqual [[6,34], [6,41]] - expect(selections[3].getBufferRange()).toEqual [[6,56], [6,63]] - - describe "when nothing is matched", -> - it "preserves the existing selection", -> - previousSelections = null - waitsForPromise -> - previousSelections = editSession.getSelectedBufferRanges() - interpreter.eval(',x/this will match nothing', editSession) - - runs -> - expect(editSession.getSelectedBufferRanges()).toEqual previousSelections - - describe "substitution", -> - it "does nothing if there are no matches", -> - waitsForPromise -> - editSession.setSelectedBufferRange([[6, 0], [6, 44]]) - interpreter.eval('s/not-in-text/foo/', editSession) - - runs -> - expect(buffer.lineForRow(6)).toBe ' current < pivot ? left.push(current) : right.push(current);' - - describe "when not global", -> - describe "when there is a single selection", -> - it "performs a single substitution within the current selection", -> - waitsForPromise -> - editSession.setSelectedBufferRange([[6, 0], [6, 44]]) - interpreter.eval('s/current/foo/', editSession) - runs -> - expect(buffer.lineForRow(6)).toBe ' foo < pivot ? left.push(current) : right.push(current);' - - describe "when there are multiple selections", -> - it "performs a single substitutions within each of the selections", -> - waitsForPromise -> - editSession.setSelectedBufferRange([[5, 0], [5, 20]]) - editSession.addSelectionForBufferRange([[6, 0], [6, 44]]) - interpreter.eval('s/current/foo/', editSession) - - runs -> - expect(buffer.lineForRow(5)).toBe ' foo = items.shift();' - expect(buffer.lineForRow(6)).toBe ' foo < pivot ? left.push(current) : right.push(current);' - - describe "when global", -> - it "performs a multiple substitutions within the current selection", -> - waitsForPromise -> - editSession.setSelectedBufferRange([[6, 0], [6, 44]]) - interpreter.eval('s/current/foo/g', editSession) - - runs -> - expect(buffer.lineForRow(6)).toBe ' foo < pivot ? left.push(foo) : right.push(current);' - - describe "when prefixed with an address", -> - it "only makes substitutions within given lines", -> - waitsForPromise -> interpreter.eval('4,6s/ /!/g', editSession) - - runs -> - expect(buffer.lineForRow(2)).toBe ' if (items.length <= 1) return items;' - expect(buffer.lineForRow(3)).toBe '!!!!var!pivot!=!items.shift(),!current,!left!=![],!right!=![];' - expect(buffer.lineForRow(4)).toBe '!!!!while(items.length!>!0)!{' - expect(buffer.lineForRow(5)).toBe '!!!!!!current!=!items.shift();' - expect(buffer.lineForRow(6)).toBe ' current < pivot ? left.push(current) : right.push(current);' - - describe "when matching $", -> - it "matches the end of each line and avoids infinitely looping on a zero-width match", -> - waitsForPromise -> interpreter.eval(',s/$/!!!/g', editSession) - runs -> - expect(buffer.lineForRow(0)).toBe 'var quicksort = function () {!!!' - expect(buffer.lineForRow(2)).toBe ' if (items.length <= 1) return items;!!!' - expect(buffer.lineForRow(6)).toBe ' current < pivot ? left.push(current) : right.push(current);!!!' - expect(buffer.lineForRow(12)).toBe '};!!!' - - describe "when matching ^", -> - it "matches the beginning of each line and avoids infinitely looping on a zero-width match", -> - waitsForPromise -> interpreter.eval(',s/^/!!!/g', editSession) - runs -> - expect(buffer.lineForRow(0)).toBe '!!!var quicksort = function () {' - expect(buffer.lineForRow(2)).toBe '!!! if (items.length <= 1) return items;' - expect(buffer.lineForRow(6)).toBe '!!! current < pivot ? left.push(current) : right.push(current);' - expect(buffer.lineForRow(12)).toBe '!!!};' - - describe "when there are multiple selections", -> - it "performs a multiple substitutions within each of the selections", -> - waitsForPromise -> - editSession.setSelectedBufferRange([[5, 0], [5, 20]]) - editSession.addSelectionForBufferRange([[6, 0], [6, 44]]) - interpreter.eval('s/current/foo/g', editSession) - - runs -> - expect(buffer.lineForRow(5)).toBe ' foo = items.shift();' - expect(buffer.lineForRow(6)).toBe ' foo < pivot ? left.push(foo) : right.push(current);' - - describe "when prefixed with an address", -> - it "restores the original selections upon completion if it is the last command", -> - waitsForPromise -> - editSession.setSelectedBufferRanges([[[5, 0], [5, 20]], [[6, 0], [6, 44]]]) - interpreter.eval(',s/current/foo/g', editSession) - - runs -> - expect(editSession.getSelectedBufferRanges()).toEqual [[[5, 0], [5, 16]], [[6, 0], [6, 36]]] - - describe "X x/regex/", -> - it "returns selection operations for all regex matches in all the project's files", -> - editSession.destroy() - project = new Project(fixturesProject.resolve('dir/')) - interpreter = new CommandInterpreter(project) - - operations = null - waitsForPromise -> - interpreter.eval("X x/a+/").done (ops) -> operations = ops - - runs -> - expect(operations.length).toBeGreaterThan 3 - for operation in operations - editSession = project.buildEditSessionForPath(operation.getPath()) - editSession.setSelectedBufferRange(operation.execute(editSession)) - expect(editSession.getSelectedText()).toMatch /a+/ - editSession.destroy() - operation.destroy() - - editSession = null diff --git a/spec/extensions/command-panel-spec.coffee b/spec/extensions/command-panel-spec.coffee deleted file mode 100644 index 76c10e262..000000000 --- a/spec/extensions/command-panel-spec.coffee +++ /dev/null @@ -1,366 +0,0 @@ -RootView = require 'root-view' -CommandPanel = require 'command-panel' -_ = require 'underscore' - -describe "CommandPanel", -> - [rootView, editor, buffer, commandPanel, project] = [] - - beforeEach -> - rootView = new RootView - rootView.open(require.resolve 'fixtures/sample.js') - rootView.enableKeymap() - project = rootView.project - editor = rootView.getActiveEditor() - buffer = editor.activeEditSession.buffer - commandPanel = requireExtension('command-panel') - - afterEach -> - rootView.deactivate() - - describe "serialization", -> - it "preserves the command panel's mini-editor text, visibility, and focus across reloads", -> - rootView.attachToDom() - rootView.trigger 'command-panel:toggle' - expect(commandPanel.miniEditor.isFocused).toBeTruthy() - commandPanel.miniEditor.insertText 'abc' - rootView2 = RootView.deserialize(rootView.serialize()) - rootView.deactivate() - rootView2.attachToDom() - - commandPanel = rootView2.activateExtension(CommandPanel) - expect(rootView2.find('.command-panel')).toExist() - expect(commandPanel.miniEditor.getText()).toBe 'abc' - expect(commandPanel.miniEditor.isFocused).toBeTruthy() - - rootView2.focus() - expect(commandPanel.miniEditor.isFocused).toBeFalsy() - rootView3 = RootView.deserialize(rootView2.serialize()) - rootView2.deactivate() - rootView3.attachToDom() - commandPanel = rootView3.activateExtension(CommandPanel) - - expect(commandPanel.miniEditor.isFocused).toBeFalsy() - rootView3.deactivate() - - describe "when command-panel:close is triggered on the command panel", -> - it "detaches the command panel", -> - commandPanel.attach() - commandPanel.trigger('command-panel:close') - expect(commandPanel.hasParent()).toBeFalsy() - - describe "when command-panel:toggle is triggered on the root view", -> - beforeEach -> - rootView.attachToDom() - - describe "when the command panel is visible", -> - beforeEach -> - commandPanel.attach() - - describe "when the mini editor is focused", -> - it "closes the command panel", -> - expect(commandPanel.miniEditor.hiddenInput).toMatchSelector ':focus' - rootView.trigger 'command-panel:toggle' - expect(commandPanel.hasParent()).toBeFalsy() - - describe "when the mini editor is not focused", -> - it "focuses the mini editor", -> - rootView.focus() - expect(commandPanel.miniEditor.hiddenInput).not.toMatchSelector ':focus' - rootView.trigger 'command-panel:toggle' - expect(commandPanel.hasParent()).toBeTruthy() - expect(commandPanel.miniEditor.hiddenInput).toMatchSelector ':focus' - - describe "when the command panel is not visible", -> - it "shows and focuses the command panel", -> - expect(commandPanel.hasParent()).toBeFalsy() - rootView.trigger 'command-panel:toggle' - expect(commandPanel.hasParent()).toBeTruthy() - - describe "when command-panel:toggle-preview is triggered on the root view", -> - beforeEach -> - rootView.attachToDom() - - describe "when the preview list is/was previously visible", -> - beforeEach -> - rootView.trigger 'command-panel:toggle' - waitsForPromise -> commandPanel.execute('X x/a+/') - - describe "when the command panel is visible", -> - beforeEach -> - expect(commandPanel.hasParent()).toBeTruthy() - - describe "when the preview list is visible", -> - beforeEach -> - expect(commandPanel.previewList).toBeVisible() - - describe "when the preview list is focused", -> - it "hides the command panel", -> - expect(commandPanel.previewList).toMatchSelector(':focus') - rootView.trigger 'command-panel:toggle-preview' - expect(commandPanel.hasParent()).toBeFalsy() - - describe "when the preview list is not focused", -> - it "focuses the preview list", -> - commandPanel.miniEditor.focus() - rootView.trigger 'command-panel:toggle-preview' - expect(commandPanel.previewList).toMatchSelector(':focus') - - describe "when the preview list is not visible", -> - beforeEach -> - commandPanel.miniEditor.focus() - rootView.trigger 'command-panel:toggle' - rootView.trigger 'command-panel:toggle' - expect(commandPanel.hasParent()).toBeTruthy() - expect(commandPanel.previewList).toBeHidden() - - it "shows and focuses the preview list", -> - rootView.trigger 'command-panel:toggle-preview' - expect(commandPanel.previewList).toBeVisible() - expect(commandPanel.previewList).toMatchSelector(':focus') - - describe "when the command panel is not visible", -> - it "shows the command panel and the preview list, and focuses the preview list", -> - commandPanel.miniEditor.focus() - rootView.trigger 'command-panel:toggle' - expect(commandPanel.hasParent()).toBeFalsy() - - rootView.trigger 'command-panel:toggle-preview' - expect(commandPanel.hasParent()).toBeTruthy() - expect(commandPanel.previewList).toBeVisible() - expect(commandPanel.previewList).toMatchSelector(':focus') - - describe "when the preview list has never been opened", -> - describe "when the command panel is visible", -> - beforeEach -> - rootView.trigger 'command-panel:toggle' - expect(commandPanel.hasParent()).toBeTruthy() - - describe "when the mini editor is focused", -> - it "retains focus on the mini editor and does not show the preview list", -> - expect(commandPanel.miniEditor.isFocused).toBeTruthy() - rootView.trigger 'command-panel:toggle-preview' - expect(commandPanel.previewList).toBeHidden() - expect(commandPanel.miniEditor.isFocused).toBeTruthy() - - describe "when the mini editor is not focused", -> - it "focuses the mini editor and does not show the preview list", -> - rootView.focus() - rootView.trigger 'command-panel:toggle-preview' - expect(commandPanel.previewList).toBeHidden() - expect(commandPanel.miniEditor.isFocused).toBeTruthy() - - describe "when the command panel is not visible", -> - it "shows the command panel and focuses the mini editor, but does not show the preview list", -> - - describe "when command-panel:unfocus is triggered on the command panel", -> - it "returns focus to the root view but does not hide the command panel", -> - rootView.attachToDom() - commandPanel.attach() - expect(commandPanel.miniEditor.hiddenInput).toMatchSelector ':focus' - commandPanel.trigger 'command-panel:unfocus' - expect(commandPanel.hasParent()).toBeTruthy() - expect(commandPanel.miniEditor.hiddenInput).not.toMatchSelector ':focus' - - describe "when command-panel:repeat-relative-address is triggered on the root view", -> - it "repeats the last search command if there is one", -> - rootView.trigger 'command-panel:repeat-relative-address' - - editor.setCursorScreenPosition([4, 0]) - - commandPanel.execute("/current") - expect(editor.getSelection().getBufferRange()).toEqual [[5,6], [5,13]] - - rootView.trigger 'command-panel:repeat-relative-address' - expect(editor.getSelection().getBufferRange()).toEqual [[6,6], [6,13]] - - commandPanel.execute('s/r/R/g') - - rootView.trigger 'command-panel:repeat-relative-address' - expect(editor.getSelection().getBufferRange()).toEqual [[6,34], [6,41]] - - commandPanel.execute('0') - commandPanel.execute('/sort/ s/r/R/') # this contains a substitution... won't be repeated - - rootView.trigger 'command-panel:repeat-relative-address' - expect(editor.getSelection().getBufferRange()).toEqual [[3,31], [3,38]] - - describe "when command-panel:repeat-relative-address-in-reverse is triggered on the root view", -> - it "it repeats the last relative address in the reverse direction", -> - rootView.trigger 'command-panel:repeat-relative-address-in-reverse' - - editor.setCursorScreenPosition([6, 0]) - - commandPanel.execute("/current") - expect(editor.getSelection().getBufferRange()).toEqual [[6,6], [6,13]] - - rootView.trigger 'command-panel:repeat-relative-address-in-reverse' - expect(editor.getSelection().getBufferRange()).toEqual [[5,6], [5,13]] - - describe "when command-panel:set-selection-as-regex-address is triggered on the root view", -> - it "sets the @lastRelativeAddress to a RegexAddress of the current selection", -> - rootView.open(require.resolve('fixtures/sample.js')) - rootView.getActiveEditor().setSelectedBufferRange([[1,21],[1,28]]) - - commandInterpreter = commandPanel.commandInterpreter - expect(commandInterpreter.lastRelativeAddress).toBeUndefined() - rootView.trigger 'command-panel:set-selection-as-regex-address' - expect(commandInterpreter.lastRelativeAddress.subcommands.length).toBe 1 - expect(commandInterpreter.lastRelativeAddress.subcommands[0].regex.toString()).toEqual "/\\(items\\)/" - - describe "when command-panel:find-in-file is triggered on an editor", -> - it "pre-populates the command panel's editor with / and moves the cursor to the last column", -> - spyOn(commandPanel, 'attach').andCallThrough() - commandPanel.miniEditor.setText("foo") - commandPanel.miniEditor.setCursorBufferPosition([0, 0]) - - rootView.getActiveEditor().trigger "command-panel:find-in-file" - expect(commandPanel.attach).toHaveBeenCalled() - expect(commandPanel.parent).not.toBeEmpty() - expect(commandPanel.miniEditor.getText()).toBe "/" - expect(commandPanel.miniEditor.getCursorBufferPosition()).toEqual [0, 1] - - describe "when command-panel:find-in-project is triggered on the root view", -> - it "pre-populates the command panel's editor with Xx/ and moves the cursor to the last column", -> - spyOn(commandPanel, 'attach').andCallThrough() - commandPanel.miniEditor.setText("foo") - commandPanel.miniEditor.setCursorBufferPosition([0, 0]) - - rootView.trigger "command-panel:find-in-project" - expect(commandPanel.attach).toHaveBeenCalled() - expect(commandPanel.parent).not.toBeEmpty() - expect(commandPanel.miniEditor.getText()).toBe "Xx/" - expect(commandPanel.miniEditor.getCursorBufferPosition()).toEqual [0, 3] - - describe "when return is pressed on the panel's editor", -> - describe "if the command has an immediate effect", -> - it "executes it immediately on the current buffer", -> - rootView.trigger 'command-panel:toggle' - commandPanel.miniEditor.insertText ',s/sort/torta/g' - commandPanel.miniEditor.hiddenInput.trigger keydownEvent('enter') - - expect(buffer.lineForRow(0)).toMatch /quicktorta/ - expect(buffer.lineForRow(1)).toMatch /var torta/ - - describe "when the command returns operations to be previewed", -> - beforeEach -> - rootView.attachToDom() - editor.remove() - rootView.trigger 'command-panel:toggle' - waitsForPromise -> commandPanel.execute('X x/a+/') - - it "displays and focuses the operation preview list", -> - expect(commandPanel).toBeVisible() - expect(commandPanel.previewList).toBeVisible() - expect(commandPanel.previewList).toMatchSelector ':focus' - previewItem = commandPanel.previewList.find("li:contains(dir/a):first") - expect(previewItem.find('.path').text()).toBe "dir/a" - expect(previewItem.find('.preview').text()).toBe "aaa bbb" - expect(previewItem.find('.preview > .match').text()).toBe "aaa" - - rootView.trigger 'command-panel:toggle-preview' # ensure we can close panel without problems - expect(commandPanel).toBeHidden() - - it "destroys previously previewed operations if there are any", -> - waitsForPromise -> commandPanel.execute('X x/b+/') - # there shouldn't be any dangling operations after this - - describe "if the command is malformed", -> - it "adds and removes an error class to the command panel and does not close it", -> - rootView.trigger 'command-panel:toggle' - commandPanel.miniEditor.insertText 'garbage-command!!' - - commandPanel.miniEditor.hiddenInput.trigger keydownEvent('enter') - expect(commandPanel.parent()).toExist() - expect(commandPanel).toHaveClass 'error' - - advanceClock 400 - - expect(commandPanel).not.toHaveClass 'error' - - describe "when move-up and move-down are triggerred on the editor", -> - it "navigates forward and backward through the command history", -> - commandPanel.execute 's/war/peace/g' - commandPanel.execute 's/twinkies/wheatgrass/g' - - rootView.trigger 'command-panel:toggle' - - commandPanel.miniEditor.trigger 'move-up' - expect(commandPanel.miniEditor.getText()).toBe 's/twinkies/wheatgrass/g' - commandPanel.miniEditor.trigger 'move-up' - expect(commandPanel.miniEditor.getText()).toBe 's/war/peace/g' - commandPanel.miniEditor.trigger 'move-up' - expect(commandPanel.miniEditor.getText()).toBe 's/war/peace/g' - commandPanel.miniEditor.trigger 'move-down' - expect(commandPanel.miniEditor.getText()).toBe 's/twinkies/wheatgrass/g' - commandPanel.miniEditor.trigger 'move-down' - expect(commandPanel.miniEditor.getText()).toBe '' - - describe "when the preview list is focused with search operations", -> - previewList = null - - beforeEach -> - previewList = commandPanel.previewList - rootView.trigger 'command-panel:toggle' - waitsForPromise -> commandPanel.execute('X x/a+/') - - describe "when move-down and move-up are triggered on the preview list", -> - it "selects the next/previous operation (if there is one), and scrolls the list if needed", -> - rootView.attachToDom() - expect(previewList.find('li:eq(0)')).toHaveClass 'selected' - expect(previewList.getSelectedOperation()).toBe previewList.getOperations()[0] - - previewList.trigger 'move-up' - expect(previewList.find('li:eq(0)')).toHaveClass 'selected' - expect(previewList.getSelectedOperation()).toBe previewList.getOperations()[0] - - previewList.trigger 'move-down' - expect(previewList.find('li:eq(1)')).toHaveClass 'selected' - expect(previewList.getSelectedOperation()).toBe previewList.getOperations()[1] - - previewList.trigger 'move-down' - expect(previewList.find('li:eq(2)')).toHaveClass 'selected' - expect(previewList.getSelectedOperation()).toBe previewList.getOperations()[2] - - previewList.trigger 'move-up' - expect(previewList.find('li:eq(1)')).toHaveClass 'selected' - expect(previewList.getSelectedOperation()).toBe previewList.getOperations()[1] - - _.times previewList.getOperations().length, -> previewList.trigger 'move-down' - - expect(previewList.find('li:last')).toHaveClass 'selected' - expect(previewList.getSelectedOperation()).toBe _.last(previewList.getOperations()) - - expect(previewList.scrollBottom()).toBe previewList.prop('scrollHeight') - - _.times previewList.getOperations().length, -> previewList.trigger 'move-up' - - describe "when command-panel:execute is triggered on the preview list", -> - it "opens the operation's buffer, selects the search result, and focuses the active editor", -> - spyOn(rootView, 'focus') - executeHandler = jasmine.createSpy('executeHandler') - commandPanel.on 'command-panel:execute', executeHandler - - _.times 4, -> previewList.trigger 'move-down' - operation = previewList.getSelectedOperation() - - previewList.trigger 'command-panel:execute' - - editSession = rootView.getActiveEditSession() - expect(editSession.buffer.getPath()).toBe project.resolve(operation.getPath()) - expect(editSession.getSelectedBufferRange()).toEqual operation.getBufferRange() - expect(rootView.focus).toHaveBeenCalled() - - expect(executeHandler).not.toHaveBeenCalled() - - describe "when an operation in the preview list is clicked", -> - it "opens the operation's buffer, selects the search result, and focuses the active editor", -> - spyOn(rootView, 'focus') - operation = previewList.getOperations()[4] - - previewList.find('li:eq(4) span').mousedown() - - expect(previewList.getSelectedOperation()).toBe operation - editSession = rootView.getActiveEditSession() - expect(editSession.buffer.getPath()).toBe project.resolve(operation.getPath()) - expect(editSession.getSelectedBufferRange()).toEqual operation.getBufferRange() - expect(rootView.focus).toHaveBeenCalled() diff --git a/spec/extensions/fuzzy-finder-spec.coffee b/spec/extensions/fuzzy-finder-spec.coffee deleted file mode 100644 index d5b2d6552..000000000 --- a/spec/extensions/fuzzy-finder-spec.coffee +++ /dev/null @@ -1,294 +0,0 @@ -RootView = require 'root-view' -FuzzyFinder = require 'fuzzy-finder' -$ = require 'jquery' -{$$} = require 'space-pen' - -describe 'FuzzyFinder', -> - [rootView, finder] = [] - - beforeEach -> - rootView = new RootView(require.resolve('fixtures/sample.js')) - rootView.enableKeymap() - rootView.activateExtension(FuzzyFinder) - finder = FuzzyFinder.instance - - afterEach -> - rootView.remove() - - describe "file-finder behavior", -> - describe "toggling", -> - describe "when the root view's project has a path", -> - it "shows the FuzzyFinder or hides it and returns focus to the active editor if it already showing", -> - rootView.attachToDom() - expect(rootView.find('.fuzzy-finder')).not.toExist() - rootView.find('.editor').trigger 'split-right' - [editor1, editor2] = rootView.find('.editor').map -> $(this).view() - - rootView.trigger 'fuzzy-finder:toggle-file-finder' - expect(rootView.find('.fuzzy-finder')).toExist() - expect(finder.miniEditor.isFocused).toBeTruthy() - finder.miniEditor.insertText('this should not show up next time we toggle') - - rootView.trigger 'fuzzy-finder:toggle-file-finder' - expect(editor1.isFocused).toBeFalsy() - expect(editor2.isFocused).toBeTruthy() - expect(rootView.find('.fuzzy-finder')).not.toExist() - - rootView.trigger 'fuzzy-finder:toggle-file-finder' - expect(finder.miniEditor.getText()).toBe '' - - it "shows all relative file paths for the current project and selects the first", -> - finder.maxResults = 1000 - rootView.trigger 'fuzzy-finder:toggle-file-finder' - rootView.project.getFilePaths().done (paths) -> - expect(finder.pathList.children('li').length).toBe paths.length, finder.maxResults - for path in paths - expect(finder.pathList.find("li:contains(#{path})")).toExist() - expect(finder.pathList.children().first()).toHaveClass 'selected' - - describe "when root view's project has no path", -> - beforeEach -> - rootView.project.setPath(null) - - it "does not open the FuzzyFinder", -> - expect(rootView.find('.fuzzy-finder')).not.toExist() - rootView.trigger 'fuzzy-finder:toggle-file-finder' - expect(rootView.find('.fuzzy-finder')).not.toExist() - - describe "selecting a path", -> - [editor1, editor2] = [] - - beforeEach -> - rootView.attachToDom() - editor1 = rootView.getActiveEditor() - editor2 = editor1.splitRight() - expect(rootView.getActiveEditor()).toBe editor2 - rootView.trigger 'fuzzy-finder:toggle-file-finder' - - describe "when a path is highlighted", -> - it "opens the file associated with that path in the editor", -> - finder.trigger 'move-down' - selectedLi = finder.find('li:eq(1)') - - expectedPath = rootView.project.resolve(selectedLi.text()) - expect(editor1.getPath()).not.toBe expectedPath - expect(editor2.getPath()).not.toBe expectedPath - - finder.trigger 'fuzzy-finder:select-path' - - expect(finder.hasParent()).toBeFalsy() - expect(editor1.getPath()).not.toBe expectedPath - expect(editor2.getPath()).toBe expectedPath - expect(editor2.isFocused).toBeTruthy() - - describe "when no paths are highlighted", -> - it "does nothing", -> - finder.miniEditor.insertText('this should match nothing, because no one wants to drink battery acid') - finder.trigger 'fuzzy-finder:select-path' - expect(finder.hasParent()).toBeTruthy() - - describe "buffer-finder behavior", -> - describe "toggling", -> - describe "when the active editor contains edit sessions for buffers with paths", -> - beforeEach -> - rootView.open('sample.txt') - - it "shows the FuzzyFinder or hides it and returns focus to the active editor if it already showing", -> - rootView.attachToDom() - expect(rootView.find('.fuzzy-finder')).not.toExist() - rootView.find('.editor').trigger 'split-right' - [editor1, editor2] = rootView.find('.editor').map -> $(this).view() - - rootView.trigger 'fuzzy-finder:toggle-buffer-finder' - expect(rootView.find('.fuzzy-finder')).toExist() - expect(rootView.find('.fuzzy-finder input:focus')).toExist() - finder.miniEditor.insertText('this should not show up next time we toggle') - - rootView.trigger 'fuzzy-finder:toggle-buffer-finder' - expect(editor1.isFocused).toBeFalsy() - expect(editor2.isFocused).toBeTruthy() - expect(rootView.find('.fuzzy-finder')).not.toExist() - - rootView.trigger 'fuzzy-finder:toggle-buffer-finder' - expect(finder.miniEditor.getText()).toBe '' - - it "lists the paths of the current editor's open buffers", -> - rootView.trigger 'fuzzy-finder:toggle-buffer-finder' - expect(finder.pathList.children('li').length).toBe 2 - expect(finder.pathList.find("li:contains(sample.js)")).toExist() - expect(finder.pathList.find("li:contains(sample.txt)")).toExist() - expect(finder.pathList.children().first()).toHaveClass 'selected' - - describe "when the active editor only contains edit sessions for anonymous buffers", -> - it "does not open", -> - editor = rootView.getActiveEditor() - editor.edit(rootView.project.buildEditSessionForPath()) - editor.loadPreviousEditSession() - editor.destroyActiveEditSession() - expect(editor.getOpenBufferPaths().length).toBe 0 - rootView.trigger 'fuzzy-finder:toggle-buffer-finder' - expect(rootView.find('.fuzzy-finder')).not.toExist() - - describe "when there is no active editor", -> - it "does not open", -> - rootView.getActiveEditor().destroyActiveEditSession() - expect(rootView.getActiveEditor()).toBeUndefined() - rootView.trigger 'fuzzy-finder:toggle-buffer-finder' - expect(rootView.find('.fuzzy-finder')).not.toExist() - - describe "selecting a path", -> - [editor1, editor2] = [] - - beforeEach -> - rootView.attachToDom() - editor1 = rootView.getActiveEditor() - editor2 = editor1.splitRight() - expect(rootView.getActiveEditor()).toBe editor2 - rootView.open('sample.txt') - editor2.loadPreviousEditSession() - rootView.trigger 'fuzzy-finder:toggle-buffer-finder' - - describe "when a path is highlighted", -> - describe "when the highlighted path is open in the active editor", -> - it "switches the active editor to the edit session for the selected path", -> - finder.moveDown() - selectedLi = finder.findSelectedLi() - expect(selectedLi.text()).toBe 'sample.txt' - expectedPath = rootView.project.resolve('sample.txt') - - finder.trigger 'fuzzy-finder:select-path' - - expect(finder.hasParent()).toBeFalsy() - expect(editor1.getPath()).not.toBe expectedPath - expect(editor2.getPath()).toBe expectedPath - expect(editor2.isFocused).toBeTruthy() - - describe "when the highlighted path is not open in the active editor, but instead is open on another editor", -> - it "focuses the editor that contains an edit session for the selected path", -> - rootView.trigger 'fuzzy-finder:toggle-buffer-finder' - editor1.focus() - rootView.trigger 'fuzzy-finder:toggle-buffer-finder' - - expect(rootView.getActiveEditor()).toBe editor1 - - finder.moveDown() - selectedLi = finder.findSelectedLi() - expect(selectedLi.text()).toBe 'sample.txt' - expectedPath = rootView.project.resolve('sample.txt') - - finder.trigger 'fuzzy-finder:select-path' - - expect(finder.hasParent()).toBeFalsy() - expect(editor1.getPath()).not.toBe expectedPath - expect(editor2.getPath()).toBe expectedPath - expect(editor2.isFocused).toBeTruthy() - - describe "common behavior between file and buffer finder", -> - describe "when characters are typed into the input element", -> - it "displays matching paths in the ol element and selects the first", -> - rootView.trigger 'fuzzy-finder:toggle-file-finder' - - listLengthBefore = finder.pathList.children().length - - finder.miniEditor.insertText('samp') - - expect(finder.pathList.children().length).toBeLessThan(listLengthBefore) - expect(finder.pathList.find('li:first')).toHaveClass 'selected' - expect(finder.pathList.find('li.selected').length).toBe 1 - - # we should clear the list before re-populating it - finder.miniEditor.insertText('txt') - - expect(finder.pathList.children().length).toBe 1 - expect(finder.pathList.find('li:first')).toHaveClass 'selected' - expect(finder.pathList.find('li:first')).toHaveText 'sample.txt' - - describe "move-down / move-up events", -> - beforeEach -> - rootView.trigger 'fuzzy-finder:toggle-file-finder' - - it "selects the next / previous path in the list", -> - expect(finder.find('li:eq(0)')).toHaveClass "selected" - expect(finder.find('li:eq(2)')).not.toHaveClass "selected" - - finder.miniEditor.trigger keydownEvent('down') - finder.miniEditor.trigger keydownEvent('down') - - expect(finder.find('li:eq(0)')).not.toHaveClass "selected" - expect(finder.find('li:eq(2)')).toHaveClass "selected" - - finder.miniEditor.trigger keydownEvent('up') - - expect(finder.find('li:eq(0)')).not.toHaveClass "selected" - expect(finder.find('li:eq(1)')).toHaveClass "selected" - expect(finder.find('li:eq(2)')).not.toHaveClass "selected" - - it "does not fall off the end or begining of the list", -> - expect(finder.find('li:first')).toHaveClass "selected" - finder.miniEditor.trigger keydownEvent('up') - expect(finder.find('li:first')).toHaveClass "selected" - - for i in [1..finder.pathList.children().length+2] - finder.miniEditor.trigger keydownEvent('down') - - expect(finder.find('li:last')).toHaveClass "selected" - - describe "when the fuzzy finder loses focus", -> - it "detaches itself", -> - rootView.attachToDom() - rootView.trigger 'fuzzy-finder:toggle-file-finder' - - expect(finder.hasParent()).toBeTruthy() - rootView.focus() - expect(finder.hasParent()).toBeFalsy() - - describe "when the fuzzy finder is cancelled", -> - it "hides the finder", -> - rootView.trigger 'fuzzy-finder:toggle-file-finder' - expect(finder.hasParent()).toBeTruthy() - - finder.trigger 'fuzzy-finder:cancel' - expect(finder.hasParent()).toBeFalsy() - - it "focuses previously focused element", -> - rootView.attachToDom() - activeEditor = rootView.getActiveEditor() - activeEditor.focus() - - rootView.trigger 'fuzzy-finder:toggle-file-finder' - expect(activeEditor.isFocused).toBeFalsy() - expect(finder.miniEditor.isFocused).toBeTruthy() - - finder.trigger 'fuzzy-finder:cancel' - expect(activeEditor.isFocused).toBeTruthy() - expect(finder.miniEditor.isFocused).toBeFalsy() - - describe "selecting a path with the mouse", -> - it "opens the clicked path in the active editor and focuses it", -> - rootView.attachToDom() - rootView.trigger 'fuzzy-finder:toggle-file-finder' - - selectedLi = finder.find('li:eq(1)') - - expectedPath = rootView.project.resolve(selectedLi.text()) - expect(rootView.getActiveEditor().getPath()).not.toBe expectedPath - expect(rootView.getActiveEditor().isFocused).toBeFalsy() - - selectedLi.mousedown() - - expect(rootView.getActiveEditor().getPath()).toBe expectedPath - expect(rootView.getActiveEditor().isFocused).toBeTruthy() - - describe ".findMatches(queryString)", -> - beforeEach -> - rootView.trigger 'fuzzy-finder:toggle-file-finder' - - it "returns up to finder.maxResults paths if queryString is empty", -> - expect(finder.findMatches('').length).toBeLessThan finder.maxResults + 1 - finder.maxResults = 5 - expect(finder.findMatches('').length).toBeLessThan finder.maxResults + 1 - - it "returns paths sorted by score of match against the given query", -> - finder.paths = ["app.coffee", "atom/app.coffee"] - expect(finder.findMatches('app.co')).toEqual ["app.coffee", "atom/app.coffee"] - expect(finder.findMatches('atom/app.co')).toEqual ["atom/app.coffee"] diff --git a/spec/extensions/snippets-spec.coffee b/spec/extensions/snippets-spec.coffee deleted file mode 100644 index 68d9e0ed7..000000000 --- a/spec/extensions/snippets-spec.coffee +++ /dev/null @@ -1,242 +0,0 @@ -Snippets = require 'snippets' -RootView = require 'root-view' -Buffer = require 'buffer' -Editor = require 'editor' -_ = require 'underscore' -fs = require 'fs' - -describe "Snippets extension", -> - [buffer, editor] = [] - beforeEach -> - rootView = new RootView(require.resolve('fixtures/sample.js')) - requireExtension("snippets") - editor = rootView.getActiveEditor() - buffer = editor.getBuffer() - rootView.simulateDomAttachment() - rootView.enableKeymap() - - afterEach -> - rootView.remove() - - describe "when 'tab' is triggered on the editor", -> - beforeEach -> - Snippets.evalSnippets 'js', """ - snippet t1 "Snippet without tab stops" - this is a test - endsnippet - - snippet t2 "With tab stops" - go here next:($2) and finally go here:($3) - go here first:($1) - - endsnippet - - snippet t3 "With indented second line" - line 1 - line 2$1 - - endsnippet - - snippet t4 "With tab stop placeholders" - go here ${1:first} and then here ${2:second} - - endsnippet - - snippet t5 "Caused problems with undo" - first line$1 - ${2:placeholder ending second line} - endsnippet - """ - - describe "when the letters preceding the cursor trigger a snippet", -> - describe "when the snippet contains no tab stops", -> - it "replaces the prefix with the snippet text and places the cursor at its end", -> - editor.insertText("t1") - expect(editor.getCursorScreenPosition()).toEqual [0, 2] - - editor.trigger keydownEvent('tab', target: editor[0]) - expect(buffer.lineForRow(0)).toBe "this is a testvar quicksort = function () {" - expect(editor.getCursorScreenPosition()).toEqual [0, 14] - - describe "when the snippet contains tab stops", -> - it "places the cursor at the first tab-stop, and moves the cursor in response to 'next-tab-stop' events", -> - anchorCountBefore = editor.activeEditSession.getAnchors().length - editor.setCursorScreenPosition([2, 0]) - editor.insertText('t2') - editor.trigger keydownEvent('tab', target: editor[0]) - expect(buffer.lineForRow(2)).toBe "go here next:() and finally go here:()" - expect(buffer.lineForRow(3)).toBe "go here first:()" - expect(buffer.lineForRow(4)).toBe " if (items.length <= 1) return items;" - expect(editor.getSelectedBufferRange()).toEqual [[3, 15], [3, 15]] - - editor.trigger keydownEvent('tab', target: editor[0]) - expect(editor.getSelectedBufferRange()).toEqual [[2, 14], [2, 14]] - editor.insertText 'abc' - - editor.trigger keydownEvent('tab', target: editor[0]) - expect(editor.getSelectedBufferRange()).toEqual [[2, 40], [2, 40]] - - # tab backwards - editor.trigger keydownEvent('tab', shiftKey: true, target: editor[0]) - expect(editor.getSelectedBufferRange()).toEqual [[2, 14], [2, 17]] # should highlight text typed at tab stop - - editor.trigger keydownEvent('tab', shiftKey: true, target: editor[0]) - expect(editor.getSelectedBufferRange()).toEqual [[3, 15], [3, 15]] - - # shift-tab on first tab-stop does nothing - editor.trigger keydownEvent('tab', shiftKey: true, target: editor[0]) - expect(editor.getCursorScreenPosition()).toEqual [3, 15] - - # tab through all tab stops, then tab on last stop to terminate snippet - editor.trigger keydownEvent('tab', target: editor[0]) - editor.trigger keydownEvent('tab', target: editor[0]) - editor.trigger keydownEvent('tab', target: editor[0]) - expect(buffer.lineForRow(2)).toBe "go here next:(abc) and finally go here:( )" - expect(editor.activeEditSession.getAnchors().length).toBe anchorCountBefore - - describe "when the tab stops have placeholder text", -> - it "auto-fills the placeholder text and highlights it when navigating to that tab stop", -> - editor.insertText 't4' - editor.trigger 'snippets:expand' - expect(buffer.lineForRow(0)).toBe 'go here first and then here second' - expect(editor.getSelectedBufferRange()).toEqual [[0, 8], [0, 13]] - - describe "when the cursor is moved beyond the bounds of a tab stop", -> - it "terminates the snippet on the next tab", -> - editor.setCursorScreenPosition([2, 0]) - editor.insertText('t2') - editor.trigger keydownEvent('tab', target: editor[0]) - - editor.moveCursorRight() - editor.trigger keydownEvent('tab', target: editor[0]) - expect(buffer.lineForRow(3)).toBe "go here first:() " - expect(editor.getCursorBufferPosition()).toEqual [3, 18] - - # test we can terminate with shift-tab - editor.setCursorScreenPosition([4, 0]) - editor.insertText('t2') - editor.trigger keydownEvent('tab', target: editor[0]) - editor.trigger keydownEvent('tab', target: editor[0]) - - editor.moveCursorRight() - editor.trigger keydownEvent('tab', shiftKey: true, target: editor[0]) - expect(editor.getCursorBufferPosition()).toEqual [4, 15] - - - describe "when a the start of the snippet is indented", -> - describe "when the snippet spans a single line", -> - it "does not indent the next line", -> - editor.setCursorScreenPosition([2, Infinity]) - editor.insertText ' t1' - editor.trigger 'snippets:expand' - expect(buffer.lineForRow(3)).toBe " var pivot = items.shift(), current, left = [], right = [];" - - describe "when the snippet spans multiple lines", -> - it "indents the subsequent lines of the snippet to be even with the start of the first line", -> - editor.setCursorScreenPosition([2, Infinity]) - editor.insertText ' t3' - editor.trigger 'snippets:expand' - expect(buffer.lineForRow(2)).toBe " if (items.length <= 1) return items; line 1" - expect(buffer.lineForRow(3)).toBe " line 2" - expect(editor.getCursorBufferPosition()).toEqual [3, 12] - - describe "when the letters preceding the cursor don't match a snippet", -> - it "inserts a tab as normal", -> - editor.insertText("xte") - expect(editor.getCursorScreenPosition()).toEqual [0, 3] - - editor.trigger keydownEvent('tab', target: editor[0]) - expect(buffer.lineForRow(0)).toBe "xte var quicksort = function () {" - expect(editor.getCursorScreenPosition()).toEqual [0, 5] - - describe "when a previous snippet expansion has just been undone", -> - it "expands the snippet based on the current prefix rather than jumping to the old snippet's tab stop", -> - editor.insertText 't5\n' - editor.setCursorBufferPosition [0, 2] - editor.trigger keydownEvent('tab', target: editor[0]) - expect(buffer.lineForRow(0)).toBe "first line" - editor.undo() - expect(buffer.lineForRow(0)).toBe "t5" - editor.trigger keydownEvent('tab', target: editor[0]) - expect(buffer.lineForRow(0)).toBe "first line" - - describe "when a snippet expansion is undone and redone", -> - it "recreates the snippet's tab stops", -> - editor.insertText ' t5\n' - editor.setCursorBufferPosition [0, 6] - editor.trigger keydownEvent('tab', target: editor[0]) - expect(buffer.lineForRow(0)).toBe " first line" - editor.undo() - editor.redo() - - expect(editor.getCursorBufferPosition()).toEqual [0, 14] - editor.trigger keydownEvent('tab', target: editor[0]) - expect(editor.getSelectedBufferRange()).toEqual [[1, 6], [1, 36]] - - it "restores tabs stops in active edit session even when the initial expansion was in a different edit session", -> - anotherEditor = editor.splitRight() - - editor.insertText ' t5\n' - editor.setCursorBufferPosition [0, 6] - editor.trigger keydownEvent('tab', target: editor[0]) - expect(buffer.lineForRow(0)).toBe " first line" - editor.undo() - - anotherEditor.redo() - expect(anotherEditor.getCursorBufferPosition()).toEqual [0, 14] - anotherEditor.trigger keydownEvent('tab', target: anotherEditor[0]) - expect(anotherEditor.getSelectedBufferRange()).toEqual [[1, 6], [1, 36]] - - describe ".loadSnippetsFile(path)", -> - it "loads the snippets in the given file", -> - spyOn(fs, 'read').andReturn """ - snippet t1 "Test snippet 1" - this is a test 1 - endsnippet - """ - - Snippets.loadSnippetsFile('/tmp/foo/js.snippets') - expect(fs.read).toHaveBeenCalledWith('/tmp/foo/js.snippets') - - editor.insertText("t1") - editor.trigger 'snippets:expand' - expect(buffer.lineForRow(0)).toBe "this is a test 1var quicksort = function () {" - - describe "Snippets parser", -> - it "can parse multiple snippets", -> - snippets = Snippets.snippetsParser.parse """ - snippet t1 "Test snippet 1" - this is a test 1 - endsnippet - - snippet t2 "Test snippet 2" - this is a test 2 - endsnippet - """ - expect(_.keys(snippets).length).toBe 2 - snippet = snippets['t1'] - expect(snippet.prefix).toBe 't1' - expect(snippet.description).toBe "Test snippet 1" - expect(snippet.body).toBe "this is a test 1" - - snippet = snippets['t2'] - expect(snippet.prefix).toBe 't2' - expect(snippet.description).toBe "Test snippet 2" - expect(snippet.body).toBe "this is a test 2" - - it "can parse snippets with tabstops", -> - snippets = Snippets.snippetsParser.parse """ - # this line intentially left blank. - snippet t1 "Snippet with tab stops" - go here next:($2) and finally go here:($3) - go here first:($1) - endsnippet - """ - - snippet = snippets['t1'] - expect(snippet.body).toBe """ - go here next:() and finally go here:() - go here first:() - """ - - expect(snippet.tabStops).toEqual [[[1, 15], [1, 15]], [[0, 14], [0, 14]], [[0, 37], [0, 37]]] diff --git a/spec/extensions/strip-trailing-whitespace-spec.coffee b/spec/extensions/strip-trailing-whitespace-spec.coffee deleted file mode 100644 index 857a8f5cb..000000000 --- a/spec/extensions/strip-trailing-whitespace-spec.coffee +++ /dev/null @@ -1,35 +0,0 @@ -StripTrailingWhitespace = require 'strip-trailing-whitespace' -RootView = require 'root-view' -fs = require 'fs' - -describe "StripTrailingWhitespace", -> - [rootView, editor, path] = [] - - beforeEach -> - path = "/tmp/atom-whitespace.txt" - fs.write(path, "") - rootView = new RootView(path) - - StripTrailingWhitespace.activate(rootView) - rootView.focus() - editor = rootView.getActiveEditor() - - afterEach -> - fs.remove(path) if fs.exists(path) - rootView.remove() - - it "strips trailing whitespace before an editor saves a buffer", -> - spyOn(fs, 'write') - - # works for buffers that are already open when extension is initialized - editor.insertText("foo \nbar\t \n\nbaz") - editor.save() - expect(editor.getText()).toBe "foo\nbar\n\nbaz" - - # works for buffers that are opened after extension is initialized - rootView.open(require.resolve('fixtures/sample.txt')) - editor.moveCursorToEndOfLine() - editor.insertText(" ") - - editor.getBuffer().save() - expect(editor.getText()).toBe 'Some text.\n' diff --git a/spec/extensions/tree-view-spec.coffee b/spec/extensions/tree-view-spec.coffee deleted file mode 100644 index 778ae5189..000000000 --- a/spec/extensions/tree-view-spec.coffee +++ /dev/null @@ -1,746 +0,0 @@ -$ = require 'jquery' -_ = require 'underscore' -TreeView = require 'tree-view' -RootView = require 'root-view' -Directory = require 'directory' -Native = require 'native' -fs = require 'fs' - -describe "TreeView", -> - [rootView, project, treeView, sampleJs, sampleTxt] = [] - - beforeEach -> - rootView = new RootView(require.resolve('fixtures/')) - project = rootView.project - - rootView.activateExtension(TreeView) - treeView = rootView.find(".tree-view").view() - treeView.root = treeView.find('> li:first').view() - sampleJs = treeView.find('.file:contains(sample.js)') - sampleTxt = treeView.find('.file:contains(sample.txt)') - - expect(treeView.root.directory.subscriptionCount()).toBeGreaterThan 0 - - afterEach -> - rootView.deactivate() - - describe ".initialize(project)", -> - it "renders the root of the project and its contents alphabetically with subdirectories first in a collapsed state", -> - expect(treeView.root.find('> .header .disclosure-arrow')).toHaveText('▾') - expect(treeView.root.find('> .header .name')).toHaveText('fixtures/') - - rootEntries = treeView.root.find('.entries') - subdir0 = rootEntries.find('> li:eq(0)') - expect(subdir0.find('.disclosure-arrow')).toHaveText('▸') - expect(subdir0.find('.name')).toHaveText('dir/') - expect(subdir0.find('.entries')).not.toExist() - - subdir2 = rootEntries.find('> li:eq(3)') - expect(subdir2.find('.disclosure-arrow')).toHaveText('▸') - expect(subdir2.find('.name')).toHaveText('zed/') - expect(subdir2.find('.entries')).not.toExist() - - expect(rootEntries.find('> .file:contains(sample.js)')).toExist() - expect(rootEntries.find('> .file:contains(sample.txt)')).toExist() - - it "selects the rootview", -> - expect(treeView.selectedEntry()).toEqual treeView.root - - describe "when the project has no path", -> - beforeEach -> - rootView.deactivate() - - rootView = new RootView - rootView.activateExtension(TreeView) - treeView = rootView.find(".tree-view").view() - - it "does not create a root node", -> - expect(treeView.root).not.toExist() - - it "serializes without throwing an exception", -> - expect(-> treeView.serialize()).not.toThrow() - - it "creates a root view when the project path is created", -> - rootView.open(require.resolve('fixtures/sample.js')) - expect(treeView.root.getPath()).toBe require.resolve('fixtures') - expect(treeView.root.parent()).toMatchSelector(".tree-view") - - oldRoot = treeView.root - - rootView.project.setPath('/tmp') - expect(treeView.root).not.toEqual oldRoot - expect(oldRoot.hasParent()).toBeFalsy() - - describe "when the prototypes deactivate method is called", -> - it "calls the deactivate on tree view instance", -> - spyOn(treeView, "deactivate").andCallThrough() - rootView.deactivateExtension(TreeView) - expect(treeView.deactivate).toHaveBeenCalled() - - describe "serialization", -> - [newRootView, newTreeView] = [] - - afterEach -> - newRootView.deactivate() - - it "restores expanded directories and selected file when deserialized", -> - treeView.find('.directory:contains(zed)').click() - sampleJs.click() - newRootView = RootView.deserialize(rootView.serialize()) - rootView.deactivate() # Deactivates previous TreeView - - newRootView.activateExtension(TreeView) - - newTreeView = newRootView.find(".tree-view").view() - - expect(newTreeView).toExist() - expect(newTreeView.selectedEntry()).toMatchSelector(".file:contains(sample.js)") - expect(newTreeView.find(".directory:contains(zed)")).toHaveClass("expanded") - - it "restores the focus state of the tree view", -> - rootView.attachToDom() - treeView.focus() - expect(treeView).toMatchSelector ':focus' - - newRootView = RootView.deserialize(rootView.serialize()) - rootView.deactivate() # Deactivates previous TreeView - - newRootView.attachToDom() - newRootView.activateExtension(TreeView) - - newTreeView = newRootView.find(".tree-view").view() - expect(newTreeView).toMatchSelector ':focus' - - describe "when tree-view:toggle is triggered on the root view", -> - beforeEach -> - rootView.attachToDom() - - describe "when the tree view is visible", -> - beforeEach -> - expect(treeView).toBeVisible() - - describe "when the tree view is focused", -> - it "hides the tree view", -> - treeView.focus() - rootView.trigger 'tree-view:toggle' - expect(treeView).toBeHidden() - - describe "when the tree view is not focused", -> - it "shifts focus to the tree view", -> - rootView.focus() - rootView.trigger 'tree-view:toggle' - expect(treeView).toBeVisible() - expect(treeView).toMatchSelector(':focus') - - describe "when the tree view is hidden", -> - it "shows and focuses the tree view", -> - treeView.detach() - rootView.trigger 'tree-view:toggle' - expect(treeView.hasParent()).toBeTruthy() - expect(treeView).toMatchSelector(':focus') - - describe "when tree-view:reveal-current-file is triggered on the root view", -> - beforeEach -> - treeView.detach() - spyOn(treeView, 'focus') - - describe "if the current file has a path", -> - it "shows and focuses the tree view and selects the file", -> - rootView.open('dir/a') - rootView.trigger 'tree-view:reveal-active-file' - expect(treeView.hasParent()).toBeTruthy() - expect(treeView.focus).toHaveBeenCalled() - expect(treeView.selectedEntry().getPath()).toMatch /dir\/a$/ - - describe "if the current file has no path", -> - it "shows and focuses the tree view, but does not attempt to select a specific file", -> - rootView.open() - expect(rootView.getActiveEditSession().getPath()).toBeUndefined() - rootView.trigger 'tree-view:reveal-active-file' - expect(treeView.hasParent()).toBeTruthy() - expect(treeView.focus).toHaveBeenCalled() - - describe "if there is no editor open", -> - it "shows and focuses the tree view, but does not attempt to select a specific file", -> - expect(rootView.getActiveEditSession()).toBeUndefined() - rootView.trigger 'tree-view:reveal-active-file' - expect(treeView.hasParent()).toBeTruthy() - expect(treeView.focus).toHaveBeenCalled() - - describe "when tree-view:unfocus is triggered on the tree view", -> - it "surrenders focus to the root view but remains open", -> - rootView.attachToDom() - treeView.focus() - treeView.trigger 'tree-view:unfocus' - expect(treeView).toBeVisible() - expect(treeView).not.toMatchSelector(':focus') - expect(rootView).toMatchSelector(':focus') - - describe "when a directory's disclosure arrow is clicked", -> - it "expands / collapses the associated directory", -> - subdir = treeView.root.find('.entries > li:contains(dir/)').view() - - expect(subdir.disclosureArrow).toHaveText('▸') - expect(subdir.find('.entries')).not.toExist() - - subdir.disclosureArrow.click() - - expect(subdir.disclosureArrow).toHaveText('▾') - expect(subdir.find('.entries')).toExist() - - subdir.disclosureArrow.click() - expect(subdir.disclosureArrow).toHaveText('▸') - expect(subdir.find('.entries')).not.toExist() - - it "restores the expansion state of descendant directories", -> - child = treeView.root.find('.entries > li:contains(dir/)').view() - child.disclosureArrow.click() - - grandchild = child.find('.entries > li:contains(a-dir/)').view() - grandchild.disclosureArrow.click() - - treeView.root.disclosureArrow.click() - expect(treeView.root.find('.entries')).not.toExist() - treeView.root.disclosureArrow.click() - - # previously expanded descendants remain expanded - expect(treeView.root.find('> .entries > li:contains(dir/) > .entries > li:contains(a-dir/) > .entries').length).toBe 1 - - # collapsed descendants remain collapsed - expect(treeView.root.find('> .entries > li.contains(zed/) > .entries')).not.toExist() - - it "when collapsing a directory, removes change subscriptions from the collapsed directory and its descendants", -> - child = treeView.root.entries.find('li:contains(dir/)').view() - child.disclosureArrow.click() - - grandchild = child.entries.find('li:contains(a-dir/)').view() - grandchild.disclosureArrow.click() - - expect(treeView.root.directory.subscriptionCount()).toBe 1 - expect(child.directory.subscriptionCount()).toBe 1 - expect(grandchild.directory.subscriptionCount()).toBe 1 - - treeView.root.disclosureArrow.click() - - expect(treeView.root.directory.subscriptionCount()).toBe 0 - expect(child.directory.subscriptionCount()).toBe 0 - expect(grandchild.directory.subscriptionCount()).toBe 0 - - describe "when a file is single-clicked", -> - it "selects the files and opens it in the active editor, without changing focus", -> - expect(rootView.getActiveEditor()).toBeUndefined() - - sampleJs.trigger clickEvent(originalEvent: { detail: 1 }) - expect(sampleJs).toHaveClass 'selected' - expect(rootView.getActiveEditor().getPath()).toBe require.resolve('fixtures/sample.js') - expect(rootView.getActiveEditor().isFocused).toBeFalsy() - - sampleTxt.trigger clickEvent(originalEvent: { detail: 1 }) - expect(sampleTxt).toHaveClass 'selected' - expect(treeView.find('.selected').length).toBe 1 - expect(rootView.getActiveEditor().getPath()).toBe require.resolve('fixtures/sample.txt') - expect(rootView.getActiveEditor().isFocused).toBeFalsy() - - describe "when a file is double-clicked", -> - it "selects the file and opens it in the active editor on the first click, then changes focus to the active editor on the second", -> - sampleJs.trigger clickEvent(originalEvent: { detail: 1 }) - expect(sampleJs).toHaveClass 'selected' - expect(rootView.getActiveEditor().getPath()).toBe require.resolve('fixtures/sample.js') - expect(rootView.getActiveEditor().isFocused).toBeFalsy() - - sampleJs.trigger clickEvent(originalEvent: { detail: 2 }) - expect(rootView.getActiveEditor().isFocused).toBeTruthy() - - describe "when a directory is single-clicked", -> - it "is selected", -> - subdir = treeView.root.find('.directory:first').view() - subdir.trigger clickEvent(originalEvent: { detail: 1 }) - expect(subdir).toHaveClass 'selected' - - describe "when a directory is double-clicked", -> - it "toggles the directory expansion state and does not change the focus to the editor", -> - sampleJs.trigger clickEvent(originalEvent: { detail: 1 }) - subdir = treeView.root.find('.directory:first').view() - subdir.trigger clickEvent(originalEvent: { detail: 1 }) - expect(subdir).toHaveClass 'selected' - subdir.trigger clickEvent(originalEvent: { detail: 2 }) - expect(subdir).toHaveClass 'expanded' - expect(rootView.getActiveEditor().isFocused).toBeFalsy() - - describe "when a new file is opened in the active editor", -> - it "is selected in the tree view if the file's entry visible", -> - sampleJs.click() - rootView.open(require.resolve('fixtures/sample.txt')) - - expect(sampleTxt).toHaveClass 'selected' - expect(treeView.find('.selected').length).toBe 1 - - it "selected a file's parent dir if the file's entry is not visible", -> - rootView.open(require.resolve('fixtures/dir/a-dir/oh-git')) - - dirView = treeView.root.find('.directory:contains(dir)').view() - expect(dirView).toHaveClass 'selected' - - describe "when a different editor becomes active", -> - it "selects the file in that is open in that editor", -> - sampleJs.click() - leftEditor = rootView.getActiveEditor() - rightEditor = leftEditor.splitRight() - sampleTxt.click() - - expect(sampleTxt).toHaveClass('selected') - leftEditor.focus() - expect(sampleJs).toHaveClass('selected') - - describe "keyboard navigation", -> - afterEach -> - expect(treeView.find('.selected').length).toBeLessThan 2 - - describe "move-down", -> - describe "when a collapsed directory is selected", -> - it "skips to the next directory", -> - treeView.root.find('.directory:eq(0)').click() - treeView.trigger 'move-down' - expect(treeView.root.find('.directory:eq(1)')).toHaveClass 'selected' - - describe "when an expanded directory is selected", -> - it "selects the first entry of the directory", -> - subdir = treeView.root.find('.directory:eq(1)').view() - subdir.expand() - subdir.click() - - treeView.trigger 'move-down' - - expect(subdir.entries.find('.entry:first')).toHaveClass 'selected' - - describe "when the last entry of an expanded directory is selected", -> - it "selects the entry after its parent directory", -> - subdir1 = treeView.root.find('.directory:eq(1)').view() - subdir1.expand() - subdir1.entries.find('.entry:last').click() - - treeView.trigger 'move-down' - - expect(treeView.root.find('.entries > .entry:eq(2)')).toHaveClass 'selected' - - describe "when the last directory of another last directory is selected", -> - [nested, nested2] = [] - - beforeEach -> - nested = treeView.root.find('.directory:eq(2)').view() - expect(nested.find('.header').text()).toContain 'nested' - nested.expand() - nested2 = nested.entries.find('.entry:last').view() - nested2.click() - - describe "when the directory is collapsed", -> - it "selects the entry after its grandparent directory", -> - treeView.trigger 'move-down' - expect(nested.next()).toHaveClass 'selected' - - describe "when the directory is expanded", -> - it "selects the entry after its grandparent directory", -> - nested2.expand() - nested2.find('.file').remove() # kill the .gitkeep file, which has to be there but screws the test - treeView.trigger 'move-down' - expect(nested.next()).toHaveClass 'selected' - - describe "when the last entry of the last directory is selected", -> - it "does not change the selection", -> - lastEntry = treeView.root.find('> .entries .entry:last') - lastEntry.click() - - treeView.trigger 'move-down' - - expect(lastEntry).toHaveClass 'selected' - - describe "move-up", -> - describe "when there is an expanded directory before the currently selected entry", -> - it "selects the last entry in the expanded directory", -> - lastDir = treeView.root.find('.directory:last').view() - fileAfterDir = lastDir.next().view() - lastDir.expand() - fileAfterDir.click() - - treeView.trigger 'move-up' - expect(lastDir.find('.entry:last')).toHaveClass 'selected' - - describe "when there is an entry before the currently selected entry", -> - it "selects the previous entry", -> - lastEntry = treeView.root.find('.entry:last') - lastEntry.click() - - treeView.trigger 'move-up' - - expect(lastEntry.prev()).toHaveClass 'selected' - - describe "when there is no entry before the currently selected entry, but there is a parent directory", -> - it "selects the parent directory", -> - subdir = treeView.root.find('.directory:first').view() - subdir.expand() - subdir.find('> .entries > .entry:first').click() - - treeView.trigger 'move-up' - - expect(subdir).toHaveClass 'selected' - - describe "when there is no parent directory or previous entry", -> - it "does not change the selection", -> - treeView.root.click() - treeView.trigger 'move-up' - expect(treeView.root).toHaveClass 'selected' - - describe "movement outside of viewable region", -> - it "scrolls the tree view to the selected item", -> - treeView.height(100) - treeView.attachToDom() - $(element).view().expand() for element in treeView.find('.directory') - expect(treeView.prop('scrollHeight')).toBeGreaterThan treeView.outerHeight() - - treeView.moveDown() - expect(treeView.scrollTop()).toBe 0 - - entryCount = treeView.find(".entry").length - _.times entryCount, -> treeView.moveDown() - expect(treeView.scrollBottom()).toBe treeView.prop('scrollHeight') - - _.times entryCount, -> treeView.moveUp() - expect(treeView.scrollTop()).toBe 0 - - describe "tree-view:expand-directory", -> - describe "when a directory entry is selected", -> - it "expands the current directory", -> - subdir = treeView.root.find('.directory:first') - subdir.click() - - expect(subdir).not.toHaveClass 'expanded' - treeView.trigger 'tree-view:expand-directory' - expect(subdir).toHaveClass 'expanded' - - describe "when a file entry is selected", -> - it "does nothing", -> - treeView.root.find('.file').click() - treeView.trigger 'tree-view:expand-directory' - - describe "tree-view:collapse-directory", -> - subdir = null - - beforeEach -> - subdir = treeView.root.find('> .entries > .directory').eq(0).view() - subdir.expand() - - describe "when an expanded directory is selected", -> - it "collapses the selected directory", -> - expect(subdir).toHaveClass 'expanded' - - subdir.click() - treeView.trigger 'tree-view:collapse-directory' - - expect(subdir).not.toHaveClass 'expanded' - expect(treeView.root).toHaveClass 'expanded' - - describe "when a collapsed directory is selected", -> - it "collapses and selects the selected directory's parent directory", -> - subdir.find('.directory').click() - treeView.trigger 'tree-view:collapse-directory' - - expect(subdir).not.toHaveClass 'expanded' - expect(subdir).toHaveClass 'selected' - expect(treeView.root).toHaveClass 'expanded' - - describe "when collapsed root directory is selected", -> - it "does not raise an error", -> - treeView.root.collapse() - treeView.selectEntry(treeView.root) - - treeView.trigger 'tree-view:collapse-directory' - - describe "when a file is selected", -> - it "collapses and selects the selected file's parent directory", -> - subdir.find('.file').click() - treeView.trigger 'tree-view:collapse-directory' - - expect(subdir).not.toHaveClass 'expanded' - expect(subdir).toHaveClass 'selected' - expect(treeView.root).toHaveClass 'expanded' - - describe "tree-view:open-selected-entry", -> - describe "when a file is selected", -> - it "opens the file in the editor", -> - treeView.root.find('.file:contains(sample.js)').click() - treeView.root.trigger 'tree-view:open-selected-entry' - expect(rootView.getActiveEditor().getPath()).toBe require.resolve('fixtures/sample.js') - - describe "when a directory is selected", -> - it "expands or collapses the directory", -> - subdir = treeView.root.find('.directory').first() - subdir.click() - - expect(subdir).not.toHaveClass 'expanded' - treeView.root.trigger 'tree-view:open-selected-entry' - expect(subdir).toHaveClass 'expanded' - treeView.root.trigger 'tree-view:open-selected-entry' - expect(subdir).not.toHaveClass 'expanded' - - describe "when nothing is selected", -> - it "does nothing", -> - treeView.root.trigger 'tree-view:open-selected-entry' - expect(rootView.getActiveEditor()).toBeUndefined() - - describe "file modification", -> - [dirView, fileView, rootDirPath, dirPath, filePath] = [] - - beforeEach -> - rootView.deactivate() - - rootDirPath = "/tmp/atom-tests" - fs.remove(rootDirPath) if fs.exists(rootDirPath) - - dirPath = fs.join(rootDirPath, "test-dir") - filePath = fs.join(dirPath, "test-file.txt") - fs.makeDirectory(rootDirPath) - fs.makeDirectory(dirPath) - fs.write(filePath, "doesn't matter") - - rootView = new RootView(rootDirPath) - project = rootView.project - rootView.activateExtension(TreeView) - treeView = rootView.find(".tree-view").view() - dirView = treeView.root.entries.find('.directory:contains(test-dir)').view() - dirView.expand() - fileView = treeView.find('.file:contains(test-file.txt)').view() - - afterEach -> - fs.remove(rootDirPath) if fs.exists(rootDirPath) - - describe "tree-view:add", -> - addDialog = null - - beforeEach -> - fileView.click() - treeView.trigger "tree-view:add" - addDialog = rootView.find(".tree-view-dialog").view() - - describe "when a file is selected", -> - it "opens an add dialog with the file's current directory path populated", -> - expect(addDialog).toExist() - expect(addDialog.prompt.text()).toBeTruthy() - expect(project.relativize(dirPath)).toMatch(/[^\/]$/) - expect(addDialog.miniEditor.getText()).toBe(project.relativize(dirPath) + "/") - expect(addDialog.miniEditor.getCursorBufferPosition().column).toBe addDialog.miniEditor.getText().length - expect(addDialog.miniEditor.isFocused).toBeTruthy() - - describe "when parent directory of the selected file changes", -> - it "active file is still shown as selected in the tree view", -> - directoryChangeHandler = jasmine.createSpy("directory-change") - dirView.on "tree-view:directory-modified", directoryChangeHandler - - dirView.directory.trigger 'contents-change' - expect(directoryChangeHandler).toHaveBeenCalled() - expect(treeView.find('.selected').text()).toBe fs.base(filePath) - - describe "when the path without a trailing '/' is changed and confirmed", -> - describe "when no file exists at that location", -> - it "add a file, closes the dialog and selects the file in the tree-view", -> - newPath = fs.join(dirPath, "new-test-file.txt") - addDialog.miniEditor.insertText(fs.base(newPath)) - addDialog.trigger 'tree-view:confirm' - expect(fs.exists(newPath)).toBeTruthy() - expect(fs.isFile(newPath)).toBeTruthy() - expect(addDialog.parent()).not.toExist() - expect(rootView.getActiveEditor().getPath()).toBe newPath - - waitsFor "tree view to be updated", -> - dirView.entries.find("> .file").length > 1 - - runs -> - expect(treeView.find('.selected').text()).toBe fs.base(newPath) - - describe "when a file already exists at that location", -> - it "shows an error message and does not close the dialog", -> - newPath = fs.join(dirPath, "new-test-file.txt") - fs.write(newPath, '') - addDialog.miniEditor.insertText(fs.base(newPath)) - addDialog.trigger 'tree-view:confirm' - - expect(addDialog.prompt.text()).toContain 'Error' - expect(addDialog.prompt.text()).toContain 'already exists' - expect(addDialog.prompt).toHaveClass('error') - expect(addDialog.hasParent()).toBeTruthy() - - describe "when the path with a trailing '/' is changed and confirmed", -> - describe "when no file or directory exists at the given path", -> - it "adds a directory and closes the dialog", -> - newPath = fs.join(dirPath, "new/dir") - addDialog.miniEditor.insertText("new/dir/") - addDialog.trigger 'tree-view:confirm' - expect(fs.exists(newPath)).toBeTruthy() - expect(fs.isDirectory(newPath)).toBeTruthy() - expect(addDialog.parent()).not.toExist() - expect(rootView.getActiveEditor().getPath()).not.toBe newPath - - describe "when a file or directory already exists at the given path", -> - it "shows an error message and does not close the dialog", -> - newPath = fs.join(dirPath, "new-dir") - fs.makeDirectory(newPath) - addDialog.miniEditor.insertText("new-dir/") - addDialog.trigger 'tree-view:confirm' - - expect(addDialog.prompt.text()).toContain 'Error' - expect(addDialog.prompt.text()).toContain 'already exists' - expect(addDialog.prompt).toHaveClass('error') - expect(addDialog.hasParent()).toBeTruthy() - - describe "when 'tree-view:cancel' is triggered on the add dialog", -> - it "removes the dialog and focuses the tree view", -> - treeView.attachToDom() - addDialog.trigger 'tree-view:cancel' - expect(addDialog.parent()).not.toExist() - expect(treeView).toMatchSelector(':focus') - - describe "when the add dialog's editor loses focus", -> - it "removes the dialog and focuses root view", -> - rootView.attachToDom() - rootView.focus() - expect(addDialog.parent()).not.toExist() - expect(rootView.getActiveEditor().isFocused).toBeTruthy() - - describe "when a directory is selected", -> - it "opens an add dialog with the directory's path populated", -> - addDialog.cancel() - dirView.click() - treeView.trigger "tree-view:add" - addDialog = rootView.find(".tree-view-dialog").view() - - expect(addDialog).toExist() - expect(addDialog.prompt.text()).toBeTruthy() - expect(project.relativize(dirPath)).toMatch(/[^\/]$/) - expect(addDialog.miniEditor.getText()).toBe(project.relativize(dirPath) + "/") - expect(addDialog.miniEditor.getCursorBufferPosition().column).toBe addDialog.miniEditor.getText().length - expect(addDialog.miniEditor.isFocused).toBeTruthy() - - describe "when the root directory is selected", -> - it "opens an add dialog with no path populated", -> - addDialog.cancel() - treeView.root.click() - treeView.trigger "tree-view:add" - addDialog = rootView.find(".tree-view-dialog").view() - - expect(addDialog.miniEditor.getText().length).toBe 0 - - describe "tree-view:move", -> - describe "when a file is selected", -> - moveDialog = null - - beforeEach -> - fileView.click() - treeView.trigger "tree-view:move" - moveDialog = rootView.find(".tree-view-dialog").view() - - it "opens a move dialog with the file's current path (excluding extension) populated", -> - extension = fs.extension(filePath) - fileNameWithoutExtension = fs.base(filePath, extension) - expect(moveDialog).toExist() - expect(moveDialog.prompt.text()).toBe "Enter the new path for the file:" - expect(moveDialog.miniEditor.getText()).toBe(project.relativize(filePath)) - expect(moveDialog.miniEditor.getSelectedText()).toBe fs.base(fileNameWithoutExtension) - expect(moveDialog.miniEditor.isFocused).toBeTruthy() - - describe "when the path is changed and confirmed", -> - describe "when all the directories along the new path exist", -> - it "moves the file, updates the tree view, and closes the dialog", -> - newPath = fs.join(rootDirPath, 'renamed-test-file.txt') - moveDialog.miniEditor.setText(newPath) - - moveDialog.trigger 'tree-view:confirm' - - expect(fs.exists(newPath)).toBeTruthy() - expect(fs.exists(filePath)).toBeFalsy() - expect(moveDialog.parent()).not.toExist() - - waitsFor "tree view to update", -> - treeView.root.find('> .entries > .file:contains(renamed-test-file.txt)').length > 0 - - runs -> - dirView = treeView.root.entries.find('.directory:contains(test-dir)').view() - dirView.expand() - expect(dirView.entries.children().length).toBe 0 - - describe "when the directories along the new path don't exist", -> - it "creates the target directory before moving the file", -> - newPath = fs.join(rootDirPath, 'new/directory', 'renamed-test-file.txt') - moveDialog.miniEditor.setText(newPath) - - moveDialog.trigger 'tree-view:confirm' - - expect(fs.exists(newPath)).toBeTruthy() - expect(fs.exists(filePath)).toBeFalsy() - - waits 50 # TODO: remove this workaround once we fix the race condition in fs events - - describe "when a file or directory already exists at the target path", -> - it "shows an error message and does not close the dialog", -> - runs -> - fs.write(fs.join(rootDirPath, 'target.txt'), '') - newPath = fs.join(rootDirPath, 'target.txt') - moveDialog.miniEditor.setText(newPath) - - moveDialog.trigger 'tree-view:confirm' - - expect(moveDialog.prompt.text()).toContain 'Error' - expect(moveDialog.prompt.text()).toContain 'already exists' - expect(moveDialog.prompt).toHaveClass('error') - expect(moveDialog.hasParent()).toBeTruthy() - - describe "when 'tree-view:cancel' is triggered on the move dialog", -> - it "removes the dialog and focuses the tree view", -> - treeView.attachToDom() - moveDialog.trigger 'tree-view:cancel' - expect(moveDialog.parent()).not.toExist() - expect(treeView).toMatchSelector(':focus') - - describe "when the move dialog's editor loses focus", -> - it "removes the dialog and focuses root view", -> - rootView.attachToDom() - rootView.focus() - expect(moveDialog.parent()).not.toExist() - expect(rootView.getActiveEditor().isFocused).toBeTruthy() - - describe "tree-view:remove", -> - it "shows the native alert dialog", -> - fileView.click() - spyOn(Native, 'alert') - treeView.trigger 'tree-view:remove' - expect(Native.alert).toHaveBeenCalled() - - describe "file system events", -> - temporaryFilePath = null - - beforeEach -> - temporaryFilePath = fs.join(require.resolve('fixtures'), 'temporary') - if fs.exists(temporaryFilePath) - fs.remove(temporaryFilePath) - waits(20) - - afterEach -> - fs.remove(temporaryFilePath) if fs.exists(temporaryFilePath) - - describe "when a file is added or removed in an expanded directory", -> - it "updates the directory view to display the directory's new contents", -> - entriesCountBefore = null - - runs -> - expect(fs.exists(temporaryFilePath)).toBeFalsy() - entriesCountBefore = treeView.root.entries.find('.entry').length - fs.write temporaryFilePath, 'hi' - - waitsFor "directory view contens to refresh", -> - treeView.root.entries.find('.entry').length == entriesCountBefore + 1 - - runs -> - expect(treeView.root.entries.find('.entry').length).toBe entriesCountBefore + 1 - expect(treeView.root.entries.find('.file:contains(temporary)')).toExist() - fs.remove(temporaryFilePath) - - waitsFor "directory view contens to refresh", -> - treeView.root.entries.find('.entry').length == entriesCountBefore diff --git a/spec/extensions/vim-mode-spec.coffee b/spec/extensions/vim-mode-spec.coffee deleted file mode 100644 index c74826a6d..000000000 --- a/spec/extensions/vim-mode-spec.coffee +++ /dev/null @@ -1,324 +0,0 @@ -Editor = require 'editor' -VimMode = require 'vim-mode' - -xdescribe "VimMode", -> - [editor, vimMode] = [] - - beforeEach -> - editor = new Editor - editor.enableKeymap() - editor.isFocused = true - vimMode = new VimMode(editor) - - describe "initialize", -> - it "puts the editor in command-mode initially", -> - expect(editor).toHaveClass 'command-mode' - - describe "command-mode", -> - it "stops propagation on key events would otherwise insert a character, but allows unhandled non-insertions through", -> - event = keydownEvent('\\') - spyOn(event, 'stopPropagation') - editor.trigger event - expect(event.stopPropagation).toHaveBeenCalled() - - event = keydownEvent('/', metaKey: true) - spyOn(event, 'stopPropagation') - editor.trigger event - expect(event.stopPropagation).not.toHaveBeenCalled() - - it "does not allow the cursor to be placed on the \n character, unless the line is empty", -> - editor.setText("012345\n\nabcdef") - editor.setCursorScreenPosition([0, 5]) - expect(editor.getCursorScreenPosition()).toEqual [0,5] - - editor.setCursorScreenPosition([0, 6]) - expect(editor.getCursorScreenPosition()).toEqual [0,5] - - editor.setCursorScreenPosition([1, 0]) - expect(editor.getCursorScreenPosition()).toEqual [1,0] - - it "clears the operator stack when commands can't be composed", -> - editor.trigger keydownEvent('d') - expect(vimMode.opStack.length).toBe 1 - editor.trigger keydownEvent('x') - expect(vimMode.opStack.length).toBe 0 - - editor.trigger keydownEvent('d') - expect(vimMode.opStack.length).toBe 1 - editor.trigger keydownEvent('\\') # \ is an unused key in vim - expect(vimMode.opStack.length).toBe 0 - - describe "the escape keybinding", -> - it "clears the operator stack", -> - editor.trigger keydownEvent('d') - expect(vimMode.opStack.length).toBe 1 - - editor.trigger keydownEvent('escape') - expect(vimMode.opStack.length).toBe 0 - - describe "the i keybinding", -> - it "puts the editor into insert mode", -> - expect(editor).not.toHaveClass 'insert-mode' - - editor.trigger keydownEvent('i') - - expect(editor).toHaveClass 'insert-mode' - expect(editor).not.toHaveClass 'command-mode' - - describe "the x keybinding", -> - it "deletes a charachter", -> - editor.setText("012345") - editor.setCursorScreenPosition([0, 4]) - - editor.trigger keydownEvent('x') - expect(editor.getText()).toBe '01235' - expect(editor.getCursorScreenPosition()).toEqual([0, 4]) - - editor.trigger keydownEvent('x') - expect(editor.getText()).toBe '0123' - expect(editor.getCursorScreenPosition()).toEqual([0, 3]) - - editor.trigger keydownEvent('x') - expect(editor.getText()).toBe '012' - expect(editor.getCursorScreenPosition()).toEqual([0, 2]) - - it "deletes nothing when cursor is on empty line", -> - editor.getBuffer().setText "012345\n\nabcdef" - editor.setCursorScreenPosition [1, 0] - - editor.trigger keydownEvent 'x' - expect(editor.getText()).toBe "012345\n\nabcdef" - - describe "the d keybinding", -> - describe "when followed by a d", -> - it "deletes the current line", -> - editor.setText("12345\nabcde\nABCDE") - editor.setCursorScreenPosition([1,1]) - - editor.trigger keydownEvent('d') - editor.trigger keydownEvent('d') - expect(editor.getText()).toBe "12345\nABCDE" - expect(editor.getCursorScreenPosition()).toEqual([1,0]) - - it "deletes the last line", -> - editor.setText("12345\nabcde\nABCDE") - editor.setCursorScreenPosition([2,1]) - editor.trigger keydownEvent('d') - editor.trigger keydownEvent('d') - expect(editor.getText()).toBe "12345\nabcde" - expect(editor.getCursorScreenPosition()).toEqual([1,0]) - - xdescribe "when the second d is prefixed by a count", -> - it "deletes n lines, starting from the current", -> - editor.setText("12345\nabcde\nABCDE\nQWERT") - editor.setCursorScreenPosition([1,1]) - - editor.trigger keydownEvent('d') - editor.trigger keydownEvent('2') - editor.trigger keydownEvent('d') - - expect(editor.getText()).toBe "12345\nQWERT" - expect(editor.getCursorScreenPosition()).toEqual([1,0]) - - describe "when followed by an h", -> - it "deletes the previous letter on the current line", -> - editor.setText("abcd\n01234") - editor.setCursorScreenPosition([1,1]) - - editor.trigger keydownEvent 'd' - editor.trigger keydownEvent 'h' - - expect(editor.getText()).toBe "abcd\n1234" - expect(editor.getCursorScreenPosition()).toEqual([1,0]) - - editor.trigger keydownEvent 'd' - editor.trigger keydownEvent 'h' - - expect(editor.getText()).toBe "abcd\n1234" - expect(editor.getCursorScreenPosition()).toEqual([1,0]) - - describe "when followed by a w", -> - it "deletes to the beginning of the next word", -> - editor.setText("abcd efg") - editor.setCursorScreenPosition([0,2]) - - editor.trigger keydownEvent('d') - editor.trigger keydownEvent('w') - - expect(editor.getText()).toBe "abefg" - expect(editor.getCursorScreenPosition()).toEqual([0,2]) - - editor.setText("one two three four") - editor.setCursorScreenPosition([0,0]) - - editor.trigger keydownEvent('d') - editor.trigger keydownEvent('3') - editor.trigger keydownEvent('w') - - expect(editor.getText()).toBe "four" - expect(editor.getCursorScreenPosition()).toEqual([0,0]) - - describe "when followed by a b", -> - it "deletes to the beginning of the previous word", -> - editor.setText("abcd efg") - editor.setCursorScreenPosition([0,2]) - - editor.trigger keydownEvent('d') - editor.trigger keydownEvent('b') - - expect(editor.getText()).toBe "cd efg" - expect(editor.getCursorScreenPosition()).toEqual([0,0]) - - editor.setText("one two three four") - editor.setCursorScreenPosition([0,11]) - - editor.trigger keydownEvent('d') - editor.trigger keydownEvent('3') - editor.trigger keydownEvent('b') - - expect(editor.getText()).toBe "ee four" - expect(editor.getCursorScreenPosition()).toEqual([0,0]) - - describe "basic motion bindings", -> - beforeEach -> - editor.setText("12345\nabcde\nABCDE") - editor.setCursorScreenPosition([1,1]) - - describe "the h keybinding", -> - it "moves the cursor left, but not to the previous line", -> - editor.trigger keydownEvent('h') - expect(editor.getCursorScreenPosition()).toEqual([1,0]) - editor.trigger keydownEvent('h') - expect(editor.getCursorScreenPosition()).toEqual([1,0]) - - describe "the j keybinding", -> - it "moves the cursor down, but not to the end of the last line", -> - editor.trigger keydownEvent 'j' - expect(editor.getCursorScreenPosition()).toEqual([2,1]) - editor.trigger keydownEvent 'j' - expect(editor.getCursorScreenPosition()).toEqual([2,1]) - - describe "the k keybinding", -> - it "moves the cursor up, but not to the beginning of the first line", -> - editor.trigger keydownEvent('k') - expect(editor.getCursorScreenPosition()).toEqual([0,1]) - editor.trigger keydownEvent('k') - expect(editor.getCursorScreenPosition()).toEqual([0,1]) - - describe "the l keybinding", -> - it "moves the cursor right, but not to the next line", -> - editor.setCursorScreenPosition([1,3]) - editor.trigger keydownEvent('l') - expect(editor.getCursorScreenPosition()).toEqual([1,4]) - editor.trigger keydownEvent('l') - expect(editor.getCursorScreenPosition()).toEqual([1,4]) - - describe "the w keybinding", -> - it "moves the cursor to the beginning of the next word", -> - editor.setText("ab cde1+- \n xyz\n\nzip") - editor.setCursorScreenPosition([0,0]) - - editor.trigger keydownEvent('w') - expect(editor.getCursorScreenPosition()).toEqual([0,3]) - - editor.trigger keydownEvent('w') - expect(editor.getCursorScreenPosition()).toEqual([0,7]) - - editor.trigger keydownEvent('w') - expect(editor.getCursorScreenPosition()).toEqual([1,1]) - - editor.trigger keydownEvent('w') - expect(editor.getCursorScreenPosition()).toEqual([2,0]) - - editor.trigger keydownEvent('w') - expect(editor.getCursorScreenPosition()).toEqual([3,0]) - - editor.trigger keydownEvent('w') - expect(editor.getCursorScreenPosition()).toEqual([3,2]) - - describe "the { keybinding", -> - it "moves the cursor to the beginning of the paragraph", -> - editor.setText("abcde\n\nfghij\nhijk\n xyz \n\nzip\n\n \nthe end") - editor.setCursorScreenPosition([0,0]) - - editor.trigger keydownEvent('}') - expect(editor.getCursorScreenPosition()).toEqual [1,0] - - editor.trigger keydownEvent('}') - expect(editor.getCursorScreenPosition()).toEqual [5,0] - - editor.trigger keydownEvent('}') - expect(editor.getCursorScreenPosition()).toEqual [7,0] - - editor.trigger keydownEvent('}') - expect(editor.getCursorScreenPosition()).toEqual [9,6] - - describe "the b keybinding", -> - it "moves the cursor to the beginning of the previous word", -> - editor.setText(" ab cde1+- \n xyz\n\nzip }\n last") - editor.setCursorScreenPosition [4,1] - - editor.trigger keydownEvent('b') - expect(editor.getCursorScreenPosition()).toEqual [3,4] - - editor.trigger keydownEvent('b') - expect(editor.getCursorScreenPosition()).toEqual [3,0] - - editor.trigger keydownEvent('b') - expect(editor.getCursorScreenPosition()).toEqual [2,0] - - editor.trigger keydownEvent('b') - expect(editor.getCursorScreenPosition()).toEqual [1,1] - - editor.trigger keydownEvent('b') - expect(editor.getCursorScreenPosition()).toEqual [0,8] - - editor.trigger keydownEvent('b') - expect(editor.getCursorScreenPosition()).toEqual [0,4] - - editor.trigger keydownEvent('b') - expect(editor.getCursorScreenPosition()).toEqual [0,1] - - editor.trigger keydownEvent('b') - expect(editor.getCursorScreenPosition()).toEqual [0,0] - - editor.trigger keydownEvent('b') - expect(editor.getCursorScreenPosition()).toEqual [0,0] - - describe "numeric prefix bindings", -> - it "repeats the following operation N times", -> - editor.setText("12345") - editor.setCursorScreenPosition([0,1]) - - editor.trigger keydownEvent('3') - editor.trigger keydownEvent('x') - - expect(editor.getText()).toBe '15' - - editor.setText("123456789abc") - editor.setCursorScreenPosition([0,0]) - editor.trigger keydownEvent('1') - editor.trigger keydownEvent('0') - editor.trigger keydownEvent('x') - - expect(editor.getText()).toBe 'bc' - - describe "insert-mode", -> - beforeEach -> - editor.trigger keydownEvent('i') - - it "allows the cursor to reach the end of the line", -> - editor.setText("012345\n\nabcdef") - editor.setCursorScreenPosition([0, 5]) - expect(editor.getCursorScreenPosition()).toEqual [0,5] - - editor.setCursorScreenPosition([0, 6]) - expect(editor.getCursorScreenPosition()).toEqual [0,6] - - it "puts the editor into command mode when is pressed", -> - expect(editor).not.toHaveClass 'command-mode' - - editor.trigger keydownEvent('escape') - - expect(editor).toHaveClass 'command-mode' - expect(editor).not.toHaveClass 'insert-mode' diff --git a/spec/fixtures/coffee.coffee b/spec/fixtures/coffee.coffee deleted file mode 100644 index b8367ca59..000000000 --- a/spec/fixtures/coffee.coffee +++ /dev/null @@ -1,23 +0,0 @@ -class quicksort - sort: (items) -> - return items if items.length <= 1 - - pivot = items.shift() - left = [] - right = [] - - # Comment in the middle - - while items.length > 0 - current = items.shift() - if current < pivot - left.push(current) - else - right.push(current); - - sort(left).concat(pivot).concat(sort(right)) - - noop: -> - # just a noop - -exports.modules = quicksort diff --git a/spec/fixtures/dir/a b/spec/fixtures/dir/a deleted file mode 100644 index 9bda1cbd0..000000000 --- a/spec/fixtures/dir/a +++ /dev/null @@ -1,2 +0,0 @@ -aaa bbb -cc aa cc diff --git a/spec/fixtures/dir/a-dir/oh-git b/spec/fixtures/dir/a-dir/oh-git deleted file mode 100644 index 64998f776..000000000 --- a/spec/fixtures/dir/a-dir/oh-git +++ /dev/null @@ -1 +0,0 @@ -bbb aaaa \ No newline at end of file diff --git a/spec/fixtures/dir/b b/spec/fixtures/dir/b deleted file mode 100644 index f2c4fd35c..000000000 --- a/spec/fixtures/dir/b +++ /dev/null @@ -1 +0,0 @@ -aaa ccc diff --git a/spec/fixtures/evil-files/a_file_with_utf8.txt b/spec/fixtures/evil-files/a_file_with_utf8.txt deleted file mode 100644 index a811bd702..000000000 --- a/spec/fixtures/evil-files/a_file_with_utf8.txt +++ /dev/null @@ -1 +0,0 @@ -I am evil because there's a UTF-8 character right here: ă diff --git a/spec/fixtures/evil-files/file with spaces.txt b/spec/fixtures/evil-files/file with spaces.txt deleted file mode 100644 index 140c7bf61..000000000 --- a/spec/fixtures/evil-files/file with spaces.txt +++ /dev/null @@ -1 +0,0 @@ -I am evil because there are spaces in my name diff --git "a/spec/fixtures/evil-files/goddam\nnewlines" "b/spec/fixtures/evil-files/goddam\nnewlines" deleted file mode 100644 index 00c5620b8..000000000 --- "a/spec/fixtures/evil-files/goddam\nnewlines" +++ /dev/null @@ -1 +0,0 @@ -I am evil because there's a newline in my name diff --git "a/spec/fixtures/evil-files/quote\".txt" "b/spec/fixtures/evil-files/quote\".txt" deleted file mode 100644 index 5e51d8e20..000000000 --- "a/spec/fixtures/evil-files/quote\".txt" +++ /dev/null @@ -1 +0,0 @@ -I am evil because there's a " in my filename. Why you do that!? \ No newline at end of file diff --git a/spec/fixtures/evil-files/utfă.md b/spec/fixtures/evil-files/utfă.md deleted file mode 100644 index 782a5bf5a..000000000 --- a/spec/fixtures/evil-files/utfă.md +++ /dev/null @@ -1 +0,0 @@ -I am evil because there's a UTF-8 character in my name diff --git a/spec/fixtures/sample-with-tabs.coffee b/spec/fixtures/sample-with-tabs.coffee deleted file mode 100644 index 1b937ea33..000000000 --- a/spec/fixtures/sample-with-tabs.coffee +++ /dev/null @@ -1,4 +0,0 @@ -# Econ 101 -if this.studyingEconomics - buy() while supply > demand - sell() until supply > demand diff --git a/spec/fixtures/sample.js b/spec/fixtures/sample.js deleted file mode 100644 index fb33b0b43..000000000 --- a/spec/fixtures/sample.js +++ /dev/null @@ -1,13 +0,0 @@ -var quicksort = function () { - var sort = function(items) { - if (items.length <= 1) return items; - var pivot = items.shift(), current, left = [], right = []; - while(items.length > 0) { - current = items.shift(); - current < pivot ? left.push(current) : right.push(current); - } - return sort(left).concat(pivot).concat(sort(right)); - }; - - return sort(Array.apply(this, arguments)); -}; \ No newline at end of file diff --git a/spec/fixtures/sample.txt b/spec/fixtures/sample.txt deleted file mode 100644 index 3e715502b..000000000 --- a/spec/fixtures/sample.txt +++ /dev/null @@ -1 +0,0 @@ -Some text. diff --git a/spec/fixtures/two-hundred.txt b/spec/fixtures/two-hundred.txt deleted file mode 100644 index 9001290d1..000000000 --- a/spec/fixtures/two-hundred.txt +++ /dev/null @@ -1,200 +0,0 @@ -0 -1 -2 -3 -4---------------------------------------------------------------------------------------------------- -5 -6 -7 -8 -9---------------------------------------------------------------------------------------------------- -10 -11 -12 -13 -14---------------------------------------------------------------------------------------------------- -15 -16 -17 -18 -19---------------------------------------------------------------------------------------------------- -20 -21 -22 -23 -24---------------------------------------------------------------------------------------------------- -25 -26 -27 -28 -29---------------------------------------------------------------------------------------------------- -30 -31 -32 -33 -34---------------------------------------------------------------------------------------------------- -35 -36 -37 -38 -39---------------------------------------------------------------------------------------------------- -40 -41 -42 -43 -44---------------------------------------------------------------------------------------------------- -45 -46 -47 -48 -49---------------------------------------------------------------------------------------------------- -50 -51 -52 -53 -54---------------------------------------------------------------------------------------------------- -55 -56 -57 -58 -59---------------------------------------------------------------------------------------------------- -60 -61 -62 -63 -64---------------------------------------------------------------------------------------------------- -65 -66 -67 -68 -69---------------------------------------------------------------------------------------------------- -70 -71 -72 -73 -74---------------------------------------------------------------------------------------------------- -75 -76 -77 -78 -79---------------------------------------------------------------------------------------------------- -80 -81 -82 -83 -84---------------------------------------------------------------------------------------------------- -85 -86 -87 -88 -89---------------------------------------------------------------------------------------------------- -90 -91 -92 -93 -94---------------------------------------------------------------------------------------------------- -95 -96 -97 -98 -99---------------------------------------------------------------------------------------------------- -100 -101 -102 -103 -104---------------------------------------------------------------------------------------------------- -105 -106 -107 -108 -109---------------------------------------------------------------------------------------------------- -110 -111 -112 -113 -114---------------------------------------------------------------------------------------------------- -115 -116 -117 -118 -119---------------------------------------------------------------------------------------------------- -120 -121 -122 -123 -124---------------------------------------------------------------------------------------------------- -125 -126 -127 -128 -129---------------------------------------------------------------------------------------------------- -130 -131 -132 -133 -134---------------------------------------------------------------------------------------------------- -135 -136 -137 -138 -139---------------------------------------------------------------------------------------------------- -140 -141 -142 -143 -144---------------------------------------------------------------------------------------------------- -145 -146 -147 -148 -149---------------------------------------------------------------------------------------------------- -150 -151 -152 -153 -154---------------------------------------------------------------------------------------------------- -155 -156 -157 -158 -159---------------------------------------------------------------------------------------------------- -160 -161 -162 -163 -164---------------------------------------------------------------------------------------------------- -165 -166 -167 -168 -169---------------------------------------------------------------------------------------------------- -170 -171 -172 -173 -174---------------------------------------------------------------------------------------------------- -175 -176 -177 -178 -179---------------------------------------------------------------------------------------------------- -180 -181 -182 -183 -184---------------------------------------------------------------------------------------------------- -185 -186 -187 -188 -189---------------------------------------------------------------------------------------------------- -190 -191 -192 -193 -194---------------------------------------------------------------------------------------------------- -195 -196 -197 -198 -199---------------------------------------------------------------------------------------------------- diff --git a/spec/fixtures/zed/a b/spec/fixtures/zed/a deleted file mode 100644 index 789819226..000000000 --- a/spec/fixtures/zed/a +++ /dev/null @@ -1 +0,0 @@ -a diff --git a/spec/spec-bootstrap.coffee b/spec/spec-bootstrap.coffee deleted file mode 100644 index 7a0f30cba..000000000 --- a/spec/spec-bootstrap.coffee +++ /dev/null @@ -1,4 +0,0 @@ -{runSpecSuite} = require 'jasmine-helper' - -document.title = "Spec Suite" -runSpecSuite "spec-suite" diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee deleted file mode 100644 index acddcb475..000000000 --- a/spec/spec-helper.coffee +++ /dev/null @@ -1,181 +0,0 @@ -nakedLoad 'jasmine-jquery' -$ = require 'jquery' -_ = require 'underscore' -Keymap = require 'keymap' -Point = require 'point' -Project = require 'project' -Directory = require 'directory' -File = require 'file' -RootView = require 'root-view' -TextMateBundle = require 'text-mate-bundle' -TextMateTheme = require 'text-mate-theme' -fs = require 'fs' -require 'window' -$native.showDevTools() - -requireStylesheet "jasmine.css" -TextMateBundle.loadAll() -TextMateTheme.loadAll() - -defaultTitle = document.title -pathsWithSubscriptions = null - -beforeEach -> - window.fixturesProject = new Project(require.resolve('fixtures')) - window.resetTimeouts() - pathsWithSubscriptions = [] - -afterEach -> - delete window.rootView if window.rootView - $('#jasmine-content').empty() - document.title = defaultTitle - ensureNoPathSubscriptions() - window.fixturesProject.destroy() - -window.keymap.bindKeys '*', 'meta-w': 'close' -$(document).on 'close', -> window.close() - -# Don't load user configuration in specs, because it's variable -RootView.prototype.loadUserConfiguration = -> - -for klass in [Directory, File] - klass.prototype.originalOn = klass.prototype.on - klass.prototype.on = (args...) -> - pathsWithSubscriptions.push(this) if @subscriptionCount() == 0 - @originalOn(args...) - -ensureNoPathSubscriptions = -> - totalSubscriptionCount = 0 - for path in pathsWithSubscriptions - totalSubscriptionCount += path.subscriptionCount() - console.log "Non-zero subscription count on", path if path.subscriptionCount() > 0 - - if totalSubscriptionCount > 0 - throw new Error("Total path subscription count was #{totalSubscriptionCount}, when it should have been 0.\nSee console for details.") - -# Use underscore's definition of equality for toEqual assertions -jasmine.Env.prototype.equals_ = _.isEqual - -emitObject = jasmine.StringPrettyPrinter.prototype.emitObject -jasmine.StringPrettyPrinter.prototype.emitObject = (obj) -> - if obj.inspect - @append obj.inspect() - else - emitObject.call(this, obj) - -window.keyIdentifierForKey = (key) -> - if key.length > 1 # named key - key - else - charCode = key.toUpperCase().charCodeAt(0) - "U+00" + charCode.toString(16) - -window.keydownEvent = (key, properties={}) -> - event = $.Event "keydown", _.extend({originalEvent: { keyIdentifier: keyIdentifierForKey(key) }}, properties) - # event.keystroke = (new Keymap).keystrokeStringForEvent(event) - event - -window.mouseEvent = (type, properties) -> - if properties.point - {point, editor} = properties - {top, left} = @pagePixelPositionForPoint(editor, point) - properties.pageX = left + 1 - properties.pageY = top + 1 - properties.originalEvent ?= {detail: 1} - $.Event type, properties - -window.clickEvent = (properties={}) -> - window.mouseEvent("click", properties) - -window.mousedownEvent = (properties={}) -> - window.mouseEvent('mousedown', properties) - -window.mousemoveEvent = (properties={}) -> - window.mouseEvent('mousemove', properties) - -window.waitsForPromise = (args...) -> - if args.length > 1 - { shouldReject } = args[0] - else - shouldReject = false - fn = _.last(args) - - window.waitsFor (moveOn) -> - promise = fn() - if shouldReject - promise.fail(moveOn) - promise.done -> - jasmine.getEnv().currentSpec.fail("Expected promise to be rejected, but it was resolved") - moveOn() - else - promise.done(moveOn) - promise.fail (error) -> - jasmine.getEnv().currentSpec.fail("Expected promise to be resolved, but it was rejected with #{jasmine.pp(error)}") - moveOn() - -window.resetTimeouts = -> - window.now = 0 - window.timeoutCount = 0 - window.timeouts = [] - -window.originalSetTimeout = window.setTimeout -window.setTimeout = (callback, ms) -> - id = ++window.timeoutCount - window.timeouts.push([id, window.now + ms, callback]) - id - -window.clearTimeout = (idToClear) -> - window.timeouts = window.timeouts.filter ([id]) -> id != idToClear - -window.advanceClock = (delta=1) -> - window.now += delta - window.timeouts = window.timeouts.filter ([id, strikeTime, callback]) -> - if strikeTime <= window.now - callback() - false - else - true - -window.pagePixelPositionForPoint = (editor, point) -> - point = Point.fromObject point - top = editor.renderedLines.offset().top + point.row * editor.lineHeight - left = editor.renderedLines.offset().left + point.column * editor.charWidth - editor.renderedLines.scrollLeft() - { top, left } - -window.tokensText = (tokens) -> - _.pluck(tokens, 'value').join('') - -window.setEditorWidthInChars = (editor, widthInChars, charWidth=editor.charWidth) -> - editor.width(charWidth * widthInChars + editor.renderedLines.position().left) - $(window).trigger 'resize' # update width of editor's on-screen lines - -window.setEditorHeightInLines = (editor, heightInChars, charHeight=editor.lineHeight) -> - editor.height(charHeight * heightInChars + editor.renderedLines.position().top) - $(window).trigger 'resize' # update editor's on-screen lines - -$.fn.resultOfTrigger = (type) -> - event = $.Event(type) - this.trigger(event) - event.result - -$.fn.enableKeymap = -> - @on 'keydown', (e) => window.keymap.handleKeyEvent(e) - -$.fn.attachToDom = -> - $('#jasmine-content').append(this) - -$.fn.simulateDomAttachment = -> - $('').append(this) - -$.fn.textInput = (data) -> - this.each -> - event = document.createEvent('TextEvent') - event.initTextEvent('textInput', true, true, window, data) - event = jQuery.event.fix(event) - $(this).trigger(event) - -$.fn.simulateDomAttachment = -> - $('').append(this) - -unless fs.md5ForPath(require.resolve('fixtures/sample.js')) == "dd38087d0d7e3e4802a6d3f9b9745f2b" - throw "Sample.js is modified" diff --git a/spec/spec-suite.coffee b/spec/spec-suite.coffee deleted file mode 100644 index 90079cd6a..000000000 --- a/spec/spec-suite.coffee +++ /dev/null @@ -1,4 +0,0 @@ -fs = require 'fs' -require 'spec-helper' - -require path for path in fs.listTree(atom.loadPath + "/spec") when /-spec\.coffee$/.test path diff --git a/spec/stdlib/child-process-spec.coffee b/spec/stdlib/child-process-spec.coffee deleted file mode 100644 index 7d57a21cb..000000000 --- a/spec/stdlib/child-process-spec.coffee +++ /dev/null @@ -1,94 +0,0 @@ -ChildProcess = require 'child-process' - -describe 'Child Processes', -> - describe ".exec(command, options)", -> - [stderrHandler, stdoutHandler] = [] - - beforeEach -> - stderrHandler = jasmine.createSpy "stderrHandler" - stdoutHandler = jasmine.createSpy "stdoutHandler" - - it "returns a promise that resolves to stdout and stderr", -> - waitsForPromise -> - cmd = "echo 'good' && echo 'bad' >&2" - ChildProcess.exec(cmd).done (stdout, stderr) -> - expect(stdout).toBe 'good\n' - expect(stderr).toBe 'bad\n' - - describe "when options are given", -> - it "calls the options.stdout callback when new data is received on stdout", -> - cmd = "echo 'first' && sleep .1 && echo 'second' && sleep .1 && echo 'third'" - ChildProcess.exec(cmd, stdout: stdoutHandler) - - waitsFor -> - stdoutHandler.callCount > 2 - - runs -> - expect(stdoutHandler.argsForCall[0][0]).toBe "first\n" - expect(stdoutHandler.argsForCall[1][0]).toBe "second\n" - expect(stdoutHandler.argsForCall[2][0]).toBe "third\n" - - it "calls the options.stderr callback when new data is received on stderr", -> - cmd = "echo '1111' >&2 && sleep .1 && echo '2222' >&2" - ChildProcess.exec(cmd, stderr: stderrHandler) - - waitsFor -> - stderrHandler.callCount > 1 - - runs -> - expect(stderrHandler.argsForCall[0][0]).toBe "1111\n" - expect(stderrHandler.argsForCall[1][0]).toBe "2222\n" - - describe "when the `bufferLines` option is true ", -> - [simulateStdout, simulateStderr] = [] - - beforeEach -> - spyOn($native, 'exec') - ChildProcess.exec("print_the_things", bufferLines: true, stdout: stdoutHandler, stderr: stderrHandler) - { stdout, stderr } = $native.exec.argsForCall[0][1] - simulateStdout = stdout - simulateStderr = stderr - - it "only triggers stdout callbacks with complete lines", -> - simulateStdout """ - I am a full line - I am part of """ - - expect(stdoutHandler).toHaveBeenCalledWith("I am a full line\n") - stdoutHandler.reset() - - simulateStdout """ - a line - I am another full line\n - """ - - expect(stdoutHandler).toHaveBeenCalledWith """ - I am part of a line - I am another full line\n - """ - - it "only triggers stderr callbacks with complete lines", -> - simulateStderr """ - I am a full line - I am part of """ - - expect(stderrHandler).toHaveBeenCalledWith("I am a full line\n") - stdoutHandler.reset() - - simulateStderr """ - a line - I am another full line\n - """ - - expect(stderrHandler).toHaveBeenCalledWith """ - I am part of a line - I am another full line\n - """ - - describe "when the command fails", -> - it "executes the callback with error set to the exit status", -> - waitsForPromise shouldReject: true, -> - cmd = "echo 'bad' >&2 && exit 2" - ChildProcess.exec(cmd).fail (error) -> - expect(error.exitStatus).toBe 2 - expect(error.stderr).toBe "bad\n" diff --git a/spec/stdlib/fs-spec.coffee b/spec/stdlib/fs-spec.coffee deleted file mode 100644 index f5abc6c38..000000000 --- a/spec/stdlib/fs-spec.coffee +++ /dev/null @@ -1,115 +0,0 @@ -fs = require 'fs' - -describe "fs", -> - describe ".isFile(path)", -> - fixturesDir = require.resolve('fixtures') - - it "returns true with a file path", -> - expect(fs.isFile(fs.join(fixturesDir, 'sample.js'))).toBe true - - it "returns false with a directory path", -> - expect(fs.isFile(fixturesDir)).toBe false - - it "returns false with a non-existent path", -> - expect(fs.isFile(fs.join(fixturesDir, 'non-existent'))).toBe false - expect(fs.isFile(null)).toBe false - - describe ".directory(path)", -> - describe "when called with a file path", -> - it "returns the path to the directory", -> - expect(fs.directory(require.resolve('fixtures/dir/a'))).toBe require.resolve('fixtures/dir') - - describe "when called with a directory path", -> - it "return the path it was given", -> - expect(fs.directory("/a/b/c")).toBe "/a/b" - expect(fs.directory("/a")).toBe "" - expect(fs.directory("a")).toBe "" - - describe ".exists(path)", -> - it "returns true when path exsits", -> - expect(fs.exists(require.resolve('fixtures'))).toBe true - - it "returns false when path doesn't exsit", -> - expect(fs.exists(require.resolve("fixtures") + "/-nope-does-not-exist")).toBe false - expect(fs.exists("")).toBe false - expect(fs.exists(null)).toBe false - - describe ".join(paths...)", -> - it "concatenates the given paths with the directory seperator", -> - expect(fs.join('a')).toBe 'a' - expect(fs.join('a', 'b', 'c')).toBe 'a/b/c' - expect(fs.join('/a/b/', 'c', 'd')).toBe '/a/b/c/d' - expect(fs.join('a', 'b/c/', 'd/')).toBe 'a/b/c/d/' - - describe ".split(path)", -> - it "returns path components", -> - expect(fs.split("/a/b/c.txt")).toEqual ["", "a", "b", "c.txt"] - expect(fs.split("a/b/c.txt")).toEqual ["a", "b", "c.txt"] - - describe ".extension(path)", -> - it "returns the extension of a file", -> - expect(fs.extension("a/b/corey.txt")).toBe '.txt' - expect(fs.extension("a/b/corey.txt.coffee")).toBe '.coffee' - - it "returns an empty string for paths without an extension", -> - expect(fs.extension("a/b.not-extension/a-dir")).toBe '' - - describe "makeTree(path)", -> - beforeEach -> - fs.remove("/tmp/a") if fs.exists("/tmp/a") - - it "creates all directories in path including any missing parent directories", -> - fs.makeTree("/tmp/a/b/c") - expect(fs.exists("/tmp/a/b/c")).toBeTruthy() - - describe ".traverseTree(path, fn)", -> - fixturesDir = null - - beforeEach -> - fixturesDir = require.resolve('fixtures') - - it "calls fn for every path in the tree at the given path", -> - paths = [] - fs.traverseTree fixturesDir, (path) -> paths.push(path) - expect(paths).toEqual fs.listTree(fixturesDir) - - it "does not recurse into a directory if it is pruned", -> - paths = [] - fs.traverseTree fixturesDir, (path, prune) -> - if path.match(/\/dir$/) - prune() - else - paths.push(path) - - expect(paths.length).toBeGreaterThan 0 - for path in paths - expect(path).not.toMatch /dir/ - - describe ".lastModified(path)", -> - it "returns a Date object representing the time the file was last modified", -> - beforeWrite = new Date - fs.write('/tmp/foo', '') - lastModified = fs.lastModified('/tmp/foo') - expect(lastModified instanceof Date).toBeTruthy() - expect(lastModified.getTime()).toBeGreaterThan(beforeWrite.getTime() - 1000) - - describe ".md5ForPath(path)", -> - it "returns the MD5 hash of the file at the given path", -> - expect(fs.md5ForPath(require.resolve('fixtures/sample.js'))).toBe 'dd38087d0d7e3e4802a6d3f9b9745f2b' - - describe ".async", -> - directoryPath = null - beforeEach -> - directoryPath = require.resolve 'fixtures/dir' - - describe ".listTree(directoryPath)", -> - it "returns a promise that resolves to the recursive contents of that directory", -> - waitsForPromise -> - fs.async.listTree(directoryPath).done (result) -> - expect(result).toEqual fs.listTree(directoryPath) - - describe ".list(directoryPath)", -> - it "returns a promise that resolves to the contents of that directory", -> - waitsForPromise -> - fs.async.list(directoryPath).done (result) -> - expect(result).toEqual fs.list(directoryPath) diff --git a/spec/stdlib/jquery-extensions-spec.coffee b/spec/stdlib/jquery-extensions-spec.coffee deleted file mode 100644 index 4a2d22d7b..000000000 --- a/spec/stdlib/jquery-extensions-spec.coffee +++ /dev/null @@ -1,41 +0,0 @@ -$ = require 'jquery' - -describe 'jQuery extensions', -> - describe '$.fn.preempt(eventName, handler)', -> - [returnValue, element, events] = [] - - beforeEach -> - returnValue = undefined - element = $("
    ") - events = [] - - element.on 'foo', -> events.push(1) - element.preempt 'foo', -> - events.push(2) - returnValue - element.on 'foo', -> events.push(3) - - it 'calls the preempting handler before all others', -> - element.trigger 'foo' - expect(events).toEqual [2,1,3] - - describe 'when handler returns false', -> - it 'does not call subsequent handlers', -> - returnValue = false - element.trigger 'foo' - expect(events).toEqual [2] - - describe 'when the event is namespaced', -> - it 'calls handler', -> - element.preempt 'foo.bar', -> events.push(4) - element.trigger 'foo' - expect(events).toEqual [4,2,1,3] - - events = [] - element.trigger 'foo.bar' - expect(events).toEqual [4] - - events = [] - element.off('.bar') - element.trigger 'foo' - expect(events).toEqual [2,1,3] diff --git a/spec/stdlib/onig-reg-exp-spec.coffee b/spec/stdlib/onig-reg-exp-spec.coffee deleted file mode 100644 index 633e13fea..000000000 --- a/spec/stdlib/onig-reg-exp-spec.coffee +++ /dev/null @@ -1,32 +0,0 @@ -describe "OnigRegExp", -> - describe ".search(string, index)", -> - it "returns an array of the match and all capture groups", -> - regex = new OnigRegExp("\\w(\\d+)") - result = regex.search("----a123----") - expect(result).toEqual ["a123", "123"] - expect(result.index).toBe 4 - expect(result.indices).toEqual [4, 5] - - it "returns null if it does not match", -> - regex = new OnigRegExp("\\w(\\d+)") - result = regex.search("--------") - expect(result).toBeNull() - - describe ".getCaptureIndices(string, index)", -> - it "returns match with nested capture groups organized into a tree", -> - regex = new OnigRegExp("a((bc)d)e(f(g)(h))(?=ij)") - tree = regex.getCaptureIndices("abcdefghij") - - expect(tree).toEqual [ - 0, 0, 8 - 1, 1, 4, - 2, 1, 3, - 3, 5, 8, - 4, 6, 7, - 5, 7, 8 - ] - - it "returns undefined if there was no match", -> - regex = new OnigRegExp('x') - expect(regex.getCaptureIndices('y')).toBeNull() - diff --git a/spec/stdlib/underscore-extensions-spec.coffee b/spec/stdlib/underscore-extensions-spec.coffee deleted file mode 100644 index ee12f269e..000000000 --- a/spec/stdlib/underscore-extensions-spec.coffee +++ /dev/null @@ -1,22 +0,0 @@ -_ = require 'underscore' - -describe "underscore extensions", -> - describe "_.adviseBefore", -> - [object, calls] = [] - - beforeEach -> - calls = [] - object = { - method: (args...) -> - calls.push(["original", this, args]) - } - - it "calls the given function before the advised method", -> - _.adviseBefore object, 'method', (args...) -> calls.push(["advice", this, args]) - object.method(1, 2, 3) - expect(calls).toEqual [['advice', object, [1, 2, 3]], ['original', object, [1, 2, 3]]] - - it "cancels the original method's invocation if the advice returns true", -> - _.adviseBefore object, 'method', -> false - object.method(1, 2, 3) - expect(calls).toEqual [] diff --git a/src/app/ace-adaptor.coffee b/src/app/ace-adaptor.coffee deleted file mode 100644 index 8869db8aa..000000000 --- a/src/app/ace-adaptor.coffee +++ /dev/null @@ -1,28 +0,0 @@ -Range = require 'range' - -module.exports = -class AceAdaptor - foldWidgets: {} - - constructor: (@editSession) -> - @buffer = @editSession.buffer - - getLine: (bufferRow) -> - @buffer.lineForRow(bufferRow) - - getLength: -> - @buffer.getLineCount() - - $findClosingBracket: (bracketType, bufferPosition) -> - @editSession.tokenizedBuffer.findClosingBracket([bufferPosition.row, bufferPosition.column - 1]) - - indentRows: (startRow, endRow, indentString) -> - for row in [startRow..endRow] - @buffer.insert([row, 0], indentString) - - replace: (range, text) -> - range = Range.fromObject(range) - @buffer.change(range, text) - - findMatchingBracket: ({row, column}) -> - @editSession.tokenizedBuffer.findOpeningBracket([row, column]) diff --git a/src/app/anchor-range.coffee b/src/app/anchor-range.coffee deleted file mode 100644 index 54609a67f..000000000 --- a/src/app/anchor-range.coffee +++ /dev/null @@ -1,28 +0,0 @@ -Range = require 'range' - -module.exports = -class AnchorRange - start: null - end: null - buffer: null - editSession: null # optional - - constructor: (bufferRange, @buffer, @editSession) -> - bufferRange = Range.fromObject(bufferRange) - @startAnchor = @buffer.addAnchorAtPosition(bufferRange.start, ignoreEqual: true) - @endAnchor = @buffer.addAnchorAtPosition(bufferRange.end) - - getBufferRange: -> - new Range(@startAnchor.getBufferPosition(), @endAnchor.getBufferPosition()) - - getScreenRange: -> - new Range(@startAnchor.getScreenPosition(), @endAnchor.getScreenPosition()) - - containsBufferPosition: (bufferPosition) -> - @getBufferRange().containsPoint(bufferPosition) - - destroy: -> - @startAnchor.destroy() - @endAnchor.destroy() - @buffer.removeAnchorRange(this) - @editSession?.removeAnchorRange(this) diff --git a/src/app/anchor.coffee b/src/app/anchor.coffee deleted file mode 100644 index 2755974c0..000000000 --- a/src/app/anchor.coffee +++ /dev/null @@ -1,81 +0,0 @@ -Point = require 'point' -EventEmitter = require 'event-emitter' -_ = require 'underscore' - -module.exports = -class Anchor - buffer: null - editSession: null # optional - bufferPosition: null - screenPosition: null - ignoreEqual: false - strong: false - - constructor: (@buffer, options = {}) -> - { @editSession, @ignoreEqual, @strong } = options - - handleBufferChange: (e) -> - { oldRange, newRange } = e - position = @getBufferPosition() - - if oldRange.containsPoint(position, exclusive: true) - if @strong - @setBufferPosition(oldRange.start) - else - @destroy() - return - - if @ignoreEqual - return if position.isLessThanOrEqual(oldRange.end) - else - return if position.isLessThan(oldRange.end) - - newRow = newRange.end.row - newColumn = newRange.end.column - if position.row == oldRange.end.row - newColumn += position.column - oldRange.end.column - else - newColumn = position.column - newRow += position.row - oldRange.end.row - - @setBufferPosition([newRow, newColumn], bufferChange: true) - - getBufferPosition: -> - @bufferPosition - - setBufferPosition: (position, options={}) -> - @bufferPosition = Point.fromObject(position) - clip = options.clip ? true - @bufferPosition = @buffer.clipPosition(@bufferPosition) if clip - @refreshScreenPosition(options) - - getScreenPosition: -> - @screenPosition - - setScreenPosition: (position, options={}) -> - previousScreenPosition = @screenPosition - @screenPosition = Point.fromObject(position) - clip = options.clip ? true - assignBufferPosition = options.assignBufferPosition ? true - - @screenPosition = @editSession.clipScreenPosition(@screenPosition, options) if clip - @bufferPosition = @editSession.bufferPositionForScreenPosition(@screenPosition, options) if assignBufferPosition - - Object.freeze @screenPosition - Object.freeze @bufferPosition - - unless @screenPosition.isEqual(previousScreenPosition) - @trigger 'change-screen-position', @screenPosition, bufferChange: options.bufferChange - - refreshScreenPosition: (options={}) -> - return unless @editSession - screenPosition = @editSession.screenPositionForBufferPosition(@bufferPosition, options) - @setScreenPosition(screenPosition, bufferChange: options.bufferChange, clip: false, assignBufferPosition: false) - - destroy: -> - @buffer.removeAnchor(this) - @editSession?.removeAnchor(this) - @trigger 'destroy' - @off() - -_.extend(Anchor.prototype, EventEmitter) diff --git a/src/app/atom.coffee b/src/app/atom.coffee deleted file mode 100644 index 1fdda1f62..000000000 --- a/src/app/atom.coffee +++ /dev/null @@ -1,39 +0,0 @@ -Keymap = require 'keymap' -fs = require 'fs' - -$ = require 'jquery' -_ = require 'underscore' -require 'underscore-extensions' - -module.exports = -class Atom - keymap: null - windows: null - configFilePath: null - configDirPath: null - rootViewStates: null - - constructor: (@loadPath, nativeMethods) -> - @windows = [] - @setUpKeymap() - @configDirPath = fs.absolute("~/.atom") - @configFilePath = fs.join(@configDirPath, "atom.coffee") - @rootViewStates = {} - - setUpKeymap: -> - @keymap = new Keymap() - @handleKeyEvent = (e) => @keymap.handleKeyEvent(e) - $(document).on 'keydown', @handleKeyEvent - @keymap.bindDefaultKeys() - - open: (path) -> - $native.open path - - quit: -> - $native.terminate null - - windowOpened: (window) -> - @windows.push(window) unless _.contains(@windows, window) - - windowClosed: (window) -> - _.remove(@windows, window) diff --git a/src/app/binding-set.coffee b/src/app/binding-set.coffee deleted file mode 100644 index 3882a7236..000000000 --- a/src/app/binding-set.coffee +++ /dev/null @@ -1,52 +0,0 @@ -$ = require 'jquery' -_ = require 'underscore' -fs = require 'fs' - -Specificity = require 'specificity' -PEG = require 'pegjs' - -module.exports = -class BindingSet - selector: null - commandsByKeystrokes: null - commandForEvent: null - parser: null - - constructor: (@selector, mapOrFunction, @index) -> - @parser = PEG.buildParser(fs.read(require.resolve 'keystroke-pattern.pegjs')) - @specificity = Specificity(@selector) - @commandsByKeystrokes = {} - - if _.isFunction(mapOrFunction) - @commandForEvent = mapOrFunction - else - @commandsByKeystrokes = @normalizeCommandsByKeystrokes(mapOrFunction) - @commandForEvent = (event) => - for keystrokes, command of @commandsByKeystrokes - return command if event.keystrokes == keystrokes - null - - matchesKeystrokePrefix: (event) -> - eventKeystrokes = event.keystrokes.split(' ') - for keystrokes, command of @commandsByKeystrokes - bindingKeystrokes = keystrokes.split(' ') - continue unless eventKeystrokes.length < bindingKeystrokes.length - return true if _.isEqual(eventKeystrokes, bindingKeystrokes[0...eventKeystrokes.length]) - false - - normalizeCommandsByKeystrokes: (commandsByKeystrokes) -> - normalizedCommandsByKeystrokes = {} - for keystrokes, command of commandsByKeystrokes - normalizedCommandsByKeystrokes[@normalizeKeystrokes(keystrokes)] = command - normalizedCommandsByKeystrokes - - normalizeKeystrokes: (keystrokes) -> - normalizedKeystrokes = keystrokes.split(/\s+/).map (keystroke) => - @normalizeKeystroke(keystroke) - normalizedKeystrokes.join(' ') - - normalizeKeystroke: (keystroke) -> - keys = @parser.parse(keystroke) - modifiers = keys[0...-1] - modifiers.sort() - [modifiers..., _.last(keys)].join('-') diff --git a/src/app/buffer-change-operation.coffee b/src/app/buffer-change-operation.coffee deleted file mode 100644 index b9f61bec8..000000000 --- a/src/app/buffer-change-operation.coffee +++ /dev/null @@ -1,57 +0,0 @@ -Range = require 'range' - -module.exports = -class BufferChangeOperation - buffer: null - oldRange: null - oldText: null - newRange: null - newText: null - - constructor: ({@buffer, @oldRange, @newText}) -> - - do: -> - @oldText = @buffer.getTextInRange(@oldRange) - @newRange = @calculateNewRange(@oldRange, @newText) - @changeBuffer - oldRange: @oldRange - newRange: @newRange - oldText: @oldText - newText: @newText - - undo: -> - @changeBuffer - oldRange: @newRange - newRange: @oldRange - oldText: @newText - newText: @oldText - - changeBuffer: ({ oldRange, newRange, newText, oldText }) -> - { prefix, suffix } = @buffer.prefixAndSuffixForRange(oldRange) - - newTextLines = newText.split('\n') - if newTextLines.length == 1 - newTextLines = [prefix + newText + suffix] - else - lastLineIndex = newTextLines.length - 1 - newTextLines[0] = prefix + newTextLines[0] - newTextLines[lastLineIndex] += suffix - - @buffer.replaceLines(oldRange.start.row, oldRange.end.row, newTextLines) - - event = { oldRange, newRange, oldText, newText } - @buffer.trigger 'change', event - anchor.handleBufferChange(event) for anchor in @buffer.getAnchors() - @buffer.trigger 'update-anchors-after-change' - newRange - - calculateNewRange: (oldRange, newText) -> - newRange = new Range(oldRange.start.copy(), oldRange.start.copy()) - newTextLines = newText.split('\n') - if newTextLines.length == 1 - newRange.end.column += newText.length - else - lastLineIndex = newTextLines.length - 1 - newRange.end.row += lastLineIndex - newRange.end.column = newTextLines[lastLineIndex].length - newRange diff --git a/src/app/buffer.coffee b/src/app/buffer.coffee deleted file mode 100644 index d86af99f3..000000000 --- a/src/app/buffer.coffee +++ /dev/null @@ -1,357 +0,0 @@ -_ = require 'underscore' -fs = require 'fs' -File = require 'file' -Point = require 'point' -Range = require 'range' -EventEmitter = require 'event-emitter' -UndoManager = require 'undo-manager' -BufferChangeOperation = require 'buffer-change-operation' -Anchor = require 'anchor' -AnchorRange = require 'anchor-range' - -module.exports = -class Buffer - @idCounter = 1 - undoManager: null - modified: null - modifiedOnDisk: null - lines: null - file: null - anchors: null - anchorRanges: null - refcount: 0 - - constructor: (path, @project) -> - @id = @constructor.idCounter++ - @anchors = [] - @anchorRanges = [] - @lines = [''] - - if path - throw "Path '#{path}' does not exist" unless fs.exists(path) - @setPath(path) - @setText(fs.read(@getPath())) - else - @setText('') - - @undoManager = new UndoManager(this) - @modified = false - - destroy: -> - throw new Error("Destroying buffer twice with path '#{@getPath()}'") if @destroyed - @file?.off() - @destroyed = true - @project?.removeBuffer(this) - - retain: -> - @refcount++ - this - - release: -> - @refcount-- - @destroy() if @refcount <= 0 - this - - subscribeToFile: -> - @file.on "contents-change", => - if @isModified() - @modifiedOnDisk = true - else - @setText(fs.read(@file.getPath())) - @modified = false - - @file.on "remove", => - @file = null - @trigger "path-change", this - - @file.on "move", => - @trigger "path-change", this - - reload: -> - @setText(fs.read(@file.getPath())) - @modified = false - @modifiedOnDisk = false - - getBaseName: -> - @file?.getBaseName() - - getPath: -> - @file?.getPath() - - setPath: (path) -> - return if path == @getPath() - - @file?.off() - @file = new File(path) - @subscribeToFile() - @file.on "contents-change", => - if @isModified() - @modifiedOnDisk = true - @trigger "contents-change-on-disk" - else - @setText(fs.read(@file.getPath())) - @modified = false - @trigger "path-change", this - - getExtension: -> - if @getPath() - @getPath().split('/').pop().split('.').pop() - else - null - - getText: -> - @lines.join('\n') - - setText: (text) -> - @change(@getRange(), text) - - getRange: -> - new Range([0, 0], [@getLastRow(), @getLastLine().length]) - - getTextInRange: (range) -> - range = Range.fromObject(range) - if range.start.row == range.end.row - return @lines[range.start.row][range.start.column...range.end.column] - - multipleLines = [] - multipleLines.push @lines[range.start.row][range.start.column..] # first line - for row in [range.start.row + 1...range.end.row] - multipleLines.push @lines[row] # middle lines - multipleLines.push @lines[range.end.row][0...range.end.column] # last line - - return multipleLines.join '\n' - - getLines: -> - @lines - - lineForRow: (row) -> - @lines[row] - - lineLengthForRow: (row) -> - @lines[row].length - - rangeForRow: (row) -> - new Range([row, 0], [row, @lineLengthForRow(row)]) - - getLineCount: -> - @getLines().length - - getLastRow: -> - @getLines().length - 1 - - getLastLine: -> - @lineForRow(@getLastRow()) - - getEofPosition: -> - lastRow = @getLastRow() - new Point(lastRow, @lineLengthForRow(lastRow)) - - characterIndexForPosition: (position) -> - position = Point.fromObject(position) - - index = 0 - index += @lineLengthForRow(row) + 1 for row in [0...position.row] - index + position.column - - positionForCharacterIndex: (index) -> - row = 0 - while index >= (lineLength = @lineLengthForRow(row) + 1) - index -= lineLength - row++ - - new Point(row, index) - - deleteRow: (row) -> - range = null - if row == @getLastRow() - range = new Range([row - 1, @lineLengthForRow(row - 1)], [row, @lineLengthForRow(row)]) - else - range = new Range([row, 0], [row + 1, 0]) - - @change(range, '') - - insert: (point, text) -> - @change(new Range(point, point), text) - - delete: (range) -> - @change(range, '') - - change: (oldRange, newText) -> - oldRange = Range.fromObject(oldRange) - operation = new BufferChangeOperation({buffer: this, oldRange, newText}) - @pushOperation(operation) - - clipPosition: (position) -> - { row, column } = Point.fromObject(position) - row = 0 if row < 0 - column = 0 if column < 0 - row = Math.min(@getLastRow(), row) - column = Math.min(@lineLengthForRow(row), column) - - new Point(row, column) - - prefixAndSuffixForRange: (range) -> - prefix: @lines[range.start.row][0...range.start.column] - suffix: @lines[range.end.row][range.end.column..] - - replaceLines: (startRow, endRow, newLines) -> - @lines[startRow..endRow] = newLines - @modified = true - - pushOperation: (operation, editSession) -> - if @undoManager - @undoManager.pushOperation(operation, editSession) - else - operation.do() - - transact: (fn) -> - @undoManager.transact(fn) - - undo: (editSession) -> - @undoManager.undo(editSession) - - redo: (editSession) -> - @undoManager.redo(editSession) - - save: -> - @saveAs(@getPath()) - - saveAs: (path) -> - if not path then throw new Error("Can't save buffer with no file path") - - @trigger 'before-save' - fs.write path, @getText() - @file?.updateMd5() - @modified = false - @modifiedOnDisk = false - @setPath(path) - @trigger 'after-save' - - isInConflict: -> - @isModified() and @isModifiedOnDisk() - - isModifiedOnDisk: -> - @modifiedOnDisk - - isModified: -> - @modified - - getAnchors: -> new Array(@anchors...) - - addAnchor: (options) -> - anchor = new Anchor(this, options) - @anchors.push(anchor) - anchor - - addAnchorAtPosition: (position, options) -> - anchor = @addAnchor(options) - anchor.setBufferPosition(position) - anchor - - addAnchorRange: (range, editSession) -> - anchorRange = new AnchorRange(range, this, editSession) - @anchorRanges.push(anchorRange) - anchorRange - - removeAnchor: (anchor) -> - _.remove(@anchors, anchor) - - removeAnchorRange: (anchorRange) -> - _.remove(@anchorRanges, anchorRange) - - matchesInCharacterRange: (regex, startIndex, endIndex) -> - text = @getText() - matches = [] - - regex.lastIndex = startIndex - while match = regex.exec(text) - matchLength = match[0].length - matchStartIndex = match.index - matchEndIndex = matchStartIndex + matchLength - - if matchEndIndex > endIndex - regex.lastIndex = 0 - if matchStartIndex < endIndex and submatch = regex.exec(text[matchStartIndex...endIndex]) - submatch.index = matchStartIndex - matches.push submatch - break - - matchEndIndex++ if matchLength is 0 - regex.lastIndex = matchEndIndex - matches.push match - - matches - - scan: (regex, iterator) -> - @scanInRange(regex, @getRange(), iterator) - - scanInRange: (regex, range, iterator, reverse=false) -> - range = Range.fromObject(range) - global = regex.global - regex = new RegExp(regex.source, 'gm') - - startIndex = @characterIndexForPosition(range.start) - endIndex = @characterIndexForPosition(range.end) - - matches = @matchesInCharacterRange(regex, startIndex, endIndex) - lengthDelta = 0 - - keepLooping = null - replacementText = null - stop = -> keepLooping = false - replace = (text) -> replacementText = text - - matches.reverse() if reverse - for match in matches - matchLength = match[0].length - matchStartIndex = match.index - matchEndIndex = matchStartIndex + matchLength - - startPosition = @positionForCharacterIndex(matchStartIndex + lengthDelta) - endPosition = @positionForCharacterIndex(matchEndIndex + lengthDelta) - range = new Range(startPosition, endPosition) - keepLooping = true - replacementText = null - iterator(match, range, { stop, replace }) - - if replacementText? - @change(range, replacementText) - lengthDelta += replacementText.length - matchLength unless reverse - - break unless global and keepLooping - - backwardsScanInRange: (regex, range, iterator) -> - @scanInRange regex, range, iterator, true - - isRowBlank: (row) -> - not /\S/.test @lineForRow(row) - - previousNonBlankRow: (startRow) -> - return null if startRow == 0 - - startRow = Math.min(startRow, @getLastRow()) - for row in [(startRow - 1)..0] - return row unless @isRowBlank(row) - null - - nextNonBlankRow: (startRow) -> - lastRow = @getLastRow() - if startRow < lastRow - for row in [(startRow + 1)..lastRow] - return row unless @isRowBlank(row) - null - - indentationForRow: (row) -> - @lineForRow(row).match(/^\s*/)?[0].length - - setIndentationForRow: (bufferRow, newLevel) -> - currentLevel = @indentationForRow(bufferRow) - indentString = [0...newLevel].map(-> ' ').join('') - @change([[bufferRow, 0], [bufferRow, currentLevel]], indentString) - - logLines: (start=0, end=@getLastRow())-> - for row in [start..end] - line = @lineForRow(row) - console.log row, line, line.length - -_.extend(Buffer.prototype, EventEmitter) diff --git a/src/app/cursor-view.coffee b/src/app/cursor-view.coffee deleted file mode 100644 index 326162536..000000000 --- a/src/app/cursor-view.coffee +++ /dev/null @@ -1,62 +0,0 @@ -{View} = require 'space-pen' -Anchor = require 'anchor' -Point = require 'point' -Range = require 'range' -_ = require 'underscore' - -module.exports = -class CursorView extends View - @content: -> - @pre class: 'cursor idle', => @raw ' ' - - editor: null - hidden: false - - initialize: (@cursor, @editor) -> - @cursor.on 'change-screen-position.cursor-view', (position, { bufferChange }) => - @updateAppearance() - @removeIdleClassTemporarily() unless bufferChange - @trigger 'cursor-move', bufferChange: bufferChange - - @cursor.on 'destroy.cursor-view', => @remove() - - afterAttach: (onDom) -> - return unless onDom - @updateAppearance() - @editor.syncCursorAnimations() - - remove: -> - @editor.removeCursorView(this) - @cursor.off('.cursor-view') - super - - updateAppearance: -> - screenPosition = @getScreenPosition() - pixelPosition = @editor.pixelPositionForScreenPosition(screenPosition) - @css(pixelPosition) - - if @cursor == @editor.getLastCursor() - @editor.scrollTo(pixelPosition) - - if @editor.isFoldedAtScreenRow(screenPosition.row) - @hide() unless @hidden - @hidden = true - else - @show() if @hidden - @hidden = false - - getBufferPosition: -> - @cursor.getBufferPosition() - - getScreenPosition: -> - @cursor.getScreenPosition() - - removeIdleClassTemporarily: -> - @removeClass 'idle' - window.clearTimeout(@idleTimeout) if @idleTimeout - @idleTimeout = window.setTimeout (=> @addClass 'idle'), 200 - - resetCursorAnimation: -> - window.clearTimeout(@idleTimeout) if @idleTimeout - @removeClass 'idle' - _.defer => @addClass 'idle' diff --git a/src/app/cursor.coffee b/src/app/cursor.coffee deleted file mode 100644 index af26c65c0..000000000 --- a/src/app/cursor.coffee +++ /dev/null @@ -1,162 +0,0 @@ -Point = require 'point' -Range = require 'range' -Anchor = require 'anchor' -EventEmitter = require 'event-emitter' -_ = require 'underscore' - -module.exports = -class Cursor - screenPosition: null - bufferPosition: null - goalColumn: null - wordRegex: /(\w+)|([^\w\s]+)/g - - constructor: ({@editSession, screenPosition, bufferPosition}) -> - @anchor = @editSession.addAnchor(strong: true) - @anchor.on 'change-screen-position', (args...) => @trigger 'change-screen-position', args... - @setScreenPosition(screenPosition) if screenPosition - @setBufferPosition(bufferPosition) if bufferPosition - - destroy: -> - @anchor.destroy() - @editSession.removeCursor(this) - @trigger 'destroy' - - setScreenPosition: (screenPosition, options) -> - @goalColumn = null - @clearSelection() - @anchor.setScreenPosition(screenPosition, options) - - getScreenPosition: -> - @anchor.getScreenPosition() - - setBufferPosition: (bufferPosition, options) -> - @goalColumn = null - @clearSelection() - @anchor.setBufferPosition(bufferPosition, options) - - getBufferPosition: -> - @anchor.getBufferPosition() - - clearSelection: -> - if @selection - @selection.clear() unless @selection.retainSelection - - getScreenRow: -> - @getScreenPosition().row - - getBufferRow: -> - @getBufferPosition().row - - getCurrentBufferLine: -> - @editSession.lineForBufferRow(@getBufferRow()) - - refreshScreenPosition: -> - @anchor.refreshScreenPosition() - - moveUp: -> - { row, column } = @getScreenPosition() - column = @goalColumn if @goalColumn? - @setScreenPosition({row: row - 1, column: column}) - @goalColumn = column - - moveDown: -> - { row, column } = @getScreenPosition() - column = @goalColumn if @goalColumn? - @setScreenPosition({row: row + 1, column: column}) - @goalColumn = column - - moveLeft: -> - { row, column } = @getScreenPosition() - [row, column] = if column > 0 then [row, column - 1] else [row - 1, Infinity] - @setScreenPosition({row, column}) - - moveRight: -> - { row, column } = @getScreenPosition() - @setScreenPosition([row, column + 1], skipAtomicTokens: true, wrapBeyondNewlines: true, wrapAtSoftNewlines: true) - - moveToTop: -> - @setBufferPosition([0,0]) - - moveToBottom: -> - @setBufferPosition(@editSession.getEofBufferPosition()) - - moveToBeginningOfLine: -> - @setBufferPosition([@getBufferRow(), 0]) - - moveToFirstCharacterOfLine: -> - position = @getBufferPosition() - range = @editSession.bufferRangeForBufferRow(position.row) - newPosition = null - @editSession.scanInRange /^\s*/, range, (match, matchRange) => - newPosition = matchRange.end - return unless newPosition - newPosition = [position.row, 0] if newPosition.isEqual(position) - @setBufferPosition(newPosition) - - moveToEndOfLine: -> - @setBufferPosition([@getBufferRow(), Infinity]) - - moveToBeginningOfWord: -> - @setBufferPosition(@getBeginningOfCurrentWordBufferPosition()) - - moveToEndOfWord: -> - @setBufferPosition(@getEndOfCurrentWordBufferPosition()) - - moveToNextWord: -> - @setBufferPosition(@getBeginningOfNextWordBufferPosition()) - - getBeginningOfCurrentWordBufferPosition: (options = {}) -> - allowPrevious = options.allowPrevious ? true - currentBufferPosition = @getBufferPosition() - previousRow = Math.max(0, currentBufferPosition.row - 1) - previousLinesRange = [[previousRow, 0], currentBufferPosition] - - beginningOfWordPosition = currentBufferPosition - @editSession.backwardsScanInRange @wordRegex, previousLinesRange, (match, matchRange, { stop }) => - if matchRange.end.isGreaterThanOrEqual(currentBufferPosition) or allowPrevious - beginningOfWordPosition = matchRange.start - stop() - beginningOfWordPosition - - getEndOfCurrentWordBufferPosition: (options = {}) -> - allowNext = options.allowNext ? true - currentBufferPosition = @getBufferPosition() - range = [currentBufferPosition, @editSession.getEofBufferPosition()] - - endOfWordPosition = null - @editSession.scanInRange @wordRegex, range, (match, matchRange, { stop }) => - endOfWordPosition = matchRange.end - if not allowNext and matchRange.start.isGreaterThan(currentBufferPosition) - endOfWordPosition = currentBufferPosition - stop() - endOfWordPosition - - getBeginningOfNextWordBufferPosition: -> - currentBufferPosition = @getBufferPosition() - eofBufferPosition = @editSession.getEofBufferPosition() - range = [currentBufferPosition, eofBufferPosition] - - nextWordPosition = eofBufferPosition - @editSession.scanInRange @wordRegex, range, (match, matchRange, { stop }) => - if matchRange.start.isGreaterThan(currentBufferPosition) - nextWordPosition = matchRange.start - stop() - nextWordPosition - - getCurrentWordBufferRange: -> - new Range(@getBeginningOfCurrentWordBufferPosition(allowPrevious: false), @getEndOfCurrentWordBufferPosition(allowNext: false)) - - getCurrentLineBufferRange: -> - @editSession.bufferRangeForBufferRow(@getBufferRow()) - - getCurrentWordPrefix: -> - @editSession.getTextInBufferRange([@getBeginningOfCurrentWordBufferPosition(), @getBufferPosition()]) - - isAtBeginningOfLine: -> - @getBufferPosition().column == 0 - - isAtEndOfLine: -> - @getBufferPosition().isEqual(@getCurrentLineBufferRange().end) - -_.extend Cursor.prototype, EventEmitter diff --git a/src/app/directory.coffee b/src/app/directory.coffee deleted file mode 100644 index d0bef88c2..000000000 --- a/src/app/directory.coffee +++ /dev/null @@ -1,38 +0,0 @@ -_ = require 'underscore' -fs = require 'fs' -File = require 'file' -EventEmitter = require 'event-emitter' - -module.exports = -class Directory - path: null - - constructor: (@path) -> - - getBaseName: -> - fs.base(@path) + '/' - - getEntries: -> - directories = [] - files = [] - for path in fs.list(@path) - if fs.isDirectory(path) - directories.push(new Directory(path)) - else - files.push(new File(path)) - directories.concat(files) - - afterSubscribe: -> - @subscribeToNativeChangeEvents() if @subscriptionCount() == 1 - - afterUnsubscribe: -> - @unsubscribeFromNativeChangeEvents() if @subscriptionCount() == 0 - - subscribeToNativeChangeEvents: -> - @watchId = $native.watchPath @path, (eventType) => - @trigger "contents-change" if eventType is "contents-change" - - unsubscribeFromNativeChangeEvents: -> - $native.unwatchPath(@path, @watchId) - -_.extend Directory.prototype, EventEmitter diff --git a/src/app/display-buffer.coffee b/src/app/display-buffer.coffee deleted file mode 100644 index edbdc2831..000000000 --- a/src/app/display-buffer.coffee +++ /dev/null @@ -1,281 +0,0 @@ -_ = require 'underscore' -TokenizedBuffer = require 'tokenized-buffer' -LineMap = require 'line-map' -Point = require 'point' -EventEmitter = require 'event-emitter' -Range = require 'range' -Fold = require 'fold' -ScreenLine = require 'screen-line' -Token = require 'token' - -module.exports = -class DisplayBuffer - @idCounter: 1 - lineMap: null - languageMode: null - tokenizedBuffer: null - activeFolds: null - foldsById: null - lastTokenizedBufferChangeEvent: null - - constructor: (@buffer, options={}) -> - @id = @constructor.idCounter++ - options.tabText ?= ' ' - @languageMode = options.languageMode - @tokenizedBuffer = new TokenizedBuffer(@buffer, options) - @softWrapColumn = options.softWrapColumn ? Infinity - @activeFolds = {} - @foldsById = {} - @buildLineMap() - @tokenizedBuffer.on 'change', (e) => @lastTokenizedBufferChangeEvent = e - @buffer.on "change.displayBuffer#{@id}", (e) => @handleBufferChange(e) - - buildLineMap: -> - @lineMap = new LineMap - @lineMap.insertAtBufferRow 0, @buildLinesForBufferRows(0, @buffer.getLastRow()) - - setSoftWrapColumn: (@softWrapColumn) -> - oldRange = @rangeForAllLines() - @buildLineMap() - newRange = @rangeForAllLines() - @trigger 'change', { oldRange, newRange, lineNumbersChanged: true } - - lineForRow: (row) -> - @lineMap.lineForScreenRow(row) - - linesForRows: (startRow, endRow) -> - @lineMap.linesForScreenRows(startRow, endRow) - - getLines: -> - @lineMap.linesForScreenRows(0, @lineMap.lastScreenRow()) - - bufferRowsForScreenRows: (startRow, endRow) -> - @lineMap.bufferRowsForScreenRows(startRow, endRow) - - foldAll: -> - for currentRow in [0..@buffer.getLastRow()] - [startRow, endRow] = @languageMode.rowRangeForFoldAtBufferRow(currentRow) ? [] - continue unless startRow? - - @createFold(startRow, endRow) - - unfoldAll: -> - for row in [@buffer.getLastRow()..0] - @activeFolds[row]?.forEach (fold) => @destroyFold(fold) - - foldBufferRow: (bufferRow) -> - for currentRow in [bufferRow..0] - [startRow, endRow] = @languageMode.rowRangeForFoldAtBufferRow(currentRow) ? [] - continue unless startRow? and startRow <= bufferRow <= endRow - fold = @largestFoldStartingAtBufferRow(startRow) - continue if fold - - @createFold(startRow, endRow) - - return - - unfoldBufferRow: (bufferRow) -> - @largestFoldContainingBufferRow(bufferRow)?.destroy() - - createFold: (startRow, endRow) -> - return fold if fold = @foldFor(startRow, endRow) - fold = new Fold(this, startRow, endRow) - @registerFold(fold) - - unless @isFoldContainedByActiveFold(fold) - bufferRange = new Range([startRow, 0], [endRow, @buffer.lineLengthForRow(endRow)]) - oldScreenRange = @screenLineRangeForBufferRange(bufferRange) - - lines = @buildLineForBufferRow(startRow) - @lineMap.replaceScreenRows(oldScreenRange.start.row, oldScreenRange.end.row, lines) - newScreenRange = @screenLineRangeForBufferRange(bufferRange) - - @trigger 'change', oldRange: oldScreenRange, newRange: newScreenRange, lineNumbersChanged: true - - fold - - isFoldContainedByActiveFold: (fold) -> - for row, folds of @activeFolds - for otherFold in folds - return otherFold if fold != otherFold and fold.isContainedByFold(otherFold) - - foldFor: (startRow, endRow) -> - _.find @activeFolds[startRow] ? [], (fold) -> - fold.startRow == startRow and fold.endRow == endRow - - destroyFold: (fold) -> - @unregisterFold(fold.startRow, fold) - - unless @isFoldContainedByActiveFold(fold) - { startRow, endRow } = fold - bufferRange = new Range([startRow, 0], [endRow, @buffer.lineLengthForRow(endRow)]) - oldScreenRange = @screenLineRangeForBufferRange(bufferRange) - lines = @buildLinesForBufferRows(startRow, endRow) - @lineMap.replaceScreenRows(oldScreenRange.start.row, oldScreenRange.end.row, lines) - newScreenRange = @screenLineRangeForBufferRange(bufferRange) - - @trigger 'change', oldRange: oldScreenRange, newRange: newScreenRange, lineNumbersChanged: true - - destroyFoldsContainingBufferRow: (bufferRow) -> - for row, folds of @activeFolds - for fold in new Array(folds...) - fold.destroy() if fold.getBufferRange().containsRow(bufferRow) - - registerFold: (fold) -> - @activeFolds[fold.startRow] ?= [] - @activeFolds[fold.startRow].push(fold) - @foldsById[fold.id] = fold - - unregisterFold: (bufferRow, fold) -> - folds = @activeFolds[bufferRow] - _.remove(folds, fold) - delete @foldsById[fold.id] - delete @activeFolds[bufferRow] if folds.length == 0 - - largestFoldStartingAtBufferRow: (bufferRow) -> - return unless folds = @activeFolds[bufferRow] - (folds.sort (a, b) -> b.endRow - a.endRow)[0] - - largestFoldStartingAtScreenRow: (screenRow) -> - @largestFoldStartingAtBufferRow(@bufferRowForScreenRow(screenRow)) - - largestFoldContainingBufferRow: (bufferRow) -> - largestFold = null - for currentBufferRow in [bufferRow..0] - if fold = @largestFoldStartingAtBufferRow(currentBufferRow) - largestFold = fold if fold.endRow >= bufferRow - largestFold - - screenLineRangeForBufferRange: (bufferRange) -> - @expandScreenRangeToLineEnds( - @lineMap.screenRangeForBufferRange( - @expandBufferRangeToLineEnds(bufferRange))) - - screenRowForBufferRow: (bufferRow) -> - @lineMap.screenPositionForBufferPosition([bufferRow, 0]).row - - bufferRowForScreenRow: (screenRow) -> - @lineMap.bufferPositionForScreenPosition([screenRow, 0]).row - - screenRangeForBufferRange: (bufferRange) -> - @lineMap.screenRangeForBufferRange(bufferRange) - - bufferRangeForScreenRange: (screenRange) -> - @lineMap.bufferRangeForScreenRange(screenRange) - - lineCount: -> - @lineMap.screenLineCount() - - getLastRow: -> - @lineCount() - 1 - - maxLineLength: -> - @lineMap.maxScreenLineLength() - - screenPositionForBufferPosition: (position, options) -> - @lineMap.screenPositionForBufferPosition(position, options) - - bufferPositionForScreenPosition: (position, options) -> - @lineMap.bufferPositionForScreenPosition(position, options) - - stateForScreenRow: (screenRow) -> - @tokenizedBuffer.stackForRow(screenRow) - - clipScreenPosition: (position, options) -> - @lineMap.clipScreenPosition(position, options) - - handleBufferChange: (e) -> - allFolds = [] # Folds can modify @activeFolds, so first make sure we have a stable array of folds - allFolds.push(folds...) for row, folds of @activeFolds - fold.handleBufferChange(e) for fold in allFolds - - @handleTokenizedBufferChange(@lastTokenizedBufferChangeEvent) - - handleTokenizedBufferChange: (e) -> - newRange = e.newRange.copy() - newRange.start.row = @bufferRowForScreenRow(@screenRowForBufferRow(newRange.start.row)) - - oldScreenRange = @screenLineRangeForBufferRange(e.oldRange) - - newScreenLines = @buildLinesForBufferRows(newRange.start.row, newRange.end.row) - @lineMap.replaceScreenRows oldScreenRange.start.row, oldScreenRange.end.row, newScreenLines - newScreenRange = @screenLineRangeForBufferRange(newRange) - - @trigger 'change', - oldRange: oldScreenRange - newRange: newScreenRange - bufferChanged: true - lineNumbersChanged: !e.oldRange.coversSameRows(newRange) or !oldScreenRange.coversSameRows(newScreenRange) - - buildLineForBufferRow: (bufferRow) -> - @buildLinesForBufferRows(bufferRow, bufferRow) - - buildLinesForBufferRows: (startBufferRow, endBufferRow) -> - lineFragments = [] - startBufferColumn = null - currentBufferRow = startBufferRow - currentScreenLineLength = 0 - - startBufferColumn = 0 - while currentBufferRow <= endBufferRow - screenLine = @tokenizedBuffer.lineForScreenRow(currentBufferRow) - screenLine.foldable = @languageMode.doesBufferRowStartFold(currentBufferRow) - - if fold = @largestFoldStartingAtBufferRow(currentBufferRow) - screenLine = screenLine.copy() - screenLine.fold = fold - screenLine.bufferDelta = fold.getBufferDelta() - lineFragments.push(screenLine) - currentBufferRow = fold.endRow + 1 - continue - - startBufferColumn ?= 0 - screenLine = screenLine.splitAt(startBufferColumn)[1] if startBufferColumn > 0 - wrapScreenColumn = @findWrapColumn(screenLine.text, @softWrapColumn) - if wrapScreenColumn? - screenLine = screenLine.splitAt(wrapScreenColumn)[0] - screenLine.screenDelta = new Point(1, 0) - startBufferColumn += wrapScreenColumn - else - currentBufferRow++ - startBufferColumn = 0 - - lineFragments.push(screenLine) - - lineFragments - - findWrapColumn: (line, softWrapColumn) -> - return unless line.length > softWrapColumn - - if /\s/.test(line[softWrapColumn]) - # search forward for the start of a word past the boundary - for column in [softWrapColumn..line.length] - return column if /\S/.test(line[column]) - return line.length - else - # search backward for the start of the word on the boundary - for column in [softWrapColumn..0] - return column + 1 if /\s/.test(line[column]) - return softWrapColumn - - expandScreenRangeToLineEnds: (screenRange) -> - screenRange = Range.fromObject(screenRange) - { start, end } = screenRange - new Range([start.row, 0], [end.row, @lineMap.lineForScreenRow(end.row).text.length]) - - expandBufferRangeToLineEnds: (bufferRange) -> - bufferRange = Range.fromObject(bufferRange) - { start, end } = bufferRange - new Range([start.row, 0], [end.row, Infinity]) - - rangeForAllLines: -> - new Range([0, 0], @clipScreenPosition([Infinity, Infinity])) - - destroy: -> - @tokenizedBuffer.destroy() - @buffer.off ".displayBuffer#{@id}" - - logLines: (start, end) -> - @lineMap.logLines(start, end) - -_.extend DisplayBuffer.prototype, EventEmitter diff --git a/src/app/edit-session.coffee b/src/app/edit-session.coffee deleted file mode 100644 index f08d70a2b..000000000 --- a/src/app/edit-session.coffee +++ /dev/null @@ -1,545 +0,0 @@ -Point = require 'point' -Buffer = require 'buffer' -Anchor = require 'anchor' -LanguageMode = require 'language-mode' -DisplayBuffer = require 'display-buffer' -Cursor = require 'cursor' -Selection = require 'selection' -EventEmitter = require 'event-emitter' -Range = require 'range' -AnchorRange = require 'anchor-range' -_ = require 'underscore' - -module.exports = -class EditSession - @idCounter: 1 - - @deserialize: (state, project) -> - session = project.buildEditSessionForPath(state.buffer) - session.setScrollTop(state.scrollTop) - session.setScrollLeft(state.scrollLeft) - session.setCursorScreenPosition(state.cursorScreenPosition) - session - - scrollTop: 0 - scrollLeft: 0 - languageMode: null - displayBuffer: null - anchors: null - anchorRanges: null - cursors: null - selections: null - autoIndent: false # TODO: re-enabled auto-indent after fixing the rest of tokenization - softTabs: true - softWrap: false - - constructor: ({@project, @buffer, @tabText, @autoIndent, @softTabs, @softWrap}) -> - @id = @constructor.idCounter++ - @softTabs ?= true - @languageMode = new LanguageMode(this, @buffer.getExtension()) - @displayBuffer = new DisplayBuffer(@buffer, { @languageMode, @tabText }) - @tokenizedBuffer = @displayBuffer.tokenizedBuffer - @anchors = [] - @anchorRanges = [] - @cursors = [] - @selections = [] - @addCursorAtScreenPosition([0, 0]) - - @buffer.retain() - @buffer.on "path-change.edit-session-#{@id}", => - @trigger "buffer-path-change" - - @buffer.on "contents-change-on-disk.edit-session-#{@id}", => - @trigger "buffer-contents-change-on-disk" - - @buffer.on "update-anchors-after-change.edit-session-#{@id}", => - @mergeCursors() - - @displayBuffer.on "change.edit-session-#{@id}", (e) => - @trigger 'screen-lines-change', e - unless e.bufferChanged - anchor.refreshScreenPosition() for anchor in @getAnchors() - - destroy: -> - throw new Error("Edit session already destroyed") if @destroyed - @destroyed = true - - @buffer.off ".edit-session-#{@id}" - @buffer.release() - @displayBuffer.off ".edit-session-#{@id}" - @displayBuffer.destroy() - @project.removeEditSession(this) - anchor.destroy() for anchor in @getAnchors() - anchorRange.destroy() for anchorRange in @getAnchorRanges() - - serialize: -> - buffer: @buffer.getPath() - scrollTop: @getScrollTop() - scrollLeft: @getScrollLeft() - cursorScreenPosition: @getCursorScreenPosition().serialize() - - copy: -> - EditSession.deserialize(@serialize(), @project) - - isEqual: (other) -> - return false unless other instanceof EditSession - @buffer == other.buffer and - @scrollTop == other.getScrollTop() and - @scrollLeft == other.getScrollLeft() and - @getCursorScreenPosition().isEqual(other.getCursorScreenPosition()) - - setScrollTop: (@scrollTop) -> - getScrollTop: -> @scrollTop - - setScrollLeft: (@scrollLeft) -> - getScrollLeft: -> @scrollLeft - - setSoftWrapColumn: (@softWrapColumn) -> @displayBuffer.setSoftWrapColumn(@softWrapColumn) - setAutoIndent: (@autoIndent) -> - setSoftTabs: (@softTabs) -> - - getSoftWrap: -> @softWrap - setSoftWrap: (@softWrap) -> - - clipBufferPosition: (bufferPosition) -> - @buffer.clipPosition(bufferPosition) - - getFileExtension: -> @buffer.getExtension() - getPath: -> @buffer.getPath() - isBufferRowBlank: (bufferRow) -> @buffer.isRowBlank(bufferRow) - nextNonBlankBufferRow: (bufferRow) -> @buffer.nextNonBlankRow(bufferRow) - indentationForBufferRow: (bufferRow) -> @buffer.indentationForRow(bufferRow) - getEofBufferPosition: -> @buffer.getEofPosition() - getLastBufferRow: -> @buffer.getLastRow() - bufferRangeForBufferRow: (row) -> @buffer.rangeForRow(row) - lineForBufferRow: (row) -> @buffer.lineForRow(row) - scanInRange: (args...) -> @buffer.scanInRange(args...) - backwardsScanInRange: (args...) -> @buffer.backwardsScanInRange(args...) - - screenPositionForBufferPosition: (bufferPosition, options) -> @displayBuffer.screenPositionForBufferPosition(bufferPosition, options) - bufferPositionForScreenPosition: (screenPosition, options) -> @displayBuffer.bufferPositionForScreenPosition(screenPosition, options) - screenRangeForBufferRange: (range) -> @displayBuffer.screenRangeForBufferRange(range) - bufferRangeForScreenRange: (range) -> @displayBuffer.bufferRangeForScreenRange(range) - clipScreenPosition: (screenPosition, options) -> @displayBuffer.clipScreenPosition(screenPosition, options) - lineForScreenRow: (row) -> @displayBuffer.lineForRow(row) - linesForScreenRows: (start, end) -> @displayBuffer.linesForRows(start, end) - stateForScreenRow: (screenRow) -> @displayBuffer.stateForScreenRow(screenRow) - screenLineCount: -> @displayBuffer.lineCount() - maxScreenLineLength: -> @displayBuffer.maxLineLength() - getLastScreenRow: -> @displayBuffer.getLastRow() - bufferRowsForScreenRows: (startRow, endRow) -> @displayBuffer.bufferRowsForScreenRows(startRow, endRow) - logScreenLines: (start, end) -> @displayBuffer.logLines(start, end) - - insertText: (text, options) -> - @mutateSelectedText (selection) -> selection.insertText(text, options) - - insertNewline: -> - @insertText('\n') - - insertNewlineBelow: -> - @moveCursorToEndOfLine() - @insertNewline() - - indent: -> - currentRow = @getCursorBufferPosition().row - if @getSelection().isEmpty() - if @softTabs - @insertText(@tabText) - else - @insertText('\t') - else - @indentSelectedRows() - - backspace: -> - @mutateSelectedText (selection) -> selection.backspace() - - backspaceToBeginningOfWord: -> - @mutateSelectedText (selection) -> selection.backspaceToBeginningOfWord() - - delete: -> - @mutateSelectedText (selection) -> selection.delete() - - deleteToEndOfWord: -> - @mutateSelectedText (selection) -> selection.deleteToEndOfWord() - - indentSelectedRows: -> - @mutateSelectedText (selection) -> selection.indentSelectedRows() - - outdentSelectedRows: -> - @mutateSelectedText (selection) -> selection.outdentSelectedRows() - - toggleLineCommentsInSelection: -> - @mutateSelectedText (selection) -> selection.toggleLineComments() - - cutToEndOfLine: -> - maintainPasteboard = false - @mutateSelectedText (selection) -> - selection.cutToEndOfLine(maintainPasteboard) - maintainPasteboard = true - - cutSelectedText: -> - maintainPasteboard = false - @mutateSelectedText (selection) -> - selection.cut(maintainPasteboard) - maintainPasteboard = true - - copySelectedText: -> - maintainPasteboard = false - for selection in @getSelections() - selection.copy(maintainPasteboard) - maintainPasteboard = true - - pasteText: -> - @insertText($native.readFromPasteboard()) - - undo: -> - @buffer.undo(this) - - redo: -> - @buffer.redo(this) - - foldAll: -> - @displayBuffer.foldAll() - - unfoldAll: -> - @displayBuffer.unfoldAll() - - foldCurrentRow: -> - bufferRow = @bufferPositionForScreenPosition(@getCursorScreenPosition()).row - @foldBufferRow(bufferRow) - - foldBufferRow: (bufferRow) -> - @displayBuffer.foldBufferRow(bufferRow) - - unfoldCurrentRow: -> - bufferRow = @bufferPositionForScreenPosition(@getCursorScreenPosition()).row - @unfoldBufferRow(bufferRow) - - unfoldBufferRow: (bufferRow) -> - @displayBuffer.unfoldBufferRow(bufferRow) - - foldSelection: -> - selection.fold() for selection in @getSelections() - - createFold: (startRow, endRow) -> - @displayBuffer.createFold(startRow, endRow) - - destroyFoldsContainingBufferRow: (bufferRow) -> - @displayBuffer.destroyFoldsContainingBufferRow(bufferRow) - - destroyFoldsIntersectingBufferRange: (bufferRange) -> - for row in [bufferRange.start.row..bufferRange.end.row] - @destroyFoldsContainingBufferRow(row) - - destroyFold: (foldId) -> - fold = @displayBuffer.foldsById[foldId] - fold.destroy() - @setCursorBufferPosition([fold.startRow, 0]) - - isFoldedAtScreenRow: (screenRow) -> - @lineForScreenRow(screenRow).fold? - - largestFoldContainingBufferRow: (bufferRow) -> - @displayBuffer.largestFoldContainingBufferRow(bufferRow) - - largestFoldStartingAtScreenRow: (screenRow) -> - @displayBuffer.largestFoldStartingAtScreenRow(screenRow) - - autoIndentBufferRows: (startRow, endRow) -> - @languageMode.autoIndentBufferRows(startRow, endRow) - - autoIndentBufferRow: (bufferRow) -> - @languageMode.autoIndentBufferRow(bufferRow) - - autoIncreaseIndentForBufferRow: (bufferRow) -> - @languageMode.autoIncreaseIndentForBufferRow(bufferRow) - - autoDecreaseIndentForRow: (bufferRow) -> - @languageMode.autoDecreaseIndentForBufferRow(bufferRow) - - toggleLineCommentsInRange: (range) -> - @languageMode.toggleLineCommentsInRange(range) - - mutateSelectedText: (fn) -> - @transact => fn(selection) for selection in @getSelections() - - transact: (fn) -> - @buffer.transact => - oldSelectedRanges = @getSelectedBufferRanges() - @pushOperation - undo: (editSession) -> - editSession?.setSelectedBufferRanges(oldSelectedRanges) - - fn() - newSelectedRanges = @getSelectedBufferRanges() - @pushOperation - redo: (editSession) -> - editSession?.setSelectedBufferRanges(newSelectedRanges) - - pushOperation: (operation) -> - @buffer.pushOperation(operation, this) - - getAnchors: -> - new Array(@anchors...) - - getAnchorRanges: -> - new Array(@anchorRanges...) - - addAnchor: (options={}) -> - anchor = @buffer.addAnchor(_.extend({editSession: this}, options)) - @anchors.push(anchor) - anchor - - addAnchorAtBufferPosition: (bufferPosition, options) -> - anchor = @addAnchor(options) - anchor.setBufferPosition(bufferPosition) - anchor - - addAnchorRange: (range) -> - anchorRange = @buffer.addAnchorRange(range, this) - @anchorRanges.push(anchorRange) - anchorRange - - removeAnchor: (anchor) -> - _.remove(@anchors, anchor) - - removeAnchorRange: (anchorRange) -> - _.remove(@anchorRanges, anchorRange) - - hasMultipleCursors: -> - @getCursors().length > 1 - - getCursors: -> new Array(@cursors...) - - getCursor: (index=0) -> - @cursors[index] - - getLastCursor: -> - _.last(@cursors) - - addCursorAtScreenPosition: (screenPosition) -> - @addCursor(new Cursor(editSession: this, screenPosition: screenPosition)) - - addCursorAtBufferPosition: (bufferPosition) -> - @addCursor(new Cursor(editSession: this, bufferPosition: bufferPosition)) - - addCursor: (cursor=new Cursor(editSession: this, screenPosition: [0,0])) -> - @cursors.push(cursor) - @trigger 'add-cursor', cursor - @addSelectionForCursor(cursor) - cursor - - removeCursor: (cursor) -> - _.remove(@cursors, cursor) - - addSelectionForCursor: (cursor) -> - selection = new Selection(editSession: this, cursor: cursor) - @selections.push(selection) - @trigger 'add-selection', selection - selection - - addSelectionForBufferRange: (bufferRange, options={}) -> - bufferRange = Range.fromObject(bufferRange) - @destroyFoldsIntersectingBufferRange(bufferRange) unless options.preserveFolds - @addCursor().selection.setBufferRange(bufferRange, options) - @mergeIntersectingSelections() - - setSelectedBufferRange: (bufferRange, options) -> - @setSelectedBufferRanges([bufferRange], options) - - setSelectedBufferRanges: (bufferRanges, options={}) -> - throw new Error("Passed an empty array to setSelectedBufferRanges") unless bufferRanges.length - - selections = @getSelections() - selection.destroy() for selection in selections[bufferRanges.length...] - - for bufferRange, i in bufferRanges - bufferRange = Range.fromObject(bufferRange) - if selections[i] - selections[i].setBufferRange(bufferRange, options) - else - @addSelectionForBufferRange(bufferRange, options) - @mergeIntersectingSelections(options) - - removeSelection: (selection) -> - _.remove(@selections, selection) - - clearSelections: -> - lastSelection = @getLastSelection() - for selection in @getSelections() when selection != lastSelection - selection.destroy() - lastSelection.clear() - - clearAllSelections: -> - selection.destroy() for selection in @getSelections() - - getSelections: -> new Array(@selections...) - - getSelection: (index) -> - index ?= @selections.length - 1 - @selections[index] - - getLastSelection: -> - _.last(@selections) - - getSelectionsOrderedByBufferPosition: -> - @getSelections().sort (a, b) -> - aRange = a.getBufferRange() - bRange = b.getBufferRange() - aRange.end.compare(bRange.end) - - getLastSelectionInBuffer: -> - _.last(@getSelectionsOrderedByBufferPosition()) - - selectionIntersectsBufferRange: (bufferRange) -> - _.any @getSelections(), (selection) -> - selection.intersectsBufferRange(bufferRange) - - setCursorScreenPosition: (position) -> - @moveCursors (cursor) -> cursor.setScreenPosition(position) - - getCursorScreenPosition: -> - @getLastCursor().getScreenPosition() - - setCursorBufferPosition: (position) -> - @moveCursors (cursor) -> cursor.setBufferPosition(position) - - getCursorBufferPosition: -> - @getLastCursor().getBufferPosition() - - getSelectedScreenRange: -> - @getLastSelection().getScreenRange() - - getSelectedBufferRange: -> - @getLastSelection().getBufferRange() - - getSelectedBufferRanges: -> - selection.getBufferRange() for selection in @getSelectionsOrderedByBufferPosition() - - getSelectedText: -> - @getLastSelection().getText() - - getTextInBufferRange: (range) -> - @buffer.getTextInRange(range) - - moveCursorUp: -> - @moveCursors (cursor) -> cursor.moveUp() - - moveCursorDown: -> - @moveCursors (cursor) -> cursor.moveDown() - - moveCursorLeft: -> - @moveCursors (cursor) -> cursor.moveLeft() - - moveCursorRight: -> - @moveCursors (cursor) -> cursor.moveRight() - - moveCursorToTop: -> - @moveCursors (cursor) -> cursor.moveToTop() - - moveCursorToBottom: -> - @moveCursors (cursor) -> cursor.moveToBottom() - - moveCursorToBeginningOfLine: -> - @moveCursors (cursor) -> cursor.moveToBeginningOfLine() - - moveCursorToFirstCharacterOfLine: -> - @moveCursors (cursor) -> cursor.moveToFirstCharacterOfLine() - - moveCursorToEndOfLine: -> - @moveCursors (cursor) -> cursor.moveToEndOfLine() - - moveCursorToNextWord: -> - @moveCursors (cursor) -> cursor.moveToNextWord() - - moveCursorToBeginningOfWord: -> - @moveCursors (cursor) -> cursor.moveToBeginningOfWord() - - moveCursorToEndOfWord: -> - @moveCursors (cursor) -> cursor.moveToEndOfWord() - - moveCursors: (fn) -> - fn(cursor) for cursor in @getCursors() - @mergeCursors() - - selectToScreenPosition: (position) -> - lastSelection = @getLastSelection() - lastSelection.selectToScreenPosition(position) - @mergeIntersectingSelections(reverse: lastSelection.isReversed()) - - selectRight: -> - @expandSelectionsForward (selection) => selection.selectRight() - - selectLeft: -> - @expandSelectionsBackward (selection) => selection.selectLeft() - - selectUp: -> - @expandSelectionsBackward (selection) => selection.selectUp() - - selectDown: -> - @expandSelectionsForward (selection) => selection.selectDown() - - selectToTop: -> - @expandSelectionsBackward (selection) => selection.selectToTop() - - selectAll: -> - @expandSelectionsForward (selection) => selection.selectAll() - - selectToBottom: -> - @expandSelectionsForward (selection) => selection.selectToBottom() - - selectToBeginningOfLine: -> - @expandSelectionsBackward (selection) => selection.selectToBeginningOfLine() - - selectToEndOfLine: -> - @expandSelectionsForward (selection) => selection.selectToEndOfLine() - - selectLine: -> - @expandSelectionsForward (selection) => selection.selectLine() - - expandLastSelectionOverLine: -> - @getLastSelection().expandOverLine() - - selectToBeginningOfWord: -> - @expandSelectionsBackward (selection) => selection.selectToBeginningOfWord() - - selectToEndOfWord: -> - @expandSelectionsForward (selection) => selection.selectToEndOfWord() - - selectWord: -> - @expandSelectionsForward (selection) => selection.selectWord() - - expandLastSelectionOverWord: -> - @getLastSelection().expandOverWord() - - mergeCursors: -> - positions = [] - for cursor in new Array(@getCursors()...) - position = cursor.getBufferPosition().toString() - if position in positions - cursor.destroy() - else - positions.push(position) - - expandSelectionsForward: (fn) -> - fn(selection) for selection in @getSelections() - @mergeIntersectingSelections() - - expandSelectionsBackward: (fn) -> - fn(selection) for selection in @getSelections() - @mergeIntersectingSelections(reverse: true) - - mergeIntersectingSelections: (options) -> - for selection in @getSelections() - otherSelections = @getSelections() - _.remove(otherSelections, selection) - for otherSelection in otherSelections - if selection.intersectsWith(otherSelection) - selection.merge(otherSelection, options) - @mergeIntersectingSelections(options) - return - - inspect: -> - JSON.stringify @serialize() - -_.extend(EditSession.prototype, EventEmitter) diff --git a/src/app/editor.coffee b/src/app/editor.coffee deleted file mode 100644 index 0ad0d08ea..000000000 --- a/src/app/editor.coffee +++ /dev/null @@ -1,869 +0,0 @@ -{View, $$} = require 'space-pen' -Buffer = require 'buffer' -Gutter = require 'gutter' -Point = require 'point' -Range = require 'range' -EditSession = require 'edit-session' -CursorView = require 'cursor-view' -SelectionView = require 'selection-view' -Native = require 'native' -fs = require 'fs' - -$ = require 'jquery' -_ = require 'underscore' - -module.exports = -class Editor extends View - @idCounter: 1 - - @content: (params) -> - @div class: @classes(params), tabindex: -1, => - @input class: 'hidden-input', outlet: 'hiddenInput' - @div class: 'flexbox', => - @subview 'gutter', new Gutter - @div class: 'scroll-view', outlet: 'scrollView', => - @div class: 'lines', outlet: 'renderedLines', => - @div class: 'vertical-scrollbar', outlet: 'verticalScrollbar', => - @div outlet: 'verticalScrollbarContent' - - @classes: ({mini} = {}) -> - classes = ['editor'] - classes.push 'mini' if mini - classes.join(' ') - - vScrollMargin: 2 - hScrollMargin: 10 - lineHeight: null - charWidth: null - charHeight: null - cursorViews: null - selectionViews: null - lineCache: null - isFocused: false - activeEditSession: null - editSessions: null - attached: false - lineOverdraw: 100 - - @deserialize: (state, rootView) -> - editSessions = state.editSessions.map (state) -> EditSession.deserialize(state, rootView.project) - editor = new Editor(editSession: editSessions[state.activeEditSessionIndex], mini: state.mini) - editor.editSessions = editSessions - editor.isFocused = state.isFocused - editor - - initialize: ({editSession, @mini} = {}) -> - requireStylesheet 'editor.css' - - @id = Editor.idCounter++ - @lineCache = [] - @bindKeys() - @handleEvents() - @cursorViews = [] - @selectionViews = [] - @editSessions = [] - - if editSession? - @editSessions.push editSession - @setActiveEditSessionIndex(0) - else if @mini - editSession = new EditSession - buffer: new Buffer() - softWrap: false - tabText: " " - autoIndent: false - softTabs: true - - @editSessions.push editSession - @setActiveEditSessionIndex(0) - else - throw new Error("Editor initialization requires an editSession") - - serialize: -> - @saveActiveEditSession() - - viewClass: "Editor" - editSessions: @editSessions.map (session) -> session.serialize() - activeEditSessionIndex: @getActiveEditSessionIndex() - isFocused: @isFocused - - copy: -> - Editor.deserialize(@serialize(), @rootView()) - - bindKeys: -> - editorBindings = - 'move-right': @moveCursorRight - 'move-left': @moveCursorLeft - 'move-down': @moveCursorDown - 'move-up': @moveCursorUp - 'move-to-next-word': @moveCursorToNextWord - 'move-to-previous-word': @moveCursorToPreviousWord - 'select-right': @selectRight - 'select-left': @selectLeft - 'select-up': @selectUp - 'select-down': @selectDown - 'select-word': @selectWord - 'newline': @insertNewline - 'indent': @indent - 'indent-selected-rows': @indentSelectedRows - 'outdent-selected-rows': @outdentSelectedRows - 'backspace': @backspace - 'backspace-to-beginning-of-word': @backspaceToBeginningOfWord - 'delete': @delete - 'delete-to-end-of-word': @deleteToEndOfWord - 'cut-to-end-of-line': @cutToEndOfLine - 'cut': @cutSelection - 'copy': @copySelection - 'paste': @paste - 'undo': @undo - 'redo': @redo - 'move-to-top': @moveCursorToTop - 'move-to-bottom': @moveCursorToBottom - 'move-to-beginning-of-line': @moveCursorToBeginningOfLine - 'move-to-end-of-line': @moveCursorToEndOfLine - 'move-to-first-character-of-line': @moveCursorToFirstCharacterOfLine - 'move-to-beginning-of-word': @moveCursorToBeginningOfWord - 'move-to-end-of-word': @moveCursorToEndOfWord - 'select-to-top': @selectToTop - 'select-to-bottom': @selectToBottom - 'select-to-end-of-line': @selectToEndOfLine - 'select-to-beginning-of-line': @selectToBeginningOfLine - 'select-to-end-of-word': @selectToEndOfWord - 'select-to-beginning-of-word': @selectToBeginningOfWord - 'select-all': @selectAll - - if not @mini - _.extend editorBindings, - 'save': @save - 'newline-below': @insertNewlineBelow - 'toggle-soft-wrap': @toggleSoftWrap - 'fold-all': @foldAll - 'unfold-all': @unfoldAll - 'fold-current-row': @foldCurrentRow - 'unfold-current-row': @unfoldCurrentRow - 'fold-selection': @foldSelection - 'split-left': @splitLeft - 'split-right': @splitRight - 'split-up': @splitUp - 'split-down': @splitDown - 'close': @close - 'show-next-buffer': @loadNextEditSession - 'show-previous-buffer': @loadPreviousEditSession - 'toggle-line-comments': @toggleLineCommentsInSelection - - - for name, method of editorBindings - do (name, method) => - @on name, => method.call(this); false - - getCursor: (index) -> @activeEditSession.getCursor(index) - getCursors: -> @activeEditSession.getCursors() - getLastCursor: -> @activeEditSession.getLastCursor() - addCursorAtScreenPosition: (screenPosition) -> @activeEditSession.addCursorAtScreenPosition(screenPosition) - addCursorAtBufferPosition: (bufferPosition) -> @activeEditSession.addCursorAtBufferPosition(bufferPosition) - moveCursorUp: -> @activeEditSession.moveCursorUp() - moveCursorDown: -> @activeEditSession.moveCursorDown() - moveCursorLeft: -> @activeEditSession.moveCursorLeft() - moveCursorRight: -> @activeEditSession.moveCursorRight() - moveCursorToNextWord: -> @activeEditSession.moveCursorToNextWord() - moveCursorToBeginningOfWord: -> @activeEditSession.moveCursorToBeginningOfWord() - moveCursorToEndOfWord: -> @activeEditSession.moveCursorToEndOfWord() - moveCursorToTop: -> @activeEditSession.moveCursorToTop() - moveCursorToBottom: -> @activeEditSession.moveCursorToBottom() - moveCursorToBeginningOfLine: -> @activeEditSession.moveCursorToBeginningOfLine() - moveCursorToFirstCharacterOfLine: -> @activeEditSession.moveCursorToFirstCharacterOfLine() - moveCursorToEndOfLine: -> @activeEditSession.moveCursorToEndOfLine() - setCursorScreenPosition: (position) -> @activeEditSession.setCursorScreenPosition(position) - getCursorScreenPosition: -> @activeEditSession.getCursorScreenPosition() - setCursorBufferPosition: (position) -> @activeEditSession.setCursorBufferPosition(position) - getCursorBufferPosition: -> @activeEditSession.getCursorBufferPosition() - - getSelection: (index) -> @activeEditSession.getSelection(index) - getSelections: -> @activeEditSession.getSelections() - getSelectionsOrderedByBufferPosition: -> @activeEditSession.getSelectionsOrderedByBufferPosition() - getLastSelectionInBuffer: -> @activeEditSession.getLastSelectionInBuffer() - getSelectedText: -> @activeEditSession.getSelectedText() - getSelectedBufferRanges: -> @activeEditSession.getSelectedBufferRanges() - getSelectedBufferRange: -> @activeEditSession.getSelectedBufferRange() - setSelectedBufferRange: (bufferRange, options) -> @activeEditSession.setSelectedBufferRange(bufferRange, options) - setSelectedBufferRanges: (bufferRanges, options) -> @activeEditSession.setSelectedBufferRanges(bufferRanges, options) - addSelectionForBufferRange: (bufferRange, options) -> @activeEditSession.addSelectionForBufferRange(bufferRange, options) - selectRight: -> @activeEditSession.selectRight() - selectLeft: -> @activeEditSession.selectLeft() - selectUp: -> @activeEditSession.selectUp() - selectDown: -> @activeEditSession.selectDown() - selectToTop: -> @activeEditSession.selectToTop() - selectToBottom: -> @activeEditSession.selectToBottom() - selectAll: -> @activeEditSession.selectAll() - selectToBeginningOfLine: -> @activeEditSession.selectToBeginningOfLine() - selectToEndOfLine: -> @activeEditSession.selectToEndOfLine() - selectToBeginningOfWord: -> @activeEditSession.selectToBeginningOfWord() - selectToEndOfWord: -> @activeEditSession.selectToEndOfWord() - selectWord: -> @activeEditSession.selectWord() - selectToScreenPosition: (position) -> @activeEditSession.selectToScreenPosition(position) - clearSelections: -> @activeEditSession.clearSelections() - - backspace: -> @activeEditSession.backspace() - backspaceToBeginningOfWord: -> @activeEditSession.backspaceToBeginningOfWord() - delete: -> @activeEditSession.delete() - deleteToEndOfWord: -> @activeEditSession.deleteToEndOfWord() - cutToEndOfLine: -> @activeEditSession.cutToEndOfLine() - insertText: (text) -> @activeEditSession.insertText(text) - insertNewline: -> @activeEditSession.insertNewline() - insertNewlineBelow: -> @activeEditSession.insertNewlineBelow() - indent: -> @activeEditSession.indent() - indentSelectedRows: -> @activeEditSession.indentSelectedRows() - outdentSelectedRows: -> @activeEditSession.outdentSelectedRows() - cutSelection: -> @activeEditSession.cutSelectedText() - copySelection: -> @activeEditSession.copySelectedText() - paste: -> @activeEditSession.pasteText() - undo: -> @activeEditSession.undo() - redo: -> @activeEditSession.redo() - createFold: (startRow, endRow) -> @activeEditSession.createFold(startRow, endRow) - foldCurrentRow: -> @activeEditSession.foldCurrentRow() - unfoldCurrentRow: -> @activeEditSession.unfoldCurrentRow() - foldAll: -> @activeEditSession.foldAll() - unfoldAll: -> @activeEditSession.unfoldAll() - foldSelection: -> @activeEditSession.foldSelection() - destroyFold: (foldId) -> @activeEditSession.destroyFold(foldId) - destroyFoldsContainingBufferRow: (bufferRow) -> @activeEditSession.destroyFoldsContainingBufferRow(bufferRow) - isFoldedAtScreenRow: (screenRow) -> @activeEditSession.isFoldedAtScreenRow(screenRow) - - lineForScreenRow: (screenRow) -> @activeEditSession.lineForScreenRow(screenRow) - linesForScreenRows: (start, end) -> @activeEditSession.linesForScreenRows(start, end) - screenLineCount: -> @activeEditSession.screenLineCount() - setSoftWrapColumn: (softWrapColumn) -> - softWrapColumn ?= @calcSoftWrapColumn() - @activeEditSession.setSoftWrapColumn(softWrapColumn) if softWrapColumn - - maxScreenLineLength: -> @activeEditSession.maxScreenLineLength() - getLastScreenRow: -> @activeEditSession.getLastScreenRow() - clipScreenPosition: (screenPosition, options={}) -> @activeEditSession.clipScreenPosition(screenPosition, options) - screenPositionForBufferPosition: (position, options) -> @activeEditSession.screenPositionForBufferPosition(position, options) - bufferPositionForScreenPosition: (position, options) -> @activeEditSession.bufferPositionForScreenPosition(position, options) - screenRangeForBufferRange: (range) -> @activeEditSession.screenRangeForBufferRange(range) - bufferRangeForScreenRange: (range) -> @activeEditSession.bufferRangeForScreenRange(range) - bufferRowsForScreenRows: (startRow, endRow) -> @activeEditSession.bufferRowsForScreenRows(startRow, endRow) - stateForScreenRow: (row) -> @activeEditSession.stateForScreenRow(row) - - setText: (text) -> @getBuffer().setText(text) - getText: -> @getBuffer().getText() - getPath: -> @getBuffer().getPath() - getLastBufferRow: -> @getBuffer().getLastRow() - getTextInRange: (range) -> @getBuffer().getTextInRange(range) - getEofPosition: -> @getBuffer().getEofPosition() - lineForBufferRow: (row) -> @getBuffer().lineForRow(row) - lineLengthForBufferRow: (row) -> @getBuffer().lineLengthForRow(row) - rangeForBufferRow: (row) -> @getBuffer().rangeForRow(row) - scanInRange: (args...) -> @getBuffer().scanInRange(args...) - backwardsScanInRange: (args...) -> @getBuffer().backwardsScanInRange(args...) - - handleEvents: -> - @on 'focus', => - @hiddenInput.focus() - false - - @hiddenInput.on 'focus', => - @rootView()?.editorFocused(this) - @isFocused = true - @addClass 'focused' - - @hiddenInput.on 'focusout', => - @isFocused = false - @removeClass 'focused' - - @renderedLines.on 'mousedown', '.fold.line', (e) => - @destroyFold($(e.currentTarget).attr('fold-id')) - false - - @renderedLines.on 'mousedown', (e) => - clickCount = e.originalEvent.detail - - screenPosition = @screenPositionFromMouseEvent(e) - if clickCount == 1 - if e.metaKey - @addCursorAtScreenPosition(screenPosition) - else if e.shiftKey - @selectToScreenPosition(screenPosition) - else - @setCursorScreenPosition(screenPosition) - else if clickCount == 2 - if e.shiftKey - @activeEditSession.expandLastSelectionOverWord() - else - @activeEditSession.selectWord() - else if clickCount >= 3 - if e.shiftKey - @activeEditSession.expandLastSelectionOverLine() - else - @activeEditSession.selectLine() - - @selectOnMousemoveUntilMouseup() - - @on "textInput", (e) => - @insertText(e.originalEvent.data) - false - - @scrollView.on 'mousewheel', (e) => - e = e.originalEvent - if e.wheelDeltaY - newEvent = document.createEvent("WheelEvent"); - newEvent.initWebKitWheelEvent(0, e.wheelDeltaY, e.view, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey) - @verticalScrollbar.get(0).dispatchEvent(newEvent) - false - - @verticalScrollbar.on 'scroll', => - @scrollTop(@verticalScrollbar.scrollTop(), adjustVerticalScrollbar: false) - - @scrollView.on 'scroll', => - if @scrollView.scrollLeft() == 0 - @gutter.removeClass('drop-shadow') - else - @gutter.addClass('drop-shadow') - - selectOnMousemoveUntilMouseup: -> - moveHandler = (e) => @selectToScreenPosition(@screenPositionFromMouseEvent(e)) - @on 'mousemove', moveHandler - $(document).one 'mouseup', => - @off 'mousemove', moveHandler - reverse = @activeEditSession.getLastSelection().isReversed() - @activeEditSession.mergeIntersectingSelections({reverse}) - @syncCursorAnimations() - - afterAttach: (onDom) -> - return if @attached or not onDom - @attached = true - @clearRenderedLines() - @subscribeToFontSize() - @calculateDimensions() - @hiddenInput.width(@charWidth) - @setSoftWrapColumn() if @activeEditSession.getSoftWrap() - $(window).on "resize.editor#{@id}", => - @updateRenderedLines() - @focus() if @isFocused - - @renderWhenAttached() - - @trigger 'editor-open', [this] - - edit: (editSession) -> - index = @editSessions.indexOf(editSession) - - if index == -1 - index = @editSessions.length - @editSessions.push(editSession) - - @setActiveEditSessionIndex(index) - - getBuffer: -> @activeEditSession.buffer - - destroyActiveEditSession: -> - if @editSessions.length == 1 - @remove() - else - editSession = @activeEditSession - @loadPreviousEditSession() - _.remove(@editSessions, editSession) - editSession.destroy() - - loadNextEditSession: -> - nextIndex = (@getActiveEditSessionIndex() + 1) % @editSessions.length - @setActiveEditSessionIndex(nextIndex) - - loadPreviousEditSession: -> - previousIndex = @getActiveEditSessionIndex() - 1 - previousIndex = @editSessions.length - 1 if previousIndex < 0 - @setActiveEditSessionIndex(previousIndex) - - getActiveEditSessionIndex: -> - return index for session, index in @editSessions when session == @activeEditSession - - setActiveEditSessionIndex: (index) -> - throw new Error("Edit session not found") unless @editSessions[index] - - if @activeEditSession - @saveActiveEditSession() - @activeEditSession.off() - - @activeEditSession = @editSessions[index] - - @activeEditSession.on "buffer-contents-change-on-disk", => - @showBufferConflictAlert(@activeEditSession) - - @activeEditSession.on "buffer-path-change", => - @trigger 'editor-path-change' - - @trigger 'editor-path-change' - @renderWhenAttached() - - if @attached and @activeEditSession.buffer.isInConflict() - @showBufferConflictAlert(@activeEditSession) - - showBufferConflictAlert: (editSession) -> - message = editSession.getPath() - detailedMessage = "Has changed on disk. Do you want to reload it?" - Native.alert message, detailedMessage, [ - ["Reload", => editSession.buffer.reload()] - ["Cancel", => ], - ] - - activateEditSessionForPath: (path) -> - for editSession, index in @editSessions - if editSession.buffer.getPath() == path - @setActiveEditSessionIndex(index) - return @activeEditSession - false - - getOpenBufferPaths: -> - editSession.buffer.getPath() for editSession in @editSessions when editSession.buffer.getPath()? - - scrollTop: (scrollTop, options) -> - return @cachedScrollTop or 0 unless scrollTop? - - maxScrollTop = @verticalScrollbar.prop('scrollHeight') - @verticalScrollbar.height() - scrollTop = Math.floor(Math.min(maxScrollTop, Math.max(0, scrollTop))) - - return if scrollTop == @cachedScrollTop - @cachedScrollTop = scrollTop - - @updateRenderedLines() if @attached - - @renderedLines.css('top', -scrollTop) - @gutter.lineNumbers.css('top', -scrollTop) - if options?.adjustVerticalScrollbar ? true - @verticalScrollbar.scrollTop(scrollTop) - - scrollBottom: (scrollBottom) -> - if scrollBottom? - @scrollTop(scrollBottom - @scrollView.height()) - else - @scrollTop() + @scrollView.height() - - scrollToBottom: -> - @scrollBottom(@scrollView.prop('scrollHeight')) - - scrollTo: (pixelPosition) -> - return unless @attached - @scrollVertically(pixelPosition) - @scrollHorizontally(pixelPosition) - - scrollVertically: (pixelPosition) -> - linesInView = @scrollView.height() / @lineHeight - maxScrollMargin = Math.floor((linesInView - 1) / 2) - scrollMargin = Math.min(@vScrollMargin, maxScrollMargin) - margin = scrollMargin * @lineHeight - desiredTop = pixelPosition.top - margin - desiredBottom = pixelPosition.top + @lineHeight + margin - - scrollViewHeight = @scrollView.height() - if desiredBottom > @scrollTop() + scrollViewHeight - @scrollTop(desiredBottom - scrollViewHeight) - else if desiredTop < @scrollTop() - @scrollTop(desiredTop) - - scrollHorizontally: (pixelPosition) -> - return if @activeEditSession.getSoftWrap() - - charsInView = @scrollView.width() / @charWidth - maxScrollMargin = Math.floor((charsInView - 1) / 2) - scrollMargin = Math.min(@hScrollMargin, maxScrollMargin) - margin = scrollMargin * @charWidth - desiredRight = pixelPosition.left + @charWidth + margin - desiredLeft = pixelPosition.left - margin - - if desiredRight > @scrollView.scrollRight() - @scrollView.scrollRight(desiredRight) - else if desiredLeft < @scrollView.scrollLeft() - @scrollView.scrollLeft(desiredLeft) - - highlightFoldsContainingBufferRange: (bufferRange) -> - screenLines = @linesForScreenRows(@firstRenderedScreenRow, @lastRenderedScreenRow) - for screenLine, i in screenLines - if fold = screenLine.fold - screenRow = @firstRenderedScreenRow + i - element = @lineElementForScreenRow(screenRow) - - if bufferRange.intersectsWith(fold.getBufferRange()) - element.addClass('selected') - else - element.removeClass('selected') - - setScrollPositionFromActiveEditSession: -> - @scrollTop(@activeEditSession.scrollTop ? 0) - @scrollView.scrollLeft(@activeEditSession.scrollLeft ? 0) - - saveActiveEditSession: -> - @activeEditSession.setScrollTop(@scrollTop()) - @activeEditSession.setScrollLeft(@scrollView.scrollLeft()) - - toggleSoftWrap: -> - @setSoftWrap(not @activeEditSession.getSoftWrap()) - - calcSoftWrapColumn: -> - if @activeEditSession.getSoftWrap() - Math.floor(@scrollView.width() / @charWidth) - else - Infinity - - setSoftWrap: (softWrap, softWrapColumn=undefined) -> - @activeEditSession.setSoftWrap(softWrap) - @setSoftWrapColumn(softWrapColumn) if @attached - if @activeEditSession.getSoftWrap() - @addClass 'soft-wrap' - @_setSoftWrapColumn = => @setSoftWrapColumn() - $(window).on 'resize', @_setSoftWrapColumn - else - @removeClass 'soft-wrap' - $(window).off 'resize', @_setSoftWrapColumn - - save: -> - if not @getPath() - path = Native.saveDialog() - return false if not path - @getBuffer().saveAs(path) - else - @getBuffer().save() - true - - subscribeToFontSize: -> - return unless rootView = @rootView() - @setFontSize(rootView.getFontSize()) - rootView.on "font-size-change.editor#{@id}", => @setFontSize(rootView.getFontSize()) - - setFontSize: (fontSize) -> - if fontSize? - @css('font-size', fontSize + 'px') - @calculateDimensions() - @updateCursorViews() - @updateRenderedLines() - - newSplitEditor: -> - new Editor { editSession: @activeEditSession.copy() } - - splitLeft: -> - @pane()?.splitLeft(@newSplitEditor()).wrappedView - - splitRight: -> - @pane()?.splitRight(@newSplitEditor()).wrappedView - - splitUp: -> - @pane()?.splitUp(@newSplitEditor()).wrappedView - - splitDown: -> - @pane()?.splitDown(@newSplitEditor()).wrappedView - - pane: -> - @parent('.pane').view() - - rootView: -> - @parents('#root-view').view() - - close: -> - return if @mini - if @getBuffer().isModified() - filename = if @getPath() then fs.base(@getPath()) else "untitled buffer" - message = "'#{filename}' has changes, do you want to save them?" - detailedMessage = "Your changes will be lost if you don't save them" - buttons = [ - ["Save", => @save() and @destroyActiveEditSession()] - ["Cancel", =>] - ["Don't save", => @destroyActiveEditSession()] - ] - - Native.alert message, detailedMessage, buttons - else - @destroyActiveEditSession() - - remove: (selector, keepData) -> - return super if keepData - - @trigger 'before-remove' - - @destroyEditSessions() - - $(window).off ".editor#{@id}" - rootView = @rootView() - rootView?.off ".editor#{@id}" - if @pane() then @pane().remove() else super - rootView?.focus() - - getEditSessions: -> - new Array(@editSessions...) - - destroyEditSessions: -> - for session in @getEditSessions() - session.destroy() - - renderWhenAttached: -> - return unless @attached - - @removeAllCursorAndSelectionViews() - @addCursorView(cursor) for cursor in @activeEditSession.getCursors() - @addSelectionView(selection) for selection in @activeEditSession.getSelections() - @activeEditSession.on 'add-cursor', (cursor) => @addCursorView(cursor) - @activeEditSession.on 'add-selection', (selection) => @addSelectionView(selection) - - @prepareForScrolling() - @setScrollPositionFromActiveEditSession() - - @renderLines() - @activeEditSession.on 'screen-lines-change', (e) => @handleDisplayBufferChange(e) - - getCursorView: (index) -> - index ?= @cursorViews.length - 1 - @cursorViews[index] - - getCursorViews: -> - new Array(@cursorViews...) - - addCursorView: (cursor) -> - cursorView = new CursorView(cursor, this) - @cursorViews.push(cursorView) - @renderedLines.append(cursorView) - cursorView - - removeCursorView: (cursorView) -> - _.remove(@cursorViews, cursorView) - - updateCursorViews: -> - for cursorView in @getCursorViews() - cursorView.updateAppearance() - - syncCursorAnimations: -> - for cursorView in @getCursorViews() - do (cursorView) -> cursorView.resetCursorAnimation() - - getSelectionView: (index) -> - index ?= @selectionViews.length - 1 - @selectionViews[index] - - getSelectionViews: -> - new Array(@selectionViews...) - - addSelectionView: (selection) -> - selectionView = new SelectionView({editor: this, selection}) - @selectionViews.push(selectionView) - @renderedLines.append(selectionView) - selectionView - - removeSelectionView: (selectionView) -> - _.remove(@selectionViews, selectionView) - - removeAllCursorAndSelectionViews: -> - cursorView.remove() for cursorView in @getCursorViews() - selectionView.remove() for selectionView in @getSelectionViews() - - calculateDimensions: -> - fragment = $('') - @renderedLines.append(fragment) - @charWidth = fragment.width() - @charHeight = fragment.find('span').height() - @lineHeight = fragment.outerHeight() - @height(@lineHeight) if @mini - fragment.remove() - - @gutter.calculateDimensions() - - prepareForScrolling: -> - @adjustHeightOfRenderedLines() - @adjustWidthOfRenderedLines() - - adjustHeightOfRenderedLines: -> - heightOfRenderedLines = @lineHeight * @screenLineCount() - @verticalScrollbarContent.height(heightOfRenderedLines) - @renderedLines.css('padding-bottom', heightOfRenderedLines) - - adjustWidthOfRenderedLines: -> - width = @charWidth * @maxScreenLineLength() - if width > @scrollView.width() - @renderedLines.width(width) - else - @renderedLines.css('width', '') - - handleScrollHeightChange: -> - scrollHeight = @lineHeight * @screenLineCount() - @verticalScrollbarContent.height(scrollHeight) - @scrollBottom(scrollHeight) if @scrollBottom() > scrollHeight - - renderLines: -> - @clearRenderedLines() - @updateRenderedLines() - - clearRenderedLines: -> - @lineCache = [] - @renderedLines.find('.line').remove() - - @firstRenderedScreenRow = -1 - @lastRenderedScreenRow = -1 - - updateRenderedLines: -> - firstVisibleScreenRow = @getFirstVisibleScreenRow() - lastVisibleScreenRow = @getLastVisibleScreenRow() - renderFrom = Math.max(0, firstVisibleScreenRow - @lineOverdraw) - renderTo = Math.min(@getLastScreenRow(), lastVisibleScreenRow + @lineOverdraw) - - if firstVisibleScreenRow < @firstRenderedScreenRow - @removeLineElements(Math.max(@firstRenderedScreenRow, renderTo + 1), @lastRenderedScreenRow) - @lastRenderedScreenRow = renderTo - newLines = @buildLineElements(renderFrom, Math.min(@firstRenderedScreenRow - 1, renderTo)) - @insertLineElements(renderFrom, newLines) - @firstRenderedScreenRow = renderFrom - renderedLines = true - - if lastVisibleScreenRow > @lastRenderedScreenRow - if 0 <= @firstRenderedScreenRow < renderFrom - @removeLineElements(@firstRenderedScreenRow, Math.min(@lastRenderedScreenRow, renderFrom - 1)) - @firstRenderedScreenRow = renderFrom - startRowOfNewLines = Math.max(@lastRenderedScreenRow + 1, renderFrom) - newLines = @buildLineElements(startRowOfNewLines, renderTo) - @insertLineElements(startRowOfNewLines, newLines) - @lastRenderedScreenRow = renderTo - renderedLines = true - - if renderedLines - @gutter.renderLineNumbers(renderFrom, renderTo) - @updatePaddingOfRenderedLines() - - updatePaddingOfRenderedLines: -> - paddingTop = @firstRenderedScreenRow * @lineHeight - @renderedLines.css('padding-top', paddingTop) - @gutter.lineNumbers.css('padding-top', paddingTop) - - paddingBottom = (@getLastScreenRow() - @lastRenderedScreenRow) * @lineHeight - @renderedLines.css('padding-bottom', paddingBottom) - @gutter.lineNumbers.css('padding-bottom', paddingBottom) - - getFirstVisibleScreenRow: -> - Math.floor(@scrollTop() / @lineHeight) - - getLastVisibleScreenRow: -> - Math.ceil((@scrollTop() + @scrollView.height()) / @lineHeight) - 1 - - handleDisplayBufferChange: (e) -> - oldScreenRange = e.oldRange - newScreenRange = e.newRange - - if @attached - @handleScrollHeightChange() unless newScreenRange.coversSameRows(oldScreenRange) - @adjustWidthOfRenderedLines() - - return if oldScreenRange.start.row > @lastRenderedScreenRow - - maxEndRow = Math.max(@getLastVisibleScreenRow() + @lineOverdraw, @lastRenderedScreenRow) - @gutter.renderLineNumbers(@firstRenderedScreenRow, maxEndRow) if e.lineNumbersChanged - - newScreenRange = newScreenRange.copy() - oldScreenRange = oldScreenRange.copy() - endOfShortestRange = Math.min(oldScreenRange.end.row, newScreenRange.end.row) - - delta = @firstRenderedScreenRow - endOfShortestRange - if delta > 0 - newScreenRange.start.row += delta - newScreenRange.end.row += delta - oldScreenRange.start.row += delta - oldScreenRange.end.row += delta - - newScreenRange.start.row = Math.max(newScreenRange.start.row, @firstRenderedScreenRow) - oldScreenRange.end.row = Math.min(oldScreenRange.end.row, @lastRenderedScreenRow) - oldScreenRange.start.row = Math.max(oldScreenRange.start.row, @firstRenderedScreenRow) - newScreenRange.end.row = Math.min(newScreenRange.end.row, maxEndRow) - - lineElements = @buildLineElements(newScreenRange.start.row, newScreenRange.end.row) - @replaceLineElements(oldScreenRange.start.row, oldScreenRange.end.row, lineElements) - - rowDelta = newScreenRange.end.row - oldScreenRange.end.row - @lastRenderedScreenRow += rowDelta - @updateRenderedLines() if rowDelta < 0 - - if @lastRenderedScreenRow > maxEndRow - @removeLineElements(maxEndRow + 1, @lastRenderedScreenRow) - @lastRenderedScreenRow = maxEndRow - @updatePaddingOfRenderedLines() - - buildLineElements: (startRow, endRow) -> - charWidth = @charWidth - charHeight = @charHeight - lines = @activeEditSession.linesForScreenRows(startRow, endRow) - activeEditSession = @activeEditSession - - $$ -> - for line in lines - if fold = line.fold - lineAttributes = { class: 'fold line', 'fold-id': fold.id } - if activeEditSession.selectionIntersectsBufferRange(fold.getBufferRange()) - lineAttributes.class += ' selected' - else - lineAttributes = { class: 'line' } - @div lineAttributes, => - if line.text == '' - @raw ' ' if line.text == '' - else - for token in line.tokens - @span { class: token.getCssClassString() }, token.value - - insertLineElements: (row, lineElements) -> - @spliceLineElements(row, 0, lineElements) - - replaceLineElements: (startRow, endRow, lineElements) -> - @spliceLineElements(startRow, endRow - startRow + 1, lineElements) - - removeLineElements: (startRow, endRow) -> - @spliceLineElements(startRow, endRow - startRow + 1) - - spliceLineElements: (startScreenRow, rowCount, lineElements) -> - throw new Error("Splicing at a negative start row: #{startScreenRow}") if startScreenRow < 0 - - if startScreenRow < @firstRenderedScreenRow - startRow = 0 - else - startRow = startScreenRow - @firstRenderedScreenRow - - endRow = startRow + rowCount - - elementToInsertBefore = @lineCache[startRow] - elementsToReplace = @lineCache[startRow...endRow] - @lineCache[startRow...endRow] = lineElements?.toArray() or [] - - lines = @renderedLines[0] - if lineElements - fragment = document.createDocumentFragment() - lineElements.each -> fragment.appendChild(this) - if elementToInsertBefore - lines.insertBefore(fragment, elementToInsertBefore) - else - lines.appendChild(fragment) - - elementsToReplace.forEach (element) => - lines.removeChild(element) - - lineElementForScreenRow: (screenRow) -> - element = @lineCache[screenRow - @firstRenderedScreenRow] - $(element) - - logScreenLines: (start, end) -> - @activeEditSession.logScreenLines(start, end) - - toggleLineCommentsInSelection: -> - @activeEditSession.toggleLineCommentsInSelection() - - logRenderedLines: -> - @renderedLines.find('.line').each (n) -> - console.log n, $(this).text() - - pixelPositionForScreenPosition: (position) -> - position = Point.fromObject(position) - { top: position.row * @lineHeight, left: position.column * @charWidth } - - pixelOffsetForScreenPosition: (position) -> - {top, left} = @pixelPositionForScreenPosition(position) - offset = @renderedLines.offset() - {top: top + offset.top, left: left + offset.left} - - screenPositionFromPixelPosition: ({top, left}) -> - screenPosition = new Point(Math.floor(top / @lineHeight), Math.floor(left / @charWidth)) - - screenPositionFromMouseEvent: (e) -> - { pageX, pageY } = e - @screenPositionFromPixelPosition - top: pageY - @scrollView.offset().top + @scrollTop() - left: pageX - @scrollView.offset().left + @scrollView.scrollLeft() diff --git a/src/app/event-emitter.coffee b/src/app/event-emitter.coffee deleted file mode 100644 index 8b28395ba..000000000 --- a/src/app/event-emitter.coffee +++ /dev/null @@ -1,62 +0,0 @@ -_ = require 'underscore' - -module.exports = - on: (eventName, handler) -> - [eventName, namespace] = eventName.split('.') - - @eventHandlersByEventName ?= {} - @eventHandlersByEventName[eventName] ?= [] - @eventHandlersByEventName[eventName].push(handler) - - if namespace - @eventHandlersByNamespace ?= {} - @eventHandlersByNamespace[namespace] ?= {} - @eventHandlersByNamespace[namespace][eventName] ?= [] - @eventHandlersByNamespace[namespace][eventName].push(handler) - - @afterSubscribe?() - - trigger: (eventName, args...) -> - [eventName, namespace] = eventName.split('.') - - if namespace - @eventHandlersByNamespace?[namespace]?[eventName]?.forEach (handler) -> handler(args...) - else - @eventHandlersByEventName?[eventName]?.forEach (handler) -> handler(args...) - - off: (eventName='', handler) -> - [eventName, namespace] = eventName.split('.') - eventName = undefined if eventName == '' - - subscriptionCountBefore = @subscriptionCount() - - if !eventName? and !namespace? - @eventHandlersByEventName = {} - @eventHandlersByNamespace = {} - else if namespace - if eventName - handlers = @eventHandlersByNamespace?[namespace]?[eventName] ? [] - for handler in new Array(handlers...) - _.remove(handlers, handler) - @off eventName, handler - return - else - for eventName, handlers of @eventHandlersByNamespace?[namespace] ? {} - for handler in new Array(handlers...) - _.remove(handlers, handler) - @off eventName, handler - return - else - if handler - _.remove(@eventHandlersByEventName[eventName], handler) - else - delete @eventHandlersByEventName?[eventName] - - @afterUnsubscribe?() if @subscriptionCount() < subscriptionCountBefore - - subscriptionCount: -> - count = 0 - for name, handlers of @eventHandlersByEventName - count += handlers.length - count - diff --git a/src/app/file.coffee b/src/app/file.coffee deleted file mode 100644 index 498b96e27..000000000 --- a/src/app/file.coffee +++ /dev/null @@ -1,50 +0,0 @@ -EventEmitter = require 'event-emitter' - -fs = require 'fs' -_ = require 'underscore' - -module.exports = -class File - path: null - md5: null - - constructor: (@path) -> - throw "Creating file with path that is not a file: #{@path}" unless fs.isFile(@path) - @updateMd5() - - setPath: (@path) -> - - getPath: -> - @path - - getBaseName: -> - fs.base(@path) - - updateMd5: -> - @md5 = fs.md5ForPath(@path) - - afterSubscribe: -> - @subscribeToNativeChangeEvents() if @subscriptionCount() == 1 - - afterUnsubscribe: -> - @unsubscribeFromNativeChangeEvents() if @subscriptionCount() == 0 - - subscribeToNativeChangeEvents: -> - @watchId = $native.watchPath @path, (eventType, path) => - if eventType is "remove" - @trigger "remove" - @off() - else if eventType is "move" - @setPath(path) - @trigger "move" - else if eventType is "contents-change" - newMd5 = fs.md5ForPath(@getPath()) - return if newMd5 == @md5 - - @md5 = newMd5 - @trigger 'contents-change' - - unsubscribeFromNativeChangeEvents: -> - $native.unwatchPath(@path, @watchId) - -_.extend File.prototype, EventEmitter diff --git a/src/app/fold.coffee b/src/app/fold.coffee deleted file mode 100644 index 966bf86f5..000000000 --- a/src/app/fold.coffee +++ /dev/null @@ -1,74 +0,0 @@ -Range = require 'range' -Point = require 'point' - -module.exports = -class Fold - @idCounter: 1 - - displayBuffer: null - startRow: null - endRow: null - - constructor: (@displayBuffer, @startRow, @endRow) -> - @id = @constructor.idCounter++ - - destroy: -> - @displayBuffer.destroyFold(this) - - inspect: -> - "Fold(#{@startRow}, #{@endRow})" - - getBufferRange: ({includeNewline}={}) -> - if includeNewline - end = [@endRow + 1, 0] - else - end = [@endRow, Infinity] - - new Range([@startRow, 0], end) - - getBufferDelta: -> - new Point(@endRow - @startRow + 1, 0) - - handleBufferChange: (event) -> - oldStartRow = @startRow - - if @isContainedByRange(event.oldRange) - @displayBuffer.unregisterFold(@startRow, this) - return - - @updateStartRow(event) - @updateEndRow(event) - - if @startRow != oldStartRow - @displayBuffer.unregisterFold(oldStartRow, this) - @displayBuffer.registerFold(this) - - isContainedByRange: (range) -> - range.start.row <= @startRow and @endRow <= range.end.row - - isContainedByFold: (fold) -> - @isContainedByRange(fold.getBufferRange()) - - updateStartRow: (event) -> - { newRange, oldRange } = event - - if oldRange.end.row < @startRow - delta = newRange.end.row - oldRange.end.row - else if newRange.end.row < @startRow - delta = newRange.end.row - @startRow - else - delta = 0 - - @startRow += delta - - updateEndRow: (event) -> - { newRange, oldRange } = event - - if oldRange.end.row <= @endRow - delta = newRange.end.row - oldRange.end.row - else if newRange.end.row <= @endRow - delta = newRange.end.row - @endRow - else - delta = 0 - - @endRow += delta diff --git a/src/app/gutter.coffee b/src/app/gutter.coffee deleted file mode 100644 index 7001b421e..000000000 --- a/src/app/gutter.coffee +++ /dev/null @@ -1,27 +0,0 @@ -{View, $$$} = require 'space-pen' - -$ = require 'jquery' -_ = require 'underscore' - -module.exports = -class Gutter extends View - @content: -> - @div class: 'gutter', => - @div outlet: 'lineNumbers', class: 'line-numbers' - - editor: -> - editor = @parentView - - renderLineNumbers: (startScreenRow, endScreenRow) -> - lastScreenRow = -1 - rows = @editor().bufferRowsForScreenRows(startScreenRow, endScreenRow) - - @lineNumbers[0].innerHTML = $$$ -> - for row in rows - @div {class: 'line-number'}, if row == lastScreenRow then '•' else row + 1 - lastScreenRow = row - - @calculateDimensions() - - calculateDimensions: -> - @lineNumbers.width(@editor().getLastBufferRow().toString().length * @editor().charWidth) diff --git a/src/app/keymap.coffee b/src/app/keymap.coffee deleted file mode 100644 index 1faa80063..000000000 --- a/src/app/keymap.coffee +++ /dev/null @@ -1,122 +0,0 @@ -$ = require 'jquery' -_ = require 'underscore' -fs = require 'fs' - -BindingSet = require 'binding-set' -Specificity = require 'specificity' - -module.exports = -class Keymap - bindingSets: null - queuedKeystrokes: null - - constructor: -> - @bindingSets = [] - - bindDefaultKeys: -> - @bindKeys "*", - 'meta-n': 'new-window' - 'meta-,': 'open-user-configuration' - 'meta-o': 'open' - - $(document).on 'new-window', => $native.newWindow() - $(document).on 'open-user-configuration', => atom.open(atom.configFilePath) - $(document).on 'open', => - path = $native.openDialog() - atom.open(path) if path - - bindKeys: (selector, bindings) -> - index = @bindingSets.length - @bindingSets.unshift(new BindingSet(selector, bindings, index)) - - bindingsForElement: (element) -> - keystrokeMap = {} - currentNode = $(element) - - while currentNode.length - bindingSets = @bindingSetsForNode(currentNode) - _.defaults(keystrokeMap, set.commandsByKeystrokes) for set in bindingSets - currentNode = currentNode.parent() - - keystrokeMap - - handleKeyEvent: (event) -> - event.keystrokes = @multiKeystrokeStringForEvent(event) - isMultiKeystroke = @queuedKeystrokes? - @queuedKeystrokes = null - currentNode = $(event.target) - while currentNode.length - candidateBindingSets = @bindingSetsForNode(currentNode) - for bindingSet in candidateBindingSets - command = bindingSet.commandForEvent(event) - if command - continue if @triggerCommandEvent(event, command) - return false - else if command == false - return false - - if bindingSet.matchesKeystrokePrefix(event) - @queuedKeystrokes = event.keystrokes - return false - currentNode = currentNode.parent() - - !isMultiKeystroke - - bindingSetsForNode: (node) -> - bindingSets = @bindingSets.filter (set) -> node.is(set.selector) - bindingSets.sort (a, b) -> - if b.specificity == a.specificity - b.index - a.index - else - b.specificity - a.specificity - - triggerCommandEvent: (keyEvent, commandName) -> - commandEvent = $.Event(commandName) - commandEvent.keyEvent = keyEvent - aborted = false - commandEvent.abortKeyBinding = -> - @stopImmediatePropagation() - aborted = true - $(keyEvent.target).trigger(commandEvent) - aborted - - multiKeystrokeStringForEvent: (event) -> - currentKeystroke = @keystrokeStringForEvent(event) - if @queuedKeystrokes - @queuedKeystrokes + ' ' + currentKeystroke - else - currentKeystroke - - keystrokeStringForEvent: (event) -> - if /^U\+/i.test event.originalEvent.keyIdentifier - hexCharCode = event.originalEvent.keyIdentifier.replace(/^U\+/i, '') - charCode = parseInt(hexCharCode, 16) - key = @keyFromCharCode(charCode) - else - key = event.originalEvent.keyIdentifier.toLowerCase() - - modifiers = '' - if event.altKey and key isnt 'alt' - modifiers += 'alt-' - if event.ctrlKey and key isnt 'ctrl' - modifiers += 'ctrl-' - if event.metaKey and key isnt 'meta' - modifiers += 'meta-' - - if event.shiftKey - isNamedKey = key.length > 1 - modifiers += 'shift-' if isNamedKey - else - key = key.toLowerCase() - - "#{modifiers}#{key}" - - keyFromCharCode: (charCode) -> - switch charCode - when 8 then 'backspace' - when 9 then 'tab' - when 13 then 'enter' - when 27 then 'escape' - when 32 then 'space' - when 127 then 'delete' - else String.fromCharCode(charCode) diff --git a/src/app/keymaps/apple.coffee b/src/app/keymaps/apple.coffee deleted file mode 100644 index b65aa1467..000000000 --- a/src/app/keymaps/apple.coffee +++ /dev/null @@ -1,15 +0,0 @@ -window.keymap.bindKeys '.editor' - 'meta-up': 'move-to-top' - 'meta-down': 'move-to-bottom' - 'meta-right': 'move-to-end-of-line' - 'meta-left': 'move-to-beginning-of-line' - 'alt-left': 'move-to-beginning-of-word' - 'alt-right': 'move-to-end-of-word' - 'meta-shift-up': 'select-to-top' - 'meta-shift-down': 'select-to-bottom' - 'meta-shift-left': 'select-to-beginning-of-line' - 'meta-shift-right': 'select-to-end-of-line' - 'alt-shift-left': 'select-to-beginning-of-word' - 'alt-shift-right': 'select-to-end-of-word' - 'alt-backspace': 'backspace-to-beginning-of-word' - 'alt-delete': 'delete-to-end-of-word' diff --git a/src/app/keymaps/atom.coffee b/src/app/keymaps/atom.coffee deleted file mode 100644 index 71f03d273..000000000 --- a/src/app/keymaps/atom.coffee +++ /dev/null @@ -1,7 +0,0 @@ -window.keymap.bindKeys '*' - 'meta-w': 'close' - 'alt-meta-i': 'toggle-dev-tools' - right: 'move-right' - left: 'move-left' - down: 'move-down' - up: 'move-up' diff --git a/src/app/keymaps/editor.coffee b/src/app/keymaps/editor.coffee deleted file mode 100644 index 5b2a819ff..000000000 --- a/src/app/keymaps/editor.coffee +++ /dev/null @@ -1,38 +0,0 @@ -window.keymap.bindKeys '.editor', - 'meta-s': 'save' - 'shift-right': 'select-right' - 'shift-left': 'select-left' - 'shift-up': 'select-up' - 'shift-down': 'select-down' - 'meta-a': 'select-all' - 'enter': 'newline' - 'meta-enter': 'newline-below' - 'tab': 'indent' - 'backspace': 'backspace' - 'shift-backspace': 'backspace' - 'delete': 'delete' - 'meta-x': 'cut' - 'meta-c': 'copy' - 'meta-v': 'paste' - 'meta-z': 'undo' - 'meta-Z': 'redo' - 'alt-meta-w': 'toggle-soft-wrap' - 'ctrl-[': 'fold-current-row' - 'ctrl-]': 'unfold-current-row' - 'ctrl-{': 'fold-all' - 'ctrl-}': 'unfold-all' - 'alt-meta-ctrl-f': 'fold-selection' - 'alt-meta-left': 'split-left' - 'alt-meta-right': 'split-right' - 'alt-meta-up': 'split-up' - 'alt-meta-down': 'split-down' - 'shift-tab': 'outdent-selected-rows' - 'meta-[': 'outdent-selected-rows' - 'meta-]': 'indent-selected-rows' - 'meta-{': 'show-previous-buffer' - 'meta-}': 'show-next-buffer' - 'meta-+': 'increase-font-size' - 'meta--': 'decrease-font-size' - 'meta-/': 'toggle-line-comments' - 'ctrl-w w': 'focus-next-pane' - 'ctrl-W': 'select-word' diff --git a/src/app/keymaps/emacs.coffee b/src/app/keymaps/emacs.coffee deleted file mode 100644 index 5ece06a79..000000000 --- a/src/app/keymaps/emacs.coffee +++ /dev/null @@ -1,22 +0,0 @@ -window.keymap.bindKeys '*', - 'ctrl-f': 'move-right' - 'ctrl-b': 'move-left' - 'ctrl-p': 'move-up' - 'ctrl-n': 'move-down' - -window.keymap.bindKeys '.editor', - 'ctrl-F': 'select-right' - 'ctrl-B': 'select-left' - 'ctrl-P': 'select-up' - 'ctrl-N': 'select-down' - 'alt-f': 'move-to-end-of-word' - 'alt-F': 'select-to-end-of-word' - 'alt-b': 'move-to-beginning-of-word' - 'alt-B': 'select-to-beginning-of-word' - 'ctrl-a': 'move-to-first-character-of-line' - 'ctrl-e': 'move-to-end-of-line' - 'ctrl-h': 'backspace' - 'ctrl-d': 'delete' - 'alt-h': 'backspace-to-beginning-of-word' - 'alt-d': 'delete-to-end-of-word' - 'ctrl-k': 'cut-to-end-of-line' diff --git a/src/app/keystroke-pattern.pegjs b/src/app/keystroke-pattern.pegjs deleted file mode 100644 index 5c0283916..000000000 --- a/src/app/keystroke-pattern.pegjs +++ /dev/null @@ -1,3 +0,0 @@ -keystrokePattern = key:key additionalKeys:additionalKey* { return [key].concat(additionalKeys); } -additionalKey = '-' key:key { return key; } -key = '-' / chars:[^-]+ { return chars.join('') } diff --git a/src/app/language-mode.coffee b/src/app/language-mode.coffee deleted file mode 100644 index 9e52d49d4..000000000 --- a/src/app/language-mode.coffee +++ /dev/null @@ -1,127 +0,0 @@ -Range = require 'range' -TextMateBundle = require 'text-mate-bundle' -_ = require 'underscore' -require 'underscore-extensions' - -module.exports = -class LanguageMode - pairedCharacters: - '(': ')' - '[': ']' - '{': '}' - '"': '"' - "'": "'" - - constructor: (@editSession) -> - @buffer = @editSession.buffer - @grammar = TextMateBundle.grammarForFileName(@buffer.getBaseName()) - - _.adviseBefore @editSession, 'insertText', (text) => - return true if @editSession.hasMultipleCursors() - - cursorBufferPosition = @editSession.getCursorBufferPosition() - nextCharacter = @editSession.getTextInBufferRange([cursorBufferPosition, cursorBufferPosition.add([0, 1])]) - - if @isCloseBracket(text) and text == nextCharacter - @editSession.moveCursorRight() - false - else if /^\s*$/.test(nextCharacter) and pairedCharacter = @pairedCharacters[text] - @editSession.insertText text + pairedCharacter - @editSession.moveCursorLeft() - false - - isOpenBracket: (string) -> - @pairedCharacters[string]? - - isCloseBracket: (string) -> - @getInvertedPairedCharacters()[string]? - - getInvertedPairedCharacters: -> - return @invertedPairedCharacters if @invertedPairedCharacters - - @invertedPairedCharacters = {} - for open, close of @pairedCharacters - @invertedPairedCharacters[close] = open - @invertedPairedCharacters - - toggleLineCommentsInRange: (range) -> - range = Range.fromObject(range) - scopes = @tokenizedBuffer.scopesForPosition(range.start) - commentString = TextMateBundle.lineCommentStringForScope(scopes[0]) - commentRegex = new OnigRegExp("^\s*" + _.escapeRegExp(commentString)) - - shouldUncomment = commentRegex.test(@editSession.lineForBufferRow(range.start.row)) - - for row in [range.start.row..range.end.row] - line = @editSession.lineForBufferRow(row) - if shouldUncomment - match = commentRegex.search(line) - @editSession.buffer.change([[row, 0], [row, match[0].length]], "") - else - @editSession.buffer.insert([row, 0], commentString) - - doesBufferRowStartFold: (bufferRow) -> - return false if @editSession.isBufferRowBlank(bufferRow) - nextNonEmptyRow = @editSession.nextNonBlankBufferRow(bufferRow) - return false unless nextNonEmptyRow? - @editSession.indentationForBufferRow(nextNonEmptyRow) > @editSession.indentationForBufferRow(bufferRow) - - rowRangeForFoldAtBufferRow: (bufferRow) -> - return null unless @doesBufferRowStartFold(bufferRow) - - startIndentation = @editSession.indentationForBufferRow(bufferRow) - for row in [(bufferRow + 1)..@editSession.getLastBufferRow()] - continue if @editSession.isBufferRowBlank(row) - indentation = @editSession.indentationForBufferRow(row) - if indentation <= startIndentation - includeRowInFold = indentation == startIndentation and @grammar.foldEndRegex.search(@editSession.lineForBufferRow(row)) - foldEndRow = row if includeRowInFold - break - - foldEndRow = row - - [bufferRow, foldEndRow] - - autoIndentBufferRows: (startRow, endRow) -> - @autoIndentBufferRow(row) for row in [startRow..endRow] - - autoIndentBufferRow: (bufferRow) -> - @autoIncreaseIndentForBufferRow(bufferRow) - @autoDecreaseIndentForBufferRow(bufferRow) - - autoIncreaseIndentForBufferRow: (bufferRow) -> - precedingRow = @buffer.previousNonBlankRow(bufferRow) - return unless precedingRow? - - precedingLine = @editSession.lineForBufferRow(precedingRow) - scopes = @tokenizedBuffer.scopesForPosition([precedingRow, Infinity]) - increaseIndentPattern = TextMateBundle.indentRegexForScope(scopes[0]) - return unless increaseIndentPattern - - currentIndentation = @buffer.indentationForRow(bufferRow) - desiredIndentation = @buffer.indentationForRow(precedingRow) - desiredIndentation += @editSession.tabText.length if increaseIndentPattern.test(precedingLine) - if desiredIndentation > currentIndentation - @buffer.setIndentationForRow(bufferRow, desiredIndentation) - - autoDecreaseIndentForBufferRow: (bufferRow) -> - scopes = @tokenizedBuffer.scopesForPosition([bufferRow, 0]) - increaseIndentPattern = TextMateBundle.indentRegexForScope(scopes[0]) - decreaseIndentPattern = TextMateBundle.outdentRegexForScope(scopes[0]) - return unless increaseIndentPattern and decreaseIndentPattern - - line = @buffer.lineForRow(bufferRow) - return unless decreaseIndentPattern.test(line) - - currentIndentation = @buffer.indentationForRow(bufferRow) - precedingRow = @buffer.previousNonBlankRow(bufferRow) - precedingLine = @buffer.lineForRow(precedingRow) - - desiredIndentation = @buffer.indentationForRow(precedingRow) - desiredIndentation -= @editSession.tabText.length unless increaseIndentPattern.test(precedingLine) - if desiredIndentation < currentIndentation - @buffer.setIndentationForRow(bufferRow, desiredIndentation) - - getLineTokens: (line, stack) -> - {tokens, stack} = @grammar.getLineTokens(line, stack) - diff --git a/src/app/line-map.coffee b/src/app/line-map.coffee deleted file mode 100644 index a06c1254b..000000000 --- a/src/app/line-map.coffee +++ /dev/null @@ -1,186 +0,0 @@ -_ = require 'underscore' -Point = require 'point' -Range = require 'range' - -module.exports = -class LineMap - constructor: -> - @lineFragments = [] - - insertAtBufferRow: (bufferRow, lineFragments) -> - @spliceAtBufferRow(bufferRow, 0, lineFragments) - - spliceAtBufferRow: (startRow, rowCount, lineFragments) -> - @spliceByDelta('bufferDelta', startRow, rowCount, lineFragments) - - spliceAtScreenRow: (startRow, rowCount, lineFragments) -> - @spliceByDelta('screenDelta', startRow, rowCount, lineFragments) - - replaceBufferRows: (start, end, lineFragments) -> - @spliceAtBufferRow(start, end - start + 1, lineFragments) - - replaceScreenRows: (start, end, lineFragments) -> - @spliceAtScreenRow(start, end - start + 1, lineFragments) - - lineForScreenRow: (row) -> - @linesForScreenRows(row, row)[0] - - linesForScreenRows: (startRow, endRow) -> - @linesByDelta('screenDelta', startRow, endRow) - - lineForBufferRow: (row) -> - @linesForBufferRows(row, row)[0] - - linesForBufferRows: (startRow, endRow) -> - @linesByDelta('bufferDelta', startRow, endRow) - - bufferRowsForScreenRows: (startRow, endRow=@lastScreenRow()) -> - bufferRows = [] - currentScreenRow = -1 - @traverseByDelta 'screenDelta', [startRow, 0], [endRow, 0], ({ screenDelta, bufferDelta }) -> - bufferRows.push(bufferDelta.row) if screenDelta.row > currentScreenRow - currentScreenRow = screenDelta.row - bufferRows - - bufferLineCount: -> - @lineCountByDelta('bufferDelta') - - screenLineCount: -> - @lineCountByDelta('screenDelta') - - lineCountByDelta: (deltaType) -> - @traverseByDelta(deltaType, new Point(Infinity, 0))[deltaType].row - - lastScreenRow: -> - @screenLineCount() - 1 - - maxScreenLineLength: -> - maxLength = 0 - @traverseByDelta 'screenDelta', [0, 0], [@lastScreenRow(), 0], ({lineFragment}) -> - length = lineFragment.text.length - maxLength = length if length > maxLength - maxLength - - screenPositionForBufferPosition: (bufferPosition, options) -> - @translatePosition('bufferDelta', 'screenDelta', bufferPosition, options) - - bufferPositionForScreenPosition: (screenPosition, options) -> - @translatePosition('screenDelta', 'bufferDelta', screenPosition, options) - - screenRangeForBufferRange: (bufferRange) -> - bufferRange = Range.fromObject(bufferRange) - start = @screenPositionForBufferPosition(bufferRange.start) - end = @screenPositionForBufferPosition(bufferRange.end) - new Range(start, end) - - bufferRangeForScreenRange: (screenRange) -> - start = @bufferPositionForScreenPosition(screenRange.start) - end = @bufferPositionForScreenPosition(screenRange.end) - new Range(start, end) - - clipScreenPosition: (screenPosition, options) -> - @clipPosition('screenDelta', screenPosition, options) - - clipPosition: (deltaType, position, options={}) -> - options.clipToBounds = true - @translatePosition(deltaType, deltaType, position, options) - - spliceByDelta: (deltaType, startRow, rowCount, lineFragments) -> - stopRow = startRow + rowCount - startIndex = undefined - stopIndex = 0 - - delta = new Point - for lineFragment, i in @lineFragments - startIndex ?= i if delta.row == startRow - break if delta.row == stopRow - delta = delta.add(lineFragment[deltaType]) - stopIndex++ - startIndex ?= i - - @lineFragments[startIndex...stopIndex] = lineFragments - - linesByDelta: (deltaType, startRow, endRow) -> - lines = [] - pendingFragment = null - @traverseByDelta deltaType, new Point(startRow, 0), new Point(endRow, Infinity), ({lineFragment}) -> - if pendingFragment - pendingFragment = pendingFragment.concat(lineFragment) - else - pendingFragment = lineFragment - if pendingFragment[deltaType].row > 0 - lines.push pendingFragment - pendingFragment = null - lines - - translatePosition: (sourceDeltaType, targetDeltaType, sourcePosition, options={}) -> - sourcePosition = Point.fromObject(sourcePosition) - wrapBeyondNewlines = options.wrapBeyondNewlines ? false - wrapAtSoftNewlines = options.wrapAtSoftNewlines ? false - skipAtomicTokens = options.skipAtomicTokens ? false - clipToBounds = options.clipToBounds ? false - - @clipToBounds(sourceDeltaType, sourcePosition) if clipToBounds - traversalResult = @traverseByDelta(sourceDeltaType, sourcePosition) - lastLineFragment = traversalResult.lastLineFragment - traversedAllFragments = traversalResult.traversedAllFragments - sourceDelta = traversalResult[sourceDeltaType] - targetDelta = traversalResult[targetDeltaType] - - return targetDelta unless lastLineFragment - maxSourceColumn = sourceDelta.column + lastLineFragment.textLength() - maxTargetColumn = targetDelta.column + lastLineFragment.textLength() - - if lastLineFragment.isSoftWrapped() and sourcePosition.column >= maxSourceColumn - if wrapAtSoftNewlines - targetDelta.row++ - targetDelta.column = 0 - else - targetDelta.column = maxTargetColumn - 1 - return @clipPosition(targetDeltaType, targetDelta) - else if sourcePosition.column > maxSourceColumn and wrapBeyondNewlines and not traversedAllFragments - targetDelta.row++ - targetDelta.column = 0 - else - additionalColumns = sourcePosition.column - sourceDelta.column - additionalColumns = lastLineFragment.translateColumn(sourceDeltaType, targetDeltaType, additionalColumns, { skipAtomicTokens }) - targetDelta.column += additionalColumns - - targetDelta - - clipToBounds: (deltaType, position) -> - if position.column < 0 - position.column = 0 - - if position.row < 0 - position.row = 0 - position.column = 0 - - maxSourceRow = @lineCountByDelta(deltaType) - 1 - if position.row > maxSourceRow - position.row = maxSourceRow - position.column = Infinity - - traverseByDelta: (deltaType, startPosition, endPosition=startPosition, iterator=null) -> - traversalDelta = new Point - screenDelta = new Point - bufferDelta = new Point - startPosition = Point.fromObject(startPosition) - endPosition = Point.fromObject(endPosition) - - for lineFragment, index in @lineFragments - iterator({ lineFragment, screenDelta, bufferDelta }) if traversalDelta.isGreaterThanOrEqual(startPosition) and iterator? - traversalDelta = traversalDelta.add(lineFragment[deltaType]) - break if traversalDelta.isGreaterThan(endPosition) - screenDelta = screenDelta.add(lineFragment.screenDelta) - bufferDelta = bufferDelta.add(lineFragment.bufferDelta) - - lastLineFragment = lineFragment - traversedAllFragments = (index == @lineFragments.length - 1) - { screenDelta, bufferDelta, lastLineFragment, traversedAllFragments } - - logLines: (start=0, end=@screenLineCount() - 1)-> - for row in [start..end] - line = @lineForScreenRow(row).text - console.log row, line, line.length - diff --git a/src/app/pane-column.coffee b/src/app/pane-column.coffee deleted file mode 100644 index f00c7ed23..000000000 --- a/src/app/pane-column.coffee +++ /dev/null @@ -1,32 +0,0 @@ -$ = require 'jquery' -_ = require 'underscore' -PaneGrid = require 'pane-grid' - -module.exports = -class PaneColumn extends PaneGrid - @content: -> - @div class: 'column' - - className: -> - "PaneColumn" - - adjustDimensions: -> - totalUnits = @verticalGridUnits() - unitsSoFar = 0 - for child in @children() - child = $(child).view() - childUnits = child.verticalGridUnits() - child.css - width: '100%' - height: "#{childUnits / totalUnits * 100}%" - top: "#{unitsSoFar / totalUnits * 100}%" - left: 0 - - child.adjustDimensions() - unitsSoFar += childUnits - - horizontalGridUnits: -> - Math.max(@horizontalChildUnits()...) - - verticalGridUnits: -> - _.sum(@verticalChildUnits()) diff --git a/src/app/pane-grid.coffee b/src/app/pane-grid.coffee deleted file mode 100644 index deca75735..000000000 --- a/src/app/pane-grid.coffee +++ /dev/null @@ -1,24 +0,0 @@ -$ = require 'jquery' -{View} = require 'space-pen' - -module.exports = -class PaneGrid extends View - @deserialize: ({children}, rootView) -> - childViews = children.map (child) -> rootView.deserializeView(child) - new this(childViews) - - initialize: (children=[]) -> - @append(children...) - - serialize: -> - viewClass: @className() - children: @childViewStates() - - childViewStates: -> - $(child).view().serialize() for child in @children() - - horizontalChildUnits: -> - $(child).view().horizontalGridUnits() for child in @children() - - verticalChildUnits: -> - $(child).view().verticalGridUnits() for child in @children() diff --git a/src/app/pane-row.coffee b/src/app/pane-row.coffee deleted file mode 100644 index c729e0b9a..000000000 --- a/src/app/pane-row.coffee +++ /dev/null @@ -1,32 +0,0 @@ -$ = require 'jquery' -_ = require 'underscore' -PaneGrid = require 'pane-grid' - -module.exports = -class PaneRow extends PaneGrid - @content: -> - @div class: 'row' - - className: -> - "PaneRow" - - adjustDimensions: -> - totalUnits = @horizontalGridUnits() - unitsSoFar = 0 - for child in @children() - child = $(child).view() - childUnits = child.horizontalGridUnits() - child.css - width: "#{childUnits / totalUnits * 100}%" - height: '100%' - top: 0 - left: "#{unitsSoFar / totalUnits * 100}%" - - child.adjustDimensions() - unitsSoFar += childUnits - - horizontalGridUnits: -> - _.sum(@horizontalChildUnits()) - - verticalGridUnits: -> - Math.max(@verticalChildUnits()...) diff --git a/src/app/pane.coffee b/src/app/pane.coffee deleted file mode 100644 index fb5317b8a..000000000 --- a/src/app/pane.coffee +++ /dev/null @@ -1,67 +0,0 @@ -{View} = require 'space-pen' -PaneRow = require 'pane-row' -PaneColumn = require 'pane-column' - -module.exports = -class Pane extends View - @content: (wrappedView) -> - @div class: 'pane', => - @subview 'wrappedView', wrappedView - - @deserialize: ({wrappedView}, rootView) -> - new Pane(rootView.deserializeView(wrappedView)) - - serialize: -> - viewClass: "Pane" - wrappedView: @wrappedView.serialize() - - adjustDimensions: -> # do nothing - - horizontalGridUnits: -> - 1 - - verticalGridUnits: -> - 1 - - splitUp: (view) -> - @split(view, 'column', 'before') - - splitDown: (view) -> - @split(view, 'column', 'after') - - splitLeft: (view) -> - @split(view, 'row', 'before') - - splitRight: (view) -> - @split(view, 'row', 'after') - - split: (view, axis, side) -> - unless @parent().hasClass(axis) - @buildPaneAxis(axis) - .insertBefore(this) - .append(@detach()) - - pane = new Pane(view) - this[side](pane) - @rootView().adjustPaneDimensions() - view.focus?() - pane - - remove: (selector, keepData) -> - return super if keepData - # find parent elements before removing from dom - parentAxis = @parent('.row, .column') - rootView = @rootView() - super - if parentAxis.children().length == 1 - sibling = parentAxis.children().detach() - parentAxis.replaceWith(sibling) - rootView.adjustPaneDimensions() - - buildPaneAxis: (axis) -> - switch axis - when 'row' then new PaneRow - when 'column' then new PaneColumn - - rootView: -> - @parents('#root-view').view() diff --git a/src/app/point.coffee b/src/app/point.coffee deleted file mode 100644 index ec0d3c646..000000000 --- a/src/app/point.coffee +++ /dev/null @@ -1,87 +0,0 @@ -module.exports = -class Point - @fromObject: (object) -> - if object instanceof Point - object - else - if object instanceof Array - [row, column] = object - else - { row, column } = object - - new Point(row, column) - - constructor: (@row=0, @column=0) -> - - copy: -> - new Point(@row, @column) - - add: (other) -> - other = Point.fromObject(other) - row = @row + other.row - if other.row == 0 - column = @column + other.column - else - column = other.column - - new Point(row, column) - - subtract: (other) -> - other = Point.fromObject(other) - row = @row - other.row - if @row == other.row - column = @column - other.column - else - column = @column - - new Point(row, column) - - splitAt: (column) -> - if @row == 0 - rightColumn = @column - column - else - rightColumn = @column - - [new Point(0, column), new Point(@row, rightColumn)] - - compare: (other) -> - if @row > other.row - 1 - else if @row < other.row - -1 - else - if @column > other.column - 1 - else if @column < other.column - -1 - else - 0 - - isEqual: (other) -> - return false unless other - other = Point.fromObject(other) - @row == other.row and @column == other.column - - isLessThan: (other) -> - @compare(other) < 0 - - isLessThanOrEqual: (other) -> - @compare(other) <= 0 - - isGreaterThan: (other) -> - @compare(other) > 0 - - isGreaterThanOrEqual: (other) -> - @compare(other) >= 0 - - inspect: -> - "(#{@row}, #{@column})" - - toString: -> - "#{@row},#{@column}" - - toArray: -> - [@row, @column] - - serialize: -> - @toArray() diff --git a/src/app/project.coffee b/src/app/project.coffee deleted file mode 100644 index 442e7df18..000000000 --- a/src/app/project.coffee +++ /dev/null @@ -1,179 +0,0 @@ -fs = require 'fs' -_ = require 'underscore' -$ = require 'jquery' -Range = require 'range' -Buffer = require 'buffer' -EditSession = require 'edit-session' -EventEmitter = require 'event-emitter' -Directory = require 'directory' -ChildProcess = require 'child-process' - -module.exports = -class Project - tabText: ' ' - autoIndent: true - softTabs: true - softWrap: false - rootDirectory: null - editSessions: null - ignoredPathRegexes: null - - constructor: (path) -> - @setPath(path) - @editSessions = [] - @buffers = [] - @ignoredPathRegexes = [ - /\.DS_Store$/ - /(^|\/)\.git(\/|$)/ - ] - - destroy: -> - editSession.destroy() for editSession in @getEditSessions() - - getPath: -> - @rootDirectory?.path - - setPath: (path) -> - @rootDirectory?.off() - - if path? - directory = if fs.isDirectory(path) then path else fs.directory(path) - @rootDirectory = new Directory(directory) - else - @rootDirectory = null - - @trigger "path-change" - - getRootDirectory: -> - @rootDirectory - - getFilePaths: -> - deferred = $.Deferred() - - filePaths = [] - fs.traverseTree @getPath(), (path, prune) => - if @ignorePath(path) - prune() - else if fs.isFile(path) - filePaths.push @relativize(path) - - deferred.resolve filePaths - deferred - - ignorePath: (path) -> - _.find @ignoredPathRegexes, (regex) -> path.match(regex) - - ignorePathRegex: -> - @ignoredPathRegexes.map((regex) -> "(#{regex.source})").join("|") - - resolve: (filePath) -> - filePath = fs.join(@getPath(), filePath) unless filePath[0] == '/' - fs.absolute filePath - - relativize: (fullPath) -> - fullPath.replace(@getPath(), "").replace(/^\//, '') - - getTabText: -> @tabText - setTabText: (@tabText) -> - - getAutoIndent: -> @autoIndent - setAutoIndent: (@autoIndent) -> - - getSoftTabs: -> @softTabs - setSoftTabs: (@softTabs) -> - - getSoftWrap: -> @softWrap - setSoftWrap: (@softWrap) -> - - buildEditSessionForPath: (filePath, editSessionOptions={}) -> - @buildEditSession(@bufferForPath(filePath), editSessionOptions) - - buildEditSession: (buffer, editSessionOptions) -> - options = _.extend(@defaultEditSessionOptions(), editSessionOptions) - options.project = this - options.buffer = buffer - editSession = new EditSession(options) - @editSessions.push editSession - @trigger 'new-edit-session', editSession - editSession - - defaultEditSessionOptions: -> - tabText: @getTabText() - autoIndent: @getAutoIndent() - softTabs: @getSoftTabs() - softWrap: @getSoftWrap() - - getEditSessions: -> - new Array(@editSessions...) - - removeEditSession: (editSession) -> - _.remove(@editSessions, editSession) - - getBuffers: -> - buffers = [] - for editSession in @editSessions when not _.include(buffers, editSession.buffer) - buffers.push editSession.buffer - - buffers - - bufferForPath: (filePath) -> - if filePath? - filePath = @resolve(filePath) - buffer = _.find @buffers, (buffer) -> buffer.getPath() == filePath - buffer or @buildBuffer(filePath) - else - @buildBuffer() - - buildBuffer: (filePath) -> - buffer = new Buffer(filePath, this) - @buffers.push buffer - @trigger 'new-buffer', buffer - buffer - - removeBuffer: (buffer) -> - _.remove(@buffers, buffer) - - scan: (regex, iterator) -> - regex = new RegExp(regex.source, 'g') - command = "#{require.resolve('ag')} --ackmate \"#{regex.source}\" \"#{@getPath()}\"" - bufferedData = "" - - state = 'readingPath' - path = null - - readPath = (line) -> - if /^[0-9,; ]+:/.test(line) - state = 'readingLines' - else if /^:/.test line - path = line.substr(1) - else - path += ('\n' + line) - - readLine = (line) -> - if line.length == 0 - state = 'readingPath' - path = null - else - colonIndex = line.indexOf(':') - matchInfo = line.substring(0, colonIndex) - lineText = line.substring(colonIndex + 1) - readMatches(matchInfo, lineText) - - readMatches = (matchInfo, lineText) -> - [lineNumber, matchPositionsText] = matchInfo.match(/(\d+);(.+)/)[1..] - row = parseInt(lineNumber) - 1 - matchPositions = matchPositionsText.split(',').map (positionText) -> positionText.split(' ').map (pos) -> parseInt(pos) - - for [column, length] in matchPositions - range = new Range([row, column], [row, column + length]) - match = lineText.substr(column, length) - iterator({path, range, match}) - - ChildProcess.exec command , bufferLines: true, stdout: (data) -> - lines = data.split('\n') - lines.pop() # the last segment is a spurios '' because data always ends in \n due to bufferLines: true - for line in lines - readPath(line) if state is 'readingPath' - readLine(line) if state is 'readingLines' - -_.extend Project.prototype, EventEmitter diff --git a/src/app/range.coffee b/src/app/range.coffee deleted file mode 100644 index 11efe0c94..000000000 --- a/src/app/range.coffee +++ /dev/null @@ -1,79 +0,0 @@ -Point = require 'point' -_ = require 'underscore' - -module.exports = -class Range - @fromObject: (object) -> - if _.isArray(object) - new Range(object...) - else if object instanceof Range - object - else - new Range(object.start, object.end) - - constructor: (pointA = new Point(0, 0), pointB = new Point(0, 0)) -> - pointA = Point.fromObject(pointA) - pointB = Point.fromObject(pointB) - - if pointA.compare(pointB) <= 0 - @start = pointA - @end = pointB - else - @start = pointB - @end = pointA - - copy: -> - new Range(@start.copy(), @end.copy()) - - isEqual: (other) -> - if other instanceof Array and other.length == 2 - other = new Range(other...) - - other.start.isEqual(@start) and other.end.isEqual(@end) - - isSingleLine: -> - @start.row == @end.row - - coversSameRows: (other) -> - @start.row == other.start.row && @end.row == other.end.row - - inspect: -> - "[#{@start.inspect()} - #{@end.inspect()}]" - - add: (point) -> - new Range(@start.add(point), @end.add(point)) - - intersectsWith: (otherRange) -> - if @start.isLessThanOrEqual(otherRange.start) - @end.isGreaterThanOrEqual(otherRange.start) - else - otherRange.intersectsWith(this) - - containsPoint: (point, { exclusive } = {}) -> - point = Point.fromObject(point) - if exclusive - point.isGreaterThan(@start) and point.isLessThan(@end) - else - point.isGreaterThanOrEqual(@start) and point.isLessThanOrEqual(@end) - - containsRow: (row) -> - @start.row <= row <= @end.row - - union: (otherRange) -> - start = if @start.isLessThan(otherRange.start) then @start else otherRange.start - end = if @end.isGreaterThan(otherRange.end) then @end else otherRange.end - new Range(start, end) - - isEmpty: -> - @start.isEqual(@end) - - toDelta: -> - rows = @end.row - @start.row - if rows == 0 - columns = @end.column - @start.column - else - columns = @end.column - new Point(rows, columns) - - getRowCount: -> - @end.row - @start.row + 1 diff --git a/src/app/root-view.coffee b/src/app/root-view.coffee deleted file mode 100644 index 4611053a2..000000000 --- a/src/app/root-view.coffee +++ /dev/null @@ -1,213 +0,0 @@ -$ = require 'jquery' -{$$} = require 'space-pen' -fs = require 'fs' -_ = require 'underscore' - -{View} = require 'space-pen' -Buffer = require 'buffer' -Editor = require 'editor' -Project = require 'project' -VimMode = require 'vim-mode' -Pane = require 'pane' -PaneColumn = require 'pane-column' -PaneRow = require 'pane-row' -StatusBar = require 'status-bar' -TextMateTheme = require 'text-mate-theme' - -module.exports = -class RootView extends View - @content: -> - @div id: 'root-view', tabindex: -1, => - @div id: 'horizontal', outlet: 'horizontal', => - @div id: 'vertical', outlet: 'vertical', => - @div id: 'panes', outlet: 'panes' - - @deserialize: ({ projectPath, panesViewState, extensionStates }) -> - rootView = new RootView(projectPath, extensionStates: extensionStates, suppressOpen: true) - rootView.setRootPane(rootView.deserializeView(panesViewState)) if panesViewState - rootView - - extensions: null - extensionStates: null - fontSize: 20 - - initialize: (pathToOpen, { @extensionStates, suppressOpen } = {}) -> - window.rootView = this - TextMateTheme.activate('IR_Black') - - @extensionStates ?= {} - @extensions = {} - @project = new Project(pathToOpen) - @handleEvents() - @setTitle() - @loadUserConfiguration() - @open(pathToOpen) if fs.isFile(pathToOpen) unless suppressOpen - - serialize: -> - projectPath: @project?.getPath() - panesViewState: @panes.children().view()?.serialize() - extensionStates: @serializeExtensions() - - handleEvents: -> - @on 'toggle-dev-tools', => window.toggleDevTools() - @on 'focus', (e) => - if @getActiveEditor() - @getActiveEditor().focus() - false - else - @setTitle(@project?.getPath()) - - @on 'active-editor-path-change', (e, path) => - @project.setPath(path) unless @project.getRootDirectory() - @setTitle(path) - - @on 'increase-font-size', => @setFontSize(@getFontSize() + 1) - @on 'decrease-font-size', => @setFontSize(@getFontSize() - 1) - @on 'focus-next-pane', => @focusNextPane() - - afterAttach: (onDom) -> - @focus() if onDom - - serializeExtensions: -> - extensionStates = {} - for name, extension of @extensions - try - extensionStates[name] = extension.serialize?() - catch e - console?.error("Exception serializing '#{name}' extension\n", e.stack) - extensionStates - - deserializeView: (viewState) -> - switch viewState.viewClass - when 'Pane' then Pane.deserialize(viewState, this) - when 'PaneRow' then PaneRow.deserialize(viewState, this) - when 'PaneColumn' then PaneColumn.deserialize(viewState, this) - when 'Editor' then Editor.deserialize(viewState, this) - - activateExtension: (extension) -> - throw new Error("Trying to activate an extension with no name") unless extension.name? - @extensions[extension.name] = extension - extension.activate(this, @extensionStates[extension.name]) - - deactivateExtension: (extension) -> - extension.deactivate?() - delete @extensions[extension.name] - - deactivate: -> - atom.rootViewStates[$windowNumber] = JSON.stringify(@serialize()) - @deactivateExtension(extension) for name, extension of @extensions - @remove() - - open: (path, options = {}) -> - changeFocus = options.changeFocus ? true - allowActiveEditorChange = options.allowActiveEditorChange ? false - - unless editSession = @openInExistingEditor(path, allowActiveEditorChange) - editSession = @project.buildEditSessionForPath(path) - editor = new Editor({editSession}) - pane = new Pane(editor) - @panes.append(pane) - if changeFocus - editor.focus() - else - @makeEditorActive(editor) - - editSession - - openInExistingEditor: (path, allowActiveEditorChange) -> - if activeEditor = @getActiveEditor() - path = @project.resolve(path) if path - - if editSession = activeEditor.activateEditSessionForPath(path) - return editSession - - if allowActiveEditorChange - for editor in @getEditors() - if editSession = editor.activateEditSessionForPath(path) - editor.focus() - return editSession - - editSession = @project.buildEditSessionForPath(path) - activeEditor.edit(editSession) - editSession - - editorFocused: (editor) -> - @makeEditorActive(editor) if @panes.containsElement(editor) - - makeEditorActive: (editor) -> - previousActiveEditor = @panes.find('.editor.active').view() - previousActiveEditor?.removeClass('active').off('.root-view') - editor.addClass('active') - - if not editor.mini - editor.on 'editor-path-change.root-view', => - @trigger 'active-editor-path-change', editor.getPath() - if not previousActiveEditor or editor.getPath() != previousActiveEditor.getPath() - @trigger 'active-editor-path-change', editor.getPath() - - activeKeybindings: -> - keymap.bindingsForElement(document.activeElement) - - setTitle: (title='untitled') -> - document.title = title - - getEditors: -> - @panes.find('.pane > .editor').map(-> $(this).view()).toArray() - - getModifiedBuffers: -> - modifiedBuffers = [] - for editor in @getEditors() - for session in editor.editSessions - modifiedBuffers.push session.buffer if session.buffer.isModified() - - modifiedBuffers - - getOpenBufferPaths: -> - _.uniq(_.flatten(@getEditors().map (editor) -> editor.getOpenBufferPaths())) - - getActiveEditor: -> - if (editor = @panes.find('.editor.active')).length - editor.view() - else - @panes.find('.editor:first').view() - - getActiveEditSession: -> - @getActiveEditor()?.activeEditSession - - focusNextPane: -> - panes = @panes.find('.pane') - currentIndex = panes.toArray().indexOf(@getFocusedPane()[0]) - nextIndex = (currentIndex + 1) % panes.length - panes.eq(nextIndex).view().wrappedView.focus() - - getFocusedPane: -> - @panes.find('.pane:has(:focus)') - - setRootPane: (pane) -> - @panes.empty() - @panes.append(pane) - @adjustPaneDimensions() - - adjustPaneDimensions: -> - rootPane = @panes.children().first().view() - rootPane?.css(width: '100%', height: '100%', top: 0, left: 0) - rootPane?.adjustDimensions() - - remove: -> - editor.remove() for editor in @getEditors() - @project.destroy() - super - - setFontSize: (newFontSize) -> - newFontSize = Math.max(1, newFontSize) - [oldFontSize, @fontSize] = [@fontSize, newFontSize] - @trigger 'font-size-change' if oldFontSize != newFontSize - - getFontSize: -> @fontSize - - loadUserConfiguration: -> - try - require atom.configFilePath if fs.exists(atom.configFilePath) - catch error - console.error "Failed to load `#{atom.configFilePath}`", error.message, error - diff --git a/src/app/screen-line.coffee b/src/app/screen-line.coffee deleted file mode 100644 index c864015f9..000000000 --- a/src/app/screen-line.coffee +++ /dev/null @@ -1,92 +0,0 @@ -_ = require 'underscore' -Point = require 'point' - -module.exports = -class ScreenLine - stack: null - text: null - tokens: null - screenDelta: null - bufferDelta: null - foldable: null - - constructor: (@tokens, @text, screenDelta, bufferDelta, extraFields) -> - @screenDelta = Point.fromObject(screenDelta) - @bufferDelta = Point.fromObject(bufferDelta) - _.extend(this, extraFields) - - copy: -> - new ScreenLine(@tokens, @text, @screenDelta, @bufferDelta, { @stack, @foldable }) - - splitAt: (column) -> - return [new ScreenLine([], '', [0, 0], [0, 0]), this] if column == 0 - - rightTokens = new Array(@tokens...) - leftTokens = [] - leftTextLength = 0 - while leftTextLength < column - if leftTextLength + rightTokens[0].value.length > column - rightTokens[0..0] = rightTokens[0].splitAt(column - leftTextLength) - nextToken = rightTokens.shift() - leftTextLength += nextToken.value.length - leftTokens.push nextToken - - leftText = _.pluck(leftTokens, 'value').join('') - rightText = _.pluck(rightTokens, 'value').join('') - - [leftScreenDelta, rightScreenDelta] = @screenDelta.splitAt(column) - [leftBufferDelta, rightBufferDelta] = @bufferDelta.splitAt(column) - - leftFragment = new ScreenLine(leftTokens, leftText, leftScreenDelta, leftBufferDelta, {@stack, @foldable}) - rightFragment = new ScreenLine(rightTokens, rightText, rightScreenDelta, rightBufferDelta, {@stack}) - [leftFragment, rightFragment] - - tokenAtBufferColumn: (bufferColumn) -> - delta = 0 - for token in @tokens - delta += token.bufferDelta - return token if delta >= bufferColumn - token - - concat: (other) -> - tokens = @tokens.concat(other.tokens) - text = @text + other.text - screenDelta = @screenDelta.add(other.screenDelta) - bufferDelta = @bufferDelta.add(other.bufferDelta) - new ScreenLine(tokens, text, screenDelta, bufferDelta, {stack: other.stack}) - - translateColumn: (sourceDeltaType, targetDeltaType, sourceColumn, options={}) -> - { skipAtomicTokens } = options - sourceColumn = Math.min(sourceColumn, @textLength()) - - currentSourceColumn = 0 - currentTargetColumn = 0 - for token in @tokens - tokenStartTargetColumn = currentTargetColumn - tokenStartSourceColumn = currentSourceColumn - tokenEndSourceColumn = currentSourceColumn + token[sourceDeltaType] - tokenEndTargetColumn = currentTargetColumn + token[targetDeltaType] - break if tokenEndSourceColumn > sourceColumn - currentSourceColumn = tokenEndSourceColumn - currentTargetColumn = tokenEndTargetColumn - - if token?.isAtomic - if skipAtomicTokens and sourceColumn > tokenStartSourceColumn - tokenEndTargetColumn - else - tokenStartTargetColumn - else - remainingColumns = sourceColumn - currentSourceColumn - currentTargetColumn + remainingColumns - - textLength: -> - if @fold - textLength = 0 - else - textLength = @text.length - - isSoftWrapped: -> - @screenDelta.row == 1 and @bufferDelta.row == 0 - - isEqual: (other) -> - _.isEqual(@tokens, other.tokens) and @screenDelta.isEqual(other.screenDelta) and @bufferDelta.isEqual(other.bufferDelta) diff --git a/src/app/selection-view.coffee b/src/app/selection-view.coffee deleted file mode 100644 index 889fcf34c..000000000 --- a/src/app/selection-view.coffee +++ /dev/null @@ -1,61 +0,0 @@ -Anchor = require 'anchor' -Point = require 'point' -Range = require 'range' -{View, $$} = require 'space-pen' - -module.exports = -class SelectionView extends View - @content: -> - @div() - - regions: null - - initialize: ({@editor, @selection} = {}) -> - @regions = [] - @selection.on 'change-screen-range', => @updateAppearance() - @selection.on 'destroy', => @remove() - @updateAppearance() - - updateAppearance: -> - @clearRegions() - range = @getScreenRange() - - @editor.highlightFoldsContainingBufferRange(@getBufferRange()) - return if range.isEmpty() - - rowSpan = range.end.row - range.start.row - - if rowSpan == 0 - @appendRegion(1, range.start, range.end) - else - @appendRegion(1, range.start, null) - if rowSpan > 1 - @appendRegion(rowSpan - 1, { row: range.start.row + 1, column: 0}, null) - @appendRegion(1, { row: range.end.row, column: 0 }, range.end) - - appendRegion: (rows, start, end) -> - { lineHeight, charWidth } = @editor - css = @editor.pixelPositionForScreenPosition(start) - css.height = lineHeight * rows - if end - css.width = @editor.pixelPositionForScreenPosition(end).left - css.left - else - css.right = 0 - - region = ($$ -> @div class: 'selection').css(css) - @append(region) - @regions.push(region) - - clearRegions: -> - region.remove() for region in @regions - @regions = [] - - getScreenRange: -> - @selection.getScreenRange() - - getBufferRange: -> - @selection.getBufferRange() - - remove: -> - @editor.removeSelectionView(this) - super diff --git a/src/app/selection.coffee b/src/app/selection.coffee deleted file mode 100644 index 1e350d59b..000000000 --- a/src/app/selection.coffee +++ /dev/null @@ -1,256 +0,0 @@ -Range = require 'range' -Anchor = require 'anchor' -EventEmitter = require 'event-emitter' -_ = require 'underscore' - -module.exports = -class Selection - anchor: null - - constructor: ({@cursor, @editSession}) -> - @cursor.selection = this - - @cursor.on 'change-screen-position.selection', (e) => - @trigger 'change-screen-range', @getScreenRange() unless e.bufferChanged - - @cursor.on 'destroy.selection', => - @cursor = null - @destroy() - - destroy: -> - if @cursor - @cursor.off('.selection') - @cursor.destroy() - @anchor?.destroy() - @editSession.removeSelection(this) - @trigger 'destroy' - - isEmpty: -> - @getBufferRange().isEmpty() - - isReversed: -> - not @isEmpty() and @cursor.getBufferPosition().isLessThan(@anchor.getBufferPosition()) - - getScreenRange: -> - if @anchor - new Range(@anchor.getScreenPosition(), @cursor.getScreenPosition()) - else - new Range(@cursor.getScreenPosition(), @cursor.getScreenPosition()) - - setScreenRange: (screenRange, options={}) -> - screenRange = Range.fromObject(screenRange) - { start, end } = screenRange - [start, end] = [end, start] if options.reverse - - @modifyScreenRange => - @placeAnchor() unless @anchor - @modifySelection => - @anchor.setScreenPosition(start) - @cursor.setScreenPosition(end) - - setBufferRange: (bufferRange, options={}) -> - bufferRange = Range.fromObject(bufferRange) - { start, end } = bufferRange - [start, end] = [end, start] if options.reverse - - @modifyScreenRange => - @editSession.destroyFoldsIntersectingBufferRange(bufferRange) unless options.preserveFolds - @placeAnchor() unless @anchor - @modifySelection => - @anchor.setBufferPosition(start, options) - @cursor.setBufferPosition(end, options) - - getBufferRange: -> - if @anchor - new Range(@anchor.getBufferPosition(), @cursor.getBufferPosition()) - else - new Range(@cursor.getBufferPosition(), @cursor.getBufferPosition()) - - getText: -> - @editSession.buffer.getTextInRange(@getBufferRange()) - - clear: -> - @modifyScreenRange => - @anchor?.destroy() - @anchor = null - - selectWord: -> - @setBufferRange(@cursor.getCurrentWordBufferRange()) - - expandOverWord: -> - @setBufferRange(@getBufferRange().union(@cursor.getCurrentWordBufferRange())) - - selectLine: (row=@cursor.getBufferPosition().row) -> - @setBufferRange(@editSession.bufferRangeForBufferRow(row)) - - expandOverLine: -> - @setBufferRange(@getBufferRange().union(@cursor.getCurrentLineBufferRange())) - - selectToScreenPosition: (position) -> - @modifySelection => @cursor.setScreenPosition(position) - - selectToBufferPosition: (position) -> - @modifySelection => @cursor.setBufferPosition(position) - - selectRight: -> - @modifySelection => @cursor.moveRight() - - selectLeft: -> - @modifySelection => @cursor.moveLeft() - - selectUp: -> - @modifySelection => @cursor.moveUp() - - selectDown: -> - @modifySelection => @cursor.moveDown() - - selectToTop: -> - @modifySelection => @cursor.moveToTop() - - selectToBottom: -> - @modifySelection => @cursor.moveToBottom() - - selectAll: -> - @setBufferRange(@editSession.buffer.getRange()) - - selectToBeginningOfLine: -> - @modifySelection => @cursor.moveToBeginningOfLine() - - selectToEndOfLine: -> - @modifySelection => @cursor.moveToEndOfLine() - - selectToBeginningOfWord: -> - @modifySelection => @cursor.moveToBeginningOfWord() - - selectToEndOfWord: -> - @modifySelection => @cursor.moveToEndOfWord() - - insertText: (text, options={}) -> - oldBufferRange = @getBufferRange() - @editSession.destroyFoldsContainingBufferRow(oldBufferRange.end.row) - wasReversed = @isReversed() - @clear() - newBufferRange = @editSession.buffer.change(oldBufferRange, text) - @cursor.setBufferPosition(newBufferRange.end, skipAtomicTokens: true) if wasReversed - - autoIndent = options.autoIndent ? true - - if @editSession.autoIndent and autoIndent - if /\n/.test(text) - firstLinePrefix = @editSession.getTextInBufferRange([[newBufferRange.start.row, 0], newBufferRange.start]) - if /^\s*$/.test(firstLinePrefix) - @editSession.autoIncreaseIndentForBufferRow(newBufferRange.start.row) - - if newBufferRange.getRowCount() > 1 - @editSession.autoIndentBufferRows(newBufferRange.start.row + 1, newBufferRange.end.row) - else - @editSession.autoDecreaseIndentForRow(newBufferRange.start.row) - - backspace: -> - if @isEmpty() and not @editSession.isFoldedAtScreenRow(@cursor.getScreenRow()) - if @cursor.isAtBeginningOfLine() and @editSession.isFoldedAtScreenRow(@cursor.getScreenRow() - 1) - @selectToBufferPosition([@cursor.getBufferRow() - 1, Infinity]) - else - @selectLeft() - - @deleteSelectedText() - - backspaceToBeginningOfWord: -> - @selectToBeginningOfWord() if @isEmpty() - @deleteSelectedText() - - delete: -> - if @isEmpty() - if @cursor.isAtEndOfLine() and fold = @editSession.largestFoldStartingAtScreenRow(@cursor.getScreenRow() + 1) - @selectToBufferPosition(fold.getBufferRange().end) - else - @selectRight() - @deleteSelectedText() - - deleteToEndOfWord: -> - @selectToEndOfWord() if @isEmpty() - @deleteSelectedText() - - deleteSelectedText: -> - bufferRange = @getBufferRange() - if fold = @editSession.largestFoldContainingBufferRow(bufferRange.end.row) - includeNewline = bufferRange.start.column == 0 or bufferRange.start.row >= fold.startRow - bufferRange = bufferRange.union(fold.getBufferRange({ includeNewline })) - - @modifyScreenRange => - @editSession.buffer.delete(bufferRange) unless bufferRange.isEmpty() - @cursor?.setBufferPosition(bufferRange.start) - - indentSelectedRows: -> - range = @getBufferRange() - for row in [range.start.row..range.end.row] - @editSession.buffer.insert([row, 0], @editSession.tabText) unless @editSession.buffer.lineLengthForRow(row) == 0 - - outdentSelectedRows: -> - range = @getBufferRange() - buffer = @editSession.buffer - leadingTabRegex = new RegExp("^#{@editSession.tabText}") - for row in [range.start.row..range.end.row] - if leadingTabRegex.test buffer.lineForRow(row) - buffer.delete [[row, 0], [row, @editSession.tabText.length]] - - toggleLineComments: -> - @modifySelection => - @editSession.toggleLineCommentsInRange(@getBufferRange()) - - cutToEndOfLine: (maintainPasteboard) -> - @selectToEndOfLine() if @isEmpty() - @cut(maintainPasteboard) - - cut: (maintainPasteboard=false) -> - @copy(maintainPasteboard) - @delete() - - copy: (maintainPasteboard=false) -> - return if @isEmpty() - text = @editSession.buffer.getTextInRange(@getBufferRange()) - text = $native.readFromPasteboard() + "\n" + text if maintainPasteboard - $native.writeToPasteboard text - - fold: -> - range = @getBufferRange() - @editSession.createFold(range.start.row, range.end.row) - @cursor.setBufferPosition([range.end.row + 1, 0]) - - autoIndentText: (text) -> - @editSession.autoIndentTextAfterBufferPosition(text, @cursor.getBufferPosition()) - - autoOutdent: -> - @editSession.autoOutdentBufferRow(@cursor.getBufferRow()) - - modifySelection: (fn) -> - @retainSelection = true - @view?.retainSelection = true - @placeAnchor() unless @anchor - fn() - @retainSelection = false - @view?.retainSelection = false - - modifyScreenRange: (fn) -> - oldScreenRange = @getScreenRange() - fn() - if @cursor - newScreenRange = @getScreenRange() - @trigger 'change-screen-range', newScreenRange unless oldScreenRange.isEqual(newScreenRange) - - placeAnchor: -> - @anchor = @editSession.addAnchor(strong: true) - @anchor.setScreenPosition(@cursor.getScreenPosition()) - @anchor.on 'change-screen-position.selection', => @trigger 'change-screen-range' - - intersectsBufferRange: (bufferRange) -> - @getBufferRange().intersectsWith(bufferRange) - - intersectsWith: (otherSelection) -> - @getScreenRange().intersectsWith(otherSelection.getScreenRange()) - - merge: (otherSelection, options) -> - @setScreenRange(@getScreenRange().union(otherSelection.getScreenRange()), options) - otherSelection.destroy() - -_.extend Selection.prototype, EventEmitter diff --git a/src/app/status-bar.coffee b/src/app/status-bar.coffee deleted file mode 100644 index 0894851b5..000000000 --- a/src/app/status-bar.coffee +++ /dev/null @@ -1,40 +0,0 @@ -{View} = require 'space-pen' - -module.exports = -class StatusBar extends View - @activate: (rootView) -> - requireStylesheet 'status-bar.css' - - for editor in rootView.getEditors() - @appendToEditorPane(rootView, editor) if rootView.parents('html').length - - rootView.on 'editor-open', (e, editor) => - @appendToEditorPane(rootView, editor) - - @appendToEditorPane: (rootView, editor) -> - if pane = editor.pane() - pane.append(new StatusBar(rootView, editor)) - - @content: -> - @div class: 'status-bar', => - @div class: 'current-path', outlet: 'currentPath' - @div class: 'cursor-position', outlet: 'cursorPosition' - - initialize: (@rootView, @editor) -> - @updatePathText() - @editor.on 'editor-path-change', => @updatePathText() - - @updateCursorPositionText() - @editor.on 'cursor-move', => @updateCursorPositionText() - - updatePathText: -> - path = @editor.getPath() - if path - @currentPath.text(@rootView.project.relativize(path)) - else - @currentPath.text('untitled') - - updateCursorPositionText: -> - { row, column } = @editor.getCursorBufferPosition() - @cursorPosition.text("#{row + 1},#{column + 1}") - diff --git a/src/app/text-mate-bundle.coffee b/src/app/text-mate-bundle.coffee deleted file mode 100644 index 3e0780c49..000000000 --- a/src/app/text-mate-bundle.coffee +++ /dev/null @@ -1,71 +0,0 @@ -_ = require 'underscore' -fs = require 'fs' -plist = require 'plist' - -TextMateGrammar = require 'text-mate-grammar' - -module.exports = -class TextMateBundle - @grammarsByFileType: {} - @preferencesByScopeSelector: {} - @bundles: [] - - @loadAll: -> - for bundlePath in fs.list(require.resolve("bundles")) - @registerBundle(new TextMateBundle(bundlePath)) - - @registerBundle: (bundle)-> - @bundles.push(bundle) - - for scopeSelector, preferences of bundle.getPreferencesByScopeSelector() - @preferencesByScopeSelector[scopeSelector] = preferences - - for grammar in bundle.grammars - for fileType in grammar.fileTypes - @grammarsByFileType[fileType] = grammar - - @grammarForFileName: (fileName) -> - extension = fs.extension(fileName)?[1...] - @grammarsByFileType[extension] or @grammarsByFileType["txt"] - - @getPreferenceInScope: (scopeSelector, preferenceName) -> - @preferencesByScopeSelector[scopeSelector]?[preferenceName] - - @lineCommentStringForScope: (scope) -> - shellVariables = @getPreferenceInScope(scope, 'shellVariables') - lineComment = (_.find shellVariables, ({name}) -> name == "TM_COMMENT_START")['value'] - - @indentRegexForScope: (scope) -> - if source = @getPreferenceInScope(scope, 'increaseIndentPattern') - new OnigRegExp(source) - - @outdentRegexForScope: (scope) -> - if source = @getPreferenceInScope(scope, 'decreaseIndentPattern') - new OnigRegExp(source) - - grammars: null - - constructor: (@path) -> - @grammars = [] - if fs.exists(@getSyntaxesPath()) - for syntaxPath in fs.list(@getSyntaxesPath()) - @grammars.push TextMateGrammar.loadFromPath(syntaxPath) - - getPreferencesByScopeSelector: -> - return {} unless fs.exists(@getPreferencesPath()) - preferencesByScopeSelector = {} - for preferencePath in fs.list(@getPreferencesPath()) - plist.parseString fs.read(preferencePath), (e, data) -> - throw new Error(e) if e - { scope, settings } = data[0] - - preferencesByScopeSelector[scope] = _.extend(preferencesByScopeSelector[scope] ? {}, settings) - - preferencesByScopeSelector - - getSyntaxesPath: -> - fs.join(@path, "Syntaxes") - - getPreferencesPath: -> - fs.join(@path, "Preferences") - diff --git a/src/app/text-mate-grammar.coffee b/src/app/text-mate-grammar.coffee deleted file mode 100644 index 395e7d052..000000000 --- a/src/app/text-mate-grammar.coffee +++ /dev/null @@ -1,212 +0,0 @@ -_ = require 'underscore' -fs = require 'fs' -plist = require 'plist' - -module.exports = -class TextMateGrammar - @loadFromPath: (path) -> - grammar = null - plist.parseString fs.read(path), (e, data) -> - throw new Error(e) if e - grammar = new TextMateGrammar(data[0]) - grammar - - name: null - fileTypes: null - foldEndRegex: null - repository: null - initialRule: null - - constructor: ({ @name, @fileTypes, scopeName, patterns, repository, foldingStopMarker}) -> - @initialRule = new Rule(this, {scopeName, patterns}) - @repository = {} - @foldEndRegex = new OnigRegExp(foldingStopMarker) if foldingStopMarker - - for name, data of repository - @repository[name] = new Rule(this, data) - - for rule in [@initialRule, _.values(@repository)...] - rule.compileRegex() - - getLineTokens: (line, stack=[@initialRule]) -> - stack = new Array(stack...) - tokens = [] - position = 0 - - loop - scopes = _.pluck(stack, "scopeName") - - if line.length == 0 - tokens = [{value: "", scopes: scopes}] - return { tokens, scopes } - - break if position == line.length - - { nextTokens, tokensStartPosition, tokensEndPosition} = _.last(stack).getNextTokens(stack, line, position) - - if nextTokens - if position < tokensStartPosition # unmatched text preceding next tokens - tokens.push - value: line[position...tokensStartPosition] - scopes: scopes - - tokens.push(nextTokens...) - position = tokensEndPosition - else - tokens.push - value: line[position...line.length] - scopes: scopes - break - - { tokens, stack } - - ruleForInclude: (name) -> - if name[0] == "#" - @repository[name[1..]] - else if name == "$self" - @initialRule - -class Rule - grammar: null - scopeName: null - patterns: null - endPattern: null - - constructor: (@grammar, {@scopeName, patterns, @endPattern}) -> - patterns ?= [] - @patterns = [] - @patterns.push(@endPattern) if @endPattern - @patterns.push((patterns.map (pattern) => new Pattern(grammar, pattern))...) - - compileRegex: -> - regexComponents = [] - @patternsByCaptureIndex = {} - currentCaptureIndex = 1 - for [regex, pattern] in @getRegexPatternPairs() - regexComponents.push(regex.source) - @patternsByCaptureIndex[currentCaptureIndex] = pattern - currentCaptureIndex += 1 + regex.getCaptureCount() - @regex = new OnigRegExp('(' + regexComponents.join(')|(') + ')') - - pattern.compileRegex() for pattern in @patterns - - getRegexPatternPairs: (included=[]) -> - return [] if _.include(included, this) - included.push(this) - regexPatternPairs = [] - - regexPatternPairs.push(@endPattern.getRegexPatternPairs()...) if @endPattern - for pattern in @patterns - regexPatternPairs.push(pattern.getRegexPatternPairs(included)...) - regexPatternPairs - - getNextTokens: (stack, line, position) -> - captureIndices = @regex.getCaptureIndices(line, position) - - return {} unless captureIndices?[2] > 0 # ignore zero-length matches - - shiftCapture(captureIndices) - - [firstCaptureIndex, firstCaptureStart, firstCaptureEnd] = captureIndices - pattern = @patternsByCaptureIndex[firstCaptureIndex] - nextTokens = pattern.handleMatch(stack, line, captureIndices) - { nextTokens, tokensStartPosition: firstCaptureStart, tokensEndPosition: firstCaptureEnd } - - getNextMatch: (line, position) -> - nextMatch = null - matchedPattern = null - - for pattern in @patterns - { pattern, match } = pattern.getNextMatch(line, position) - if match - if !nextMatch or match.position < nextMatch.position - nextMatch = match - matchedPattern = pattern - - { match: nextMatch, pattern: matchedPattern } - -class Pattern - grammar: null - pushRule: null - popRule: false - scopeName: null - regex: null - captures: null - - constructor: (@grammar, { name, contentName, @include, match, begin, end, captures, beginCaptures, endCaptures, patterns, @popRule}) -> - @scopeName = name ? contentName # TODO: We need special treatment of contentName - if match - @regex = new OnigRegExp(match) - @captures = captures - else if begin - @regex = new OnigRegExp(begin) - @captures = beginCaptures ? captures - endPattern = new Pattern(@grammar, { match: end, captures: endCaptures ? captures, popRule: true}) - @pushRule = new Rule(@grammar, { @scopeName, patterns, endPattern }) - - getRegexPatternPairs: (included) -> - if @include - rule = @grammar.ruleForInclude(@include) - # console.log "Could not find rule for include #{@include} in #{@grammar.name} grammar" unless rule - rule?.getRegexPatternPairs(included) ? [] - else - [[@regex, this]] - - compileRegex: -> - @pushRule?.compileRegex() - - getNextMatch: (line, position) -> - if @include - rule = @grammar.ruleForInclude(@include) - rule.getNextMatch(line, position) - else - { match: @regex.getCaptureIndices(line, position), pattern: this } - - handleMatch: (stack, line, captureIndices) -> - scopes = _.pluck(stack, "scopeName") - scopes.push(@scopeName) unless @popRule - - if @captures - tokens = @getTokensForCaptureIndices(line, captureIndices, scopes) - else - [start, end] = captureIndices[1..2] - tokens = [{ value: line[start...end], scopes: scopes }] - - if @pushRule - stack.push(@pushRule) - else if @popRule - stack.pop() - - tokens - - getTokensForCaptureIndices: (line, captureIndices, scopes, indexOffset=captureIndices[0]) -> - [parentCaptureIndex, parentCaptureStart, parentCaptureEnd] = shiftCapture(captureIndices) - relativeParentCaptureIndex = parentCaptureIndex - indexOffset - - tokens = [] - if scope = @captures[relativeParentCaptureIndex]?.name - scopes = scopes.concat(scope) - - previousChildCaptureEnd = parentCaptureStart - while captureIndices.length and captureIndices[1] < parentCaptureEnd - [childCaptureIndex, childCaptureStart, childCaptureEnd] = captureIndices - - if childCaptureStart > previousChildCaptureEnd - tokens.push - value: line[previousChildCaptureEnd...childCaptureStart] - scopes: scopes - - captureTokens = @getTokensForCaptureIndices(line, captureIndices, scopes, indexOffset) - tokens.push(captureTokens...) - previousChildCaptureEnd = childCaptureEnd - - if parentCaptureEnd > previousChildCaptureEnd - tokens.push - value: line[previousChildCaptureEnd...parentCaptureEnd] - scopes: scopes - - tokens - -shiftCapture = (captureIndices) -> - [captureIndices.shift(), captureIndices.shift(), captureIndices.shift()] - diff --git a/src/app/text-mate-theme.coffee b/src/app/text-mate-theme.coffee deleted file mode 100644 index c7c3bd41b..000000000 --- a/src/app/text-mate-theme.coffee +++ /dev/null @@ -1,108 +0,0 @@ -_ = require 'underscore' -fs = require 'fs' -plist = require 'plist' - -module.exports = -class TextMateTheme - @themesByName: {} - - @loadAll: -> - for themePath in fs.list(require.resolve("themes")) - @registerTheme(TextMateTheme.load(themePath)) - - @load: (path) -> - plistString = fs.read(require.resolve(path)) - theme = null - plist.parseString plistString, (err, data) -> - throw new Error("Error loading theme at '#{path}': #{err}") if err - theme = new TextMateTheme(data[0]) - theme - - @registerTheme: (theme) -> - @themesByName[theme.name] = theme - - @getNames: -> - _.keys(@themesByName) - - @getTheme: (name) -> - @themesByName[name] - - @activate: (name) -> - if theme = @getTheme(name) - theme.activate() - else - throw new Error("No theme with name '#{name}'") - - constructor: ({@name, settings}) -> - @rulesets = [] - globalSettings = settings[0] - @buildGlobalSettingsRulesets(settings[0]) - @buildScopeSelectorRulesets(settings[1..]) - - activate: -> - applyStylesheet(@name, @getStylesheet()) - - getStylesheet: -> - lines = [] - for {selector, properties} in @getRulesets() - lines.push("#{selector} {") - for name, value of properties - lines.push " #{name}: #{value};" - lines.push("}\n") - lines.join("\n") - - getRulesets: -> @rulesets - - buildGlobalSettingsRulesets: ({settings}) -> - { background, foreground, caret, selection } = settings - - @rulesets.push - selector: '.editor' - properties: - 'background-color': @translateColor(background) - 'color': @translateColor(foreground) - - @rulesets.push - selector: '.editor.focused .cursor' - properties: - 'border-color': @translateColor(caret) - - @rulesets.push - selector: '.editor.focused .selection' - properties: - 'background-color': @translateColor(selection) - - buildScopeSelectorRulesets: (scopeSelectorSettings) -> - for { name, scope, settings } in scopeSelectorSettings - continue unless scope - @rulesets.push - comment: name - selector: @translateScopeSelector(scope) - properties: @translateScopeSelectorSettings(settings) - - translateScopeSelector: (textmateScopeSelector) -> - scopes = textmateScopeSelector.replace(/\./g, '-').split(/\s+/).map (scope) -> '.' + scope - scopes.join(' ') - - translateScopeSelectorSettings: ({ foreground, background, fontStyle }) -> - properties = {} - - if fontStyle - fontStyles = fontStyle.split(/\s+/) - # properties['font-weight'] = 'bold' if _.contains(fontStyles, 'bold') - # properties['font-style'] = 'italic' if _.contains(fontStyles, 'italic') - properties['text-decoration'] = 'underline' if _.contains(fontStyles, 'underline') - - properties['color'] = @translateColor(foreground) if foreground - properties['background-color'] = @translateColor(background) if background - properties - - translateColor: (textmateColor) -> - if textmateColor.length <= 7 - textmateColor - else - r = parseInt(textmateColor[1..2], 16) - g = parseInt(textmateColor[3..4], 16) - b = parseInt(textmateColor[5..6], 16) - a = parseInt(textmateColor[7..8], 16) - "rgba(#{r}, #{g}, #{b}, #{a})" diff --git a/src/app/token.coffee b/src/app/token.coffee deleted file mode 100644 index 397f0b196..000000000 --- a/src/app/token.coffee +++ /dev/null @@ -1,46 +0,0 @@ -_ = require 'underscore' - -module.exports = -class Token - value: null - scopes: null - isAtomic: null - - constructor: ({@value, @scopes, @isAtomic, @bufferDelta, @fold}) -> - @screenDelta = @value.length - @bufferDelta ?= @screenDelta - - isEqual: (other) -> - @value == other.value and _.isEqual(@scopes, other.scopes) and !!@isAtomic == !!other.isAtomic - - isBracket: -> - /^meta\.brace\b/.test(_.last(@scopes)) - - splitAt: (splitIndex) -> - value1 = @value.substring(0, splitIndex) - value2 = @value.substring(splitIndex) - [new Token(value: value1, scopes: @scopes), new Token(value: value2, scopes: @scopes)] - - breakOutTabCharacters: (tabText) -> - return [this] unless /\t/.test(@value) - - for substring in @value.match(/([^\t]+|\t)/g) - if substring == '\t' - @buildTabToken(tabText) - else - new Token(value: substring, scopes: @scopes) - - buildTabToken: (tabText) -> - new Token(value: tabText, scopes: @scopes, bufferDelta: 1, isAtomic: true) - - getCssClassString: -> - @cssClassString ?= @getCssClasses().join(' ') - - getCssClasses: -> - classes = [] - for scope in @scopes - scopeComponents = scope.split('.') - for i in [0...scopeComponents.length] - classes.push scopeComponents[0..i].join('-') - classes - diff --git a/src/app/tokenized-buffer.coffee b/src/app/tokenized-buffer.coffee deleted file mode 100644 index 02285a505..000000000 --- a/src/app/tokenized-buffer.coffee +++ /dev/null @@ -1,153 +0,0 @@ -_ = require 'underscore' -ScreenLine = require 'screen-line' -EventEmitter = require 'event-emitter' -Token = require 'token' -Range = require 'range' -Point = require 'point' - -module.exports = -class TokenizedBuffer - @idCounter: 1 - - languageMode: null - buffer: null - aceAdaptor: null - screenLines: null - - constructor: (@buffer, { @languageMode, @tabText }) -> - @languageMode.tokenizedBuffer = this - @id = @constructor.idCounter++ - @screenLines = @buildScreenLinesForRows(0, @buffer.getLastRow()) - @buffer.on "change.tokenized-buffer#{@id}", (e) => @handleBufferChange(e) - - handleBufferChange: (e) -> - oldRange = e.oldRange.copy() - newRange = e.newRange.copy() - previousStack = @stackForRow(oldRange.end.row) # used in spill detection below - - stack = @stackForRow(newRange.start.row - 1) - @screenLines[oldRange.start.row..oldRange.end.row] = - @buildScreenLinesForRows(newRange.start.row, newRange.end.row, stack) - - # spill detection - # compare scanner state of last re-highlighted line with its previous state. - # if it differs, re-tokenize the next line with the new state and repeat for - # each line until the line's new state matches the previous state. this covers - # cases like inserting a /* needing to comment out lines below until we see a */ - for row in [newRange.end.row...@buffer.getLastRow()] - break if _.isEqual(@stackForRow(row), previousStack) - nextRow = row + 1 - previousStack = @stackForRow(nextRow) - @screenLines[nextRow] = @buildScreenLineForRow(nextRow, @stackForRow(row)) - - # if highlighting spilled beyond the bounds of the textual change, update - # the pre and post range to reflect area of highlight changes - if nextRow > newRange.end.row - oldRange.end.row += (nextRow - newRange.end.row) - newRange.end.row = nextRow - endColumn = @buffer.lineForRow(nextRow).length - newRange.end.column = endColumn - oldRange.end.column = endColumn - - @trigger("change", {oldRange, newRange}) - - buildScreenLinesForRows: (startRow, endRow, startingStack) -> - stack = startingStack - for row in [startRow..endRow] - screenLine = @buildScreenLineForRow(row, stack) - stack = screenLine.stack - screenLine - - buildScreenLineForRow: (row, stack) -> - line = @buffer.lineForRow(row) - {tokens, stack} = @languageMode.getLineTokens(line, stack) - tokenObjects = [] - for tokenProperties in tokens - token = new Token(tokenProperties) - tokenObjects.push(token.breakOutTabCharacters(@tabText)...) - text = _.pluck(tokenObjects, 'value').join('') - new ScreenLine(tokenObjects, text, [1, 0], [1, 0], { stack }) - - lineForScreenRow: (row) -> - @screenLines[row] - - linesForScreenRows: (startRow, endRow) -> - @screenLines[startRow..endRow] - - stackForRow: (row) -> - @screenLines[row]?.stack - - scopesForPosition: (position) -> - position = Point.fromObject(position) - token = @screenLines[position.row].tokenAtBufferColumn(position.column) - token.scopes - - destroy: -> - @buffer.off ".tokenized-buffer#{@id}" - - iterateTokensInBufferRange: (bufferRange, iterator) -> - bufferRange = Range.fromObject(bufferRange) - { start, end } = bufferRange - - keepLooping = true - stop = -> keepLooping = false - - for bufferRow in [start.row..end.row] - bufferColumn = 0 - for token in @screenLines[bufferRow].tokens - startOfToken = new Point(bufferRow, bufferColumn) - iterator(token, startOfToken, { stop }) if bufferRange.containsPoint(startOfToken) - return unless keepLooping - bufferColumn += token.bufferDelta - - backwardsIterateTokensInBufferRange: (bufferRange, iterator) -> - bufferRange = Range.fromObject(bufferRange) - { start, end } = bufferRange - - keepLooping = true - stop = -> keepLooping = false - - for bufferRow in [end.row..start.row] - bufferColumn = @buffer.lineLengthForRow(bufferRow) - for token in new Array(@screenLines[bufferRow].tokens...).reverse() - bufferColumn -= token.bufferDelta - startOfToken = new Point(bufferRow, bufferColumn) - iterator(token, startOfToken, { stop }) if bufferRange.containsPoint(startOfToken) - return unless keepLooping - - findOpeningBracket: (startBufferPosition) -> - range = [[0,0], startBufferPosition] - position = null - depth = 0 - @backwardsIterateTokensInBufferRange range, (token, startPosition, { stop }) -> - if token.isBracket() - if token.value == '}' - depth++ - else if token.value == '{' - depth-- - if depth == 0 - position = startPosition - stop() - position - - findClosingBracket: (startBufferPosition) -> - range = [startBufferPosition, @buffer.getEofPosition()] - position = null - depth = 0 - @iterateTokensInBufferRange range, (token, startPosition, { stop }) -> - if token.isBracket() - if token.value == '{' - depth++ - else if token.value == '}' - depth-- - if depth == 0 - position = startPosition - stop() - position - - logLines: (start=0, end=@buffer.getLastRow()) -> - for row in [start..end] - line = @lineForScreenRow(row).text - console.log row, line, line.length - -_.extend(TokenizedBuffer.prototype, EventEmitter) diff --git a/src/app/undo-manager.coffee b/src/app/undo-manager.coffee deleted file mode 100644 index 21760ef62..000000000 --- a/src/app/undo-manager.coffee +++ /dev/null @@ -1,46 +0,0 @@ -_ = require 'underscore' - -module.exports = - -class UndoManager - undoHistory: null - redoHistory: null - currentTransaction: null - - constructor: -> - @startBatchCallCount = 0 - @undoHistory = [] - @redoHistory = [] - - pushOperation: (operation, editSession) -> - if @currentTransaction - @currentTransaction.push(operation) - else - @undoHistory.push([operation]) - @redoHistory = [] - operation.do?(editSession) - - transact: (fn) -> - if @currentTransaction - fn() - else - @currentTransaction = [] - fn() - @undoHistory.push(@currentTransaction) if @currentTransaction.length - @currentTransaction = null - - undo: (editSession) -> - if batch = @undoHistory.pop() - opsInReverse = new Array(batch...) - opsInReverse.reverse() - op.undo?(editSession) for op in opsInReverse - @redoHistory.push batch - batch.oldSelectionRanges - - redo: (editSession) -> - if batch = @redoHistory.pop() - for op in batch - op.do?(editSession) - op.redo?(editSession) - @undoHistory.push(batch) - batch.newSelectionRanges diff --git a/src/app/window.coffee b/src/app/window.coffee deleted file mode 100644 index 4a0665995..000000000 --- a/src/app/window.coffee +++ /dev/null @@ -1,113 +0,0 @@ -# This a weirdo file. We don't create a Window class, we just add stuff to -# the DOM window. - -Native = require 'native' -TextMateBundle = require 'text-mate-bundle' -TextMateTheme = require 'text-mate-theme' -fs = require 'fs' -_ = require 'underscore' -$ = require 'jquery' -{CoffeeScript} = require 'coffee-script' - -windowAdditions = - rootViewParentSelector: 'body' - rootView: null - keymap: null - platform: $native.getPlatform() - - setUpKeymap: -> - Keymap = require 'keymap' - - @keymap = new Keymap() - @keymap.bindDefaultKeys() - require(keymapPath) for keymapPath in fs.list(require.resolve("keymaps")) - - @_handleKeyEvent = (e) => @keymap.handleKeyEvent(e) - $(document).on 'keydown', @_handleKeyEvent - - startup: (path) -> - TextMateBundle.loadAll() - TextMateTheme.loadAll() - - @attachRootView(path) - $(window).on 'close', => @close() - $(window).on 'beforeunload', => - @shutdown() - false - $(window).focus() - atom.windowOpened this - - shutdown: -> - @rootView.deactivate() - $(window).unbind('focus') - $(window).unbind('blur') - $(window).off('before') - atom.windowClosed this - - # Note: RootView assigns itself on window on initialization so that - # window.rootView is available when loading user configuration - attachRootView: (pathToOpen) -> - if rootViewState = atom.rootViewStates[$windowNumber] - RootView.deserialize(JSON.parse(rootViewState)) - else - new RootView(pathToOpen) - @rootView.open() unless pathToOpen - - $(@rootViewParentSelector).append @rootView - - requireStylesheet: (path) -> - unless fullPath = require.resolve(path) - throw new Error("requireStylesheet could not find a file at path '#{path}'") - window.applyStylesheet(fullPath, fs.read(fullPath)) - - applyStylesheet: (id, text) -> - unless $("head style[id='#{id}']").length - $('head').append "" - - requireExtension: (name) -> - extensionPath = require.resolve name - extension = rootView.activateExtension require(extensionPath) - - extensionKeymapPath = fs.join(fs.directory(extensionPath), "keymap.coffee") - require extensionKeymapPath if fs.exists(extensionKeymapPath) - - extension - - reload: -> - if rootView.getModifiedBuffers().length > 0 - message = "There are unsaved buffers, reload anyway?" - detailedMessage = "You will lose all unsaved changes if you reload" - buttons = [ - ["Reload", -> Native.reload()] - ["Cancel", ->] - ] - - Native.alert(message, detailedMessage, buttons) - else - Native.reload() - - toggleDevTools: -> - $native.toggleDevTools() - - onerror: -> - $native.showDevTools() - - measure: (description, fn) -> - start = new Date().getTime() - fn() - result = new Date().getTime() - start - console.log description, result - -window[key] = value for key, value of windowAdditions -window.setUpKeymap() - -RootView = require 'root-view' - -require 'jquery-extensions' -require 'underscore-extensions' - -requireStylesheet 'reset.css' -requireStylesheet 'atom.css' - -if nativeStylesheetPath = require.resolve("#{platform}.css") - requireStylesheet(nativeStylesheetPath) diff --git a/src/atom-bootstrap.coffee b/src/atom-bootstrap.coffee deleted file mode 100644 index ca1409857..000000000 --- a/src/atom-bootstrap.coffee +++ /dev/null @@ -1,2 +0,0 @@ -Atom = require 'atom' -window.atom = new Atom(atom.loadPath, $native) diff --git a/src/extensions/autocomplete/autocomplete.coffee b/src/extensions/autocomplete/autocomplete.coffee deleted file mode 100644 index 5a8ea7845..000000000 --- a/src/extensions/autocomplete/autocomplete.coffee +++ /dev/null @@ -1,216 +0,0 @@ -{View, $$} = require 'space-pen' -$ = require 'jquery' -_ = require 'underscore' -Range = require 'range' -Editor = require 'editor' -fuzzyFilter = require 'fuzzy-filter' - -module.exports = -class Autocomplete extends View - @content: -> - @div class: 'autocomplete', tabindex: -1, => - @ol outlet: 'matchesList' - @subview 'miniEditor', new Editor(mini: true) - - editor: null - miniEditor: null - currentBuffer: null - wordList: null - wordRegex: /\w+/g - allMatches: null - filteredMatches: null - currentMatchIndex: null - isAutocompleting: false - originalSelectionBufferRange: null - originalSelectedText: null - - @activate: (rootView) -> - new Autocomplete(editor) for editor in rootView.getEditors() - rootView.on 'editor-open', (e, editor) -> - editor.autoComplete = new Autocomplete(editor) unless editor.is('.autocomplete .mini') - - initialize: (@editor) -> - requireStylesheet 'autocomplete.css' - @handleEvents() - @setCurrentBuffer(@editor.getBuffer()) - - handleEvents: -> - @editor.on 'editor-path-change', => @setCurrentBuffer(@editor.getBuffer()) - @editor.on 'before-remove', => @currentBuffer?.off '.autocomplete' - - @editor.on 'autocomplete:attach', => @attach() - @editor.on 'autocomplete:cancel', => @cancel() - @on 'autocomplete:confirm', => @confirm() - - @matchesList.on 'mousedown', (e) => - index = $(e.target).attr('index') - @selectMatchAtIndex(index) if index? - false - - @matchesList.on 'mouseup', => - if @selectedMatch() - @confirm() - else - @cancel() - - @miniEditor.getBuffer().on 'change', (e) => - @filterMatches() if @hasParent() - - @miniEditor.preempt 'move-up', => - @selectPreviousMatch() - false - - @miniEditor.preempt 'move-down', => - @selectNextMatch() - false - - @miniEditor.preempt 'textInput', (e) => - text = e.originalEvent.data - unless text.match(@wordRegex) - @confirm() - @editor.insertText(text) - false - - setCurrentBuffer: (buffer) -> - @currentBuffer?.off '.autocomplete' - @currentBuffer = buffer - @buildWordList() - @currentBuffer.on 'change.autocomplete', (e) => - @buildWordList() unless @isAutocompleting - - buildWordList: () -> - wordHash = {} - matches = @currentBuffer.getText().match(@wordRegex) - wordHash[word] ?= true for word in (matches or []) - - @wordList = Object.keys(wordHash) - - confirm: -> - @confirmed = true - @editor.getSelection().clear() - @detach() - return unless match = @selectedMatch() - position = @editor.getCursorBufferPosition() - @editor.setCursorBufferPosition([position.row, position.column + match.suffix.length]) - - cancel: -> - @detach() - @editor.getBuffer().change(@currentMatchBufferRange, @originalSelectedText) if @currentMatchBufferRange - @editor.setSelectedBufferRange(@originalSelectionBufferRange) - - attach: -> - @confirmed = false - @miniEditor.on 'focusout', => - @cancel() unless @confirmed - - @originalSelectedText = @editor.getSelectedText() - @originalSelectionBufferRange = @editor.getSelection().getBufferRange() - @currentMatchBufferRange = null - @allMatches = @findMatchesForCurrentSelection() - - originalCursorPosition = @editor.getCursorScreenPosition() - @filterMatches() - @editor.append(this) - @setPosition(originalCursorPosition) - - @miniEditor.focus() - - detach: -> - @miniEditor.off("focusout") - super - @editor.off(".autocomplete") - @editor.focus() - @miniEditor.setText('') - - setPosition: (originalCursorPosition) -> - { left, top } = @editor.pixelPositionForScreenPosition(originalCursorPosition) - - top -= @editor.scrollTop() - potentialTop = top + @editor.lineHeight - potentialBottom = potentialTop + @outerHeight() - - if potentialBottom > @editor.outerHeight() - @css(left: left, bottom: @editor.outerHeight() - top, top: 'inherit') - else - @css(left: left, top: potentialTop, bottom: 'inherit') - - selectPreviousMatch: -> - previousIndex = @currentMatchIndex - 1 - previousIndex = @filteredMatches.length - 1 if previousIndex < 0 - @selectMatchAtIndex(previousIndex) - - selectNextMatch: -> - nextIndex = (@currentMatchIndex + 1) % @filteredMatches.length - @selectMatchAtIndex(nextIndex) - - selectMatchAtIndex: (index) -> - @currentMatchIndex = index - @matchesList.find("li").removeClass "selected" - - liToSelect = @matchesList.find("li:eq(#{index})") - liToSelect.addClass "selected" - - topOfLiToSelect = liToSelect.position().top + @matchesList.scrollTop() - bottomOfLiToSelect = topOfLiToSelect + liToSelect.outerHeight() - if topOfLiToSelect < @matchesList.scrollTop() - @matchesList.scrollTop(topOfLiToSelect) - else if bottomOfLiToSelect > @matchesList.scrollBottom() - @matchesList.scrollBottom(bottomOfLiToSelect) - - @replaceSelectedTextWithMatch @selectedMatch() - - selectedMatch: -> - @filteredMatches[@currentMatchIndex] - - filterMatches: -> - @filteredMatches = fuzzyFilter(@allMatches, @miniEditor.getText(), key: 'word') - @renderMatchList() - - renderMatchList: -> - @matchesList.empty() - if @filteredMatches.length > 0 - @matchesList.append($$ -> @li match.word, index: index) for match, index in @filteredMatches - else - @matchesList.append($$ -> @li "No matches found") - - @selectMatchAtIndex(0) if @filteredMatches.length > 0 - - findMatchesForCurrentSelection: -> - selection = @editor.getSelection() - {prefix, suffix} = @prefixAndSuffixOfSelection(selection) - - if (prefix.length + suffix.length) > 0 - regex = new RegExp("^#{prefix}(.+)#{suffix}$", "i") - currentWord = prefix + @editor.getSelectedText() + suffix - for word in @wordList when regex.test(word) and word != currentWord - match = regex.exec(word) - {prefix, suffix, word, infix: match[1]} - else - [] - - replaceSelectedTextWithMatch: (match) -> - selection = @editor.getSelection() - startPosition = selection.getBufferRange().start - @isAutocompleting = true - @editor.insertText(match.infix) - - @currentMatchBufferRange = [startPosition, [startPosition.row, startPosition.column + match.infix.length]] - @editor.setSelectedBufferRange(@currentMatchBufferRange) - @isAutocompleting = false - - prefixAndSuffixOfSelection: (selection) -> - selectionRange = selection.getBufferRange() - lineRange = [[selectionRange.start.row, 0], [selectionRange.end.row, @editor.lineLengthForBufferRow(selectionRange.end.row)]] - [prefix, suffix] = ["", ""] - - @currentBuffer.scanInRange @wordRegex, lineRange, (match, range, {stop}) -> - stop() if range.start.isGreaterThan(selectionRange.end) - - if range.intersectsWith(selectionRange) - prefixOffset = selectionRange.start.column - range.start.column - suffixOffset = selectionRange.end.column - range.end.column - - prefix = match[0][0...prefixOffset] if range.start.isLessThan(selectionRange.start) - suffix = match[0][suffixOffset..] if range.end.isGreaterThan(selectionRange.end) - - {prefix, suffix} diff --git a/src/extensions/autocomplete/index.coffee b/src/extensions/autocomplete/index.coffee deleted file mode 100644 index 4cee041e6..000000000 --- a/src/extensions/autocomplete/index.coffee +++ /dev/null @@ -1 +0,0 @@ -module.exports = require 'autocomplete/autocomplete.coffee' diff --git a/src/extensions/autocomplete/keymap.coffee b/src/extensions/autocomplete/keymap.coffee deleted file mode 100644 index e656d8ae2..000000000 --- a/src/extensions/autocomplete/keymap.coffee +++ /dev/null @@ -1,8 +0,0 @@ -window.keymap.bindKeys '.editor', - 'escape': 'autocomplete:attach' - 'ctrl-space': 'autocomplete:attach' - -window.keymap.bindKeys '.autocomplete .editor', - 'enter': 'autocomplete:confirm' - 'escape': 'autocomplete:cancel' - 'ctrl-space': 'autocomplete:cancel' diff --git a/src/extensions/command-panel/command-interpreter.coffee b/src/extensions/command-panel/command-interpreter.coffee deleted file mode 100644 index eb328c9b6..000000000 --- a/src/extensions/command-panel/command-interpreter.coffee +++ /dev/null @@ -1,18 +0,0 @@ -fs = require 'fs' -PEG = require 'pegjs' - -module.exports = -class CommandInterpreter - constructor: (@project) -> - @parser = PEG.buildParser(fs.read(require.resolve 'command-panel/commands.pegjs')) - - eval: (string, activeEditSession) -> - compositeCommand = @parser.parse(string) - @lastRelativeAddress = compositeCommand if compositeCommand.isRelativeAddress() - compositeCommand.execute(@project, activeEditSession) - - repeatRelativeAddress: (activeEditSession) -> - @lastRelativeAddress?.execute(@project, activeEditSession) - - repeatRelativeAddressInReverse: (activeEditSession) -> - @lastRelativeAddress?.reverse().execute(@project, activeEditSession) diff --git a/src/extensions/command-panel/command-panel.coffee b/src/extensions/command-panel/command-panel.coffee deleted file mode 100644 index 50e817c2e..000000000 --- a/src/extensions/command-panel/command-panel.coffee +++ /dev/null @@ -1,138 +0,0 @@ -{View, $$$} = require 'space-pen' -CommandInterpreter = require 'command-panel/command-interpreter' -RegexAddress = require 'command-panel/commands/regex-address' -CompositeCommand = require 'command-panel/commands/composite-command' -PreviewList = require 'command-panel/preview-list' -Editor = require 'editor' -{SyntaxError} = require('pegjs').parser - -_ = require 'underscore' - -module.exports = -class CommandPanel extends View - @activate: (rootView, state) -> - requireStylesheet 'command-panel.css' - if state? - @instance = CommandPanel.deserialize(state, rootView) - else - @instance = new CommandPanel(rootView) - - @deactivate: -> - @instance.destroy() - - @serialize: -> - text: @instance.miniEditor.getText() - visible: @instance.hasParent() - miniEditorFocused: @instance.miniEditor.isFocused - - @deserialize: (state, rootView) -> - commandPanel = new CommandPanel(rootView) - commandPanel.attach(state.text, focus: false) if state.visible - commandPanel.miniEditor.focus() if state.miniEditorFocused - commandPanel - - @content: (rootView) -> - @div class: 'command-panel', => - @subview 'previewList', new PreviewList(rootView) - @div class: 'prompt-and-editor', => - @div ':', class: 'prompt', outlet: 'prompt' - @subview 'miniEditor', new Editor(mini: true) - - commandInterpreter: null - history: null - historyIndex: 0 - - initialize: (@rootView)-> - @commandInterpreter = new CommandInterpreter(@rootView.project) - @history = [] - - @on 'command-panel:unfocus', => @rootView.focus() - @on 'command-panel:close', => @detach() - - @rootView.on 'command-panel:toggle', => @toggle() - @rootView.on 'command-panel:toggle-preview', => @togglePreview() - @rootView.on 'command-panel:execute', => @execute() - @rootView.on 'command-panel:find-in-file', => @attach("/") - @rootView.on 'command-panel:find-in-project', => @attach("Xx/") - @rootView.on 'command-panel:repeat-relative-address', => @repeatRelativeAddress() - @rootView.on 'command-panel:repeat-relative-address-in-reverse', => @repeatRelativeAddressInReverse() - @rootView.on 'command-panel:set-selection-as-regex-address', => @setSelectionAsLastRelativeAddress() - - @miniEditor.off 'move-up move-down' - @miniEditor.on 'move-up', => @navigateBackwardInHistory() - @miniEditor.on 'move-down', => @navigateForwardInHistory() - - @previewList.hide() - - destroy: -> - @previewList.destroy() - - toggle: -> - if @miniEditor.isFocused - @detach() - @rootView.focus() - else - @attach() unless @hasParent() - @miniEditor.focus() - - togglePreview: -> - if @previewList.is(':focus') - @previewList.hide() - @detach() - @rootView.focus() - else - @attach() unless @hasParent() - if @previewList.hasOperations() - @previewList.show().focus() - else - @miniEditor.focus() - - attach: (text='', options={}) -> - focus = options.focus ? true - @rootView.vertical.append(this) - @miniEditor.focus() if focus - @miniEditor.setText(text) - @miniEditor.setCursorBufferPosition([0, Infinity]) - - detach: -> - @rootView.focus() - @previewList.hide() - super - - execute: (command = @miniEditor.getText()) -> - try - @commandInterpreter.eval(command, @rootView.getActiveEditSession()).done (operationsToPreview) => - @history.push(command) - @historyIndex = @history.length - if operationsToPreview?.length - @previewList.populate(operationsToPreview) - @previewList.focus() - else - @detach() - catch error - if error.name is "SyntaxError" - @flashError() - return - else - throw error - - navigateBackwardInHistory: -> - return if @historyIndex == 0 - @historyIndex-- - @miniEditor.setText(@history[@historyIndex]) - - navigateForwardInHistory: -> - return if @historyIndex == @history.length - @historyIndex++ - @miniEditor.setText(@history[@historyIndex] or '') - - repeatRelativeAddress: -> - @commandInterpreter.repeatRelativeAddress(@rootView.getActiveEditSession()) - - repeatRelativeAddressInReverse: -> - @commandInterpreter.repeatRelativeAddressInReverse(@rootView.getActiveEditSession()) - - setSelectionAsLastRelativeAddress: -> - selection = @rootView.getActiveEditor().getSelectedText() - regex = _.escapeRegExp(selection) - @commandInterpreter.lastRelativeAddress = new CompositeCommand([new RegexAddress(regex)]) diff --git a/src/extensions/command-panel/commands.pegjs b/src/extensions/command-panel/commands.pegjs deleted file mode 100644 index 7761003eb..000000000 --- a/src/extensions/command-panel/commands.pegjs +++ /dev/null @@ -1,58 +0,0 @@ -{ - var CompositeCommand = require('command-panel/commands/composite-command') - var Substitution = require('command-panel/commands/substitution'); - var ZeroAddress = require('command-panel/commands/zero-address'); - var EofAddress = require('command-panel/commands/eof-address'); - var LineAddress = require('command-panel/commands/line-address'); - var AddressRange = require('command-panel/commands/address-range'); - var CurrentSelectionAddress = require('command-panel/commands/current-selection-address') - var RegexAddress = require('command-panel/commands/regex-address') - var SelectAllMatches = require('command-panel/commands/select-all-matches') - var SelectAllMatchesInProject = require('command-panel/commands/select-all-matches-in-project') -} - -start = expressions:(expression+) { - return new CompositeCommand(expressions) -} - -expression = _ expression:(address / command) _ { return expression; } - -address = addressRange / primitiveAddress - -addressRange - = start:primitiveAddress? _ ',' _ end:address? { - if (!start) start = new ZeroAddress() - if (!end) end = new EofAddress() - return new AddressRange(start, end) - } - -primitiveAddress - = '0' { return new ZeroAddress() } - / '$' { return new EofAddress() } - / '.' { return new CurrentSelectionAddress() } - / lineNumber:integer { return new LineAddress(lineNumber) } - / regexAddress - -regexAddress - = reverse:'-'? '/' pattern:pattern '/'? { return new RegexAddress(pattern, reverse.length > 0)} - -command = substitution / selectAllMatches / selectAllMatchesInProject - -substitution - = "s" _ "/" find:pattern "/" replace:pattern "/" _ options:[g]* { - return new Substitution(find, replace, options); - } - -selectAllMatches - = 'x' _ '/' pattern:pattern '/'? { return new SelectAllMatches(pattern) } - -selectAllMatchesInProject - = 'X' _ 'x' _ '/' pattern:pattern '/'? { return new SelectAllMatchesInProject(pattern) } - -pattern - = pattern:[^/]* { return pattern.join('') } - -integer - = digits:[0-9]+ { return parseInt(digits.join('')); } - -_ = " "* diff --git a/src/extensions/command-panel/commands/address-range.coffee b/src/extensions/command-panel/commands/address-range.coffee deleted file mode 100644 index 45cb5afda..000000000 --- a/src/extensions/command-panel/commands/address-range.coffee +++ /dev/null @@ -1,12 +0,0 @@ -Address = require 'command-panel/commands/address' -Range = require 'range' - -module.exports = -class AddressRange extends Address - constructor: (@startAddress, @endAddress) -> - - getRange: (buffer, range) -> - new Range(@startAddress.getRange(buffer, range).start, @endAddress.getRange(buffer, range).end) - - isRelative: -> - @startAddress.isRelative() and @endAddress.isRelative() diff --git a/src/extensions/command-panel/commands/address.coffee b/src/extensions/command-panel/commands/address.coffee deleted file mode 100644 index b15c07d63..000000000 --- a/src/extensions/command-panel/commands/address.coffee +++ /dev/null @@ -1,17 +0,0 @@ -Command = require 'command-panel/commands/command' -Operation = require 'command-panel/operation' -$ = require 'jquery' - -module.exports = -class Address extends Command - compile: (project, buffer, ranges) -> - deferred = $.Deferred() - deferred.resolve ranges.map (range) => - new Operation - project: project - buffer: buffer - bufferRange: @getRange(buffer, range) - - deferred.promise() - - isAddress: -> true diff --git a/src/extensions/command-panel/commands/command.coffee b/src/extensions/command-panel/commands/command.coffee deleted file mode 100644 index 181def85b..000000000 --- a/src/extensions/command-panel/commands/command.coffee +++ /dev/null @@ -1,7 +0,0 @@ -_ = require 'underscore' - -module.exports = -class Command - isAddress: -> false - preserveSelections: false - previewOperations: false \ No newline at end of file diff --git a/src/extensions/command-panel/commands/composite-command.coffee b/src/extensions/command-panel/commands/composite-command.coffee deleted file mode 100644 index 4858b73e6..000000000 --- a/src/extensions/command-panel/commands/composite-command.coffee +++ /dev/null @@ -1,43 +0,0 @@ -_ = require 'underscore' -$ = require 'jquery' - -module.exports = -class CompositeCommand - constructor: (@subcommands) -> - - execute: (project, editSession) -> - currentRanges = editSession?.getSelectedBufferRanges() - @executeCommands(@subcommands, project, editSession, currentRanges) - - executeCommands: (commands, project, editSession, ranges) -> - deferred = $.Deferred() - [currentCommand, remainingCommands...] = commands - - currentCommand.compile(project, editSession?.buffer, ranges).done (operations) => - if remainingCommands.length - nextRanges = operations.map (operation) -> - operation.destroy() - operation.getBufferRange() - @executeCommands(remainingCommands, project, editSession, nextRanges).done -> - deferred.resolve() - else - if currentCommand.previewOperations - deferred.resolve(operations) - else - bufferRanges = [] - for operation in operations - bufferRange = operation.execute(editSession) - bufferRanges.push(bufferRange) if bufferRange - operation.destroy() - if bufferRanges.length and not currentCommand.preserveSelections - editSession.setSelectedBufferRanges(bufferRanges) - deferred.resolve() - - deferred.promise() - - reverse: -> - new CompositeCommand(@subcommands.map (command) -> command.reverse()) - - isRelativeAddress: -> - _.all(@subcommands, (command) -> command.isAddress() and command.isRelative()) - diff --git a/src/extensions/command-panel/commands/current-selection-address.coffee b/src/extensions/command-panel/commands/current-selection-address.coffee deleted file mode 100644 index 5a230f842..000000000 --- a/src/extensions/command-panel/commands/current-selection-address.coffee +++ /dev/null @@ -1,9 +0,0 @@ -Address = require 'command-panel/commands/address' -Range = require 'range' - -module.exports = -class CurrentSelectionAddress extends Address - getRange: (buffer, range) -> - range - - isRelative: -> true diff --git a/src/extensions/command-panel/commands/eof-address.coffee b/src/extensions/command-panel/commands/eof-address.coffee deleted file mode 100644 index f84213420..000000000 --- a/src/extensions/command-panel/commands/eof-address.coffee +++ /dev/null @@ -1,10 +0,0 @@ -Address = require 'command-panel/commands/address' -Range = require 'range' - -module.exports = -class EofAddress extends Address - getRange: (buffer, range) -> - eof = buffer.getEofPosition() - new Range(eof, eof) - - isRelative: -> false diff --git a/src/extensions/command-panel/commands/line-address.coffee b/src/extensions/command-panel/commands/line-address.coffee deleted file mode 100644 index aaebc7a40..000000000 --- a/src/extensions/command-panel/commands/line-address.coffee +++ /dev/null @@ -1,12 +0,0 @@ -Address = require 'command-panel/commands/address' -Range = require 'range' - -module.exports = -class LineAddress extends Address - constructor: (lineNumber) -> - @row = lineNumber - 1 - - getRange: -> - new Range([@row, 0], [@row + 1, 0]) - - isRelative: -> false diff --git a/src/extensions/command-panel/commands/regex-address.coffee b/src/extensions/command-panel/commands/regex-address.coffee deleted file mode 100644 index 37a4737ed..000000000 --- a/src/extensions/command-panel/commands/regex-address.coffee +++ /dev/null @@ -1,36 +0,0 @@ -Address = require 'command-panel/commands/address' -Range = require 'range' - -module.exports = -class RegexAddress extends Address - regex: null - reverse: null - - constructor: (pattern, isReversed) -> - @isReversed = isReversed - @regex = new RegExp(pattern) - - getRange: (buffer, range) -> - rangeBefore = new Range([0, 0], range.start) - rangeAfter = new Range(range.end, buffer.getEofPosition()) - - rangeToSearch = if @isReversed then rangeBefore else rangeAfter - - rangeToReturn = null - scanMethodName = if @isReversed then "backwardsScanInRange" else "scanInRange" - buffer[scanMethodName] @regex, rangeToSearch, (match, range) -> - rangeToReturn = range - - if rangeToReturn - rangeToReturn - else - rangeToSearch = if @isReversed then rangeAfter else rangeBefore - buffer[scanMethodName] @regex, rangeToSearch, (match, range) -> - rangeToReturn = range - - rangeToReturn or range - - isRelative: -> true - - reverse: -> - new RegexAddress(@regex, !@isReversed) diff --git a/src/extensions/command-panel/commands/select-all-matches-in-project.coffee b/src/extensions/command-panel/commands/select-all-matches-in-project.coffee deleted file mode 100644 index 6e09abbe9..000000000 --- a/src/extensions/command-panel/commands/select-all-matches-in-project.coffee +++ /dev/null @@ -1,24 +0,0 @@ -Command = require 'command-panel/commands/command' -Operation = require 'command-panel/operation' -$ = require 'jquery' - -module.exports = -class SelectAllMatchesInProject extends Command - regex: null - previewOperations: true - - constructor: (pattern) -> - @regex = new RegExp(pattern, 'g') - - compile: (project, buffer, range) -> - deferred = $.Deferred() - operations = [] - promise = project.scan @regex, ({path, range}) -> - operations.push(new Operation( - project: project - buffer: project.bufferForPath(path) - bufferRange: range - )) - - promise.done -> deferred.resolve(operations) - deferred.promise() diff --git a/src/extensions/command-panel/commands/select-all-matches.coffee b/src/extensions/command-panel/commands/select-all-matches.coffee deleted file mode 100644 index fb5017f25..000000000 --- a/src/extensions/command-panel/commands/select-all-matches.coffee +++ /dev/null @@ -1,23 +0,0 @@ -Command = require 'command-panel/commands/command' -Operation = require 'command-panel/operation' -$ = require 'jquery' - -module.exports = -class SelectAllMatches extends Command - regex: null - - constructor: (pattern) -> - @regex = new RegExp(pattern, 'g') - - compile: (project, buffer, ranges) -> - deferred = $.Deferred() - operations = [] - for range in ranges - buffer.scanInRange @regex, range, (match, matchRange) -> - operations.push(new Operation( - project: project - buffer: buffer - bufferRange: matchRange - )) - deferred.resolve(operations) - deferred.promise() diff --git a/src/extensions/command-panel/commands/substitution.coffee b/src/extensions/command-panel/commands/substitution.coffee deleted file mode 100644 index 403cb3731..000000000 --- a/src/extensions/command-panel/commands/substitution.coffee +++ /dev/null @@ -1,28 +0,0 @@ -Command = require 'command-panel/commands/command' -Operation = require 'command-panel/operation' -$ = require 'jquery' - -module.exports = -class Substitution extends Command - regex: null - replacementText: null - preserveSelections: true - - constructor: (pattern, replacementText, options) -> - @replacementText = replacementText - @regex = new RegExp(pattern, options.join('')) - - compile: (project, buffer, ranges) -> - deferred = $.Deferred() - operations = [] - for range in ranges - buffer.scanInRange @regex, range, (match, matchRange, { replace }) => - operations.push(new Operation( - project: project - buffer: buffer - bufferRange: matchRange - newText: @replacementText - preserveSelection: true - )) - deferred.resolve(operations) - deferred.promise() diff --git a/src/extensions/command-panel/commands/zero-address.coffee b/src/extensions/command-panel/commands/zero-address.coffee deleted file mode 100644 index f40b6d377..000000000 --- a/src/extensions/command-panel/commands/zero-address.coffee +++ /dev/null @@ -1,9 +0,0 @@ -Address = require 'command-panel/commands/address' -Range = require 'range' - -module.exports = -class ZeroAddress extends Address - getRange: -> - new Range([0, 0], [0, 0]) - - isRelative: -> false diff --git a/src/extensions/command-panel/index.coffee b/src/extensions/command-panel/index.coffee deleted file mode 100644 index 4d7dbb69f..000000000 --- a/src/extensions/command-panel/index.coffee +++ /dev/null @@ -1 +0,0 @@ -module.exports = require 'command-panel/command-panel' diff --git a/src/extensions/command-panel/keymap.coffee b/src/extensions/command-panel/keymap.coffee deleted file mode 100644 index 8b515ddcb..000000000 --- a/src/extensions/command-panel/keymap.coffee +++ /dev/null @@ -1,17 +0,0 @@ -window.keymap.bindKeys '*' - 'ctrl-0': 'command-panel:toggle' - 'ctrl-2': 'command-panel:toggle-preview' - 'meta-:': 'command-panel:toggle' - 'meta-F': 'command-panel:find-in-project' - -window.keymap.bindKeys '.command-panel .preview-list, .command-panel .editor input', - 'meta-w': 'command-panel:close' - escape: 'command-panel:unfocus' - enter: 'command-panel:execute' - -window.keymap.bindKeys '.editor', - 'meta-g': 'command-panel:repeat-relative-address' - 'meta-G': 'command-panel:repeat-relative-address-in-reverse' - 'meta-e': 'command-panel:set-selection-as-regex-address' - 'meta-f': 'command-panel:find-in-file' - 'meta-F': 'command-panel:find-in-project' diff --git a/src/extensions/command-panel/operation.coffee b/src/extensions/command-panel/operation.coffee deleted file mode 100644 index 7bf2d82b5..000000000 --- a/src/extensions/command-panel/operation.coffee +++ /dev/null @@ -1,30 +0,0 @@ -{$$$} = require 'space-pen' - -module.exports = -class Operation - constructor: ({@project, @buffer, bufferRange, @newText, @preserveSelection}) -> - @buffer.retain() - @anchorRange = @buffer.addAnchorRange(bufferRange) - - getPath: -> - @project.relativize(@buffer.getPath()) - - getBufferRange: -> - @anchorRange.getBufferRange() - - execute: (editSession) -> - @buffer.change(@getBufferRange(), @newText) if @newText - @getBufferRange() unless @preserveSelection - - preview: -> - range = @anchorRange.getBufferRange() - line = @buffer.lineForRow(range.start.row) - prefix = line[0...range.start.column] - match = line[range.start.column...range.end.column] - suffix = line[range.end.column..] - - {prefix, suffix, match} - - destroy: -> - @buffer.release() - @anchorRange.destroy() \ No newline at end of file diff --git a/src/extensions/command-panel/preview-list.coffee b/src/extensions/command-panel/preview-list.coffee deleted file mode 100644 index cebe520c9..000000000 --- a/src/extensions/command-panel/preview-list.coffee +++ /dev/null @@ -1,83 +0,0 @@ -$ = require 'jquery' -{$$$, View} = require 'space-pen' - -module.exports = -class PreviewList extends View - @content: -> - @ol class: 'preview-list', tabindex: -1, -> - - selectedOperationIndex: 0 - operations: null - - initialize: (@rootView) -> - @on 'move-down', => @selectNextOperation() - @on 'move-up', => @selectPreviousOperation() - @on 'command-panel:execute', => @executeSelectedOperation() - - @on 'mousedown', 'li', (e) => - @setSelectedOperationIndex(parseInt($(e.target).closest('li').data('index'))) - @executeSelectedOperation() - - destroy: -> - @destroyOperations() if @operations - - hasOperations: -> @operations? - - populate: (operations) -> - @destroyOperations() if @operations - @operations = operations - @empty() - @html $$$ -> - for operation, index in operations - {prefix, suffix, match} = operation.preview() - @li 'data-index': index, => - @span operation.getPath(), outlet: "path", class: "path" - @span outlet: "preview", class: "preview", => - @span prefix - @span match, class: 'match' - @span suffix - - @setSelectedOperationIndex(0) - @show() - - selectNextOperation: -> - @setSelectedOperationIndex(@selectedOperationIndex + 1) - - selectPreviousOperation: -> - @setSelectedOperationIndex(@selectedOperationIndex - 1) - - setSelectedOperationIndex: (index) -> - index = Math.max(0, index) - index = Math.min(@operations.length - 1, index) - @children(".selected").removeClass('selected') - element = @children("li:eq(#{index})") - element.addClass('selected') - @scrollToElement(element) - @selectedOperationIndex = index - - executeSelectedOperation: -> - operation = @getSelectedOperation() - editSession = @rootView.open(operation.getPath()) - bufferRange = operation.execute(editSession) - editSession.setSelectedBufferRange(bufferRange) if bufferRange - @rootView.focus() - false - - getOperations: -> - new Array(@operations...) - - destroyOperations: -> - operation.destroy() for operation in @getOperations() - @operations = null - - getSelectedOperation: -> - @operations[@selectedOperationIndex] - - scrollToElement: (element) -> - top = @scrollTop() + element.position().top - bottom = top + element.outerHeight() - - if bottom > @scrollBottom() - @scrollBottom(bottom) - if top < @scrollTop() - @scrollTop(top) diff --git a/src/extensions/fuzzy-finder/fuzzy-finder.coffee b/src/extensions/fuzzy-finder/fuzzy-finder.coffee deleted file mode 100644 index f016017f1..000000000 --- a/src/extensions/fuzzy-finder/fuzzy-finder.coffee +++ /dev/null @@ -1,110 +0,0 @@ -{View, $$} = require 'space-pen' -stringScore = require 'stringscore' -fuzzyFilter = require 'fuzzy-filter' -$ = require 'jquery' -Editor = require 'editor' - -module.exports = -class FuzzyFinder extends View - @activate: (rootView) -> - @instance = new FuzzyFinder(rootView) - - @content: -> - @div class: 'fuzzy-finder', => - @ol outlet: 'pathList' - @subview 'miniEditor', new Editor(mini: true) - - paths: null - allowActiveEditorChange: null - maxResults: null - - initialize: (@rootView) -> - requireStylesheet 'fuzzy-finder.css' - @maxResults = 10 - - @rootView.on 'fuzzy-finder:toggle-file-finder', => @toggleFileFinder() - @rootView.on 'fuzzy-finder:toggle-buffer-finder', => @toggleBufferFinder() - - @on 'fuzzy-finder:cancel', => @detach() - @on 'move-up', => @moveUp() - @on 'move-down', => @moveDown() - @on 'fuzzy-finder:select-path', => @select() - @on 'mousedown', 'li', (e) => @entryClicked(e) - - @miniEditor.getBuffer().on 'change', => @populatePathList() if @hasParent() - @miniEditor.off 'move-up move-down' - - toggleFileFinder: -> - if @hasParent() - @detach() - else - return unless @rootView.project.getPath()? - @allowActiveEditorChange = false - @populateProjectPaths() - @attach() - - toggleBufferFinder: -> - if @hasParent() - @detach() - else - @allowActiveEditorChange = true - @populateOpenBufferPaths() - @attach() if @paths?.length - - populateProjectPaths: -> - @rootView.project.getFilePaths().done (@paths) => @populatePathList() - - populateOpenBufferPaths: -> - @paths = @rootView.getOpenBufferPaths().map (path) => - @rootView.project.relativize(path) - @populatePathList() if @paths?.length - - attach: -> - @rootView.append(this) - @miniEditor.focus() - @miniEditor.on 'focusout', => @detach() - - detach: -> - @miniEditor.off 'focusout' - @rootView.focus() - super - @miniEditor.setText('') - - populatePathList: -> - @pathList.empty() - for path in @findMatches(@miniEditor.getText()) - @pathList.append $$ -> @li path - - @pathList.children('li:first').addClass 'selected' - - findSelectedLi: -> - @pathList.children('li.selected') - - open : (path) -> - return unless path.length - @rootView.open(path, {@allowActiveEditorChange}) - @detach() - - select: -> - @open(@findSelectedLi().text()) - - entryClicked: (e) -> - @open($(e.currentTarget).text()) - false - - moveUp: -> - @findSelectedLi() - .filter(':not(:first-child)') - .removeClass('selected') - .prev() - .addClass('selected') - - moveDown: -> - @findSelectedLi() - .filter(':not(:last-child)') - .removeClass('selected') - .next() - .addClass('selected') - - findMatches: (query) -> - fuzzyFilter(@paths, query, maxResults: @maxResults) diff --git a/src/extensions/fuzzy-finder/index.coffee b/src/extensions/fuzzy-finder/index.coffee deleted file mode 100644 index c1518b670..000000000 --- a/src/extensions/fuzzy-finder/index.coffee +++ /dev/null @@ -1 +0,0 @@ -module.exports = require 'fuzzy-finder/fuzzy-finder' diff --git a/src/extensions/fuzzy-finder/keymap.coffee b/src/extensions/fuzzy-finder/keymap.coffee deleted file mode 100644 index b06be4909..000000000 --- a/src/extensions/fuzzy-finder/keymap.coffee +++ /dev/null @@ -1,8 +0,0 @@ -window.keymap.bindKeys '*' - 'meta-t': 'fuzzy-finder:toggle-file-finder' - 'meta-b': 'fuzzy-finder:toggle-buffer-finder' - -window.keymap.bindKeys ".fuzzy-finder .editor input", - 'enter': 'fuzzy-finder:select-path', - 'escape': 'fuzzy-finder:cancel' - 'meta-w': 'fuzzy-finder:cancel' diff --git a/src/extensions/keybindings-view/index.coffee b/src/extensions/keybindings-view/index.coffee deleted file mode 100644 index fc9229496..000000000 --- a/src/extensions/keybindings-view/index.coffee +++ /dev/null @@ -1 +0,0 @@ -module.exports = require 'keybindings-view/keybindings-view' diff --git a/src/extensions/keybindings-view/keybindings-view.coffee b/src/extensions/keybindings-view/keybindings-view.coffee deleted file mode 100644 index e2a641369..000000000 --- a/src/extensions/keybindings-view/keybindings-view.coffee +++ /dev/null @@ -1,31 +0,0 @@ -{View, $$} = require 'space-pen' - -module.exports = -class KeybindingsView extends View - @activate: (rootView, state) -> - requireStylesheet 'keybinding-view.css' - @instance = new this(rootView) - - @content: (rootView) -> - @div class: 'keybindings-view', tabindex: -1, => - @ul outlet: 'keybindingList' - - initialize: (@rootView) -> - @rootView.on 'keybindings-view:attach', => @attach() - @on 'keybindings-view:detach', => @detach() - - attach: -> - @keybindingList.empty() - @keybindingList.append $$ -> - for keystroke, command of rootView.activeKeybindings() - @li => - @span class: 'keystroke', "#{keystroke}" - @span ":" - @span "#{command}" - - @rootView.append(this) - @focus() - - detach: -> - super() - @rootView.focus() diff --git a/src/extensions/keybindings-view/keymap.coffee b/src/extensions/keybindings-view/keymap.coffee deleted file mode 100644 index de373a6e8..000000000 --- a/src/extensions/keybindings-view/keymap.coffee +++ /dev/null @@ -1,5 +0,0 @@ -window.keymap.bindKeys '*', - 'ctrl-?': 'keybindings-view:attach' - -window.keymap.bindKeys ".keybindings-view", - 'escape': 'keybindings-view:detach' diff --git a/src/extensions/snippets/index.coffee b/src/extensions/snippets/index.coffee deleted file mode 100644 index 912e393e5..000000000 --- a/src/extensions/snippets/index.coffee +++ /dev/null @@ -1 +0,0 @@ -module.exports = require 'extensions/snippets/snippets.coffee' diff --git a/src/extensions/snippets/keymap.coffee b/src/extensions/snippets/keymap.coffee deleted file mode 100644 index 6227dd8c1..000000000 --- a/src/extensions/snippets/keymap.coffee +++ /dev/null @@ -1,6 +0,0 @@ -window.keymap.bindKeys '.editor' - 'tab': 'snippets:expand' - -window.keymap.bindKeys '.editor' - 'tab': 'snippets:next-tab-stop' - 'shift-tab': 'snippets:previous-tab-stop' diff --git a/src/extensions/snippets/snippet-expansion.coffee b/src/extensions/snippets/snippet-expansion.coffee deleted file mode 100644 index e4277a90b..000000000 --- a/src/extensions/snippets/snippet-expansion.coffee +++ /dev/null @@ -1,61 +0,0 @@ -module.exports = -class SnippetExpansion - tabStopAnchorRanges: null - - constructor: (snippet, @editSession) -> - @editSession.selectToBeginningOfWord() - startPosition = @editSession.getCursorBufferPosition() - @editSession.transact => - @editSession.insertText(snippet.body, autoIndent: false) - if snippet.tabStops.length - @placeTabStopAnchorRanges(startPosition, snippet.tabStops) - if snippet.lineCount > 1 - @indentSubsequentLines(startPosition.row, snippet) - - placeTabStopAnchorRanges: (startPosition, tabStopRanges) -> - @tabStopAnchorRanges = tabStopRanges.map ({start, end}) => - @editSession.addAnchorRange([startPosition.add(start), startPosition.add(end)]) - @setTabStopIndex(0) - - indentSubsequentLines: (startRow, snippet) -> - initialIndent = @editSession.lineForBufferRow(startRow).match(/^\s*/)[0] - for row in [startRow + 1...startRow + snippet.lineCount] - @editSession.buffer.insert([row, 0], initialIndent) - - goToNextTabStop: -> - nextIndex = @tabStopIndex + 1 - if @cursorIsInsideTabStops() and nextIndex < @tabStopAnchorRanges.length - @setTabStopIndex(nextIndex) - true - else - @destroy() - false - - goToPreviousTabStop: -> - if @cursorIsInsideTabStops() - @setTabStopIndex(@tabStopIndex - 1) if @tabStopIndex > 0 - true - else - @destroy() - false - - ensureValidTabStops: -> - @tabStopAnchorRanges? and @destroyIfCursorIsOutsideTabStops() - - setTabStopIndex: (@tabStopIndex) -> - @editSession.setSelectedBufferRange(@tabStopAnchorRanges[@tabStopIndex].getBufferRange()) - - cursorIsInsideTabStops: -> - position = @editSession.getCursorBufferPosition() - for anchorRange in @tabStopAnchorRanges - return true if anchorRange.containsBufferPosition(position) - false - - destroy: -> - anchorRange.destroy() for anchorRange in @tabStopAnchorRanges - @editSession.snippetExpansion = null - - restore: (@editSession) -> - @editSession.snippetExpansion = this - @tabStopAnchorRanges = @tabStopAnchorRanges.map (anchorRange) => - @editSession.addAnchorRange(anchorRange.getBufferRange()) diff --git a/src/extensions/snippets/snippet.coffee b/src/extensions/snippets/snippet.coffee deleted file mode 100644 index bcdbd3de5..000000000 --- a/src/extensions/snippets/snippet.coffee +++ /dev/null @@ -1,36 +0,0 @@ -_ = require 'underscore' -Range = require 'range' - -module.exports = -class Snippet - body: null - lineCount: null - tabStops: null - - constructor: ({@bodyPosition, @prefix, @description, body}) -> - @body = @extractTabStops(body) - - extractTabStops: (bodyLines) -> - tabStopsByIndex = {} - bodyText = [] - - [row, column] = [0, 0] - for bodyLine, i in bodyLines - lineText = [] - for segment in bodyLine - if segment.index - { index, placeholderText } = segment - tabStopsByIndex[index] = new Range([row, column], [row, column + placeholderText.length]) - lineText.push(placeholderText) - else - lineText.push(segment) - column += segment.length - bodyText.push(lineText.join('')) - row++; column = 0 - @lineCount = row - - @tabStops = [] - for index in _.keys(tabStopsByIndex).sort() - @tabStops.push tabStopsByIndex[index] - - bodyText.join('\n') diff --git a/src/extensions/snippets/snippets.coffee b/src/extensions/snippets/snippets.coffee deleted file mode 100644 index de88ed7a1..000000000 --- a/src/extensions/snippets/snippets.coffee +++ /dev/null @@ -1,46 +0,0 @@ -fs = require 'fs' -PEG = require 'pegjs' -_ = require 'underscore' -SnippetExpansion = require 'snippets/snippet-expansion' - -module.exports = - name: 'Snippets' - snippetsByExtension: {} - snippetsParser: PEG.buildParser(fs.read(require.resolve 'extensions/snippets/snippets.pegjs'), trackLineAndColumn: true) - - activate: (@rootView) -> - @loadSnippets() - @rootView.on 'editor-open', (e, editor) => @enableSnippetsInEditor(editor) - - loadSnippets: -> - snippetsDir = fs.join(atom.configDirPath, 'snippets') - if fs.exists(snippetsDir) - @loadSnippetsFile(path) for path in fs.list(snippetsDir) when fs.extension(path) == '.snippets' - - loadSnippetsFile: (path) -> - @evalSnippets(fs.base(path, '.snippets'), fs.read(path)) - - evalSnippets: (extension, text) -> - @snippetsByExtension[extension] = @snippetsParser.parse(text) - - enableSnippetsInEditor: (editor) -> - editor.on 'snippets:expand', (e) => - editSession = editor.activeEditSession - prefix = editSession.getLastCursor().getCurrentWordPrefix() - if snippet = @snippetsByExtension[editSession.getFileExtension()]?[prefix] - editSession.transact -> - snippetExpansion = new SnippetExpansion(snippet, editSession) - editSession.snippetExpansion = snippetExpansion - editSession.pushOperation - undo: -> snippetExpansion.destroy() - redo: (editSession) -> snippetExpansion.restore(editSession) - else - e.abortKeyBinding() - - editor.on 'snippets:next-tab-stop', (e) -> - unless editor.activeEditSession.snippetExpansion?.goToNextTabStop() - e.abortKeyBinding() - - editor.on 'snippets:previous-tab-stop', (e) -> - unless editor.activeEditSession.snippetExpansion?.goToPreviousTabStop() - e.abortKeyBinding() diff --git a/src/extensions/snippets/snippets.pegjs b/src/extensions/snippets/snippets.pegjs deleted file mode 100644 index 2d2950130..000000000 --- a/src/extensions/snippets/snippets.pegjs +++ /dev/null @@ -1,39 +0,0 @@ -{ - var Snippet = require('extensions/snippets/snippet'); - var Point = require('point'); -} - -snippets = snippets:snippet+ ws? { - var snippetsByPrefix = {}; - snippets.forEach(function(snippet) { - snippetsByPrefix[snippet.prefix] = snippet - }); - return snippetsByPrefix; -} - -snippet = ws? start ws prefix:prefix ws description:string bodyPosition:beforeBody body:body end { - return new Snippet({ bodyPosition: bodyPosition, prefix: prefix, description: description, body: body }); -} - -start = 'snippet' -prefix = prefix:[A-Za-z0-9_]+ { return prefix.join(''); } -string = ['] body:[^']* ['] { return body.join(''); } - / ["] body:[^"]* ["] { return body.join(''); } - -beforeBody = [ ]* '\n' { return new Point(line, 0); } // return start position of body: body begins on next line, so don't subtract 1 from line - -body = bodyLine+ -bodyLine = content:(tabStop / bodyText)* '\n' { return content; } -bodyText = text:bodyChar+ { return text.join(''); } -bodyChar = !(end / tabStop) char:[^\n] { return char; } -tabStop = simpleTabStop / tabStopWithPlaceholder -simpleTabStop = '$' index:[0-9]+ { - return { index: parseInt(index), placeholderText: '' }; -} -tabStopWithPlaceholder = '${' index:[0-9]+ ':' placeholderText:[^}]* '}' { - return { index: parseInt(index), placeholderText: placeholderText.join('') }; -} - -end = 'endsnippet' -ws = ([ \n] / comment)+ -comment = '#' [^\n]* diff --git a/src/extensions/strip-trailing-whitespace.coffee b/src/extensions/strip-trailing-whitespace.coffee deleted file mode 100644 index d33eafe87..000000000 --- a/src/extensions/strip-trailing-whitespace.coffee +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = - name: "strip trailing whitespace" - - activate: (rootView) -> - for buffer in rootView.project.getBuffers() - @stripTrailingWhitespaceBeforeSave(buffer) - - rootView.project.on 'new-buffer', (buffer) => - @stripTrailingWhitespaceBeforeSave(buffer) - - stripTrailingWhitespaceBeforeSave: (buffer) -> - buffer.on 'before-save', -> - buffer.scan /[ \t]+$/g, (match, range, { replace }) -> - replace('') diff --git a/src/extensions/tree-view/dialog.coffee b/src/extensions/tree-view/dialog.coffee deleted file mode 100644 index da9685ea5..000000000 --- a/src/extensions/tree-view/dialog.coffee +++ /dev/null @@ -1,38 +0,0 @@ -{View, $$} = require 'space-pen' -Editor = require 'editor' -fs = require 'fs' -$ = require 'jquery' - -module.exports = -class Dialog extends View - @content: ({prompt} = {}) -> - @div class: 'tree-view-dialog', => - @div prompt, outlet: 'prompt' - @subview 'miniEditor', new Editor(mini: true) - - initialize: ({path, @onConfirm, select} = {}) -> - @miniEditor.focus() - @on 'tree-view:confirm', => @confirm() - @on 'tree-view:cancel', => @cancel() - @miniEditor.on 'focusout', => @remove() - - @miniEditor.setText(path) - - if select - extension = fs.extension(path) - baseName = fs.base(path) - range = [[0, path.length - baseName.length], [0, path.length - extension.length]] - @miniEditor.setSelectedBufferRange(range) - - confirm: -> - return if @onConfirm(@miniEditor.getText()) is false - @remove() - $('#root-view').focus() - - cancel: -> - @remove() - $('.tree-view').focus() - - showError: (message) -> - @prompt.text(message) - @prompt.flashError() diff --git a/src/extensions/tree-view/directory-view.coffee b/src/extensions/tree-view/directory-view.coffee deleted file mode 100644 index 0fd70521d..000000000 --- a/src/extensions/tree-view/directory-view.coffee +++ /dev/null @@ -1,84 +0,0 @@ -{View, $$} = require 'space-pen' -FileView = require 'tree-view/file-view' -Directory = require 'directory' -$ = require 'jquery' - -module.exports = -class DirectoryView extends View - @content: ({directory, isExpanded} = {}) -> - @li class: 'directory entry', => - @div outlet: 'header', class: 'header', => - @span '▸', class: 'disclosure-arrow', outlet: 'disclosureArrow' - @span directory.getBaseName(), class: 'name' - - directory: null - entries: null - header: null - - initialize: ({@directory, isExpanded} = {}) -> - @expand() if isExpanded - @disclosureArrow.on 'click', => @toggleExpansion() - - getPath: -> - @directory.path - - buildEntries: -> - @unwatchDescendantEntries() - @entries?.remove() - @entries = $$ -> @ol class: 'entries' - for entry in @directory.getEntries() - if entry instanceof Directory - @entries.append(new DirectoryView(directory: entry, isExpanded: false)) - else - @entries.append(new FileView(entry)) - @append(@entries) - - toggleExpansion: -> - if @isExpanded then @collapse() else @expand() - - expand: -> - return if @isExpanded - @addClass('expanded') - @disclosureArrow.text('▾') - @buildEntries() - @watchEntries() - @deserializeEntryExpansionStates(@entryStates) if @entryStates? - @isExpanded = true - false - - collapse: -> - @entryStates = @serializeEntryExpansionStates() - @removeClass('expanded') - @disclosureArrow.text('▸') - @unwatchEntries() - @entries.remove() - @entries = null - @isExpanded = false - - watchEntries: -> - @directory.on "contents-change.#{@directory.path}", => - @buildEntries() - @trigger "tree-view:directory-modified" - - unwatchEntries: -> - @unwatchDescendantEntries() - @directory.off ".#{@directory.path}" - - unwatchDescendantEntries: -> - @find('.expanded.directory').each -> - $(this).view().unwatchEntries() - - serializeEntryExpansionStates: -> - entryStates = {} - @entries?.find('> .directory.expanded').each -> - view = $(this).view() - entryStates[view.directory.getBaseName()] = view.serializeEntryExpansionStates() - entryStates - - deserializeEntryExpansionStates: (entryStates) -> - for directoryName, childEntryStates of entryStates - @entries.find("> .directory:contains('#{directoryName}')").each -> - view = $(this).view() - view.entryStates = childEntryStates - view.expand() - diff --git a/src/extensions/tree-view/file-view.coffee b/src/extensions/tree-view/file-view.coffee deleted file mode 100644 index 29b5f7a97..000000000 --- a/src/extensions/tree-view/file-view.coffee +++ /dev/null @@ -1,14 +0,0 @@ -{View, $$} = require 'space-pen' -$ = require 'jquery' - -module.exports = -class FileView extends View - @content: (file) -> - @li file.getBaseName(), class: 'file entry' - - file: null - - initialize: (@file) -> - - getPath: -> - @file.path diff --git a/src/extensions/tree-view/index.coffee b/src/extensions/tree-view/index.coffee deleted file mode 100644 index 26740b31b..000000000 --- a/src/extensions/tree-view/index.coffee +++ /dev/null @@ -1 +0,0 @@ -module.exports = require 'tree-view/tree-view' diff --git a/src/extensions/tree-view/keymap.coffee b/src/extensions/tree-view/keymap.coffee deleted file mode 100644 index b7aff8127..000000000 --- a/src/extensions/tree-view/keymap.coffee +++ /dev/null @@ -1,18 +0,0 @@ -window.keymap.bindKeys '#root-view' - 'ctrl-1': 'tree-view:toggle' - 'ctrl-meta-1': 'tree-view:reveal-active-file' - -window.keymap.bindKeys '.tree-view' - 'escape': 'tree-view:unfocus' - 'meta-w': 'tree-view:toggle' - 'right': 'tree-view:expand-directory' - 'left': 'tree-view:collapse-directory' - 'enter': 'tree-view:open-selected-entry' - 'm': 'tree-view:move' - 'a': 'tree-view:add' - 'delete': 'tree-view:remove' - 'backspace': 'tree-view:remove' - -window.keymap.bindKeys '.tree-view-dialog .mini.editor' - 'enter': 'tree-view:confirm' - 'escape': 'tree-view:cancel' diff --git a/src/extensions/tree-view/tree-view.coffee b/src/extensions/tree-view/tree-view.coffee deleted file mode 100644 index 59aa25301..000000000 --- a/src/extensions/tree-view/tree-view.coffee +++ /dev/null @@ -1,265 +0,0 @@ -{View, $$} = require 'space-pen' -Directory = require 'directory' -DirectoryView = require 'tree-view/directory-view' -FileView = require 'tree-view/file-view' -Dialog = require 'tree-view/dialog' -Native = require 'native' -fs = require 'fs' -$ = require 'jquery' -_ = require 'underscore' - -module.exports = -class TreeView extends View - @activate: (rootView, state) -> - requireStylesheet 'tree-view.css' - - if state - @instance = TreeView.deserialize(state, rootView) - else - @instance = new TreeView(rootView) - @instance.attach() - - @deactivate: () -> - @instance.deactivate() - - @serialize: -> - @instance.serialize() - - @content: (rootView) -> - @div class: 'tree-view', tabindex: -1, => - if rootView.project.getRootDirectory() - @subview 'root', new DirectoryView(directory: rootView.project.getRootDirectory(), isExpanded: true) - - @deserialize: (state, rootView) -> - treeView = new TreeView(rootView) - treeView.root.deserializeEntryExpansionStates(state.directoryExpansionStates) - treeView.selectEntryForPath(state.selectedPath) - treeView.focusAfterAttach = state.hasFocus - treeView.attach() if state.attached - treeView - - root: null - focusAfterAttach: false - - initialize: (@rootView) -> - @on 'click', '.entry', (e) => @entryClicked(e) - @on 'move-up', => @moveUp() - @on 'move-down', => @moveDown() - @on 'tree-view:expand-directory', => @expandDirectory() - @on 'tree-view:collapse-directory', => @collapseDirectory() - @on 'tree-view:open-selected-entry', => @openSelectedEntry() - @on 'tree-view:move', => @moveSelectedEntry() - @on 'tree-view:add', => @add() - @on 'tree-view:remove', => @removeSelectedEntry() - @on 'tree-view:directory-modified', => @selectActiveFile() - @on 'tree-view:unfocus', => @rootView.focus() - @rootView.on 'tree-view:toggle', => @toggle() - @rootView.on 'tree-view:reveal-active-file', => @revealActiveFile() - @rootView.on 'active-editor-path-change', => @selectActiveFile() - @rootView.project.on 'path-change', => @updateRoot() - - @selectEntry(@root) if @root - - afterAttach: (onDom) -> - @focus() if @focusAfterAttach - - serialize: -> - directoryExpansionStates: @root?.serializeEntryExpansionStates() - selectedPath: @selectedEntry()?.getPath() - hasFocus: @is(':focus') - attached: @hasParent() - - deactivate: -> - @root?.unwatchEntries() - - toggle: -> - if @is(':focus') - @detach() - @rootView.focus() - else - @attach() unless @hasParent() - @focus() - - attach: -> - @rootView.horizontal.prepend(this) - - entryClicked: (e) -> - entry = $(e.currentTarget).view() - switch e.originalEvent?.detail ? 1 - when 1 - @selectEntry(entry) - @openSelectedEntry() if (entry instanceof FileView) - when 2 - if entry.is('.selected.file') - @rootView.getActiveEditor().focus() - else if entry.is('.selected.directory') - entry.toggleExpansion() - - false - - updateRoot: -> - @root?.remove() - @root = new DirectoryView(directory: @rootView.project.getRootDirectory(), isExpanded: true) - @append(@root) - - selectActiveFile: -> - activeFilePath = @rootView.getActiveEditor()?.getPath() - @selectEntryForPath(activeFilePath) - - revealActiveFile: -> - @attach() - @focus() - - return unless activeFilePath = @rootView.getActiveEditor()?.getPath() - - project = @rootView.project - activePathComponents = project.relativize(activeFilePath).split('/') - currentPath = project.getPath().replace(/\/$/, '') - for pathComponent in activePathComponents - currentPath += '/' + pathComponent - entry = @entryForPath(currentPath) - if entry.hasClass('directory') - entry.expand() - else - @selectEntry(entry) - - entryForPath: (path) -> - fn = (bestMatchEntry, element) -> - entry = $(element).view() - regex = new RegExp("^" + _.escapeRegExp(entry.getPath())) - if regex.test(path) and entry.getPath().length > bestMatchEntry.getPath().length - entry - else - bestMatchEntry - - @find(".entry").toArray().reduce(fn, @root) - - selectEntryForPath: (path) -> - @selectEntry(@entryForPath(path)) - - moveDown: -> - selectedEntry = @selectedEntry() - if selectedEntry - if selectedEntry.is('.expanded.directory') - return if @selectEntry(selectedEntry.find('.entry:first')) - until @selectEntry(selectedEntry.next()) - selectedEntry = selectedEntry.parents('.entry:first') - break unless selectedEntry.length - else - @selectEntry(@root) - - @scrollToEntry(@selectedEntry()) - - moveUp: -> - selectedEntry = @selectedEntry() - if selectedEntry - if previousEntry = @selectEntry(selectedEntry.prev()) - if previousEntry.is('.expanded.directory') - @selectEntry(previousEntry.find('.entry:last')) - else - @selectEntry(selectedEntry.parents('.directory').first()) - else - @selectEntry(@find('.entry').last()) - - @scrollToEntry(@selectedEntry()) - - expandDirectory: -> - selectedEntry = @selectedEntry() - selectedEntry.view().expand() if (selectedEntry instanceof DirectoryView) - - collapseDirectory: -> - selectedEntry = @selectedEntry() - if directory = selectedEntry.closest('.expanded.directory').view() - directory.collapse() - @selectEntry(directory) - - openSelectedEntry: -> - selectedEntry = @selectedEntry() - if (selectedEntry instanceof DirectoryView) - selectedEntry.view().toggleExpansion() - else if (selectedEntry instanceof FileView) - @rootView.open(selectedEntry.getPath(), changeFocus: false) - - moveSelectedEntry: -> - entry = @selectedEntry() - return unless entry - oldPath = @selectedEntry().getPath() - - dialog = new Dialog - prompt: "Enter the new path for the file:" - path: @rootView.project.relativize(oldPath) - select: true - onConfirm: (newPath) => - newPath = @rootView.project.resolve(newPath) - directoryPath = fs.directory(newPath) - try - fs.makeTree(directoryPath) unless fs.exists(directoryPath) - fs.move(oldPath, newPath) - catch e - dialog.showError("Error: " + e.message + " Try a different path:") - return false - - @rootView.append(dialog) - - removeSelectedEntry: -> - entry = @selectedEntry() - return unless entry - - entryType = if entry instanceof DirectoryView then "directory" else "file" - message = "Are you sure you would like to delete the selected #{entryType}?" - detailedMessage = "You are deleting #{entry.getPath()}" - buttons = [ - ["Move to Trash", => Native.moveToTrash(entry.getPath())] - ["Cancel", => ] # Do Nothing - ["Delete", => fs.remove(entry.getPath())] - ] - - Native.alert message, detailedMessage, buttons - - add: -> - selectedPath = @selectedEntry().getPath() - directoryPath = if fs.isFile(selectedPath) then fs.directory(selectedPath) else selectedPath - relativeDirectoryPath = @rootView.project.relativize(directoryPath) - relativeDirectoryPath += '/' if relativeDirectoryPath.length > 0 - - dialog = new Dialog - prompt: "Enter the path for the new file/directory. Directories end with '/':" - path: relativeDirectoryPath - select: false - onConfirm: (relativePath) => - endsWithDirectorySeperator = /\/$/.test(relativePath) - path = @rootView.project.resolve(relativePath) - try - if fs.exists(path) - pathType = if fs.isFile(path) then "file" else "directory" - dialog.showError("Error: A #{pathType} already exists at path '#{path}'. Try a different path:") - false - else if endsWithDirectorySeperator - fs.makeTree(path) - else - fs.write(path, "") - @rootView.open(path) - catch e - dialog.showError("Error: " + e.message + " Try a different path:") - return false - - @rootView.append(dialog) - - selectedEntry: -> - @find('.selected')?.view() - - selectEntry: (entry) -> - return false unless entry.get(0) - @find('.selected').removeClass('selected') - entry.addClass('selected') - - scrollToEntry: (entry) -> - displayElement = if (entry instanceof DirectoryView) then entry.header else entry - - top = @scrollTop() + displayElement.position().top - bottom = top + displayElement.outerHeight() - - if bottom > @scrollBottom() - @scrollBottom(bottom) - if top < @scrollTop() - @scrollTop(top) diff --git a/src/extensions/vim-mode/commands.coffee b/src/extensions/vim-mode/commands.coffee deleted file mode 100644 index 42a598143..000000000 --- a/src/extensions/vim-mode/commands.coffee +++ /dev/null @@ -1,10 +0,0 @@ -class Command - constructor: (@editor) -> - isComplete: -> true - -class DeleteRight extends Command - execute: -> - @editor.delete() unless @editor.getCurrentBufferLine().length == 0 - -module.exports = { DeleteRight } - diff --git a/src/extensions/vim-mode/index.coffee b/src/extensions/vim-mode/index.coffee deleted file mode 100644 index 7391ddfe3..000000000 --- a/src/extensions/vim-mode/index.coffee +++ /dev/null @@ -1,130 +0,0 @@ -_ = require 'underscore' -$ = require 'jquery' -operators = require 'vim-mode/operators' -commands = require 'vim-mode/commands' -motions = require 'vim-mode/motions' - -module.exports = -class VimMode - editor: null - opStack: null - - constructor: (@editor) -> - requireStylesheet 'vim-mode.css' - - @opStack = [] - @activateCommandMode() - - window.keymap.bindKeys '.editor', 'escape': 'activate-command-mode' - @editor.on 'activate-command-mode', => @activateCommandMode() - - @setupCommandMode() - - setupCommandMode: -> - window.keymap.bindKeys '.command-mode', (e) => - if e.keystroke.match /^\d$/ - return 'command-mode:numeric-prefix' - if e.keystroke.match /^.$/ - @resetCommandMode() - return false - - @bindCommandModeKeys - 'i': 'insert' - 'd': 'delete' - 'x': 'delete-right' - 'h': 'move-left' - 'j': 'move-down' - 'k': 'move-up' - 'l': 'move-right' - 'w': 'move-to-next-word' - 'b': 'move-to-previous-word' - '}': 'move-to-next-paragraph' - 'escape': 'reset-command-mode' - 'left': 'move-left' - 'right': 'move-right' - - @handleCommands - 'insert': => @activateInsertMode() - 'delete': => @delete() - 'delete-right': => new commands.DeleteRight(@editor) - 'move-left': => new motions.MoveLeft(@editor) - 'move-up': => new motions.MoveUp(@editor) - 'move-down': => new motions.MoveDown @editor - 'move-right': => new motions.MoveRight @editor - 'move-to-next-word': => new motions.MoveToNextWord(@editor) - 'move-to-previous-word': => new motions.MoveToPreviousWord(@editor) - 'move-to-next-paragraph': => new motions.MoveToNextParagraph(@editor) - 'numeric-prefix': (e) => @numericPrefix(e) - 'reset-command-mode': => @resetCommandMode() - - bindCommandModeKeys: (bindings) -> - prefixedBindings = {} - for pattern, commandName of bindings - prefixedBindings[pattern] = "command-mode:#{commandName}" - - window.keymap.bindKeys ".command-mode", prefixedBindings - - handleCommands: (commands) -> - _.each commands, (fn, commandName) => - eventName = "command-mode:#{commandName}" - @editor.on eventName, (e) => - possibleOperator = fn(e) - @pushOperator(possibleOperator) if possibleOperator?.execute - - activateInsertMode: -> - @editor.removeClass('command-mode') - @editor.addClass('insert-mode') - - @editor.off 'cursor:position-changed', @moveCursorBeforeNewline - - activateCommandMode: -> - @editor.removeClass('insert-mode') - @editor.addClass('command-mode') - - @editor.on 'cursor:position-changed', @moveCursorBeforeNewline - - resetCommandMode: -> - @opStack = [] - - moveCursorBeforeNewline: => - if not @editor.getSelection().modifyingSelection and @editor.cursor.isOnEOL() and @editor.getCurrentBufferLine().length > 0 - @editor.setCursorBufferColumn(@editor.getCurrentBufferLine().length - 1) - - numericPrefix: (e) -> - num = parseInt(e.keyEvent.keystroke) - if @topOperator() instanceof operators.NumericPrefix - @topOperator().addDigit(num) - else - @pushOperator(new operators.NumericPrefix(num)) - - delete: () -> - if deleteOperation = @isDeletePending() - deleteOperation.complete = true - @processOpStack() - else - @pushOperator(new operators.Delete(@editor)) - - isDeletePending: () -> - for op in @opStack - return op if op instanceof operators.Delete - false - - pushOperator: (op) -> - @opStack.push(op) - @processOpStack() - - processOpStack: -> - return unless @topOperator().isComplete() - - poppedOperator = @opStack.pop() - if @opStack.length - try - @topOperator().compose(poppedOperator) - @processOpStack() - catch e - (e instanceof operators.OperatorError) and @resetCommandMode() or throw e - else - poppedOperator.execute() - - topOperator: -> - _.last @opStack diff --git a/src/extensions/vim-mode/motions.coffee b/src/extensions/vim-mode/motions.coffee deleted file mode 100644 index c8303b3ee..000000000 --- a/src/extensions/vim-mode/motions.coffee +++ /dev/null @@ -1,89 +0,0 @@ -Point = require 'point' -getWordRegex = -> /(\w+)|([^\w\s]+)/g - -class Motion - constructor: (@editor) -> - isComplete: -> true - -class MoveLeft extends Motion - execute: -> - {column, row} = @editor.getCursorScreenPosition() - @editor.moveCursorLeft() if column > 0 - - select: -> - position = @editor.getCursorScreenPosition().copy() - position.column-- if position.column > 0 - @editor.selectToBufferPosition(position) - -class MoveRight extends Motion - execute: -> - {column, row} = @editor.getCursorScreenPosition() - @editor.moveCursorRight() - -class MoveUp extends Motion - execute: -> - {column, row} = @editor.getCursorScreenPosition() - @editor.moveCursorUp() if row > 0 - -class MoveDown extends Motion - execute: -> - {column, row} = @editor.getCursorScreenPosition() - @editor.moveCursorDown() if row < (@editor.getBuffer().getLineCount() - 1) - -class MoveToPreviousWord extends Motion - execute: -> - @editor.getCursor().moveToBeginningOfWord() - - select: -> - @editor.getSelection().selectToBeginningOfWord() - -class MoveToNextWord extends Motion - execute: -> - @editor.setCursorScreenPosition(@nextWordPosition()) - - select: -> - @editor.selectToBufferPosition(@nextWordPosition()) - - nextWordPosition: -> - regex = getWordRegex() - { row, column } = @editor.getCursorScreenPosition() - rightOfCursor = @editor.lineForBufferRow(row).substring(column) - - match = regex.exec(rightOfCursor) - # If we're on top of part of a word, match the next one. - match = regex.exec(rightOfCursor) if match?.index is 0 - - if match - column += match.index - else if row + 1 == @editor.getBuffer().getLineCount() - column = @editor.lineForBufferRow(row).length - else - nextLineMatch = regex.exec(@editor.lineForBufferRow(++row)) - column = nextLineMatch?.index or 0 - { row, column } - -class MoveToNextParagraph extends Motion - execute: -> - @editor.setCursorScreenPosition(@nextPosition()) - - select: -> - @editor.selectToPosition(@nextPosition()) - - nextPosition: -> - regex = /[^\n]\n^$/gm - row = null - column = 0 - - startRow = @editor.getCursorBufferRow() + 1 - for r in [startRow..@editor.getLastBufferRow()] - if @editor.lineForBufferRow(r).length == 0 - row = r - break - - if not row - row = @editor.getLastBufferRow() - column = @editor.getBuffer().getLastLine().length - 1 - - new Point(row, column) - -module.exports = { Motion, MoveLeft, MoveRight, MoveUp, MoveDown, MoveToNextWord, MoveToPreviousWord, MoveToNextParagraph } diff --git a/src/extensions/vim-mode/operators.coffee b/src/extensions/vim-mode/operators.coffee deleted file mode 100644 index a9ea6e8e2..000000000 --- a/src/extensions/vim-mode/operators.coffee +++ /dev/null @@ -1,57 +0,0 @@ -_ = require 'underscore' - -class OperatorError - constructor: (@message) -> - @name = "Operator Error" - -class NumericPrefix - count: null - complete: null - operatorToRepeat: null - - constructor: (@count) -> - @complete = false - - isComplete: -> @complete - - compose: (@operatorToRepeat) -> - @complete = true - if @operatorToRepeat.setCount? - @operatorToRepeat.setCount @count - @count = 1 - - addDigit: (digit) -> - @count = @count * 10 + digit - - execute: -> - _.times @count, => @operatorToRepeat.execute() - - select: -> - _.times @count, => @operatorToRepeat.select() - -class Delete - motion: null - complete: null - - constructor: (@editor) -> - @complete = false - - isComplete: -> @complete - - execute: -> - if @motion - @motion.select() - @editor.getSelection().delete() - else - @editor.getBuffer().deleteRow(@editor.getCursorBufferRow()) - @editor.setCursorScreenPosition([@editor.getCursorScreenRow(), 0]) - - compose: (motion) -> - if not motion.select - throw new OperatorError("Delete must compose with a motion") - - @motion = motion - @complete = true - -module.exports = { NumericPrefix, Delete, OperatorError } - diff --git a/src/single-window-bootstrap.coffee b/src/single-window-bootstrap.coffee deleted file mode 100644 index 1795f2db8..000000000 --- a/src/single-window-bootstrap.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Bootstrap the app in a single window mode -require 'atom-bootstrap.coffee' -require 'window-bootstrap.coffee' \ No newline at end of file diff --git a/src/stdlib/child-process.coffee b/src/stdlib/child-process.coffee deleted file mode 100644 index 9bddda62e..000000000 --- a/src/stdlib/child-process.coffee +++ /dev/null @@ -1,35 +0,0 @@ -# node.js child-process -# http://nodejs.org/docs/v0.6.3/api/child_processes.html - -$ = require 'jquery' -_ = require 'underscore' - -module.exports = -class ChildProccess - @exec: (command, options={}) -> - deferred = $.Deferred() - - if options.bufferLines - options.stdout = @bufferLines(options.stdout) if options.stdout - options.stderr = @bufferLines(options.stderr) if options.stderr - - $native.exec command, options, (exitStatus, stdout, stderr) -> - try - if exitStatus != 0 - deferred.reject({command, exitStatus, stderr}) - else - deferred.resolve(stdout, stderr) - catch e - console.error "In ChildProccess termination callback: ", e.message - console.error e.stack - - deferred - - @bufferLines: (callback) -> - buffered = "" - (data) -> - buffered += data - lastNewlineIndex = buffered.lastIndexOf('\n') - if lastNewlineIndex >= 0 - callback(buffered.substring(0, lastNewlineIndex + 1)) - buffered = buffered.substring(lastNewlineIndex + 1) diff --git a/src/stdlib/event.coffee b/src/stdlib/event.coffee deleted file mode 100644 index adf761d97..000000000 --- a/src/stdlib/event.coffee +++ /dev/null @@ -1,20 +0,0 @@ -_ = require 'underscore' - -module.exports = -class Event - events: {} - - on: (name, callback) -> - @events[name] ?= [] - @events[name].push callback - - off: (name, callback) -> - delete @events[name][_.indexOf callback] if @events[name] - - trigger: (name, data...) -> - if name.match /^app:/ - OSX.NSApp.triggerGlobalAtomEvent_data name, data - return - - _.each @events[name], (callback) => callback data... - null diff --git a/src/stdlib/fs.coffee b/src/stdlib/fs.coffee deleted file mode 100644 index bd0a86293..000000000 --- a/src/stdlib/fs.coffee +++ /dev/null @@ -1,131 +0,0 @@ -# commonjs fs module -# http://ringojs.org/api/v0.8/fs/ - -_ = require 'underscore' -$ = require 'jquery' - -module.exports = - # Make the given path absolute by resolving it against the - # current working directory. - absolute: (path) -> - $native.absolute(path) - - # Return the basename of the given path. That is the path with - # any leading directory components removed. If specified, also - # remove a trailing extension. - base: (path, ext) -> - base = path.replace(/\/$/, '').split("/").pop() - if ext then base.replace(RegExp(ext + "$"), "") else base - - # Returns the path of a file's containing directory, albeit the - # parent directory if the file is a directory. A terminal directory - # separator is ignored. - directory: (path) -> - parentPath = path.replace(new RegExp("/#{@base(path)}\/?$"), '') - return "" if path == parentPath - parentPath - - # Returns true if the file specified by path exists - exists: (path) -> - return false unless path? - $native.exists(path) - - # Returns the extension of a file. The extension of a file is the - # last dot (excluding any number of initial dots) followed by one or - # more non-dot characters. Returns an empty string if no valid - # extension exists. - extension: (path) -> - return '' unless typeof path is 'string' - match = @base(path).match(/\.[^\.]+$/) - if match - match[0] - else - "" - - join: (paths...) -> - return paths[0] if paths.length == 1 - [first, rest...] = paths - first.replace(/\/?$/, "/") + @join(rest...) - - # Returns true if the file specified by path exists and is a - # directory. - isDirectory: (path) -> - $native.isDirectory path - - # Returns true if the file specified by path exists and is a - # regular file. - isFile: (path) -> - return false unless path? - $native.isFile(path) - - # Returns an array with all the names of files contained - # in the directory path. - list: (path) -> - $native.list(path, false) - - listTree: (path) -> - $native.list(path, true) - - move: (source, target) -> - $native.move(source, target) - - # Remove a file at the given path. Throws an error if path is not a - # file or a symbolic link to a file. - remove: (path) -> - $native.remove path - - # Open, read, and close a file, returning the file's contents. - read: (path) -> - $native.read(path) - - # Returns an array of path components. If the path is absolute, the first - # component will be an indicator of the root of the file system; for file - # systems with drives (such as Windows), this is the drive identifier with a - # colon, like "c:"; on Unix, this is an empty string "". The intent is that - # calling "join.apply" with the result of "split" as arguments will - # reconstruct the path. - split: (path) -> - path.split("/") - - # Open, write, flush, and close a file, writing the given content. - write: (path, content) -> - $native.write(path, content) - - makeDirectory: (path) -> - $native.makeDirectory(path) - - # Creates the directory specified by "path" including any missing parent - # directories. - makeTree: (path) -> - return unless path - if not @exists(path) - @makeTree(@directory(path)) - @makeDirectory(path) - - traverseTree: (rootPath, fn) -> - recurse = null - prune = -> recurse = false - - for path in @list(rootPath) - recurse = true - fn(path, prune) - @traverseTree(path, fn) if @isDirectory(path) and recurse - - lastModified: (path) -> - $native.lastModified(path) - - md5ForPath: (path) -> - $native.md5ForPath(path) - - async: - list: (path) -> - deferred = $.Deferred() - $native.asyncList path, false, (subpaths) -> - deferred.resolve subpaths - deferred - - listTree: (path) -> - deferred = $.Deferred() - $native.asyncList path, true, (subpaths) -> - deferred.resolve subpaths - deferred diff --git a/src/stdlib/fuzzy-filter.coffee b/src/stdlib/fuzzy-filter.coffee deleted file mode 100644 index 33bfbd5a5..000000000 --- a/src/stdlib/fuzzy-filter.coffee +++ /dev/null @@ -1,16 +0,0 @@ -stringScore = require 'stringscore' - -module.exports = (candidates, query, options) -> - if query - scoredCandidates = candidates.map (candidate) -> - string = if options.key? then candidate[options.key] else candidate - { candidate, score: stringScore(string, query) } - - scoredCandidates.sort (a, b) -> - if a.score > b.score then -1 - else if a.score < b.score then 1 - else 0 - candidates = (scoredCandidate.candidate for scoredCandidate in scoredCandidates when scoredCandidate.score > 0) - - candidates = candidates[0...options.maxResults] if options.maxResults? - candidates diff --git a/src/stdlib/jquery-extensions.coffee b/src/stdlib/jquery-extensions.coffee deleted file mode 100644 index f8becf602..000000000 --- a/src/stdlib/jquery-extensions.coffee +++ /dev/null @@ -1,32 +0,0 @@ -$ = require 'jquery' - -$.fn.scrollBottom = (newValue) -> - if newValue? - @scrollTop(newValue - @height()) - else - @scrollTop() + @height() - -$.fn.scrollRight = (newValue) -> - if newValue? - @scrollLeft(newValue - @width()) - else - @scrollLeft() + @width() - -$.fn.containsElement = (element) -> - (element[0].compareDocumentPosition(this[0]) & 8) == 8 - -$.fn.preempt = (eventName, handler) -> - @on eventName, (e, args...) -> - if handler(e, args...) == false then e.stopImmediatePropagation() - - eventNameWithoutNamespace = eventName.split('.')[0] - handlers = @data('events')[eventNameWithoutNamespace] - handlers.unshift(handlers.pop()) - -$.fn.hasParent = -> - @parent()[0]? - -$.fn.flashError = -> - @addClass 'error' - removeErrorClass = => @removeClass 'error' - window.setTimeout(removeErrorClass, 200) diff --git a/src/stdlib/native-handler.js b/src/stdlib/native-handler.js deleted file mode 100644 index a9a76c7fb..000000000 --- a/src/stdlib/native-handler.js +++ /dev/null @@ -1,94 +0,0 @@ -var $native = {}; -(function() { - - native function exists(path); - $native.exists = exists; - - native function alert(message, detailedMessage, buttonNamesAndCallbacks); - $native.alert = alert; - - native function read(path); - $native.read = read; - - native function write(path, content); - $native.write = write; - - native function absolute(path); - $native.absolute = absolute; - - native function list(path, recursive); - $native.list = list; - - native function isFile(path); - $native.isFile = isFile; - - native function isDirectory(path); - $native.isDirectory = isDirectory; - - native function remove(path); - $native.remove = remove; - - native function asyncList(path, recursive, callback); - $native.asyncList = asyncList; - - native function open(path); - $native.open = open; - - native function openDialog(); - $native.openDialog = openDialog; - - native function quit(); - $native.quit = quit; - - native function writeToPasteboard(text); - $native.writeToPasteboard = writeToPasteboard; - - native function readFromPasteboard(); - $native.readFromPasteboard = readFromPasteboard; - - native function showDevTools(); - $native.showDevTools = showDevTools; - - native function toggleDevTools(); - $native.toggleDevTools = toggleDevTools; - - native function newWindow(); - $native.newWindow = newWindow; - - native function saveDialog(); - $native.saveDialog = saveDialog; - - native function exit(status); - $native.exit = exit; - - native function watchPath(path); - $native.watchPath = watchPath; - - native function unwatchPath(path, callbackId); - $native.unwatchPath = unwatchPath; - - native function makeDirectory(path); - $native.makeDirectory = makeDirectory; - - native function move(sourcePath, targetPath); - $native.move = move; - - native function moveToTrash(path); - $native.moveToTrash = moveToTrash; - - native function reload(); - $native.reload = reload; - - native function lastModified(path); - $native.lastModified = lastModified; - - native function md5ForPath(path); - $native.md5ForPath = md5ForPath; - - native function exec(command, options, callback); - $native.exec = exec; - - native function getPlatform(); - $native.getPlatform = getPlatform; - -})(); diff --git a/src/stdlib/native.coffee b/src/stdlib/native.coffee deleted file mode 100644 index e468e4026..000000000 --- a/src/stdlib/native.coffee +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = -class Native - @alert: (args...) -> $native.alert(args...) - - @saveDialog: (args...) -> $native.saveDialog(args...) - - @reload: -> $native.reload() - - @moveToTrash: (args...) -> $native.moveToTrash(args...) diff --git a/src/stdlib/onig-reg-exp-extension.js b/src/stdlib/onig-reg-exp-extension.js deleted file mode 100644 index 0fa3d5968..000000000 --- a/src/stdlib/onig-reg-exp-extension.js +++ /dev/null @@ -1,23 +0,0 @@ -(function() { - native function buildOnigRegExp(source); - native function search(string, index); - native function getCaptureIndices(string, index); - native function getCaptureCount(); - native function test(string); - - function OnigRegExp(source) { - var regexp = buildOnigRegExp(source); - regexp.constructor = OnigRegExp; - regexp.__proto__ = OnigRegExp.prototype; - regexp.source = source; - return regexp; - } - - OnigRegExp.prototype.search = search; - OnigRegExp.prototype.test = test; - OnigRegExp.prototype.getCaptureIndices = getCaptureIndices; - OnigRegExp.prototype.getCaptureCount = getCaptureCount; - - this.OnigRegExp = OnigRegExp; -})(); - diff --git a/src/stdlib/path.coffee b/src/stdlib/path.coffee deleted file mode 100644 index 337b60d6b..000000000 --- a/src/stdlib/path.coffee +++ /dev/null @@ -1,15 +0,0 @@ -# node.js path module -# http://nodejs.org/docs/v0.6.0/api/path.html - -_ = require 'underscore' - -module.exports = - # Return the last portion of a path. Similar to the Unix basename command. - basename: (filepath) -> - _.last filepath.split '/' - - # Return the extension of the path, from the last '.' to end of string in - # the last portion of the path. If there is no '.' in the last portion of - # the path or the first character of it is '.', then it returns an empty string. - extname: (filepath) -> - _.last filepath.split '.' diff --git a/src/stdlib/require.coffee b/src/stdlib/require.coffee deleted file mode 100644 index ac60e6d58..000000000 --- a/src/stdlib/require.coffee +++ /dev/null @@ -1,149 +0,0 @@ -paths = [ - "#{atom.loadPath}/spec" - "#{atom.loadPath}/benchmark" - "#{atom.loadPath}/src/stdlib" - "#{atom.loadPath}/src/app" - "#{atom.loadPath}/src/extensions" - "#{atom.loadPath}/src" - "#{atom.loadPath}/vendor" - "#{atom.loadPath}/static" - "#{atom.loadPath}/bundles" - "#{atom.loadPath}/themes" - "#{atom.loadPath}" -] - -window.__filename = null - -nakedLoad = (file) -> - file = resolve file - code = __read file - window.eval(code + "\n//@ sourceURL=" + file) - -require = (path, cb) -> - return cb require path if cb? - - unless file = resolve(path) - throw new Error("Require can't find file at path '#{path}'") - - parts = file.split '.' - ext = parts[parts.length-1] - - if __modules[file]? - if not __modules.loaded[file.toLowerCase()]? - console.warn "Circular require: #{__filename} required #{file}" - return __modules[file] - else if __modules.loaded[file.toLowerCase()] - console.warn "Multiple requires (different cases) for #{file}" - - [ previousFilename, window.__filename ] = [ __filename, file ] - __modules[file] = {} # Fix for circular references - __modules[file] = (exts[ext] or (file) -> __read file) file - window.__filename = previousFilename - __modules[file] - -define = (cb) -> - __defines.push -> - exports = __modules[__filename] or {} - module = exports: exports - cb.call exports, require, exports, module - __modules.loaded[__filename.toLowerCase()] = true - module.exports or exports - -exts = - js: (file, code) -> - code or= __read file - - if not /define\(/.test code - code = """ - define(function(require, exports, module) { 'use strict'; #{code}; - }); - """ - eval(code + "\n//@ sourceURL=" + file) - __defines.pop()?.call() - coffee: (file) -> - exts.js(file, __coffeeCache(file)) - -resolve = (file) -> - if /!/.test file - parts = file.split '!' - file = parts[parts.length-1] - - if file[0..1] is './' - prefix = __filename.split('/')[0..-2].join '/' - file = file.replace './', "#{prefix}/" - - if file[0..2] is '../' - prefix = __filename.split('/')[0..-3].join '/' - file = file.replace '../', "#{prefix}/" - - if file[0] isnt '/' - paths.some (path) -> - fileExists = /\.(.+)$/.test(file) and __exists "#{path}/#{file}" - jsFileExists = not /\.(.+)$/.test(file) and __exists "#{path}/#{file}.js" - - if fileExists - file = "#{path}/#{file}" - if jsFileExists - file = "#{path}/#{file}.js" - else if expanded = __expand "#{path}/#{file}" - file = expanded - else - file = __expand(file) or file - - if file[0] == '/' - file - else - null - -__expand = (path) -> - return path if __isFile path - for ext, handler of exts - if __exists "#{path}.#{ext}" - return "#{path}.#{ext}" - else if __exists "#{path}/index.#{ext}" - return "#{path}/index.#{ext}" - - return path if __exists path - return null - -__exists = (path) -> - $native.exists path - -__isFile = (path) -> - $native.isFile path - -__coffeeCache = (filePath) -> - {CoffeeScript} = require 'coffee-script' - tmpPath = "/tmp/atom-compiled-scripts" - cacheFilePath = [tmpPath, $native.md5ForPath(filePath)].join("/") - - if __exists(cacheFilePath) - __read(cacheFilePath) - else - compiled = CoffeeScript.compile(__read(filePath), filename: filePath) - $native.write(cacheFilePath, compiled) - compiled - -__read = (path) -> - try - $native.read(path) - catch e - console.error "Failed to read `#{path}`" - throw e - -__modules = { loaded : {} } -__defines = [] - -this.require = require -this.nakedLoad = nakedLoad -this.define = define - -this.require.paths = paths -this.require.exts = exts - -this.require.resolve = resolve -this.require.nameToUrl = (path) -> "#{path}.js" -this.require.__modules = __modules - -# issue #17 -this.require.noWorker = true diff --git a/src/stdlib/settings.coffee b/src/stdlib/settings.coffee deleted file mode 100644 index 21961f5ce..000000000 --- a/src/stdlib/settings.coffee +++ /dev/null @@ -1,55 +0,0 @@ -fs = require 'fs' -{CoffeeScript} = require 'coffee-script' - -# Settings file looks like: -# editor: # name of class -# theme: "twilight" -# tabSize: 2 -# softTabs: true -# showInvisibles: false -# -# project: -# ignorePattern: /x|y|z/ -# -# Settings are applied to object x's settings variable by calling applyTo(x) on -# instance of Settings. -module.exports = -class Settings - settings: {} - - load: (path) -> - path = require.resolve path - if not fs.isFile path - console.warn "Could not find settings file '#{path}'" - return - - try - json = CoffeeScript.eval "return " + (fs.read path) - - for className, value of json - @settings[@simplifyClassName className] = value - catch error - console.error "Can't evaluate settings at `#{path}`." - console.error error - - applyTo: (object) -> - if not object.settings - console.warning "#{object.constructor.name}: Does not have `settings` varible" - return - - classHierarchy = [] - - # ICK: Using internal var __super to get the build heirarchy - walker = object - while walker - classHierarchy.unshift @simplifyClassName walker.constructor.name - walker = walker.constructor.__super__ - - for className in classHierarchy - for setting, value of @settings[className] ? {} - object.settings[setting] = value - - # I don't care if you use camelCase, underscores or dashes. It should all - # point to the same place - simplifyClassName: (className) -> - className.toLowerCase().replace /\W/, '' diff --git a/src/stdlib/storage.coffee b/src/stdlib/storage.coffee deleted file mode 100644 index 9a3334b29..000000000 --- a/src/stdlib/storage.coffee +++ /dev/null @@ -1,39 +0,0 @@ -module.exports = -class Storage - storagePath: (require.resolve '~/.atom/.storage') - - get: (key, defaultValue=null) -> - try - value = @storage().valueForKeyPath key - @toJS value or defaultValue - catch error - error.message += "\nGetting #{key}" - console.error(error) - - set: (key, value) -> - keys = key.split '.' - parent = storage = @storage() - for key in keys.slice 0, -1 - parent[key] = {} unless parent[key] - parent = parent[key] - - parent[keys.slice -1] = value - storage.writeToFile_atomically @storagePath, true - - storage: -> - storage = OSX.NSMutableDictionary.dictionaryWithContentsOfFile @storagePath - storage ?= OSX.NSMutableDictionary.dictionary - - toJS: (value) -> - if not value or not value.isKindOfClass - value - else if value.isKindOfClass OSX.NSDictionary.class - dict = {} - dict[k.valueOf()] = @toJS v for k, v of value - dict - else if value.isKindOfClass OSX.NSArray.class - array = [] - array.push @toJS v for v in value - array - else - value.valueOf() diff --git a/src/stdlib/underscore-extensions.coffee b/src/stdlib/underscore-extensions.coffee deleted file mode 100644 index 1fda906ee..000000000 --- a/src/stdlib/underscore-extensions.coffee +++ /dev/null @@ -1,53 +0,0 @@ -_ = require 'underscore' - -_.mixin - remove: (array, element) -> - index = array.indexOf(element) - array.splice(index, 1) if index >= 0 - - sum: (array) -> - sum = 0 - sum += elt for elt in array - sum - - adviseBefore: (object, methodName, advice) -> - original = object[methodName] - object[methodName] = (args...) -> - unless advice.apply(this, args) == false - original.apply(this, args) - - escapeRegExp: (string) -> - # Referring to the table here: - # https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/regexp - # these characters should be escaped - # \ ^ $ * + ? . ( ) | { } [ ] - # These characters only have special meaning inside of brackets - # they do not need to be escaped, but they MAY be escaped - # without any adverse effects (to the best of my knowledge and casual testing) - # : ! , = - # my test "~!@#$%^&*(){}[]`/=?+\|-_;:'\",<.>".match(/[\#]/g) - - specials = [ - # order matters for these - "-" - "[" - "]" - # order doesn't matter for any of these - "/" - "{" - "}" - "(" - ")" - "*" - "+" - "?" - "." - "\\" - "^" - "$" - "|"] - - # I choose to escape every character with '\' - # even though only some strictly require it when inside of [] - regex = RegExp('[' + specials.join('\\') + ']', 'g') - string.replace(regex, "\\$&"); diff --git a/src/stdlib/watcher.coffee b/src/stdlib/watcher.coffee deleted file mode 100644 index 2ea02ff96..000000000 --- a/src/stdlib/watcher.coffee +++ /dev/null @@ -1,50 +0,0 @@ -module.exports = -class Watcher - @watchedPaths: {} - - @setup: -> - if not OSX.__AAWatcher__ - OSX.__AAWatcher__ = OSX.JSCocoa.createClass_parentClass "__AAWatcher__", "NSObject" - OSX.JSCocoa.addInstanceMethod_class_jsFunction_encoding "watcher:receivedNotification:forPath:", OSX.__AAWatcher__, @watcher_receivedNotification_forPath, "v:@@@@" - - @delegate = OSX.__AAWatcher__.alloc.init - @queue = OSX.UKKQueue.alloc.init - @queue.setDelegate @delegate - - @watch: (path, callback) -> - @setup() unless @queue? - - path = OSX.NSString.stringWithString(path).stringByStandardizingPath - @queue.addPath path if not @watchedPaths[path] - - (@watchedPaths[path] ?= []).push callback - - callback # Handy for anonymous functions. - - @unwatch: (path, callback=null) -> - return unless @watchedPaths[path] - - @watchedPaths[path] = (item for item in @watchedPaths[path] when item != callback) - if not callback? or @watchedPaths[path].length == 0 - @watchedPaths[path] = null - console.log "Unwatch #{path}" - @queue.removePathFromQueue path - - # Delegate method for __AAWatcher__ - @watcher_receivedNotification_forPath = (queue, notification, path) => - callbacks = @watchedPaths[path] ? [] - - switch notification.toString() - when "UKKQueueFileRenamedNotification" - throw "Doesn't handle this yet" - when "UKKQueueFileDeletedNotification" - @watchedPaths[path] = null - @queue.removePathFromQueue path - callback notification, path, callback for callback in callbacks - when "UKKQueueFileWrittenToNotification" - callback notification, path, callback for callback in callbacks - when "UKKQueueFileAttributesChangedNotification" - # Just ignore this - console.log "Attribute Changed on #{path}" - else - console.error "I HAVE NO IDEA WHY #{notification} WAS TRIGGERED ON #{path}" diff --git a/src/window-bootstrap.coffee b/src/window-bootstrap.coffee deleted file mode 100644 index cd8207efe..000000000 --- a/src/window-bootstrap.coffee +++ /dev/null @@ -1,4 +0,0 @@ -# Like sands through the hourglass, so are the days of our lives. -require 'window' -window.startup $pathToOpen - diff --git a/static/atom.css b/static/atom.css deleted file mode 100644 index a78cbf383..000000000 --- a/static/atom.css +++ /dev/null @@ -1,73 +0,0 @@ -* { - margin: 0; - padding: 0; -} - -body { - font: 16px Inconsolata, Monaco, Courier !important; -} - -#root-view { - height: 100%; - overflow-y: auto; - position: relative; - background-image: url(static/images/linen.png); -} - -#root-view #horizontal { - display: -webkit-box; - height: 100%; -} - -#root-view #vertical { - -webkit-box-flex: 1; - display: -webkit-box; - -webkit-box-orient: vertical; -} - -#root-view #panes { - -webkit-box-flex: 1; - position: relative; -} - -#root-view #panes .column { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - overflow-y: hidden; -} - -#root-view #panes .row { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - overflow-x: hidden; -} - -#root-view #panes .pane { - position: absolute; - display: -webkit-box; - -webkit-box-orient: vertical; - top: 0; - bottom: 0; - left: 0; - right: 0; - box-sizing: border-box; -} - -#root-view #panes .row > * + * { - border-left: 5px solid #515151; -} - -#root-view #panes .column > * + * { - border-top: 5px solid #515151; -} - -.error { - background: #991212; - -webkit-transition: background 200ms ease-out; -} diff --git a/static/autocomplete.css b/static/autocomplete.css deleted file mode 100644 index 6d247eaf0..000000000 --- a/static/autocomplete.css +++ /dev/null @@ -1,25 +0,0 @@ -.autocomplete { - display: table; - position: absolute; - min-width: 150px; - background-color: #444; - border: 2px solid #222; - color: #eee; - -webkit-box-shadow: 0 0 3px 3px rgba(0, 0, 0, .5); -} - -.autocomplete ol { - position: relative; - overflow-y: scroll; - max-height: 200px; -} - -.autocomplete ol li { - padding: 0.1em 0.2em; -} - -.autocomplete ol li.selected { - background-color: #a3fd97; - color: black; -} - diff --git a/static/command-panel.css b/static/command-panel.css deleted file mode 100644 index 268612031..000000000 --- a/static/command-panel.css +++ /dev/null @@ -1,49 +0,0 @@ -.command-panel { - background: #515151; - padding: 3px; -} - -.command-panel .preview-list { - max-height: 300px; - overflow: auto; - margin-bottom: 3px; - position: relative; - background: #161616; -} - -.command-panel .preview-list { - cursor: default; -} - -.command-panel .preview-list li.selected { - background: #444; -} - -.command-panel .preview-list:focus li.selected { - background: #223555; -} - -.command-panel .preview-list .path { - padding-left: 3px; - color: #f9ee98; - margin-right: 1ex; -} - -.command-panel .preview-list .preview { - color: #f6f3e8; -} - -.command-panel .preview-list .preview .match { - background-color: rgba(255,255,255,.25); - padding: 1px; -} - -.command-panel .prompt-and-editor { - display: -webkit-box; -} - -.command-panel .prompt { - color: white; - font-weight: bold; - padding: .2em; -} diff --git a/static/editor.css b/static/editor.css deleted file mode 100644 index 8ebde68b8..000000000 --- a/static/editor.css +++ /dev/null @@ -1,129 +0,0 @@ -.editor { - height: 100%; - overflow: hidden; - cursor: default; - -webkit-user-select: none; - -webkit-box-flex: 1; - position: relative; - z-index: 0; -} - -.editor.mini { - height: auto; -} - -.editor .flexbox { - display: -webkit-box; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; -} - -.editor .gutter { - height: 100%; - overflow: hidden; - padding-left: 0.4em; - padding-right: 0.8em; - color: rgba(255, 255, 255, .3); - text-align: right; -} - -.editor .gutter .line-numbers { - position: relative; -} - -.editor.mini .gutter { - display: none; -} - -.editor .gutter.drop-shadow { - -webkit-box-shadow: -2px 0px 10px 2px #222; -} - -.editor .vertical-scrollbar { - position: absolute; - right: 0; - top: 0; - bottom: 0; - width: 10px; - overflow-y: auto; -} - -.editor .scroll-view { - overflow-x: auto; - overflow-y: hidden; - -webkit-box-flex: 1; -} - -.editor.mini .scroll-view { - overflow: hidden; -} - -.editor.soft-wrap .scroll-view { - overflow-x: hidden; -} - -.editor .lines { - position: relative; - display: table; - height: 100%; - width: 100%; -} - -.editor .line, .gutter .line-number { - white-space: pre; - margin: 0; - padding: 0; - padding-bottom: .05em; -} - -.editor .line > span { - vertical-align: top; -} - -@-webkit-keyframes blink { - 0% { opacity: 1; } - 60% { opacity: 1; } - 61% { opacity: 0; } - 100% { opacity: 0; } -} - -.editor .cursor { - position: absolute; - border-left: 2px solid; - opacity: 0.65; -} - -.editor.focused .cursor { - opacity: 1; -} - -.editor.focused .cursor.idle { - -webkit-animation: blink 0.8s; - -webkit-animation-iteration-count: infinite; -} - -.editor .hidden-input { - position: fixed; - z-index: -1; - top: 0; - left: 0; - opacity: 0; -} - -.editor .selection { - position: absolute; - background: rgba(255, 255, 255, .15); - pointer-events: none; - z-index: -1; -} - -.editor .fold { - background-color: #444; -} - -.editor .fold.selected { - background-color: #244; -} \ No newline at end of file diff --git a/static/fuzzy-finder.css b/static/fuzzy-finder.css deleted file mode 100644 index a4ed68595..000000000 --- a/static/fuzzy-finder.css +++ /dev/null @@ -1,27 +0,0 @@ -.fuzzy-finder { - position: absolute; - width: 100%; - bottom: 0; - background-color: #444; - box-sizing: border-box; - color: #eee; - -webkit-box-shadow: 0 0 5px 5px #222; - padding: 5px; -} - -.fuzzy-finder ol { - overflow: hidden; - margin-bottom: 5px; -} - -.fuzzy-finder li:hover { - background-color: #555; -} - -.fuzzy-finder ol:empty { - margin-bottom: 0; -} - -.fuzzy-finder li.selected { - background-color: green; -} diff --git a/static/images/belt-small.png b/static/images/belt-small.png deleted file mode 100644 index 3396f0881..000000000 Binary files a/static/images/belt-small.png and /dev/null differ diff --git a/static/images/belt.png b/static/images/belt.png deleted file mode 100644 index 0ee9690e4..000000000 Binary files a/static/images/belt.png and /dev/null differ diff --git a/static/images/linen.png b/static/images/linen.png deleted file mode 100644 index 2288044ac..000000000 Binary files a/static/images/linen.png and /dev/null differ diff --git a/static/jasmine.css b/static/jasmine.css deleted file mode 100644 index 72301db23..000000000 --- a/static/jasmine.css +++ /dev/null @@ -1,167 +0,0 @@ -.jasmine_reporter { - font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; - font-size: 16px; -} - - -.jasmine_reporter a:visited, .jasmine_reporter a { - color: #303; -} - -.jasmine_reporter a:hover, .jasmine_reporter a:active { - color: blue; -} - -.run_spec { - float:right; - padding-right: 5px; - font-size: .8em; - text-decoration: none; -} - -.jasmine_reporter { - margin: 0 5px; -} - -.banner { - color: #303; - background-color: #fef; - padding: 5px; -} - -.logo { - float: left; - font-size: 1.1em; - padding-left: 5px; -} - -.logo .version { - font-size: .6em; - padding-left: 1em; -} - -.runner.running { - background-color: yellow; -} - - -.options { - text-align: right; - font-size: .8em; -} - - - - -.suite { - border: 1px outset gray; - margin: 5px 0; - padding-left: 1em; -} - -.suite .suite { - margin: 5px; -} - -.suite.passed { - background-color: #dfd; -} - -.suite.failed { - background-color: #fdd; -} - -.spec { - margin: 5px; - padding-left: 1em; - clear: both; -} - -.spec.failed, .spec.passed, .spec.skipped { - padding-bottom: 5px; - border: 1px solid gray; -} - -.spec.failed { - background-color: #fbb; - border-color: red; -} - -.spec.passed { - background-color: #bfb; - border-color: green; -} - -.spec.skipped { - background-color: #bbb; -} - -.messages { - border-left: 1px dashed gray; - padding-left: 1em; - padding-right: 1em; -} - -.passed { - background-color: #cfc; - display: none; -} - -.failed { - background-color: #fbb; -} - -.skipped { - color: #777; - background-color: #eee; - display: none; -} - - -/*.resultMessage {*/ - /*white-space: pre;*/ -/*}*/ - -.resultMessage span.result { - display: block; - line-height: 2em; - color: black; -} - -.resultMessage .mismatch { - color: black; -} - -.stackTrace { - white-space: pre; - font-size: .8em; - margin-left: 10px; - max-height: 5em; - overflow: auto; - border: 1px inset red; - padding: 1em; - background: #eef; -} - -.finished-at { - padding-left: 1em; - font-size: .6em; -} - -.show-passed .passed, -.show-skipped .skipped { - display: block; -} - - -#jasmine_content { - position:fixed; - right: 100%; -} - -.runner { - border: 1px solid gray; - display: block; - margin: 5px 0; - padding: 2px 0 2px 10px; -} diff --git a/static/keybinding-view.css b/static/keybinding-view.css deleted file mode 100644 index 9e3312e02..000000000 --- a/static/keybinding-view.css +++ /dev/null @@ -1,18 +0,0 @@ -.keybindings-view { - position: absolute; - width: 100%; - height: 100%; - top: 0px; - left: 0px; - background-color: white; - overflow: scroll; - opacity: 0.9; -} - -.keybindings-view li .keystroke { - font-weight: bold; - float: left; - text-align: right; - padding-right: 10px; - width: 200px; -} diff --git a/static/linux.css b/static/linux.css deleted file mode 100644 index 183353821..000000000 --- a/static/linux.css +++ /dev/null @@ -1,13 +0,0 @@ -::-webkit-scrollbar-corner { - background-color: transparent; -} - -::-webkit-scrollbar { - width: 8px; - height: 8px; -} - -::-webkit-scrollbar-thumb { - -webkit-border-radius: 2px; - background: rgba(150, 150, 150, .33); -} diff --git a/static/reset.css b/static/reset.css deleted file mode 100755 index 2daea0c94..000000000 --- a/static/reset.css +++ /dev/null @@ -1,69 +0,0 @@ -/* -------------------------------------------------------------- - - reset.css - * Resets default browser CSS. - --------------------------------------------------------------- */ - -html { - margin:0; - padding:0; - border:0; -} - -body, div, span, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, code, -del, dfn, em, img, q, dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td, -article, aside, dialog, figure, footer, header, -hgroup, nav, section { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; -} - -li { - list-style-type: none; -} - -/* This helps to make newer HTML5 elements behave like DIVs in older browers */ -article, aside, details, figcaption, figure, dialog, -footer, header, hgroup, menu, nav, section { - display:block; -} - -/* Line-height should always be unitless! */ -body { - line-height: 1.5; - background: white; -} - -/* Tables still need 'cellspacing="0"' in the markup. */ -table { - border-collapse: separate; - border-spacing: 0; -} -/* float:none prevents the span-x classes from breaking table-cell display */ -caption, th, td { - text-align: left; - font-weight: normal; - float:none !important; -} -table, th, td { - vertical-align: middle; -} - -/* Remove possible quote marks (") from ,
    . */ -blockquote:before, blockquote:after, q:before, q:after { content: ''; } -blockquote, q { quotes: "" ""; } - -/* Remove annoying border on linked images. */ -a img { border: none; } - -/* Remember to define your own focus styles! */ -:focus { outline: 0; } diff --git a/static/status-bar.css b/static/status-bar.css deleted file mode 100644 index cbe86bb1f..000000000 --- a/static/status-bar.css +++ /dev/null @@ -1,12 +0,0 @@ -.status-bar { - background: black; - color: white; - padding: 5px; - position: relative; -} - -.status-bar .cursor-position { - position: absolute; - right: 5px; - top: 5px; -} diff --git a/static/tree-view.css b/static/tree-view.css deleted file mode 100644 index 2abec56a8..000000000 --- a/static/tree-view.css +++ /dev/null @@ -1,46 +0,0 @@ -.tree-view { - position: relative; - height: 100%; - background: black; - color: white; - overflow: auto; - padding: 0 1em; - cursor: default; - -webkit-user-select: none; -} - -.tree-view .disclosure-arrow { - width: 2ex; - display: inline-block; -} - -.tree-view .directory .entries { - padding-left: 1ex; -} - -.file, .directory > .header { - padding: 0 1ex; -} - -.tree-view .directory .entries .file { - padding-left: 3ex; -} - -.tree-view .file.selected, .tree-view .directory.selected > .header { - background: #444; -} - -.tree-view:focus .file.selected, .tree-view:focus .directory.selected > .header { - background: #a3fd97; - color: black; -} - -.tree-view-dialog { - position: absolute; - bottom: 0; - width: 100%; - background-color: #333; - color: white; - border: 2px solid #222; - -webkit-box-shadow: 0 0 3px 3px rgba(0, 0, 0, .5); -} diff --git a/static/vim-mode.css b/static/vim-mode.css deleted file mode 100644 index 49c73f580..000000000 --- a/static/vim-mode.css +++ /dev/null @@ -1,4 +0,0 @@ -.editor.command-mode .cursor { - border-left: 0; - background-color: #9dff9d; -} diff --git a/tests/cefclient/binding_test.cpp b/tests/cefclient/binding_test.cpp new file mode 100644 index 000000000..e3efa23f2 --- /dev/null +++ b/tests/cefclient/binding_test.cpp @@ -0,0 +1,104 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/binding_test.h" + +#include +#include + +#include "include/wrapper/cef_stream_resource_handler.h" +#include "cefclient/resource_util.h" + +namespace binding_test { + +namespace { + +const char* kTestUrl = "http://tests/binding"; +const char* kMessageName = "binding_test"; + +// Handle messages in the browser process. +class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate { + public: + ProcessMessageDelegate() { + } + + // From ClientHandler::ProcessMessageDelegate. + virtual bool OnProcessMessageReceived( + CefRefPtr handler, + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) OVERRIDE { + std::string message_name = message->GetName(); + if (message_name == kMessageName) { + // Handle the message. + std::string result; + + CefRefPtr args = message->GetArgumentList(); + if (args->GetSize() > 0 && args->GetType(0) == VTYPE_STRING) { + // Our result is a reverse of the original message. + result = args->GetString(0); + std::reverse(result.begin(), result.end()); + } else { + result = "Invalid request"; + } + + // Send the result back to the render process. + CefRefPtr response = + CefProcessMessage::Create(kMessageName); + response->GetArgumentList()->SetString(0, result); + browser->SendProcessMessage(PID_RENDERER, response); + + return true; + } + + return false; + } + + IMPLEMENT_REFCOUNTING(ProcessMessageDelegate); +}; + +// Handle resource loading in the browser process. +class RequestDelegate: public ClientHandler::RequestDelegate { + public: + RequestDelegate() { + } + + // From ClientHandler::RequestDelegate. + virtual CefRefPtr GetResourceHandler( + CefRefPtr handler, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request) OVERRIDE { + std::string url = request->GetURL(); + if (url == kTestUrl) { + // Show the binding contents + CefRefPtr stream = + GetBinaryResourceReader("binding.html"); + ASSERT(stream.get()); + return new CefStreamResourceHandler("text/html", stream); + } + + return NULL; + } + + IMPLEMENT_REFCOUNTING(RequestDelegate); +}; + +} // namespace + +void CreateProcessMessageDelegates( + ClientHandler::ProcessMessageDelegateSet& delegates) { + delegates.insert(new ProcessMessageDelegate); +} + +void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates) { + delegates.insert(new RequestDelegate); +} + +void RunTest(CefRefPtr browser) { + // Load the test URL. + browser->GetMainFrame()->LoadURL(kTestUrl); +} + +} // namespace binding_test diff --git a/tests/cefclient/binding_test.h b/tests/cefclient/binding_test.h new file mode 100644 index 000000000..3412fa2a1 --- /dev/null +++ b/tests/cefclient/binding_test.h @@ -0,0 +1,24 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_BINDING_TEST_H_ +#define CEF_TESTS_CEFCLIENT_BINDING_TEST_H_ +#pragma once + +#include "cefclient/client_app.h" +#include "cefclient/client_handler.h" + +namespace binding_test { + +// Delegate creation. Called from ClientApp and ClientHandler. +void CreateProcessMessageDelegates( + ClientHandler::ProcessMessageDelegateSet& delegates); +void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates); + +// Run the test. +void RunTest(CefRefPtr browser); + +} // namespace binding_test + +#endif // CEF_TESTS_CEFCLIENT_BINDING_TEST_H_ diff --git a/tests/cefclient/cefclient.cpp b/tests/cefclient/cefclient.cpp new file mode 100644 index 000000000..caa0683f5 --- /dev/null +++ b/tests/cefclient/cefclient.cpp @@ -0,0 +1,336 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/cefclient.h" +#include +#include +#include +#include +#include "include/cef_app.h" +#include "include/cef_browser.h" +#include "include/cef_command_line.h" +#include "include/cef_frame.h" +#include "include/cef_runnable.h" +#include "include/cef_web_plugin.h" +#include "cefclient/client_handler.h" +#include "cefclient/client_switches.h" +#include "cefclient/string_util.h" +#include "cefclient/util.h" + +namespace { + +// Return the int representation of the specified string. +int GetIntValue(const CefString& str) { + if (str.empty()) + return 0; + + std::string stdStr = str; + return atoi(stdStr.c_str()); +} + +} // namespace + +CefRefPtr g_handler; +CefRefPtr g_command_line; + +CefRefPtr AppGetBrowser() { + if (!g_handler.get()) + return NULL; + return g_handler->GetBrowser(); +} + +CefWindowHandle AppGetMainHwnd() { + if (!g_handler.get()) + return NULL; + return g_handler->GetMainHwnd(); +} + +void AppInitCommandLine(int argc, const char* const* argv) { + g_command_line = CefCommandLine::CreateCommandLine(); +#if defined(OS_WIN) + g_command_line->InitFromString(::GetCommandLineW()); +#else + g_command_line->InitFromArgv(argc, argv); +#endif +} + +// Returns the application command line object. +CefRefPtr AppGetCommandLine() { + return g_command_line; +} + +// Returns the application settings based on command line arguments. +void AppGetSettings(CefSettings& settings, CefRefPtr app) { + ASSERT(app.get()); + ASSERT(g_command_line.get()); + if (!g_command_line.get()) + return; + + CefString str; + +#if defined(OS_WIN) + settings.multi_threaded_message_loop = + g_command_line->HasSwitch(cefclient::kMultiThreadedMessageLoop); +#endif + + CefString(&settings.cache_path) = + g_command_line->GetSwitchValue(cefclient::kCachePath); + + // Retrieve command-line proxy configuration, if any. + bool has_proxy = false; + cef_proxy_type_t proxy_type = PROXY_TYPE_DIRECT; + CefString proxy_config; + + if (g_command_line->HasSwitch(cefclient::kProxyType)) { + std::string str = g_command_line->GetSwitchValue(cefclient::kProxyType); + if (str == cefclient::kProxyType_Direct) { + has_proxy = true; + proxy_type = PROXY_TYPE_DIRECT; + } else if (str == cefclient::kProxyType_Named || + str == cefclient::kProxyType_Pac) { + proxy_config = g_command_line->GetSwitchValue(cefclient::kProxyConfig); + if (!proxy_config.empty()) { + has_proxy = true; + proxy_type = (str == cefclient::kProxyType_Named? + PROXY_TYPE_NAMED:PROXY_TYPE_PAC_STRING); + } + } + } + + if (has_proxy) { + // Provide a ClientApp instance to handle proxy resolution. + app->SetProxyConfig(proxy_type, proxy_config); + } +} + +// Returns the application browser settings based on command line arguments. +void AppGetBrowserSettings(CefBrowserSettings& settings) { + ASSERT(g_command_line.get()); + if (!g_command_line.get()) + return; + + settings.remote_fonts_disabled = + g_command_line->HasSwitch(cefclient::kRemoteFontsDisabled); + + CefString(&settings.default_encoding) = + g_command_line->GetSwitchValue(cefclient::kDefaultEncoding); + + settings.encoding_detector_enabled = + g_command_line->HasSwitch(cefclient::kEncodingDetectorEnabled); + settings.javascript_disabled = + g_command_line->HasSwitch(cefclient::kJavascriptDisabled); + settings.javascript_open_windows_disallowed = + g_command_line->HasSwitch(cefclient::kJavascriptOpenWindowsDisallowed); + settings.javascript_close_windows_disallowed = + g_command_line->HasSwitch(cefclient::kJavascriptCloseWindowsDisallowed); + settings.javascript_access_clipboard_disallowed = + g_command_line->HasSwitch( + cefclient::kJavascriptAccessClipboardDisallowed); + settings.dom_paste_disabled = + g_command_line->HasSwitch(cefclient::kDomPasteDisabled); + settings.caret_browsing_enabled = + g_command_line->HasSwitch(cefclient::kCaretBrowsingDisabled); + settings.java_disabled = + g_command_line->HasSwitch(cefclient::kJavaDisabled); + settings.plugins_disabled = + g_command_line->HasSwitch(cefclient::kPluginsDisabled); + settings.universal_access_from_file_urls_allowed = + g_command_line->HasSwitch(cefclient::kUniversalAccessFromFileUrlsAllowed); + settings.file_access_from_file_urls_allowed = + g_command_line->HasSwitch(cefclient::kFileAccessFromFileUrlsAllowed); + settings.web_security_disabled = + g_command_line->HasSwitch(cefclient::kWebSecurityDisabled); + settings.xss_auditor_enabled = + g_command_line->HasSwitch(cefclient::kXssAuditorEnabled); + settings.image_load_disabled = + g_command_line->HasSwitch(cefclient::kImageLoadingDisabled); + settings.shrink_standalone_images_to_fit = + g_command_line->HasSwitch(cefclient::kShrinkStandaloneImagesToFit); + settings.site_specific_quirks_disabled = + g_command_line->HasSwitch(cefclient::kSiteSpecificQuirksDisabled); + settings.text_area_resize_disabled = + g_command_line->HasSwitch(cefclient::kTextAreaResizeDisabled); + settings.page_cache_disabled = + g_command_line->HasSwitch(cefclient::kPageCacheDisabled); + settings.tab_to_links_disabled = + g_command_line->HasSwitch(cefclient::kTabToLinksDisabled); + settings.hyperlink_auditing_disabled = + g_command_line->HasSwitch(cefclient::kHyperlinkAuditingDisabled); + settings.user_style_sheet_enabled = + g_command_line->HasSwitch(cefclient::kUserStyleSheetEnabled); + + CefString(&settings.user_style_sheet_location) = + g_command_line->GetSwitchValue(cefclient::kUserStyleSheetLocation); + + settings.author_and_user_styles_disabled = + g_command_line->HasSwitch(cefclient::kAuthorAndUserStylesDisabled); + settings.local_storage_disabled = + g_command_line->HasSwitch(cefclient::kLocalStorageDisabled); + settings.databases_disabled = + g_command_line->HasSwitch(cefclient::kDatabasesDisabled); + settings.application_cache_disabled = + g_command_line->HasSwitch(cefclient::kApplicationCacheDisabled); + settings.webgl_disabled = + g_command_line->HasSwitch(cefclient::kWebglDisabled); + settings.accelerated_compositing_disabled = + g_command_line->HasSwitch(cefclient::kAcceleratedCompositingDisabled); + settings.accelerated_layers_disabled = + g_command_line->HasSwitch(cefclient::kAcceleratedLayersDisabled); + settings.accelerated_video_disabled = + g_command_line->HasSwitch(cefclient::kAcceleratedVideoDisabled); + settings.accelerated_2d_canvas_disabled = + g_command_line->HasSwitch(cefclient::kAcceledated2dCanvasDisabled); + settings.accelerated_painting_enabled = + g_command_line->HasSwitch(cefclient::kAcceleratedPaintingEnabled); + settings.accelerated_filters_enabled = + g_command_line->HasSwitch(cefclient::kAcceleratedFiltersEnabled); + settings.accelerated_plugins_disabled = + g_command_line->HasSwitch(cefclient::kAcceleratedPluginsDisabled); + settings.developer_tools_disabled = + g_command_line->HasSwitch(cefclient::kDeveloperToolsDisabled); + settings.fullscreen_enabled = + g_command_line->HasSwitch(cefclient::kFullscreenEnabled); +} + +void RunGetSourceTest(CefRefPtr browser) { + class Visitor : public CefStringVisitor { + public: + explicit Visitor(CefRefPtr browser) : browser_(browser) {} + virtual void Visit(const CefString& string) OVERRIDE { + std::string source = StringReplace(string, "<", "<"); + source = StringReplace(source, ">", ">"); + std::stringstream ss; + ss << "Source:
    " << source << "
    "; + browser_->GetMainFrame()->LoadString(ss.str(), "http://tests/getsource"); + } + private: + CefRefPtr browser_; + IMPLEMENT_REFCOUNTING(Visitor); + }; + + browser->GetMainFrame()->GetSource(new Visitor(browser)); +} + +void RunGetTextTest(CefRefPtr browser) { + class Visitor : public CefStringVisitor { + public: + explicit Visitor(CefRefPtr browser) : browser_(browser) {} + virtual void Visit(const CefString& string) OVERRIDE { + std::string text = StringReplace(string, "<", "<"); + text = StringReplace(text, ">", ">"); + std::stringstream ss; + ss << "Text:
    " << text << "
    "; + browser_->GetMainFrame()->LoadString(ss.str(), "http://tests/gettext"); + } + private: + CefRefPtr browser_; + IMPLEMENT_REFCOUNTING(Visitor); + }; + + browser->GetMainFrame()->GetText(new Visitor(browser)); +} + +void RunRequestTest(CefRefPtr browser) { + // Create a new request + CefRefPtr request(CefRequest::Create()); + + // Set the request URL + request->SetURL("http://tests/request"); + + // Add post data to the request. The correct method and content- + // type headers will be set by CEF. + CefRefPtr postDataElement(CefPostDataElement::Create()); + std::string data = "arg1=val1&arg2=val2"; + postDataElement->SetToBytes(data.length(), data.c_str()); + CefRefPtr postData(CefPostData::Create()); + postData->AddElement(postDataElement); + request->SetPostData(postData); + + // Add a custom header + CefRequest::HeaderMap headerMap; + headerMap.insert( + std::make_pair("X-My-Header", "My Header Value")); + request->SetHeaderMap(headerMap); + + // Load the request + browser->GetMainFrame()->LoadRequest(request); +} + +void RunPopupTest(CefRefPtr browser) { + browser->GetMainFrame()->ExecuteJavaScript( + "window.open('http://www.google.com');", "about:blank", 0); +} + +void RunDialogTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL("http://tests/dialogs"); +} + +void RunPluginInfoTest(CefRefPtr browser) { + class Visitor : public CefWebPluginInfoVisitor { + public: + explicit Visitor(CefRefPtr browser) + : browser_(browser) { + html_ = "Plugin Info Test" + "\nInstalled plugins:"; + } + ~Visitor() { + html_ += "\n"; + + // Load the html in the browser. + browser_->GetMainFrame()->LoadString(html_, "http://tests/plugin_info"); + } + + virtual bool Visit(CefRefPtr info, int count, int total) + OVERRIDE { + html_ += "\n

    Name: " + info->GetName().ToString() + + "\n
    Description: " + info->GetDescription().ToString() + + "\n
    Version: " + info->GetVersion().ToString() + + "\n
    Path: " + info->GetPath().ToString(); + return true; + } + + private: + std::string html_; + CefRefPtr browser_; + IMPLEMENT_REFCOUNTING(Visitor); + }; + + CefVisitWebPluginInfo(new Visitor(browser)); +} + +void RunLocalStorageTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL("http://tests/localstorage"); +} + +void RunAccelerated2DCanvasTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL( + "http://mudcu.be/labs/JS1k/BreathingGalaxies.html"); +} + +void RunAcceleratedLayersTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL( + "http://webkit.org/blog-files/3d-transforms/poster-circle.html"); +} + +void RunWebGLTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL( + "http://webglsamples.googlecode.com/hg/field/field.html"); +} + +void RunHTML5VideoTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL( + "http://www.youtube.com/watch?v=siOHh0uzcuY&html5=True"); +} + +void RunXMLHTTPRequestTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL("http://tests/xmlhttprequest"); +} + +void RunDragDropTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL("http://html5demos.com/drag"); +} + +void RunGeolocationTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL("http://html5demos.com/geo"); +} diff --git a/tests/cefclient/cefclient.h b/tests/cefclient/cefclient.h new file mode 100644 index 000000000..cd01401f2 --- /dev/null +++ b/tests/cefclient/cefclient.h @@ -0,0 +1,58 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_H_ +#define CEF_TESTS_CEFCLIENT_CEFCLIENT_H_ +#pragma once + +#include +#include "include/cef_base.h" +#include "cefclient/client_app.h" + +class CefApp; +class CefBrowser; +class CefCommandLine; + +// Returns the main browser window instance. +CefRefPtr AppGetBrowser(); + +// Returns the main application window handle. +CefWindowHandle AppGetMainHwnd(); + +// Returns the application working directory. +std::string AppGetWorkingDirectory(); + +// Initialize the application command line. +void AppInitCommandLine(int argc, const char* const* argv); + +// Returns the application command line object. +CefRefPtr AppGetCommandLine(); + +// Returns the application settings based on command line arguments. +void AppGetSettings(CefSettings& settings, CefRefPtr app); + +// Returns the application browser settings based on command line arguments. +void AppGetBrowserSettings(CefBrowserSettings& settings); + +// Implementations for various tests. +void RunGetSourceTest(CefRefPtr browser); +void RunGetTextTest(CefRefPtr browser); +void RunRequestTest(CefRefPtr browser); +void RunPopupTest(CefRefPtr browser); +void RunDialogTest(CefRefPtr browser); +void RunPluginInfoTest(CefRefPtr browser); +void RunLocalStorageTest(CefRefPtr browser); +void RunAccelerated2DCanvasTest(CefRefPtr browser); +void RunAcceleratedLayersTest(CefRefPtr browser); +void RunWebGLTest(CefRefPtr browser); +void RunHTML5VideoTest(CefRefPtr browser); +void RunXMLHTTPRequestTest(CefRefPtr browser); +void RunDragDropTest(CefRefPtr browser); +void RunGeolocationTest(CefRefPtr browser); + +#if defined(OS_WIN) +void RunTransparentPopupTest(CefRefPtr browser); +#endif + +#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_H_ diff --git a/tests/cefclient/cefclient.rc b/tests/cefclient/cefclient.rc new file mode 100644 index 000000000..c56c72659 --- /dev/null +++ b/tests/cefclient/cefclient.rc @@ -0,0 +1,172 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Binary +// + +IDS_BINDING BINARY "res\\binding.html" +IDS_DIALOGS BINARY "res\\dialogs.html" +IDS_LOGO BINARY "res\\logo.png" +IDS_LOGOBALL BINARY "res\\logoball.png" +IDS_LOCALSTORAGE BINARY "res\\localstorage.html" +IDS_XMLHTTPREQUEST BINARY "res\\xmlhttprequest.html" +IDS_DOMACCESS BINARY "res\\domaccess.html" + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_CEFCLIENT ICON "res\cefclient.ico" +IDI_SMALL ICON "res\small.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_CEFCLIENT MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END + POPUP "&Help" + BEGIN + MENUITEM "&About ...", IDM_ABOUT + END + POPUP "Tests" + BEGIN + MENUITEM "Get Source", ID_TESTS_GETSOURCE + MENUITEM "Get Text", ID_TESTS_GETTEXT + MENUITEM "Popup Window", ID_TESTS_POPUP + MENUITEM "Request", ID_TESTS_REQUEST + MENUITEM "Scheme Handler", ID_TESTS_SCHEME_HANDLER + MENUITEM "JavaScript Binding", ID_TESTS_BINDING + MENUITEM "JavaScript Dialogs", ID_TESTS_DIALOGS + MENUITEM "Plugin Info", ID_TESTS_PLUGIN_INFO + MENUITEM "DOM Access", ID_TESTS_DOM_ACCESS + MENUITEM "Local Storage", ID_TESTS_LOCALSTORAGE + MENUITEM "XMLHttpRequest", ID_TESTS_XMLHTTPREQUEST + MENUITEM "Accelerated 2D Canvas", ID_TESTS_ACCELERATED2DCANVAS + MENUITEM "Accelerated Layers", ID_TESTS_ACCELERATEDLAYERS + MENUITEM "WebGL", ID_TESTS_WEBGL + MENUITEM "HTML5 Video", ID_TESTS_HTML5VIDEO + MENUITEM "Drag && Drop", ID_TESTS_DRAGDROP + MENUITEM "Geolocation", ID_TESTS_GEOLOCATION + MENUITEM "Zoom In", ID_TESTS_ZOOM_IN + MENUITEM "Zoom Out", ID_TESTS_ZOOM_OUT + MENUITEM "Zoom Reset", ID_TESTS_ZOOM_RESET + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_CEFCLIENT ACCELERATORS +BEGIN + "?", IDM_ABOUT, ASCII, ALT + "/", IDM_ABOUT, ASCII, ALT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG 22, 17, 230, 75 +STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "System" +BEGIN + ICON IDI_CEFCLIENT,IDC_MYICON,14,9,16,16 + LTEXT "cefclient Version 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX + LTEXT "Copyright (C) 2008",IDC_STATIC,49,20,119,8 + DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_APP_TITLE "cefclient" + IDC_CEFCLIENT "CEFCLIENT" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/tests/cefclient/cefclient_gtk.cpp b/tests/cefclient/cefclient_gtk.cpp new file mode 100644 index 000000000..118862711 --- /dev/null +++ b/tests/cefclient/cefclient_gtk.cpp @@ -0,0 +1,408 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include +#include +#include +#include +#include "cefclient/cefclient.h" +#include "include/cef_app.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "include/cef_runnable.h" +#include "cefclient/binding_test.h" +#include "cefclient/client_handler.h" +#include "cefclient/dom_test.h" +#include "cefclient/scheme_test.h" +#include "cefclient/string_util.h" + +char szWorkingDir[512]; // The current working directory + +// The global ClientHandler reference. +extern CefRefPtr g_handler; + +void destroy(void) { + CefQuitMessageLoop(); +} + +void TerminationSignalHandler(int signatl) { + destroy(); +} + +// Callback for Debug > Get Source... menu item. +gboolean GetSourceActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunGetSourceTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Get Source... menu item. +gboolean GetTextActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunGetTextTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Request... menu item. +gboolean RequestActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunRequestTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Local Storage... menu item. +gboolean LocalStorageActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunLocalStorageTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > XMLHttpRequest... menu item. +gboolean XMLHttpRequestActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunXMLHTTPRequestTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Scheme Handler... menu item. +gboolean SchemeHandlerActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + scheme_test::RunTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > JavaScript Binding... menu item. +gboolean BindingActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + binding_test::RunTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Plugin Info... menu item. +gboolean PluginInfoActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunPluginInfoTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > DOM Access... menu item. +gboolean DOMAccessActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + dom_test::RunTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Popup Window... menu item. +gboolean PopupWindowActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunPopupTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Accelerated 2D Canvas... menu item. +gboolean Accelerated2DCanvasActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunAccelerated2DCanvasTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Accelerated Layers... menu item. +gboolean AcceleratedLayersActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunAcceleratedLayersTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > WebGL... menu item. +gboolean WebGLActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunWebGLTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > HTML5 Video... menu item. +gboolean HTML5VideoActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunHTML5VideoTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > HTML5 Drag & Drop... menu item. +gboolean HTML5DragDropActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) + RunDragDropTest(g_handler->GetBrowser()); + + return FALSE; // Don't stop this message. +} + + +// Callback for Debug > Zoom In... menu item. +gboolean ZoomInActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) { + CefRefPtr browser = g_handler->GetBrowser(); + browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() + 0.5); + } + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Zoom Out... menu item. +gboolean ZoomOutActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) { + CefRefPtr browser = g_handler->GetBrowser(); + browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() - 0.5); + } + + return FALSE; // Don't stop this message. +} + +// Callback for Debug > Zoom Reset... menu item. +gboolean ZoomResetActivated(GtkWidget* widget) { + if (g_handler.get() && g_handler->GetBrowserId()) { + CefRefPtr browser = g_handler->GetBrowser(); + browser->GetHost()->SetZoomLevel(0.0); + } + + return FALSE; // Don't stop this message. +} + +// Callback for when you click the back button. +void BackButtonClicked(GtkButton* button) { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->GoBack(); +} + +// Callback for when you click the forward button. +void ForwardButtonClicked(GtkButton* button) { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->GoForward(); +} + +// Callback for when you click the stop button. +void StopButtonClicked(GtkButton* button) { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->StopLoad(); +} + +// Callback for when you click the reload button. +void ReloadButtonClicked(GtkButton* button) { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->Reload(); +} + +// Callback for when you press enter in the URL box. +void URLEntryActivate(GtkEntry* entry) { + if (!g_handler.get() || !g_handler->GetBrowserId()) + return; + + const gchar* url = gtk_entry_get_text(entry); + g_handler->GetBrowser()->GetMainFrame()->LoadURL(std::string(url).c_str()); +} + +// GTK utility functions ---------------------------------------------- + +GtkWidget* AddMenuEntry(GtkWidget* menu_widget, const char* text, + GCallback callback) { + GtkWidget* entry = gtk_menu_item_new_with_label(text); + g_signal_connect(entry, "activate", callback, NULL); + gtk_menu_shell_append(GTK_MENU_SHELL(menu_widget), entry); + return entry; +} + +GtkWidget* CreateMenu(GtkWidget* menu_bar, const char* text) { + GtkWidget* menu_widget = gtk_menu_new(); + GtkWidget* menu_header = gtk_menu_item_new_with_label(text); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_header), menu_widget); + gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), menu_header); + return menu_widget; +} + +GtkWidget* CreateMenuBar() { + GtkWidget* menu_bar = gtk_menu_bar_new(); + GtkWidget* debug_menu = CreateMenu(menu_bar, "Tests"); + + AddMenuEntry(debug_menu, "Get Source", + G_CALLBACK(GetSourceActivated)); + AddMenuEntry(debug_menu, "Get Text", + G_CALLBACK(GetTextActivated)); + AddMenuEntry(debug_menu, "Request", + G_CALLBACK(RequestActivated)); + AddMenuEntry(debug_menu, "Local Storage", + G_CALLBACK(LocalStorageActivated)); + AddMenuEntry(debug_menu, "XMLHttpRequest", + G_CALLBACK(XMLHttpRequestActivated)); + AddMenuEntry(debug_menu, "Scheme Handler", + G_CALLBACK(SchemeHandlerActivated)); + AddMenuEntry(debug_menu, "JavaScript Binding", + G_CALLBACK(BindingActivated)); + AddMenuEntry(debug_menu, "Plugin Info", + G_CALLBACK(PluginInfoActivated)); + AddMenuEntry(debug_menu, "DOM Access", + G_CALLBACK(DOMAccessActivated)); + AddMenuEntry(debug_menu, "Popup Window", + G_CALLBACK(PopupWindowActivated)); + AddMenuEntry(debug_menu, "Accelerated 2D Canvas", + G_CALLBACK(Accelerated2DCanvasActivated)); + AddMenuEntry(debug_menu, "Accelerated Layers", + G_CALLBACK(AcceleratedLayersActivated)); + AddMenuEntry(debug_menu, "WebGL", + G_CALLBACK(WebGLActivated)); + AddMenuEntry(debug_menu, "HTML5 Video", + G_CALLBACK(HTML5VideoActivated)); + AddMenuEntry(debug_menu, "HTML5 Drag & Drop", + G_CALLBACK(HTML5DragDropActivated)); + AddMenuEntry(debug_menu, "Zoom In", + G_CALLBACK(ZoomInActivated)); + AddMenuEntry(debug_menu, "Zoom Out", + G_CALLBACK(ZoomOutActivated)); + AddMenuEntry(debug_menu, "Zoom Reset", + G_CALLBACK(ZoomResetActivated)); + return menu_bar; +} + +// WebViewDelegate::TakeFocus in the test webview delegate. +static gboolean HandleFocus(GtkWidget* widget, + GdkEventFocus* focus) { + if (g_handler.get() && g_handler->GetBrowserId()) { + // Give focus to the browser window. + g_handler->GetBrowser()->GetHost()->SetFocus(true); + } + + return TRUE; +} + +int main(int argc, char* argv[]) { + CefMainArgs main_args(argc, argv); + CefRefPtr app(new ClientApp); + + // Execute the secondary process, if any. + int exit_code = CefExecuteProcess(main_args, app.get()); + if (exit_code >= 0) + return exit_code; + + if (!getcwd(szWorkingDir, sizeof (szWorkingDir))) + return -1; + + GtkWidget* window; + + gtk_init(&argc, &argv); + + // Parse command line arguments. + AppInitCommandLine(argc, argv); + + CefSettings settings; + + // Populate the settings based on command line arguments. + AppGetSettings(settings, app); + + // Initialize CEF. + CefInitialize(main_args, settings, app.get()); + + // Register the scheme handler. + scheme_test::InitTest(); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_default_size(GTK_WINDOW(window), 800, 600); + + g_signal_connect(window, "focus", G_CALLBACK(&HandleFocus), NULL); + + GtkWidget* vbox = gtk_vbox_new(FALSE, 0); + + GtkWidget* menu_bar = CreateMenuBar(); + + gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 0); + + GtkWidget* toolbar = gtk_toolbar_new(); + // Turn off the labels on the toolbar buttons. + gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); + + GtkToolItem* back = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK); + g_signal_connect(back, "clicked", + G_CALLBACK(BackButtonClicked), NULL); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), back, -1 /* append */); + + GtkToolItem* forward = gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD); + g_signal_connect(forward, "clicked", + G_CALLBACK(ForwardButtonClicked), NULL); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), forward, -1 /* append */); + + GtkToolItem* reload = gtk_tool_button_new_from_stock(GTK_STOCK_REFRESH); + g_signal_connect(reload, "clicked", + G_CALLBACK(ReloadButtonClicked), NULL); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), reload, -1 /* append */); + + GtkToolItem* stop = gtk_tool_button_new_from_stock(GTK_STOCK_STOP); + g_signal_connect(stop, "clicked", + G_CALLBACK(StopButtonClicked), NULL); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), stop, -1 /* append */); + + GtkWidget* m_editWnd = gtk_entry_new(); + g_signal_connect(G_OBJECT(m_editWnd), "activate", + G_CALLBACK(URLEntryActivate), NULL); + + GtkToolItem* tool_item = gtk_tool_item_new(); + gtk_container_add(GTK_CONTAINER(tool_item), m_editWnd); + gtk_tool_item_set_expand(tool_item, TRUE); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), tool_item, -1); // append + + gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); + + g_signal_connect(G_OBJECT(window), "destroy", + G_CALLBACK(gtk_widget_destroyed), &window); + g_signal_connect(G_OBJECT(window), "destroy", + G_CALLBACK(destroy), NULL); + + // Create the handler. + g_handler = new ClientHandler(); + g_handler->SetMainHwnd(vbox); + g_handler->SetEditHwnd(m_editWnd); + g_handler->SetButtonHwnds(GTK_WIDGET(back), GTK_WIDGET(forward), + GTK_WIDGET(reload), GTK_WIDGET(stop)); + + // Create the browser view. + CefWindowInfo window_info; + CefBrowserSettings browserSettings; + + // Populate the settings based on command line arguments. + AppGetBrowserSettings(browserSettings); + + window_info.SetAsChild(vbox); + + CefBrowserHost::CreateBrowserSync( + window_info, g_handler.get(), + g_handler->GetStartupURL(), browserSettings); + + gtk_container_add(GTK_CONTAINER(window), vbox); + gtk_widget_show_all(GTK_WIDGET(window)); + + // Install an signal handler so we clean up after ourselves. + signal(SIGINT, TerminationSignalHandler); + signal(SIGTERM, TerminationSignalHandler); + + CefRunMessageLoop(); + + CefShutdown(); + + return 0; +} + +// Global functions + +std::string AppGetWorkingDirectory() { + return szWorkingDir; +} diff --git a/tests/cefclient/cefclient_mac.mm b/tests/cefclient/cefclient_mac.mm new file mode 100644 index 000000000..b4c17da3d --- /dev/null +++ b/tests/cefclient/cefclient_mac.mm @@ -0,0 +1,542 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#include +#include "cefclient/cefclient.h" +#include "include/cef_app.h" +#import "include/cef_application_mac.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "include/cef_runnable.h" +#include "cefclient/binding_test.h" +#include "cefclient/client_handler.h" +#include "cefclient/dom_test.h" +#include "cefclient/resource_util.h" +#include "cefclient/scheme_test.h" +#include "cefclient/string_util.h" + +// The global ClientHandler reference. +extern CefRefPtr g_handler; + +char szWorkingDir[512]; // The current working directory + +// Sizes for URL bar layout +#define BUTTON_HEIGHT 22 +#define BUTTON_WIDTH 72 +#define BUTTON_MARGIN 8 +#define URLBAR_HEIGHT 32 + +// Content area size for newly created windows. +const int kWindowWidth = 800; +const int kWindowHeight = 600; + +// Memory AutoRelease pool. +static NSAutoreleasePool* g_autopool = nil; + +// Provide the CefAppProtocol implementation required by CEF. +@interface ClientApplication : NSApplication { +@private + BOOL handlingSendEvent_; +} +@end + +@implementation ClientApplication +- (BOOL)isHandlingSendEvent { + return handlingSendEvent_; +} + +- (void)setHandlingSendEvent:(BOOL)handlingSendEvent { + handlingSendEvent_ = handlingSendEvent; +} + +- (void)sendEvent:(NSEvent*)event { + CefScopedSendingEvent sendingEventScoper; + [super sendEvent:event]; +} +@end + + +// Receives notifications from controls and the browser window. Will delete +// itself when done. +@interface ClientWindowDelegate : NSObject +- (IBAction)goBack:(id)sender; +- (IBAction)goForward:(id)sender; +- (IBAction)reload:(id)sender; +- (IBAction)stopLoading:(id)sender; +- (IBAction)takeURLStringValueFrom:(NSTextField *)sender; +- (void)alert:(NSString*)title withMessage:(NSString*)message; +- (void)notifyConsoleMessage:(id)object; +- (void)notifyDownloadComplete:(id)object; +- (void)notifyDownloadError:(id)object; +@end + +@implementation ClientWindowDelegate + +- (IBAction)goBack:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->GoBack(); +} + +- (IBAction)goForward:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->GoForward(); +} + +- (IBAction)reload:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->Reload(); +} + +- (IBAction)stopLoading:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + g_handler->GetBrowser()->StopLoad(); +} + +- (IBAction)takeURLStringValueFrom:(NSTextField *)sender { + if (!g_handler.get() || !g_handler->GetBrowserId()) + return; + + NSString *url = [sender stringValue]; + + // if it doesn't already have a prefix, add http. If we can't parse it, + // just don't bother rather than making things worse. + NSURL* tempUrl = [NSURL URLWithString:url]; + if (tempUrl && ![tempUrl scheme]) + url = [@"http://" stringByAppendingString:url]; + + std::string urlStr = [url UTF8String]; + g_handler->GetBrowser()->GetMainFrame()->LoadURL(urlStr); +} + +- (void)alert:(NSString*)title withMessage:(NSString*)message { + NSAlert *alert = [NSAlert alertWithMessageText:title + defaultButton:@"OK" + alternateButton:nil + otherButton:nil + informativeTextWithFormat:message]; + [alert runModal]; +} + +- (void)notifyConsoleMessage:(id)object { + std::stringstream ss; + ss << "Console messages will be written to " << g_handler->GetLogFile(); + NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())]; + [self alert:@"Console Messages" withMessage:str]; +} + +- (void)notifyDownloadComplete:(id)object { + std::stringstream ss; + ss << "File \"" << g_handler->GetLastDownloadFile() << + "\" downloaded successfully."; + NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())]; + [self alert:@"File Download" withMessage:str]; +} + +- (void)notifyDownloadError:(id)object { + std::stringstream ss; + ss << "File \"" << g_handler->GetLastDownloadFile() << + "\" failed to download."; + NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())]; + [self alert:@"File Download" withMessage:str]; +} + +- (void)windowDidBecomeKey:(NSNotification*)notification { + if (g_handler.get() && g_handler->GetBrowserId()) { + // Give focus to the browser window. + g_handler->GetBrowser()->GetHost()->SetFocus(true); + } +} + +// Called when the window is about to close. Perform the self-destruction +// sequence by getting rid of the window. By returning YES, we allow the window +// to be removed from the screen. +- (BOOL)windowShouldClose:(id)window { + // Try to make the window go away. + [window autorelease]; + + // Clean ourselves up after clearing the stack of anything that might have the + // window on it. + [self performSelectorOnMainThread:@selector(cleanup:) + withObject:window + waitUntilDone:NO]; + + return YES; +} + +// Deletes itself. +- (void)cleanup:(id)window { + [self release]; +} + +@end + + +NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) { + NSButton* button = [[[NSButton alloc] initWithFrame:*rect] autorelease]; + [button setTitle:title]; + [button setBezelStyle:NSSmallSquareBezelStyle]; + [button setAutoresizingMask:(NSViewMaxXMargin | NSViewMinYMargin)]; + [parent addSubview:button]; + rect->origin.x += BUTTON_WIDTH; + return button; +} + +// Receives notifications from the application. Will delete itself when done. +@interface ClientAppDelegate : NSObject +- (void)createApp:(id)object; +- (IBAction)testGetSource:(id)sender; +- (IBAction)testGetText:(id)sender; +- (IBAction)testRequest:(id)sender; +- (IBAction)testLocalStorage:(id)sender; +- (IBAction)testXMLHttpRequest:(id)sender; +- (IBAction)testSchemeHandler:(id)sender; +- (IBAction)testBinding:(id)sender; +- (IBAction)testDialogs:(id)sender; +- (IBAction)testPluginInfo:(id)sender; +- (IBAction)testDOMAccess:(id)sender; +- (IBAction)testPopupWindow:(id)sender; +- (IBAction)testAccelerated2DCanvas:(id)sender; +- (IBAction)testAcceleratedLayers:(id)sender; +- (IBAction)testWebGL:(id)sender; +- (IBAction)testHTML5Video:(id)sender; +- (IBAction)testDragDrop:(id)sender; +- (IBAction)testZoomIn:(id)sender; +- (IBAction)testZoomOut:(id)sender; +- (IBAction)testZoomReset:(id)sender; +@end + +@implementation ClientAppDelegate + +// Create the application on the UI thread. +- (void)createApp:(id)object { + [NSApplication sharedApplication]; + [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; + + // Set the delegate for application events. + [NSApp setDelegate:self]; + + // Add the Tests menu. + NSMenu* menubar = [NSApp mainMenu]; + NSMenuItem *testItem = [[[NSMenuItem alloc] initWithTitle:@"Tests" + action:nil + keyEquivalent:@""] autorelease]; + NSMenu *testMenu = [[[NSMenu alloc] initWithTitle:@"Tests"] autorelease]; + [testMenu addItemWithTitle:@"Get Source" + action:@selector(testGetSource:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Get Text" + action:@selector(testGetText:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Popup Window" + action:@selector(testPopupWindow:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Request" + action:@selector(testRequest:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Scheme Handler" + action:@selector(testSchemeHandler:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"JavaScript Binding" + action:@selector(testBinding:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"JavaScript Dialogs" + action:@selector(testDialogs:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Plugin Info" + action:@selector(testPluginInfo:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"DOM Access" + action:@selector(testDOMAccess:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Local Storage" + action:@selector(testLocalStorage:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"XMLHttpRequest" + action:@selector(testXMLHttpRequest:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Accelerated 2D Canvas" + action:@selector(testAccelerated2DCanvas:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Accelerated Layers" + action:@selector(testAcceleratedLayers:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"WebGL" + action:@selector(testWebGL:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"HTML5 Video" + action:@selector(testHTML5Video:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Drag & Drop" + action:@selector(testDragDrop:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Zoom In" + action:@selector(testZoomIn:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Zoom Out" + action:@selector(testZoomOut:) + keyEquivalent:@""]; + [testMenu addItemWithTitle:@"Zoom Reset" + action:@selector(testZoomReset:) + keyEquivalent:@""]; + [testItem setSubmenu:testMenu]; + [menubar addItem:testItem]; + + // Create the delegate for control and browser window events. + ClientWindowDelegate* delegate = [[ClientWindowDelegate alloc] init]; + + // Create the main application window. + NSRect screen_rect = [[NSScreen mainScreen] visibleFrame]; + NSRect window_rect = { {0, screen_rect.size.height - kWindowHeight}, + {kWindowWidth, kWindowHeight} }; + NSWindow* mainWnd = [[UnderlayOpenGLHostingWindow alloc] + initWithContentRect:window_rect + styleMask:(NSTitledWindowMask | + NSClosableWindowMask | + NSMiniaturizableWindowMask | + NSResizableWindowMask ) + backing:NSBackingStoreBuffered + defer:NO]; + [mainWnd setTitle:@"cefclient"]; + [mainWnd setDelegate:delegate]; + + // Rely on the window delegate to clean us up rather than immediately + // releasing when the window gets closed. We use the delegate to do + // everything from the autorelease pool so the window isn't on the stack + // during cleanup (ie, a window close from javascript). + [mainWnd setReleasedWhenClosed:NO]; + + NSView* contentView = [mainWnd contentView]; + + // Create the buttons. + NSRect button_rect = [contentView bounds]; + button_rect.origin.y = window_rect.size.height - URLBAR_HEIGHT + + (URLBAR_HEIGHT - BUTTON_HEIGHT) / 2; + button_rect.size.height = BUTTON_HEIGHT; + button_rect.origin.x += BUTTON_MARGIN; + button_rect.size.width = BUTTON_WIDTH; + + NSButton* button = MakeButton(&button_rect, @"Back", contentView); + [button setTarget:delegate]; + [button setAction:@selector(goBack:)]; + + button = MakeButton(&button_rect, @"Forward", contentView); + [button setTarget:delegate]; + [button setAction:@selector(goForward:)]; + + button = MakeButton(&button_rect, @"Reload", contentView); + [button setTarget:delegate]; + [button setAction:@selector(reload:)]; + + button = MakeButton(&button_rect, @"Stop", contentView); + [button setTarget:delegate]; + [button setAction:@selector(stopLoading:)]; + + // Create the URL text field. + button_rect.origin.x += BUTTON_MARGIN; + button_rect.size.width = [contentView bounds].size.width - + button_rect.origin.x - BUTTON_MARGIN; + NSTextField* editWnd = [[NSTextField alloc] initWithFrame:button_rect]; + [contentView addSubview:editWnd]; + [editWnd setAutoresizingMask:(NSViewWidthSizable | NSViewMinYMargin)]; + [editWnd setTarget:delegate]; + [editWnd setAction:@selector(takeURLStringValueFrom:)]; + [[editWnd cell] setWraps:NO]; + [[editWnd cell] setScrollable:YES]; + + // Create the handler. + g_handler = new ClientHandler(); + g_handler->SetMainHwnd(contentView); + g_handler->SetEditHwnd(editWnd); + + // Create the browser view. + CefWindowInfo window_info; + CefBrowserSettings settings; + + // Populate the settings based on command line arguments. + AppGetBrowserSettings(settings); + + window_info.SetAsChild(contentView, 0, 0, kWindowWidth, kWindowHeight); + CefBrowserHost::CreateBrowser(window_info, g_handler.get(), + g_handler->GetStartupURL(), settings); + + // Show the window. + [mainWnd makeKeyAndOrderFront: nil]; + + // Size the window. + NSRect r = [mainWnd contentRectForFrameRect:[mainWnd frame]]; + r.size.width = kWindowWidth; + r.size.height = kWindowHeight + URLBAR_HEIGHT; + [mainWnd setFrame:[mainWnd frameRectForContentRect:r] display:YES]; +} + +- (IBAction)testGetSource:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunGetSourceTest(g_handler->GetBrowser()); +} + +- (IBAction)testGetText:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunGetTextTest(g_handler->GetBrowser()); +} + +- (IBAction)testRequest:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunRequestTest(g_handler->GetBrowser()); +} + +- (IBAction)testLocalStorage:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunLocalStorageTest(g_handler->GetBrowser()); +} + +- (IBAction)testXMLHttpRequest:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunXMLHTTPRequestTest(g_handler->GetBrowser()); +} + +- (IBAction)testSchemeHandler:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + scheme_test::RunTest(g_handler->GetBrowser()); +} + +- (IBAction)testBinding:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + binding_test::RunTest(g_handler->GetBrowser()); +} + +- (IBAction)testDialogs:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunDialogTest(g_handler->GetBrowser()); +} + +- (IBAction)testPluginInfo:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunPluginInfoTest(g_handler->GetBrowser()); +} + +- (IBAction)testDOMAccess:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + dom_test::RunTest(g_handler->GetBrowser()); +} + +- (IBAction)testPopupWindow:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunPopupTest(g_handler->GetBrowser()); +} + +- (IBAction)testAccelerated2DCanvas:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunAccelerated2DCanvasTest(g_handler->GetBrowser()); +} + +- (IBAction)testAcceleratedLayers:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunAcceleratedLayersTest(g_handler->GetBrowser()); +} + +- (IBAction)testWebGL:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunWebGLTest(g_handler->GetBrowser()); +} + +- (IBAction)testHTML5Video:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunHTML5VideoTest(g_handler->GetBrowser()); +} + +- (IBAction)testDragDrop:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) + RunDragDropTest(g_handler->GetBrowser()); +} + +- (IBAction)testZoomIn:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) { + CefRefPtr browser = g_handler->GetBrowser(); + browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() + 0.5); + } +} + +- (IBAction)testZoomOut:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) { + CefRefPtr browser = g_handler->GetBrowser(); + browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() - 0.5); + } +} + +- (IBAction)testZoomReset:(id)sender { + if (g_handler.get() && g_handler->GetBrowserId()) { + CefRefPtr browser = g_handler->GetBrowser(); + browser->GetHost()->SetZoomLevel(0.0); + } +} + + +// Sent by the default notification center immediately before the application +// terminates. +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Shut down CEF. + g_handler = NULL; + CefShutdown(); + + [self release]; + + // Release the AutoRelease pool. + [g_autopool release]; +} + +@end + + +int main(int argc, char* argv[]) { + CefMainArgs main_args(argc, argv); + CefRefPtr app(new ClientApp); + + // Execute the secondary process, if any. + int exit_code = CefExecuteProcess(main_args, app.get()); + if (exit_code >= 0) + return exit_code; + + // Retrieve the current working directory. + getcwd(szWorkingDir, sizeof(szWorkingDir)); + + // Initialize the AutoRelease pool. + g_autopool = [[NSAutoreleasePool alloc] init]; + + // Initialize the ClientApplication instance. + [ClientApplication sharedApplication]; + + // Parse command line arguments. + AppInitCommandLine(argc, argv); + + CefSettings settings; + + // Populate the settings based on command line arguments. + AppGetSettings(settings, app); + + // Initialize CEF. + CefInitialize(main_args, settings, app.get()); + + // Register the scheme handler. + scheme_test::InitTest(); + + // Create the application delegate and window. + NSObject* delegate = [[ClientAppDelegate alloc] init]; + [delegate performSelectorOnMainThread:@selector(createApp:) withObject:nil + waitUntilDone:NO]; + + // Run the application message loop. + CefRunMessageLoop(); + + // Don't put anything below this line because it won't be executed. + return 0; +} + + +// Global functions + +std::string AppGetWorkingDirectory() { + return szWorkingDir; +} diff --git a/tests/cefclient/cefclient_win.cpp b/tests/cefclient/cefclient_win.cpp new file mode 100644 index 000000000..a380d9ce2 --- /dev/null +++ b/tests/cefclient/cefclient_win.cpp @@ -0,0 +1,546 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/cefclient.h" +#include +#include +#include +#include +#include +#include +#include "include/cef_app.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "include/cef_runnable.h" +#include "cefclient/binding_test.h" +#include "cefclient/client_handler.h" +#include "cefclient/dom_test.h" +#include "cefclient/resource.h" +#include "cefclient/scheme_test.h" +#include "cefclient/string_util.h" + +#define MAX_LOADSTRING 100 +#define MAX_URL_LENGTH 255 +#define BUTTON_WIDTH 72 +#define URLBAR_HEIGHT 24 + +// Global Variables: +HINSTANCE hInst; // current instance +TCHAR szTitle[MAX_LOADSTRING]; // The title bar text +TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name +char szWorkingDir[MAX_PATH]; // The current working directory + +// Forward declarations of functions included in this code module: +ATOM MyRegisterClass(HINSTANCE hInstance); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); + +// The global ClientHandler reference. +extern CefRefPtr g_handler; + +#if defined(OS_WIN) +// Add Common Controls to the application manifest because it's required to +// support the default tooltip implementation. +#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length) +#endif + +// Program entry point function. +int APIENTRY wWinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) { + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + CefMainArgs main_args(hInstance); + CefRefPtr app(new ClientApp); + + // Execute the secondary process, if any. + int exit_code = CefExecuteProcess(main_args, app.get()); + if (exit_code >= 0) + return exit_code; + + // Retrieve the current working directory. + if (_getcwd(szWorkingDir, MAX_PATH) == NULL) + szWorkingDir[0] = 0; + + // Parse command line arguments. The passed in values are ignored on Windows. + AppInitCommandLine(0, NULL); + + CefSettings settings; + + // Populate the settings based on command line arguments. + AppGetSettings(settings, app); + + // Initialize CEF. + CefInitialize(main_args, settings, app.get()); + + // Register the scheme handler. + scheme_test::InitTest(); + + HACCEL hAccelTable; + + // Initialize global strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + LoadString(hInstance, IDC_CEFCLIENT, szWindowClass, MAX_LOADSTRING); + MyRegisterClass(hInstance); + + // Perform application initialization + if (!InitInstance (hInstance, nCmdShow)) + return FALSE; + + hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_CEFCLIENT)); + + int result = 0; + + if (!settings.multi_threaded_message_loop) { + // Run the CEF message loop. This function will block until the application + // recieves a WM_QUIT message. + CefRunMessageLoop(); + } else { + MSG msg; + + // Run the application message loop. + while (GetMessage(&msg, NULL, 0, 0)) { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + result = static_cast(msg.wParam); + } + + // Shut down CEF. + CefShutdown(); + + return result; +} + +// +// FUNCTION: MyRegisterClass() +// +// PURPOSE: Registers the window class. +// +// COMMENTS: +// +// This function and its usage are only necessary if you want this code +// to be compatible with Win32 systems prior to the 'RegisterClassEx' +// function that was added to Windows 95. It is important to call this +// function so that the application will get 'well formed' small icons +// associated with it. +// +ATOM MyRegisterClass(HINSTANCE hInstance) { + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_CEFCLIENT)); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = MAKEINTRESOURCE(IDC_CEFCLIENT); + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); + + return RegisterClassEx(&wcex); +} + +// +// FUNCTION: InitInstance(HINSTANCE, int) +// +// PURPOSE: Saves instance handle and creates main window +// +// COMMENTS: +// +// In this function, we save the instance handle in a global variable and +// create and display the main program window. +// +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { + HWND hWnd; + + hInst = hInstance; // Store instance handle in our global variable + + hWnd = CreateWindow(szWindowClass, szTitle, + WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, CW_USEDEFAULT, 0, + CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); + + if (!hWnd) + return FALSE; + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +// Change the zoom factor on the UI thread. +static void ModifyZoom(CefRefPtr browser, double delta) { + if (CefCurrentlyOn(TID_UI)) { + browser->GetHost()->SetZoomLevel( + browser->GetHost()->GetZoomLevel() + delta); + } else { + CefPostTask(TID_UI, NewCefRunnableFunction(ModifyZoom, browser, delta)); + } +} + +// +// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) +// +// PURPOSE: Processes messages for the main window. +// +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, + LPARAM lParam) { + static HWND backWnd = NULL, forwardWnd = NULL, reloadWnd = NULL, + stopWnd = NULL, editWnd = NULL; + static WNDPROC editWndOldProc = NULL; + + // Static members used for the find dialog. + static FINDREPLACE fr; + static WCHAR szFindWhat[80] = {0}; + static WCHAR szLastFindWhat[80] = {0}; + static bool findNext = false; + static bool lastMatchCase = false; + + int wmId, wmEvent; + PAINTSTRUCT ps; + HDC hdc; + + if (hWnd == editWnd) { + // Callback for the edit window + switch (message) { + case WM_CHAR: + if (wParam == VK_RETURN && g_handler.get()) { + // When the user hits the enter key load the URL + CefRefPtr browser = g_handler->GetBrowser(); + wchar_t strPtr[MAX_URL_LENGTH+1] = {0}; + *((LPWORD)strPtr) = MAX_URL_LENGTH; + LRESULT strLen = SendMessage(hWnd, EM_GETLINE, 0, (LPARAM)strPtr); + if (strLen > 0) { + strPtr[strLen] = 0; + browser->GetMainFrame()->LoadURL(strPtr); + } + + return 0; + } + } + + return (LRESULT)CallWindowProc(editWndOldProc, hWnd, message, wParam, + lParam); + } else { + // Callback for the main window + switch (message) { + case WM_CREATE: { + // Create the single static handler class instance + g_handler = new ClientHandler(); + g_handler->SetMainHwnd(hWnd); + + // Create the child windows used for navigation + RECT rect; + int x = 0; + + GetClientRect(hWnd, &rect); + + backWnd = CreateWindow(L"BUTTON", L"Back", + WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON + | WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT, + hWnd, (HMENU) IDC_NAV_BACK, hInst, 0); + x += BUTTON_WIDTH; + + forwardWnd = CreateWindow(L"BUTTON", L"Forward", + WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON + | WS_DISABLED, x, 0, BUTTON_WIDTH, + URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_FORWARD, + hInst, 0); + x += BUTTON_WIDTH; + + reloadWnd = CreateWindow(L"BUTTON", L"Reload", + WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON + | WS_DISABLED, x, 0, BUTTON_WIDTH, + URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_RELOAD, + hInst, 0); + x += BUTTON_WIDTH; + + stopWnd = CreateWindow(L"BUTTON", L"Stop", + WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON + | WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT, + hWnd, (HMENU) IDC_NAV_STOP, hInst, 0); + x += BUTTON_WIDTH; + + editWnd = CreateWindow(L"EDIT", 0, + WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | + ES_AUTOVSCROLL | ES_AUTOHSCROLL| WS_DISABLED, + x, 0, rect.right - BUTTON_WIDTH * 4, + URLBAR_HEIGHT, hWnd, 0, hInst, 0); + + // Assign the edit window's WNDPROC to this function so that we can + // capture the enter key + editWndOldProc = + reinterpret_cast(GetWindowLongPtr(editWnd, GWLP_WNDPROC)); + SetWindowLongPtr(editWnd, GWLP_WNDPROC, + reinterpret_cast(WndProc)); + g_handler->SetEditHwnd(editWnd); + g_handler->SetButtonHwnds(backWnd, forwardWnd, reloadWnd, stopWnd); + + rect.top += URLBAR_HEIGHT; + + CefWindowInfo info; + CefBrowserSettings settings; + + // Populate the settings based on command line arguments. + AppGetBrowserSettings(settings); + + // Initialize window info to the defaults for a child window + info.SetAsChild(hWnd, rect); + + // Creat the new child browser window + CefBrowserHost::CreateBrowser(info, g_handler.get(), + g_handler->GetStartupURL(), settings); + + return 0; + } + + case WM_COMMAND: { + CefRefPtr browser; + if (g_handler.get()) + browser = g_handler->GetBrowser(); + + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + // Parse the menu selections: + switch (wmId) { + case IDM_ABOUT: + DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); + return 0; + case IDM_EXIT: + DestroyWindow(hWnd); + return 0; + case ID_WARN_CONSOLEMESSAGE: + if (g_handler.get()) { + std::wstringstream ss; + ss << L"Console messages will be written to " + << std::wstring(CefString(g_handler->GetLogFile())); + MessageBox(hWnd, ss.str().c_str(), L"Console Messages", + MB_OK | MB_ICONINFORMATION); + } + return 0; + case ID_WARN_DOWNLOADCOMPLETE: + case ID_WARN_DOWNLOADERROR: + if (g_handler.get()) { + std::wstringstream ss; + ss << L"File \"" << + std::wstring(CefString(g_handler->GetLastDownloadFile())) << + L"\" "; + + if (wmId == ID_WARN_DOWNLOADCOMPLETE) + ss << L"downloaded successfully."; + else + ss << L"failed to download."; + + MessageBox(hWnd, ss.str().c_str(), L"File Download", + MB_OK | MB_ICONINFORMATION); + } + return 0; + case IDC_NAV_BACK: // Back button + if (browser.get()) + browser->GoBack(); + return 0; + case IDC_NAV_FORWARD: // Forward button + if (browser.get()) + browser->GoForward(); + return 0; + case IDC_NAV_RELOAD: // Reload button + if (browser.get()) + browser->Reload(); + return 0; + case IDC_NAV_STOP: // Stop button + if (browser.get()) + browser->StopLoad(); + return 0; + case ID_TESTS_GETSOURCE: // Test the GetSource function + if (browser.get()) + RunGetSourceTest(browser); + return 0; + case ID_TESTS_GETTEXT: // Test the GetText function + if (browser.get()) + RunGetTextTest(browser); + return 0; + case ID_TESTS_POPUP: // Test a popup window + if (browser.get()) + RunPopupTest(browser); + return 0; + case ID_TESTS_REQUEST: // Test a request + if (browser.get()) + RunRequestTest(browser); + return 0; + case ID_TESTS_SCHEME_HANDLER: // Test the scheme handler + if (browser.get()) + scheme_test::RunTest(browser); + return 0; + case ID_TESTS_BINDING: // Test JavaScript binding + if (browser.get()) + binding_test::RunTest(browser); + return 0; + case ID_TESTS_DIALOGS: // Test JavaScript dialogs + if (browser.get()) + RunDialogTest(browser); + return 0; + case ID_TESTS_PLUGIN_INFO: // Test plugin info + if (browser.get()) + RunPluginInfoTest(browser); + return 0; + case ID_TESTS_DOM_ACCESS: // Test DOM access + if (browser.get()) + dom_test::RunTest(browser); + return 0; + case ID_TESTS_LOCALSTORAGE: // Test localStorage + if (browser.get()) + RunLocalStorageTest(browser); + return 0; + case ID_TESTS_ACCELERATED2DCANVAS: // Test accelerated 2d canvas + if (browser.get()) + RunAccelerated2DCanvasTest(browser); + return 0; + case ID_TESTS_ACCELERATEDLAYERS: // Test accelerated layers + if (browser.get()) + RunAcceleratedLayersTest(browser); + return 0; + case ID_TESTS_WEBGL: // Test WebGL + if (browser.get()) + RunWebGLTest(browser); + return 0; + case ID_TESTS_HTML5VIDEO: // Test HTML5 video + if (browser.get()) + RunHTML5VideoTest(browser); + return 0; + case ID_TESTS_XMLHTTPREQUEST: // Test XMLHttpRequest + if (browser.get()) + RunXMLHTTPRequestTest(browser); + return 0; + case ID_TESTS_DRAGDROP: // Test drag & drop + if (browser.get()) + RunDragDropTest(browser); + return 0; + case ID_TESTS_GEOLOCATION: // Test geolocation + if (browser.get()) + RunGeolocationTest(browser); + return 0; + case ID_TESTS_ZOOM_IN: + if (browser.get()) + ModifyZoom(browser, 0.5); + return 0; + case ID_TESTS_ZOOM_OUT: + if (browser.get()) + ModifyZoom(browser, -0.5); + return 0; + case ID_TESTS_ZOOM_RESET: + if (browser.get()) + browser->GetHost()->SetZoomLevel(0.0); + return 0; + } + break; + } + + case WM_PAINT: + hdc = BeginPaint(hWnd, &ps); + EndPaint(hWnd, &ps); + return 0; + + case WM_SETFOCUS: + if (g_handler.get() && g_handler->GetBrowser()) { + // Pass focus to the browser window + CefWindowHandle hwnd = + g_handler->GetBrowser()->GetHost()->GetWindowHandle(); + if (hwnd) + PostMessage(hwnd, WM_SETFOCUS, wParam, NULL); + } + return 0; + + case WM_SIZE: + // Minimizing resizes the window to 0x0 which causes our layout to go all + // screwy, so we just ignore it. + if (wParam != SIZE_MINIMIZED && g_handler.get() && + g_handler->GetBrowser()) { + CefWindowHandle hwnd = + g_handler->GetBrowser()->GetHost()->GetWindowHandle(); + if (hwnd) { + // Resize the browser window and address bar to match the new frame + // window size + RECT rect; + GetClientRect(hWnd, &rect); + rect.top += URLBAR_HEIGHT; + + int urloffset = rect.left + BUTTON_WIDTH * 4; + + HDWP hdwp = BeginDeferWindowPos(1); + hdwp = DeferWindowPos(hdwp, editWnd, NULL, urloffset, + 0, rect.right - urloffset, URLBAR_HEIGHT, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, hwnd, NULL, + rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, + SWP_NOZORDER); + EndDeferWindowPos(hdwp); + } + } + break; + + case WM_ERASEBKGND: + if (g_handler.get() && g_handler->GetBrowser()) { + CefWindowHandle hwnd = + g_handler->GetBrowser()->GetHost()->GetWindowHandle(); + if (hwnd) { + // Dont erase the background if the browser window has been loaded + // (this avoids flashing) + return 0; + } + } + break; + + case WM_CLOSE: + if (g_handler.get()) { + CefRefPtr browser = g_handler->GetBrowser(); + if (browser.get()) { + // Let the browser window know we are about to destroy it. + browser->GetHost()->ParentWindowWillClose(); + } + } + break; + + case WM_DESTROY: + // The frame window has exited + PostQuitMessage(0); + return 0; + } + + return DefWindowProc(hWnd, message, wParam, lParam); + } +} + +// Message handler for about box. +INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { + UNREFERENCED_PARAMETER(lParam); + switch (message) { + case WM_INITDIALOG: + return (INT_PTR)TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { + EndDialog(hDlg, LOWORD(wParam)); + return (INT_PTR)TRUE; + } + break; + } + return (INT_PTR)FALSE; +} + + +// Global functions + +std::string AppGetWorkingDirectory() { + return szWorkingDir; +} diff --git a/tests/cefclient/client_app.cpp b/tests/cefclient/client_app.cpp new file mode 100644 index 000000000..b6a26d150 --- /dev/null +++ b/tests/cefclient/client_app.cpp @@ -0,0 +1,346 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +// This file is shared by cefclient and cef_unittests so don't include using +// a qualified path. +#include "client_app.h" // NOLINT(build/include) + +#include + +#include "include/cef_cookie.h" +#include "include/cef_process_message.h" +#include "include/cef_task.h" +#include "include/cef_v8.h" +#include "util.h" // NOLINT(build/include) + +namespace { + +// Forward declarations. +void SetList(CefRefPtr source, CefRefPtr target); +void SetList(CefRefPtr source, CefRefPtr target); + +// Transfer a V8 value to a List index. +void SetListValue(CefRefPtr list, int index, + CefRefPtr value) { + if (value->IsArray()) { + CefRefPtr new_list = CefListValue::Create(); + SetList(value, new_list); + list->SetList(index, new_list); + } else if (value->IsString()) { + list->SetString(index, value->GetStringValue()); + } else if (value->IsBool()) { + list->SetBool(index, value->GetBoolValue()); + } else if (value->IsInt()) { + list->SetInt(index, value->GetIntValue()); + } else if (value->IsDouble()) { + list->SetDouble(index, value->GetDoubleValue()); + } +} + +// Transfer a V8 array to a List. +void SetList(CefRefPtr source, CefRefPtr target) { + ASSERT(source->IsArray()); + + int arg_length = source->GetArrayLength(); + if (arg_length == 0) + return; + + // Start with null types in all spaces. + target->SetSize(arg_length); + + for (int i = 0; i < arg_length; ++i) + SetListValue(target, i, source->GetValue(i)); +} + +// Transfer a List value to a V8 array index. +void SetListValue(CefRefPtr list, int index, + CefRefPtr value) { + CefRefPtr new_value; + + CefValueType type = value->GetType(index); + switch (type) { + case VTYPE_LIST: { + CefRefPtr list = value->GetList(index); + new_value = CefV8Value::CreateArray(list->GetSize()); + SetList(list, new_value); + } break; + case VTYPE_BOOL: + new_value = CefV8Value::CreateBool(value->GetBool(index)); + break; + case VTYPE_DOUBLE: + new_value = CefV8Value::CreateDouble(value->GetDouble(index)); + break; + case VTYPE_INT: + new_value = CefV8Value::CreateInt(value->GetInt(index)); + break; + case VTYPE_STRING: + new_value = CefV8Value::CreateString(value->GetString(index)); + break; + default: + break; + } + + if (new_value.get()) { + list->SetValue(index, new_value); + } else { + list->SetValue(index, CefV8Value::CreateNull()); + } +} + +// Transfer a List to a V8 array. +void SetList(CefRefPtr source, CefRefPtr target) { + ASSERT(target->IsArray()); + + int arg_length = source->GetSize(); + if (arg_length == 0) + return; + + for (int i = 0; i < arg_length; ++i) + SetListValue(target, i, source); +} + + +// Handles the native implementation for the client_app extension. +class ClientAppExtensionHandler : public CefV8Handler { + public: + explicit ClientAppExtensionHandler(CefRefPtr client_app) + : client_app_(client_app) { + } + + virtual bool Execute(const CefString& name, + CefRefPtr object, + const CefV8ValueList& arguments, + CefRefPtr& retval, + CefString& exception) { + bool handled = false; + + if (name == "sendMessage") { + // Send a message to the browser process. + if ((arguments.size() == 1 || arguments.size() == 2) && + arguments[0]->IsString()) { + CefRefPtr browser = + CefV8Context::GetCurrentContext()->GetBrowser(); + ASSERT(browser.get()); + + CefString name = arguments[0]->GetStringValue(); + if (!name.empty()) { + CefRefPtr message = + CefProcessMessage::Create(name); + + // Translate the arguments, if any. + if (arguments.size() == 2 && arguments[1]->IsArray()) + SetList(arguments[1], message->GetArgumentList()); + + browser->SendProcessMessage(PID_BROWSER, message); + handled = true; + } + } + } else if (name == "setMessageCallback") { + // Set a message callback. + if (arguments.size() == 2 && arguments[0]->IsString() && + arguments[1]->IsFunction()) { + std::string name = arguments[0]->GetStringValue(); + CefRefPtr context = CefV8Context::GetCurrentContext(); + int browser_id = context->GetBrowser()->GetIdentifier(); + client_app_->SetMessageCallback(name, browser_id, context, + arguments[1]); + handled = true; + } + } else if (name == "removeMessageCallback") { + // Remove a message callback. + if (arguments.size() == 1 && arguments[0]->IsString()) { + std::string name = arguments[0]->GetStringValue(); + CefRefPtr context = CefV8Context::GetCurrentContext(); + int browser_id = context->GetBrowser()->GetIdentifier(); + bool removed = client_app_->RemoveMessageCallback(name, browser_id); + retval = CefV8Value::CreateBool(removed); + handled = true; + } + } + + if (!handled) + exception = "Invalid method arguments"; + + return true; + } + + private: + CefRefPtr client_app_; + + IMPLEMENT_REFCOUNTING(ClientAppExtensionHandler); +}; + +} // namespace + + +ClientApp::ClientApp() + : proxy_type_(PROXY_TYPE_DIRECT) { + CreateRenderDelegates(render_delegates_); + + // Default schemes that support cookies. + cookieable_schemes_.push_back("http"); + cookieable_schemes_.push_back("https"); +} + +void ClientApp::SetMessageCallback(const std::string& message_name, + int browser_id, + CefRefPtr context, + CefRefPtr function) { + ASSERT(CefCurrentlyOn(TID_RENDERER)); + + callback_map_.insert( + std::make_pair(std::make_pair(message_name, browser_id), + std::make_pair(context, function))); +} + +bool ClientApp::RemoveMessageCallback(const std::string& message_name, + int browser_id) { + ASSERT(CefCurrentlyOn(TID_RENDERER)); + + CallbackMap::iterator it = + callback_map_.find(std::make_pair(message_name, browser_id)); + if (it != callback_map_.end()) { + callback_map_.erase(it); + return true; + } + + return false; +} + +void ClientApp::OnContextInitialized() { + // Register cookieable schemes with the global cookie manager. + CefRefPtr manager = CefCookieManager::GetGlobalManager(); + ASSERT(manager.get()); + manager->SetSupportedSchemes(cookieable_schemes_); +} + +void ClientApp::GetProxyForUrl(const CefString& url, + CefProxyInfo& proxy_info) { + proxy_info.proxyType = proxy_type_; + if (!proxy_config_.empty()) + CefString(&proxy_info.proxyList) = proxy_config_; +} + +void ClientApp::OnWebKitInitialized() { + // Register the client_app extension. + std::string app_code = + "var app;" + "if (!app)" + " app = {};" + "(function() {" + " app.sendMessage = function(name, arguments) {" + " native function sendMessage();" + " return sendMessage(name, arguments);" + " };" + " app.setMessageCallback = function(name, callback) {" + " native function setMessageCallback();" + " return setMessageCallback(name, callback);" + " };" + " app.removeMessageCallback = function(name) {" + " native function removeMessageCallback();" + " return removeMessageCallback(name);" + " };" + "})();"; + CefRegisterExtension("v8/app", app_code, + new ClientAppExtensionHandler(this)); + + // Execute delegate callbacks. + RenderDelegateSet::iterator it = render_delegates_.begin(); + for (; it != render_delegates_.end(); ++it) + (*it)->OnWebKitInitialized(this); +} + +void ClientApp::OnContextCreated(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) { + // Execute delegate callbacks. + RenderDelegateSet::iterator it = render_delegates_.begin(); + for (; it != render_delegates_.end(); ++it) + (*it)->OnContextCreated(this, browser, frame, context); +} + +void ClientApp::OnContextReleased(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) { + // Execute delegate callbacks. + RenderDelegateSet::iterator it = render_delegates_.begin(); + for (; it != render_delegates_.end(); ++it) + (*it)->OnContextReleased(this, browser, frame, context); + + // Remove any JavaScript callbacks registered for the context that has been + // released. + if (!callback_map_.empty()) { + CallbackMap::iterator it = callback_map_.begin(); + for (; it != callback_map_.end();) { + if (it->second.first->IsSame(context)) + callback_map_.erase(it++); + else + ++it; + } + } +} + +void ClientApp::OnFocusedNodeChanged(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr node) { + // Execute delegate callbacks. + RenderDelegateSet::iterator it = render_delegates_.begin(); + for (; it != render_delegates_.end(); ++it) + (*it)->OnFocusedNodeChanged(this, browser, frame, node); +} + +bool ClientApp::OnProcessMessageReceived( + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) { + ASSERT(source_process == PID_BROWSER); + + bool handled = false; + + // Execute delegate callbacks. + RenderDelegateSet::iterator it = render_delegates_.begin(); + for (; it != render_delegates_.end() && !handled; ++it) { + handled = (*it)->OnProcessMessageReceived(this, browser, source_process, + message); + } + + if (handled) + return true; + + // Execute the registered JavaScript callback if any. + if (!callback_map_.empty()) { + CefString message_name = message->GetName(); + CallbackMap::const_iterator it = callback_map_.find( + std::make_pair(message_name.ToString(), + browser->GetIdentifier())); + if (it != callback_map_.end()) { + // Enter the context. + it->second.first->Enter(); + + CefV8ValueList arguments; + + // First argument is the message name. + arguments.push_back(CefV8Value::CreateString(message_name)); + + // Second argument is the list of message arguments. + CefRefPtr list = message->GetArgumentList(); + CefRefPtr args = CefV8Value::CreateArray(list->GetSize()); + SetList(list, args); + arguments.push_back(args); + + // Execute the callback. + CefRefPtr retval = + it->second.second->ExecuteFunction(NULL, arguments); + if (retval.get()) { + if (retval->IsBool()) + handled = retval->GetBoolValue(); + } + + // Exit the context. + it->second.first->Exit(); + } + } + + return handled; +} diff --git a/tests/cefclient/client_app.h b/tests/cefclient/client_app.h new file mode 100644 index 000000000..2a5e955aa --- /dev/null +++ b/tests/cefclient/client_app.h @@ -0,0 +1,157 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_CLIENT_APP_H_ +#define CEF_TESTS_CEFCLIENT_CLIENT_APP_H_ +#pragma once + +#include +#include +#include +#include +#include +#include "include/cef_app.h" + +class ClientApp : public CefApp, + public CefBrowserProcessHandler, + public CefProxyHandler, + public CefRenderProcessHandler { + public: + // Interface for renderer delegates. All RenderDelegates must be returned via + // CreateRenderDelegates. Do not perform work in the RenderDelegate + // constructor. + class RenderDelegate : public virtual CefBase { + public: + // Called when WebKit is initialized. Used to register V8 extensions. + virtual void OnWebKitInitialized(CefRefPtr app) { + }; + + // Called when a V8 context is created. Used to create V8 window bindings + // and set message callbacks. RenderDelegates should check for unique URLs + // to avoid interfering with each other. + virtual void OnContextCreated(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) { + }; + + // Called when a V8 context is released. Used to clean up V8 window + // bindings. RenderDelegates should check for unique URLs to avoid + // interfering with each other. + virtual void OnContextReleased(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) { + }; + + // Called when the focused node in a frame has changed. + virtual void OnFocusedNodeChanged(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr node) { + } + + // Called when a process message is received. Return true if the message was + // handled and should not be passed on to other handlers. RenderDelegates + // should check for unique message names to avoid interfering with each + // other. + virtual bool OnProcessMessageReceived( + CefRefPtr app, + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) { + return false; + } + }; + + typedef std::set > RenderDelegateSet; + + ClientApp(); + + // Set the proxy configuration. Should only be called during initialization. + void SetProxyConfig(cef_proxy_type_t proxy_type, + const CefString& proxy_config) { + proxy_type_ = proxy_type; + proxy_config_ = proxy_config; + } + + // Set a JavaScript callback for the specified |message_name| and |browser_id| + // combination. Will automatically be removed when the associated context is + // released. Callbacks can also be set in JavaScript using the + // app.setMessageCallback function. + void SetMessageCallback(const std::string& message_name, + int browser_id, + CefRefPtr context, + CefRefPtr function); + + // Removes the JavaScript callback for the specified |message_name| and + // |browser_id| combination. Returns true if a callback was removed. Callbacks + // can also be removed in JavaScript using the app.removeMessageCallback + // function. + bool RemoveMessageCallback(const std::string& message_name, + int browser_id); + + private: + // Creates all of the RenderDelegate objects. Implemented in + // client_app_delegates. + static void CreateRenderDelegates(RenderDelegateSet& delegates); + + // Registers custom schemes. Implemented in client_app_delegates. + static void RegisterCustomSchemes(CefRefPtr registrar, + std::vector& cookiable_schemes); + + // CefApp methods. + virtual void OnRegisterCustomSchemes( + CefRefPtr registrar) OVERRIDE { + RegisterCustomSchemes(registrar, cookieable_schemes_); + } + virtual CefRefPtr GetBrowserProcessHandler() + OVERRIDE { return this; } + virtual CefRefPtr GetRenderProcessHandler() + OVERRIDE { return this; } + + // CefBrowserProcessHandler methods. + virtual CefRefPtr GetProxyHandler() OVERRIDE { return this; } + virtual void OnContextInitialized(); + + // CefProxyHandler methods. + virtual void GetProxyForUrl(const CefString& url, + CefProxyInfo& proxy_info) OVERRIDE; + + // CefRenderProcessHandler methods. + virtual void OnWebKitInitialized() OVERRIDE; + virtual void OnContextCreated(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) OVERRIDE; + virtual void OnContextReleased(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) OVERRIDE; + virtual void OnFocusedNodeChanged(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr node) OVERRIDE; + virtual bool OnProcessMessageReceived( + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) OVERRIDE; + + // Proxy configuration. + cef_proxy_type_t proxy_type_; + CefString proxy_config_; + + // Map of message callbacks. + typedef std::map, + std::pair, CefRefPtr > > + CallbackMap; + CallbackMap callback_map_; + + // Set of supported RenderDelegates. + RenderDelegateSet render_delegates_; + + // Schemes that will be registered with the global cookie manager. + std::vector cookieable_schemes_; + + IMPLEMENT_REFCOUNTING(ClientApp); +}; + +#endif // CEF_TESTS_CEFCLIENT_CLIENT_APP_H_ diff --git a/tests/cefclient/client_app_delegates.cpp b/tests/cefclient/client_app_delegates.cpp new file mode 100644 index 000000000..84a76a8dc --- /dev/null +++ b/tests/cefclient/client_app_delegates.cpp @@ -0,0 +1,21 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/client_app.h" +#include "cefclient/client_renderer.h" +#include "cefclient/dom_test.h" +#include "cefclient/scheme_test.h" + +// static +void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) { + client_renderer::CreateRenderDelegates(delegates); + dom_test::CreateRenderDelegates(delegates); +} + +// static +void ClientApp::RegisterCustomSchemes( + CefRefPtr registrar, + std::vector& cookiable_schemes) { + scheme_test::RegisterCustomSchemes(registrar, cookiable_schemes); +} diff --git a/tests/cefclient/client_handler.cpp b/tests/cefclient/client_handler.cpp new file mode 100644 index 000000000..e65bd98d3 --- /dev/null +++ b/tests/cefclient/client_handler.cpp @@ -0,0 +1,526 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/client_handler.h" +#include +#include +#include +#include +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "include/cef_path_util.h" +#include "include/cef_process_util.h" +#include "include/cef_runnable.h" +#include "include/wrapper/cef_stream_resource_handler.h" +#include "cefclient/binding_test.h" +#include "cefclient/cefclient.h" +#include "cefclient/client_renderer.h" +#include "cefclient/client_switches.h" +#include "cefclient/dom_test.h" +#include "cefclient/resource_util.h" +#include "cefclient/string_util.h" + + +// Custom menu command Ids. +enum client_menu_ids { + CLIENT_ID_SHOW_DEVTOOLS = MENU_ID_USER_FIRST, + CLIENT_ID_TESTMENU_SUBMENU, + CLIENT_ID_TESTMENU_CHECKITEM, + CLIENT_ID_TESTMENU_RADIOITEM1, + CLIENT_ID_TESTMENU_RADIOITEM2, + CLIENT_ID_TESTMENU_RADIOITEM3, +}; + +ClientHandler::ClientHandler() + : m_MainHwnd(NULL), + m_BrowserId(0), + m_EditHwnd(NULL), + m_BackHwnd(NULL), + m_ForwardHwnd(NULL), + m_StopHwnd(NULL), + m_ReloadHwnd(NULL), + m_bFocusOnEditableField(false) { + CreateProcessMessageDelegates(process_message_delegates_); + CreateRequestDelegates(request_delegates_); + + // Read command line settings. + CefRefPtr command_line = + CefCommandLine::GetGlobalCommandLine(); + + if (command_line->HasSwitch(cefclient::kUrl)) + m_StartupURL = command_line->GetSwitchValue(cefclient::kUrl); + if (m_StartupURL.empty()) + m_StartupURL = "http://www.google.com/"; + + m_bExternalDevTools = command_line->HasSwitch(cefclient::kExternalDevTools); +} + +ClientHandler::~ClientHandler() { +} + +bool ClientHandler::OnProcessMessageReceived( + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) { + // Check for messages from the client renderer. + std::string message_name = message->GetName(); + if (message_name == client_renderer::kFocusedNodeChangedMessage) { + // A message is sent from ClientRenderDelegate to tell us whether the + // currently focused DOM node is editable. Use of |m_bFocusOnEditableField| + // is redundant with CefKeyEvent.focus_on_editable_field in OnPreKeyEvent + // but is useful for demonstration purposes. + m_bFocusOnEditableField = message->GetArgumentList()->GetBool(0); + return true; + } + + bool handled = false; + + // Execute delegate callbacks. + ProcessMessageDelegateSet::iterator it = process_message_delegates_.begin(); + for (; it != process_message_delegates_.end() && !handled; ++it) { + handled = (*it)->OnProcessMessageReceived(this, browser, source_process, + message); + } + + return handled; +} + +void ClientHandler::OnBeforeContextMenu( + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr params, + CefRefPtr model) { + if ((params->GetTypeFlags() & (CM_TYPEFLAG_PAGE | CM_TYPEFLAG_FRAME)) != 0) { + // Add a separator if the menu already has items. + if (model->GetCount() > 0) + model->AddSeparator(); + + // Add a "Show DevTools" item to all context menus. + model->AddItem(CLIENT_ID_SHOW_DEVTOOLS, "&Show DevTools"); + + CefString devtools_url = browser->GetHost()->GetDevToolsURL(true); + if (devtools_url.empty() || + m_OpenDevToolsURLs.find(devtools_url) != m_OpenDevToolsURLs.end()) { + // Disable the menu option if DevTools isn't enabled or if a window is + // already open for the current URL. + model->SetEnabled(CLIENT_ID_SHOW_DEVTOOLS, false); + } + + // Test context menu features. + BuildTestMenu(model); + } +} + +bool ClientHandler::OnContextMenuCommand( + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr params, + int command_id, + EventFlags event_flags) { + switch (command_id) { + case CLIENT_ID_SHOW_DEVTOOLS: + ShowDevTools(browser); + return true; + default: // Allow default handling, if any. + return ExecuteTestMenu(command_id); + } +} + +void ClientHandler::OnLoadingStateChange(CefRefPtr browser, + bool isLoading, + bool canGoBack, + bool canGoForward) { + REQUIRE_UI_THREAD(); + SetLoading(isLoading); + SetNavState(canGoBack, canGoForward); +} + +bool ClientHandler::OnConsoleMessage(CefRefPtr browser, + const CefString& message, + const CefString& source, + int line) { + REQUIRE_UI_THREAD(); + + bool first_message; + std::string logFile; + + { + AutoLock lock_scope(this); + + first_message = m_LogFile.empty(); + if (first_message) { + std::stringstream ss; + ss << AppGetWorkingDirectory(); +#if defined(OS_WIN) + ss << "\\"; +#else + ss << "/"; +#endif + ss << "console.log"; + m_LogFile = ss.str(); + } + logFile = m_LogFile; + } + + FILE* file = fopen(logFile.c_str(), "a"); + if (file) { + std::stringstream ss; + ss << "Message: " << std::string(message) << "\r\nSource: " << + std::string(source) << "\r\nLine: " << line << + "\r\n-----------------------\r\n"; + fputs(ss.str().c_str(), file); + fclose(file); + + if (first_message) + SendNotification(NOTIFY_CONSOLE_MESSAGE); + } + + return false; +} + +void ClientHandler::OnBeforeDownload( + CefRefPtr browser, + CefRefPtr download_item, + const CefString& suggested_name, + CefRefPtr callback) { + REQUIRE_UI_THREAD(); + // Continue the download and show the "Save As" dialog. + callback->Continue(GetDownloadPath(suggested_name), true); +} + +void ClientHandler::OnDownloadUpdated( + CefRefPtr browser, + CefRefPtr download_item, + CefRefPtr callback) { + REQUIRE_UI_THREAD(); + if (download_item->IsComplete()) { + SetLastDownloadFile(download_item->GetFullPath()); + SendNotification(NOTIFY_DOWNLOAD_COMPLETE); + } +} + +void ClientHandler::OnRequestGeolocationPermission( + CefRefPtr browser, + const CefString& requesting_url, + int request_id, + CefRefPtr callback) { + // Allow geolocation access from all websites. + callback->Continue(true); +} + +bool ClientHandler::OnPreKeyEvent(CefRefPtr browser, + const CefKeyEvent& event, + CefEventHandle os_event, + bool* is_keyboard_shortcut) { + ASSERT(m_bFocusOnEditableField == event.focus_on_editable_field); + if (!event.focus_on_editable_field && event.windows_key_code == 0x20) { + // Special handling for the space character when an input element does not + // have focus. Handling the event in OnPreKeyEvent() keeps the event from + // being processed in the renderer. If we instead handled the event in the + // OnKeyEvent() method the space key would cause the window to scroll in + // addition to showing the alert box. + if (event.type == KEYEVENT_RAWKEYDOWN) { + browser->GetMainFrame()->ExecuteJavaScript( + "alert('You pressed the space bar!');", "", 0); + } + return true; + } + + return false; +} + +void ClientHandler::OnAfterCreated(CefRefPtr browser) { + REQUIRE_UI_THREAD(); + + AutoLock lock_scope(this); + if (!m_Browser.get()) { + // We need to keep the main child window, but not popup windows + m_Browser = browser; + m_BrowserId = browser->GetIdentifier(); + } +} + +bool ClientHandler::DoClose(CefRefPtr browser) { + REQUIRE_UI_THREAD(); + + 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(); + + // Return true here so that we can skip closing the browser window + // in this pass. (It will be destroyed due to the call to close + // the parent above.) + return true; + } + + // A popup browser window is not contained in another window, so we can let + // these windows close by themselves. + return false; +} + +void ClientHandler::OnBeforeClose(CefRefPtr browser) { + REQUIRE_UI_THREAD(); + + 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); + } +} + +void ClientHandler::OnLoadStart(CefRefPtr browser, + CefRefPtr frame) { + REQUIRE_UI_THREAD(); + + if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { + // We've just started loading a page + SetLoading(true); + } +} + +void ClientHandler::OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) { + REQUIRE_UI_THREAD(); + + if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { + // We've just finished loading a page + SetLoading(false); + + // Continue the DOM test. + if (frame->GetURL() == dom_test::kTestUrl) + dom_test::OnLoadEnd(browser); + } +} + +void ClientHandler::OnLoadError(CefRefPtr browser, + CefRefPtr frame, + ErrorCode errorCode, + const CefString& errorText, + const CefString& failedUrl) { + REQUIRE_UI_THREAD(); + + // Don't display an error for downloaded files. + if (errorCode == ERR_ABORTED) + return; + + // Don't display an error for external protocols that we allow the OS to + // handle. See OnProtocolExecution(). + if (errorCode == ERR_UNKNOWN_URL_SCHEME) { + std::string urlStr = frame->GetURL(); + if (urlStr.find("spotify:") == 0) + return; + } + + // Display a load error message. + std::stringstream ss; + ss << "

    Failed to load URL " << std::string(failedUrl) << + " with error " << std::string(errorText) << " (" << errorCode << + ").

    "; + frame->LoadString(ss.str(), failedUrl); +} + +void ClientHandler::OnRenderProcessTerminated(CefRefPtr browser, + TerminationStatus status) { + // Load the startup URL if that's not the website that we terminated on. + CefRefPtr frame = browser->GetMainFrame(); + std::string url = frame->GetURL(); + std::transform(url.begin(), url.end(), url.begin(), tolower); + + std::string startupURL = GetStartupURL(); + if (url.find(startupURL) != 0) + frame->LoadURL(startupURL); +} + +CefRefPtr ClientHandler::GetResourceHandler( + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request) { + std::string url = request->GetURL(); + if (url == "http://tests/request") { + // Show the request contents + std::string dump; + DumpRequestContents(request, dump); + CefRefPtr stream = + CefStreamReader::CreateForData( + static_cast(const_cast(dump.c_str())), + dump.size()); + ASSERT(stream.get()); + return new CefStreamResourceHandler("text/plain", stream); + } else if (url == "http://tests/dialogs") { + // Show the dialogs contents + CefRefPtr stream = + GetBinaryResourceReader("dialogs.html"); + ASSERT(stream.get()); + return new CefStreamResourceHandler("text/html", stream); + } else if (url == dom_test::kTestUrl) { + // Show the domaccess contents + CefRefPtr stream = + GetBinaryResourceReader("domaccess.html"); + ASSERT(stream.get()); + return new CefStreamResourceHandler("text/html", stream); + } else if (url == "http://tests/localstorage") { + // Show the localstorage contents + CefRefPtr stream = + GetBinaryResourceReader("localstorage.html"); + ASSERT(stream.get()); + return new CefStreamResourceHandler("text/html", stream); + } else if (url == "http://tests/xmlhttprequest") { + // Show the xmlhttprequest contents + CefRefPtr stream = + GetBinaryResourceReader("xmlhttprequest.html"); + ASSERT(stream.get()); + return new CefStreamResourceHandler("text/html", stream); + } + + CefRefPtr handler; + + // Execute delegate callbacks. + RequestDelegateSet::iterator it = request_delegates_.begin(); + for (; it != request_delegates_.end() && !handler.get(); ++it) + handler = (*it)->GetResourceHandler(this, browser, frame, request); + + return handler; +} + +void ClientHandler::OnProtocolExecution(CefRefPtr browser, + const CefString& url, + bool& allow_os_execution) { + std::string urlStr = url; + + // Allow OS execution of Spotify URIs. + if (urlStr.find("spotify:") == 0) + allow_os_execution = true; +} + +void ClientHandler::SetMainHwnd(CefWindowHandle hwnd) { + AutoLock lock_scope(this); + m_MainHwnd = hwnd; +} + +void ClientHandler::SetEditHwnd(CefWindowHandle hwnd) { + AutoLock lock_scope(this); + m_EditHwnd = hwnd; +} + +void ClientHandler::SetButtonHwnds(CefWindowHandle backHwnd, + CefWindowHandle forwardHwnd, + CefWindowHandle reloadHwnd, + CefWindowHandle stopHwnd) { + AutoLock lock_scope(this); + m_BackHwnd = backHwnd; + m_ForwardHwnd = forwardHwnd; + m_ReloadHwnd = reloadHwnd; + m_StopHwnd = stopHwnd; +} + +std::string ClientHandler::GetLogFile() { + AutoLock lock_scope(this); + return m_LogFile; +} + +void ClientHandler::SetLastDownloadFile(const std::string& fileName) { + AutoLock lock_scope(this); + m_LastDownloadFile = fileName; +} + +std::string ClientHandler::GetLastDownloadFile() { + AutoLock lock_scope(this); + return m_LastDownloadFile; +} + +void ClientHandler::ShowDevTools(CefRefPtr browser) { + std::string devtools_url = browser->GetHost()->GetDevToolsURL(true); + if (!devtools_url.empty()) { + if (m_bExternalDevTools) { + // Open DevTools in an external browser window. + LaunchExternalBrowser(devtools_url); + } else if (m_OpenDevToolsURLs.find(devtools_url) == + m_OpenDevToolsURLs.end()) { + // Open DevTools in a popup window. + m_OpenDevToolsURLs.insert(devtools_url); + browser->GetMainFrame()->ExecuteJavaScript( + "window.open('" + devtools_url + "');", "about:blank", 0); + } + } +} + +// static +void ClientHandler::LaunchExternalBrowser(const std::string& url) { + if (CefCurrentlyOn(TID_PROCESS_LAUNCHER)) { + // Retrieve the current executable path. + CefString file_exe; + if (!CefGetPath(PK_FILE_EXE, file_exe)) + return; + + // Create the command line. + CefRefPtr command_line = + CefCommandLine::CreateCommandLine(); + command_line->SetProgram(file_exe); + command_line->AppendSwitchWithValue(cefclient::kUrl, url); + + // Launch the process. + CefLaunchProcess(command_line); + } else { + // Execute on the PROCESS_LAUNCHER thread. + CefPostTask(TID_PROCESS_LAUNCHER, + NewCefRunnableFunction(&ClientHandler::LaunchExternalBrowser, url)); + } +} + +// static +void ClientHandler::CreateProcessMessageDelegates( + ProcessMessageDelegateSet& delegates) { + // Create the binding test delegates. + binding_test::CreateProcessMessageDelegates(delegates); +} + +// static +void ClientHandler::CreateRequestDelegates(RequestDelegateSet& delegates) { + // Create the binding test delegates. + binding_test::CreateRequestDelegates(delegates); +} + +void ClientHandler::BuildTestMenu(CefRefPtr model) { + if (model->GetCount() > 0) + model->AddSeparator(); + + // Build the sub menu. + CefRefPtr submenu = + model->AddSubMenu(CLIENT_ID_TESTMENU_SUBMENU, "Context Menu Test"); + submenu->AddCheckItem(CLIENT_ID_TESTMENU_CHECKITEM, "Check Item"); + submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM1, "Radio Item 1", 0); + submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM2, "Radio Item 2", 0); + submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM3, "Radio Item 3", 0); + + // Check the check item. + if (m_TestMenuState.check_item) + submenu->SetChecked(CLIENT_ID_TESTMENU_CHECKITEM, true); + + // Check the selected radio item. + submenu->SetChecked( + CLIENT_ID_TESTMENU_RADIOITEM1 + m_TestMenuState.radio_item, true); +} + +bool ClientHandler::ExecuteTestMenu(int command_id) { + if (command_id == CLIENT_ID_TESTMENU_CHECKITEM) { + // Toggle the check item. + m_TestMenuState.check_item ^= 1; + return true; + } else if (command_id >= CLIENT_ID_TESTMENU_RADIOITEM1 && + command_id <= CLIENT_ID_TESTMENU_RADIOITEM3) { + // Store the selected radio item. + m_TestMenuState.radio_item = (command_id - CLIENT_ID_TESTMENU_RADIOITEM1); + return true; + } + + // Allow default handling to proceed. + return false; +} diff --git a/tests/cefclient/client_handler.h b/tests/cefclient/client_handler.h new file mode 100644 index 000000000..52c04e618 --- /dev/null +++ b/tests/cefclient/client_handler.h @@ -0,0 +1,283 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_ +#define CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_ +#pragma once + +#include +#include +#include +#include "include/cef_client.h" +#include "cefclient/util.h" + + +// Define this value to redirect all popup URLs to the main application browser +// window. +// #define TEST_REDIRECT_POPUP_URLS + + +// ClientHandler implementation. +class ClientHandler : public CefClient, + public CefContextMenuHandler, + public CefDisplayHandler, + public CefDownloadHandler, + public CefGeolocationHandler, + public CefKeyboardHandler, + public CefLifeSpanHandler, + public CefLoadHandler, + public CefRequestHandler { + public: + // Interface for process message delegates. Do not perform work in the + // RenderDelegate constructor. + class ProcessMessageDelegate : public virtual CefBase { + public: + // Called when a process message is received. Return true if the message was + // handled and should not be passed on to other handlers. + // ProcessMessageDelegates should check for unique message names to avoid + // interfering with each other. + virtual bool OnProcessMessageReceived( + CefRefPtr handler, + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) { + return false; + } + }; + + typedef std::set > + ProcessMessageDelegateSet; + + // Interface for request handler delegates. Do not perform work in the + // RequestDelegate constructor. + class RequestDelegate : public virtual CefBase { + public: + // Called to retrieve a resource handler. + virtual CefRefPtr GetResourceHandler( + CefRefPtr handler, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request) { + return NULL; + } + }; + + typedef std::set > RequestDelegateSet; + + ClientHandler(); + virtual ~ClientHandler(); + + // CefClient methods + virtual CefRefPtr GetContextMenuHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetDisplayHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetDownloadHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetGeolocationHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetKeyboardHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetLifeSpanHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetLoadHandler() OVERRIDE { + return this; + } + virtual CefRefPtr GetRequestHandler() OVERRIDE { + return this; + } + virtual bool OnProcessMessageReceived(CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) + OVERRIDE; + + // CefContextMenuHandler methods + virtual void OnBeforeContextMenu(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr params, + CefRefPtr model) OVERRIDE; + virtual bool OnContextMenuCommand(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr params, + int command_id, + EventFlags event_flags) OVERRIDE; + + // CefDisplayHandler methods + virtual void OnLoadingStateChange(CefRefPtr browser, + bool isLoading, + bool canGoBack, + bool canGoForward) OVERRIDE; + virtual void OnAddressChange(CefRefPtr browser, + CefRefPtr frame, + const CefString& url) OVERRIDE; + virtual void OnTitleChange(CefRefPtr browser, + const CefString& title) OVERRIDE; + virtual bool OnConsoleMessage(CefRefPtr browser, + const CefString& message, + const CefString& source, + int line) OVERRIDE; + + // CefDownloadHandler methods + virtual void OnBeforeDownload( + CefRefPtr browser, + CefRefPtr download_item, + const CefString& suggested_name, + CefRefPtr callback) OVERRIDE; + virtual void OnDownloadUpdated( + CefRefPtr browser, + CefRefPtr download_item, + CefRefPtr callback) OVERRIDE; + + // CefGeolocationHandler methods + virtual void OnRequestGeolocationPermission( + CefRefPtr browser, + const CefString& requesting_url, + int request_id, + CefRefPtr callback) OVERRIDE; + + // CefKeyboardHandler methods + virtual bool OnPreKeyEvent(CefRefPtr browser, + const CefKeyEvent& event, + CefEventHandle os_event, + bool* is_keyboard_shortcut) OVERRIDE; + + // CefLifeSpanHandler methods + virtual void OnAfterCreated(CefRefPtr browser) OVERRIDE; + virtual bool DoClose(CefRefPtr browser) OVERRIDE; + virtual void OnBeforeClose(CefRefPtr browser) OVERRIDE; + + // CefLoadHandler methods + virtual void OnLoadStart(CefRefPtr browser, + CefRefPtr frame) OVERRIDE; + virtual void OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) OVERRIDE; + virtual void OnLoadError(CefRefPtr browser, + CefRefPtr frame, + ErrorCode errorCode, + const CefString& errorText, + const CefString& failedUrl) OVERRIDE; + virtual void OnRenderProcessTerminated(CefRefPtr browser, + TerminationStatus status) OVERRIDE; + + // CefRequestHandler methods + virtual CefRefPtr GetResourceHandler( + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request) OVERRIDE; + virtual void OnProtocolExecution(CefRefPtr browser, + const CefString& url, + bool& allow_os_execution) OVERRIDE; + + void SetMainHwnd(CefWindowHandle hwnd); + CefWindowHandle GetMainHwnd() { return m_MainHwnd; } + void SetEditHwnd(CefWindowHandle hwnd); + void SetButtonHwnds(CefWindowHandle backHwnd, + CefWindowHandle forwardHwnd, + CefWindowHandle reloadHwnd, + CefWindowHandle stopHwnd); + + CefRefPtr GetBrowser() { return m_Browser; } + int GetBrowserId() { return m_BrowserId; } + + std::string GetLogFile(); + + void SetLastDownloadFile(const std::string& fileName); + std::string GetLastDownloadFile(); + + // Send a notification to the application. Notifications should not block the + // caller. + enum NotificationType { + NOTIFY_CONSOLE_MESSAGE, + NOTIFY_DOWNLOAD_COMPLETE, + NOTIFY_DOWNLOAD_ERROR, + }; + void SendNotification(NotificationType type); + void CloseMainWindow(); + + void ShowDevTools(CefRefPtr browser); + + // Returns the startup URL. + std::string GetStartupURL() { return m_StartupURL; } + + // Create an external browser window that loads the specified URL. + static void LaunchExternalBrowser(const std::string& url); + + protected: + void SetLoading(bool isLoading); + void SetNavState(bool canGoBack, bool canGoForward); + + // Create all of ProcessMessageDelegate objects. + static void CreateProcessMessageDelegates( + ProcessMessageDelegateSet& delegates); + + // Create all of RequestDelegateSet objects. + static void CreateRequestDelegates(RequestDelegateSet& delegates); + + // Test context menu creation. + void BuildTestMenu(CefRefPtr model); + bool ExecuteTestMenu(int command_id); + struct TestMenuState { + TestMenuState() : check_item(true), radio_item(0) {} + bool check_item; + int radio_item; + } m_TestMenuState; + + // Returns the full download path for the specified file, or an empty path to + // use the default temp directory. + std::string GetDownloadPath(const std::string& file_name); + + // The child browser window + CefRefPtr m_Browser; + + // The main frame window handle + CefWindowHandle m_MainHwnd; + + // The child browser id + int m_BrowserId; + + // The edit window handle + CefWindowHandle m_EditHwnd; + + // The button window handles + CefWindowHandle m_BackHwnd; + CefWindowHandle m_ForwardHwnd; + CefWindowHandle m_StopHwnd; + CefWindowHandle m_ReloadHwnd; + + // Support for logging. + std::string m_LogFile; + + // Support for downloading files. + std::string m_LastDownloadFile; + + // True if an editable field currently has focus. + bool m_bFocusOnEditableField; + + // Registered delegates. + ProcessMessageDelegateSet process_message_delegates_; + RequestDelegateSet request_delegates_; + + // If true DevTools will be opened in an external browser window. + bool m_bExternalDevTools; + + // List of open DevTools URLs if not using an external browser window. + std::set m_OpenDevToolsURLs; + + // The startup URL. + std::string m_StartupURL; + + // Include the default reference counting implementation. + IMPLEMENT_REFCOUNTING(ClientHandler); + // Include the default locking implementation. + IMPLEMENT_LOCKING(ClientHandler); +}; + +#endif // CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_ diff --git a/tests/cefclient/client_handler_gtk.cpp b/tests/cefclient/client_handler_gtk.cpp new file mode 100644 index 000000000..a35b04e61 --- /dev/null +++ b/tests/cefclient/client_handler_gtk.cpp @@ -0,0 +1,63 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include +#include +#include "cefclient/client_handler.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" + +void ClientHandler::OnAddressChange(CefRefPtr browser, + CefRefPtr frame, + const CefString& url) { + REQUIRE_UI_THREAD(); + + if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { + // Set the edit window text + std::string urlStr(url); + gtk_entry_set_text(GTK_ENTRY(m_EditHwnd), urlStr.c_str()); + } +} + +void ClientHandler::OnTitleChange(CefRefPtr browser, + const CefString& title) { + REQUIRE_UI_THREAD(); + + GtkWidget* window = gtk_widget_get_ancestor( + GTK_WIDGET(browser->GetHost()->GetWindowHandle()), + GTK_TYPE_WINDOW); + std::string titleStr(title); + gtk_window_set_title(GTK_WINDOW(window), titleStr.c_str()); +} + +void ClientHandler::SendNotification(NotificationType type) { + // TODO(port): Implement this method. +} + +void ClientHandler::SetLoading(bool isLoading) { + if (isLoading) + gtk_widget_set_sensitive(GTK_WIDGET(m_StopHwnd), true); + else + gtk_widget_set_sensitive(GTK_WIDGET(m_StopHwnd), false); +} + +void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) { + if (canGoBack) + gtk_widget_set_sensitive(GTK_WIDGET(m_BackHwnd), true); + else + gtk_widget_set_sensitive(GTK_WIDGET(m_BackHwnd), false); + + if (canGoForward) + gtk_widget_set_sensitive(GTK_WIDGET(m_ForwardHwnd), true); + else + gtk_widget_set_sensitive(GTK_WIDGET(m_ForwardHwnd), false); +} + +void ClientHandler::CloseMainWindow() { + // TODO(port): Close main window. +} + +std::string ClientHandler::GetDownloadPath(const std::string& file_name) { + return std::string(); +} diff --git a/tests/cefclient/client_handler_mac.mm b/tests/cefclient/client_handler_mac.mm new file mode 100644 index 000000000..fba1ddd2c --- /dev/null +++ b/tests/cefclient/client_handler_mac.mm @@ -0,0 +1,74 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#import + +#include "cefclient/client_handler.h" +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "cefclient/cefclient.h" + +void ClientHandler::OnAddressChange(CefRefPtr browser, + CefRefPtr frame, + const CefString& url) { + REQUIRE_UI_THREAD(); + + if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { + // Set the edit window text + NSTextField* textField = (NSTextField*)m_EditHwnd; + std::string urlStr(url); + NSString* str = [NSString stringWithUTF8String:urlStr.c_str()]; + [textField setStringValue:str]; + } +} + +void ClientHandler::OnTitleChange(CefRefPtr browser, + const CefString& title) { + REQUIRE_UI_THREAD(); + + // Set the frame window title bar + NSView* view = (NSView*)browser->GetHost()->GetWindowHandle(); + NSWindow* window = [view window]; + std::string titleStr(title); + NSString* str = [NSString stringWithUTF8String:titleStr.c_str()]; + [window setTitle:str]; +} + +void ClientHandler::SendNotification(NotificationType type) { + SEL sel = nil; + switch(type) { + case NOTIFY_CONSOLE_MESSAGE: + sel = @selector(notifyConsoleMessage:); + break; + case NOTIFY_DOWNLOAD_COMPLETE: + sel = @selector(notifyDownloadComplete:); + break; + case NOTIFY_DOWNLOAD_ERROR: + sel = @selector(notifyDownloadError:); + break; + } + + if (sel == nil) + return; + + NSWindow* window = [AppGetMainHwnd() window]; + NSObject* delegate = [window delegate]; + [delegate performSelectorOnMainThread:sel withObject:nil waitUntilDone:NO]; +} + +void ClientHandler::SetLoading(bool isLoading) { + // TODO(port): Change button status. +} + +void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) { + // TODO(port): Change button status. +} + +void ClientHandler::CloseMainWindow() { + // TODO(port): Close window +} + +std::string ClientHandler::GetDownloadPath(const std::string& file_name) { + return std::string(); +} diff --git a/tests/cefclient/client_handler_win.cpp b/tests/cefclient/client_handler_win.cpp new file mode 100644 index 000000000..fe9944255 --- /dev/null +++ b/tests/cefclient/client_handler_win.cpp @@ -0,0 +1,86 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/client_handler.h" + +#include +#include +#include + +#include "include/cef_browser.h" +#include "include/cef_frame.h" +#include "cefclient/resource.h" + +void ClientHandler::OnAddressChange(CefRefPtr browser, + CefRefPtr frame, + const CefString& url) { + REQUIRE_UI_THREAD(); + + if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) { + // Set the edit window text + SetWindowText(m_EditHwnd, std::wstring(url).c_str()); + } +} + +void ClientHandler::OnTitleChange(CefRefPtr browser, + const CefString& title) { + REQUIRE_UI_THREAD(); + + // Set the frame window title bar + CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle(); + if (m_BrowserId == browser->GetIdentifier()) { + // The frame window will be the parent of the browser window + hwnd = GetParent(hwnd); + } + SetWindowText(hwnd, std::wstring(title).c_str()); +} + +void ClientHandler::SendNotification(NotificationType type) { + UINT id; + switch (type) { + case NOTIFY_CONSOLE_MESSAGE: + id = ID_WARN_CONSOLEMESSAGE; + break; + case NOTIFY_DOWNLOAD_COMPLETE: + id = ID_WARN_DOWNLOADCOMPLETE; + break; + case NOTIFY_DOWNLOAD_ERROR: + id = ID_WARN_DOWNLOADERROR; + break; + default: + return; + } + PostMessage(m_MainHwnd, WM_COMMAND, id, 0); +} + +void ClientHandler::SetLoading(bool isLoading) { + ASSERT(m_EditHwnd != NULL && m_ReloadHwnd != NULL && m_StopHwnd != NULL); + EnableWindow(m_EditHwnd, TRUE); + EnableWindow(m_ReloadHwnd, !isLoading); + EnableWindow(m_StopHwnd, isLoading); +} + +void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) { + ASSERT(m_BackHwnd != NULL && m_ForwardHwnd != NULL); + EnableWindow(m_BackHwnd, canGoBack); + EnableWindow(m_ForwardHwnd, canGoForward); +} + +void ClientHandler::CloseMainWindow() { + ::PostMessage(m_MainHwnd, WM_CLOSE, 0, 0); +} + +std::string ClientHandler::GetDownloadPath(const std::string& file_name) { + TCHAR szFolderPath[MAX_PATH]; + std::string path; + + // Save the file in the user's "My Documents" folder. + if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, + NULL, 0, szFolderPath))) { + path = CefString(szFolderPath); + path += "\\" + file_name; + } + + return path; +} diff --git a/tests/cefclient/client_renderer.cpp b/tests/cefclient/client_renderer.cpp new file mode 100644 index 000000000..17b5a43f3 --- /dev/null +++ b/tests/cefclient/client_renderer.cpp @@ -0,0 +1,52 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/client_renderer.h" + +#include +#include + +#include "include/cef_dom.h" +#include "cefclient/util.h" + +namespace client_renderer { + +const char kFocusedNodeChangedMessage[] = "ClientRenderer.FocusedNodeChanged"; + +namespace { + +class ClientRenderDelegate : public ClientApp::RenderDelegate { + public: + ClientRenderDelegate() + : last_node_is_editable_(false) { + } + + virtual void OnFocusedNodeChanged(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr node) OVERRIDE { + bool is_editable = (node.get() && node->IsEditable()); + if (is_editable != last_node_is_editable_) { + // Notify the browser of the change in focused element type. + last_node_is_editable_ = is_editable; + CefRefPtr message = + CefProcessMessage::Create(kFocusedNodeChangedMessage); + message->GetArgumentList()->SetBool(0, is_editable); + browser->SendProcessMessage(PID_BROWSER, message); + } + } + + private: + bool last_node_is_editable_; + + IMPLEMENT_REFCOUNTING(ClientRenderDelegate); +}; + +} // namespace + +void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates) { + delegates.insert(new ClientRenderDelegate); +} + +} // namespace client_renderer diff --git a/tests/cefclient/client_renderer.h b/tests/cefclient/client_renderer.h new file mode 100644 index 000000000..37b08408d --- /dev/null +++ b/tests/cefclient/client_renderer.h @@ -0,0 +1,22 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_CLIENT_RENDERER_H_ +#define CEF_TESTS_CEFCLIENT_CLIENT_RENDERER_H_ +#pragma once + +#include "include/cef_base.h" +#include "cefclient/client_app.h" + +namespace client_renderer { + +// Message sent when the focused node changes. +extern const char kFocusedNodeChangedMessage[]; + +// Create the render delegate. +void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates); + +} // namespace client_renderer + +#endif // CEF_TESTS_CEFCLIENT_CLIENT_RENDERER_H_ diff --git a/tests/cefclient/client_switches.cpp b/tests/cefclient/client_switches.cpp new file mode 100644 index 000000000..a65f179f2 --- /dev/null +++ b/tests/cefclient/client_switches.cpp @@ -0,0 +1,71 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +// This file is shared by cefclient and cef_unittests so don't include using +// a qualified path. +#include "client_switches.h" // NOLINT(build/include) + +namespace cefclient { + +const char kUrl[] = "url"; +const char kExternalDevTools[] = "external-devtools"; + +// CefSettings attributes. +const char kMultiThreadedMessageLoop[] = "multi-threaded-message-loop"; +const char kCachePath[] = "cache-path"; + +// CefBrowserSettings attributes. +const char kRemoteFontsDisabled[] = "remote-fonts-disabled"; +const char kDefaultEncoding[] = "default-encoding"; +const char kEncodingDetectorEnabled[] = "encoding-detector-enabled"; +const char kJavascriptDisabled[] = "javascript-disabled"; +const char kJavascriptOpenWindowsDisallowed[] = + "javascript-open-windows-disallowed"; +const char kJavascriptCloseWindowsDisallowed[] = + "javascript-close-windows-disallowed"; +const char kJavascriptAccessClipboardDisallowed[] = + "javascript-access-clipboard-disallowed"; +const char kDomPasteDisabled[] = "dom-paste-disabled"; +const char kCaretBrowsingDisabled[] = "caret-browsing-enabled"; +const char kJavaDisabled[] = "java-disabled"; +const char kPluginsDisabled[] = "plugins-disabled"; +const char kUniversalAccessFromFileUrlsAllowed[] = + "universal-access-from-file-urls-allowed"; +const char kFileAccessFromFileUrlsAllowed[] = + "file-access-from-file-urls-allowed"; +const char kWebSecurityDisabled[] = "web-security-disabled"; +const char kXssAuditorEnabled[] = "xss-auditor-enabled"; +const char kImageLoadingDisabled[] = "image-load-disabled"; +const char kShrinkStandaloneImagesToFit[] = "shrink-standalone-images-to-fit"; +const char kSiteSpecificQuirksDisabled[] = "site-specific-quirks-disabled"; +const char kTextAreaResizeDisabled[] = "text-area-resize-disabled"; +const char kPageCacheDisabled[] = "page-cache-disabled"; +const char kTabToLinksDisabled[] = "tab-to-links-disabled"; +const char kHyperlinkAuditingDisabled[] = "hyperlink-auditing-disabled"; +const char kUserStyleSheetEnabled[] = "user-style-sheet-enabled"; +const char kUserStyleSheetLocation[] = "user-style-sheet-location"; +const char kAuthorAndUserStylesDisabled[] = "author-and-user-styles-disabled"; +const char kLocalStorageDisabled[] = "local-storage-disabled"; +const char kDatabasesDisabled[] = "databases-disabled"; +const char kApplicationCacheDisabled[] = "application-cache-disabled"; +const char kWebglDisabled[] = "webgl-disabled"; +const char kAcceleratedCompositingDisabled[] = + "accelerated-compositing-disabled"; +const char kAcceleratedLayersDisabled[] = "accelerated-layers-disabled"; +const char kAcceleratedVideoDisabled[] = "accelerated-video-disabled"; +const char kAcceledated2dCanvasDisabled[] = "accelerated-2d-canvas-disabled"; +const char kAcceleratedPaintingEnabled[] = "accelerated-painting-enabled"; +const char kAcceleratedFiltersEnabled[] = "accelerated-filters-enabled"; +const char kAcceleratedPluginsDisabled[] = "accelerated-plugins-disabled"; +const char kDeveloperToolsDisabled[] = "developer-tools-disabled"; +const char kFullscreenEnabled[] = "fullscreen-enabled"; + +// Other attributes. +const char kProxyType[] = "proxy-type"; +const char kProxyType_Direct[] = "direct"; +const char kProxyType_Named[] = "named"; +const char kProxyType_Pac[] = "pac"; +const char kProxyConfig[] = "proxy-config"; + +} // namespace cefclient diff --git a/tests/cefclient/client_switches.h b/tests/cefclient/client_switches.h new file mode 100644 index 000000000..8a9751721 --- /dev/null +++ b/tests/cefclient/client_switches.h @@ -0,0 +1,69 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +// Defines all of the command line switches used by cefclient. + +#ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_ +#define CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_ +#pragma once + +namespace cefclient { + +extern const char kUrl[]; +extern const char kExternalDevTools[]; + +// CefSettings attributes. +extern const char kMultiThreadedMessageLoop[]; +extern const char kCachePath[]; + +// CefBrowserSettings attributes. +extern const char kRemoteFontsDisabled[]; +extern const char kDefaultEncoding[]; +extern const char kEncodingDetectorEnabled[]; +extern const char kJavascriptDisabled[]; +extern const char kJavascriptOpenWindowsDisallowed[]; +extern const char kJavascriptCloseWindowsDisallowed[]; +extern const char kJavascriptAccessClipboardDisallowed[]; +extern const char kDomPasteDisabled[]; +extern const char kCaretBrowsingDisabled[]; +extern const char kJavaDisabled[]; +extern const char kPluginsDisabled[]; +extern const char kUniversalAccessFromFileUrlsAllowed[]; +extern const char kFileAccessFromFileUrlsAllowed[]; +extern const char kWebSecurityDisabled[]; +extern const char kXssAuditorEnabled[]; +extern const char kImageLoadingDisabled[]; +extern const char kShrinkStandaloneImagesToFit[]; +extern const char kSiteSpecificQuirksDisabled[]; +extern const char kTextAreaResizeDisabled[]; +extern const char kPageCacheDisabled[]; +extern const char kTabToLinksDisabled[]; +extern const char kHyperlinkAuditingDisabled[]; +extern const char kUserStyleSheetEnabled[]; +extern const char kUserStyleSheetLocation[]; +extern const char kAuthorAndUserStylesDisabled[]; +extern const char kLocalStorageDisabled[]; +extern const char kDatabasesDisabled[]; +extern const char kApplicationCacheDisabled[]; +extern const char kWebglDisabled[]; +extern const char kAcceleratedCompositingDisabled[]; +extern const char kAcceleratedLayersDisabled[]; +extern const char kAcceleratedVideoDisabled[]; +extern const char kAcceledated2dCanvasDisabled[]; +extern const char kAcceleratedPaintingEnabled[]; +extern const char kAcceleratedFiltersEnabled[]; +extern const char kAcceleratedPluginsDisabled[]; +extern const char kDeveloperToolsDisabled[]; +extern const char kFullscreenEnabled[]; + +// Other attributes. +extern const char kProxyType[]; +extern const char kProxyType_Direct[]; +extern const char kProxyType_Named[]; +extern const char kProxyType_Pac[]; +extern const char kProxyConfig[]; + +} // namespace cefclient + +#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_ diff --git a/tests/cefclient/dom_test.cpp b/tests/cefclient/dom_test.cpp new file mode 100644 index 000000000..5002d6394 --- /dev/null +++ b/tests/cefclient/dom_test.cpp @@ -0,0 +1,139 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/dom_test.h" + +#include +#include + +#include "include/cef_dom.h" +#include "cefclient/util.h" + +namespace dom_test { + +const char kTestUrl[] = "http://tests/domaccess"; + +namespace { + +const char* kMessageName = "DOMTest.Message"; + +class ClientDOMEventListener : public CefDOMEventListener { + public: + ClientDOMEventListener() { + } + + virtual void HandleEvent(CefRefPtr event) OVERRIDE { + CefRefPtr document = event->GetDocument(); + ASSERT(document.get()); + + std::stringstream ss; + + CefRefPtr button = event->GetTarget(); + ASSERT(button.get()); + std::string buttonValue = button->GetElementAttribute("value"); + ss << "You clicked the " << buttonValue.c_str() << " button. "; + + if (document->HasSelection()) { + std::string startName, endName; + + // Determine the start name by first trying to locate the "id" attribute + // and then defaulting to the tag name. + { + CefRefPtr node = document->GetSelectionStartNode(); + if (!node->IsElement()) + node = node->GetParent(); + if (node->IsElement() && node->HasElementAttribute("id")) + startName = node->GetElementAttribute("id"); + else + startName = node->GetName(); + } + + // Determine the end name by first trying to locate the "id" attribute + // and then defaulting to the tag name. + { + CefRefPtr node = document->GetSelectionEndNode(); + if (!node->IsElement()) + node = node->GetParent(); + if (node->IsElement() && node->HasElementAttribute("id")) + endName = node->GetElementAttribute("id"); + else + endName = node->GetName(); + } + + ss << "The selection is from " << + startName.c_str() << ":" << document->GetSelectionStartOffset() << + " to " << + endName.c_str() << ":" << document->GetSelectionEndOffset(); + } else { + ss << "Nothing is selected."; + } + + // Update the description. + CefRefPtr desc = document->GetElementById("description"); + ASSERT(desc.get()); + CefRefPtr text = desc->GetFirstChild(); + ASSERT(text.get()); + ASSERT(text->IsText()); + text->SetValue(ss.str()); + } + + IMPLEMENT_REFCOUNTING(ClientDOMEventListener); +}; + +class ClientDOMVisitor : public CefDOMVisitor { + public: + ClientDOMVisitor() { + } + + virtual void Visit(CefRefPtr document) OVERRIDE { + // Register a click listener for the button. + CefRefPtr button = document->GetElementById("button"); + ASSERT(button.get()); + button->AddEventListener("click", new ClientDOMEventListener(), false); + } + + IMPLEMENT_REFCOUNTING(ClientDOMVisitor); +}; + +class DOMRenderDelegate : public ClientApp::RenderDelegate { + public: + DOMRenderDelegate() { + } + + virtual bool OnProcessMessageReceived( + CefRefPtr app, + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) OVERRIDE { + if (message->GetName() == kMessageName) { + // Visit the DOM to attach the event listener. + browser->GetMainFrame()->VisitDOM(new ClientDOMVisitor); + return true; + } + + return false; + } + + private: + IMPLEMENT_REFCOUNTING(DOMRenderDelegate); +}; + +} // namespace + +void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates) { + delegates.insert(new DOMRenderDelegate); +} + +void RunTest(CefRefPtr browser) { + // Load the test URL. + browser->GetMainFrame()->LoadURL(kTestUrl); +} + +void OnLoadEnd(CefRefPtr browser) { + // Send a message to the render process to continue the test setup. + browser->SendProcessMessage(PID_RENDERER, + CefProcessMessage::Create(kMessageName)); +} + +} // namespace dom_test diff --git a/tests/cefclient/dom_test.h b/tests/cefclient/dom_test.h new file mode 100644 index 000000000..0bcee1749 --- /dev/null +++ b/tests/cefclient/dom_test.h @@ -0,0 +1,28 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_DOM_TEST_H_ +#define CEF_TESTS_CEFCLIENT_DOM_TEST_H_ +#pragma once + +#include "include/cef_base.h" +#include "cefclient/client_app.h" + +namespace dom_test { + +// The DOM test URL. +extern const char kTestUrl[]; + +// Create the render delegate. +void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates); + +// Run the test. +void RunTest(CefRefPtr browser); + +// Continue the test after the page has loaded. +void OnLoadEnd(CefRefPtr browser); + +} // namespace dom_test + +#endif // CEF_TESTS_CEFCLIENT_DOM_TEST_H_ diff --git a/tests/cefclient/mac/English.lproj/InfoPlist.strings b/tests/cefclient/mac/English.lproj/InfoPlist.strings new file mode 100644 index 000000000..fe2abe11b --- /dev/null +++ b/tests/cefclient/mac/English.lproj/InfoPlist.strings @@ -0,0 +1,3 @@ +/* Localized versions of Info.plist keys */ + +NSHumanReadableCopyright = "© Chromium Embedded Framework Authors, 2010"; diff --git a/tests/cefclient/mac/English.lproj/MainMenu.xib b/tests/cefclient/mac/English.lproj/MainMenu.xib new file mode 100644 index 000000000..e4f7c1fc3 --- /dev/null +++ b/tests/cefclient/mac/English.lproj/MainMenu.xib @@ -0,0 +1,2880 @@ + + + + 1050 + 10F569 + 820 + 1038.29 + 461.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 820 + + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + cefclient + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + TestShell + + YES + + + About cefclient + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide cefclient + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit cefclient + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + Save As… + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + Show Spelling… + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 1048576 + 2147483647 + + + submenuAction: + + Format + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Show Colors + C + 1179648 + 2147483647 + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + cefclient Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + YES + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + orderFrontColorPanel: + + + + 361 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + terminate: + + + + 369 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + + YES + + 0 + + YES + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 299 + + + YES + + + + + + 300 + + + YES + + + + + + + 344 + + + + + 345 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 389 + + + + + + + YES + + YES + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBEditorWindowLastContentRect + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBEditorWindowLastContentRect + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBEditorWindowLastContentRect + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBEditorWindowLastContentRect + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBEditorWindowLastContentRect + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBEditorWindowLastContentRect + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBEditorWindowLastContentRect + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 299.IBPluginDependency + 300.IBEditorWindowLastContentRect + 300.IBPluginDependency + 300.editorWindowContentRectSynchronizationRect + 344.IBPluginDependency + 345.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBEditorWindowLastContentRect + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 389.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + {{906, 713}, {164, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{375, 955}, {171, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{915, 473}, {272, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{675, 493}, {240, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{144, 735}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{915, 473}, {164, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{915, 473}, {238, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{835, 663}, {194, 73}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{304, 905}, {197, 73}} + {{541, 736}, {426, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{6, 836}, {430, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + {{785, 693}, {231, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + {{254, 935}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{719, 693}, {173, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + {{188, 935}, {176, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{915, 473}, {212, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{553, 553}, {193, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{18, 653}, {200, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{633, 533}, {196, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{102, 775}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + + YES + + + + + YES + + + YES + + + + 439 + + + + YES + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSBrowser + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSBrowser.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSController + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSController.h + + + + NSDocument + NSObject + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + id + id + id + id + id + id + + + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + + printDocument: + id + + + revertDocumentToSaved: + id + + + runPageLayout: + id + + + saveDocument: + id + + + saveDocumentAs: + id + + + saveDocumentTo: + id + + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocument.h + + + + NSDocument + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentScripting.h + + + + NSDocumentController + NSObject + + YES + + YES + clearRecentDocuments: + newDocument: + openDocument: + saveAllDocuments: + + + YES + id + id + id + id + + + + YES + + YES + clearRecentDocuments: + newDocument: + openDocument: + saveAllDocuments: + + + YES + + clearRecentDocuments: + id + + + newDocument: + id + + + openDocument: + id + + + saveAllDocuments: + id + + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentController.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMatrix + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSMatrix.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSMenuItem + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSMovieView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMovieView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAlert.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAnimation.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSComboBox.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSComboBoxCell.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDatePickerCell.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSImage.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSRuleEditor.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSound.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSpeechRecognizer.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSpeechSynthesizer.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSplitView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTabView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTextStorage.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTextView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTokenField.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTokenFieldCell.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbar.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSMetadata.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSNetServices.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPort.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSSpellServer.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSStream.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSXMLParser.h + + + + NSObject + + IBFrameworkSource + Print.framework/Headers/PDEPluginInterface.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CIImageProvider.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTableView + NSControl + + + + NSText + NSView + + + + NSUserDefaultsController + NSController + + IBFrameworkSource + AppKit.framework/Headers/NSUserDefaultsController.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + + + NSWindow + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../../../../cef.xcodeproj + 3 + + YES + + YES + NSMenuCheckmark + NSMenuMixedState + + + YES + {9, 8} + {7, 2} + + + + diff --git a/tests/cefclient/mac/Info.plist b/tests/cefclient/mac/Info.plist new file mode 100644 index 000000000..83c535e41 --- /dev/null +++ b/tests/cefclient/mac/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + cefclient.icns + CFBundleIdentifier + org.cef.cefclient + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/tests/cefclient/mac/cefclient.icns b/tests/cefclient/mac/cefclient.icns new file mode 100644 index 000000000..f36742de2 Binary files /dev/null and b/tests/cefclient/mac/cefclient.icns differ diff --git a/tests/cefclient/mac/helper-Info.plist b/tests/cefclient/mac/helper-Info.plist new file mode 100644 index 000000000..ed5abfae9 --- /dev/null +++ b/tests/cefclient/mac/helper-Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${EXECUTABLE_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + org.cef.cefclient.helper + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + LSFileQuarantineEnabled + + LSMinimumSystemVersion + 10.5.0 + LSUIElement + 1 + NSSupportsAutomaticGraphicsSwitching + + + diff --git a/tests/cefclient/process_helper_mac.cpp b/tests/cefclient/process_helper_mac.cpp new file mode 100644 index 000000000..7354b036a --- /dev/null +++ b/tests/cefclient/process_helper_mac.cpp @@ -0,0 +1,27 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "include/cef_app.h" + +// This file is shared by cefclient and cef_unittests so don't include using +// a qualified path. +#include "client_app.h" // NOLINT(build/include) + +// Stub implementations. +std::string AppGetWorkingDirectory() { + return std::string(); +} +CefWindowHandle AppGetMainHwnd() { + return NULL; +} + +// Process entry point. +int main(int argc, char* argv[]) { + CefMainArgs main_args(argc, argv); + + CefRefPtr app(new ClientApp); + + // Execute the secondary process. + return CefExecuteProcess(main_args, app); +} diff --git a/tests/cefclient/res/binding.html b/tests/cefclient/res/binding.html new file mode 100644 index 000000000..edb1f4a00 --- /dev/null +++ b/tests/cefclient/res/binding.html @@ -0,0 +1,27 @@ + + +Binding Test + + + + +
    +Message: +
    +
    You should see the reverse of your message below: +
    +
    + + diff --git a/tests/cefclient/res/cefclient.ico b/tests/cefclient/res/cefclient.ico new file mode 100644 index 000000000..d551aa3aa Binary files /dev/null and b/tests/cefclient/res/cefclient.ico differ diff --git a/tests/cefclient/res/dialogs.html b/tests/cefclient/res/dialogs.html new file mode 100644 index 000000000..1bce8e475 --- /dev/null +++ b/tests/cefclient/res/dialogs.html @@ -0,0 +1,45 @@ + + +Dialog Test + + + +
    +Click a button to show the associated dialog type. +
    +
    +
    +

    +
    + + diff --git a/tests/cefclient/res/domaccess.html b/tests/cefclient/res/domaccess.html new file mode 100644 index 000000000..68ff69647 --- /dev/null +++ b/tests/cefclient/res/domaccess.html @@ -0,0 +1,13 @@ + + +

    Select some portion of the below page content and click the "Describe Selection" button. The selected region will then be described below.

    +

    This is p1

    +

    This is p2

    +

    This is p3

    +

    This is p4

    +
    + +

    The description will appear here.

    +
    + + diff --git a/tests/cefclient/res/localstorage.html b/tests/cefclient/res/localstorage.html new file mode 100644 index 000000000..a794305b7 --- /dev/null +++ b/tests/cefclient/res/localstorage.html @@ -0,0 +1,24 @@ + + + +Click the "Add Line" button to add a line or the "Clear" button to clear.
    +This data will persist across sessions if a cache path was specified.
    + + +
    + + + diff --git a/tests/cefclient/res/logo.png b/tests/cefclient/res/logo.png new file mode 100644 index 000000000..41dd728df Binary files /dev/null and b/tests/cefclient/res/logo.png differ diff --git a/tests/cefclient/res/logoball.png b/tests/cefclient/res/logoball.png new file mode 100644 index 000000000..ef115ca07 Binary files /dev/null and b/tests/cefclient/res/logoball.png differ diff --git a/tests/cefclient/res/small.ico b/tests/cefclient/res/small.ico new file mode 100644 index 000000000..d551aa3aa Binary files /dev/null and b/tests/cefclient/res/small.ico differ diff --git a/tests/cefclient/res/xmlhttprequest.html b/tests/cefclient/res/xmlhttprequest.html new file mode 100644 index 000000000..638c63c82 --- /dev/null +++ b/tests/cefclient/res/xmlhttprequest.html @@ -0,0 +1,19 @@ + + + +
    +URL: +
    +
    +
    + + diff --git a/tests/cefclient/resource.h b/tests/cefclient/resource.h new file mode 100644 index 000000000..dd6988e3b --- /dev/null +++ b/tests/cefclient/resource.h @@ -0,0 +1,69 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by cefclient.rc +// +#define BINARY 256 +#define IDC_MYICON 2 +#define IDD_CEFCLIENT_DIALOG 102 +#define IDS_APP_TITLE 103 +#define IDD_ABOUTBOX 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDI_CEFCLIENT 107 +#define IDI_SMALL 108 +#define IDC_CEFCLIENT 109 +#define IDR_MAINFRAME 128 +#define IDC_NAV_BACK 200 +#define IDC_NAV_FORWARD 201 +#define IDC_NAV_RELOAD 202 +#define IDC_NAV_STOP 203 +#define ID_WARN_CONSOLEMESSAGE 32000 +#define ID_WARN_DOWNLOADCOMPLETE 32001 +#define ID_WARN_DOWNLOADERROR 32002 +#define ID_TESTS_GETSOURCE 32760 +#define ID_TESTS_GETTEXT 32761 +#define ID_TESTS_POPUP 32762 +#define ID_TESTS_REQUEST 32763 +#define ID_TESTS_SCHEME_HANDLER 32764 +#define ID_TESTS_LOCALSTORAGE 32765 +#define ID_TESTS_ACCELERATED2DCANVAS 32766 +#define ID_TESTS_ACCELERATEDLAYERS 32767 +#define ID_TESTS_WEBGL 32768 +#define ID_TESTS_HTML5VIDEO 32769 +#define ID_TESTS_XMLHTTPREQUEST 32770 +#define ID_TESTS_DRAGDROP 32771 +#define ID_TESTS_GEOLOCATION 32772 +#define ID_TESTS_BINDING 32773 +#define ID_TESTS_DIALOGS 32774 +#define ID_TESTS_PLUGIN_INFO 32775 +#define ID_TESTS_DOM_ACCESS 32776 +#define ID_TESTS_ZOOM_IN 32777 +#define ID_TESTS_ZOOM_OUT 32778 +#define ID_TESTS_ZOOM_RESET 32779 +#define IDC_STATIC -1 +#define IDS_BINDING 1000 +#define IDS_DIALOGS 1001 +#define IDS_LOGO 1002 +#define IDS_LOGOBALL 1003 +#define IDS_LOCALSTORAGE 1004 +#define IDS_XMLHTTPREQUEST 1005 +#define IDS_DOMACCESS 1006 + +// Avoid files associated with MacOS +#define _X86_ + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 130 +#define _APS_NEXT_COMMAND_VALUE 32774 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/tests/cefclient/resource_util.h b/tests/cefclient/resource_util.h new file mode 100644 index 000000000..c382196f4 --- /dev/null +++ b/tests/cefclient/resource_util.h @@ -0,0 +1,32 @@ +// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_ +#define CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_ +#pragma once + +#include "include/cef_base.h" + +class CefStreamReader; + +#if defined(OS_WIN) + +#include "cefclient/resource.h" + +// Load a resource of type BINARY +bool LoadBinaryResource(int binaryId, DWORD &dwSize, LPBYTE &pBytes); +CefRefPtr GetBinaryResourceReader(int binaryId); + +#elif defined(OS_MACOSX) || defined(OS_POSIX) + +#include // NOLINT(build/include_order) + +// Load the resource with the specified name. +bool LoadBinaryResource(const char* resource_name, std::string& resource_data); + +#endif + +CefRefPtr GetBinaryResourceReader(const char* resource_name); + +#endif // CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_ diff --git a/tests/cefclient/resource_util_linux.cpp b/tests/cefclient/resource_util_linux.cpp new file mode 100644 index 000000000..66b46267d --- /dev/null +++ b/tests/cefclient/resource_util_linux.cpp @@ -0,0 +1,67 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "cefclient/resource_util.h" +#include +#include +#include "include/cef_stream.h" +#include "cefclient/util.h" + +bool GetResourceDir(std::string& dir) { + char buff[1024]; + + // Retrieve the executable path. + ssize_t len = readlink("/proc/self/exe", buff, sizeof(buff)-1); + if (len == -1) + return false; + + buff[len] = 0; + + // Remove the executable name from the path. + char* pos = strrchr(buff, '/'); + if (!pos) + return false; + + // Add "files" to the path. + strcpy(pos+1, "files"); // NOLINT(runtime/printf) + dir = std::string(buff); + return true; +} + +bool LoadBinaryResource(const char* resource_name, std::string& resource_data) { + std::string path; + if (!GetResourceDir(path)) + return false; + + path.append("/"); + path.append(resource_name); + + FILE* f = fopen(path.c_str(), "rb"); + if (!f) + return false; + + size_t bytes_read; + char buff[1024*8]; + + do { + bytes_read = fread(buff, 1, sizeof(buff)-1, f); + if (bytes_read > 0) + resource_data.append(buff, bytes_read); + } while (bytes_read > 0); + + fclose(f); + return true; +} + +CefRefPtr GetBinaryResourceReader(const char* resource_name) { + std::string path; + if (!GetResourceDir(path)) + return NULL; + + path.append("/"); + path.append(resource_name); + + return CefStreamReader::CreateForFile(path); +} diff --git a/tests/cefclient/resource_util_mac.mm b/tests/cefclient/resource_util_mac.mm new file mode 100644 index 000000000..98cfd8605 --- /dev/null +++ b/tests/cefclient/resource_util_mac.mm @@ -0,0 +1,97 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import +#include +#include +#include "cefclient/resource_util.h" +#include "include/cef_stream.h" +#include "cefclient/util.h" + +namespace { + +bool AmIBundled() { + // Implementation adapted from Chromium's base/mac/foundation_util.mm + ProcessSerialNumber psn = {0, kCurrentProcess}; + + FSRef fsref; + OSStatus pbErr; + if ((pbErr = GetProcessBundleLocation(&psn, &fsref)) != noErr) { + ASSERT(false); + return false; + } + + FSCatalogInfo info; + OSErr fsErr; + if ((fsErr = FSGetCatalogInfo(&fsref, kFSCatInfoNodeFlags, &info, + NULL, NULL, NULL)) != noErr) { + ASSERT(false); + return false; + } + + return (info.nodeFlags & kFSNodeIsDirectoryMask); +} + +bool GetResourceDir(std::string& dir) { + // Implementation adapted from Chromium's base/base_path_mac.mm + if (AmIBundled()) { + // Retrieve the executable directory. + uint32_t pathSize = 0; + _NSGetExecutablePath(NULL, &pathSize); + if (pathSize > 0) { + dir.resize(pathSize); + _NSGetExecutablePath(const_cast(dir.c_str()), &pathSize); + } + + // Trim executable name up to the last separator + std::string::size_type last_separator = dir.find_last_of("/"); + dir.resize(last_separator); + dir.append("/../Resources"); + return true; + } else { + // TODO: Provide unbundled path + ASSERT(false); + return false; + } +} + +bool ReadFileToString(const char* path, std::string& data) { + // Implementation adapted from base/file_util.cc + FILE* file = fopen(path, "rb"); + if (!file) + return false; + + char buf[1 << 16]; + size_t len; + while ((len = fread(buf, 1, sizeof(buf), file)) > 0) + data.append(buf, len); + fclose(file); + + return true; +} + +} // namespace + +bool LoadBinaryResource(const char* resource_name, std::string& resource_data) { + std::string path; + if (!GetResourceDir(path)) + return false; + + path.append("/"); + path.append(resource_name); + + return ReadFileToString(path.c_str(), resource_data); +} + +CefRefPtr GetBinaryResourceReader(const char* resource_name) { + std::string path; + if (!GetResourceDir(path)) + return NULL; + + path.append("/"); + path.append(resource_name); + + return CefStreamReader::CreateForFile(path); +} diff --git a/tests/cefclient/resource_util_win.cpp b/tests/cefclient/resource_util_win.cpp new file mode 100644 index 000000000..8482ac954 --- /dev/null +++ b/tests/cefclient/resource_util_win.cpp @@ -0,0 +1,64 @@ +// Copyright (c) 2008-2009 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/resource_util.h" +#include "include/cef_stream.h" +#include "include/wrapper/cef_byte_read_handler.h" +#include "cefclient/util.h" + +#if defined(OS_WIN) + +bool LoadBinaryResource(int binaryId, DWORD &dwSize, LPBYTE &pBytes) { + extern HINSTANCE hInst; + HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(binaryId), + MAKEINTRESOURCE(256)); + if (hRes) { + HGLOBAL hGlob = LoadResource(hInst, hRes); + if (hGlob) { + dwSize = SizeofResource(hInst, hRes); + pBytes = (LPBYTE)LockResource(hGlob); + if (dwSize > 0 && pBytes) + return true; + } + } + + return false; +} + +CefRefPtr GetBinaryResourceReader(int binaryId) { + DWORD dwSize; + LPBYTE pBytes; + + if (LoadBinaryResource(binaryId, dwSize, pBytes)) { + return CefStreamReader::CreateForHandler( + new CefByteReadHandler(pBytes, dwSize, NULL)); + } + + ASSERT(FALSE); // The resource should be found. + return NULL; +} + +CefRefPtr GetBinaryResourceReader(const char* resource_name) { + // Map of resource labels to BINARY id values. + static struct _resource_map { + char* name; + int id; + } resource_map[] = { + {"binding.html", IDS_BINDING}, + {"dialogs.html", IDS_DIALOGS}, + {"domaccess.html", IDS_DOMACCESS}, + {"localstorage.html", IDS_LOCALSTORAGE}, + {"xmlhttprequest.html", IDS_XMLHTTPREQUEST}, + }; + + for (int i = 0; i < sizeof(resource_map)/sizeof(_resource_map); ++i) { + if (!strcmp(resource_map[i].name, resource_name)) + return GetBinaryResourceReader(resource_map[i].id); + } + + ASSERT(FALSE); // The resource should be found. + return NULL; +} + +#endif // OS_WIN diff --git a/tests/cefclient/scheme_test.cpp b/tests/cefclient/scheme_test.cpp new file mode 100644 index 000000000..ee33a4389 --- /dev/null +++ b/tests/cefclient/scheme_test.cpp @@ -0,0 +1,182 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/scheme_test.h" +#include +#include +#include "include/cef_browser.h" +#include "include/cef_callback.h" +#include "include/cef_frame.h" +#include "include/cef_resource_handler.h" +#include "include/cef_response.h" +#include "include/cef_request.h" +#include "include/cef_scheme.h" +#include "cefclient/resource_util.h" +#include "cefclient/string_util.h" +#include "cefclient/util.h" + +#if defined(OS_WIN) +#include "cefclient/resource.h" +#endif + +namespace scheme_test { + +namespace { + +// Implementation of the schema handler for client:// requests. +class ClientSchemeHandler : public CefResourceHandler { + public: + ClientSchemeHandler() : offset_(0) {} + + virtual bool ProcessRequest(CefRefPtr request, + CefRefPtr callback) + OVERRIDE { + REQUIRE_IO_THREAD(); + + bool handled = false; + + AutoLock lock_scope(this); + + std::string url = request->GetURL(); + if (strstr(url.c_str(), "handler.html") != NULL) { + // Build the response html + data_ = "Client Scheme Handler" + "This contents of this page page are served by the " + "ClientSchemeHandler class handling the client:// protocol." + "
    You should see an image:" + "
    ";
    +
    +      // Output a string representation of the request
    +      std::string dump;
    +      DumpRequestContents(request, dump);
    +      data_.append(dump);
    +
    +      data_.append("

    Try the test form:" + "
    " + "" + "" + "" + "
    "); + + handled = true; + + // Set the resulting mime type + mime_type_ = "text/html"; + } else if (strstr(url.c_str(), "client.png") != NULL) { + // Load the response image +#if defined(OS_WIN) + DWORD dwSize; + LPBYTE pBytes; + if (LoadBinaryResource(IDS_LOGO, dwSize, pBytes)) { + data_ = std::string(reinterpret_cast(pBytes), dwSize); + handled = true; + // Set the resulting mime type + mime_type_ = "image/jpg"; + } +#elif defined(OS_MACOSX) || defined(OS_LINUX) + if (LoadBinaryResource("logo.png", data_)) { + handled = true; + // Set the resulting mime type + mime_type_ = "image/png"; + } +#else +#error "Unsupported platform" +#endif + } + + if (handled) { + // Indicate the headers are available. + callback->Continue(); + return true; + } + + return false; + } + + virtual void GetResponseHeaders(CefRefPtr response, + int64& response_length, + CefString& redirectUrl) OVERRIDE { + REQUIRE_IO_THREAD(); + + ASSERT(!data_.empty()); + + response->SetMimeType(mime_type_); + response->SetStatus(200); + + // Set the resulting response length + response_length = data_.length(); + } + + virtual void Cancel() OVERRIDE { + REQUIRE_IO_THREAD(); + } + + virtual bool ReadResponse(void* data_out, + int bytes_to_read, + int& bytes_read, + CefRefPtr callback) + OVERRIDE { + REQUIRE_IO_THREAD(); + + bool has_data = false; + bytes_read = 0; + + AutoLock lock_scope(this); + + if (offset_ < data_.length()) { + // Copy the next block of data into the buffer. + int transfer_size = + std::min(bytes_to_read, static_cast(data_.length() - offset_)); + memcpy(data_out, data_.c_str() + offset_, transfer_size); + offset_ += transfer_size; + + bytes_read = transfer_size; + has_data = true; + } + + return has_data; + } + + private: + std::string data_; + std::string mime_type_; + size_t offset_; + + IMPLEMENT_REFCOUNTING(ClientSchemeHandler); + IMPLEMENT_LOCKING(ClientSchemeHandler); +}; + +// Implementation of the factory for for creating schema handlers. +class ClientSchemeHandlerFactory : public CefSchemeHandlerFactory { + public: + // Return a new scheme handler instance to handle the request. + virtual CefRefPtr Create(CefRefPtr browser, + CefRefPtr frame, + const CefString& scheme_name, + CefRefPtr request) + OVERRIDE { + REQUIRE_IO_THREAD(); + return new ClientSchemeHandler(); + } + + IMPLEMENT_REFCOUNTING(ClientSchemeHandlerFactory); +}; + +} // namespace + +void RegisterCustomSchemes(CefRefPtr registrar, + std::vector& cookiable_schemes) { + registrar->AddCustomScheme("client", true, false, false); +} + +void InitTest() { + CefRegisterSchemeHandlerFactory("client", "tests", + new ClientSchemeHandlerFactory()); +} + +void RunTest(CefRefPtr browser) { + browser->GetMainFrame()->LoadURL("client://tests/handler.html"); +} + +} // namespace scheme_test diff --git a/tests/cefclient/scheme_test.h b/tests/cefclient/scheme_test.h new file mode 100644 index 000000000..724843a92 --- /dev/null +++ b/tests/cefclient/scheme_test.h @@ -0,0 +1,29 @@ +// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_ +#define CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_ +#pragma once + +#include +#include "include/cef_base.h" + +class CefBrowser; +class CefSchemeRegistrar; + +namespace scheme_test { + +// Register the scheme. +void RegisterCustomSchemes(CefRefPtr registrar, + std::vector& cookiable_schemes); + +// Create the scheme handler. +void InitTest(); + +// Run the test. +void RunTest(CefRefPtr browser); + +} // namespace scheme_test + +#endif // CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_ diff --git a/tests/cefclient/string_util.cpp b/tests/cefclient/string_util.cpp new file mode 100644 index 000000000..ebeca5c03 --- /dev/null +++ b/tests/cefclient/string_util.cpp @@ -0,0 +1,74 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "cefclient/string_util.h" +#include +#include +#include "include/cef_request.h" + +void DumpRequestContents(CefRefPtr request, std::string& str) { + std::stringstream ss; + + ss << "URL: " << std::string(request->GetURL()); + ss << "\nMethod: " << std::string(request->GetMethod()); + + CefRequest::HeaderMap headerMap; + request->GetHeaderMap(headerMap); + if (headerMap.size() > 0) { + ss << "\nHeaders:"; + CefRequest::HeaderMap::const_iterator it = headerMap.begin(); + for (; it != headerMap.end(); ++it) { + ss << "\n\t" << std::string((*it).first) << ": " << + std::string((*it).second); + } + } + + CefRefPtr postData = request->GetPostData(); + if (postData.get()) { + CefPostData::ElementVector elements; + postData->GetElements(elements); + if (elements.size() > 0) { + ss << "\nPost Data:"; + CefRefPtr element; + CefPostData::ElementVector::const_iterator it = elements.begin(); + for (; it != elements.end(); ++it) { + element = (*it); + if (element->GetType() == PDE_TYPE_BYTES) { + // the element is composed of bytes + ss << "\n\tBytes: "; + if (element->GetBytesCount() == 0) { + ss << "(empty)"; + } else { + // retrieve the data. + size_t size = element->GetBytesCount(); + char* bytes = new char[size]; + element->GetBytes(size, bytes); + ss << std::string(bytes, size); + delete [] bytes; + } + } else if (element->GetType() == PDE_TYPE_FILE) { + ss << "\n\tFile: " << std::string(element->GetFile()); + } + } + } + } + + str = ss.str(); +} + +std::string StringReplace(const std::string& str, const std::string& from, + const std::string& to) { + std::string result = str; + std::string::size_type pos = 0; + std::string::size_type from_len = from.length(); + std::string::size_type to_len = to.length(); + do { + pos = result.find(from, pos); + if (pos != std::string::npos) { + result.replace(pos, from_len, to); + pos += to_len; + } + } while (pos != std::string::npos); + return result; +} diff --git a/tests/cefclient/string_util.h b/tests/cefclient/string_util.h new file mode 100644 index 000000000..c43e6f210 --- /dev/null +++ b/tests/cefclient/string_util.h @@ -0,0 +1,21 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_STRING_UTIL_H_ +#define CEF_TESTS_CEFCLIENT_STRING_UTIL_H_ +#pragma once + +#include +#include "include/cef_base.h" + +class CefRequest; + +// Dump the contents of the request into a string. +void DumpRequestContents(CefRefPtr request, std::string& str); + +// Replace all instances of |from| with |to| in |str|. +std::string StringReplace(const std::string& str, const std::string& from, + const std::string& to); + +#endif // CEF_TESTS_CEFCLIENT_STRING_UTIL_H_ diff --git a/tests/cefclient/util.h b/tests/cefclient/util.h new file mode 100644 index 000000000..ba0305c1c --- /dev/null +++ b/tests/cefclient/util.h @@ -0,0 +1,37 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_TESTS_CEFCLIENT_UTIL_H_ +#define CEF_TESTS_CEFCLIENT_UTIL_H_ +#pragma once + +#include "include/cef_task.h" + +#if defined(OS_WIN) + +#include // NOLINT(build/include_order) + +#ifndef NDEBUG +#define ASSERT(condition) if (!(condition)) { DebugBreak(); } +#else +#define ASSERT(condition) ((void)0) +#endif + +#else // !OS_WIN + +#include // NOLINT(build/include_order) + +#ifndef NDEBUG +#define ASSERT(condition) if (!(condition)) { assert(false); } +#else +#define ASSERT(condition) ((void)0) +#endif + +#endif // !OS_WIN + +#define REQUIRE_UI_THREAD() ASSERT(CefCurrentlyOn(TID_UI)); +#define REQUIRE_IO_THREAD() ASSERT(CefCurrentlyOn(TID_IO)); +#define REQUIRE_FILE_THREAD() ASSERT(CefCurrentlyOn(TID_FILE)); + +#endif // CEF_TESTS_CEFCLIENT_UTIL_H_ diff --git a/tests/unittests/client_app_delegates.cc b/tests/unittests/client_app_delegates.cc new file mode 100644 index 000000000..e47e97698 --- /dev/null +++ b/tests/unittests/client_app_delegates.cc @@ -0,0 +1,48 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "tests/cefclient/client_app.h" + +// static +void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) { + // Bring in the process message tests. + extern void CreateProcessMessageRendererTests( + ClientApp::RenderDelegateSet& delegates); + CreateProcessMessageRendererTests(delegates); + + // Bring in the V8 tests. + extern void CreateV8RendererTests(RenderDelegateSet& delegates); + CreateV8RendererTests(delegates); + + // Bring in the DOM tests. + extern void CreateDOMRendererTests(RenderDelegateSet& delegates); + CreateDOMRendererTests(delegates); + + // Bring in the URLRequest tests. + extern void CreateURLRequestRendererTests(RenderDelegateSet& delegates); + CreateURLRequestRendererTests(delegates); +} + +// static +void ClientApp::RegisterCustomSchemes( + CefRefPtr registrar, + std::vector& cookiable_schemes) { + // Bring in the scheme handler tests. + extern void RegisterSchemeHandlerCustomSchemes( + CefRefPtr registrar, + std::vector& cookiable_schemes); + RegisterSchemeHandlerCustomSchemes(registrar, cookiable_schemes); + + // Bring in the cookie tests. + extern void RegisterCookieCustomSchemes( + CefRefPtr registrar, + std::vector& cookiable_schemes); + RegisterCookieCustomSchemes(registrar, cookiable_schemes); + + // Bring in the URLRequest tests. + extern void RegisterURLRequestCustomSchemes( + CefRefPtr registrar, + std::vector& cookiable_schemes); + RegisterURLRequestCustomSchemes(registrar, cookiable_schemes); +} diff --git a/tests/unittests/command_line_unittest.cc b/tests/unittests/command_line_unittest.cc new file mode 100644 index 000000000..19c4b47b6 --- /dev/null +++ b/tests/unittests/command_line_unittest.cc @@ -0,0 +1,118 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "include/cef_command_line.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +void VerifyCommandLine(CefRefPtr command_line) { + std::string program = command_line->GetProgram(); + EXPECT_EQ("test.exe", program); + + EXPECT_TRUE(command_line->HasSwitches()); + + EXPECT_TRUE(command_line->HasSwitch("switch1")); + std::string switch1 = command_line->GetSwitchValue("switch1"); + EXPECT_EQ("", switch1); + EXPECT_TRUE(command_line->HasSwitch("switch2")); + std::string switch2 = command_line->GetSwitchValue("switch2"); + EXPECT_EQ("val2", switch2); + EXPECT_TRUE(command_line->HasSwitch("switch3")); + std::string switch3 = command_line->GetSwitchValue("switch3"); + EXPECT_EQ("val3", switch3); + EXPECT_TRUE(command_line->HasSwitch("switch4")); + std::string switch4 = command_line->GetSwitchValue("switch4"); + EXPECT_EQ("val 4", switch4); + EXPECT_FALSE(command_line->HasSwitch("switchnoexist")); + + CefCommandLine::SwitchMap switches; + command_line->GetSwitches(switches); + EXPECT_EQ((size_t)4, switches.size()); + + bool has1 = false, has2 = false, has3 = false, has4 = false; + + CefCommandLine::SwitchMap::const_iterator it = switches.begin(); + for (; it != switches.end(); ++it) { + std::string name = it->first; + std::string val = it->second; + + if (name == "switch1") { + has1 = true; + EXPECT_EQ("", val); + } else if (name == "switch2") { + has2 = true; + EXPECT_EQ("val2", val); + } else if (name == "switch3") { + has3 = true; + EXPECT_EQ("val3", val); + } else if (name == "switch4") { + has4 = true; + EXPECT_EQ("val 4", val); + } + } + + EXPECT_TRUE(has1); + EXPECT_TRUE(has2); + EXPECT_TRUE(has3); + EXPECT_TRUE(has4); + + EXPECT_TRUE(command_line->HasArguments()); + + CefCommandLine::ArgumentList args; + command_line->GetArguments(args); + EXPECT_EQ((size_t)2, args.size()); + std::string arg0 = args[0]; + EXPECT_EQ("arg1", arg0); + std::string arg1 = args[1]; + EXPECT_EQ("arg 2", arg1); + + command_line->Reset(); + EXPECT_FALSE(command_line->HasSwitches()); + EXPECT_FALSE(command_line->HasArguments()); + std::string cur_program = command_line->GetProgram(); + EXPECT_EQ(program, cur_program); +} + +} // namespace + +// Test creating a command line from argc/argv or string. +TEST(CommandLineTest, Init) { + CefRefPtr command_line = CefCommandLine::CreateCommandLine(); + EXPECT_TRUE(command_line.get() != NULL); + +#if defined(OS_WIN) + command_line->InitFromString("test.exe --switch1 -switch2=val2 /switch3=val3 " + "-switch4=\"val 4\" arg1 \"arg 2\""); +#else + const char* args[] = { + "test.exe", + "--switch1", + "-switch2=val2", + "-switch3=val3", + "-switch4=val 4", + "arg1", + "arg 2" + }; + command_line->InitFromArgv(sizeof(args) / sizeof(char*), args); +#endif + + VerifyCommandLine(command_line); +} + +// Test creating a command line using set and append methods. +TEST(CommandLineTest, Manual) { + CefRefPtr command_line = CefCommandLine::CreateCommandLine(); + EXPECT_TRUE(command_line.get() != NULL); + + command_line->SetProgram("test.exe"); + command_line->AppendSwitch("switch1"); + command_line->AppendSwitchWithValue("switch2", "val2"); + command_line->AppendSwitchWithValue("switch3", "val3"); + command_line->AppendSwitchWithValue("switch4", "val 4"); + command_line->AppendArgument("arg1"); + command_line->AppendArgument("arg 2"); + + VerifyCommandLine(command_line); +} diff --git a/tests/unittests/cookie_unittest.cc b/tests/unittests/cookie_unittest.cc new file mode 100644 index 000000000..9b2ca26f5 --- /dev/null +++ b/tests/unittests/cookie_unittest.cc @@ -0,0 +1,962 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include +#include "include/cef_cookie.h" +#include "include/cef_runnable.h" +#include "include/cef_scheme.h" +#include "tests/unittests/test_handler.h" +#include "tests/unittests/test_suite.h" +#include "base/scoped_temp_dir.h" +#include "base/synchronization/waitable_event.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +const char* kTestUrl = "http://www.test.com/path/to/cookietest/foo.html"; +const char* kTestDomain = "www.test.com"; +const char* kTestPath = "/path/to/cookietest"; + +typedef std::vector CookieVector; + +void IOT_Set(CefRefPtr manager, + const CefString& url, CookieVector* cookies, + base::WaitableEvent* event) { + CookieVector::const_iterator it = cookies->begin(); + for (; it != cookies->end(); ++it) + EXPECT_TRUE(manager->SetCookie(url, *it)); + event->Signal(); +} + +void IOT_Delete(CefRefPtr manager, + const CefString& url, const CefString& cookie_name, + base::WaitableEvent* event) { + EXPECT_TRUE(manager->DeleteCookies(url, cookie_name)); + event->Signal(); +} + +class TestVisitor : public CefCookieVisitor { + public: + TestVisitor(CookieVector* cookies, bool deleteCookies, + base::WaitableEvent* event) + : cookies_(cookies), + delete_cookies_(deleteCookies), + event_(event) { + } + virtual ~TestVisitor() { + event_->Signal(); + } + + virtual bool Visit(const CefCookie& cookie, int count, int total, + bool& deleteCookie) { + cookies_->push_back(cookie); + if (delete_cookies_) + deleteCookie = true; + return true; + } + + CookieVector* cookies_; + bool delete_cookies_; + base::WaitableEvent* event_; + + IMPLEMENT_REFCOUNTING(TestVisitor); +}; + +// Set the cookies. +void SetCookies(CefRefPtr manager, + const CefString& url, CookieVector& cookies, + base::WaitableEvent& event) { + CefPostTask(TID_IO, NewCefRunnableFunction(IOT_Set, manager, url, + &cookies, &event)); + event.Wait(); +} + +// Delete the cookie. +void DeleteCookies(CefRefPtr manager, + const CefString& url, const CefString& cookie_name, + base::WaitableEvent& event) { + CefPostTask(TID_IO, NewCefRunnableFunction(IOT_Delete, manager, url, + cookie_name, &event)); + event.Wait(); +} + +// Create a test cookie. If |withDomain| is true a domain cookie will be +// created, otherwise a host cookie will be created. +void CreateCookie(CefRefPtr manager, + CefCookie& cookie, bool withDomain, + base::WaitableEvent& event) { + CefString(&cookie.name).FromASCII("my_cookie"); + CefString(&cookie.value).FromASCII("My Value"); + if (withDomain) + CefString(&cookie.domain).FromASCII(kTestDomain); + CefString(&cookie.path).FromASCII(kTestPath); + cookie.has_expires = true; + cookie.expires.year = 2200; + cookie.expires.month = 4; + cookie.expires.day_of_week = 5; + cookie.expires.day_of_month = 11; + + CookieVector cookies; + cookies.push_back(cookie); + + SetCookies(manager, kTestUrl, cookies, event); +} + +// Retrieve the test cookie. If |withDomain| is true check that the cookie +// is a domain cookie, otherwise a host cookie. if |deleteCookies| is true +// the cookie will be deleted when it's retrieved. +void GetCookie(CefRefPtr manager, + const CefCookie& cookie, bool withDomain, + base::WaitableEvent& event, bool deleteCookies) { + CookieVector cookies; + + // Get the cookie and delete it. + EXPECT_TRUE(manager->VisitUrlCookies(kTestUrl, false, + new TestVisitor(&cookies, deleteCookies, &event))); + event.Wait(); + + EXPECT_EQ((CookieVector::size_type)1, cookies.size()); + + const CefCookie& cookie_read = cookies[0]; + EXPECT_EQ(CefString(&cookie_read.name), "my_cookie"); + EXPECT_EQ(CefString(&cookie_read.value), "My Value"); + if (withDomain) + EXPECT_EQ(CefString(&cookie_read.domain), ".www.test.com"); + else + EXPECT_EQ(CefString(&cookie_read.domain), kTestDomain); + EXPECT_EQ(CefString(&cookie_read.path), kTestPath); + EXPECT_TRUE(cookie_read.has_expires); + EXPECT_EQ(cookie.expires.year, cookie_read.expires.year); + EXPECT_EQ(cookie.expires.month, cookie_read.expires.month); + EXPECT_EQ(cookie.expires.day_of_week, cookie_read.expires.day_of_week); + EXPECT_EQ(cookie.expires.day_of_month, cookie_read.expires.day_of_month); + EXPECT_EQ(cookie.expires.hour, cookie_read.expires.hour); + EXPECT_EQ(cookie.expires.minute, cookie_read.expires.minute); + EXPECT_EQ(cookie.expires.second, cookie_read.expires.second); + EXPECT_EQ(cookie.expires.millisecond, cookie_read.expires.millisecond); +} + +// Visit URL cookies. +void VisitUrlCookies(CefRefPtr manager, + const CefString& url, + bool includeHttpOnly, + CookieVector& cookies, + bool deleteCookies, + base::WaitableEvent& event) { + EXPECT_TRUE(manager->VisitUrlCookies(url, includeHttpOnly, + new TestVisitor(&cookies, deleteCookies, &event))); + event.Wait(); +} + +// Visit all cookies. +void VisitAllCookies(CefRefPtr manager, + CookieVector& cookies, + bool deleteCookies, + base::WaitableEvent& event) { + EXPECT_TRUE(manager->VisitAllCookies( + new TestVisitor(&cookies, deleteCookies, &event))); + event.Wait(); +} + +// Verify that no cookies exist. If |withUrl| is true it will only check for +// cookies matching the URL. +void VerifyNoCookies(CefRefPtr manager, + base::WaitableEvent& event, bool withUrl) { + CookieVector cookies; + + // Verify that the cookie has been deleted. + if (withUrl) { + EXPECT_TRUE(manager->VisitUrlCookies(kTestUrl, false, + new TestVisitor(&cookies, false, &event))); + } else { + EXPECT_TRUE(manager->VisitAllCookies( + new TestVisitor(&cookies, false, &event))); + } + event.Wait(); + + EXPECT_EQ((CookieVector::size_type)0, cookies.size()); +} + +// Delete all system cookies. +void DeleteAllCookies(CefRefPtr manager, + base::WaitableEvent& event) { + CefPostTask(TID_IO, NewCefRunnableFunction(IOT_Delete, manager, CefString(), + CefString(), &event)); + event.Wait(); +} + +void TestDomainCookie(CefRefPtr manager) { + base::WaitableEvent event(false, false); + CefCookie cookie; + + // Create a domain cookie. + CreateCookie(manager, cookie, true, event); + + // Retrieve, verify and delete the domain cookie. + GetCookie(manager, cookie, true, event, true); + + // Verify that the cookie was deleted. + VerifyNoCookies(manager, event, true); +} + +void TestHostCookie(CefRefPtr manager) { + base::WaitableEvent event(false, false); + CefCookie cookie; + + // Create a host cookie. + CreateCookie(manager, cookie, false, event); + + // Retrieve, verify and delete the host cookie. + GetCookie(manager, cookie, false, event, true); + + // Verify that the cookie was deleted. + VerifyNoCookies(manager, event, true); +} + +void TestMultipleCookies(CefRefPtr manager) { + base::WaitableEvent event(false, false); + std::stringstream ss; + int i; + + CookieVector cookies; + + const int kNumCookies = 4; + + // Create the cookies. + for (i = 0; i < kNumCookies; i++) { + CefCookie cookie; + + ss << "my_cookie" << i; + CefString(&cookie.name).FromASCII(ss.str().c_str()); + ss.str(""); + ss << "My Value " << i; + CefString(&cookie.value).FromASCII(ss.str().c_str()); + ss.str(""); + + cookies.push_back(cookie); + } + + // Set the cookies. + SetCookies(manager, kTestUrl, cookies, event); + cookies.clear(); + + // Get the cookies without deleting them. + VisitUrlCookies(manager, kTestUrl, false, cookies, false, event); + + EXPECT_EQ((CookieVector::size_type)kNumCookies, cookies.size()); + + CookieVector::const_iterator it = cookies.begin(); + for (i = 0; it != cookies.end(); ++it, ++i) { + const CefCookie& cookie = *it; + + ss << "my_cookie" << i; + EXPECT_EQ(CefString(&cookie.name), ss.str()); + ss.str(""); + ss << "My Value " << i; + EXPECT_EQ(CefString(&cookie.value), ss.str()); + ss.str(""); + } + + cookies.clear(); + + // Delete the 2nd cookie. + DeleteCookies(manager, kTestUrl, CefString("my_cookie1"), event); + + // Verify that the cookie has been deleted. + VisitUrlCookies(manager, kTestUrl, false, cookies, false, event); + + EXPECT_EQ((CookieVector::size_type)3, cookies.size()); + EXPECT_EQ(CefString(&cookies[0].name), "my_cookie0"); + EXPECT_EQ(CefString(&cookies[1].name), "my_cookie2"); + EXPECT_EQ(CefString(&cookies[2].name), "my_cookie3"); + + cookies.clear(); + + // Delete the rest of the cookies. + DeleteCookies(manager, kTestUrl, CefString(), event); + + // Verify that the cookies have been deleted. + VisitUrlCookies(manager, kTestUrl, false, cookies, false, event); + + EXPECT_EQ((CookieVector::size_type)0, cookies.size()); + + // Create the cookies. + for (i = 0; i < kNumCookies; i++) { + CefCookie cookie; + + ss << "my_cookie" << i; + CefString(&cookie.name).FromASCII(ss.str().c_str()); + ss.str(""); + ss << "My Value " << i; + CefString(&cookie.value).FromASCII(ss.str().c_str()); + ss.str(""); + + cookies.push_back(cookie); + } + + // Delete all of the cookies using the visitor. + VisitUrlCookies(manager, kTestUrl, false, cookies, true, event); + + cookies.clear(); + + // Verify that the cookies have been deleted. + VisitUrlCookies(manager, kTestUrl, false, cookies, false, event); + + EXPECT_EQ((CookieVector::size_type)0, cookies.size()); +} + +void TestAllCookies(CefRefPtr manager) { + base::WaitableEvent event(false, false); + CookieVector cookies; + + // Delete all system cookies just in case something is left over from a + // different test. + DeleteCookies(manager, CefString(), CefString(), event); + + // Verify that all system cookies have been deleted. + VisitAllCookies(manager, cookies, false, event); + + EXPECT_EQ((CookieVector::size_type)0, cookies.size()); + + // Create cookies with 2 separate hosts. + CefCookie cookie1; + const char* kUrl1 = "http://www.foo.com"; + CefString(&cookie1.name).FromASCII("my_cookie1"); + CefString(&cookie1.value).FromASCII("My Value 1"); + + cookies.push_back(cookie1); + SetCookies(manager, kUrl1, cookies, event); + cookies.clear(); + + CefCookie cookie2; + const char* kUrl2 = "http://www.bar.com"; + CefString(&cookie2.name).FromASCII("my_cookie2"); + CefString(&cookie2.value).FromASCII("My Value 2"); + + cookies.push_back(cookie2); + SetCookies(manager, kUrl2, cookies, event); + cookies.clear(); + + // Verify that all system cookies can be retrieved. + VisitAllCookies(manager, cookies, false, event); + + EXPECT_EQ((CookieVector::size_type)2, cookies.size()); + EXPECT_EQ(CefString(&cookies[0].name), "my_cookie1"); + EXPECT_EQ(CefString(&cookies[0].value), "My Value 1"); + EXPECT_EQ(CefString(&cookies[0].domain), "www.foo.com"); + EXPECT_EQ(CefString(&cookies[1].name), "my_cookie2"); + EXPECT_EQ(CefString(&cookies[1].value), "My Value 2"); + EXPECT_EQ(CefString(&cookies[1].domain), "www.bar.com"); + cookies.clear(); + + // Verify that the cookies can be retrieved separately. + VisitUrlCookies(manager, kUrl1, false, cookies, false, event); + + EXPECT_EQ((CookieVector::size_type)1, cookies.size()); + EXPECT_EQ(CefString(&cookies[0].name), "my_cookie1"); + EXPECT_EQ(CefString(&cookies[0].value), "My Value 1"); + EXPECT_EQ(CefString(&cookies[0].domain), "www.foo.com"); + cookies.clear(); + + VisitUrlCookies(manager, kUrl2, false, cookies, false, event); + + EXPECT_EQ((CookieVector::size_type)1, cookies.size()); + EXPECT_EQ(CefString(&cookies[0].name), "my_cookie2"); + EXPECT_EQ(CefString(&cookies[0].value), "My Value 2"); + EXPECT_EQ(CefString(&cookies[0].domain), "www.bar.com"); + cookies.clear(); + + // Delete all of the system cookies. + DeleteAllCookies(manager, event); + + // Verify that all system cookies have been deleted. + VerifyNoCookies(manager, event, false); +} + +void TestChangeDirectory(CefRefPtr manager, + const CefString& original_dir) { + base::WaitableEvent event(false, false); + CefCookie cookie; + + ScopedTempDir temp_dir; + + // Create a new temporary directory. + EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); + + // Delete all of the system cookies. + DeleteAllCookies(manager, event); + + // Set the new temporary directory as the storage location. + EXPECT_TRUE(manager->SetStoragePath(temp_dir.path().value())); + + // Wait for the storage location change to complete on the IO thread. + WaitForIOThread(); + + // Verify that no cookies exist. + VerifyNoCookies(manager, event, true); + + // Create a domain cookie. + CreateCookie(manager, cookie, true, event); + + // Retrieve and verify the domain cookie. + GetCookie(manager, cookie, true, event, false); + + // Restore the original storage location. + EXPECT_TRUE(manager->SetStoragePath(original_dir)); + + // Wait for the storage location change to complete on the IO thread. + WaitForIOThread(); + + // Verify that no cookies exist. + VerifyNoCookies(manager, event, true); + + // Set the new temporary directory as the storage location. + EXPECT_TRUE(manager->SetStoragePath(temp_dir.path().value())); + + // Wait for the storage location change to complete on the IO thread. + WaitForIOThread(); + + // Retrieve and verify the domain cookie that was set previously. + GetCookie(manager, cookie, true, event, false); + + // Restore the original storage location. + EXPECT_TRUE(manager->SetStoragePath(original_dir)); + + // Wait for the storage location change to complete on the IO thread. + WaitForIOThread(); +} + +} // namespace + +// Test creation of a domain cookie. +TEST(CookieTest, DomainCookieGlobal) { + CefRefPtr manager = CefCookieManager::GetGlobalManager(); + EXPECT_TRUE(manager.get()); + + TestDomainCookie(manager); +} + +// Test creation of a domain cookie. +TEST(CookieTest, DomainCookieInMemory) { + CefRefPtr manager = + CefCookieManager::CreateManager(CefString()); + EXPECT_TRUE(manager.get()); + + TestDomainCookie(manager); +} + +// Test creation of a domain cookie. +TEST(CookieTest, DomainCookieOnDisk) { + ScopedTempDir temp_dir; + + // Create a new temporary directory. + EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); + + CefRefPtr manager = + CefCookieManager::CreateManager(temp_dir.path().value()); + EXPECT_TRUE(manager.get()); + + TestDomainCookie(manager); +} + +// Test creation of a host cookie. +TEST(CookieTest, HostCookieGlobal) { + CefRefPtr manager = CefCookieManager::GetGlobalManager(); + EXPECT_TRUE(manager.get()); + + TestHostCookie(manager); +} + +// Test creation of a host cookie. +TEST(CookieTest, HostCookieInMemory) { + CefRefPtr manager = + CefCookieManager::CreateManager(CefString()); + EXPECT_TRUE(manager.get()); + + TestHostCookie(manager); +} + +// Test creation of a host cookie. +TEST(CookieTest, HostCookieOnDisk) { + ScopedTempDir temp_dir; + + // Create a new temporary directory. + EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); + + CefRefPtr manager = + CefCookieManager::CreateManager(temp_dir.path().value()); + EXPECT_TRUE(manager.get()); + + TestHostCookie(manager); +} + +// Test creation of multiple cookies. +TEST(CookieTest, MultipleCookiesGlobal) { + CefRefPtr manager = CefCookieManager::GetGlobalManager(); + EXPECT_TRUE(manager.get()); + + TestMultipleCookies(manager); +} + +// Test creation of multiple cookies. +TEST(CookieTest, MultipleCookiesInMemory) { + CefRefPtr manager = + CefCookieManager::CreateManager(CefString()); + EXPECT_TRUE(manager.get()); + + TestMultipleCookies(manager); +} + +// Test creation of multiple cookies. +TEST(CookieTest, MultipleCookiesOnDisk) { + ScopedTempDir temp_dir; + + // Create a new temporary directory. + EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); + + CefRefPtr manager = + CefCookieManager::CreateManager(temp_dir.path().value()); + EXPECT_TRUE(manager.get()); + + TestMultipleCookies(manager); +} + +TEST(CookieTest, AllCookiesGlobal) { + CefRefPtr manager = CefCookieManager::GetGlobalManager(); + EXPECT_TRUE(manager.get()); + + TestAllCookies(manager); +} + +TEST(CookieTest, AllCookiesInMemory) { + CefRefPtr manager = + CefCookieManager::CreateManager(CefString()); + EXPECT_TRUE(manager.get()); + + TestAllCookies(manager); +} + +TEST(CookieTest, AllCookiesOnDisk) { + ScopedTempDir temp_dir; + + // Create a new temporary directory. + EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); + + CefRefPtr manager = + CefCookieManager::CreateManager(temp_dir.path().value()); + EXPECT_TRUE(manager.get()); + + TestAllCookies(manager); +} + +TEST(CookieTest, ChangeDirectoryGlobal) { + CefRefPtr manager = CefCookieManager::GetGlobalManager(); + EXPECT_TRUE(manager.get()); + + std::string cache_path; + CefTestSuite::GetCachePath(cache_path); + + TestChangeDirectory(manager, cache_path); +} + +TEST(CookieTest, ChangeDirectoryCreated) { + CefRefPtr manager = + CefCookieManager::CreateManager(CefString()); + EXPECT_TRUE(manager.get()); + + TestChangeDirectory(manager, CefString()); +} + + +namespace { + +const char* kCookieJSUrl1 = "http://tests/cookie1.html"; +const char* kCookieJSUrl2 = "http://tests/cookie2.html"; + +class CookieTestJSHandler : public TestHandler { + public: + CookieTestJSHandler() {} + + virtual void RunTest() OVERRIDE { + // Create =new in-memory managers. + manager1_ = CefCookieManager::CreateManager(CefString()); + manager2_ = CefCookieManager::CreateManager(CefString()); + + std::string page = + "" + "" + "COOKIE TEST1"; + AddResource(kCookieJSUrl1, page, "text/html"); + + page = + "" + "" + "COOKIE TEST2"; + AddResource(kCookieJSUrl2, page, "text/html"); + + // Create the browser + CreateBrowser(kCookieJSUrl1); + } + + virtual void OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) OVERRIDE { + std::string url = frame->GetURL(); + if (url == kCookieJSUrl1) { + got_load_end1_.yes(); + VerifyCookie(manager1_, url, "name1", "value1", got_cookie1_); + + // Go to the next URL + frame->LoadURL(kCookieJSUrl2); + } else { + got_load_end2_.yes(); + VerifyCookie(manager2_, url, "name2", "value2", got_cookie2_); + + DestroyTest(); + } + } + + virtual CefRefPtr GetCookieManager( + CefRefPtr browser, + const CefString& main_url) OVERRIDE { + if (main_url == kCookieJSUrl1) { + // Return the first cookie manager. + got_cookie_manager1_.yes(); + return manager1_; + } else { + // Return the second cookie manager. + got_cookie_manager2_.yes(); + return manager2_; + } + } + + // Verify that the cookie was set successfully. + void VerifyCookie(CefRefPtr manager, + const std::string& url, + const std::string& name, + const std::string& value, + TrackCallback& callback) { + base::WaitableEvent event(false, false); + CookieVector cookies; + + // Get the cookie. + VisitUrlCookies(manager, url, false, cookies, false, event); + + if (cookies.size() == 1 && CefString(&cookies[0].name) == name && + CefString(&cookies[0].value) == value) { + callback.yes(); + } + } + + CefRefPtr manager1_; + CefRefPtr manager2_; + + TrackCallback got_cookie_manager1_; + TrackCallback got_cookie_manager2_; + TrackCallback got_load_end1_; + TrackCallback got_load_end2_; + TrackCallback got_cookie1_; + TrackCallback got_cookie2_; +}; + +} // namespace + +// Verify use of multiple cookie managers vis JS. +TEST(CookieTest, GetCookieManagerJS) { + CefRefPtr handler = new CookieTestJSHandler(); + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_cookie_manager1_); + EXPECT_TRUE(handler->got_cookie_manager2_); + EXPECT_TRUE(handler->got_load_end1_); + EXPECT_TRUE(handler->got_load_end2_); + EXPECT_TRUE(handler->got_cookie1_); + EXPECT_TRUE(handler->got_cookie2_); +} + + +namespace { + +class CookieTestSchemeHandler : public TestHandler { + public: + class SchemeHandler : public CefResourceHandler { + public: + explicit SchemeHandler(CookieTestSchemeHandler* handler) + : handler_(handler), + offset_(0) {} + + virtual bool ProcessRequest(CefRefPtr request, + CefRefPtr callback) + OVERRIDE { + std::string url = request->GetURL(); + if (url == handler_->url1_) { + content_ = "COOKIE TEST1"; + cookie_ = "name1=value1"; + handler_->got_process_request1_.yes(); + } else if (url == handler_->url2_) { + content_ = "COOKIE TEST2"; + cookie_ = "name2=value2"; + handler_->got_process_request2_.yes(); + } else if (url == handler_->url3_) { + content_ = "COOKIE TEST3"; + handler_->got_process_request3_.yes(); + + // Verify that the cookie was passed in. + CefRequest::HeaderMap headerMap; + request->GetHeaderMap(headerMap); + CefRequest::HeaderMap::iterator it = headerMap.find("Cookie"); + if (it != headerMap.end() && it->second == "name2=value2") + handler_->got_process_request_cookie_.yes(); + + } + callback->Continue(); + return true; + } + + virtual void GetResponseHeaders(CefRefPtr response, + int64& response_length, + CefString& redirectUrl) OVERRIDE { + response_length = content_.size(); + + response->SetStatus(200); + response->SetMimeType("text/html"); + + if (!cookie_.empty()) { + CefResponse::HeaderMap headerMap; + response->GetHeaderMap(headerMap); + headerMap.insert(std::make_pair("Set-Cookie", cookie_)); + response->SetHeaderMap(headerMap); + } + } + + virtual bool ReadResponse(void* data_out, + int bytes_to_read, + int& bytes_read, + CefRefPtr callback) + OVERRIDE { + bool has_data = false; + bytes_read = 0; + + size_t size = content_.size(); + if (offset_ < size) { + int transfer_size = + std::min(bytes_to_read, static_cast(size - offset_)); + memcpy(data_out, content_.c_str() + offset_, transfer_size); + offset_ += transfer_size; + + bytes_read = transfer_size; + has_data = true; + } + + return has_data; + } + + virtual void Cancel() OVERRIDE { + } + + private: + CookieTestSchemeHandler* handler_; + std::string content_; + size_t offset_; + std::string cookie_; + + IMPLEMENT_REFCOUNTING(SchemeHandler); + }; + + class SchemeHandlerFactory : public CefSchemeHandlerFactory { + public: + explicit SchemeHandlerFactory(CookieTestSchemeHandler* handler) + : handler_(handler) {} + + virtual CefRefPtr Create( + CefRefPtr browser, + CefRefPtr frame, + const CefString& scheme_name, + CefRefPtr request) OVERRIDE { + std::string url = request->GetURL(); + if (url == handler_->url3_) { + // Verify that the cookie was not passed in. + CefRequest::HeaderMap headerMap; + request->GetHeaderMap(headerMap); + CefRequest::HeaderMap::iterator it = headerMap.find("Cookie"); + if (it != headerMap.end() && it->second == "name2=value2") + handler_->got_create_cookie_.yes(); + } + + return new SchemeHandler(handler_); + } + + private: + CookieTestSchemeHandler* handler_; + + IMPLEMENT_REFCOUNTING(SchemeHandlerFactory); + }; + + CookieTestSchemeHandler(const std::string& scheme) : scheme_(scheme) { + url1_ = scheme + "://cookie-tests/cookie1.html"; + url2_ = scheme + "://cookie-tests/cookie2.html"; + url3_ = scheme + "://cookie-tests/cookie3.html"; + } + + virtual void RunTest() OVERRIDE { + // Create new in-memory managers. + manager1_ = CefCookieManager::CreateManager(CefString()); + manager2_ = CefCookieManager::CreateManager(CefString()); + + if (scheme_ != "http") { + std::vector schemes; + schemes.push_back("http"); + schemes.push_back("https"); + schemes.push_back(scheme_); + + manager1_->SetSupportedSchemes(schemes); + manager2_->SetSupportedSchemes(schemes); + } + + // Register the scheme handler. + CefRegisterSchemeHandlerFactory(scheme_, "cookie-tests", + new SchemeHandlerFactory(this)); + + // Create the browser + CreateBrowser(url1_); + } + + virtual void OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) OVERRIDE { + std::string url = frame->GetURL(); + if (url == url1_) { + got_load_end1_.yes(); + VerifyCookie(manager1_, url, "name1", "value1", got_cookie1_); + + // Go to the next URL + frame->LoadURL(url2_); + } else if (url == url2_) { + got_load_end2_.yes(); + VerifyCookie(manager2_, url, "name2", "value2", got_cookie2_); + + // Go to the next URL + frame->LoadURL(url3_); + } else { + got_load_end3_.yes(); + VerifyCookie(manager2_, url, "name2", "value2", got_cookie3_); + + // Unregister the scheme handler. + CefRegisterSchemeHandlerFactory(scheme_, "cookie-tests", NULL); + + DestroyTest(); + } + } + + virtual CefRefPtr GetCookieManager( + CefRefPtr browser, + const CefString& main_url) OVERRIDE { + if (main_url == url1_) { + // Return the first cookie manager. + got_cookie_manager1_.yes(); + return manager1_; + } else { + // Return the second cookie manager. + got_cookie_manager2_.yes(); + return manager2_; + } + } + + // Verify that the cookie was set successfully. + void VerifyCookie(CefRefPtr manager, + const std::string& url, + const std::string& name, + const std::string& value, + TrackCallback& callback) { + base::WaitableEvent event(false, false); + CookieVector cookies; + + // Get the cookie. + VisitUrlCookies(manager, url, false, cookies, false, event); + + if (cookies.size() == 1 && CefString(&cookies[0].name) == name && + CefString(&cookies[0].value) == value) { + callback.yes(); + } + } + + std::string scheme_; + std::string url1_; + std::string url2_; + std::string url3_; + + CefRefPtr manager1_; + CefRefPtr manager2_; + + TrackCallback got_process_request1_; + TrackCallback got_process_request2_; + TrackCallback got_process_request3_; + TrackCallback got_create_cookie_; + TrackCallback got_process_request_cookie_; + TrackCallback got_cookie_manager1_; + TrackCallback got_cookie_manager2_; + TrackCallback got_load_end1_; + TrackCallback got_load_end2_; + TrackCallback got_load_end3_; + TrackCallback got_cookie1_; + TrackCallback got_cookie2_; + TrackCallback got_cookie3_; +}; + +} // namespace + +// Verify use of multiple cookie managers via HTTP. +TEST(CookieTest, GetCookieManagerHttp) { + CefRefPtr handler = + new CookieTestSchemeHandler("http"); + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_process_request1_); + EXPECT_TRUE(handler->got_process_request2_); + EXPECT_TRUE(handler->got_process_request3_); + EXPECT_FALSE(handler->got_create_cookie_); + EXPECT_TRUE(handler->got_process_request_cookie_); + EXPECT_TRUE(handler->got_cookie_manager1_); + EXPECT_TRUE(handler->got_cookie_manager2_); + EXPECT_TRUE(handler->got_load_end1_); + EXPECT_TRUE(handler->got_load_end2_); + EXPECT_TRUE(handler->got_load_end3_); + EXPECT_TRUE(handler->got_cookie1_); + EXPECT_TRUE(handler->got_cookie2_); + EXPECT_TRUE(handler->got_cookie3_); +} + +// Verify use of multiple cookie managers via a custom scheme. +TEST(CookieTest, GetCookieManagerCustom) { + CefRefPtr handler = + new CookieTestSchemeHandler("ccustom"); + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_process_request1_); + EXPECT_TRUE(handler->got_process_request2_); + EXPECT_TRUE(handler->got_process_request3_); + EXPECT_FALSE(handler->got_create_cookie_); + EXPECT_TRUE(handler->got_process_request_cookie_); + EXPECT_TRUE(handler->got_cookie_manager1_); + EXPECT_TRUE(handler->got_cookie_manager2_); + EXPECT_TRUE(handler->got_load_end1_); + EXPECT_TRUE(handler->got_load_end2_); + EXPECT_TRUE(handler->got_load_end3_); + EXPECT_TRUE(handler->got_cookie1_); + EXPECT_TRUE(handler->got_cookie2_); + EXPECT_TRUE(handler->got_cookie3_); +} + +// Entry point for registering custom schemes. +// Called from client_app_delegates.cc. +void RegisterCookieCustomSchemes( + CefRefPtr registrar, + std::vector& cookiable_schemes) { + // Used by GetCookieManagerCustom test. + registrar->AddCustomScheme("ccustom", true, false, false); +} diff --git a/tests/unittests/dom_unittest.cc b/tests/unittests/dom_unittest.cc new file mode 100644 index 000000000..26ba0d453 --- /dev/null +++ b/tests/unittests/dom_unittest.cc @@ -0,0 +1,332 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "include/cef_dom.h" +#include "tests/cefclient/client_app.h" +#include "tests/unittests/test_handler.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +const char* kTestUrl = "http://tests/DOMTest.Test"; +const char* kTestMessage = "DOMTest.Message"; + +enum DOMTestType { + DOM_TEST_STRUCTURE, + DOM_TEST_MODIFY, +}; + +class TestDOMVisitor : public CefDOMVisitor { + public: + explicit TestDOMVisitor(CefRefPtr browser, DOMTestType test_type) + : browser_(browser), + test_type_(test_type) { + } + + void TestHeadNodeStructure(CefRefPtr headNode) { + EXPECT_TRUE(headNode.get()); + EXPECT_TRUE(headNode->IsElement()); + EXPECT_FALSE(headNode->IsText()); + EXPECT_EQ(headNode->GetName(), "HEAD"); + EXPECT_EQ(headNode->GetElementTagName(), "HEAD"); + + EXPECT_TRUE(headNode->HasChildren()); + EXPECT_FALSE(headNode->HasElementAttributes()); + + CefRefPtr titleNode = headNode->GetFirstChild(); + EXPECT_TRUE(titleNode.get()); + EXPECT_TRUE(titleNode->IsElement()); + EXPECT_FALSE(titleNode->IsText()); + EXPECT_EQ(titleNode->GetName(), "TITLE"); + EXPECT_EQ(titleNode->GetElementTagName(), "TITLE"); + EXPECT_TRUE(titleNode->GetParent()->IsSame(headNode)); + + EXPECT_FALSE(titleNode->GetNextSibling().get()); + EXPECT_FALSE(titleNode->GetPreviousSibling().get()); + EXPECT_TRUE(titleNode->HasChildren()); + EXPECT_FALSE(titleNode->HasElementAttributes()); + + CefRefPtr textNode = titleNode->GetFirstChild(); + EXPECT_TRUE(textNode.get()); + EXPECT_FALSE(textNode->IsElement()); + EXPECT_TRUE(textNode->IsText()); + EXPECT_EQ(textNode->GetValue(), "The Title"); + EXPECT_TRUE(textNode->GetParent()->IsSame(titleNode)); + + EXPECT_FALSE(textNode->GetNextSibling().get()); + EXPECT_FALSE(textNode->GetPreviousSibling().get()); + EXPECT_FALSE(textNode->HasChildren()); + } + + void TestBodyNodeStructure(CefRefPtr bodyNode) { + EXPECT_TRUE(bodyNode.get()); + EXPECT_TRUE(bodyNode->IsElement()); + EXPECT_FALSE(bodyNode->IsText()); + EXPECT_EQ(bodyNode->GetName(), "BODY"); + EXPECT_EQ(bodyNode->GetElementTagName(), "BODY"); + + EXPECT_TRUE(bodyNode->HasChildren()); + EXPECT_FALSE(bodyNode->HasElementAttributes()); + + CefRefPtr h1Node = bodyNode->GetFirstChild(); + EXPECT_TRUE(h1Node.get()); + EXPECT_TRUE(h1Node->IsElement()); + EXPECT_FALSE(h1Node->IsText()); + EXPECT_EQ(h1Node->GetName(), "H1"); + EXPECT_EQ(h1Node->GetElementTagName(), "H1"); + + EXPECT_FALSE(h1Node->GetNextSibling().get()); + EXPECT_FALSE(h1Node->GetPreviousSibling().get()); + EXPECT_TRUE(h1Node->HasChildren()); + EXPECT_FALSE(h1Node->HasElementAttributes()); + + CefRefPtr textNode = h1Node->GetFirstChild(); + EXPECT_TRUE(textNode.get()); + EXPECT_FALSE(textNode->IsElement()); + EXPECT_TRUE(textNode->IsText()); + EXPECT_EQ(textNode->GetValue(), "Hello From"); + + EXPECT_FALSE(textNode->GetPreviousSibling().get()); + EXPECT_FALSE(textNode->HasChildren()); + + CefRefPtr brNode = textNode->GetNextSibling(); + EXPECT_TRUE(brNode.get()); + EXPECT_TRUE(brNode->IsElement()); + EXPECT_FALSE(brNode->IsText()); + EXPECT_EQ(brNode->GetName(), "BR"); + EXPECT_EQ(brNode->GetElementTagName(), "BR"); + + EXPECT_FALSE(brNode->HasChildren()); + + EXPECT_TRUE(brNode->HasElementAttributes()); + EXPECT_TRUE(brNode->HasElementAttribute("class")); + EXPECT_EQ(brNode->GetElementAttribute("class"), "some_class"); + EXPECT_TRUE(brNode->HasElementAttribute("id")); + EXPECT_EQ(brNode->GetElementAttribute("id"), "some_id"); + EXPECT_FALSE(brNode->HasElementAttribute("no_existing")); + + CefDOMNode::AttributeMap map; + brNode->GetElementAttributes(map); + ASSERT_EQ(map.size(), (size_t)2); + EXPECT_EQ(map["class"], "some_class"); + EXPECT_EQ(map["id"], "some_id"); + + // Can also retrieve by ID. + brNode = bodyNode->GetDocument()->GetElementById("some_id"); + EXPECT_TRUE(brNode.get()); + EXPECT_TRUE(brNode->IsElement()); + EXPECT_FALSE(brNode->IsText()); + EXPECT_EQ(brNode->GetName(), "BR"); + EXPECT_EQ(brNode->GetElementTagName(), "BR"); + + textNode = brNode->GetNextSibling(); + EXPECT_TRUE(textNode.get()); + EXPECT_FALSE(textNode->IsElement()); + EXPECT_TRUE(textNode->IsText()); + EXPECT_EQ(textNode->GetValue(), "Main Frame"); + + EXPECT_FALSE(textNode->GetNextSibling().get()); + EXPECT_FALSE(textNode->HasChildren()); + } + + // Test document structure by iterating through the DOM tree. + void TestStructure(CefRefPtr document) { + EXPECT_EQ(document->GetTitle(), "The Title"); + EXPECT_EQ(document->GetBaseURL(), kTestUrl); + EXPECT_EQ(document->GetCompleteURL("foo.html"), "http://tests/foo.html"); + + // Navigate the complete document structure. + CefRefPtr docNode = document->GetDocument(); + EXPECT_TRUE(docNode.get()); + EXPECT_FALSE(docNode->IsElement()); + EXPECT_FALSE(docNode->IsText()); + + CefRefPtr htmlNode = docNode->GetFirstChild(); + EXPECT_TRUE(htmlNode.get()); + EXPECT_TRUE(htmlNode->IsElement()); + EXPECT_FALSE(htmlNode->IsText()); + EXPECT_EQ(htmlNode->GetName(), "HTML"); + EXPECT_EQ(htmlNode->GetElementTagName(), "HTML"); + + EXPECT_TRUE(htmlNode->HasChildren()); + EXPECT_FALSE(htmlNode->HasElementAttributes()); + + CefRefPtr headNode = htmlNode->GetFirstChild(); + TestHeadNodeStructure(headNode); + + CefRefPtr bodyNode = headNode->GetNextSibling(); + TestBodyNodeStructure(bodyNode); + + // Retrieve the head node directly. + headNode = document->GetHead(); + TestHeadNodeStructure(headNode); + + // Retrieve the body node directly. + bodyNode = document->GetBody(); + TestBodyNodeStructure(bodyNode); + } + + // Test document modification by changing the H1 tag. + void TestModify(CefRefPtr document) { + CefRefPtr bodyNode = document->GetBody(); + CefRefPtr h1Node = bodyNode->GetFirstChild(); + + ASSERT_EQ(h1Node->GetAsMarkup(), + "

    Hello From
    " + "Main Frame

    "); + + CefRefPtr textNode = h1Node->GetFirstChild(); + ASSERT_EQ(textNode->GetValue(), "Hello From"); + ASSERT_TRUE(textNode->SetValue("A Different Message From")); + ASSERT_EQ(textNode->GetValue(), "A Different Message From"); + + CefRefPtr brNode = textNode->GetNextSibling(); + EXPECT_EQ(brNode->GetElementAttribute("class"), "some_class"); + EXPECT_TRUE(brNode->SetElementAttribute("class", "a_different_class")); + EXPECT_EQ(brNode->GetElementAttribute("class"), "a_different_class"); + + ASSERT_EQ(h1Node->GetAsMarkup(), + "

    A Different Message From
    Main Frame

    "); + + ASSERT_FALSE(h1Node->SetValue("Something Different")); + } + + virtual void Visit(CefRefPtr document) OVERRIDE { + if (test_type_ == DOM_TEST_STRUCTURE) + TestStructure(document); + else if (test_type_ == DOM_TEST_MODIFY) + TestModify(document); + + DestroyTest(); + } + + protected: + // Return from the test. + void DestroyTest() { + // Check if the test has failed. + bool result = !TestFailed(); + + // Return the result to the browser process. + CefRefPtr return_msg = + CefProcessMessage::Create(kTestMessage); + EXPECT_TRUE(return_msg->GetArgumentList()->SetBool(0, result)); + EXPECT_TRUE(browser_->SendProcessMessage(PID_BROWSER, return_msg)); + } + + CefRefPtr browser_; + DOMTestType test_type_; + + IMPLEMENT_REFCOUNTING(TestDOMVisitor); +}; + +// Used in the render process. +class DOMRendererTest : public ClientApp::RenderDelegate { + public: + DOMRendererTest() { + } + + virtual bool OnProcessMessageReceived( + CefRefPtr app, + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) OVERRIDE { + if (message->GetName() == kTestMessage) { + EXPECT_EQ(message->GetArgumentList()->GetSize(), (size_t)1); + int test_type = message->GetArgumentList()->GetInt(0); + + browser->GetMainFrame()->VisitDOM( + new TestDOMVisitor(browser, static_cast(test_type))); + return true; + } + return false; + } + + private: + IMPLEMENT_REFCOUNTING(DOMRendererTest); +}; + +// Used in the browser process. +class TestDOMHandler : public TestHandler { + public: + explicit TestDOMHandler(DOMTestType test) + : test_type_(test) { + } + + virtual void RunTest() OVERRIDE { + std::stringstream mainHtml; + mainHtml << + "" + "The Title" + "" + "

    Hello From
    " + "Main Frame

    " + "" + ""; + + AddResource(kTestUrl, mainHtml.str(), "text/html"); + CreateBrowser(kTestUrl); + } + + virtual void OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) OVERRIDE { + if (frame->IsMain()) { + // Start the test in the render process. + CefRefPtr message( + CefProcessMessage::Create(kTestMessage)); + message->GetArgumentList()->SetInt(0, test_type_); + EXPECT_TRUE(browser->SendProcessMessage(PID_RENDERER, message)); + } + } + + virtual bool OnProcessMessageReceived( + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) OVERRIDE { + EXPECT_STREQ(message->GetName().ToString().c_str(), kTestMessage); + + got_message_.yes(); + + if (message->GetArgumentList()->GetBool(0)) + got_success_.yes(); + + // Test is complete. + DestroyTest(); + + return true; + } + + DOMTestType test_type_; + TrackCallback got_message_; + TrackCallback got_success_; +}; + +} // namespace + +// Test DOM structure reading. +TEST(DOMTest, Read) { + CefRefPtr handler = + new TestDOMHandler(DOM_TEST_STRUCTURE); + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_message_); + EXPECT_TRUE(handler->got_success_); +} + +// Test DOM modifications. +TEST(DOMTest, Modify) { + CefRefPtr handler = + new TestDOMHandler(DOM_TEST_MODIFY); + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_message_); + EXPECT_TRUE(handler->got_success_); +} + +// Entry point for creating DOM renderer test objects. +// Called from client_app_delegates.cc. +void CreateDOMRendererTests(ClientApp::RenderDelegateSet& delegates) { + delegates.insert(new DOMRendererTest); +} diff --git a/tests/unittests/jsdialog_unittest.cc b/tests/unittests/jsdialog_unittest.cc new file mode 100644 index 000000000..df5312152 --- /dev/null +++ b/tests/unittests/jsdialog_unittest.cc @@ -0,0 +1,413 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "include/cef_runnable.h" +#include "tests/unittests/test_handler.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +const char* kStartUrl = "http://tests/JSDialogTestHandler.Start"; +const char* kEndUrl = "http://tests/JSDialogTestHandler.End?r="; + +class JSDialogTestHandler : public TestHandler { + public: + enum TestType { + TYPE_ALERT, + TYPE_CONFIRM, + TYPE_PROMPT, + TYPE_ONBEFOREUNLOAD, + }; + enum TestMode { + MODE_SUPPRESS, + MODE_RUN_IMMEDIATE, + MODE_RUN_DELAYED, + }; + + JSDialogTestHandler(TestType type, + TestMode mode, + bool success, + const std::string& user_input, + const std::string& result) + : type_(type), + mode_(mode), + success_(success), + user_input_(user_input), + result_(result) { + } + + virtual void RunTest() OVERRIDE { + std::string content = "START"; + + AddResource(kStartUrl, content, "text/html"); + AddResource(kEndUrl, "END", "text/html"); + + // Create the browser + CreateBrowser(kStartUrl); + } + + virtual void OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) OVERRIDE { + if (!frame->IsMain()) + return; + + std::string url = frame->GetURL(); + if (url.find(kEndUrl) == 0) { + got_onloadend_.yes(); + + std::string result = url.substr(strlen(kEndUrl)); + EXPECT_STREQ(result_.c_str(), result.c_str()); + + DestroyTest(); + } else if (type_ == TYPE_ONBEFOREUNLOAD) { + // Trigger the onunload handler. + frame->LoadURL(kEndUrl); + } + } + + virtual void Continue(CefRefPtr callback) { + callback->Continue(success_, user_input_); + } + + virtual bool OnJSDialog(CefRefPtr browser, + const CefString& origin_url, + const CefString& accept_lang, + JSDialogType dialog_type, + const CefString& message_text, + const CefString& default_prompt_text, + CefRefPtr callback, + bool& suppress_message) OVERRIDE { + got_onjsdialog_.yes(); + + EXPECT_STREQ("http://tests/", origin_url.ToString().c_str()); + EXPECT_TRUE(accept_lang.empty()); + + if (type_ == TYPE_ALERT) { + EXPECT_EQ(JSDIALOGTYPE_ALERT, dialog_type); + EXPECT_STREQ("My alert message", message_text.ToString().c_str()); + EXPECT_TRUE(default_prompt_text.empty()); + } else if (type_ == TYPE_CONFIRM) { + EXPECT_EQ(JSDIALOGTYPE_CONFIRM, dialog_type); + EXPECT_STREQ("My confirm message", message_text.ToString().c_str()); + EXPECT_TRUE(default_prompt_text.empty()); + } else if (type_ == TYPE_PROMPT) { + EXPECT_EQ(JSDIALOGTYPE_PROMPT, dialog_type); + EXPECT_STREQ("My prompt message", message_text.ToString().c_str()); + EXPECT_STREQ("my default", default_prompt_text.ToString().c_str()); + } + + EXPECT_FALSE(suppress_message); + + if (mode_ == MODE_SUPPRESS) { + // Suppress the dialog. + suppress_message = true; + return false; + } else if (mode_ == MODE_RUN_IMMEDIATE) { + // Continue immediately. + callback->Continue(success_, user_input_); + } else if (mode_ == MODE_RUN_DELAYED) { + // Continue asynchronously. + CefPostTask(TID_UI, + NewCefRunnableMethod(this, &JSDialogTestHandler::Continue, callback)); + } + + return true; + } + + virtual bool OnBeforeUnloadDialog(CefRefPtr browser, + const CefString& message_text, + bool is_reload, + CefRefPtr callback) + OVERRIDE { + got_onbeforeunloaddialog_.yes(); + + if (type_ == TYPE_ONBEFOREUNLOAD) { + EXPECT_STREQ("My unload message", message_text.ToString().c_str()); + EXPECT_FALSE(is_reload); + } + + if (mode_ == MODE_RUN_IMMEDIATE) { + // Continue immediately. + callback->Continue(success_, user_input_); + } else if (mode_ == MODE_RUN_DELAYED) { + // Continue asynchronously. + CefPostTask(TID_UI, + NewCefRunnableMethod(this, &JSDialogTestHandler::Continue, callback)); + } + + return true; + } + + virtual void OnResetDialogState(CefRefPtr browser) OVERRIDE { + got_onresetdialogstate_.yes(); + } + + TestType type_; + TestMode mode_; + bool success_; + std::string user_input_; + std::string result_; + + TrackCallback got_onjsdialog_; + TrackCallback got_onbeforeunloaddialog_; + TrackCallback got_onresetdialogstate_; + TrackCallback got_onloadend_; +}; + +} // namespace + +// Alert dialog with suppression. +TEST(JSDialogTest, AlertSuppress) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_ALERT, + JSDialogTestHandler::MODE_SUPPRESS, + true, // success + "", // user_input + ""); // result + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_onjsdialog_); + EXPECT_FALSE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// Alert dialog with immediate callback. +TEST(JSDialogTest, AlertRunImmediate) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_ALERT, + JSDialogTestHandler::MODE_RUN_IMMEDIATE, + true, // success + "", // user_input + ""); // result + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_onjsdialog_); + EXPECT_FALSE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// Alert dialog with delayed callback. +TEST(JSDialogTest, AlertRunDelayed) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_ALERT, + JSDialogTestHandler::MODE_RUN_DELAYED, + true, // success + "", // user_input + ""); // result + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_onjsdialog_); + EXPECT_FALSE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// Confirm dialog with suppression. +TEST(JSDialogTest, ConfirmSuppress) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_CONFIRM, + JSDialogTestHandler::MODE_SUPPRESS, + true, // success + "", // user_input + "cancel"); // result + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_onjsdialog_); + EXPECT_FALSE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// Confirm dialog run immediately return OK. +TEST(JSDialogTest, ConfirmRunImmediateOk) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_CONFIRM, + JSDialogTestHandler::MODE_RUN_IMMEDIATE, + true, // success + "", // user_input + "ok"); // result + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_onjsdialog_); + EXPECT_FALSE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// Confirm dialog run immediately return Cancel. +TEST(JSDialogTest, ConfirmRunImmediateCancel) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_CONFIRM, + JSDialogTestHandler::MODE_RUN_IMMEDIATE, + false, // success + "", // user_input + "cancel"); // result + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_onjsdialog_); + EXPECT_FALSE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// Confirm dialog run delayed return OK. +TEST(JSDialogTest, ConfirmRunDelayedOk) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_CONFIRM, + JSDialogTestHandler::MODE_RUN_DELAYED, + true, // success + "", // user_input + "ok"); // result + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_onjsdialog_); + EXPECT_FALSE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// Confirm dialog run delayed return Cancel. +TEST(JSDialogTest, ConfirmRunDelayedCancel) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_CONFIRM, + JSDialogTestHandler::MODE_RUN_DELAYED, + false, // success + "", // user_input + "cancel"); // result + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_onjsdialog_); + EXPECT_FALSE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// Prompt dialog with suppression. +TEST(JSDialogTest, PromptSuppress) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_PROMPT, + JSDialogTestHandler::MODE_SUPPRESS, + true, // success + "some_value", // user_input + "null"); // result + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_onjsdialog_); + EXPECT_FALSE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// Prompt dialog run immediately return OK. +TEST(JSDialogTest, PromptRunImmediateOk) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_PROMPT, + JSDialogTestHandler::MODE_RUN_IMMEDIATE, + true, // success + "some_value", // user_input + "some_value"); // result + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_onjsdialog_); + EXPECT_FALSE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// Prompt dialog run immediately return Cancel. +TEST(JSDialogTest, PromptRunImmediateCancel) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_PROMPT, + JSDialogTestHandler::MODE_RUN_IMMEDIATE, + false, // success + "some_value", // user_input + "null"); // result + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_onjsdialog_); + EXPECT_FALSE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// Prompt dialog run delayed return OK. +TEST(JSDialogTest, PromptRunDelayedOk) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_PROMPT, + JSDialogTestHandler::MODE_RUN_DELAYED, + true, // success + "some_value", // user_input + "some_value"); // result + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_onjsdialog_); + EXPECT_FALSE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// Prompt dialog run delayed return Cancel. +TEST(JSDialogTest, PromptRunDelayedCancel) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_PROMPT, + JSDialogTestHandler::MODE_RUN_DELAYED, + false, // success + "some_value", // user_input + "null"); // result + handler->ExecuteTest(); + + EXPECT_TRUE(handler->got_onjsdialog_); + EXPECT_FALSE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// OnBeforeUnload dialog with immediate callback. +TEST(JSDialogTest, OnBeforeUnloadRunImmediate) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_ONBEFOREUNLOAD, + JSDialogTestHandler::MODE_RUN_IMMEDIATE, + true, // success + "", // user_input + ""); // result + handler->ExecuteTest(); + + EXPECT_FALSE(handler->got_onjsdialog_); + EXPECT_TRUE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} + +// OnBeforeUnload dialog with delayed callback. +TEST(JSDialogTest, OnBeforeUnloadRunDelayed) { + CefRefPtr handler = + new JSDialogTestHandler(JSDialogTestHandler::TYPE_ONBEFOREUNLOAD, + JSDialogTestHandler::MODE_RUN_DELAYED, + true, // success + "", // user_input + ""); // result + handler->ExecuteTest(); + + EXPECT_FALSE(handler->got_onjsdialog_); + EXPECT_TRUE(handler->got_onbeforeunloaddialog_); + EXPECT_TRUE(handler->got_onresetdialogstate_); + EXPECT_TRUE(handler->got_onloadend_); +} diff --git a/tests/unittests/mac/English.lproj/InfoPlist.strings b/tests/unittests/mac/English.lproj/InfoPlist.strings new file mode 100644 index 000000000..fe2abe11b --- /dev/null +++ b/tests/unittests/mac/English.lproj/InfoPlist.strings @@ -0,0 +1,3 @@ +/* Localized versions of Info.plist keys */ + +NSHumanReadableCopyright = "© Chromium Embedded Framework Authors, 2010"; diff --git a/tests/unittests/mac/English.lproj/MainMenu.xib b/tests/unittests/mac/English.lproj/MainMenu.xib new file mode 100644 index 000000000..e4f7c1fc3 --- /dev/null +++ b/tests/unittests/mac/English.lproj/MainMenu.xib @@ -0,0 +1,2880 @@ + + + + 1050 + 10F569 + 820 + 1038.29 + 461.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 820 + + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + cefclient + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + TestShell + + YES + + + About cefclient + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide cefclient + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit cefclient + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + Save As… + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + Show Spelling… + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 1048576 + 2147483647 + + + submenuAction: + + Format + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Show Colors + C + 1179648 + 2147483647 + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + cefclient Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + YES + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + orderFrontColorPanel: + + + + 361 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + terminate: + + + + 369 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + + YES + + 0 + + YES + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 299 + + + YES + + + + + + 300 + + + YES + + + + + + + 344 + + + + + 345 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 389 + + + + + + + YES + + YES + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBEditorWindowLastContentRect + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBEditorWindowLastContentRect + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBEditorWindowLastContentRect + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBEditorWindowLastContentRect + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBEditorWindowLastContentRect + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBEditorWindowLastContentRect + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBEditorWindowLastContentRect + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 299.IBPluginDependency + 300.IBEditorWindowLastContentRect + 300.IBPluginDependency + 300.editorWindowContentRectSynchronizationRect + 344.IBPluginDependency + 345.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBEditorWindowLastContentRect + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 389.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + {{906, 713}, {164, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{375, 955}, {171, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{915, 473}, {272, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{675, 493}, {240, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{144, 735}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{915, 473}, {164, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{915, 473}, {238, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{835, 663}, {194, 73}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{304, 905}, {197, 73}} + {{541, 736}, {426, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{6, 836}, {430, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + {{785, 693}, {231, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + {{254, 935}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{719, 693}, {173, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + {{188, 935}, {176, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{915, 473}, {212, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{553, 553}, {193, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{18, 653}, {200, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{633, 533}, {196, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{102, 775}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + + YES + + + + + YES + + + YES + + + + 439 + + + + YES + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSBrowser + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSBrowser.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSController + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSController.h + + + + NSDocument + NSObject + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + id + id + id + id + id + id + + + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + + printDocument: + id + + + revertDocumentToSaved: + id + + + runPageLayout: + id + + + saveDocument: + id + + + saveDocumentAs: + id + + + saveDocumentTo: + id + + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocument.h + + + + NSDocument + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentScripting.h + + + + NSDocumentController + NSObject + + YES + + YES + clearRecentDocuments: + newDocument: + openDocument: + saveAllDocuments: + + + YES + id + id + id + id + + + + YES + + YES + clearRecentDocuments: + newDocument: + openDocument: + saveAllDocuments: + + + YES + + clearRecentDocuments: + id + + + newDocument: + id + + + openDocument: + id + + + saveAllDocuments: + id + + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentController.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMatrix + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSMatrix.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSMenuItem + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSMovieView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMovieView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAlert.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAnimation.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSComboBox.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSComboBoxCell.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDatePickerCell.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSImage.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSRuleEditor.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSound.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSpeechRecognizer.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSpeechSynthesizer.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSplitView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTabView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTextStorage.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTextView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTokenField.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTokenFieldCell.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbar.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSMetadata.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSNetServices.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPort.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSSpellServer.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSStream.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSXMLParser.h + + + + NSObject + + IBFrameworkSource + Print.framework/Headers/PDEPluginInterface.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CAAnimation.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CALayer.h + + + + NSObject + + IBFrameworkSource + QuartzCore.framework/Headers/CIImageProvider.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTableView + NSControl + + + + NSText + NSView + + + + NSUserDefaultsController + NSController + + IBFrameworkSource + AppKit.framework/Headers/NSUserDefaultsController.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + + + NSWindow + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../../../../cef.xcodeproj + 3 + + YES + + YES + NSMenuCheckmark + NSMenuMixedState + + + YES + {9, 8} + {7, 2} + + + + diff --git a/tests/unittests/mac/Info.plist b/tests/unittests/mac/Info.plist new file mode 100644 index 000000000..3d5f27c20 --- /dev/null +++ b/tests/unittests/mac/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + unittests.icns + CFBundleIdentifier + org.cef.unittests + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/tests/unittests/mac/unittests.icns b/tests/unittests/mac/unittests.icns new file mode 100644 index 000000000..f36742de2 Binary files /dev/null and b/tests/unittests/mac/unittests.icns differ diff --git a/tests/unittests/navigation_unittest.cc b/tests/unittests/navigation_unittest.cc new file mode 100644 index 000000000..a830314ff --- /dev/null +++ b/tests/unittests/navigation_unittest.cc @@ -0,0 +1,605 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "include/cef_callback.h" +#include "include/cef_scheme.h" +#include "tests/unittests/test_handler.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +static const char* kNav1 = "http://tests/nav1.html"; +static const char* kNav2 = "http://tests/nav2.html"; +static const char* kNav3 = "http://tests/nav3.html"; +static const char* kNav4 = "http://tests/nav4.html"; + +enum NavAction { + NA_LOAD = 1, + NA_BACK, + NA_FORWARD, + NA_CLEAR +}; + +typedef struct { + NavAction action; // What to do + const char* target; // Where to be after navigation + bool can_go_back; // After navigation, can go back? + bool can_go_forward; // After navigation, can go forward? +} NavListItem; + +// Array of navigation actions: X = current page, . = history exists +static NavListItem kNavList[] = { + // kNav1 | kNav2 | kNav3 + {NA_LOAD, kNav1, false, false}, // X + {NA_LOAD, kNav2, true, false}, // . X + {NA_BACK, kNav1, false, true}, // X . + {NA_FORWARD, kNav2, true, false}, // . X + {NA_LOAD, kNav3, true, false}, // . . X + {NA_BACK, kNav2, true, true}, // . X . + // TODO(cef): Enable once ClearHistory is implemented + // {NA_CLEAR, kNav2, false, false}, // X +}; + +#define NAV_LIST_SIZE() (sizeof(kNavList) / sizeof(NavListItem)) + +class HistoryNavTestHandler : public TestHandler { + public: + HistoryNavTestHandler() : nav_(0) {} + + virtual void RunTest() OVERRIDE { + // Add the resources that we will navigate to/from. + AddResource(kNav1, "Nav1", "text/html"); + AddResource(kNav2, "Nav2", "text/html"); + AddResource(kNav3, "Nav3", "text/html"); + + // Create the browser. + CreateBrowser(CefString()); + } + + void RunNav(CefRefPtr browser) { + if (nav_ == NAV_LIST_SIZE()) { + // End of the nav list. + DestroyTest(); + return; + } + + const NavListItem& item = kNavList[nav_]; + + // Perform the action. + switch (item.action) { + case NA_LOAD: + browser->GetMainFrame()->LoadURL(item.target); + break; + case NA_BACK: + browser->GoBack(); + break; + case NA_FORWARD: + browser->GoForward(); + break; + case NA_CLEAR: + // TODO(cef): Enable once ClearHistory is implemented + // browser->GetHost()->ClearHistory(); + // Not really a navigation action so go to the next one. + nav_++; + RunNav(browser); + break; + default: + break; + } + } + + virtual void OnAfterCreated(CefRefPtr browser) OVERRIDE { + TestHandler::OnAfterCreated(browser); + + RunNav(browser); + } + + virtual bool OnBeforeResourceLoad(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request) OVERRIDE { + const NavListItem& item = kNavList[nav_]; + + got_before_resource_load_[nav_].yes(); + + std::string url = request->GetURL(); + if (url == item.target) + got_correct_target_[nav_].yes(); + + return false; + } + + virtual void OnLoadingStateChange(CefRefPtr browser, + bool isLoading, + bool canGoBack, + bool canGoForward) OVERRIDE { + const NavListItem& item = kNavList[nav_]; + + got_loading_state_change_[nav_].yes(); + + if (item.can_go_back == canGoBack) + got_correct_can_go_back_[nav_].yes(); + if (item.can_go_forward == canGoForward) + got_correct_can_go_forward_[nav_].yes(); + } + + virtual void OnLoadStart(CefRefPtr browser, + CefRefPtr frame) OVERRIDE { + if(browser->IsPopup() || !frame->IsMain()) + return; + + const NavListItem& item = kNavList[nav_]; + + got_load_start_[nav_].yes(); + + std::string url1 = browser->GetMainFrame()->GetURL(); + std::string url2 = frame->GetURL(); + if (url1 == item.target && url2 == item.target) + got_correct_load_start_url_[nav_].yes(); + } + + virtual void OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) OVERRIDE { + if (browser->IsPopup() || !frame->IsMain()) + return; + + const NavListItem& item = kNavList[nav_]; + + got_load_end_[nav_].yes(); + + std::string url1 = browser->GetMainFrame()->GetURL(); + std::string url2 = frame->GetURL(); + if (url1 == item.target && url2 == item.target) + got_correct_load_end_url_[nav_].yes(); + + if (item.can_go_back == browser->CanGoBack()) + got_correct_can_go_back2_[nav_].yes(); + if (item.can_go_forward == browser->CanGoForward()) + got_correct_can_go_forward2_[nav_].yes(); + + nav_++; + RunNav(browser); + } + + int nav_; + + TrackCallback got_before_resource_load_[NAV_LIST_SIZE()]; + TrackCallback got_correct_target_[NAV_LIST_SIZE()]; + TrackCallback got_loading_state_change_[NAV_LIST_SIZE()]; + TrackCallback got_correct_can_go_back_[NAV_LIST_SIZE()]; + TrackCallback got_correct_can_go_forward_[NAV_LIST_SIZE()]; + TrackCallback got_load_start_[NAV_LIST_SIZE()]; + TrackCallback got_correct_load_start_url_[NAV_LIST_SIZE()]; + TrackCallback got_load_end_[NAV_LIST_SIZE()]; + TrackCallback got_correct_load_end_url_[NAV_LIST_SIZE()]; + TrackCallback got_correct_can_go_back2_[NAV_LIST_SIZE()]; + TrackCallback got_correct_can_go_forward2_[NAV_LIST_SIZE()]; +}; + +} // namespace + +// Verify history navigation. +TEST(NavigationTest, History) { + CefRefPtr handler = + new HistoryNavTestHandler(); + handler->ExecuteTest(); + + for (size_t i = 0; i < NAV_LIST_SIZE(); ++i) { + if (kNavList[i].action != NA_CLEAR) { + ASSERT_TRUE(handler->got_before_resource_load_[i]) << "i = " << i; + ASSERT_TRUE(handler->got_correct_target_[i]) << "i = " << i; + ASSERT_TRUE(handler->got_load_start_[i]) << "i = " << i; + ASSERT_TRUE(handler->got_correct_load_start_url_[i]) << "i = " << i; + } + + ASSERT_TRUE(handler->got_loading_state_change_[i]) << "i = " << i; + ASSERT_TRUE(handler->got_correct_can_go_back_[i]) << "i = " << i; + ASSERT_TRUE(handler->got_correct_can_go_forward_[i]) << "i = " << i; + + if (kNavList[i].action != NA_CLEAR) { + ASSERT_TRUE(handler->got_load_end_[i]) << "i = " << i; + ASSERT_TRUE(handler->got_correct_load_end_url_[i]) << "i = " << i; + ASSERT_TRUE(handler->got_correct_can_go_back2_[i]) << "i = " << i; + ASSERT_TRUE(handler->got_correct_can_go_forward2_[i]) << "i = " << i; + } + } +} + + +namespace { + +class FrameNameIdentNavTestHandler : public TestHandler { + public: + FrameNameIdentNavTestHandler() : browse_ct_(0) {} + + virtual void RunTest() OVERRIDE { + // Add the frame resources. + std::stringstream ss; + + // Page with named frame + ss << "Nav1" + "", "text/html"); + AddResource(kV8ContextChildTestUrl, "CHILD", + "text/html"); + CreateBrowser(kV8ContextParentTestUrl); + } else { + EXPECT_TRUE(test_url_ != NULL); + AddResource(test_url_, "TEST", "text/html"); + CreateBrowser(test_url_); + } + } + + CefRefPtr CreateTestMessage() { + CefRefPtr msg = CefProcessMessage::Create(kV8TestMsg); + EXPECT_TRUE(msg->GetArgumentList()->SetInt(0, test_mode_)); + return msg; + } + + virtual void OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) OVERRIDE { + if (frame->IsMain()) { + // Send the message to the renderer process to run the test. + EXPECT_TRUE(browser->SendProcessMessage(PID_RENDERER, + CreateTestMessage())); + } + } + + virtual bool OnProcessMessageReceived( + CefRefPtr browser, + CefProcessId source_process, + CefRefPtr message) OVERRIDE { + EXPECT_TRUE(browser.get()); + EXPECT_EQ(PID_RENDERER, source_process); + EXPECT_TRUE(message.get()); + EXPECT_TRUE(message->IsReadOnly()); + + got_message_.yes(); + + if (message->GetArgumentList()->GetBool(0)) + got_success_.yes(); + + // Test is complete. + DestroyTest(); + + return true; + } + + V8TestMode test_mode_; + const char* test_url_; + TrackCallback got_message_; + TrackCallback got_success_; +}; + +} // namespace + + +// Entry point for creating V8 renderer test objects. +// Called from client_app_delegates.cc. +void CreateV8RendererTests(ClientApp::RenderDelegateSet& delegates) { + delegates.insert(new V8RendererTest); +} + + +// Helpers for defining V8 tests. +#define V8_TEST_EX(name, test_mode, test_url) \ + TEST(V8Test, name) { \ + CefRefPtr handler = \ + new V8TestHandler(test_mode, test_url); \ + handler->ExecuteTest(); \ + EXPECT_TRUE(handler->got_message_); \ + EXPECT_TRUE(handler->got_success_); \ + } + +#define V8_TEST(name, test_mode) \ + V8_TEST_EX(name, test_mode, kV8TestUrl) + + +// Define the tests. +V8_TEST(NullCreate, V8TEST_NULL_CREATE); +V8_TEST(BoolCreate, V8TEST_BOOL_CREATE); +V8_TEST(IntCreate, V8TEST_INT_CREATE); +V8_TEST(UIntCreate, V8TEST_UINT_CREATE); +V8_TEST(DoubleCreate, V8TEST_DOUBLE_CREATE); +V8_TEST(DateCreate, V8TEST_DATE_CREATE); +V8_TEST(StringCreate, V8TEST_STRING_CREATE); +V8_TEST(ArrayCreate, V8TEST_ARRAY_CREATE); +V8_TEST(ArrayValue, V8TEST_ARRAY_VALUE); +V8_TEST(ObjectCreate, V8TEST_OBJECT_CREATE); +V8_TEST(ObjectUserData, V8TEST_OBJECT_USERDATA); +V8_TEST(ObjectAccessor, V8TEST_OBJECT_ACCESSOR); +V8_TEST(ObjectAccessorException, V8TEST_OBJECT_ACCESSOR_EXCEPTION); +V8_TEST(ObjectAccessorFail, V8TEST_OBJECT_ACCESSOR_FAIL); +V8_TEST(ObjectAccessorReadOnly, V8TEST_OBJECT_ACCESSOR_READONLY); +V8_TEST(ObjectValue, V8TEST_OBJECT_VALUE); +V8_TEST(ObjectValueReadOnly, V8TEST_OBJECT_VALUE_READONLY); +V8_TEST(ObjectValueEnum, V8TEST_OBJECT_VALUE_ENUM); +V8_TEST(ObjectValueDontEnum, V8TEST_OBJECT_VALUE_DONTENUM); +V8_TEST(ObjectValueDelete, V8TEST_OBJECT_VALUE_DELETE); +V8_TEST(ObjectValueDontDelete, V8TEST_OBJECT_VALUE_DONTDELETE); +V8_TEST(FunctionCreate, V8TEST_FUNCTION_CREATE); +V8_TEST(FunctionHandler, V8TEST_FUNCTION_HANDLER); +V8_TEST(FunctionHandlerException, V8TEST_FUNCTION_HANDLER_EXCEPTION); +V8_TEST(FunctionHandlerFail, V8TEST_FUNCTION_HANDLER_FAIL); +V8_TEST(FunctionHandlerNoObject, V8TEST_FUNCTION_HANDLER_NO_OBJECT); +V8_TEST(FunctionHandlerWithContext, V8TEST_FUNCTION_HANDLER_WITH_CONTEXT); +V8_TEST(ContextEval, V8TEST_CONTEXT_EVAL); +V8_TEST(ContextEvalException, V8TEST_CONTEXT_EVAL_EXCEPTION); +V8_TEST_EX(ContextEntered, V8TEST_CONTEXT_ENTERED, NULL); +V8_TEST_EX(Binding, V8TEST_BINDING, kV8BindingTestUrl); diff --git a/tests/unittests/values_unittest.cc b/tests/unittests/values_unittest.cc new file mode 100644 index 000000000..3e3cb83ad --- /dev/null +++ b/tests/unittests/values_unittest.cc @@ -0,0 +1,734 @@ +// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "include/cef_task.h" +#include "include/cef_values.h" +#include "tests/unittests/test_handler.h" +#include "tests/unittests/test_util.h" +#include "testing/gtest/include/gtest/gtest.h" + + +namespace { + +// Dictionary test keys. +const char* kNullKey = "null_key"; +const char* kBoolKey = "bool_key"; +const char* kIntKey = "int_key"; +const char* kDoubleKey = "double_key"; +const char* kStringKey = "string_key"; +const char* kBinaryKey = "binary_key"; +const char* kDictionaryKey = "dict_key"; +const char* kListKey = "list_key"; + +// List test indexes. +enum { + kNullIndex = 0, + kBoolIndex, + kIntIndex, + kDoubleIndex, + kStringIndex, + kBinaryIndex, + kDictionaryIndex, + kListIndex, +}; + +// Dictionary/list test values. +const bool kBoolValue = true; +const int kIntValue = 12; +const double kDoubleValue = 4.5432; +const char* kStringValue = "My string value"; + + +// BINARY TEST HELPERS + +// Test a binary value. +void TestBinary(CefRefPtr value, char* data, size_t data_size) { + // Testing requires strings longer than 15 characters. + EXPECT_GT(data_size, (size_t)15); + + EXPECT_EQ(data_size, value->GetSize()); + + char* buff = new char[data_size+1]; + char old_char; + + // Test full read. + memset(buff, 0, data_size+1); + EXPECT_EQ(data_size, value->GetData(buff, data_size, 0)); + EXPECT_TRUE(!strcmp(buff, data)); + + // Test partial read with offset. + memset(buff, 0, data_size+1); + old_char = data[15]; + data[15] = 0; + EXPECT_EQ((size_t)10, value->GetData(buff, 10, 5)); + EXPECT_TRUE(!strcmp(buff, data+5)); + data[15] = old_char; + + // Test that changes to the original data have no effect. + memset(buff, 0, data_size+1); + old_char = data[0]; + data[0] = '.'; + EXPECT_EQ((size_t)1, value->GetData(buff, 1, 0)); + EXPECT_EQ(old_char, buff[0]); + data[0] = old_char; + + // Test copy. + CefRefPtr copy = value->Copy(); + TestBinaryEqual(copy, value); + + delete [] buff; +} + +// Used to test access of binary data on a different thread. +class BinaryTask : public CefTask { + public: + BinaryTask(CefRefPtr value, char* data, size_t data_size) + : value_(value), + data_(data), + data_size_(data_size) {} + + virtual void Execute(CefThreadId threadId) OVERRIDE { + TestBinary(value_, data_, data_size_); + } + + private: + CefRefPtr value_; + char* data_; + size_t data_size_; + + IMPLEMENT_REFCOUNTING(BinaryTask); +}; + + +// DICTIONARY TEST HELPERS + +// Test dictionary null value. +void TestDictionaryNull(CefRefPtr value) { + EXPECT_FALSE(value->HasKey(kNullKey)); + EXPECT_TRUE(value->SetNull(kNullKey)); + EXPECT_TRUE(value->HasKey(kNullKey)); + EXPECT_EQ(VTYPE_NULL, value->GetType(kNullKey)); +} + +// Test dictionary bool value. +void TestDictionaryBool(CefRefPtr value) { + EXPECT_FALSE(value->HasKey(kBoolKey)); + EXPECT_TRUE(value->SetBool(kBoolKey, kBoolValue)); + EXPECT_TRUE(value->HasKey(kBoolKey)); + EXPECT_EQ(VTYPE_BOOL, value->GetType(kBoolKey)); + EXPECT_EQ(kBoolValue, value->GetBool(kBoolKey)); +} + +// Test dictionary int value. +void TestDictionaryInt(CefRefPtr value) { + EXPECT_FALSE(value->HasKey(kIntKey)); + EXPECT_TRUE(value->SetInt(kIntKey, kIntValue)); + EXPECT_TRUE(value->HasKey(kIntKey)); + EXPECT_EQ(VTYPE_INT, value->GetType(kIntKey)); + EXPECT_EQ(kIntValue, value->GetInt(kIntKey)); +} + +// Test dictionary double value. +void TestDictionaryDouble(CefRefPtr value) { + EXPECT_FALSE(value->HasKey(kDoubleKey)); + EXPECT_TRUE(value->SetDouble(kDoubleKey, kDoubleValue)); + EXPECT_TRUE(value->HasKey(kDoubleKey)); + EXPECT_EQ(VTYPE_DOUBLE, value->GetType(kDoubleKey)); + EXPECT_EQ(kDoubleValue, value->GetDouble(kDoubleKey)); +} + +// Test dictionary string value. +void TestDictionaryString(CefRefPtr value) { + EXPECT_FALSE(value->HasKey(kStringKey)); + EXPECT_TRUE(value->SetString(kStringKey, kStringValue)); + EXPECT_TRUE(value->HasKey(kStringKey)); + EXPECT_EQ(VTYPE_STRING, value->GetType(kStringKey)); + EXPECT_EQ(kStringValue, value->GetString(kStringKey).ToString()); +} + +// Test dictionary binary value. +void TestDictionaryBinary(CefRefPtr value, + char* binary_data, size_t binary_data_size, + CefRefPtr& binary_value) { + binary_value = CefBinaryValue::Create(binary_data, binary_data_size); + EXPECT_TRUE(binary_value.get()); + EXPECT_TRUE(binary_value->IsValid()); + EXPECT_FALSE(binary_value->IsOwned()); + EXPECT_FALSE(value->HasKey(kBinaryKey)); + EXPECT_TRUE(value->SetBinary(kBinaryKey, binary_value)); + EXPECT_FALSE(binary_value->IsValid()); // Value should be detached + EXPECT_TRUE(value->HasKey(kBinaryKey)); + EXPECT_EQ(VTYPE_BINARY, value->GetType(kBinaryKey)); + binary_value = value->GetBinary(kBinaryKey); + EXPECT_TRUE(binary_value.get()); + EXPECT_TRUE(binary_value->IsValid()); + EXPECT_TRUE(binary_value->IsOwned()); + TestBinary(binary_value, binary_data, binary_data_size); +} + +// Test dictionary dictionary value. +void TestDictionaryDictionary(CefRefPtr value, + CefRefPtr& dictionary_value) { + dictionary_value = CefDictionaryValue::Create(); + EXPECT_TRUE(dictionary_value.get()); + EXPECT_TRUE(dictionary_value->IsValid()); + EXPECT_FALSE(dictionary_value->IsOwned()); + EXPECT_FALSE(dictionary_value->IsReadOnly()); + EXPECT_TRUE(dictionary_value->SetInt(kIntKey, kIntValue)); + EXPECT_EQ((size_t)1, dictionary_value->GetSize()); + EXPECT_FALSE(value->HasKey(kDictionaryKey)); + EXPECT_TRUE(value->SetDictionary(kDictionaryKey, dictionary_value)); + EXPECT_FALSE(dictionary_value->IsValid()); // Value should be detached + EXPECT_TRUE(value->HasKey(kDictionaryKey)); + EXPECT_EQ(VTYPE_DICTIONARY, value->GetType(kDictionaryKey)); + dictionary_value = value->GetDictionary(kDictionaryKey); + EXPECT_TRUE(dictionary_value.get()); + EXPECT_TRUE(dictionary_value->IsValid()); + EXPECT_TRUE(dictionary_value->IsOwned()); + EXPECT_FALSE(dictionary_value->IsReadOnly()); + EXPECT_EQ((size_t)1, dictionary_value->GetSize()); + EXPECT_EQ(kIntValue, dictionary_value->GetInt(kIntKey)); +} + +// Test dictionary list value. +void TestDictionaryList(CefRefPtr value, + CefRefPtr& list_value) { + list_value = CefListValue::Create(); + EXPECT_TRUE(list_value.get()); + EXPECT_TRUE(list_value->IsValid()); + EXPECT_FALSE(list_value->IsOwned()); + EXPECT_FALSE(list_value->IsReadOnly()); + EXPECT_TRUE(list_value->SetInt(0, kIntValue)); + EXPECT_EQ((size_t)1, list_value->GetSize()); + EXPECT_FALSE(value->HasKey(kListKey)); + EXPECT_TRUE(value->SetList(kListKey, list_value)); + EXPECT_FALSE(list_value->IsValid()); // Value should be detached + EXPECT_TRUE(value->HasKey(kListKey)); + EXPECT_EQ(VTYPE_LIST, value->GetType(kListKey)); + list_value = value->GetList(kListKey); + EXPECT_TRUE(list_value.get()); + EXPECT_TRUE(list_value->IsValid()); + EXPECT_TRUE(list_value->IsOwned()); + EXPECT_FALSE(list_value->IsReadOnly()); + EXPECT_EQ((size_t)1, list_value->GetSize()); + EXPECT_EQ(kIntValue, list_value->GetInt(0)); +} + +// Test dictionary value. +void TestDictionary(CefRefPtr value, + char* binary_data, size_t binary_data_size) { + CefRefPtr binary_value; + CefRefPtr dictionary_value; + CefRefPtr list_value; + + // Test the size. + EXPECT_EQ((size_t)0, value->GetSize()); + + TestDictionaryNull(value); + TestDictionaryBool(value); + TestDictionaryInt(value); + TestDictionaryDouble(value); + TestDictionaryString(value); + TestDictionaryBinary(value, binary_data, binary_data_size, binary_value); + TestDictionaryDictionary(value, dictionary_value); + TestDictionaryList(value, list_value); + + // Test the size. + EXPECT_EQ((size_t)8, value->GetSize()); + + // Test copy. + CefRefPtr copy = value->Copy(false); + TestDictionaryEqual(value, copy); + + // Test removal. + EXPECT_TRUE(value->Remove(kNullKey)); + EXPECT_FALSE(value->HasKey(kNullKey)); + + EXPECT_TRUE(value->Remove(kBoolKey)); + EXPECT_FALSE(value->HasKey(kBoolKey)); + + EXPECT_TRUE(value->Remove(kIntKey)); + EXPECT_FALSE(value->HasKey(kIntKey)); + + EXPECT_TRUE(value->Remove(kDoubleKey)); + EXPECT_FALSE(value->HasKey(kDoubleKey)); + + EXPECT_TRUE(value->Remove(kStringKey)); + EXPECT_FALSE(value->HasKey(kStringKey)); + + EXPECT_TRUE(value->Remove(kBinaryKey)); + EXPECT_FALSE(value->HasKey(kBinaryKey)); + EXPECT_FALSE(binary_value->IsValid()); // Value should be detached + + EXPECT_TRUE(value->Remove(kDictionaryKey)); + EXPECT_FALSE(value->HasKey(kDictionaryKey)); + EXPECT_FALSE(dictionary_value->IsValid()); // Value should be detached + + EXPECT_TRUE(value->Remove(kListKey)); + EXPECT_FALSE(value->HasKey(kListKey)); + EXPECT_FALSE(list_value->IsValid()); // Value should be detached + + // Test the size. + EXPECT_EQ((size_t)0, value->GetSize()); + + // Re-add some values. + TestDictionaryNull(value); + TestDictionaryBool(value); + TestDictionaryDictionary(value, dictionary_value); + + // Test the size. + EXPECT_EQ((size_t)3, value->GetSize()); + + // Clear the values. + EXPECT_TRUE(value->Clear()); + EXPECT_EQ((size_t)0, value->GetSize()); + EXPECT_FALSE(dictionary_value->IsValid()); // Value should be detached +} + +// Used to test access of dictionary data on a different thread. +class DictionaryTask : public CefTask { + public: + DictionaryTask(CefRefPtr value, char* binary_data, + size_t binary_data_size) + : value_(value), + binary_data_(binary_data), + binary_data_size_(binary_data_size) {} + + virtual void Execute(CefThreadId threadId) OVERRIDE { + TestDictionary(value_, binary_data_, binary_data_size_); + } + + private: + CefRefPtr value_; + char* binary_data_; + size_t binary_data_size_; + + IMPLEMENT_REFCOUNTING(DictionaryTask); +}; + + +// LIST TEST HELPERS + +// Test list null value. +void TestListNull(CefRefPtr value, int index) { + CefValueType type = value->GetType(index); + EXPECT_TRUE(type == VTYPE_INVALID || type == VTYPE_NULL); + + EXPECT_TRUE(value->SetNull(index)); + EXPECT_EQ(VTYPE_NULL, value->GetType(index)); +} + +// Test list bool value. +void TestListBool(CefRefPtr value, int index) { + CefValueType type = value->GetType(index); + EXPECT_TRUE(type == VTYPE_INVALID || type == VTYPE_NULL); + + EXPECT_TRUE(value->SetBool(index, kBoolValue)); + EXPECT_EQ(VTYPE_BOOL, value->GetType(index)); + EXPECT_EQ(kBoolValue, value->GetBool(index)); +} + +// Test list int value. +void TestListInt(CefRefPtr value, int index) { + CefValueType type = value->GetType(index); + EXPECT_TRUE(type == VTYPE_INVALID || type == VTYPE_NULL); + + EXPECT_TRUE(value->SetInt(index, kIntValue)); + EXPECT_EQ(VTYPE_INT, value->GetType(index)); + EXPECT_EQ(kIntValue, value->GetInt(index)); +} + +// Test list double value. +void TestListDouble(CefRefPtr value, int index) { + CefValueType type = value->GetType(index); + EXPECT_TRUE(type == VTYPE_INVALID || type == VTYPE_NULL); + + EXPECT_TRUE(value->SetDouble(index, kDoubleValue)); + EXPECT_EQ(VTYPE_DOUBLE, value->GetType(index)); + EXPECT_EQ(kDoubleValue, value->GetDouble(index)); +} + +// Test list string value. +void TestListString(CefRefPtr value, int index) { + CefValueType type = value->GetType(index); + EXPECT_TRUE(type == VTYPE_INVALID || type == VTYPE_NULL); + + EXPECT_TRUE(value->SetString(index, kStringValue)); + EXPECT_EQ(VTYPE_STRING, value->GetType(index)); + EXPECT_EQ(kStringValue, value->GetString(index).ToString()); +} + +// Test list binary value. +void TestListBinary(CefRefPtr value, int index, + char* binary_data, size_t binary_data_size, + CefRefPtr& binary_value) { + binary_value = CefBinaryValue::Create(binary_data, binary_data_size); + EXPECT_TRUE(binary_value.get()); + EXPECT_TRUE(binary_value->IsValid()); + EXPECT_FALSE(binary_value->IsOwned()); + + CefValueType type = value->GetType(index); + EXPECT_TRUE(type == VTYPE_INVALID || type == VTYPE_NULL); + + EXPECT_TRUE(value->SetBinary(index, binary_value)); + EXPECT_FALSE(binary_value->IsValid()); // Value should be detached + EXPECT_EQ(VTYPE_BINARY, value->GetType(index)); + binary_value = value->GetBinary(index); + EXPECT_TRUE(binary_value.get()); + EXPECT_TRUE(binary_value->IsValid()); + EXPECT_TRUE(binary_value->IsOwned()); + TestBinary(binary_value, binary_data, binary_data_size); +} + +// Test list dictionary value. +void TestListDictionary(CefRefPtr value, int index, + CefRefPtr& dictionary_value) { + dictionary_value = CefDictionaryValue::Create(); + EXPECT_TRUE(dictionary_value.get()); + EXPECT_TRUE(dictionary_value->IsValid()); + EXPECT_FALSE(dictionary_value->IsOwned()); + EXPECT_FALSE(dictionary_value->IsReadOnly()); + EXPECT_TRUE(dictionary_value->SetInt(kIntKey, kIntValue)); + EXPECT_EQ((size_t)1, dictionary_value->GetSize()); + + CefValueType type = value->GetType(index); + EXPECT_TRUE(type == VTYPE_INVALID || type == VTYPE_NULL); + + EXPECT_TRUE(value->SetDictionary(index, dictionary_value)); + EXPECT_FALSE(dictionary_value->IsValid()); // Value should be detached + EXPECT_EQ(VTYPE_DICTIONARY, value->GetType(index)); + dictionary_value = value->GetDictionary(index); + EXPECT_TRUE(dictionary_value.get()); + EXPECT_TRUE(dictionary_value->IsValid()); + EXPECT_TRUE(dictionary_value->IsOwned()); + EXPECT_FALSE(dictionary_value->IsReadOnly()); + EXPECT_EQ((size_t)1, dictionary_value->GetSize()); + EXPECT_EQ(kIntValue, dictionary_value->GetInt(kIntKey)); +} + +// Test list list value. +void TestListList(CefRefPtr value, int index, + CefRefPtr& list_value) { + list_value = CefListValue::Create(); + EXPECT_TRUE(list_value.get()); + EXPECT_TRUE(list_value->IsValid()); + EXPECT_FALSE(list_value->IsOwned()); + EXPECT_FALSE(list_value->IsReadOnly()); + EXPECT_TRUE(list_value->SetInt(0, kIntValue)); + EXPECT_EQ((size_t)1, list_value->GetSize()); + + CefValueType type = value->GetType(index); + EXPECT_TRUE(type == VTYPE_INVALID || type == VTYPE_NULL); + + EXPECT_TRUE(value->SetList(index, list_value)); + EXPECT_FALSE(list_value->IsValid()); // Value should be detached + EXPECT_EQ(VTYPE_LIST, value->GetType(index)); + list_value = value->GetList(index); + EXPECT_TRUE(list_value.get()); + EXPECT_TRUE(list_value->IsValid()); + EXPECT_TRUE(list_value->IsOwned()); + EXPECT_FALSE(list_value->IsReadOnly()); + EXPECT_EQ((size_t)1, list_value->GetSize()); + EXPECT_EQ(kIntValue, list_value->GetInt(0)); +} + +// Test list value. +void TestList(CefRefPtr value, + char* binary_data, size_t binary_data_size) { + CefRefPtr binary_value; + CefRefPtr dictionary_value; + CefRefPtr list_value; + + // Test the size. + EXPECT_EQ((size_t)0, value->GetSize()); + + // Set the size. + EXPECT_TRUE(value->SetSize(8)); + EXPECT_EQ((size_t)8, value->GetSize()); + + EXPECT_EQ(VTYPE_NULL, value->GetType(kNullIndex)); + TestListNull(value, kNullIndex); + EXPECT_EQ(VTYPE_NULL, value->GetType(kBoolIndex)); + TestListBool(value, kBoolIndex); + EXPECT_EQ(VTYPE_NULL, value->GetType(kIntIndex)); + TestListInt(value, kIntIndex); + EXPECT_EQ(VTYPE_NULL, value->GetType(kDoubleIndex)); + TestListDouble(value, kDoubleIndex); + EXPECT_EQ(VTYPE_NULL, value->GetType(kStringIndex)); + TestListString(value, kStringIndex); + EXPECT_EQ(VTYPE_NULL, value->GetType(kBinaryIndex)); + TestListBinary(value, kBinaryIndex, binary_data, binary_data_size, + binary_value); + EXPECT_EQ(VTYPE_NULL, value->GetType(kDictionaryIndex)); + TestListDictionary(value, kDictionaryIndex, dictionary_value); + EXPECT_EQ(VTYPE_NULL, value->GetType(kListIndex)); + TestListList(value, kListIndex, list_value); + + // Test the size. + EXPECT_EQ((size_t)8, value->GetSize()); + + // Test copy. + CefRefPtr copy = value->Copy(); + TestListEqual(value, copy); + + // Test removal (in reverse order so indexes stay valid). + EXPECT_TRUE(value->Remove(kListIndex)); + EXPECT_EQ((size_t)7, value->GetSize()); + EXPECT_FALSE(list_value->IsValid()); // Value should be detached + + EXPECT_TRUE(value->Remove(kDictionaryIndex)); + EXPECT_EQ((size_t)6, value->GetSize()); + EXPECT_FALSE(dictionary_value->IsValid()); // Value should be detached + + EXPECT_TRUE(value->Remove(kBinaryIndex)); + EXPECT_EQ((size_t)5, value->GetSize()); + EXPECT_FALSE(binary_value->IsValid()); // Value should be detached + + EXPECT_TRUE(value->Remove(kStringIndex)); + EXPECT_EQ((size_t)4, value->GetSize()); + + EXPECT_TRUE(value->Remove(kDoubleIndex)); + EXPECT_EQ((size_t)3, value->GetSize()); + + EXPECT_TRUE(value->Remove(kIntIndex)); + EXPECT_EQ((size_t)2, value->GetSize()); + + EXPECT_TRUE(value->Remove(kBoolIndex)); + EXPECT_EQ((size_t)1, value->GetSize()); + + EXPECT_TRUE(value->Remove(kNullIndex)); + EXPECT_EQ((size_t)0, value->GetSize()); + + // Re-add some values. + EXPECT_EQ(VTYPE_INVALID, value->GetType(0)); + TestListNull(value, 0); + EXPECT_EQ(VTYPE_INVALID, value->GetType(1)); + TestListBool(value, 1); + EXPECT_EQ(VTYPE_INVALID, value->GetType(2)); + TestListList(value, 2, list_value); + + // Test the size. + EXPECT_EQ((size_t)3, value->GetSize()); + + // Clear the values. + EXPECT_TRUE(value->Clear()); + EXPECT_EQ((size_t)0, value->GetSize()); + EXPECT_FALSE(list_value->IsValid()); // Value should be detached + + // Add some values in random order. + EXPECT_EQ(VTYPE_INVALID, value->GetType(2)); + TestListInt(value, 2); + EXPECT_EQ(VTYPE_NULL, value->GetType(0)); + TestListBool(value, 0); + EXPECT_EQ(VTYPE_NULL, value->GetType(1)); + TestListList(value, 1, list_value); + + EXPECT_EQ(VTYPE_BOOL, value->GetType(0)); + EXPECT_EQ(VTYPE_LIST, value->GetType(1)); + EXPECT_EQ(VTYPE_INT, value->GetType(2)); + + // Test the size. + EXPECT_EQ((size_t)3, value->GetSize()); + + // Clear some values. + EXPECT_TRUE(value->SetSize(1)); + EXPECT_EQ((size_t)1, value->GetSize()); + EXPECT_FALSE(list_value->IsValid()); // Value should be detached + + EXPECT_EQ(VTYPE_BOOL, value->GetType(0)); + EXPECT_EQ(VTYPE_INVALID, value->GetType(1)); + EXPECT_EQ(VTYPE_INVALID, value->GetType(2)); + + // Clear all values. + EXPECT_TRUE(value->Clear()); + EXPECT_EQ((size_t)0, value->GetSize()); +} + +// Used to test access of list data on a different thread. +class ListTask : public CefTask { + public: + ListTask(CefRefPtr value, char* binary_data, + size_t binary_data_size) + : value_(value), + binary_data_(binary_data), + binary_data_size_(binary_data_size) {} + + virtual void Execute(CefThreadId threadId) OVERRIDE { + TestList(value_, binary_data_, binary_data_size_); + } + + private: + CefRefPtr value_; + char* binary_data_; + size_t binary_data_size_; + + IMPLEMENT_REFCOUNTING(ListTask); +}; + +} // namespace + + +// Test binary value access. +TEST(ValuesTest, BinaryAccess) { + char data[] = "This is my test data"; + + CefRefPtr value = + CefBinaryValue::Create(data, sizeof(data)-1); + EXPECT_TRUE(value.get()); + EXPECT_TRUE(value->IsValid()); + EXPECT_FALSE(value->IsOwned()); + + // Test on this thread. + TestBinary(value, data, sizeof(data)-1); +} + +// Test binary value access on a different thread. +TEST(ValuesTest, BinaryAccessOtherThread) { + char data[] = "This is my test data"; + + CefRefPtr value = + CefBinaryValue::Create(data, sizeof(data)-1); + EXPECT_TRUE(value.get()); + EXPECT_TRUE(value->IsValid()); + EXPECT_FALSE(value->IsOwned()); + + // Test on a different thread. + CefPostTask(TID_UI, new BinaryTask(value, data, sizeof(data)-1)); + WaitForUIThread(); +} + +// Test dictionary value access. +TEST(ValuesTest, DictionaryAccess) { + CefRefPtr value = CefDictionaryValue::Create(); + EXPECT_TRUE(value.get()); + EXPECT_TRUE(value->IsValid()); + EXPECT_FALSE(value->IsOwned()); + EXPECT_FALSE(value->IsReadOnly()); + + char binary_data[] = "This is my test data"; + + // Test on this thread. + TestDictionary(value, binary_data, sizeof(binary_data)-1); +} + +// Test dictionary value access on a different thread. +TEST(ValuesTest, DictionaryAccessOtherThread) { + CefRefPtr value = CefDictionaryValue::Create(); + EXPECT_TRUE(value.get()); + EXPECT_TRUE(value->IsValid()); + EXPECT_FALSE(value->IsOwned()); + EXPECT_FALSE(value->IsReadOnly()); + + char binary_data[] = "This is my test data"; + + // Test on a different thread. + CefPostTask(TID_UI, + new DictionaryTask(value, binary_data, sizeof(binary_data)-1)); + WaitForUIThread(); +} + +// Test dictionary value nested detachment +TEST(ValuesTest, DictionaryDetachment) { + CefRefPtr value = CefDictionaryValue::Create(); + EXPECT_TRUE(value.get()); + EXPECT_TRUE(value->IsValid()); + EXPECT_FALSE(value->IsOwned()); + EXPECT_FALSE(value->IsReadOnly()); + + CefRefPtr dictionary_value = CefDictionaryValue::Create(); + CefRefPtr dictionary_value2 = + CefDictionaryValue::Create(); + CefRefPtr dictionary_value3 = + CefDictionaryValue::Create(); + + dictionary_value2->SetDictionary(kDictionaryKey, dictionary_value3); + EXPECT_FALSE(dictionary_value3->IsValid()); + dictionary_value->SetDictionary(kDictionaryKey, dictionary_value2); + EXPECT_FALSE(dictionary_value2->IsValid()); + value->SetDictionary(kDictionaryKey, dictionary_value); + EXPECT_FALSE(dictionary_value->IsValid()); + + dictionary_value = value->GetDictionary(kDictionaryKey); + EXPECT_TRUE(dictionary_value.get()); + EXPECT_TRUE(dictionary_value->IsValid()); + + dictionary_value2 = dictionary_value->GetDictionary(kDictionaryKey); + EXPECT_TRUE(dictionary_value2.get()); + EXPECT_TRUE(dictionary_value2->IsValid()); + + dictionary_value3 = dictionary_value2->GetDictionary(kDictionaryKey); + EXPECT_TRUE(dictionary_value3.get()); + EXPECT_TRUE(dictionary_value3->IsValid()); + + EXPECT_TRUE(value->Remove(kDictionaryKey)); + EXPECT_FALSE(dictionary_value->IsValid()); + EXPECT_FALSE(dictionary_value2->IsValid()); + EXPECT_FALSE(dictionary_value3->IsValid()); +} + +// Test list value access. +TEST(ValuesTest, ListAccess) { + CefRefPtr value = CefListValue::Create(); + EXPECT_TRUE(value.get()); + EXPECT_TRUE(value->IsValid()); + EXPECT_FALSE(value->IsOwned()); + EXPECT_FALSE(value->IsReadOnly()); + + char binary_data[] = "This is my test data"; + + // Test on this thread. + TestList(value, binary_data, sizeof(binary_data)-1); +} + +// Test list value access on a different thread. +TEST(ValuesTest, ListAccessOtherThread) { + CefRefPtr value = CefListValue::Create(); + EXPECT_TRUE(value.get()); + EXPECT_TRUE(value->IsValid()); + EXPECT_FALSE(value->IsOwned()); + EXPECT_FALSE(value->IsReadOnly()); + + char binary_data[] = "This is my test data"; + + // Test on a different thread. + CefPostTask(TID_UI, new ListTask(value, binary_data, sizeof(binary_data)-1)); + WaitForUIThread(); +} + +// Test list value nested detachment +TEST(ValuesTest, ListDetachment) { + CefRefPtr value = CefListValue::Create(); + EXPECT_TRUE(value.get()); + EXPECT_TRUE(value->IsValid()); + EXPECT_FALSE(value->IsOwned()); + EXPECT_FALSE(value->IsReadOnly()); + + CefRefPtr list_value = CefListValue::Create(); + CefRefPtr list_value2 = CefListValue::Create(); + CefRefPtr list_value3 = CefListValue::Create(); + + list_value2->SetList(0, list_value3); + EXPECT_FALSE(list_value3->IsValid()); + list_value->SetList(0, list_value2); + EXPECT_FALSE(list_value2->IsValid()); + value->SetList(0, list_value); + EXPECT_FALSE(list_value->IsValid()); + + list_value = value->GetList(0); + EXPECT_TRUE(list_value.get()); + EXPECT_TRUE(list_value->IsValid()); + + list_value2 = list_value->GetList(0); + EXPECT_TRUE(list_value2.get()); + EXPECT_TRUE(list_value2->IsValid()); + + list_value3 = list_value2->GetList(0); + EXPECT_TRUE(list_value3.get()); + EXPECT_TRUE(list_value3->IsValid()); + + EXPECT_TRUE(value->Remove(0)); + EXPECT_FALSE(list_value->IsValid()); + EXPECT_FALSE(list_value2->IsValid()); + EXPECT_FALSE(list_value3->IsValid()); +} diff --git a/tests/unittests/xml_reader_unittest.cc b/tests/unittests/xml_reader_unittest.cc new file mode 100644 index 000000000..fcc85600e --- /dev/null +++ b/tests/unittests/xml_reader_unittest.cc @@ -0,0 +1,642 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "include/cef_stream.h" +#include "include/cef_xml_reader.h" +#include "include/wrapper/cef_xml_object.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +char g_test_xml[] = + "\n" + "\n" + "\n" + " \n" + "]>\n" + "\n" + " value A\n" + " \n" + " \n" + " value B1\n" + " data]]>\n" + " &EB;\n" + " this is mixed content &EA;\n" + " \n" + " " + "\n" + "\n"; + +} // namespace + +// Test XML reading +TEST(XmlReaderTest, Read) { + // Create the stream reader. + CefRefPtr stream( + CefStreamReader::CreateForData(g_test_xml, sizeof(g_test_xml) - 1)); + ASSERT_TRUE(stream.get() != NULL); + + // Create the XML reader. + CefRefPtr reader( + CefXmlReader::Create(stream, XML_ENCODING_NONE, + "http://www.example.org/example.xml")); + ASSERT_TRUE(reader.get() != NULL); + + // Move to the processing instruction node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 0); + ASSERT_EQ(reader->GetType(), XML_NODE_PROCESSING_INSTRUCTION); + ASSERT_EQ(reader->GetLocalName(), "my_instruction"); + ASSERT_EQ(reader->GetQualifiedName(), "my_instruction"); + ASSERT_TRUE(reader->HasValue()); + ASSERT_EQ(reader->GetValue(), "my_value"); + + // Move to the DOCTYPE node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 0); + ASSERT_EQ(reader->GetType(), XML_NODE_DOCUMENT_TYPE); + ASSERT_EQ(reader->GetLocalName(), "my_document"); + ASSERT_EQ(reader->GetQualifiedName(), "my_document"); + ASSERT_FALSE(reader->HasValue()); + + // Move to ns:obj element start node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 0); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_START); + ASSERT_EQ(reader->GetLocalName(), "obj"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:obj"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_TRUE(reader->HasAttributes()); + ASSERT_EQ(reader->GetAttributeCount(), (size_t)1); + ASSERT_EQ(reader->GetAttribute(0), "http://www.example.org/ns"); + ASSERT_EQ(reader->GetAttribute("xmlns:ns"), "http://www.example.org/ns"); + ASSERT_EQ(reader->GetAttribute("ns", "http://www.w3.org/2000/xmlns/"), + "http://www.example.org/ns"); + + // Move to the whitespace node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetType(), XML_NODE_WHITESPACE); + + // Move to the ns:objA element start node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 1); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_START); + ASSERT_EQ(reader->GetLocalName(), "objA"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objA"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the ns:objA value node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_TEXT); + ASSERT_EQ(reader->GetLocalName(), "#text"); + ASSERT_EQ(reader->GetQualifiedName(), "#text"); + ASSERT_TRUE(reader->HasValue()); + ASSERT_EQ(reader->GetValue(), "value A"); + + // Move to the ns:objA element ending node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 1); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_END); + ASSERT_EQ(reader->GetLocalName(), "objA"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objA"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the whitespace node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 1); + ASSERT_EQ(reader->GetType(), XML_NODE_WHITESPACE); + + // Move to the comment node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 1); + ASSERT_EQ(reader->GetType(), XML_NODE_COMMENT); + ASSERT_EQ(reader->GetLocalName(), "#comment"); + ASSERT_EQ(reader->GetQualifiedName(), "#comment"); + ASSERT_TRUE(reader->HasValue()); + ASSERT_EQ(reader->GetValue(), " my comment "); + + // Move to the whitespace node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetType(), XML_NODE_WHITESPACE); + + // Move to the ns:objB element start node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 1); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_START); + ASSERT_EQ(reader->GetLocalName(), "objB"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objB"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the whitespace node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetType(), XML_NODE_WHITESPACE); + + // Move to the ns:objB_1 element start node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_START); + ASSERT_EQ(reader->GetLocalName(), "objB_1"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objB_1"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the ns:objB_1 value node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 3); + ASSERT_EQ(reader->GetType(), XML_NODE_TEXT); + ASSERT_TRUE(reader->HasValue()); + ASSERT_EQ(reader->GetValue(), "value B1"); + + // Move to the ns:objB_1 element ending node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_END); + ASSERT_EQ(reader->GetLocalName(), "objB_1"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objB_1"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the whitespace node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetType(), XML_NODE_WHITESPACE); + + // Move to the ns:objB_2 element start node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_START); + ASSERT_EQ(reader->GetLocalName(), "objB_2"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objB_2"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the ns:objB_2 value node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 3); + ASSERT_EQ(reader->GetType(), XML_NODE_CDATA); + ASSERT_TRUE(reader->HasValue()); + ASSERT_EQ(reader->GetValue(), "some
    data"); + + // Move to the ns:objB_2 element ending node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_END); + ASSERT_EQ(reader->GetLocalName(), "objB_2"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objB_2"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the whitespace node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetType(), XML_NODE_WHITESPACE); + + // Move to the ns:objB_3 element start node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_START); + ASSERT_EQ(reader->GetLocalName(), "objB_3"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objB_3"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the EB entity reference node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 3); + ASSERT_EQ(reader->GetType(), XML_NODE_ENTITY_REFERENCE); + ASSERT_EQ(reader->GetLocalName(), "EB"); + ASSERT_EQ(reader->GetQualifiedName(), "EB"); + ASSERT_TRUE(reader->HasValue()); + ASSERT_EQ(reader->GetValue(), "EB Value"); + + // Move to the ns:objB_3 element ending node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_END); + ASSERT_EQ(reader->GetLocalName(), "objB_3"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objB_3"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the whitespace node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetType(), XML_NODE_WHITESPACE); + + // Move to the ns:objB_4 element start node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_START); + ASSERT_EQ(reader->GetLocalName(), "objB_4"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objB_4"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + ASSERT_EQ(reader->GetInnerXml(), "this is mixed content &EA;"); + ASSERT_EQ(reader->GetOuterXml(), + "" + "this is mixed content &EA;"); + + // Move to the element node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 3); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_START); + ASSERT_EQ(reader->GetLocalName(), "b"); + ASSERT_EQ(reader->GetQualifiedName(), "b"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the text node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 4); + ASSERT_EQ(reader->GetType(), XML_NODE_TEXT); + ASSERT_EQ(reader->GetLocalName(), "#text"); + ASSERT_EQ(reader->GetQualifiedName(), "#text"); + ASSERT_TRUE(reader->HasValue()); + ASSERT_EQ(reader->GetValue(), "this is"); + + // Move to the element node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 3); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_END); + ASSERT_EQ(reader->GetLocalName(), "b"); + ASSERT_EQ(reader->GetQualifiedName(), "b"); + + // Move to the text node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 3); + ASSERT_EQ(reader->GetType(), XML_NODE_TEXT); + ASSERT_EQ(reader->GetLocalName(), "#text"); + ASSERT_EQ(reader->GetQualifiedName(), "#text"); + ASSERT_TRUE(reader->HasValue()); + ASSERT_EQ(reader->GetValue(), " mixed content "); + + // Move to the EA entity reference node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 3); + ASSERT_EQ(reader->GetType(), XML_NODE_ENTITY_REFERENCE); + ASSERT_EQ(reader->GetLocalName(), "EA"); + ASSERT_EQ(reader->GetQualifiedName(), "EA"); + ASSERT_TRUE(reader->HasValue()); + ASSERT_EQ(reader->GetValue(), "EA Value"); + + // Move to the ns:objB_4 element ending node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_END); + ASSERT_EQ(reader->GetLocalName(), "objB_4"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objB_4"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the whitespace node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetType(), XML_NODE_WHITESPACE); + + // Move to the ns:objB element ending node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 1); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_END); + ASSERT_EQ(reader->GetLocalName(), "objB"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objB"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the whitespace node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetType(), XML_NODE_WHITESPACE); + + // Move to the ns:objC element start node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 1); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_START); + ASSERT_EQ(reader->GetLocalName(), "objC"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objC"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_TRUE(reader->IsEmptyElement()); + ASSERT_TRUE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + ASSERT_EQ(reader->GetAttributeCount(), (size_t)2); + ASSERT_EQ(reader->GetAttribute(0), "value C1"); + ASSERT_EQ(reader->GetAttribute("ns:attr1"), "value C1"); + ASSERT_EQ(reader->GetAttribute("attr1", "http://www.example.org/ns"), + "value C1"); + ASSERT_EQ(reader->GetAttribute(1), "value C2"); + ASSERT_EQ(reader->GetAttribute("ns:attr2"), "value C2"); + ASSERT_EQ(reader->GetAttribute("attr2", "http://www.example.org/ns"), + "value C2"); + + // Move to the ns:attr1 attribute. + ASSERT_TRUE(reader->MoveToFirstAttribute()); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_ATTRIBUTE); + ASSERT_EQ(reader->GetLocalName(), "attr1"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:attr1"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_TRUE(reader->HasValue()); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_EQ(reader->GetValue(), "value C1"); + + // Move to the ns:attr2 attribute. + ASSERT_TRUE(reader->MoveToNextAttribute()); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_ATTRIBUTE); + ASSERT_EQ(reader->GetLocalName(), "attr2"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:attr2"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_TRUE(reader->HasValue()); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_EQ(reader->GetValue(), "value C2"); + + // No more attributes. + ASSERT_FALSE(reader->MoveToNextAttribute()); + + // Return to the ns:objC element start node. + ASSERT_TRUE(reader->MoveToCarryingElement()); + ASSERT_EQ(reader->GetDepth(), 1); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_START); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objC"); + + // Move to the ns:attr1 attribute. + ASSERT_TRUE(reader->MoveToAttribute(0)); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_ATTRIBUTE); + ASSERT_EQ(reader->GetLocalName(), "attr1"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:attr1"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_TRUE(reader->HasValue()); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_EQ(reader->GetValue(), "value C1"); + + // Return to the ns:objC element start node. + ASSERT_TRUE(reader->MoveToCarryingElement()); + ASSERT_EQ(reader->GetDepth(), 1); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_START); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objC"); + + // Move to the ns:attr2 attribute. + ASSERT_TRUE(reader->MoveToAttribute("ns:attr2")); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_ATTRIBUTE); + ASSERT_EQ(reader->GetLocalName(), "attr2"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:attr2"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_TRUE(reader->HasValue()); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_EQ(reader->GetValue(), "value C2"); + + // Move to the ns:attr1 attribute without returning to the ns:objC element. + ASSERT_TRUE(reader->MoveToAttribute("attr1", "http://www.example.org/ns")); + ASSERT_EQ(reader->GetDepth(), 2); + ASSERT_EQ(reader->GetType(), XML_NODE_ATTRIBUTE); + ASSERT_EQ(reader->GetLocalName(), "attr1"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:attr1"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_TRUE(reader->HasValue()); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_EQ(reader->GetValue(), "value C1"); + + // Move to the ns:objD element start node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 1); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_START); + ASSERT_EQ(reader->GetLocalName(), "objD"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objD"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the ns:objD element end node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 1); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_END); + ASSERT_EQ(reader->GetLocalName(), "objD"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:objD"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_FALSE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + + // Move to the whitespace node without returning to the ns:objC element. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetType(), XML_NODE_WHITESPACE); + + // Move to ns:obj element ending node. + ASSERT_TRUE(reader->MoveToNextNode()); + ASSERT_EQ(reader->GetDepth(), 0); + ASSERT_EQ(reader->GetType(), XML_NODE_ELEMENT_END); + ASSERT_EQ(reader->GetLocalName(), "obj"); + ASSERT_EQ(reader->GetPrefix(), "ns"); + ASSERT_EQ(reader->GetQualifiedName(), "ns:obj"); + ASSERT_EQ(reader->GetNamespaceURI(), "http://www.example.org/ns"); + ASSERT_FALSE(reader->IsEmptyElement()); + ASSERT_TRUE(reader->HasAttributes()); + ASSERT_FALSE(reader->HasValue()); + // Strangely, the end node will report if the starting node has attributes + // but will not provide access to them. + ASSERT_TRUE(reader->HasAttributes()); + ASSERT_EQ(reader->GetAttributeCount(), (size_t)0); + + // And we're done. + ASSERT_FALSE(reader->MoveToNextNode()); + + ASSERT_TRUE(reader->Close()); +} + +// Test XML read error handling. +TEST(XmlReaderTest, ReadError) { + char test_str[] = + "\n" + "\n"; + + // Create the stream reader. + CefRefPtr stream( + CefStreamReader::CreateForData(test_str, sizeof(test_str) - 1)); + ASSERT_TRUE(stream.get() != NULL); + + // Create the XML reader. + CefRefPtr reader( + CefXmlReader::Create(stream, XML_ENCODING_NONE, + "http://www.example.org/example.xml")); + ASSERT_TRUE(reader.get() != NULL); + + // Move to the processing instruction node and generate parser error. + ASSERT_FALSE(reader->MoveToNextNode()); + ASSERT_TRUE(reader->HasError()); +} + +// Test XmlObject load behavior. +TEST(XmlReaderTest, ObjectLoad) { + // Create the stream reader. + CefRefPtr stream( + CefStreamReader::CreateForData(g_test_xml, sizeof(g_test_xml) - 1)); + ASSERT_TRUE(stream.get() != NULL); + + // Create the XML reader. + CefRefPtr object(new CefXmlObject("object")); + ASSERT_TRUE(object->Load(stream, XML_ENCODING_NONE, + "http://www.example.org/example.xml", NULL)); + + ASSERT_FALSE(object->HasAttributes()); + ASSERT_TRUE(object->HasChildren()); + ASSERT_EQ(object->GetChildCount(), (size_t)1); + + CefRefPtr obj(object->FindChild("ns:obj")); + ASSERT_TRUE(obj.get()); + ASSERT_TRUE(obj->HasChildren()); + ASSERT_EQ(obj->GetChildCount(), (size_t)4); + + CefRefPtr obj_child(obj->FindChild("ns:objC")); + ASSERT_TRUE(obj_child.get()); + ASSERT_EQ(obj_child->GetName(), "ns:objC"); + ASSERT_FALSE(obj_child->HasChildren()); + ASSERT_FALSE(obj_child->HasValue()); + ASSERT_TRUE(obj_child->HasAttributes()); + + CefXmlObject::ObjectVector obj_children; + ASSERT_EQ(obj->GetChildren(obj_children), (size_t)4); + ASSERT_EQ(obj_children.size(), (size_t)4); + + CefXmlObject::ObjectVector::const_iterator it = obj_children.begin(); + for (int ct = 0; it != obj_children.end(); ++it, ++ct) { + obj_child = *it; + ASSERT_TRUE(obj_child.get()); + if (ct == 0) { + // ns:objA + ASSERT_EQ(obj_child->GetName(), "ns:objA"); + ASSERT_FALSE(obj_child->HasChildren()); + ASSERT_TRUE(obj_child->HasValue()); + ASSERT_FALSE(obj_child->HasAttributes()); + ASSERT_EQ(obj_child->GetValue(), "value A"); + } else if (ct == 1) { + // ns:objB + ASSERT_EQ(obj_child->GetName(), "ns:objB"); + ASSERT_TRUE(obj_child->HasChildren()); + ASSERT_FALSE(obj_child->HasValue()); + ASSERT_FALSE(obj_child->HasAttributes()); + ASSERT_EQ(obj_child->GetChildCount(), (size_t)4); + obj_child = obj_child->FindChild("ns:objB_4"); + ASSERT_TRUE(obj_child.get()); + ASSERT_TRUE(obj_child->HasValue()); + ASSERT_EQ(obj_child->GetValue(), + "this is mixed content EA Value"); + } else if (ct == 2) { + // ns:objC + ASSERT_EQ(obj_child->GetName(), "ns:objC"); + ASSERT_FALSE(obj_child->HasChildren()); + ASSERT_FALSE(obj_child->HasValue()); + ASSERT_TRUE(obj_child->HasAttributes()); + + CefXmlObject::AttributeMap attribs; + ASSERT_EQ(obj_child->GetAttributes(attribs), (size_t)2); + ASSERT_EQ(attribs.size(), (size_t)2); + ASSERT_EQ(attribs["ns:attr1"], "value C1"); + ASSERT_EQ(attribs["ns:attr2"], "value C2"); + + ASSERT_EQ(obj_child->GetAttributeCount(), (size_t)2); + ASSERT_TRUE(obj_child->HasAttribute("ns:attr1")); + ASSERT_EQ(obj_child->GetAttributeValue("ns:attr1"), "value C1"); + ASSERT_TRUE(obj_child->HasAttribute("ns:attr2")); + ASSERT_EQ(obj_child->GetAttributeValue("ns:attr2"), "value C2"); + } else if (ct == 3) { + // ns:objD + ASSERT_EQ(obj_child->GetName(), "ns:objD"); + ASSERT_FALSE(obj_child->HasChildren()); + ASSERT_FALSE(obj_child->HasValue()); + ASSERT_FALSE(obj_child->HasAttributes()); + } + } +} + +// Test XmlObject load error handling behavior. +TEST(XmlReaderTest, ObjectLoadError) { + // Test start/end tag mismatch error. + { + char error_xml[] = "\n\n\n"; + + // Create the stream reader. + CefRefPtr stream( + CefStreamReader::CreateForData(error_xml, sizeof(error_xml) - 1)); + ASSERT_TRUE(stream.get() != NULL); + + CefString error_str; + + // Create the XML reader. + CefRefPtr object(new CefXmlObject("object")); + ASSERT_FALSE(object->Load(stream, XML_ENCODING_NONE, + "http://www.example.org/example.xml", &error_str)); + ASSERT_EQ(error_str, + "Opening and ending tag mismatch: foo line 2 and obj, line 3"); + } + + // Test value following child error. + { + char error_xml[] = "\n\ndisallowed value\n"; + + // Create the stream reader. + CefRefPtr stream( + CefStreamReader::CreateForData(error_xml, sizeof(error_xml) - 1)); + ASSERT_TRUE(stream.get() != NULL); + + CefString error_str; + + // Create the XML reader. + CefRefPtr object(new CefXmlObject("object")); + ASSERT_FALSE(object->Load(stream, XML_ENCODING_NONE, + "http://www.example.org/example.xml", &error_str)); + ASSERT_EQ(error_str, + "Value following child element, line 4"); + } +} diff --git a/tests/unittests/zip_reader_unittest.cc b/tests/unittests/zip_reader_unittest.cc new file mode 100644 index 000000000..41f83fdde --- /dev/null +++ b/tests/unittests/zip_reader_unittest.cc @@ -0,0 +1,253 @@ +// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "include/cef_stream.h" +#include "include/cef_zip_reader.h" +#include "include/wrapper/cef_zip_archive.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + + unsigned char g_test_zip[] = { + 0x50, 0x4b, 0x03, 0x04, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x7f, + 0x57, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, + 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2f, 0x50, 0x4b, 0x03, 0x04, 0x0a, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x7f, 0x57, 0x3d, 0xf8, 0x47, 0x0c, + 0xc6, 0x13, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, + 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, + 0x65, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x31, 0x2e, 0x74, 0x78, 0x74, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x6f, 0x66, 0x20, + 0x66, 0x69, 0x6c, 0x65, 0x20, 0x31, 0x2e, 0x50, 0x4b, 0x03, 0x04, 0x0a, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x7f, 0x57, 0x3d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, + 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, + 0x65, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x31, 0x2f, 0x50, + 0x4b, 0x03, 0x04, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x7f, 0x57, + 0x3d, 0x43, 0xe3, 0x11, 0x5f, 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, + 0x00, 0x21, 0x00, 0x00, 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, + 0x63, 0x68, 0x69, 0x76, 0x65, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, + 0x20, 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x31, 0x61, 0x2e, 0x74, + 0x78, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x6f, + 0x66, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x31, 0x41, 0x2e, 0x50, 0x4b, + 0x03, 0x04, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x7f, 0x57, 0x3d, + 0x80, 0xb0, 0x3c, 0x74, 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x63, + 0x68, 0x69, 0x76, 0x65, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x20, + 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x31, 0x62, 0x2e, 0x74, 0x78, + 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x6f, 0x66, + 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x31, 0x42, 0x2e, 0x50, 0x4b, 0x03, + 0x04, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x7f, 0x57, 0x3d, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, + 0x69, 0x76, 0x65, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x31, + 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x31, 0x61, 0x2f, 0x50, + 0x4b, 0x03, 0x04, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7f, 0x57, + 0x3d, 0x15, 0xed, 0x04, 0x2c, 0x15, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, + 0x00, 0x2c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, + 0x63, 0x68, 0x69, 0x76, 0x65, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, + 0x20, 0x31, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x31, 0x61, + 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x31, 0x61, 0x31, 0x2e, 0x74, 0x78, + 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x20, 0x6f, 0x66, + 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x31, 0x41, 0x31, 0x2e, 0x50, 0x4b, + 0x03, 0x04, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x7f, 0x57, 0x3d, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x63, + 0x68, 0x69, 0x76, 0x65, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x20, + 0x32, 0x2f, 0x50, 0x4b, 0x03, 0x04, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x80, 0x57, 0x3d, 0x1a, 0x5d, 0x57, 0x5d, 0x14, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x74, 0x65, 0x73, 0x74, + 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2f, 0x66, 0x6f, 0x6c, + 0x64, 0x65, 0x72, 0x20, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x32, + 0x61, 0x2e, 0x74, 0x78, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x73, 0x20, 0x6f, 0x66, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x32, 0x41, + 0x2e, 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x67, 0x7f, 0x57, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2f, + 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x70, 0x7f, 0x57, 0x3d, 0xf8, 0x47, 0x0c, 0xc6, 0x13, 0x00, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2f, 0x66, + 0x69, 0x6c, 0x65, 0x20, 0x31, 0x2e, 0x74, 0x78, 0x74, 0x50, 0x4b, 0x01, + 0x02, 0x14, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x7f, 0x57, + 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, + 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2f, 0x66, 0x6f, 0x6c, 0x64, + 0x65, 0x72, 0x20, 0x31, 0x2f, 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x0a, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x7f, 0x57, 0x3d, 0x43, 0xe3, 0x11, + 0x5f, 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xa7, + 0x00, 0x00, 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, + 0x69, 0x76, 0x65, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x31, + 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x31, 0x61, 0x2e, 0x74, 0x78, 0x74, + 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x78, 0x7f, 0x57, 0x3d, 0x80, 0xb0, 0x3c, 0x74, 0x14, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x00, 0x00, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2f, 0x66, + 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x31, 0x2f, 0x66, 0x69, 0x6c, 0x65, + 0x20, 0x31, 0x62, 0x2e, 0x74, 0x78, 0x74, 0x50, 0x4b, 0x01, 0x02, 0x14, + 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x7f, 0x57, 0x3d, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x4d, 0x01, 0x00, 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, + 0x63, 0x68, 0x69, 0x76, 0x65, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, + 0x20, 0x31, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x31, 0x61, + 0x2f, 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x7c, 0x7f, 0x57, 0x3d, 0x15, 0xed, 0x04, 0x2c, 0x15, 0x00, 0x00, + 0x00, 0x15, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x8b, 0x01, 0x00, 0x00, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2f, + 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x31, 0x2f, 0x66, 0x6f, 0x6c, + 0x64, 0x65, 0x72, 0x20, 0x31, 0x61, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x20, + 0x31, 0x61, 0x31, 0x2e, 0x74, 0x78, 0x74, 0x50, 0x4b, 0x01, 0x02, 0x14, + 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x7f, 0x57, 0x3d, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0xea, 0x01, 0x00, 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, + 0x63, 0x68, 0x69, 0x76, 0x65, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, + 0x20, 0x32, 0x2f, 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x0a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x80, 0x57, 0x3d, 0x1a, 0x5d, 0x57, 0x5d, 0x14, + 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1e, 0x02, 0x00, + 0x00, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, + 0x65, 0x2f, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x20, 0x32, 0x2f, 0x66, + 0x69, 0x6c, 0x65, 0x20, 0x32, 0x61, 0x2e, 0x74, 0x78, 0x74, 0x50, 0x4b, + 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x09, 0x00, 0x9d, 0x02, + 0x00, 0x00, 0x71, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + +} // namespace + +// Test Zip reading. +TEST(ZipReaderTest, Read) { + // Create the stream reader. + CefRefPtr stream( + CefStreamReader::CreateForData(g_test_zip, sizeof(g_test_zip) - 1)); + ASSERT_TRUE(stream.get() != NULL); + + // Create the Zip reader. + CefRefPtr reader(CefZipReader::Create(stream)); + ASSERT_TRUE(reader.get() != NULL); + + char buff[25]; + + // Walk through the archive contents. + ASSERT_TRUE(reader->MoveToFirstFile()); + ASSERT_EQ(reader->GetFileName(), "test_archive/"); + ASSERT_EQ(reader->GetFileSize(), 0); + + ASSERT_TRUE(reader->MoveToNextFile()); + ASSERT_EQ(reader->GetFileName(), "test_archive/file 1.txt"); + ASSERT_EQ(reader->GetFileSize(), 19); + ASSERT_TRUE(reader->OpenFile("")); + ASSERT_EQ(reader->ReadFile(buff, sizeof(buff)), 19); + ASSERT_TRUE(!strncmp(buff, "Contents of file 1.", 19)); + + ASSERT_TRUE(reader->MoveToNextFile()); + ASSERT_EQ(reader->GetFileName(), "test_archive/folder 1/"); + ASSERT_EQ(reader->GetFileSize(), 0); + + ASSERT_TRUE(reader->MoveToNextFile()); + ASSERT_EQ(reader->GetFileName(), "test_archive/folder 1/file 1a.txt"); + ASSERT_EQ(reader->GetFileSize(), 20); + ASSERT_TRUE(reader->OpenFile("")); + ASSERT_EQ(reader->ReadFile(buff, sizeof(buff)), 20); + ASSERT_TRUE(reader->CloseFile()); + ASSERT_TRUE(!strncmp(buff, "Contents of file 1A.", 20)); + + ASSERT_TRUE(reader->MoveToNextFile()); + ASSERT_EQ(reader->GetFileName(), "test_archive/folder 1/file 1b.txt"); + ASSERT_EQ(reader->GetFileSize(), 20); + ASSERT_TRUE(reader->OpenFile("")); + ASSERT_EQ(reader->ReadFile(buff, sizeof(buff)), 20); + ASSERT_TRUE(reader->CloseFile()); + ASSERT_TRUE(!strncmp(buff, "Contents of file 1B.", 20)); + + ASSERT_TRUE(reader->MoveToNextFile()); + ASSERT_EQ(reader->GetFileName(), "test_archive/folder 1/folder 1a/"); + ASSERT_EQ(reader->GetFileSize(), 0); + + ASSERT_TRUE(reader->MoveToNextFile()); + ASSERT_EQ(reader->GetFileName(), + "test_archive/folder 1/folder 1a/file 1a1.txt"); + ASSERT_EQ(reader->GetFileSize(), 21); + ASSERT_TRUE(reader->OpenFile("")); + ASSERT_EQ(reader->ReadFile(buff, sizeof(buff)), 21); + ASSERT_TRUE(reader->CloseFile()); + ASSERT_TRUE(!strncmp(buff, "Contents of file 1A1.", 21)); + + ASSERT_TRUE(reader->MoveToNextFile()); + ASSERT_EQ(reader->GetFileName(), "test_archive/folder 2/"); + ASSERT_EQ(reader->GetFileSize(), 0); + + ASSERT_TRUE(reader->MoveToNextFile()); + ASSERT_EQ(reader->GetFileName(), "test_archive/folder 2/file 2a.txt"); + ASSERT_EQ(reader->GetFileSize(), 20); + ASSERT_TRUE(reader->OpenFile("")); + ASSERT_EQ(reader->ReadFile(buff, sizeof(buff)), 20); + ASSERT_TRUE(reader->CloseFile()); + ASSERT_TRUE(!strncmp(buff, "Contents of file 2A.", 20)); + + ASSERT_FALSE(reader->MoveToNextFile()); + + // Try seeking a particular file + ASSERT_TRUE(reader->MoveToFile("TEST_ARCHIVE/FOLDER 1/FILE 1B.TXT", false)); + ASSERT_EQ(reader->GetFileName(), "test_archive/folder 1/file 1b.txt"); + ASSERT_EQ(reader->GetFileSize(), 20); + ASSERT_TRUE(reader->OpenFile("")); + ASSERT_EQ(reader->ReadFile(buff, sizeof(buff)), 20); + ASSERT_TRUE(reader->CloseFile()); + ASSERT_TRUE(!strncmp(buff, "Contents of file 1B.", 20)); + + ASSERT_TRUE(reader->MoveToFile("test_archive/folder 1/file 1b.txt", true)); + ASSERT_FALSE(reader->MoveToFile("test_archive/folder 1/FILE 1B.txt", true)); + + ASSERT_TRUE(reader->Close()); +} + +// Test CefZipArchive object. +TEST(ZipReaderTest, ReadArchive) { + // Create the stream reader. + CefRefPtr stream( + CefStreamReader::CreateForData(g_test_zip, sizeof(g_test_zip) - 1)); + ASSERT_TRUE(stream.get() != NULL); + + // Create the Zip archive object. + CefRefPtr archive(new CefZipArchive()); + + ASSERT_EQ(archive->Load(stream, false), (size_t)5); + + ASSERT_TRUE(archive->HasFile("test_archive/file 1.txt")); + ASSERT_TRUE(archive->HasFile("test_archive/folder 1/file 1a.txt")); + ASSERT_TRUE(archive->HasFile("test_archive/FOLDER 1/file 1b.txt")); + ASSERT_TRUE(archive->HasFile("test_archive/folder 1/folder 1a/file 1a1.txt")); + ASSERT_TRUE(archive->HasFile("test_archive/folder 2/file 2a.txt")); + + // Test content retrieval. + CefRefPtr file; + file = archive->GetFile("test_archive/folder 2/file 2a.txt"); + ASSERT_TRUE(file.get()); + + ASSERT_EQ(file->GetDataSize(), (size_t)20); + ASSERT_TRUE(!strncmp(reinterpret_cast(file->GetData()), + "Contents of file 2A.", 20)); + + // Test stream reading. + CefRefPtr reader(file->GetStreamReader()); + ASSERT_TRUE(reader.get()); + + char buff[8]; + ASSERT_EQ(reader->Read(buff, 1, 8), (size_t)8); + ASSERT_TRUE(!strncmp(buff, "Contents", 8)); + ASSERT_EQ(reader->Read(buff, 1, 8), (size_t)8); + ASSERT_TRUE(!strncmp(buff, " of file", 8)); + ASSERT_EQ(reader->Read(buff, 1, 8), (size_t)4); + ASSERT_TRUE(!strncmp(buff, " 2A.", 4)); + ASSERT_TRUE(reader->Eof()); +} diff --git a/themes/All Hallow's Eve.tmTheme b/themes/All Hallow's Eve.tmTheme deleted file mode 100644 index 47a679784..000000000 --- a/themes/All Hallow's Eve.tmTheme +++ /dev/null @@ -1,277 +0,0 @@ - - - - - author - David Heinemeier Hansson - name - All Hallow's Eve - settings - - - settings - - background - #000000 - caret - #FFFFFF - foreground - #FFFFFF - invisibles - #404040 - lineHighlight - #333300 - selection - #73597EE0 - - - - name - Text base - scope - text - settings - - background - #434242 - foreground - #FFFFFF - - - - name - Source base - scope - source - settings - - background - #000000 - foreground - #FFFFFF - - - - name - Comment - scope - comment - settings - - foreground - #9933CC - - - - name - Constant - scope - constant - settings - - foreground - #3387CC - - - - name - Keyword - scope - keyword - settings - - fontStyle - - foreground - #CC7833 - - - - name - Pre-processor Line - scope - meta.preprocessor.c - settings - - fontStyle - - foreground - #D0D0FF - - - - name - Pre-processor Directive - scope - keyword.control.import - settings - - fontStyle - - - - - name - Function name - scope - entity.name.function - settings - - fontStyle - - - - - name - Function argument - scope - variable.parameter - settings - - fontStyle - italic - - - - name - Block comment - scope - source comment.block - settings - - background - #9B9B9B - foreground - #FFFFFF - - - - name - String - scope - string - settings - - foreground - #66CC33 - - - - name - String escapes - scope - string constant.character.escape - settings - - foreground - #AAAAAA - - - - name - String (executed) - scope - string.interpolated - settings - - background - #CCCC33 - foreground - #000000 - - - - name - Regular expression - scope - string.regexp - settings - - foreground - #CCCC33 - - - - name - String (literal) - scope - string.literal - settings - - foreground - #CCCC33 - - - - name - String escapes (executed) - scope - string.interpolated constant.character.escape - settings - - foreground - #555555 - - - - name - Type name - scope - entity.name.type - settings - - fontStyle - underline - - - - name - Class inheritance - scope - entity.other.inherited-class - settings - - fontStyle - italic underline - - - - name - Tag name - scope - entity.name.tag - settings - - fontStyle - underline - - - - name - Tag attribute - scope - entity.other.attribute-name - settings - - fontStyle - - - - - name - Support function - scope - support.function - settings - - fontStyle - - foreground - #C83730 - - - - uuid - 37F22BDC-B2F4-11D9-850C-000A95A89C98 - - diff --git a/themes/Amy.tmTheme b/themes/Amy.tmTheme deleted file mode 100644 index b3258c468..000000000 --- a/themes/Amy.tmTheme +++ /dev/null @@ -1,557 +0,0 @@ - - - - - name - Amy - author - William D. Neumann - settings - - - settings - - background - #200020 - caret - #7070FF - foreground - #D0D0FF - invisibles - #BFBFBF - lineHighlight - #80000040 - selection - #80000080 - - - - name - Comment - scope - comment.block - settings - - background - #200020 - fontStyle - italic - foreground - #404080 - - - - name - String - scope - string - settings - - foreground - #999999 - - - - name - Built-in constant - scope - constant.language - settings - - foreground - #707090 - - - - name - Integer - scope - constant.numeric - settings - - foreground - #7090B0 - - - - name - Int32 constant - scope - constant.numeric.integer.int32 - settings - - fontStyle - bold - - - - name - Int64 constant - scope - constant.numeric.integer.int64 - settings - - fontStyle - italic - - - - name - Nativeint constant - scope - constant.numeric.integer.nativeint - settings - - fontStyle - bold italic - - - - name - Floating-point constant - scope - constant.numeric.floating-point.ocaml - settings - - fontStyle - underline - - - - name - Character constant - scope - constant.character - settings - - fontStyle - - foreground - #666666 - - - - name - Boolean constant - scope - constant.language.boolean - settings - - foreground - #8080A0 - - - - name - Built-in constant - scope - constant.language - settings - - - - name - User-defined constant - scope - constant.other - settings - - - - name - Variable - scope - variable.language, variable.other - settings - - fontStyle - - foreground - #008080 - - - - name - Keyword - scope - keyword - settings - - foreground - #A080FF - - - - name - Keyword operator - scope - keyword.operator - settings - - foreground - #A0A0FF - - - - name - Keyword decorator - scope - keyword.other.decorator - settings - - foreground - #D0D0FF - - - - name - Floating-point infix operator - scope - keyword.operator.infix.floating-point.ocaml - settings - - fontStyle - underline - - - - name - Floating-point prefix operator - scope - keyword.operator.prefix.floating-point.ocaml - settings - - fontStyle - underline - - - - name - Compiler directives - scope - keyword.other.directive - settings - - fontStyle - - foreground - #C080C0 - - - - name - Line-number directives - scope - keyword.other.directive.line-number - settings - - fontStyle - underline - foreground - #C080C0 - - - - name - Control keyword - scope - keyword.control - settings - - foreground - #80A0FF - - - - name - Storage - scope - storage - settings - - foreground - #B0FFF0 - - - - name - Variants - scope - entity.name.type.variant - settings - - foreground - #60B0FF - - - - name - Polymorphic variants - scope - storage.type.variant.polymorphic, entity.name.type.variant.polymorphic - settings - - fontStyle - italic - foreground - #60B0FF - - - - name - Module definitions - scope - entity.name.type.module - settings - - foreground - #B000B0 - - - - name - Module type definitions - scope - entity.name.type.module-type.ocaml - settings - - fontStyle - underline - foreground - #B000B0 - - - - name - Support modules - scope - support.other - settings - - foreground - #A00050 - - - - name - Class name - scope - entity.name.type.class - settings - - foreground - #70E080 - - - - name - Class type - scope - entity.name.type.class-type - settings - - fontStyle - - foreground - #70E0A0 - - - - name - Inherited class - scope - entity.other.inherited-class - settings - - - - name - Function name - scope - entity.name.function - settings - - foreground - #50A0A0 - - - - name - Function argument - scope - variable.parameter - settings - - foreground - #80B0B0 - - - - name - Token definition (ocamlyacc) - scope - entity.name.type.token - settings - - fontStyle - - foreground - #3080A0 - - - - name - Token reference (ocamlyacc) - scope - entity.name.type.token.reference - settings - - fontStyle - - foreground - #3CB0D0 - - - - name - Non-terminal definition (ocamlyacc) - scope - entity.name.function.non-terminal - settings - - foreground - #90E0E0 - - - - name - Non-terminal reference (ocamlyacc) - scope - entity.name.function.non-terminal.reference - settings - - foreground - #C0F0F0 - - - - name - Tag name - scope - entity.name.tag - settings - - foreground - #009090 - - - - name - Tag attribute - scope - entity.other.attribute-name - settings - - - - name - Library function - settings - - background - #200020 - - - - name - Library constant - scope - support.constant - settings - - background - #200020 - - - - name - Library class/type - scope - support.type, support.class - settings - - - - name - Library variable - scope - support.other.variable - settings - - - - name - Invalid - illegal - scope - invalid.illegal - settings - - background - #FFFF00 - fontStyle - bold - foreground - #400080 - - - - name - Invalid - depricated - scope - invalid.deprecated - settings - - background - #CC66FF - foreground - #200020 - - - - name - Camlp4 code - scope - source.camlp4.embedded - settings - - background - #40008054 - - - - name - Camlp4 temp (parser) - scope - source.camlp4.embedded.parser.ocaml - settings - - fontStyle - - - - - name - Punctuation - scope - punctuation - settings - - foreground - #805080 - - - - uuid - 3C01FADD-7592-49DD-B7A5-1B82CA4E57B5 - - diff --git a/themes/Blackboard.tmTheme b/themes/Blackboard.tmTheme deleted file mode 100644 index 18bb72e33..000000000 --- a/themes/Blackboard.tmTheme +++ /dev/null @@ -1,350 +0,0 @@ - - - - - name - Blackboard - author - Domenico Carbotta - settings - - - settings - - background - #0C1021 - caret - #FFFFFFA6 - foreground - #F8F8F8 - invisibles - #FFFFFF40 - lineHighlight - #FFFFFF0F - selection - #253B76 - - - - name - Comment - scope - comment - settings - - fontStyle - - foreground - #AEAEAE - - - - name - Constant - scope - constant - settings - - fontStyle - - foreground - #D8FA3C - - - - name - Entity - scope - entity - settings - - fontStyle - - foreground - #FF6400 - - - - name - Keyword - scope - keyword - settings - - fontStyle - - foreground - #FBDE2D - - - - name - Storage - scope - storage - settings - - fontStyle - - foreground - #FBDE2D - - - - name - String - scope - string, meta.verbatim - settings - - fontStyle - - foreground - #61CE3C - - - - name - Support - scope - support - settings - - fontStyle - - foreground - #8DA6CE - - - - name - Variable - scope - variable - settings - - fontStyle - - - - - name - Invalid – Deprecated - scope - invalid.deprecated - settings - - fontStyle - italic - foreground - #AB2A1D - - - - name - Invalid – Illegal - scope - invalid.illegal - settings - - background - #9D1E15 - foreground - #F8F8F8 - - - - name - Superclass - scope - entity.other.inherited-class - settings - - fontStyle - italic - foreground - #FF6400 - - - - name - String interpolation - scope - string constant.other.placeholder - settings - - fontStyle - - foreground - #FF6400 - - - - name - meta.function-call.py - scope - meta.function-call.py - settings - - fontStyle - - foreground - #BECDE6 - - - - name - meta.tag - scope - meta.tag, meta.tag entity - settings - - foreground - #7F90AA - - - - name - entity.name.section - scope - entity.name.section - settings - - fontStyle - - foreground - #FFFFFF - - - - name - OCaml variant - scope - keyword.type.variant - settings - - foreground - #D5E0F3 - - - - name - OCaml operator - scope - source.ocaml keyword.operator.symbol - settings - - foreground - #F8F8F8 - - - - name - OCaml infix operator - scope - source.ocaml keyword.operator.symbol.infix - settings - - fontStyle - - foreground - #8DA6CE - - - - name - OCaml prefix operator - scope - source.ocaml keyword.operator.symbol.prefix - settings - - fontStyle - - foreground - #8DA6CE - - - - name - OCaml f-p infix operator - scope - source.ocaml keyword.operator.symbol.infix.floating-point - settings - - fontStyle - underline - - - - name - OCaml f-p prefix operator - scope - source.ocaml keyword.operator.symbol.prefix.floating-point - settings - - fontStyle - underline - - - - name - OCaml f-p constant - scope - source.ocaml constant.numeric.floating-point - settings - - fontStyle - underline - - - - name - LaTeX environment - scope - text.tex.latex meta.function.environment - settings - - background - #FFFFFF08 - - - - name - LaTeX environment (nested) - scope - text.tex.latex meta.function.environment meta.function.environment - settings - - background - #7A96FA08 - - - - name - Latex support - scope - text.tex.latex support.function - settings - - fontStyle - - foreground - #FBDE2D - - - - name - PList unquoted string - scope - source.plist string.unquoted, source.plist keyword.operator - settings - - foreground - #FFFFFF - - - - uuid - A2C6BAA7-90D0-4147-BBF5-96B0CD92D109 - - diff --git a/themes/Brilliance Black.tmTheme b/themes/Brilliance Black.tmTheme deleted file mode 100644 index 560c825ba..000000000 --- a/themes/Brilliance Black.tmTheme +++ /dev/null @@ -1,2619 +0,0 @@ - - - - - author - Thomas Aylott - comment - Thomas Aylott ㊷ subtleGradient.com - name - Brilliance Black - settings - - - settings - - background - #0D0D0DFA - caret - #3333FF - foreground - #EEEEEE - invisibles - #CCCCCC1A - lineHighlight - #00008033 - selection - #0010B499 - - - - name - Thomas Aylott ㊷ - scope - meta.thomas_aylott - settings - - background - #FFFFFF - fontStyle - bold - foreground - #000000 - - - - name - subtleGradient.com - scope - meta.subtlegradient - settings - - background - #FFFFFF - fontStyle - underline - foreground - #555555 - - - - name - ~ String - scope - string -meta.tag -meta.doctype -string.regexp -string.literal -string.interpolated -string.quoted.literal -string.unquoted, variable.parameter.misc.css, text string source string, string.unquoted string, string.regexp string, string.interpolated string, meta.tag source string - settings - - background - #803D0033 - foreground - #FFFC80 - - - - name - ~ String Punctuation - scope - punctuation.definition.string -meta.tag - settings - - foreground - #803D00 - - - - name - ~ String Punctuation II - scope - string.regexp punctuation.definition.string, string.quoted.literal punctuation.definition.string, string.quoted.double.ruby.mod punctuation.definition.string - settings - - foreground - #FFF80033 - - - - name - ~ String Literal - scope - string.quoted.literal, string.quoted.double.ruby.mod - settings - - background - #43800033 - foreground - #FFF800 - - - - name - ~ String Unquoted - scope - string.unquoted -string.unquoted.embedded, string.quoted.double.multiline, meta.scope.heredoc - settings - - foreground - #FFBC80 - - - - name - ~ String Interpolated - scope - string.interpolated - settings - - background - #1A1A1A - foreground - #FFFC80 - - - - name - ~ String RegEx - scope - string.regexp - settings - - background - #43800033 - foreground - #FFF800 - - - - name - ~ String RegEx Group 1 - scope - string.regexp.group - settings - - background - #43800033 - - - - name - ~ String RegEx Group 2 - scope - string.regexp.group string.regexp.group - settings - - background - #43800033 - foreground - #FFFFFF66 - - - - name - ~ String RegEx Group 3 - scope - string.regexp.group string.regexp.group string.regexp.group - settings - - background - #43800033 - foreground - #FFFFFF66 - - - - name - ~ String RegEx Group 4 - scope - string.regexp.group string.regexp.group string.regexp.group string.regexp.group - settings - - background - #43800033 - foreground - #FFFFFF66 - - - - name - ~ String RegEx Character-Class - scope - string.regexp.character-class - settings - - background - #43800033 - foreground - #86FF00 - - - - name - ~ String RegEx Arbitrary-Repitition - scope - string.regexp.arbitrary-repitition - settings - - background - #43800033 - foreground - #00FFF8 - - - - name - ~ String RegEx Definition Keyword - scope - string.regexp punctuation.definition.string keyword.other - settings - - fontStyle - - foreground - #803D00 - - - - name - ~ Meta Group Assertion Regexp - scope - meta.group.assertion.regexp - settings - - background - #0086FF33 - - - - name - ~ Meta Assertion - scope - meta.assertion, meta.group.assertion keyword.control.group.regexp, meta.group.assertion punctuation.definition.group - settings - - foreground - #0086FF - - - - name - ~ Number - scope - constant.numeric - settings - - foreground - #C6FF00 - - - - name - ~ Character constant - scope - constant.character - settings - - foreground - #86FF00 - - - - name - ~ Built-in constant - scope - constant.language, keyword.other.unit, constant.other.java, constant.other.unit - settings - - foreground - #07FF00 - - - - name - ~ Built-in constant+ - scope - constant.language.pseudo-variable - settings - - background - #04800033 - foreground - #07FF00 - - - - name - ~ User-defined constant - scope - constant.other, constant.block - settings - - foreground - #00FF79 - - - - name - ~ Library constant - scope - support.constant, constant.name - settings - - foreground - #00FFF8 - - - - name - ————————————————— - settings - - - - name - √ pre-defined variable - scope - variable.other.readwrite.global.pre-defined, variable.language - settings - - background - #00807C33 - foreground - #00FF79 - - - - name - √ Constant Variable - scope - variable.other.constant - settings - - foreground - #00FFF8 - - - - name - √ Library variable - scope - support.variable - settings - - background - #00807C33 - foreground - #00FFF8 - - - - name - √ global Variable - scope - variable.other.readwrite.global - settings - - background - #00438033 - foreground - #00807C - - - - name - √ Variable - scope - variable.other, variable.js, punctuation.separator.variable - settings - - foreground - #31A6FF - - - - name - √ class Variable - scope - variable.other.readwrite.class - settings - - background - #0008FF33 - foreground - #0086FF - - - - name - √ instance Variable - scope - variable.other.readwrite.instance - settings - - foreground - #406180 - - - - name - √ Normal Variables - scope - variable.other.php, variable.other.normal - settings - - foreground - #406180 - - - - name - √ Variable Punctuation - scope - punctuation.definition, punctuation.separator.variable - settings - - foreground - #00000080 - - - - name - ————————————————— - settings - - - - name - ¢ Storage - scope - storage -storage.modifier - settings - - foreground - #7E0080 - - - - name - ¢ Entity Name Preprocessor - scope - other.preprocessor, entity.name.preprocessor - settings - - background - #803D0033 - - - - name - ~ variable.language.this.js.prototype - scope - variable.language.this.js - settings - - foreground - #666666 - - - - name - ¢ Storage Modifier - scope - storage.modifier - settings - - foreground - #803D00 - - - - name - ¢ Class name - scope - entity.name.class, entity.name.type.class, entity.name.type.module - settings - - foreground - #FF0000 - - - - name - ¢ Class - scope - meta.class -meta.class.instance, declaration.class, meta.definition.class, declaration.module - settings - - background - #FF000033 - foreground - #870000 - - - - name - ¢ Library class/type - scope - support.type, support.class - settings - - background - #87000033 - foreground - #FF0000 - - - - name - ¢ Instance - scope - entity.name.instance, entity.name.type.instance - settings - - foreground - #FF3D44 - - - - name - ¢ Instance.constructor - scope - meta.class.instance.constructor - settings - - background - #831E5133 - - - - name - ¢ Inherited class - scope - entity.other.inherited-class, entity.name.module - settings - - background - #80000433 - foreground - #FF0086 - - - - name - ¢ Class Method - scope - meta.definition.method - settings - - foreground - #FF0086 - - - - name - ¢ Function Declaration - scope - meta.function, meta.property.function, declaration.function - settings - - - - name - ¢ Function Declaration Name - scope - entity.name.function, entity.name.preprocessor - settings - - foreground - #FF0086 - - - - name - ¢ Function Declaration Parameters - scope - variable.parameter.function - settings - - foreground - #9799FF - - - - name - ¢ Function Declaration Parameters - scope - variable.parameter -variable.parameter.misc.css, meta.definition.method meta.definition.param-list, meta.function.method.with-arguments variable.parameter.function - settings - - foreground - #9799FF - - - - name - ¢ Function Declaration Parameters Punctuation - scope - punctuation.definition.parameters, variable.parameter.function punctuation.separator.object - settings - - foreground - #800004 - - - - name - ™ Function Call - scope - keyword.other.special-method, meta.function-call entity.name.function -(meta.function-call meta.function), support.function - variable - settings - - foreground - #782EC1 - - - - name - ™ Library Function Call - scope - meta.function-call support.function - variable - settings - - fontStyle - - foreground - #9D3EFF - - - - name - ™ Library Function Name - scope - support.function - settings - - background - #603F8033 - foreground - #603F80 - - - - name - ™ Function Call Arguments Punctuation - scope - punctuation.section.function, meta.brace.curly.function, meta.function-call punctuation.section.scope.ruby, meta.function-call punctuation.separator.object - settings - - fontStyle - - foreground - #BC80FF - - - - name - ™ Function Punctuation - scope - meta.group.braces.round punctuation.section.scope, -meta.group.braces.round meta.delimiter.object.comma, -meta.group.braces.curly.function meta.delimiter.object.comma, -meta.brace.round - settings - - fontStyle - bold - foreground - #BC80FF - - - - name - ™ Function Call Without Arguments - scope - meta.function-call.method.without-arguments, meta.function-call.method.without-arguments entity.name.function - settings - - foreground - #A88FC0 - - - - name - ————————————————— - settings - - - - name - ™ Keyword Control - scope - keyword.control - settings - - foreground - #F800FF - - - - name - ™ Keyword - scope - keyword - settings - - - - name - ™ Keyword other - scope - keyword.other - settings - - foreground - #7900FF - - - - name - ™ Regex Keyword - scope - source.regexp keyword.operator - settings - - - - name - ™ Keyword Operator - scope - keyword.operator, declaration.function.operator, meta.preprocessor.c.include, punctuation.separator.operator - settings - - foreground - #0000CE - - - - name - ™ Keyword Operator Assignment - scope - keyword.operator.assignment - settings - - background - #00009A33 - foreground - #0000CE - - - - name - ™ Keyword Operator Arithmetic - scope - keyword.operator.arithmetic - settings - - foreground - #2136CE - - - - name - ™ Keyword Operator Logical - scope - keyword.operator.logical - settings - - background - #00009A33 - foreground - #3759FF - - - - name - ™ Keyword Operator Comparison - scope - keyword.operator.comparison - settings - - foreground - #7C88FF - - - - name - meta.class.instance.constructor keyword.operator.new - scope - meta.class.instance.constructor keyword.operator.new - settings - - foreground - #800043 - - - - name - ————————————————— - settings - - - - name - ✘ HTML - settings - - - - name - ✘ Tag Doctype - scope - meta.doctype, meta.tag.sgml-declaration.doctype, meta.tag.sgml.doctype - settings - - background - #333333 - foreground - #CCCCCC - - - - name - ✘ Tag - scope - meta.tag - settings - - foreground - #333333 - - - - name - ✘ Tag Structure - scope - meta.tag.structure, meta.tag.segment - settings - - background - #333333BF - foreground - #666666 - - - - name - ✘ Tag Block - scope - meta.tag.block, meta.tag.xml, meta.tag.key - settings - - background - #4C4C4C33 - foreground - #4C4C4C - - - - name - ✘ Tag Inline - scope - meta.tag.inline - settings - - background - #803D0033 - foreground - #FF7900 - - - - name - meta.tag.inline source - scope - meta.tag.inline source - settings - - background - #803D0033 - - - - name - ✘ Tag Other - scope - meta.tag.other, entity.name.tag.style, entity.name.tag.script, meta.tag.block.script, source.js.embedded punctuation.definition.tag.html, source.css.embedded punctuation.definition.tag.html - settings - - background - #80000433 - foreground - #FF0007 - - - - name - ✘ Tag Form - scope - meta.tag.form, meta.tag.block.form - settings - - background - #00438033 - foreground - #0086FF - - - - name - ✘ Tag Meta - scope - meta.tag.meta - settings - - background - #3C008033 - foreground - #F800FF - - - - name - ✘ Tag Block Head - scope - meta.section.html.head - settings - - background - #121212 - - - - name - ✘ Tag Block Form - scope - meta.section.html.form - settings - - background - #0043801A - - - - name - ✘ XML Tag - scope - meta.tag.xml - settings - - foreground - #666666 - - - - name - ✘ Tag name - scope - entity.name.tag - settings - - foreground - #FFFFFF4D - - - - name - ✘ Tag attribute - scope - entity.other.attribute-name, meta.tag punctuation.definition.string - settings - - foreground - #FFFFFF33 - - - - name - ✘ Tag value - scope - meta.tag string -source -punctuation, text source text meta.tag string -punctuation - settings - - foreground - #FFFFFF66 - - - - name - ————————————————— - settings - - - - name - text meta.paragraph - scope - text meta.paragraph - settings - - foreground - #999999 - - - - name - M markup - scope - markup markup -(markup meta.paragraph.list) - settings - - background - #33333333 - foreground - #FFF800 - - - - name - M HR - scope - markup.hr - settings - - background - #FFFFFF - foreground - #000000 - - - - name - M heading - scope - markup.heading - settings - - fontStyle - - foreground - #FFFFFF - - - - name - M bold - scope - markup.bold - settings - - fontStyle - bold - foreground - #95D4FF80 - - - - name - M italic - scope - markup.italic - settings - - fontStyle - italic - - - - name - M strike - settings - - - - name - M add - settings - - - - name - M del - settings - - - - name - M underline - scope - markup.underline - settings - - fontStyle - underline - - - - name - M reference - scope - meta.reference, markup.underline.link - settings - - fontStyle - - foreground - #0086FF - - - - name - M reference name - scope - entity.name.reference - settings - - background - #00438033 - foreground - #00FFF8 - - - - name - M underline link - scope - meta.reference.list markup.underline.link, text.html.textile markup.underline.link - settings - - fontStyle - underline - foreground - #00FFF8 - - - - name - M raw block - scope - markup.raw.block - settings - - background - #80808040 - - - - name - M quote block - scope - markup.quote - settings - - background - #FFFFFF1A - - - - name - M list - scope - markup.list meta.paragraph - settings - - fontStyle - - foreground - #FFFFFF - - - - name - ————————————————— - settings - - - - name - Markdown - scope - text.html.markdown - settings - - background - #FFFFFF - foreground - #000000 - - - - name - text.html.markdown meta.paragraph - scope - text.html.markdown meta.paragraph - settings - - foreground - #000000 - - - - name - text.html.markdown markup.list meta.paragraph - scope - text.html.markdown markup.list meta.paragraph - settings - - foreground - #555555 - - - - name - text.html.markdown markup.heading - scope - text.html.markdown markup.heading - settings - - fontStyle - bold - foreground - #000000 - - - - name - text.html.markdown string - scope - text.html.markdown string - settings - - foreground - #8A5420 - - - - name - ————————————————— - settings - - - - name - § CSS - scope - source.css - settings - - - - name - § Selector - scope - meta.selector - settings - - foreground - #666666 - - - - name - Property Value Parens - scope - source.css meta.scope.property-list meta.property-value punctuation.definition.arguments, -source.css meta.scope.property-list meta.property-value punctuation.separator.arguments - settings - - fontStyle - - foreground - #006680 - - - - name - § Pseudo-Element - scope - entity.other.attribute-name.pseudo-element - settings - - foreground - #4F00FF - - - - name - § Pseudo-Class - scope - entity.other.attribute-name.pseudo-class, entity.other.attribute-name.tag.pseudo-class - settings - - foreground - #7900FF - - - - name - § Class - scope - meta.selector entity.other.attribute-name.class - settings - - foreground - #F800FF - - - - name - § ID - scope - meta.selector entity.other.attribute-name.id - settings - - foreground - #FF0086 - - - - name - § Tag - scope - meta.selector entity.name.tag - settings - - fontStyle - - foreground - #FF0007 - - - - name - § Tag Wildcard - scope - entity.name.tag.wildcard, entity.other.attribute-name.universal - settings - - fontStyle - bold - foreground - #FF7900 - - - - name - § Attribute - scope - source.css entity.other.attribute-name.attribute - settings - - foreground - #C25A00 - - - - name - § Attribute-Match - scope - source.css meta.attribute-selector keyword.operator.comparison - settings - - foreground - #673000 - - - - name - § meta.scope.property-list - scope - meta.scope.property-list - settings - - fontStyle - bold - foreground - #333333 - - - - name - § meta.property-name - scope - meta.property-name - settings - - fontStyle - - foreground - #999999 - - - - name - § support.type.property-name - scope - support.type.property-name - settings - - background - #0D0D0D - fontStyle - - foreground - #FFFFFF - - - - name - § meta.property-value - scope - meta.property-value - settings - - background - #19191980 - fontStyle - - foreground - #999999 - - - - name - ————————————————— - settings - - - - name - LaTeX - scope - text.latex - settings - - - - name - L Markup Raw - scope - text.latex markup.raw - settings - - background - #000000 - - - - name - L support.function - scope - text.latex support.function -support.function.textit -support.function.emph - settings - - foreground - #BC80FF - - - - name - L support.function.section - scope - text.latex support.function.section - settings - - foreground - #FFFFFFBF - - - - name - L entity.name.section - scope - text.latex entity.name.section -meta.group -keyword.operator.braces - settings - - background - #FFFFFF - fontStyle - - foreground - #000000 - - - - name - L constant.language.general - scope - text.latex constant.language.general - settings - - - - name - L keyword.operator.delimiter - scope - text.latex keyword.operator.delimiter - settings - - background - #00000080 - - - - name - L keyword.operator.brackets - scope - text.latex keyword.operator.brackets - settings - - foreground - #999999 - - - - name - L keyword.operator.braces - scope - text.latex keyword.operator.braces - settings - - fontStyle - - foreground - #666666 - - - - name - L meta.footnote - scope - meta.footnote - settings - - background - #00008033 - foreground - #0008FF4D - - - - name - L meta.label.reference - scope - text.latex meta.label.reference - settings - - background - #FFFFFF0D - fontStyle - - - - - name - L keyword.control.ref - scope - text.latex keyword.control.ref - settings - - background - #260001 - foreground - #FF0007 - - - - name - L variable.parameter.label.reference - scope - text.latex variable.parameter.label.reference - settings - - background - #400002 - foreground - #FFBC80 - - - - name - L keyword.control.cite - scope - text.latex keyword.control.cite - settings - - background - #260014 - foreground - #FF0086 - - - - name - L variable.parameter.cite - scope - variable.parameter.cite - settings - - background - #400022 - foreground - #FFBFE1 - - - - name - L variable.parameter.label - scope - text.latex variable.parameter.label - settings - - foreground - #FFFFFF80 - - - - name - L markup - scope - meta.function markup - settings - - foreground - #CDCDCD - - - - name - L meta.group.braces - scope - text.latex meta.group.braces - settings - - foreground - #33333333 - - - - name - L meta.environment.list - scope - text.latex meta.environment.list - settings - - background - #00000080 - fontStyle - - foreground - #33333333 - - - - name - L meta.environment.list 2 - scope - text.latex meta.environment.list meta.environment.list - settings - - background - #00000080 - foreground - #33333333 - - - - name - L meta.environment.list 3 - scope - text.latex meta.environment.list meta.environment.list meta.environment.list - settings - - background - #000000 - foreground - #33333333 - - - - name - L meta.environment.list 4 - scope - text.latex meta.environment.list meta.environment.list meta.environment.list meta.environment.list - settings - - foreground - #33333333 - - - - name - L meta.environment.list 5 - scope - text.latex meta.environment.list meta.environment.list meta.environment.list meta.environment.list meta.environment.list - settings - - foreground - #33333333 - - - - name - L meta.environment.list 6 - scope - text.latex meta.environment.list meta.environment.list meta.environment.list meta.environment.list meta.environment.list meta.environment.list - settings - - foreground - #33333333 - - - - name - L meta.end-document - scope - text.latex meta.end-document, text.latex meta.begin-document, meta.end-document.latex support.function, meta.end-document.latex variable.parameter, meta.begin-document.latex support.function, meta.begin-document.latex variable.parameter - settings - - background - #CCCCCC - foreground - #000000 - - - - name - ————————————————— - settings - - - - name - meta.brace.erb.return-value - scope - meta.brace.erb.return-value - settings - - background - #00805533 - foreground - #00FFAA - - - - name - source.ruby.rails.embedded.return-value.one-line - scope - source.ruby.rails.embedded.return-value.one-line - settings - - background - #8080801A - - - - name - meta.brace.erb - scope - punctuation.section.embedded -(source string source punctuation.section.embedded), meta.brace.erb.html - settings - - background - #00FFF81A - foreground - #00FFF8 - - - - name - source.ruby.rails.embedded.one-line - scope - source.ruby.rails.embedded.one-line - settings - - background - #00FFF81A - - - - name - String Embedded Source - scope - source string source punctuation.section.embedded - settings - - foreground - #406180 - - - - name - source.js.embedded - scope - source.js.embedded - settings - - background - #0D0D0D - - - - name - ◊ Source - scope - source - settings - - fontStyle - - - - - name - ◊ meta.brace.erb - scope - meta.brace.erb - settings - - background - #000000 - - - - name - ◊ Source String Source - scope - source string source - settings - - background - #33333380 - foreground - #FFFFFF - - - - name - ◊ Source String Interpolated Source - scope - source string.interpolated source - settings - - background - #00000099 - foreground - #999999 - - - - name - ◊ Source Embeded Source - scope - source source, source.java.embedded - settings - - background - #3333331A - - - - name - ◊ Text - scope - text -text.xml.strict - settings - - foreground - #FFFFFF - - - - name - ◊ Text Source - scope - text source, meta.scope.django.template - settings - - background - #000000 - foreground - #CCCCCC - - - - name - ◊ Text Source Text String - settings - - - - name - ◊ Text String Source - scope - text string source - settings - - foreground - #999999 - - - - name - ◊ Text Source String Source - settings - - - - name - ◊ Text String Source String Source - scope - text string source string source - settings - - - - name - ————————————————— - settings - - - - name - Invalid - scope - invalid -invalid.SOMETHING - settings - - background - #FF0007 - fontStyle - bold - foreground - #330004 - - - - name - Invalid Value - scope - invalid.SOMETHING - settings - - fontStyle - underline - foreground - #FF3600 - - - - name - Syntax - scope - meta.syntax - settings - - foreground - #333333 - - - - name - comment - scope - comment -comment.line - settings - - background - #33333333 - foreground - #4C4C4C - - - - name - comment.line - scope - comment.line - settings - - fontStyle - italic - foreground - #4C4C4C - - - - name - Comment Punctuation - scope - comment punctuation - settings - - - - name - ✘ HTML Comment - scope - text comment.block -source - settings - - fontStyle - italic - - - - name - ————————————————— - settings - - - - name - D Diff Add - scope - markup.inserted - settings - - background - #00401E - foreground - #40FF9A - - - - name - D Diff Delete - scope - markup.deleted - settings - - background - #400022 - foreground - #FF40A3 - - - - name - D Diff Changed - scope - markup.changed - settings - - background - #803D00 - foreground - #FFFF55 - - - - name - text.subversion-commit meta.scope.changed-files - scope - text.subversion-commit meta.scope.changed-files, text.subversion-commit meta.scope.changed-files.svn meta.diff.separator - settings - - background - #000000 - foreground - #FFFFFF - - - - name - text.subversion-commit - scope - text.subversion-commit - settings - - background - #FFFFFF - foreground - #000000 - - - - name - ————————————————— - settings - - - - name - meta.delimiter - scope - punctuation.terminator, meta.delimiter, punctuation.separator.method - settings - - background - #FFFFFF03 - fontStyle - bold - foreground - #7F7F7F - - - - name - meta.delimiter.statement.js - scope - punctuation.terminator.statement, meta.delimiter.statement.js - settings - - background - #00000080 - - - - name - meta.delimiter.object.js - scope - meta.delimiter.object.js - settings - - background - #00000040 - - - - name - Bold String Quotes - scope - string.quoted.single.brace, string.quoted.double.brace - settings - - fontStyle - bold - foreground - #803D00 - - - - name - ————————————————— - settings - - - - name - ß Blog Post / Email Message - scope - text.blog, text.mail - settings - - background - #DCDCDC - foreground - #333333 - - - - name - ß Post Content - scope - text.blog text, text.mail text - settings - - background - #000000 - foreground - #CCCCCC - - - - name - ß Post Header Keys - scope - meta.header.blog keyword.other, meta.header.mail keyword.other - settings - - background - #00FFF81A - fontStyle - - foreground - #06403E - - - - name - ß Post Header Values - scope - meta.header.blog string.unquoted.blog, meta.header.mail string.unquoted - settings - - background - #FFFF551A - foreground - #803D00 - - - - name - ————————————————— - settings - - - - name - OCAML - settings - - - - name - entity.name.type.module - scope - source.ocaml entity.name.type.module - settings - - foreground - #FF0000 - - - - name - support.other.module - scope - source.ocaml support.other.module - settings - - background - #83000033 - foreground - #FF0000 - - - - name - entity.name.type.variant - scope - entity.name.type.variant - settings - - foreground - #00FFF8 - - - - name - entity.name.tag, meta.record.definition - scope - source.ocaml entity.name.tag, source.ocaml meta.record.definition - settings - - foreground - #00FF79 - - - - name - ———————— PUNCTUATION ———————— - settings - - - - name - punctuation.separator.parameters - scope - punctuation.separator.parameters - settings - - fontStyle - bold - foreground - #FFFFFF - - - - name - meta.brace.pipe - scope - meta.brace.pipe - settings - - background - #33333333 - fontStyle - - foreground - #4C4C4C - - - - name - Misc Punctuation - scope - meta.brace.erb, source.ruby.embedded.source.brace, punctuation.section.dictionary, punctuation.terminator.dictionary, punctuation.separator.object, punctuation.separator.statement, punctuation.separator.key-value.css - settings - - fontStyle - bold - foreground - #666666 - - - - name - Curly Punctuation - scope - punctuation.section.scope.curly, punctuation.section.scope - settings - - fontStyle - bold - foreground - #999999 - - - - name - Object Punctuation - scope - punctuation.separator.objects, -meta.group.braces.curly meta.delimiter.object.comma, -punctuation.separator.key-value -meta.tag, -source.ocaml punctuation.separator.match-definition - - settings - - fontStyle - bold - foreground - #0C823B - - - - name - Function Punctuation - scope - punctuation.separator.parameters.function.js,punctuation.definition.function, punctuation.separator.function-return, punctuation.separator.function-definition, punctuation.definition.arguments, punctuation.separator.arguments - settings - - foreground - #800043 - - - - name - Array Punctuation - scope - meta.group.braces.square punctuation.section.scope, meta.group.braces.square meta.delimiter.object.comma, meta.brace.square, punctuation.separator.array, punctuation.section.array, punctuation.definition.array, punctuation.definition.constant.range - settings - - background - #803D001A - fontStyle - bold - foreground - #7F5E40 - - - - name - Array, Range - scope - meta.structure.array -punctuation.definition.array, meta.definition.range -punctuation.definition.constant.range - settings - - background - #803D001A - - - - name - meta.brace.curly meta.group - scope - meta.brace.curly meta.group.css - settings - - background - #00000080 - fontStyle - - - - - name - º meta.source.embedded - scope - meta.source.embedded, entity.other.django.tagbraces - settings - - background - #00000080 - foreground - #666666 - - - - name - º meta.group.braces.round JS - scope - source.js meta.group.braces.round, meta.scope.heredoc - settings - - - - name - º Even - scope - source.ruby meta.even-tab, source.ruby meta.even-tab.group2, source.ruby meta.even-tab.group4, source.ruby meta.even-tab.group6, source.ruby meta.even-tab.group8, source.ruby meta.even-tab.group10, source.ruby meta.even-tab.group12 - - settings - - background - #00000080 - - - - name - º meta.block.slate - scope - meta.block.slate - settings - - foreground - #666666 - - - - name - º meta.block.content.slate - scope - meta.block.content.slate - settings - - foreground - #CCCCCC - - - - name - Function Group1 - scope - meta.function meta.group.braces.curly.function -(meta.group meta.group), meta.function meta.odd-tab.group1 - settings - - - - name - Group1 - scope - meta.odd-tab.group1, meta.group.braces, meta.block.slate, text.xml.strict meta.tag, meta.paren-group, meta.section - settings - - background - #0A0A0A - - - - name - Group2 - scope - meta.even-tab.group2, meta.group.braces meta.group.braces, meta.block.slate meta.block.slate, text.xml.strict meta.tag meta.tag, meta.group.braces meta.group.braces, meta.paren-group meta.paren-group, meta.section meta.section - settings - - background - #0E0E0E - - - - name - Group3 - scope - meta.odd-tab.group3, meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces, meta.paren-group meta.paren-group meta.paren-group, meta.section meta.section meta.section - settings - - background - #111111 - - - - name - Group4 - scope - meta.even-tab.group4, meta.group.braces meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces meta.group.braces, meta.paren-group meta.paren-group meta.paren-group meta.paren-group, meta.section meta.section meta.section meta.section - settings - - background - #151515 - - - - name - Group5 - scope - meta.odd-tab.group5, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces, meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group, meta.section meta.section meta.section meta.section meta.section - settings - - background - #191919 - - - - name - Group6 - scope - meta.even-tab.group6, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces, meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group, meta.section meta.section meta.section meta.section meta.section meta.section - settings - - background - #1C1C1C - - - - name - Group7 - scope - meta.odd-tab.group7, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces, meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group, meta.section meta.section meta.section meta.section meta.section meta.section meta.section - settings - - background - #1F1F1F - - - - name - Group8 - scope - meta.even-tab.group8, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces, meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group, meta.section meta.section meta.section meta.section meta.section meta.section meta.section meta.section - settings - - background - #212121 - - - - name - Group9 - scope - meta.odd-tab.group9, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces, meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group meta.paren-group, meta.section meta.section meta.section meta.section meta.section meta.section meta.section meta.section meta.section - settings - - background - #242424 - - - - name - Group10 - scope - meta.even-tab.group10 - settings - - background - #1F1F1F - - - - name - Group11 - scope - meta.odd-tab.group11 - settings - - background - #151515 - - - - name - ———————— END ———————— - settings - - - - name - IE6 - scope - meta.property.vendor.microsoft.trident.4, -meta.property.vendor.microsoft.trident.4 support.type.property-name, -meta.property.vendor.microsoft.trident.4 punctuation.terminator.rule - settings - - fontStyle - - foreground - #1B95E2 - - - - name - IE7 - scope - meta.property.vendor.microsoft.trident.5, -meta.property.vendor.microsoft.trident.5 support.type.property-name, -meta.property.vendor.microsoft.trident.5 punctuation.separator.key-value, -meta.property.vendor.microsoft.trident.5 punctuation.terminator.rule - settings - - fontStyle - - foreground - #F5C034 - - - - uuid - 24847CB3-23BC-4BF9-861B-E39661A6DA71 - - diff --git a/themes/Brilliance Dull.tmTheme b/themes/Brilliance Dull.tmTheme deleted file mode 100644 index 39f90ae22..000000000 --- a/themes/Brilliance Dull.tmTheme +++ /dev/null @@ -1,2243 +0,0 @@ - - - - - author - Thomas Aylott - comment - by Thomas Aylott subtleGradient.com - name - Brilliance Dull - settings - - - settings - - background - #050505FA - caret - #7979B7 - foreground - #CDCDCD - invisibles - #CDCDCD1A - lineHighlight - #0000801A - selection - #2E2EE64D - - - - name - Thomas Aylott ㊷ - scope - meta.thomas_aylott - settings - - background - #FFFFFF - fontStyle - bold - foreground - #000000 - - - - name - subtleGradient.com - scope - meta.subtlegradient - settings - - background - #FFFFFF - fontStyle - underline - foreground - #555555 - - - - name - —————————————————— - scope - meta.subtlegradient - settings - - background - #FFFFFF - foreground - #E6E6E6 - - - - name - ~ String - scope - string -meta.tag -meta.doctype -string.regexp -string.literal -string.interpolated -string.quoted.literal -string.unquoted, variable.parameter.misc.css, text string source string, string.unquoted string, string.regexp string - settings - - background - #803D0033 - foreground - #D2D1AB - - - - name - ~ String Punctuation - scope - punctuation.definition.string -meta.tag - settings - - foreground - #533F2C - - - - name - ~ String Punctuation II - scope - string.regexp punctuation.definition.string, string.quoted.literal punctuation.definition.string, string.quoted.double.ruby.mod punctuation.definition.string - settings - - foreground - #FFF80033 - - - - name - ~ String Literal - scope - string.quoted.literal, string.quoted.double.ruby.mod - settings - - background - #43800033 - foreground - #A6A458 - - - - name - ~ String Unquoted - scope - string.unquoted -string.unquoted.embedded, string.quoted.double.multiline, meta.scope.heredoc - settings - - foreground - #D2BEAB - - - - name - ~ String Interpolated - scope - string.interpolated - settings - - background - #1A1A1A - foreground - #D2D1AB - - - - name - ~ String RegEx - scope - string.regexp - settings - - background - #43800033 - foreground - #A6A458 - - - - name - ~ String RegEx Group 1 - scope - string.regexp.group - settings - - background - #43800033 - - - - name - ~ String RegEx Group 2 - scope - string.regexp.group string.regexp.group - settings - - background - #43800033 - foreground - #FFFFFF66 - - - - name - ~ String RegEx Group 3 - scope - string.regexp.group string.regexp.group string.regexp.group - settings - - background - #43800033 - foreground - #FFFFFF66 - - - - name - ~ String RegEx Group 4 - scope - string.regexp.group string.regexp.group string.regexp.group string.regexp.group - settings - - background - #43800033 - foreground - #FFFFFF66 - - - - name - ~ String RegEx Character-Class - scope - string.regexp.character-class - settings - - background - #43800033 - foreground - #80A659 - - - - name - ~ String RegEx Arbitrary-Repitition - scope - string.regexp.arbitrary-repitition - settings - - background - #43800033 - foreground - #56A5A4 - - - - name - source.regexp keyword - scope - source.regexp keyword.operator - settings - - foreground - #A75980 - - - - name - ~ String RegEx Comment - scope - string.regexp comment - settings - - fontStyle - italic - foreground - #FFFFFF - - - - name - ~ Meta Group Assertion Regexp - scope - meta.group.assertion.regexp - settings - - background - #0086FF33 - - - - name - ~ Meta Assertion - scope - meta.assertion, meta.group.assertion keyword.control.group.regexp - settings - - foreground - #5780A6 - - - - name - ~ Number - scope - constant.numeric - settings - - foreground - #95A658 - - - - name - ~ Character constant - scope - constant.character - settings - - foreground - #80A659 - - - - name - ~ Built-in constant - scope - constant.language, keyword.other.unit, constant.other.java, constant.other.unit - settings - - foreground - #59A559 - - - - name - ~ Built-in constant+ - scope - constant.language.pseudo-variable - settings - - background - #04800033 - foreground - #59A559 - - - - name - ~ User-defined constant - scope - constant.other, constant.block - settings - - foreground - #57A57D - - - - name - ~ Library constant - scope - support.constant, constant.name - settings - - foreground - #56A5A4 - - - - name - ————————————————— - settings - - - - name - √ pre-defined variable - scope - variable.language, variable.other.readwrite.global.pre-defined - settings - - foreground - #5E6B6B - - - - name - √ Constant Variable - scope - variable.other.constant - settings - - foreground - #56A5A4 - - - - name - √ Library variable - scope - support.variable - settings - - background - #00807C33 - foreground - #56A5A4 - - - - name - √ global Variable - scope - variable.other.readwrite.global - settings - - background - #00438033 - foreground - #2B5252 - - - - name - √ Variable - scope - variable.other, variable.js - settings - - foreground - #5780A6 - - - - name - √ class Variable - scope - variable.other.readwrite.class - settings - - background - #0007FF33 - foreground - #5780A6 - - - - name - √ instance Variable - scope - variable.other.readwrite.instance - settings - - foreground - #555F69 - - - - name - √ Normal Variables - scope - variable.other.php, variable.other.normal - settings - - foreground - #555F69 - - - - name - √ Variable Punctuation - scope - punctuation.definition -punctuation.definition.comment, punctuation.separator.variable - settings - - foreground - #00000080 - - - - name - ————————————————— - settings - - - - name - ¢ Storage - scope - storage -storage.modifier - settings - - foreground - #A77D58 - - - - name - ¢ Entity Name Preprocessor - scope - other.preprocessor, entity.name.preprocessor - settings - - background - #803D0033 - - - - name - ~ variable.language.this.js.prototype - scope - variable.language.this.js - settings - - foreground - #666666 - - - - name - ¢ Storage Modifier - scope - storage.modifier - settings - - foreground - #533F2C - - - - name - ¢ Class name - scope - entity.name.class, entity.name.type.class, entity.name.type.module - settings - - foreground - #A7595A - - - - name - ¢ Class - scope - meta.class -meta.class.instance, declaration.class, meta.definition.class, declaration.module - settings - - background - #29161780 - foreground - #532D2D - - - - name - ¢ Library class/type - scope - support.type, support.class - settings - - background - #80000433 - foreground - #A7595A - - - - name - ¢ Instance - scope - entity.name.instance - settings - - foreground - #A7595A - - - - name - ¢ Instance.constructor - scope - meta.class.instance.constructor - settings - - background - #80004333 - - - - name - ¢ Inherited class - scope - entity.other.inherited-class, entity.name.module - settings - - background - #80000433 - foreground - #A75980 - - - - name - ¢ Class Method - scope - object.property.function, meta.definition.method - settings - - foreground - #A75980 - - - - name - ¢ Function - scope - meta.function -(meta.tell-block), meta.property.function, declaration.function - settings - - background - #80004333 - foreground - #532D40 - - - - name - ¢ Function name - scope - entity.name.function, entity.name.preprocessor - settings - - foreground - #A75980 - - - - name - ————————————————— - settings - - - - name - ™ Keyword - scope - keyword - settings - - foreground - #A459A5 - - - - name - ™ Keyword.control - scope - keyword.control - settings - - background - #3C008033 - foreground - #A459A5 - - - - name - ™ Special Function - scope - keyword.other.special-method, meta.function-call entity.name.function -(meta.function-call meta.function), support.function - variable - settings - - foreground - #8D809D - - - - name - ™ Library function - scope - support.function - variable - settings - - foreground - #634683 - - - - name - ™ Keyword.operator - scope - keyword.operator, declaration.function.operator, meta.preprocessor.c.include - settings - - fontStyle - bold - foreground - #7979B7 - - - - name - ™ keyword.operator.comparison - scope - keyword.operator.comparison - settings - - fontStyle - - foreground - #9899C8 - - - - name - ™ Function argument - scope - variable.parameter -variable.parameter.misc.css, meta.definition.method meta.definition.param-list, meta.function.method.with-arguments variable.parameter.function - settings - - background - #3C008033 - foreground - #ABACD2 - - - - name - ————————————————— - settings - - - - name - ✘ HTML - settings - - - - name - ✘ Tag Doctype - scope - meta.doctype, meta.tag.sgml-declaration.doctype, meta.tag.sgml.doctype - settings - - background - #333333 - foreground - #CDCDCD - - - - name - ✘ Tag - scope - meta.tag - settings - - foreground - #333333 - - - - name - ✘ Tag Structure - scope - meta.tag.structure, meta.tag.segment - settings - - background - #333333BF - foreground - #666666 - - - - name - ✘ Tag Block - scope - meta.tag.block, meta.tag.xml, meta.tag.key - settings - - background - #4C4C4C33 - foreground - #4C4C4C - - - - name - ✘ Tag Inline - scope - meta.tag.inline - settings - - background - #803D0033 - foreground - #A77D58 - - - - name - meta.tag.inline source - scope - meta.tag.inline source - settings - - background - #803D0033 - - - - name - ✘ Tag Other - scope - meta.tag.other, entity.name.tag.style, source entity.other.attribute-name -text.html.basic.embedded , entity.name.tag.script, meta.tag.block.script - settings - - background - #80000433 - foreground - #A7595A - - - - name - ✘ Tag Form - scope - meta.tag.form, meta.tag.block.form - settings - - background - #00438033 - foreground - #5780A6 - - - - name - ✘ Tag Meta - scope - meta.tag.meta - settings - - background - #3C008033 - foreground - #A459A5 - - - - name - ✘ Tag Block Head - scope - meta.section.html.head - settings - - background - #121212 - - - - name - ✘ Tag Block Form - scope - meta.section.html.form - settings - - background - #0043801A - - - - name - ✘ XML Tag - scope - meta.tag.xml - settings - - foreground - #666666 - - - - name - ✘ Tag name - scope - entity.name.tag - settings - - foreground - #FFFFFF4D - - - - name - ✘ Tag attribute - scope - entity.other.attribute-name, meta.tag punctuation.definition.string - settings - - foreground - #FFFFFF33 - - - - name - ✘ Tag value - scope - meta.tag string -source -punctuation, text source text meta.tag string -punctuation - settings - - foreground - #FFFFFF66 - - - - name - ————————————————— - settings - - - - name - M markdown - settings - - - - name - M markup - scope - markup markup -(markup meta.paragraph.list) - settings - - background - #33333333 - foreground - #A6A458 - - - - name - M HR - scope - markup.hr - settings - - background - #FFFFFF - foreground - #000000 - - - - name - M heading - scope - markup.heading - settings - - background - #33333380 - foreground - #666666 - - - - name - M bold - scope - markup.bold - settings - - fontStyle - bold - - - - name - M italic - scope - markup.italic - settings - - fontStyle - italic - - - - name - M strike - settings - - - - name - M add - settings - - - - name - M del - settings - - - - name - M underline - scope - markup.underline - settings - - fontStyle - underline - - - - name - M reference - scope - meta.reference, markup.underline.link - settings - - fontStyle - - foreground - #5780A6 - - - - name - M reference name - scope - entity.name.reference - settings - - background - #00438033 - foreground - #56A5A4 - - - - name - M underline link - scope - meta.reference.list markup.underline.link, text.html.textile markup.underline.link - settings - - fontStyle - underline - foreground - #56A5A4 - - - - name - M raw block - scope - markup.raw.block - settings - - background - #000000 - foreground - #999999 - - - - name - M quote block - scope - markup.quote - settings - - background - #FFFFFF1A - - - - name - ————————————————— - settings - - - - name - § CSS - scope - source.css - settings - - - - name - § Selector - scope - meta.selector - settings - - background - #00000080 - foreground - #666666 - - - - name - § Attribute-Match - scope - meta.attribute-match.css - settings - - background - #00048033 - foreground - #575AA6 - - - - name - § Pseudo-Class - scope - entity.other.attribute-name.pseudo-class, entity.other.attribute-name.tag.pseudo-class - settings - - foreground - #7C58A5 - - - - name - § Class - scope - meta.selector entity.other.attribute-name.class - settings - - foreground - #A459A5 - - - - name - § ID - scope - meta.selector entity.other.attribute-name.id - settings - - foreground - #A75980 - - - - name - § Tag - scope - meta.selector entity.name.tag - settings - - fontStyle - - foreground - #A7595A - - - - name - § Tag Wildcard - scope - entity.name.tag.wildcard, entity.other.attribute-name.universal - settings - - fontStyle - bold - foreground - #A77D58 - - - - name - § meta.scope.property-list - scope - meta.scope.property-list - settings - - fontStyle - bold - foreground - #333333 - - - - name - § meta.property-name - scope - meta.property-name - settings - - fontStyle - - foreground - #999999 - - - - name - § support.type.property-name - scope - support.type.property-name - settings - - background - #000000 - fontStyle - - foreground - #FFFFFF - - - - name - § meta.property-value - scope - meta.property-value - settings - - background - #0D0D0D - fontStyle - - foreground - #999999 - - - - name - ————————————————— - settings - - - - name - LaTeX - scope - text.latex - settings - - - - name - L Markup Raw - scope - text.latex markup.raw - settings - - background - #000000 - - - - name - L support.function - scope - text.latex support.function -support.function.textit -support.function.emph - settings - - foreground - #BDABD1 - - - - name - L support.function.section - scope - text.latex support.function.section - settings - - foreground - #FFFFFFBF - - - - name - L entity.name.section - scope - text.latex entity.name.section -meta.group -keyword.operator.braces - settings - - background - #FFFFFF - fontStyle - - foreground - #000000 - - - - name - L constant.language.general - scope - text.latex constant.language.general - settings - - - - name - L keyword.operator.delimiter - scope - text.latex keyword.operator.delimiter - settings - - background - #00000080 - - - - name - L keyword.operator.brackets - scope - text.latex keyword.operator.brackets - settings - - foreground - #999999 - - - - name - L keyword.operator.braces - scope - text.latex keyword.operator.braces - settings - - fontStyle - - foreground - #666666 - - - - name - L meta.footnote - scope - meta.footnote - settings - - background - #00048033 - foreground - #0008FF4D - - - - name - L meta.label.reference - scope - text.latex meta.label.reference - settings - - background - #FFFFFF0D - fontStyle - - - - - name - L keyword.control.ref - scope - text.latex keyword.control.ref - settings - - background - #180D0C - foreground - #A7595A - - - - name - L variable.parameter.label.reference - scope - text.latex variable.parameter.label.reference - settings - - background - #291616 - foreground - #D2BEAB - - - - name - L keyword.control.cite - scope - text.latex keyword.control.cite - settings - - background - #180D12 - foreground - #A75980 - - - - name - L variable.parameter.cite - scope - variable.parameter.cite - settings - - background - #29161F - foreground - #E8D5DE - - - - name - L variable.parameter.label - scope - text.latex variable.parameter.label - settings - - foreground - #FFFFFF80 - - - - name - L meta.group.braces - scope - text.latex meta.group.braces - settings - - foreground - #33333333 - - - - name - L meta.environment.list - scope - text.latex meta.environment.list - settings - - background - #00000080 - fontStyle - - foreground - #33333333 - - - - name - L meta.environment.list 2 - scope - text.latex meta.environment.list meta.environment.list - settings - - background - #00000080 - foreground - #33333333 - - - - name - L meta.environment.list 3 - scope - text.latex meta.environment.list meta.environment.list meta.environment.list - settings - - background - #000000 - foreground - #33333333 - - - - name - L meta.environment.list 4 - scope - text.latex meta.environment.list meta.environment.list meta.environment.list meta.environment.list - settings - - foreground - #33333333 - - - - name - L meta.environment.list 5 - scope - text.latex meta.environment.list meta.environment.list meta.environment.list meta.environment.list meta.environment.list - settings - - foreground - #33333333 - - - - name - L meta.environment.list 6 - scope - text.latex meta.environment.list meta.environment.list meta.environment.list meta.environment.list meta.environment.list meta.environment.list - settings - - foreground - #33333333 - - - - name - L meta.end-document - scope - text.latex meta.end-document, text.latex meta.begin-document, meta.end-document.latex support.function, meta.end-document.latex variable.parameter, meta.begin-document.latex support.function, meta.begin-document.latex variable.parameter - settings - - background - #CDCDCD - foreground - #000000 - - - - name - ————————————————— - settings - - - - name - meta.brace.erb.return-value - scope - meta.brace.erb.return-value - settings - - background - #45815D33 - foreground - #596B61 - - - - name - source.ruby.rails.embedded.return-value.one-line - scope - source.ruby.rails.embedded.return-value.one-line - settings - - background - #66666633 - - - - name - meta.brace.erb - scope - punctuation.section.embedded -(source string source punctuation.section.embedded), meta.brace.erb.html - settings - - background - #00FFF81A - foreground - #56A5A4 - - - - name - source.ruby.rails.embedded.one-line - scope - source.ruby.rails.embedded.one-line - settings - - background - #00FFF81A - - - - name - String Embedded Source - scope - source string source punctuation.section.embedded - settings - - foreground - #555F69 - - - - name - ◊ Source - scope - source - settings - - background - #000000 - fontStyle - - - - - name - ◊ meta.brace.erb - scope - meta.brace.erb - settings - - background - #000000 - - - - name - ◊ Source String Source - scope - source string source - settings - - background - #33333380 - foreground - #FFFFFF - - - - name - ◊ Source String Interpolated Source - scope - source string.interpolated source - settings - - background - #00000099 - foreground - #999999 - - - - name - ◊ Source Embeded Source - scope - source.java.embedded - settings - - background - #3333331A - - - - name - ◊ Text - scope - text -text.xml.strict - settings - - foreground - #FFFFFF - - - - name - ◊ Text Source - scope - text source, meta.scope.django.template - settings - - background - #000000 - foreground - #CCCCCC - - - - name - ◊ Text Source Text String - settings - - - - name - ◊ Text String Source - scope - text string source - settings - - foreground - #999999 - - - - name - ◊ Text Source String Source - settings - - - - name - ◊ Text String Source String Source - scope - text string source string source - settings - - - - name - ————————————————— - settings - - - - name - Syntax - scope - meta.syntax - settings - - foreground - #333333 - - - - name - Invalid - scope - invalid - settings - - background - #A7595A - fontStyle - bold - foreground - #211211 - - - - name - Comment - scope - 0comment - settings - - background - #0000FF1A - fontStyle - italic - foreground - #8F8FC3 - - - - name - Comment Punctuation - scope - comment punctuation - settings - - fontStyle - bold - foreground - #0000FF1A - - - - name - comment - scope - comment - settings - - foreground - #333333 - - - - name - Comment Punctuation - scope - comment punctuation - settings - - background - #8080800D - fontStyle - bold italic - foreground - #262626 - - - - name - ✘ HTML Comment - scope - text comment.block -source - settings - - fontStyle - italic - - - - name - ————————————————— - settings - - - - name - D Diff Add - scope - markup.inserted - settings - - background - #15281F - foreground - #81BB9E - - - - name - D Diff Delete - scope - markup.deleted - settings - - background - #400021 - foreground - #BC839F - - - - name - D Diff Changed - scope - markup.changed - settings - - background - #533F2C - foreground - #C3C38F - - - - name - text.subversion-commit meta.scope.changed-files - scope - text.subversion-commit meta.scope.changed-files, text.subversion-commit meta.scope.changed-files.svn meta.diff.separator - settings - - background - #000000 - foreground - #FFFFFF - - - - name - text.subversion-commit - scope - text.subversion-commit - settings - - background - #FFFFFF - foreground - #000000 - - - - name - ————————————————— - settings - - - - name - meta.delimiter - scope - punctuation.terminator, meta.delimiter, punctuation.separator.method - settings - - background - #FFFFFF03 - fontStyle - bold - foreground - #FFFFFF - - - - name - meta.delimiter.statement.js - scope - punctuation.terminator.statement, meta.delimiter.statement.js - settings - - background - #000000BF - - - - name - meta.delimiter.object.js - scope - meta.delimiter.object.js - settings - - background - #00000040 - - - - name - Bold String Quotes - scope - string.quoted.single.brace, string.quoted.double.brace - settings - - fontStyle - bold - foreground - #533F2C - - - - name - ————————————————— - settings - - - - name - meta.headers.blog - scope - text.blog -(text.blog text) - settings - - background - #FFFFFF - - - - name - meta.headers.blog - scope - meta.headers.blog - settings - - background - #FFFFFF - foreground - #666666 - - - - name - meta.headers.blog keyword.other.blog - scope - meta.headers.blog keyword.other.blog - settings - - background - #00FFF81A - fontStyle - - foreground - #192B2A - - - - name - meta.headers.blog string.unquoted.blog - scope - meta.headers.blog string.unquoted.blog - settings - - background - #FFFF551A - foreground - #533F2C - - - - name - ————————————————— - settings - - - - name - meta.brace.pipe - scope - meta.brace.pipe - settings - - background - #33333333 - fontStyle - - foreground - #4C4C4C - - - - name - Misc Punctuation - scope - meta.brace.erb, source.ruby.embedded.source.brace, punctuation.section.dictionary, punctuation.terminator.dictionary, punctuation.separator.object - settings - - fontStyle - bold - foreground - #4C4C4C - - - - name - Curly Punctuation - scope - meta.group.braces.curly punctuation.section.scope, meta.brace.curly - settings - - fontStyle - bold - foreground - #FFFFFF - - - - name - Object Punctuation - scope - punctuation.separator.objects, meta.group.braces.curly meta.delimiter.object.comma, punctuation.separator.key-value -meta.tag - settings - - fontStyle - bold - foreground - #345743 - - - - name - Array Punctuation - scope - meta.group.braces.square punctuation.section.scope, meta.group.braces.square meta.delimiter.object.comma, meta.brace.square, punctuation.separator.array, punctuation.section.array - settings - - background - #803D001A - fontStyle - bold - foreground - #695F55 - - - - name - meta.brace.curly meta.group - scope - meta.brace.curly meta.group - settings - - background - #00000080 - fontStyle - - foreground - #CDCDCD - - - - name - Function Punctuation - scope - meta.group.braces.round punctuation.section.scope, meta.group.braces.round meta.delimiter.object.comma, meta.brace.round - settings - - fontStyle - bold - foreground - #532D40 - - - - name - meta.brace.curly.function - scope - punctuation.section.function, meta.brace.curly.function, meta.function-call punctuation.section.scope.ruby - settings - - background - #3C008033 - fontStyle - - foreground - #ABACD2 - - - - name - º meta.source.embedded - scope - meta.source.embedded, entity.other.django.tagbraces - settings - - background - #00000080 - foreground - #666666 - - - - name - º meta.group.braces.round JS - scope - source.js meta.group.braces.round, meta.scope.heredoc - settings - - - - name - º meta.group.braces 1 - scope - meta.odd-tab.group1, meta.group.braces, meta.block.slate, text.xml.strict meta.tag, meta.tell-block meta.tell-block - settings - - background - #0A0A0A - - - - name - º meta.group.braces 2 - scope - meta.even-tab.group2, meta.group.braces meta.group.braces, meta.block.slate meta.block.slate, text.xml.strict meta.tag meta.tag, meta.group.braces meta.group.braces, meta.tell-block meta.tell-block - settings - - background - #0E0E0E - - - - name - º meta.group.braces 3 - scope - meta.odd-tab.group3, meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces, meta.tell-block meta.tell-block meta.tell-block - settings - - background - #111111 - - - - name - º meta.group.braces 4 - scope - meta.even-tab.group4, meta.group.braces meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces meta.group.braces, meta.tell-block meta.tell-block meta.tell-block meta.tell-block - settings - - background - #151515 - - - - name - º meta.group.braces 5 - scope - meta.odd-tab.group5, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces, meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block - settings - - background - #191919 - - - - name - º meta.group.braces 6 - scope - meta.even-tab.group6, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces, meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block - settings - - background - #1C1C1C - - - - name - º meta.group.braces 7 - scope - meta.odd-tab.group7, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces, meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block - settings - - background - #1F1F1F - - - - name - º meta.group.braces 8 - scope - meta.even-tab.group8, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces, meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block - settings - - background - #212121 - - - - name - º meta.group.braces 9 - scope - meta.odd-tab.group11, meta.odd-tab.group10, meta.odd-tab.group9, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces , meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate meta.block.slate , text.xml.strict meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag meta.tag, meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces meta.group.braces, meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block meta.tell-block - settings - - background - #242424 - - - - name - º meta.block.slate - scope - meta.block.slate - settings - - foreground - #666666 - - - - name - º meta.block.content.slate - scope - meta.block.content.slate - settings - - foreground - #CDCDCD - - - - name - ————————————————— - settings - - - - uuid - 4535004C-927A-401A-A6D5-1C9AC89E24C6 - - diff --git a/themes/Cobalt.tmTheme b/themes/Cobalt.tmTheme deleted file mode 100644 index 3c685f253..000000000 --- a/themes/Cobalt.tmTheme +++ /dev/null @@ -1,559 +0,0 @@ - - - - - author - Jacob Rus - comment - Created by Jacob Rus. Based on ‘Slate’ by Wilson Miner - name - Cobalt - settings - - - settings - - background - #002240 - caret - #FFFFFF - foreground - #FFFFFF - invisibles - #FFFFFF26 - lineHighlight - #00000059 - selection - #B36539BF - - - - name - Punctuation - scope - punctuation - (punctuation.definition.string | punctuation.definition.comment) - settings - - fontStyle - - foreground - #E1EFFF - - - - name - Constant - scope - constant - settings - - fontStyle - - foreground - #FF628C - - - - name - Entity - scope - entity - settings - - fontStyle - - foreground - #FFDD00 - - - - name - Keyword - scope - keyword - settings - - fontStyle - - foreground - #FF9D00 - - - - name - Storage - scope - storage - settings - - fontStyle - - foreground - #FFEE80 - - - - name - String - scope - string -string.unquoted.old-plist -string.unquoted.heredoc, string.unquoted.heredoc string - settings - - fontStyle - - foreground - #3AD900 - - - - name - Comment - scope - comment - settings - - fontStyle - italic - foreground - #0088FF - - - - name - Support - scope - support - settings - - fontStyle - - foreground - #80FFBB - - - - name - Variable - scope - variable - settings - - fontStyle - - foreground - #CCCCCC - - - - name - Lang Variable - scope - variable.language - settings - - fontStyle - - foreground - #FF80E1 - - - - name - Function Call - scope - meta.function-call - settings - - foreground - #FFEE80 - - - - name - Invalid - scope - invalid - settings - - background - #800F00 - foreground - #F8F8F8 - - - - name - Embedded Source - scope - text source, string.unquoted.heredoc, source source - settings - - background - #223545 - fontStyle - - foreground - #FFFFFF - - - - name - Entity inherited-class - scope - entity.other.inherited-class - settings - - fontStyle - italic - foreground - #80FCFF - - - - name - String embedded-source - scope - string.quoted source - settings - - fontStyle - - foreground - #9EFF80 - - - - name - String constant - scope - string constant - settings - - foreground - #80FF82 - - - - name - String.regexp - scope - string.regexp - settings - - foreground - #80FFC2 - - - - name - String variable - scope - string variable - settings - - foreground - #EDEF7D - - - - name - Support.function - scope - support.function - settings - - fontStyle - - foreground - #FFB054 - - - - name - Support.constant - scope - support.constant - settings - - fontStyle - - foreground - #EB939A - - - - name - Exception - scope - support.type.exception - settings - - foreground - #FF1E00 - - - - name - C/C++ Preprocessor Line - scope - meta.preprocessor.c - settings - - foreground - #8996A8 - - - - name - C/C++ Preprocessor Directive - scope - meta.preprocessor.c keyword - settings - - foreground - #AFC4DB - - - - name - Doctype/XML Processing - scope - meta.sgml.html meta.doctype, meta.sgml.html meta.doctype entity, meta.sgml.html meta.doctype string, meta.xml-processing, meta.xml-processing entity, meta.xml-processing string - settings - - foreground - #73817D - - - - name - Meta.tag.A - scope - meta.tag, meta.tag entity - settings - - foreground - #9EFFFF - - - - name - css tag-name - scope - meta.selector.css entity.name.tag - settings - - foreground - #9EFFFF - - - - name - css#id - scope - meta.selector.css entity.other.attribute-name.id - settings - - foreground - #FFB454 - - - - name - css.class - scope - meta.selector.css entity.other.attribute-name.class - settings - - foreground - #5FE461 - - - - name - css property-name: - scope - support.type.property-name.css - settings - - foreground - #9DF39F - - - - name - css property-value; - scope - meta.property-group support.constant.property-value.css, meta.property-value support.constant.property-value.css - settings - - foreground - #F6F080 - - - - name - css @at-rule - scope - meta.preprocessor.at-rule keyword.control.at-rule - settings - - foreground - #F6AA11 - - - - name - css additional-constants - scope - meta.property-value support.constant.named-color.css, meta.property-value constant - settings - - foreground - #EDF080 - - - - name - css constructor.argument - scope - meta.constructor.argument.css - settings - - foreground - #EB939A - - - - name - diff.header - scope - meta.diff, meta.diff.header - settings - - background - #000E1A - fontStyle - - foreground - #F8F8F8 - - - - name - diff.deleted - scope - markup.deleted - settings - - background - #4C0900 - foreground - #F8F8F8 - - - - name - diff.changed - scope - markup.changed - settings - - background - #806F00 - foreground - #F8F8F8 - - - - name - diff.inserted - scope - markup.inserted - settings - - background - #154F00 - foreground - #F8F8F8 - - - - name - Raw Markup - scope - markup.raw - settings - - background - #8FDDF630 - - - - name - Block Quote - scope - markup.quote - settings - - background - #004480 - - - - name - List - scope - markup.list - settings - - background - #130D26 - - - - name - Bold Markup - scope - markup.bold - settings - - fontStyle - bold - foreground - #C1AFFF - - - - name - Italic Markup - scope - markup.italic - settings - - fontStyle - italic - foreground - #B8FFD9 - - - - name - Heading Markup - scope - markup.heading - settings - - background - #001221 - fontStyle - bold - foreground - #C8E4FD - - - - uuid - 06CD1FB2-A00A-4F8C-97B2-60E131980454 - - diff --git a/themes/Dawn.tmTheme b/themes/Dawn.tmTheme deleted file mode 100644 index 12cff9b6e..000000000 --- a/themes/Dawn.tmTheme +++ /dev/null @@ -1,437 +0,0 @@ - - - - - author - David Powers - comment - Dawn - name - Dawn - settings - - - settings - - background - #F9F9F9 - caret - #000000 - foreground - #080808 - invisibles - #4B4B7E80 - lineHighlight - #2463B41F - selection - #275FFF4D - - - - name - Comment - scope - comment - settings - - fontStyle - italic - foreground - #5A525F - - - - name - Constant - scope - constant - settings - - fontStyle - bold - foreground - #811F24 - - - - name - Entity - scope - entity - settings - - fontStyle - - foreground - #BF4F24 - - - - name - Keyword - scope - keyword - settings - - fontStyle - - foreground - #794938 - - - - name - Storage - scope - storage - settings - - fontStyle - italic - foreground - #A71D5D - - - - name - String - scope - string | punctuation.definition.string - settings - - fontStyle - - foreground - #0B6125 - - - - name - Support - scope - support - settings - - fontStyle - - foreground - #691C97 - - - - name - Variable - scope - variable - settings - - fontStyle - - foreground - #234A97 - - - - name - Punctuation.separator - scope - punctuation.separator - settings - - foreground - #794938 - - - - name - Invalid – Deprecated - scope - invalid.deprecated - settings - - fontStyle - bold italic underline - foreground - #B52A1D - - - - name - Invalid – Illegal - scope - invalid.illegal - settings - - background - #B52A1D - fontStyle - italic underline - foreground - #F8F8F8 - - - - name - String embedded-source - scope - string source - settings - - background - #6F8BBA26 - fontStyle - - foreground - #080808 - - - - name - String constant - scope - string constant - settings - - fontStyle - bold - foreground - #696969 - - - - name - String variable - scope - string variable - settings - - fontStyle - - foreground - #234A97 - - - - name - String.regexp - scope - string.regexp - settings - - fontStyle - - foreground - #CF5628 - - - - name - String.regexp.«special» - scope - string.regexp.character-class, string.regexp constant.character.escaped, string.regexp source.ruby.embedded, string.regexp string.regexp.arbitrary-repitition - settings - - fontStyle - bold italic - foreground - #CF5628 - - - - name - String.regexp constant.character.escape - scope - string.regexp constant.character.escape - settings - - fontStyle - bold - foreground - #811F24 - - - - name - Embedded Source - scope - text source - settings - - background - #6F8BBA26 - - - - name - Support.function - scope - support.function - settings - - fontStyle - - foreground - #693A17 - - - - name - Support.constant - scope - support.constant - settings - - fontStyle - - foreground - #B4371F - - - - name - Support.variable - scope - support.variable - settings - - foreground - #234A97 - - - - name - Markup.list - scope - markup.list - settings - - foreground - #693A17 - - - - name - Markup.heading - scope - markup.heading | markup.heading entity.name - settings - - fontStyle - bold - foreground - #19356D - - - - name - Markup.quote - scope - markup.quote - settings - - background - #BBBBBB30 - fontStyle - italic - foreground - #0B6125 - - - - name - Markup.italic - scope - markup.italic - settings - - fontStyle - italic - foreground - #080808 - - - - name - Markup.bold - scope - markup.bold - settings - - fontStyle - bold - foreground - #080808 - - - - name - Markup.underline - scope - markup.underline - settings - - fontStyle - underline - foreground - #080808 - - - - name - Markup.link - scope - markup.link - settings - - fontStyle - italic underline - foreground - #234A97 - - - - name - Markup.raw - scope - markup.raw - settings - - background - #BBBBBB30 - fontStyle - - foreground - #234A97 - - - - name - Markup.deleted - scope - markup.deleted - settings - - foreground - #59140E - - - - name - Meta.separator - scope - meta.separator - settings - - background - #DCDCDC - fontStyle - bold - foreground - #19356D - - - - uuid - E7E82498-F9EA-49A6-A0D8-12327EA46B01 - - diff --git a/themes/Espresso Libre.tmTheme b/themes/Espresso Libre.tmTheme deleted file mode 100644 index 2ccae6448..000000000 --- a/themes/Espresso Libre.tmTheme +++ /dev/null @@ -1,402 +0,0 @@ - - - - - author - Chris Thomas - name - Espresso Libre - settings - - - settings - - background - #2A211C - caret - #889AFF - foreground - #BDAE9D - invisibles - #BFBFBF - lineHighlight - #3A312C - selection - #C3DCFF - - - - name - Comment - scope - comment - settings - - fontStyle - italic - foreground - #0066FF - - - - name - Keyword - scope - keyword, storage - settings - - fontStyle - bold - foreground - #43A8ED - - - - name - Number - scope - constant.numeric - settings - - fontStyle - - foreground - #44AA43 - - - - name - User-defined constant - scope - constant - settings - - fontStyle - bold - foreground - #C5656B - - - - name - Built-in constant - scope - constant.language - settings - - fontStyle - bold - foreground - #585CF6 - - - - name - Variable - scope - variable.language, variable.other - settings - - fontStyle - - foreground - #318495 - - - - name - String - scope - string - settings - - fontStyle - - foreground - #049B0A - - - - name - String interpolation - scope - constant.character.escape, string source - settings - - fontStyle - - foreground - #2FE420 - - - - name - Preprocessor line - scope - meta.preprocessor - settings - - fontStyle - - foreground - #1A921C - - - - name - Preprocessor directive - scope - keyword.control.import - settings - - fontStyle - bold - foreground - #9AFF87 - - - - name - Function name - scope - entity.name.function, keyword.other.name-of-parameter.objc - settings - - fontStyle - bold - foreground - #FF9358 - - - - name - Type name - scope - entity.name.type - settings - - fontStyle - underline - - - - name - Inherited class name - scope - entity.other.inherited-class - settings - - fontStyle - italic - - - - name - Function parameter - scope - variable.parameter - settings - - fontStyle - italic - - - - name - Function argument and result types - scope - storage.type.method - settings - - fontStyle - - foreground - #8B8E9C - - - - name - Section - scope - meta.section entity.name.section, declaration.section entity.name.section - settings - - fontStyle - italic - - - - name - Library function - scope - support.function - settings - - fontStyle - bold - foreground - #7290D9 - - - - name - Library object - scope - support.class, support.type - settings - - fontStyle - bold - foreground - #6D79DE - - - - name - Library constant - scope - support.constant - settings - - fontStyle - bold - foreground - #00AF0E - - - - name - Library variable - scope - support.variable - settings - - fontStyle - bold - foreground - #2F5FE0 - - - - name - JS: Operator - scope - keyword.operator.js - settings - - foreground - #687687 - - - - name - Invalid - scope - invalid - settings - - background - #990000 - foreground - #FFFFFF - - - - name - Invalid trailing whitespace - scope - invalid.deprecated.trailing-whitespace - settings - - background - #FFD0D0 - - - - name - Embedded source - scope - text source, string.unquoted - settings - - background - #F5AA7730 - - - - name - Markup XML declaration - scope - meta.tag.preprocessor.xml - settings - - fontStyle - - foreground - #8F7E65 - - - - name - Markup DOCTYPE - scope - meta.tag.sgml.doctype - settings - - fontStyle - - foreground - #888888 - - - - name - Markup DTD - scope - string.quoted.docinfo.doctype.DTD - settings - - fontStyle - italic - - - - name - Markup tag - scope - meta.tag, declaration.tag - settings - - fontStyle - - foreground - #43A8ED - - - - name - Markup name of tag - scope - entity.name.tag - settings - - fontStyle - bold - - - - name - Markup tag attribute - scope - entity.other.attribute-name - settings - - fontStyle - italic - - - - uuid - 6B90703E-4E4B-43C8-9D32-921BEDF6D725 - - diff --git a/themes/IDLE.tmTheme b/themes/IDLE.tmTheme deleted file mode 100644 index 704296f5c..000000000 --- a/themes/IDLE.tmTheme +++ /dev/null @@ -1,235 +0,0 @@ - - - - - author - Domenico Carbotta - name - IDLE - settings - - - settings - - background - #FFFFFF - caret - #000000 - foreground - #000000 - invisibles - #BFBFBF - lineHighlight - #00000012 - selection - #BAD6FD - - - - name - Comment - scope - comment - settings - - foreground - #919191 - - - - name - String - scope - string - settings - - foreground - #00A33F - - - - name - Number - scope - constant.numeric - settings - - - - name - Built-in constant - scope - constant.language - settings - - foreground - #A535AE - - - - name - User-defined constant - scope - constant.character, constant.other - settings - - - - name - Variable - scope - variable.language, variable.other - settings - - - - name - Keyword - scope - keyword - settings - - foreground - #FF5600 - - - - name - Storage - scope - storage - settings - - foreground - #FF5600 - - - - name - Type name - scope - entity.name.type - settings - - foreground - #21439C - - - - name - Inherited class - scope - entity.other.inherited-class - settings - - - - name - Function name - scope - entity.name.function - settings - - foreground - #21439C - - - - name - Function argument - scope - variable.parameter - settings - - - - name - Tag name - scope - entity.name.tag - settings - - - - name - Tag attribute - scope - entity.other.attribute-name - settings - - - - name - Library function - scope - support.function - settings - - foreground - #A535AE - - - - name - Library constant - scope - support.constant - settings - - foreground - #A535AE - - - - name - Library class/type - scope - support.type, support.class - settings - - foreground - #A535AE - - - - name - Library variable - scope - support.variable - settings - - foreground - #A535AE - - - - name - Invalid - scope - invalid - settings - - background - #990000 - foreground - #FFFFFF - - - - name - String interpolation - scope - constant.other.placeholder.py - settings - - fontStyle - - foreground - #990000 - - - - uuid - DDC0CBE1-442B-4CB5-80E4-26E4CFB3A277 - - diff --git a/themes/IR_Black.tmTheme b/themes/IR_Black.tmTheme deleted file mode 100644 index cbc18d0b9..000000000 --- a/themes/IR_Black.tmTheme +++ /dev/null @@ -1,810 +0,0 @@ - - - - - name - IR_Black - settings - - - settings - - background - #000000 - caret - #FFFFFF - foreground - #EDEDED - invisibles - #CAE2FB3D - lineHighlight - #FFFFFF24 - selection - #333333 - - - - name - Comment - scope - comment - settings - - fontStyle - - foreground - #7C7C7C - - - - name - Entity - scope - entity - settings - - fontStyle - - foreground - #FFD2A7 - - - - name - Keyword - scope - keyword - settings - - fontStyle - - foreground - #96CBFE - - - - name - Keyword.control - scope - keyword.control - settings - - fontStyle - - foreground - #96CBFE - - - - name - Keyword.Operator - scope - keyword.operator - settings - - foreground - #EDEDED - - - - name - Class - scope - entity.name.type - settings - - fontStyle - underline - foreground - #FFFFB6 - - - - name - Support - scope - support - settings - - fontStyle - - foreground - #FFFFB6 - - - - name - Storage - scope - storage - settings - - fontStyle - - foreground - #CFCB90 - - - - name - Storage.modifier - scope - storage.modifier - settings - - fontStyle - - foreground - #96CBFE - - - - name - Constant - scope - constant - settings - - fontStyle - - foreground - #99CC99 - - - - name - String - scope - string - settings - - fontStyle - bold - foreground - #A8FF60 - - - - name - Number - scope - constant.numeric - settings - - fontStyle - bold - foreground - #FF73FD - - - - name - Punctuation - scope - punctuation - settings - - fontStyle - - - - - name - Variable - scope - variable - settings - - fontStyle - - foreground - #C6C5FE - - - - name - Invalid – Deprecated - scope - invalid.deprecated - settings - - fontStyle - italic underline - foreground - #FD5FF1 - - - - name - Invalid – Illegal - scope - invalid.illegal - settings - - background - #562D56BF - foreground - #FD5FF1 - - - - name - ----------------------------------- - settings - - - - name - ♦ Embedded Source (Bright) - scope - text source - settings - - background - #B1B3BA08 - fontStyle - - - - - name - ♦ Entity inherited-class - scope - entity.other.inherited-class - settings - - fontStyle - italic - foreground - #9B5C2E - - - - name - ♦ String embedded-variable - scope - source string source - settings - - fontStyle - - foreground - #EDEDED - - - - name - ♦ String punctuation - scope - source string source punctuation.section.embedded - settings - - fontStyle - - foreground - #00A0A0 - - - - name - ♦ String constant - scope - string constant - settings - - fontStyle - - foreground - #00A0A0 - - - - name - ♦ String.regexp - scope - string.regexp - settings - - foreground - #E9C062 - - - - name - ♦ String.regexp.«special» - scope - string.regexp constant.character.escape, string.regexp source.ruby.embedded, string.regexp string.regexp.arbitrary-repitition - settings - - fontStyle - - foreground - #FF8000 - - - - name - ♦ String.regexp.group - scope - string.regexp.group - settings - - background - #FFFFFF0F - fontStyle - - foreground - #C6A24F - - - - name - ♦ String.regexp.character-class - scope - string.regexp.character-class - settings - - fontStyle - - foreground - #B18A3D - - - - name - ♦ String variable - scope - string variable - settings - - fontStyle - - foreground - #8A9A95 - - - - name - ♦ Support.function - scope - support.function - settings - - fontStyle - - foreground - #DAD085 - - - - name - ♦ Support.constant - scope - support.constant - settings - - fontStyle - - foreground - #FFD2A7 - - - - name - c C/C++ Preprocessor Line - scope - meta.preprocessor.c - settings - - foreground - #8996A8 - - - - name - c C/C++ Preprocessor Directive - scope - meta.preprocessor.c keyword - settings - - fontStyle - - foreground - #AFC4DB - - - - name - j Cast - scope - meta.cast - settings - - fontStyle - italic - foreground - #676767 - - - - name - ✘ Doctype/XML Processing - scope - meta.sgml.html meta.doctype, meta.sgml.html meta.doctype entity, meta.sgml.html meta.doctype string, meta.xml-processing, meta.xml-processing entity, meta.xml-processing string - settings - - foreground - #494949 - - - - name - ✘ Meta.tag.«all» - scope - meta.tag, meta.tag entity - settings - - fontStyle - bold - foreground - #96CBFE - - - - name - ✘ Meta.tag.inline - scope - source entity.name.tag, source entity.other.attribute-name, meta.tag.inline, meta.tag.inline entity - settings - - fontStyle - - foreground - #96CBFE - - - - name - ✘ Meta.tag.attribute-name - scope - entity.other.attribute-name - settings - - fontStyle - - foreground - #FFD7B1 - - - - name - ✘ Namespaces - scope - entity.name.tag.namespace, entity.other.attribute-name.namespace - settings - - fontStyle - - foreground - #E18964 - - - - name - § css tag-name - scope - meta.selector.css entity.name.tag - settings - - fontStyle - underline - foreground - #96CBFE - - - - name - § css:pseudo-class - scope - meta.selector.css entity.other.attribute-name.tag.pseudo-class - settings - - fontStyle - - foreground - #8F9D6A - - - - name - § css#id - scope - meta.selector.css entity.other.attribute-name.id - settings - - fontStyle - - foreground - #8B98AB - - - - name - § css.class - scope - meta.selector.css entity.other.attribute-name.class - settings - - fontStyle - - foreground - #62B1FE - - - - name - § css property-name: - scope - support.type.property-name.css - settings - - foreground - #EDEDED - - - - name - § css property-value; - scope - meta.property-group support.constant.property-value.css, meta.property-value support.constant.property-value.css - settings - - fontStyle - - foreground - #F9EE98 - - - - name - § css @at-rule - scope - meta.preprocessor.at-rule keyword.control.at-rule - settings - - foreground - #8693A5 - - - - name - § css additional-constants - scope - meta.property-value support.constant.named-color.css, meta.property-value constant - settings - - fontStyle - - foreground - #87C38A - - - - name - § css constructor.argument - scope - meta.constructor.argument.css - settings - - foreground - #8F9D6A - - - - name - ⎇ diff.header - scope - meta.diff, meta.diff.header - settings - - background - #0E2231 - fontStyle - italic - foreground - #F8F8F8 - - - - name - ⎇ diff.deleted - scope - markup.deleted - settings - - background - #420E09 - foreground - #F8F8F8 - - - - name - ⎇ diff.changed - scope - markup.changed - settings - - background - #4A410D - foreground - #F8F8F8 - - - - name - ⎇ diff.inserted - scope - markup.inserted - settings - - background - #253B22 - foreground - #F8F8F8 - - - - name - -------------------------------- - settings - - - - name - Markup: Italic - scope - markup.italic - settings - - fontStyle - italic - foreground - #E9C062 - - - - name - Markup: Bold - scope - markup.bold - settings - - fontStyle - bold - foreground - #E9C062 - - - - name - Markup: Underline - scope - markup.underline - settings - - fontStyle - underline - foreground - #E18964 - - - - name - Markup: Quote - scope - markup.quote - settings - - background - #FEE09C12 - fontStyle - italic - foreground - #E1D4B9 - - - - name - Markup: Heading - scope - markup.heading, markup.heading entity - settings - - background - #632D04 - fontStyle - - foreground - #FEDCC5 - - - - name - Markup: List - scope - markup.list - settings - - foreground - #E1D4B9 - - - - name - Markup: Raw - scope - markup.raw - settings - - background - #B1B3BA08 - fontStyle - - foreground - #578BB3 - - - - name - Markup: Comment - scope - markup comment - settings - - fontStyle - italic - foreground - #F67B37 - - - - name - Markup: Separator - scope - meta.separator - settings - - background - #242424 - foreground - #60A633 - - - - name - Log Entry - scope - meta.line.entry.logfile, meta.line.exit.logfile - settings - - background - #EEEEEE29 - - - - name - Log Entry Error - scope - meta.line.error.logfile - settings - - background - #751012 - - - - uuid - D039AEA9-9DD2-4237-A963-E84494B0B3FB - - diff --git a/themes/LAZY.tmTheme b/themes/LAZY.tmTheme deleted file mode 100644 index 09ff51116..000000000 --- a/themes/LAZY.tmTheme +++ /dev/null @@ -1,291 +0,0 @@ - - - - - author - Domenico Carbotta - name - LAZY - settings - - - settings - - background - #FFFFFF - caret - #7C7C7C - foreground - #000000 - invisibles - #B6B6B6 - lineHighlight - #EFFCA68F - selection - #E3FC8D - - - - name - Comment - scope - comment - settings - - fontStyle - - foreground - #8C868F - - - - name - Constant - scope - constant - settings - - fontStyle - - foreground - #3B5BB5 - - - - name - Entity - scope - entity - settings - - fontStyle - - foreground - #3B5BB5 - - - - name - Latex Entity - scope - text.tex.latex entity - settings - - fontStyle - - foreground - #D62A28 - - - - name - Keyword - scope - keyword, storage - settings - - fontStyle - - foreground - #FF7800 - - - - name - String - scope - string, meta.verbatim - settings - - fontStyle - - foreground - #409B1C - - - - name - Support - scope - support - settings - - fontStyle - - foreground - #3B5BB5 - - - - name - Variable - scope - variable - settings - - fontStyle - - - - - name - Invalid – Deprecated - scope - invalid.deprecated - settings - - fontStyle - italic - foreground - #990000 - - - - name - Invalid – Illegal - scope - invalid.illegal - settings - - background - #9D1E15 - foreground - #F8F8F8 - - - - name - Superclass - scope - entity.other.inherited-class - settings - - fontStyle - italic - foreground - #3B5BB5 - - - - name - String interpolation - scope - string constant.other.placeholder - settings - - fontStyle - - foreground - #671EBB - - - - name - meta.function-call.py - scope - meta.function-call.py - settings - - fontStyle - - foreground - #3E4558 - - - - name - meta.tag - scope - meta.tag, meta.tag entity - settings - - foreground - #3A4A64 - - - - name - OCaml variant - scope - keyword.type.variant - settings - - fontStyle - - foreground - #7F90AA - - - - name - OCaml operator - scope - source.ocaml keyword.operator - settings - - foreground - #000000 - - - - name - OCaml infix operator - scope - source.ocaml keyword.operator.symbol.infix - settings - - fontStyle - - foreground - #3B5BB5 - - - - name - OCaml prefix operator - scope - source.ocaml keyword.operator.symbol.prefix - settings - - foreground - #3B5BB5 - - - - name - OCaml infix f-p operator - scope - source.ocaml keyword.operator.symbol.infix.floating-point - settings - - fontStyle - underline - - - - name - OCaml prefix f-p operator - scope - source.ocaml keyword.operator.symbol.prefix.floating-point - settings - - fontStyle - underline - - - - name - OCaml f-p constant - scope - source.ocaml constant.numeric.floating-point - settings - - fontStyle - underline - - - - uuid - A1E55FCB-3CD2-4811-9E73-D9B87419443A - - diff --git a/themes/Mac Classic.tmTheme b/themes/Mac Classic.tmTheme deleted file mode 100644 index 4b789dfea..000000000 --- a/themes/Mac Classic.tmTheme +++ /dev/null @@ -1,450 +0,0 @@ - - - - - author - Chris Thomas - name - Mac Classic - settings - - - settings - - background - #FFFFFF - caret - #000000 - foreground - #000000 - invisibles - #BFBFBF - lineHighlight - #00000012 - selection - #4D97FF54 - - - - name - Comment - scope - comment - settings - - fontStyle - italic - foreground - #0066FF - - - - name - Keyword - scope - keyword, storage - settings - - fontStyle - bold - foreground - #0000FF - - - - name - Number - scope - constant.numeric - settings - - fontStyle - - foreground - #0000CD - - - - name - User-defined constant - scope - constant - settings - - fontStyle - bold - foreground - #C5060B - - - - name - Built-in constant - scope - constant.language - settings - - fontStyle - bold - foreground - #585CF6 - - - - name - Variable - scope - variable.language, variable.other - settings - - fontStyle - - foreground - #318495 - - - - name - String - scope - string - settings - - fontStyle - - foreground - #036A07 - - - - name - String interpolation - scope - constant.character.escape, string source - settings - - fontStyle - - foreground - #26B31A - - - - name - Preprocessor line - scope - meta.preprocessor - settings - - fontStyle - - foreground - #1A921C - - - - name - Preprocessor directive - scope - keyword.control.import - settings - - fontStyle - bold - foreground - #0C450D - - - - name - Function name - scope - entity.name.function, support.function.any-method - settings - - fontStyle - bold - foreground - #0000A2 - - - - name - Type name - scope - entity.name.type - settings - - fontStyle - underline - - - - name - Inherited class name - scope - entity.other.inherited-class - settings - - fontStyle - italic - - - - name - Function parameter - scope - variable.parameter - settings - - fontStyle - italic - - - - name - Function argument and result types - scope - storage.type.method - settings - - fontStyle - - foreground - #70727E - - - - name - Section - scope - meta.section entity.name.section, declaration.section entity.name.section - settings - - fontStyle - italic - - - - name - Library function - scope - support.function - settings - - fontStyle - bold - foreground - #3C4C72 - - - - name - Library object - scope - support.class, support.type - settings - - fontStyle - bold - foreground - #6D79DE - - - - name - Library constant - scope - support.constant - settings - - fontStyle - bold - foreground - #06960E - - - - name - Library variable - scope - support.variable - settings - - fontStyle - bold - foreground - #21439C - - - - name - JS: Operator - scope - keyword.operator.js - settings - - foreground - #687687 - - - - name - Invalid - scope - invalid - settings - - background - #990000 - foreground - #FFFFFF - - - - name - Invalid trailing whitespace - scope - invalid.deprecated.trailing-whitespace - settings - - background - #FFD0D0 - - - - name - Embedded source - scope - text source, string.unquoted - settings - - background - #0000000D - - - - name - Embedded embedded source - scope - text source string.unquoted, text source text source - settings - - background - #0000000F - - - - name - Markup XML declaration - scope - meta.tag.preprocessor.xml - settings - - fontStyle - - foreground - #68685B - - - - name - Markup DOCTYPE - scope - meta.tag.sgml.doctype, meta.tag.sgml.doctype entity, meta.tag.sgml.doctype string, meta.tag.preprocessor.xml, meta.tag.preprocessor.xml entity, meta.tag.preprocessor.xml string - settings - - fontStyle - - foreground - #888888 - - - - name - Markup DTD - scope - string.quoted.docinfo.doctype.DTD - settings - - fontStyle - italic - - - - name - Markup tag - scope - meta.tag, declaration.tag - settings - - fontStyle - - foreground - #1C02FF - - - - name - Markup name of tag - scope - entity.name.tag - settings - - fontStyle - bold - - - - name - Markup tag attribute - scope - entity.other.attribute-name - settings - - fontStyle - italic - - - - name - Markup: Heading - scope - markup.heading - settings - - fontStyle - bold - foreground - #0C07FF - - - - name - Markup: Quote - scope - markup.quote - settings - - fontStyle - italic - foreground - #000000 - - - - name - Markup: List - scope - markup.list - settings - - foreground - #B90690 - - - - uuid - 71D40D9D-AE48-11D9-920A-000D93589AF6 - - diff --git a/themes/MagicWB (Amiga).tmTheme b/themes/MagicWB (Amiga).tmTheme deleted file mode 100644 index 7897886b1..000000000 --- a/themes/MagicWB (Amiga).tmTheme +++ /dev/null @@ -1,376 +0,0 @@ - - - - - author - Allan Odgaard - comment - Inspired by the original 8 MagicWB colors from Martin Huttenloher - name - MagicWB (Amiga) - settings - - - settings - - background - #969696 - caret - #FFFFFF - foreground - #000000 - invisibles - #FF38FF - lineHighlight - #00000012 - selection - #B1B1B1 - - - - name - Comment - scope - comment - settings - - fontStyle - italic - foreground - #8D2E75 - - - - name - String - scope - string - settings - - background - #FF000033 - fontStyle - - foreground - #FFFFFF - - - - name - Number - scope - constant.numeric - settings - - foreground - #FFFFFF - - - - name - Constant: Built-in - scope - constant.language - settings - - fontStyle - bold - foreground - #FFA995 - - - - name - Constant: User-defined - scope - constant.character, constant.other - settings - - background - #0000FF33 - fontStyle - - foreground - #FFA995 - - - - name - Variable - scope - variable.language, variable.other - settings - - foreground - #FFA995 - - - - name - Keyword - scope - keyword - settings - - fontStyle - bold - - - - name - Storage - scope - storage - settings - - fontStyle - bold - foreground - #3A68A3 - - - - name - Type Name - scope - entity.name.type - settings - - fontStyle - underline - - - - name - Inherited Class - scope - entity.other.inherited-class - settings - - fontStyle - italic - - - - name - Function Name - scope - entity.name.function - settings - - fontStyle - - foreground - #FFA995 - - - - name - Function Argument - scope - variable.parameter - settings - - fontStyle - italic - - - - name - Entity Name - scope - entity.name - settings - - fontStyle - bold - foreground - #0000FF - - - - name - Tag Attribute - scope - entity.other.attribute-name - settings - - fontStyle - italic - foreground - #3A68A3 - - - - name - Library Function - scope - support.function - settings - - foreground - #E5B3FF - - - - name - Objective-C Method Call - scope - support.function.any-method - settings - - fontStyle - - foreground - #000000 - - - - name - Objective-C Method Call - : - scope - support.function.any-method - punctuation - settings - - fontStyle - italic - - - - name - Library Constant - scope - support.constant - settings - - foreground - #FFFFFF - - - - name - Library Class/Type - scope - support.type, support.class - settings - - foreground - #FFA995 - - - - name - Library Variable - scope - support.variable - settings - - foreground - #3A68A3 - - - - name - Invalid - scope - invalid - settings - - background - #797979 - foreground - #FFFFFF - - - - name - Include <system> - scope - string.quoted.other.lt-gt.include - settings - - background - #969696 - fontStyle - italic - foreground - #FFA995 - - - - name - Include "user" - scope - string.quoted.double.include - settings - - background - #969696 - foreground - #FFA995 - - - - name - Markup: List Item - scope - markup.list - settings - - foreground - #4D4E60 - - - - name - Markup: Raw - scope - markup.raw - settings - - background - #0000FF - foreground - #FFFFFF - - - - name - Markup: Quote (Email) - scope - markup.quote - settings - - foreground - #00F0C9 - - - - name - Markup: Quote Double (Email) - scope - markup.quote markup.quote - settings - - fontStyle - - foreground - #4C457E - - - - name - Embedded Source - scope - text.html source - settings - - background - #8A9ECB - - - - uuid - B0A18BAA-6220-481C-9914-F6D3E51B5410 - - diff --git a/themes/Pastels on Dark.tmTheme b/themes/Pastels on Dark.tmTheme deleted file mode 100644 index e3928606e..000000000 --- a/themes/Pastels on Dark.tmTheme +++ /dev/null @@ -1,701 +0,0 @@ - - - - - author - Mats Persson - name - Pastels on Dark - settings - - - settings - - background - #211E1E - caret - #FFFFFF - foreground - #DADADA - invisibles - #4F4D4D - lineHighlight - #353030 - selection - #73597E80 - - - - name - Comments - scope - comment - settings - - fontStyle - - foreground - #555555 - - - - name - Comments Block - scope - comment.block - settings - - fontStyle - - foreground - #555555 - - - - name - Strings - scope - string - settings - - foreground - #AD9361 - - - - name - Numbers - scope - constant.numeric - settings - - fontStyle - - foreground - #CCCCCC - - - - name - Keywords - scope - keyword - settings - - fontStyle - - foreground - #A1A1FF - - - - name - Preprocessor Line - scope - meta.preprocessor - settings - - fontStyle - - foreground - #2F006E - - - - name - Preprocessor Directive - scope - keyword.control.import - settings - - fontStyle - bold - - - - name - Functions - scope - support.function - settings - - fontStyle - - foreground - #A1A1FF - - - - name - Function result - scope - declaration.function function-result - settings - - foreground - #0000FF - - - - name - Function name - scope - declaration.function function-name - settings - - fontStyle - bold - - - - name - Function argument name - scope - declaration.function argument-name - settings - - fontStyle - bold - - - - name - Function argument type - scope - declaration.function function-arg-type - settings - - foreground - #0000FF - - - - name - Function argument variable - scope - declaration.function function-argument - settings - - fontStyle - italic - - - - name - Class name - scope - declaration.class class-name - settings - - fontStyle - underline - - - - name - Class inheritance - scope - declaration.class class-inheritance - settings - - fontStyle - italic underline - - - - name - Invalid - scope - invalid - settings - - background - #FF0000 - fontStyle - bold - foreground - #FFF9F9 - - - - name - Invalid Trailing Whitespace - scope - invalid.deprecated.trailing-whitespace - settings - - background - #FFD0D0 - - - - name - Section - scope - declaration.section section-name - settings - - fontStyle - italic - - - - name - Interpolation - scope - string.interpolation - settings - - foreground - #C10006 - - - - name - Regular Expressions - scope - string.regexp - settings - - fontStyle - - foreground - #666666 - - - - name - Variables - scope - variable - settings - - foreground - #C1C144 - - - - name - Constants - scope - constant - settings - - foreground - #6782D3 - - - - name - Character Constants - scope - constant.character - settings - - fontStyle - - foreground - #AFA472 - - - - name - Language Constants - scope - constant.language - settings - - fontStyle - bold - foreground - #DE8E30 - - - - name - Embedded Code - scope - embedded - settings - - fontStyle - underline - - - - name - Tag name - scope - keyword.markup.element-name - settings - - fontStyle - - foreground - #858EF4 - - - - name - Attribute name - scope - keyword.markup.attribute-name - settings - - fontStyle - - foreground - #9B456F - - - - name - Attribute with Value - scope - meta.attribute-with-value - settings - - fontStyle - - foreground - #9B456F - - - - name - Exceptions - scope - keyword.exception - settings - - fontStyle - bold - foreground - #C82255 - - - - name - Operators - scope - keyword.operator - settings - - fontStyle - - foreground - #47B8D6 - - - - name - Control Structures - scope - keyword.control - settings - - fontStyle - bold - foreground - #6969FA - - - - name - HTML: DocInfo XML - scope - meta.tag.preprocessor.xml - settings - - foreground - #68685B - - - - name - HTML: DocType - scope - meta.tag.sgml.doctype - settings - - foreground - #888888 - - - - name - HTML: DocInfo DTD - scope - string.quoted.docinfo.doctype.DTD - settings - - fontStyle - italic - - - - name - HTML: ServerSide Includes - scope - comment.other.server-side-include.xhtml, comment.other.server-side-include.html - settings - - foreground - #909090 - - - - name - HTML: Tag - scope - text.html declaration.tag, text.html meta.tag, text.html entity.name.tag.xhtml - settings - - foreground - #858EF4 - - - - name - HTML: attribute="" - scope - keyword.markup.attribute-name - settings - - foreground - #9B456F - - - - name - PHP: PHPdocs - scope - keyword.other.phpdoc.php - settings - - foreground - #777777 - - - - name - PHP: Include() & Require() - scope - keyword.other.include.php - settings - - foreground - #C82255 - - - - name - PHP: Constants Core Predefined - scope - support.constant.core.php - settings - - fontStyle - bold - foreground - #DE8E20 - - - - name - PHP: Constants Standard Predefined - scope - support.constant.std.php - settings - - fontStyle - bold - foreground - #DE8E10 - - - - name - PHP: Variables Globals - scope - variable.other.global.php - settings - - foreground - #B72E1D - - - - name - PHP: Variables Safer Globals - scope - variable.other.global.safer.php - settings - - foreground - #00FF00 - - - - name - PHP: Strings Single-Quoted - scope - string.quoted.single.php - settings - - foreground - #BFA36D - - - - name - PHP: Keywords Storage - scope - keyword.storage.php - settings - - foreground - #6969FA - - - - name - PHP: Strings Double-Quoted - scope - string.quoted.double.php - settings - - foreground - #AD9361 - - - - name - CSS: Selectors #ID - scope - entity.other.attribute-name.id.css - settings - - foreground - #EC9E00 - - - - name - CSS: Selectors <Elements> - scope - entity.name.tag.css - settings - - fontStyle - bold - foreground - #B8CD06 - - - - name - CSS: Selectors .ClassName - scope - entity.other.attribute-name.class.css - settings - - foreground - #EDCA06 - - - - name - CSS: Selectors :PseudoClass - scope - entity.other.attribute-name.pseudo-class.css - settings - - foreground - #2E759C - - - - name - CSS: Invalid Comma - scope - invalid.bad-comma.css - settings - - background - #FF0000 - foreground - #FFFFFF - - - - name - CSS: Property Value - scope - support.constant.property-value.css - settings - - foreground - #9B2E4D - - - - name - CSS: Property Keyword - scope - support.type.property-name.css - settings - - foreground - #E1C96B - - - - name - CSS: Property Colours - scope - constant.other.rgb-value.css - settings - - foreground - #666633 - - - - name - CSS: Font Names - scope - support.constant.font-name.css - settings - - foreground - #666633 - - - - name - TMLangDef: Keys - scope - support.constant.tm-language-def, support.constant.name.tm-language-def - settings - - foreground - #7171F3 - - - - name - CSS: Units - scope - keyword.other.unit.css - settings - - foreground - #6969FA - - - - uuid - 343011CC-B7DF-11D9-B5C6-000D93C8BE28 - - diff --git a/themes/Slush & Poppies.tmTheme b/themes/Slush & Poppies.tmTheme deleted file mode 100644 index 02ecbcbe2..000000000 --- a/themes/Slush & Poppies.tmTheme +++ /dev/null @@ -1,336 +0,0 @@ - - - - - author - William D. Neumann - name - Slush & Poppies - settings - - - settings - - background - #F1F1F1 - caret - #000000 - foreground - #000000 - invisibles - #BFBFBF - lineHighlight - #00000026 - selection - #B0B0FF - - - - name - Comment - scope - comment - settings - - fontStyle - - foreground - #406040 - - - - name - String - scope - string - settings - - foreground - #C03030 - - - - name - Number - scope - constant.numeric - settings - - foreground - #0080A0 - - - - name - OCaml floating-point constants - scope - source.ocaml constant.numeric.floating-point - settings - - fontStyle - underline - - - - name - Character constants - scope - constant.character - settings - - foreground - #800000 - - - - name - Built-in constant - scope - constant.language - settings - - - - name - User-defined constant - scope - constant.character, constant.other - settings - - - - name - Variable - scope - variable.parameter, variable.other - settings - - - - name - Keyword - scope - keyword - settings - - fontStyle - - foreground - #2060A0 - - - - name - Operators - scope - keyword.operator - settings - - fontStyle - - foreground - #2060A0 - - - - name - OCaml prefix f-p operators - scope - source.ocaml keyword.operator.symbol.prefix.floating-point - settings - - fontStyle - underline - - - - name - OCaml infix f-p operators - scope - source.ocaml keyword.operator.symbol.infix.floating-point - settings - - fontStyle - underline - - - - name - Module Keyword - scope - entity.name.module, support.other.module - settings - - fontStyle - - foreground - #0080FF - - - - name - Storage types - scope - storage.type - settings - - foreground - #A08000 - - - - name - Storage - scope - storage - settings - - foreground - #008080 - - - - name - Variant types - scope - entity.name.class.variant - settings - - foreground - #C08060 - - - - name - Directives - scope - keyword.other.directive - settings - - fontStyle - bold - - - - name - Line-number directives - scope - source.ocaml keyword.other.directive.line-number - settings - - fontStyle - - - - - name - Inherited class - scope - entity.other.inherited-class - settings - - - - name - Function name - scope - entity.name.function - settings - - fontStyle - - foreground - #800000 - - - - name - Type name - scope - storage.type.user-defined - settings - - foreground - #800080 - - - - name - Class type name - scope - entity.name.type.class.type - settings - - foreground - #8000C0 - - - - name - Function argument - scope - variable.parameter - settings - - - - name - Tag name - scope - entity.name.tag - settings - - - - name - Tag attribute - scope - entity.other.attribute-name - settings - - - - name - Library function - scope - support.function - settings - - - - name - Library constant - scope - support.constant - settings - - - - name - Library class/type - scope - support.type, support.class - settings - - - - name - Library variable - scope - support.variable - settings - - - - name - Invalid - scope - invalid - settings - - - - uuid - D68685B8-1CFE-4C10-99C4-E21CBC892376 - - diff --git a/themes/Solarized (dark).tmTheme b/themes/Solarized (dark).tmTheme deleted file mode 100644 index 3a280b185..000000000 --- a/themes/Solarized (dark).tmTheme +++ /dev/null @@ -1,2051 +0,0 @@ - - - - - name - Solarized (dark) - settings - - - settings - - background - #002B36 - caret - #819090 - foreground - #839496 - invisibles - #073642 - lineHighlight - #073642 - selection - #073642 - - - - name - Comment - scope - comment - settings - - fontStyle - - foreground - #586E75 - - - - name - String - scope - string - settings - - foreground - #2AA198 - - - - name - StringNumber - scope - string - settings - - foreground - #586E75 - - - - name - Regexp - scope - string.regexp - settings - - foreground - #D30102 - - - - name - Number - scope - constant.numeric - settings - - foreground - #D33682 - - - - name - Variable - scope - variable.language, variable.other - settings - - foreground - #268BD2 - - - - name - Keyword - scope - keyword - settings - - foreground - #859900 - - - - name - Storage - scope - storage - settings - - fontStyle - - foreground - #738A05 - - - - name - Class name - scope - entity.name.class, entity.name.type.class - settings - - foreground - #268BD2 - - - - name - Function name - scope - entity.name.function - settings - - foreground - #268BD2 - - - - name - Variable start - scope - punctuation.definition.variable - settings - - foreground - #859900 - - - - name - Embedded code markers - scope - punctuation.section.embedded.begin, punctuation.section.embedded.end - settings - - foreground - #D30102 - - - - name - Built-in constant - scope - constant.language, meta.preprocessor - settings - - foreground - #B58900 - - - - name - Support.construct - scope - support.function.construct, keyword.other.new - settings - - foreground - #D30102 - - - - name - User-defined constant - scope - constant.character, constant.other - settings - - foreground - #CB4B16 - - - - name - Inherited class - scope - entity.other.inherited-class - settings - - - - name - Function argument - scope - variable.parameter - settings - - - - name - Tag name - scope - entity.name.tag - settings - - fontStyle - bold - foreground - #268BD2 - - - - name - Tag start/end - scope - punctuation.definition.tag.html, punctuation.definition.tag.begin, punctuation.definition.tag.end - settings - - foreground - #586E75 - - - - name - Tag attribute - scope - entity.other.attribute-name - settings - - foreground - #93A1A1 - - - - name - Library function - scope - support.function - settings - - foreground - #268BD2 - - - - name - Continuation - scope - punctuation.separator.continuation - settings - - foreground - #D30102 - - - - name - Library constant - scope - support.constant - settings - - - - name - Library class/type - scope - support.type, support.class - settings - - foreground - #859900 - - - - name - Library Exception - scope - support.type.exception - settings - - foreground - #CB4B16 - - - - name - Special - scope - keyword.other.special-method - settings - - foreground - #CB4B16 - - - - name - Library variable - scope - support.other.variable - settings - - - - name - Invalid - scope - invalid - settings - - - - name - Quoted String - scope - string.quoted.double, string.quoted.single - settings - - foreground - #269186 - - - - name - Quotes - scope - punctuation.definition.string.begin, punctuation.definition.string.end - settings - - foreground - #C60000 - - - - name - CSS: Property - scope - entity.name.tag.css, support.type.property-name.css, meta.property-name.css - settings - - fontStyle - - foreground - #A57800 - - - - name - CSS: @font-face - scope - source.css - settings - - foreground - #D01F1E - - - - name - CSS: Selector - scope - meta.selector.css - settings - - fontStyle - - foreground - #536871 - - - - name - CSS: {} - scope - punctuation.section.property-list.css - settings - - foreground - #5A74CF - - - - name - CSS: Numeric Value - scope - meta.property-value.css constant.numeric.css, keyword.other.unit.css,constant.other.color.rgb-value.css - settings - - fontStyle - - foreground - #269186 - - - - name - CSS: Value - scope - meta.property-value.css - settings - - fontStyle - - foreground - #269186 - - - - name - CSS: !Important - scope - keyword.other.important.css - settings - - foreground - #D01F1E - - - - name - CSS: Standard Value - scope - support.constant.color - settings - - foreground - #269186 - - - - name - CSS: Tag - scope - entity.name.tag.css - settings - - foreground - #738A13 - - - - name - CSS: : , - scope - punctuation.separator.key-value.css, punctuation.terminator.rule.css - settings - - fontStyle - - foreground - #536871 - - - - name - CSS .class - scope - entity.other.attribute-name.class.css - settings - - fontStyle - - foreground - #268BD2 - - - - name - CSS :pseudo - scope - entity.other.attribute-name.pseudo-element.css, entity.other.attribute-name.pseudo-class.css - settings - - fontStyle - - foreground - #BD3800 - - - - name - CSS: #id - scope - entity.other.attribute-name.id.css - settings - - fontStyle - - foreground - #268BD2 - - - - name - JS: Function Name - scope - meta.function.js, entity.name.function.js, support.function.dom.js - settings - - foreground - #A57800 - - - - name - JS: Source - scope - text.html.basic source.js.embedded.html - settings - - fontStyle - - foreground - #A57800 - - - - name - JS: Function - scope - storage.type.function.js - settings - - foreground - #268BD2 - - - - name - JS: Numeric Constant - scope - constant.numeric.js - settings - - foreground - #269186 - - - - name - JS: [] - scope - meta.brace.square.js - settings - - foreground - #268BD2 - - - - name - JS: Storage Type - scope - storage.type.js - settings - - foreground - #268BD2 - - - - name - () - scope - meta.brace.round, punctuation.definition.parameters.begin.js, punctuation.definition.parameters.end.js - settings - - foreground - #93A1A1 - - - - name - {} - scope - meta.brace.curly.js - settings - - foreground - #268BD2 - - - - name - HTML: Doctype - scope - entity.name.tag.doctype.html, meta.tag.sgml.html, string.quoted.double.doctype.identifiers-and-DTDs.html - settings - - fontStyle - italic - foreground - #899090 - - - - name - HTML: Comment Block - scope - comment.block.html - settings - - fontStyle - italic - foreground - #839496 - - - - name - HTML: Script - scope - entity.name.tag.script.html - settings - - fontStyle - italic - - - - name - HTML: Style - scope - source.css.embedded.html string.quoted.double.html - settings - - fontStyle - - foreground - #269186 - - - - name - HTML: Text - scope - text.html.ruby - settings - - fontStyle - bold - foreground - #BD3800 - - - - name - HTML: = - scope - text.html.basic meta.tag.other.html, text.html.basic meta.tag.any.html, text.html.basic meta.tag.block.any, text.html.basic meta.tag.inline.any, text.html.basic meta.tag.structure.any.html, text.html.basic source.js.embedded.html, punctuation.separator.key-value.html - settings - - fontStyle - - foreground - #708284 - - - - name - HTML: something= - scope - text.html.basic entity.other.attribute-name.html - settings - - foreground - #708284 - - - - name - HTML: " - scope - text.html.basic meta.tag.structure.any.html punctuation.definition.string.begin.html, punctuation.definition.string.begin.html, punctuation.definition.string.end.html - settings - - fontStyle - - foreground - #269186 - - - - name - HTML: <tag> - scope - entity.name.tag.block.any.html - settings - - fontStyle - bold - foreground - #268BD2 - - - - name - HTML: style - scope - source.css.embedded.html entity.name.tag.style.html - settings - - fontStyle - italic - - - - name - HTML: <style> - scope - entity.name.tag.style.html - settings - - fontStyle - - - - - name - HTML: {} - scope - text.html.basic punctuation.section.property-list.css - settings - - fontStyle - - - - - name - HTML: Embeddable - scope - source.css.embedded.html, comment.block.html - settings - - fontStyle - italic - foreground - #819090 - - - - name - Ruby: Variable definition - scope - punctuation.definition.variable.ruby - settings - - fontStyle - - foreground - #268BD2 - - - - name - Ruby: Function Name - scope - meta.function.method.with-arguments.ruby - settings - - foreground - #708284 - - - - name - Ruby: Variable - scope - variable.language.ruby - settings - - foreground - #469186 - - - - name - Ruby: Function - scope - entity.name.function.ruby - settings - - foreground - #268BD2 - - - - name - Ruby: Keyword Control - scope - keyword.control.ruby, keyword.control.def.ruby - settings - - fontStyle - bold - foreground - #738A05 - - - - name - Ruby: Class - scope - keyword.control.class.ruby, meta.class.ruby - settings - - foreground - #748B00 - - - - name - Ruby: Class Name - scope - entity.name.type.class.ruby - settings - - fontStyle - - foreground - #A57800 - - - - name - Ruby: Keyword - scope - keyword.control.ruby - settings - - fontStyle - - foreground - #748B00 - - - - name - Ruby: Support Class - scope - support.class.ruby - settings - - fontStyle - - foreground - #A57800 - - - - name - Ruby: Special Method - scope - keyword.other.special-method.ruby - settings - - foreground - #748B00 - - - - name - Ruby: Constant - scope - constant.language.ruby, constant.numeric.ruby - settings - - foreground - #269186 - - - - name - Ruby: Constant Other - scope - variable.other.constant.ruby - settings - - fontStyle - - foreground - #A57800 - - - - name - Ruby: :symbol - scope - constant.other.symbol.ruby - settings - - fontStyle - - foreground - #269186 - - - - name - Ruby: Punctuation Section '' - scope - punctuation.section.embedded.ruby, punctuation.definition.string.begin.ruby, punctuation.definition.string.end.ruby - settings - - foreground - #D01F1E - - - - name - Ruby: Special Method - scope - keyword.other.special-method.ruby - settings - - foreground - #BD3800 - - - - name - PHP: Include - scope - keyword.control.import.include.php - settings - - foreground - #BD3800 - - - - name - Ruby: erb = - scope - text.html.ruby meta.tag.inline.any.html - settings - - fontStyle - - foreground - #819090 - - - - name - Ruby: erb "" - scope - text.html.ruby punctuation.definition.string.begin, text.html.ruby punctuation.definition.string.end - settings - - fontStyle - - foreground - #269186 - - - - name - PHP: Quoted Single - scope - punctuation.definition.string.begin, punctuation.definition.string.end - settings - - foreground - #839496 - - - - name - PHP: Class Names - scope - support.class.php - settings - - foreground - #839496 - - - - name - PHP: [] - scope - keyword.operator.index-start.php, keyword.operator.index-end.php - settings - - foreground - #D31E1E - - - - name - PHP: Array - scope - meta.array.php - settings - - foreground - #536871 - - - - name - PHP: Array() - scope - meta.array.php support.function.construct.php, meta.array.empty.php support.function.construct.php - settings - - fontStyle - - foreground - #A57800 - - - - name - PHP: Array Construct - scope - support.function.construct.php - settings - - foreground - #A57800 - - - - name - PHP: Array Begin - scope - punctuation.definition.array.begin, punctuation.definition.array.end - settings - - foreground - #D31E1E - - - - name - PHP: Numeric Constant - scope - constant.numeric.php - settings - - foreground - #269186 - - - - name - PHP: New - scope - keyword.other.new.php - settings - - foreground - #CB4B16 - - - - name - PHP: :: - scope - keyword.operator.class - settings - - fontStyle - - foreground - #839496 - - - - name - PHP: Other Property - scope - variable.other.property.php - settings - - foreground - #899090 - - - - name - PHP: Class - scope - storage.modifier.extends.php, storage.type.class.php, keyword.operator.class.php - settings - - foreground - #A57800 - - - - name - PHP: Class Function - settings - - - - name - PHP: Semicolon - scope - punctuation.terminator.expression.php - settings - - foreground - #839496 - - - - name - PHP: Inherited Class - scope - meta.other.inherited-class.php - settings - - fontStyle - - foreground - #536871 - - - - name - PHP: Storage Type - scope - storage.type.php - settings - - foreground - #748B00 - - - - name - PHP: Function - scope - entity.name.function.php - settings - - foreground - #899090 - - - - name - PHP: Function Construct - scope - support.function.construct.php - settings - - foreground - #748B00 - - - - name - PHP: Function Call - scope - entity.name.type.class.php, meta.function-call.php, meta.function-call.static.php, meta.function-call.object.php - settings - - foreground - #839496 - - - - name - PHP: Comment - scope - keyword.other.phpdoc - settings - - fontStyle - - foreground - #899090 - - - - name - PHP: Source Emebedded - scope - source.php.embedded.block.html - settings - - foreground - #BD3613 - - - - name - PHP: Storage Type Function - scope - storage.type.function.php - settings - - foreground - #BD3800 - - - - name - C: constant - scope - constant.numeric.c - settings - - fontStyle - - foreground - #269186 - - - - name - C: Meta Preprocessor - scope - meta.preprocessor.c.include, meta.preprocessor.macro.c - settings - - fontStyle - - foreground - #BB3700 - - - - name - C: Keyword - scope - keyword.control.import.define.c, keyword.control.import.include.c - settings - - fontStyle - - foreground - #BB3700 - - - - name - C: Function Preprocessor - scope - entity.name.function.preprocessor.c - settings - - fontStyle - - foreground - #BB3700 - - - - name - C: include <something.c> - scope - meta.preprocessor.c.include string.quoted.other.lt-gt.include.c, meta.preprocessor.c.include punctuation.definition.string.begin.c, meta.preprocessor.c.include punctuation.definition.string.end.c - settings - - fontStyle - - foreground - #269186 - - - - name - C: Function - scope - support.function.C99.c, support.function.any-method.c, entity.name.function.c - settings - - fontStyle - - foreground - #536871 - - - - name - C: " - scope - punctuation.definition.string.begin.c, punctuation.definition.string.end.c - settings - - fontStyle - - foreground - #269186 - - - - name - C: Storage Type - scope - storage.type.c - settings - - fontStyle - - foreground - #A57800 - - - - name - diff: header - scope - meta.diff, meta.diff.header - settings - - background - #A57706 - fontStyle - italic - foreground - #E0EDDD - - - - name - diff: deleted - scope - markup.deleted - settings - - background - #EAE3CA - fontStyle - - foreground - #D3201F - - - - name - diff: changed - scope - markup.changed - settings - - background - #EAE3CA - fontStyle - - foreground - #BF3904 - - - - name - diff: inserted - scope - markup.inserted - settings - - background - #EAE3CA - foreground - #219186 - - - - name - Markdown: Linebreak - scope - text.html.markdown meta.dummy.line-break - settings - - background - #A57706 - foreground - #E0EDDD - - - - name - Markdown: Raw - scope - text.html.markdown markup.raw.inline - settings - - foreground - #269186 - - - - name - reST raw - scope - text.restructuredtext markup.raw - settings - - foreground - #269186 - - - - name - Other: Removal - scope - other.package.exclude, other.remove - settings - - fontStyle - - foreground - #D3201F - - - - name - Other: Add - scope - other.add - settings - - foreground - #269186 - - - - name - Tex: {} - scope - punctuation.section.group.tex , punctuation.definition.arguments.begin.latex, punctuation.definition.arguments.end.latex, punctuation.definition.arguments.latex - settings - - fontStyle - - foreground - #B81D1C - - - - name - Tex: {text} - scope - meta.group.braces.tex - settings - - fontStyle - - foreground - #A57705 - - - - name - Tex: Other Math - scope - string.other.math.tex - settings - - fontStyle - - foreground - #A57705 - - - - name - Tex: {var} - scope - variable.parameter.function.latex - settings - - fontStyle - - foreground - #BD3800 - - - - name - Tex: Math \\ - scope - punctuation.definition.constant.math.tex - settings - - fontStyle - - foreground - #D01F1E - - - - name - Tex: Constant Math - scope - text.tex.latex constant.other.math.tex, constant.other.general.math.tex, constant.other.general.math.tex, constant.character.math.tex - settings - - fontStyle - - foreground - #269186 - - - - name - Tex: Other Math String - scope - string.other.math.tex - settings - - fontStyle - - foreground - #A57800 - - - - name - Tex: $ - scope - punctuation.definition.string.begin.tex, punctuation.definition.string.end.tex - settings - - fontStyle - - foreground - #D3201F - - - - name - Tex: \label - scope - keyword.control.label.latex, text.tex.latex constant.other.general.math.tex - settings - - fontStyle - - foreground - #269186 - - - - name - Tex: \label { } - scope - variable.parameter.definition.label.latex - settings - - fontStyle - - foreground - #D01F1E - - - - name - Tex: Function - scope - support.function.be.latex - settings - - fontStyle - - foreground - #748B00 - - - - name - Tex: Support Function Section - scope - support.function.section.latex - settings - - fontStyle - - foreground - #BD3800 - - - - name - Tex: Support Function - scope - support.function.general.tex - settings - - fontStyle - - foreground - #269186 - - - - name - Tex: Comment - scope - punctuation.definition.comment.tex, comment.line.percentage.tex - settings - - fontStyle - italic - - - - name - Tex: Reference Label - scope - keyword.control.ref.latex - settings - - fontStyle - - foreground - #269186 - - - - name - Python: storage - scope - storage.type.class.python, storage.type.function.python, storage.modifier.global.python - settings - - fontStyle - - foreground - #748B00 - - - - name - Python: import - scope - keyword.control.import.python, keyword.control.import.from.python - settings - - foreground - #BD3800 - - - - name - Python: Support.exception - scope - support.type.exception.python - settings - - foreground - #A57800 - - - - name - Shell: builtin - scope - support.function.builtin.shell - settings - - foreground - #748B00 - - - - name - Shell: variable - scope - variable.other.normal.shell - settings - - foreground - #BD3800 - - - - name - Shell: DOT_FILES - scope - source.shell - settings - - fontStyle - - foreground - #268BD2 - - - - name - Shell: meta scope in loop - scope - meta.scope.for-in-loop.shell, variable.other.loop.shell - settings - - fontStyle - - foreground - #536871 - - - - name - Shell: "" - scope - punctuation.definition.string.end.shell, punctuation.definition.string.begin.shell - settings - - fontStyle - - foreground - #748B00 - - - - name - Shell: Meta Block - scope - meta.scope.case-block.shell, meta.scope.case-body.shell - settings - - fontStyle - - foreground - #536871 - - - - name - Shell: [] - scope - punctuation.definition.logical-expression.shell - settings - - fontStyle - - foreground - #CD1E1D - - - - name - Shell: Comment - scope - comment.line.number-sign.shell - settings - - fontStyle - italic - - - - name - Java: import - scope - keyword.other.import.java - settings - - fontStyle - - foreground - #BD3800 - - - - name - Java: meta-import - scope - storage.modifier.import.java - settings - - fontStyle - - foreground - #586E75 - - - - name - Java: Class - scope - meta.class.java storage.modifier.java - settings - - fontStyle - - foreground - #A57800 - - - - name - Java: /* comment */ - scope - source.java comment.block - settings - - fontStyle - - foreground - #536871 - - - - name - Java: /* @param */ - scope - comment.block meta.documentation.tag.param.javadoc keyword.other.documentation.param.javadoc - settings - - fontStyle - - foreground - #536871 - - - - name - Perl: variables - scope - punctuation.definition.variable.perl, variable.other.readwrite.global.perl, variable.other.predefined.perl, keyword.operator.comparison.perl - settings - - foreground - #B58900 - - - - name - Perl: functions - scope - support.function.perl - settings - - foreground - #859900 - - - - name - Perl: comments - scope - comment.line.number-sign.perl - settings - - fontStyle - italic - foreground - #586E75 - - - - name - Perl: quotes - scope - punctuation.definition.string.begin.perl, punctuation.definition.string.end.perl - settings - - foreground - #2AA198 - - - - name - Perl: \char - scope - constant.character.escape.perl - settings - - foreground - #DC322F - - - - - name - Markdown: Headings - scope - markup.heading.markdown, markup.heading.1.markdown, markup.heading.2.markdown - settings - - foreground - #268BD2 - - - - name - Markdown: Bold - scope - markup.bold.markdown - settings - - fontStyle - bold - foreground - #839496 - - - - name - Markdown: Italic - scope - markup.italic.markdown - settings - - fontStyle - italic - foreground - #839496 - - - - name - Markdown: Punctuation for Bold, Italic, and Inline Block - scope - punctuation.definition.bold.markdown, punctuation.definition.italic.markdown, punctuation.definition.raw.markdown - settings - - foreground - #D3201F - - - - name - Markdown: Bulleted List - scope - markup.list.unnumbered.markdown - settings - - foreground - #B58900 - - - - name - Markdown: Numbered List - scope - markup.list.numbered.markdown - settings - - foreground - #859900 - - - - name - Markdown: Block and Inline Block - scope - markup.raw.block.markdown, markup.raw.inline.markdown - settings - - foreground - #2AA198 - - - - name - Markdown: Quote Block and Punctuation - scope - markup.quote.markdown, punctuation.definition.blockquote.markdown - settings - - foreground - #6C71C4 - - - - name - Markdown: Seperator - scope - meta.separator.markdown - settings - - foreground - #D33682 - - - - name - Markdown: Link and Reference URL - scope - meta.image.inline.markdown, markup.underline.link.markdown - settings - - fontStyle - italic - foreground - #586E75 - - - - name - Markdown: Link Title, Image Description - scope - string.other.link.title.markdown, string.other.link.description.markdown - settings - - foreground - #93A1A1 - - - - name - Markdown: Angle Brakets on Link and Image - scope - punctuation.definition.link.markdown - settings - - foreground - #586E75 - - - - name - Markdown: Parens on Link and Image - scope - punctuation.definition.metadata.markdown - settings - - foreground - #586E75 - - - - name - Markdown: Square Brakets on Link, Image, and Reference - scope - punctuation.definition.string.begin.markdown, punctuation.definition.string.end.markdown, punctuation.definition.constant.markdown - settings - - foreground - #586E75 - - - - - uuid - A4299D9B-1DE5-4BC4-87F6-A757E71B1597 - - diff --git a/themes/SpaceCadet.tmTheme b/themes/SpaceCadet.tmTheme deleted file mode 100644 index 156f43dee..000000000 --- a/themes/SpaceCadet.tmTheme +++ /dev/null @@ -1,212 +0,0 @@ - - - - - author - Alex Ross - comment - Created by Alex Ross - name - SpaceCadet - settings - - - settings - - background - #0D0D0D - caret - #7F005D - foreground - #DDE6CF - invisibles - #BFBFBF - lineHighlight - #00000012 - selection - #40002F - - - - name - Comment - scope - comment - settings - - foreground - #473C45 - - - - name - String - scope - string - settings - - foreground - #805978 - - - - name - Constant - scope - constant - settings - - foreground - #A8885A - - - - name - Variable - scope - variable.parameter, variable.other - settings - - foreground - #596380 - - - - name - Keyword - scope - keyword - keyword.operator, keyword.operator.logical - settings - - foreground - #728059 - - - - name - Storage - scope - storage - settings - - foreground - #9EBF60 - - - - name - Entity - scope - entity - settings - - foreground - #6078BF - - - - name - Inherited class - scope - entity.other.inherited-class - settings - - fontStyle - italic - - - - name - Support - scope - support - settings - - foreground - #8A4B66 - - - - name - Exception - scope - support.type.exception - settings - - foreground - #893062 - - - - name - Tag name - scope - entity.name.tag - settings - - - - name - Tag attribute - scope - entity.other.attribute-name - settings - - - - name - Library constant - scope - support.constant - settings - - - - name - Library class/type - scope - support.type, support.class - settings - - - - name - Library variable - scope - support.other.variable - settings - - - - name - Invalid - scope - invalid - settings - - background - #5F0047 - - - - name - - Meta - settings - - - - name - function.section - scope - meta.function.section - settings - - background - #371D28 - - - - uuid - 2C24E84F-F9FE-4C2E-92D2-F52198BA7E41 - - diff --git a/themes/Sunburst.tmTheme b/themes/Sunburst.tmTheme deleted file mode 100644 index 694c2c8c4..000000000 --- a/themes/Sunburst.tmTheme +++ /dev/null @@ -1,665 +0,0 @@ - - - - - author - Stanley Rost - comment - (π) Soryu, 2005 - name - Sunburst - settings - - - settings - - background - #000000 - caret - #A7A7A7 - foreground - #F8F8F8 - invisibles - #CAE2FB3D - lineHighlight - #FFFFFF1A - selection - #DDF0FF33 - - - - name - Comment - scope - comment - settings - - fontStyle - italic - foreground - #AEAEAE - - - - name - Constant - scope - constant - settings - - foreground - #3387CC - - - - name - Entity - scope - entity - settings - - fontStyle - - foreground - #89BDFF - - - - name - Keyword - scope - keyword - settings - - fontStyle - - foreground - #E28964 - - - - name - Storage - scope - storage - settings - - fontStyle - - foreground - #99CF50 - - - - name - String - scope - string - settings - - fontStyle - - foreground - #65B042 - - - - name - Support - scope - support - settings - - fontStyle - - foreground - #9B859D - - - - name - Variable - scope - variable - settings - - foreground - #3E87E3 - - - - name - Invalid – Deprecated - scope - invalid.deprecated - settings - - fontStyle - italic underline - foreground - #FD5FF1 - - - - name - Invalid – Illegal - scope - invalid.illegal - settings - - background - #562D56BF - foreground - #FD5FF1 - - - - name - ----------------------------------- - settings - - - - name - ♦ Embedded Source (Bright) - scope - text source - settings - - background - #B1B3BA08 - - - - name - ♦ Entity inherited-class - scope - entity.other.inherited-class - settings - - fontStyle - italic - foreground - #9B5C2E - - - - name - ♦ String embedded-source - scope - string.quoted source - settings - - fontStyle - - foreground - #DAEFA3 - - - - name - ♦ String constant - scope - string constant - settings - - foreground - #DDF2A4 - - - - name - ♦ String.regexp - scope - string.regexp - settings - - foreground - #E9C062 - - - - name - ♦ String.regexp.«special» - scope - string.regexp constant.character.escape, string.regexp source.ruby.embedded, string.regexp string.regexp.arbitrary-repitition - settings - - foreground - #CF7D34 - - - - name - ♦ String variable - scope - string variable - settings - - foreground - #8A9A95 - - - - name - ♦ Support.function - scope - support.function - settings - - fontStyle - - foreground - #DAD085 - - - - name - ♦ Support.constant - scope - support.constant - settings - - fontStyle - - foreground - #CF6A4C - - - - name - c C/C++ Preprocessor Line - scope - meta.preprocessor.c - settings - - foreground - #8996A8 - - - - name - c C/C++ Preprocessor Directive - scope - meta.preprocessor.c keyword - settings - - foreground - #AFC4DB - - - - name - j Entity Name Type - scope - entity.name.type - settings - - fontStyle - underline - - - - name - j Cast - scope - meta.cast - settings - - fontStyle - italic - foreground - #676767 - - - - name - ✘ Doctype/XML Processing - scope - meta.sgml.html meta.doctype, meta.sgml.html meta.doctype entity, meta.sgml.html meta.doctype string, meta.xml-processing, meta.xml-processing entity, meta.xml-processing string - settings - - foreground - #494949 - - - - name - ✘ Meta.tag.«all» - scope - meta.tag, meta.tag entity - settings - - foreground - #89BDFF - - - - name - ✘ Meta.tag.inline - scope - source entity.name.tag, source entity.other.attribute-name, meta.tag.inline, meta.tag.inline entity - settings - - foreground - #E0C589 - - - - name - ✘ Namespaces - scope - entity.name.tag.namespace, entity.other.attribute-name.namespace - settings - - foreground - #E18964 - - - - name - § css tag-name - scope - meta.selector.css entity.name.tag - settings - - foreground - #CDA869 - - - - name - § css:pseudo-class - scope - meta.selector.css entity.other.attribute-name.tag.pseudo-class - settings - - foreground - #8F9D6A - - - - name - § css#id - scope - meta.selector.css entity.other.attribute-name.id - settings - - foreground - #8B98AB - - - - name - § css.class - scope - meta.selector.css entity.other.attribute-name.class - settings - - foreground - #9B703F - - - - name - § css property-name: - scope - support.type.property-name.css - settings - - foreground - #C5AF75 - - - - name - § css property-value; - scope - meta.property-group support.constant.property-value.css, meta.property-value support.constant.property-value.css - settings - - foreground - #F9EE98 - - - - name - § css @at-rule - scope - meta.preprocessor.at-rule keyword.control.at-rule - settings - - foreground - #8693A5 - - - - name - § css additional-constants - scope - meta.property-value support.constant.named-color.css, meta.property-value constant - settings - - foreground - #DD7B3B - - - - name - § css constructor.argument - scope - meta.constructor.argument.css - settings - - foreground - #8F9D6A - - - - name - ⎇ diff.header - scope - meta.diff, meta.diff.header - settings - - background - #0E2231 - fontStyle - italic - foreground - #F8F8F8 - - - - name - ⎇ diff.deleted - scope - markup.deleted - settings - - background - #420E09 - foreground - #F8F8F8 - - - - name - ⎇ diff.changed - scope - markup.changed - settings - - background - #4A410D - foreground - #F8F8F8 - - - - name - ⎇ diff.inserted - scope - markup.inserted - settings - - background - #253B22 - foreground - #F8F8F8 - - - - name - -------------------------------- - settings - - - - name - Markup: Italic - scope - markup.italic - settings - - fontStyle - italic - foreground - #E9C062 - - - - name - Markup: Bold - scope - markup.bold - settings - - fontStyle - bold - foreground - #E9C062 - - - - name - Markup: Underline - scope - markup.underline - settings - - fontStyle - underline - foreground - #E18964 - - - - name - Markup: Quote - scope - markup.quote - settings - - background - #FEE09C12 - fontStyle - italic - foreground - #E1D4B9 - - - - name - Markup: Heading - scope - markup.heading, markup.heading entity - settings - - background - #632D04 - fontStyle - - foreground - #FEDCC5 - - - - name - Markup: List - scope - markup.list - settings - - foreground - #E1D4B9 - - - - name - Markup: Raw - scope - markup.raw - settings - - background - #B1B3BA08 - fontStyle - - foreground - #578BB3 - - - - name - Markup: Comment - scope - markup comment - settings - - fontStyle - italic - foreground - #F67B37 - - - - name - Markup: Separator - scope - meta.separator - settings - - background - #242424 - foreground - #60A633 - - - - name - Log Entry - scope - meta.line.entry.logfile, meta.line.exit.logfile - settings - - background - #EEEEEE29 - - - - name - Log Entry Error - scope - meta.line.error.logfile - settings - - background - #751012 - - - - uuid - C8C58F9A-35FE-44A4-9BC2-2F3C343DC81D - - diff --git a/themes/Twilight.tmTheme b/themes/Twilight.tmTheme deleted file mode 100644 index a83f7ecbb..000000000 --- a/themes/Twilight.tmTheme +++ /dev/null @@ -1,514 +0,0 @@ - - - - - author - Michael Sheets - name - Twilight - settings - - - settings - - background - #141414 - caret - #A7A7A7 - foreground - #F8F8F8 - invisibles - #FFFFFF40 - lineHighlight - #FFFFFF08 - selection - #DDF0FF33 - - - - name - Comment - scope - comment - settings - - fontStyle - italic - foreground - #5F5A60 - - - - name - Constant - scope - constant - settings - - foreground - #CF6A4C - - - - name - Entity - scope - entity - settings - - fontStyle - - foreground - #9B703F - - - - name - Keyword - scope - keyword - settings - - fontStyle - - foreground - #CDA869 - - - - name - Storage - scope - storage - settings - - fontStyle - - foreground - #F9EE98 - - - - name - String - scope - string - settings - - fontStyle - - foreground - #8F9D6A - - - - name - Support - scope - support - settings - - fontStyle - - foreground - #9B859D - - - - name - Variable - scope - variable - settings - - foreground - #7587A6 - - - - name - Invalid – Deprecated - scope - invalid.deprecated - settings - - fontStyle - italic underline - foreground - #D2A8A1 - - - - name - Invalid – Illegal - scope - invalid.illegal - settings - - background - #562D56BF - foreground - #F8F8F8 - - - - name - ----------------------------------- - settings - - - - name - ♦ Embedded Source - scope - text source - settings - - background - #B0B3BA14 - - - - name - ♦ Embedded Source (Bright) - scope - text.html.ruby source - settings - - background - #B1B3BA21 - - - - name - ♦ Entity inherited-class - scope - entity.other.inherited-class - settings - - fontStyle - italic - foreground - #9B5C2E - - - - name - ♦ String embedded-source - scope - string source - settings - - fontStyle - - foreground - #DAEFA3 - - - - name - ♦ String constant - scope - string constant - settings - - foreground - #DDF2A4 - - - - name - ♦ String.regexp - scope - string.regexp - settings - - fontStyle - - foreground - #E9C062 - - - - name - ♦ String.regexp.«special» - scope - string.regexp constant.character.escape, string.regexp source.ruby.embedded, string.regexp string.regexp.arbitrary-repitition - settings - - foreground - #CF7D34 - - - - name - ♦ String variable - scope - string variable - settings - - foreground - #8A9A95 - - - - name - ♦ Support.function - scope - support.function - settings - - fontStyle - - foreground - #DAD085 - - - - name - ♦ Support.constant - scope - support.constant - settings - - fontStyle - - foreground - #CF6A4C - - - - name - c C/C++ Preprocessor Line - scope - meta.preprocessor.c - settings - - foreground - #8996A8 - - - - name - c C/C++ Preprocessor Directive - scope - meta.preprocessor.c keyword - settings - - foreground - #AFC4DB - - - - name - ✘ Doctype/XML Processing - scope - meta.tag.sgml.doctype, meta.tag.sgml.doctype entity, meta.tag.sgml.doctype string, meta.tag.preprocessor.xml, meta.tag.preprocessor.xml entity, meta.tag.preprocessor.xml string - settings - - foreground - #494949 - - - - name - ✘ Meta.tag.«all» - scope - declaration.tag, declaration.tag entity, meta.tag, meta.tag entity - settings - - foreground - #AC885B - - - - name - ✘ Meta.tag.inline - scope - declaration.tag.inline, declaration.tag.inline entity, source entity.name.tag, source entity.other.attribute-name, meta.tag.inline, meta.tag.inline entity - settings - - foreground - #E0C589 - - - - name - § css tag-name - scope - meta.selector.css entity.name.tag - settings - - foreground - #CDA869 - - - - name - § css:pseudo-class - scope - meta.selector.css entity.other.attribute-name.tag.pseudo-class - settings - - foreground - #8F9D6A - - - - name - § css#id - scope - meta.selector.css entity.other.attribute-name.id - settings - - foreground - #8B98AB - - - - name - § css.class - scope - meta.selector.css entity.other.attribute-name.class - settings - - foreground - #9B703F - - - - name - § css property-name: - scope - support.type.property-name.css - settings - - foreground - #C5AF75 - - - - name - § css property-value; - scope - meta.property-group support.constant.property-value.css, meta.property-value support.constant.property-value.css - settings - - foreground - #F9EE98 - - - - name - § css @at-rule - scope - meta.preprocessor.at-rule keyword.control.at-rule - settings - - foreground - #8693A5 - - - - name - § css additional-constants - scope - meta.property-value support.constant.named-color.css, meta.property-value constant - settings - - foreground - #CA7840 - - - - name - § css constructor.argument - scope - meta.constructor.argument.css - settings - - foreground - #8F9D6A - - - - name - ⎇ diff.header - scope - meta.diff, meta.diff.header, meta.separator - settings - - background - #0E2231 - fontStyle - italic - foreground - #F8F8F8 - - - - name - ⎇ diff.deleted - scope - markup.deleted - settings - - background - #420E09 - foreground - #F8F8F8 - - - - name - ⎇ diff.changed - scope - markup.changed - settings - - background - #4A410D - foreground - #F8F8F8 - - - - name - ⎇ diff.inserted - scope - markup.inserted - settings - - background - #253B22 - foreground - #F8F8F8 - - - - name - Markup: List - scope - markup.list - settings - - foreground - #F9EE98 - - - - name - Markup: Heading - scope - markup.heading - settings - - foreground - #CF6A4C - - - - uuid - 766026CB-703D-4610-B070-8DE07D967C5F - - diff --git a/themes/Zenburnesque.tmTheme b/themes/Zenburnesque.tmTheme deleted file mode 100644 index 8631f9867..000000000 --- a/themes/Zenburnesque.tmTheme +++ /dev/null @@ -1,343 +0,0 @@ - - - - - author - William D. Neumann - name - Zenburnesque - settings - - - settings - - background - #404040 - caret - #FFFF66 - foreground - #DEDEDE - invisibles - #A8A8A8 - lineHighlight - #A0804026 - selection - #A0A0C0 - - - - name - Comment - scope - comment - settings - - fontStyle - italic - foreground - #709070 - - - - name - Directive - scope - keyword.other.directive - settings - - fontStyle - bold - - - - name - Line-number directives - scope - keyword.other.directive.line-number - settings - - fontStyle - underline - - - - name - Characters - scope - constant.character - settings - - foreground - #FF8080 - - - - name - String - scope - string - settings - - foreground - #FF2020 - - - - name - Number - scope - constant.numeric - settings - - foreground - #22C0FF - - - - name - Floating-point numbers - scope - constant.numeric.floating-point - settings - - fontStyle - underline - - - - name - Built-in constant - scope - constant.language - settings - - - - name - User-defined constant - scope - constant.character, constant.other - settings - - - - name - Variable - scope - variable.parameter, variable.other - settings - - - - name - Language Keyword - scope - keyword - settings - - foreground - #FFFFA0 - - - - name - Module Keyword - scope - entity.name.module, support.other.module - settings - - fontStyle - bold - foreground - #FF8000 - - - - name - Operators - scope - keyword.operator - settings - - foreground - #FFFFA0 - - - - name - Floating-point infix operators - scope - source.ocaml keyword.operator.symbol.infix.floating-point - settings - - fontStyle - underline - - - - name - Floating-point prefix operators - scope - source.ocaml keyword.operator.symbol.prefix.floating-point - settings - - fontStyle - underline - - - - name - Storage Types - scope - storage.type - settings - - foreground - #6080FF - - - - name - Variant Types - scope - entity.name.class.variant - settings - - foreground - #4080A0 - - - - name - Storage - scope - storage - settings - - - - name - Type name - scope - entity.name.type - settings - - foreground - #F09040 - - - - name - Inherited class - scope - entity.other.inherited-class - settings - - - - name - Function name - scope - entity.name.function - settings - - fontStyle - bold - foreground - #FFCC66 - - - - name - Type name - scope - storage.type.user-defined - settings - - foreground - #FFE000 - - - - name - Class type name - scope - entity.name.type.class.type - settings - - foreground - #F4A020 - - - - name - Function argument - scope - variable.parameter - settings - - fontStyle - - - - - name - Tag name - scope - entity.name.tag - settings - - - - name - Tag attribute - scope - entity.other.attribute-name - settings - - - - name - Library function - scope - support.function - settings - - - - name - Library constant - scope - support.constant - settings - - - - name - Library class/type - scope - support.type, support.class - settings - - - - name - Library variable - scope - support.variable - settings - - - - name - Invalid - scope - invalid - settings - - - - uuid - 8D4988B9-ADD8-436F-B388-BC1360F8504B - - diff --git a/themes/iPlastic.tmTheme b/themes/iPlastic.tmTheme deleted file mode 100644 index 7253df6a7..000000000 --- a/themes/iPlastic.tmTheme +++ /dev/null @@ -1,286 +0,0 @@ - - - - - author - Jeroen van der Ham - name - iPlastic - settings - - - settings - - background - #EEEEEEEB - caret - #000000 - foreground - #000000 - invisibles - #B3B3B3F4 - lineHighlight - #0000001A - selection - #BAD6FD - - - - name - String - scope - string - settings - - foreground - #009933 - - - - name - Number - scope - constant.numeric - settings - - foreground - #0066FF - - - - name - Regular expression - scope - string.regexp - settings - - foreground - #FF0080 - - - - name - Keyword - scope - keyword - settings - - foreground - #0000FF - - - - name - Identifier - scope - constant.language - settings - - foreground - #9700CC - - - - name - Exception - scope - support.class.exception - settings - - foreground - #990000 - - - - name - Function name - scope - entity.name.function - settings - - foreground - #FF8000 - - - - name - Type name - scope - entity.name.type - settings - - fontStyle - bold underline - - - - name - Arguments - scope - variable.parameter - settings - - fontStyle - italic - - - - name - Comment - scope - comment - settings - - fontStyle - italic - foreground - #0066FF - - - - name - Invalid - scope - invalid - settings - - background - #E71A114D - foreground - #FF0000 - - - - name - Trailing whitespace - scope - invalid.deprecated.trailing-whitespace - settings - - background - #E71A1100 - - - - name - Embedded source - scope - text source - settings - - background - #FAFAFAFC - foreground - #000000 - - - - name - Tag - scope - meta.tag, declaration.tag - settings - - foreground - #0033CC - - - - name - Constant - scope - constant, support.constant - settings - - foreground - #6782D3 - - - - name - Support - scope - support - settings - - fontStyle - bold - foreground - #3333FF - - - - name - Storage - scope - storage - settings - - fontStyle - bold - - - - name - Section name - scope - entity.name.section - settings - - fontStyle - bold underline - - - - name - Frame title - scope - entity.name.function.frame - settings - - fontStyle - bold - foreground - #000000 - - - - name - XML Declaration - scope - meta.tag.preprocessor.xml - settings - - foreground - #333333 - - - - name - Tag Attribute - scope - entity.other.attribute-name - settings - - fontStyle - italic - foreground - #3366CC - - - - name - Tag Name - scope - entity.name.tag - settings - - fontStyle - bold - - - - uuid - 4FCFA210-B247-11D9-9D00-000D93347A42 - - diff --git a/tools/automate/automate-git.py b/tools/automate/automate-git.py new file mode 100644 index 000000000..67dceae12 --- /dev/null +++ b/tools/automate/automate-git.py @@ -0,0 +1,362 @@ +# Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +from optparse import OptionParser +from subprocess import Popen, PIPE, STDOUT +from tempfile import mktemp +import os +import shlex +import shutil +import sys +import urllib + +# default URL values +chromium_url = 'http://git.chromium.org/chromium/src.git' +depot_tools_url = 'http://src.chromium.org/svn/trunk/tools/depot_tools' + +def check_url(url): + """ Check the URL and raise an exception if invalid. """ + if ':' in url[:7]: + parts = url.split(':', 1) + if (parts[0] in ["http", "https", "git"] and \ + parts[1] == urllib.quote(parts[1])): + return url + sys.stderr.write('Invalid URL: '+url+"\n") + raise Exception('Invalid URL: '+url) + +def get_exec_environ(): + env = os.environ + env['PATH'] = depot_tools_dir + os.pathsep + env['PATH'] + return env + +def run(args, **kwargs): + '''Run a command and capture the output iteratively''' + if isinstance(args, str): + args = shlex.split(args.replace('\\', '\\\\')) + cwd = kwargs.get("cwd", os.getcwd()) + quiet = kwargs.get("quiet", False) + print "-> Running '%s' in %s" % (" ".join(args), os.path.relpath(cwd)) + cmd = Popen(args, cwd=cwd, stdout=PIPE, stderr=STDOUT, + env=kwargs.get("env", get_exec_environ()), + shell=(sys.platform == 'win32')) + output = '' + while True: + out = cmd.stdout.read(1) + if out == '' and cmd.poll() != None: + break + output += out + if not quiet: + sys.stdout.write(out) + if cmd.wait() != 0: + raise Exception("Command failed: \"%s\"" % " ".join(args), output) + return output + +def get_current_branch(path): + return run("git rev-parse --abbrev-ref HEAD", cwd=path, quiet=True) + +def get_chromium_compat_rev(cef_url, path, cef_rev): + if not os.path.isdir(path): + path = mktemp() + run("git clone --depth 1 %s %s" % (cef_url, path), quiet = True) + if cef_rev == "None": + cef_rev = get_git_rev(path, get_current_branch(path)) + compat_cmd = "git cat-file -p %s:CHROMIUM_BUILD_COMPATIBILITY.txt" % cef_rev + compat_value = run(compat_cmd, cwd = path, quiet = True) + config = eval(compat_value, {'__builtins__': None}, None) + if not 'chromium_revision' in config: + raise Exception("Missing chromium_revision value") + return str(int(config['chromium_revision'])) + +def get_svn_rev(path, branch): + svn_rev = "None" + cmd = ("git log --grep=^git-svn-id: -n 1 %s" % branch).split() + try: + process = Popen(cmd, cwd=path, stdout = PIPE, stderr = PIPE) + for line in process.stdout: + if line.find("git-svn-id") > 0: + svn_rev = line.split("@")[1].split()[0] + break + except IOError, (errno, strerror): + sys.stderr.write('Failed to read git log: ' + strerror + "\n") + raise + return svn_rev + +def get_git_rev_for_svn_rvn(path, svn_rev): + git_rev = "None" + cmd = ("git log --grep=^git-svn-id:.*@%s --oneline" % svn_rev).split() + try: + process = Popen(cmd, cwd=path, stdout = PIPE, stderr = PIPE) + git_rev = process.communicate()[0].split()[0] + except IOError, (errno, strerror): + sys.stderr.write('Failed to read git log: ' + strerror + "\n") + raise + return git_rev + +def get_git_rev(path, branch): + git_rev = "None" + cmd = ("git describe --always %s" % branch).split() + try: + process = Popen(cmd, cwd=path, stdout = PIPE, stderr = PIPE) + git_rev = process.communicate()[0].strip() + except IOError, (errno, strerror): + sys.stderr.write('Failed to read git log: ' + strerror + "\n") + raise + return git_rev + +def get_git_origin(path): + git_origin = "None" + get_origin_cmd = "git remote show origin -n".split() + try: + process = Popen(get_origin_cmd, cwd=path, stdout = PIPE, stderr = PIPE) + for line in process.stdout: + if line.startswith(" Fetch URL: "): + git_origin = line.replace(" Fetch URL: ", "").strip() + break + except IOError, (errno, strerror): + sys.stderr.write('Failed to read git log: ' + strerror + "\n") + raise + return git_origin + +def get_checkout_info(path, fetch_latest = True): + """ Retrieves the origin URL, git HEAD revision and last SVN revision """ + url = 'None' + origin_svn_rev = 'None' + origin_git_rev = 'None' + local_svn_rev = 'None' + local_git_rev = 'None' + if os.path.isdir(path): + if fetch_latest: + run("git fetch", cwd = path, quiet = True) + url = get_git_origin(path) + branch = get_current_branch(path) + origin_svn_rev = get_svn_rev(path, "origin/%s" % branch) + origin_git_rev = get_git_rev(path, "origin/%s" % branch) + local_svn_rev = get_svn_rev(path, branch) + local_git_rev = get_git_rev(path, branch) + return { + 'url' : url, + 'local' : { + 'svn-revision' : local_svn_rev, + 'git-revision' : local_git_rev + }, + 'origin' : { + 'svn-revision' : origin_svn_rev, + 'git-revision' : origin_git_rev + } + } + +# cannot be loaded as a module +if __name__ != "__main__": + sys.stderr.write('This file cannot be loaded as a module!') + sys.exit() + +# parse command-line options +desc = """ +This utility implements automation for the download, update, build and +distribution of CEF. +""" + +parser = OptionParser(description=desc) +parser.add_option('--url', dest='url', + help='CEF source URL') +parser.add_option('--download-dir', dest='downloaddir', metavar='DIR', + help='download directory with no spaces [required]') +parser.add_option('--revision', dest='revision', + help='CEF source revision') +parser.add_option('--force-config', + action='store_true', dest='forceconfig', default=False, + help='force Chromium configuration') +parser.add_option('--force-clean', + action='store_true', dest='forceclean', default=False, + help='force revert of all Chromium changes, deletion of '+\ + 'all unversioned files including the CEF folder and '+\ + 'trigger the force-update, force-build and '+\ + 'force-distrib options') +parser.add_option('--force-update', + action='store_true', dest='forceupdate', default=False, + help='force Chromium and CEF update') +parser.add_option('--force-build', + action='store_true', dest='forcebuild', default=False, + help='force CEF debug and release builds') +parser.add_option('--force-distrib', + action='store_true', dest='forcedistrib', default=False, + help='force creation of CEF binary distribution') +parser.add_option('--no-debug-build', + action='store_true', dest='nodebugbuild', default=False, + help="don't perform the CEF debug build") +parser.add_option('--no-release-build', + action='store_true', dest='noreleasebuild', default=False, + help="don't perform the CEF release build") +parser.add_option('--no-distrib', + action='store_true', dest='nodistrib', default=False, + help="don't create the CEF binary distribution") +(options, args) = parser.parse_args() + +# the downloaddir and url options are required +if options.downloaddir is None: + print "ERROR: Download directory is required" + parser.print_help(sys.stderr) + sys.exit() +if options.url is None: + print "ERROR: CEF URL is required" + parser.print_help(sys.stderr) + sys.exit() + +cef_url = check_url(options.url) +download_dir = os.path.abspath(options.downloaddir) +if not os.path.exists(download_dir): + # create the download directory + os.makedirs(download_dir) + +# set the expected script extension +if sys.platform == 'win32': + script_ext = '.bat' +else: + script_ext = '.sh' + +# check if the "depot_tools" directory exists +depot_tools_dir = os.path.join(download_dir, 'depot_tools') +if not os.path.exists(depot_tools_dir): + # checkout depot_tools + run('svn checkout %s %s' % (depot_tools_url, depot_tools_dir), + cwd = download_dir, quiet = True) + +chromium_dir = os.path.join(download_dir, 'chromium') +if not os.path.exists(chromium_dir): + # create the "chromium" directory + os.makedirs(chromium_dir) + +chromium_src_dir = os.path.join(chromium_dir, 'src') +cef_src_dir = os.path.join(chromium_src_dir, 'cef') +cef_tools_dir = os.path.join(cef_src_dir, 'tools') + +# retrieve the current CEF URL and revision +info = get_checkout_info(cef_src_dir) +cef_rev = info['origin']['git-revision'] +if not options.revision is None: + cef_rev = str(options.revision) +current_cef_url = info['url'] +current_cef_rev = info['local']['git-revision'] + +# retrieve the compatible Chromium revision +chromium_rev = get_chromium_compat_rev(cef_url, cef_src_dir, cef_rev) + +# retrieve the current Chromium URL and revision +info = get_checkout_info(chromium_src_dir, False) +current_chromium_url = info['url'] +current_chromium_rev = info['local']['svn-revision'] + +# test if the CEF URL changed +cef_url_changed = current_cef_url != cef_url +print "-- CEF URL: %s" % current_cef_url +if cef_url_changed: + print "\t-> CHANGED TO: %s" % cef_url + +# test if the CEF revision changed +cef_rev_changed = current_cef_rev != cef_rev +print "-- CEF Revision: %s" % current_cef_rev +if cef_url_changed: + print "\t-> CHANGED TO: %s" % cef_rev + +# test if the Chromium URL changed +chromium_url_changed = current_chromium_url != chromium_url +print "-- Chromium URL: %s" % current_chromium_url +if cef_url_changed: + print "\t-> CHANGED TO: %s" % chromium_url + +# test if the Chromium revision changed +chromium_rev_changed = current_chromium_rev != chromium_rev +print "-- Chromium Revision: %s" % current_chromium_rev +if cef_url_changed: + print "\t-> CHANGED TO: %s" % chromium_rev + +# true if anything changed +any_changed = chromium_url_changed or chromium_rev_changed or \ + cef_url_changed or cef_rev_changed +if not any_changed: + print "*** NO CHANGE ***" + +if chromium_url_changed or options.forceconfig: + # run gclient config to create the .gclient file + run('gclient config %s --git-deps' % chromium_url, cwd = chromium_dir) + + path = os.path.join(chromium_dir, '.gclient') + if not os.path.exists(path): + raise Exception('.gclient file was not created') + + # read the resulting .gclient file + fp = open(path, 'r') + data = fp.read() + fp.close() + + # populate "custom_deps" section + data = data.replace('"custom_deps" : {', '"custom_deps" : {'+\ + "\n "+'"src/third_party/WebKit/LayoutTests": None,'+\ + "\n "+'"src/chrome_frame/tools/test/reference_build/chrome": None,'+\ + "\n "+'"src/chrome/tools/test/reference_build/chrome_mac": None,'+\ + "\n "+'"src/chrome/tools/test/reference_build/chrome_win": None,'+\ + "\n "+'"src/chrome/tools/test/reference_build/chrome_linux": None,') + + # write the new .gclient file + fp = open(path, 'w') + fp.write(data) + fp.close() + +if options.forceclean: + if os.path.exists(chromium_src_dir): + # revert all Chromium changes and delete all unversioned files + run('gclient revert -n', cwd = chromium_dir) + + # force update, build and distrib steps + options.forceupdate = True + options.forcebuild = True + options.forcedistrib = True + +if chromium_url_changed or chromium_rev_changed or options.forceupdate: + # download/update the Chromium source cod + fetch_rev = "HEAD" + if os.path.isdir(chromium_src_dir): + fetch_rev = get_git_rev_for_svn_rvn( + chromium_src_dir, current_chromium_rev) + run('gclient sync --jobs 8 -n --force --revision=src@%s' % fetch_rev, + cwd = chromium_dir) + checkout_rev = get_git_rev_for_svn_rvn(chromium_src_dir, chromium_rev) + run('gclient sync --jobs 8 --revision=src@%s' % checkout_rev, + cwd = chromium_dir) + +if not os.path.exists(cef_src_dir) or cef_url_changed: + if cef_url_changed and os.path.exists(cef_src_dir): + # delete the cef directory (it will be re-downloaded) + shutil.rmtree(cef_src_dir) + # download the CEF source code + run("git clone %s %s" % (cef_url, cef_src_dir)) +elif cef_rev_changed or options.forceupdate: + # update the CEF source code + stashed = run("git stash", cwd = cef_src_dir).find( + "No local changes to save") < 0 + ref = cef_rev + if ref == "None": + ref = "origin/%s" % get_current_branch(cef_src_dir) + run("git fetch origin", cwd = cef_src_dir) + run("git reset --hard %s" % ref, cwd = cef_src_dir) + if stashed: + run("git stash pop", cwd = cef_src_dir) + +if any_changed or options.forceupdate: + # create CEF projects + path = os.path.join(cef_src_dir, 'cef_create_projects' + script_ext) + run(path, cwd = cef_src_dir, quiet = True) + +if any_changed or options.forcebuild: + path = os.path.join(cef_tools_dir, 'build_projects' + script_ext) + if not options.nodebugbuild: + run(path +' Debug', cwd = cef_tools_dir) + if not options.noreleasebuild: + run(path +' Release', cwd = cef_tools_dir) + +if any_changed or options.forcedistrib: + if not options.nodistrib: + # make CEF binary distribution + path = os.path.join(cef_tools_dir, 'make_distrib' + script_ext) + run(path, cwd = cef_tools_dir) diff --git a/tools/automate/automate.README.txt b/tools/automate/automate.README.txt new file mode 100644 index 000000000..505be746a --- /dev/null +++ b/tools/automate/automate.README.txt @@ -0,0 +1,99 @@ +Chromium Embedded Framework (CEF) Automation Tool +------------------------------------------------------------------------------- + +Document Last Updated: October 10, 2011 + + +OVERVIEW +-------- + +The CEF Automation Tool can perform the following actions in an automated manner: + +1. Download/update the Chromium and CEF source code. +2. Build the CEF Debug and Release targets. +3. Create the CEF binary distribution package. + + +SETUP +----- + +1. Install Subversion [1] and Python [2]. Make sure the bin directories for both + programs are discoverable via your system PATH configuration. On Windows + install CppDoc [3] in the default location (assumes a 64bit version of + Windows 7). + +2. Install build tools. On Windows install Visual Studio 2008 or newer and all + required prerequisite software [4]. On Mac install Xcode 3.2 or newer. + +3. Configure the GYP environment. On Windows set the GYP_MSVS_VERSION + environment variable to "2008" or "2010" depending on which version of Visual + Studio you're building with. On Mac Lion set the GYP_DEFINES environment + variable to 'mac_sdk=10.6'. + +4. Checkout the "automate" folder to a location on your hard drive. For the + trunk version of CEF you can use the following command: + + svn checkout http://chromiumembedded.googlecode.com/svn/trunk/cef3/tools/automate /path/to/automate + +5. Run the automate.py script at whatever interval is appropriate (for each + CEF commit, once per day, once per week, etc): + + python /path/to/automate/automate.py --download-dir=/path/to/download + + +HOW IT WORKS +------------ + +The automate.py script performs the following actions in the download directory +specified by the "--download-dir" flag. This path value must contain no spaces. + +1. Retrieve the Chromium URL and revision associated with a CEF URL and + revision. A specific CEF URL and revision can be specified using the "--url" + and "--revision" flags. Otherwise, the current CEF trunk URL [7] and HEAD + revision will be used. The Chromium URL and revision are retrieved by + querying the SVN repository for a CHROMIUM_BUILD_COMPATIBILITY.txt file. + +2. If a "depot_tools" folder does not already exist download depot_tools [5]. + The depot_tools folder will be added to the beginning of the PATH to support + execution of the below steps. + +3. If a "chromium" folder does not already exist create it and configure + gclient [6] using the Chromium URL retrieved in step 1. To force execution of + this step use the "--force-config" flag. + +4. If the "--force-clean" flag is specified all Chromium changes will be + reverted, all unversioned files including the CEF folder will be deleted and + steps 6-10 will be triggered automatically. + +5. If both Chromium and CEF are already at the correct URL and revision the + script will exit at this point. To force execution of steps 6-8 use the + "--force-update" flag. To force execution of step 9 use the "--force-build" + flag. To force execution of step 10 use the "--force-distrib" flag. + +6. Use gclient [6] to update the Chromium source code to the correct revision. + +7. If a "chromium/src/cef" folder does not already exist download the CEF source + code at the correct revision. Otherwise, update CEF source code to the + correct revision. + +8. Run the "chromium/src/cef/cef_create_projects.[sh|bat]" script to apply CEF + patches and generate CEF project files. + +9. Run the "chromium/src/cef/tools/build_projects.[sh|bat]" script twice; once + to build the Debug target and once to build the Release target. + +10.Run the "chromium/src/cef/tools/make_distrib.[sh|bat]" script to build the + binary distribution package. The resulting package will be output in a + "chromium/src/cef/binary_distrib/cef_binary_rXXX_[windows|macosx]" folder. + + +REFERENCES +---------- + +[1] http://subversion.apache.org/ +[2] http://www.python.org/ +[3] http://www.cppdoc.com/ +[4] http://dev.chromium.org/developers/how-tos/build-instructions-windows +[5] http://dev.chromium.org/developers/how-tos/depottools +[6] http://dev.chromium.org/developers/how-tos/get-the-code +[7] http://chromiumembedded.googlecode.com/svn/trunk/cef3 diff --git a/tools/automate/automate.py b/tools/automate/automate.py new file mode 100644 index 000000000..18f805d25 --- /dev/null +++ b/tools/automate/automate.py @@ -0,0 +1,347 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +from optparse import OptionParser +import os +import re +import shlex +import shutil +import subprocess +import sys +import urllib + +# default URL values +cef_url = 'http://chromiumembedded.googlecode.com/svn/trunk/cef3' +depot_tools_url = 'http://src.chromium.org/svn/trunk/tools/depot_tools' + +def run(command_line, working_dir, depot_tools_dir=None): + # add depot_tools to the path + env = os.environ + if not depot_tools_dir is None: + env['PATH'] = depot_tools_dir+os.pathsep+env['PATH'] + + sys.stdout.write('-------- Running "'+command_line+'" in "'+\ + working_dir+'"...'+"\n") + args = shlex.split(command_line.replace('\\', '\\\\')) + return subprocess.check_call(args, cwd=working_dir, env=env, + shell=(sys.platform == 'win32')) + +def check_url(url): + """ Check the URL and raise an exception if invalid. """ + if ':' in url[:7]: + parts = url.split(':', 1) + if (parts[0] == 'http' or parts[0] == 'https') and \ + parts[1] == urllib.quote(parts[1]): + return url + sys.stderr.write('Invalid URL: '+url+"\n") + raise Exception('Invalid URL: '+url) + +def get_svn_info(path): + """ Retrieves the URL and revision from svn info. """ + url = 'None' + rev = 'None' + if path[0:4] == 'http' or os.path.exists(path): + try: + stream = os.popen('svn info '+path) + for line in stream: + if line[0:4] == "URL:": + url = check_url(line[5:-1]) + elif line[0:9] == "Revision:": + rev = str(int(line[10:-1])) + except IOError, (errno, strerror): + sys.stderr.write('Failed to read svn info: '+strerror+"\n") + raise + return {'url': url, 'revision': rev} + +# cannot be loaded as a module +if __name__ != "__main__": + sys.stderr.write('This file cannot be loaded as a module!') + sys.exit() + +# parse command-line options +disc = """ +This utility implements automation for the download, update, build and +distribution of CEF. +""" + +parser = OptionParser(description=disc) +parser.add_option('--download-dir', dest='downloaddir', metavar='DIR', + help='download directory with no spaces [required]') +parser.add_option('--revision', dest='revision', type="int", + help='CEF source revision') +parser.add_option('--url', dest='url', + help='CEF source URL') +parser.add_option('--force-config', + action='store_true', dest='forceconfig', default=False, + help='force Chromium configuration') +parser.add_option('--force-clean', + action='store_true', dest='forceclean', default=False, + help='force revert of all Chromium changes, deletion of '+\ + 'all unversioned files including the CEF folder and '+\ + 'trigger the force-update, force-build and '+\ + 'force-distrib options') +parser.add_option('--force-update', + action='store_true', dest='forceupdate', default=False, + help='force Chromium and CEF update') +parser.add_option('--force-build', + action='store_true', dest='forcebuild', default=False, + help='force CEF debug and release builds') +parser.add_option('--force-distrib', + action='store_true', dest='forcedistrib', default=False, + help='force creation of CEF binary distribution') +parser.add_option('--no-debug-build', + action='store_true', dest='nodebugbuild', default=False, + help="don't perform the CEF debug build") +parser.add_option('--no-release-build', + action='store_true', dest='noreleasebuild', default=False, + help="don't perform the CEF release build") +parser.add_option('--no-distrib', + action='store_true', dest='nodistrib', default=False, + help="don't create the CEF binary distribution") +(options, args) = parser.parse_args() + +# the downloaddir option is required +if options.downloaddir is None: + parser.print_help(sys.stderr) + sys.exit() + +# script directory +script_dir = os.path.dirname(__file__) + +if not options.url is None: + # set the CEF URL + cef_url = check_url(options.url) + +if not options.revision is None: + # set the CEF revision + cef_rev = str(options.revision) +else: + # retrieve the CEF revision from the remote repo + info = get_svn_info(cef_url) + cef_rev = info['revision'] + if cef_rev == 'None': + sys.stderr.write('No SVN info for: '+cef_url+"\n") + raise Exception('No SVN info for: '+cef_url) + +# Retrieve the Chromium URL and revision from the CEF repo +compat_url = cef_url + "/CHROMIUM_BUILD_COMPATIBILITY.txt?r="+cef_rev + +release_url = None +chromium_url = None +chromium_rev = None + +try: + # Read the remote URL contents + handle = urllib.urlopen(compat_url) + compat_value = handle.read().strip() + handle.close() + + # Parse the contents + config = eval(compat_value, {'__builtins__': None}, None) + + if 'release_url' in config: + # building from a release + release_url = check_url(config['release_url']) + else: + # building from chromium src + if not 'chromium_url' in config: + raise Exception("Missing chromium_url value") + if not 'chromium_revision' in config: + raise Exception("Missing chromium_revision value") + + chromium_url = check_url(config['chromium_url']) + chromium_rev = str(int(config['chromium_revision'])) +except Exception, e: + sys.stderr.write('Failed to read URL and revision information from '+ \ + compat_url+"\n") + raise + +download_dir = options.downloaddir +if not os.path.exists(download_dir): + # create the download directory + os.makedirs(download_dir) + +# set the expected script extension +if sys.platform == 'win32': + script_ext = '.bat' +else: + script_ext = '.sh' + +# check if the "depot_tools" directory exists +depot_tools_dir = os.path.join(download_dir, 'depot_tools') +if not os.path.exists(depot_tools_dir): + # checkout depot_tools + run('svn checkout '+depot_tools_url+' '+depot_tools_dir, download_dir) + +# check if the "chromium" directory exists +chromium_dir = os.path.join(download_dir, 'chromium') +if not os.path.exists(chromium_dir): + # create the "chromium" directory + os.makedirs(chromium_dir) + +chromium_src_dir = os.path.join(chromium_dir, 'src') +cef_src_dir = os.path.join(chromium_src_dir, 'cef') +cef_tools_dir = os.path.join(cef_src_dir, 'tools') + +# retrieve the current CEF URL and revision +info = get_svn_info(cef_src_dir) +current_cef_url = info['url'] +current_cef_rev = info['revision'] + +if release_url is None: + # retrieve the current Chromium URL and revision + info = get_svn_info(chromium_src_dir) + current_chromium_url = info['url'] + current_chromium_rev = info['revision'] + +# test if the CEF URL changed +cef_url_changed = current_cef_url != cef_url +sys.stdout.write('CEF URL: '+current_cef_url+"\n") +if cef_url_changed: + sys.stdout.write(' -> CHANGED TO: '+cef_url+"\n") + +# test if the CEF revision changed +cef_rev_changed = current_cef_rev != cef_rev +sys.stdout.write('CEF Revision: '+current_cef_rev+"\n") +if cef_rev_changed: + sys.stdout.write(' -> CHANGED TO: '+cef_rev+"\n") + +release_url_changed = False +chromium_url_changed = False +chromium_rev_changed = False + +if release_url is None: + # test if the Chromium URL changed + chromium_url_changed = current_chromium_url != chromium_url + sys.stdout.write('Chromium URL: '+current_chromium_url+"\n") + if chromium_url_changed: + sys.stdout.write(' -> CHANGED TO: '+chromium_url+"\n") + + # test if the Chromium revision changed + chromium_rev_changed = current_chromium_rev != chromium_rev + sys.stdout.write('Chromium Revision: '+current_chromium_rev+"\n") + if chromium_rev_changed: + sys.stdout.write(' -> CHANGED TO: '+chromium_rev+"\n") +else: + # test if the release URL changed + current_release_url = 'None' + + path = os.path.join(chromium_dir, '.gclient') + if os.path.exists(path): + # read the .gclient file + fp = open(path, 'r') + data = fp.read() + fp.close() + + # Parse the contents + config_dict = {} + try: + exec(data, config_dict) + current_release_url = config_dict['solutions'][0]['url'] + except Exception, e: + sys.stderr.write('Failed to parse existing .glient file.\n') + raise + + release_url_changed = current_release_url != release_url + sys.stdout.write('Release URL: '+current_release_url+"\n") + if release_url_changed: + sys.stdout.write(' -> CHANGED TO: '+release_url+"\n") + +# true if anything changed +any_changed = release_url_changed or chromium_url_changed or \ + chromium_rev_changed or cef_url_changed or cef_rev_changed +if not any_changed: + sys.stdout.write("No changes.\n") + +if release_url_changed or chromium_url_changed or options.forceconfig: + if release_url is None: + url = chromium_url + else: + url = release_url + + # run gclient config to create the .gclient file + run('gclient config '+url, chromium_dir, depot_tools_dir) + + path = os.path.join(chromium_dir, '.gclient') + if not os.path.exists(path): + sys.stderr.write(".gclient file was not created\n") + raise Exception('.gclient file was not created') + + # read the resulting .gclient file + fp = open(path, 'r') + data = fp.read() + fp.close() + + custom_deps = \ + "\n "+'"src/third_party/WebKit/LayoutTests": None,'+\ + "\n "+'"src/chrome_frame/tools/test/reference_build/chrome": None,'+\ + "\n "+'"src/chrome/tools/test/reference_build/chrome_mac": None,'+\ + "\n "+'"src/chrome/tools/test/reference_build/chrome_win": None,'+\ + "\n "+'"src/chrome/tools/test/reference_build/chrome_linux": None,' + + if not release_url is None: + # TODO: Read the DEPS file and exclude all non-src directories. + custom_deps += \ + "\n "+'"chromeos": None,'+\ + "\n "+'"depot_tools": None,' + + # populate "custom_deps" section + data = data.replace('"custom_deps" : {', '"custom_deps" : {'+custom_deps) + + # write the new .gclient file + fp = open(path, 'w') + fp.write(data) + fp.close() + +if options.forceclean: + if os.path.exists(chromium_src_dir): + # revert all Chromium changes and delete all unversioned files + run('gclient revert -n', chromium_dir, depot_tools_dir) + + # force update, build and distrib steps + options.forceupdate = True + options.forcebuild = True + options.forcedistrib = True + +if release_url is None: + if chromium_url_changed or chromium_rev_changed or options.forceupdate: + # download/update the Chromium source code + run('gclient sync --revision src@'+chromium_rev+' --jobs 8 --force', \ + chromium_dir, depot_tools_dir) +elif release_url_changed or options.forceupdate: + # download/update the release source code + run('gclient sync --jobs 8 --force', chromium_dir, depot_tools_dir) + +if not os.path.exists(cef_src_dir) or cef_url_changed: + if cef_url_changed and os.path.exists(cef_src_dir): + # delete the cef directory (it will be re-downloaded) + shutil.rmtree(cef_src_dir) + + # download the CEF source code + run('svn checkout '+cef_url+' -r '+cef_rev+' '+cef_src_dir, download_dir) +elif cef_rev_changed or options.forceupdate: + # update the CEF source code + run('svn update -r '+cef_rev+' '+cef_src_dir, download_dir) + +if any_changed or options.forceupdate: + # create CEF projects + path = os.path.join(cef_src_dir, 'cef_create_projects'+script_ext) + run(path, cef_src_dir, depot_tools_dir) + +if any_changed or options.forcebuild: + path = os.path.join(cef_tools_dir, 'build_projects'+script_ext) + + if not options.nodebugbuild: + # make CEF Debug build + run(path+' Debug', cef_tools_dir, depot_tools_dir) + + if not options.noreleasebuild: + # make CEF Release build + run(path+' Release', cef_tools_dir, depot_tools_dir) + +if any_changed or options.forcedistrib: + if not options.nodistrib: + # make CEF binary distribution + path = os.path.join(cef_tools_dir, 'make_distrib'+script_ext) + run(path, cef_tools_dir, depot_tools_dir) diff --git a/tools/build_projects.bat b/tools/build_projects.bat new file mode 100644 index 000000000..6c0739eca --- /dev/null +++ b/tools/build_projects.bat @@ -0,0 +1,45 @@ +@echo off +set RC= +setlocal + +if "%1" == "" ( +echo ERROR: Please specify a build target: Debug or Release +set ERRORLEVEL=1 +goto end +) + +if "%2" == "" ( +set PROJECT_NAME=cefclient +) else ( +set PROJECT_NAME=%2 +) + +echo Configuring Visual Studio environment... +if "%GYP_MSVS_VERSION%" == "2008" ( +call "%VS90COMNTOOLS%vsvars32.bat" +set PROJECT_EXT=.vcproj +) else ( +call "%VS100COMNTOOLS%vsvars32.bat" +set PROJECT_EXT=.vcxproj +) + +if exist "%DevEnvDir%\devenv.com" ( +echo Building %1 target for %PROJECT_NAME% project... +"%DevEnvDir%\devenv.com" /build %1 ..\cef.sln /project %PROJECT_NAME%%PROJECT_EXT% +) else if exist "%VCINSTALLDIR%\vcpackages\vcbuild.exe" ( +echo Building %1 target for all projects... +"%VCINSTALLDIR%\vcpackages\vcbuild.exe" ..\cef.sln "%1|Win32" +) else ( +echo ERROR: Cannot find Visual Studio builder +set ERRORLEVEL=1 +) + +:end +endlocal & set RC=%ERRORLEVEL% +goto omega + +:returncode +exit /B %RC% + +:omega +call :returncode %RC% diff --git a/tools/build_projects.sh b/tools/build_projects.sh new file mode 100755 index 000000000..73dbad4fb --- /dev/null +++ b/tools/build_projects.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "ERROR: Please specify a build target: Debug or Release" +else + if [ -z "$2" ]; then + PROJECT_NAME='cefclient' + else + PROJECT_NAME=$2 + fi + if [ `uname` = "Linux" ]; then + pushd ../../ + make BUILDTYPE=$1 -j 16 + popd + else + xcodebuild -project ../cef.xcodeproj -configuration $1 -target "$PROJECT_NAME" + fi +fi diff --git a/tools/cef_parser.py b/tools/cef_parser.py new file mode 100644 index 000000000..4bc3a7940 --- /dev/null +++ b/tools/cef_parser.py @@ -0,0 +1,1850 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +from date_util import * +from file_util import * +import os +import re +import shutil +import string +import sys +import textwrap +import time + + +def notify(msg): + """ Display a message. """ + sys.stdout.write(' NOTE: '+msg+'\n') + +def wrap_text(text, indent = '', maxchars = 80): + """ Wrap the text to the specified number of characters. If + necessary a line will be broken and wrapped after a word. + """ + result = '' + lines = textwrap.wrap(text, maxchars - len(indent)) + for line in lines: + result += indent+line+'\n' + return result + +def wrap_code(code, indent = ' ', maxchars = 80, splitchars = '(=,'): + """ Wrap the code lines to the specified number of characters. If + necessary a line will be broken and wrapped after one of the split + characters. + """ + output = '' + + # normalize line endings + code = code.replace("\r\n", "\n") + + # break the code chunk into lines + lines = string.split(code, '\n') + for line in lines: + if len(line) <= maxchars: + # line is short enough that it doesn't need to be wrapped + output += line + '\n' + continue + + # retrieve the whitespace at the beginning of the line for later use + # as padding + ws = '' + for char in line: + if char.isspace(): + ws += char + else: + break + + # iterate over all characters in the string keeping track of where the + # last valid break character was found and wrapping the line + # accordingly + lastsplit = 0 + nextsplit = -1 + splitct = 0 + pos = 0 + for char in line: + if splitchars.find(char) >= 0: + # a new split position has been found + nextsplit = pos + size = pos - lastsplit + 1 + if splitct > 0: + size += len(ws) + len(indent) + if size >= maxchars: + # the line is too long + section = line[lastsplit:nextsplit+1] + if len(section) > 0: + # output the line portion between the last split and the + # next split + if splitct > 0: + # start a new line and trim the line section + output += '\n'+ws+indent + section = string.strip(section) + output += section + lastsplit = nextsplit + 1 + splitct += 1 + pos += 1 + if len(line) - lastsplit > 0: + # output the remainder of the line + section = line[lastsplit:] + if splitct > 0: + # start a new line and trim the line section + output += '\n'+ws+indent + section = string.strip(section) + output += section + output += '\n' + + return output + +def get_capi_file_name(cppname): + """ Convert a C++ header file name to a C API header file name. """ + return cppname[:-2]+'_capi.h' + +def get_capi_name(cppname, isclassname, prefix = None): + """ Convert a C++ CamelCaps name to a C API underscore name. """ + result = '' + lastchr = '' + for chr in cppname: + # add an underscore if the current character is an upper case letter + # and the last character was a lower case letter + if len(result) > 0 and not chr.isdigit() \ + and string.upper(chr) == chr \ + and not string.upper(lastchr) == lastchr: + result += '_' + result += string.lower(chr) + lastchr = chr + + if isclassname: + result += '_t' + + if not prefix is None: + if prefix[0:3] == 'cef': + # if the prefix name is duplicated in the function name + # remove that portion of the function name + subprefix = prefix[3:] + pos = result.find(subprefix) + if pos >= 0: + result = result[0:pos]+ result[pos+len(subprefix):] + result = prefix+'_'+result + + return result + +def get_prev_line(body, pos): + """ Retrieve the start and end positions and value for the line immediately + before the line containing the specified position. + """ + end = string.rfind(body, '\n', 0, pos) + start = body.rfind('\n', 0, end)+1 + line = body[start:end] + return { 'start' : start, 'end' : end, 'line' : line } + +def get_comment(body, name): + """ Retrieve the comment for a class or function. """ + result = [] + + pos = body.find(name) + while pos > 0: + data = get_prev_line(body, pos) + line = string.strip(data['line']) + pos = data['start'] + if len(line) == 0: + # check if the next previous line is a comment + prevdata = get_prev_line(body, pos) + if string.strip(prevdata['line'])[0:2] == '//': + result.append(None) + else: + break + elif line[0:2] == '/*' or line[-2:] == '*/': + continue + elif line[0:2] == '//': + # keep the comment line including any leading spaces + result.append(line[2:]) + else: + break + + result.reverse() + return result + +def format_comment(comment, indent, translate_map = None, maxchars = 80): + """ Return the comments array as a formatted string. """ + result = '' + wrapme = '' + hasemptyline = False + for line in comment: + # if the line starts with a leading space, remove that space + if not line is None and len(line) > 0 and line[0:1] == ' ': + line = line[1:] + didremovespace = True + else: + didremovespace = False + + if line is None or len(line) == 0 or line[0:1] == ' ' \ + or line[0:1] == '/': + # the previous paragraph, if any, has ended + if len(wrapme) > 0: + if not translate_map is None: + # apply the translation + for key in translate_map.keys(): + wrapme = wrapme.replace(key, translate_map[key]) + # output the previous paragraph + result += wrap_text(wrapme, indent+'// ', maxchars) + wrapme = '' + + if not line is None: + if len(line) == 0 or line[0:1] == ' ' or line[0:1] == '/': + # blank lines or anything that's further indented should be + # output as-is + result += indent+'//' + if len(line) > 0: + if didremovespace: + result += ' '+line + else: + result += line + result += '\n' + else: + # add to the current paragraph + wrapme += line+' ' + else: + # output an empty line + hasemptyline = True + result += '\n' + + if len(wrapme) > 0: + if not translate_map is None: + # apply the translation + for key in translate_map.keys(): + wrapme = wrapme.replace(key, translate_map[key]) + # output the previous paragraph + result += wrap_text(wrapme, indent+'// ', maxchars) + + if hasemptyline: + # an empty line means a break between comments, so the comment is + # probably a section heading and should have an extra line before it + result = '\n' + result + return result + +def format_translation_changes(old, new): + """ Return a comment stating what is different between the old and new + function prototype parts. + """ + changed = False + result = '' + + # normalize C API attributes + oldargs = [x.replace('struct _', '') for x in old['args']] + oldretval = old['retval'].replace('struct _', '') + newargs = [x.replace('struct _', '') for x in new['args']] + newretval = new['retval'].replace('struct _', '') + + # check if the prototype has changed + oldset = set(oldargs) + newset = set(newargs) + if len(oldset.symmetric_difference(newset)) > 0: + changed = True + result += '\n // WARNING - CHANGED ATTRIBUTES' + + # in the implementation set only + oldonly = oldset.difference(newset) + for arg in oldonly: + result += '\n // REMOVED: '+arg + + # in the current set only + newonly = newset.difference(oldset) + for arg in newonly: + result += '\n // ADDED: '+arg + + # check if the return value has changed + if oldretval != newretval: + changed = True + result += '\n // WARNING - CHANGED RETURN VALUE'+ \ + '\n // WAS: '+old['retval']+ \ + '\n // NOW: '+new['retval'] + + if changed: + result += '\n #pragma message("Warning: "__FILE__": '+new['name']+ \ + ' prototype has changed")\n' + + return result + +def format_translation_includes(body): + """ Return the necessary list of includes based on the contents of the + body. + """ + result = '' + + if body.find('cef_build_revision()') > 0: + result += '#include "include/cef_version.h"\n' + + # identify what CppToC classes are being used + p = re.compile('([A-Za-z0-9_]{1,})CppToC') + list = sorted(set(p.findall(body))) + for item in list: + result += '#include "libcef_dll/cpptoc/'+ \ + get_capi_name(item[3:], False)+'_cpptoc.h"\n' + + # identify what CToCpp classes are being used + p = re.compile('([A-Za-z0-9_]{1,})CToCpp') + list = sorted(set(p.findall(body))) + for item in list: + result += '#include "libcef_dll/ctocpp/'+ \ + get_capi_name(item[3:], False)+'_ctocpp.h"\n' + + if body.find('transfer_') > 0: + result += '#include "libcef_dll/transfer_util.h"\n' + + return result + +def str_to_dict(str): + """ Convert a string to a dictionary. If the same key has multiple values + the values will be stored in a list. """ + dict = {} + parts = string.split(str, ',') + for part in parts: + part = string.strip(part) + if len(part) == 0: + continue + sparts = string.split(part, '=') + if len(sparts) > 2: + raise Exception('Invalid dictionary pair format: '+part) + name = string.strip(sparts[0]) + if len(sparts) == 2: + val = string.strip(sparts[1]) + else: + val = True + if name in dict: + # a value with this name already exists + curval = dict[name] + if not isinstance(curval, list): + # convert the string value to a list + dict[name] = [curval] + dict[name].append(val) + else: + dict[name] = val + return dict + +def dict_to_str(dict): + """ Convert a dictionary to a string. """ + str = [] + for name in dict.keys(): + if not isinstance(dict[name], list): + if dict[name] is True: + # currently a bool value + str.append(name) + else: + # currently a string value + str.append(name+'='+dict[name]) + else: + # currently a list value + for val in dict[name]: + str.append(name+'='+val) + return string.join(str, ',') + + +# regex for matching comment-formatted attributes +_cre_attrib = '/\*--cef\(([A-Za-z0-9_ ,=:\n]{0,})\)--\*/' +# regex for matching class and function names +_cre_cfname = '([A-Za-z0-9_]{1,})' +# regex for matching function return values +_cre_retval = '([A-Za-z0-9_<>:,\*\&]{1,})' +# regex for matching typedef value and name combination +_cre_typedef = '([A-Za-z0-9_<>:,\*\& ]{1,})' +# regex for matching function return value and name combination +_cre_func = '([A-Za-z][A-Za-z0-9_<>:,\*\& ]{1,})' +# regex for matching virtual function modifiers +_cre_vfmod = '([A-Za-z0-9_]{0,})' +# regex for matching arbitrary whitespace +_cre_space = '[\s]{1,}' + +# Simple translation types. Format is: +# 'cpp_type' : ['capi_type', 'capi_default_value'] +_simpletypes = { + 'void' : ['void', ''], + 'void*' : ['void*', 'NULL'], + 'int' : ['int', '0'], + 'int32' : ['int32', '0'], + 'uint32' : ['uint32', '0'], + 'int64' : ['int64', '0'], + 'uint64' : ['uint64', '0'], + 'double' : ['double', '0'], + 'long' : ['long', '0'], + 'unsigned long' : ['unsigned long', '0'], + 'long long' : ['long long', '0'], + 'size_t' : ['size_t', '0'], + 'time_t' : ['time_t', '0'], + 'bool' : ['int', '0'], + 'char* const': ['char* const', 'NULL'], + 'CefCursorHandle' : ['cef_cursor_handle_t', 'NULL'], + 'CefEventHandle' : ['cef_event_handle_t', 'NULL'], + 'CefWindowHandle' : ['cef_window_handle_t', 'NULL'], + 'CefRect' : ['cef_rect_t', 'CefRect()'], + 'CefThreadId' : ['cef_thread_id_t', 'TID_UI'], + 'CefTime' : ['cef_time_t', 'CefTime()'], +} + +def get_function_impls(content, ident): + """ Retrieve the function parts from the specified contents as a set of + return value, name, arguments and body. Ident must occur somewhere in + the value. + """ + # extract the functions + p = re.compile('\n'+_cre_func+'\((.*?)\)([A-Za-z0-9_\s]{0,})'+ + '\{(.*?)\n\}', + re.MULTILINE | re.DOTALL) + list = p.findall(content) + + # build the function map with the function name as the key + result = [] + for retval, argval, vfmod, body in list: + if retval.find(ident) < 0: + # the identifier was not found + continue + + # remove the identifier + retval = string.replace(retval, ident, '') + retval = string.strip(retval) + + # retrieve the function name + parts = string.split(retval, ' ') + name = parts[-1] + del parts[-1] + retval = string.join(parts, ' ') + + # parse the arguments + args = [] + for v in string.split(argval, ','): + v = string.strip(v) + if len(v) > 0: + args.append(v) + + result.append({ + 'retval' : string.strip(retval), + 'name' : name, + 'args' : args, + 'vfmod' : string.strip(vfmod), + 'body' : body + }) + + return result + +def get_next_function_impl(existing, name): + result = None + for item in existing: + if item['name'] == name: + result = item + existing.remove(item) + break + return result + +def get_copyright(): + result = \ +"""// Copyright (c) $YEAR$ The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool. If making changes by +// hand only do so within the body of existing method and function +// implementations. See the translator.README.txt file in the tools directory +// for more information. +// + +""" + # add the copyright year + return result.replace('$YEAR$', get_year()) + + +class obj_header: + """ Class representing a C++ header file. """ + + def __init__(self): + self.filenames = [] + self.typedefs = [] + self.funcs = [] + self.classes = [] + + def add_directory(self, directory): + """ Add all header files from the specified directory. """ + files = get_files(os.path.join(directory, '*.h')) + for file in files: + self.add_file(file) + + def add_file(self, filepath): + """ Add a header file. """ + + filename = os.path.split(filepath)[1] + added = False + + # read the input file into memory + data = read_file(filepath) + + # remove space from between template definition end brackets + data = data.replace("> >", ">>") + + # extract global typedefs + p = re.compile('\ntypedef'+_cre_space+_cre_typedef+';', + re.MULTILINE | re.DOTALL) + list = p.findall(data) + if len(list) > 0: + # build the global typedef objects + for value in list: + pos = value.rfind(' ') + if pos < 0: + raise Exception('Invalid typedef: '+value) + alias = value[pos+1:] + value = value[:pos] + self.typedefs.append(obj_typedef(self, filename, value, alias)) + + # extract global functions + p = re.compile('\n'+_cre_attrib+'\n'+_cre_func+'\((.*?)\)', + re.MULTILINE | re.DOTALL) + list = p.findall(data) + if len(list) > 0: + added = True + + # build the global function objects + for attrib, retval, argval in list: + comment = get_comment(data, retval+'('+argval+');') + self.funcs.append(obj_function(self, filename, attrib, retval, + argval, comment)) + + # extract forward declarations + p = re.compile('\nclass'+_cre_space+_cre_cfname+';') + forward_declares = p.findall(data) + + # extract classes + p = re.compile('\n'+_cre_attrib+ + '\nclass'+_cre_space+_cre_cfname+_cre_space+ + ':'+_cre_space+'public'+_cre_space+'virtual'+ + _cre_space+'CefBase'+_cre_space+ + '{(.*?)};', re.MULTILINE | re.DOTALL) + list = p.findall(data) + if len(list) > 0: + added = True + + # build the class objects + for attrib, name, body in list: + comment = get_comment(data, name+' : public virtual CefBase') + self.classes.append( + obj_class(self, filename, attrib, name, body, comment, + forward_declares)) + + if added: + # a global function or class was read from the header file + self.filenames.append(filename) + + def __repr__(self): + result = '' + + if len(self.typedefs) > 0: + strlist = [] + for cls in self.typedefs: + strlist.append(str(cls)) + result += string.join(strlist, "\n") + "\n\n" + + if len(self.funcs) > 0: + strlist = [] + for cls in self.funcs: + strlist.append(str(cls)) + result += string.join(strlist, "\n") + "\n\n" + + if len(self.classes) > 0: + strlist = [] + for cls in self.classes: + strlist.append(str(cls)) + result += string.join(strlist, "\n") + + return result + + def get_file_names(self): + """ Return the array of header file names. """ + return self.filenames + + def get_typedefs(self): + """ Return the array of typedef objects. """ + return self.typedefs + + def get_funcs(self, filename = None): + """ Return the array of function objects. """ + if filename is None: + return self.funcs + else: + # only return the functions in the specified file + res = [] + for func in self.funcs: + if func.get_file_name() == filename: + res.append(func) + return res + + def get_classes(self, filename = None): + """ Return the array of class objects. """ + if filename is None: + return self.classes + else: + # only return the classes in the specified file + res = [] + for cls in self.classes: + if cls.get_file_name() == filename: + res.append(cls) + return res + + def get_class(self, classname, defined_structs = None): + """ Return the specified class or None if not found. """ + for cls in self.classes: + if cls.get_name() == classname: + return cls + elif not defined_structs is None: + defined_structs.append(cls.get_capi_name()) + return None + + def get_class_names(self): + """ Returns the names of all classes in this object. """ + result = [] + for cls in self.classes: + result.append(cls.get_name()) + return result + + def get_types(self, list): + """ Return a dictionary mapping data types to analyzed values. """ + for cls in self.typedefs: + cls.get_types(list) + + for cls in self.classes: + cls.get_types(list) + + def get_alias_translation(self, alias): + """ Return a translation of alias to value based on typedef + statements. """ + for cls in self.typedefs: + if cls.alias == alias: + return cls.value + return None + + def get_analysis(self, value, named = True): + """ Return an analysis of the value based the header file context. """ + return obj_analysis([self], value, named) + + def get_defined_structs(self): + """ Return a list of names already defined structure names. """ + return ['cef_print_info_t', 'cef_window_info_t', 'cef_base_t'] + + def get_capi_translations(self): + """ Return a dictionary that maps C++ terminology to C API terminology. + """ + # strings that will be changed in C++ comments + map = { + 'class' : 'structure', + 'Class' : 'Structure', + 'interface' : 'structure', + 'Interface' : 'Structure', + 'true' : 'true (1)', + 'false' : 'false (0)', + 'empty' : 'NULL', + 'method' : 'function' + } + + # add mappings for all classes and functions + funcs = self.get_funcs() + for func in funcs: + map[func.get_name()+'()'] = func.get_capi_name()+'()' + + classes = self.get_classes() + for cls in classes: + map[cls.get_name()] = cls.get_capi_name() + + funcs = cls.get_virtual_funcs() + for func in funcs: + map[func.get_name()+'()'] = func.get_capi_name()+'()' + + funcs = cls.get_static_funcs() + for func in funcs: + map[func.get_name()+'()'] = func.get_capi_name()+'()' + + return map + + +class obj_class: + """ Class representing a C++ class. """ + + def __init__(self, parent, filename, attrib, name, body, comment, + forward_declares): + if not isinstance(parent, obj_header): + raise Exception('Invalid parent object type') + + self.parent = parent + self.filename = filename + self.attribs = str_to_dict(attrib) + self.name = name + self.comment = comment + self.forward_declares = forward_declares + + # extract typedefs + p = re.compile('\n'+_cre_space+'typedef'+_cre_space+_cre_typedef+';', + re.MULTILINE | re.DOTALL) + list = p.findall(body) + + # build the typedef objects + self.typedefs = [] + for value in list: + pos = value.rfind(' ') + if pos < 0: + raise Exception('Invalid typedef: '+value) + alias = value[pos+1:] + value = value[:pos] + self.typedefs.append(obj_typedef(self, filename, value, alias)) + + # extract static functions + p = re.compile('\n'+_cre_space+_cre_attrib+'\n'+_cre_space+'static'+ + _cre_space+_cre_func+'\((.*?)\)', + re.MULTILINE | re.DOTALL) + list = p.findall(body) + + # build the static function objects + self.staticfuncs = [] + for attrib, retval, argval in list: + comment = get_comment(body, retval+'('+argval+')') + self.staticfuncs.append( + obj_function_static(self, attrib, retval, argval, comment)) + + # extract virtual functions + p = re.compile('\n'+_cre_space+_cre_attrib+'\n'+_cre_space+'virtual'+ + _cre_space+_cre_func+'\((.*?)\)'+_cre_space+_cre_vfmod, + re.MULTILINE | re.DOTALL) + list = p.findall(body) + + # build the virtual function objects + self.virtualfuncs = [] + for attrib, retval, argval, vfmod in list: + comment = get_comment(body, retval+'('+argval+')') + self.virtualfuncs.append( + obj_function_virtual(self, attrib, retval, argval, comment, + vfmod)) + + def __repr__(self): + result = '/* '+dict_to_str(self.attribs)+' */ class '+self.name+"\n{" + + if len(self.typedefs) > 0: + result += "\n\t" + strlist = [] + for cls in self.typedefs: + strlist.append(str(cls)) + result += string.join(strlist, "\n\t") + + if len(self.staticfuncs) > 0: + result += "\n\t" + strlist = [] + for cls in self.staticfuncs: + strlist.append(str(cls)) + result += string.join(strlist, "\n\t") + + if len(self.virtualfuncs) > 0: + result += "\n\t" + strlist = [] + for cls in self.virtualfuncs: + strlist.append(str(cls)) + result += string.join(strlist, "\n\t") + + result += "\n};\n" + return result + + def get_file_name(self): + """ Return the C++ header file name. """ + return self.filename + + def get_capi_file_name(self): + """ Return the CAPI header file name. """ + return get_capi_file_name(self.filename) + + def get_name(self): + """ Return the class name. """ + return self.name + + def get_capi_name(self): + """ Return the CAPI structure name for this class. """ + return get_capi_name(self.name, True) + + def get_comment(self): + """ Return the class comment as an array of lines. """ + return self.comment + + def get_forward_declares(self): + """ Return the list of classes that are forward declared for this + class. """ + return self.forward_declares + + def get_attribs(self): + """ Return all attributes as a dictionary. """ + return self.attribs + + def has_attrib(self, name): + """ Return true if the specified attribute exists. """ + return name in self.attribs + + def get_attrib(self, name): + """ Return the first or only value for specified attribute. """ + if name in self.attribs: + if isinstance(self.attribs[name], list): + # the value is a list + return self.attribs[name][0] + else: + # the value is a string + return self.attribs[name] + return None + + def get_attrib_list(self, name): + """ Return all values for specified attribute as a list. """ + if name in self.attribs: + if isinstance(self.attribs[name], list): + # the value is already a list + return self.attribs[name] + else: + # convert the value to a list + return [self.attribs[name]] + return None + + def get_typedefs(self): + """ Return the array of typedef objects. """ + return self.typedefs + + def has_typedef_alias(self, alias): + """ Returns true if the specified typedef alias is defined in the scope + of this class declaration. """ + for typedef in self.typedefs: + if typedef.get_alias() == alias: + return True + return False + + def get_static_funcs(self): + """ Return the array of static function objects. """ + return self.staticfuncs + + def get_virtual_funcs(self): + """ Return the array of virtual function objects. """ + return self.virtualfuncs + + def get_types(self, list): + """ Return a dictionary mapping data types to analyzed values. """ + for cls in self.typedefs: + cls.get_types(list) + + for cls in self.staticfuncs: + cls.get_types(list) + + for cls in self.virtualfuncs: + cls.get_types(list) + + def get_alias_translation(self, alias): + for cls in self.typedefs: + if cls.alias == alias: + return cls.value + return None + + def get_analysis(self, value, named = True): + """ Return an analysis of the value based on the class definition + context. + """ + return obj_analysis([self, self.parent], value, named) + + def is_library_side(self): + """ Returns true if the class is implemented by the library. """ + return self.attribs['source'] == 'library' + + def is_client_side(self): + """ Returns true if the class is implemented by the client. """ + return self.attribs['source'] == 'client' + + +class obj_typedef: + """ Class representing a typedef statement. """ + + def __init__(self, parent, filename, value, alias): + if not isinstance(parent, obj_header) \ + and not isinstance(parent, obj_class): + raise Exception('Invalid parent object type') + + self.parent = parent + self.filename = filename + self.alias = alias + self.value = self.parent.get_analysis(value, False) + + def __repr__(self): + return 'typedef '+self.value.get_type()+' '+self.alias+';' + + def get_file_name(self): + """ Return the C++ header file name. """ + return self.filename + + def get_capi_file_name(self): + """ Return the CAPI header file name. """ + return get_capi_file_name(self.filename) + + def get_alias(self): + """ Return the alias. """ + return self.alias + + def get_value(self): + """ Return an analysis of the value based on the class or header file + definition context. + """ + return self.value + + def get_types(self, list): + """ Return a dictionary mapping data types to analyzed values. """ + name = self.value.get_type() + if not name in list: + list[name] = self.value + + +class obj_function: + """ Class representing a function. """ + + def __init__(self, parent, filename, attrib, retval, argval, comment): + self.parent = parent + self.filename = filename + self.attribs = str_to_dict(attrib) + self.retval = obj_argument(self, retval) + self.name = self.retval.remove_name() + self.comment = comment + + # build the argument objects + self.arguments = [] + arglist = string.split(argval, ',') + for arg in arglist: + arg = string.strip(arg) + if len(arg) > 0: + argument = obj_argument(self, arg) + if argument.needs_attrib_count_func() and \ + argument.get_attrib_count_func() is None: + raise Exception("A 'count_func' attribute is required "+ \ + "for the '"+argument.get_name()+ \ + "' parameter to "+self.get_qualified_name()) + self.arguments.append(argument) + + if self.retval.needs_attrib_default_retval() and \ + self.retval.get_attrib_default_retval() is None: + raise Exception("A 'default_retval' attribute is required for "+ \ + self.get_qualified_name()) + + def __repr__(self): + return '/* '+dict_to_str(self.attribs)+' */ '+self.get_cpp_proto() + + def get_file_name(self): + """ Return the C++ header file name. """ + return self.filename + + def get_capi_file_name(self): + """ Return the CAPI header file name. """ + return get_capi_file_name(self.filename) + + def get_name(self): + """ Return the function name. """ + return self.name + + def get_qualified_name(self): + """ Return the fully qualified function name. """ + if isinstance(self.parent, obj_header): + # global function + return self.name + else: + # member function + return self.parent.get_name()+'::'+self.name + + def get_capi_name(self, prefix = None): + """ Return the CAPI function name. """ + if 'capi_name' in self.attribs: + return self.attribs['capi_name'] + return get_capi_name(self.name, False, prefix) + + def get_comment(self): + """ Return the function comment as an array of lines. """ + return self.comment + + def get_attribs(self): + """ Return all attributes as a dictionary. """ + return self.attribs + + def has_attrib(self, name): + """ Return true if the specified attribute exists. """ + return name in self.attribs + + def get_attrib(self, name): + """ Return the first or only value for specified attribute. """ + if name in self.attribs: + if isinstance(self.attribs[name], list): + # the value is a list + return self.attribs[name][0] + else: + # the value is a string + return self.attribs[name] + return None + + def get_attrib_list(self, name): + """ Return all values for specified attribute as a list. """ + if name in self.attribs: + if isinstance(self.attribs[name], list): + # the value is already a list + return self.attribs[name] + else: + # convert the value to a list + return [self.attribs[name]] + return None + + def get_retval(self): + """ Return the return value object. """ + return self.retval + + def get_arguments(self): + """ Return the argument array. """ + return self.arguments + + def get_types(self, list): + """ Return a dictionary mapping data types to analyzed values. """ + for cls in self.arguments: + cls.get_types(list) + + def get_capi_parts(self, defined_structs = [], prefix = None): + """ Return the parts of the C API function definition. """ + retval = '' + dict = self.retval.get_type().get_capi(defined_structs) + if dict['format'] == 'single': + retval = dict['value'] + + name = self.get_capi_name(prefix) + args = [] + + if isinstance(self, obj_function_virtual): + # virtual functions get themselves as the first argument + str = 'struct _'+self.parent.get_capi_name()+'* self' + if isinstance(self, obj_function_virtual) and self.is_const(): + # const virtual functions get const self pointers + str = 'const '+str + args.append(str) + + if len(self.arguments) > 0: + for cls in self.arguments: + type = cls.get_type() + dict = type.get_capi(defined_structs) + if dict['format'] == 'single': + args.append(dict['value']) + elif dict['format'] == 'multi-arg': + # add an additional argument for the size of the array + type_name = type.get_name() + if type.is_const(): + # for const arrays pass the size argument by value + args.append('size_t '+type_name+'Count') + else: + # for non-const arrays pass the size argument by address + args.append('size_t* '+type_name+'Count') + args.append(dict['value']) + + return { 'retval' : retval, 'name' : name, 'args' : args } + + def get_capi_proto(self, defined_structs = [], prefix = None): + """ Return the prototype of the C API function. """ + parts = self.get_capi_parts(defined_structs, prefix) + result = parts['retval']+' '+parts['name']+ \ + '('+string.join(parts['args'], ', ')+')' + return result + + def get_cpp_parts(self, isimpl = False): + """ Return the parts of the C++ function definition. """ + retval = str(self.retval) + name = self.name + + args = [] + if len(self.arguments) > 0: + for cls in self.arguments: + args.append(str(cls)) + + if isimpl and isinstance(self, obj_function_virtual): + # enumeration return values must be qualified with the class name + # if the type is defined in the class declaration scope. + type = self.get_retval().get_type() + if type.is_result_struct() and type.is_result_struct_enum() and \ + self.parent.has_typedef_alias(retval): + retval = self.parent.get_name()+'::'+retval + + return { 'retval' : retval, 'name' : name, 'args' : args } + + def get_cpp_proto(self, classname = None): + """ Return the prototype of the C++ function. """ + parts = self.get_cpp_parts() + result = parts['retval']+' ' + if not classname is None: + result += classname+'::' + result += parts['name']+'('+string.join(parts['args'], ', ')+')' + if isinstance(self, obj_function_virtual) and self.is_const(): + result += ' const' + return result + + def is_same_side(self, other_class_name): + """ Returns true if this function is on the same side (library or + client) and the specified class. """ + if isinstance(self.parent, obj_class): + # this function is part of a class + this_is_library_side = self.parent.is_library_side() + header = self.parent.parent + else: + # this function is global + this_is_library_side = True + header = self.parent + + if other_class_name == 'CefBase': + other_is_library_side = False + else: + other_class = header.get_class(other_class_name) + if other_class is None: + raise Exception('Unknown class: '+other_class_name) + other_is_library_side = other_class.is_library_side() + + return other_is_library_side == this_is_library_side + + +class obj_function_static(obj_function): + """ Class representing a static function. """ + + def __init__(self, parent, attrib, retval, argval, comment): + if not isinstance(parent, obj_class): + raise Exception('Invalid parent object type') + obj_function.__init__(self, parent, parent.filename, attrib, retval, + argval, comment) + + def __repr__(self): + return 'static '+obj_function.__repr__(self)+';' + + def get_capi_name(self, prefix = None): + """ Return the CAPI function name. """ + if prefix is None: + # by default static functions are prefixed with the class name + prefix = get_capi_name(self.parent.get_name(), False) + return obj_function.get_capi_name(self, prefix) + +class obj_function_virtual(obj_function): + """ Class representing a virtual function. """ + + def __init__(self, parent, attrib, retval, argval, comment, vfmod): + if not isinstance(parent, obj_class): + raise Exception('Invalid parent object type') + obj_function.__init__(self, parent, parent.filename, attrib, retval, + argval, comment) + if vfmod == 'const': + self.isconst = True + else: + self.isconst = False + + def __repr__(self): + return 'virtual '+obj_function.__repr__(self)+';' + + def is_const(self): + """ Returns true if the method declaration is const. """ + return self.isconst + + +class obj_argument: + """ Class representing a function argument. """ + + def __init__(self, parent, argval): + if not isinstance(parent, obj_function): + raise Exception('Invalid parent object type') + + self.parent = parent + self.type = self.parent.parent.get_analysis(argval) + + def __repr__(self): + result = '' + if self.type.is_const(): + result += 'const ' + result += self.type.get_type() + if self.type.is_byref(): + result += '&' + elif self.type.is_byaddr(): + result += '*' + if self.type.has_name(): + result += ' '+self.type.get_name() + return result + + def get_name(self): + """ Return the name for this argument. """ + return self.type.get_name() + + def remove_name(self): + """ Remove and return the name value. """ + name = self.type.get_name() + self.type.name = None + return name + + def get_type(self): + """ Return an analysis of the argument type based on the class + definition context. + """ + return self.type + + def get_types(self, list): + """ Return a dictionary mapping data types to analyzed values. """ + name = self.type.get_type() + if not name in list: + list[name] = self.type + + def needs_attrib_count_func(self): + """ Returns true if this argument requires a 'count_func' attribute. """ + # A 'count_func' attribute is required for non-const non-string vector + # attribute types + return self.type.has_name() and \ + self.type.is_result_vector() and \ + not self.type.is_result_vector_string() and \ + not self.type.is_const() + + def get_attrib_count_func(self): + """ Returns the count function for this argument. """ + # The 'count_func' attribute value format is name:function + if not self.parent.has_attrib('count_func'): + return None + name = self.type.get_name() + vals = self.parent.get_attrib_list('count_func') + for val in vals: + parts = string.split(val, ':') + if len(parts) != 2: + raise Exception("Invalid 'count_func' attribute value for "+ \ + self.parent.get_qualified_name()+': '+val) + if string.strip(parts[0]) == name: + return string.strip(parts[1]) + return None + + def needs_attrib_default_retval(self): + """ Returns true if this argument requires a 'default_retval' attribute. + """ + # A 'default_retval' attribute is required for enumeration return value + # types. + return not self.type.has_name() and \ + self.type.is_result_struct() and \ + self.type.is_result_struct_enum() + + def get_attrib_default_retval(self): + """ Returns the defualt return value for this argument. """ + return self.parent.get_attrib('default_retval') + + def get_arg_type(self): + """ Returns the argument type as defined in translator.README.txt. """ + if not self.type.has_name(): + raise Exception('Cannot be called for retval types') + + # simple or enumeration type + if (self.type.is_result_simple() and \ + self.type.get_type() != 'bool') or \ + (self.type.is_result_struct() and \ + self.type.is_result_struct_enum()): + if self.type.is_byref(): + if self.type.is_const(): + return 'simple_byref_const' + return 'simple_byref' + elif self.type.is_byaddr(): + return 'simple_byaddr' + return 'simple_byval' + + # boolean type + if self.type.get_type() == 'bool': + if self.type.is_byref(): + return 'bool_byref' + elif self.type.is_byaddr(): + return 'bool_byaddr' + return 'bool_byval' + + # structure type + if self.type.is_result_struct() and self.type.is_byref(): + if self.type.is_const(): + return 'struct_byref_const' + return 'struct_byref' + + # string type + if self.type.is_result_string() and self.type.is_byref(): + if self.type.is_const(): + return 'string_byref_const' + return 'string_byref' + + # refptr type + if self.type.is_result_refptr(): + same_side = self.parent.is_same_side(self.type.get_refptr_type()) + if self.type.is_byref(): + if same_side: + return 'refptr_same_byref' + return 'refptr_diff_byref' + if same_side: + return 'refptr_same' + return 'refptr_diff' + + + if self.type.is_result_vector(): + # all vector types must be passed by reference + if not self.type.is_byref(): + return 'invalid' + + if self.type.is_result_vector_string(): + # string vector type + if self.type.is_const(): + return 'string_vec_byref_const' + return 'string_vec_byref' + + if self.type.is_result_vector_simple(): + if self.type.get_vector_type() != 'bool': + # simple/enumeration vector types + if self.type.is_const(): + return 'simple_vec_byref_const' + return 'simple_vec_byref' + + # boolean vector types + if self.type.is_const(): + return 'bool_vec_byref_const' + return 'bool_vec_byref' + + if self.type.is_result_vector_refptr(): + # refptr vector types + same_side = self.parent.is_same_side(self.type.get_refptr_type()) + if self.type.is_const(): + if same_side: + return 'refptr_vec_same_byref_const' + return 'refptr_vec_diff_byref_const' + if same_side: + return 'refptr_vec_same_byref' + return 'refptr_vec_diff_byref' + + + # string single map type + if self.type.is_result_map_single(): + if not self.type.is_byref(): + return 'invalid' + if self.type.is_const(): + return 'string_map_single_byref_const' + return 'string_map_single_byref' + + # string multi map type + if self.type.is_result_map_multi(): + if not self.type.is_byref(): + return 'invalid' + if self.type.is_const(): + return 'string_map_multi_byref_const' + return 'string_map_multi_byref' + + return 'invalid' + + def get_retval_type(self): + """ Returns the retval type as defined in translator.README.txt. """ + if self.type.has_name(): + raise Exception('Cannot be called for argument types') + + # unsupported modifiers + if self.type.is_const() or self.type.is_byref() or \ + self.type.is_byaddr(): + return 'invalid' + + # void types don't have a return value + if self.type.get_type() == 'void': + return 'none' + + if (self.type.is_result_simple() and \ + self.type.get_type() != 'bool') or \ + (self.type.is_result_struct() and self.type.is_result_struct_enum()): + return 'simple' + + if self.type.get_type() == 'bool': + return 'bool' + + if self.type.is_result_string(): + return 'string' + + if self.type.is_result_refptr(): + if self.parent.is_same_side(self.type.get_refptr_type()): + return 'refptr_same' + else: + return 'refptr_diff' + + return 'invalid' + + def get_retval_default(self, for_capi): + """ Returns the default return value based on the retval type. """ + # start with the default retval attribute, if any. + retval = self.get_attrib_default_retval() + if not retval is None: + if for_capi: + # apply any appropriate C API translations. + if retval == 'true': + return '1' + if retval == 'false': + return '0' + return retval + + # next look at the retval type value. + type = self.get_retval_type() + if type == 'simple': + return self.get_type().get_result_simple_default() + elif type == 'bool': + if for_capi: + return '0' + return 'false' + elif type == 'string': + if for_capi: + return 'NULL' + return 'CefString()' + elif type == 'refptr_same' or type == 'refptr_diff': + return 'NULL' + + return '' + +class obj_analysis: + """ Class representing an analysis of a data type value. """ + + def __init__(self, scopelist, value, named): + self.value = value + self.result_type = 'unknown' + self.result_value = None + self.result_default = None + self.refptr_type = None + + # parse the argument string + partlist = string.split(string.strip(value)) + + if named == True: + # extract the name value + self.name = partlist[-1] + del partlist[-1] + else: + self.name = None + + if len(partlist) == 0: + raise Exception('Invalid argument value: '+value) + + # check const status + if partlist[0] == 'const': + self.isconst = True + del partlist[0] + else: + self.isconst = False + + # combine the data type + self.type = string.join(partlist, ' ') + + # extract the last character of the data type + endchar = self.type[-1] + + # check if the value is passed by reference + if endchar == '&': + self.isbyref = True + self.type = self.type[:-1] + else: + self.isbyref = False + + # check if the value is passed by address + if endchar == '*': + self.isbyaddr = True + self.type = self.type[:-1] + else: + self.isbyaddr = False + + # see if the value is directly identifiable + if self._check_advanced(self.type) == True: + return + + # not identifiable, so look it up + translation = None + for scope in scopelist: + if not isinstance(scope, obj_header) \ + and not isinstance(scope, obj_class): + raise Exception('Invalid scope object type') + translation = scope.get_alias_translation(self.type) + if not translation is None: + break + + if translation is None: + raise Exception('Failed to translate type: '+self.type) + + # the translation succeeded so keep the result + self.result_type = translation.result_type + self.result_value = translation.result_value + + def _check_advanced(self, value): + # check for vectors + if value.find('std::vector') == 0: + self.result_type = 'vector' + val = string.strip(value[12:-1]) + self.result_value = [ + self._get_basic(val) + ] + self.result_value[0]['vector_type'] = val + return True + + # check for maps + if value.find('std::map') == 0: + self.result_type = 'map' + vals = string.split(value[9:-1], ',') + if len(vals) == 2: + self.result_value = [ + self._get_basic(string.strip(vals[0])), + self._get_basic(string.strip(vals[1])) + ] + return True + + # check for multimaps + if value.find('std::multimap') == 0: + self.result_type = 'multimap' + vals = string.split(value[14:-1], ',') + if len(vals) == 2: + self.result_value = [ + self._get_basic(string.strip(vals[0])), + self._get_basic(string.strip(vals[1])) + ] + return True + + # check for basic types + basic = self._get_basic(value) + if not basic is None: + self.result_type = basic['result_type'] + self.result_value = basic['result_value'] + if 'refptr_type' in basic: + self.refptr_type = basic['refptr_type'] + if 'result_default' in basic: + self.result_default = basic['result_default'] + return True + + return False + + def _get_basic(self, value): + # check for string values + if value == "CefString": + return { + 'result_type' : 'string', + 'result_value' : None + } + + # check for simple direct translations + if value in _simpletypes.keys(): + return { + 'result_type' : 'simple', + 'result_value' : _simpletypes[value][0], + 'result_default' : _simpletypes[value][1], + } + + # check if already a C API structure + if value[-2:] == '_t': + return { + 'result_type' : 'structure', + 'result_value' : value + } + + # check for CEF reference pointers + p = re.compile('^CefRefPtr<(.*?)>$', re.DOTALL) + list = p.findall(value) + if len(list) == 1: + return { + 'result_type' : 'refptr', + 'result_value' : get_capi_name(list[0], True)+'*', + 'refptr_type' : list[0] + } + + # check for CEF structure types + if value[0:3] == 'Cef' and value[-4:] != 'List': + return { + 'result_type' : 'structure', + 'result_value' : get_capi_name(value, True) + } + + return None + + def __repr__(self): + return '('+self.result_type+') '+str(self.result_value) + + def has_name(self): + """ Returns true if a name value exists. """ + return (not self.name is None) + + def get_name(self): + """ Return the name. """ + return self.name + + def get_value(self): + """ Return the C++ value (type + name). """ + return self.value + + def get_type(self): + """ Return the C++ type. """ + return self.type + + def get_refptr_type(self): + """ Return the C++ class type referenced by a CefRefPtr. """ + if self.is_result_vector() and self.is_result_vector_refptr(): + # return the vector RefPtr type + return self.result_value[0]['refptr_type'] + # return the basic RefPtr type + return self.refptr_type + + def get_vector_type(self): + """ Return the C++ class type referenced by a std::vector. """ + if self.is_result_vector(): + return self.result_value[0]['vector_type'] + return None + + def is_const(self): + """ Returns true if the argument value is constant. """ + return self.isconst + + def is_byref(self): + """ Returns true if the argument is passed by reference. """ + return self.isbyref + + def is_byaddr(self): + """ Returns true if the argument is passed by address. """ + return self.isbyaddr + + def is_result_simple(self): + """ Returns true if this is a simple argument type. """ + return (self.result_type == 'simple') + + def get_result_simple_type_root(self): + """ Return the simple structure or basic type name. """ + return self.result_value + + def get_result_simple_type(self): + """ Return the simple type. """ + result = '' + if self.is_const(): + result += 'const ' + result += self.result_value + if self.is_byaddr() or self.is_byref(): + result += '*' + return result + + def get_result_simple_default(self): + """ Return the default value fo the basic type. """ + return self.result_default + + def is_result_refptr(self): + """ Returns true if this is a reference pointer type. """ + return (self.result_type == 'refptr') + + def get_result_refptr_type_root(self): + """ Return the refptr type structure name. """ + return self.result_value[:-1] + + def get_result_refptr_type(self, defined_structs = []): + """ Return the refptr type. """ + result = '' + if not self.result_value[:-1] in defined_structs: + result += 'struct _' + result += self.result_value + if self.is_byref() or self.is_byaddr(): + result += '*' + return result + + def is_result_struct(self): + """ Returns true if this is a structure type. """ + return (self.result_type == 'structure') + + def is_result_struct_enum(self): + """ Returns true if this struct type is likely an enumeration. """ + # structure values that are passed by reference or address must be + # structures and not enumerations + if not self.is_byref() and not self.is_byaddr(): + return True + return False + + def get_result_struct_type(self, defined_structs = []): + """ Return the structure or enumeration type. """ + result = '' + is_enum = self.is_result_struct_enum() + if not is_enum: + if self.is_const(): + result += 'const ' + if not self.result_value in defined_structs: + result += 'struct _' + else: + result += 'enum ' + result += self.result_value + if not is_enum: + result += '*' + return result + + def is_result_string(self): + """ Returns true if this is a string type. """ + return (self.result_type == 'string') + + def get_result_string_type(self): + """ Return the string type. """ + if not self.has_name(): + # Return values are string structs that the user must free. Use + # the name of the structure as a hint. + return 'cef_string_userfree_t' + elif not self.is_const() and (self.is_byref() or self.is_byaddr()): + # Parameters passed by reference or address. Use the normal + # non-const string struct. + return 'cef_string_t*' + # Const parameters use the const string struct. + return 'const cef_string_t*' + + def is_result_vector(self): + """ Returns true if this is a vector type. """ + return (self.result_type == 'vector') + + def is_result_vector_string(self): + """ Returns true if this is a string vector. """ + return self.result_value[0]['result_type'] == 'string' + + def is_result_vector_simple(self): + """ Returns true if this is a string vector. """ + return self.result_value[0]['result_type'] == 'simple' + + def is_result_vector_refptr(self): + """ Returns true if this is a string vector. """ + return self.result_value[0]['result_type'] == 'refptr' + + def get_result_vector_type_root(self): + """ Return the vector structure or basic type name. """ + return self.result_value[0]['result_value'] + + def get_result_vector_type(self, defined_structs = []): + """ Return the vector type. """ + if not self.has_name(): + raise Exception('Cannot use vector as a return type') + + type = self.result_value[0]['result_type'] + value = self.result_value[0]['result_value'] + + result = {} + if type == 'string': + result['value'] = 'cef_string_list_t' + result['format'] = 'single' + return result + + if type == 'simple': + str = value + if self.is_const(): + str += ' const' + str += '*' + result['value'] = str + elif type == 'refptr': + str = '' + if not value[:-1] in defined_structs: + str += 'struct _' + str += value + if self.is_const(): + str += ' const' + str += '*' + result['value'] = str + else: + raise Exception('Unsupported vector type: '+type) + + # vector values must be passed as a value array parameter + # and a size parameter + result['format'] = 'multi-arg' + return result + + def is_result_map(self): + """ Returns true if this is a map type. """ + return (self.result_type == 'map' or self.result_type == 'multimap') + + def is_result_map_single(self): + """ Returns true if this is a single map type. """ + return (self.result_type == 'map') + + def is_result_map_multi(self): + """ Returns true if this is a multi map type. """ + return (self.result_type == 'multimap') + + def get_result_map_type(self, defined_structs = []): + """ Return the map type. """ + if not self.has_name(): + raise Exception('Cannot use map as a return type') + if self.result_value[0]['result_type'] == 'string' \ + and self.result_value[1]['result_type'] == 'string': + if self.result_type == 'map': + return { + 'value' : 'cef_string_map_t', + 'format' : 'single' + } + elif self.result_type == 'multimap': + return { + 'value' : 'cef_string_multimap_t', + 'format' : 'multi' + } + raise Exception('Only mappings of strings to strings are supported') + + def get_capi(self, defined_structs = []): + """ Format the value for the C API. """ + result = '' + format = 'single' + if self.is_result_simple(): + result += self.get_result_simple_type() + elif self.is_result_refptr(): + result += self.get_result_refptr_type(defined_structs) + elif self.is_result_struct(): + result += self.get_result_struct_type(defined_structs) + elif self.is_result_string(): + result += self.get_result_string_type() + elif self.is_result_map(): + resdict = self.get_result_map_type(defined_structs) + if resdict['format'] == 'single' or resdict['format'] == 'multi': + result += resdict['value'] + else: + raise Exception('Unsupported map type') + elif self.is_result_vector(): + resdict = self.get_result_vector_type(defined_structs) + if resdict['format'] != 'single': + format = resdict['format'] + result += resdict['value'] + + if self.has_name(): + result += ' '+self.get_name() + + return {'format' : format, 'value' : result} + + +# test the module +if __name__ == "__main__": + import pprint + import sys + + # verify that the correct number of command-line arguments are provided + if len(sys.argv) != 2: + sys.stderr.write('Usage: '+sys.argv[0]+' ') + sys.exit() + + pp = pprint.PrettyPrinter(indent=4) + + # create the header object + header = obj_header() + header.add_directory(sys.argv[1]) + + # output the type mapping + types = {} + header.get_types(types) + pp.pprint(types) + sys.stdout.write('\n') + + # output the parsed C++ data + sys.stdout.write(wrap_code(str(header), '\t')) + + # output the C API formatted data + defined_names = header.get_defined_structs() + result = '' + + # global functions + funcs = header.get_funcs() + if len(funcs) > 0: + for func in funcs: + result += func.get_capi_proto(defined_names)+';\n' + result += '\n' + + classes = header.get_classes() + for cls in classes: + # virtual functions are inside a structure + result += 'struct '+cls.get_capi_name()+'\n{\n' + funcs = cls.get_virtual_funcs() + if len(funcs) > 0: + for func in funcs: + result += '\t'+func.get_capi_proto(defined_names)+';\n' + result += '}\n\n' + + defined_names.append(cls.get_capi_name()) + + # static functions become global + funcs = cls.get_static_funcs() + if len(funcs) > 0: + for func in funcs: + result += func.get_capi_proto(defined_names)+';\n' + result += '\n' + sys.stdout.write(wrap_code(result, '\t')) diff --git a/tools/cef_parser.pyc b/tools/cef_parser.pyc new file mode 100644 index 000000000..08306698f Binary files /dev/null and b/tools/cef_parser.pyc differ diff --git a/tools/check_revision.py b/tools/check_revision.py new file mode 100644 index 000000000..e9334dca2 --- /dev/null +++ b/tools/check_revision.py @@ -0,0 +1,87 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +from file_util import * +from optparse import OptionParser +from svn_util import * +import sys + +# cannot be loaded as a module +if __name__ != "__main__": + sys.stderr.write('This file cannot be loaded as a module!') + sys.exit() + + +# parse command-line options +disc = """ +This utility checks that the correct Chromium revision is being used. +""" + +parser = OptionParser(description=disc) +parser.add_option('-q', '--quiet', + action='store_true', dest='quiet', default=False, + help='do not output detailed status information') +(options, args) = parser.parse_args() + +# The CEF root directory is the parent directory of _this_ script. +cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + +# Retrieve the CEF SVN info. +cef_info = get_svn_info(cef_dir) +if not options.quiet: + sys.stdout.write('Using CEF revision '+cef_info['revision']+' @ '+\ + cef_info['url']+"\n") + +# Retrieve the Chromium SVN info. +src_dir = os.path.join(cef_dir, os.pardir) +chromium_info = get_svn_info(src_dir) +if not options.quiet: + sys.stdout.write('Using Chromium revision '+chromium_info['revision']+' @ '+\ + chromium_info['url']+"\n") + +# Parse the compatibility file contents. +compat_file = os.path.join(cef_dir, 'CHROMIUM_BUILD_COMPATIBILITY.txt') +config = eval(read_file(compat_file), {'__builtins__': None}, None) + +error = False + +if 'release_url' in config: + current_release_url = None + path = os.path.join(os.path.join(src_dir, os.pardir), '.gclient') + if os.path.exists(path): + # read the .gclient file + fp = open(path, 'r') + data = fp.read() + fp.close() + + # Parse the contents + config_dict = {} + try: + exec(data, config_dict) + current_release_url = config_dict['solutions'][0]['url'] + except Exception, e: + sys.stderr.write('Failed to parse existing .glient file.\n') + raise + + if not options.quiet: + sys.stdout.write('Using Chromium release '+current_release_url+"\n") + + if current_release_url != config['release_url']: + error = True + sys.stderr.write("\nWARNING: Incorrect Chromium release URL; found "+\ + current_release_url+', expected '+config['release_url']+"\n") +else: + if chromium_info['url'] != config['chromium_url']: + error = True + sys.stderr.write("\nWARNING: Incorrect Chromium URL; found "+\ + chromium_info['url']+', expected '+config['chromium_url']+"\n") + + if chromium_info['revision'] != config['chromium_revision']: + error = True + sys.stderr.write("\nWARNING: Incorrect Chromium revision; found "+\ + chromium_info['revision']+', expected '+config['chromium_revision']+"\n") + +if error: + sys.stderr.write("\nPlease see CHROMIUM_BUILD_COMPATIBILITY.txt for "\ + "instructions.\n") diff --git a/tools/check_style.bat b/tools/check_style.bat new file mode 100644 index 000000000..43612cf91 --- /dev/null +++ b/tools/check_style.bat @@ -0,0 +1,2 @@ +@echo off +..\..\third_party\python_26\python.exe check_style.py %* diff --git a/tools/check_style.py b/tools/check_style.py new file mode 100644 index 000000000..d734e76fb --- /dev/null +++ b/tools/check_style.py @@ -0,0 +1,129 @@ +# Copyright (c) 2012 The Chromium Embedded Framework Authors. +# Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os, re, string, sys +from file_util import * +import git_util as git +import svn_util as svn + +# script directory +script_dir = os.path.dirname(__file__) + +# CEF root directory +cef_dir = os.path.abspath(os.path.join(script_dir, os.pardir)) + +# Valid extensions for files we want to lint. +DEFAULT_LINT_WHITELIST_REGEX = r"(.*\.cpp|.*\.cc|.*\.h)" +DEFAULT_LINT_BLACKLIST_REGEX = r"$^" + +try: + # depot_tools may already be in the import path. + import cpplint + import cpplint_chromium +except ImportError, e: + # Search the PATH environment variable to find the depot_tools folder. + depot_tools = None; + paths = os.environ.get('PATH').split(os.pathsep) + for path in paths: + if os.path.exists(os.path.join(path, 'cpplint_chromium.py')): + depot_tools = path + break + + if depot_tools is None: + print >> sys.stderr, 'Error: could not find depot_tools in PATH.' + sys.exit(2) + + # Add depot_tools to import path. + sys.path.append(depot_tools) + import cpplint + import cpplint_chromium + +# The default implementation of FileInfo.RepositoryName looks for the top-most +# directory that contains a .git or .svn folder. This is a problem for CEF +# because the CEF root folder (which may have an arbitrary name) lives inside +# the Chromium src folder. Reimplement in a dumb but sane way. +def patch_RepositoryName(self): + fullname = self.FullName() + project_dir = os.path.dirname(fullname) + if os.path.exists(fullname): + root_dir = project_dir + while os.path.basename(project_dir) != "src": + project_dir = os.path.dirname(project_dir) + prefix = os.path.commonprefix([root_dir, project_dir]) + components = fullname[len(prefix) + 1:].split('/') + return string.join(["cef"] + components[1:], '/') + return fullname + +def check_style(args, white_list = None, black_list = None): + """ Execute cpplint with the specified arguments. """ + + # Apply patches. + cpplint.FileInfo.RepositoryName = patch_RepositoryName + + # Process cpplint arguments. + filenames = cpplint.ParseArguments(args) + + if not white_list: + white_list = DEFAULT_LINT_WHITELIST_REGEX + white_regex = re.compile(white_list) + if not black_list: + black_list = DEFAULT_LINT_BLACKLIST_REGEX + black_regex = re.compile(black_list) + + extra_check_functions = [cpplint_chromium.CheckPointerDeclarationWhitespace] + + for filename in filenames: + if white_regex.match(filename): + if black_regex.match(filename): + print "Ignoring file %s" % filename + else: + cpplint.ProcessFile(filename, cpplint._cpplint_state.verbose_level, + extra_check_functions) + else: + print "Skipping file %s" % filename + + print "Total errors found: %d\n" % cpplint._cpplint_state.error_count + return 1 + +def get_changed_files(): + """ Retrieve the list of changed files. """ + try: + return svn.get_changed_files(cef_dir) + except: + return git.get_changed_files(cef_dir) + +if __name__ == "__main__": + # Start with the default parameters. + args = [ + # * Disable the 'build/class' test because it errors uselessly with C + # structure pointers and template declarations. + # * Disable the 'runtime/references' test because CEF allows non-const + # arguments passed by reference. + # * Disable the 'runtime/sizeof' test because it has a high number of + # false positives and adds marginal value. + '--filter=-build/class,-runtime/references,-runtime/sizeof', + ] + + # Add anything passed on the command-line. + args += sys.argv[1:] + + # Pre-process the arguments before passing to the linter. + new_args = [] + changed = [] + for arg in args: + if arg == '--changed': + # Add any changed files. + changed = get_changed_files() + elif arg[:2] == '--' or not os.path.isdir(arg): + # Pass argument unchanged. + new_args.append(arg) + else: + # Add all files in the directory. + new_args += get_files(os.path.join(arg, '*')) + + if len(changed) > 0: + new_args += changed + + check_style(new_args) diff --git a/tools/check_style.sh b/tools/check_style.sh new file mode 100755 index 000000000..3a38a6ab7 --- /dev/null +++ b/tools/check_style.sh @@ -0,0 +1,2 @@ +#!/bin/sh +python check_style.py $@ diff --git a/tools/date_util.py b/tools/date_util.py new file mode 100644 index 000000000..c19af17b4 --- /dev/null +++ b/tools/date_util.py @@ -0,0 +1,13 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +import datetime + +def get_year(): + """ Returns the current year. """ + return str(datetime.datetime.now().year) + +def get_date(): + """ Returns the current date. """ + return datetime.datetime.now().strftime('%B %d, %Y') diff --git a/tools/date_util.pyc b/tools/date_util.pyc new file mode 100644 index 000000000..d2074afe3 Binary files /dev/null and b/tools/date_util.pyc differ diff --git a/tools/distrib/README-TRANSFER.txt b/tools/distrib/README-TRANSFER.txt new file mode 100644 index 000000000..6843cc201 --- /dev/null +++ b/tools/distrib/README-TRANSFER.txt @@ -0,0 +1,5 @@ +Files in this directory have been copied from other locations in the Chromium +source tree. They have been modified only to the extent necessary to work in +the CEF Binary Distribution directory structure. Below is a listing of the +original file locations. + diff --git a/tools/distrib/cefclient.gyp b/tools/distrib/cefclient.gyp new file mode 100644 index 000000000..fd59d516e --- /dev/null +++ b/tools/distrib/cefclient.gyp @@ -0,0 +1,245 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +{ + 'variables': { + 'chromium_code': 1, + 'conditions': [ + [ 'OS=="mac"', { + # Don't use clang with CEF binary releases due to Chromium tree structure dependency. + 'clang': 0, + }] + ] + }, + 'includes': [ + # Bring in the source file lists for cefclient. + 'cef_paths2.gypi', + ], + 'targets': [ + { + 'target_name': 'cefclient', + 'type': 'executable', + 'mac_bundle': 1, + 'msvs_guid': '6617FED9-C5D4-4907-BF55-A90062A6683F', + 'dependencies': [ + 'libcef_dll_wrapper', + ], + 'defines': [ + 'USING_CEF_SHARED', + ], + 'include_dirs': [ + '.', + ], + 'sources': [ + '<@(includes_common)', + '<@(includes_wrapper)', + '<@(cefclient_sources_common)', + ], + 'mac_bundle_resources': [ + '<@(cefclient_bundle_resources_mac)', + ], + 'mac_bundle_resources!': [ + # TODO(mark): Come up with a fancier way to do this (mac_info_plist?) + # that automatically sets the correct INFOPLIST_FILE setting and adds + # the file to a source group. + 'cefclient/mac/Info.plist', + ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'cefclient/mac/Info.plist', + # Target build path. + 'SYMROOT': 'xcodebuild', + }, + 'conditions': [ + ['OS=="win"', { + 'msvs_settings': { + 'VCLinkerTool': { + # Set /SUBSYSTEM:WINDOWS. + 'SubSystem': '2', + 'EntryPointSymbol' : 'wWinMainCRTStartup', + }, + }, + 'link_settings': { + 'libraries': [ + '-lcomctl32.lib', + '-lshlwapi.lib', + '-lrpcrt4.lib', + '-lopengl32.lib', + '-lglu32.lib', + '-llib/$(ConfigurationName)/libcef.lib' + ], + }, + 'sources': [ + '<@(includes_win)', + '<@(cefclient_sources_win)', + ], + }], + [ 'OS=="mac"', { + 'product_name': 'cefclient', + 'dependencies': [ + 'cefclient_helper_app', + ], + 'copies': [ + { + # Add library dependencies to the bundle. + 'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/', + 'files': [ + '$(CONFIGURATION)/libcef.dylib', + '$(CONFIGURATION)/ffmpegsumo.so', + ], + }, + { + # Add other resources to the bundle. + 'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/', + 'files': [ + 'Resources/', + ], + }, + { + # Add the helper app. + 'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/Frameworks', + 'files': [ + '<(PRODUCT_DIR)/cefclient Helper.app', + ], + }, + ], + 'postbuilds': [ + { + 'postbuild_name': 'Fix Framework Link', + 'action': [ + 'install_name_tool', + '-change', + '@executable_path/libcef.dylib', + '@executable_path/../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}' + ], + }, + { + # This postbuid step is responsible for creating the following + # helpers: + # + # cefclient Helper EH.app and cefclient Helper NP.app are created + # from cefclient Helper.app. + # + # The EH helper is marked for an executable heap. The NP helper + # is marked for no PIE (ASLR). + 'postbuild_name': 'Make More Helpers', + 'action': [ + 'tools/make_more_helpers.sh', + 'Frameworks', + 'cefclient', + ], + }, + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/AppKit.framework', + '$(CONFIGURATION)/libcef.dylib', + ], + }, + 'sources': [ + '<@(includes_mac)', + '<@(cefclient_sources_mac)', + ], + }], + [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/files', + 'files': [ + '<@(cefclient_bundle_resources_linux)', + ], + }, + ], + 'sources': [ + '<@(includes_linux)', + '<@(cefclient_sources_linux)', + ], + }], + ], + }, + { + 'target_name': 'libcef_dll_wrapper', + 'type': 'static_library', + 'msvs_guid': 'A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9', + 'defines': [ + 'USING_CEF_SHARED', + ], + 'include_dirs': [ + '.', + ], + 'sources': [ + '<@(includes_common)', + '<@(includes_capi)', + '<@(includes_wrapper)', + '<@(libcef_dll_wrapper_sources_common)', + ], + 'xcode_settings': { + # Target build path. + 'SYMROOT': 'xcodebuild', + }, + }, + ], + 'conditions': [ + ['OS=="mac"', { + 'targets': [ + { + 'target_name': 'cefclient_helper_app', + 'type': 'executable', + 'variables': { 'enable_wexit_time_destructors': 1, }, + 'product_name': 'cefclient Helper', + 'mac_bundle': 1, + 'dependencies': [ + 'libcef_dll_wrapper', + ], + 'defines': [ + 'USING_CEF_SHARED', + ], + 'include_dirs': [ + '.', + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/AppKit.framework', + '$(CONFIGURATION)/libcef.dylib', + ], + }, + 'sources': [ + '<@(cefclient_sources_mac_helper)', + ], + # TODO(mark): Come up with a fancier way to do this. It should only + # be necessary to list helper-Info.plist once, not the three times it + # is listed here. + 'mac_bundle_resources!': [ + 'cefclient/mac/helper-Info.plist', + ], + # TODO(mark): For now, don't put any resources into this app. Its + # resources directory will be a symbolic link to the browser app's + # resources directory. + 'mac_bundle_resources/': [ + ['exclude', '.*'], + ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'cefclient/mac/helper-Info.plist', + }, + 'postbuilds': [ + { + # The framework defines its load-time path + # (DYLIB_INSTALL_NAME_BASE) relative to the main executable + # (chrome). A different relative path needs to be used in + # cefclient_helper_app. + 'postbuild_name': 'Fix Framework Link', + 'action': [ + 'install_name_tool', + '-change', + '@executable_path/libcef.dylib', + '@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}' + ], + }, + ], + }, # target cefclient_helper_app + ], + }], # OS=="mac" + ], +} diff --git a/tools/distrib/linux/README.txt b/tools/distrib/linux/README.txt new file mode 100644 index 000000000..19982cea9 --- /dev/null +++ b/tools/distrib/linux/README.txt @@ -0,0 +1,89 @@ +Chromium Embedded Framework (CEF) Binary Distribution +------------------------------------------------------------------------------- + +Date: $DATE$ + +CEF Version: $CEF_VER$ +CEF URL: $CEF_URL$@$CEF_REV$ + +Chromium Verison: $CHROMIUM_VER$ +Chromium URL: $CHROMIUM_URL$@$CHROMIUM_REV$ + + +This distribution contains all components necessary to build and distribute an +application using CEF. Please see the LICENSING section of this document for +licensing terms and conditions. + + +CONTENTS +-------- + +cefclient Contains the cefclient sample application configured to build + using the files in this distribution. + +Debug Contains libcef.so and other components required to run the debug + version of CEF-based applications. + +docs Contains C++ API documentation generated from the CEF header files. + +include Contains all required CEF header files. + +libcef_dll Contains the source code for the libcef_dll_wrapper static library + that all applications using the CEF C++ API must link against. + +Release Contains libcef.so and other components required to run the + release version of CEF-based applications. + + +USAGE +----- + +Run 'make -j4 cefclient BUILDTYPE=Debug' to build the cefclient target in +Debug mode. + +Please visit the CEF Website for additional usage information. + +http://code.google.com/p/chromiumembedded + + +REDISTRIBUTION +-------------- + +This binary distribution contains the below components. Components listed under +the "required" section must be redistributed with all applications using CEF. +Components listed under the "optional" section may be excluded if the related +features will not be used. + +Required components: + +* CEF core library + libcef.so + +Optional components: + +* Localized resources + locales/ + Note: Contains localized strings for WebKit UI controls. A .pak file is loaded + from this folder based on the value of environment variables which are read + with the following precedence order: LANGUAGE, LC_ALL, LC_MESSAGES and LANG. + Only configured locales need to be distributed. If no locale is configured the + default locale of "en-US" will be used. Locale file loading can be disabled + completely using CefSettings.pack_loading_disabled. The locales folder path + can be customized using CefSettings.locales_dir_path. + +* Other resources + cef.pak + Note: Contains WebKit image and inspector resources. Pack file loading can be + disabled completely using CefSettings.pack_loading_disabled. The cef.pak file + path can be customized using CefSettings.pack_file_path. + + +LICENSING +--------- + +The CEF project is BSD licensed. Please read the LICENSE.txt file included with +this binary distribution for licensing terms and conditions. Other software +included in this distribution is provided under other licenses. Please visit the +below link for complete Chromium and third-party licensing information. + +http://code.google.com/chromium/terms.html diff --git a/tools/distrib/mac/README.txt b/tools/distrib/mac/README.txt new file mode 100644 index 000000000..b3da9a334 --- /dev/null +++ b/tools/distrib/mac/README.txt @@ -0,0 +1,103 @@ +Chromium Embedded Framework (CEF) Binary Distribution +------------------------------------------------------------------------------- + +Date: $DATE$ + +CEF Version: $CEF_VER$ +CEF URL: $CEF_URL$@$CEF_REV$ + +Chromium Verison: $CHROMIUM_VER$ +Chromium URL: $CHROMIUM_URL$@$CHROMIUM_REV$ + + +This distribution contains all components necessary to build and distribute an +application using CEF. Please see the LICENSING section of this document for +licensing terms and conditions. + + +CONTENTS +-------- + +cefclient Contains the cefclient sample application configured to build + using the files in this distribution. + +Debug Contains libcef.dylib and other components required to run the debug + version of CEF-based applications. + +docs Contains C++ API documentation generated from the CEF header files. + +include Contains all required CEF header files. + +libcef_dll Contains the source code for the libcef_dll_wrapper static library + that all applications using the CEF C++ API must link against. + +Release Contains libcef.dylib and other components required to run the + release version of CEF-based applications. + +Resources Contains images and resources required by applications using CEF. + The contents of this folder should be transferred to the + Contents/Resources folder in the app bundle. + +tools Scripts that perform post-processing on Mac release targets. + + +USAGE +----- + +Xcode 3 and 4: Open the cefclient.xcodeproj project and build. + +When using Xcode 4.2 or newer you will need to change the "Compiler for +C/C++/Objective-C" setting to "LLVM GCC 4.2" under "Build Settings" for +each target. + +Please visit the CEF Website for additional usage information. + +http://code.google.com/p/chromiumembedded + + +REDISTRIBUTION +-------------- + +This binary distribution contains the below components. Components listed under +the "required" section must be redistributed with all applications using CEF. +Components listed under the "optional" section may be excluded if the related +features will not be used. + +Required components: + +* CEF core library + libcef.dylib + +* Cursor resources + Resources/*.png + Resources/*.tiff + +Optional components: + +* Localized resources + Resources/*.lproj/ + Note: Contains localized strings for WebKit UI controls. A .pak file is loaded + from this folder based on the CefSettings.locale value. Only configured + locales need to be distributed. If no locale is configured the default locale + of "en" will be used. Locale file loading can be disabled completely using + CefSettings.pack_loading_disabled. + +* Other resources + Resources/cef.pak + Note: Contains WebKit image and inspector resources. Pack file loading can be + disabled completely using CefSettings.pack_loading_disabled. + +* FFmpeg audio and video support + ffmpegsumo.so + Note: Without this component HTML5 audio and video will not function. + + +LICENSING +--------- + +The CEF project is BSD licensed. Please read the LICENSE.txt file included with +this binary distribution for licensing terms and conditions. Other software +included in this distribution is provided under other licenses. Please visit the +below link for complete Chromium and third-party licensing information. + +http://code.google.com/chromium/terms.html diff --git a/tools/distrib/mac/transfer.cfg b/tools/distrib/mac/transfer.cfg new file mode 100644 index 000000000..952c06166 --- /dev/null +++ b/tools/distrib/mac/transfer.cfg @@ -0,0 +1,33 @@ +# Additional handling of transfer files. +# target: Target location relative to the target release directory. This +# value is required. +# source: Source location relative to the CEF root directory. This value +# is optional. If specified the target will be copied to this location +# and a TRANSFER-README.txt file will be created. +# post-process: Post-processing operation to perform. This value is +# optional and may be any one of the following: +# 'normalize_headers': Replace fully-qualified project header paths with +# the optionally specified 'new_header_path' value. + +[ + { + 'source' : '../build/mac/change_mach_o_flags_from_xcode.sh', + 'target' : 'tools/change_mach_o_flags_from_xcode.sh', + }, + { + 'source' : '../build/mac/change_mach_o_flags.py', + 'target' : 'tools/change_mach_o_flags.py', + }, + { + 'source' : '../build/mac/strip_from_xcode', + 'target' : 'tools/strip_from_xcode', + }, + { + 'source' : '../build/mac/strip_save_dsym', + 'target' : 'tools/strip_save_dsym', + }, + { + 'source' : '../build/mac/make_more_helpers.sh', + 'target' : 'tools/make_more_helpers.sh', + }, +] diff --git a/tools/distrib/transfer.cfg b/tools/distrib/transfer.cfg new file mode 100644 index 000000000..a0e42dc57 --- /dev/null +++ b/tools/distrib/transfer.cfg @@ -0,0 +1,13 @@ +# Additional handling of transfer files. +# target: Target location relative to the target release directory. This +# value is required. +# source: Source location relative to the CEF root directory. This value +# is optional. If specified the target will be copied to this location +# and a TRANSFER-README.txt file will be created. +# post-process: Post-processing operation to perform. This value is +# optional and may be any one of the following: +# 'normalize_headers': Replace fully-qualified project header paths with +# the optionally specified 'new_header_path' value. + +[ +] \ No newline at end of file diff --git a/tools/distrib/win/README.txt b/tools/distrib/win/README.txt new file mode 100644 index 000000000..5e07732f5 --- /dev/null +++ b/tools/distrib/win/README.txt @@ -0,0 +1,113 @@ +Chromium Embedded Framework (CEF) Binary Distribution +------------------------------------------------------------------------------- + +Date: $DATE$ + +CEF Version: $CEF_VER$ +CEF URL: $CEF_URL$@$CEF_REV$ + +Chromium Verison: $CHROMIUM_VER$ +Chromium URL: $CHROMIUM_URL$@$CHROMIUM_REV$ + + +This distribution contains all components necessary to build and distribute an +application using CEF. Please see the LICENSING section of this document for +licensing terms and conditions. + + +CONTENTS +-------- + +cefclient Contains the cefclient sample application configured to build + using the files in this distribution. + +Debug Contains libcef.dll and other components required to run the debug + version of CEF-based applications. Also acts as the build target for + the Debug build of cefclient. + +docs Contains C++ API documentation generated from the CEF header files. + +include Contains all required CEF header files. + +lib Contains Debug and Release versions of the libcef.lib library file + that all CEF-based applications must link against. + +libcef_dll Contains the source code for the libcef_dll_wrapper static library + that all applications using the CEF C++ API must link against. + +Release Contains libcef.dll and other components required to run the release + version of CEF-based applications. Also acts as the build target for + the Release build of cefclient. + + +USAGE +----- + +Visual Studio 2010: Open the cefclient2010.sln solution and build. +Visual Studio 2008: Open the cefclient2008.sln solution and build. + * If using VS2008 Express Edition add atlthunk.lib to the cefclient + Configuration Properties > Linker > Input > Additional Dependencies +Visual Studio 2005: Open the cefclient2005.sln solution and build. + +Please visit the CEF Website for additional usage information. + +http://code.google.com/p/chromiumembedded + + +REDISTRIBUTION +-------------- + +This binary distribution contains the below components. Components listed under +the "required" section must be redistributed with all applications using CEF. +Components listed under the "optional" section may be excluded if the related +features will not be used. + +Required components: + +* CEF core library + libcef.dll + +* Unicode support + icudt.dll + +Optional components: + +* Localized resources + locales/ + Note: Contains localized strings for WebKit UI controls. A .pak file is loaded + from this folder based on the CefSettings.locale value. Only configured + locales need to be distributed. If no locale is configured the default locale + of "en-US" will be used. Locale file loading can be disabled completely using + CefSettings.pack_loading_disabled. The locales folder path can be customized + using CefSettings.locales_dir_path. + +* Other resources + cef.pak + Note: Contains WebKit image and inspector resources. Pack file loading can be + disabled completely using CefSettings.pack_loading_disabled. The cef.pak file + path can be customized using CefSettings.pack_file_path. + +* FFmpeg audio and video support + avcodec-54.dll + avformat-54.dll + avutil-51.dll + Note: Without these components HTML5 audio and video will not function. + +* Angle and Direct3D support + d3dcompiler_43.dll + d3dx9_43.dll + libEGL.dll + libGLESv2.dll + Note: Without these components HTML5 accelerated content like 2D canvas, 3D + CSS and WebGL will not function. + + +LICENSING +--------- + +The CEF project is BSD licensed. Please read the LICENSE.txt file included with +this binary distribution for licensing terms and conditions. Other software +included in this distribution is provided under other licenses. Please visit the +below link for complete Chromium and third-party licensing information. + +http://code.google.com/chromium/terms.html diff --git a/tools/distrib/win/d3dcompiler_43.dll b/tools/distrib/win/d3dcompiler_43.dll new file mode 100644 index 000000000..ab9616191 Binary files /dev/null and b/tools/distrib/win/d3dcompiler_43.dll differ diff --git a/tools/distrib/win/d3dx9_43.dll b/tools/distrib/win/d3dx9_43.dll new file mode 100644 index 000000000..96cfbe227 Binary files /dev/null and b/tools/distrib/win/d3dx9_43.dll differ diff --git a/tools/file_util.py b/tools/file_util.py new file mode 100644 index 000000000..f6f99cf6b --- /dev/null +++ b/tools/file_util.py @@ -0,0 +1,111 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +from glob import iglob +import os +import shutil +import sys +import time + +def read_file(name, normalize = True): + """ Read a file. """ + try: + f = open(name, 'r') + # read the data + data = f.read() + if normalize: + # normalize line endings + data = data.replace("\r\n", "\n") + return data + except IOError, (errno, strerror): + sys.stderr.write('Failed to read file '+name+': '+strerror) + raise + else: + f.close() + +def write_file(name, data): + """ Write a file. """ + try: + f = open(name, 'w') + # write the data + f.write(data) + except IOError, (errno, strerror): + sys.stderr.write('Failed to write file '+name+': '+strerror) + raise + else: + f.close() + +def path_exists(name): + """ Returns true if the path currently exists. """ + return os.path.exists(name) + +def backup_file(name): + """ Rename the file to a name that includes the current time stamp. """ + move_file(name, name+'.'+time.strftime('%Y-%m-%d-%H-%M-%S')) + +def copy_file(src, dst, quiet = True): + """ Copy a file. """ + try: + shutil.copy(src, dst) + if not quiet: + sys.stdout.write('Transferring '+src+' file.\n') + except IOError, (errno, strerror): + sys.stderr.write('Failed to copy file from '+src+' to '+dst+': '+strerror) + raise + +def move_file(src, dst, quiet = True): + """ Move a file. """ + try: + shutil.move(src, dst) + if not quiet: + sys.stdout.write('Moving '+src+' file.\n') + except IOError, (errno, strerror): + sys.stderr.write('Failed to move file from '+src+' to '+dst+': '+strerror) + raise + +def copy_files(src_glob, dst_folder, quiet = True): + """ Copy multiple files. """ + for fname in iglob(src_glob): + dst = os.path.join(dst_folder, os.path.basename(fname)) + if os.path.isdir(fname): + copy_dir(fname, dst, quiet) + else: + copy_file(fname, dst, quiet) + +def copy_dir(src, dst, quiet = True): + """ Copy a directory tree. """ + try: + remove_dir(dst, quiet) + shutil.copytree(src, dst) + if not quiet: + sys.stdout.write('Transferring '+src+' directory.\n') + except IOError, (errno, strerror): + sys.stderr.write('Failed to copy directory from '+src+' to '+dst+': '+strerror) + raise + +def remove_dir(name, quiet = True): + """ Remove the specified directory. """ + try: + if path_exists(name): + shutil.rmtree(name) + if not quiet: + sys.stdout.write('Removing '+name+' directory.\n') + except IOError, (errno, strerror): + sys.stderr.write('Failed to remove directory '+name+': '+strerror) + raise + +def make_dir(name, quiet = True): + """ Create the specified directory. """ + try: + if not path_exists(name): + if not quiet: + sys.stdout.write('Creating '+name+' directory.\n') + os.makedirs(name) + except IOError, (errno, strerror): + sys.stderr.write('Failed to create directory '+name+': '+strerror) + raise + +def get_files(search_glob): + """ Returns all files matching the search glob. """ + return iglob(search_glob) diff --git a/tools/file_util.pyc b/tools/file_util.pyc new file mode 100644 index 000000000..621e1b197 Binary files /dev/null and b/tools/file_util.pyc differ diff --git a/tools/gclient_hook.py b/tools/gclient_hook.py new file mode 100644 index 000000000..f79c67645 --- /dev/null +++ b/tools/gclient_hook.py @@ -0,0 +1,30 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. +# Portions copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from gclient_util import * +import os, sys + +# The CEF root directory is the parent directory of _this_ script. +cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + +print "\nChecking CEF and Chromium revisions..." +gyper = [ 'python', 'tools/check_revision.py' ] +RunAction(cef_dir, gyper) + +print "\nGenerating CEF version header file..." +gyper = [ 'python', 'tools/make_version_header.py', + '--header', 'include/cef_version.h', + '--version', '../chrome/VERSION' ] +RunAction(cef_dir, gyper) + +print "\nPatching build configuration and source files for CEF..." +patcher = [ 'python', 'tools/patcher.py', + '--patch-config', 'patch/patch.cfg' ]; +RunAction(cef_dir, patcher) + +print "\nGenerating CEF project files..." +os.environ['CEF_DIRECTORY'] = os.path.basename(cef_dir); +gyper = [ 'python', 'tools/gyp_cef', 'cef.gyp', '-I', 'cef.gypi' ] +RunAction(cef_dir, gyper) diff --git a/tools/gclient_util.py b/tools/gclient_util.py new file mode 100644 index 000000000..300841456 --- /dev/null +++ b/tools/gclient_util.py @@ -0,0 +1,45 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. +# Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os, sys + +try: + # depot_tools may already be in the import path. + import gclient_utils +except ImportError, e: + # Search the PATH environment variable to find the depot_tools folder. + depot_tools = None; + paths = os.environ.get('PATH').split(os.pathsep) + for path in paths: + if os.path.exists(os.path.join(path, 'gclient_utils.py')): + depot_tools = path + break + + if depot_tools is None: + print >> sys.stderr, 'Error: could not find depot_tools in PATH.' + sys.exit(2) + + # Add depot_tools to import path. + sys.path.append(depot_tools) + import gclient_utils + +# Copied from gclient.py python code. +def RunAction(dir, command): + """Runs the action.""" + if command[0] == 'python': + # If the hook specified "python" as the first item, the action is a + # Python script. Run it by starting a new copy of the same + # interpreter. + command[0] = sys.executable + + try: + gclient_utils.CheckCallAndFilterAndHeader( + command, cwd=dir, always=True) + except gclient_utils.Error, e: + # Use a discrete exit status code of 2 to indicate that a hook action + # failed. Users of this script may wish to treat hook action failures + # differently from VC failures. + print >> sys.stderr, 'Error: %s' % str(e) + sys.exit(2) diff --git a/tools/gclient_util.pyc b/tools/gclient_util.pyc new file mode 100644 index 000000000..668c7eb59 Binary files /dev/null and b/tools/gclient_util.pyc differ diff --git a/tools/git_util.py b/tools/git_util.py new file mode 100644 index 000000000..a641c83fa --- /dev/null +++ b/tools/git_util.py @@ -0,0 +1,24 @@ +# Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file + +from subprocess import Popen, PIPE + +def get_svn_revision(path=".", branch="master"): + svn_rev = "None" + cmd = ("git log --grep=^git-svn-id: -n 1 %s" % branch).split() + try: + process = Popen(cmd, cwd=path, stdout = PIPE, stderr = PIPE) + for line in process.stdout: + if line.find("git-svn-id") > 0: + svn_rev = line.split("@")[1].split()[0] + break + except IOError, (errno, strerror): + sys.stderr.write('Failed to read git log: ' + strerror + "\n") + raise + return svn_rev + +def get_changed_files(path="."): + """ Retrieves the list of changed files. """ + # not implemented + return [] diff --git a/tools/git_util.pyc b/tools/git_util.pyc new file mode 100644 index 000000000..ecd9e806e Binary files /dev/null and b/tools/git_util.pyc differ diff --git a/tools/gyp/.gitignore b/tools/gyp/.gitignore new file mode 100644 index 000000000..0d20b6487 --- /dev/null +++ b/tools/gyp/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/tools/gyp/AUTHORS b/tools/gyp/AUTHORS new file mode 100644 index 000000000..6db82b9e4 --- /dev/null +++ b/tools/gyp/AUTHORS @@ -0,0 +1,6 @@ +# Names should be added to this file like so: +# Name or Organization + +Google Inc. +Steven Knight +Ryan Norton diff --git a/tools/gyp/DEPS b/tools/gyp/DEPS new file mode 100644 index 000000000..c17571ae0 --- /dev/null +++ b/tools/gyp/DEPS @@ -0,0 +1,26 @@ +# DEPS file for gclient use in buildbot execution of gyp tests. +# +# (You don't need to use gclient for normal GYP development work.) + +vars = { + "chrome_trunk": "http://src.chromium.org/svn/trunk", + "googlecode_url": "http://%s.googlecode.com/svn", +} + +deps = { + "scons": + Var("chrome_trunk") + "/src/third_party/scons@44099", +} + +deps_os = { + "win": { + "third_party/cygwin": + Var("chrome_trunk") + "/deps/third_party/cygwin@66844", + + "third_party/python_26": + Var("chrome_trunk") + "/tools/third_party/python_26@89111", + + "src/third_party/pefile": + (Var("googlecode_url") % "pefile") + "/trunk@63", + }, +} diff --git a/tools/gyp/LICENSE b/tools/gyp/LICENSE new file mode 100644 index 000000000..ab6b011a1 --- /dev/null +++ b/tools/gyp/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tools/gyp/MANIFEST b/tools/gyp/MANIFEST new file mode 100644 index 000000000..925ecc184 --- /dev/null +++ b/tools/gyp/MANIFEST @@ -0,0 +1,21 @@ +setup.py +gyp +LICENSE +AUTHORS +pylib/gyp/MSVSNew.py +pylib/gyp/MSVSProject.py +pylib/gyp/MSVSToolFile.py +pylib/gyp/MSVSUserFile.py +pylib/gyp/MSVSVersion.py +pylib/gyp/SCons.py +pylib/gyp/__init__.py +pylib/gyp/common.py +pylib/gyp/input.py +pylib/gyp/xcodeproj_file.py +pylib/gyp/generator/__init__.py +pylib/gyp/generator/gypd.py +pylib/gyp/generator/gypsh.py +pylib/gyp/generator/make.py +pylib/gyp/generator/msvs.py +pylib/gyp/generator/scons.py +pylib/gyp/generator/xcode.py diff --git a/tools/gyp/OWNERS b/tools/gyp/OWNERS new file mode 100644 index 000000000..72e8ffc0d --- /dev/null +++ b/tools/gyp/OWNERS @@ -0,0 +1 @@ +* diff --git a/tools/gyp/PRESUBMIT.py b/tools/gyp/PRESUBMIT.py new file mode 100644 index 000000000..9fa6c183a --- /dev/null +++ b/tools/gyp/PRESUBMIT.py @@ -0,0 +1,106 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Top-level presubmit script for GYP. + +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts +for more details about the presubmit API built into gcl. +""" + + +PYLINT_BLACKLIST = [ + # TODO: fix me. + # From SCons, not done in google style. + 'test/lib/TestCmd.py', + 'test/lib/TestCommon.py', + 'test/lib/TestGyp.py', + # Needs style fix. + 'pylib/gyp/generator/scons.py', + 'pylib/gyp/generator/xcode.py', +] + + +PYLINT_DISABLED_WARNINGS = [ + # TODO: fix me. + # Many tests include modules they don't use. + 'W0611', + # Include order doesn't properly include local files? + 'F0401', + # Some use of built-in names. + 'W0622', + # Some unused variables. + 'W0612', + # Operator not preceded/followed by space. + 'C0323', + 'C0322', + # Unnecessary semicolon. + 'W0301', + # Unused argument. + 'W0613', + # String has no effect (docstring in wrong place). + 'W0105', + # Comma not followed by space. + 'C0324', + # Access to a protected member. + 'W0212', + # Bad indent. + 'W0311', + # Line too long. + 'C0301', + # Undefined variable. + 'E0602', + # Not exception type specified. + 'W0702', + # No member of that name. + 'E1101', + # Dangerous default {}. + 'W0102', + # Others, too many to sort. + 'W0201', 'W0232', 'E1103', 'W0621', 'W0108', 'W0223', 'W0231', + 'R0201', 'E0101', 'C0321', +] + + +def CheckChangeOnUpload(input_api, output_api): + report = [] + report.extend(input_api.canned_checks.PanProjectChecks( + input_api, output_api)) + return report + + +def CheckChangeOnCommit(input_api, output_api): + report = [] + license = ( + r'.*? Copyright \(c\) %(year)s Google Inc\. All rights reserved\.\n' + r'.*? Use of this source code is governed by a BSD-style license that ' + r'can be\n' + r'.*? found in the LICENSE file\.\n' + ) % { + 'year': input_api.time.strftime('%Y'), + } + + report.extend(input_api.canned_checks.PanProjectChecks( + input_api, output_api, license_header=license)) + report.extend(input_api.canned_checks.CheckTreeIsOpen( + input_api, output_api, + 'http://gyp-status.appspot.com/status', + 'http://gyp-status.appspot.com/current')) + + import sys + old_sys_path = sys.path + try: + sys.path = ['pylib', 'test/lib'] + sys.path + report.extend(input_api.canned_checks.RunPylint( + input_api, + output_api, + black_list=PYLINT_BLACKLIST, + disabled_warnings=PYLINT_DISABLED_WARNINGS)) + finally: + sys.path = old_sys_path + return report + + +def GetPreferredTrySlaves(): + return ['gyp-win32', 'gyp-win64', 'gyp-linux', 'gyp-mac'] diff --git a/tools/gyp/buildbot/buildbot_run.py b/tools/gyp/buildbot/buildbot_run.py new file mode 100755 index 000000000..57fdb655b --- /dev/null +++ b/tools/gyp/buildbot/buildbot_run.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Argument-less script to select what to run on the buildbots.""" + + +import os +import shutil +import subprocess +import sys + + +if sys.platform in ['win32', 'cygwin']: + EXE_SUFFIX = '.exe' +else: + EXE_SUFFIX = '' + + +BUILDBOT_DIR = os.path.dirname(os.path.abspath(__file__)) +TRUNK_DIR = os.path.dirname(BUILDBOT_DIR) +ROOT_DIR = os.path.dirname(TRUNK_DIR) +OUT_DIR = os.path.join(TRUNK_DIR, 'out') + + +def GypTestFormat(title, format=None, msvs_version=None): + """Run the gyp tests for a given format, emitting annotator tags. + + See annotator docs at: + https://sites.google.com/a/chromium.org/dev/developers/testing/chromium-build-infrastructure/buildbot-annotations + Args: + format: gyp format to test. + Returns: + 0 for sucesss, 1 for failure. + """ + if not format: + format = title + + print '@@@BUILD_STEP ' + title + '@@@' + sys.stdout.flush() + env = os.environ.copy() + # TODO(bradnelson): remove this when this issue is resolved: + # http://code.google.com/p/chromium/issues/detail?id=108251 + if format == 'ninja': + env['NOGOLD'] = '1' + if msvs_version: + env['GYP_MSVS_VERSION'] = msvs_version + retcode = subprocess.call(' '.join( + [sys.executable, 'trunk/gyptest.py', + '--all', + '--passed', + '--format', format, + '--chdir', 'trunk', + '--path', '../scons']), + cwd=ROOT_DIR, env=env, shell=True) + if retcode: + # Emit failure tag, and keep going. + print '@@@STEP_FAILURE@@@' + return 1 + return 0 + + +def GypBuild(): + # Dump out/ directory. + print '@@@BUILD_STEP cleanup@@@' + print 'Removing %s...' % OUT_DIR + shutil.rmtree(OUT_DIR, ignore_errors=True) + print 'Done.' + + retcode = 0 + if sys.platform.startswith('linux'): + retcode += GypTestFormat('ninja') + retcode += GypTestFormat('scons') + retcode += GypTestFormat('make') + elif sys.platform == 'darwin': + retcode += GypTestFormat('ninja') + retcode += GypTestFormat('xcode') + retcode += GypTestFormat('make') + elif sys.platform == 'win32': + retcode += GypTestFormat('ninja') + retcode += GypTestFormat('msvs-2008', format='msvs', msvs_version='2008') + if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-win64': + retcode += GypTestFormat('msvs-2010', format='msvs', msvs_version='2010') + else: + raise Exception('Unknown platform') + if retcode: + # TODO(bradnelson): once the annotator supports a postscript (section for + # after the build proper that could be used for cumulative failures), + # use that instead of this. This isolates the final return value so + # that it isn't misattributed to the last stage. + print '@@@BUILD_STEP failures@@@' + sys.exit(retcode) + + +if __name__ == '__main__': + GypBuild() diff --git a/tools/gyp/codereview.settings b/tools/gyp/codereview.settings new file mode 100644 index 000000000..a04a2440d --- /dev/null +++ b/tools/gyp/codereview.settings @@ -0,0 +1,10 @@ +# This file is used by gcl to get repository specific information. +CODE_REVIEW_SERVER: codereview.chromium.org +CC_LIST: gyp-developer@googlegroups.com +VIEW_VC: http://code.google.com/p/gyp/source/detail?r= +TRY_ON_UPLOAD: True +TRYSERVER_PROJECT: gyp +TRYSERVER_PATCHLEVEL: 0 +TRYSERVER_ROOT: trunk +TRYSERVER_SVN_URL: svn://svn.chromium.org/chrome-try/try-nacl + diff --git a/tools/gyp/gyp b/tools/gyp/gyp new file mode 100755 index 000000000..d52e7116f --- /dev/null +++ b/tools/gyp/gyp @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +# TODO(mark): sys.path manipulation is some temporary testing stuff. +try: + import gyp +except ImportError, e: + import os.path + sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'pylib')) + import gyp + +if __name__ == '__main__': + sys.exit(gyp.main(sys.argv[1:])) diff --git a/tools/gyp/gyp.bat b/tools/gyp/gyp.bat new file mode 100755 index 000000000..90fbc6d30 --- /dev/null +++ b/tools/gyp/gyp.bat @@ -0,0 +1,5 @@ +@rem Copyright (c) 2009 Google Inc. All rights reserved. +@rem Use of this source code is governed by a BSD-style license that can be +@rem found in the LICENSE file. + +@python "%~dp0/gyp" %* diff --git a/tools/gyp/gyp_dummy.c b/tools/gyp/gyp_dummy.c new file mode 100644 index 000000000..fb55bbc78 --- /dev/null +++ b/tools/gyp/gyp_dummy.c @@ -0,0 +1,7 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +int main() { + return 0; +} diff --git a/tools/gyp/gyptest.py b/tools/gyp/gyptest.py new file mode 100755 index 000000000..d9c814f3f --- /dev/null +++ b/tools/gyp/gyptest.py @@ -0,0 +1,256 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +__doc__ = """ +gyptest.py -- test runner for GYP tests. +""" + +import os +import optparse +import subprocess +import sys + +class CommandRunner: + """ + Executor class for commands, including "commands" implemented by + Python functions. + """ + verbose = True + active = True + + def __init__(self, dictionary={}): + self.subst_dictionary(dictionary) + + def subst_dictionary(self, dictionary): + self._subst_dictionary = dictionary + + def subst(self, string, dictionary=None): + """ + Substitutes (via the format operator) the values in the specified + dictionary into the specified command. + + The command can be an (action, string) tuple. In all cases, we + perform substitution on strings and don't worry if something isn't + a string. (It's probably a Python function to be executed.) + """ + if dictionary is None: + dictionary = self._subst_dictionary + if dictionary: + try: + string = string % dictionary + except TypeError: + pass + return string + + def display(self, command, stdout=None, stderr=None): + if not self.verbose: + return + if type(command) == type(()): + func = command[0] + args = command[1:] + s = '%s(%s)' % (func.__name__, ', '.join(map(repr, args))) + if type(command) == type([]): + # TODO: quote arguments containing spaces + # TODO: handle meta characters? + s = ' '.join(command) + else: + s = self.subst(command) + if not s.endswith('\n'): + s += '\n' + sys.stdout.write(s) + sys.stdout.flush() + + def execute(self, command, stdout=None, stderr=None): + """ + Executes a single command. + """ + if not self.active: + return 0 + if type(command) == type(''): + command = self.subst(command) + cmdargs = shlex.split(command) + if cmdargs[0] == 'cd': + command = (os.chdir,) + tuple(cmdargs[1:]) + if type(command) == type(()): + func = command[0] + args = command[1:] + return func(*args) + else: + if stdout is sys.stdout: + # Same as passing sys.stdout, except python2.4 doesn't fail on it. + subout = None + else: + # Open pipe for anything else so Popen works on python2.4. + subout = subprocess.PIPE + if stderr is sys.stderr: + # Same as passing sys.stderr, except python2.4 doesn't fail on it. + suberr = None + elif stderr is None: + # Merge with stdout if stderr isn't specified. + suberr = subprocess.STDOUT + else: + # Open pipe for anything else so Popen works on python2.4. + suberr = subprocess.PIPE + p = subprocess.Popen(command, + shell=(sys.platform == 'win32'), + stdout=subout, + stderr=suberr) + p.wait() + if stdout is None: + self.stdout = p.stdout.read() + elif stdout is not sys.stdout: + stdout.write(p.stdout.read()) + if stderr not in (None, sys.stderr): + stderr.write(p.stderr.read()) + return p.returncode + + def run(self, command, display=None, stdout=None, stderr=None): + """ + Runs a single command, displaying it first. + """ + if display is None: + display = command + self.display(display) + return self.execute(command, stdout, stderr) + + +class Unbuffered: + def __init__(self, fp): + self.fp = fp + def write(self, arg): + self.fp.write(arg) + self.fp.flush() + def __getattr__(self, attr): + return getattr(self.fp, attr) + +sys.stdout = Unbuffered(sys.stdout) +sys.stderr = Unbuffered(sys.stderr) + + +def find_all_gyptest_files(directory): + result = [] + for root, dirs, files in os.walk(directory): + if '.svn' in dirs: + dirs.remove('.svn') + result.extend([ os.path.join(root, f) for f in files + if f.startswith('gyptest') and f.endswith('.py') ]) + result.sort() + return result + + +def main(argv=None): + if argv is None: + argv = sys.argv + + usage = "gyptest.py [-ahlnq] [-f formats] [test ...]" + parser = optparse.OptionParser(usage=usage) + parser.add_option("-a", "--all", action="store_true", + help="run all tests") + parser.add_option("-C", "--chdir", action="store", default=None, + help="chdir to the specified directory") + parser.add_option("-f", "--format", action="store", default='', + help="run tests with the specified formats") + parser.add_option("-l", "--list", action="store_true", + help="list available tests and exit") + parser.add_option("-n", "--no-exec", action="store_true", + help="no execute, just print the command line") + parser.add_option("--passed", action="store_true", + help="report passed tests") + parser.add_option("--path", action="append", default=[], + help="additional $PATH directory") + parser.add_option("-q", "--quiet", action="store_true", + help="quiet, don't print test command lines") + opts, args = parser.parse_args(argv[1:]) + + if opts.chdir: + os.chdir(opts.chdir) + + if opts.path: + os.environ['PATH'] += ':' + ':'.join(opts.path) + + if not args: + if not opts.all: + sys.stderr.write('Specify -a to get all tests.\n') + return 1 + args = ['test'] + + tests = [] + for arg in args: + if os.path.isdir(arg): + tests.extend(find_all_gyptest_files(os.path.normpath(arg))) + else: + tests.append(arg) + + if opts.list: + for test in tests: + print test + sys.exit(0) + + CommandRunner.verbose = not opts.quiet + CommandRunner.active = not opts.no_exec + cr = CommandRunner() + + os.environ['PYTHONPATH'] = os.path.abspath('test/lib') + if not opts.quiet: + sys.stdout.write('PYTHONPATH=%s\n' % os.environ['PYTHONPATH']) + + passed = [] + failed = [] + no_result = [] + + if opts.format: + format_list = opts.format.split(',') + else: + # TODO: not duplicate this mapping from pylib/gyp/__init__.py + format_list = { + 'freebsd7': ['make'], + 'freebsd8': ['make'], + 'cygwin': ['msvs'], + 'win32': ['msvs', 'ninja'], + 'linux2': ['make', 'ninja'], + 'linux3': ['make', 'ninja'], + 'darwin': ['make', 'ninja', 'xcode'], + }[sys.platform] + + for format in format_list: + os.environ['TESTGYP_FORMAT'] = format + if not opts.quiet: + sys.stdout.write('TESTGYP_FORMAT=%s\n' % format) + + for test in tests: + status = cr.run([sys.executable, test], + stdout=sys.stdout, + stderr=sys.stderr) + if status == 2: + no_result.append(test) + elif status: + failed.append(test) + else: + passed.append(test) + + if not opts.quiet: + def report(description, tests): + if tests: + if len(tests) == 1: + sys.stdout.write("\n%s the following test:\n" % description) + else: + fmt = "\n%s the following %d tests:\n" + sys.stdout.write(fmt % (description, len(tests))) + sys.stdout.write("\t" + "\n\t".join(tests) + "\n") + + if opts.passed: + report("Passed", passed) + report("Failed", failed) + report("No result from", no_result) + + if failed: + return 1 + else: + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tools/gyp/pylib/gyp/MSVSNew.py b/tools/gyp/pylib/gyp/MSVSNew.py new file mode 100644 index 000000000..086597378 --- /dev/null +++ b/tools/gyp/pylib/gyp/MSVSNew.py @@ -0,0 +1,341 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""New implementation of Visual Studio project generation for SCons.""" + +import os +import random + +import gyp.common + +# hashlib is supplied as of Python 2.5 as the replacement interface for md5 +# and other secure hashes. In 2.6, md5 is deprecated. Import hashlib if +# available, avoiding a deprecation warning under 2.6. Import md5 otherwise, +# preserving 2.4 compatibility. +try: + import hashlib + _new_md5 = hashlib.md5 +except ImportError: + import md5 + _new_md5 = md5.new + + +# Initialize random number generator +random.seed() + +# GUIDs for project types +ENTRY_TYPE_GUIDS = { + 'project': '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}', + 'folder': '{2150E333-8FDC-42A3-9474-1A3956D46DE8}', +} + +#------------------------------------------------------------------------------ +# Helper functions + + +def MakeGuid(name, seed='msvs_new'): + """Returns a GUID for the specified target name. + + Args: + name: Target name. + seed: Seed for MD5 hash. + Returns: + A GUID-line string calculated from the name and seed. + + This generates something which looks like a GUID, but depends only on the + name and seed. This means the same name/seed will always generate the same + GUID, so that projects and solutions which refer to each other can explicitly + determine the GUID to refer to explicitly. It also means that the GUID will + not change when the project for a target is rebuilt. + """ + # Calculate a MD5 signature for the seed and name. + d = _new_md5(str(seed) + str(name)).hexdigest().upper() + # Convert most of the signature to GUID form (discard the rest) + guid = ('{' + d[:8] + '-' + d[8:12] + '-' + d[12:16] + '-' + d[16:20] + + '-' + d[20:32] + '}') + return guid + +#------------------------------------------------------------------------------ + + +class MSVSFolder(object): + """Folder in a Visual Studio project or solution.""" + + def __init__(self, path, name = None, entries = None, + guid = None, items = None): + """Initializes the folder. + + Args: + path: Full path to the folder. + name: Name of the folder. + entries: List of folder entries to nest inside this folder. May contain + Folder or Project objects. May be None, if the folder is empty. + guid: GUID to use for folder, if not None. + items: List of solution items to include in the folder project. May be + None, if the folder does not directly contain items. + """ + if name: + self.name = name + else: + # Use last layer. + self.name = os.path.basename(path) + + self.path = path + self.guid = guid + + # Copy passed lists (or set to empty lists) + self.entries = list(entries or []) + self.items = list(items or []) + + self.entry_type_guid = ENTRY_TYPE_GUIDS['folder'] + + def get_guid(self): + if self.guid is None: + # Use consistent guids for folders (so things don't regenerate). + self.guid = MakeGuid(self.path, seed='msvs_folder') + return self.guid + + +#------------------------------------------------------------------------------ + + +class MSVSProject(object): + """Visual Studio project.""" + + def __init__(self, path, name = None, dependencies = None, guid = None, + spec = None, build_file = None, config_platform_overrides = None, + fixpath_prefix = None): + """Initializes the project. + + Args: + path: Absolute path to the project file. + name: Name of project. If None, the name will be the same as the base + name of the project file. + dependencies: List of other Project objects this project is dependent + upon, if not None. + guid: GUID to use for project, if not None. + spec: Dictionary specifying how to build this project. + build_file: Filename of the .gyp file that the vcproj file comes from. + config_platform_overrides: optional dict of configuration platforms to + used in place of the default for this target. + fixpath_prefix: the path used to adjust the behavior of _fixpath + """ + self.path = path + self.guid = guid + self.spec = spec + self.build_file = build_file + # Use project filename if name not specified + self.name = name or os.path.splitext(os.path.basename(path))[0] + + # Copy passed lists (or set to empty lists) + self.dependencies = list(dependencies or []) + + self.entry_type_guid = ENTRY_TYPE_GUIDS['project'] + + if config_platform_overrides: + self.config_platform_overrides = config_platform_overrides + else: + self.config_platform_overrides = {} + self.fixpath_prefix = fixpath_prefix + self.msbuild_toolset = None + + def set_dependencies(self, dependencies): + self.dependencies = list(dependencies or []) + + def get_guid(self): + if self.guid is None: + # Set GUID from path + # TODO(rspangler): This is fragile. + # 1. We can't just use the project filename sans path, since there could + # be multiple projects with the same base name (for example, + # foo/unittest.vcproj and bar/unittest.vcproj). + # 2. The path needs to be relative to $SOURCE_ROOT, so that the project + # GUID is the same whether it's included from base/base.sln or + # foo/bar/baz/baz.sln. + # 3. The GUID needs to be the same each time this builder is invoked, so + # that we don't need to rebuild the solution when the project changes. + # 4. We should be able to handle pre-built project files by reading the + # GUID from the files. + self.guid = MakeGuid(self.name) + return self.guid + + def set_msbuild_toolset(self, msbuild_toolset): + self.msbuild_toolset = msbuild_toolset + +#------------------------------------------------------------------------------ + + +class MSVSSolution: + """Visual Studio solution.""" + + def __init__(self, path, version, entries=None, variants=None, + websiteProperties=True): + """Initializes the solution. + + Args: + path: Path to solution file. + version: Format version to emit. + entries: List of entries in solution. May contain Folder or Project + objects. May be None, if the folder is empty. + variants: List of build variant strings. If none, a default list will + be used. + websiteProperties: Flag to decide if the website properties section + is generated. + """ + self.path = path + self.websiteProperties = websiteProperties + self.version = version + + # Copy passed lists (or set to empty lists) + self.entries = list(entries or []) + + if variants: + # Copy passed list + self.variants = variants[:] + else: + # Use default + self.variants = ['Debug|Win32', 'Release|Win32'] + # TODO(rspangler): Need to be able to handle a mapping of solution config + # to project config. Should we be able to handle variants being a dict, + # or add a separate variant_map variable? If it's a dict, we can't + # guarantee the order of variants since dict keys aren't ordered. + + + # TODO(rspangler): Automatically write to disk for now; should delay until + # node-evaluation time. + self.Write() + + + def Write(self, writer=gyp.common.WriteOnDiff): + """Writes the solution file to disk. + + Raises: + IndexError: An entry appears multiple times. + """ + # Walk the entry tree and collect all the folders and projects. + all_entries = set() + entries_to_check = self.entries[:] + while entries_to_check: + e = entries_to_check.pop(0) + + # If this entry has been visited, nothing to do. + if e in all_entries: + continue + + all_entries.add(e) + + # If this is a folder, check its entries too. + if isinstance(e, MSVSFolder): + entries_to_check += e.entries + + # Sort by name then guid (so things are in order on vs2008). + def NameThenGuid(a, b): + if a.name < b.name: return -1 + if a.name > b.name: return 1 + if a.get_guid() < b.get_guid(): return -1 + if a.get_guid() > b.get_guid(): return 1 + return 0 + + all_entries = sorted(all_entries, NameThenGuid) + + # Open file and print header + f = writer(self.path) + f.write('Microsoft Visual Studio Solution File, ' + 'Format Version %s\r\n' % self.version.SolutionVersion()) + f.write('# %s\r\n' % self.version.Description()) + + # Project entries + sln_root = os.path.split(self.path)[0] + for e in all_entries: + relative_path = gyp.common.RelativePath(e.path, sln_root) + # msbuild does not accept an empty folder_name. + # use '.' in case relative_path is empty. + folder_name = relative_path.replace('/', '\\') or '.' + f.write('Project("%s") = "%s", "%s", "%s"\r\n' % ( + e.entry_type_guid, # Entry type GUID + e.name, # Folder name + folder_name, # Folder name (again) + e.get_guid(), # Entry GUID + )) + + # TODO(rspangler): Need a way to configure this stuff + if self.websiteProperties: + f.write('\tProjectSection(WebsiteProperties) = preProject\r\n' + '\t\tDebug.AspNetCompiler.Debug = "True"\r\n' + '\t\tRelease.AspNetCompiler.Debug = "False"\r\n' + '\tEndProjectSection\r\n') + + if isinstance(e, MSVSFolder): + if e.items: + f.write('\tProjectSection(SolutionItems) = preProject\r\n') + for i in e.items: + f.write('\t\t%s = %s\r\n' % (i, i)) + f.write('\tEndProjectSection\r\n') + + if isinstance(e, MSVSProject): + if e.dependencies: + f.write('\tProjectSection(ProjectDependencies) = postProject\r\n') + for d in e.dependencies: + f.write('\t\t%s = %s\r\n' % (d.get_guid(), d.get_guid())) + f.write('\tEndProjectSection\r\n') + + f.write('EndProject\r\n') + + # Global section + f.write('Global\r\n') + + # Configurations (variants) + f.write('\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n') + for v in self.variants: + f.write('\t\t%s = %s\r\n' % (v, v)) + f.write('\tEndGlobalSection\r\n') + + # Sort config guids for easier diffing of solution changes. + config_guids = [] + config_guids_overrides = {} + for e in all_entries: + if isinstance(e, MSVSProject): + config_guids.append(e.get_guid()) + config_guids_overrides[e.get_guid()] = e.config_platform_overrides + config_guids.sort() + + f.write('\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n') + for g in config_guids: + for v in self.variants: + nv = config_guids_overrides[g].get(v, v) + # Pick which project configuration to build for this solution + # configuration. + f.write('\t\t%s.%s.ActiveCfg = %s\r\n' % ( + g, # Project GUID + v, # Solution build configuration + nv, # Project build config for that solution config + )) + + # Enable project in this solution configuration. + f.write('\t\t%s.%s.Build.0 = %s\r\n' % ( + g, # Project GUID + v, # Solution build configuration + nv, # Project build config for that solution config + )) + f.write('\tEndGlobalSection\r\n') + + # TODO(rspangler): Should be able to configure this stuff too (though I've + # never seen this be any different) + f.write('\tGlobalSection(SolutionProperties) = preSolution\r\n') + f.write('\t\tHideSolutionNode = FALSE\r\n') + f.write('\tEndGlobalSection\r\n') + + # Folder mappings + # TODO(rspangler): Should omit this section if there are no folders + f.write('\tGlobalSection(NestedProjects) = preSolution\r\n') + for e in all_entries: + if not isinstance(e, MSVSFolder): + continue # Does not apply to projects, only folders + for subentry in e.entries: + f.write('\t\t%s = %s\r\n' % (subentry.get_guid(), e.get_guid())) + f.write('\tEndGlobalSection\r\n') + + f.write('EndGlobal\r\n') + + f.close() diff --git a/tools/gyp/pylib/gyp/MSVSProject.py b/tools/gyp/pylib/gyp/MSVSProject.py new file mode 100644 index 000000000..db1ceede3 --- /dev/null +++ b/tools/gyp/pylib/gyp/MSVSProject.py @@ -0,0 +1,208 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Visual Studio project reader/writer.""" + +import gyp.common +import gyp.easy_xml as easy_xml + +#------------------------------------------------------------------------------ + + +class Tool(object): + """Visual Studio tool.""" + + def __init__(self, name, attrs=None): + """Initializes the tool. + + Args: + name: Tool name. + attrs: Dict of tool attributes; may be None. + """ + self._attrs = attrs or {} + self._attrs['Name'] = name + + def _GetSpecification(self): + """Creates an element for the tool. + + Returns: + A new xml.dom.Element for the tool. + """ + return ['Tool', self._attrs] + +class Filter(object): + """Visual Studio filter - that is, a virtual folder.""" + + def __init__(self, name, contents=None): + """Initializes the folder. + + Args: + name: Filter (folder) name. + contents: List of filenames and/or Filter objects contained. + """ + self.name = name + self.contents = list(contents or []) + + +#------------------------------------------------------------------------------ + + +class Writer(object): + """Visual Studio XML project writer.""" + + def __init__(self, project_path, version, name, guid=None, platforms=None): + """Initializes the project. + + Args: + project_path: Path to the project file. + version: Format version to emit. + name: Name of the project. + guid: GUID to use for project, if not None. + platforms: Array of string, the supported platforms. If null, ['Win32'] + """ + self.project_path = project_path + self.version = version + self.name = name + self.guid = guid + + # Default to Win32 for platforms. + if not platforms: + platforms = ['Win32'] + + # Initialize the specifications of the various sections. + self.platform_section = ['Platforms'] + for platform in platforms: + self.platform_section.append(['Platform', {'Name': platform}]) + self.tool_files_section = ['ToolFiles'] + self.configurations_section = ['Configurations'] + self.files_section = ['Files'] + + # Keep a dict keyed on filename to speed up access. + self.files_dict = dict() + + def AddToolFile(self, path): + """Adds a tool file to the project. + + Args: + path: Relative path from project to tool file. + """ + self.tool_files_section.append(['ToolFile', {'RelativePath': path}]) + + def _GetSpecForConfiguration(self, config_type, config_name, attrs, tools): + """Returns the specification for a configuration. + + Args: + config_type: Type of configuration node. + config_name: Configuration name. + attrs: Dict of configuration attributes; may be None. + tools: List of tools (strings or Tool objects); may be None. + Returns: + """ + # Handle defaults + if not attrs: + attrs = {} + if not tools: + tools = [] + + # Add configuration node and its attributes + node_attrs = attrs.copy() + node_attrs['Name'] = config_name + specification = [config_type, node_attrs] + + # Add tool nodes and their attributes + if tools: + for t in tools: + if isinstance(t, Tool): + specification.append(t._GetSpecification()) + else: + specification.append(Tool(t)._GetSpecification()) + return specification + + + def AddConfig(self, name, attrs=None, tools=None): + """Adds a configuration to the project. + + Args: + name: Configuration name. + attrs: Dict of configuration attributes; may be None. + tools: List of tools (strings or Tool objects); may be None. + """ + spec = self._GetSpecForConfiguration('Configuration', name, attrs, tools) + self.configurations_section.append(spec) + + def _AddFilesToNode(self, parent, files): + """Adds files and/or filters to the parent node. + + Args: + parent: Destination node + files: A list of Filter objects and/or relative paths to files. + + Will call itself recursively, if the files list contains Filter objects. + """ + for f in files: + if isinstance(f, Filter): + node = ['Filter', {'Name': f.name}] + self._AddFilesToNode(node, f.contents) + else: + node = ['File', {'RelativePath': f}] + self.files_dict[f] = node + parent.append(node) + + def AddFiles(self, files): + """Adds files to the project. + + Args: + files: A list of Filter objects and/or relative paths to files. + + This makes a copy of the file/filter tree at the time of this call. If you + later add files to a Filter object which was passed into a previous call + to AddFiles(), it will not be reflected in this project. + """ + self._AddFilesToNode(self.files_section, files) + # TODO(rspangler) This also doesn't handle adding files to an existing + # filter. That is, it doesn't merge the trees. + + def AddFileConfig(self, path, config, attrs=None, tools=None): + """Adds a configuration to a file. + + Args: + path: Relative path to the file. + config: Name of configuration to add. + attrs: Dict of configuration attributes; may be None. + tools: List of tools (strings or Tool objects); may be None. + + Raises: + ValueError: Relative path does not match any file added via AddFiles(). + """ + # Find the file node with the right relative path + parent = self.files_dict.get(path) + if not parent: + raise ValueError('AddFileConfig: file "%s" not in project.' % path) + + # Add the config to the file node + spec = self._GetSpecForConfiguration('FileConfiguration', config, attrs, + tools) + parent.append(spec) + + def WriteIfChanged(self): + """Writes the project file.""" + # First create XML content definition + content = [ + 'VisualStudioProject', + {'ProjectType': 'Visual C++', + 'Version': self.version.ProjectVersion(), + 'Name': self.name, + 'ProjectGUID': self.guid, + 'RootNamespace': self.name, + 'Keyword': 'Win32Proj' + }, + self.platform_section, + self.tool_files_section, + self.configurations_section, + ['References'], # empty section + self.files_section, + ['Globals'] # empty section + ] + easy_xml.WriteXmlIfChanged(content, self.project_path, + encoding="Windows-1252") diff --git a/tools/gyp/pylib/gyp/MSVSSettings.py b/tools/gyp/pylib/gyp/MSVSSettings.py new file mode 100644 index 000000000..3821fb925 --- /dev/null +++ b/tools/gyp/pylib/gyp/MSVSSettings.py @@ -0,0 +1,1032 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Code to validate and convert settings of the Microsoft build tools. + +This file contains code to validate and convert settings of the Microsoft +build tools. The function ConvertToMSBuildSettings(), ValidateMSVSSettings(), +and ValidateMSBuildSettings() are the entry points. + +This file was created by comparing the projects created by Visual Studio 2008 +and Visual Studio 2010 for all available settings through the user interface. +The MSBuild schemas were also considered. They are typically found in the +MSBuild install directory, e.g. c:\Program Files (x86)\MSBuild +""" + +import sys + + +# Dictionaries of settings validators. The key is the tool name, the value is +# a dictionary mapping setting names to validation functions. +_msvs_validators = {} +_msbuild_validators = {} + + +# A dictionary of settings converters. The key is the tool name, the value is +# a dictionary mapping setting names to conversion functions. +_msvs_to_msbuild_converters = {} + + +# Tool name mapping from MSVS to MSBuild. +_msbuild_name_of_tool = {} + + +class _Tool(object): + """Represents a tool used by MSVS or MSBuild. + + Attributes: + msvs_name: The name of the tool in MSVS. + msbuild_name: The name of the tool in MSBuild. + """ + + def __init__(self, msvs_name, msbuild_name): + self.msvs_name = msvs_name + self.msbuild_name = msbuild_name + + +def _AddTool(tool): + """Adds a tool to the four dictionaries used to process settings. + + This only defines the tool. Each setting also needs to be added. + + Args: + tool: The _Tool object to be added. + """ + _msvs_validators[tool.msvs_name] = {} + _msbuild_validators[tool.msbuild_name] = {} + _msvs_to_msbuild_converters[tool.msvs_name] = {} + _msbuild_name_of_tool[tool.msvs_name] = tool.msbuild_name + + +def _GetMSBuildToolSettings(msbuild_settings, tool): + """Returns an MSBuild tool dictionary. Creates it if needed.""" + return msbuild_settings.setdefault(tool.msbuild_name, {}) + + +class _Type(object): + """Type of settings (Base class).""" + + def ValidateMSVS(self, value): + """Verifies that the value is legal for MSVS. + + Args: + value: the value to check for this type. + + Raises: + ValueError if value is not valid for MSVS. + """ + + def ValidateMSBuild(self, value): + """Verifies that the value is legal for MSBuild. + + Args: + value: the value to check for this type. + + Raises: + ValueError if value is not valid for MSBuild. + """ + + def ConvertToMSBuild(self, value): + """Returns the MSBuild equivalent of the MSVS value given. + + Args: + value: the MSVS value to convert. + + Returns: + the MSBuild equivalent. + + Raises: + ValueError if value is not valid. + """ + return value + + +class _String(_Type): + """A setting that's just a string.""" + + def ValidateMSVS(self, value): + if not isinstance(value, basestring): + raise ValueError('expected string; got %r' % value) + + def ValidateMSBuild(self, value): + if not isinstance(value, basestring): + raise ValueError('expected string; got %r' % value) + + def ConvertToMSBuild(self, value): + # Convert the macros + return ConvertVCMacrosToMSBuild(value) + + +class _StringList(_Type): + """A settings that's a list of strings.""" + + def ValidateMSVS(self, value): + if not isinstance(value, basestring) and not isinstance(value, list): + raise ValueError('expected string list; got %r' % value) + + def ValidateMSBuild(self, value): + if not isinstance(value, basestring) and not isinstance(value, list): + raise ValueError('expected string list; got %r' % value) + + def ConvertToMSBuild(self, value): + # Convert the macros + if isinstance(value, list): + return [ConvertVCMacrosToMSBuild(i) for i in value] + else: + return ConvertVCMacrosToMSBuild(value) + + +class _Boolean(_Type): + """Boolean settings, can have the values 'false' or 'true'.""" + + def _Validate(self, value): + if value != 'true' and value != 'false': + raise ValueError('expected bool; got %r' % value) + + def ValidateMSVS(self, value): + self._Validate(value) + + def ValidateMSBuild(self, value): + self._Validate(value) + + def ConvertToMSBuild(self, value): + self._Validate(value) + return value + + +class _Integer(_Type): + """Integer settings.""" + + def __init__(self, msbuild_base=10): + _Type.__init__(self) + self._msbuild_base = msbuild_base + + def ValidateMSVS(self, value): + # Try to convert, this will raise ValueError if invalid. + self.ConvertToMSBuild(value) + + def ValidateMSBuild(self, value): + # Try to convert, this will raise ValueError if invalid. + int(value, self._msbuild_base) + + def ConvertToMSBuild(self, value): + msbuild_format = (self._msbuild_base == 10) and '%d' or '0x%04x' + return msbuild_format % int(value) + + +class _Enumeration(_Type): + """Type of settings that is an enumeration. + + In MSVS, the values are indexes like '0', '1', and '2'. + MSBuild uses text labels that are more representative, like 'Win32'. + + Constructor args: + label_list: an array of MSBuild labels that correspond to the MSVS index. + In the rare cases where MSVS has skipped an index value, None is + used in the array to indicate the unused spot. + new: an array of labels that are new to MSBuild. + """ + + def __init__(self, label_list, new=None): + _Type.__init__(self) + self._label_list = label_list + self._msbuild_values = set(value for value in label_list + if value is not None) + if new is not None: + self._msbuild_values.update(new) + + def ValidateMSVS(self, value): + # Try to convert. It will raise an exception if not valid. + self.ConvertToMSBuild(value) + + def ValidateMSBuild(self, value): + if value not in self._msbuild_values: + raise ValueError('unrecognized enumerated value %s' % value) + + def ConvertToMSBuild(self, value): + index = int(value) + if index < 0 or index >= len(self._label_list): + raise ValueError('index value (%d) not in expected range [0, %d)' % + (index, len(self._label_list))) + label = self._label_list[index] + if label is None: + raise ValueError('converted value for %s not specified.' % value) + return label + + +# Instantiate the various generic types. +_boolean = _Boolean() +_integer = _Integer() +# For now, we don't do any special validation on these types: +_string = _String() +_file_name = _String() +_folder_name = _String() +_file_list = _StringList() +_folder_list = _StringList() +_string_list = _StringList() +# Some boolean settings went from numerical values to boolean. The +# mapping is 0: default, 1: false, 2: true. +_newly_boolean = _Enumeration(['', 'false', 'true']) + + +def _Same(tool, name, setting_type): + """Defines a setting that has the same name in MSVS and MSBuild. + + Args: + tool: a dictionary that gives the names of the tool for MSVS and MSBuild. + name: the name of the setting. + setting_type: the type of this setting. + """ + _Renamed(tool, name, name, setting_type) + + +def _Renamed(tool, msvs_name, msbuild_name, setting_type): + """Defines a setting for which the name has changed. + + Args: + tool: a dictionary that gives the names of the tool for MSVS and MSBuild. + msvs_name: the name of the MSVS setting. + msbuild_name: the name of the MSBuild setting. + setting_type: the type of this setting. + """ + + def _Translate(value, msbuild_settings): + msbuild_tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool) + msbuild_tool_settings[msbuild_name] = setting_type.ConvertToMSBuild(value) + + _msvs_validators[tool.msvs_name][msvs_name] = setting_type.ValidateMSVS + _msbuild_validators[tool.msbuild_name][msbuild_name] = ( + setting_type.ValidateMSBuild) + _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate + + +def _Moved(tool, settings_name, msbuild_tool_name, setting_type): + _MovedAndRenamed(tool, settings_name, msbuild_tool_name, settings_name, + setting_type) + + +def _MovedAndRenamed(tool, msvs_settings_name, msbuild_tool_name, + msbuild_settings_name, setting_type): + """Defines a setting that may have moved to a new section. + + Args: + tool: a dictionary that gives the names of the tool for MSVS and MSBuild. + msvs_settings_name: the MSVS name of the setting. + msbuild_tool_name: the name of the MSBuild tool to place the setting under. + msbuild_settings_name: the MSBuild name of the setting. + setting_type: the type of this setting. + """ + + def _Translate(value, msbuild_settings): + tool_settings = msbuild_settings.setdefault(msbuild_tool_name, {}) + tool_settings[msbuild_settings_name] = setting_type.ConvertToMSBuild(value) + + _msvs_validators[tool.msvs_name][msvs_settings_name] = ( + setting_type.ValidateMSVS) + validator = setting_type.ValidateMSBuild + _msbuild_validators[msbuild_tool_name][msbuild_settings_name] = validator + _msvs_to_msbuild_converters[tool.msvs_name][msvs_settings_name] = _Translate + + +def _MSVSOnly(tool, name, setting_type): + """Defines a setting that is only found in MSVS. + + Args: + tool: a dictionary that gives the names of the tool for MSVS and MSBuild. + name: the name of the setting. + setting_type: the type of this setting. + """ + + def _Translate(unused_value, unused_msbuild_settings): + # Since this is for MSVS only settings, no translation will happen. + pass + + _msvs_validators[tool.msvs_name][name] = setting_type.ValidateMSVS + _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate + + +def _MSBuildOnly(tool, name, setting_type): + """Defines a setting that is only found in MSBuild. + + Args: + tool: a dictionary that gives the names of the tool for MSVS and MSBuild. + name: the name of the setting. + setting_type: the type of this setting. + """ + _msbuild_validators[tool.msbuild_name][name] = setting_type.ValidateMSBuild + + +def _ConvertedToAdditionalOption(tool, msvs_name, flag): + """Defines a setting that's handled via a command line option in MSBuild. + + Args: + tool: a dictionary that gives the names of the tool for MSVS and MSBuild. + msvs_name: the name of the MSVS setting that if 'true' becomes a flag + flag: the flag to insert at the end of the AdditionalOptions + """ + + def _Translate(value, msbuild_settings): + if value == 'true': + tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool) + if 'AdditionalOptions' in tool_settings: + new_flags = '%s %s' % (tool_settings['AdditionalOptions'], flag) + else: + new_flags = flag + tool_settings['AdditionalOptions'] = new_flags + _msvs_validators[tool.msvs_name][msvs_name] = _boolean.ValidateMSVS + _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate + + +def _CustomGeneratePreprocessedFile(tool, msvs_name): + def _Translate(value, msbuild_settings): + tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool) + if value == '0': + tool_settings['PreprocessToFile'] = 'false' + tool_settings['PreprocessSuppressLineNumbers'] = 'false' + elif value == '1': # /P + tool_settings['PreprocessToFile'] = 'true' + tool_settings['PreprocessSuppressLineNumbers'] = 'false' + elif value == '2': # /EP /P + tool_settings['PreprocessToFile'] = 'true' + tool_settings['PreprocessSuppressLineNumbers'] = 'true' + else: + raise ValueError('value must be one of [0, 1, 2]; got %s' % value) + # Create a bogus validator that looks for '0', '1', or '2' + msvs_validator = _Enumeration(['a', 'b', 'c']).ValidateMSVS + _msvs_validators[tool.msvs_name][msvs_name] = msvs_validator + msbuild_validator = _boolean.ValidateMSBuild + msbuild_tool_validators = _msbuild_validators[tool.msbuild_name] + msbuild_tool_validators['PreprocessToFile'] = msbuild_validator + msbuild_tool_validators['PreprocessSuppressLineNumbers'] = msbuild_validator + _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate + + +def ConvertVCMacrosToMSBuild(s): + """Convert the the MSVS macros found in the string to the MSBuild equivalent. + + This list is probably not exhaustive. Add as needed. + """ + if '$' in s: + replace_map = { + '$(ConfigurationName)': '$(Configuration)', + '$(InputDir)': '%(RootDir)%(Directory)', + '$(InputExt)': '%(Extension)', + '$(InputFileName)': '%(Filename)%(Extension)', + '$(InputName)': '%(Filename)', + '$(InputPath)': '%(FullPath)', + '$(ParentName)': '$(ProjectFileName)', + '$(PlatformName)': '$(Platform)', + '$(SafeInputName)': '%(Filename)', + + '$(IntDir)\\': '$(IntDir)', + '$(OutDir)\\': '$(OutDir)', + '$(IntDir)/': '$(IntDir)', + '$(OutDir)/': '$(OutDir)', + } + for old, new in replace_map.iteritems(): + s = s.replace(old, new) + return s + + +def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr): + """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+). + + Args: + msvs_settings: A dictionary. The key is the tool name. The values are + themselves dictionaries of settings and their values. + stderr: The stream receiving the error messages. + + Returns: + A dictionary of MSBuild settings. The key is either the MSBuild tool name + or the empty string (for the global settings). The values are themselves + dictionaries of settings and their values. + """ + msbuild_settings = {} + for msvs_tool_name, msvs_tool_settings in msvs_settings.iteritems(): + if msvs_tool_name in _msvs_to_msbuild_converters: + msvs_tool = _msvs_to_msbuild_converters[msvs_tool_name] + for msvs_setting, msvs_value in msvs_tool_settings.iteritems(): + if msvs_setting in msvs_tool: + # Invoke the translation function. + try: + msvs_tool[msvs_setting](msvs_value, msbuild_settings) + except ValueError, e: + print >> stderr, ('Warning: while converting %s/%s to MSBuild, ' + '%s' % (msvs_tool_name, msvs_setting, e)) + else: + # We don't know this setting. Give a warning. + print >> stderr, ('Warning: unrecognized setting %s/%s ' + 'while converting to MSBuild.' % + (msvs_tool_name, msvs_setting)) + else: + print >> stderr, ('Warning: unrecognized tool %s while converting to ' + 'MSBuild.' % msvs_tool_name) + return msbuild_settings + + +def ValidateMSVSSettings(settings, stderr=sys.stderr): + """Validates that the names of the settings are valid for MSVS. + + Args: + settings: A dictionary. The key is the tool name. The values are + themselves dictionaries of settings and their values. + stderr: The stream receiving the error messages. + """ + _ValidateSettings(_msvs_validators, settings, stderr) + + +def ValidateMSBuildSettings(settings, stderr=sys.stderr): + """Validates that the names of the settings are valid for MSBuild. + + Args: + settings: A dictionary. The key is the tool name. The values are + themselves dictionaries of settings and their values. + stderr: The stream receiving the error messages. + """ + _ValidateSettings(_msbuild_validators, settings, stderr) + + +def _ValidateSettings(validators, settings, stderr): + """Validates that the settings are valid for MSBuild or MSVS. + + We currently only validate the names of the settings, not their values. + + Args: + validators: A dictionary of tools and their validators. + settings: A dictionary. The key is the tool name. The values are + themselves dictionaries of settings and their values. + stderr: The stream receiving the error messages. + """ + for tool_name in settings: + if tool_name in validators: + tool_validators = validators[tool_name] + for setting, value in settings[tool_name].iteritems(): + if setting in tool_validators: + try: + tool_validators[setting](value) + except ValueError, e: + print >> stderr, ('Warning: for %s/%s, %s' % + (tool_name, setting, e)) + else: + print >> stderr, ('Warning: unrecognized setting %s/%s' % + (tool_name, setting)) + else: + print >> stderr, ('Warning: unrecognized tool %s' % tool_name) + + +# MSVS and MBuild names of the tools. +_compile = _Tool('VCCLCompilerTool', 'ClCompile') +_link = _Tool('VCLinkerTool', 'Link') +_midl = _Tool('VCMIDLTool', 'Midl') +_rc = _Tool('VCResourceCompilerTool', 'ResourceCompile') +_lib = _Tool('VCLibrarianTool', 'Lib') +_manifest = _Tool('VCManifestTool', 'Manifest') + + +_AddTool(_compile) +_AddTool(_link) +_AddTool(_midl) +_AddTool(_rc) +_AddTool(_lib) +_AddTool(_manifest) +# Add sections only found in the MSBuild settings. +_msbuild_validators[''] = {} +_msbuild_validators['ProjectReference'] = {} +_msbuild_validators['ManifestResourceCompile'] = {} + +# Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and +# ClCompile in MSBuild. +# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\cl.xml" for +# the schema of the MSBuild ClCompile settings. + +# Options that have the same name in MSVS and MSBuild +_Same(_compile, 'AdditionalIncludeDirectories', _folder_list) # /I +_Same(_compile, 'AdditionalOptions', _string_list) +_Same(_compile, 'AdditionalUsingDirectories', _folder_list) # /AI +_Same(_compile, 'AssemblerListingLocation', _file_name) # /Fa +_Same(_compile, 'BrowseInformationFile', _file_name) +_Same(_compile, 'BufferSecurityCheck', _boolean) # /GS +_Same(_compile, 'DisableLanguageExtensions', _boolean) # /Za +_Same(_compile, 'DisableSpecificWarnings', _string_list) # /wd +_Same(_compile, 'EnableFiberSafeOptimizations', _boolean) # /GT +_Same(_compile, 'EnablePREfast', _boolean) # /analyze Visible='false' +_Same(_compile, 'ExpandAttributedSource', _boolean) # /Fx +_Same(_compile, 'FloatingPointExceptions', _boolean) # /fp:except +_Same(_compile, 'ForceConformanceInForLoopScope', _boolean) # /Zc:forScope +_Same(_compile, 'ForcedIncludeFiles', _file_list) # /FI +_Same(_compile, 'ForcedUsingFiles', _file_list) # /FU +_Same(_compile, 'GenerateXMLDocumentationFiles', _boolean) # /doc +_Same(_compile, 'IgnoreStandardIncludePath', _boolean) # /X +_Same(_compile, 'MinimalRebuild', _boolean) # /Gm +_Same(_compile, 'OmitDefaultLibName', _boolean) # /Zl +_Same(_compile, 'OmitFramePointers', _boolean) # /Oy +_Same(_compile, 'PreprocessorDefinitions', _string_list) # /D +_Same(_compile, 'ProgramDataBaseFileName', _file_name) # /Fd +_Same(_compile, 'RuntimeTypeInfo', _boolean) # /GR +_Same(_compile, 'ShowIncludes', _boolean) # /showIncludes +_Same(_compile, 'SmallerTypeCheck', _boolean) # /RTCc +_Same(_compile, 'StringPooling', _boolean) # /GF +_Same(_compile, 'SuppressStartupBanner', _boolean) # /nologo +_Same(_compile, 'TreatWChar_tAsBuiltInType', _boolean) # /Zc:wchar_t +_Same(_compile, 'UndefineAllPreprocessorDefinitions', _boolean) # /u +_Same(_compile, 'UndefinePreprocessorDefinitions', _string_list) # /U +_Same(_compile, 'UseFullPaths', _boolean) # /FC +_Same(_compile, 'WholeProgramOptimization', _boolean) # /GL +_Same(_compile, 'XMLDocumentationFileName', _file_name) + +_Same(_compile, 'AssemblerOutput', + _Enumeration(['NoListing', + 'AssemblyCode', # /FA + 'All', # /FAcs + 'AssemblyAndMachineCode', # /FAc + 'AssemblyAndSourceCode'])) # /FAs +_Same(_compile, 'BasicRuntimeChecks', + _Enumeration(['Default', + 'StackFrameRuntimeCheck', # /RTCs + 'UninitializedLocalUsageCheck', # /RTCu + 'EnableFastChecks'])) # /RTC1 +_Same(_compile, 'BrowseInformation', + _Enumeration(['false', + 'true', # /FR + 'true'])) # /Fr +_Same(_compile, 'CallingConvention', + _Enumeration(['Cdecl', # /Gd + 'FastCall', # /Gr + 'StdCall'])) # /Gz +_Same(_compile, 'CompileAs', + _Enumeration(['Default', + 'CompileAsC', # /TC + 'CompileAsCpp'])) # /TP +_Same(_compile, 'DebugInformationFormat', + _Enumeration(['', # Disabled + 'OldStyle', # /Z7 + None, + 'ProgramDatabase', # /Zi + 'EditAndContinue'])) # /ZI +_Same(_compile, 'EnableEnhancedInstructionSet', + _Enumeration(['NotSet', + 'StreamingSIMDExtensions', # /arch:SSE + 'StreamingSIMDExtensions2'])) # /arch:SSE2 +_Same(_compile, 'ErrorReporting', + _Enumeration(['None', # /errorReport:none + 'Prompt', # /errorReport:prompt + 'Queue'], # /errorReport:queue + new=['Send'])) # /errorReport:send" +_Same(_compile, 'ExceptionHandling', + _Enumeration(['false', + 'Sync', # /EHsc + 'Async'], # /EHa + new=['SyncCThrow'])) # /EHs +_Same(_compile, 'FavorSizeOrSpeed', + _Enumeration(['Neither', + 'Speed', # /Ot + 'Size'])) # /Os +_Same(_compile, 'FloatingPointModel', + _Enumeration(['Precise', # /fp:precise + 'Strict', # /fp:strict + 'Fast'])) # /fp:fast +_Same(_compile, 'InlineFunctionExpansion', + _Enumeration(['Default', + 'OnlyExplicitInline', # /Ob1 + 'AnySuitable'], # /Ob2 + new=['Disabled'])) # /Ob0 +_Same(_compile, 'Optimization', + _Enumeration(['Disabled', # /Od + 'MinSpace', # /O1 + 'MaxSpeed', # /O2 + 'Full'])) # /Ox +_Same(_compile, 'RuntimeLibrary', + _Enumeration(['MultiThreaded', # /MT + 'MultiThreadedDebug', # /MTd + 'MultiThreadedDLL', # /MD + 'MultiThreadedDebugDLL'])) # /MDd +_Same(_compile, 'StructMemberAlignment', + _Enumeration(['Default', + '1Byte', # /Zp1 + '2Bytes', # /Zp2 + '4Bytes', # /Zp4 + '8Bytes', # /Zp8 + '16Bytes'])) # /Zp16 +_Same(_compile, 'WarningLevel', + _Enumeration(['TurnOffAllWarnings', # /W0 + 'Level1', # /W1 + 'Level2', # /W2 + 'Level3', # /W3 + 'Level4'], # /W4 + new=['EnableAllWarnings'])) # /Wall + +# Options found in MSVS that have been renamed in MSBuild. +_Renamed(_compile, 'EnableFunctionLevelLinking', 'FunctionLevelLinking', + _boolean) # /Gy +_Renamed(_compile, 'EnableIntrinsicFunctions', 'IntrinsicFunctions', + _boolean) # /Oi +_Renamed(_compile, 'KeepComments', 'PreprocessKeepComments', _boolean) # /C +_Renamed(_compile, 'ObjectFile', 'ObjectFileName', _file_name) # /Fo +_Renamed(_compile, 'OpenMP', 'OpenMPSupport', _boolean) # /openmp +_Renamed(_compile, 'PrecompiledHeaderThrough', 'PrecompiledHeaderFile', + _file_name) # Used with /Yc and /Yu +_Renamed(_compile, 'PrecompiledHeaderFile', 'PrecompiledHeaderOutputFile', + _file_name) # /Fp +_Renamed(_compile, 'UsePrecompiledHeader', 'PrecompiledHeader', + _Enumeration(['NotUsing', # VS recognized '' for this value too. + 'Create', # /Yc + 'Use'])) # /Yu +_Renamed(_compile, 'WarnAsError', 'TreatWarningAsError', _boolean) # /WX + +_ConvertedToAdditionalOption(_compile, 'DefaultCharIsUnsigned', '/J') + +# MSVS options not found in MSBuild. +_MSVSOnly(_compile, 'Detect64BitPortabilityProblems', _boolean) +_MSVSOnly(_compile, 'UseUnicodeResponseFiles', _boolean) + +# MSBuild options not found in MSVS. +_MSBuildOnly(_compile, 'BuildingInIDE', _boolean) +_MSBuildOnly(_compile, 'CompileAsManaged', + _Enumeration([], new=['false', + 'true', # /clr + 'Pure', # /clr:pure + 'Safe', # /clr:safe + 'OldSyntax'])) # /clr:oldSyntax +_MSBuildOnly(_compile, 'CreateHotpatchableImage', _boolean) # /hotpatch +_MSBuildOnly(_compile, 'MultiProcessorCompilation', _boolean) # /MP +_MSBuildOnly(_compile, 'PreprocessOutputPath', _string) # /Fi +_MSBuildOnly(_compile, 'ProcessorNumber', _integer) # the number of processors +_MSBuildOnly(_compile, 'TrackerLogDirectory', _folder_name) +_MSBuildOnly(_compile, 'TreatSpecificWarningsAsErrors', _string_list) # /we +_MSBuildOnly(_compile, 'UseUnicodeForAssemblerListing', _boolean) # /FAu + +# Defines a setting that needs very customized processing +_CustomGeneratePreprocessedFile(_compile, 'GeneratePreprocessedFile') + + +# Directives for converting MSVS VCLinkerTool to MSBuild Link. +# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\link.xml" for +# the schema of the MSBuild Link settings. + +# Options that have the same name in MSVS and MSBuild +_Same(_link, 'AdditionalDependencies', _file_list) +_Same(_link, 'AdditionalLibraryDirectories', _folder_list) # /LIBPATH +# /MANIFESTDEPENDENCY: +_Same(_link, 'AdditionalManifestDependencies', _file_list) +_Same(_link, 'AdditionalOptions', _string_list) +_Same(_link, 'AddModuleNamesToAssembly', _file_list) # /ASSEMBLYMODULE +_Same(_link, 'AllowIsolation', _boolean) # /ALLOWISOLATION +_Same(_link, 'AssemblyLinkResource', _file_list) # /ASSEMBLYLINKRESOURCE +_Same(_link, 'BaseAddress', _string) # /BASE +_Same(_link, 'CLRUnmanagedCodeCheck', _boolean) # /CLRUNMANAGEDCODECHECK +_Same(_link, 'DelayLoadDLLs', _file_list) # /DELAYLOAD +_Same(_link, 'DelaySign', _boolean) # /DELAYSIGN +_Same(_link, 'EmbedManagedResourceFile', _file_list) # /ASSEMBLYRESOURCE +_Same(_link, 'EnableUAC', _boolean) # /MANIFESTUAC +_Same(_link, 'EntryPointSymbol', _string) # /ENTRY +_Same(_link, 'ForceSymbolReferences', _file_list) # /INCLUDE +_Same(_link, 'FunctionOrder', _file_name) # /ORDER +_Same(_link, 'GenerateDebugInformation', _boolean) # /DEBUG +_Same(_link, 'GenerateMapFile', _boolean) # /MAP +_Same(_link, 'HeapCommitSize', _string) +_Same(_link, 'HeapReserveSize', _string) # /HEAP +_Same(_link, 'IgnoreAllDefaultLibraries', _boolean) # /NODEFAULTLIB +_Same(_link, 'IgnoreEmbeddedIDL', _boolean) # /IGNOREIDL +_Same(_link, 'ImportLibrary', _file_name) # /IMPLIB +_Same(_link, 'KeyContainer', _file_name) # /KEYCONTAINER +_Same(_link, 'KeyFile', _file_name) # /KEYFILE +_Same(_link, 'ManifestFile', _file_name) # /ManifestFile +_Same(_link, 'MapExports', _boolean) # /MAPINFO:EXPORTS +_Same(_link, 'MapFileName', _file_name) +_Same(_link, 'MergedIDLBaseFileName', _file_name) # /IDLOUT +_Same(_link, 'MergeSections', _string) # /MERGE +_Same(_link, 'MidlCommandFile', _file_name) # /MIDL +_Same(_link, 'ModuleDefinitionFile', _file_name) # /DEF +_Same(_link, 'OutputFile', _file_name) # /OUT +_Same(_link, 'PerUserRedirection', _boolean) +_Same(_link, 'Profile', _boolean) # /PROFILE +_Same(_link, 'ProfileGuidedDatabase', _file_name) # /PGD +_Same(_link, 'ProgramDatabaseFile', _file_name) # /PDB +_Same(_link, 'RegisterOutput', _boolean) +_Same(_link, 'SetChecksum', _boolean) # /RELEASE +_Same(_link, 'StackCommitSize', _string) +_Same(_link, 'StackReserveSize', _string) # /STACK +_Same(_link, 'StripPrivateSymbols', _file_name) # /PDBSTRIPPED +_Same(_link, 'SupportUnloadOfDelayLoadedDLL', _boolean) # /DELAY:UNLOAD +_Same(_link, 'SuppressStartupBanner', _boolean) # /NOLOGO +_Same(_link, 'SwapRunFromCD', _boolean) # /SWAPRUN:CD +_Same(_link, 'TurnOffAssemblyGeneration', _boolean) # /NOASSEMBLY +_Same(_link, 'TypeLibraryFile', _file_name) # /TLBOUT +_Same(_link, 'TypeLibraryResourceID', _integer) # /TLBID +_Same(_link, 'UACUIAccess', _boolean) # /uiAccess='true' +_Same(_link, 'Version', _string) # /VERSION + +_Same(_link, 'EnableCOMDATFolding', _newly_boolean) # /OPT:ICF +_Same(_link, 'FixedBaseAddress', _newly_boolean) # /FIXED +_Same(_link, 'LargeAddressAware', _newly_boolean) # /LARGEADDRESSAWARE +_Same(_link, 'OptimizeReferences', _newly_boolean) # /OPT:REF +_Same(_link, 'RandomizedBaseAddress', _newly_boolean) # /DYNAMICBASE +_Same(_link, 'TerminalServerAware', _newly_boolean) # /TSAWARE + +_subsystem_enumeration = _Enumeration( + ['NotSet', + 'Console', # /SUBSYSTEM:CONSOLE + 'Windows', # /SUBSYSTEM:WINDOWS + 'Native', # /SUBSYSTEM:NATIVE + 'EFI Application', # /SUBSYSTEM:EFI_APPLICATION + 'EFI Boot Service Driver', # /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER + 'EFI ROM', # /SUBSYSTEM:EFI_ROM + 'EFI Runtime', # /SUBSYSTEM:EFI_RUNTIME_DRIVER + 'WindowsCE'], # /SUBSYSTEM:WINDOWSCE + new=['POSIX']) # /SUBSYSTEM:POSIX + +_target_machine_enumeration = _Enumeration( + ['NotSet', + 'MachineX86', # /MACHINE:X86 + None, + 'MachineARM', # /MACHINE:ARM + 'MachineEBC', # /MACHINE:EBC + 'MachineIA64', # /MACHINE:IA64 + None, + 'MachineMIPS', # /MACHINE:MIPS + 'MachineMIPS16', # /MACHINE:MIPS16 + 'MachineMIPSFPU', # /MACHINE:MIPSFPU + 'MachineMIPSFPU16', # /MACHINE:MIPSFPU16 + None, + None, + None, + 'MachineSH4', # /MACHINE:SH4 + None, + 'MachineTHUMB', # /MACHINE:THUMB + 'MachineX64']) # /MACHINE:X64 + +_Same(_link, 'AssemblyDebug', + _Enumeration(['', + 'true', # /ASSEMBLYDEBUG + 'false'])) # /ASSEMBLYDEBUG:DISABLE +_Same(_link, 'CLRImageType', + _Enumeration(['Default', + 'ForceIJWImage', # /CLRIMAGETYPE:IJW + 'ForcePureILImage', # /Switch="CLRIMAGETYPE:PURE + 'ForceSafeILImage'])) # /Switch="CLRIMAGETYPE:SAFE +_Same(_link, 'CLRThreadAttribute', + _Enumeration(['DefaultThreadingAttribute', # /CLRTHREADATTRIBUTE:NONE + 'MTAThreadingAttribute', # /CLRTHREADATTRIBUTE:MTA + 'STAThreadingAttribute'])) # /CLRTHREADATTRIBUTE:STA +_Same(_link, 'DataExecutionPrevention', + _Enumeration(['', + 'false', # /NXCOMPAT:NO + 'true'])) # /NXCOMPAT +_Same(_link, 'Driver', + _Enumeration(['NotSet', + 'Driver', # /Driver + 'UpOnly', # /DRIVER:UPONLY + 'WDM'])) # /DRIVER:WDM +_Same(_link, 'LinkTimeCodeGeneration', + _Enumeration(['Default', + 'UseLinkTimeCodeGeneration', # /LTCG + 'PGInstrument', # /LTCG:PGInstrument + 'PGOptimization', # /LTCG:PGOptimize + 'PGUpdate'])) # /LTCG:PGUpdate +_Same(_link, 'ShowProgress', + _Enumeration(['NotSet', + 'LinkVerbose', # /VERBOSE + 'LinkVerboseLib'], # /VERBOSE:Lib + new=['LinkVerboseICF', # /VERBOSE:ICF + 'LinkVerboseREF', # /VERBOSE:REF + 'LinkVerboseSAFESEH', # /VERBOSE:SAFESEH + 'LinkVerboseCLR'])) # /VERBOSE:CLR +_Same(_link, 'SubSystem', _subsystem_enumeration) +_Same(_link, 'TargetMachine', _target_machine_enumeration) +_Same(_link, 'UACExecutionLevel', + _Enumeration(['AsInvoker', # /level='asInvoker' + 'HighestAvailable', # /level='highestAvailable' + 'RequireAdministrator'])) # /level='requireAdministrator' + + +# Options found in MSVS that have been renamed in MSBuild. +_Renamed(_link, 'ErrorReporting', 'LinkErrorReporting', + _Enumeration(['NoErrorReport', # /ERRORREPORT:NONE + 'PromptImmediately', # /ERRORREPORT:PROMPT + 'QueueForNextLogin'], # /ERRORREPORT:QUEUE + new=['SendErrorReport'])) # /ERRORREPORT:SEND +_Renamed(_link, 'IgnoreDefaultLibraryNames', 'IgnoreSpecificDefaultLibraries', + _file_list) # /NODEFAULTLIB +_Renamed(_link, 'ResourceOnlyDLL', 'NoEntryPoint', _boolean) # /NOENTRY +_Renamed(_link, 'SwapRunFromNet', 'SwapRunFromNET', _boolean) # /SWAPRUN:NET + +_Moved(_link, 'GenerateManifest', '', _boolean) +_Moved(_link, 'IgnoreImportLibrary', '', _boolean) +_Moved(_link, 'LinkIncremental', '', _newly_boolean) +_Moved(_link, 'LinkLibraryDependencies', 'ProjectReference', _boolean) +_Moved(_link, 'UseLibraryDependencyInputs', 'ProjectReference', _boolean) + +# MSVS options not found in MSBuild. +_MSVSOnly(_link, 'OptimizeForWindows98', _newly_boolean) +_MSVSOnly(_link, 'UseUnicodeResponseFiles', _boolean) +# TODO(jeanluc) I don't think these are genuine settings but byproducts of Gyp. +_MSVSOnly(_link, 'AdditionalLibraryDirectories_excluded', _folder_list) + +# MSBuild options not found in MSVS. +_MSBuildOnly(_link, 'BuildingInIDE', _boolean) +_MSBuildOnly(_link, 'ImageHasSafeExceptionHandlers', _boolean) # /SAFESEH +_MSBuildOnly(_link, 'LinkDLL', _boolean) # /DLL Visible='false' +_MSBuildOnly(_link, 'LinkStatus', _boolean) # /LTCG:STATUS +_MSBuildOnly(_link, 'PreventDllBinding', _boolean) # /ALLOWBIND +_MSBuildOnly(_link, 'SupportNobindOfDelayLoadedDLL', _boolean) # /DELAY:NOBIND +_MSBuildOnly(_link, 'TrackerLogDirectory', _folder_name) +_MSBuildOnly(_link, 'TreatLinkerWarningAsErrors', _boolean) # /WX +_MSBuildOnly(_link, 'MinimumRequiredVersion', _string) +_MSBuildOnly(_link, 'MSDOSStubFileName', _file_name) # /STUB Visible='false' +_MSBuildOnly(_link, 'SectionAlignment', _integer) # /ALIGN +_MSBuildOnly(_link, 'SpecifySectionAttributes', _string) # /SECTION +_MSBuildOnly(_link, 'ForceFileOutput', + _Enumeration([], new=['Enabled', # /FORCE + # /FORCE:MULTIPLE + 'MultiplyDefinedSymbolOnly', + 'UndefinedSymbolOnly'])) # /FORCE:UNRESOLVED +_MSBuildOnly(_link, 'CreateHotPatchableImage', + _Enumeration([], new=['Enabled', # /FUNCTIONPADMIN + 'X86Image', # /FUNCTIONPADMIN:5 + 'X64Image', # /FUNCTIONPADMIN:6 + 'ItaniumImage'])) # /FUNCTIONPADMIN:16 +_MSBuildOnly(_link, 'CLRSupportLastError', + _Enumeration([], new=['Enabled', # /CLRSupportLastError + 'Disabled', # /CLRSupportLastError:NO + # /CLRSupportLastError:SYSTEMDLL + 'SystemDlls'])) + + +# Directives for converting VCResourceCompilerTool to ResourceCompile. +# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\rc.xml" for +# the schema of the MSBuild ResourceCompile settings. + +_Same(_rc, 'AdditionalOptions', _string_list) +_Same(_rc, 'AdditionalIncludeDirectories', _folder_list) # /I +_Same(_rc, 'Culture', _Integer(msbuild_base=16)) +_Same(_rc, 'IgnoreStandardIncludePath', _boolean) # /X +_Same(_rc, 'PreprocessorDefinitions', _string_list) # /D +_Same(_rc, 'ResourceOutputFileName', _string) # /fo +_Same(_rc, 'ShowProgress', _boolean) # /v +# There is no UI in VisualStudio 2008 to set the following properties. +# However they are found in CL and other tools. Include them here for +# completeness, as they are very likely to have the same usage pattern. +_Same(_rc, 'SuppressStartupBanner', _boolean) # /nologo +_Same(_rc, 'UndefinePreprocessorDefinitions', _string_list) # /u + +# MSBuild options not found in MSVS. +_MSBuildOnly(_rc, 'NullTerminateStrings', _boolean) # /n +_MSBuildOnly(_rc, 'TrackerLogDirectory', _folder_name) + + +# Directives for converting VCMIDLTool to Midl. +# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\midl.xml" for +# the schema of the MSBuild Midl settings. + +_Same(_midl, 'AdditionalIncludeDirectories', _folder_list) # /I +_Same(_midl, 'AdditionalOptions', _string_list) +_Same(_midl, 'CPreprocessOptions', _string) # /cpp_opt +_Same(_midl, 'ErrorCheckAllocations', _boolean) # /error allocation +_Same(_midl, 'ErrorCheckBounds', _boolean) # /error bounds_check +_Same(_midl, 'ErrorCheckEnumRange', _boolean) # /error enum +_Same(_midl, 'ErrorCheckRefPointers', _boolean) # /error ref +_Same(_midl, 'ErrorCheckStubData', _boolean) # /error stub_data +_Same(_midl, 'GenerateStublessProxies', _boolean) # /Oicf +_Same(_midl, 'GenerateTypeLibrary', _boolean) +_Same(_midl, 'HeaderFileName', _file_name) # /h +_Same(_midl, 'IgnoreStandardIncludePath', _boolean) # /no_def_idir +_Same(_midl, 'InterfaceIdentifierFileName', _file_name) # /iid +_Same(_midl, 'MkTypLibCompatible', _boolean) # /mktyplib203 +_Same(_midl, 'OutputDirectory', _string) # /out +_Same(_midl, 'PreprocessorDefinitions', _string_list) # /D +_Same(_midl, 'ProxyFileName', _file_name) # /proxy +_Same(_midl, 'RedirectOutputAndErrors', _file_name) # /o +_Same(_midl, 'SuppressStartupBanner', _boolean) # /nologo +_Same(_midl, 'TypeLibraryName', _file_name) # /tlb +_Same(_midl, 'UndefinePreprocessorDefinitions', _string_list) # /U +_Same(_midl, 'WarnAsError', _boolean) # /WX + +_Same(_midl, 'DefaultCharType', + _Enumeration(['Unsigned', # /char unsigned + 'Signed', # /char signed + 'Ascii'])) # /char ascii7 +_Same(_midl, 'TargetEnvironment', + _Enumeration(['NotSet', + 'Win32', # /env win32 + 'Itanium', # /env ia64 + 'X64'])) # /env x64 +_Same(_midl, 'EnableErrorChecks', + _Enumeration(['EnableCustom', + 'None', # /error none + 'All'])) # /error all +_Same(_midl, 'StructMemberAlignment', + _Enumeration(['NotSet', + '1', # Zp1 + '2', # Zp2 + '4', # Zp4 + '8'])) # Zp8 +_Same(_midl, 'WarningLevel', + _Enumeration(['0', # /W0 + '1', # /W1 + '2', # /W2 + '3', # /W3 + '4'])) # /W4 + +_Renamed(_midl, 'DLLDataFileName', 'DllDataFileName', _file_name) # /dlldata +_Renamed(_midl, 'ValidateParameters', 'ValidateAllParameters', + _boolean) # /robust + +# MSBuild options not found in MSVS. +_MSBuildOnly(_midl, 'ApplicationConfigurationMode', _boolean) # /app_config +_MSBuildOnly(_midl, 'ClientStubFile', _file_name) # /cstub +_MSBuildOnly(_midl, 'GenerateClientFiles', + _Enumeration([], new=['Stub', # /client stub + 'None'])) # /client none +_MSBuildOnly(_midl, 'GenerateServerFiles', + _Enumeration([], new=['Stub', # /client stub + 'None'])) # /client none +_MSBuildOnly(_midl, 'LocaleID', _integer) # /lcid DECIMAL +_MSBuildOnly(_midl, 'ServerStubFile', _file_name) # /sstub +_MSBuildOnly(_midl, 'SuppressCompilerWarnings', _boolean) # /no_warn +_MSBuildOnly(_midl, 'TrackerLogDirectory', _folder_name) +_MSBuildOnly(_midl, 'TypeLibFormat', + _Enumeration([], new=['NewFormat', # /newtlb + 'OldFormat'])) # /oldtlb + + +# Directives for converting VCLibrarianTool to Lib. +# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\lib.xml" for +# the schema of the MSBuild Lib settings. + +_Same(_lib, 'AdditionalDependencies', _file_list) +_Same(_lib, 'AdditionalLibraryDirectories', _folder_list) # /LIBPATH +_Same(_lib, 'AdditionalOptions', _string_list) +_Same(_lib, 'ExportNamedFunctions', _string_list) # /EXPORT +_Same(_lib, 'ForceSymbolReferences', _string) # /INCLUDE +_Same(_lib, 'IgnoreAllDefaultLibraries', _boolean) # /NODEFAULTLIB +_Same(_lib, 'IgnoreSpecificDefaultLibraries', _file_list) # /NODEFAULTLIB +_Same(_lib, 'ModuleDefinitionFile', _file_name) # /DEF +_Same(_lib, 'OutputFile', _file_name) # /OUT +_Same(_lib, 'SuppressStartupBanner', _boolean) # /NOLOGO +_Same(_lib, 'UseUnicodeResponseFiles', _boolean) +_Same(_lib, 'LinkTimeCodeGeneration', _boolean) # /LTCG + +# TODO(jeanluc) _link defines the same value that gets moved to +# ProjectReference. We may want to validate that they are consistent. +_Moved(_lib, 'LinkLibraryDependencies', 'ProjectReference', _boolean) + +# TODO(jeanluc) I don't think these are genuine settings but byproducts of Gyp. +_MSVSOnly(_lib, 'AdditionalLibraryDirectories_excluded', _folder_list) + +_MSBuildOnly(_lib, 'DisplayLibrary', _string) # /LIST Visible='false' +_MSBuildOnly(_lib, 'ErrorReporting', + _Enumeration([], new=['PromptImmediately', # /ERRORREPORT:PROMPT + 'QueueForNextLogin', # /ERRORREPORT:QUEUE + 'SendErrorReport', # /ERRORREPORT:SEND + 'NoErrorReport'])) # /ERRORREPORT:NONE +_MSBuildOnly(_lib, 'MinimumRequiredVersion', _string) +_MSBuildOnly(_lib, 'Name', _file_name) # /NAME +_MSBuildOnly(_lib, 'RemoveObjects', _file_list) # /REMOVE +_MSBuildOnly(_lib, 'SubSystem', _subsystem_enumeration) +_MSBuildOnly(_lib, 'TargetMachine', _target_machine_enumeration) +_MSBuildOnly(_lib, 'TrackerLogDirectory', _folder_name) +_MSBuildOnly(_lib, 'TreatLibWarningAsErrors', _boolean) # /WX +_MSBuildOnly(_lib, 'Verbose', _boolean) + + +# Directives for converting VCManifestTool to Mt. +# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\mt.xml" for +# the schema of the MSBuild Lib settings. + +# Options that have the same name in MSVS and MSBuild +_Same(_manifest, 'AdditionalManifestFiles', _file_list) # /manifest +_Same(_manifest, 'AdditionalOptions', _string_list) +_Same(_manifest, 'AssemblyIdentity', _string) # /identity: +_Same(_manifest, 'ComponentFileName', _file_name) # /dll +_Same(_manifest, 'GenerateCatalogFiles', _boolean) # /makecdfs +_Same(_manifest, 'InputResourceManifests', _string) # /inputresource +_Same(_manifest, 'OutputManifestFile', _file_name) # /out +_Same(_manifest, 'RegistrarScriptFile', _file_name) # /rgs +_Same(_manifest, 'ReplacementsFile', _file_name) # /replacements +_Same(_manifest, 'SuppressStartupBanner', _boolean) # /nologo +_Same(_manifest, 'TypeLibraryFile', _file_name) # /tlb: +_Same(_manifest, 'UpdateFileHashes', _boolean) # /hashupdate +_Same(_manifest, 'UpdateFileHashesSearchPath', _file_name) +_Same(_manifest, 'VerboseOutput', _boolean) # /verbose + +# Options that have moved location. +_MovedAndRenamed(_manifest, 'ManifestResourceFile', + 'ManifestResourceCompile', + 'ResourceOutputFileName', + _file_name) +_Moved(_manifest, 'EmbedManifest', '', _boolean) + +# MSVS options not found in MSBuild. +_MSVSOnly(_manifest, 'DependencyInformationFile', _file_name) +_MSVSOnly(_manifest, 'UseFAT32Workaround', _boolean) +_MSVSOnly(_manifest, 'UseUnicodeResponseFiles', _boolean) + +# MSBuild options not found in MSVS. +_MSBuildOnly(_manifest, 'EnableDPIAwareness', _boolean) +_MSBuildOnly(_manifest, 'GenerateCategoryTags', _boolean) # /category +_MSBuildOnly(_manifest, 'ManifestFromManagedAssembly', + _file_name) # /managedassemblyname +_MSBuildOnly(_manifest, 'OutputResourceManifests', _string) # /outputresource +_MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean) # /nodependency +_MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name) diff --git a/tools/gyp/pylib/gyp/MSVSSettings_test.py b/tools/gyp/pylib/gyp/MSVSSettings_test.py new file mode 100755 index 000000000..4e06da3bb --- /dev/null +++ b/tools/gyp/pylib/gyp/MSVSSettings_test.py @@ -0,0 +1,1482 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Unit tests for the MSVSSettings.py file.""" + +import StringIO +import unittest +import gyp.MSVSSettings as MSVSSettings + + +class TestSequenceFunctions(unittest.TestCase): + + def setUp(self): + self.stderr = StringIO.StringIO() + + def _ExpectedWarnings(self, expected): + """Compares recorded lines to expected warnings.""" + self.stderr.seek(0) + actual = self.stderr.read().split('\n') + actual = [line for line in actual if line] + self.assertEqual(sorted(expected), sorted(actual)) + + def testValidateMSVSSettings_tool_names(self): + """Tests that only MSVS tool names are allowed.""" + MSVSSettings.ValidateMSVSSettings( + {'VCCLCompilerTool': {}, + 'VCLinkerTool': {}, + 'VCMIDLTool': {}, + 'foo': {}, + 'VCResourceCompilerTool': {}, + 'VCLibrarianTool': {}, + 'VCManifestTool': {}, + 'ClCompile': {}}, + self.stderr) + self._ExpectedWarnings([ + 'Warning: unrecognized tool foo', + 'Warning: unrecognized tool ClCompile']) + + def testValidateMSVSSettings_settings(self): + """Tests that for invalid MSVS settings.""" + MSVSSettings.ValidateMSVSSettings( + {'VCCLCompilerTool': { + 'AdditionalIncludeDirectories': 'folder1;folder2', + 'AdditionalOptions': ['string1', 'string2'], + 'AdditionalUsingDirectories': 'folder1;folder2', + 'AssemblerListingLocation': 'a_file_name', + 'AssemblerOutput': '0', + 'BasicRuntimeChecks': '5', + 'BrowseInformation': 'fdkslj', + 'BrowseInformationFile': 'a_file_name', + 'BufferSecurityCheck': 'true', + 'CallingConvention': '-1', + 'CompileAs': '1', + 'DebugInformationFormat': '2', + 'DefaultCharIsUnsigned': 'true', + 'Detect64BitPortabilityProblems': 'true', + 'DisableLanguageExtensions': 'true', + 'DisableSpecificWarnings': 'string1;string2', + 'EnableEnhancedInstructionSet': '1', + 'EnableFiberSafeOptimizations': 'true', + 'EnableFunctionLevelLinking': 'true', + 'EnableIntrinsicFunctions': 'true', + 'EnablePREfast': 'true', + 'Enableprefast': 'bogus', + 'ErrorReporting': '1', + 'ExceptionHandling': '1', + 'ExpandAttributedSource': 'true', + 'FavorSizeOrSpeed': '1', + 'FloatingPointExceptions': 'true', + 'FloatingPointModel': '1', + 'ForceConformanceInForLoopScope': 'true', + 'ForcedIncludeFiles': 'file1;file2', + 'ForcedUsingFiles': 'file1;file2', + 'GeneratePreprocessedFile': '1', + 'GenerateXMLDocumentationFiles': 'true', + 'IgnoreStandardIncludePath': 'true', + 'InlineFunctionExpansion': '1', + 'KeepComments': 'true', + 'MinimalRebuild': 'true', + 'ObjectFile': 'a_file_name', + 'OmitDefaultLibName': 'true', + 'OmitFramePointers': 'true', + 'OpenMP': 'true', + 'Optimization': '1', + 'PrecompiledHeaderFile': 'a_file_name', + 'PrecompiledHeaderThrough': 'a_file_name', + 'PreprocessorDefinitions': 'string1;string2', + 'ProgramDataBaseFileName': 'a_file_name', + 'RuntimeLibrary': '1', + 'RuntimeTypeInfo': 'true', + 'ShowIncludes': 'true', + 'SmallerTypeCheck': 'true', + 'StringPooling': 'true', + 'StructMemberAlignment': '1', + 'SuppressStartupBanner': 'true', + 'TreatWChar_tAsBuiltInType': 'true', + 'UndefineAllPreprocessorDefinitions': 'true', + 'UndefinePreprocessorDefinitions': 'string1;string2', + 'UseFullPaths': 'true', + 'UsePrecompiledHeader': '1', + 'UseUnicodeResponseFiles': 'true', + 'WarnAsError': 'true', + 'WarningLevel': '1', + 'WholeProgramOptimization': 'true', + 'XMLDocumentationFileName': 'a_file_name', + 'ZZXYZ': 'bogus'}, + 'VCLinkerTool': { + 'AdditionalDependencies': 'file1;file2', + 'AdditionalLibraryDirectories': 'folder1;folder2', + 'AdditionalManifestDependencies': 'file1;file2', + 'AdditionalOptions': 'a string1', + 'AddModuleNamesToAssembly': 'file1;file2', + 'AllowIsolation': 'true', + 'AssemblyDebug': '2', + 'AssemblyLinkResource': 'file1;file2', + 'BaseAddress': 'a string1', + 'CLRImageType': '2', + 'CLRThreadAttribute': '2', + 'CLRUnmanagedCodeCheck': 'true', + 'DataExecutionPrevention': '2', + 'DelayLoadDLLs': 'file1;file2', + 'DelaySign': 'true', + 'Driver': '2', + 'EmbedManagedResourceFile': 'file1;file2', + 'EnableCOMDATFolding': '2', + 'EnableUAC': 'true', + 'EntryPointSymbol': 'a string1', + 'ErrorReporting': '2', + 'FixedBaseAddress': '2', + 'ForceSymbolReferences': 'file1;file2', + 'FunctionOrder': 'a_file_name', + 'GenerateDebugInformation': 'true', + 'GenerateManifest': 'true', + 'GenerateMapFile': 'true', + 'HeapCommitSize': 'a string1', + 'HeapReserveSize': 'a string1', + 'IgnoreAllDefaultLibraries': 'true', + 'IgnoreDefaultLibraryNames': 'file1;file2', + 'IgnoreEmbeddedIDL': 'true', + 'IgnoreImportLibrary': 'true', + 'ImportLibrary': 'a_file_name', + 'KeyContainer': 'a_file_name', + 'KeyFile': 'a_file_name', + 'LargeAddressAware': '2', + 'LinkIncremental': '2', + 'LinkLibraryDependencies': 'true', + 'LinkTimeCodeGeneration': '2', + 'ManifestFile': 'a_file_name', + 'MapExports': 'true', + 'MapFileName': 'a_file_name', + 'MergedIDLBaseFileName': 'a_file_name', + 'MergeSections': 'a string1', + 'MidlCommandFile': 'a_file_name', + 'ModuleDefinitionFile': 'a_file_name', + 'OptimizeForWindows98': '1', + 'OptimizeReferences': '2', + 'OutputFile': 'a_file_name', + 'PerUserRedirection': 'true', + 'Profile': 'true', + 'ProfileGuidedDatabase': 'a_file_name', + 'ProgramDatabaseFile': 'a_file_name', + 'RandomizedBaseAddress': '2', + 'RegisterOutput': 'true', + 'ResourceOnlyDLL': 'true', + 'SetChecksum': 'true', + 'ShowProgress': '2', + 'StackCommitSize': 'a string1', + 'StackReserveSize': 'a string1', + 'StripPrivateSymbols': 'a_file_name', + 'SubSystem': '2', + 'SupportUnloadOfDelayLoadedDLL': 'true', + 'SuppressStartupBanner': 'true', + 'SwapRunFromCD': 'true', + 'SwapRunFromNet': 'true', + 'TargetMachine': '2', + 'TerminalServerAware': '2', + 'TurnOffAssemblyGeneration': 'true', + 'TypeLibraryFile': 'a_file_name', + 'TypeLibraryResourceID': '33', + 'UACExecutionLevel': '2', + 'UACUIAccess': 'true', + 'UseLibraryDependencyInputs': 'true', + 'UseUnicodeResponseFiles': 'true', + 'Version': 'a string1'}, + 'VCMIDLTool': { + 'AdditionalIncludeDirectories': 'folder1;folder2', + 'AdditionalOptions': 'a string1', + 'CPreprocessOptions': 'a string1', + 'DefaultCharType': '1', + 'DLLDataFileName': 'a_file_name', + 'EnableErrorChecks': '1', + 'ErrorCheckAllocations': 'true', + 'ErrorCheckBounds': 'true', + 'ErrorCheckEnumRange': 'true', + 'ErrorCheckRefPointers': 'true', + 'ErrorCheckStubData': 'true', + 'GenerateStublessProxies': 'true', + 'GenerateTypeLibrary': 'true', + 'HeaderFileName': 'a_file_name', + 'IgnoreStandardIncludePath': 'true', + 'InterfaceIdentifierFileName': 'a_file_name', + 'MkTypLibCompatible': 'true', + 'notgood': 'bogus', + 'OutputDirectory': 'a string1', + 'PreprocessorDefinitions': 'string1;string2', + 'ProxyFileName': 'a_file_name', + 'RedirectOutputAndErrors': 'a_file_name', + 'StructMemberAlignment': '1', + 'SuppressStartupBanner': 'true', + 'TargetEnvironment': '1', + 'TypeLibraryName': 'a_file_name', + 'UndefinePreprocessorDefinitions': 'string1;string2', + 'ValidateParameters': 'true', + 'WarnAsError': 'true', + 'WarningLevel': '1'}, + 'VCResourceCompilerTool': { + 'AdditionalOptions': 'a string1', + 'AdditionalIncludeDirectories': 'folder1;folder2', + 'Culture': '1003', + 'IgnoreStandardIncludePath': 'true', + 'notgood2': 'bogus', + 'PreprocessorDefinitions': 'string1;string2', + 'ResourceOutputFileName': 'a string1', + 'ShowProgress': 'true', + 'SuppressStartupBanner': 'true', + 'UndefinePreprocessorDefinitions': 'string1;string2'}, + 'VCLibrarianTool': { + 'AdditionalDependencies': 'file1;file2', + 'AdditionalLibraryDirectories': 'folder1;folder2', + 'AdditionalOptions': 'a string1', + 'ExportNamedFunctions': 'string1;string2', + 'ForceSymbolReferences': 'a string1', + 'IgnoreAllDefaultLibraries': 'true', + 'IgnoreSpecificDefaultLibraries': 'file1;file2', + 'LinkLibraryDependencies': 'true', + 'ModuleDefinitionFile': 'a_file_name', + 'OutputFile': 'a_file_name', + 'SuppressStartupBanner': 'true', + 'UseUnicodeResponseFiles': 'true'}, + 'VCManifestTool': { + 'AdditionalManifestFiles': 'file1;file2', + 'AdditionalOptions': 'a string1', + 'AssemblyIdentity': 'a string1', + 'ComponentFileName': 'a_file_name', + 'DependencyInformationFile': 'a_file_name', + 'GenerateCatalogFiles': 'true', + 'InputResourceManifests': 'a string1', + 'ManifestResourceFile': 'a_file_name', + 'OutputManifestFile': 'a_file_name', + 'RegistrarScriptFile': 'a_file_name', + 'ReplacementsFile': 'a_file_name', + 'SuppressStartupBanner': 'true', + 'TypeLibraryFile': 'a_file_name', + 'UpdateFileHashes': 'truel', + 'UpdateFileHashesSearchPath': 'a_file_name', + 'UseFAT32Workaround': 'true', + 'UseUnicodeResponseFiles': 'true', + 'VerboseOutput': 'true'}}, + self.stderr) + self._ExpectedWarnings([ + 'Warning: for VCCLCompilerTool/BasicRuntimeChecks, ' + 'index value (5) not in expected range [0, 4)', + 'Warning: for VCCLCompilerTool/BrowseInformation, ' + "invalid literal for int() with base 10: 'fdkslj'", + 'Warning: for VCCLCompilerTool/CallingConvention, ' + 'index value (-1) not in expected range [0, 3)', + 'Warning: for VCCLCompilerTool/DebugInformationFormat, ' + 'converted value for 2 not specified.', + 'Warning: unrecognized setting VCCLCompilerTool/Enableprefast', + 'Warning: unrecognized setting VCCLCompilerTool/ZZXYZ', + 'Warning: for VCLinkerTool/TargetMachine, ' + 'converted value for 2 not specified.', + 'Warning: unrecognized setting VCMIDLTool/notgood', + 'Warning: unrecognized setting VCResourceCompilerTool/notgood2', + 'Warning: for VCManifestTool/UpdateFileHashes, ' + "expected bool; got 'truel'" + '']) + + def testValidateMSBuildSettings_settings(self): + """Tests that for invalid MSBuild settings.""" + MSVSSettings.ValidateMSBuildSettings( + {'ClCompile': { + 'AdditionalIncludeDirectories': 'folder1;folder2', + 'AdditionalOptions': ['string1', 'string2'], + 'AdditionalUsingDirectories': 'folder1;folder2', + 'AssemblerListingLocation': 'a_file_name', + 'AssemblerOutput': 'NoListing', + 'BasicRuntimeChecks': 'StackFrameRuntimeCheck', + 'BrowseInformation': 'false', + 'BrowseInformationFile': 'a_file_name', + 'BufferSecurityCheck': 'true', + 'BuildingInIDE': 'true', + 'CallingConvention': 'Cdecl', + 'CompileAs': 'CompileAsC', + 'CompileAsManaged': 'Pure', + 'CreateHotpatchableImage': 'true', + 'DebugInformationFormat': 'ProgramDatabase', + 'DisableLanguageExtensions': 'true', + 'DisableSpecificWarnings': 'string1;string2', + 'EnableEnhancedInstructionSet': 'StreamingSIMDExtensions', + 'EnableFiberSafeOptimizations': 'true', + 'EnablePREfast': 'true', + 'Enableprefast': 'bogus', + 'ErrorReporting': 'Prompt', + 'ExceptionHandling': 'SyncCThrow', + 'ExpandAttributedSource': 'true', + 'FavorSizeOrSpeed': 'Neither', + 'FloatingPointExceptions': 'true', + 'FloatingPointModel': 'Precise', + 'ForceConformanceInForLoopScope': 'true', + 'ForcedIncludeFiles': 'file1;file2', + 'ForcedUsingFiles': 'file1;file2', + 'FunctionLevelLinking': 'false', + 'GenerateXMLDocumentationFiles': 'true', + 'IgnoreStandardIncludePath': 'true', + 'InlineFunctionExpansion': 'OnlyExplicitInline', + 'IntrinsicFunctions': 'false', + 'MinimalRebuild': 'true', + 'MultiProcessorCompilation': 'true', + 'ObjectFileName': 'a_file_name', + 'OmitDefaultLibName': 'true', + 'OmitFramePointers': 'true', + 'OpenMPSupport': 'true', + 'Optimization': 'Disabled', + 'PrecompiledHeader': 'NotUsing', + 'PrecompiledHeaderFile': 'a_file_name', + 'PrecompiledHeaderOutputFile': 'a_file_name', + 'PreprocessKeepComments': 'true', + 'PreprocessorDefinitions': 'string1;string2', + 'PreprocessOutputPath': 'a string1', + 'PreprocessSuppressLineNumbers': 'false', + 'PreprocessToFile': 'false', + 'ProcessorNumber': '33', + 'ProgramDataBaseFileName': 'a_file_name', + 'RuntimeLibrary': 'MultiThreaded', + 'RuntimeTypeInfo': 'true', + 'ShowIncludes': 'true', + 'SmallerTypeCheck': 'true', + 'StringPooling': 'true', + 'StructMemberAlignment': '1Byte', + 'SuppressStartupBanner': 'true', + 'TrackerLogDirectory': 'a_folder', + 'TreatSpecificWarningsAsErrors': 'string1;string2', + 'TreatWarningAsError': 'true', + 'TreatWChar_tAsBuiltInType': 'true', + 'UndefineAllPreprocessorDefinitions': 'true', + 'UndefinePreprocessorDefinitions': 'string1;string2', + 'UseFullPaths': 'true', + 'UseUnicodeForAssemblerListing': 'true', + 'WarningLevel': 'TurnOffAllWarnings', + 'WholeProgramOptimization': 'true', + 'XMLDocumentationFileName': 'a_file_name', + 'ZZXYZ': 'bogus'}, + 'Link': { + 'AdditionalDependencies': 'file1;file2', + 'AdditionalLibraryDirectories': 'folder1;folder2', + 'AdditionalManifestDependencies': 'file1;file2', + 'AdditionalOptions': 'a string1', + 'AddModuleNamesToAssembly': 'file1;file2', + 'AllowIsolation': 'true', + 'AssemblyDebug': '', + 'AssemblyLinkResource': 'file1;file2', + 'BaseAddress': 'a string1', + 'BuildingInIDE': 'true', + 'CLRImageType': 'ForceIJWImage', + 'CLRSupportLastError': 'Enabled', + 'CLRThreadAttribute': 'MTAThreadingAttribute', + 'CLRUnmanagedCodeCheck': 'true', + 'CreateHotPatchableImage': 'X86Image', + 'DataExecutionPrevention': 'false', + 'DelayLoadDLLs': 'file1;file2', + 'DelaySign': 'true', + 'Driver': 'NotSet', + 'EmbedManagedResourceFile': 'file1;file2', + 'EnableCOMDATFolding': 'false', + 'EnableUAC': 'true', + 'EntryPointSymbol': 'a string1', + 'FixedBaseAddress': 'false', + 'ForceFileOutput': 'Enabled', + 'ForceSymbolReferences': 'file1;file2', + 'FunctionOrder': 'a_file_name', + 'GenerateDebugInformation': 'true', + 'GenerateMapFile': 'true', + 'HeapCommitSize': 'a string1', + 'HeapReserveSize': 'a string1', + 'IgnoreAllDefaultLibraries': 'true', + 'IgnoreEmbeddedIDL': 'true', + 'IgnoreSpecificDefaultLibraries': 'a_file_list', + 'ImageHasSafeExceptionHandlers': 'true', + 'ImportLibrary': 'a_file_name', + 'KeyContainer': 'a_file_name', + 'KeyFile': 'a_file_name', + 'LargeAddressAware': 'false', + 'LinkDLL': 'true', + 'LinkErrorReporting': 'SendErrorReport', + 'LinkStatus': 'true', + 'LinkTimeCodeGeneration': 'UseLinkTimeCodeGeneration', + 'ManifestFile': 'a_file_name', + 'MapExports': 'true', + 'MapFileName': 'a_file_name', + 'MergedIDLBaseFileName': 'a_file_name', + 'MergeSections': 'a string1', + 'MidlCommandFile': 'a_file_name', + 'MinimumRequiredVersion': 'a string1', + 'ModuleDefinitionFile': 'a_file_name', + 'MSDOSStubFileName': 'a_file_name', + 'NoEntryPoint': 'true', + 'OptimizeReferences': 'false', + 'OutputFile': 'a_file_name', + 'PerUserRedirection': 'true', + 'PreventDllBinding': 'true', + 'Profile': 'true', + 'ProfileGuidedDatabase': 'a_file_name', + 'ProgramDatabaseFile': 'a_file_name', + 'RandomizedBaseAddress': 'false', + 'RegisterOutput': 'true', + 'SectionAlignment': '33', + 'SetChecksum': 'true', + 'ShowProgress': 'LinkVerboseREF', + 'SpecifySectionAttributes': 'a string1', + 'StackCommitSize': 'a string1', + 'StackReserveSize': 'a string1', + 'StripPrivateSymbols': 'a_file_name', + 'SubSystem': 'Console', + 'SupportNobindOfDelayLoadedDLL': 'true', + 'SupportUnloadOfDelayLoadedDLL': 'true', + 'SuppressStartupBanner': 'true', + 'SwapRunFromCD': 'true', + 'SwapRunFromNET': 'true', + 'TargetMachine': 'MachineX86', + 'TerminalServerAware': 'false', + 'TrackerLogDirectory': 'a_folder', + 'TreatLinkerWarningAsErrors': 'true', + 'TurnOffAssemblyGeneration': 'true', + 'TypeLibraryFile': 'a_file_name', + 'TypeLibraryResourceID': '33', + 'UACExecutionLevel': 'AsInvoker', + 'UACUIAccess': 'true', + 'Version': 'a string1'}, + 'ResourceCompile': { + 'AdditionalIncludeDirectories': 'folder1;folder2', + 'AdditionalOptions': 'a string1', + 'Culture': '0x236', + 'IgnoreStandardIncludePath': 'true', + 'NullTerminateStrings': 'true', + 'PreprocessorDefinitions': 'string1;string2', + 'ResourceOutputFileName': 'a string1', + 'ShowProgress': 'true', + 'SuppressStartupBanner': 'true', + 'TrackerLogDirectory': 'a_folder', + 'UndefinePreprocessorDefinitions': 'string1;string2'}, + 'Midl': { + 'AdditionalIncludeDirectories': 'folder1;folder2', + 'AdditionalOptions': 'a string1', + 'ApplicationConfigurationMode': 'true', + 'ClientStubFile': 'a_file_name', + 'CPreprocessOptions': 'a string1', + 'DefaultCharType': 'Signed', + 'DllDataFileName': 'a_file_name', + 'EnableErrorChecks': 'EnableCustom', + 'ErrorCheckAllocations': 'true', + 'ErrorCheckBounds': 'true', + 'ErrorCheckEnumRange': 'true', + 'ErrorCheckRefPointers': 'true', + 'ErrorCheckStubData': 'true', + 'GenerateClientFiles': 'Stub', + 'GenerateServerFiles': 'None', + 'GenerateStublessProxies': 'true', + 'GenerateTypeLibrary': 'true', + 'HeaderFileName': 'a_file_name', + 'IgnoreStandardIncludePath': 'true', + 'InterfaceIdentifierFileName': 'a_file_name', + 'LocaleID': '33', + 'MkTypLibCompatible': 'true', + 'OutputDirectory': 'a string1', + 'PreprocessorDefinitions': 'string1;string2', + 'ProxyFileName': 'a_file_name', + 'RedirectOutputAndErrors': 'a_file_name', + 'ServerStubFile': 'a_file_name', + 'StructMemberAlignment': 'NotSet', + 'SuppressCompilerWarnings': 'true', + 'SuppressStartupBanner': 'true', + 'TargetEnvironment': 'Itanium', + 'TrackerLogDirectory': 'a_folder', + 'TypeLibFormat': 'NewFormat', + 'TypeLibraryName': 'a_file_name', + 'UndefinePreprocessorDefinitions': 'string1;string2', + 'ValidateAllParameters': 'true', + 'WarnAsError': 'true', + 'WarningLevel': '1'}, + 'Lib': { + 'AdditionalDependencies': 'file1;file2', + 'AdditionalLibraryDirectories': 'folder1;folder2', + 'AdditionalOptions': 'a string1', + 'DisplayLibrary': 'a string1', + 'ErrorReporting': 'PromptImmediately', + 'ExportNamedFunctions': 'string1;string2', + 'ForceSymbolReferences': 'a string1', + 'IgnoreAllDefaultLibraries': 'true', + 'IgnoreSpecificDefaultLibraries': 'file1;file2', + 'LinkTimeCodeGeneration': 'true', + 'MinimumRequiredVersion': 'a string1', + 'ModuleDefinitionFile': 'a_file_name', + 'Name': 'a_file_name', + 'OutputFile': 'a_file_name', + 'RemoveObjects': 'file1;file2', + 'SubSystem': 'Console', + 'SuppressStartupBanner': 'true', + 'TargetMachine': 'MachineX86i', + 'TrackerLogDirectory': 'a_folder', + 'TreatLibWarningAsErrors': 'true', + 'UseUnicodeResponseFiles': 'true', + 'Verbose': 'true'}, + 'Manifest': { + 'AdditionalManifestFiles': 'file1;file2', + 'AdditionalOptions': 'a string1', + 'AssemblyIdentity': 'a string1', + 'ComponentFileName': 'a_file_name', + 'EnableDPIAwareness': 'fal', + 'GenerateCatalogFiles': 'truel', + 'GenerateCategoryTags': 'true', + 'InputResourceManifests': 'a string1', + 'ManifestFromManagedAssembly': 'a_file_name', + 'notgood3': 'bogus', + 'OutputManifestFile': 'a_file_name', + 'OutputResourceManifests': 'a string1', + 'RegistrarScriptFile': 'a_file_name', + 'ReplacementsFile': 'a_file_name', + 'SuppressDependencyElement': 'true', + 'SuppressStartupBanner': 'true', + 'TrackerLogDirectory': 'a_folder', + 'TypeLibraryFile': 'a_file_name', + 'UpdateFileHashes': 'true', + 'UpdateFileHashesSearchPath': 'a_file_name', + 'VerboseOutput': 'true'}, + 'ProjectReference': { + 'LinkLibraryDependencies': 'true', + 'UseLibraryDependencyInputs': 'true'}, + 'ManifestResourceCompile': { + 'ResourceOutputFileName': 'a_file_name'}, + '': { + 'EmbedManifest': 'true', + 'GenerateManifest': 'true', + 'IgnoreImportLibrary': 'true', + 'LinkIncremental': 'false'}}, + self.stderr) + self._ExpectedWarnings([ + 'Warning: unrecognized setting ClCompile/Enableprefast', + 'Warning: unrecognized setting ClCompile/ZZXYZ', + 'Warning: unrecognized setting Manifest/notgood3', + 'Warning: for Manifest/GenerateCatalogFiles, ' + "expected bool; got 'truel'", + 'Warning: for Lib/TargetMachine, unrecognized enumerated value ' + 'MachineX86i', + "Warning: for Manifest/EnableDPIAwareness, expected bool; got 'fal'"]) + + def testConvertToMSBuildSettings_empty(self): + """Tests an empty conversion.""" + msvs_settings = {} + expected_msbuild_settings = {} + actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings( + msvs_settings, + self.stderr) + self.assertEqual(expected_msbuild_settings, actual_msbuild_settings) + self._ExpectedWarnings([]) + + def testConvertToMSBuildSettings_minimal(self): + """Tests a minimal conversion.""" + msvs_settings = { + 'VCCLCompilerTool': { + 'AdditionalIncludeDirectories': 'dir1', + 'AdditionalOptions': '/foo', + 'BasicRuntimeChecks': '0', + }, + 'VCLinkerTool': { + 'LinkTimeCodeGeneration': '1', + 'ErrorReporting': '1', + 'DataExecutionPrevention': '2', + }, + } + expected_msbuild_settings = { + 'ClCompile': { + 'AdditionalIncludeDirectories': 'dir1', + 'AdditionalOptions': '/foo', + 'BasicRuntimeChecks': 'Default', + }, + 'Link': { + 'LinkTimeCodeGeneration': 'UseLinkTimeCodeGeneration', + 'LinkErrorReporting': 'PromptImmediately', + 'DataExecutionPrevention': 'true', + }, + } + actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings( + msvs_settings, + self.stderr) + self.assertEqual(expected_msbuild_settings, actual_msbuild_settings) + self._ExpectedWarnings([]) + + def testConvertToMSBuildSettings_warnings(self): + """Tests conversion that generates warnings.""" + msvs_settings = { + 'VCCLCompilerTool': { + 'AdditionalIncludeDirectories': '1', + 'AdditionalOptions': '2', + # These are incorrect values: + 'BasicRuntimeChecks': '12', + 'BrowseInformation': '21', + 'UsePrecompiledHeader': '13', + 'GeneratePreprocessedFile': '14'}, + 'VCLinkerTool': { + # These are incorrect values: + 'Driver': '10', + 'LinkTimeCodeGeneration': '31', + 'ErrorReporting': '21', + 'FixedBaseAddress': '6'}, + 'VCResourceCompilerTool': { + # Custom + 'Culture': '1003'}} + expected_msbuild_settings = { + 'ClCompile': { + 'AdditionalIncludeDirectories': '1', + 'AdditionalOptions': '2'}, + 'Link': {}, + 'ResourceCompile': { + # Custom + 'Culture': '0x03eb'}} + actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings( + msvs_settings, + self.stderr) + self.assertEqual(expected_msbuild_settings, actual_msbuild_settings) + self._ExpectedWarnings([ + 'Warning: while converting VCCLCompilerTool/BasicRuntimeChecks to ' + 'MSBuild, index value (12) not in expected range [0, 4)', + 'Warning: while converting VCCLCompilerTool/BrowseInformation to ' + 'MSBuild, index value (21) not in expected range [0, 3)', + 'Warning: while converting VCCLCompilerTool/UsePrecompiledHeader to ' + 'MSBuild, index value (13) not in expected range [0, 3)', + 'Warning: while converting VCCLCompilerTool/GeneratePreprocessedFile to ' + 'MSBuild, value must be one of [0, 1, 2]; got 14', + + 'Warning: while converting VCLinkerTool/Driver to ' + 'MSBuild, index value (10) not in expected range [0, 4)', + 'Warning: while converting VCLinkerTool/LinkTimeCodeGeneration to ' + 'MSBuild, index value (31) not in expected range [0, 5)', + 'Warning: while converting VCLinkerTool/ErrorReporting to ' + 'MSBuild, index value (21) not in expected range [0, 3)', + 'Warning: while converting VCLinkerTool/FixedBaseAddress to ' + 'MSBuild, index value (6) not in expected range [0, 3)', + ]) + + def testConvertToMSBuildSettings_full_synthetic(self): + """Tests conversion of all the MSBuild settings.""" + msvs_settings = { + 'VCCLCompilerTool': { + 'AdditionalIncludeDirectories': 'folder1;folder2;folder3', + 'AdditionalOptions': 'a_string', + 'AdditionalUsingDirectories': 'folder1;folder2;folder3', + 'AssemblerListingLocation': 'a_file_name', + 'AssemblerOutput': '0', + 'BasicRuntimeChecks': '1', + 'BrowseInformation': '2', + 'BrowseInformationFile': 'a_file_name', + 'BufferSecurityCheck': 'true', + 'CallingConvention': '0', + 'CompileAs': '1', + 'DebugInformationFormat': '4', + 'DefaultCharIsUnsigned': 'true', + 'Detect64BitPortabilityProblems': 'true', + 'DisableLanguageExtensions': 'true', + 'DisableSpecificWarnings': 'd1;d2;d3', + 'EnableEnhancedInstructionSet': '0', + 'EnableFiberSafeOptimizations': 'true', + 'EnableFunctionLevelLinking': 'true', + 'EnableIntrinsicFunctions': 'true', + 'EnablePREfast': 'true', + 'ErrorReporting': '1', + 'ExceptionHandling': '2', + 'ExpandAttributedSource': 'true', + 'FavorSizeOrSpeed': '0', + 'FloatingPointExceptions': 'true', + 'FloatingPointModel': '1', + 'ForceConformanceInForLoopScope': 'true', + 'ForcedIncludeFiles': 'file1;file2;file3', + 'ForcedUsingFiles': 'file1;file2;file3', + 'GeneratePreprocessedFile': '1', + 'GenerateXMLDocumentationFiles': 'true', + 'IgnoreStandardIncludePath': 'true', + 'InlineFunctionExpansion': '2', + 'KeepComments': 'true', + 'MinimalRebuild': 'true', + 'ObjectFile': 'a_file_name', + 'OmitDefaultLibName': 'true', + 'OmitFramePointers': 'true', + 'OpenMP': 'true', + 'Optimization': '3', + 'PrecompiledHeaderFile': 'a_file_name', + 'PrecompiledHeaderThrough': 'a_file_name', + 'PreprocessorDefinitions': 'd1;d2;d3', + 'ProgramDataBaseFileName': 'a_file_name', + 'RuntimeLibrary': '0', + 'RuntimeTypeInfo': 'true', + 'ShowIncludes': 'true', + 'SmallerTypeCheck': 'true', + 'StringPooling': 'true', + 'StructMemberAlignment': '1', + 'SuppressStartupBanner': 'true', + 'TreatWChar_tAsBuiltInType': 'true', + 'UndefineAllPreprocessorDefinitions': 'true', + 'UndefinePreprocessorDefinitions': 'd1;d2;d3', + 'UseFullPaths': 'true', + 'UsePrecompiledHeader': '1', + 'UseUnicodeResponseFiles': 'true', + 'WarnAsError': 'true', + 'WarningLevel': '2', + 'WholeProgramOptimization': 'true', + 'XMLDocumentationFileName': 'a_file_name'}, + 'VCLinkerTool': { + 'AdditionalDependencies': 'file1;file2;file3', + 'AdditionalLibraryDirectories': 'folder1;folder2;folder3', + 'AdditionalLibraryDirectories_excluded': 'folder1;folder2;folder3', + 'AdditionalManifestDependencies': 'file1;file2;file3', + 'AdditionalOptions': 'a_string', + 'AddModuleNamesToAssembly': 'file1;file2;file3', + 'AllowIsolation': 'true', + 'AssemblyDebug': '0', + 'AssemblyLinkResource': 'file1;file2;file3', + 'BaseAddress': 'a_string', + 'CLRImageType': '1', + 'CLRThreadAttribute': '2', + 'CLRUnmanagedCodeCheck': 'true', + 'DataExecutionPrevention': '0', + 'DelayLoadDLLs': 'file1;file2;file3', + 'DelaySign': 'true', + 'Driver': '1', + 'EmbedManagedResourceFile': 'file1;file2;file3', + 'EnableCOMDATFolding': '0', + 'EnableUAC': 'true', + 'EntryPointSymbol': 'a_string', + 'ErrorReporting': '0', + 'FixedBaseAddress': '1', + 'ForceSymbolReferences': 'file1;file2;file3', + 'FunctionOrder': 'a_file_name', + 'GenerateDebugInformation': 'true', + 'GenerateManifest': 'true', + 'GenerateMapFile': 'true', + 'HeapCommitSize': 'a_string', + 'HeapReserveSize': 'a_string', + 'IgnoreAllDefaultLibraries': 'true', + 'IgnoreDefaultLibraryNames': 'file1;file2;file3', + 'IgnoreEmbeddedIDL': 'true', + 'IgnoreImportLibrary': 'true', + 'ImportLibrary': 'a_file_name', + 'KeyContainer': 'a_file_name', + 'KeyFile': 'a_file_name', + 'LargeAddressAware': '2', + 'LinkIncremental': '1', + 'LinkLibraryDependencies': 'true', + 'LinkTimeCodeGeneration': '2', + 'ManifestFile': 'a_file_name', + 'MapExports': 'true', + 'MapFileName': 'a_file_name', + 'MergedIDLBaseFileName': 'a_file_name', + 'MergeSections': 'a_string', + 'MidlCommandFile': 'a_file_name', + 'ModuleDefinitionFile': 'a_file_name', + 'OptimizeForWindows98': '1', + 'OptimizeReferences': '0', + 'OutputFile': 'a_file_name', + 'PerUserRedirection': 'true', + 'Profile': 'true', + 'ProfileGuidedDatabase': 'a_file_name', + 'ProgramDatabaseFile': 'a_file_name', + 'RandomizedBaseAddress': '1', + 'RegisterOutput': 'true', + 'ResourceOnlyDLL': 'true', + 'SetChecksum': 'true', + 'ShowProgress': '0', + 'StackCommitSize': 'a_string', + 'StackReserveSize': 'a_string', + 'StripPrivateSymbols': 'a_file_name', + 'SubSystem': '2', + 'SupportUnloadOfDelayLoadedDLL': 'true', + 'SuppressStartupBanner': 'true', + 'SwapRunFromCD': 'true', + 'SwapRunFromNet': 'true', + 'TargetMachine': '3', + 'TerminalServerAware': '2', + 'TurnOffAssemblyGeneration': 'true', + 'TypeLibraryFile': 'a_file_name', + 'TypeLibraryResourceID': '33', + 'UACExecutionLevel': '1', + 'UACUIAccess': 'true', + 'UseLibraryDependencyInputs': 'false', + 'UseUnicodeResponseFiles': 'true', + 'Version': 'a_string'}, + 'VCResourceCompilerTool': { + 'AdditionalIncludeDirectories': 'folder1;folder2;folder3', + 'AdditionalOptions': 'a_string', + 'Culture': '1003', + 'IgnoreStandardIncludePath': 'true', + 'PreprocessorDefinitions': 'd1;d2;d3', + 'ResourceOutputFileName': 'a_string', + 'ShowProgress': 'true', + 'SuppressStartupBanner': 'true', + 'UndefinePreprocessorDefinitions': 'd1;d2;d3'}, + 'VCMIDLTool': { + 'AdditionalIncludeDirectories': 'folder1;folder2;folder3', + 'AdditionalOptions': 'a_string', + 'CPreprocessOptions': 'a_string', + 'DefaultCharType': '0', + 'DLLDataFileName': 'a_file_name', + 'EnableErrorChecks': '2', + 'ErrorCheckAllocations': 'true', + 'ErrorCheckBounds': 'true', + 'ErrorCheckEnumRange': 'true', + 'ErrorCheckRefPointers': 'true', + 'ErrorCheckStubData': 'true', + 'GenerateStublessProxies': 'true', + 'GenerateTypeLibrary': 'true', + 'HeaderFileName': 'a_file_name', + 'IgnoreStandardIncludePath': 'true', + 'InterfaceIdentifierFileName': 'a_file_name', + 'MkTypLibCompatible': 'true', + 'OutputDirectory': 'a_string', + 'PreprocessorDefinitions': 'd1;d2;d3', + 'ProxyFileName': 'a_file_name', + 'RedirectOutputAndErrors': 'a_file_name', + 'StructMemberAlignment': '3', + 'SuppressStartupBanner': 'true', + 'TargetEnvironment': '1', + 'TypeLibraryName': 'a_file_name', + 'UndefinePreprocessorDefinitions': 'd1;d2;d3', + 'ValidateParameters': 'true', + 'WarnAsError': 'true', + 'WarningLevel': '4'}, + 'VCLibrarianTool': { + 'AdditionalDependencies': 'file1;file2;file3', + 'AdditionalLibraryDirectories': 'folder1;folder2;folder3', + 'AdditionalLibraryDirectories_excluded': 'folder1;folder2;folder3', + 'AdditionalOptions': 'a_string', + 'ExportNamedFunctions': 'd1;d2;d3', + 'ForceSymbolReferences': 'a_string', + 'IgnoreAllDefaultLibraries': 'true', + 'IgnoreSpecificDefaultLibraries': 'file1;file2;file3', + 'LinkLibraryDependencies': 'true', + 'ModuleDefinitionFile': 'a_file_name', + 'OutputFile': 'a_file_name', + 'SuppressStartupBanner': 'true', + 'UseUnicodeResponseFiles': 'true'}, + 'VCManifestTool': { + 'AdditionalManifestFiles': 'file1;file2;file3', + 'AdditionalOptions': 'a_string', + 'AssemblyIdentity': 'a_string', + 'ComponentFileName': 'a_file_name', + 'DependencyInformationFile': 'a_file_name', + 'EmbedManifest': 'true', + 'GenerateCatalogFiles': 'true', + 'InputResourceManifests': 'a_string', + 'ManifestResourceFile': 'my_name', + 'OutputManifestFile': 'a_file_name', + 'RegistrarScriptFile': 'a_file_name', + 'ReplacementsFile': 'a_file_name', + 'SuppressStartupBanner': 'true', + 'TypeLibraryFile': 'a_file_name', + 'UpdateFileHashes': 'true', + 'UpdateFileHashesSearchPath': 'a_file_name', + 'UseFAT32Workaround': 'true', + 'UseUnicodeResponseFiles': 'true', + 'VerboseOutput': 'true'}} + expected_msbuild_settings = { + 'ClCompile': { + 'AdditionalIncludeDirectories': 'folder1;folder2;folder3', + 'AdditionalOptions': 'a_string /J', + 'AdditionalUsingDirectories': 'folder1;folder2;folder3', + 'AssemblerListingLocation': 'a_file_name', + 'AssemblerOutput': 'NoListing', + 'BasicRuntimeChecks': 'StackFrameRuntimeCheck', + 'BrowseInformation': 'true', + 'BrowseInformationFile': 'a_file_name', + 'BufferSecurityCheck': 'true', + 'CallingConvention': 'Cdecl', + 'CompileAs': 'CompileAsC', + 'DebugInformationFormat': 'EditAndContinue', + 'DisableLanguageExtensions': 'true', + 'DisableSpecificWarnings': 'd1;d2;d3', + 'EnableEnhancedInstructionSet': 'NotSet', + 'EnableFiberSafeOptimizations': 'true', + 'EnablePREfast': 'true', + 'ErrorReporting': 'Prompt', + 'ExceptionHandling': 'Async', + 'ExpandAttributedSource': 'true', + 'FavorSizeOrSpeed': 'Neither', + 'FloatingPointExceptions': 'true', + 'FloatingPointModel': 'Strict', + 'ForceConformanceInForLoopScope': 'true', + 'ForcedIncludeFiles': 'file1;file2;file3', + 'ForcedUsingFiles': 'file1;file2;file3', + 'FunctionLevelLinking': 'true', + 'GenerateXMLDocumentationFiles': 'true', + 'IgnoreStandardIncludePath': 'true', + 'InlineFunctionExpansion': 'AnySuitable', + 'IntrinsicFunctions': 'true', + 'MinimalRebuild': 'true', + 'ObjectFileName': 'a_file_name', + 'OmitDefaultLibName': 'true', + 'OmitFramePointers': 'true', + 'OpenMPSupport': 'true', + 'Optimization': 'Full', + 'PrecompiledHeader': 'Create', + 'PrecompiledHeaderFile': 'a_file_name', + 'PrecompiledHeaderOutputFile': 'a_file_name', + 'PreprocessKeepComments': 'true', + 'PreprocessorDefinitions': 'd1;d2;d3', + 'PreprocessSuppressLineNumbers': 'false', + 'PreprocessToFile': 'true', + 'ProgramDataBaseFileName': 'a_file_name', + 'RuntimeLibrary': 'MultiThreaded', + 'RuntimeTypeInfo': 'true', + 'ShowIncludes': 'true', + 'SmallerTypeCheck': 'true', + 'StringPooling': 'true', + 'StructMemberAlignment': '1Byte', + 'SuppressStartupBanner': 'true', + 'TreatWarningAsError': 'true', + 'TreatWChar_tAsBuiltInType': 'true', + 'UndefineAllPreprocessorDefinitions': 'true', + 'UndefinePreprocessorDefinitions': 'd1;d2;d3', + 'UseFullPaths': 'true', + 'WarningLevel': 'Level2', + 'WholeProgramOptimization': 'true', + 'XMLDocumentationFileName': 'a_file_name'}, + 'Link': { + 'AdditionalDependencies': 'file1;file2;file3', + 'AdditionalLibraryDirectories': 'folder1;folder2;folder3', + 'AdditionalManifestDependencies': 'file1;file2;file3', + 'AdditionalOptions': 'a_string', + 'AddModuleNamesToAssembly': 'file1;file2;file3', + 'AllowIsolation': 'true', + 'AssemblyDebug': '', + 'AssemblyLinkResource': 'file1;file2;file3', + 'BaseAddress': 'a_string', + 'CLRImageType': 'ForceIJWImage', + 'CLRThreadAttribute': 'STAThreadingAttribute', + 'CLRUnmanagedCodeCheck': 'true', + 'DataExecutionPrevention': '', + 'DelayLoadDLLs': 'file1;file2;file3', + 'DelaySign': 'true', + 'Driver': 'Driver', + 'EmbedManagedResourceFile': 'file1;file2;file3', + 'EnableCOMDATFolding': '', + 'EnableUAC': 'true', + 'EntryPointSymbol': 'a_string', + 'FixedBaseAddress': 'false', + 'ForceSymbolReferences': 'file1;file2;file3', + 'FunctionOrder': 'a_file_name', + 'GenerateDebugInformation': 'true', + 'GenerateMapFile': 'true', + 'HeapCommitSize': 'a_string', + 'HeapReserveSize': 'a_string', + 'IgnoreAllDefaultLibraries': 'true', + 'IgnoreEmbeddedIDL': 'true', + 'IgnoreSpecificDefaultLibraries': 'file1;file2;file3', + 'ImportLibrary': 'a_file_name', + 'KeyContainer': 'a_file_name', + 'KeyFile': 'a_file_name', + 'LargeAddressAware': 'true', + 'LinkErrorReporting': 'NoErrorReport', + 'LinkTimeCodeGeneration': 'PGInstrument', + 'ManifestFile': 'a_file_name', + 'MapExports': 'true', + 'MapFileName': 'a_file_name', + 'MergedIDLBaseFileName': 'a_file_name', + 'MergeSections': 'a_string', + 'MidlCommandFile': 'a_file_name', + 'ModuleDefinitionFile': 'a_file_name', + 'NoEntryPoint': 'true', + 'OptimizeReferences': '', + 'OutputFile': 'a_file_name', + 'PerUserRedirection': 'true', + 'Profile': 'true', + 'ProfileGuidedDatabase': 'a_file_name', + 'ProgramDatabaseFile': 'a_file_name', + 'RandomizedBaseAddress': 'false', + 'RegisterOutput': 'true', + 'SetChecksum': 'true', + 'ShowProgress': 'NotSet', + 'StackCommitSize': 'a_string', + 'StackReserveSize': 'a_string', + 'StripPrivateSymbols': 'a_file_name', + 'SubSystem': 'Windows', + 'SupportUnloadOfDelayLoadedDLL': 'true', + 'SuppressStartupBanner': 'true', + 'SwapRunFromCD': 'true', + 'SwapRunFromNET': 'true', + 'TargetMachine': 'MachineARM', + 'TerminalServerAware': 'true', + 'TurnOffAssemblyGeneration': 'true', + 'TypeLibraryFile': 'a_file_name', + 'TypeLibraryResourceID': '33', + 'UACExecutionLevel': 'HighestAvailable', + 'UACUIAccess': 'true', + 'Version': 'a_string'}, + 'ResourceCompile': { + 'AdditionalIncludeDirectories': 'folder1;folder2;folder3', + 'AdditionalOptions': 'a_string', + 'Culture': '0x03eb', + 'IgnoreStandardIncludePath': 'true', + 'PreprocessorDefinitions': 'd1;d2;d3', + 'ResourceOutputFileName': 'a_string', + 'ShowProgress': 'true', + 'SuppressStartupBanner': 'true', + 'UndefinePreprocessorDefinitions': 'd1;d2;d3'}, + 'Midl': { + 'AdditionalIncludeDirectories': 'folder1;folder2;folder3', + 'AdditionalOptions': 'a_string', + 'CPreprocessOptions': 'a_string', + 'DefaultCharType': 'Unsigned', + 'DllDataFileName': 'a_file_name', + 'EnableErrorChecks': 'All', + 'ErrorCheckAllocations': 'true', + 'ErrorCheckBounds': 'true', + 'ErrorCheckEnumRange': 'true', + 'ErrorCheckRefPointers': 'true', + 'ErrorCheckStubData': 'true', + 'GenerateStublessProxies': 'true', + 'GenerateTypeLibrary': 'true', + 'HeaderFileName': 'a_file_name', + 'IgnoreStandardIncludePath': 'true', + 'InterfaceIdentifierFileName': 'a_file_name', + 'MkTypLibCompatible': 'true', + 'OutputDirectory': 'a_string', + 'PreprocessorDefinitions': 'd1;d2;d3', + 'ProxyFileName': 'a_file_name', + 'RedirectOutputAndErrors': 'a_file_name', + 'StructMemberAlignment': '4', + 'SuppressStartupBanner': 'true', + 'TargetEnvironment': 'Win32', + 'TypeLibraryName': 'a_file_name', + 'UndefinePreprocessorDefinitions': 'd1;d2;d3', + 'ValidateAllParameters': 'true', + 'WarnAsError': 'true', + 'WarningLevel': '4'}, + 'Lib': { + 'AdditionalDependencies': 'file1;file2;file3', + 'AdditionalLibraryDirectories': 'folder1;folder2;folder3', + 'AdditionalOptions': 'a_string', + 'ExportNamedFunctions': 'd1;d2;d3', + 'ForceSymbolReferences': 'a_string', + 'IgnoreAllDefaultLibraries': 'true', + 'IgnoreSpecificDefaultLibraries': 'file1;file2;file3', + 'ModuleDefinitionFile': 'a_file_name', + 'OutputFile': 'a_file_name', + 'SuppressStartupBanner': 'true', + 'UseUnicodeResponseFiles': 'true'}, + 'Manifest': { + 'AdditionalManifestFiles': 'file1;file2;file3', + 'AdditionalOptions': 'a_string', + 'AssemblyIdentity': 'a_string', + 'ComponentFileName': 'a_file_name', + 'GenerateCatalogFiles': 'true', + 'InputResourceManifests': 'a_string', + 'OutputManifestFile': 'a_file_name', + 'RegistrarScriptFile': 'a_file_name', + 'ReplacementsFile': 'a_file_name', + 'SuppressStartupBanner': 'true', + 'TypeLibraryFile': 'a_file_name', + 'UpdateFileHashes': 'true', + 'UpdateFileHashesSearchPath': 'a_file_name', + 'VerboseOutput': 'true'}, + 'ManifestResourceCompile': { + 'ResourceOutputFileName': 'my_name'}, + 'ProjectReference': { + 'LinkLibraryDependencies': 'true', + 'UseLibraryDependencyInputs': 'false'}, + '': { + 'EmbedManifest': 'true', + 'GenerateManifest': 'true', + 'IgnoreImportLibrary': 'true', + 'LinkIncremental': 'false'}} + actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings( + msvs_settings, + self.stderr) + self.assertEqual(expected_msbuild_settings, actual_msbuild_settings) + self._ExpectedWarnings([]) + + def testConvertToMSBuildSettings_actual(self): + """Tests the conversion of an actual project. + + A VS2008 project with most of the options defined was created through the + VS2008 IDE. It was then converted to VS2010. The tool settings found in + the .vcproj and .vcxproj files were converted to the two dictionaries + msvs_settings and expected_msbuild_settings. + + Note that for many settings, the VS2010 converter adds macros like + %(AdditionalIncludeDirectories) to make sure than inherited values are + included. Since the Gyp projects we generate do not use inheritance, + we removed these macros. They were: + ClCompile: + AdditionalIncludeDirectories: ';%(AdditionalIncludeDirectories)' + AdditionalOptions: ' %(AdditionalOptions)' + AdditionalUsingDirectories: ';%(AdditionalUsingDirectories)' + DisableSpecificWarnings: ';%(DisableSpecificWarnings)', + ForcedIncludeFiles: ';%(ForcedIncludeFiles)', + ForcedUsingFiles: ';%(ForcedUsingFiles)', + PreprocessorDefinitions: ';%(PreprocessorDefinitions)', + UndefinePreprocessorDefinitions: + ';%(UndefinePreprocessorDefinitions)', + Link: + AdditionalDependencies: ';%(AdditionalDependencies)', + AdditionalLibraryDirectories: ';%(AdditionalLibraryDirectories)', + AdditionalManifestDependencies: + ';%(AdditionalManifestDependencies)', + AdditionalOptions: ' %(AdditionalOptions)', + AddModuleNamesToAssembly: ';%(AddModuleNamesToAssembly)', + AssemblyLinkResource: ';%(AssemblyLinkResource)', + DelayLoadDLLs: ';%(DelayLoadDLLs)', + EmbedManagedResourceFile: ';%(EmbedManagedResourceFile)', + ForceSymbolReferences: ';%(ForceSymbolReferences)', + IgnoreSpecificDefaultLibraries: + ';%(IgnoreSpecificDefaultLibraries)', + ResourceCompile: + AdditionalIncludeDirectories: ';%(AdditionalIncludeDirectories)', + AdditionalOptions: ' %(AdditionalOptions)', + PreprocessorDefinitions: ';%(PreprocessorDefinitions)', + Manifest: + AdditionalManifestFiles: ';%(AdditionalManifestFiles)', + AdditionalOptions: ' %(AdditionalOptions)', + InputResourceManifests: ';%(InputResourceManifests)', + """ + msvs_settings = { + 'VCCLCompilerTool': { + 'AdditionalIncludeDirectories': 'dir1', + 'AdditionalOptions': '/more', + 'AdditionalUsingDirectories': 'test', + 'AssemblerListingLocation': '$(IntDir)\\a', + 'AssemblerOutput': '1', + 'BasicRuntimeChecks': '3', + 'BrowseInformation': '1', + 'BrowseInformationFile': '$(IntDir)\\e', + 'BufferSecurityCheck': 'false', + 'CallingConvention': '1', + 'CompileAs': '1', + 'DebugInformationFormat': '4', + 'DefaultCharIsUnsigned': 'true', + 'Detect64BitPortabilityProblems': 'true', + 'DisableLanguageExtensions': 'true', + 'DisableSpecificWarnings': 'abc', + 'EnableEnhancedInstructionSet': '1', + 'EnableFiberSafeOptimizations': 'true', + 'EnableFunctionLevelLinking': 'true', + 'EnableIntrinsicFunctions': 'true', + 'EnablePREfast': 'true', + 'ErrorReporting': '2', + 'ExceptionHandling': '2', + 'ExpandAttributedSource': 'true', + 'FavorSizeOrSpeed': '2', + 'FloatingPointExceptions': 'true', + 'FloatingPointModel': '1', + 'ForceConformanceInForLoopScope': 'false', + 'ForcedIncludeFiles': 'def', + 'ForcedUsingFiles': 'ge', + 'GeneratePreprocessedFile': '2', + 'GenerateXMLDocumentationFiles': 'true', + 'IgnoreStandardIncludePath': 'true', + 'InlineFunctionExpansion': '1', + 'KeepComments': 'true', + 'MinimalRebuild': 'true', + 'ObjectFile': '$(IntDir)\\b', + 'OmitDefaultLibName': 'true', + 'OmitFramePointers': 'true', + 'OpenMP': 'true', + 'Optimization': '3', + 'PrecompiledHeaderFile': '$(IntDir)\\$(TargetName).pche', + 'PrecompiledHeaderThrough': 'StdAfx.hd', + 'PreprocessorDefinitions': 'WIN32;_DEBUG;_CONSOLE', + 'ProgramDataBaseFileName': '$(IntDir)\\vc90b.pdb', + 'RuntimeLibrary': '3', + 'RuntimeTypeInfo': 'false', + 'ShowIncludes': 'true', + 'SmallerTypeCheck': 'true', + 'StringPooling': 'true', + 'StructMemberAlignment': '3', + 'SuppressStartupBanner': 'false', + 'TreatWChar_tAsBuiltInType': 'false', + 'UndefineAllPreprocessorDefinitions': 'true', + 'UndefinePreprocessorDefinitions': 'wer', + 'UseFullPaths': 'true', + 'UsePrecompiledHeader': '0', + 'UseUnicodeResponseFiles': 'false', + 'WarnAsError': 'true', + 'WarningLevel': '3', + 'WholeProgramOptimization': 'true', + 'XMLDocumentationFileName': '$(IntDir)\\c'}, + 'VCLinkerTool': { + 'AdditionalDependencies': 'zx', + 'AdditionalLibraryDirectories': 'asd', + 'AdditionalManifestDependencies': 's2', + 'AdditionalOptions': '/mor2', + 'AddModuleNamesToAssembly': 'd1', + 'AllowIsolation': 'false', + 'AssemblyDebug': '1', + 'AssemblyLinkResource': 'd5', + 'BaseAddress': '23423', + 'CLRImageType': '3', + 'CLRThreadAttribute': '1', + 'CLRUnmanagedCodeCheck': 'true', + 'DataExecutionPrevention': '0', + 'DelayLoadDLLs': 'd4', + 'DelaySign': 'true', + 'Driver': '2', + 'EmbedManagedResourceFile': 'd2', + 'EnableCOMDATFolding': '1', + 'EnableUAC': 'false', + 'EntryPointSymbol': 'f5', + 'ErrorReporting': '2', + 'FixedBaseAddress': '1', + 'ForceSymbolReferences': 'd3', + 'FunctionOrder': 'fssdfsd', + 'GenerateDebugInformation': 'true', + 'GenerateManifest': 'false', + 'GenerateMapFile': 'true', + 'HeapCommitSize': '13', + 'HeapReserveSize': '12', + 'IgnoreAllDefaultLibraries': 'true', + 'IgnoreDefaultLibraryNames': 'flob;flok', + 'IgnoreEmbeddedIDL': 'true', + 'IgnoreImportLibrary': 'true', + 'ImportLibrary': 'f4', + 'KeyContainer': 'f7', + 'KeyFile': 'f6', + 'LargeAddressAware': '2', + 'LinkIncremental': '0', + 'LinkLibraryDependencies': 'false', + 'LinkTimeCodeGeneration': '1', + 'ManifestFile': + '$(IntDir)\\$(TargetFileName).2intermediate.manifest', + 'MapExports': 'true', + 'MapFileName': 'd5', + 'MergedIDLBaseFileName': 'f2', + 'MergeSections': 'f5', + 'MidlCommandFile': 'f1', + 'ModuleDefinitionFile': 'sdsd', + 'OptimizeForWindows98': '2', + 'OptimizeReferences': '2', + 'OutputFile': '$(OutDir)\\$(ProjectName)2.exe', + 'PerUserRedirection': 'true', + 'Profile': 'true', + 'ProfileGuidedDatabase': '$(TargetDir)$(TargetName).pgdd', + 'ProgramDatabaseFile': 'Flob.pdb', + 'RandomizedBaseAddress': '1', + 'RegisterOutput': 'true', + 'ResourceOnlyDLL': 'true', + 'SetChecksum': 'false', + 'ShowProgress': '1', + 'StackCommitSize': '15', + 'StackReserveSize': '14', + 'StripPrivateSymbols': 'd3', + 'SubSystem': '1', + 'SupportUnloadOfDelayLoadedDLL': 'true', + 'SuppressStartupBanner': 'false', + 'SwapRunFromCD': 'true', + 'SwapRunFromNet': 'true', + 'TargetMachine': '1', + 'TerminalServerAware': '1', + 'TurnOffAssemblyGeneration': 'true', + 'TypeLibraryFile': 'f3', + 'TypeLibraryResourceID': '12', + 'UACExecutionLevel': '2', + 'UACUIAccess': 'true', + 'UseLibraryDependencyInputs': 'true', + 'UseUnicodeResponseFiles': 'false', + 'Version': '333'}, + 'VCResourceCompilerTool': { + 'AdditionalIncludeDirectories': 'f3', + 'AdditionalOptions': '/more3', + 'Culture': '3084', + 'IgnoreStandardIncludePath': 'true', + 'PreprocessorDefinitions': '_UNICODE;UNICODE2', + 'ResourceOutputFileName': '$(IntDir)/$(InputName)3.res', + 'ShowProgress': 'true'}, + 'VCManifestTool': { + 'AdditionalManifestFiles': 'sfsdfsd', + 'AdditionalOptions': 'afdsdafsd', + 'AssemblyIdentity': 'sddfdsadfsa', + 'ComponentFileName': 'fsdfds', + 'DependencyInformationFile': '$(IntDir)\\mt.depdfd', + 'EmbedManifest': 'false', + 'GenerateCatalogFiles': 'true', + 'InputResourceManifests': 'asfsfdafs', + 'ManifestResourceFile': + '$(IntDir)\\$(TargetFileName).embed.manifest.resfdsf', + 'OutputManifestFile': '$(TargetPath).manifestdfs', + 'RegistrarScriptFile': 'sdfsfd', + 'ReplacementsFile': 'sdffsd', + 'SuppressStartupBanner': 'false', + 'TypeLibraryFile': 'sfsd', + 'UpdateFileHashes': 'true', + 'UpdateFileHashesSearchPath': 'sfsd', + 'UseFAT32Workaround': 'true', + 'UseUnicodeResponseFiles': 'false', + 'VerboseOutput': 'true'}} + expected_msbuild_settings = { + 'ClCompile': { + 'AdditionalIncludeDirectories': 'dir1', + 'AdditionalOptions': '/more /J', + 'AdditionalUsingDirectories': 'test', + 'AssemblerListingLocation': '$(IntDir)a', + 'AssemblerOutput': 'AssemblyCode', + 'BasicRuntimeChecks': 'EnableFastChecks', + 'BrowseInformation': 'true', + 'BrowseInformationFile': '$(IntDir)e', + 'BufferSecurityCheck': 'false', + 'CallingConvention': 'FastCall', + 'CompileAs': 'CompileAsC', + 'DebugInformationFormat': 'EditAndContinue', + 'DisableLanguageExtensions': 'true', + 'DisableSpecificWarnings': 'abc', + 'EnableEnhancedInstructionSet': 'StreamingSIMDExtensions', + 'EnableFiberSafeOptimizations': 'true', + 'EnablePREfast': 'true', + 'ErrorReporting': 'Queue', + 'ExceptionHandling': 'Async', + 'ExpandAttributedSource': 'true', + 'FavorSizeOrSpeed': 'Size', + 'FloatingPointExceptions': 'true', + 'FloatingPointModel': 'Strict', + 'ForceConformanceInForLoopScope': 'false', + 'ForcedIncludeFiles': 'def', + 'ForcedUsingFiles': 'ge', + 'FunctionLevelLinking': 'true', + 'GenerateXMLDocumentationFiles': 'true', + 'IgnoreStandardIncludePath': 'true', + 'InlineFunctionExpansion': 'OnlyExplicitInline', + 'IntrinsicFunctions': 'true', + 'MinimalRebuild': 'true', + 'ObjectFileName': '$(IntDir)b', + 'OmitDefaultLibName': 'true', + 'OmitFramePointers': 'true', + 'OpenMPSupport': 'true', + 'Optimization': 'Full', + 'PrecompiledHeader': 'NotUsing', # Actual conversion gives '' + 'PrecompiledHeaderFile': 'StdAfx.hd', + 'PrecompiledHeaderOutputFile': '$(IntDir)$(TargetName).pche', + 'PreprocessKeepComments': 'true', + 'PreprocessorDefinitions': 'WIN32;_DEBUG;_CONSOLE', + 'PreprocessSuppressLineNumbers': 'true', + 'PreprocessToFile': 'true', + 'ProgramDataBaseFileName': '$(IntDir)vc90b.pdb', + 'RuntimeLibrary': 'MultiThreadedDebugDLL', + 'RuntimeTypeInfo': 'false', + 'ShowIncludes': 'true', + 'SmallerTypeCheck': 'true', + 'StringPooling': 'true', + 'StructMemberAlignment': '4Bytes', + 'SuppressStartupBanner': 'false', + 'TreatWarningAsError': 'true', + 'TreatWChar_tAsBuiltInType': 'false', + 'UndefineAllPreprocessorDefinitions': 'true', + 'UndefinePreprocessorDefinitions': 'wer', + 'UseFullPaths': 'true', + 'WarningLevel': 'Level3', + 'WholeProgramOptimization': 'true', + 'XMLDocumentationFileName': '$(IntDir)c'}, + 'Link': { + 'AdditionalDependencies': 'zx', + 'AdditionalLibraryDirectories': 'asd', + 'AdditionalManifestDependencies': 's2', + 'AdditionalOptions': '/mor2', + 'AddModuleNamesToAssembly': 'd1', + 'AllowIsolation': 'false', + 'AssemblyDebug': 'true', + 'AssemblyLinkResource': 'd5', + 'BaseAddress': '23423', + 'CLRImageType': 'ForceSafeILImage', + 'CLRThreadAttribute': 'MTAThreadingAttribute', + 'CLRUnmanagedCodeCheck': 'true', + 'DataExecutionPrevention': '', + 'DelayLoadDLLs': 'd4', + 'DelaySign': 'true', + 'Driver': 'UpOnly', + 'EmbedManagedResourceFile': 'd2', + 'EnableCOMDATFolding': 'false', + 'EnableUAC': 'false', + 'EntryPointSymbol': 'f5', + 'FixedBaseAddress': 'false', + 'ForceSymbolReferences': 'd3', + 'FunctionOrder': 'fssdfsd', + 'GenerateDebugInformation': 'true', + 'GenerateMapFile': 'true', + 'HeapCommitSize': '13', + 'HeapReserveSize': '12', + 'IgnoreAllDefaultLibraries': 'true', + 'IgnoreEmbeddedIDL': 'true', + 'IgnoreSpecificDefaultLibraries': 'flob;flok', + 'ImportLibrary': 'f4', + 'KeyContainer': 'f7', + 'KeyFile': 'f6', + 'LargeAddressAware': 'true', + 'LinkErrorReporting': 'QueueForNextLogin', + 'LinkTimeCodeGeneration': 'UseLinkTimeCodeGeneration', + 'ManifestFile': '$(IntDir)$(TargetFileName).2intermediate.manifest', + 'MapExports': 'true', + 'MapFileName': 'd5', + 'MergedIDLBaseFileName': 'f2', + 'MergeSections': 'f5', + 'MidlCommandFile': 'f1', + 'ModuleDefinitionFile': 'sdsd', + 'NoEntryPoint': 'true', + 'OptimizeReferences': 'true', + 'OutputFile': '$(OutDir)$(ProjectName)2.exe', + 'PerUserRedirection': 'true', + 'Profile': 'true', + 'ProfileGuidedDatabase': '$(TargetDir)$(TargetName).pgdd', + 'ProgramDatabaseFile': 'Flob.pdb', + 'RandomizedBaseAddress': 'false', + 'RegisterOutput': 'true', + 'SetChecksum': 'false', + 'ShowProgress': 'LinkVerbose', + 'StackCommitSize': '15', + 'StackReserveSize': '14', + 'StripPrivateSymbols': 'd3', + 'SubSystem': 'Console', + 'SupportUnloadOfDelayLoadedDLL': 'true', + 'SuppressStartupBanner': 'false', + 'SwapRunFromCD': 'true', + 'SwapRunFromNET': 'true', + 'TargetMachine': 'MachineX86', + 'TerminalServerAware': 'false', + 'TurnOffAssemblyGeneration': 'true', + 'TypeLibraryFile': 'f3', + 'TypeLibraryResourceID': '12', + 'UACExecutionLevel': 'RequireAdministrator', + 'UACUIAccess': 'true', + 'Version': '333'}, + 'ResourceCompile': { + 'AdditionalIncludeDirectories': 'f3', + 'AdditionalOptions': '/more3', + 'Culture': '0x0c0c', + 'IgnoreStandardIncludePath': 'true', + 'PreprocessorDefinitions': '_UNICODE;UNICODE2', + 'ResourceOutputFileName': '$(IntDir)%(Filename)3.res', + 'ShowProgress': 'true'}, + 'Manifest': { + 'AdditionalManifestFiles': 'sfsdfsd', + 'AdditionalOptions': 'afdsdafsd', + 'AssemblyIdentity': 'sddfdsadfsa', + 'ComponentFileName': 'fsdfds', + 'GenerateCatalogFiles': 'true', + 'InputResourceManifests': 'asfsfdafs', + 'OutputManifestFile': '$(TargetPath).manifestdfs', + 'RegistrarScriptFile': 'sdfsfd', + 'ReplacementsFile': 'sdffsd', + 'SuppressStartupBanner': 'false', + 'TypeLibraryFile': 'sfsd', + 'UpdateFileHashes': 'true', + 'UpdateFileHashesSearchPath': 'sfsd', + 'VerboseOutput': 'true'}, + 'ProjectReference': { + 'LinkLibraryDependencies': 'false', + 'UseLibraryDependencyInputs': 'true'}, + '': { + 'EmbedManifest': 'false', + 'GenerateManifest': 'false', + 'IgnoreImportLibrary': 'true', + 'LinkIncremental': '' + }, + 'ManifestResourceCompile': { + 'ResourceOutputFileName': + '$(IntDir)$(TargetFileName).embed.manifest.resfdsf'} + } + actual_msbuild_settings = MSVSSettings.ConvertToMSBuildSettings( + msvs_settings, + self.stderr) + self.assertEqual(expected_msbuild_settings, actual_msbuild_settings) + self._ExpectedWarnings([]) + + +if __name__ == '__main__': + unittest.main() diff --git a/tools/gyp/pylib/gyp/MSVSToolFile.py b/tools/gyp/pylib/gyp/MSVSToolFile.py new file mode 100644 index 000000000..74e529a17 --- /dev/null +++ b/tools/gyp/pylib/gyp/MSVSToolFile.py @@ -0,0 +1,58 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Visual Studio project reader/writer.""" + +import gyp.common +import gyp.easy_xml as easy_xml + + +class Writer(object): + """Visual Studio XML tool file writer.""" + + def __init__(self, tool_file_path, name): + """Initializes the tool file. + + Args: + tool_file_path: Path to the tool file. + name: Name of the tool file. + """ + self.tool_file_path = tool_file_path + self.name = name + self.rules_section = ['Rules'] + + def AddCustomBuildRule(self, name, cmd, description, + additional_dependencies, + outputs, extensions): + """Adds a rule to the tool file. + + Args: + name: Name of the rule. + description: Description of the rule. + cmd: Command line of the rule. + additional_dependencies: other files which may trigger the rule. + outputs: outputs of the rule. + extensions: extensions handled by the rule. + """ + rule = ['CustomBuildRule', + {'Name': name, + 'ExecutionDescription': description, + 'CommandLine': cmd, + 'Outputs': ';'.join(outputs), + 'FileExtensions': ';'.join(extensions), + 'AdditionalDependencies': + ';'.join(additional_dependencies) + }] + self.rules_section.append(rule) + + def WriteIfChanged(self): + """Writes the tool file.""" + content = ['VisualStudioToolFile', + {'Version': '8.00', + 'Name': self.name + }, + self.rules_section + ] + easy_xml.WriteXmlIfChanged(content, self.tool_file_path, + encoding="Windows-1252") diff --git a/tools/gyp/pylib/gyp/MSVSUserFile.py b/tools/gyp/pylib/gyp/MSVSUserFile.py new file mode 100644 index 000000000..6c07e9a89 --- /dev/null +++ b/tools/gyp/pylib/gyp/MSVSUserFile.py @@ -0,0 +1,147 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Visual Studio user preferences file writer.""" + +import os +import re +import socket # for gethostname + +import gyp.common +import gyp.easy_xml as easy_xml + + +#------------------------------------------------------------------------------ + +def _FindCommandInPath(command): + """If there are no slashes in the command given, this function + searches the PATH env to find the given command, and converts it + to an absolute path. We have to do this because MSVS is looking + for an actual file to launch a debugger on, not just a command + line. Note that this happens at GYP time, so anything needing to + be built needs to have a full path.""" + if '/' in command or '\\' in command: + # If the command already has path elements (either relative or + # absolute), then assume it is constructed properly. + return command + else: + # Search through the path list and find an existing file that + # we can access. + paths = os.environ.get('PATH','').split(os.pathsep) + for path in paths: + item = os.path.join(path, command) + if os.path.isfile(item) and os.access(item, os.X_OK): + return item + return command + +def _QuoteWin32CommandLineArgs(args): + new_args = [] + for arg in args: + # Replace all double-quotes with double-double-quotes to escape + # them for cmd shell, and then quote the whole thing if there + # are any. + if arg.find('"') != -1: + arg = '""'.join(arg.split('"')) + arg = '"%s"' % arg + + # Otherwise, if there are any spaces, quote the whole arg. + elif re.search(r'[ \t\n]', arg): + arg = '"%s"' % arg + new_args.append(arg) + return new_args + +class Writer(object): + """Visual Studio XML user user file writer.""" + + def __init__(self, user_file_path, version, name): + """Initializes the user file. + + Args: + user_file_path: Path to the user file. + version: Version info. + name: Name of the user file. + """ + self.user_file_path = user_file_path + self.version = version + self.name = name + self.configurations = {} + + def AddConfig(self, name): + """Adds a configuration to the project. + + Args: + name: Configuration name. + """ + self.configurations[name] = ['Configuration', {'Name': name}] + + def AddDebugSettings(self, config_name, command, environment = {}, + working_directory=""): + """Adds a DebugSettings node to the user file for a particular config. + + Args: + command: command line to run. First element in the list is the + executable. All elements of the command will be quoted if + necessary. + working_directory: other files which may trigger the rule. (optional) + """ + command = _QuoteWin32CommandLineArgs(command) + + abs_command = _FindCommandInPath(command[0]) + + if environment and isinstance(environment, dict): + env_list = ['%s="%s"' % (key, val) + for (key,val) in environment.iteritems()] + environment = ' '.join(env_list) + else: + environment = '' + + n_cmd = ['DebugSettings', + {'Command': abs_command, + 'WorkingDirectory': working_directory, + 'CommandArguments': " ".join(command[1:]), + 'RemoteMachine': socket.gethostname(), + 'Environment': environment, + 'EnvironmentMerge': 'true', + # Currently these are all "dummy" values that we're just setting + # in the default manner that MSVS does it. We could use some of + # these to add additional capabilities, I suppose, but they might + # not have parity with other platforms then. + 'Attach': 'false', + 'DebuggerType': '3', # 'auto' debugger + 'Remote': '1', + 'RemoteCommand': '', + 'HttpUrl': '', + 'PDBPath': '', + 'SQLDebugging': '', + 'DebuggerFlavor': '0', + 'MPIRunCommand': '', + 'MPIRunArguments': '', + 'MPIRunWorkingDirectory': '', + 'ApplicationCommand': '', + 'ApplicationArguments': '', + 'ShimCommand': '', + 'MPIAcceptMode': '', + 'MPIAcceptFilter': '' + }] + + # Find the config, and add it if it doesn't exist. + if config_name not in self.configurations: + self.AddConfig(config_name) + + # Add the DebugSettings onto the appropriate config. + self.configurations[config_name].append(n_cmd) + + def WriteIfChanged(self): + """Writes the user file.""" + configs = ['Configurations'] + for config, spec in sorted(self.configurations.iteritems()): + configs.append(spec) + + content = ['VisualStudioUserFile', + {'Version': self.version.ProjectVersion(), + 'Name': self.name + }, + configs] + easy_xml.WriteXmlIfChanged(content, self.user_file_path, + encoding="Windows-1252") diff --git a/tools/gyp/pylib/gyp/MSVSVersion.py b/tools/gyp/pylib/gyp/MSVSVersion.py new file mode 100644 index 000000000..656a890a5 --- /dev/null +++ b/tools/gyp/pylib/gyp/MSVSVersion.py @@ -0,0 +1,309 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Handle version information related to Visual Stuio.""" + +import errno +import os +import re +import subprocess +import sys + + +class VisualStudioVersion(object): + """Information regarding a version of Visual Studio.""" + + def __init__(self, short_name, description, + solution_version, project_version, flat_sln, uses_vcxproj, + path, sdk_based): + self.short_name = short_name + self.description = description + self.solution_version = solution_version + self.project_version = project_version + self.flat_sln = flat_sln + self.uses_vcxproj = uses_vcxproj + self.path = path + self.sdk_based = sdk_based + + def ShortName(self): + return self.short_name + + def Description(self): + """Get the full description of the version.""" + return self.description + + def SolutionVersion(self): + """Get the version number of the sln files.""" + return self.solution_version + + def ProjectVersion(self): + """Get the version number of the vcproj or vcxproj files.""" + return self.project_version + + def FlatSolution(self): + return self.flat_sln + + def UsesVcxproj(self): + """Returns true if this version uses a vcxproj file.""" + return self.uses_vcxproj + + def ProjectExtension(self): + """Returns the file extension for the project.""" + return self.uses_vcxproj and '.vcxproj' or '.vcproj' + + def Path(self): + """Returns the path to Visual Studio installation.""" + return self.path + + def ToolPath(self, tool): + """Returns the path to a given compiler tool. """ + return os.path.normpath(os.path.join(self.path, "VC/bin", tool)) + + def SetupScript(self): + """Returns the path to the setup script for setting up the environment.""" + # Check if we are running in the SDK command line environment and use + # the setup script from the SDK if so. + # TODO(alexeypa): specify the target platform (x86 or x64). + sdk_dir = os.environ.get('WindowsSDKDir') + if self.sdk_based and sdk_dir: + return os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.Cmd')) + else: + return os.path.normpath( + os.path.join(self.path, 'Common7/Tools/vsvars32.bat')) + +def _RegistryQueryBase(sysdir, key, value): + """Use reg.exe to read a particular key. + + While ideally we might use the win32 module, we would like gyp to be + python neutral, so for instance cygwin python lacks this module. + + Arguments: + sysdir: The system subdirectory to attempt to launch reg.exe from. + key: The registry key to read from. + value: The particular value to read. + Return: + stdout from reg.exe, or None for failure. + """ + # Skip if not on Windows or Python Win32 setup issue + if sys.platform not in ('win32', 'cygwin'): + return None + # Setup params to pass to and attempt to launch reg.exe + cmd = [os.path.join(os.environ.get('WINDIR', ''), sysdir, 'reg.exe'), + 'query', key] + if value: + cmd.extend(['/v', value]) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # Obtain the stdout from reg.exe, reading to the end so p.returncode is valid + # Note that the error text may be in [1] in some cases + text = p.communicate()[0] + # Check return code from reg.exe; officially 0==success and 1==error + if p.returncode: + return None + return text + + +def _RegistryQuery(key, value=None): + """Use reg.exe to read a particular key through _RegistryQueryBase. + + First tries to launch from %WinDir%\Sysnative to avoid WoW64 redirection. If + that fails, it falls back to System32. Sysnative is available on Vista and + up and available on Windows Server 2003 and XP through KB patch 942589. Note + that Sysnative will always fail if using 64-bit python due to it being a + virtual directory and System32 will work correctly in the first place. + + KB 942589 - http://support.microsoft.com/kb/942589/en-us. + + Arguments: + key: The registry key. + value: The particular registry value to read (optional). + Return: + stdout from reg.exe, or None for failure. + """ + text = None + try: + text = _RegistryQueryBase('Sysnative', key, value) + except OSError, e: + if e.errno == errno.ENOENT: + text = _RegistryQueryBase('System32', key, value) + else: + raise + return text + + +def _RegistryGetValue(key, value): + """Use reg.exe to obtain the value of a registry key. + + Args: + key: The registry key. + value: The particular registry value to read. + Return: + contents of the registry key's value, or None on failure. + """ + text = _RegistryQuery(key, value) + if not text: + return None + # Extract value. + match = re.search(r'REG_\w+\s+([^\r]+)\r\n', text) + if not match: + return None + return match.group(1) + + +def _RegistryKeyExists(key): + """Use reg.exe to see if a key exists. + + Args: + key: The registry key to check. + Return: + True if the key exists + """ + if not _RegistryQuery(key): + return False + return True + + +def _CreateVersion(name, path, sdk_based=False): + """Sets up MSVS project generation. + + Setup is based off the GYP_MSVS_VERSION environment variable or whatever is + autodetected if GYP_MSVS_VERSION is not explicitly specified. If a version is + passed in that doesn't match a value in versions python will throw a error. + """ + versions = { + '2010': VisualStudioVersion('2010', + 'Visual Studio 2010', + solution_version='11.00', + project_version='4.0', + flat_sln=False, + uses_vcxproj=True, + path=path, + sdk_based=sdk_based), + '2010e': VisualStudioVersion('2010e', + 'Visual Studio 2010', + solution_version='11.00', + project_version='4.0', + flat_sln=True, + uses_vcxproj=True, + path=path, + sdk_based=sdk_based), + '2008': VisualStudioVersion('2008', + 'Visual Studio 2008', + solution_version='10.00', + project_version='9.00', + flat_sln=False, + uses_vcxproj=False, + path=path, + sdk_based=sdk_based), + '2008e': VisualStudioVersion('2008e', + 'Visual Studio 2008', + solution_version='10.00', + project_version='9.00', + flat_sln=True, + uses_vcxproj=False, + path=path, + sdk_based=sdk_based), + '2005': VisualStudioVersion('2005', + 'Visual Studio 2005', + solution_version='9.00', + project_version='8.00', + flat_sln=False, + uses_vcxproj=False, + path=path, + sdk_based=sdk_based), + '2005e': VisualStudioVersion('2005e', + 'Visual Studio 2005', + solution_version='9.00', + project_version='8.00', + flat_sln=True, + uses_vcxproj=False, + path=path, + sdk_based=sdk_based), + } + return versions[str(name)] + + +def _DetectVisualStudioVersions(versions_to_check, force_express): + """Collect the list of installed visual studio versions. + + Returns: + A list of visual studio versions installed in descending order of + usage preference. + Base this on the registry and a quick check if devenv.exe exists. + Only versions 8-10 are considered. + Possibilities are: + 2005(e) - Visual Studio 2005 (8) + 2008(e) - Visual Studio 2008 (9) + 2010(e) - Visual Studio 2010 (10) + Where (e) is e for express editions of MSVS and blank otherwise. + """ + version_to_year = {'8.0': '2005', '9.0': '2008', '10.0': '2010'} + versions = [] + for version in versions_to_check: + # Old method of searching for which VS version is installed + # We don't use the 2010-encouraged-way because we also want to get the + # path to the binaries, which it doesn't offer. + keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version, + r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version, + r'HKLM\Software\Microsoft\VCExpress\%s' % version, + r'HKLM\Software\Wow6432Node\Microsoft\VCExpress\%s' % version] + for index in range(len(keys)): + path = _RegistryGetValue(keys[index], 'InstallDir') + if not path: + continue + # Check for full. + full_path = os.path.join(path, 'devenv.exe') + express_path = os.path.join(path, 'vcexpress.exe') + if not force_express and os.path.exists(full_path): + # Add this one. + versions.append(_CreateVersion(version_to_year[version], + os.path.join(path, '..', '..'))) + # Check for express. + elif os.path.exists(express_path): + # Add this one. + versions.append(_CreateVersion(version_to_year[version] + 'e', + os.path.join(path, '..', '..'))) + + # The old method above does not work when only SDK is installed. + keys = [r'HKLM\Software\Microsoft\VisualStudio\SxS\VC7', + r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VC7'] + for index in range(len(keys)): + path = _RegistryGetValue(keys[index], version) + if not path: + continue + versions.append(_CreateVersion(version_to_year[version] + 'e', + os.path.join(path, '..'), sdk_based=True)) + + return versions + + +def SelectVisualStudioVersion(version='auto'): + """Select which version of Visual Studio projects to generate. + + Arguments: + version: Hook to allow caller to force a particular version (vs auto). + Returns: + An object representing a visual studio project format version. + """ + # In auto mode, check environment variable for override. + if version == 'auto': + version = os.environ.get('GYP_MSVS_VERSION', 'auto') + version_map = { + # For now, prefer versions before VS2010 + 'auto': ('9.0', '8.0', '10.0'), + '2005': ('8.0',), + '2005e': ('8.0',), + '2008': ('9.0',), + '2008e': ('9.0',), + '2010': ('10.0',), + '2010e': ('10.0',), + } + version = str(version) + versions = _DetectVisualStudioVersions(version_map[version], 'e' in version) + if not versions: + if version == 'auto': + # Default to 2005 if we couldn't find anything + return _CreateVersion('2005', None) + else: + return _CreateVersion(version, None) + return versions[0] diff --git a/tools/gyp/pylib/gyp/SCons.py b/tools/gyp/pylib/gyp/SCons.py new file mode 100644 index 000000000..42d845ebe --- /dev/null +++ b/tools/gyp/pylib/gyp/SCons.py @@ -0,0 +1,199 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +SCons generator. + +This contains class definitions and supporting functions for generating +pieces of SCons files for the different types of GYP targets. +""" + +import os + + +def WriteList(fp, list, prefix='', + separator=',\n ', + preamble=None, + postamble=None): + fp.write(preamble or '') + fp.write((separator or ' ').join([prefix + l for l in list])) + fp.write(postamble or '') + + +class TargetBase(object): + """ + Base class for a SCons representation of a GYP target. + """ + is_ignored = False + target_prefix = '' + target_suffix = '' + def __init__(self, spec): + self.spec = spec + def full_product_name(self): + """ + Returns the full name of the product being built: + + * Uses 'product_name' if it's set, else prefix + 'target_name'. + * Prepends 'product_dir' if set. + * Appends SCons suffix variables for the target type (or + product_extension). + """ + suffix = self.target_suffix + product_extension = self.spec.get('product_extension') + if product_extension: + suffix = '.' + product_extension + prefix = self.spec.get('product_prefix', self.target_prefix) + name = self.spec['target_name'] + name = prefix + self.spec.get('product_name', name) + suffix + product_dir = self.spec.get('product_dir') + if product_dir: + name = os.path.join(product_dir, name) + else: + name = os.path.join(self.out_dir, name) + return name + + def write_input_files(self, fp): + """ + Writes the definition of the input files (sources). + """ + sources = self.spec.get('sources') + if not sources: + fp.write('\ninput_files = []\n') + return + preamble = '\ninput_files = [\n ' + postamble = ',\n]\n' + WriteList(fp, map(repr, sources), preamble=preamble, postamble=postamble) + + def builder_call(self): + """ + Returns the actual SCons builder call to build this target. + """ + name = self.full_product_name() + return 'env.%s(env.File(%r), input_files)' % (self.builder_name, name) + def write_target(self, fp, src_dir='', pre=''): + """ + Writes the lines necessary to build this target. + """ + fp.write('\n' + pre) + fp.write('_outputs = %s\n' % self.builder_call()) + fp.write('target_files.extend(_outputs)\n') + + +class NoneTarget(TargetBase): + """ + A GYP target type of 'none', implicitly or explicitly. + """ + def write_target(self, fp, src_dir='', pre=''): + fp.write('\ntarget_files.extend(input_files)\n') + + +class SettingsTarget(TargetBase): + """ + A GYP target type of 'settings'. + """ + is_ignored = True + + +compilable_sources_template = """ +_result = [] +for infile in input_files: + if env.compilable(infile): + if (type(infile) == type('') + and (infile.startswith(%(src_dir)r) + or not os.path.isabs(env.subst(infile)))): + # Force files below the build directory by replacing all '..' + # elements in the path with '__': + base, ext = os.path.splitext(os.path.normpath(infile)) + base = [d == '..' and '__' or d for d in base.split('/')] + base = os.path.join(*base) + object = '${OBJ_DIR}/${COMPONENT_NAME}/${TARGET_NAME}/' + base + if not infile.startswith(%(src_dir)r): + infile = %(src_dir)r + infile + infile = env.%(name)s(object, infile)[0] + else: + infile = env.%(name)s(infile)[0] + _result.append(infile) +input_files = _result +""" + +class CompilableSourcesTargetBase(TargetBase): + """ + An abstract base class for targets that compile their source files. + + We explicitly transform compilable files into object files, + even though SCons could infer that for us, because we want + to control where the object file ends up. (The implicit rules + in SCons always put the object file next to the source file.) + """ + intermediate_builder_name = None + def write_target(self, fp, src_dir='', pre=''): + if self.intermediate_builder_name is None: + raise NotImplementedError + if src_dir and not src_dir.endswith('/'): + src_dir += '/' + variables = { + 'src_dir': src_dir, + 'name': self.intermediate_builder_name, + } + fp.write(compilable_sources_template % variables) + super(CompilableSourcesTargetBase, self).write_target(fp) + + +class ProgramTarget(CompilableSourcesTargetBase): + """ + A GYP target type of 'executable'. + """ + builder_name = 'GypProgram' + intermediate_builder_name = 'StaticObject' + target_prefix = '${PROGPREFIX}' + target_suffix = '${PROGSUFFIX}' + out_dir = '${TOP_BUILDDIR}' + + +class StaticLibraryTarget(CompilableSourcesTargetBase): + """ + A GYP target type of 'static_library'. + """ + builder_name = 'GypStaticLibrary' + intermediate_builder_name = 'StaticObject' + target_prefix = '${LIBPREFIX}' + target_suffix = '${LIBSUFFIX}' + out_dir = '${LIB_DIR}' + + +class SharedLibraryTarget(CompilableSourcesTargetBase): + """ + A GYP target type of 'shared_library'. + """ + builder_name = 'GypSharedLibrary' + intermediate_builder_name = 'SharedObject' + target_prefix = '${SHLIBPREFIX}' + target_suffix = '${SHLIBSUFFIX}' + out_dir = '${LIB_DIR}' + + +class LoadableModuleTarget(CompilableSourcesTargetBase): + """ + A GYP target type of 'loadable_module'. + """ + builder_name = 'GypLoadableModule' + intermediate_builder_name = 'SharedObject' + target_prefix = '${SHLIBPREFIX}' + target_suffix = '${SHLIBSUFFIX}' + out_dir = '${TOP_BUILDDIR}' + + +TargetMap = { + None : NoneTarget, + 'none' : NoneTarget, + 'settings' : SettingsTarget, + 'executable' : ProgramTarget, + 'static_library' : StaticLibraryTarget, + 'shared_library' : SharedLibraryTarget, + 'loadable_module' : LoadableModuleTarget, +} + + +def Target(spec): + return TargetMap[spec.get('type')](spec) diff --git a/tools/gyp/pylib/gyp/__init__.py b/tools/gyp/pylib/gyp/__init__.py new file mode 100755 index 000000000..140271388 --- /dev/null +++ b/tools/gyp/pylib/gyp/__init__.py @@ -0,0 +1,487 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import copy +import gyp.input +import optparse +import os.path +import re +import shlex +import sys +import traceback + +# Default debug modes for GYP +debug = {} + +# List of "official" debug modes, but you can use anything you like. +DEBUG_GENERAL = 'general' +DEBUG_VARIABLES = 'variables' +DEBUG_INCLUDES = 'includes' + + +def DebugOutput(mode, message): + if 'all' in gyp.debug.keys() or mode in gyp.debug.keys(): + ctx = ('unknown', 0, 'unknown') + try: + f = traceback.extract_stack(limit=2) + if f: + ctx = f[0][:3] + except: + pass + print '%s:%s:%d:%s %s' % (mode.upper(), os.path.basename(ctx[0]), + ctx[1], ctx[2], message) + +def FindBuildFiles(): + extension = '.gyp' + files = os.listdir(os.getcwd()) + build_files = [] + for file in files: + if file[-len(extension):] == extension: + build_files.append(file) + return build_files + + +def Load(build_files, format, default_variables={}, + includes=[], depth='.', params=None, check=False, circular_check=True): + """ + Loads one or more specified build files. + default_variables and includes will be copied before use. + Returns the generator for the specified format and the + data returned by loading the specified build files. + """ + if params is None: + params = {} + + flavor = None + if '-' in format: + format, params['flavor'] = format.split('-', 1) + + default_variables = copy.copy(default_variables) + + # Default variables provided by this program and its modules should be + # named WITH_CAPITAL_LETTERS to provide a distinct "best practice" namespace, + # avoiding collisions with user and automatic variables. + default_variables['GENERATOR'] = format + + generator_name = 'gyp.generator.' + format + # These parameters are passed in order (as opposed to by key) + # because ActivePython cannot handle key parameters to __import__. + generator = __import__(generator_name, globals(), locals(), generator_name) + for (key, val) in generator.generator_default_variables.items(): + default_variables.setdefault(key, val) + + # Give the generator the opportunity to set additional variables based on + # the params it will receive in the output phase. + if getattr(generator, 'CalculateVariables', None): + generator.CalculateVariables(default_variables, params) + + # Give the generator the opportunity to set generator_input_info based on + # the params it will receive in the output phase. + if getattr(generator, 'CalculateGeneratorInputInfo', None): + generator.CalculateGeneratorInputInfo(params) + + # Fetch the generator specific info that gets fed to input, we use getattr + # so we can default things and the generators only have to provide what + # they need. + generator_input_info = { + 'generator_wants_absolute_build_file_paths': + getattr(generator, 'generator_wants_absolute_build_file_paths', False), + 'generator_handles_variants': + getattr(generator, 'generator_handles_variants', False), + 'non_configuration_keys': + getattr(generator, 'generator_additional_non_configuration_keys', []), + 'path_sections': + getattr(generator, 'generator_additional_path_sections', []), + 'extra_sources_for_rules': + getattr(generator, 'generator_extra_sources_for_rules', []), + 'generator_supports_multiple_toolsets': + getattr(generator, 'generator_supports_multiple_toolsets', False), + 'generator_wants_static_library_dependencies_adjusted': + getattr(generator, + 'generator_wants_static_library_dependencies_adjusted', True), + 'generator_wants_sorted_dependencies': + getattr(generator, 'generator_wants_sorted_dependencies', False), + } + + # Process the input specific to this generator. + result = gyp.input.Load(build_files, default_variables, includes[:], + depth, generator_input_info, check, circular_check) + return [generator] + result + +def NameValueListToDict(name_value_list): + """ + Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary + of the pairs. If a string is simply NAME, then the value in the dictionary + is set to True. If VALUE can be converted to an integer, it is. + """ + result = { } + for item in name_value_list: + tokens = item.split('=', 1) + if len(tokens) == 2: + # If we can make it an int, use that, otherwise, use the string. + try: + token_value = int(tokens[1]) + except ValueError: + token_value = tokens[1] + # Set the variable to the supplied value. + result[tokens[0]] = token_value + else: + # No value supplied, treat it as a boolean and set it. + result[tokens[0]] = True + return result + +def ShlexEnv(env_name): + flags = os.environ.get(env_name, []) + if flags: + flags = shlex.split(flags) + return flags + +def FormatOpt(opt, value): + if opt.startswith('--'): + return '%s=%s' % (opt, value) + return opt + value + +def RegenerateAppendFlag(flag, values, predicate, env_name, options): + """Regenerate a list of command line flags, for an option of action='append'. + + The |env_name|, if given, is checked in the environment and used to generate + an initial list of options, then the options that were specified on the + command line (given in |values|) are appended. This matches the handling of + environment variables and command line flags where command line flags override + the environment, while not requiring the environment to be set when the flags + are used again. + """ + flags = [] + if options.use_environment and env_name: + for flag_value in ShlexEnv(env_name): + flags.append(FormatOpt(flag, predicate(flag_value))) + if values: + for flag_value in values: + flags.append(FormatOpt(flag, predicate(flag_value))) + return flags + +def RegenerateFlags(options): + """Given a parsed options object, and taking the environment variables into + account, returns a list of flags that should regenerate an equivalent options + object (even in the absence of the environment variables.) + + Any path options will be normalized relative to depth. + + The format flag is not included, as it is assumed the calling generator will + set that as appropriate. + """ + def FixPath(path): + path = gyp.common.FixIfRelativePath(path, options.depth) + if not path: + return os.path.curdir + return path + + def Noop(value): + return value + + # We always want to ignore the environment when regenerating, to avoid + # duplicate or changed flags in the environment at the time of regeneration. + flags = ['--ignore-environment'] + for name, metadata in options._regeneration_metadata.iteritems(): + opt = metadata['opt'] + value = getattr(options, name) + value_predicate = metadata['type'] == 'path' and FixPath or Noop + action = metadata['action'] + env_name = metadata['env_name'] + if action == 'append': + flags.extend(RegenerateAppendFlag(opt, value, value_predicate, + env_name, options)) + elif action in ('store', None): # None is a synonym for 'store'. + if value: + flags.append(FormatOpt(opt, value_predicate(value))) + elif options.use_environment and env_name and os.environ.get(env_name): + flags.append(FormatOpt(opt, value_predicate(os.environ.get(env_name)))) + elif action in ('store_true', 'store_false'): + if ((action == 'store_true' and value) or + (action == 'store_false' and not value)): + flags.append(opt) + elif options.use_environment and env_name: + print >>sys.stderr, ('Warning: environment regeneration unimplemented ' + 'for %s flag %r env_name %r' % (action, opt, + env_name)) + else: + print >>sys.stderr, ('Warning: regeneration unimplemented for action %r ' + 'flag %r' % (action, opt)) + + return flags + +class RegeneratableOptionParser(optparse.OptionParser): + def __init__(self): + self.__regeneratable_options = {} + optparse.OptionParser.__init__(self) + + def add_option(self, *args, **kw): + """Add an option to the parser. + + This accepts the same arguments as OptionParser.add_option, plus the + following: + regenerate: can be set to False to prevent this option from being included + in regeneration. + env_name: name of environment variable that additional values for this + option come from. + type: adds type='path', to tell the regenerator that the values of + this option need to be made relative to options.depth + """ + env_name = kw.pop('env_name', None) + if 'dest' in kw and kw.pop('regenerate', True): + dest = kw['dest'] + + # The path type is needed for regenerating, for optparse we can just treat + # it as a string. + type = kw.get('type') + if type == 'path': + kw['type'] = 'string' + + self.__regeneratable_options[dest] = { + 'action': kw.get('action'), + 'type': type, + 'env_name': env_name, + 'opt': args[0], + } + + optparse.OptionParser.add_option(self, *args, **kw) + + def parse_args(self, *args): + values, args = optparse.OptionParser.parse_args(self, *args) + values._regeneration_metadata = self.__regeneratable_options + return values, args + +def main(args): + my_name = os.path.basename(sys.argv[0]) + + parser = RegeneratableOptionParser() + usage = 'usage: %s [options ...] [build_file ...]' + parser.set_usage(usage.replace('%s', '%prog')) + parser.add_option('-D', dest='defines', action='append', metavar='VAR=VAL', + env_name='GYP_DEFINES', + help='sets variable VAR to value VAL') + parser.add_option('-f', '--format', dest='formats', action='append', + env_name='GYP_GENERATORS', regenerate=False, + help='output formats to generate') + parser.add_option('--msvs-version', dest='msvs_version', + regenerate=False, + help='Deprecated; use -G msvs_version=MSVS_VERSION instead') + parser.add_option('-I', '--include', dest='includes', action='append', + metavar='INCLUDE', type='path', + help='files to include in all loaded .gyp files') + parser.add_option('--depth', dest='depth', metavar='PATH', type='path', + help='set DEPTH gyp variable to a relative path to PATH') + parser.add_option('-d', '--debug', dest='debug', metavar='DEBUGMODE', + action='append', default=[], help='turn on a debugging ' + 'mode for debugging GYP. Supported modes are "variables", ' + '"includes" and "general" or "all" for all of them.') + parser.add_option('-S', '--suffix', dest='suffix', default='', + help='suffix to add to generated files') + parser.add_option('-G', dest='generator_flags', action='append', default=[], + metavar='FLAG=VAL', env_name='GYP_GENERATOR_FLAGS', + help='sets generator flag FLAG to VAL') + parser.add_option('--generator-output', dest='generator_output', + action='store', default=None, metavar='DIR', type='path', + env_name='GYP_GENERATOR_OUTPUT', + help='puts generated build files under DIR') + parser.add_option('--ignore-environment', dest='use_environment', + action='store_false', default=True, regenerate=False, + help='do not read options from environment variables') + parser.add_option('--check', dest='check', action='store_true', + help='check format of gyp files') + parser.add_option('--toplevel-dir', dest='toplevel_dir', action='store', + default=None, metavar='DIR', type='path', + help='directory to use as the root of the source tree') + # --no-circular-check disables the check for circular relationships between + # .gyp files. These relationships should not exist, but they've only been + # observed to be harmful with the Xcode generator. Chromium's .gyp files + # currently have some circular relationships on non-Mac platforms, so this + # option allows the strict behavior to be used on Macs and the lenient + # behavior to be used elsewhere. + # TODO(mark): Remove this option when http://crbug.com/35878 is fixed. + parser.add_option('--no-circular-check', dest='circular_check', + action='store_false', default=True, regenerate=False, + help="don't check for circular relationships between files") + + # We read a few things from ~/.gyp, so set up a var for that. + home_vars = ['HOME'] + if sys.platform in ('cygwin', 'win32'): + home_vars.append('USERPROFILE') + home = None + home_dot_gyp = None + for home_var in home_vars: + home = os.getenv(home_var) + if home != None: + home_dot_gyp = os.path.join(home, '.gyp') + if not os.path.exists(home_dot_gyp): + home_dot_gyp = None + else: + break + + # TODO(thomasvl): add support for ~/.gyp/defaults + + options, build_files_arg = parser.parse_args(args) + build_files = build_files_arg + + if not options.formats: + # If no format was given on the command line, then check the env variable. + generate_formats = [] + if options.use_environment: + generate_formats = os.environ.get('GYP_GENERATORS', []) + if generate_formats: + generate_formats = re.split('[\s,]', generate_formats) + if generate_formats: + options.formats = generate_formats + else: + # Nothing in the variable, default based on platform. + if sys.platform == 'darwin': + options.formats = ['xcode'] + elif sys.platform in ('win32', 'cygwin'): + options.formats = ['msvs'] + else: + options.formats = ['make'] + + if not options.generator_output and options.use_environment: + g_o = os.environ.get('GYP_GENERATOR_OUTPUT') + if g_o: + options.generator_output = g_o + + for mode in options.debug: + gyp.debug[mode] = 1 + + # Do an extra check to avoid work when we're not debugging. + if DEBUG_GENERAL in gyp.debug.keys(): + DebugOutput(DEBUG_GENERAL, 'running with these options:') + for option, value in sorted(options.__dict__.items()): + if option[0] == '_': + continue + if isinstance(value, basestring): + DebugOutput(DEBUG_GENERAL, " %s: '%s'" % (option, value)) + else: + DebugOutput(DEBUG_GENERAL, " %s: %s" % (option, str(value))) + + if not build_files: + build_files = FindBuildFiles() + if not build_files: + print >>sys.stderr, (usage + '\n\n%s: error: no build_file') % \ + (my_name, my_name) + return 1 + + # TODO(mark): Chromium-specific hack! + # For Chromium, the gyp "depth" variable should always be a relative path + # to Chromium's top-level "src" directory. If no depth variable was set + # on the command line, try to find a "src" directory by looking at the + # absolute path to each build file's directory. The first "src" component + # found will be treated as though it were the path used for --depth. + if not options.depth: + for build_file in build_files: + build_file_dir = os.path.abspath(os.path.dirname(build_file)) + build_file_dir_components = build_file_dir.split(os.path.sep) + components_len = len(build_file_dir_components) + for index in xrange(components_len - 1, -1, -1): + if build_file_dir_components[index] == 'src': + options.depth = os.path.sep.join(build_file_dir_components) + break + del build_file_dir_components[index] + + # If the inner loop found something, break without advancing to another + # build file. + if options.depth: + break + + if not options.depth: + raise Exception, \ + 'Could not automatically locate src directory. This is a ' + \ + 'temporary Chromium feature that will be removed. Use ' + \ + '--depth as a workaround.' + + # If toplevel-dir is not set, we assume that depth is the root of our source + # tree. + if not options.toplevel_dir: + options.toplevel_dir = options.depth + + # -D on the command line sets variable defaults - D isn't just for define, + # it's for default. Perhaps there should be a way to force (-F?) a + # variable's value so that it can't be overridden by anything else. + cmdline_default_variables = {} + defines = [] + if options.use_environment: + defines += ShlexEnv('GYP_DEFINES') + if options.defines: + defines += options.defines + cmdline_default_variables = NameValueListToDict(defines) + if DEBUG_GENERAL in gyp.debug.keys(): + DebugOutput(DEBUG_GENERAL, + "cmdline_default_variables: %s" % cmdline_default_variables) + + # Set up includes. + includes = [] + + # If ~/.gyp/include.gypi exists, it'll be forcibly included into every + # .gyp file that's loaded, before anything else is included. + if home_dot_gyp != None: + default_include = os.path.join(home_dot_gyp, 'include.gypi') + if os.path.exists(default_include): + print 'Using overrides found in ' + default_include + includes.append(default_include) + + # Command-line --include files come after the default include. + if options.includes: + includes.extend(options.includes) + + # Generator flags should be prefixed with the target generator since they + # are global across all generator runs. + gen_flags = [] + if options.use_environment: + gen_flags += ShlexEnv('GYP_GENERATOR_FLAGS') + if options.generator_flags: + gen_flags += options.generator_flags + generator_flags = NameValueListToDict(gen_flags) + if DEBUG_GENERAL in gyp.debug.keys(): + DebugOutput(DEBUG_GENERAL, "generator_flags: %s" % generator_flags) + + # TODO: Remove this and the option after we've gotten folks to move to the + # generator flag. + if options.msvs_version: + print >>sys.stderr, \ + 'DEPRECATED: Use generator flag (-G msvs_version=' + \ + options.msvs_version + ') instead of --msvs-version=' + \ + options.msvs_version + generator_flags['msvs_version'] = options.msvs_version + + # Generate all requested formats (use a set in case we got one format request + # twice) + for format in set(options.formats): + params = {'options': options, + 'build_files': build_files, + 'generator_flags': generator_flags, + 'cwd': os.getcwd(), + 'build_files_arg': build_files_arg, + 'gyp_binary': sys.argv[0], + 'home_dot_gyp': home_dot_gyp} + + # Start with the default variables from the command line. + [generator, flat_list, targets, data] = Load(build_files, format, + cmdline_default_variables, + includes, options.depth, + params, options.check, + options.circular_check) + + # TODO(mark): Pass |data| for now because the generator needs a list of + # build files that came in. In the future, maybe it should just accept + # a list, and not the whole data dict. + # NOTE: flat_list is the flattened dependency graph specifying the order + # that targets may be built. Build systems that operate serially or that + # need to have dependencies defined before dependents reference them should + # generate targets in the order specified in flat_list. + generator.GenerateOutput(flat_list, targets, data, params) + + # Done + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/tools/gyp/pylib/gyp/common.py b/tools/gyp/pylib/gyp/common.py new file mode 100644 index 000000000..5b06a9746 --- /dev/null +++ b/tools/gyp/pylib/gyp/common.py @@ -0,0 +1,452 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from __future__ import with_statement + +import errno +import filecmp +import os.path +import re +import tempfile +import sys + + +# A minimal memoizing decorator. It'll blow up if the args aren't immutable, +# among other "problems". +class memoize(object): + def __init__(self, func): + self.func = func + self.cache = {} + def __call__(self, *args): + try: + return self.cache[args] + except KeyError: + result = self.func(*args) + self.cache[args] = result + return result + + +def ExceptionAppend(e, msg): + """Append a message to the given exception's message.""" + if not e.args: + e.args = (msg,) + elif len(e.args) == 1: + e.args = (str(e.args[0]) + ' ' + msg,) + else: + e.args = (str(e.args[0]) + ' ' + msg,) + e.args[1:] + + +def ParseQualifiedTarget(target): + # Splits a qualified target into a build file, target name and toolset. + + # NOTE: rsplit is used to disambiguate the Windows drive letter separator. + target_split = target.rsplit(':', 1) + if len(target_split) == 2: + [build_file, target] = target_split + else: + build_file = None + + target_split = target.rsplit('#', 1) + if len(target_split) == 2: + [target, toolset] = target_split + else: + toolset = None + + return [build_file, target, toolset] + + +def ResolveTarget(build_file, target, toolset): + # This function resolves a target into a canonical form: + # - a fully defined build file, either absolute or relative to the current + # directory + # - a target name + # - a toolset + # + # build_file is the file relative to which 'target' is defined. + # target is the qualified target. + # toolset is the default toolset for that target. + [parsed_build_file, target, parsed_toolset] = ParseQualifiedTarget(target) + + if parsed_build_file: + if build_file: + # If a relative path, parsed_build_file is relative to the directory + # containing build_file. If build_file is not in the current directory, + # parsed_build_file is not a usable path as-is. Resolve it by + # interpreting it as relative to build_file. If parsed_build_file is + # absolute, it is usable as a path regardless of the current directory, + # and os.path.join will return it as-is. + build_file = os.path.normpath(os.path.join(os.path.dirname(build_file), + parsed_build_file)) + # Further (to handle cases like ../cwd), make it relative to cwd) + if not os.path.isabs(build_file): + build_file = RelativePath(build_file, '.') + else: + build_file = parsed_build_file + + if parsed_toolset: + toolset = parsed_toolset + + return [build_file, target, toolset] + + +def BuildFile(fully_qualified_target): + # Extracts the build file from the fully qualified target. + return ParseQualifiedTarget(fully_qualified_target)[0] + + +def QualifiedTarget(build_file, target, toolset): + # "Qualified" means the file that a target was defined in and the target + # name, separated by a colon, suffixed by a # and the toolset name: + # /path/to/file.gyp:target_name#toolset + fully_qualified = build_file + ':' + target + if toolset: + fully_qualified = fully_qualified + '#' + toolset + return fully_qualified + + +@memoize +def RelativePath(path, relative_to): + # Assuming both |path| and |relative_to| are relative to the current + # directory, returns a relative path that identifies path relative to + # relative_to. + + # Convert to absolute (and therefore normalized paths). + path = os.path.abspath(path) + relative_to = os.path.abspath(relative_to) + + # Split the paths into components. + path_split = path.split(os.path.sep) + relative_to_split = relative_to.split(os.path.sep) + + # Determine how much of the prefix the two paths share. + prefix_len = len(os.path.commonprefix([path_split, relative_to_split])) + + # Put enough ".." components to back up out of relative_to to the common + # prefix, and then append the part of path_split after the common prefix. + relative_split = [os.path.pardir] * (len(relative_to_split) - prefix_len) + \ + path_split[prefix_len:] + + if len(relative_split) == 0: + # The paths were the same. + return '' + + # Turn it back into a string and we're done. + return os.path.join(*relative_split) + + +def FixIfRelativePath(path, relative_to): + # Like RelativePath but returns |path| unchanged if it is absolute. + if os.path.isabs(path): + return path + return RelativePath(path, relative_to) + + +def UnrelativePath(path, relative_to): + # Assuming that |relative_to| is relative to the current directory, and |path| + # is a path relative to the dirname of |relative_to|, returns a path that + # identifies |path| relative to the current directory. + rel_dir = os.path.dirname(relative_to) + return os.path.normpath(os.path.join(rel_dir, path)) + + +# re objects used by EncodePOSIXShellArgument. See IEEE 1003.1 XCU.2.2 at +# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_02 +# and the documentation for various shells. + +# _quote is a pattern that should match any argument that needs to be quoted +# with double-quotes by EncodePOSIXShellArgument. It matches the following +# characters appearing anywhere in an argument: +# \t, \n, space parameter separators +# # comments +# $ expansions (quoted to always expand within one argument) +# % called out by IEEE 1003.1 XCU.2.2 +# & job control +# ' quoting +# (, ) subshell execution +# *, ?, [ pathname expansion +# ; command delimiter +# <, >, | redirection +# = assignment +# {, } brace expansion (bash) +# ~ tilde expansion +# It also matches the empty string, because "" (or '') is the only way to +# represent an empty string literal argument to a POSIX shell. +# +# This does not match the characters in _escape, because those need to be +# backslash-escaped regardless of whether they appear in a double-quoted +# string. +_quote = re.compile('[\t\n #$%&\'()*;<=>?[{|}~]|^$') + +# _escape is a pattern that should match any character that needs to be +# escaped with a backslash, whether or not the argument matched the _quote +# pattern. _escape is used with re.sub to backslash anything in _escape's +# first match group, hence the (parentheses) in the regular expression. +# +# _escape matches the following characters appearing anywhere in an argument: +# " to prevent POSIX shells from interpreting this character for quoting +# \ to prevent POSIX shells from interpreting this character for escaping +# ` to prevent POSIX shells from interpreting this character for command +# substitution +# Missing from this list is $, because the desired behavior of +# EncodePOSIXShellArgument is to permit parameter (variable) expansion. +# +# Also missing from this list is !, which bash will interpret as the history +# expansion character when history is enabled. bash does not enable history +# by default in non-interactive shells, so this is not thought to be a problem. +# ! was omitted from this list because bash interprets "\!" as a literal string +# including the backslash character (avoiding history expansion but retaining +# the backslash), which would not be correct for argument encoding. Handling +# this case properly would also be problematic because bash allows the history +# character to be changed with the histchars shell variable. Fortunately, +# as history is not enabled in non-interactive shells and +# EncodePOSIXShellArgument is only expected to encode for non-interactive +# shells, there is no room for error here by ignoring !. +_escape = re.compile(r'(["\\`])') + +def EncodePOSIXShellArgument(argument): + """Encodes |argument| suitably for consumption by POSIX shells. + + argument may be quoted and escaped as necessary to ensure that POSIX shells + treat the returned value as a literal representing the argument passed to + this function. Parameter (variable) expansions beginning with $ are allowed + to remain intact without escaping the $, to allow the argument to contain + references to variables to be expanded by the shell. + """ + + if not isinstance(argument, str): + argument = str(argument) + + if _quote.search(argument): + quote = '"' + else: + quote = '' + + encoded = quote + re.sub(_escape, r'\\\1', argument) + quote + + return encoded + + +def EncodePOSIXShellList(list): + """Encodes |list| suitably for consumption by POSIX shells. + + Returns EncodePOSIXShellArgument for each item in list, and joins them + together using the space character as an argument separator. + """ + + encoded_arguments = [] + for argument in list: + encoded_arguments.append(EncodePOSIXShellArgument(argument)) + return ' '.join(encoded_arguments) + + +def DeepDependencyTargets(target_dicts, roots): + """Returns the recursive list of target dependencies.""" + dependencies = set() + pending = set(roots) + while pending: + # Pluck out one. + r = pending.pop() + # Skip if visited already. + if r in dependencies: + continue + # Add it. + dependencies.add(r) + # Add its children. + spec = target_dicts[r] + pending.update(set(spec.get('dependencies', []))) + pending.update(set(spec.get('dependencies_original', []))) + return list(dependencies - set(roots)) + + +def BuildFileTargets(target_list, build_file): + """From a target_list, returns the subset from the specified build_file. + """ + return [p for p in target_list if BuildFile(p) == build_file] + + +def AllTargets(target_list, target_dicts, build_file): + """Returns all targets (direct and dependencies) for the specified build_file. + """ + bftargets = BuildFileTargets(target_list, build_file) + deptargets = DeepDependencyTargets(target_dicts, bftargets) + return bftargets + deptargets + + +def WriteOnDiff(filename): + """Write to a file only if the new contents differ. + + Arguments: + filename: name of the file to potentially write to. + Returns: + A file like object which will write to temporary file and only overwrite + the target if it differs (on close). + """ + + class Writer: + """Wrapper around file which only covers the target if it differs.""" + def __init__(self): + # Pick temporary file. + tmp_fd, self.tmp_path = tempfile.mkstemp( + suffix='.tmp', + prefix=os.path.split(filename)[1] + '.gyp.', + dir=os.path.split(filename)[0]) + try: + self.tmp_file = os.fdopen(tmp_fd, 'wb') + except Exception: + # Don't leave turds behind. + os.unlink(self.tmp_path) + raise + + def __getattr__(self, attrname): + # Delegate everything else to self.tmp_file + return getattr(self.tmp_file, attrname) + + def close(self): + try: + # Close tmp file. + self.tmp_file.close() + # Determine if different. + same = False + try: + same = filecmp.cmp(self.tmp_path, filename, False) + except OSError, e: + if e.errno != errno.ENOENT: + raise + + if same: + # The new file is identical to the old one, just get rid of the new + # one. + os.unlink(self.tmp_path) + else: + # The new file is different from the old one, or there is no old one. + # Rename the new file to the permanent name. + # + # tempfile.mkstemp uses an overly restrictive mode, resulting in a + # file that can only be read by the owner, regardless of the umask. + # There's no reason to not respect the umask here, which means that + # an extra hoop is required to fetch it and reset the new file's mode. + # + # No way to get the umask without setting a new one? Set a safe one + # and then set it back to the old value. + umask = os.umask(077) + os.umask(umask) + os.chmod(self.tmp_path, 0666 & ~umask) + if sys.platform == 'win32' and os.path.exists(filename): + # NOTE: on windows (but not cygwin) rename will not replace an + # existing file, so it must be preceded with a remove. Sadly there + # is no way to make the switch atomic. + os.remove(filename) + os.rename(self.tmp_path, filename) + except Exception: + # Don't leave turds behind. + os.unlink(self.tmp_path) + raise + + return Writer() + + +def GetFlavor(params): + """Returns |params.flavor| if it's set, the system's default flavor else.""" + flavors = { + 'cygwin': 'win', + 'win32': 'win', + 'darwin': 'mac', + 'sunos5': 'solaris', + 'freebsd7': 'freebsd', + 'freebsd8': 'freebsd', + 'freebsd9': 'freebsd', + } + flavor = flavors.get(sys.platform, 'linux') + return params.get('flavor', flavor) + + +def CopyTool(flavor, out_path): + """Finds (mac|sun|win)_tool.gyp in the gyp directory and copies it + to |out_path|.""" + prefix = { 'solaris': 'sun', 'mac': 'mac', 'win': 'win' }.get(flavor, None) + if not prefix: + return + + # Slurp input file. + source_path = os.path.join( + os.path.dirname(os.path.abspath(__file__)), '%s_tool.py' % prefix) + with open(source_path) as source_file: + source = source_file.readlines() + + # Add header and write it out. + tool_path = os.path.join(out_path, 'gyp-%s-tool' % prefix) + with open(tool_path, 'w') as tool_file: + tool_file.write( + ''.join([source[0], '# Generated by gyp. Do not edit.\n'] + source[1:])) + + # Make file executable. + os.chmod(tool_path, 0755) + + +# From Alex Martelli, +# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560 +# ASPN: Python Cookbook: Remove duplicates from a sequence +# First comment, dated 2001/10/13. +# (Also in the printed Python Cookbook.) + +def uniquer(seq, idfun=None): + if idfun is None: + idfun = lambda x: x + seen = {} + result = [] + for item in seq: + marker = idfun(item) + if marker in seen: continue + seen[marker] = 1 + result.append(item) + return result + + +class CycleError(Exception): + """An exception raised when an unexpected cycle is detected.""" + def __init__(self, nodes): + self.nodes = nodes + def __str__(self): + return 'CycleError: cycle involving: ' + str(self.nodes) + + +def TopologicallySorted(graph, get_edges): + """Topologically sort based on a user provided edge definition. + + Args: + graph: A list of node names. + get_edges: A function mapping from node name to a hashable collection + of node names which this node has outgoing edges to. + Returns: + A list containing all of the node in graph in topological order. + It is assumed that calling get_edges once for each node and caching is + cheaper than repeatedly calling get_edges. + Raises: + CycleError in the event of a cycle. + Example: + graph = {'a': '$(b) $(c)', 'b': 'hi', 'c': '$(b)'} + def GetEdges(node): + return re.findall(r'\$\(([^))]\)', graph[node]) + print TopologicallySorted(graph.keys(), GetEdges) + ==> + ['a', 'c', b'] + """ + get_edges = memoize(get_edges) + visited = set() + visiting = set() + ordered_nodes = [] + def Visit(node): + if node in visiting: + raise CycleError(visiting) + if node in visited: + return + visited.add(node) + visiting.add(node) + for neighbor in get_edges(node): + Visit(neighbor) + visiting.remove(node) + ordered_nodes.insert(0, node) + for node in sorted(graph): + Visit(node) + return ordered_nodes diff --git a/tools/gyp/pylib/gyp/common_test.py b/tools/gyp/pylib/gyp/common_test.py new file mode 100755 index 000000000..aabaf344b --- /dev/null +++ b/tools/gyp/pylib/gyp/common_test.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Unit tests for the common.py file.""" + +import gyp.common +import unittest + + +class TestTopologicallySorted(unittest.TestCase): + def test_Valid(self): + """Test that sorting works on a valid graph with one possible order.""" + graph = { + 'a': ['b', 'c'], + 'b': [], + 'c': ['d'], + 'd': ['b'], + } + def GetEdge(node): + return tuple(graph[node]) + self.assertEqual( + gyp.common.TopologicallySorted(graph.keys(), GetEdge), + ['a', 'c', 'd', 'b']) + + def test_Cycle(self): + """Test that an exception is thrown on a cyclic graph.""" + graph = { + 'a': ['b'], + 'b': ['c'], + 'c': ['d'], + 'd': ['a'], + } + def GetEdge(node): + return tuple(graph[node]) + self.assertRaises( + gyp.common.CycleError, gyp.common.TopologicallySorted, + graph.keys(), GetEdge) + + +if __name__ == '__main__': + unittest.main() diff --git a/tools/gyp/pylib/gyp/easy_xml.py b/tools/gyp/pylib/gyp/easy_xml.py new file mode 100644 index 000000000..db54aadbe --- /dev/null +++ b/tools/gyp/pylib/gyp/easy_xml.py @@ -0,0 +1,148 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import re + + +def XmlToString(content, encoding='utf-8', pretty=False): + """ Writes the XML content to disk, touching the file only if it has changed. + + Visual Studio files have a lot of pre-defined structures. This function makes + it easy to represent these structures as Python data structures, instead of + having to create a lot of function calls. + + Each XML element of the content is represented as a list composed of: + 1. The name of the element, a string, + 2. The attributes of the element, a dictionary (optional), and + 3+. The content of the element, if any. Strings are simple text nodes and + lists are child elements. + + Example 1: + + becomes + ['test'] + + Example 2: + + This is + it! + + + becomes + ['myelement', {'a':'value1', 'b':'value2'}, + ['childtype', 'This is'], + ['childtype', 'it!'], + ] + + Args: + content: The structured content to be converted. + encoding: The encoding to report on the first XML line. + pretty: True if we want pretty printing with indents and new lines. + + Returns: + The XML content as a string. + """ + # We create a huge list of all the elements of the file. + xml_parts = ['' % encoding] + if pretty: + xml_parts.append('\n') + _ConstructContentList(xml_parts, content, pretty) + + # Convert it to a string + return ''.join(xml_parts) + + +def _ConstructContentList(xml_parts, specification, pretty, level=0): + """ Appends the XML parts corresponding to the specification. + + Args: + xml_parts: A list of XML parts to be appended to. + specification: The specification of the element. See EasyXml docs. + pretty: True if we want pretty printing with indents and new lines. + level: Indentation level. + """ + # The first item in a specification is the name of the element. + if pretty: + indentation = ' ' * level + new_line = '\n' + else: + indentation = '' + new_line = '' + name = specification[0] + if not isinstance(name, str): + raise Exception('The first item of an EasyXml specification should be ' + 'a string. Specification was ' + str(specification)) + xml_parts.append(indentation + '<' + name) + + # Optionally in second position is a dictionary of the attributes. + rest = specification[1:] + if rest and isinstance(rest[0], dict): + for at, val in sorted(rest[0].iteritems()): + xml_parts.append(' %s="%s"' % (at, _XmlEscape(val))) + rest = rest[1:] + if rest: + xml_parts.append('>') + all_strings = reduce(lambda x, y: x and isinstance(y, str), rest, True) + multi_line = not all_strings + if multi_line and new_line: + xml_parts.append(new_line) + for child_spec in rest: + # If it's a string, append a text node. + # Otherwise recurse over that child definition + if isinstance(child_spec, str): + xml_parts.append(_XmlEscape(child_spec)) + else: + _ConstructContentList(xml_parts, child_spec, pretty, level + 1) + if multi_line and indentation: + xml_parts.append(indentation) + xml_parts.append('%s' % (name, new_line)) + else: + xml_parts.append('/>%s' % new_line) + + +def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False): + """ Writes the XML content to disk, touching the file only if it has changed. + + Args: + content: The structured content to be written. + path: Location of the file. + encoding: The encoding to report on the first line of the XML file. + pretty: True if we want pretty printing with indents and new lines. + """ + xml_string = XmlToString(content, encoding, pretty) + + # Get the old content + try: + f = open(path, 'r') + existing = f.read() + f.close() + except: + existing = None + + # It has changed, write it + if existing != xml_string: + f = open(path, 'w') + f.write(xml_string) + f.close() + + +_xml_escape_map = { + '"': '"', + "'": ''', + '<': '<', + '>': '>', + '&': '&', + '\n': ' ', + '\r': ' ', +} + + +_xml_escape_re = re.compile( + "(%s)" % "|".join(map(re.escape, _xml_escape_map.keys()))) + + +def _XmlEscape(value): + """ Escape a string for inclusion in XML.""" + replace = lambda m: _xml_escape_map[m.string[m.start() : m.end()]] + return _xml_escape_re.sub(replace, value) diff --git a/tools/gyp/pylib/gyp/easy_xml_test.py b/tools/gyp/pylib/gyp/easy_xml_test.py new file mode 100755 index 000000000..a2aa4f20c --- /dev/null +++ b/tools/gyp/pylib/gyp/easy_xml_test.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Unit tests for the easy_xml.py file. """ + +import gyp.easy_xml as easy_xml +import unittest +import StringIO + + +class TestSequenceFunctions(unittest.TestCase): + + def setUp(self): + self.stderr = StringIO.StringIO() + + def test_EasyXml_simple(self): + self.assertEqual( + easy_xml.XmlToString(['test']), + '') + + self.assertEqual( + easy_xml.XmlToString(['test'], encoding='Windows-1252'), + '') + + def test_EasyXml_simple_with_attributes(self): + self.assertEqual( + easy_xml.XmlToString(['test2', {'a': 'value1', 'b': 'value2'}]), + '') + + def test_EasyXml_escaping(self): + original = '\'"\r&\nfoo' + converted = '<test>'" & foo' + self.assertEqual( + easy_xml.XmlToString(['test3', {'a': original}, original]), + '%s' % + (converted, converted)) + + def test_EasyXml_pretty(self): + self.assertEqual( + easy_xml.XmlToString( + ['test3', + ['GrandParent', + ['Parent1', + ['Child'] + ], + ['Parent2'] + ] + ], + pretty=True), + '\n' + '\n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + ' \n' + '\n') + + + def test_EasyXml_complex(self): + # We want to create: + target = ( + '' + '' + '' + '{D2250C20-3A94-4FB9-AF73-11BC5B73884B}' + 'Win32Proj' + 'automated_ui_tests' + '' + '' + '' + 'Application' + 'Unicode' + '' + '') + + xml = easy_xml.XmlToString( + ['Project', + ['PropertyGroup', {'Label': 'Globals'}, + ['ProjectGuid', '{D2250C20-3A94-4FB9-AF73-11BC5B73884B}'], + ['Keyword', 'Win32Proj'], + ['RootNamespace', 'automated_ui_tests'] + ], + ['Import', {'Project': '$(VCTargetsPath)\\Microsoft.Cpp.props'}], + ['PropertyGroup', + {'Condition': "'$(Configuration)|$(Platform)'=='Debug|Win32'", + 'Label': 'Configuration'}, + ['ConfigurationType', 'Application'], + ['CharacterSet', 'Unicode'] + ] + ]) + self.assertEqual(xml, target) + + +if __name__ == '__main__': + unittest.main() diff --git a/spec/fixtures/nested/nested2/.gitkeep b/tools/gyp/pylib/gyp/generator/__init__.py similarity index 100% rename from spec/fixtures/nested/nested2/.gitkeep rename to tools/gyp/pylib/gyp/generator/__init__.py diff --git a/tools/gyp/pylib/gyp/generator/dump_dependency_json.py b/tools/gyp/pylib/gyp/generator/dump_dependency_json.py new file mode 100644 index 000000000..acee72ebb --- /dev/null +++ b/tools/gyp/pylib/gyp/generator/dump_dependency_json.py @@ -0,0 +1,66 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import collections +import gyp +import gyp.common +import json +import sys + +generator_supports_multiple_toolsets = True + +generator_wants_static_library_dependencies_adjusted = False + +generator_default_variables = { +} +for dirname in ['INTERMEDIATE_DIR', 'SHARED_INTERMEDIATE_DIR', 'PRODUCT_DIR', + 'LIB_DIR', 'SHARED_LIB_DIR']: + # Some gyp steps fail if these are empty(!). + generator_default_variables[dirname] = 'dir' +for unused in ['RULE_INPUT_PATH', 'RULE_INPUT_ROOT', 'RULE_INPUT_NAME', + 'RULE_INPUT_DIRNAME', 'RULE_INPUT_EXT', + 'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX', + 'STATIC_LIB_PREFIX', 'STATIC_LIB_SUFFIX', + 'SHARED_LIB_PREFIX', 'SHARED_LIB_SUFFIX']: + generator_default_variables[unused] = '' + + +def CalculateVariables(default_variables, params): + generator_flags = params.get('generator_flags', {}) + for key, val in generator_flags.items(): + default_variables.setdefault(key, val) + default_variables.setdefault('OS', gyp.common.GetFlavor(params)) + + +def CalculateGeneratorInputInfo(params): + """Calculate the generator specific info that gets fed to input (called by + gyp).""" + generator_flags = params.get('generator_flags', {}) + if generator_flags.get('adjust_static_libraries', False): + global generator_wants_static_library_dependencies_adjusted + generator_wants_static_library_dependencies_adjusted = True + + +def GenerateOutput(target_list, target_dicts, data, params): + # Map of target -> list of targets it depends on. + edges = {} + + # Queue of targets to visit. + targets_to_visit = target_list[:] + + while len(targets_to_visit) > 0: + target = targets_to_visit.pop() + if target in edges: + continue + edges[target] = [] + + for dep in target_dicts[target].get('dependencies', []): + edges[target].append(dep) + targets_to_visit.append(dep) + + filename = 'dump.json' + f = open(filename, 'w') + json.dump(edges, f) + f.close() + print 'Wrote json to %s.' % filename diff --git a/tools/gyp/pylib/gyp/generator/eclipse.py b/tools/gyp/pylib/gyp/generator/eclipse.py new file mode 100644 index 000000000..5e16c0273 --- /dev/null +++ b/tools/gyp/pylib/gyp/generator/eclipse.py @@ -0,0 +1,271 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""GYP backend that generates Eclipse CDT settings files. + +This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML +files that can be imported into an Eclipse CDT project. The XML file contains a +list of include paths and symbols (i.e. defines). + +Because a full .cproject definition is not created by this generator, it's not +possible to properly define the include dirs and symbols for each file +individually. Instead, one set of includes/symbols is generated for the entire +project. This works fairly well (and is a vast improvement in general), but may +still result in a few indexer issues here and there. + +This generator has no automated tests, so expect it to be broken. +""" + +import os.path +import subprocess +import gyp +import gyp.common +import shlex + +generator_wants_static_library_dependencies_adjusted = False + +generator_default_variables = { +} + +for dirname in ['INTERMEDIATE_DIR', 'PRODUCT_DIR', 'LIB_DIR', 'SHARED_LIB_DIR']: + # Some gyp steps fail if these are empty(!). + generator_default_variables[dirname] = 'dir' + +for unused in ['RULE_INPUT_PATH', 'RULE_INPUT_ROOT', 'RULE_INPUT_NAME', + 'RULE_INPUT_DIRNAME', 'RULE_INPUT_EXT', + 'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX', + 'STATIC_LIB_PREFIX', 'STATIC_LIB_SUFFIX', + 'SHARED_LIB_PREFIX', 'SHARED_LIB_SUFFIX']: + generator_default_variables[unused] = '' + +# Include dirs will occasionaly use the SHARED_INTERMEDIATE_DIR variable as +# part of the path when dealing with generated headers. This value will be +# replaced dynamically for each configuration. +generator_default_variables['SHARED_INTERMEDIATE_DIR'] = \ + '$SHARED_INTERMEDIATES_DIR' + + +def CalculateVariables(default_variables, params): + generator_flags = params.get('generator_flags', {}) + for key, val in generator_flags.items(): + default_variables.setdefault(key, val) + default_variables.setdefault('OS', gyp.common.GetFlavor(params)) + + +def CalculateGeneratorInputInfo(params): + """Calculate the generator specific info that gets fed to input (called by + gyp).""" + generator_flags = params.get('generator_flags', {}) + if generator_flags.get('adjust_static_libraries', False): + global generator_wants_static_library_dependencies_adjusted + generator_wants_static_library_dependencies_adjusted = True + + +def GetAllIncludeDirectories(target_list, target_dicts, + shared_intermediates_dir, config_name): + """Calculate the set of include directories to be used. + + Returns: + A list including all the include_dir's specified for every target followed + by any include directories that were added as cflag compiler options. + """ + + gyp_includes_set = set() + compiler_includes_list = [] + + for target_name in target_list: + target = target_dicts[target_name] + if config_name in target['configurations']: + config = target['configurations'][config_name] + + # Look for any include dirs that were explicitly added via cflags. This + # may be done in gyp files to force certain includes to come at the end. + # TODO(jgreenwald): Change the gyp files to not abuse cflags for this, and + # remove this. + cflags = config['cflags'] + for cflag in cflags: + include_dir = '' + if cflag.startswith('-I'): + include_dir = cflag[2:] + if include_dir and not include_dir in compiler_includes_list: + compiler_includes_list.append(include_dir) + + # Find standard gyp include dirs. + if config.has_key('include_dirs'): + include_dirs = config['include_dirs'] + for include_dir in include_dirs: + include_dir = include_dir.replace('$SHARED_INTERMEDIATES_DIR', + shared_intermediates_dir) + if not os.path.isabs(include_dir): + base_dir = os.path.dirname(target_name) + + include_dir = base_dir + '/' + include_dir + include_dir = os.path.abspath(include_dir) + + if not include_dir in gyp_includes_set: + gyp_includes_set.add(include_dir) + + + # Generate a list that has all the include dirs. + all_includes_list = list(gyp_includes_set) + all_includes_list.sort() + for compiler_include in compiler_includes_list: + if not compiler_include in gyp_includes_set: + all_includes_list.append(compiler_include) + + # All done. + return all_includes_list + + +def GetCompilerPath(target_list, target_dicts, data): + """Determine a command that can be used to invoke the compiler. + + Returns: + If this is a gyp project that has explicit make settings, try to determine + the compiler from that. Otherwise, see if a compiler was specified via the + CC_target environment variable. + """ + + # First, see if the compiler is configured in make's settings. + build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) + make_global_settings_dict = data[build_file].get('make_global_settings', {}) + for key, value in make_global_settings_dict: + if key in ['CC', 'CXX']: + return value + + # Check to see if the compiler was specified as an environment variable. + for key in ['CC_target', 'CC', 'CXX']: + compiler = os.environ.get(key) + if compiler: + return compiler + + return 'gcc' + + +def GetAllDefines(target_list, target_dicts, data, config_name): + """Calculate the defines for a project. + + Returns: + A dict that includes explict defines declared in gyp files along with all of + the default defines that the compiler uses. + """ + + # Get defines declared in the gyp files. + all_defines = {} + for target_name in target_list: + target = target_dicts[target_name] + + if config_name in target['configurations']: + config = target['configurations'][config_name] + for define in config['defines']: + split_define = define.split('=', 1) + if len(split_define) == 1: + split_define.append('1') + if split_define[0].strip() in all_defines: + # Already defined + continue + + all_defines[split_define[0].strip()] = split_define[1].strip() + + # Get default compiler defines (if possible). + cc_target = GetCompilerPath(target_list, target_dicts, data) + if cc_target: + command = shlex.split(cc_target) + command.extend(['-E', '-dM', '-']) + cpp_proc = subprocess.Popen(args=command, cwd='.', + stdin=subprocess.PIPE, stdout=subprocess.PIPE) + cpp_output = cpp_proc.communicate()[0] + cpp_lines = cpp_output.split('\n') + for cpp_line in cpp_lines: + if not cpp_line.strip(): + continue + cpp_line_parts = cpp_line.split(' ', 2) + key = cpp_line_parts[1] + if len(cpp_line_parts) >= 3: + val = cpp_line_parts[2] + else: + val = '1' + all_defines[key] = val + + return all_defines + + +def WriteIncludePaths(out, eclipse_langs, include_dirs): + """Write the includes section of a CDT settings export file.""" + + out.write('
    \n') + out.write(' \n') + for lang in eclipse_langs: + out.write(' \n' % lang) + for include_dir in include_dirs: + out.write(' %s\n' % + include_dir) + out.write(' \n') + out.write('
    \n') + + +def WriteMacros(out, eclipse_langs, defines): + """Write the macros section of a CDT settings export file.""" + + out.write('
    \n') + out.write(' \n') + for lang in eclipse_langs: + out.write(' \n' % lang) + for key in sorted(defines.iterkeys()): + out.write(' %s%s\n' % + (key, defines[key])) + out.write(' \n') + out.write('
    \n') + + +def GenerateOutputForConfig(target_list, target_dicts, data, params, + config_name): + options = params['options'] + generator_flags = params.get('generator_flags', {}) + + # build_dir: relative path from source root to our output files. + # e.g. "out/Debug" + build_dir = os.path.join(generator_flags.get('output_dir', 'out'), + config_name) + + toplevel_build = os.path.join(options.toplevel_dir, build_dir) + shared_intermediate_dir = os.path.join(toplevel_build, 'obj', 'gen') + + if not os.path.exists(toplevel_build): + os.makedirs(toplevel_build) + out = open(os.path.join(toplevel_build, 'eclipse-cdt-settings.xml'), 'w') + + out.write('\n') + out.write('\n') + + eclipse_langs = ['C++ Source File', 'C Source File', 'Assembly Source File', + 'GNU C++', 'GNU C', 'Assembly'] + include_dirs = GetAllIncludeDirectories(target_list, target_dicts, + shared_intermediate_dir, config_name) + WriteIncludePaths(out, eclipse_langs, include_dirs) + defines = GetAllDefines(target_list, target_dicts, data, config_name) + WriteMacros(out, eclipse_langs, defines) + + out.write('\n') + out.close() + + +def GenerateOutput(target_list, target_dicts, data, params): + """Generate an XML settings file that can be imported into a CDT project.""" + + if params['options'].generator_output: + raise NotImplementedError, "--generator_output not implemented for eclipse" + + user_config = params.get('generator_flags', {}).get('config', None) + if user_config: + GenerateOutputForConfig(target_list, target_dicts, data, params, + user_config) + else: + config_names = target_dicts[target_list[0]]['configurations'].keys() + for config_name in config_names: + GenerateOutputForConfig(target_list, target_dicts, data, params, + config_name) + diff --git a/tools/gyp/pylib/gyp/generator/gypd.py b/tools/gyp/pylib/gyp/generator/gypd.py new file mode 100644 index 000000000..22ef57f84 --- /dev/null +++ b/tools/gyp/pylib/gyp/generator/gypd.py @@ -0,0 +1,87 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""gypd output module + +This module produces gyp input as its output. Output files are given the +.gypd extension to avoid overwriting the .gyp files that they are generated +from. Internal references to .gyp files (such as those found in +"dependencies" sections) are not adjusted to point to .gypd files instead; +unlike other paths, which are relative to the .gyp or .gypd file, such paths +are relative to the directory from which gyp was run to create the .gypd file. + +This generator module is intended to be a sample and a debugging aid, hence +the "d" for "debug" in .gypd. It is useful to inspect the results of the +various merges, expansions, and conditional evaluations performed by gyp +and to see a representation of what would be fed to a generator module. + +It's not advisable to rename .gypd files produced by this module to .gyp, +because they will have all merges, expansions, and evaluations already +performed and the relevant constructs not present in the output; paths to +dependencies may be wrong; and various sections that do not belong in .gyp +files such as such as "included_files" and "*_excluded" will be present. +Output will also be stripped of comments. This is not intended to be a +general-purpose gyp pretty-printer; for that, you probably just want to +run "pprint.pprint(eval(open('source.gyp').read()))", which will still strip +comments but won't do all of the other things done to this module's output. + +The specific formatting of the output generated by this module is subject +to change. +""" + + +import gyp.common +import errno +import os +import pprint + + +# These variables should just be spit back out as variable references. +_generator_identity_variables = [ + 'EXECUTABLE_PREFIX', + 'EXECUTABLE_SUFFIX', + 'INTERMEDIATE_DIR', + 'PRODUCT_DIR', + 'RULE_INPUT_ROOT', + 'RULE_INPUT_DIRNAME', + 'RULE_INPUT_EXT', + 'RULE_INPUT_NAME', + 'RULE_INPUT_PATH', + 'SHARED_INTERMEDIATE_DIR', +] + +# gypd doesn't define a default value for OS like many other generator +# modules. Specify "-D OS=whatever" on the command line to provide a value. +generator_default_variables = { +} + +# gypd supports multiple toolsets +generator_supports_multiple_toolsets = True + +# TODO(mark): This always uses <, which isn't right. The input module should +# notify the generator to tell it which phase it is operating in, and this +# module should use < for the early phase and then switch to > for the late +# phase. Bonus points for carrying @ back into the output too. +for v in _generator_identity_variables: + generator_default_variables[v] = '<(%s)' % v + + +def GenerateOutput(target_list, target_dicts, data, params): + output_files = {} + for qualified_target in target_list: + [input_file, target] = \ + gyp.common.ParseQualifiedTarget(qualified_target)[0:2] + + if input_file[-4:] != '.gyp': + continue + input_file_stem = input_file[:-4] + output_file = input_file_stem + params['options'].suffix + '.gypd' + + if not output_file in output_files: + output_files[output_file] = input_file + + for output_file, input_file in output_files.iteritems(): + output = open(output_file, 'w') + pprint.pprint(data[input_file], output) + output.close() diff --git a/tools/gyp/pylib/gyp/generator/gypsh.py b/tools/gyp/pylib/gyp/generator/gypsh.py new file mode 100644 index 000000000..bd405f43a --- /dev/null +++ b/tools/gyp/pylib/gyp/generator/gypsh.py @@ -0,0 +1,56 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""gypsh output module + +gypsh is a GYP shell. It's not really a generator per se. All it does is +fire up an interactive Python session with a few local variables set to the +variables passed to the generator. Like gypd, it's intended as a debugging +aid, to facilitate the exploration of .gyp structures after being processed +by the input module. + +The expected usage is "gyp -f gypsh -D OS=desired_os". +""" + + +import code +import sys + + +# All of this stuff about generator variables was lovingly ripped from gypd.py. +# That module has a much better description of what's going on and why. +_generator_identity_variables = [ + 'EXECUTABLE_PREFIX', + 'EXECUTABLE_SUFFIX', + 'INTERMEDIATE_DIR', + 'PRODUCT_DIR', + 'RULE_INPUT_ROOT', + 'RULE_INPUT_DIRNAME', + 'RULE_INPUT_EXT', + 'RULE_INPUT_NAME', + 'RULE_INPUT_PATH', + 'SHARED_INTERMEDIATE_DIR', +] + +generator_default_variables = { +} + +for v in _generator_identity_variables: + generator_default_variables[v] = '<(%s)' % v + + +def GenerateOutput(target_list, target_dicts, data, params): + locals = { + 'target_list': target_list, + 'target_dicts': target_dicts, + 'data': data, + } + + # Use a banner that looks like the stock Python one and like what + # code.interact uses by default, but tack on something to indicate what + # locals are available, and identify gypsh. + banner='Python %s on %s\nlocals.keys() = %s\ngypsh' % \ + (sys.version, sys.platform, repr(sorted(locals.keys()))) + + code.interact(banner, local=locals) diff --git a/tools/gyp/pylib/gyp/generator/make.py b/tools/gyp/pylib/gyp/generator/make.py new file mode 100644 index 000000000..32c4110e8 --- /dev/null +++ b/tools/gyp/pylib/gyp/generator/make.py @@ -0,0 +1,2133 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Notes: +# +# This is all roughly based on the Makefile system used by the Linux +# kernel, but is a non-recursive make -- we put the entire dependency +# graph in front of make and let it figure it out. +# +# The code below generates a separate .mk file for each target, but +# all are sourced by the top-level Makefile. This means that all +# variables in .mk-files clobber one another. Be careful to use := +# where appropriate for immediate evaluation, and similarly to watch +# that you're not relying on a variable value to last beween different +# .mk files. +# +# TODOs: +# +# Global settings and utility functions are currently stuffed in the +# toplevel Makefile. It may make sense to generate some .mk files on +# the side to keep the the files readable. + +import gyp +import gyp.common +import gyp.system_test +import gyp.xcode_emulation +import os +import re +import sys + +generator_default_variables = { + 'EXECUTABLE_PREFIX': '', + 'EXECUTABLE_SUFFIX': '', + 'STATIC_LIB_PREFIX': 'lib', + 'SHARED_LIB_PREFIX': 'lib', + 'STATIC_LIB_SUFFIX': '.a', + 'INTERMEDIATE_DIR': '$(obj).$(TOOLSET)/$(TARGET)/geni', + 'SHARED_INTERMEDIATE_DIR': '$(obj)/gen', + 'PRODUCT_DIR': '$(builddir)', + 'RULE_INPUT_ROOT': '%(INPUT_ROOT)s', # This gets expanded by Python. + 'RULE_INPUT_DIRNAME': '%(INPUT_DIRNAME)s', # This gets expanded by Python. + 'RULE_INPUT_PATH': '$(abspath $<)', + 'RULE_INPUT_EXT': '$(suffix $<)', + 'RULE_INPUT_NAME': '$(notdir $<)', + + # This appears unused --- ? + 'CONFIGURATION_NAME': '$(BUILDTYPE)', +} + +# Make supports multiple toolsets +generator_supports_multiple_toolsets = True + +# Request sorted dependencies in the order from dependents to dependencies. +generator_wants_sorted_dependencies = False + +# Placates pylint. +generator_additional_non_configuration_keys = [] +generator_additional_path_sections = [] +generator_extra_sources_for_rules = [] + + +def CalculateVariables(default_variables, params): + """Calculate additional variables for use in the build (called by gyp).""" + cc_target = os.environ.get('CC.target', os.environ.get('CC', 'cc')) + flavor = gyp.common.GetFlavor(params) + if flavor == 'mac': + default_variables.setdefault('OS', 'mac') + default_variables.setdefault('SHARED_LIB_SUFFIX', '.dylib') + default_variables.setdefault('SHARED_LIB_DIR', + generator_default_variables['PRODUCT_DIR']) + default_variables.setdefault('LIB_DIR', + generator_default_variables['PRODUCT_DIR']) + + # Copy additional generator configuration data from Xcode, which is shared + # by the Mac Make generator. + import gyp.generator.xcode as xcode_generator + global generator_additional_non_configuration_keys + generator_additional_non_configuration_keys = getattr(xcode_generator, + 'generator_additional_non_configuration_keys', []) + global generator_additional_path_sections + generator_additional_path_sections = getattr(xcode_generator, + 'generator_additional_path_sections', []) + global generator_extra_sources_for_rules + generator_extra_sources_for_rules = getattr(xcode_generator, + 'generator_extra_sources_for_rules', []) + COMPILABLE_EXTENSIONS.update({'.m': 'objc', '.mm' : 'objcxx'}) + else: + operating_system = flavor + if flavor == 'android': + operating_system = 'linux' # Keep this legacy behavior for now. + default_variables.setdefault('OS', operating_system) + default_variables.setdefault('SHARED_LIB_SUFFIX', '.so') + default_variables.setdefault('SHARED_LIB_DIR','$(builddir)/lib.$(TOOLSET)') + default_variables.setdefault('LIB_DIR', '$(obj).$(TOOLSET)') + + +def CalculateGeneratorInputInfo(params): + """Calculate the generator specific info that gets fed to input (called by + gyp).""" + generator_flags = params.get('generator_flags', {}) + android_ndk_version = generator_flags.get('android_ndk_version', None) + # Android NDK requires a strict link order. + if android_ndk_version: + global generator_wants_sorted_dependencies + generator_wants_sorted_dependencies = True + + +def ensure_directory_exists(path): + dir = os.path.dirname(path) + if dir and not os.path.exists(dir): + os.makedirs(dir) + + +# The .d checking code below uses these functions: +# wildcard, sort, foreach, shell, wordlist +# wildcard can handle spaces, the rest can't. +# Since I could find no way to make foreach work with spaces in filenames +# correctly, the .d files have spaces replaced with another character. The .d +# file for +# Chromium\ Framework.framework/foo +# is for example +# out/Release/.deps/out/Release/Chromium?Framework.framework/foo +# This is the replacement character. +SPACE_REPLACEMENT = '?' + + +LINK_COMMANDS_LINUX = """\ +quiet_cmd_alink = AR($(TOOLSET)) $@ +cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) $(ARFLAGS.$(TOOLSET)) $@ $(filter %.o,$^) + +# Due to circular dependencies between libraries :(, we wrap the +# special "figure out circular dependencies" flags around the entire +# input list during linking. +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) + +# We support two kinds of shared objects (.so): +# 1) shared_library, which is just bundling together many dependent libraries +# into a link line. +# 2) loadable_module, which is generating a module intended for dlopen(). +# +# They differ only slightly: +# In the former case, we want to package all dependent code into the .so. +# In the latter case, we want to package just the API exposed by the +# outermost module. +# This means shared_library uses --whole-archive, while loadable_module doesn't. +# (Note that --whole-archive is incompatible with the --start-group used in +# normal linking.) + +# Other shared-object link notes: +# - Set SONAME to the library filename so our binaries don't reference +# the local, absolute paths used on the link command-line. +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) +""" + +LINK_COMMANDS_MAC = """\ +quiet_cmd_alink = LIBTOOL-STATIC $@ +cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool -static -o $@ $(filter %.o,$^) + +quiet_cmd_link = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +# TODO(thakis): Find out and document the difference between shared_library and +# loadable_module on mac. +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) + +# TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass +# -bundle -single_module here (for osmesa.so). +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) +""" + +LINK_COMMANDS_ANDROID = """\ +quiet_cmd_alink = AR($(TOOLSET)) $@ +cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) $(ARFLAGS.$(TOOLSET)) $@ $(filter %.o,$^) + +# Due to circular dependencies between libraries :(, we wrap the +# special "figure out circular dependencies" flags around the entire +# input list during linking. +quiet_cmd_link = LINK($(TOOLSET)) $@ +quiet_cmd_link_host = LINK($(TOOLSET)) $@ +cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) +cmd_link_host = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) + +# Other shared-object link notes: +# - Set SONAME to the library filename so our binaries don't reference +# the local, absolute paths used on the link command-line. +quiet_cmd_solink = SOLINK($(TOOLSET)) $@ +cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) + +quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) +quiet_cmd_solink_module_host = SOLINK_MODULE($(TOOLSET)) $@ +cmd_solink_module_host = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) +""" + + +# Header of toplevel Makefile. +# This should go into the build tree, but it's easier to keep it here for now. +SHARED_HEADER = ("""\ +# We borrow heavily from the kernel build setup, though we are simpler since +# we don't have Kconfig tweaking settings on us. + +# The implicit make rules have it looking for RCS files, among other things. +# We instead explicitly write all the rules we care about. +# It's even quicker (saves ~200ms) to pass -r on the command line. +MAKEFLAGS=-r + +# The source directory tree. +srcdir := %(srcdir)s +abs_srcdir := $(abspath $(srcdir)) + +# The name of the builddir. +builddir_name ?= %(builddir)s + +# The V=1 flag on command line makes us verbosely print command lines. +ifdef V + quiet= +else + quiet=quiet_ +endif + +# Specify BUILDTYPE=Release on the command line for a release build. +BUILDTYPE ?= %(default_configuration)s + +# Directory all our build output goes into. +# Note that this must be two directories beneath src/ for unit tests to pass, +# as they reach into the src/ directory for data with relative paths. +builddir ?= $(builddir_name)/$(BUILDTYPE) +abs_builddir := $(abspath $(builddir)) +depsdir := $(builddir)/.deps + +# Object output directory. +obj := $(builddir)/obj +abs_obj := $(abspath $(obj)) + +# We build up a list of every single one of the targets so we can slurp in the +# generated dependency rule Makefiles in one pass. +all_deps := + +%(make_global_settings)s + +# C++ apps need to be linked with g++. +# +# Note: flock is used to seralize linking. Linking is a memory-intensive +# process so running parallel links can often lead to thrashing. To disable +# the serialization, override LINK via an envrionment variable as follows: +# +# export LINK=g++ +# +# This will allow make to invoke N linker processes as specified in -jN. +LINK ?= %(flock)s $(builddir)/linker.lock $(CXX) + +CC.target ?= $(CC) +CFLAGS.target ?= $(CFLAGS) +CXX.target ?= $(CXX) +CXXFLAGS.target ?= $(CXXFLAGS) +LINK.target ?= $(LINK) +LDFLAGS.target ?= $(LDFLAGS) +AR.target ?= $(AR) +ARFLAGS.target ?= %(ARFLAGS.target)s + +# N.B.: the logic of which commands to run should match the computation done +# in gyp's make.py where ARFLAGS.host etc. is computed. +# TODO(evan): move all cross-compilation logic to gyp-time so we don't need +# to replicate this environment fallback in make as well. +CC.host ?= gcc +CFLAGS.host ?= +CXX.host ?= g++ +CXXFLAGS.host ?= +LINK.host ?= g++ +LDFLAGS.host ?= +AR.host ?= ar +ARFLAGS.host := %(ARFLAGS.host)s + +# Define a dir function that can handle spaces. +# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions +# "leading spaces cannot appear in the text of the first argument as written. +# These characters can be put into the argument value by variable substitution." +empty := +space := $(empty) $(empty) + +# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces +replace_spaces = $(subst $(space),""" + SPACE_REPLACEMENT + """,$1) +unreplace_spaces = $(subst """ + SPACE_REPLACEMENT + """,$(space),$1) +dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1))) + +# Flags to make gcc output dependency info. Note that you need to be +# careful here to use the flags that ccache and distcc can understand. +# We write to a dep file on the side first and then rename at the end +# so we can't end up with a broken dep file. +depfile = $(depsdir)/$(call replace_spaces,$@).d +DEPFLAGS = -MMD -MF $(depfile).raw + +# We have to fixup the deps output in a few ways. +# (1) the file output should mention the proper .o file. +# ccache or distcc lose the path to the target, so we convert a rule of +# the form: +# foobar.o: DEP1 DEP2 +# into +# path/to/foobar.o: DEP1 DEP2 +# (2) we want missing files not to cause us to fail to build. +# We want to rewrite +# foobar.o: DEP1 DEP2 \\ +# DEP3 +# to +# DEP1: +# DEP2: +# DEP3: +# so if the files are missing, they're just considered phony rules. +# We have to do some pretty insane escaping to get those backslashes +# and dollar signs past make, the shell, and sed at the same time. +# Doesn't work with spaces, but that's fine: .d files have spaces in +# their names replaced with other characters.""" +r""" +define fixup_dep +# The depfile may not exist if the input file didn't have any #includes. +touch $(depfile).raw +# Fixup path as in (1). +sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile) +# Add extra rules as in (2). +# We remove slashes and replace spaces with new lines; +# remove blank lines; +# delete the first line and append a colon to the remaining lines. +sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ + grep -v '^$$' |\ + sed -e 1d -e 's|$$|:|' \ + >> $(depfile) +rm $(depfile).raw +endef +""" +""" +# Command definitions: +# - cmd_foo is the actual command to run; +# - quiet_cmd_foo is the brief-output summary of the command. + +quiet_cmd_cc = CC($(TOOLSET)) $@ +cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< + +quiet_cmd_cxx = CXX($(TOOLSET)) $@ +cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +%(extra_commands)s +quiet_cmd_touch = TOUCH $@ +cmd_touch = touch $@ + +quiet_cmd_copy = COPY $@ +# send stderr to /dev/null to ignore messages when linking directories. +cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@") + +%(link_commands)s +""" + +r""" +# Define an escape_quotes function to escape single quotes. +# This allows us to handle quotes properly as long as we always use +# use single quotes and escape_quotes. +escape_quotes = $(subst ','\'',$(1)) +# This comment is here just to include a ' to unconfuse syntax highlighting. +# Define an escape_vars function to escape '$' variable syntax. +# This allows us to read/write command lines with shell variables (e.g. +# $LD_LIBRARY_PATH), without triggering make substitution. +escape_vars = $(subst $$,$$$$,$(1)) +# Helper that expands to a shell command to echo a string exactly as it is in +# make. This uses printf instead of echo because printf's behaviour with respect +# to escape sequences is more portable than echo's across different shells +# (e.g., dash, bash). +exact_echo = printf '%%s\n' '$(call escape_quotes,$(1))' +""" +""" +# Helper to compare the command we're about to run against the command +# we logged the last time we ran the command. Produces an empty +# string (false) when the commands match. +# Tricky point: Make has no string-equality test function. +# The kernel uses the following, but it seems like it would have false +# positives, where one string reordered its arguments. +# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \\ +# $(filter-out $(cmd_$@), $(cmd_$(1)))) +# We instead substitute each for the empty string into the other, and +# say they're equal if both substitutions produce the empty string. +# .d files contain """ + SPACE_REPLACEMENT + \ + """ instead of spaces, take that into account. +command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\\ + $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) + +# Helper that is non-empty when a prerequisite changes. +# Normally make does this implicitly, but we force rules to always run +# so we can check their command lines. +# $? -- new prerequisites +# $| -- order-only dependencies +prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) + +# Helper that executes all postbuilds, and deletes the output file when done +# if any of the postbuilds failed. +define do_postbuilds + @E=0;\\ + for p in $(POSTBUILDS); do\\ + eval $$p;\\ + F=$$?;\\ + if [ $$F -ne 0 ]; then\\ + E=$$F;\\ + fi;\\ + done;\\ + if [ $$E -ne 0 ]; then\\ + rm -rf "$@";\\ + exit $$E;\\ + fi +endef + +# do_cmd: run a command via the above cmd_foo names, if necessary. +# Should always run for a given target to handle command-line changes. +# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. +# Third argument, if non-zero, makes it do POSTBUILDS processing. +# Note: We intentionally do NOT call dirx for depfile, since it contains """ + \ + SPACE_REPLACEMENT + """ for +# spaces already and dirx strips the """ + SPACE_REPLACEMENT + \ + """ characters. +define do_cmd +$(if $(or $(command_changed),$(prereq_changed)), + @$(call exact_echo, $($(quiet)cmd_$(1))) + @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" + $(if $(findstring flock,$(word %(flock_index)d,$(cmd_$1))), + @$(cmd_$(1)) + @echo " $(quiet_cmd_$(1)): Finished", + @$(cmd_$(1)) + ) + @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) + @$(if $(2),$(fixup_dep)) + $(if $(and $(3), $(POSTBUILDS)), + $(call do_postbuilds) + ) +) +endef + +# Declare the "%(default_target)s" target first so it is the default, +# even though we don't have the deps yet. +.PHONY: %(default_target)s +%(default_target)s: + +# make looks for ways to re-generate included makefiles, but in our case, we +# don't have a direct way. Explicitly telling make that it has nothing to do +# for them makes it go faster. +%%.d: ; + +# Use FORCE_DO_CMD to force a target to run. Should be coupled with +# do_cmd. +.PHONY: FORCE_DO_CMD +FORCE_DO_CMD: + +""") + +SHARED_HEADER_MAC_COMMANDS = """ +quiet_cmd_objc = CXX($(TOOLSET)) $@ +cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< + +quiet_cmd_objcxx = CXX($(TOOLSET)) $@ +cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# Commands for precompiled header files. +quiet_cmd_pch_c = CXX($(TOOLSET)) $@ +cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_cc = CXX($(TOOLSET)) $@ +cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +quiet_cmd_pch_m = CXX($(TOOLSET)) $@ +cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< +quiet_cmd_pch_mm = CXX($(TOOLSET)) $@ +cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# gyp-mac-tool is written next to the root Makefile by gyp. +# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd +# already. +quiet_cmd_mac_tool = MACTOOL $(4) $< +cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@" + +quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@ +cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4) + +quiet_cmd_infoplist = INFOPLIST $@ +cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@" +""" + +SHARED_HEADER_SUN_COMMANDS = """ +# gyp-sun-tool is written next to the root Makefile by gyp. +# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd +# already. +quiet_cmd_sun_tool = SUNTOOL $(4) $< +cmd_sun_tool = ./gyp-sun-tool $(4) $< "$@" +""" + + +def WriteRootHeaderSuffixRules(writer): + extensions = sorted(COMPILABLE_EXTENSIONS.keys(), key=str.lower) + + writer.write('# Suffix rules, putting all outputs into $(obj).\n') + for ext in extensions: + writer.write('$(obj).$(TOOLSET)/%%.o: $(srcdir)/%%%s FORCE_DO_CMD\n' % ext) + writer.write('\t@$(call do_cmd,%s,1)\n' % COMPILABLE_EXTENSIONS[ext]) + + writer.write('\n# Try building from generated source, too.\n') + for ext in extensions: + writer.write( + '$(obj).$(TOOLSET)/%%.o: $(obj).$(TOOLSET)/%%%s FORCE_DO_CMD\n' % ext) + writer.write('\t@$(call do_cmd,%s,1)\n' % COMPILABLE_EXTENSIONS[ext]) + writer.write('\n') + for ext in extensions: + writer.write('$(obj).$(TOOLSET)/%%.o: $(obj)/%%%s FORCE_DO_CMD\n' % ext) + writer.write('\t@$(call do_cmd,%s,1)\n' % COMPILABLE_EXTENSIONS[ext]) + writer.write('\n') + + +SHARED_HEADER_SUFFIX_RULES_COMMENT1 = ("""\ +# Suffix rules, putting all outputs into $(obj). +""") + + +SHARED_HEADER_SUFFIX_RULES_COMMENT2 = ("""\ +# Try building from generated source, too. +""") + + +SHARED_FOOTER = """\ +# "all" is a concatenation of the "all" targets from all the included +# sub-makefiles. This is just here to clarify. +all: + +# Add in dependency-tracking rules. $(all_deps) is the list of every single +# target in our tree. Only consider the ones with .d (dependency) info: +d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) +ifneq ($(d_files),) + include $(d_files) +endif +""" + +header = """\ +# This file is generated by gyp; do not edit. + +""" + +# Maps every compilable file extension to the do_cmd that compiles it. +COMPILABLE_EXTENSIONS = { + '.c': 'cc', + '.cc': 'cxx', + '.cpp': 'cxx', + '.cxx': 'cxx', + '.s': 'cc', + '.S': 'cc', +} + +def Compilable(filename): + """Return true if the file is compilable (should be in OBJS).""" + for res in (filename.endswith(e) for e in COMPILABLE_EXTENSIONS): + if res: + return True + return False + + +def Linkable(filename): + """Return true if the file is linkable (should be on the link line).""" + return filename.endswith('.o') + + +def Target(filename): + """Translate a compilable filename to its .o target.""" + return os.path.splitext(filename)[0] + '.o' + + +def EscapeShellArgument(s): + """Quotes an argument so that it will be interpreted literally by a POSIX + shell. Taken from + http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python + """ + return "'" + s.replace("'", "'\\''") + "'" + + +def EscapeMakeVariableExpansion(s): + """Make has its own variable expansion syntax using $. We must escape it for + string to be interpreted literally.""" + return s.replace('$', '$$') + + +def EscapeCppDefine(s): + """Escapes a CPP define so that it will reach the compiler unaltered.""" + s = EscapeShellArgument(s) + s = EscapeMakeVariableExpansion(s) + # '#' characters must be escaped even embedded in a string, else Make will + # treat it as the start of a comment. + return s.replace('#', r'\#') + + +def QuoteIfNecessary(string): + """TODO: Should this ideally be replaced with one or more of the above + functions?""" + if '"' in string: + string = '"' + string.replace('"', '\\"') + '"' + return string + + +def StringToMakefileVariable(string): + """Convert a string to a value that is acceptable as a make variable name.""" + return re.sub('[^a-zA-Z0-9_]', '_', string) + + +srcdir_prefix = '' +def Sourceify(path): + """Convert a path to its source directory form.""" + if '$(' in path: + return path + if os.path.isabs(path): + return path + return srcdir_prefix + path + + +def QuoteSpaces(s, quote=r'\ '): + return s.replace(' ', quote) + + +def InvertRelativePath(path): + """Given a relative path like foo/bar, return the inverse relative path: + the path from the relative path back to the origin dir. + + E.g. os.path.normpath(os.path.join(path, InvertRelativePath(path))) + should always produce the empty string.""" + + if not path: + return path + # Only need to handle relative paths into subdirectories for now. + assert '..' not in path, path + depth = len(path.split(os.path.sep)) + return os.path.sep.join(['..'] * depth) + + +# Map from qualified target to path to output. +target_outputs = {} +# Map from qualified target to any linkable output. A subset +# of target_outputs. E.g. when mybinary depends on liba, we want to +# include liba in the linker line; when otherbinary depends on +# mybinary, we just want to build mybinary first. +target_link_deps = {} + + +class MakefileWriter: + """MakefileWriter packages up the writing of one target-specific foobar.mk. + + Its only real entry point is Write(), and is mostly used for namespacing. + """ + + def __init__(self, generator_flags, flavor): + self.generator_flags = generator_flags + self.flavor = flavor + + self.suffix_rules_srcdir = {} + self.suffix_rules_objdir1 = {} + self.suffix_rules_objdir2 = {} + + # Generate suffix rules for all compilable extensions. + for ext in COMPILABLE_EXTENSIONS.keys(): + # Suffix rules for source folder. + self.suffix_rules_srcdir.update({ext: ("""\ +$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(srcdir)/%%%s FORCE_DO_CMD + @$(call do_cmd,%s,1) +""" % (ext, COMPILABLE_EXTENSIONS[ext]))}) + + # Suffix rules for generated source files. + self.suffix_rules_objdir1.update({ext: ("""\ +$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj).$(TOOLSET)/%%%s FORCE_DO_CMD + @$(call do_cmd,%s,1) +""" % (ext, COMPILABLE_EXTENSIONS[ext]))}) + self.suffix_rules_objdir2.update({ext: ("""\ +$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD + @$(call do_cmd,%s,1) +""" % (ext, COMPILABLE_EXTENSIONS[ext]))}) + + + def Write(self, qualified_target, base_path, output_filename, spec, configs, + part_of_all): + """The main entry point: writes a .mk file for a single target. + + Arguments: + qualified_target: target we're generating + base_path: path relative to source root we're building in, used to resolve + target-relative paths + output_filename: output .mk file name to write + spec, configs: gyp info + part_of_all: flag indicating this target is part of 'all' + """ + ensure_directory_exists(output_filename) + + self.fp = open(output_filename, 'w') + + self.fp.write(header) + + self.qualified_target = qualified_target + self.path = base_path + self.target = spec['target_name'] + self.type = spec['type'] + self.toolset = spec['toolset'] + + self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) + if self.flavor == 'mac': + self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) + else: + self.xcode_settings = None + + deps, link_deps = self.ComputeDeps(spec) + + # Some of the generation below can add extra output, sources, or + # link dependencies. All of the out params of the functions that + # follow use names like extra_foo. + extra_outputs = [] + extra_sources = [] + extra_link_deps = [] + extra_mac_bundle_resources = [] + mac_bundle_deps = [] + + if self.is_mac_bundle: + self.output = self.ComputeMacBundleOutput(spec) + self.output_binary = self.ComputeMacBundleBinaryOutput(spec) + else: + self.output = self.output_binary = self.ComputeOutput(spec) + + self._INSTALLABLE_TARGETS = ('executable', 'loadable_module', + 'shared_library') + if self.type in self._INSTALLABLE_TARGETS: + self.alias = os.path.basename(self.output) + install_path = self._InstallableTargetInstallPath() + else: + self.alias = self.output + install_path = self.output + + self.WriteLn("TOOLSET := " + self.toolset) + self.WriteLn("TARGET := " + self.target) + + # Actions must come first, since they can generate more OBJs for use below. + if 'actions' in spec: + self.WriteActions(spec['actions'], extra_sources, extra_outputs, + extra_mac_bundle_resources, part_of_all) + + # Rules must be early like actions. + if 'rules' in spec: + self.WriteRules(spec['rules'], extra_sources, extra_outputs, + extra_mac_bundle_resources, part_of_all) + + if 'copies' in spec: + self.WriteCopies(spec['copies'], extra_outputs, part_of_all) + + # Bundle resources. + if self.is_mac_bundle: + all_mac_bundle_resources = ( + spec.get('mac_bundle_resources', []) + extra_mac_bundle_resources) + self.WriteMacBundleResources(all_mac_bundle_resources, mac_bundle_deps) + self.WriteMacInfoPlist(mac_bundle_deps) + + # Sources. + all_sources = spec.get('sources', []) + extra_sources + if all_sources: + self.WriteSources( + configs, deps, all_sources, extra_outputs, + extra_link_deps, part_of_all, + gyp.xcode_emulation.MacPrefixHeader( + self.xcode_settings, lambda p: Sourceify(self.Absolutify(p)), + self.Pchify)) + sources = filter(Compilable, all_sources) + if sources: + self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT1) + extensions = set([os.path.splitext(s)[1] for s in sources]) + for ext in extensions: + if ext in self.suffix_rules_srcdir: + self.WriteLn(self.suffix_rules_srcdir[ext]) + self.WriteLn(SHARED_HEADER_SUFFIX_RULES_COMMENT2) + for ext in extensions: + if ext in self.suffix_rules_objdir1: + self.WriteLn(self.suffix_rules_objdir1[ext]) + for ext in extensions: + if ext in self.suffix_rules_objdir2: + self.WriteLn(self.suffix_rules_objdir2[ext]) + self.WriteLn('# End of this set of suffix rules') + + # Add dependency from bundle to bundle binary. + if self.is_mac_bundle: + mac_bundle_deps.append(self.output_binary) + + self.WriteTarget(spec, configs, deps, extra_link_deps + link_deps, + mac_bundle_deps, extra_outputs, part_of_all) + + # Update global list of target outputs, used in dependency tracking. + target_outputs[qualified_target] = install_path + + # Update global list of link dependencies. + if self.type in ('static_library', 'shared_library'): + target_link_deps[qualified_target] = self.output_binary + + # Currently any versions have the same effect, but in future the behavior + # could be different. + if self.generator_flags.get('android_ndk_version', None): + self.WriteAndroidNdkModuleRule(self.target, all_sources, link_deps) + + self.fp.close() + + + def WriteSubMake(self, output_filename, makefile_path, targets, build_dir): + """Write a "sub-project" Makefile. + + This is a small, wrapper Makefile that calls the top-level Makefile to build + the targets from a single gyp file (i.e. a sub-project). + + Arguments: + output_filename: sub-project Makefile name to write + makefile_path: path to the top-level Makefile + targets: list of "all" targets for this sub-project + build_dir: build output directory, relative to the sub-project + """ + ensure_directory_exists(output_filename) + self.fp = open(output_filename, 'w') + self.fp.write(header) + # For consistency with other builders, put sub-project build output in the + # sub-project dir (see test/subdirectory/gyptest-subdir-all.py). + self.WriteLn('export builddir_name ?= %s' % + os.path.join(os.path.dirname(output_filename), build_dir)) + self.WriteLn('.PHONY: all') + self.WriteLn('all:') + if makefile_path: + makefile_path = ' -C ' + makefile_path + self.WriteLn('\t$(MAKE)%s %s' % (makefile_path, ' '.join(targets))) + self.fp.close() + + + def WriteActions(self, actions, extra_sources, extra_outputs, + extra_mac_bundle_resources, part_of_all): + """Write Makefile code for any 'actions' from the gyp input. + + extra_sources: a list that will be filled in with newly generated source + files, if any + extra_outputs: a list that will be filled in with any outputs of these + actions (used to make other pieces dependent on these + actions) + part_of_all: flag indicating this target is part of 'all' + """ + for action in actions: + name = StringToMakefileVariable('%s_%s' % (self.qualified_target, + action['action_name'])) + self.WriteLn('### Rules for action "%s":' % action['action_name']) + inputs = action['inputs'] + outputs = action['outputs'] + + # Build up a list of outputs. + # Collect the output dirs we'll need. + dirs = set() + for out in outputs: + dir = os.path.split(out)[0] + if dir: + dirs.add(dir) + if int(action.get('process_outputs_as_sources', False)): + extra_sources += outputs + if int(action.get('process_outputs_as_mac_bundle_resources', False)): + extra_mac_bundle_resources += outputs + + # Write the actual command. + command = gyp.common.EncodePOSIXShellList(action['action']) + if 'message' in action: + self.WriteLn('quiet_cmd_%s = ACTION %s $@' % (name, action['message'])) + else: + self.WriteLn('quiet_cmd_%s = ACTION %s $@' % (name, name)) + if len(dirs) > 0: + command = 'mkdir -p %s' % ' '.join(dirs) + '; ' + command + + cd_action = 'cd %s; ' % Sourceify(self.path or '.') + + # command and cd_action get written to a toplevel variable called + # cmd_foo. Toplevel variables can't handle things that change per + # makefile like $(TARGET), so hardcode the target. + command = command.replace('$(TARGET)', self.target) + cd_action = cd_action.replace('$(TARGET)', self.target) + + # Set LD_LIBRARY_PATH in case the action runs an executable from this + # build which links to shared libs from this build. + # actions run on the host, so they should in theory only use host + # libraries, but until everything is made cross-compile safe, also use + # target libraries. + # TODO(piman): when everything is cross-compile safe, remove lib.target + self.WriteLn('cmd_%s = LD_LIBRARY_PATH=$(builddir)/lib.host:' + '$(builddir)/lib.target:$$LD_LIBRARY_PATH; ' + 'export LD_LIBRARY_PATH; ' + '%s%s' + % (name, cd_action, command)) + self.WriteLn() + outputs = map(self.Absolutify, outputs) + # The makefile rules are all relative to the top dir, but the gyp actions + # are defined relative to their containing dir. This replaces the obj + # variable for the action rule with an absolute version so that the output + # goes in the right place. + # Only write the 'obj' and 'builddir' rules for the "primary" output (:1); + # it's superfluous for the "extra outputs", and this avoids accidentally + # writing duplicate dummy rules for those outputs. + # Same for environment. + self.WriteLn("%s: obj := $(abs_obj)" % QuoteSpaces(outputs[0])) + self.WriteLn("%s: builddir := $(abs_builddir)" % QuoteSpaces(outputs[0])) + self.WriteSortedXcodeEnv(outputs[0], self.GetSortedXcodeEnv()) + + for input in inputs: + assert ' ' not in input, ( + "Spaces in action input filenames not supported (%s)" % input) + for output in outputs: + assert ' ' not in output, ( + "Spaces in action output filenames not supported (%s)" % output) + + # See the comment in WriteCopies about expanding env vars. + env = self.GetSortedXcodeEnv() + outputs = [gyp.xcode_emulation.ExpandEnvVars(o, env) for o in outputs] + inputs = [gyp.xcode_emulation.ExpandEnvVars(i, env) for i in inputs] + + self.WriteDoCmd(outputs, map(Sourceify, map(self.Absolutify, inputs)), + part_of_all=part_of_all, command=name) + + # Stuff the outputs in a variable so we can refer to them later. + outputs_variable = 'action_%s_outputs' % name + self.WriteLn('%s := %s' % (outputs_variable, ' '.join(outputs))) + extra_outputs.append('$(%s)' % outputs_variable) + self.WriteLn() + + self.WriteLn() + + + def WriteRules(self, rules, extra_sources, extra_outputs, + extra_mac_bundle_resources, part_of_all): + """Write Makefile code for any 'rules' from the gyp input. + + extra_sources: a list that will be filled in with newly generated source + files, if any + extra_outputs: a list that will be filled in with any outputs of these + rules (used to make other pieces dependent on these rules) + part_of_all: flag indicating this target is part of 'all' + """ + for rule in rules: + name = StringToMakefileVariable('%s_%s' % (self.qualified_target, + rule['rule_name'])) + count = 0 + self.WriteLn('### Generated for rule %s:' % name) + + all_outputs = [] + + for rule_source in rule.get('rule_sources', []): + dirs = set() + (rule_source_dirname, rule_source_basename) = os.path.split(rule_source) + (rule_source_root, rule_source_ext) = \ + os.path.splitext(rule_source_basename) + + outputs = [self.ExpandInputRoot(out, rule_source_root, + rule_source_dirname) + for out in rule['outputs']] + + for out in outputs: + dir = os.path.dirname(out) + if dir: + dirs.add(dir) + if int(rule.get('process_outputs_as_sources', False)): + extra_sources += outputs + if int(rule.get('process_outputs_as_mac_bundle_resources', False)): + extra_mac_bundle_resources += outputs + inputs = map(Sourceify, map(self.Absolutify, [rule_source] + + rule.get('inputs', []))) + actions = ['$(call do_cmd,%s_%d)' % (name, count)] + + if name == 'resources_grit': + # HACK: This is ugly. Grit intentionally doesn't touch the + # timestamp of its output file when the file doesn't change, + # which is fine in hash-based dependency systems like scons + # and forge, but not kosher in the make world. After some + # discussion, hacking around it here seems like the least + # amount of pain. + actions += ['@touch --no-create $@'] + + outputs = map(self.Absolutify, outputs) + all_outputs += outputs + # Only write the 'obj' and 'builddir' rules for the "primary" output + # (:1); it's superfluous for the "extra outputs", and this avoids + # accidentally writing duplicate dummy rules for those outputs. + self.WriteLn('%s: obj := $(abs_obj)' % outputs[0]) + self.WriteLn('%s: builddir := $(abs_builddir)' % outputs[0]) + self.WriteMakeRule(outputs, inputs + ['FORCE_DO_CMD'], actions) + for output in outputs: + assert ' ' not in output, ( + "Spaces in rule filenames not yet supported (%s)" % output) + self.WriteLn('all_deps += %s' % ' '.join(outputs)) + + action = [self.ExpandInputRoot(ac, rule_source_root, + rule_source_dirname) + for ac in rule['action']] + mkdirs = '' + if len(dirs) > 0: + mkdirs = 'mkdir -p %s; ' % ' '.join(dirs) + cd_action = 'cd %s; ' % Sourceify(self.path or '.') + + # action, cd_action, and mkdirs get written to a toplevel variable + # called cmd_foo. Toplevel variables can't handle things that change + # per makefile like $(TARGET), so hardcode the target. + action = gyp.common.EncodePOSIXShellList(action) + action = action.replace('$(TARGET)', self.target) + cd_action = cd_action.replace('$(TARGET)', self.target) + mkdirs = mkdirs.replace('$(TARGET)', self.target) + + # Set LD_LIBRARY_PATH in case the rule runs an executable from this + # build which links to shared libs from this build. + # rules run on the host, so they should in theory only use host + # libraries, but until everything is made cross-compile safe, also use + # target libraries. + # TODO(piman): when everything is cross-compile safe, remove lib.target + self.WriteLn( + "cmd_%(name)s_%(count)d = LD_LIBRARY_PATH=" + "$(builddir)/lib.host:$(builddir)/lib.target:$$LD_LIBRARY_PATH; " + "export LD_LIBRARY_PATH; " + "%(cd_action)s%(mkdirs)s%(action)s" % { + 'action': action, + 'cd_action': cd_action, + 'count': count, + 'mkdirs': mkdirs, + 'name': name, + }) + self.WriteLn( + 'quiet_cmd_%(name)s_%(count)d = RULE %(name)s_%(count)d $@' % { + 'count': count, + 'name': name, + }) + self.WriteLn() + count += 1 + + outputs_variable = 'rule_%s_outputs' % name + self.WriteList(all_outputs, outputs_variable) + extra_outputs.append('$(%s)' % outputs_variable) + + self.WriteLn('### Finished generating for rule: %s' % name) + self.WriteLn() + self.WriteLn('### Finished generating for all rules') + self.WriteLn('') + + + def WriteCopies(self, copies, extra_outputs, part_of_all): + """Write Makefile code for any 'copies' from the gyp input. + + extra_outputs: a list that will be filled in with any outputs of this action + (used to make other pieces dependent on this action) + part_of_all: flag indicating this target is part of 'all' + """ + self.WriteLn('### Generated for copy rule.') + + variable = StringToMakefileVariable(self.qualified_target + '_copies') + outputs = [] + for copy in copies: + for path in copy['files']: + # Absolutify() calls normpath, stripping trailing slashes. + path = Sourceify(self.Absolutify(path)) + filename = os.path.split(path)[1] + output = Sourceify(self.Absolutify(os.path.join(copy['destination'], + filename))) + + # If the output path has variables in it, which happens in practice for + # 'copies', writing the environment as target-local doesn't work, + # because the variables are already needed for the target name. + # Copying the environment variables into global make variables doesn't + # work either, because then the .d files will potentially contain spaces + # after variable expansion, and .d file handling cannot handle spaces. + # As a workaround, manually expand variables at gyp time. Since 'copies' + # can't run scripts, there's no need to write the env then. + # WriteDoCmd() will escape spaces for .d files. + env = self.GetSortedXcodeEnv() + output = gyp.xcode_emulation.ExpandEnvVars(output, env) + path = gyp.xcode_emulation.ExpandEnvVars(path, env) + self.WriteDoCmd([output], [path], 'copy', part_of_all) + outputs.append(output) + self.WriteLn('%s = %s' % (variable, ' '.join(map(QuoteSpaces, outputs)))) + extra_outputs.append('$(%s)' % variable) + self.WriteLn() + + + def WriteMacBundleResources(self, resources, bundle_deps): + """Writes Makefile code for 'mac_bundle_resources'.""" + self.WriteLn('### Generated for mac_bundle_resources') + + for output, res in gyp.xcode_emulation.GetMacBundleResources( + generator_default_variables['PRODUCT_DIR'], self.xcode_settings, + map(Sourceify, map(self.Absolutify, resources))): + self.WriteDoCmd([output], [res], 'mac_tool,,,copy-bundle-resource', + part_of_all=True) + bundle_deps.append(output) + + + def WriteMacInfoPlist(self, bundle_deps): + """Write Makefile code for bundle Info.plist files.""" + info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist( + generator_default_variables['PRODUCT_DIR'], self.xcode_settings, + lambda p: Sourceify(self.Absolutify(p))) + if not info_plist: + return + if defines: + # Create an intermediate file to store preprocessed results. + intermediate_plist = ('$(obj).$(TOOLSET)/$(TARGET)/' + + os.path.basename(info_plist)) + self.WriteList(defines, intermediate_plist + ': INFOPLIST_DEFINES', '-D', + quoter=EscapeCppDefine) + self.WriteMakeRule([intermediate_plist], [info_plist], + ['$(call do_cmd,infoplist)', + # "Convert" the plist so that any weird whitespace changes from the + # preprocessor do not affect the XML parser in mac_tool. + '@plutil -convert xml1 $@ $@']) + info_plist = intermediate_plist + # plists can contain envvars and substitute them into the file. + self.WriteSortedXcodeEnv( + out, self.GetSortedXcodeEnv(additional_settings=extra_env)) + self.WriteDoCmd([out], [info_plist], 'mac_tool,,,copy-info-plist', + part_of_all=True) + bundle_deps.append(out) + + + def WriteSources(self, configs, deps, sources, + extra_outputs, extra_link_deps, + part_of_all, precompiled_header): + """Write Makefile code for any 'sources' from the gyp input. + These are source files necessary to build the current target. + + configs, deps, sources: input from gyp. + extra_outputs: a list of extra outputs this action should be dependent on; + used to serialize action/rules before compilation + extra_link_deps: a list that will be filled in with any outputs of + compilation (to be used in link lines) + part_of_all: flag indicating this target is part of 'all' + """ + + # Write configuration-specific variables for CFLAGS, etc. + for configname in sorted(configs.keys()): + config = configs[configname] + self.WriteList(config.get('defines'), 'DEFS_%s' % configname, prefix='-D', + quoter=EscapeCppDefine) + + if self.flavor == 'mac': + cflags = self.xcode_settings.GetCflags(configname) + cflags_c = self.xcode_settings.GetCflagsC(configname) + cflags_cc = self.xcode_settings.GetCflagsCC(configname) + cflags_objc = self.xcode_settings.GetCflagsObjC(configname) + cflags_objcc = self.xcode_settings.GetCflagsObjCC(configname) + else: + cflags = config.get('cflags') + cflags_c = config.get('cflags_c') + cflags_cc = config.get('cflags_cc') + + self.WriteLn("# Flags passed to all source files."); + self.WriteList(cflags, 'CFLAGS_%s' % configname) + self.WriteLn("# Flags passed to only C files."); + self.WriteList(cflags_c, 'CFLAGS_C_%s' % configname) + self.WriteLn("# Flags passed to only C++ files."); + self.WriteList(cflags_cc, 'CFLAGS_CC_%s' % configname) + if self.flavor == 'mac': + self.WriteLn("# Flags passed to only ObjC files."); + self.WriteList(cflags_objc, 'CFLAGS_OBJC_%s' % configname) + self.WriteLn("# Flags passed to only ObjC++ files."); + self.WriteList(cflags_objcc, 'CFLAGS_OBJCC_%s' % configname) + includes = config.get('include_dirs') + if includes: + includes = map(Sourceify, map(self.Absolutify, includes)) + self.WriteList(includes, 'INCS_%s' % configname, prefix='-I') + + compilable = filter(Compilable, sources) + objs = map(self.Objectify, map(self.Absolutify, map(Target, compilable))) + self.WriteList(objs, 'OBJS') + + for obj in objs: + assert ' ' not in obj, ( + "Spaces in object filenames not supported (%s)" % obj) + self.WriteLn('# Add to the list of files we specially track ' + 'dependencies for.') + self.WriteLn('all_deps += $(OBJS)') + self.WriteLn() + + # Make sure our dependencies are built first. + if deps: + self.WriteMakeRule(['$(OBJS)'], deps, + comment = 'Make sure our dependencies are built ' + 'before any of us.', + order_only = True) + + # Make sure the actions and rules run first. + # If they generate any extra headers etc., the per-.o file dep tracking + # will catch the proper rebuilds, so order only is still ok here. + if extra_outputs: + self.WriteMakeRule(['$(OBJS)'], extra_outputs, + comment = 'Make sure our actions/rules run ' + 'before any of us.', + order_only = True) + + pchdeps = precompiled_header.GetObjDependencies(compilable, objs ) + if pchdeps: + self.WriteLn('# Dependencies from obj files to their precompiled headers') + for source, obj, gch in pchdeps: + self.WriteLn('%s: %s' % (obj, gch)) + self.WriteLn('# End precompiled header dependencies') + + if objs: + extra_link_deps.append('$(OBJS)') + self.WriteLn("""\ +# CFLAGS et al overrides must be target-local. +# See "Target-specific Variable Values" in the GNU Make manual.""") + self.WriteLn("$(OBJS): TOOLSET := $(TOOLSET)") + self.WriteLn("$(OBJS): GYP_CFLAGS := " + "$(DEFS_$(BUILDTYPE)) " + "$(INCS_$(BUILDTYPE)) " + "%s " % precompiled_header.GetInclude('c') + + "$(CFLAGS_$(BUILDTYPE)) " + "$(CFLAGS_C_$(BUILDTYPE))") + self.WriteLn("$(OBJS): GYP_CXXFLAGS := " + "$(DEFS_$(BUILDTYPE)) " + "$(INCS_$(BUILDTYPE)) " + "%s " % precompiled_header.GetInclude('cc') + + "$(CFLAGS_$(BUILDTYPE)) " + "$(CFLAGS_CC_$(BUILDTYPE))") + if self.flavor == 'mac': + self.WriteLn("$(OBJS): GYP_OBJCFLAGS := " + "$(DEFS_$(BUILDTYPE)) " + "$(INCS_$(BUILDTYPE)) " + "%s " % precompiled_header.GetInclude('m') + + "$(CFLAGS_$(BUILDTYPE)) " + "$(CFLAGS_C_$(BUILDTYPE)) " + "$(CFLAGS_OBJC_$(BUILDTYPE))") + self.WriteLn("$(OBJS): GYP_OBJCXXFLAGS := " + "$(DEFS_$(BUILDTYPE)) " + "$(INCS_$(BUILDTYPE)) " + "%s " % precompiled_header.GetInclude('mm') + + "$(CFLAGS_$(BUILDTYPE)) " + "$(CFLAGS_CC_$(BUILDTYPE)) " + "$(CFLAGS_OBJCC_$(BUILDTYPE))") + + self.WritePchTargets(precompiled_header.GetPchBuildCommands()) + + # If there are any object files in our input file list, link them into our + # output. + extra_link_deps += filter(Linkable, sources) + + self.WriteLn() + + def WritePchTargets(self, pch_commands): + """Writes make rules to compile prefix headers.""" + if not pch_commands: + return + + for gch, lang_flag, lang, input in pch_commands: + extra_flags = { + 'c': '$(CFLAGS_C_$(BUILDTYPE))', + 'cc': '$(CFLAGS_CC_$(BUILDTYPE))', + 'm': '$(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE))', + 'mm': '$(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE))', + }[lang] + var_name = { + 'c': 'GYP_PCH_CFLAGS', + 'cc': 'GYP_PCH_CXXFLAGS', + 'm': 'GYP_PCH_OBJCFLAGS', + 'mm': 'GYP_PCH_OBJCXXFLAGS', + }[lang] + self.WriteLn("%s: %s := %s " % (gch, var_name, lang_flag) + + "$(DEFS_$(BUILDTYPE)) " + "$(INCS_$(BUILDTYPE)) " + "$(CFLAGS_$(BUILDTYPE)) " + + extra_flags) + + self.WriteLn('%s: %s FORCE_DO_CMD' % (gch, input)) + self.WriteLn('\t@$(call do_cmd,pch_%s,1)' % lang) + self.WriteLn('') + assert ' ' not in gch, ( + "Spaces in gch filenames not supported (%s)" % gch) + self.WriteLn('all_deps += %s' % gch) + self.WriteLn('') + + + def ComputeOutputBasename(self, spec): + """Return the 'output basename' of a gyp spec. + + E.g., the loadable module 'foobar' in directory 'baz' will produce + 'libfoobar.so' + """ + assert not self.is_mac_bundle + + if self.flavor == 'mac' and self.type in ( + 'static_library', 'executable', 'shared_library', 'loadable_module'): + return self.xcode_settings.GetExecutablePath() + + target = spec['target_name'] + target_prefix = '' + target_ext = '' + if self.type == 'static_library': + if target[:3] == 'lib': + target = target[3:] + target_prefix = 'lib' + target_ext = '.a' + elif self.type in ('loadable_module', 'shared_library'): + if target[:3] == 'lib': + target = target[3:] + target_prefix = 'lib' + target_ext = '.so' + elif self.type == 'none': + target = '%s.stamp' % target + elif self.type != 'executable': + print ("ERROR: What output file should be generated?", + "type", self.type, "target", target) + + target_prefix = spec.get('product_prefix', target_prefix) + target = spec.get('product_name', target) + product_ext = spec.get('product_extension') + if product_ext: + target_ext = '.' + product_ext + + return target_prefix + target + target_ext + + + def _InstallImmediately(self): + return self.toolset == 'target' and self.flavor == 'mac' and self.type in ( + 'static_library', 'executable', 'shared_library', 'loadable_module') + + + def ComputeOutput(self, spec): + """Return the 'output' (full output path) of a gyp spec. + + E.g., the loadable module 'foobar' in directory 'baz' will produce + '$(obj)/baz/libfoobar.so' + """ + assert not self.is_mac_bundle + + path = os.path.join('$(obj).' + self.toolset, self.path) + if self.type == 'executable' or self._InstallImmediately(): + path = '$(builddir)' + path = spec.get('product_dir', path) + return os.path.join(path, self.ComputeOutputBasename(spec)) + + + def ComputeMacBundleOutput(self, spec): + """Return the 'output' (full output path) to a bundle output directory.""" + assert self.is_mac_bundle + path = generator_default_variables['PRODUCT_DIR'] + return os.path.join(path, self.xcode_settings.GetWrapperName()) + + + def ComputeMacBundleBinaryOutput(self, spec): + """Return the 'output' (full output path) to the binary in a bundle.""" + path = generator_default_variables['PRODUCT_DIR'] + return os.path.join(path, self.xcode_settings.GetExecutablePath()) + + + def ComputeDeps(self, spec): + """Compute the dependencies of a gyp spec. + + Returns a tuple (deps, link_deps), where each is a list of + filenames that will need to be put in front of make for either + building (deps) or linking (link_deps). + """ + deps = [] + link_deps = [] + if 'dependencies' in spec: + deps.extend([target_outputs[dep] for dep in spec['dependencies'] + if target_outputs[dep]]) + for dep in spec['dependencies']: + if dep in target_link_deps: + link_deps.append(target_link_deps[dep]) + deps.extend(link_deps) + # TODO: It seems we need to transitively link in libraries (e.g. -lfoo)? + # This hack makes it work: + # link_deps.extend(spec.get('libraries', [])) + return (gyp.common.uniquer(deps), gyp.common.uniquer(link_deps)) + + + def WriteDependencyOnExtraOutputs(self, target, extra_outputs): + self.WriteMakeRule([self.output_binary], extra_outputs, + comment = 'Build our special outputs first.', + order_only = True) + + + def WriteTarget(self, spec, configs, deps, link_deps, bundle_deps, + extra_outputs, part_of_all): + """Write Makefile code to produce the final target of the gyp spec. + + spec, configs: input from gyp. + deps, link_deps: dependency lists; see ComputeDeps() + extra_outputs: any extra outputs that our target should depend on + part_of_all: flag indicating this target is part of 'all' + """ + + self.WriteLn('### Rules for final target.') + + if extra_outputs: + self.WriteDependencyOnExtraOutputs(self.output_binary, extra_outputs) + self.WriteMakeRule(extra_outputs, deps, + comment=('Preserve order dependency of ' + 'special output on deps.'), + order_only = True) + + target_postbuilds = {} + if self.type != 'none': + for configname in sorted(configs.keys()): + config = configs[configname] + if self.flavor == 'mac': + ldflags = self.xcode_settings.GetLdflags(configname, + generator_default_variables['PRODUCT_DIR'], + lambda p: Sourceify(self.Absolutify(p))) + + # TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on. + gyp_to_build = InvertRelativePath(self.path) + target_postbuild = self.xcode_settings.GetTargetPostbuilds( + configname, + QuoteSpaces(os.path.normpath(os.path.join(gyp_to_build, + self.output))), + QuoteSpaces(os.path.normpath(os.path.join(gyp_to_build, + self.output_binary)))) + if target_postbuild: + target_postbuilds[configname] = target_postbuild + else: + ldflags = config.get('ldflags', []) + # Compute an rpath for this output if needed. + if any(dep.endswith('.so') for dep in deps): + # We want to get the literal string "$ORIGIN" into the link command, + # so we need lots of escaping. + ldflags.append(r'-Wl,-rpath=\$$ORIGIN/lib.%s/' % self.toolset) + ldflags.append(r'-Wl,-rpath-link=\$(builddir)/lib.%s/' % + self.toolset) + self.WriteList(ldflags, 'LDFLAGS_%s' % configname) + libraries = spec.get('libraries') + if libraries: + # Remove duplicate entries + libraries = gyp.common.uniquer(libraries) + if self.flavor == 'mac': + libraries = self.xcode_settings.AdjustLibraries(libraries) + self.WriteList(libraries, 'LIBS') + self.WriteLn('%s: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))' % + QuoteSpaces(self.output_binary)) + self.WriteLn('%s: LIBS := $(LIBS)' % QuoteSpaces(self.output_binary)) + + # Postbuild actions. Like actions, but implicitly depend on the target's + # output. + postbuilds = [] + if self.flavor == 'mac': + if target_postbuilds: + postbuilds.append('$(TARGET_POSTBUILDS_$(BUILDTYPE))') + postbuilds.extend( + gyp.xcode_emulation.GetSpecPostbuildCommands(spec)) + + if postbuilds: + # Envvars may be referenced by TARGET_POSTBUILDS_$(BUILDTYPE), + # so we must output its definition first, since we declare variables + # using ":=". + self.WriteSortedXcodeEnv(self.output, self.GetSortedXcodePostbuildEnv()) + + for configname in target_postbuilds: + self.WriteLn('%s: TARGET_POSTBUILDS_%s := %s' % + (QuoteSpaces(self.output), + configname, + gyp.common.EncodePOSIXShellList(target_postbuilds[configname]))) + + # Postbuilds expect to be run in the gyp file's directory, so insert an + # implicit postbuild to cd to there. + postbuilds.insert(0, gyp.common.EncodePOSIXShellList(['cd', self.path])) + for i in xrange(len(postbuilds)): + if not postbuilds[i].startswith('$'): + postbuilds[i] = EscapeShellArgument(postbuilds[i]) + self.WriteLn('%s: builddir := $(abs_builddir)' % QuoteSpaces(self.output)) + self.WriteLn('%s: POSTBUILDS := %s' % ( + QuoteSpaces(self.output), ' '.join(postbuilds))) + + # A bundle directory depends on its dependencies such as bundle resources + # and bundle binary. When all dependencies have been built, the bundle + # needs to be packaged. + if self.is_mac_bundle: + # If the framework doesn't contain a binary, then nothing depends + # on the actions -- make the framework depend on them directly too. + self.WriteDependencyOnExtraOutputs(self.output, extra_outputs) + + # Bundle dependencies. Note that the code below adds actions to this + # target, so if you move these two lines, move the lines below as well. + self.WriteList(map(QuoteSpaces, bundle_deps), 'BUNDLE_DEPS') + self.WriteLn('%s: $(BUNDLE_DEPS)' % QuoteSpaces(self.output)) + + # After the framework is built, package it. Needs to happen before + # postbuilds, since postbuilds depend on this. + if self.type in ('shared_library', 'loadable_module'): + self.WriteLn('\t@$(call do_cmd,mac_package_framework,,,%s)' % + self.xcode_settings.GetFrameworkVersion()) + + # Bundle postbuilds can depend on the whole bundle, so run them after + # the bundle is packaged, not already after the bundle binary is done. + if postbuilds: + self.WriteLn('\t@$(call do_postbuilds)') + postbuilds = [] # Don't write postbuilds for target's output. + + # Needed by test/mac/gyptest-rebuild.py. + self.WriteLn('\t@true # No-op, used by tests') + + # Since this target depends on binary and resources which are in + # nested subfolders, the framework directory will be older than + # its dependencies usually. To prevent this rule from executing + # on every build (expensive, especially with postbuilds), expliclity + # update the time on the framework directory. + self.WriteLn('\t@touch -c %s' % QuoteSpaces(self.output)) + + if postbuilds: + assert not self.is_mac_bundle, ('Postbuilds for bundles should be done ' + 'on the bundle, not the binary (target \'%s\')' % self.target) + assert 'product_dir' not in spec, ('Postbuilds do not work with ' + 'custom product_dir') + + if self.type == 'executable': + self.WriteLn('%s: LD_INPUTS := %s' % ( + QuoteSpaces(self.output_binary), + ' '.join(map(QuoteSpaces, link_deps)))) + if self.toolset == 'host' and self.flavor == 'android': + self.WriteDoCmd([self.output_binary], link_deps, 'link_host', + part_of_all, postbuilds=postbuilds) + else: + self.WriteDoCmd([self.output_binary], link_deps, 'link', part_of_all, + postbuilds=postbuilds) + + elif self.type == 'static_library': + for link_dep in link_deps: + assert ' ' not in link_dep, ( + "Spaces in alink input filenames not supported (%s)" % link_dep) + self.WriteDoCmd([self.output_binary], link_deps, 'alink', part_of_all, + postbuilds=postbuilds) + elif self.type == 'shared_library': + self.WriteLn('%s: LD_INPUTS := %s' % ( + QuoteSpaces(self.output_binary), + ' '.join(map(QuoteSpaces, link_deps)))) + self.WriteDoCmd([self.output_binary], link_deps, 'solink', part_of_all, + postbuilds=postbuilds) + elif self.type == 'loadable_module': + for link_dep in link_deps: + assert ' ' not in link_dep, ( + "Spaces in module input filenames not supported (%s)" % link_dep) + if self.toolset == 'host' and self.flavor == 'android': + self.WriteDoCmd([self.output_binary], link_deps, 'solink_module_host', + part_of_all, postbuilds=postbuilds) + else: + self.WriteDoCmd( + [self.output_binary], link_deps, 'solink_module', part_of_all, + postbuilds=postbuilds) + elif self.type == 'none': + # Write a stamp line. + self.WriteDoCmd([self.output_binary], deps, 'touch', part_of_all, + postbuilds=postbuilds) + else: + print "WARNING: no output for", self.type, target + + # Add an alias for each target (if there are any outputs). + # Installable target aliases are created below. + if ((self.output and self.output != self.target) and + (self.type not in self._INSTALLABLE_TARGETS)): + self.WriteMakeRule([self.target], [self.output], + comment='Add target alias', phony = True) + if part_of_all: + self.WriteMakeRule(['all'], [self.target], + comment = 'Add target alias to "all" target.', + phony = True) + + # Add special-case rules for our installable targets. + # 1) They need to install to the build dir or "product" dir. + # 2) They get shortcuts for building (e.g. "make chrome"). + # 3) They are part of "make all". + if self.type in self._INSTALLABLE_TARGETS: + if self.type == 'shared_library': + file_desc = 'shared library' + else: + file_desc = 'executable' + install_path = self._InstallableTargetInstallPath() + installable_deps = [self.output] + if (self.flavor == 'mac' and not 'product_dir' in spec and + self.toolset == 'target'): + # On mac, products are created in install_path immediately. + assert install_path == self.output, '%s != %s' % ( + install_path, self.output) + + # Point the target alias to the final binary output. + self.WriteMakeRule([self.target], [install_path], + comment='Add target alias', phony = True) + if install_path != self.output: + assert not self.is_mac_bundle # See comment a few lines above. + self.WriteDoCmd([install_path], [self.output], 'copy', + comment = 'Copy this to the %s output path.' % + file_desc, part_of_all=part_of_all) + installable_deps.append(install_path) + if self.output != self.alias and self.alias != self.target: + self.WriteMakeRule([self.alias], installable_deps, + comment = 'Short alias for building this %s.' % + file_desc, phony = True) + if part_of_all: + self.WriteMakeRule(['all'], [install_path], + comment = 'Add %s to "all" target.' % file_desc, + phony = True) + + + def WriteList(self, list, variable=None, prefix='', quoter=QuoteIfNecessary): + """Write a variable definition that is a list of values. + + E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out + foo = blaha blahb + but in a pretty-printed style. + """ + self.fp.write(variable + " := ") + if list: + list = [quoter(prefix + l) for l in list] + self.fp.write(" \\\n\t".join(list)) + self.fp.write("\n\n") + + + def WriteDoCmd(self, outputs, inputs, command, part_of_all, comment=None, + postbuilds=False): + """Write a Makefile rule that uses do_cmd. + + This makes the outputs dependent on the command line that was run, + as well as support the V= make command line flag. + """ + suffix = '' + if postbuilds: + assert ',' not in command + suffix = ',,1' # Tell do_cmd to honor $POSTBUILDS + self.WriteMakeRule(outputs, inputs, + actions = ['$(call do_cmd,%s%s)' % (command, suffix)], + comment = comment, + force = True) + # Add our outputs to the list of targets we read depfiles from. + # all_deps is only used for deps file reading, and for deps files we replace + # spaces with ? because escaping doesn't work with make's $(sort) and + # other functions. + outputs = [QuoteSpaces(o, SPACE_REPLACEMENT) for o in outputs] + self.WriteLn('all_deps += %s' % ' '.join(outputs)) + + + def WriteMakeRule(self, outputs, inputs, actions=None, comment=None, + order_only=False, force=False, phony=False): + """Write a Makefile rule, with some extra tricks. + + outputs: a list of outputs for the rule (note: this is not directly + supported by make; see comments below) + inputs: a list of inputs for the rule + actions: a list of shell commands to run for the rule + comment: a comment to put in the Makefile above the rule (also useful + for making this Python script's code self-documenting) + order_only: if true, makes the dependency order-only + force: if true, include FORCE_DO_CMD as an order-only dep + phony: if true, the rule does not actually generate the named output, the + output is just a name to run the rule + """ + outputs = map(QuoteSpaces, outputs) + inputs = map(QuoteSpaces, inputs) + + if comment: + self.WriteLn('# ' + comment) + if phony: + self.WriteLn('.PHONY: ' + ' '.join(outputs)) + # TODO(evanm): just make order_only a list of deps instead of these hacks. + if order_only: + order_insert = '| ' + pick_output = ' '.join(outputs) + else: + order_insert = '' + pick_output = outputs[0] + if force: + force_append = ' FORCE_DO_CMD' + else: + force_append = '' + if actions: + self.WriteLn("%s: TOOLSET := $(TOOLSET)" % outputs[0]) + self.WriteLn('%s: %s%s%s' % (pick_output, order_insert, ' '.join(inputs), + force_append)) + if actions: + for action in actions: + self.WriteLn('\t%s' % action) + if not order_only and len(outputs) > 1: + # If we have more than one output, a rule like + # foo bar: baz + # that for *each* output we must run the action, potentially + # in parallel. That is not what we're trying to write -- what + # we want is that we run the action once and it generates all + # the files. + # http://www.gnu.org/software/hello/manual/automake/Multiple-Outputs.html + # discusses this problem and has this solution: + # 1) Write the naive rule that would produce parallel runs of + # the action. + # 2) Make the outputs seralized on each other, so we won't start + # a parallel run until the first run finishes, at which point + # we'll have generated all the outputs and we're done. + self.WriteLn('%s: %s' % (' '.join(outputs[1:]), outputs[0])) + # Add a dummy command to the "extra outputs" rule, otherwise make seems to + # think these outputs haven't (couldn't have?) changed, and thus doesn't + # flag them as changed (i.e. include in '$?') when evaluating dependent + # rules, which in turn causes do_cmd() to skip running dependent commands. + self.WriteLn('%s: ;' % (' '.join(outputs[1:]))) + self.WriteLn() + + + def WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps): + """Write a set of LOCAL_XXX definitions for Android NDK. + + These variable definitions will be used by Android NDK but do nothing for + non-Android applications. + + Arguments: + module_name: Android NDK module name, which must be unique among all + module names. + all_sources: A list of source files (will be filtered by Compilable). + link_deps: A list of link dependencies, which must be sorted in + the order from dependencies to dependents. + """ + if self.type not in ('executable', 'shared_library', 'static_library'): + return + + self.WriteLn('# Variable definitions for Android applications') + self.WriteLn('include $(CLEAR_VARS)') + self.WriteLn('LOCAL_MODULE := ' + module_name) + self.WriteLn('LOCAL_CFLAGS := $(CFLAGS_$(BUILDTYPE)) ' + '$(DEFS_$(BUILDTYPE)) ' + # LOCAL_CFLAGS is applied to both of C and C++. There is + # no way to specify $(CFLAGS_C_$(BUILDTYPE)) only for C + # sources. + '$(CFLAGS_C_$(BUILDTYPE)) ' + # $(INCS_$(BUILDTYPE)) includes the prefix '-I' while + # LOCAL_C_INCLUDES does not expect it. So put it in + # LOCAL_CFLAGS. + '$(INCS_$(BUILDTYPE))') + # LOCAL_CXXFLAGS is obsolete and LOCAL_CPPFLAGS is preferred. + self.WriteLn('LOCAL_CPPFLAGS := $(CFLAGS_CC_$(BUILDTYPE))') + self.WriteLn('LOCAL_C_INCLUDES :=') + self.WriteLn('LOCAL_LDLIBS := $(LDFLAGS_$(BUILDTYPE)) $(LIBS)') + + # Detect the C++ extension. + cpp_ext = {'.cc': 0, '.cpp': 0, '.cxx': 0} + default_cpp_ext = '.cpp' + for filename in all_sources: + ext = os.path.splitext(filename)[1] + if ext in cpp_ext: + cpp_ext[ext] += 1 + if cpp_ext[ext] > cpp_ext[default_cpp_ext]: + default_cpp_ext = ext + self.WriteLn('LOCAL_CPP_EXTENSION := ' + default_cpp_ext) + + self.WriteList(map(self.Absolutify, filter(Compilable, all_sources)), + 'LOCAL_SRC_FILES') + + # Filter out those which do not match prefix and suffix and produce + # the resulting list without prefix and suffix. + def DepsToModules(deps, prefix, suffix): + modules = [] + for filepath in deps: + filename = os.path.basename(filepath) + if filename.startswith(prefix) and filename.endswith(suffix): + modules.append(filename[len(prefix):-len(suffix)]) + return modules + + # Retrieve the default value of 'SHARED_LIB_SUFFIX' + params = {'flavor': 'linux'} + default_variables = {} + CalculateVariables(default_variables, params) + + self.WriteList( + DepsToModules(link_deps, + generator_default_variables['SHARED_LIB_PREFIX'], + default_variables['SHARED_LIB_SUFFIX']), + 'LOCAL_SHARED_LIBRARIES') + self.WriteList( + DepsToModules(link_deps, + generator_default_variables['STATIC_LIB_PREFIX'], + generator_default_variables['STATIC_LIB_SUFFIX']), + 'LOCAL_STATIC_LIBRARIES') + + if self.type == 'executable': + self.WriteLn('include $(BUILD_EXECUTABLE)') + elif self.type == 'shared_library': + self.WriteLn('include $(BUILD_SHARED_LIBRARY)') + elif self.type == 'static_library': + self.WriteLn('include $(BUILD_STATIC_LIBRARY)') + self.WriteLn() + + + def WriteLn(self, text=''): + self.fp.write(text + '\n') + + + def GetSortedXcodeEnv(self, additional_settings=None): + return gyp.xcode_emulation.GetSortedXcodeEnv( + self.xcode_settings, "$(abs_builddir)", + os.path.join("$(abs_srcdir)", self.path), "$(BUILDTYPE)", + additional_settings) + + + def GetSortedXcodePostbuildEnv(self): + # CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack. + # TODO(thakis): It would be nice to have some general mechanism instead. + strip_save_file = self.xcode_settings.GetPerTargetSetting( + 'CHROMIUM_STRIP_SAVE_FILE', '') + # Even if strip_save_file is empty, explicitly write it. Else a postbuild + # might pick up an export from an earlier target. + return self.GetSortedXcodeEnv( + additional_settings={'CHROMIUM_STRIP_SAVE_FILE': strip_save_file}) + + + def WriteSortedXcodeEnv(self, target, env): + for k, v in env: + # For + # foo := a\ b + # the escaped space does the right thing. For + # export foo := a\ b + # it does not -- the backslash is written to the env as literal character. + # So don't escape spaces in |env[k]|. + self.WriteLn('%s: export %s := %s' % (QuoteSpaces(target), k, v)) + + + def Objectify(self, path): + """Convert a path to its output directory form.""" + if '$(' in path: + path = path.replace('$(obj)/', '$(obj).%s/$(TARGET)/' % self.toolset) + return path + return '$(obj).%s/$(TARGET)/%s' % (self.toolset, path) + + + def Pchify(self, path, lang): + """Convert a prefix header path to its output directory form.""" + path = self.Absolutify(path) + if '$(' in path: + path = path.replace('$(obj)/', '$(obj).%s/$(TARGET)/pch-%s' % + (self.toolset, lang)) + return path + return '$(obj).%s/$(TARGET)/pch-%s/%s' % (self.toolset, lang, path) + + + def Absolutify(self, path): + """Convert a subdirectory-relative path into a base-relative path. + Skips over paths that contain variables.""" + if '$(' in path: + # path is no existing file in this case, but calling normpath is still + # important for trimming trailing slashes. + return os.path.normpath(path) + return os.path.normpath(os.path.join(self.path, path)) + + + def ExpandInputRoot(self, template, expansion, dirname): + if '%(INPUT_ROOT)s' not in template and '%(INPUT_DIRNAME)s' not in template: + return template + path = template % { + 'INPUT_ROOT': expansion, + 'INPUT_DIRNAME': dirname, + } + return path + + + def _InstallableTargetInstallPath(self): + """Returns the location of the final output for an installable target.""" + # Xcode puts shared_library results into PRODUCT_DIR, and some gyp files + # rely on this. Emulate this behavior for mac. + if (self.type == 'shared_library' and + (self.flavor != 'mac' or self.toolset != 'target')): + # Install all shared libs into a common directory (per toolset) for + # convenient access with LD_LIBRARY_PATH. + return '$(builddir)/lib.%s/%s' % (self.toolset, self.alias) + return '$(builddir)/' + self.alias + + +def WriteAutoRegenerationRule(params, root_makefile, makefile_name, + build_files): + """Write the target to regenerate the Makefile.""" + options = params['options'] + build_files_args = [gyp.common.RelativePath(filename, options.toplevel_dir) + for filename in params['build_files_arg']] + gyp_binary = gyp.common.FixIfRelativePath(params['gyp_binary'], + options.toplevel_dir) + if not gyp_binary.startswith(os.sep): + gyp_binary = os.path.join('.', gyp_binary) + root_makefile.write( + "quiet_cmd_regen_makefile = ACTION Regenerating $@\n" + "cmd_regen_makefile = %(cmd)s\n" + "%(makefile_name)s: %(deps)s\n" + "\t$(call do_cmd,regen_makefile)\n\n" % { + 'makefile_name': makefile_name, + 'deps': ' '.join(map(Sourceify, build_files)), + 'cmd': gyp.common.EncodePOSIXShellList( + [gyp_binary, '-fmake'] + + gyp.RegenerateFlags(options) + + build_files_args)}) + + +def RunSystemTests(flavor): + """Run tests against the system to compute default settings for commands. + + Returns: + dictionary of settings matching the block of command-lines used in + SHARED_HEADER. E.g. the dictionary will contain a ARFLAGS.target + key for the default ARFLAGS for the target ar command. + """ + # Compute flags used for building static archives. + # N.B.: this fallback logic should match the logic in SHARED_HEADER. + # See comment there for more details. + ar_target = os.environ.get('AR.target', os.environ.get('AR', 'ar')) + cc_target = os.environ.get('CC.target', os.environ.get('CC', 'cc')) + arflags_target = 'crs' + # ar -T enables thin archives on Linux. OS X's ar supports a -T flag, but it + # does something useless (it limits filenames in the archive to 15 chars). + if flavor != 'mac' and gyp.system_test.TestArSupportsT(ar_command=ar_target, + cc_command=cc_target): + arflags_target = 'crsT' + + ar_host = os.environ.get('AR.host', 'ar') + cc_host = os.environ.get('CC.host', 'gcc') + arflags_host = 'crs' + # It feels redundant to compute this again given that most builds aren't + # cross-compiles, but due to quirks of history CC.host defaults to 'gcc' + # while CC.target defaults to 'cc', so the commands really are different + # even though they're nearly guaranteed to run the same code underneath. + if flavor != 'mac' and gyp.system_test.TestArSupportsT(ar_command=ar_host, + cc_command=cc_host): + arflags_host = 'crsT' + + return { 'ARFLAGS.target': arflags_target, + 'ARFLAGS.host': arflags_host } + + +def GenerateOutput(target_list, target_dicts, data, params): + options = params['options'] + flavor = gyp.common.GetFlavor(params) + generator_flags = params.get('generator_flags', {}) + builddir_name = generator_flags.get('output_dir', 'out') + android_ndk_version = generator_flags.get('android_ndk_version', None) + default_target = generator_flags.get('default_target', 'all') + + def CalculateMakefilePath(build_file, base_name): + """Determine where to write a Makefile for a given gyp file.""" + # Paths in gyp files are relative to the .gyp file, but we want + # paths relative to the source root for the master makefile. Grab + # the path of the .gyp file as the base to relativize against. + # E.g. "foo/bar" when we're constructing targets for "foo/bar/baz.gyp". + base_path = gyp.common.RelativePath(os.path.dirname(build_file), + options.depth) + # We write the file in the base_path directory. + output_file = os.path.join(options.depth, base_path, base_name) + if options.generator_output: + output_file = os.path.join(options.generator_output, output_file) + base_path = gyp.common.RelativePath(os.path.dirname(build_file), + options.toplevel_dir) + return base_path, output_file + + # TODO: search for the first non-'Default' target. This can go + # away when we add verification that all targets have the + # necessary configurations. + default_configuration = None + toolsets = set([target_dicts[target]['toolset'] for target in target_list]) + for target in target_list: + spec = target_dicts[target] + if spec['default_configuration'] != 'Default': + default_configuration = spec['default_configuration'] + break + if not default_configuration: + default_configuration = 'Default' + + srcdir = '.' + makefile_name = 'Makefile' + options.suffix + makefile_path = os.path.join(options.toplevel_dir, makefile_name) + if options.generator_output: + global srcdir_prefix + makefile_path = os.path.join(options.generator_output, makefile_path) + srcdir = gyp.common.RelativePath(srcdir, options.generator_output) + srcdir_prefix = '$(srcdir)/' + + flock_command= 'flock' + header_params = { + 'default_target': default_target, + 'builddir': builddir_name, + 'default_configuration': default_configuration, + 'flock': flock_command, + 'flock_index': 1, + 'link_commands': LINK_COMMANDS_LINUX, + 'extra_commands': '', + 'srcdir': srcdir, + } + if flavor == 'mac': + flock_command = './gyp-mac-tool flock' + header_params.update({ + 'flock': flock_command, + 'flock_index': 2, + 'link_commands': LINK_COMMANDS_MAC, + 'extra_commands': SHARED_HEADER_MAC_COMMANDS, + }) + elif flavor == 'android': + header_params.update({ + 'link_commands': LINK_COMMANDS_ANDROID, + }) + elif flavor == 'solaris': + header_params.update({ + 'flock': './gyp-sun-tool flock', + 'flock_index': 2, + 'extra_commands': SHARED_HEADER_SUN_COMMANDS, + }) + elif flavor == 'freebsd': + header_params.update({ + 'flock': 'lockf', + }) + header_params.update(RunSystemTests(flavor)) + + build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) + make_global_settings_dict = data[build_file].get('make_global_settings', {}) + make_global_settings = '' + for key, value in make_global_settings_dict: + if value[0] != '$': + value = '$(abspath %s)' % value + if key == 'LINK': + make_global_settings += ('%s ?= %s $(builddir)/linker.lock %s\n' % + (key, flock_command, value)) + elif key in ['CC', 'CXX']: + make_global_settings += ( + 'ifneq (,$(filter $(origin %s), undefined default))\n' % key) + # Let gyp-time envvars win over global settings. + if key in os.environ: + value = os.environ[key] + make_global_settings += ' %s = %s\n' % (key, value) + make_global_settings += 'endif\n' + else: + make_global_settings += '%s ?= %s\n' % (key, value) + header_params['make_global_settings'] = make_global_settings + + ensure_directory_exists(makefile_path) + root_makefile = open(makefile_path, 'w') + root_makefile.write(SHARED_HEADER % header_params) + # Currently any versions have the same effect, but in future the behavior + # could be different. + if android_ndk_version: + root_makefile.write( + '# Define LOCAL_PATH for build of Android applications.\n' + 'LOCAL_PATH := $(call my-dir)\n' + '\n') + for toolset in toolsets: + root_makefile.write('TOOLSET := %s\n' % toolset) + WriteRootHeaderSuffixRules(root_makefile) + + # Put build-time support tools next to the root Makefile. + dest_path = os.path.dirname(makefile_path) + gyp.common.CopyTool(flavor, dest_path) + + # Find the list of targets that derive from the gyp file(s) being built. + needed_targets = set() + for build_file in params['build_files']: + for target in gyp.common.AllTargets(target_list, target_dicts, build_file): + needed_targets.add(target) + + build_files = set() + include_list = set() + for qualified_target in target_list: + build_file, target, toolset = gyp.common.ParseQualifiedTarget( + qualified_target) + + this_make_global_settings = data[build_file].get('make_global_settings', {}) + assert make_global_settings_dict == this_make_global_settings, ( + "make_global_settings needs to be the same for all targets.") + + build_files.add(gyp.common.RelativePath(build_file, options.toplevel_dir)) + included_files = data[build_file]['included_files'] + for included_file in included_files: + # The included_files entries are relative to the dir of the build file + # that included them, so we have to undo that and then make them relative + # to the root dir. + relative_include_file = gyp.common.RelativePath( + gyp.common.UnrelativePath(included_file, build_file), + options.toplevel_dir) + abs_include_file = os.path.abspath(relative_include_file) + # If the include file is from the ~/.gyp dir, we should use absolute path + # so that relocating the src dir doesn't break the path. + if (params['home_dot_gyp'] and + abs_include_file.startswith(params['home_dot_gyp'])): + build_files.add(abs_include_file) + else: + build_files.add(relative_include_file) + + base_path, output_file = CalculateMakefilePath(build_file, + target + '.' + toolset + options.suffix + '.mk') + + spec = target_dicts[qualified_target] + configs = spec['configurations'] + + if flavor == 'mac': + gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[build_file], spec) + + writer = MakefileWriter(generator_flags, flavor) + writer.Write(qualified_target, base_path, output_file, spec, configs, + part_of_all=qualified_target in needed_targets) + + # Our root_makefile lives at the source root. Compute the relative path + # from there to the output_file for including. + mkfile_rel_path = gyp.common.RelativePath(output_file, + os.path.dirname(makefile_path)) + include_list.add(mkfile_rel_path) + + # Write out per-gyp (sub-project) Makefiles. + depth_rel_path = gyp.common.RelativePath(options.depth, os.getcwd()) + for build_file in build_files: + # The paths in build_files were relativized above, so undo that before + # testing against the non-relativized items in target_list and before + # calculating the Makefile path. + build_file = os.path.join(depth_rel_path, build_file) + gyp_targets = [target_dicts[target]['target_name'] for target in target_list + if target.startswith(build_file) and + target in needed_targets] + # Only generate Makefiles for gyp files with targets. + if not gyp_targets: + continue + base_path, output_file = CalculateMakefilePath(build_file, + os.path.splitext(os.path.basename(build_file))[0] + '.Makefile') + makefile_rel_path = gyp.common.RelativePath(os.path.dirname(makefile_path), + os.path.dirname(output_file)) + writer.WriteSubMake(output_file, makefile_rel_path, gyp_targets, + builddir_name) + + + # Write out the sorted list of includes. + root_makefile.write('\n') + for include_file in sorted(include_list): + # We wrap each .mk include in an if statement so users can tell make to + # not load a file by setting NO_LOAD. The below make code says, only + # load the .mk file if the .mk filename doesn't start with a token in + # NO_LOAD. + root_makefile.write( + "ifeq ($(strip $(foreach prefix,$(NO_LOAD),\\\n" + " $(findstring $(join ^,$(prefix)),\\\n" + " $(join ^," + include_file + ")))),)\n") + root_makefile.write(" include " + include_file + "\n") + root_makefile.write("endif\n") + root_makefile.write('\n') + + if generator_flags.get('auto_regeneration', True): + WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) + + root_makefile.write(SHARED_FOOTER) + + root_makefile.close() diff --git a/tools/gyp/pylib/gyp/generator/msvs.py b/tools/gyp/pylib/gyp/generator/msvs.py new file mode 100644 index 000000000..cca04e14a --- /dev/null +++ b/tools/gyp/pylib/gyp/generator/msvs.py @@ -0,0 +1,3126 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import copy +import ntpath +import os +import posixpath +import re +import subprocess +import sys + +import gyp.common +import gyp.easy_xml as easy_xml +import gyp.MSVSNew as MSVSNew +import gyp.MSVSProject as MSVSProject +import gyp.MSVSSettings as MSVSSettings +import gyp.MSVSToolFile as MSVSToolFile +import gyp.MSVSUserFile as MSVSUserFile +import gyp.MSVSVersion as MSVSVersion + + +# Regular expression for validating Visual Studio GUIDs. If the GUID +# contains lowercase hex letters, MSVS will be fine. However, +# IncrediBuild BuildConsole will parse the solution file, but then +# silently skip building the target causing hard to track down errors. +# Note that this only happens with the BuildConsole, and does not occur +# if IncrediBuild is executed from inside Visual Studio. This regex +# validates that the string looks like a GUID with all uppercase hex +# letters. +VALID_MSVS_GUID_CHARS = re.compile('^[A-F0-9\-]+$') + + +generator_default_variables = { + 'EXECUTABLE_PREFIX': '', + 'EXECUTABLE_SUFFIX': '.exe', + 'STATIC_LIB_PREFIX': '', + 'SHARED_LIB_PREFIX': '', + 'STATIC_LIB_SUFFIX': '.lib', + 'SHARED_LIB_SUFFIX': '.dll', + 'INTERMEDIATE_DIR': '$(IntDir)', + 'SHARED_INTERMEDIATE_DIR': '$(OutDir)/obj/global_intermediate', + 'OS': 'win', + 'PRODUCT_DIR': '$(OutDir)', + 'LIB_DIR': '$(OutDir)\\lib', + 'RULE_INPUT_ROOT': '$(InputName)', + 'RULE_INPUT_DIRNAME': '$(InputDir)', + 'RULE_INPUT_EXT': '$(InputExt)', + 'RULE_INPUT_NAME': '$(InputFileName)', + 'RULE_INPUT_PATH': '$(InputPath)', + 'CONFIGURATION_NAME': '$(ConfigurationName)', +} + + +# The msvs specific sections that hold paths +generator_additional_path_sections = [ + 'msvs_cygwin_dirs', + 'msvs_props', +] + + +generator_additional_non_configuration_keys = [ + 'msvs_cygwin_dirs', + 'msvs_cygwin_shell', + 'msvs_shard', +] + + +# List of precompiled header related keys. +precomp_keys = [ + 'msvs_precompiled_header', + 'msvs_precompiled_source', +] + + +cached_username = None + + +cached_domain = None + + +# TODO(gspencer): Switch the os.environ calls to be +# win32api.GetDomainName() and win32api.GetUserName() once the +# python version in depot_tools has been updated to work on Vista +# 64-bit. +def _GetDomainAndUserName(): + if sys.platform not in ('win32', 'cygwin'): + return ('DOMAIN', 'USERNAME') + global cached_username + global cached_domain + if not cached_domain or not cached_username: + domain = os.environ.get('USERDOMAIN') + username = os.environ.get('USERNAME') + if not domain or not username: + call = subprocess.Popen(['net', 'config', 'Workstation'], + stdout=subprocess.PIPE) + config = call.communicate()[0] + username_re = re.compile('^User name\s+(\S+)', re.MULTILINE) + username_match = username_re.search(config) + if username_match: + username = username_match.group(1) + domain_re = re.compile('^Logon domain\s+(\S+)', re.MULTILINE) + domain_match = domain_re.search(config) + if domain_match: + domain = domain_match.group(1) + cached_domain = domain + cached_username = username + return (cached_domain, cached_username) + +fixpath_prefix = None + + +def _NormalizedSource(source): + """Normalize the path. + + But not if that gets rid of a variable, as this may expand to something + larger than one directory. + + Arguments: + source: The path to be normalize.d + + Returns: + The normalized path. + """ + normalized = os.path.normpath(source) + if source.count('$') == normalized.count('$'): + source = normalized + return source + + +def _FixPath(path): + """Convert paths to a form that will make sense in a vcproj file. + + Arguments: + path: The path to convert, may contain / etc. + Returns: + The path with all slashes made into backslashes. + """ + if fixpath_prefix and path and not os.path.isabs(path) and not path[0] == '$': + path = os.path.join(fixpath_prefix, path) + path = path.replace('/', '\\') + path = _NormalizedSource(path) + if path and path[-1] == '\\': + path = path[:-1] + return path + + +def _FixPaths(paths): + """Fix each of the paths of the list.""" + return [_FixPath(i) for i in paths] + + +def _ConvertSourcesToFilterHierarchy(sources, prefix=None, excluded=None, + list_excluded=True): + """Converts a list split source file paths into a vcproj folder hierarchy. + + Arguments: + sources: A list of source file paths split. + prefix: A list of source file path layers meant to apply to each of sources. + excluded: A set of excluded files. + + Returns: + A hierarchy of filenames and MSVSProject.Filter objects that matches the + layout of the source tree. + For example: + _ConvertSourcesToFilterHierarchy([['a', 'bob1.c'], ['b', 'bob2.c']], + prefix=['joe']) + --> + [MSVSProject.Filter('a', contents=['joe\\a\\bob1.c']), + MSVSProject.Filter('b', contents=['joe\\b\\bob2.c'])] + """ + if not prefix: prefix = [] + result = [] + excluded_result = [] + folders = dict() + # Gather files into the final result, excluded, or folders. + for s in sources: + if len(s) == 1: + filename = _NormalizedSource('\\'.join(prefix + s)) + if filename in excluded: + excluded_result.append(filename) + else: + result.append(filename) + else: + if not folders.get(s[0]): + folders[s[0]] = [] + folders[s[0]].append(s[1:]) + # Add a folder for excluded files. + if excluded_result and list_excluded: + excluded_folder = MSVSProject.Filter('_excluded_files', + contents=excluded_result) + result.append(excluded_folder) + # Populate all the folders. + for f in folders: + contents = _ConvertSourcesToFilterHierarchy(folders[f], prefix=prefix + [f], + excluded=excluded, + list_excluded=list_excluded) + contents = MSVSProject.Filter(f, contents=contents) + result.append(contents) + + return result + + +def _ToolAppend(tools, tool_name, setting, value, only_if_unset=False): + if not value: return + # TODO(bradnelson): ugly hack, fix this more generally!!! + if 'Directories' in setting or 'Dependencies' in setting: + if type(value) == str: + value = value.replace('/', '\\') + else: + value = [i.replace('/', '\\') for i in value] + if not tools.get(tool_name): + tools[tool_name] = dict() + tool = tools[tool_name] + if tool.get(setting): + if only_if_unset: return + if type(tool[setting]) == list: + tool[setting] += value + else: + raise TypeError( + 'Appending "%s" to a non-list setting "%s" for tool "%s" is ' + 'not allowed, previous value: %s' % ( + value, setting, tool_name, str(tool[setting]))) + else: + tool[setting] = value + + +def _ConfigPlatform(config_data): + return config_data.get('msvs_configuration_platform', 'Win32') + + +def _ConfigBaseName(config_name, platform_name): + if config_name.endswith('_' + platform_name): + return config_name[0:-len(platform_name)-1] + else: + return config_name + + +def _ConfigFullName(config_name, config_data): + platform_name = _ConfigPlatform(config_data) + return '%s|%s' % (_ConfigBaseName(config_name, platform_name), platform_name) + + +def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path, + quote_cmd, do_setup_env): + + if [x for x in cmd if '$(InputDir)' in x]: + input_dir_preamble = ( + 'set INPUTDIR=$(InputDir)\n' + 'set INPUTDIR=%INPUTDIR:$(ProjectDir)=%\n' + 'set INPUTDIR=%INPUTDIR:~0,-1%\n' + ) + else: + input_dir_preamble = '' + + if cygwin_shell: + # Find path to cygwin. + cygwin_dir = _FixPath(spec.get('msvs_cygwin_dirs', ['.'])[0]) + # Prepare command. + direct_cmd = cmd + direct_cmd = [i.replace('$(IntDir)', + '`cygpath -m "${INTDIR}"`') for i in direct_cmd] + direct_cmd = [i.replace('$(OutDir)', + '`cygpath -m "${OUTDIR}"`') for i in direct_cmd] + direct_cmd = [i.replace('$(InputDir)', + '`cygpath -m "${INPUTDIR}"`') for i in direct_cmd] + if has_input_path: + direct_cmd = [i.replace('$(InputPath)', + '`cygpath -m "${INPUTPATH}"`') + for i in direct_cmd] + direct_cmd = ['"%s"' % i for i in direct_cmd] + direct_cmd = [i.replace('"', '\\"') for i in direct_cmd] + #direct_cmd = gyp.common.EncodePOSIXShellList(direct_cmd) + direct_cmd = ' '.join(direct_cmd) + # TODO(quote): regularize quoting path names throughout the module + cmd = '' + if do_setup_env: + cmd += 'call "$(ProjectDir)%(cygwin_dir)s\\setup_env.bat" && ' + cmd += 'set CYGWIN=nontsec&& ' + if direct_cmd.find('NUMBER_OF_PROCESSORS') >= 0: + cmd += 'set /a NUMBER_OF_PROCESSORS_PLUS_1=%%NUMBER_OF_PROCESSORS%%+1&& ' + if direct_cmd.find('INTDIR') >= 0: + cmd += 'set INTDIR=$(IntDir)&& ' + if direct_cmd.find('OUTDIR') >= 0: + cmd += 'set OUTDIR=$(OutDir)&& ' + if has_input_path and direct_cmd.find('INPUTPATH') >= 0: + cmd += 'set INPUTPATH=$(InputPath) && ' + cmd += 'bash -c "%(cmd)s"' + cmd = cmd % {'cygwin_dir': cygwin_dir, + 'cmd': direct_cmd} + return input_dir_preamble + cmd + else: + # Convert cat --> type to mimic unix. + if cmd[0] == 'cat': + command = ['type'] + else: + command = [cmd[0].replace('/', '\\')] + # Fix the paths + # If the argument starts with a slash, it's probably a command line switch + arguments = [i.startswith('/') and i or _FixPath(i) for i in cmd[1:]] + arguments = [i.replace('$(InputDir)','%INPUTDIR%') for i in arguments] + if quote_cmd: + # Support a mode for using cmd directly. + # Convert any paths to native form (first element is used directly). + # TODO(quote): regularize quoting path names throughout the module + arguments = ['"%s"' % i for i in arguments] + # Collapse into a single command. + return input_dir_preamble + ' '.join(command + arguments) + + +def _BuildCommandLineForRule(spec, rule, has_input_path, do_setup_env): + # Currently this weird argument munging is used to duplicate the way a + # python script would need to be run as part of the chrome tree. + # Eventually we should add some sort of rule_default option to set this + # per project. For now the behavior chrome needs is the default. + mcs = rule.get('msvs_cygwin_shell') + if mcs is None: + mcs = int(spec.get('msvs_cygwin_shell', 1)) + elif isinstance(mcs, str): + mcs = int(mcs) + quote_cmd = int(rule.get('msvs_quote_cmd', 1)) + return _BuildCommandLineForRuleRaw(spec, rule['action'], mcs, has_input_path, + quote_cmd, do_setup_env=do_setup_env) + + +def _AddActionStep(actions_dict, inputs, outputs, description, command): + """Merge action into an existing list of actions. + + Care must be taken so that actions which have overlapping inputs either don't + get assigned to the same input, or get collapsed into one. + + Arguments: + actions_dict: dictionary keyed on input name, which maps to a list of + dicts describing the actions attached to that input file. + inputs: list of inputs + outputs: list of outputs + description: description of the action + command: command line to execute + """ + # Require there to be at least one input (call sites will ensure this). + assert inputs + + action = { + 'inputs': inputs, + 'outputs': outputs, + 'description': description, + 'command': command, + } + + # Pick where to stick this action. + # While less than optimal in terms of build time, attach them to the first + # input for now. + chosen_input = inputs[0] + + # Add it there. + if chosen_input not in actions_dict: + actions_dict[chosen_input] = [] + actions_dict[chosen_input].append(action) + + +def _AddCustomBuildToolForMSVS(p, spec, primary_input, + inputs, outputs, description, cmd): + """Add a custom build tool to execute something. + + Arguments: + p: the target project + spec: the target project dict + primary_input: input file to attach the build tool to + inputs: list of inputs + outputs: list of outputs + description: description of the action + cmd: command line to execute + """ + inputs = _FixPaths(inputs) + outputs = _FixPaths(outputs) + tool = MSVSProject.Tool( + 'VCCustomBuildTool', + {'Description': description, + 'AdditionalDependencies': ';'.join(inputs), + 'Outputs': ';'.join(outputs), + 'CommandLine': cmd, + }) + # Add to the properties of primary input for each config. + for config_name, c_data in spec['configurations'].iteritems(): + p.AddFileConfig(_FixPath(primary_input), + _ConfigFullName(config_name, c_data), tools=[tool]) + + +def _AddAccumulatedActionsToMSVS(p, spec, actions_dict): + """Add actions accumulated into an actions_dict, merging as needed. + + Arguments: + p: the target project + spec: the target project dict + actions_dict: dictionary keyed on input name, which maps to a list of + dicts describing the actions attached to that input file. + """ + for primary_input in actions_dict: + inputs = set() + outputs = set() + descriptions = [] + commands = [] + for action in actions_dict[primary_input]: + inputs.update(set(action['inputs'])) + outputs.update(set(action['outputs'])) + descriptions.append(action['description']) + commands.append(action['command']) + # Add the custom build step for one input file. + description = ', and also '.join(descriptions) + command = '\r\n'.join(commands) + _AddCustomBuildToolForMSVS(p, spec, + primary_input=primary_input, + inputs=inputs, + outputs=outputs, + description=description, + cmd=command) + + +def _RuleExpandPath(path, input_file): + """Given the input file to which a rule applied, string substitute a path. + + Arguments: + path: a path to string expand + input_file: the file to which the rule applied. + Returns: + The string substituted path. + """ + path = path.replace('$(InputName)', + os.path.splitext(os.path.split(input_file)[1])[0]) + path = path.replace('$(InputDir)', os.path.dirname(input_file)) + path = path.replace('$(InputExt)', + os.path.splitext(os.path.split(input_file)[1])[1]) + path = path.replace('$(InputFileName)', os.path.split(input_file)[1]) + path = path.replace('$(InputPath)', input_file) + return path + + +def _FindRuleTriggerFiles(rule, sources): + """Find the list of files which a particular rule applies to. + + Arguments: + rule: the rule in question + sources: the set of all known source files for this project + Returns: + The list of sources that trigger a particular rule. + """ + rule_ext = rule['extension'] + return [s for s in sources if s.endswith('.' + rule_ext)] + + +def _RuleInputsAndOutputs(rule, trigger_file): + """Find the inputs and outputs generated by a rule. + + Arguments: + rule: the rule in question. + trigger_file: the main trigger for this rule. + Returns: + The pair of (inputs, outputs) involved in this rule. + """ + raw_inputs = _FixPaths(rule.get('inputs', [])) + raw_outputs = _FixPaths(rule.get('outputs', [])) + inputs = set() + outputs = set() + inputs.add(trigger_file) + for i in raw_inputs: + inputs.add(_RuleExpandPath(i, trigger_file)) + for o in raw_outputs: + outputs.add(_RuleExpandPath(o, trigger_file)) + return (inputs, outputs) + + +def _GenerateNativeRulesForMSVS(p, rules, output_dir, spec, options): + """Generate a native rules file. + + Arguments: + p: the target project + rules: the set of rules to include + output_dir: the directory in which the project/gyp resides + spec: the project dict + options: global generator options + """ + rules_filename = '%s%s.rules' % (spec['target_name'], + options.suffix) + rules_file = MSVSToolFile.Writer(os.path.join(output_dir, rules_filename), + spec['target_name']) + # Add each rule. + for r in rules: + rule_name = r['rule_name'] + rule_ext = r['extension'] + inputs = _FixPaths(r.get('inputs', [])) + outputs = _FixPaths(r.get('outputs', [])) + # Skip a rule with no action and no inputs. + if 'action' not in r and not r.get('rule_sources', []): + continue + cmd = _BuildCommandLineForRule(spec, r, has_input_path=True, + do_setup_env=True) + rules_file.AddCustomBuildRule(name=rule_name, + description=r.get('message', rule_name), + extensions=[rule_ext], + additional_dependencies=inputs, + outputs=outputs, + cmd=cmd) + # Write out rules file. + rules_file.WriteIfChanged() + + # Add rules file to project. + p.AddToolFile(rules_filename) + + +def _Cygwinify(path): + path = path.replace('$(OutDir)', '$(OutDirCygwin)') + path = path.replace('$(IntDir)', '$(IntDirCygwin)') + return path + + +def _GenerateExternalRules(rules, output_dir, spec, + sources, options, actions_to_add): + """Generate an external makefile to do a set of rules. + + Arguments: + rules: the list of rules to include + output_dir: path containing project and gyp files + spec: project specification data + sources: set of sources known + options: global generator options + actions_to_add: The list of actions we will add to. + """ + filename = '%s_rules%s.mk' % (spec['target_name'], options.suffix) + mk_file = gyp.common.WriteOnDiff(os.path.join(output_dir, filename)) + # Find cygwin style versions of some paths. + mk_file.write('OutDirCygwin:=$(shell cygpath -u "$(OutDir)")\n') + mk_file.write('IntDirCygwin:=$(shell cygpath -u "$(IntDir)")\n') + # Gather stuff needed to emit all: target. + all_inputs = set() + all_outputs = set() + all_output_dirs = set() + first_outputs = [] + for rule in rules: + trigger_files = _FindRuleTriggerFiles(rule, sources) + for tf in trigger_files: + inputs, outputs = _RuleInputsAndOutputs(rule, tf) + all_inputs.update(set(inputs)) + all_outputs.update(set(outputs)) + # Only use one target from each rule as the dependency for + # 'all' so we don't try to build each rule multiple times. + first_outputs.append(list(outputs)[0]) + # Get the unique output directories for this rule. + output_dirs = [os.path.split(i)[0] for i in outputs] + for od in output_dirs: + all_output_dirs.add(od) + first_outputs_cyg = [_Cygwinify(i) for i in first_outputs] + # Write out all: target, including mkdir for each output directory. + mk_file.write('all: %s\n' % ' '.join(first_outputs_cyg)) + for od in all_output_dirs: + if od: + mk_file.write('\tmkdir -p `cygpath -u "%s"`\n' % od) + mk_file.write('\n') + # Define how each output is generated. + for rule in rules: + trigger_files = _FindRuleTriggerFiles(rule, sources) + for tf in trigger_files: + # Get all the inputs and outputs for this rule for this trigger file. + inputs, outputs = _RuleInputsAndOutputs(rule, tf) + inputs = [_Cygwinify(i) for i in inputs] + outputs = [_Cygwinify(i) for i in outputs] + # Prepare the command line for this rule. + cmd = [_RuleExpandPath(c, tf) for c in rule['action']] + cmd = ['"%s"' % i for i in cmd] + cmd = ' '.join(cmd) + # Add it to the makefile. + mk_file.write('%s: %s\n' % (' '.join(outputs), ' '.join(inputs))) + mk_file.write('\t%s\n\n' % cmd) + # Close up the file. + mk_file.close() + + # Add makefile to list of sources. + sources.add(filename) + # Add a build action to call makefile. + cmd = ['make', + 'OutDir=$(OutDir)', + 'IntDir=$(IntDir)', + '-j', '${NUMBER_OF_PROCESSORS_PLUS_1}', + '-f', filename] + cmd = _BuildCommandLineForRuleRaw(spec, cmd, True, False, True, True) + # Insert makefile as 0'th input, so it gets the action attached there, + # as this is easier to understand from in the IDE. + all_inputs = list(all_inputs) + all_inputs.insert(0, filename) + _AddActionStep(actions_to_add, + inputs=_FixPaths(all_inputs), + outputs=_FixPaths(all_outputs), + description='Running external rules for %s' % + spec['target_name'], + command=cmd) + + +def _EscapeEnvironmentVariableExpansion(s): + """Escapes % characters. + + Escapes any % characters so that Windows-style environment variable + expansions will leave them alone. + See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d-name-text-containing-percentage-characters-doesnt-compile + to understand why we have to do this. + + Args: + s: The string to be escaped. + + Returns: + The escaped string. + """ + s = s.replace('%', '%%') + return s + + +quote_replacer_regex = re.compile(r'(\\*)"') + + +def _EscapeCommandLineArgumentForMSVS(s): + """Escapes a Windows command-line argument. + + So that the Win32 CommandLineToArgv function will turn the escaped result back + into the original string. + See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx + ("Parsing C++ Command-Line Arguments") to understand why we have to do + this. + + Args: + s: the string to be escaped. + Returns: + the escaped string. + """ + + def _Replace(match): + # For a literal quote, CommandLineToArgv requires an odd number of + # backslashes preceding it, and it produces half as many literal backslashes + # (rounded down). So we need to produce 2n+1 backslashes. + return 2 * match.group(1) + '\\"' + + # Escape all quotes so that they are interpreted literally. + s = quote_replacer_regex.sub(_Replace, s) + # Now add unescaped quotes so that any whitespace is interpreted literally. + s = '"' + s + '"' + return s + + +delimiters_replacer_regex = re.compile(r'(\\*)([,;]+)') + + +def _EscapeVCProjCommandLineArgListItem(s): + """Escapes command line arguments for MSVS. + + The VCProj format stores string lists in a single string using commas and + semi-colons as separators, which must be quoted if they are to be + interpreted literally. However, command-line arguments may already have + quotes, and the VCProj parser is ignorant of the backslash escaping + convention used by CommandLineToArgv, so the command-line quotes and the + VCProj quotes may not be the same quotes. So to store a general + command-line argument in a VCProj list, we need to parse the existing + quoting according to VCProj's convention and quote any delimiters that are + not already quoted by that convention. The quotes that we add will also be + seen by CommandLineToArgv, so if backslashes precede them then we also have + to escape those backslashes according to the CommandLineToArgv + convention. + + Args: + s: the string to be escaped. + Returns: + the escaped string. + """ + + def _Replace(match): + # For a non-literal quote, CommandLineToArgv requires an even number of + # backslashes preceding it, and it produces half as many literal + # backslashes. So we need to produce 2n backslashes. + return 2 * match.group(1) + '"' + match.group(2) + '"' + + segments = s.split('"') + # The unquoted segments are at the even-numbered indices. + for i in range(0, len(segments), 2): + segments[i] = delimiters_replacer_regex.sub(_Replace, segments[i]) + # Concatenate back into a single string + s = '"'.join(segments) + if len(segments) % 2 == 0: + # String ends while still quoted according to VCProj's convention. This + # means the delimiter and the next list item that follow this one in the + # .vcproj file will be misinterpreted as part of this item. There is nothing + # we can do about this. Adding an extra quote would correct the problem in + # the VCProj but cause the same problem on the final command-line. Moving + # the item to the end of the list does works, but that's only possible if + # there's only one such item. Let's just warn the user. + print >> sys.stderr, ('Warning: MSVS may misinterpret the odd number of ' + + 'quotes in ' + s) + return s + + +def _EscapeCppDefineForMSVS(s): + """Escapes a CPP define so that it will reach the compiler unaltered.""" + s = _EscapeEnvironmentVariableExpansion(s) + s = _EscapeCommandLineArgumentForMSVS(s) + s = _EscapeVCProjCommandLineArgListItem(s) + # cl.exe replaces literal # characters with = in preprocesor definitions for + # some reason. Octal-encode to work around that. + s = s.replace('#', '\\%03o' % ord('#')) + return s + + +quote_replacer_regex2 = re.compile(r'(\\+)"') + + +def _EscapeCommandLineArgumentForMSBuild(s): + """Escapes a Windows command-line argument for use by MSBuild.""" + + def _Replace(match): + return (len(match.group(1))/2*4)*'\\' + '\\"' + + # Escape all quotes so that they are interpreted literally. + s = quote_replacer_regex2.sub(_Replace, s) + return s + + +def _EscapeMSBuildSpecialCharacters(s): + escape_dictionary = { + '%': '%25', + '$': '%24', + '@': '%40', + "'": '%27', + ';': '%3B', + '?': '%3F', + '*': '%2A' + } + result = ''.join([escape_dictionary.get(c, c) for c in s]) + return result + + +def _EscapeCppDefineForMSBuild(s): + """Escapes a CPP define so that it will reach the compiler unaltered.""" + s = _EscapeEnvironmentVariableExpansion(s) + s = _EscapeCommandLineArgumentForMSBuild(s) + s = _EscapeMSBuildSpecialCharacters(s) + # cl.exe replaces literal # characters with = in preprocesor definitions for + # some reason. Octal-encode to work around that. + s = s.replace('#', '\\%03o' % ord('#')) + return s + + +def _GenerateRulesForMSVS(p, output_dir, options, spec, + sources, excluded_sources, + actions_to_add): + """Generate all the rules for a particular project. + + Arguments: + p: the project + output_dir: directory to emit rules to + options: global options passed to the generator + spec: the specification for this project + sources: the set of all known source files in this project + excluded_sources: the set of sources excluded from normal processing + actions_to_add: deferred list of actions to add in + """ + rules = spec.get('rules', []) + rules_native = [r for r in rules if not int(r.get('msvs_external_rule', 0))] + rules_external = [r for r in rules if int(r.get('msvs_external_rule', 0))] + + # Handle rules that use a native rules file. + if rules_native: + _GenerateNativeRulesForMSVS(p, rules_native, output_dir, spec, options) + + # Handle external rules (non-native rules). + if rules_external: + _GenerateExternalRules(rules_external, output_dir, spec, + sources, options, actions_to_add) + _AdjustSourcesForRules(rules, sources, excluded_sources) + + +def _AdjustSourcesForRules(rules, sources, excluded_sources): + # Add outputs generated by each rule (if applicable). + for rule in rules: + # Done if not processing outputs as sources. + if int(rule.get('process_outputs_as_sources', False)): + # Add in the outputs from this rule. + trigger_files = _FindRuleTriggerFiles(rule, sources) + for trigger_file in trigger_files: + inputs, outputs = _RuleInputsAndOutputs(rule, trigger_file) + inputs = set(_FixPaths(inputs)) + outputs = set(_FixPaths(outputs)) + inputs.remove(_FixPath(trigger_file)) + sources.update(inputs) + excluded_sources.update(inputs) + sources.update(outputs) + + +def _FilterActionsFromExcluded(excluded_sources, actions_to_add): + """Take inputs with actions attached out of the list of exclusions. + + Arguments: + excluded_sources: list of source files not to be built. + actions_to_add: dict of actions keyed on source file they're attached to. + Returns: + excluded_sources with files that have actions attached removed. + """ + must_keep = set(_FixPaths(actions_to_add.keys())) + return [s for s in excluded_sources if s not in must_keep] + + +def _GetDefaultConfiguration(spec): + return spec['configurations'][spec['default_configuration']] + + +def _GetGuidOfProject(proj_path, spec): + """Get the guid for the project. + + Arguments: + proj_path: Path of the vcproj or vcxproj file to generate. + spec: The target dictionary containing the properties of the target. + Returns: + the guid. + Raises: + ValueError: if the specified GUID is invalid. + """ + # Pluck out the default configuration. + default_config = _GetDefaultConfiguration(spec) + # Decide the guid of the project. + guid = default_config.get('msvs_guid') + if guid: + if VALID_MSVS_GUID_CHARS.match(guid) is None: + raise ValueError('Invalid MSVS guid: "%s". Must match regex: "%s".' % + (guid, VALID_MSVS_GUID_CHARS.pattern)) + guid = '{%s}' % guid + guid = guid or MSVSNew.MakeGuid(proj_path) + return guid + + +def _GetMsbuildToolsetOfProject(proj_path, spec): + """Get the platform toolset for the project. + + Arguments: + proj_path: Path of the vcproj or vcxproj file to generate. + spec: The target dictionary containing the properties of the target. + Returns: + the platform toolset string or None. + """ + # Pluck out the default configuration. + default_config = _GetDefaultConfiguration(spec) + return default_config.get('msbuild_toolset') + + +def _GenerateProject(project, options, version, generator_flags): + """Generates a vcproj file. + + Arguments: + project: the MSVSProject object. + options: global generator options. + version: the MSVSVersion object. + generator_flags: dict of generator-specific flags. + Returns: + A list of source files that cannot be found on disk. + """ + default_config = _GetDefaultConfiguration(project.spec) + + # Skip emitting anything if told to with msvs_existing_vcproj option. + if default_config.get('msvs_existing_vcproj'): + return [] + + if version.UsesVcxproj(): + return _GenerateMSBuildProject(project, options, version, generator_flags) + else: + return _GenerateMSVSProject(project, options, version, generator_flags) + + +def _GenerateMSVSProject(project, options, version, generator_flags): + """Generates a .vcproj file. It may create .rules and .user files too. + + Arguments: + project: The project object we will generate the file for. + options: Global options passed to the generator. + version: The VisualStudioVersion object. + generator_flags: dict of generator-specific flags. + """ + spec = project.spec + vcproj_dir = os.path.dirname(project.path) + if vcproj_dir and not os.path.exists(vcproj_dir): + os.makedirs(vcproj_dir) + + platforms = _GetUniquePlatforms(spec) + p = MSVSProject.Writer(project.path, version, spec['target_name'], + project.guid, platforms) + + # Get directory project file is in. + project_dir = os.path.split(project.path)[0] + gyp_path = _NormalizedSource(project.build_file) + relative_path_of_gyp_file = gyp.common.RelativePath(gyp_path, project_dir) + + config_type = _GetMSVSConfigurationType(spec, project.build_file) + for config_name, config in spec['configurations'].iteritems(): + _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config) + + # Prepare list of sources and excluded sources. + gyp_file = os.path.split(project.build_file)[1] + sources, excluded_sources = _PrepareListOfSources(spec, gyp_file) + + # Add rules. + actions_to_add = {} + _GenerateRulesForMSVS(p, project_dir, options, spec, + sources, excluded_sources, + actions_to_add) + list_excluded = generator_flags.get('msvs_list_excluded_files', True) + sources, excluded_sources, excluded_idl = ( + _AdjustSourcesAndConvertToFilterHierarchy( + spec, options, project_dir, sources, excluded_sources, list_excluded)) + + # Add in files. + missing_sources = _VerifySourcesExist(sources, project_dir) + p.AddFiles(sources) + + _AddToolFilesToMSVS(p, spec) + _HandlePreCompiledHeaders(p, sources, spec) + _AddActions(actions_to_add, spec, relative_path_of_gyp_file) + _AddCopies(actions_to_add, spec) + _WriteMSVSUserFile(project.path, version, spec) + + # NOTE: this stanza must appear after all actions have been decided. + # Don't excluded sources with actions attached, or they won't run. + excluded_sources = _FilterActionsFromExcluded( + excluded_sources, actions_to_add) + _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl, + list_excluded) + _AddAccumulatedActionsToMSVS(p, spec, actions_to_add) + + # Write it out. + p.WriteIfChanged() + + return missing_sources + + +def _GetUniquePlatforms(spec): + """Returns the list of unique platforms for this spec, e.g ['win32', ...]. + + Arguments: + spec: The target dictionary containing the properties of the target. + Returns: + The MSVSUserFile object created. + """ + # Gather list of unique platforms. + platforms = set() + for configuration in spec['configurations']: + platforms.add(_ConfigPlatform(spec['configurations'][configuration])) + platforms = list(platforms) + return platforms + + +def _CreateMSVSUserFile(proj_path, version, spec): + """Generates a .user file for the user running this Gyp program. + + Arguments: + proj_path: The path of the project file being created. The .user file + shares the same path (with an appropriate suffix). + version: The VisualStudioVersion object. + spec: The target dictionary containing the properties of the target. + Returns: + The MSVSUserFile object created. + """ + (domain, username) = _GetDomainAndUserName() + vcuser_filename = '.'.join([proj_path, domain, username, 'user']) + user_file = MSVSUserFile.Writer(vcuser_filename, version, + spec['target_name']) + return user_file + + +def _GetMSVSConfigurationType(spec, build_file): + """Returns the configuration type for this project. + + It's a number defined by Microsoft. May raise an exception. + + Args: + spec: The target dictionary containing the properties of the target. + build_file: The path of the gyp file. + Returns: + An integer, the configuration type. + """ + try: + config_type = { + 'executable': '1', # .exe + 'shared_library': '2', # .dll + 'loadable_module': '2', # .dll + 'static_library': '4', # .lib + 'none': '10', # Utility type + }[spec['type']] + except KeyError: + if spec.get('type'): + raise Exception('Target type %s is not a valid target type for ' + 'target %s in %s.' % + (spec['type'], spec['target_name'], build_file)) + else: + raise Exception('Missing type field for target %s in %s.' % + (spec['target_name'], build_file)) + return config_type + + +def _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config): + """Adds a configuration to the MSVS project. + + Many settings in a vcproj file are specific to a configuration. This + function the main part of the vcproj file that's configuration specific. + + Arguments: + p: The target project being generated. + spec: The target dictionary containing the properties of the target. + config_type: The configuration type, a number as defined by Microsoft. + config_name: The name of the configuration. + config: The dictionnary that defines the special processing to be done + for this configuration. + """ + # Get the information for this configuration + include_dirs, resource_include_dirs = _GetIncludeDirs(config) + libraries = _GetLibraries(spec) + out_file, vc_tool, _ = _GetOutputFilePathAndTool(spec) + defines = _GetDefines(config) + defines = [_EscapeCppDefineForMSVS(d) for d in defines] + disabled_warnings = _GetDisabledWarnings(config) + prebuild = config.get('msvs_prebuild') + postbuild = config.get('msvs_postbuild') + def_file = _GetModuleDefinition(spec) + precompiled_header = config.get('msvs_precompiled_header') + + # Prepare the list of tools as a dictionary. + tools = dict() + # Add in user specified msvs_settings. + msvs_settings = config.get('msvs_settings', {}) + MSVSSettings.ValidateMSVSSettings(msvs_settings) + for tool in msvs_settings: + settings = config['msvs_settings'][tool] + for setting in settings: + _ToolAppend(tools, tool, setting, settings[setting]) + # Add the information to the appropriate tool + _ToolAppend(tools, 'VCCLCompilerTool', + 'AdditionalIncludeDirectories', include_dirs) + _ToolAppend(tools, 'VCResourceCompilerTool', + 'AdditionalIncludeDirectories', resource_include_dirs) + # Add in libraries. + _ToolAppend(tools, 'VCLinkerTool', 'AdditionalDependencies', libraries) + if out_file: + _ToolAppend(tools, vc_tool, 'OutputFile', out_file, only_if_unset=True) + # Add defines. + _ToolAppend(tools, 'VCCLCompilerTool', 'PreprocessorDefinitions', defines) + _ToolAppend(tools, 'VCResourceCompilerTool', 'PreprocessorDefinitions', + defines) + # Change program database directory to prevent collisions. + _ToolAppend(tools, 'VCCLCompilerTool', 'ProgramDataBaseFileName', + '$(IntDir)\\$(ProjectName)\\vc80.pdb', only_if_unset=True) + # Add disabled warnings. + _ToolAppend(tools, 'VCCLCompilerTool', + 'DisableSpecificWarnings', disabled_warnings) + # Add Pre-build. + _ToolAppend(tools, 'VCPreBuildEventTool', 'CommandLine', prebuild) + # Add Post-build. + _ToolAppend(tools, 'VCPostBuildEventTool', 'CommandLine', postbuild) + # Turn on precompiled headers if appropriate. + if precompiled_header: + precompiled_header = os.path.split(precompiled_header)[1] + _ToolAppend(tools, 'VCCLCompilerTool', 'UsePrecompiledHeader', '2') + _ToolAppend(tools, 'VCCLCompilerTool', + 'PrecompiledHeaderThrough', precompiled_header) + _ToolAppend(tools, 'VCCLCompilerTool', + 'ForcedIncludeFiles', precompiled_header) + # Loadable modules don't generate import libraries; + # tell dependent projects to not expect one. + if spec['type'] == 'loadable_module': + _ToolAppend(tools, 'VCLinkerTool', 'IgnoreImportLibrary', 'true') + # Set the module definition file if any. + if def_file: + _ToolAppend(tools, 'VCLinkerTool', 'ModuleDefinitionFile', def_file) + + _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name) + + +def _GetIncludeDirs(config): + """Returns the list of directories to be used for #include directives. + + Arguments: + config: The dictionnary that defines the special processing to be done + for this configuration. + Returns: + The list of directory paths. + """ + # TODO(bradnelson): include_dirs should really be flexible enough not to + # require this sort of thing. + include_dirs = ( + config.get('include_dirs', []) + + config.get('msvs_system_include_dirs', [])) + resource_include_dirs = config.get('resource_include_dirs', include_dirs) + include_dirs = _FixPaths(include_dirs) + resource_include_dirs = _FixPaths(resource_include_dirs) + return include_dirs, resource_include_dirs + + +def _GetLibraries(spec): + """Returns the list of libraries for this configuration. + + Arguments: + spec: The target dictionary containing the properties of the target. + Returns: + The list of directory paths. + """ + libraries = spec.get('libraries', []) + # Strip out -l, as it is not used on windows (but is needed so we can pass + # in libraries that are assumed to be in the default library path). + # Also remove duplicate entries, leaving only the last duplicate, while + # preserving order. + found = set() + unique_libraries_list = [] + for entry in reversed(libraries): + library = re.sub('^\-l', '', entry) + if library not in found: + found.add(library) + unique_libraries_list.append(library) + unique_libraries_list.reverse() + return unique_libraries_list + + +def _GetOutputFilePathAndTool(spec): + """Returns the path and tool to use for this target. + + Figures out the path of the file this spec will create and the name of + the VC tool that will create it. + + Arguments: + spec: The target dictionary containing the properties of the target. + Returns: + A triple of (file path, name of the vc tool, name of the msbuild tool) + """ + # Select a name for the output file. + out_file = '' + vc_tool = '' + msbuild_tool = '' + output_file_map = { + 'executable': ('VCLinkerTool', 'Link', '$(OutDir)\\', '.exe'), + 'shared_library': ('VCLinkerTool', 'Link', '$(OutDir)\\', '.dll'), + 'loadable_module': ('VCLinkerTool', 'Link', '$(OutDir)\\', '.dll'), + 'static_library': ('VCLibrarianTool', 'Lib', '$(OutDir)\\lib\\', '.lib'), + } + output_file_props = output_file_map.get(spec['type']) + if output_file_props and int(spec.get('msvs_auto_output_file', 1)): + vc_tool, msbuild_tool, out_dir, suffix = output_file_props + out_dir = spec.get('product_dir', out_dir) + product_extension = spec.get('product_extension') + if product_extension: + suffix = '.' + product_extension + prefix = spec.get('product_prefix', '') + product_name = spec.get('product_name', '$(ProjectName)') + out_file = ntpath.join(out_dir, prefix + product_name + suffix) + return out_file, vc_tool, msbuild_tool + + +def _GetDefines(config): + """Returns the list of preprocessor definitions for this configuation. + + Arguments: + config: The dictionnary that defines the special processing to be done + for this configuration. + Returns: + The list of preprocessor definitions. + """ + defines = [] + for d in config.get('defines', []): + if type(d) == list: + fd = '='.join([str(dpart) for dpart in d]) + else: + fd = str(d) + defines.append(fd) + return defines + + +def _GetDisabledWarnings(config): + return [str(i) for i in config.get('msvs_disabled_warnings', [])] + + +def _GetModuleDefinition(spec): + def_file = '' + if spec['type'] in ['shared_library', 'loadable_module', 'executable']: + def_files = [s for s in spec.get('sources', []) if s.endswith('.def')] + if len(def_files) == 1: + def_file = _FixPath(def_files[0]) + elif def_files: + raise ValueError( + 'Multiple module definition files in one target, target %s lists ' + 'multiple .def files: %s' % ( + spec['target_name'], ' '.join(def_files))) + return def_file + + +def _ConvertToolsToExpectedForm(tools): + """Convert tools to a form expected by Visual Studio. + + Arguments: + tools: A dictionnary of settings; the tool name is the key. + Returns: + A list of Tool objects. + """ + tool_list = [] + for tool, settings in tools.iteritems(): + # Collapse settings with lists. + settings_fixed = {} + for setting, value in settings.iteritems(): + if type(value) == list: + if ((tool == 'VCLinkerTool' and + setting == 'AdditionalDependencies') or + setting == 'AdditionalOptions'): + settings_fixed[setting] = ' '.join(value) + else: + settings_fixed[setting] = ';'.join(value) + else: + settings_fixed[setting] = value + # Add in this tool. + tool_list.append(MSVSProject.Tool(tool, settings_fixed)) + return tool_list + + +def _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name): + """Add to the project file the configuration specified by config. + + Arguments: + p: The target project being generated. + spec: the target project dict. + tools: A dictionnary of settings; the tool name is the key. + config: The dictionnary that defines the special processing to be done + for this configuration. + config_type: The configuration type, a number as defined by Microsoft. + config_name: The name of the configuration. + """ + attributes = _GetMSVSAttributes(spec, config, config_type) + # Add in this configuration. + tool_list = _ConvertToolsToExpectedForm(tools) + p.AddConfig(_ConfigFullName(config_name, config), + attrs=attributes, tools=tool_list) + + +def _GetMSVSAttributes(spec, config, config_type): + # Prepare configuration attributes. + prepared_attrs = {} + source_attrs = config.get('msvs_configuration_attributes', {}) + for a in source_attrs: + prepared_attrs[a] = source_attrs[a] + # Add props files. + vsprops_dirs = config.get('msvs_props', []) + vsprops_dirs = _FixPaths(vsprops_dirs) + if vsprops_dirs: + prepared_attrs['InheritedPropertySheets'] = ';'.join(vsprops_dirs) + # Set configuration type. + prepared_attrs['ConfigurationType'] = config_type + output_dir = prepared_attrs.get('OutputDirectory', + '$(SolutionDir)$(ConfigurationName)') + prepared_attrs['OutputDirectory'] = output_dir + if 'IntermediateDirectory' not in prepared_attrs: + intermediate = '$(ConfigurationName)\\obj\\$(ProjectName)' + prepared_attrs['IntermediateDirectory'] = intermediate + return prepared_attrs + + +def _AddNormalizedSources(sources_set, sources_array): + sources = [_NormalizedSource(s) for s in sources_array] + sources_set.update(set(sources)) + + +def _PrepareListOfSources(spec, gyp_file): + """Prepare list of sources and excluded sources. + + Besides the sources specified directly in the spec, adds the gyp file so + that a change to it will cause a re-compile. Also adds appropriate sources + for actions and copies. Assumes later stage will un-exclude files which + have custom build steps attached. + + Arguments: + spec: The target dictionary containing the properties of the target. + gyp_file: The name of the gyp file. + Returns: + A pair of (list of sources, list of excluded sources). + The sources will be relative to the gyp file. + """ + sources = set() + _AddNormalizedSources(sources, spec.get('sources', [])) + excluded_sources = set() + # Add in the gyp file. + sources.add(gyp_file) + + # Add in 'action' inputs and outputs. + for a in spec.get('actions', []): + inputs = a['inputs'] + inputs = [_NormalizedSource(i) for i in inputs] + # Add all inputs to sources and excluded sources. + inputs = set(inputs) + sources.update(inputs) + excluded_sources.update(inputs) + if int(a.get('process_outputs_as_sources', False)): + _AddNormalizedSources(sources, a.get('outputs', [])) + # Add in 'copies' inputs and outputs. + for cpy in spec.get('copies', []): + _AddNormalizedSources(sources, cpy.get('files', [])) + return (sources, excluded_sources) + + +def _AdjustSourcesAndConvertToFilterHierarchy( + spec, options, gyp_dir, sources, excluded_sources, list_excluded): + """Adjusts the list of sources and excluded sources. + + Also converts the sets to lists. + + Arguments: + spec: The target dictionary containing the properties of the target. + options: Global generator options. + gyp_dir: The path to the gyp file being processed. + sources: A set of sources to be included for this project. + excluded_sources: A set of sources to be excluded for this project. + Returns: + A trio of (list of sources, list of excluded sources, + path of excluded IDL file) + """ + # Exclude excluded sources coming into the generator. + excluded_sources.update(set(spec.get('sources_excluded', []))) + # Add excluded sources into sources for good measure. + sources.update(excluded_sources) + # Convert to proper windows form. + # NOTE: sources goes from being a set to a list here. + # NOTE: excluded_sources goes from being a set to a list here. + sources = _FixPaths(sources) + # Convert to proper windows form. + excluded_sources = _FixPaths(excluded_sources) + + excluded_idl = _IdlFilesHandledNonNatively(spec, sources) + + precompiled_related = _GetPrecompileRelatedFiles(spec) + # Find the excluded ones, minus the precompiled header related ones. + fully_excluded = [i for i in excluded_sources if i not in precompiled_related] + + # Convert to folders and the right slashes. + sources = [i.split('\\') for i in sources] + sources = _ConvertSourcesToFilterHierarchy(sources, excluded=fully_excluded, + list_excluded=list_excluded) + + return sources, excluded_sources, excluded_idl + + +def _IdlFilesHandledNonNatively(spec, sources): + # If any non-native rules use 'idl' as an extension exclude idl files. + # Gather a list here to use later. + using_idl = False + for rule in spec.get('rules', []): + if rule['extension'] == 'idl' and int(rule.get('msvs_external_rule', 0)): + using_idl = True + break + if using_idl: + excluded_idl = [i for i in sources if i.endswith('.idl')] + else: + excluded_idl = [] + return excluded_idl + + +def _GetPrecompileRelatedFiles(spec): + # Gather a list of precompiled header related sources. + precompiled_related = [] + for _, config in spec['configurations'].iteritems(): + for k in precomp_keys: + f = config.get(k) + if f: + precompiled_related.append(_FixPath(f)) + return precompiled_related + + +def _ExcludeFilesFromBeingBuilt(p, spec, excluded_sources, excluded_idl, + list_excluded): + exclusions = _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl) + for file_name, excluded_configs in exclusions.iteritems(): + if (not list_excluded and + len(excluded_configs) == len(spec['configurations'])): + # If we're not listing excluded files, then they won't appear in the + # project, so don't try to configure them to be excluded. + pass + else: + for config_name, config in excluded_configs: + p.AddFileConfig(file_name, _ConfigFullName(config_name, config), + {'ExcludedFromBuild': 'true'}) + + +def _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl): + exclusions = {} + # Exclude excluded sources from being built. + for f in excluded_sources: + excluded_configs = [] + for config_name, config in spec['configurations'].iteritems(): + precomped = [_FixPath(config.get(i, '')) for i in precomp_keys] + # Don't do this for ones that are precompiled header related. + if f not in precomped: + excluded_configs.append((config_name, config)) + exclusions[f] = excluded_configs + # If any non-native rules use 'idl' as an extension exclude idl files. + # Exclude them now. + for f in excluded_idl: + excluded_configs = [] + for config_name, config in spec['configurations'].iteritems(): + excluded_configs.append((config_name, config)) + exclusions[f] = excluded_configs + return exclusions + + +def _AddToolFilesToMSVS(p, spec): + # Add in tool files (rules). + tool_files = set() + for _, config in spec['configurations'].iteritems(): + for f in config.get('msvs_tool_files', []): + tool_files.add(f) + for f in tool_files: + p.AddToolFile(f) + + +def _HandlePreCompiledHeaders(p, sources, spec): + # Pre-compiled header source stubs need a different compiler flag + # (generate precompiled header) and any source file not of the same + # kind (i.e. C vs. C++) as the precompiled header source stub needs + # to have use of precompiled headers disabled. + extensions_excluded_from_precompile = [] + for config_name, config in spec['configurations'].iteritems(): + source = config.get('msvs_precompiled_source') + if source: + source = _FixPath(source) + # UsePrecompiledHeader=1 for if using precompiled headers. + tool = MSVSProject.Tool('VCCLCompilerTool', + {'UsePrecompiledHeader': '1'}) + p.AddFileConfig(source, _ConfigFullName(config_name, config), + {}, tools=[tool]) + basename, extension = os.path.splitext(source) + if extension == '.c': + extensions_excluded_from_precompile = ['.cc', '.cpp', '.cxx'] + else: + extensions_excluded_from_precompile = ['.c'] + def DisableForSourceTree(source_tree): + for source in source_tree: + if isinstance(source, MSVSProject.Filter): + DisableForSourceTree(source.contents) + else: + basename, extension = os.path.splitext(source) + if extension in extensions_excluded_from_precompile: + for config_name, config in spec['configurations'].iteritems(): + tool = MSVSProject.Tool('VCCLCompilerTool', + {'UsePrecompiledHeader': '0', + 'ForcedIncludeFiles': '$(NOINHERIT)'}) + p.AddFileConfig(_FixPath(source), + _ConfigFullName(config_name, config), + {}, tools=[tool]) + # Do nothing if there was no precompiled source. + if extensions_excluded_from_precompile: + DisableForSourceTree(sources) + + +def _AddActions(actions_to_add, spec, relative_path_of_gyp_file): + # Add actions. + actions = spec.get('actions', []) + # Don't setup_env every time. When all the actions are run together in one + # batch file in VS, the PATH will grow too long. + # Membership in this set means that the cygwin environment has been set up, + # and does not need to be set up again. + have_setup_env = set() + for a in actions: + # Attach actions to the gyp file if nothing else is there. + inputs = a.get('inputs') or [relative_path_of_gyp_file] + attached_to = inputs[0] + need_setup_env = attached_to not in have_setup_env + cmd = _BuildCommandLineForRule(spec, a, has_input_path=False, + do_setup_env=need_setup_env) + have_setup_env.add(attached_to) + # Add the action. + _AddActionStep(actions_to_add, + inputs=inputs, + outputs=a.get('outputs', []), + description=a.get('message', a['action_name']), + command=cmd) + + +def _WriteMSVSUserFile(project_path, version, spec): + # Add run_as and test targets. + if 'run_as' in spec: + run_as = spec['run_as'] + action = run_as.get('action', []) + environment = run_as.get('environment', []) + working_directory = run_as.get('working_directory', '.') + elif int(spec.get('test', 0)): + action = ['$(TargetPath)', '--gtest_print_time'] + environment = [] + working_directory = '.' + else: + return # Nothing to add + # Write out the user file. + user_file = _CreateMSVSUserFile(project_path, version, spec) + for config_name, c_data in spec['configurations'].iteritems(): + user_file.AddDebugSettings(_ConfigFullName(config_name, c_data), + action, environment, working_directory) + user_file.WriteIfChanged() + + +def _AddCopies(actions_to_add, spec): + copies = _GetCopies(spec) + for inputs, outputs, cmd, description in copies: + _AddActionStep(actions_to_add, inputs=inputs, outputs=outputs, + description=description, command=cmd) + + +def _GetCopies(spec): + copies = [] + # Add copies. + for cpy in spec.get('copies', []): + for src in cpy.get('files', []): + dst = os.path.join(cpy['destination'], os.path.basename(src)) + # _AddCustomBuildToolForMSVS() will call _FixPath() on the inputs and + # outputs, so do the same for our generated command line. + if src.endswith('/'): + src_bare = src[:-1] + base_dir = posixpath.split(src_bare)[0] + outer_dir = posixpath.split(src_bare)[1] + cmd = 'cd "%s" && xcopy /e /f /y "%s" "%s\\%s\\"' % ( + _FixPath(base_dir), outer_dir, _FixPath(dst), outer_dir) + copies.append(([src], ['dummy_copies', dst], cmd, + 'Copying %s to %s' % (src, dst))) + else: + cmd = 'mkdir "%s" 2>nul & set ERRORLEVEL=0 & copy /Y "%s" "%s"' % ( + _FixPath(cpy['destination']), _FixPath(src), _FixPath(dst)) + copies.append(([src], [dst], cmd, 'Copying %s to %s' % (src, dst))) + return copies + + +def _GetPathDict(root, path): + # |path| will eventually be empty (in the recursive calls) if it was initially + # relative; otherwise it will eventually end up as '\', 'D:\', etc. + if not path or path.endswith(os.sep): + return root + parent, folder = os.path.split(path) + parent_dict = _GetPathDict(root, parent) + if folder not in parent_dict: + parent_dict[folder] = dict() + return parent_dict[folder] + + +def _DictsToFolders(base_path, bucket, flat): + # Convert to folders recursively. + children = [] + for folder, contents in bucket.iteritems(): + if type(contents) == dict: + folder_children = _DictsToFolders(os.path.join(base_path, folder), + contents, flat) + if flat: + children += folder_children + else: + folder_children = MSVSNew.MSVSFolder(os.path.join(base_path, folder), + name='(' + folder + ')', + entries=folder_children) + children.append(folder_children) + else: + children.append(contents) + return children + + +def _CollapseSingles(parent, node): + # Recursively explorer the tree of dicts looking for projects which are + # the sole item in a folder which has the same name as the project. Bring + # such projects up one level. + if (type(node) == dict and + len(node) == 1 and + node.keys()[0] == parent + '.vcproj'): + return node[node.keys()[0]] + if type(node) != dict: + return node + for child in node: + node[child] = _CollapseSingles(child, node[child]) + return node + + +def _GatherSolutionFolders(sln_projects, project_objects, flat): + root = {} + # Convert into a tree of dicts on path. + for p in sln_projects: + gyp_file, target = gyp.common.ParseQualifiedTarget(p)[0:2] + gyp_dir = os.path.dirname(gyp_file) + path_dict = _GetPathDict(root, gyp_dir) + path_dict[target + '.vcproj'] = project_objects[p] + # Walk down from the top until we hit a folder that has more than one entry. + # In practice, this strips the top-level "src/" dir from the hierarchy in + # the solution. + while len(root) == 1 and type(root[root.keys()[0]]) == dict: + root = root[root.keys()[0]] + # Collapse singles. + root = _CollapseSingles('', root) + # Merge buckets until everything is a root entry. + return _DictsToFolders('', root, flat) + + +def _GetPathOfProject(qualified_target, spec, options, msvs_version): + default_config = _GetDefaultConfiguration(spec) + proj_filename = default_config.get('msvs_existing_vcproj') + if not proj_filename: + proj_filename = (spec['target_name'] + options.suffix + + msvs_version.ProjectExtension()) + + build_file = gyp.common.BuildFile(qualified_target) + proj_path = os.path.join(os.path.split(build_file)[0], proj_filename) + fix_prefix = None + if options.generator_output: + project_dir_path = os.path.dirname(os.path.abspath(proj_path)) + proj_path = os.path.join(options.generator_output, proj_path) + fix_prefix = gyp.common.RelativePath(project_dir_path, + os.path.dirname(proj_path)) + return proj_path, fix_prefix + + +def _GetPlatformOverridesOfProject(spec): + # Prepare a dict indicating which project configurations are used for which + # solution configurations for this target. + config_platform_overrides = {} + for config_name, c in spec['configurations'].iteritems(): + config_fullname = _ConfigFullName(config_name, c) + platform = c.get('msvs_target_platform', _ConfigPlatform(c)) + fixed_config_fullname = '%s|%s' % ( + _ConfigBaseName(config_name, _ConfigPlatform(c)), platform) + config_platform_overrides[config_fullname] = fixed_config_fullname + return config_platform_overrides + + +def _CreateProjectObjects(target_list, target_dicts, options, msvs_version): + """Create a MSVSProject object for the targets found in target list. + + Arguments: + target_list: the list of targets to generate project objects for. + target_dicts: the dictionary of specifications. + options: global generator options. + msvs_version: the MSVSVersion object. + Returns: + A set of created projects, keyed by target. + """ + global fixpath_prefix + # Generate each project. + projects = {} + for qualified_target in target_list: + spec = target_dicts[qualified_target] + if spec['toolset'] != 'target': + raise Exception( + 'Multiple toolsets not supported in msvs build (target %s)' % + qualified_target) + proj_path, fixpath_prefix = _GetPathOfProject(qualified_target, spec, + options, msvs_version) + guid = _GetGuidOfProject(proj_path, spec) + overrides = _GetPlatformOverridesOfProject(spec) + build_file = gyp.common.BuildFile(qualified_target) + # Create object for this project. + obj = MSVSNew.MSVSProject( + _FixPath(proj_path), + name=spec['target_name'], + guid=guid, + spec=spec, + build_file=build_file, + config_platform_overrides=overrides, + fixpath_prefix=fixpath_prefix) + # Set project toolset if any (MS build only) + if msvs_version.UsesVcxproj(): + obj.set_msbuild_toolset(_GetMsbuildToolsetOfProject(proj_path, spec)) + projects[qualified_target] = obj + # Set all the dependencies + for project in projects.values(): + deps = project.spec.get('dependencies', []) + deps = [projects[d] for d in deps] + project.set_dependencies(deps) + return projects + + +def CalculateVariables(default_variables, params): + """Generated variables that require params to be known.""" + + generator_flags = params.get('generator_flags', {}) + + # Select project file format version (if unset, default to auto detecting). + msvs_version = MSVSVersion.SelectVisualStudioVersion( + generator_flags.get('msvs_version', 'auto')) + # Stash msvs_version for later (so we don't have to probe the system twice). + params['msvs_version'] = msvs_version + + # Set a variable so conditions can be based on msvs_version. + default_variables['MSVS_VERSION'] = msvs_version.ShortName() + + # To determine processor word size on Windows, in addition to checking + # PROCESSOR_ARCHITECTURE (which reflects the word size of the current + # process), it is also necessary to check PROCESSOR_ARCITEW6432 (which + # contains the actual word size of the system when running thru WOW64). + if (os.environ.get('PROCESSOR_ARCHITECTURE', '').find('64') >= 0 or + os.environ.get('PROCESSOR_ARCHITEW6432', '').find('64') >= 0): + default_variables['MSVS_OS_BITS'] = 64 + else: + default_variables['MSVS_OS_BITS'] = 32 + + +def _ShardName(name, number): + """Add a shard number to the end of a target. + + Arguments: + name: name of the target (foo#target) + number: shard number + Returns: + Target name with shard added (foo_1#target) + """ + parts = name.rsplit('#', 1) + parts[0] = '%s_%d' % (parts[0], number) + return '#'.join(parts) + + +def _ShardTargets(target_list, target_dicts): + """Shard some targets apart to work around the linkers limits. + + Arguments: + target_list: List of target pairs: 'base/base.gyp:base'. + target_dicts: Dict of target properties keyed on target pair. + Returns: + Tuple of the new sharded versions of the inputs. + """ + # Gather the targets to shard, and how many pieces. + targets_to_shard = {} + for t in target_dicts: + shards = int(target_dicts[t].get('msvs_shard', 0)) + if shards: + targets_to_shard[t] = shards + # Shard target_list. + new_target_list = [] + for t in target_list: + if t in targets_to_shard: + for i in range(targets_to_shard[t]): + new_target_list.append(_ShardName(t, i)) + else: + new_target_list.append(t) + # Shard target_dict. + new_target_dicts = {} + for t in target_dicts: + if t in targets_to_shard: + for i in range(targets_to_shard[t]): + name = _ShardName(t, i) + new_target_dicts[name] = copy.copy(target_dicts[t]) + new_target_dicts[name]['target_name'] = _ShardName( + new_target_dicts[name]['target_name'], i) + sources = new_target_dicts[name].get('sources', []) + new_sources = [] + for pos in range(i, len(sources), targets_to_shard[t]): + new_sources.append(sources[pos]) + new_target_dicts[name]['sources'] = new_sources + else: + new_target_dicts[t] = target_dicts[t] + # Shard dependencies. + for t in new_target_dicts: + dependencies = copy.copy(new_target_dicts[t].get('dependencies', [])) + new_dependencies = [] + for d in dependencies: + if d in targets_to_shard: + for i in range(targets_to_shard[d]): + new_dependencies.append(_ShardName(d, i)) + else: + new_dependencies.append(d) + new_target_dicts[t]['dependencies'] = new_dependencies + + return (new_target_list, new_target_dicts) + + +def GenerateOutput(target_list, target_dicts, data, params): + """Generate .sln and .vcproj files. + + This is the entry point for this generator. + Arguments: + target_list: List of target pairs: 'base/base.gyp:base'. + target_dicts: Dict of target properties keyed on target pair. + data: Dictionary containing per .gyp data. + """ + global fixpath_prefix + + options = params['options'] + + # Get the project file format version back out of where we stashed it in + # GeneratorCalculatedVariables. + msvs_version = params['msvs_version'] + + generator_flags = params.get('generator_flags', {}) + + # Optionally shard targets marked with 'msvs_shard': SHARD_COUNT. + (target_list, target_dicts) = _ShardTargets(target_list, target_dicts) + + # Prepare the set of configurations. + configs = set() + for qualified_target in target_list: + spec = target_dicts[qualified_target] + for config_name, config in spec['configurations'].iteritems(): + configs.add(_ConfigFullName(config_name, config)) + configs = list(configs) + + # Figure out all the projects that will be generated and their guids + project_objects = _CreateProjectObjects(target_list, target_dicts, options, + msvs_version) + + # Generate each project. + missing_sources = [] + for project in project_objects.values(): + fixpath_prefix = project.fixpath_prefix + missing_sources.extend(_GenerateProject(project, options, msvs_version, + generator_flags)) + fixpath_prefix = None + + for build_file in data: + # Validate build_file extension + if build_file[-4:] != '.gyp': + continue + sln_path = build_file[:-4] + options.suffix + '.sln' + if options.generator_output: + sln_path = os.path.join(options.generator_output, sln_path) + # Get projects in the solution, and their dependents. + sln_projects = gyp.common.BuildFileTargets(target_list, build_file) + sln_projects += gyp.common.DeepDependencyTargets(target_dicts, sln_projects) + # Create folder hierarchy. + root_entries = _GatherSolutionFolders( + sln_projects, project_objects, flat=msvs_version.FlatSolution()) + # Create solution. + sln = MSVSNew.MSVSSolution(sln_path, + entries=root_entries, + variants=configs, + websiteProperties=False, + version=msvs_version) + sln.Write() + + if missing_sources: + error_message = "Missing input files:\n" + \ + '\n'.join(set(missing_sources)) + if generator_flags.get('msvs_error_on_missing_sources', False): + raise Exception(error_message) + else: + print >>sys.stdout, "Warning: " + error_message + + +def _GenerateMSBuildFiltersFile(filters_path, source_files, + extension_to_rule_name): + """Generate the filters file. + + This file is used by Visual Studio to organize the presentation of source + files into folders. + + Arguments: + filters_path: The path of the file to be created. + source_files: The hierarchical structure of all the sources. + extension_to_rule_name: A dictionary mapping file extensions to rules. + """ + filter_group = [] + source_group = [] + _AppendFiltersForMSBuild('', source_files, extension_to_rule_name, + filter_group, source_group) + if filter_group: + content = ['Project', + {'ToolsVersion': '4.0', + 'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003' + }, + ['ItemGroup'] + filter_group, + ['ItemGroup'] + source_group + ] + easy_xml.WriteXmlIfChanged(content, filters_path) + elif os.path.exists(filters_path): + # We don't need this filter anymore. Delete the old filter file. + os.unlink(filters_path) + + +def _AppendFiltersForMSBuild(parent_filter_name, sources, + extension_to_rule_name, + filter_group, source_group): + """Creates the list of filters and sources to be added in the filter file. + + Args: + parent_filter_name: The name of the filter under which the sources are + found. + sources: The hierarchy of filters and sources to process. + extension_to_rule_name: A dictionary mapping file extensions to rules. + filter_group: The list to which filter entries will be appended. + source_group: The list to which source entries will be appeneded. + """ + for source in sources: + if isinstance(source, MSVSProject.Filter): + # We have a sub-filter. Create the name of that sub-filter. + if not parent_filter_name: + filter_name = source.name + else: + filter_name = '%s\\%s' % (parent_filter_name, source.name) + # Add the filter to the group. + filter_group.append( + ['Filter', {'Include': filter_name}, + ['UniqueIdentifier', MSVSNew.MakeGuid(source.name)]]) + # Recurse and add its dependents. + _AppendFiltersForMSBuild(filter_name, source.contents, + extension_to_rule_name, + filter_group, source_group) + else: + # It's a source. Create a source entry. + _, element = _MapFileToMsBuildSourceType(source, extension_to_rule_name) + source_entry = [element, {'Include': source}] + # Specify the filter it is part of, if any. + if parent_filter_name: + source_entry.append(['Filter', parent_filter_name]) + source_group.append(source_entry) + + +def _MapFileToMsBuildSourceType(source, extension_to_rule_name): + """Returns the group and element type of the source file. + + Arguments: + source: The source file name. + extension_to_rule_name: A dictionary mapping file extensions to rules. + + Returns: + A pair of (group this file should be part of, the label of element) + """ + _, ext = os.path.splitext(source) + if ext in extension_to_rule_name: + group = 'rule' + element = extension_to_rule_name[ext] + elif ext in ['.cc', '.cpp', '.c', '.cxx']: + group = 'compile' + element = 'ClCompile' + elif ext in ['.h', '.hxx']: + group = 'include' + element = 'ClInclude' + elif ext == '.rc': + group = 'resource' + element = 'ResourceCompile' + elif ext == '.idl': + group = 'midl' + element = 'Midl' + else: + group = 'none' + element = 'None' + return (group, element) + + +def _GenerateRulesForMSBuild(output_dir, options, spec, + sources, excluded_sources, + props_files_of_rules, targets_files_of_rules, + actions_to_add, extension_to_rule_name): + # MSBuild rules are implemented using three files: an XML file, a .targets + # file and a .props file. + # See http://blogs.msdn.com/b/vcblog/archive/2010/04/21/quick-help-on-vs2010-custom-build-rule.aspx + # for more details. + rules = spec.get('rules', []) + rules_native = [r for r in rules if not int(r.get('msvs_external_rule', 0))] + rules_external = [r for r in rules if int(r.get('msvs_external_rule', 0))] + + msbuild_rules = [] + for rule in rules_native: + # Skip a rule with no action and no inputs. + if 'action' not in rule and not rule.get('rule_sources', []): + continue + msbuild_rule = MSBuildRule(rule, spec) + msbuild_rules.append(msbuild_rule) + extension_to_rule_name[msbuild_rule.extension] = msbuild_rule.rule_name + if msbuild_rules: + base = spec['target_name'] + options.suffix + props_name = base + '.props' + targets_name = base + '.targets' + xml_name = base + '.xml' + + props_files_of_rules.add(props_name) + targets_files_of_rules.add(targets_name) + + props_path = os.path.join(output_dir, props_name) + targets_path = os.path.join(output_dir, targets_name) + xml_path = os.path.join(output_dir, xml_name) + + _GenerateMSBuildRulePropsFile(props_path, msbuild_rules) + _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules) + _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules) + + if rules_external: + _GenerateExternalRules(rules_external, output_dir, spec, + sources, options, actions_to_add) + _AdjustSourcesForRules(rules, sources, excluded_sources) + + +class MSBuildRule(object): + """Used to store information used to generate an MSBuild rule. + + Attributes: + rule_name: The rule name, sanitized to use in XML. + target_name: The name of the target. + after_targets: The name of the AfterTargets element. + before_targets: The name of the BeforeTargets element. + depends_on: The name of the DependsOn element. + compute_output: The name of the ComputeOutput element. + dirs_to_make: The name of the DirsToMake element. + inputs: The name of the _inputs element. + tlog: The name of the _tlog element. + extension: The extension this rule applies to. + description: The message displayed when this rule is invoked. + additional_dependencies: A string listing additional dependencies. + outputs: The outputs of this rule. + command: The command used to run the rule. + """ + + def __init__(self, rule, spec): + self.display_name = rule['rule_name'] + # Assure that the rule name is only characters and numbers + self.rule_name = re.sub(r'\W', '_', self.display_name) + # Create the various element names, following the example set by the + # Visual Studio 2008 to 2010 conversion. I don't know if VS2010 + # is sensitive to the exact names. + self.target_name = '_' + self.rule_name + self.after_targets = self.rule_name + 'AfterTargets' + self.before_targets = self.rule_name + 'BeforeTargets' + self.depends_on = self.rule_name + 'DependsOn' + self.compute_output = 'Compute%sOutput' % self.rule_name + self.dirs_to_make = self.rule_name + 'DirsToMake' + self.inputs = self.rule_name + '_inputs' + self.tlog = self.rule_name + '_tlog' + self.extension = rule['extension'] + if not self.extension.startswith('.'): + self.extension = '.' + self.extension + + self.description = MSVSSettings.ConvertVCMacrosToMSBuild( + rule.get('message', self.rule_name)) + old_additional_dependencies = _FixPaths(rule.get('inputs', [])) + self.additional_dependencies = ( + ';'.join([MSVSSettings.ConvertVCMacrosToMSBuild(i) + for i in old_additional_dependencies])) + old_outputs = _FixPaths(rule.get('outputs', [])) + self.outputs = ';'.join([MSVSSettings.ConvertVCMacrosToMSBuild(i) + for i in old_outputs]) + old_command = _BuildCommandLineForRule(spec, rule, has_input_path=True, + do_setup_env=True) + self.command = MSVSSettings.ConvertVCMacrosToMSBuild(old_command) + + +def _GenerateMSBuildRulePropsFile(props_path, msbuild_rules): + """Generate the .props file.""" + content = ['Project', + {'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'}] + for rule in msbuild_rules: + content.extend([ + ['PropertyGroup', + {'Condition': "'$(%s)' == '' and '$(%s)' == '' and " + "'$(ConfigurationType)' != 'Makefile'" % (rule.before_targets, + rule.after_targets) + }, + [rule.before_targets, 'Midl'], + [rule.after_targets, 'CustomBuild'], + ], + ['PropertyGroup', + [rule.depends_on, + {'Condition': "'$(ConfigurationType)' != 'Makefile'"}, + '_SelectedFiles;$(%s)' % rule.depends_on + ], + ], + ['ItemDefinitionGroup', + [rule.rule_name, + ['CommandLineTemplate', rule.command], + ['Outputs', rule.outputs], + ['ExecutionDescription', rule.description], + ['AdditionalDependencies', rule.additional_dependencies], + ], + ] + ]) + easy_xml.WriteXmlIfChanged(content, props_path) + + +def _GenerateMSBuildRuleTargetsFile(targets_path, msbuild_rules): + """Generate the .targets file.""" + content = ['Project', + {'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003' + } + ] + item_group = [ + 'ItemGroup', + ['PropertyPageSchema', + {'Include': '$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml'} + ] + ] + for rule in msbuild_rules: + item_group.append( + ['AvailableItemName', + {'Include': rule.rule_name}, + ['Targets', rule.target_name], + ]) + content.append(item_group) + + for rule in msbuild_rules: + content.append( + ['UsingTask', + {'TaskName': rule.rule_name, + 'TaskFactory': 'XamlTaskFactory', + 'AssemblyName': 'Microsoft.Build.Tasks.v4.0' + }, + ['Task', '$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml'], + ]) + for rule in msbuild_rules: + rule_name = rule.rule_name + target_outputs = '%%(%s.Outputs)' % rule_name + target_inputs = ('%%(%s.Identity);%%(%s.AdditionalDependencies);' + '$(MSBuildProjectFile)') % (rule_name, rule_name) + rule_inputs = '%%(%s.Identity)' % rule_name + extension_condition = ("'%(Extension)'=='.obj' or " + "'%(Extension)'=='.res' or " + "'%(Extension)'=='.rsc' or " + "'%(Extension)'=='.lib'") + remove_section = [ + 'ItemGroup', + {'Condition': "'@(SelectedFiles)' != ''"}, + [rule_name, + {'Remove': '@(%s)' % rule_name, + 'Condition': "'%(Identity)' != '@(SelectedFiles)'" + } + ] + ] + inputs_section = [ + 'ItemGroup', + [rule.inputs, {'Include': '%%(%s.AdditionalDependencies)' % rule_name}] + ] + logging_section = [ + 'ItemGroup', + [rule.tlog, + {'Include': '%%(%s.Outputs)' % rule_name, + 'Condition': ("'%%(%s.Outputs)' != '' and " + "'%%(%s.ExcludedFromBuild)' != 'true'" % + (rule_name, rule_name)) + }, + ['Source', "@(%s, '|')" % rule_name], + ['Inputs', "@(%s -> '%%(Fullpath)', ';')" % rule.inputs], + ], + ] + message_section = [ + 'Message', + {'Importance': 'High', + 'Text': '%%(%s.ExecutionDescription)' % rule_name + } + ] + write_tlog_section = [ + 'WriteLinesToFile', + {'Condition': "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != " + "'true'" % (rule.tlog, rule.tlog), + 'File': '$(IntDir)$(ProjectName).write.1.tlog', + 'Lines': "^%%(%s.Source);@(%s->'%%(Fullpath)')" % (rule.tlog, + rule.tlog) + } + ] + read_tlog_section = [ + 'WriteLinesToFile', + {'Condition': "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != " + "'true'" % (rule.tlog, rule.tlog), + 'File': '$(IntDir)$(ProjectName).read.1.tlog', + 'Lines': "^%%(%s.Source);%%(%s.Inputs)" % (rule.tlog, rule.tlog) + } + ] + command_and_input_section = [ + rule_name, + {'Condition': "'@(%s)' != '' and '%%(%s.ExcludedFromBuild)' != " + "'true'" % (rule_name, rule_name), + 'CommandLineTemplate': '%%(%s.CommandLineTemplate)' % rule_name, + 'AdditionalOptions': '%%(%s.AdditionalOptions)' % rule_name, + 'Inputs': rule_inputs + } + ] + content.extend([ + ['Target', + {'Name': rule.target_name, + 'BeforeTargets': '$(%s)' % rule.before_targets, + 'AfterTargets': '$(%s)' % rule.after_targets, + 'Condition': "'@(%s)' != ''" % rule_name, + 'DependsOnTargets': '$(%s);%s' % (rule.depends_on, + rule.compute_output), + 'Outputs': target_outputs, + 'Inputs': target_inputs + }, + remove_section, + inputs_section, + logging_section, + message_section, + write_tlog_section, + read_tlog_section, + command_and_input_section, + ], + ['PropertyGroup', + ['ComputeLinkInputsTargets', + '$(ComputeLinkInputsTargets);', + '%s;' % rule.compute_output + ], + ['ComputeLibInputsTargets', + '$(ComputeLibInputsTargets);', + '%s;' % rule.compute_output + ], + ], + ['Target', + {'Name': rule.compute_output, + 'Condition': "'@(%s)' != ''" % rule_name + }, + ['ItemGroup', + [rule.dirs_to_make, + {'Condition': "'@(%s)' != '' and " + "'%%(%s.ExcludedFromBuild)' != 'true'" % (rule_name, rule_name), + 'Include': '%%(%s.Outputs)' % rule_name + } + ], + ['Link', + {'Include': '%%(%s.Identity)' % rule.dirs_to_make, + 'Condition': extension_condition + } + ], + ['Lib', + {'Include': '%%(%s.Identity)' % rule.dirs_to_make, + 'Condition': extension_condition + } + ], + ['ImpLib', + {'Include': '%%(%s.Identity)' % rule.dirs_to_make, + 'Condition': extension_condition + } + ], + ], + ['MakeDir', + {'Directories': ("@(%s->'%%(RootDir)%%(Directory)')" % + rule.dirs_to_make) + } + ] + ], + ]) + easy_xml.WriteXmlIfChanged(content, targets_path) + + +def _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules): + # Generate the .xml file + content = [ + 'ProjectSchemaDefinitions', + {'xmlns': ('clr-namespace:Microsoft.Build.Framework.XamlTypes;' + 'assembly=Microsoft.Build.Framework'), + 'xmlns:x': 'http://schemas.microsoft.com/winfx/2006/xaml', + 'xmlns:sys': 'clr-namespace:System;assembly=mscorlib', + 'xmlns:transformCallback': + 'Microsoft.Cpp.Dev10.ConvertPropertyCallback' + } + ] + for rule in msbuild_rules: + content.extend([ + ['Rule', + {'Name': rule.rule_name, + 'PageTemplate': 'tool', + 'DisplayName': rule.display_name, + 'Order': '200' + }, + ['Rule.DataSource', + ['DataSource', + {'Persistence': 'ProjectFile', + 'ItemType': rule.rule_name + } + ] + ], + ['Rule.Categories', + ['Category', + {'Name': 'General'}, + ['Category.DisplayName', + ['sys:String', 'General'], + ], + ], + ['Category', + {'Name': 'Command Line', + 'Subtype': 'CommandLine' + }, + ['Category.DisplayName', + ['sys:String', 'Command Line'], + ], + ], + ], + ['StringListProperty', + {'Name': 'Inputs', + 'Category': 'Command Line', + 'IsRequired': 'true', + 'Switch': ' ' + }, + ['StringListProperty.DataSource', + ['DataSource', + {'Persistence': 'ProjectFile', + 'ItemType': rule.rule_name, + 'SourceType': 'Item' + } + ] + ], + ], + ['StringProperty', + {'Name': 'CommandLineTemplate', + 'DisplayName': 'Command Line', + 'Visible': 'False', + 'IncludeInCommandLine': 'False' + } + ], + ['DynamicEnumProperty', + {'Name': rule.before_targets, + 'Category': 'General', + 'EnumProvider': 'Targets', + 'IncludeInCommandLine': 'False' + }, + ['DynamicEnumProperty.DisplayName', + ['sys:String', 'Execute Before'], + ], + ['DynamicEnumProperty.Description', + ['sys:String', 'Specifies the targets for the build customization' + ' to run before.' + ], + ], + ['DynamicEnumProperty.ProviderSettings', + ['NameValuePair', + {'Name': 'Exclude', + 'Value': '^%s|^Compute' % rule.before_targets + } + ] + ], + ['DynamicEnumProperty.DataSource', + ['DataSource', + {'Persistence': 'ProjectFile', + 'HasConfigurationCondition': 'true' + } + ] + ], + ], + ['DynamicEnumProperty', + {'Name': rule.after_targets, + 'Category': 'General', + 'EnumProvider': 'Targets', + 'IncludeInCommandLine': 'False' + }, + ['DynamicEnumProperty.DisplayName', + ['sys:String', 'Execute After'], + ], + ['DynamicEnumProperty.Description', + ['sys:String', ('Specifies the targets for the build customization' + ' to run after.') + ], + ], + ['DynamicEnumProperty.ProviderSettings', + ['NameValuePair', + {'Name': 'Exclude', + 'Value': '^%s|^Compute' % rule.after_targets + } + ] + ], + ['DynamicEnumProperty.DataSource', + ['DataSource', + {'Persistence': 'ProjectFile', + 'ItemType': '', + 'HasConfigurationCondition': 'true' + } + ] + ], + ], + ['StringListProperty', + {'Name': 'Outputs', + 'DisplayName': 'Outputs', + 'Visible': 'False', + 'IncludeInCommandLine': 'False' + } + ], + ['StringProperty', + {'Name': 'ExecutionDescription', + 'DisplayName': 'Execution Description', + 'Visible': 'False', + 'IncludeInCommandLine': 'False' + } + ], + ['StringListProperty', + {'Name': 'AdditionalDependencies', + 'DisplayName': 'Additional Dependencies', + 'IncludeInCommandLine': 'False', + 'Visible': 'false' + } + ], + ['StringProperty', + {'Subtype': 'AdditionalOptions', + 'Name': 'AdditionalOptions', + 'Category': 'Command Line' + }, + ['StringProperty.DisplayName', + ['sys:String', 'Additional Options'], + ], + ['StringProperty.Description', + ['sys:String', 'Additional Options'], + ], + ], + ], + ['ItemType', + {'Name': rule.rule_name, + 'DisplayName': rule.display_name + } + ], + ['FileExtension', + {'Name': '*' + rule.extension, + 'ContentType': rule.rule_name + } + ], + ['ContentType', + {'Name': rule.rule_name, + 'DisplayName': '', + 'ItemType': rule.rule_name + } + ] + ]) + easy_xml.WriteXmlIfChanged(content, xml_path) + + +def _GetConfigurationAndPlatform(name, settings): + configuration = name.rsplit('_', 1)[0] + platform = settings.get('msvs_configuration_platform', 'Win32') + return (configuration, platform) + + +def _GetConfigurationCondition(name, settings): + return (r"'$(Configuration)|$(Platform)'=='%s|%s'" % + _GetConfigurationAndPlatform(name, settings)) + + +def _GetMSBuildProjectConfigurations(configurations): + group = ['ItemGroup', {'Label': 'ProjectConfigurations'}] + for (name, settings) in sorted(configurations.iteritems()): + configuration, platform = _GetConfigurationAndPlatform(name, settings) + designation = '%s|%s' % (configuration, platform) + group.append( + ['ProjectConfiguration', {'Include': designation}, + ['Configuration', configuration], + ['Platform', platform]]) + return [group] + + +def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name): + namespace = os.path.splitext(gyp_file_name)[0] + return [ + ['PropertyGroup', {'Label': 'Globals'}, + ['ProjectGuid', guid], + ['Keyword', 'Win32Proj'], + ['RootNamespace', namespace], + ] + ] + + +def _GetMSBuildConfigurationDetails(spec, build_file): + properties = {} + for name, settings in spec['configurations'].iteritems(): + msbuild_attributes = _GetMSBuildAttributes(spec, settings, build_file) + condition = _GetConfigurationCondition(name, settings) + character_set = msbuild_attributes.get('CharacterSet') + _AddConditionalProperty(properties, condition, 'ConfigurationType', + msbuild_attributes['ConfigurationType']) + if character_set: + _AddConditionalProperty(properties, condition, 'CharacterSet', + character_set) + return _GetMSBuildPropertyGroup(spec, 'Configuration', properties) + + +def _GetMSBuildLocalProperties(msbuild_toolset): + # Currently the only local property we support is PlatformToolset + properties = {} + if msbuild_toolset: + properties = [ + ['PropertyGroup', {'Label': 'Locals'}, + ['PlatformToolset', msbuild_toolset], + ] + ] + return properties + + +def _GetMSBuildPropertySheets(configurations): + user_props = r'$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props' + additional_props = {} + props_specified = False + for name, settings in sorted(configurations.iteritems()): + configuration = _GetConfigurationCondition(name, settings) + if settings.has_key('msbuild_props'): + additional_props[configuration] = _FixPaths(settings['msbuild_props']) + props_specified = True + else: + additional_props[configuration] = '' + + if not props_specified: + return [ + ['ImportGroup', + {'Label': 'PropertySheets'}, + ['Import', + {'Project': user_props, + 'Condition': "exists('%s')" % user_props, + 'Label': 'LocalAppDataPlatform' + } + ] + ] + ] + else: + sheets = [] + for condition, props in additional_props.iteritems(): + import_group = [ + 'ImportGroup', + {'Label': 'PropertySheets', + 'Condition': condition + }, + ['Import', + {'Project': user_props, + 'Condition': "exists('%s')" % user_props, + 'Label': 'LocalAppDataPlatform' + } + ] + ] + for props_file in props: + import_group.append(['Import', {'Project':props_file}]) + sheets.append(import_group) + return sheets + +def _ConvertMSVSBuildAttributes(spec, config, build_file): + + + + config_type = _GetMSVSConfigurationType(spec, build_file) + msvs_attributes = _GetMSVSAttributes(spec, config, config_type) + msbuild_attributes = {} + for a in msvs_attributes: + if a in ['IntermediateDirectory', 'OutputDirectory']: + directory = MSVSSettings.ConvertVCMacrosToMSBuild(msvs_attributes[a]) + if not directory.endswith('\\'): + directory += '\\' + msbuild_attributes[a] = directory + elif a == 'CharacterSet': + msbuild_attributes[a] = _ConvertMSVSCharacterSet(msvs_attributes[a]) + elif a == 'ConfigurationType': + msbuild_attributes[a] = _ConvertMSVSConfigurationType(msvs_attributes[a]) + else: + print 'Warning: Do not know how to convert MSVS attribute ' + a + return msbuild_attributes + + +def _ConvertMSVSCharacterSet(char_set): + if char_set.isdigit(): + char_set = { + '0': 'MultiByte', + '1': 'Unicode', + '2': 'MultiByte', + }[char_set] + return char_set + + +def _ConvertMSVSConfigurationType(config_type): + if config_type.isdigit(): + config_type = { + '1': 'Application', + '2': 'DynamicLibrary', + '4': 'StaticLibrary', + '10': 'Utility' + }[config_type] + return config_type + + +def _GetMSBuildAttributes(spec, config, build_file): + if 'msbuild_configuration_attributes' not in config: + msbuild_attributes = _ConvertMSVSBuildAttributes(spec, config, build_file) + + else: + config_type = _GetMSVSConfigurationType(spec, build_file) + config_type = _ConvertMSVSConfigurationType(config_type) + msbuild_attributes = config.get('msbuild_configuration_attributes', {}) + msbuild_attributes['ConfigurationType'] = config_type + output_dir = msbuild_attributes.get('OutputDirectory', + '$(SolutionDir)$(Configuration)\\') + msbuild_attributes['OutputDirectory'] = output_dir + if 'IntermediateDirectory' not in msbuild_attributes: + intermediate = '$(Configuration)\\' + msbuild_attributes['IntermediateDirectory'] = intermediate + if 'CharacterSet' in msbuild_attributes: + msbuild_attributes['CharacterSet'] = _ConvertMSVSCharacterSet( + msbuild_attributes['CharacterSet']) + if 'TargetName' not in msbuild_attributes: + prefix = spec.get('product_prefix', '') + product_name = spec.get('product_name', '$(ProjectName)') + target_name = prefix + product_name + msbuild_attributes['TargetName'] = target_name + + # Make sure that 'TargetPath' matches 'Lib.OutputFile' or 'Link.OutputFile' + # (depending on the tool used) to avoid MSB8012 warning. + msbuild_tool_map = { + 'executable': 'Link', + 'shared_library': 'Link', + 'loadable_module': 'Link', + 'static_library': 'Lib', + } + msbuild_tool = msbuild_tool_map.get(spec['type']) + if msbuild_tool: + msbuild_settings = config['finalized_msbuild_settings'] + out_file = msbuild_settings[msbuild_tool].get('OutputFile') + if out_file: + msbuild_attributes['TargetPath'] = out_file + + return msbuild_attributes + + +def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file): + # TODO(jeanluc) We could optimize out the following and do it only if + # there are actions. + # TODO(jeanluc) Handle the equivalent of setting 'CYGWIN=nontsec'. + new_paths = [] + cygwin_dirs = spec.get('msvs_cygwin_dirs', ['.'])[0] + if cygwin_dirs: + cyg_path = '$(MSBuildProjectDirectory)\\%s\\bin\\' % _FixPath(cygwin_dirs) + new_paths.append(cyg_path) + # TODO(jeanluc) Change the convention to have both a cygwin_dir and a + # python_dir. + python_path = cyg_path.replace('cygwin\\bin', 'python_26') + new_paths.append(python_path) + if new_paths: + new_paths = '$(ExecutablePath);' + ';'.join(new_paths) + + properties = {} + for (name, configuration) in sorted(configurations.iteritems()): + condition = _GetConfigurationCondition(name, configuration) + attributes = _GetMSBuildAttributes(spec, configuration, build_file) + msbuild_settings = configuration['finalized_msbuild_settings'] + _AddConditionalProperty(properties, condition, 'IntDir', + attributes['IntermediateDirectory']) + _AddConditionalProperty(properties, condition, 'OutDir', + attributes['OutputDirectory']) + _AddConditionalProperty(properties, condition, 'TargetName', + attributes['TargetName']) + + if attributes.get('TargetPath'): + _AddConditionalProperty(properties, condition, 'TargetPath', + attributes['TargetPath']) + + if new_paths: + _AddConditionalProperty(properties, condition, 'ExecutablePath', + new_paths) + tool_settings = msbuild_settings.get('', {}) + for name, value in sorted(tool_settings.iteritems()): + formatted_value = _GetValueFormattedForMSBuild('', name, value) + _AddConditionalProperty(properties, condition, name, formatted_value) + return _GetMSBuildPropertyGroup(spec, None, properties) + + +def _AddConditionalProperty(properties, condition, name, value): + """Adds a property / conditional value pair to a dictionary. + + Arguments: + properties: The dictionary to be modified. The key is the name of the + property. The value is itself a dictionary; its key is the value and + the value a list of condition for which this value is true. + condition: The condition under which the named property has the value. + name: The name of the property. + value: The value of the property. + """ + if name not in properties: + properties[name] = {} + values = properties[name] + if value not in values: + values[value] = [] + conditions = values[value] + conditions.append(condition) + + +# Regex for msvs variable references ( i.e. $(FOO) ). +MSVS_VARIABLE_REFERENCE = re.compile('\$\(([a-zA-Z_][a-zA-Z0-9_]*)\)') + + +def _GetMSBuildPropertyGroup(spec, label, properties): + """Returns a PropertyGroup definition for the specified properties. + + Arguments: + spec: The target project dict. + label: An optional label for the PropertyGroup. + properties: The dictionary to be converted. The key is the name of the + property. The value is itself a dictionary; its key is the value and + the value a list of condition for which this value is true. + """ + group = ['PropertyGroup'] + if label: + group.append({'Label': label}) + num_configurations = len(spec['configurations']) + def GetEdges(node): + # Use a definition of edges such that user_of_variable -> used_varible. + # This happens to be easier in this case, since a variable's + # definition contains all variables it references in a single string. + edges = set() + for value in sorted(properties[node].keys()): + # Add to edges all $(...) references to variables. + # + # Variable references that refer to names not in properties are excluded + # These can exist for instance to refer built in definitions like + # $(SolutionDir). + # + # Self references are ignored. Self reference is used in a few places to + # append to the default value. I.e. PATH=$(PATH);other_path + edges.update(set([v for v in MSVS_VARIABLE_REFERENCE.findall(value) + if v in properties and v != node])) + return edges + properties_ordered = gyp.common.TopologicallySorted( + properties.keys(), GetEdges) + # Walk properties in the reverse of a topological sort on + # user_of_variable -> used_variable as this ensures variables are + # defined before they are used. + # NOTE: reverse(topsort(DAG)) = topsort(reverse_edges(DAG)) + for name in reversed(properties_ordered): + values = properties[name] + for value, conditions in sorted(values.iteritems()): + if len(conditions) == num_configurations: + # If the value is the same all configurations, + # just add one unconditional entry. + group.append([name, value]) + else: + for condition in conditions: + group.append([name, {'Condition': condition}, value]) + return [group] + + +def _GetMSBuildToolSettingsSections(spec, configurations): + groups = [] + for (name, configuration) in sorted(configurations.iteritems()): + msbuild_settings = configuration['finalized_msbuild_settings'] + group = ['ItemDefinitionGroup', + {'Condition': _GetConfigurationCondition(name, configuration)} + ] + for tool_name, tool_settings in sorted(msbuild_settings.iteritems()): + # Skip the tool named '' which is a holder of global settings handled + # by _GetMSBuildConfigurationGlobalProperties. + if tool_name: + if tool_settings: + tool = [tool_name] + for name, value in sorted(tool_settings.iteritems()): + formatted_value = _GetValueFormattedForMSBuild(tool_name, name, + value) + tool.append([name, formatted_value]) + group.append(tool) + groups.append(group) + return groups + + +def _FinalizeMSBuildSettings(spec, configuration): + if 'msbuild_settings' in configuration: + converted = False + msbuild_settings = configuration['msbuild_settings'] + MSVSSettings.ValidateMSBuildSettings(msbuild_settings) + else: + converted = True + msvs_settings = configuration.get('msvs_settings', {}) + msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(msvs_settings) + include_dirs, resource_include_dirs = _GetIncludeDirs(configuration) + libraries = _GetLibraries(spec) + out_file, _, msbuild_tool = _GetOutputFilePathAndTool(spec) + defines = _GetDefines(configuration) + if converted: + # Visual Studio 2010 has TR1 + defines = [d for d in defines if d != '_HAS_TR1=0'] + # Warn of ignored settings + ignored_settings = ['msvs_prebuild', 'msvs_postbuild', 'msvs_tool_files'] + for ignored_setting in ignored_settings: + value = configuration.get(ignored_setting) + if value: + print ('Warning: The automatic conversion to MSBuild does not handle ' + '%s. Ignoring setting of %s' % (ignored_setting, str(value))) + + defines = [_EscapeCppDefineForMSBuild(d) for d in defines] + disabled_warnings = _GetDisabledWarnings(configuration) + # TODO(jeanluc) Validate & warn that we don't translate + # prebuild = configuration.get('msvs_prebuild') + # postbuild = configuration.get('msvs_postbuild') + def_file = _GetModuleDefinition(spec) + precompiled_header = configuration.get('msvs_precompiled_header') + + # Add the information to the appropriate tool + # TODO(jeanluc) We could optimize and generate these settings only if + # the corresponding files are found, e.g. don't generate ResourceCompile + # if you don't have any resources. + _ToolAppend(msbuild_settings, 'ClCompile', + 'AdditionalIncludeDirectories', include_dirs) + _ToolAppend(msbuild_settings, 'ResourceCompile', + 'AdditionalIncludeDirectories', resource_include_dirs) + # Add in libraries. + _ToolAppend(msbuild_settings, 'Link', 'AdditionalDependencies', libraries) + if out_file: + _ToolAppend(msbuild_settings, msbuild_tool, 'OutputFile', out_file, + only_if_unset=True) + # Add defines. + _ToolAppend(msbuild_settings, 'ClCompile', + 'PreprocessorDefinitions', defines) + _ToolAppend(msbuild_settings, 'ResourceCompile', + 'PreprocessorDefinitions', defines) + # Add disabled warnings. + _ToolAppend(msbuild_settings, 'ClCompile', + 'DisableSpecificWarnings', disabled_warnings) + # Turn on precompiled headers if appropriate. + if precompiled_header: + precompiled_header = os.path.split(precompiled_header)[1] + _ToolAppend(msbuild_settings, 'ClCompile', 'PrecompiledHeader', 'Use') + _ToolAppend(msbuild_settings, 'ClCompile', + 'PrecompiledHeaderFile', precompiled_header) + _ToolAppend(msbuild_settings, 'ClCompile', + 'ForcedIncludeFiles', precompiled_header) + # Loadable modules don't generate import libraries; + # tell dependent projects to not expect one. + if spec['type'] == 'loadable_module': + _ToolAppend(msbuild_settings, '', 'IgnoreImportLibrary', 'true') + # Set the module definition file if any. + if def_file: + _ToolAppend(msbuild_settings, 'Link', 'ModuleDefinitionFile', def_file) + configuration['finalized_msbuild_settings'] = msbuild_settings + + +def _GetValueFormattedForMSBuild(tool_name, name, value): + if type(value) == list: + # For some settings, VS2010 does not automatically extends the settings + # TODO(jeanluc) Is this what we want? + if name in ['AdditionalDependencies', + 'AdditionalIncludeDirectories', + 'AdditionalLibraryDirectories', + 'AdditionalOptions', + 'DelayLoadDLLs', + 'DisableSpecificWarnings', + 'PreprocessorDefinitions']: + value.append('%%(%s)' % name) + # For most tools, entries in a list should be separated with ';' but some + # settings use a space. Check for those first. + exceptions = { + 'ClCompile': ['AdditionalOptions'], + 'Link': ['AdditionalOptions'], + 'Lib': ['AdditionalOptions']} + if tool_name in exceptions and name in exceptions[tool_name]: + char = ' ' + else: + char = ';' + formatted_value = char.join( + [MSVSSettings.ConvertVCMacrosToMSBuild(i) for i in value]) + else: + formatted_value = MSVSSettings.ConvertVCMacrosToMSBuild(value) + return formatted_value + + +def _VerifySourcesExist(sources, root_dir): + """Verifies that all source files exist on disk. + + Checks that all regular source files, i.e. not created at run time, + exist on disk. Missing files cause needless recompilation but no otherwise + visible errors. + + Arguments: + sources: A recursive list of Filter/file names. + root_dir: The root directory for the relative path names. + Returns: + A list of source files that cannot be found on disk. + """ + missing_sources = [] + for source in sources: + if isinstance(source, MSVSProject.Filter): + missing_sources.extend(_VerifySourcesExist(source.contents, root_dir)) + else: + if '$' not in source: + full_path = os.path.join(root_dir, source) + if not os.path.exists(full_path): + missing_sources.append(full_path) + return missing_sources + + +def _GetMSBuildSources(spec, sources, exclusions, extension_to_rule_name, + actions_spec, sources_handled_by_action, list_excluded): + groups = ['none', 'midl', 'include', 'compile', 'resource', 'rule'] + grouped_sources = {} + for g in groups: + grouped_sources[g] = [] + + _AddSources2(spec, sources, exclusions, grouped_sources, + extension_to_rule_name, sources_handled_by_action, list_excluded) + sources = [] + for g in groups: + if grouped_sources[g]: + sources.append(['ItemGroup'] + grouped_sources[g]) + if actions_spec: + sources.append(['ItemGroup'] + actions_spec) + return sources + + +def _AddSources2(spec, sources, exclusions, grouped_sources, + extension_to_rule_name, sources_handled_by_action, + list_excluded): + extensions_excluded_from_precompile = [] + for source in sources: + if isinstance(source, MSVSProject.Filter): + _AddSources2(spec, source.contents, exclusions, grouped_sources, + extension_to_rule_name, sources_handled_by_action, + list_excluded) + else: + if not source in sources_handled_by_action: + detail = [] + excluded_configurations = exclusions.get(source, []) + if len(excluded_configurations) == len(spec['configurations']): + detail.append(['ExcludedFromBuild', 'true']) + else: + for config_name, configuration in sorted(excluded_configurations): + condition = _GetConfigurationCondition(config_name, configuration) + detail.append(['ExcludedFromBuild', + {'Condition': condition}, + 'true']) + # Add precompile if needed + for config_name, configuration in spec['configurations'].iteritems(): + precompiled_source = configuration.get('msvs_precompiled_source', '') + if precompiled_source != '': + precompiled_source = _FixPath(precompiled_source) + if not extensions_excluded_from_precompile: + # If the precompiled header is generated by a C source, we must + # not try to use it for C++ sources, and vice versa. + basename, extension = os.path.splitext(precompiled_source) + if extension == '.c': + extensions_excluded_from_precompile = ['.cc', '.cpp', '.cxx'] + else: + extensions_excluded_from_precompile = ['.c'] + + if precompiled_source == source: + condition = _GetConfigurationCondition(config_name, configuration) + detail.append(['PrecompiledHeader', + {'Condition': condition}, + 'Create' + ]) + else: + # Turn off precompiled header usage for source files of a + # different type than the file that generated the + # precompiled header. + for extension in extensions_excluded_from_precompile: + if source.endswith(extension): + detail.append(['PrecompiledHeader', '']) + detail.append(['ForcedIncludeFiles', '']) + + group, element = _MapFileToMsBuildSourceType(source, + extension_to_rule_name) + grouped_sources[group].append([element, {'Include': source}] + detail) + + +def _GetMSBuildProjectReferences(project): + references = [] + if project.dependencies: + group = ['ItemGroup'] + for dependency in project.dependencies: + guid = dependency.guid + project_dir = os.path.split(project.path)[0] + relative_path = gyp.common.RelativePath(dependency.path, project_dir) + project_ref = ['ProjectReference', + {'Include': relative_path}, + ['Project', guid], + ['ReferenceOutputAssembly', 'false'] + ] + for config in dependency.spec.get('configurations', {}).itervalues(): + # If it's disabled in any config, turn it off in the reference. + if config.get('msvs_2010_disable_uldi_when_referenced', 0): + project_ref.append(['UseLibraryDependencyInputs', 'false']) + break + group.append(project_ref) + references.append(group) + return references + + +def _GenerateMSBuildProject(project, options, version, generator_flags): + spec = project.spec + configurations = spec['configurations'] + project_dir, project_file_name = os.path.split(project.path) + msbuildproj_dir = os.path.dirname(project.path) + if msbuildproj_dir and not os.path.exists(msbuildproj_dir): + os.makedirs(msbuildproj_dir) + # Prepare list of sources and excluded sources. + gyp_path = _NormalizedSource(project.build_file) + relative_path_of_gyp_file = gyp.common.RelativePath(gyp_path, project_dir) + + gyp_file = os.path.split(project.build_file)[1] + sources, excluded_sources = _PrepareListOfSources(spec, gyp_file) + # Add rules. + actions_to_add = {} + props_files_of_rules = set() + targets_files_of_rules = set() + extension_to_rule_name = {} + list_excluded = generator_flags.get('msvs_list_excluded_files', True) + _GenerateRulesForMSBuild(project_dir, options, spec, + sources, excluded_sources, + props_files_of_rules, targets_files_of_rules, + actions_to_add, extension_to_rule_name) + sources, excluded_sources, excluded_idl = ( + _AdjustSourcesAndConvertToFilterHierarchy(spec, options, + project_dir, sources, + excluded_sources, + list_excluded)) + _AddActions(actions_to_add, spec, project.build_file) + _AddCopies(actions_to_add, spec) + + # NOTE: this stanza must appear after all actions have been decided. + # Don't excluded sources with actions attached, or they won't run. + excluded_sources = _FilterActionsFromExcluded( + excluded_sources, actions_to_add) + + exclusions = _GetExcludedFilesFromBuild(spec, excluded_sources, excluded_idl) + actions_spec, sources_handled_by_action = _GenerateActionsForMSBuild( + spec, actions_to_add) + + _GenerateMSBuildFiltersFile(project.path + '.filters', sources, + extension_to_rule_name) + missing_sources = _VerifySourcesExist(sources, project_dir) + + for (_, configuration) in configurations.iteritems(): + _FinalizeMSBuildSettings(spec, configuration) + + # Add attributes to root element + + import_default_section = [ + ['Import', {'Project': r'$(VCTargetsPath)\Microsoft.Cpp.Default.props'}]] + import_cpp_props_section = [ + ['Import', {'Project': r'$(VCTargetsPath)\Microsoft.Cpp.props'}]] + import_cpp_targets_section = [ + ['Import', {'Project': r'$(VCTargetsPath)\Microsoft.Cpp.targets'}]] + macro_section = [['PropertyGroup', {'Label': 'UserMacros'}]] + + content = [ + 'Project', + {'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003', + 'ToolsVersion': version.ProjectVersion(), + 'DefaultTargets': 'Build' + }] + + content += _GetMSBuildProjectConfigurations(configurations) + content += _GetMSBuildGlobalProperties(spec, project.guid, project_file_name) + content += import_default_section + content += _GetMSBuildConfigurationDetails(spec, project.build_file) + content += _GetMSBuildLocalProperties(project.msbuild_toolset) + content += import_cpp_props_section + content += _GetMSBuildExtensions(props_files_of_rules) + content += _GetMSBuildPropertySheets(configurations) + content += macro_section + content += _GetMSBuildConfigurationGlobalProperties(spec, configurations, + project.build_file) + content += _GetMSBuildToolSettingsSections(spec, configurations) + content += _GetMSBuildSources( + spec, sources, exclusions, extension_to_rule_name, actions_spec, + sources_handled_by_action, list_excluded) + content += _GetMSBuildProjectReferences(project) + content += import_cpp_targets_section + content += _GetMSBuildExtensionTargets(targets_files_of_rules) + + # TODO(jeanluc) File a bug to get rid of runas. We had in MSVS: + # has_run_as = _WriteMSVSUserFile(project.path, version, spec) + + easy_xml.WriteXmlIfChanged(content, project.path) + + return missing_sources + + +def _GetMSBuildExtensions(props_files_of_rules): + extensions = ['ImportGroup', {'Label': 'ExtensionSettings'}] + for props_file in props_files_of_rules: + extensions.append(['Import', {'Project': props_file}]) + return [extensions] + + +def _GetMSBuildExtensionTargets(targets_files_of_rules): + targets_node = ['ImportGroup', {'Label': 'ExtensionTargets'}] + for targets_file in sorted(targets_files_of_rules): + targets_node.append(['Import', {'Project': targets_file}]) + return [targets_node] + + +def _GenerateActionsForMSBuild(spec, actions_to_add): + """Add actions accumulated into an actions_to_add, merging as needed. + + Arguments: + spec: the target project dict + actions_to_add: dictionary keyed on input name, which maps to a list of + dicts describing the actions attached to that input file. + + Returns: + A pair of (action specification, the sources handled by this action). + """ + sources_handled_by_action = set() + actions_spec = [] + for primary_input, actions in actions_to_add.iteritems(): + inputs = set() + outputs = set() + descriptions = [] + commands = [] + for action in actions: + inputs.update(set(action['inputs'])) + outputs.update(set(action['outputs'])) + descriptions.append(action['description']) + cmd = action['command'] + # For most actions, add 'call' so that actions that invoke batch files + # return and continue executing. msbuild_use_call provides a way to + # disable this but I have not seen any adverse effect from doing that + # for everything. + if action.get('msbuild_use_call', True): + cmd = 'call ' + cmd + commands.append(cmd) + # Add the custom build action for one input file. + description = ', and also '.join(descriptions) + + # We can't join the commands simply with && because the command line will + # get too long. See also _AddActions: cygwin's setup_env mustn't be called + # for every invocation or the command that sets the PATH will grow too + # long. + command = ( + '\r\nif %errorlevel% neq 0 exit /b %errorlevel%\r\n'.join(commands)) + _AddMSBuildAction(spec, + primary_input, + inputs, + outputs, + command, + description, + sources_handled_by_action, + actions_spec) + return actions_spec, sources_handled_by_action + + +def _AddMSBuildAction(spec, primary_input, inputs, outputs, cmd, description, + sources_handled_by_action, actions_spec): + command = MSVSSettings.ConvertVCMacrosToMSBuild(cmd) + primary_input = _FixPath(primary_input) + inputs_array = _FixPaths(inputs) + outputs_array = _FixPaths(outputs) + additional_inputs = ';'.join([i for i in inputs_array + if i != primary_input]) + outputs = ';'.join(outputs_array) + sources_handled_by_action.add(primary_input) + action_spec = ['CustomBuild', {'Include': primary_input}] + action_spec.extend( + # TODO(jeanluc) 'Document' for all or just if as_sources? + [['FileType', 'Document'], + ['Command', command], + ['Message', description], + ['Outputs', outputs] + ]) + if additional_inputs: + action_spec.append(['AdditionalInputs', additional_inputs]) + actions_spec.append(action_spec) diff --git a/tools/gyp/pylib/gyp/generator/msvs_test.py b/tools/gyp/pylib/gyp/generator/msvs_test.py new file mode 100755 index 000000000..5a69c1c28 --- /dev/null +++ b/tools/gyp/pylib/gyp/generator/msvs_test.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Unit tests for the msvs.py file. """ + +import gyp.generator.msvs as msvs +import unittest +import StringIO + + +class TestSequenceFunctions(unittest.TestCase): + + def setUp(self): + self.stderr = StringIO.StringIO() + + def test_GetLibraries(self): + self.assertEqual( + msvs._GetLibraries({}), + []) + self.assertEqual( + msvs._GetLibraries({'libraries': []}), + []) + self.assertEqual( + msvs._GetLibraries({'other':'foo', 'libraries': ['a.lib']}), + ['a.lib']) + self.assertEqual( + msvs._GetLibraries({'libraries': ['a.lib', 'b.lib', 'c.lib', '-lb.lib', + '-lb.lib', 'd.lib', 'a.lib']}), + ['c.lib', 'b.lib', 'd.lib', 'a.lib']) + +if __name__ == '__main__': + unittest.main() diff --git a/tools/gyp/pylib/gyp/generator/ninja.py b/tools/gyp/pylib/gyp/generator/ninja.py new file mode 100644 index 000000000..8add064f0 --- /dev/null +++ b/tools/gyp/pylib/gyp/generator/ninja.py @@ -0,0 +1,1551 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import copy +import gyp +import gyp.common +import gyp.msvs_emulation +import gyp.MSVSVersion +import gyp.system_test +import gyp.xcode_emulation +import os.path +import re +import subprocess +import sys + +import gyp.ninja_syntax as ninja_syntax + +generator_default_variables = { + 'EXECUTABLE_PREFIX': '', + 'EXECUTABLE_SUFFIX': '', + 'STATIC_LIB_PREFIX': 'lib', + 'STATIC_LIB_SUFFIX': '.a', + 'SHARED_LIB_PREFIX': 'lib', + + # Gyp expects the following variables to be expandable by the build + # system to the appropriate locations. Ninja prefers paths to be + # known at gyp time. To resolve this, introduce special + # variables starting with $! (which begin with a $ so gyp knows it + # should be treated as a path, but is otherwise an invalid + # ninja/shell variable) that are passed to gyp here but expanded + # before writing out into the target .ninja files; see + # ExpandSpecial. + 'INTERMEDIATE_DIR': '$!INTERMEDIATE_DIR', + 'SHARED_INTERMEDIATE_DIR': '$!PRODUCT_DIR/gen', + 'PRODUCT_DIR': '$!PRODUCT_DIR', + + # Special variables that may be used by gyp 'rule' targets. + # We generate definitions for these variables on the fly when processing a + # rule. + 'RULE_INPUT_ROOT': '${root}', + 'RULE_INPUT_DIRNAME': '${dirname}', + 'RULE_INPUT_PATH': '${source}', + 'RULE_INPUT_EXT': '${ext}', + 'RULE_INPUT_NAME': '${name}', +} + +# Placates pylint. +generator_additional_non_configuration_keys = [] +generator_additional_path_sections = [] +generator_extra_sources_for_rules = [] + +# TODO: figure out how to not build extra host objects in the non-cross-compile +# case when this is enabled, and enable unconditionally. +generator_supports_multiple_toolsets = ( + os.environ.get('AR_target') or os.environ.get('CC_target') or + os.environ.get('CXX_target')) + + +def StripPrefix(arg, prefix): + if arg.startswith(prefix): + return arg[len(prefix):] + return arg + + +def QuoteShellArgument(arg, flavor): + """Quote a string such that it will be interpreted as a single argument + by the shell.""" + # Rather than attempting to enumerate the bad shell characters, just + # whitelist common OK ones and quote anything else. + if re.match(r'^[a-zA-Z0-9_=.\\/-]+$', arg): + return arg # No quoting necessary. + if flavor == 'win': + return gyp.msvs_emulation.QuoteForRspFile(arg) + return "'" + arg.replace("'", "'" + '"\'"' + "'") + "'" + + +def Define(d, flavor): + """Takes a preprocessor define and returns a -D parameter that's ninja- and + shell-escaped.""" + if flavor == 'win': + # cl.exe replaces literal # characters with = in preprocesor definitions for + # some reason. Octal-encode to work around that. + d = d.replace('#', '\\%03o' % ord('#')) + return QuoteShellArgument(ninja_syntax.escape('-D' + d), flavor) + + +def InvertRelativePath(path): + """Given a relative path like foo/bar, return the inverse relative path: + the path from the relative path back to the origin dir. + + E.g. os.path.normpath(os.path.join(path, InvertRelativePath(path))) + should always produce the empty string.""" + + if not path: + return path + # Only need to handle relative paths into subdirectories for now. + assert '..' not in path, path + depth = len(path.split(os.path.sep)) + return os.path.sep.join(['..'] * depth) + + +class Target: + """Target represents the paths used within a single gyp target. + + Conceptually, building a single target A is a series of steps: + + 1) actions/rules/copies generates source/resources/etc. + 2) compiles generates .o files + 3) link generates a binary (library/executable) + 4) bundle merges the above in a mac bundle + + (Any of these steps can be optional.) + + From a build ordering perspective, a dependent target B could just + depend on the last output of this series of steps. + + But some dependent commands sometimes need to reach inside the box. + For example, when linking B it needs to get the path to the static + library generated by A. + + This object stores those paths. To keep things simple, member + variables only store concrete paths to single files, while methods + compute derived values like "the last output of the target". + """ + def __init__(self, type): + # Gyp type ("static_library", etc.) of this target. + self.type = type + # File representing whether any input dependencies necessary for + # dependent actions have completed. + self.preaction_stamp = None + # File representing whether any input dependencies necessary for + # dependent compiles have completed. + self.precompile_stamp = None + # File representing the completion of actions/rules/copies, if any. + self.actions_stamp = None + # Path to the output of the link step, if any. + self.binary = None + # Path to the file representing the completion of building the bundle, + # if any. + self.bundle = None + # On Windows, incremental linking requires linking against all the .objs + # that compose a .lib (rather than the .lib itself). That list is stored + # here. + self.component_objs = None + # Windows only. The import .lib is the output of a build step, but + # because dependents only link against the lib (not both the lib and the + # dll) we keep track of the import library here. + self.import_lib = None + + def Linkable(self): + """Return true if this is a target that can be linked against.""" + return self.type in ('static_library', 'shared_library') + + def PreActionInput(self): + """Return the path, if any, that should be used as a dependency of + any dependent action step.""" + return self.FinalOutput() or self.preaction_stamp + + def PreCompileInput(self): + """Return the path, if any, that should be used as a dependency of + any dependent compile step.""" + return self.actions_stamp or self.precompile_stamp + + def FinalOutput(self): + """Return the last output of the target, which depends on all prior + steps.""" + return self.bundle or self.binary or self.actions_stamp + + +# A small discourse on paths as used within the Ninja build: +# All files we produce (both at gyp and at build time) appear in the +# build directory (e.g. out/Debug). +# +# Paths within a given .gyp file are always relative to the directory +# containing the .gyp file. Call these "gyp paths". This includes +# sources as well as the starting directory a given gyp rule/action +# expects to be run from. We call the path from the source root to +# the gyp file the "base directory" within the per-.gyp-file +# NinjaWriter code. +# +# All paths as written into the .ninja files are relative to the build +# directory. Call these paths "ninja paths". +# +# We translate between these two notions of paths with two helper +# functions: +# +# - GypPathToNinja translates a gyp path (i.e. relative to the .gyp file) +# into the equivalent ninja path. +# +# - GypPathToUniqueOutput translates a gyp path into a ninja path to write +# an output file; the result can be namespaced such that it is unique +# to the input file name as well as the output target name. + +class NinjaWriter: + def __init__(self, qualified_target, target_outputs, base_dir, build_dir, + output_file, flavor, abs_build_dir=None): + """ + base_dir: path from source root to directory containing this gyp file, + by gyp semantics, all input paths are relative to this + build_dir: path from source root to build output + abs_build_dir: absolute path to the build directory + """ + + self.qualified_target = qualified_target + self.target_outputs = target_outputs + self.base_dir = base_dir + self.build_dir = build_dir + self.ninja = ninja_syntax.Writer(output_file) + self.flavor = flavor + self.abs_build_dir = abs_build_dir + self.obj_ext = '.obj' if flavor == 'win' else '.o' + + # Relative path from build output dir to base dir. + self.build_to_base = os.path.join(InvertRelativePath(build_dir), base_dir) + # Relative path from base dir to build dir. + self.base_to_build = os.path.join(InvertRelativePath(base_dir), build_dir) + + def ExpandSpecial(self, path, product_dir=None): + """Expand specials like $!PRODUCT_DIR in |path|. + + If |product_dir| is None, assumes the cwd is already the product + dir. Otherwise, |product_dir| is the relative path to the product + dir. + """ + + PRODUCT_DIR = '$!PRODUCT_DIR' + if PRODUCT_DIR in path: + if product_dir: + path = path.replace(PRODUCT_DIR, product_dir) + else: + path = path.replace(PRODUCT_DIR + '/', '') + path = path.replace(PRODUCT_DIR + '\\', '') + path = path.replace(PRODUCT_DIR, '.') + + INTERMEDIATE_DIR = '$!INTERMEDIATE_DIR' + if INTERMEDIATE_DIR in path: + int_dir = self.GypPathToUniqueOutput('gen') + # GypPathToUniqueOutput generates a path relative to the product dir, + # so insert product_dir in front if it is provided. + path = path.replace(INTERMEDIATE_DIR, + os.path.join(product_dir or '', int_dir)) + return path + + def ExpandRuleVariables(self, path, root, dirname, source, ext, name): + if self.flavor == 'win': + path = self.msvs_settings.ConvertVSMacros(path) + path = path.replace(generator_default_variables['RULE_INPUT_ROOT'], root) + path = path.replace(generator_default_variables['RULE_INPUT_DIRNAME'], + dirname) + path = path.replace(generator_default_variables['RULE_INPUT_PATH'], source) + path = path.replace(generator_default_variables['RULE_INPUT_EXT'], ext) + path = path.replace(generator_default_variables['RULE_INPUT_NAME'], name) + return path + + def GypPathToNinja(self, path, env=None): + """Translate a gyp path to a ninja path, optionally expanding environment + variable references in |path| with |env|. + + See the above discourse on path conversions.""" + if env: + if self.flavor == 'mac': + path = gyp.xcode_emulation.ExpandEnvVars(path, env) + elif self.flavor == 'win': + path = gyp.msvs_emulation.ExpandMacros(path, env) + if path.startswith('$!'): + expanded = self.ExpandSpecial(path) + if self.flavor == 'win': + expanded = os.path.normpath(expanded) + return expanded + assert '$' not in path, path + return os.path.normpath(os.path.join(self.build_to_base, path)) + + def GypPathToUniqueOutput(self, path, qualified=True): + """Translate a gyp path to a ninja path for writing output. + + If qualified is True, qualify the resulting filename with the name + of the target. This is necessary when e.g. compiling the same + path twice for two separate output targets. + + See the above discourse on path conversions.""" + + path = self.ExpandSpecial(path) + assert not path.startswith('$'), path + + # Translate the path following this scheme: + # Input: foo/bar.gyp, target targ, references baz/out.o + # Output: obj/foo/baz/targ.out.o (if qualified) + # obj/foo/baz/out.o (otherwise) + # (and obj.host instead of obj for cross-compiles) + # + # Why this scheme and not some other one? + # 1) for a given input, you can compute all derived outputs by matching + # its path, even if the input is brought via a gyp file with '..'. + # 2) simple files like libraries and stamps have a simple filename. + + obj = 'obj' + if self.toolset != 'target': + obj += '.' + self.toolset + + path_dir, path_basename = os.path.split(path) + if qualified: + path_basename = self.name + '.' + path_basename + return os.path.normpath(os.path.join(obj, self.base_dir, path_dir, + path_basename)) + + def WriteCollapsedDependencies(self, name, targets): + """Given a list of targets, return a path for a single file + representing the result of building all the targets or None. + + Uses a stamp file if necessary.""" + + assert targets == filter(None, targets), targets + if len(targets) == 0: + return None + if len(targets) > 1: + stamp = self.GypPathToUniqueOutput(name + '.stamp') + targets = self.ninja.build(stamp, 'stamp', targets) + self.ninja.newline() + return targets[0] + + def WriteSpec(self, spec, config_name, generator_flags): + """The main entry point for NinjaWriter: write the build rules for a spec. + + Returns a Target object, which represents the output paths for this spec. + Returns None if there are no outputs (e.g. a settings-only 'none' type + target).""" + + self.config_name = config_name + self.name = spec['target_name'] + self.toolset = spec['toolset'] + config = spec['configurations'][config_name] + self.target = Target(spec['type']) + + self.is_mac_bundle = gyp.xcode_emulation.IsMacBundle(self.flavor, spec) + self.xcode_settings = self.msvs_settings = None + if self.flavor == 'mac': + self.xcode_settings = gyp.xcode_emulation.XcodeSettings(spec) + if self.flavor == 'win': + self.msvs_settings = gyp.msvs_emulation.MsvsSettings(spec, + generator_flags) + + # Compute predepends for all rules. + # actions_depends is the dependencies this target depends on before running + # any of its action/rule/copy steps. + # compile_depends is the dependencies this target depends on before running + # any of its compile steps. + actions_depends = [] + compile_depends = [] + # TODO(evan): it is rather confusing which things are lists and which + # are strings. Fix these. + if 'dependencies' in spec: + for dep in spec['dependencies']: + if dep in self.target_outputs: + target = self.target_outputs[dep] + actions_depends.append(target.PreActionInput()) + compile_depends.append(target.PreCompileInput()) + actions_depends = filter(None, actions_depends) + compile_depends = filter(None, compile_depends) + actions_depends = self.WriteCollapsedDependencies('actions_depends', + actions_depends) + compile_depends = self.WriteCollapsedDependencies('compile_depends', + compile_depends) + self.target.preaction_stamp = actions_depends + self.target.precompile_stamp = compile_depends + + # Write out actions, rules, and copies. These must happen before we + # compile any sources, so compute a list of predependencies for sources + # while we do it. + extra_sources = [] + mac_bundle_depends = [] + self.target.actions_stamp = self.WriteActionsRulesCopies( + spec, extra_sources, actions_depends, mac_bundle_depends) + + # If we have actions/rules/copies, we depend directly on those, but + # otherwise we depend on dependent target's actions/rules/copies etc. + # We never need to explicitly depend on previous target's link steps, + # because no compile ever depends on them. + compile_depends_stamp = (self.target.actions_stamp or compile_depends) + + # Write out the compilation steps, if any. + link_deps = [] + sources = spec.get('sources', []) + extra_sources + if sources: + pch = None + if self.flavor == 'win': + pch = gyp.msvs_emulation.PrecompiledHeader( + self.msvs_settings, config_name, self.GypPathToNinja) + else: + pch = gyp.xcode_emulation.MacPrefixHeader( + self.xcode_settings, self.GypPathToNinja, + lambda path, lang: self.GypPathToUniqueOutput(path + '-' + lang)) + link_deps = self.WriteSources( + config_name, config, sources, compile_depends_stamp, pch) + # Some actions/rules output 'sources' that are already object files. + link_deps += [self.GypPathToNinja(f) + for f in sources if f.endswith(self.obj_ext)] + + if self.flavor == 'win' and self.target.type == 'static_library': + self.target.component_objs = link_deps + + # Write out a link step, if needed. + output = None + if link_deps or self.target.actions_stamp or actions_depends: + output = self.WriteTarget(spec, config_name, config, link_deps, + self.target.actions_stamp or actions_depends) + if self.is_mac_bundle: + mac_bundle_depends.append(output) + + # Bundle all of the above together, if needed. + if self.is_mac_bundle: + output = self.WriteMacBundle(spec, mac_bundle_depends) + + if not output: + return None + + assert self.target.FinalOutput(), output + return self.target + + def _WinIdlRule(self, source, prebuild, outputs): + """Handle the implicit VS .idl rule for one source file. Fills |outputs| + with files that are generated.""" + outdir, output, vars, flags = self.msvs_settings.GetIdlBuildData( + source, self.config_name) + outdir = self.GypPathToNinja(outdir) + def fix_path(path, rel=None): + path = os.path.join(outdir, path) + dirname, basename = os.path.split(source) + root, ext = os.path.splitext(basename) + path = self.ExpandRuleVariables( + path, root, dirname, source, ext, basename) + if rel: + path = os.path.relpath(path, rel) + return path + vars = [(name, fix_path(value, outdir)) for name, value in vars] + output = [fix_path(p) for p in output] + vars.append(('outdir', outdir)) + vars.append(('idlflags', flags)) + input = self.GypPathToNinja(source) + self.ninja.build(output, 'idl', input, + variables=vars, order_only=prebuild) + outputs.extend(output) + + def WriteWinIdlFiles(self, spec, prebuild): + """Writes rules to match MSVS's implicit idl handling.""" + assert self.flavor == 'win' + if self.msvs_settings.HasExplicitIdlRules(spec): + return [] + outputs = [] + for source in filter(lambda x: x.endswith('.idl'), spec['sources']): + self._WinIdlRule(source, prebuild, outputs) + return outputs + + def WriteActionsRulesCopies(self, spec, extra_sources, prebuild, + mac_bundle_depends): + """Write out the Actions, Rules, and Copies steps. Return a path + representing the outputs of these steps.""" + outputs = [] + extra_mac_bundle_resources = [] + + if 'actions' in spec: + outputs += self.WriteActions(spec['actions'], extra_sources, prebuild, + extra_mac_bundle_resources) + if 'rules' in spec: + outputs += self.WriteRules(spec['rules'], extra_sources, prebuild, + extra_mac_bundle_resources) + if 'copies' in spec: + outputs += self.WriteCopies(spec['copies'], prebuild) + + if 'sources' in spec and self.flavor == 'win': + outputs += self.WriteWinIdlFiles(spec, prebuild) + + stamp = self.WriteCollapsedDependencies('actions_rules_copies', outputs) + + if self.is_mac_bundle: + mac_bundle_resources = spec.get('mac_bundle_resources', []) + \ + extra_mac_bundle_resources + self.WriteMacBundleResources(mac_bundle_resources, mac_bundle_depends) + self.WriteMacInfoPlist(mac_bundle_depends) + + return stamp + + def GenerateDescription(self, verb, message, fallback): + """Generate and return a description of a build step. + + |verb| is the short summary, e.g. ACTION or RULE. + |message| is a hand-written description, or None if not available. + |fallback| is the gyp-level name of the step, usable as a fallback. + """ + if self.toolset != 'target': + verb += '(%s)' % self.toolset + if message: + return '%s %s' % (verb, self.ExpandSpecial(message)) + else: + return '%s %s: %s' % (verb, self.name, fallback) + + def WriteActions(self, actions, extra_sources, prebuild, + extra_mac_bundle_resources): + # Actions cd into the base directory. + env = self.GetSortedXcodeEnv() + if self.flavor == 'win': + env = self.msvs_settings.GetVSMacroEnv('$!PRODUCT_DIR') + all_outputs = [] + for action in actions: + # First write out a rule for the action. + name = '%s_%s' % (self.qualified_target, action['action_name']) + description = self.GenerateDescription('ACTION', + action.get('message', None), + name) + is_cygwin = (self.msvs_settings.IsRuleRunUnderCygwin(action) + if self.flavor == 'win' else False) + args = action['action'] + args = [self.msvs_settings.ConvertVSMacros(arg, self.base_to_build) + for arg in args] if self.flavor == 'win' else args + rule_name = self.WriteNewNinjaRule(name, args, description, + is_cygwin, env=env) + + inputs = [self.GypPathToNinja(i, env) for i in action['inputs']] + if int(action.get('process_outputs_as_sources', False)): + extra_sources += action['outputs'] + if int(action.get('process_outputs_as_mac_bundle_resources', False)): + extra_mac_bundle_resources += action['outputs'] + outputs = [self.GypPathToNinja(o, env) for o in action['outputs']] + + # Then write out an edge using the rule. + self.ninja.build(outputs, rule_name, inputs, + order_only=prebuild) + all_outputs += outputs + + self.ninja.newline() + + return all_outputs + + def WriteRules(self, rules, extra_sources, prebuild, + extra_mac_bundle_resources): + all_outputs = [] + for rule in rules: + # First write out a rule for the rule action. + name = '%s_%s' % (self.qualified_target, rule['rule_name']) + # Skip a rule with no action and no inputs. + if 'action' not in rule and not rule.get('rule_sources', []): + continue + args = rule['action'] + description = self.GenerateDescription( + 'RULE', + rule.get('message', None), + ('%s ' + generator_default_variables['RULE_INPUT_PATH']) % name) + is_cygwin = (self.msvs_settings.IsRuleRunUnderCygwin(rule) + if self.flavor == 'win' else False) + args = [self.msvs_settings.ConvertVSMacros(arg, self.base_to_build) + for arg in args] if self.flavor == 'win' else args + rule_name = self.WriteNewNinjaRule(name, args, description, is_cygwin) + + # TODO: if the command references the outputs directly, we should + # simplify it to just use $out. + + # Rules can potentially make use of some special variables which + # must vary per source file. + # Compute the list of variables we'll need to provide. + special_locals = ('source', 'root', 'dirname', 'ext', 'name') + needed_variables = set(['source']) + for argument in args: + for var in special_locals: + if ('${%s}' % var) in argument: + needed_variables.add(var) + + def cygwin_munge(path): + if is_cygwin: + return path.replace('\\', '/') + return path + + # For each source file, write an edge that generates all the outputs. + for source in rule.get('rule_sources', []): + dirname, basename = os.path.split(source) + root, ext = os.path.splitext(basename) + + # Gather the list of inputs and outputs, expanding $vars if possible. + outputs = [self.ExpandRuleVariables(o, root, dirname, + source, ext, basename) + for o in rule['outputs']] + inputs = [self.ExpandRuleVariables(i, root, dirname, + source, ext, basename) + for i in rule.get('inputs', [])] + + if int(rule.get('process_outputs_as_sources', False)): + extra_sources += outputs + if int(rule.get('process_outputs_as_mac_bundle_resources', False)): + extra_mac_bundle_resources += outputs + + extra_bindings = [] + for var in needed_variables: + if var == 'root': + extra_bindings.append(('root', cygwin_munge(root))) + elif var == 'dirname': + extra_bindings.append(('dirname', cygwin_munge(dirname))) + elif var == 'source': + # '$source' is a parameter to the rule action, which means + # it shouldn't be converted to a Ninja path. But we don't + # want $!PRODUCT_DIR in there either. + source_expanded = self.ExpandSpecial(source, self.base_to_build) + extra_bindings.append(('source', cygwin_munge(source_expanded))) + elif var == 'ext': + extra_bindings.append(('ext', ext)) + elif var == 'name': + extra_bindings.append(('name', cygwin_munge(basename))) + else: + assert var == None, repr(var) + + inputs = map(self.GypPathToNinja, inputs) + outputs = map(self.GypPathToNinja, outputs) + self.ninja.build(outputs, rule_name, self.GypPathToNinja(source), + implicit=inputs, + order_only=prebuild, + variables=extra_bindings) + + all_outputs.extend(outputs) + + return all_outputs + + def WriteCopies(self, copies, prebuild): + outputs = [] + env = self.GetSortedXcodeEnv() + for copy in copies: + for path in copy['files']: + # Normalize the path so trailing slashes don't confuse us. + path = os.path.normpath(path) + basename = os.path.split(path)[1] + src = self.GypPathToNinja(path, env) + dst = self.GypPathToNinja(os.path.join(copy['destination'], basename), + env) + outputs += self.ninja.build(dst, 'copy', src, order_only=prebuild) + + return outputs + + def WriteMacBundleResources(self, resources, bundle_depends): + """Writes ninja edges for 'mac_bundle_resources'.""" + for output, res in gyp.xcode_emulation.GetMacBundleResources( + self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']), + self.xcode_settings, map(self.GypPathToNinja, resources)): + self.ninja.build(output, 'mac_tool', res, + variables=[('mactool_cmd', 'copy-bundle-resource')]) + bundle_depends.append(output) + + def WriteMacInfoPlist(self, bundle_depends): + """Write build rules for bundle Info.plist files.""" + info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist( + self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']), + self.xcode_settings, self.GypPathToNinja) + if not info_plist: + return + if defines: + # Create an intermediate file to store preprocessed results. + intermediate_plist = self.GypPathToUniqueOutput( + os.path.basename(info_plist)) + defines = ' '.join([Define(d, self.flavor) for d in defines]) + info_plist = self.ninja.build(intermediate_plist, 'infoplist', info_plist, + variables=[('defines',defines)]) + + env = self.GetSortedXcodeEnv(additional_settings=extra_env) + env = self.ComputeExportEnvString(env) + + self.ninja.build(out, 'mac_tool', info_plist, + variables=[('mactool_cmd', 'copy-info-plist'), + ('env', env)]) + bundle_depends.append(out) + + def WriteSources(self, config_name, config, sources, predepends, + precompiled_header): + """Write build rules to compile all of |sources|.""" + if self.toolset == 'target': + self.ninja.variable('ar', '$ar_target') + self.ninja.variable('cc', '$cc_target') + self.ninja.variable('cxx', '$cxx_target') + self.ninja.variable('ld', '$ld_target') + + extra_defines = [] + if self.flavor == 'mac': + cflags = self.xcode_settings.GetCflags(config_name) + cflags_c = self.xcode_settings.GetCflagsC(config_name) + cflags_cc = self.xcode_settings.GetCflagsCC(config_name) + cflags_objc = ['$cflags_c'] + \ + self.xcode_settings.GetCflagsObjC(config_name) + cflags_objcc = ['$cflags_cc'] + \ + self.xcode_settings.GetCflagsObjCC(config_name) + elif self.flavor == 'win': + cflags = self.msvs_settings.GetCflags(config_name) + cflags_c = self.msvs_settings.GetCflagsC(config_name) + cflags_cc = self.msvs_settings.GetCflagsCC(config_name) + extra_defines = self.msvs_settings.GetComputedDefines(config_name) + self.WriteVariableList('pdbname', [self.name + '.pdb']) + self.WriteVariableList('pchprefix', [self.name]) + else: + cflags = config.get('cflags', []) + cflags_c = config.get('cflags_c', []) + cflags_cc = config.get('cflags_cc', []) + + defines = config.get('defines', []) + extra_defines + self.WriteVariableList('defines', [Define(d, self.flavor) for d in defines]) + if self.flavor == 'win': + self.WriteVariableList('rcflags', + [QuoteShellArgument(self.ExpandSpecial(f), self.flavor) + for f in self.msvs_settings.GetRcflags(config_name, + self.GypPathToNinja)]) + + include_dirs = config.get('include_dirs', []) + if self.flavor == 'win': + include_dirs = self.msvs_settings.AdjustIncludeDirs(include_dirs, + config_name) + self.WriteVariableList('includes', + [QuoteShellArgument('-I' + self.GypPathToNinja(i), self.flavor) + for i in include_dirs]) + + pch_commands = precompiled_header.GetPchBuildCommands() + if self.flavor == 'mac': + self.WriteVariableList('cflags_pch_c', + [precompiled_header.GetInclude('c')]) + self.WriteVariableList('cflags_pch_cc', + [precompiled_header.GetInclude('cc')]) + self.WriteVariableList('cflags_pch_objc', + [precompiled_header.GetInclude('m')]) + self.WriteVariableList('cflags_pch_objcc', + [precompiled_header.GetInclude('mm')]) + + self.WriteVariableList('cflags', map(self.ExpandSpecial, cflags)) + self.WriteVariableList('cflags_c', map(self.ExpandSpecial, cflags_c)) + self.WriteVariableList('cflags_cc', map(self.ExpandSpecial, cflags_cc)) + if self.flavor == 'mac': + self.WriteVariableList('cflags_objc', map(self.ExpandSpecial, + cflags_objc)) + self.WriteVariableList('cflags_objcc', map(self.ExpandSpecial, + cflags_objcc)) + self.ninja.newline() + outputs = [] + for source in sources: + filename, ext = os.path.splitext(source) + ext = ext[1:] + obj_ext = self.obj_ext + if ext in ('cc', 'cpp', 'cxx'): + command = 'cxx' + elif ext == 'c' or (ext in ('s', 'S') and self.flavor != 'win'): + # TODO(scottmg): .s files won't be handled by the Windows compiler. + # We could add support for .asm, though that's only supported on + # x86. Currently not used in Chromium in favor of other third-party + # assemblers. + command = 'cc' + elif self.flavor == 'mac' and ext == 'm': + command = 'objc' + elif self.flavor == 'mac' and ext == 'mm': + command = 'objcxx' + elif self.flavor == 'win' and ext == 'rc': + command = 'rc' + obj_ext = '.res' + else: + # Ignore unhandled extensions. + continue + input = self.GypPathToNinja(source) + output = self.GypPathToUniqueOutput(filename + obj_ext) + implicit = precompiled_header.GetObjDependencies([input], [output]) + self.ninja.build(output, command, input, + implicit=[gch for _, _, gch in implicit], + order_only=predepends) + outputs.append(output) + + self.WritePchTargets(pch_commands) + + self.ninja.newline() + return outputs + + def WritePchTargets(self, pch_commands): + """Writes ninja rules to compile prefix headers.""" + if not pch_commands: + return + + for gch, lang_flag, lang, input in pch_commands: + var_name = { + 'c': 'cflags_pch_c', + 'cc': 'cflags_pch_cc', + 'm': 'cflags_pch_objc', + 'mm': 'cflags_pch_objcc', + }[lang] + + map = { 'c': 'cc', 'cc': 'cxx', 'm': 'objc', 'mm': 'objcxx', } + if self.flavor == 'win': + map.update({'c': 'cc_pch', 'cc': 'cxx_pch'}) + cmd = map.get(lang) + self.ninja.build(gch, cmd, input, variables=[(var_name, lang_flag)]) + + def WriteLink(self, spec, config_name, config, link_deps): + """Write out a link step. Fills out target.binary. """ + + command = { + 'executable': 'link', + 'loadable_module': 'solink_module', + 'shared_library': 'solink', + }[spec['type']] + + implicit_deps = set() + + if 'dependencies' in spec: + # Two kinds of dependencies: + # - Linkable dependencies (like a .a or a .so): add them to the link line. + # - Non-linkable dependencies (like a rule that generates a file + # and writes a stamp file): add them to implicit_deps + extra_link_deps = set() + for dep in spec['dependencies']: + target = self.target_outputs.get(dep) + if not target: + continue + linkable = target.Linkable() + if linkable: + if (self.flavor == 'win' and + target.component_objs and + self.msvs_settings.IsUseLibraryDependencyInputs(config_name)): + extra_link_deps |= set(target.component_objs) + elif self.flavor == 'win' and target.import_lib: + extra_link_deps.add(target.import_lib) + else: + extra_link_deps.add(target.binary) + + final_output = target.FinalOutput() + if not linkable or final_output != target.binary: + implicit_deps.add(final_output) + + link_deps.extend(list(extra_link_deps)) + + extra_bindings = [] + if self.is_mac_bundle: + output = self.ComputeMacBundleBinaryOutput() + else: + output = self.ComputeOutput(spec) + extra_bindings.append(('postbuilds', + self.GetPostbuildCommand(spec, output, output))) + + if self.flavor == 'mac': + ldflags = self.xcode_settings.GetLdflags(config_name, + self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']), + self.GypPathToNinja) + elif self.flavor == 'win': + libflags = self.msvs_settings.GetLibFlags(config_name, + self.GypPathToNinja) + self.WriteVariableList( + 'libflags', gyp.common.uniquer(map(self.ExpandSpecial, libflags))) + ldflags = self.msvs_settings.GetLdflags(config_name, + self.GypPathToNinja, self.ExpandSpecial) + else: + ldflags = config.get('ldflags', []) + self.WriteVariableList('ldflags', + gyp.common.uniquer(map(self.ExpandSpecial, + ldflags))) + + libraries = gyp.common.uniquer(map(self.ExpandSpecial, + spec.get('libraries', []))) + if self.flavor == 'mac': + libraries = self.xcode_settings.AdjustLibraries(libraries) + elif self.flavor == 'win': + libraries = self.msvs_settings.AdjustLibraries(libraries) + self.WriteVariableList('libs', libraries) + + self.target.binary = output + + if command in ('solink', 'solink_module'): + extra_bindings.append(('soname', os.path.split(output)[1])) + if self.flavor == 'win': + self.target.import_lib = output + '.lib' + extra_bindings.append(('dll', output)) + extra_bindings.append(('implib', self.target.import_lib)) + output = [output, self.target.import_lib] + + self.ninja.build(output, command, link_deps, + implicit=list(implicit_deps), + variables=extra_bindings) + + def WriteTarget(self, spec, config_name, config, link_deps, compile_deps): + if spec['type'] == 'none': + # TODO(evan): don't call this function for 'none' target types, as + # it doesn't do anything, and we fake out a 'binary' with a stamp file. + self.target.binary = compile_deps + elif spec['type'] == 'static_library': + self.target.binary = self.ComputeOutput(spec) + self.ninja.build(self.target.binary, 'alink', link_deps, + order_only=compile_deps, + variables=[('postbuilds', self.GetPostbuildCommand( + spec, self.target.binary, self.target.binary))]) + else: + self.WriteLink(spec, config_name, config, link_deps) + return self.target.binary + + def WriteMacBundle(self, spec, mac_bundle_depends): + assert self.is_mac_bundle + package_framework = spec['type'] in ('shared_library', 'loadable_module') + output = self.ComputeMacBundleOutput() + postbuild = self.GetPostbuildCommand(spec, output, self.target.binary, + is_command_start=not package_framework) + variables = [] + if postbuild: + variables.append(('postbuilds', postbuild)) + if package_framework: + variables.append(('version', self.xcode_settings.GetFrameworkVersion())) + self.ninja.build(output, 'package_framework', mac_bundle_depends, + variables=variables) + else: + self.ninja.build(output, 'stamp', mac_bundle_depends, + variables=variables) + self.target.bundle = output + return output + + def GetSortedXcodeEnv(self, additional_settings=None): + """Returns the variables Xcode would set for build steps.""" + assert self.abs_build_dir + abs_build_dir = self.abs_build_dir + return gyp.xcode_emulation.GetSortedXcodeEnv( + self.xcode_settings, abs_build_dir, + os.path.join(abs_build_dir, self.build_to_base), self.config_name, + additional_settings) + + def GetSortedXcodePostbuildEnv(self): + """Returns the variables Xcode would set for postbuild steps.""" + postbuild_settings = {} + # CHROMIUM_STRIP_SAVE_FILE is a chromium-specific hack. + # TODO(thakis): It would be nice to have some general mechanism instead. + strip_save_file = self.xcode_settings.GetPerTargetSetting( + 'CHROMIUM_STRIP_SAVE_FILE') + if strip_save_file: + postbuild_settings['CHROMIUM_STRIP_SAVE_FILE'] = strip_save_file + return self.GetSortedXcodeEnv(additional_settings=postbuild_settings) + + def GetPostbuildCommand(self, spec, output, output_binary, + is_command_start=False): + """Returns a shell command that runs all the postbuilds, and removes + |output| if any of them fails. If |is_command_start| is False, then the + returned string will start with ' && '.""" + if not self.xcode_settings or spec['type'] == 'none' or not output: + return '' + output = QuoteShellArgument(output, self.flavor) + target_postbuilds = self.xcode_settings.GetTargetPostbuilds( + self.config_name, + os.path.normpath(os.path.join(self.base_to_build, output)), + QuoteShellArgument( + os.path.normpath(os.path.join(self.base_to_build, output_binary)), + self.flavor), + quiet=True) + postbuilds = gyp.xcode_emulation.GetSpecPostbuildCommands(spec, quiet=True) + postbuilds = target_postbuilds + postbuilds + if not postbuilds: + return '' + # Postbuilds expect to be run in the gyp file's directory, so insert an + # implicit postbuild to cd to there. + postbuilds.insert(0, gyp.common.EncodePOSIXShellList( + ['cd', self.build_to_base])) + env = self.ComputeExportEnvString(self.GetSortedXcodePostbuildEnv()) + # G will be non-null if any postbuild fails. Run all postbuilds in a + # subshell. + commands = env + ' (F=0; ' + \ + ' '.join([ninja_syntax.escape(command) + ' || F=$$?;' + for command in postbuilds]) + command_string = (commands + ' exit $$F); G=$$?; ' + # Remove the final output if any postbuild failed. + '((exit $$G) || rm -rf %s) ' % output + '&& exit $$G)') + if is_command_start: + return '(' + command_string + ' && ' + else: + return '$ && (' + command_string + + def ComputeExportEnvString(self, env): + """Given an environment, returns a string looking like + 'export FOO=foo; export BAR="${FOO} bar;' + that exports |env| to the shell.""" + export_str = [] + for k, v in env: + export_str.append('export %s=%s;' % + (k, ninja_syntax.escape(gyp.common.EncodePOSIXShellArgument(v)))) + return ' '.join(export_str) + + def ComputeMacBundleOutput(self): + """Return the 'output' (full output path) to a bundle output directory.""" + assert self.is_mac_bundle + path = self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']) + return os.path.join(path, self.xcode_settings.GetWrapperName()) + + def ComputeMacBundleBinaryOutput(self): + """Return the 'output' (full output path) to the binary in a bundle.""" + assert self.is_mac_bundle + path = self.ExpandSpecial(generator_default_variables['PRODUCT_DIR']) + return os.path.join(path, self.xcode_settings.GetExecutablePath()) + + def ComputeOutputFileName(self, spec, type=None): + """Compute the filename of the final output for the current target.""" + if not type: + type = spec['type'] + + default_variables = copy.copy(generator_default_variables) + CalculateVariables(default_variables, {'flavor': self.flavor}) + + # Compute filename prefix: the product prefix, or a default for + # the product type. + DEFAULT_PREFIX = { + 'loadable_module': default_variables['SHARED_LIB_PREFIX'], + 'shared_library': default_variables['SHARED_LIB_PREFIX'], + 'static_library': default_variables['STATIC_LIB_PREFIX'], + 'executable': default_variables['EXECUTABLE_PREFIX'], + } + prefix = spec.get('product_prefix', DEFAULT_PREFIX.get(type, '')) + + # Compute filename extension: the product extension, or a default + # for the product type. + DEFAULT_EXTENSION = { + 'loadable_module': default_variables['SHARED_LIB_SUFFIX'], + 'shared_library': default_variables['SHARED_LIB_SUFFIX'], + 'static_library': default_variables['STATIC_LIB_SUFFIX'], + 'executable': default_variables['EXECUTABLE_SUFFIX'], + } + extension = spec.get('product_extension') + if extension: + extension = '.' + extension + else: + extension = DEFAULT_EXTENSION.get(type, '') + + if 'product_name' in spec: + # If we were given an explicit name, use that. + target = spec['product_name'] + else: + # Otherwise, derive a name from the target name. + target = spec['target_name'] + if prefix == 'lib': + # Snip out an extra 'lib' from libs if appropriate. + target = StripPrefix(target, 'lib') + + if type in ('static_library', 'loadable_module', 'shared_library', + 'executable'): + return '%s%s%s' % (prefix, target, extension) + elif type == 'none': + return '%s.stamp' % target + else: + raise Exception('Unhandled output type %s' % type) + + def ComputeOutput(self, spec, type=None): + """Compute the path for the final output of the spec.""" + assert not self.is_mac_bundle or type + + if not type: + type = spec['type'] + + if self.flavor == 'win': + override = self.msvs_settings.GetOutputName(self.config_name, + self.ExpandSpecial) + if override: + return override + + if self.flavor == 'mac' and type in ( + 'static_library', 'executable', 'shared_library', 'loadable_module'): + filename = self.xcode_settings.GetExecutablePath() + else: + filename = self.ComputeOutputFileName(spec, type) + + if 'product_dir' in spec: + path = os.path.join(spec['product_dir'], filename) + return self.ExpandSpecial(path) + + # Some products go into the output root, libraries go into shared library + # dir, and everything else goes into the normal place. + type_in_output_root = ['executable', 'loadable_module'] + if self.flavor == 'mac' and self.toolset == 'target': + type_in_output_root += ['shared_library', 'static_library'] + elif self.flavor == 'win' and self.toolset == 'target': + type_in_output_root += ['shared_library'] + + if type in type_in_output_root: + return filename + elif type == 'shared_library': + libdir = 'lib' + if self.toolset != 'target': + libdir = os.path.join('lib', '%s' % self.toolset) + return os.path.join(libdir, filename) + else: + return self.GypPathToUniqueOutput(filename, qualified=False) + + def WriteVariableList(self, var, values): + assert not isinstance(values, str) + if values is None: + values = [] + self.ninja.variable(var, ' '.join(values)) + + def WriteNewNinjaRule(self, name, args, description, is_cygwin, env={}): + """Write out a new ninja "rule" statement for a given command. + + Returns the name of the new rule.""" + + # TODO: we shouldn't need to qualify names; we do it because + # currently the ninja rule namespace is global, but it really + # should be scoped to the subninja. + rule_name = self.name + if self.toolset == 'target': + rule_name += '.' + self.toolset + rule_name += '.' + name + rule_name = re.sub('[^a-zA-Z0-9_]', '_', rule_name) + + args = args[:] + + if self.flavor == 'win': + description = self.msvs_settings.ConvertVSMacros(description) + + # gyp dictates that commands are run from the base directory. + # cd into the directory before running, and adjust paths in + # the arguments to point to the proper locations. + if self.flavor == 'win': + cd = 'cmd /s /c "' + if not is_cygwin: + # cd command added by BuildCygwinBashCommandLine in cygwin case. + cd += 'cd %s && ' % self.build_to_base + else: + cd = 'cd %s; ' % self.build_to_base + args = [self.ExpandSpecial(arg, self.base_to_build) for arg in args] + env = self.ComputeExportEnvString(env) if self.flavor != 'win' else '' + if self.flavor == 'win': + if is_cygwin: + command = self.msvs_settings.BuildCygwinBashCommandLine( + args, self.build_to_base) + else: + # If there's no command, fake one to match the dangling |&&| above. + command = gyp.msvs_emulation.EncodeRspFileList(args) or 'cmd /c' + command += '"' # Close quote opened in |cd|. + else: + command = gyp.common.EncodePOSIXShellList(args) + if env: + # If an environment is passed in, variables in the command should be + # read from it, instead of from ninja's internal variables. + command = ninja_syntax.escape(command) + + command = cd + env + command + # GYP rules/actions express being no-ops by not touching their outputs. + # Avoid executing downstream dependencies in this case by specifying + # restat=1 to ninja. + self.ninja.rule(rule_name, command, description, restat=True) + self.ninja.newline() + + return rule_name + + +def CalculateVariables(default_variables, params): + """Calculate additional variables for use in the build (called by gyp).""" + global generator_additional_non_configuration_keys + global generator_additional_path_sections + cc_target = os.environ.get('CC.target', os.environ.get('CC', 'cc')) + flavor = gyp.common.GetFlavor(params) + if flavor == 'mac': + default_variables.setdefault('OS', 'mac') + default_variables.setdefault('SHARED_LIB_SUFFIX', '.dylib') + default_variables.setdefault('SHARED_LIB_DIR', + generator_default_variables['PRODUCT_DIR']) + default_variables.setdefault('LIB_DIR', + generator_default_variables['PRODUCT_DIR']) + + # Copy additional generator configuration data from Xcode, which is shared + # by the Mac Ninja generator. + import gyp.generator.xcode as xcode_generator + generator_additional_non_configuration_keys = getattr(xcode_generator, + 'generator_additional_non_configuration_keys', []) + generator_additional_path_sections = getattr(xcode_generator, + 'generator_additional_path_sections', []) + global generator_extra_sources_for_rules + generator_extra_sources_for_rules = getattr(xcode_generator, + 'generator_extra_sources_for_rules', []) + elif flavor == 'win': + default_variables.setdefault('OS', 'win') + default_variables['EXECUTABLE_SUFFIX'] = '.exe' + default_variables['STATIC_LIB_PREFIX'] = '' + default_variables['STATIC_LIB_SUFFIX'] = '.lib' + default_variables['SHARED_LIB_PREFIX'] = '' + default_variables['SHARED_LIB_SUFFIX'] = '.dll' + generator_flags = params.get('generator_flags', {}) + + # Copy additional generator configuration data from VS, which is shared + # by the Windows Ninja generator. + import gyp.generator.msvs as msvs_generator + generator_additional_non_configuration_keys = getattr(msvs_generator, + 'generator_additional_non_configuration_keys', []) + generator_additional_path_sections = getattr(msvs_generator, + 'generator_additional_path_sections', []) + + # Set a variable so conditions can be based on msvs_version. + msvs_version = gyp.msvs_emulation.GetVSVersion(generator_flags) + default_variables['MSVS_VERSION'] = msvs_version.ShortName() + + # To determine processor word size on Windows, in addition to checking + # PROCESSOR_ARCHITECTURE (which reflects the word size of the current + # process), it is also necessary to check PROCESSOR_ARCHITEW6432 (which + # contains the actual word size of the system when running thru WOW64). + if ('64' in os.environ.get('PROCESSOR_ARCHITECTURE', '') or + '64' in os.environ.get('PROCESSOR_ARCHITEW6432', '')): + default_variables['MSVS_OS_BITS'] = 64 + else: + default_variables['MSVS_OS_BITS'] = 32 + else: + operating_system = flavor + if flavor == 'android': + operating_system = 'linux' # Keep this legacy behavior for now. + default_variables.setdefault('OS', operating_system) + default_variables.setdefault('SHARED_LIB_SUFFIX', '.so') + default_variables.setdefault('SHARED_LIB_DIR', + os.path.join('$!PRODUCT_DIR', 'lib')) + default_variables.setdefault('LIB_DIR', + os.path.join('$!PRODUCT_DIR', 'obj')) + + +def OpenOutput(path): + """Open |path| for writing, creating directories if necessary.""" + try: + os.makedirs(os.path.dirname(path)) + except OSError: + pass + return open(path, 'w') + + +def _WriteWinEnvironmentHelper(toplevel_build, generator_flags): + """It's not sufficient to have the absolute path to the compiler, linker, + etc. on Windows, as those tools rely on .dlls being in the PATH. We write a + helper .bat file that sets up the environment correctly once we've detected + which toolchain we want to use.""" + out = OpenOutput(os.path.join(toplevel_build, 'set_environment.bat')) + vsvars_path = gyp.msvs_emulation.GetVsvarsPath(generator_flags) + out.write('@call "%s"\n' % vsvars_path) + out.close() + + +def GenerateOutputForConfig(target_list, target_dicts, data, params, + config_name): + options = params['options'] + flavor = gyp.common.GetFlavor(params) + generator_flags = params.get('generator_flags', {}) + + # build_dir: relative path from source root to our output files. + # e.g. "out/Debug" + build_dir = os.path.join(generator_flags.get('output_dir', 'out'), + config_name) + + toplevel_build = os.path.join(options.toplevel_dir, build_dir) + + master_ninja = ninja_syntax.Writer( + OpenOutput(os.path.join(toplevel_build, 'build.ninja')), + width=120) + + # Put build-time support tools in out/{config_name}. + gyp.common.CopyTool(flavor, toplevel_build) + + # Grab make settings for CC/CXX. + if flavor == 'win': + cc = cxx = gyp.msvs_emulation.GetCLPath(generator_flags) + _WriteWinEnvironmentHelper(toplevel_build, generator_flags) + else: + cc, cxx = 'gcc', 'g++' + build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) + make_global_settings = data[build_file].get('make_global_settings', []) + build_to_root = InvertRelativePath(build_dir) + for key, value in make_global_settings: + if key == 'CC': cc = os.path.join(build_to_root, value) + if key == 'CXX': cxx = os.path.join(build_to_root, value) + + flock = 'flock' + if flavor == 'mac': + flock = './gyp-mac-tool flock' + master_ninja.variable('cc', os.environ.get('CC', cc)) + master_ninja.variable('cxx', os.environ.get('CXX', cxx)) + if flavor == 'win': + master_ninja.variable('ld', gyp.msvs_emulation.GetLinkPath(generator_flags)) + master_ninja.variable('idl', + gyp.msvs_emulation.GetMidlPath(generator_flags)) + master_ninja.variable('ar', gyp.msvs_emulation.GetLibPath(generator_flags)) + # TODO(scottmg): Note that rc.exe isn't part of VS, it's part of the + # Windows SDK. We currently assume it's in the PATH, we may need to figure + # out a way to locate it explicitly. + master_ninja.variable('rc', 'rc.exe') + else: + master_ninja.variable('ld', flock + ' linker.lock $cxx') + master_ninja.variable('ar', os.environ.get('AR', 'ar')) + + master_ninja.variable('ar_target', os.environ.get('AR_target', '$ar')) + master_ninja.variable('cc_target', os.environ.get('CC_target', '$cc')) + master_ninja.variable('cxx_target', os.environ.get('CXX_target', '$cxx')) + if flavor == 'win': + master_ninja.variable('ld_target', os.environ.get('LD_target', '$ld')) + else: + master_ninja.variable('ld_target', flock + ' linker.lock $cxx_target') + + if flavor == 'mac': + master_ninja.variable('mac_tool', os.path.join('.', 'gyp-mac-tool')) + master_ninja.newline() + + if flavor != 'win': + master_ninja.rule( + 'cc', + description='CC $out', + command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_c ' + '$cflags_pch_c -c $in -o $out'), + depfile='$out.d') + master_ninja.rule( + 'cxx', + description='CXX $out', + command=('$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc ' + '$cflags_pch_cc -c $in -o $out'), + depfile='$out.d') + else: + # TODO(scottmg): Requires fork of ninja for dependency and linking + # support: https://github.com/sgraham/ninja + # Template for compile commands mostly shared between compiling files + # and generating PCH. In the case of PCH, the "output" is specified by /Fp + # rather than /Fo (for object files), but we still need to specify an /Fo + # when compiling PCH. + cc_template = ('cmd /s /c "$cc /nologo /showIncludes ' + '@$out.rsp ' + '$cflags_pch_c /c $in %(outspec)s /Fd$pdbname ' + '| ninja-deplist-helper -r . -q -f cl -o $out.dl"') + cxx_template = ('cmd /s /c "$cxx /nologo /showIncludes ' + '@$out.rsp ' + '$cflags_pch_cc /c $in %(outspec)s $pchobj /Fd$pdbname ' + '| ninja-deplist-helper -r . -q -f cl -o $out.dl"') + master_ninja.rule( + 'cc', + description='CC $out', + command=cc_template % {'outspec': '/Fo$out'}, + deplist='$out.dl', + rspfile='$out.rsp', + rspfile_content='$defines $includes $cflags $cflags_c') + master_ninja.rule( + 'cc_pch', + description='CC PCH $out', + command=cc_template % {'outspec': '/Fp$out /Fo$out.obj'}, + deplist='$out.dl', + rspfile='$out.rsp', + rspfile_content='$defines $includes $cflags $cflags_c') + master_ninja.rule( + 'cxx', + description='CXX $out', + command=cxx_template % {'outspec': '/Fo$out'}, + deplist='$out.dl', + rspfile='$out.rsp', + rspfile_content='$defines $includes $cflags $cflags_cc') + master_ninja.rule( + 'cxx_pch', + description='CXX PCH $out', + command=cxx_template % {'outspec': '/Fp$out /Fo$out.obj'}, + deplist='$out.dl', + rspfile='$out.rsp', + rspfile_content='$defines $includes $cflags $cflags_cc') + master_ninja.rule( + 'idl', + description='IDL $in', + command=('python gyp-win-tool midl-wrapper $outdir ' + '$tlb $h $dlldata $iid $proxy $in ' + '$idlflags')) + master_ninja.rule( + 'rc', + description='RC $in', + # Note: $in must be last otherwise rc.exe complains. + command=('python gyp-win-tool rc-wrapper ' + '$rc $defines $includes $rcflags /fo$out $in')) + + if flavor != 'mac' and flavor != 'win': + master_ninja.rule( + 'alink', + description='AR $out', + command='rm -f $out && $ar rcsT $out $in') + master_ninja.rule( + 'solink', + description='SOLINK $out', + command=('$ld -shared $ldflags -o $out -Wl,-soname=$soname ' + '-Wl,--whole-archive $in -Wl,--no-whole-archive $libs')) + master_ninja.rule( + 'solink_module', + description='SOLINK(module) $out', + command=('$ld -shared $ldflags -o $out -Wl,-soname=$soname ' + '-Wl,--start-group $in -Wl,--end-group $libs')) + master_ninja.rule( + 'link', + description='LINK $out', + command=('$ld $ldflags -o $out -Wl,-rpath=\$$ORIGIN/lib ' + '-Wl,--start-group $in -Wl,--end-group $libs')) + elif flavor == 'win': + master_ninja.rule( + 'alink', + description='LIB $out', + command='$ar /nologo /ignore:4221 /OUT:$out @$out.rsp', + rspfile='$out.rsp', + rspfile_content='$in $libflags') + dlldesc = 'LINK(DLL) $dll' + dllcmd = ('python gyp-win-tool link-wrapper ' + '$ld /nologo /IMPLIB:$implib /DLL /OUT:$dll ' + '/PDB:$dll.pdb @$dll.rsp') + master_ninja.rule('solink', description=dlldesc, command=dllcmd, + rspfile='$dll.rsp', + rspfile_content='$libs $in $ldflags', + restat=True) + master_ninja.rule('solink_module', description=dlldesc, command=dllcmd, + rspfile='$dll.rsp', + rspfile_content='$libs $in $ldflags', + restat=True) + # Note that ldflags goes at the end so that it has the option of + # overriding default settings earlier in the command line. + master_ninja.rule( + 'link', + description='LINK $out', + command=('python gyp-win-tool link-wrapper ' + '$ld /nologo /OUT:$out /PDB:$out.pdb @$out.rsp'), + rspfile='$out.rsp', + rspfile_content='$in $libs $ldflags') + else: + master_ninja.rule( + 'objc', + description='OBJC $out', + command=('$cc -MMD -MF $out.d $defines $includes $cflags $cflags_objc ' + '$cflags_pch_objc -c $in -o $out'), + depfile='$out.d') + master_ninja.rule( + 'objcxx', + description='OBJCXX $out', + command=('$cxx -MMD -MF $out.d $defines $includes $cflags $cflags_objcc ' + '$cflags_pch_objcc -c $in -o $out'), + depfile='$out.d') + master_ninja.rule( + 'alink', + description='LIBTOOL-STATIC $out, POSTBUILDS', + command='rm -f $out && ' + './gyp-mac-tool filter-libtool libtool -static -o $out $in' + '$postbuilds') + # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass + # -bundle -single_module here (for osmesa.so). + master_ninja.rule( + 'solink', + description='SOLINK $out, POSTBUILDS', + command=('$ld -shared $ldflags -o $out ' + '$in $libs$postbuilds')) + master_ninja.rule( + 'solink_module', + description='SOLINK(module) $out, POSTBUILDS', + command=('$ld -shared $ldflags -o $out ' + '$in $libs$postbuilds')) + master_ninja.rule( + 'link', + description='LINK $out, POSTBUILDS', + command=('$ld $ldflags -o $out ' + '$in $libs$postbuilds')) + master_ninja.rule( + 'infoplist', + description='INFOPLIST $out', + command=('$cc -E -P -Wno-trigraphs -x c $defines $in -o $out && ' + 'plutil -convert xml1 $out $out')) + master_ninja.rule( + 'mac_tool', + description='MACTOOL $mactool_cmd $in', + command='$env $mac_tool $mactool_cmd $in $out') + master_ninja.rule( + 'package_framework', + description='PACKAGE FRAMEWORK $out, POSTBUILDS', + command='$mac_tool package-framework $out $version$postbuilds ' + '&& touch $out') + if flavor == 'win': + master_ninja.rule( + 'stamp', + description='STAMP $out', + command='python gyp-win-tool stamp $out') + master_ninja.rule( + 'copy', + description='COPY $in $out', + command='python gyp-win-tool recursive-mirror $in $out') + else: + master_ninja.rule( + 'stamp', + description='STAMP $out', + command='${postbuilds}touch $out') + master_ninja.rule( + 'copy', + description='COPY $in $out', + command='ln -f $in $out 2>/dev/null || (rm -rf $out && cp -af $in $out)') + master_ninja.newline() + + all_targets = set() + for build_file in params['build_files']: + for target in gyp.common.AllTargets(target_list, + target_dicts, + os.path.normpath(build_file)): + all_targets.add(target) + all_outputs = set() + + # target_outputs is a map from qualified target name to a Target object. + target_outputs = {} + # target_short_names is a map from target short name to a list of Target + # objects. + target_short_names = {} + for qualified_target in target_list: + # qualified_target is like: third_party/icu/icu.gyp:icui18n#target + build_file, name, toolset = \ + gyp.common.ParseQualifiedTarget(qualified_target) + + this_make_global_settings = data[build_file].get('make_global_settings', []) + assert make_global_settings == this_make_global_settings, ( + "make_global_settings needs to be the same for all targets.") + + spec = target_dicts[qualified_target] + if flavor == 'mac': + gyp.xcode_emulation.MergeGlobalXcodeSettingsToSpec(data[build_file], spec) + + build_file = gyp.common.RelativePath(build_file, options.toplevel_dir) + + base_path = os.path.dirname(build_file) + obj = 'obj' + if toolset != 'target': + obj += '.' + toolset + output_file = os.path.join(obj, base_path, name + '.ninja') + + abs_build_dir = os.path.abspath(toplevel_build) + writer = NinjaWriter(qualified_target, target_outputs, base_path, build_dir, + OpenOutput(os.path.join(toplevel_build, output_file)), + flavor, abs_build_dir=abs_build_dir) + master_ninja.subninja(output_file) + + target = writer.WriteSpec(spec, config_name, generator_flags) + if target: + if name != target.FinalOutput() and spec['toolset'] == 'target': + target_short_names.setdefault(name, []).append(target) + target_outputs[qualified_target] = target + if qualified_target in all_targets: + all_outputs.add(target.FinalOutput()) + + if target_short_names: + # Write a short name to build this target. This benefits both the + # "build chrome" case as well as the gyp tests, which expect to be + # able to run actions and build libraries by their short name. + master_ninja.newline() + master_ninja.comment('Short names for targets.') + for short_name in target_short_names: + master_ninja.build(short_name, 'phony', [x.FinalOutput() for x in + target_short_names[short_name]]) + + if all_outputs: + master_ninja.newline() + master_ninja.build('all', 'phony', list(all_outputs)) + master_ninja.default('all') + + +def GenerateOutput(target_list, target_dicts, data, params): + if params['options'].generator_output: + raise NotImplementedError, "--generator_output not implemented for ninja" + + user_config = params.get('generator_flags', {}).get('config', None) + if user_config: + GenerateOutputForConfig(target_list, target_dicts, data, params, + user_config) + else: + config_names = target_dicts[target_list[0]]['configurations'].keys() + for config_name in config_names: + GenerateOutputForConfig(target_list, target_dicts, data, params, + config_name) diff --git a/tools/gyp/pylib/gyp/generator/ninja_test.py b/tools/gyp/pylib/gyp/generator/ninja_test.py new file mode 100644 index 000000000..90dd15373 --- /dev/null +++ b/tools/gyp/pylib/gyp/generator/ninja_test.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Unit tests for the ninja.py file. """ + +import gyp.generator.ninja as ninja +import unittest +import StringIO +import sys +import TestCommon + + +class TestPrefixesAndSuffixes(unittest.TestCase): + if sys.platform in ('win32', 'cygwin'): + def test_BinaryNamesWindows(self): + writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'ninja.build', 'win') + spec = { 'target_name': 'wee' } + self.assertTrue(writer.ComputeOutputFileName(spec, 'executable'). + endswith('.exe')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). + endswith('.dll')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). + endswith('.lib')) + + if sys.platform == 'linux2': + def test_BinaryNamesLinux(self): + writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'ninja.build', 'linux') + spec = { 'target_name': 'wee' } + self.assertTrue('.' not in writer.ComputeOutputFileName(spec, + 'executable')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). + startswith('lib')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). + startswith('lib')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library'). + endswith('.so')) + self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library'). + endswith('.a')) + +if __name__ == '__main__': + unittest.main() diff --git a/tools/gyp/pylib/gyp/generator/scons.py b/tools/gyp/pylib/gyp/generator/scons.py new file mode 100644 index 000000000..4d0feb0c9 --- /dev/null +++ b/tools/gyp/pylib/gyp/generator/scons.py @@ -0,0 +1,1047 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import gyp +import gyp.common +import gyp.SCons as SCons +import os.path +import pprint +import re + + +# TODO: remove when we delete the last WriteList() call in this module +WriteList = SCons.WriteList + + +generator_default_variables = { + 'EXECUTABLE_PREFIX': '', + 'EXECUTABLE_SUFFIX': '', + 'STATIC_LIB_PREFIX': '${LIBPREFIX}', + 'SHARED_LIB_PREFIX': '${SHLIBPREFIX}', + 'STATIC_LIB_SUFFIX': '${LIBSUFFIX}', + 'SHARED_LIB_SUFFIX': '${SHLIBSUFFIX}', + 'INTERMEDIATE_DIR': '${INTERMEDIATE_DIR}', + 'SHARED_INTERMEDIATE_DIR': '${SHARED_INTERMEDIATE_DIR}', + 'OS': 'linux', + 'PRODUCT_DIR': '$TOP_BUILDDIR', + 'SHARED_LIB_DIR': '$LIB_DIR', + 'LIB_DIR': '$LIB_DIR', + 'RULE_INPUT_ROOT': '${SOURCE.filebase}', + 'RULE_INPUT_DIRNAME': '${SOURCE.dir}', + 'RULE_INPUT_EXT': '${SOURCE.suffix}', + 'RULE_INPUT_NAME': '${SOURCE.file}', + 'RULE_INPUT_PATH': '${SOURCE.abspath}', + 'CONFIGURATION_NAME': '${CONFIG_NAME}', +} + +# Tell GYP how to process the input for us. +generator_handles_variants = True +generator_wants_absolute_build_file_paths = True + + +def FixPath(path, prefix): + if not os.path.isabs(path) and not path[0] == '$': + path = prefix + path + return path + + +header = """\ +# This file is generated; do not edit. +""" + + +_alias_template = """ +if GetOption('verbose'): + _action = Action([%(action)s]) +else: + _action = Action([%(action)s], %(message)s) +_outputs = env.Alias( + ['_%(target_name)s_action'], + %(inputs)s, + _action +) +env.AlwaysBuild(_outputs) +""" + +_run_as_template = """ +if GetOption('verbose'): + _action = Action([%(action)s]) +else: + _action = Action([%(action)s], %(message)s) +""" + +_run_as_template_suffix = """ +_run_as_target = env.Alias('run_%(target_name)s', target_files, _action) +env.Requires(_run_as_target, [ + Alias('%(target_name)s'), +]) +env.AlwaysBuild(_run_as_target) +""" + +_command_template = """ +if GetOption('verbose'): + _action = Action([%(action)s]) +else: + _action = Action([%(action)s], %(message)s) +_outputs = env.Command( + %(outputs)s, + %(inputs)s, + _action +) +""" + +# This is copied from the default SCons action, updated to handle symlinks. +_copy_action_template = """ +import shutil +import SCons.Action + +def _copy_files_or_dirs_or_symlinks(dest, src): + SCons.Node.FS.invalidate_node_memos(dest) + if SCons.Util.is_List(src) and os.path.isdir(dest): + for file in src: + shutil.copy2(file, dest) + return 0 + elif os.path.islink(src): + linkto = os.readlink(src) + os.symlink(linkto, dest) + return 0 + elif os.path.isfile(src): + return shutil.copy2(src, dest) + else: + return shutil.copytree(src, dest, 1) + +def _copy_files_or_dirs_or_symlinks_str(dest, src): + return 'Copying %s to %s ...' % (src, dest) + +GYPCopy = SCons.Action.ActionFactory(_copy_files_or_dirs_or_symlinks, + _copy_files_or_dirs_or_symlinks_str, + convert=str) +""" + +_rule_template = """ +%(name)s_additional_inputs = %(inputs)s +%(name)s_outputs = %(outputs)s +def %(name)s_emitter(target, source, env): + return (%(name)s_outputs, source + %(name)s_additional_inputs) +if GetOption('verbose'): + %(name)s_action = Action([%(action)s]) +else: + %(name)s_action = Action([%(action)s], %(message)s) +env['BUILDERS']['%(name)s'] = Builder(action=%(name)s_action, + emitter=%(name)s_emitter) + +_outputs = [] +_processed_input_files = [] +for infile in input_files: + if (type(infile) == type('') + and not os.path.isabs(infile) + and not infile[0] == '$'): + infile = %(src_dir)r + infile + if str(infile).endswith('.%(extension)s'): + _generated = env.%(name)s(infile) + env.Precious(_generated) + _outputs.append(_generated) + %(process_outputs_as_sources_line)s + else: + _processed_input_files.append(infile) +prerequisites.extend(_outputs) +input_files = _processed_input_files +""" + +_spawn_hack = """ +import re +import SCons.Platform.posix +needs_shell = re.compile('["\\'>= 2.5: + return os.sysconf('SC_NPROCESSORS_ONLN') + else: # Mac OS X with Python < 2.5: + return int(os.popen2("sysctl -n hw.ncpu")[1].read()) + # Windows: + if os.environ.has_key('NUMBER_OF_PROCESSORS'): + return max(int(os.environ.get('NUMBER_OF_PROCESSORS', '1')), 1) + return 1 # Default + +# Support PROGRESS= to show progress in different ways. +p = ARGUMENTS.get('PROGRESS') +if p == 'spinner': + Progress(['/\\r', '|\\r', '\\\\\\r', '-\\r'], + interval=5, + file=open('/dev/tty', 'w')) +elif p == 'name': + Progress('$TARGET\\r', overwrite=True, file=open('/dev/tty', 'w')) + +# Set the default -j value based on the number of processors. +SetOption('num_jobs', GetProcessorCount() + 1) + +# Have SCons use its cached dependency information. +SetOption('implicit_cache', 1) + +# Only re-calculate MD5 checksums if a timestamp has changed. +Decider('MD5-timestamp') + +# Since we set the -j value by default, suppress SCons warnings about being +# unable to support parallel build on versions of Python with no threading. +default_warnings = ['no-no-parallel-support'] +SetOption('warn', default_warnings + GetOption('warn')) + +AddOption('--mode', nargs=1, dest='conf_list', default=[], + action='append', help='Configuration to build.') + +AddOption('--verbose', dest='verbose', default=False, + action='store_true', help='Verbose command-line output.') + + +# +sconscript_file_map = %(sconscript_files)s + +class LoadTarget: + ''' + Class for deciding if a given target sconscript is to be included + based on a list of included target names, optionally prefixed with '-' + to exclude a target name. + ''' + def __init__(self, load): + ''' + Initialize a class with a list of names for possible loading. + + Arguments: + load: list of elements in the LOAD= specification + ''' + self.included = set([c for c in load if not c.startswith('-')]) + self.excluded = set([c[1:] for c in load if c.startswith('-')]) + + if not self.included: + self.included = set(['all']) + + def __call__(self, target): + ''' + Returns True if the specified target's sconscript file should be + loaded, based on the initialized included and excluded lists. + ''' + return (target in self.included or + ('all' in self.included and not target in self.excluded)) + +if 'LOAD' in ARGUMENTS: + load = ARGUMENTS['LOAD'].split(',') +else: + load = [] +load_target = LoadTarget(load) + +sconscript_files = [] +for target, sconscript in sconscript_file_map.iteritems(): + if load_target(target): + sconscript_files.append(sconscript) + + +target_alias_list= [] + +conf_list = GetOption('conf_list') +if conf_list: + # In case the same --mode= value was specified multiple times. + conf_list = list(set(conf_list)) +else: + conf_list = [%(default_configuration)r] + +sconsbuild_dir = Dir(%(sconsbuild_dir)s) + + +def FilterOut(self, **kw): + kw = SCons.Environment.copy_non_reserved_keywords(kw) + for key, val in kw.items(): + envval = self.get(key, None) + if envval is None: + # No existing variable in the environment, so nothing to delete. + continue + + for vremove in val: + # Use while not if, so we can handle duplicates. + while vremove in envval: + envval.remove(vremove) + + self[key] = envval + + # TODO(sgk): SCons.Environment.Append() has much more logic to deal + # with various types of values. We should handle all those cases in here + # too. (If variable is a dict, etc.) + + +non_compilable_suffixes = { + 'LINUX' : set([ + '.bdic', + '.css', + '.dat', + '.fragment', + '.gperf', + '.h', + '.hh', + '.hpp', + '.html', + '.hxx', + '.idl', + '.in', + '.in0', + '.in1', + '.js', + '.mk', + '.rc', + '.sigs', + '', + ]), + 'WINDOWS' : set([ + '.h', + '.hh', + '.hpp', + '.dat', + '.idl', + '.in', + '.in0', + '.in1', + ]), +} + +def compilable(env, file): + base, ext = os.path.splitext(str(file)) + if ext in non_compilable_suffixes[env['TARGET_PLATFORM']]: + return False + return True + +def compilable_files(env, sources): + return [x for x in sources if compilable(env, x)] + +def GypProgram(env, target, source, *args, **kw): + source = compilable_files(env, source) + result = env.Program(target, source, *args, **kw) + if env.get('INCREMENTAL'): + env.Precious(result) + return result + +def GypTestProgram(env, target, source, *args, **kw): + source = compilable_files(env, source) + result = env.Program(target, source, *args, **kw) + if env.get('INCREMENTAL'): + env.Precious(*result) + return result + +def GypLibrary(env, target, source, *args, **kw): + source = compilable_files(env, source) + result = env.Library(target, source, *args, **kw) + return result + +def GypLoadableModule(env, target, source, *args, **kw): + source = compilable_files(env, source) + result = env.LoadableModule(target, source, *args, **kw) + return result + +def GypStaticLibrary(env, target, source, *args, **kw): + source = compilable_files(env, source) + result = env.StaticLibrary(target, source, *args, **kw) + return result + +def GypSharedLibrary(env, target, source, *args, **kw): + source = compilable_files(env, source) + result = env.SharedLibrary(target, source, *args, **kw) + if env.get('INCREMENTAL'): + env.Precious(result) + return result + +def add_gyp_methods(env): + env.AddMethod(GypProgram) + env.AddMethod(GypTestProgram) + env.AddMethod(GypLibrary) + env.AddMethod(GypLoadableModule) + env.AddMethod(GypStaticLibrary) + env.AddMethod(GypSharedLibrary) + + env.AddMethod(FilterOut) + + env.AddMethod(compilable) + + +base_env = Environment( + tools = %(scons_tools)s, + INTERMEDIATE_DIR='$OBJ_DIR/${COMPONENT_NAME}/_${TARGET_NAME}_intermediate', + LIB_DIR='$TOP_BUILDDIR/lib', + OBJ_DIR='$TOP_BUILDDIR/obj', + SCONSBUILD_DIR=sconsbuild_dir.abspath, + SHARED_INTERMEDIATE_DIR='$OBJ_DIR/_global_intermediate', + SRC_DIR=Dir(%(src_dir)r), + TARGET_PLATFORM='LINUX', + TOP_BUILDDIR='$SCONSBUILD_DIR/$CONFIG_NAME', + LIBPATH=['$LIB_DIR'], +) + +if not GetOption('verbose'): + base_env.SetDefault( + ARCOMSTR='Creating library $TARGET', + ASCOMSTR='Assembling $TARGET', + CCCOMSTR='Compiling $TARGET', + CONCATSOURCECOMSTR='ConcatSource $TARGET', + CXXCOMSTR='Compiling $TARGET', + LDMODULECOMSTR='Building loadable module $TARGET', + LINKCOMSTR='Linking $TARGET', + MANIFESTCOMSTR='Updating manifest for $TARGET', + MIDLCOMSTR='Compiling IDL $TARGET', + PCHCOMSTR='Precompiling $TARGET', + RANLIBCOMSTR='Indexing $TARGET', + RCCOMSTR='Compiling resource $TARGET', + SHCCCOMSTR='Compiling $TARGET', + SHCXXCOMSTR='Compiling $TARGET', + SHLINKCOMSTR='Linking $TARGET', + SHMANIFESTCOMSTR='Updating manifest for $TARGET', + ) + +add_gyp_methods(base_env) + +for conf in conf_list: + env = base_env.Clone(CONFIG_NAME=conf) + SConsignFile(env.File('$TOP_BUILDDIR/.sconsign').abspath) + for sconscript in sconscript_files: + target_alias = env.SConscript(sconscript, exports=['env']) + if target_alias: + target_alias_list.extend(target_alias) + +Default(Alias('all', target_alias_list)) + +help_fmt = ''' +Usage: hammer [SCONS_OPTIONS] [VARIABLES] [TARGET] ... + +Local command-line build options: + --mode=CONFIG Configuration to build: + --mode=Debug [default] + --mode=Release + --verbose Print actual executed command lines. + +Supported command-line build variables: + LOAD=[module,...] Comma-separated list of components to load in the + dependency graph ('-' prefix excludes) + PROGRESS=type Display a progress indicator: + name: print each evaluated target name + spinner: print a spinner every 5 targets + +The following TARGET names can also be used as LOAD= module names: + +%%s +''' + +if GetOption('help'): + def columnar_text(items, width=78, indent=2, sep=2): + result = [] + colwidth = max(map(len, items)) + sep + cols = (width - indent) / colwidth + if cols < 1: + cols = 1 + rows = (len(items) + cols - 1) / cols + indent = '%%*s' %% (indent, '') + sep = indent + for row in xrange(0, rows): + result.append(sep) + for i in xrange(row, len(items), rows): + result.append('%%-*s' %% (colwidth, items[i])) + sep = '\\n' + indent + result.append('\\n') + return ''.join(result) + + load_list = set(sconscript_file_map.keys()) + target_aliases = set(map(str, target_alias_list)) + + common = load_list and target_aliases + load_only = load_list - common + target_only = target_aliases - common + help_text = [help_fmt %% columnar_text(sorted(list(common)))] + if target_only: + fmt = "The following are additional TARGET names:\\n\\n%%s\\n" + help_text.append(fmt %% columnar_text(sorted(list(target_only)))) + if load_only: + fmt = "The following are additional LOAD= module names:\\n\\n%%s\\n" + help_text.append(fmt %% columnar_text(sorted(list(load_only)))) + Help(''.join(help_text)) +""" + +# TEMPLATE END +############################################################################# + + +def GenerateSConscriptWrapper(build_file, build_file_data, name, + output_filename, sconscript_files, + default_configuration): + """ + Generates the "wrapper" SConscript file (analogous to the Visual Studio + solution) that calls all the individual target SConscript files. + """ + output_dir = os.path.dirname(output_filename) + src_dir = build_file_data['_DEPTH'] + src_dir_rel = gyp.common.RelativePath(src_dir, output_dir) + if not src_dir_rel: + src_dir_rel = '.' + scons_settings = build_file_data.get('scons_settings', {}) + sconsbuild_dir = scons_settings.get('sconsbuild_dir', '#') + scons_tools = scons_settings.get('tools', ['default']) + + sconscript_file_lines = ['dict('] + for target in sorted(sconscript_files.keys()): + sconscript = sconscript_files[target] + sconscript_file_lines.append(' %s = %r,' % (target, sconscript)) + sconscript_file_lines.append(')') + + fp = open(output_filename, 'w') + fp.write(header) + fp.write(_wrapper_template % { + 'default_configuration' : default_configuration, + 'name' : name, + 'scons_tools' : repr(scons_tools), + 'sconsbuild_dir' : repr(sconsbuild_dir), + 'sconscript_files' : '\n'.join(sconscript_file_lines), + 'src_dir' : src_dir_rel, + }) + fp.close() + + # Generate the SConstruct file that invokes the wrapper SConscript. + dir, fname = os.path.split(output_filename) + SConstruct = os.path.join(dir, 'SConstruct') + fp = open(SConstruct, 'w') + fp.write(header) + fp.write('SConscript(%s)\n' % repr(fname)) + fp.close() + + +def TargetFilename(target, build_file=None, output_suffix=''): + """Returns the .scons file name for the specified target. + """ + if build_file is None: + build_file, target = gyp.common.ParseQualifiedTarget(target)[:2] + output_file = os.path.join(os.path.dirname(build_file), + target + output_suffix + '.scons') + return output_file + + +def GenerateOutput(target_list, target_dicts, data, params): + """ + Generates all the output files for the specified targets. + """ + options = params['options'] + + if options.generator_output: + def output_path(filename): + return filename.replace(params['cwd'], options.generator_output) + else: + def output_path(filename): + return filename + + default_configuration = None + + for qualified_target in target_list: + spec = target_dicts[qualified_target] + if spec['toolset'] != 'target': + raise Exception( + 'Multiple toolsets not supported in scons build (target %s)' % + qualified_target) + scons_target = SCons.Target(spec) + if scons_target.is_ignored: + continue + + # TODO: assumes the default_configuration of the first target + # non-Default target is the correct default for all targets. + # Need a better model for handle variation between targets. + if (not default_configuration and + spec['default_configuration'] != 'Default'): + default_configuration = spec['default_configuration'] + + build_file, target = gyp.common.ParseQualifiedTarget(qualified_target)[:2] + output_file = TargetFilename(target, build_file, options.suffix) + if options.generator_output: + output_file = output_path(output_file) + + if not spec.has_key('libraries'): + spec['libraries'] = [] + + # Add dependent static library targets to the 'libraries' value. + deps = spec.get('dependencies', []) + spec['scons_dependencies'] = [] + for d in deps: + td = target_dicts[d] + target_name = td['target_name'] + spec['scons_dependencies'].append("Alias('%s')" % target_name) + if td['type'] in ('static_library', 'shared_library'): + libname = td.get('product_name', target_name) + spec['libraries'].append('lib' + libname) + if td['type'] == 'loadable_module': + prereqs = spec.get('scons_prerequisites', []) + # TODO: parameterize with <(SHARED_LIBRARY_*) variables? + td_target = SCons.Target(td) + td_target.target_prefix = '${SHLIBPREFIX}' + td_target.target_suffix = '${SHLIBSUFFIX}' + + GenerateSConscript(output_file, spec, build_file, data[build_file]) + + if not default_configuration: + default_configuration = 'Default' + + for build_file in sorted(data.keys()): + path, ext = os.path.splitext(build_file) + if ext != '.gyp': + continue + output_dir, basename = os.path.split(path) + output_filename = path + '_main' + options.suffix + '.scons' + + all_targets = gyp.common.AllTargets(target_list, target_dicts, build_file) + sconscript_files = {} + for t in all_targets: + scons_target = SCons.Target(target_dicts[t]) + if scons_target.is_ignored: + continue + bf, target = gyp.common.ParseQualifiedTarget(t)[:2] + target_filename = TargetFilename(target, bf, options.suffix) + tpath = gyp.common.RelativePath(target_filename, output_dir) + sconscript_files[target] = tpath + + output_filename = output_path(output_filename) + if sconscript_files: + GenerateSConscriptWrapper(build_file, data[build_file], basename, + output_filename, sconscript_files, + default_configuration) diff --git a/tools/gyp/pylib/gyp/generator/xcode.py b/tools/gyp/pylib/gyp/generator/xcode.py new file mode 100644 index 000000000..a9fac46d0 --- /dev/null +++ b/tools/gyp/pylib/gyp/generator/xcode.py @@ -0,0 +1,1209 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import filecmp +import gyp.common +import gyp.xcodeproj_file +import errno +import os +import posixpath +import re +import shutil +import subprocess +import tempfile + + +# Project files generated by this module will use _intermediate_var as a +# custom Xcode setting whose value is a DerivedSources-like directory that's +# project-specific and configuration-specific. The normal choice, +# DERIVED_FILE_DIR, is target-specific, which is thought to be too restrictive +# as it is likely that multiple targets within a single project file will want +# to access the same set of generated files. The other option, +# PROJECT_DERIVED_FILE_DIR, is unsuitable because while it is project-specific, +# it is not configuration-specific. INTERMEDIATE_DIR is defined as +# $(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION). +_intermediate_var = 'INTERMEDIATE_DIR' + +# SHARED_INTERMEDIATE_DIR is the same, except that it is shared among all +# targets that share the same BUILT_PRODUCTS_DIR. +_shared_intermediate_var = 'SHARED_INTERMEDIATE_DIR' + +_library_search_paths_var = 'LIBRARY_SEARCH_PATHS' + +generator_default_variables = { + 'EXECUTABLE_PREFIX': '', + 'EXECUTABLE_SUFFIX': '', + 'STATIC_LIB_PREFIX': 'lib', + 'SHARED_LIB_PREFIX': 'lib', + 'STATIC_LIB_SUFFIX': '.a', + 'SHARED_LIB_SUFFIX': '.dylib', + # INTERMEDIATE_DIR is a place for targets to build up intermediate products. + # It is specific to each build environment. It is only guaranteed to exist + # and be constant within the context of a project, corresponding to a single + # input file. Some build environments may allow their intermediate directory + # to be shared on a wider scale, but this is not guaranteed. + 'INTERMEDIATE_DIR': '$(%s)' % _intermediate_var, + 'OS': 'mac', + 'PRODUCT_DIR': '$(BUILT_PRODUCTS_DIR)', + 'LIB_DIR': '$(BUILT_PRODUCTS_DIR)', + 'RULE_INPUT_ROOT': '$(INPUT_FILE_BASE)', + 'RULE_INPUT_EXT': '$(INPUT_FILE_SUFFIX)', + 'RULE_INPUT_NAME': '$(INPUT_FILE_NAME)', + 'RULE_INPUT_PATH': '$(INPUT_FILE_PATH)', + 'RULE_INPUT_DIRNAME': '$(INPUT_FILE_DIRNAME)', + 'SHARED_INTERMEDIATE_DIR': '$(%s)' % _shared_intermediate_var, + 'CONFIGURATION_NAME': '$(CONFIGURATION)', +} + +# The Xcode-specific sections that hold paths. +generator_additional_path_sections = [ + 'mac_bundle_resources', + 'mac_framework_headers', + 'mac_framework_private_headers', + # 'mac_framework_dirs', input already handles _dirs endings. +] + +# The Xcode-specific keys that exist on targets and aren't moved down to +# configurations. +generator_additional_non_configuration_keys = [ + 'mac_bundle', + 'mac_bundle_resources', + 'mac_framework_headers', + 'mac_framework_private_headers', + 'xcode_create_dependents_test_runner', +] + +# We want to let any rules apply to files that are resources also. +generator_extra_sources_for_rules = [ + 'mac_bundle_resources', + 'mac_framework_headers', + 'mac_framework_private_headers', +] + +# Xcode's standard set of library directories, which don't need to be duplicated +# in LIBRARY_SEARCH_PATHS. This list is not exhaustive, but that's okay. +xcode_standard_library_dirs = frozenset([ + '$(SDKROOT)/usr/lib', + '$(SDKROOT)/usr/local/lib', +]) + +def CreateXCConfigurationList(configuration_names): + xccl = gyp.xcodeproj_file.XCConfigurationList({'buildConfigurations': []}) + if len(configuration_names) == 0: + configuration_names = ['Default'] + for configuration_name in configuration_names: + xcbc = gyp.xcodeproj_file.XCBuildConfiguration({ + 'name': configuration_name}) + xccl.AppendProperty('buildConfigurations', xcbc) + xccl.SetProperty('defaultConfigurationName', configuration_names[0]) + return xccl + + +class XcodeProject(object): + def __init__(self, gyp_path, path, build_file_dict): + self.gyp_path = gyp_path + self.path = path + self.project = gyp.xcodeproj_file.PBXProject(path=path) + projectDirPath = gyp.common.RelativePath( + os.path.dirname(os.path.abspath(self.gyp_path)), + os.path.dirname(path) or '.') + self.project.SetProperty('projectDirPath', projectDirPath) + self.project_file = \ + gyp.xcodeproj_file.XCProjectFile({'rootObject': self.project}) + self.build_file_dict = build_file_dict + + # TODO(mark): add destructor that cleans up self.path if created_dir is + # True and things didn't complete successfully. Or do something even + # better with "try"? + self.created_dir = False + try: + os.makedirs(self.path) + self.created_dir = True + except OSError, e: + if e.errno != errno.EEXIST: + raise + + def Finalize1(self, xcode_targets, serialize_all_tests): + # Collect a list of all of the build configuration names used by the + # various targets in the file. It is very heavily advised to keep each + # target in an entire project (even across multiple project files) using + # the same set of configuration names. + configurations = [] + for xct in self.project.GetProperty('targets'): + xccl = xct.GetProperty('buildConfigurationList') + xcbcs = xccl.GetProperty('buildConfigurations') + for xcbc in xcbcs: + name = xcbc.GetProperty('name') + if name not in configurations: + configurations.append(name) + + # Replace the XCConfigurationList attached to the PBXProject object with + # a new one specifying all of the configuration names used by the various + # targets. + try: + xccl = CreateXCConfigurationList(configurations) + self.project.SetProperty('buildConfigurationList', xccl) + except: + import sys + sys.stderr.write("Problem with gyp file %s\n" % self.gyp_path) + raise + + # The need for this setting is explained above where _intermediate_var is + # defined. The comments below about wanting to avoid project-wide build + # settings apply here too, but this needs to be set on a project-wide basis + # so that files relative to the _intermediate_var setting can be displayed + # properly in the Xcode UI. + # + # Note that for configuration-relative files such as anything relative to + # _intermediate_var, for the purposes of UI tree view display, Xcode will + # only resolve the configuration name once, when the project file is + # opened. If the active build configuration is changed, the project file + # must be closed and reopened if it is desired for the tree view to update. + # This is filed as Apple radar 6588391. + xccl.SetBuildSetting(_intermediate_var, + '$(PROJECT_DERIVED_FILE_DIR)/$(CONFIGURATION)') + xccl.SetBuildSetting(_shared_intermediate_var, + '$(SYMROOT)/DerivedSources/$(CONFIGURATION)') + + # Set user-specified project-wide build settings and config files. This + # is intended to be used very sparingly. Really, almost everything should + # go into target-specific build settings sections. The project-wide + # settings are only intended to be used in cases where Xcode attempts to + # resolve variable references in a project context as opposed to a target + # context, such as when resolving sourceTree references while building up + # the tree tree view for UI display. + # Any values set globally are applied to all configurations, then any + # per-configuration values are applied. + for xck, xcv in self.build_file_dict.get('xcode_settings', {}).iteritems(): + xccl.SetBuildSetting(xck, xcv) + if 'xcode_config_file' in self.build_file_dict: + config_ref = self.project.AddOrGetFileInRootGroup( + self.build_file_dict['xcode_config_file']) + xccl.SetBaseConfiguration(config_ref) + build_file_configurations = self.build_file_dict.get('configurations', {}) + if build_file_configurations: + for config_name in configurations: + build_file_configuration_named = \ + build_file_configurations.get(config_name, {}) + if build_file_configuration_named: + xcc = xccl.ConfigurationNamed(config_name) + for xck, xcv in build_file_configuration_named.get('xcode_settings', + {}).iteritems(): + xcc.SetBuildSetting(xck, xcv) + if 'xcode_config_file' in build_file_configuration_named: + config_ref = self.project.AddOrGetFileInRootGroup( + build_file_configurations[config_name]['xcode_config_file']) + xcc.SetBaseConfiguration(config_ref) + + # Sort the targets based on how they appeared in the input. + # TODO(mark): Like a lot of other things here, this assumes internal + # knowledge of PBXProject - in this case, of its "targets" property. + + # ordinary_targets are ordinary targets that are already in the project + # file. run_test_targets are the targets that run unittests and should be + # used for the Run All Tests target. support_targets are the action/rule + # targets used by GYP file targets, just kept for the assert check. + ordinary_targets = [] + run_test_targets = [] + support_targets = [] + + # targets is full list of targets in the project. + targets = [] + + # does the it define it's own "all"? + has_custom_all = False + + # targets_for_all is the list of ordinary_targets that should be listed + # in this project's "All" target. It includes each non_runtest_target + # that does not have suppress_wildcard set. + targets_for_all = [] + + for target in self.build_file_dict['targets']: + target_name = target['target_name'] + toolset = target['toolset'] + qualified_target = gyp.common.QualifiedTarget(self.gyp_path, target_name, + toolset) + xcode_target = xcode_targets[qualified_target] + # Make sure that the target being added to the sorted list is already in + # the unsorted list. + assert xcode_target in self.project._properties['targets'] + targets.append(xcode_target) + ordinary_targets.append(xcode_target) + if xcode_target.support_target: + support_targets.append(xcode_target.support_target) + targets.append(xcode_target.support_target) + + if not int(target.get('suppress_wildcard', False)): + targets_for_all.append(xcode_target) + + if target_name.lower() == 'all': + has_custom_all = True; + + # If this target has a 'run_as' attribute, add its target to the + # targets, and add it to the test targets. + if target.get('run_as'): + # Make a target to run something. It should have one + # dependency, the parent xcode target. + xccl = CreateXCConfigurationList(configurations) + run_target = gyp.xcodeproj_file.PBXAggregateTarget({ + 'name': 'Run ' + target_name, + 'productName': xcode_target.GetProperty('productName'), + 'buildConfigurationList': xccl, + }, + parent=self.project) + run_target.AddDependency(xcode_target) + + command = target['run_as'] + script = '' + if command.get('working_directory'): + script = script + 'cd "%s"\n' % \ + gyp.xcodeproj_file.ConvertVariablesToShellSyntax( + command.get('working_directory')) + + if command.get('environment'): + script = script + "\n".join( + ['export %s="%s"' % + (key, gyp.xcodeproj_file.ConvertVariablesToShellSyntax(val)) + for (key, val) in command.get('environment').iteritems()]) + "\n" + + # Some test end up using sockets, files on disk, etc. and can get + # confused if more then one test runs at a time. The generator + # flag 'xcode_serialize_all_test_runs' controls the forcing of all + # tests serially. It defaults to True. To get serial runs this + # little bit of python does the same as the linux flock utility to + # make sure only one runs at a time. + command_prefix = '' + if serialize_all_tests: + command_prefix = \ +"""python -c "import fcntl, subprocess, sys +file = open('$TMPDIR/GYP_serialize_test_runs', 'a') +fcntl.flock(file.fileno(), fcntl.LOCK_EX) +sys.exit(subprocess.call(sys.argv[1:]))" """ + + # If we were unable to exec for some reason, we want to exit + # with an error, and fixup variable references to be shell + # syntax instead of xcode syntax. + script = script + 'exec ' + command_prefix + '%s\nexit 1\n' % \ + gyp.xcodeproj_file.ConvertVariablesToShellSyntax( + gyp.common.EncodePOSIXShellList(command.get('action'))) + + ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase({ + 'shellScript': script, + 'showEnvVarsInLog': 0, + }) + run_target.AppendProperty('buildPhases', ssbp) + + # Add the run target to the project file. + targets.append(run_target) + run_test_targets.append(run_target) + xcode_target.test_runner = run_target + + + # Make sure that the list of targets being replaced is the same length as + # the one replacing it, but allow for the added test runner targets. + assert len(self.project._properties['targets']) == \ + len(ordinary_targets) + len(support_targets) + + self.project._properties['targets'] = targets + + # Get rid of unnecessary levels of depth in groups like the Source group. + self.project.RootGroupsTakeOverOnlyChildren(True) + + # Sort the groups nicely. Do this after sorting the targets, because the + # Products group is sorted based on the order of the targets. + self.project.SortGroups() + + # Create an "All" target if there's more than one target in this project + # file and the project didn't define its own "All" target. Put a generated + # "All" target first so that people opening up the project for the first + # time will build everything by default. + if len(targets_for_all) > 1 and not has_custom_all: + xccl = CreateXCConfigurationList(configurations) + all_target = gyp.xcodeproj_file.PBXAggregateTarget( + { + 'buildConfigurationList': xccl, + 'name': 'All', + }, + parent=self.project) + + for target in targets_for_all: + all_target.AddDependency(target) + + # TODO(mark): This is evil because it relies on internal knowledge of + # PBXProject._properties. It's important to get the "All" target first, + # though. + self.project._properties['targets'].insert(0, all_target) + + # The same, but for run_test_targets. + if len(run_test_targets) > 1: + xccl = CreateXCConfigurationList(configurations) + run_all_tests_target = gyp.xcodeproj_file.PBXAggregateTarget( + { + 'buildConfigurationList': xccl, + 'name': 'Run All Tests', + }, + parent=self.project) + for run_test_target in run_test_targets: + run_all_tests_target.AddDependency(run_test_target) + + # Insert after the "All" target, which must exist if there is more than + # one run_test_target. + self.project._properties['targets'].insert(1, run_all_tests_target) + + def Finalize2(self, xcode_targets, xcode_target_to_target_dict): + # Finalize2 needs to happen in a separate step because the process of + # updating references to other projects depends on the ordering of targets + # within remote project files. Finalize1 is responsible for sorting duty, + # and once all project files are sorted, Finalize2 can come in and update + # these references. + + # To support making a "test runner" target that will run all the tests + # that are direct dependents of any given target, we look for + # xcode_create_dependents_test_runner being set on an Aggregate target, + # and generate a second target that will run the tests runners found under + # the marked target. + for bf_tgt in self.build_file_dict['targets']: + if int(bf_tgt.get('xcode_create_dependents_test_runner', 0)): + tgt_name = bf_tgt['target_name'] + toolset = bf_tgt['toolset'] + qualified_target = gyp.common.QualifiedTarget(self.gyp_path, + tgt_name, toolset) + xcode_target = xcode_targets[qualified_target] + if isinstance(xcode_target, gyp.xcodeproj_file.PBXAggregateTarget): + # Collect all the run test targets. + all_run_tests = [] + pbxtds = xcode_target.GetProperty('dependencies') + for pbxtd in pbxtds: + pbxcip = pbxtd.GetProperty('targetProxy') + dependency_xct = pbxcip.GetProperty('remoteGlobalIDString') + if hasattr(dependency_xct, 'test_runner'): + all_run_tests.append(dependency_xct.test_runner) + + # Directly depend on all the runners as they depend on the target + # that builds them. + if len(all_run_tests) > 0: + run_all_target = gyp.xcodeproj_file.PBXAggregateTarget({ + 'name': 'Run %s Tests' % tgt_name, + 'productName': tgt_name, + }, + parent=self.project) + for run_test_target in all_run_tests: + run_all_target.AddDependency(run_test_target) + + # Insert the test runner after the related target. + idx = self.project._properties['targets'].index(xcode_target) + self.project._properties['targets'].insert(idx + 1, run_all_target) + + # Update all references to other projects, to make sure that the lists of + # remote products are complete. Otherwise, Xcode will fill them in when + # it opens the project file, which will result in unnecessary diffs. + # TODO(mark): This is evil because it relies on internal knowledge of + # PBXProject._other_pbxprojects. + for other_pbxproject in self.project._other_pbxprojects.keys(): + self.project.AddOrGetProjectReference(other_pbxproject) + + self.project.SortRemoteProductReferences() + + # Give everything an ID. + self.project_file.ComputeIDs() + + # Make sure that no two objects in the project file have the same ID. If + # multiple objects wind up with the same ID, upon loading the file, Xcode + # will only recognize one object (the last one in the file?) and the + # results are unpredictable. + self.project_file.EnsureNoIDCollisions() + + def Write(self): + # Write the project file to a temporary location first. Xcode watches for + # changes to the project file and presents a UI sheet offering to reload + # the project when it does change. However, in some cases, especially when + # multiple projects are open or when Xcode is busy, things don't work so + # seamlessly. Sometimes, Xcode is able to detect that a project file has + # changed but can't unload it because something else is referencing it. + # To mitigate this problem, and to avoid even having Xcode present the UI + # sheet when an open project is rewritten for inconsequential changes, the + # project file is written to a temporary file in the xcodeproj directory + # first. The new temporary file is then compared to the existing project + # file, if any. If they differ, the new file replaces the old; otherwise, + # the new project file is simply deleted. Xcode properly detects a file + # being renamed over an open project file as a change and so it remains + # able to present the "project file changed" sheet under this system. + # Writing to a temporary file first also avoids the possible problem of + # Xcode rereading an incomplete project file. + (output_fd, new_pbxproj_path) = \ + tempfile.mkstemp(suffix='.tmp', prefix='project.pbxproj.gyp.', + dir=self.path) + + try: + output_file = os.fdopen(output_fd, 'wb') + + self.project_file.Print(output_file) + output_file.close() + + pbxproj_path = os.path.join(self.path, 'project.pbxproj') + + same = False + try: + same = filecmp.cmp(pbxproj_path, new_pbxproj_path, False) + except OSError, e: + if e.errno != errno.ENOENT: + raise + + if same: + # The new file is identical to the old one, just get rid of the new + # one. + os.unlink(new_pbxproj_path) + else: + # The new file is different from the old one, or there is no old one. + # Rename the new file to the permanent name. + # + # tempfile.mkstemp uses an overly restrictive mode, resulting in a + # file that can only be read by the owner, regardless of the umask. + # There's no reason to not respect the umask here, which means that + # an extra hoop is required to fetch it and reset the new file's mode. + # + # No way to get the umask without setting a new one? Set a safe one + # and then set it back to the old value. + umask = os.umask(077) + os.umask(umask) + + os.chmod(new_pbxproj_path, 0666 & ~umask) + os.rename(new_pbxproj_path, pbxproj_path) + + except Exception: + # Don't leave turds behind. In fact, if this code was responsible for + # creating the xcodeproj directory, get rid of that too. + os.unlink(new_pbxproj_path) + if self.created_dir: + shutil.rmtree(self.path, True) + raise + + +cached_xcode_version = None +def InstalledXcodeVersion(): + """Fetches the installed version of Xcode, returns empty string if it is + unable to figure it out.""" + + global cached_xcode_version + if not cached_xcode_version is None: + return cached_xcode_version + + # Default to an empty string + cached_xcode_version = '' + + # Collect the xcodebuild's version information. + try: + import subprocess + cmd = ['/usr/bin/xcodebuild', '-version'] + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) + xcodebuild_version_info = proc.communicate()[0] + # Any error, return empty string + if proc.returncode: + xcodebuild_version_info = '' + except OSError: + # We failed to launch the tool + xcodebuild_version_info = '' + + # Pull out the Xcode version itself. + match_line = re.search('^Xcode (.*)$', xcodebuild_version_info, re.MULTILINE) + if match_line: + cached_xcode_version = match_line.group(1) + # Done! + return cached_xcode_version + + +def AddSourceToTarget(source, type, pbxp, xct): + # TODO(mark): Perhaps source_extensions and library_extensions can be made a + # little bit fancier. + source_extensions = ['c', 'cc', 'cpp', 'cxx', 'm', 'mm', 's'] + + # .o is conceptually more of a "source" than a "library," but Xcode thinks + # of "sources" as things to compile and "libraries" (or "frameworks") as + # things to link with. Adding an object file to an Xcode target's frameworks + # phase works properly. + library_extensions = ['a', 'dylib', 'framework', 'o'] + + basename = posixpath.basename(source) + (root, ext) = posixpath.splitext(basename) + if ext != '': + ext = ext[1:].lower() + + if ext in source_extensions and type != 'none': + xct.SourcesPhase().AddFile(source) + elif ext in library_extensions and type != 'none': + xct.FrameworksPhase().AddFile(source) + else: + # Files that aren't added to a sources or frameworks build phase can still + # go into the project file, just not as part of a build phase. + pbxp.AddOrGetFileInRootGroup(source) + + +def AddResourceToTarget(resource, pbxp, xct): + # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call + # where it's used. + xct.ResourcesPhase().AddFile(resource) + + +def AddHeaderToTarget(header, pbxp, xct, is_public): + # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call + # where it's used. + settings = '{ATTRIBUTES = (%s, ); }' % ('Private', 'Public')[is_public] + xct.HeadersPhase().AddFile(header, settings) + + +_xcode_variable_re = re.compile('(\$\((.*?)\))') +def ExpandXcodeVariables(string, expansions): + """Expands Xcode-style $(VARIABLES) in string per the expansions dict. + + In some rare cases, it is appropriate to expand Xcode variables when a + project file is generated. For any substring $(VAR) in string, if VAR is a + key in the expansions dict, $(VAR) will be replaced with expansions[VAR]. + Any $(VAR) substring in string for which VAR is not a key in the expansions + dict will remain in the returned string. + """ + + matches = _xcode_variable_re.findall(string) + if matches == None: + return string + + matches.reverse() + for match in matches: + (to_replace, variable) = match + if not variable in expansions: + continue + + replacement = expansions[variable] + string = re.sub(re.escape(to_replace), replacement, string) + + return string + + +def EscapeXCodeArgument(s): + """We must escape the arguments that we give to XCode so that it knows not to + split on spaces and to respect backslash and quote literals.""" + s = s.replace('\\', '\\\\') + s = s.replace('"', '\\"') + return '"' + s + '"' + + +def GenerateOutput(target_list, target_dicts, data, params): + options = params['options'] + generator_flags = params.get('generator_flags', {}) + parallel_builds = generator_flags.get('xcode_parallel_builds', True) + serialize_all_tests = \ + generator_flags.get('xcode_serialize_all_test_runs', True) + project_version = generator_flags.get('xcode_project_version', None) + skip_excluded_files = \ + not generator_flags.get('xcode_list_excluded_files', True) + xcode_projects = {} + for build_file, build_file_dict in data.iteritems(): + (build_file_root, build_file_ext) = os.path.splitext(build_file) + if build_file_ext != '.gyp': + continue + xcodeproj_path = build_file_root + options.suffix + '.xcodeproj' + if options.generator_output: + xcodeproj_path = os.path.join(options.generator_output, xcodeproj_path) + xcp = XcodeProject(build_file, xcodeproj_path, build_file_dict) + xcode_projects[build_file] = xcp + pbxp = xcp.project + + if parallel_builds: + pbxp.SetProperty('attributes', + {'BuildIndependentTargetsInParallel': 'YES'}) + if project_version: + xcp.project_file.SetXcodeVersion(project_version) + + main_group = pbxp.GetProperty('mainGroup') + build_group = gyp.xcodeproj_file.PBXGroup({'name': 'Build'}) + main_group.AppendChild(build_group) + for included_file in build_file_dict['included_files']: + build_group.AddOrGetFileByPath(included_file, False) + + xcode_targets = {} + xcode_target_to_target_dict = {} + for qualified_target in target_list: + [build_file, target_name, toolset] = \ + gyp.common.ParseQualifiedTarget(qualified_target) + + spec = target_dicts[qualified_target] + if spec['toolset'] != 'target': + raise Exception( + 'Multiple toolsets not supported in xcode build (target %s)' % + qualified_target) + configuration_names = [spec['default_configuration']] + for configuration_name in sorted(spec['configurations'].keys()): + if configuration_name not in configuration_names: + configuration_names.append(configuration_name) + xcp = xcode_projects[build_file] + pbxp = xcp.project + + # Set up the configurations for the target according to the list of names + # supplied. + xccl = CreateXCConfigurationList(configuration_names) + + # Create an XCTarget subclass object for the target. The type with + # "+bundle" appended will be used if the target has "mac_bundle" set. + # loadable_modules not in a mac_bundle are mapped to + # com.googlecode.gyp.xcode.bundle, a pseudo-type that xcode.py interprets + # to create a single-file mh_bundle. + _types = { + 'executable': 'com.apple.product-type.tool', + 'loadable_module': 'com.googlecode.gyp.xcode.bundle', + 'shared_library': 'com.apple.product-type.library.dynamic', + 'static_library': 'com.apple.product-type.library.static', + 'executable+bundle': 'com.apple.product-type.application', + 'loadable_module+bundle': 'com.apple.product-type.bundle', + 'shared_library+bundle': 'com.apple.product-type.framework', + } + + target_properties = { + 'buildConfigurationList': xccl, + 'name': target_name, + } + + type = spec['type'] + is_bundle = int(spec.get('mac_bundle', 0)) + if type != 'none': + type_bundle_key = type + if is_bundle: + type_bundle_key += '+bundle' + xctarget_type = gyp.xcodeproj_file.PBXNativeTarget + try: + target_properties['productType'] = _types[type_bundle_key] + except KeyError, e: + gyp.common.ExceptionAppend(e, "-- unknown product type while " + "writing target %s" % target_name) + raise + else: + xctarget_type = gyp.xcodeproj_file.PBXAggregateTarget + assert not is_bundle, ( + 'mac_bundle targets cannot have type none (target "%s")' % + target_name) + + target_product_name = spec.get('product_name') + if target_product_name is not None: + target_properties['productName'] = target_product_name + + xct = xctarget_type(target_properties, parent=pbxp, + force_outdir=spec.get('product_dir'), + force_prefix=spec.get('product_prefix'), + force_extension=spec.get('product_extension')) + pbxp.AppendProperty('targets', xct) + xcode_targets[qualified_target] = xct + xcode_target_to_target_dict[xct] = spec + + spec_actions = spec.get('actions', []) + spec_rules = spec.get('rules', []) + + # Xcode has some "issues" with checking dependencies for the "Compile + # sources" step with any source files/headers generated by actions/rules. + # To work around this, if a target is building anything directly (not + # type "none"), then a second target is used to run the GYP actions/rules + # and is made a dependency of this target. This way the work is done + # before the dependency checks for what should be recompiled. + support_xct = None + if type != 'none' and (spec_actions or spec_rules): + support_xccl = CreateXCConfigurationList(configuration_names); + support_target_properties = { + 'buildConfigurationList': support_xccl, + 'name': target_name + ' Support', + } + if target_product_name: + support_target_properties['productName'] = \ + target_product_name + ' Support' + support_xct = \ + gyp.xcodeproj_file.PBXAggregateTarget(support_target_properties, + parent=pbxp) + pbxp.AppendProperty('targets', support_xct) + xct.AddDependency(support_xct) + # Hang the support target off the main target so it can be tested/found + # by the generator during Finalize. + xct.support_target = support_xct + + prebuild_index = 0 + + # Add custom shell script phases for "actions" sections. + for action in spec_actions: + # There's no need to write anything into the script to ensure that the + # output directories already exist, because Xcode will look at the + # declared outputs and automatically ensure that they exist for us. + + # Do we have a message to print when this action runs? + message = action.get('message') + if message: + message = 'echo note: ' + gyp.common.EncodePOSIXShellArgument(message) + else: + message = '' + + # Turn the list into a string that can be passed to a shell. + action_string = gyp.common.EncodePOSIXShellList(action['action']) + + # Convert Xcode-type variable references to sh-compatible environment + # variable references. + message_sh = gyp.xcodeproj_file.ConvertVariablesToShellSyntax(message) + action_string_sh = gyp.xcodeproj_file.ConvertVariablesToShellSyntax( + action_string) + + script = '' + # Include the optional message + if message_sh: + script += message_sh + '\n' + # Be sure the script runs in exec, and that if exec fails, the script + # exits signalling an error. + script += 'exec ' + action_string_sh + '\nexit 1\n' + ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase({ + 'inputPaths': action['inputs'], + 'name': 'Action "' + action['action_name'] + '"', + 'outputPaths': action['outputs'], + 'shellScript': script, + 'showEnvVarsInLog': 0, + }) + + if support_xct: + support_xct.AppendProperty('buildPhases', ssbp) + else: + # TODO(mark): this assumes too much knowledge of the internals of + # xcodeproj_file; some of these smarts should move into xcodeproj_file + # itself. + xct._properties['buildPhases'].insert(prebuild_index, ssbp) + prebuild_index = prebuild_index + 1 + + # TODO(mark): Should verify that at most one of these is specified. + if int(action.get('process_outputs_as_sources', False)): + for output in action['outputs']: + AddSourceToTarget(output, type, pbxp, xct) + + if int(action.get('process_outputs_as_mac_bundle_resources', False)): + for output in action['outputs']: + AddResourceToTarget(output, pbxp, xct) + + # tgt_mac_bundle_resources holds the list of bundle resources so + # the rule processing can check against it. + if is_bundle: + tgt_mac_bundle_resources = spec.get('mac_bundle_resources', []) + else: + tgt_mac_bundle_resources = [] + + # Add custom shell script phases driving "make" for "rules" sections. + # + # Xcode's built-in rule support is almost powerful enough to use directly, + # but there are a few significant deficiencies that render them unusable. + # There are workarounds for some of its inadequacies, but in aggregate, + # the workarounds added complexity to the generator, and some workarounds + # actually require input files to be crafted more carefully than I'd like. + # Consequently, until Xcode rules are made more capable, "rules" input + # sections will be handled in Xcode output by shell script build phases + # performed prior to the compilation phase. + # + # The following problems with Xcode rules were found. The numbers are + # Apple radar IDs. I hope that these shortcomings are addressed, I really + # liked having the rules handled directly in Xcode during the period that + # I was prototyping this. + # + # 6588600 Xcode compiles custom script rule outputs too soon, compilation + # fails. This occurs when rule outputs from distinct inputs are + # interdependent. The only workaround is to put rules and their + # inputs in a separate target from the one that compiles the rule + # outputs. This requires input file cooperation and it means that + # process_outputs_as_sources is unusable. + # 6584932 Need to declare that custom rule outputs should be excluded from + # compilation. A possible workaround is to lie to Xcode about a + # rule's output, giving it a dummy file it doesn't know how to + # compile. The rule action script would need to touch the dummy. + # 6584839 I need a way to declare additional inputs to a custom rule. + # A possible workaround is a shell script phase prior to + # compilation that touches a rule's primary input files if any + # would-be additional inputs are newer than the output. Modifying + # the source tree - even just modification times - feels dirty. + # 6564240 Xcode "custom script" build rules always dump all environment + # variables. This is a low-prioroty problem and is not a + # show-stopper. + rules_by_ext = {} + for rule in spec_rules: + rules_by_ext[rule['extension']] = rule + + # First, some definitions: + # + # A "rule source" is a file that was listed in a target's "sources" + # list and will have a rule applied to it on the basis of matching the + # rule's "extensions" attribute. Rule sources are direct inputs to + # rules. + # + # Rule definitions may specify additional inputs in their "inputs" + # attribute. These additional inputs are used for dependency tracking + # purposes. + # + # A "concrete output" is a rule output with input-dependent variables + # resolved. For example, given a rule with: + # 'extension': 'ext', 'outputs': ['$(INPUT_FILE_BASE).cc'], + # if the target's "sources" list contained "one.ext" and "two.ext", + # the "concrete output" for rule input "two.ext" would be "two.cc". If + # a rule specifies multiple outputs, each input file that the rule is + # applied to will have the same number of concrete outputs. + # + # If any concrete outputs are outdated or missing relative to their + # corresponding rule_source or to any specified additional input, the + # rule action must be performed to generate the concrete outputs. + + # concrete_outputs_by_rule_source will have an item at the same index + # as the rule['rule_sources'] that it corresponds to. Each item is a + # list of all of the concrete outputs for the rule_source. + concrete_outputs_by_rule_source = [] + + # concrete_outputs_all is a flat list of all concrete outputs that this + # rule is able to produce, given the known set of input files + # (rule_sources) that apply to it. + concrete_outputs_all = [] + + # messages & actions are keyed by the same indices as rule['rule_sources'] + # and concrete_outputs_by_rule_source. They contain the message and + # action to perform after resolving input-dependent variables. The + # message is optional, in which case None is stored for each rule source. + messages = [] + actions = [] + + for rule_source in rule.get('rule_sources', []): + rule_source_dirname, rule_source_basename = \ + posixpath.split(rule_source) + (rule_source_root, rule_source_ext) = \ + posixpath.splitext(rule_source_basename) + + # These are the same variable names that Xcode uses for its own native + # rule support. Because Xcode's rule engine is not being used, they + # need to be expanded as they are written to the makefile. + rule_input_dict = { + 'INPUT_FILE_BASE': rule_source_root, + 'INPUT_FILE_SUFFIX': rule_source_ext, + 'INPUT_FILE_NAME': rule_source_basename, + 'INPUT_FILE_PATH': rule_source, + 'INPUT_FILE_DIRNAME': rule_source_dirname, + } + + concrete_outputs_for_this_rule_source = [] + for output in rule.get('outputs', []): + # Fortunately, Xcode and make both use $(VAR) format for their + # variables, so the expansion is the only transformation necessary. + # Any remaning $(VAR)-type variables in the string can be given + # directly to make, which will pick up the correct settings from + # what Xcode puts into the environment. + concrete_output = ExpandXcodeVariables(output, rule_input_dict) + concrete_outputs_for_this_rule_source.append(concrete_output) + + # Add all concrete outputs to the project. + pbxp.AddOrGetFileInRootGroup(concrete_output) + + concrete_outputs_by_rule_source.append( \ + concrete_outputs_for_this_rule_source) + concrete_outputs_all.extend(concrete_outputs_for_this_rule_source) + + # TODO(mark): Should verify that at most one of these is specified. + if int(rule.get('process_outputs_as_sources', False)): + for output in concrete_outputs_for_this_rule_source: + AddSourceToTarget(output, type, pbxp, xct) + + # If the file came from the mac_bundle_resources list or if the rule + # is marked to process outputs as bundle resource, do so. + was_mac_bundle_resource = rule_source in tgt_mac_bundle_resources + if was_mac_bundle_resource or \ + int(rule.get('process_outputs_as_mac_bundle_resources', False)): + for output in concrete_outputs_for_this_rule_source: + AddResourceToTarget(output, pbxp, xct) + + # Do we have a message to print when this rule runs? + message = rule.get('message') + if message: + message = gyp.common.EncodePOSIXShellArgument(message) + message = ExpandXcodeVariables(message, rule_input_dict) + messages.append(message) + + # Turn the list into a string that can be passed to a shell. + action_string = gyp.common.EncodePOSIXShellList(rule['action']) + + action = ExpandXcodeVariables(action_string, rule_input_dict) + actions.append(action) + + if len(concrete_outputs_all) > 0: + # TODO(mark): There's a possibilty for collision here. Consider + # target "t" rule "A_r" and target "t_A" rule "r". + makefile_name = '%s.make' % re.sub( + '[^a-zA-Z0-9_]', '_' , '%s_%s' % (target_name, rule['rule_name'])) + makefile_path = os.path.join(xcode_projects[build_file].path, + makefile_name) + # TODO(mark): try/close? Write to a temporary file and swap it only + # if it's got changes? + makefile = open(makefile_path, 'wb') + + # make will build the first target in the makefile by default. By + # convention, it's called "all". List all (or at least one) + # concrete output for each rule source as a prerequisite of the "all" + # target. + makefile.write('all: \\\n') + for concrete_output_index in \ + xrange(0, len(concrete_outputs_by_rule_source)): + # Only list the first (index [0]) concrete output of each input + # in the "all" target. Otherwise, a parallel make (-j > 1) would + # attempt to process each input multiple times simultaneously. + # Otherwise, "all" could just contain the entire list of + # concrete_outputs_all. + concrete_output = \ + concrete_outputs_by_rule_source[concrete_output_index][0] + if concrete_output_index == len(concrete_outputs_by_rule_source) - 1: + eol = '' + else: + eol = ' \\' + makefile.write(' %s%s\n' % (concrete_output, eol)) + + for (rule_source, concrete_outputs, message, action) in \ + zip(rule['rule_sources'], concrete_outputs_by_rule_source, + messages, actions): + makefile.write('\n') + + # Add a rule that declares it can build each concrete output of a + # rule source. Collect the names of the directories that are + # required. + concrete_output_dirs = [] + for concrete_output_index in xrange(0, len(concrete_outputs)): + concrete_output = concrete_outputs[concrete_output_index] + if concrete_output_index == 0: + bol = '' + else: + bol = ' ' + makefile.write('%s%s \\\n' % (bol, concrete_output)) + + concrete_output_dir = posixpath.dirname(concrete_output) + if (concrete_output_dir and + concrete_output_dir not in concrete_output_dirs): + concrete_output_dirs.append(concrete_output_dir) + + makefile.write(' : \\\n') + + # The prerequisites for this rule are the rule source itself and + # the set of additional rule inputs, if any. + prerequisites = [rule_source] + prerequisites.extend(rule.get('inputs', [])) + for prerequisite_index in xrange(0, len(prerequisites)): + prerequisite = prerequisites[prerequisite_index] + if prerequisite_index == len(prerequisites) - 1: + eol = '' + else: + eol = ' \\' + makefile.write(' %s%s\n' % (prerequisite, eol)) + + # Make sure that output directories exist before executing the rule + # action. + if len(concrete_output_dirs) > 0: + makefile.write('\t@mkdir -p "%s"\n' % + '" "'.join(concrete_output_dirs)) + + # The rule message and action have already had the necessary variable + # substitutions performed. + if message: + # Mark it with note: so Xcode picks it up in build output. + makefile.write('\t@echo note: %s\n' % message) + makefile.write('\t%s\n' % action) + + makefile.close() + + # It might be nice to ensure that needed output directories exist + # here rather than in each target in the Makefile, but that wouldn't + # work if there ever was a concrete output that had an input-dependent + # variable anywhere other than in the leaf position. + + # Don't declare any inputPaths or outputPaths. If they're present, + # Xcode will provide a slight optimization by only running the script + # phase if any output is missing or outdated relative to any input. + # Unfortunately, it will also assume that all outputs are touched by + # the script, and if the outputs serve as files in a compilation + # phase, they will be unconditionally rebuilt. Since make might not + # rebuild everything that could be declared here as an output, this + # extra compilation activity is unnecessary. With inputPaths and + # outputPaths not supplied, make will always be called, but it knows + # enough to not do anything when everything is up-to-date. + + # To help speed things up, pass -j COUNT to make so it does some work + # in parallel. Don't use ncpus because Xcode will build ncpus targets + # in parallel and if each target happens to have a rules step, there + # would be ncpus^2 things going. With a machine that has 2 quad-core + # Xeons, a build can quickly run out of processes based on + # scheduling/other tasks, and randomly failing builds are no good. + script = \ +"""JOB_COUNT="$(/usr/sbin/sysctl -n hw.ncpu)" +if [ "${JOB_COUNT}" -gt 4 ]; then + JOB_COUNT=4 +fi +exec "${DEVELOPER_BIN_DIR}/make" -f "${PROJECT_FILE_PATH}/%s" -j "${JOB_COUNT}" +exit 1 +""" % makefile_name + ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase({ + 'name': 'Rule "' + rule['rule_name'] + '"', + 'shellScript': script, + 'showEnvVarsInLog': 0, + }) + + if support_xct: + support_xct.AppendProperty('buildPhases', ssbp) + else: + # TODO(mark): this assumes too much knowledge of the internals of + # xcodeproj_file; some of these smarts should move into xcodeproj_file + # itself. + xct._properties['buildPhases'].insert(prebuild_index, ssbp) + prebuild_index = prebuild_index + 1 + + # Extra rule inputs also go into the project file. Concrete outputs were + # already added when they were computed. + groups = ['inputs', 'inputs_excluded'] + if skip_excluded_files: + groups = [x for x in groups if not x.endswith('_excluded')] + for group in groups: + for item in rule.get(group, []): + pbxp.AddOrGetFileInRootGroup(item) + + # Add "sources". + for source in spec.get('sources', []): + (source_root, source_extension) = posixpath.splitext(source) + if source_extension[1:] not in rules_by_ext: + # AddSourceToTarget will add the file to a root group if it's not + # already there. + AddSourceToTarget(source, type, pbxp, xct) + else: + pbxp.AddOrGetFileInRootGroup(source) + + # Add "mac_bundle_resources" and "mac_framework_private_headers" if + # it's a bundle of any type. + if is_bundle: + for resource in tgt_mac_bundle_resources: + (resource_root, resource_extension) = posixpath.splitext(resource) + if resource_extension[1:] not in rules_by_ext: + AddResourceToTarget(resource, pbxp, xct) + else: + pbxp.AddOrGetFileInRootGroup(resource) + + for header in spec.get('mac_framework_private_headers', []): + AddHeaderToTarget(header, pbxp, xct, False) + + # Add "mac_framework_headers". These can be valid for both frameworks + # and static libraries. + if is_bundle or type == 'static_library': + for header in spec.get('mac_framework_headers', []): + AddHeaderToTarget(header, pbxp, xct, True) + + # Add "copies". + for copy_group in spec.get('copies', []): + pbxcp = gyp.xcodeproj_file.PBXCopyFilesBuildPhase({ + 'name': 'Copy to ' + copy_group['destination'] + }, + parent=xct) + dest = copy_group['destination'] + if dest[0] not in ('/', '$'): + # Relative paths are relative to $(SRCROOT). + dest = '$(SRCROOT)/' + dest + pbxcp.SetDestination(dest) + + # TODO(mark): The usual comment about this knowing too much about + # gyp.xcodeproj_file internals applies. + xct._properties['buildPhases'].insert(prebuild_index, pbxcp) + + for file in copy_group['files']: + pbxcp.AddFile(file) + + # Excluded files can also go into the project file. + if not skip_excluded_files: + for key in ['sources', 'mac_bundle_resources', 'mac_framework_headers', + 'mac_framework_private_headers']: + excluded_key = key + '_excluded' + for item in spec.get(excluded_key, []): + pbxp.AddOrGetFileInRootGroup(item) + + # So can "inputs" and "outputs" sections of "actions" groups. + groups = ['inputs', 'inputs_excluded', 'outputs', 'outputs_excluded'] + if skip_excluded_files: + groups = [x for x in groups if not x.endswith('_excluded')] + for action in spec.get('actions', []): + for group in groups: + for item in action.get(group, []): + # Exclude anything in BUILT_PRODUCTS_DIR. They're products, not + # sources. + if not item.startswith('$(BUILT_PRODUCTS_DIR)/'): + pbxp.AddOrGetFileInRootGroup(item) + + for postbuild in spec.get('postbuilds', []): + action_string_sh = gyp.common.EncodePOSIXShellList(postbuild['action']) + script = 'exec ' + action_string_sh + '\nexit 1\n' + + # Make the postbuild step depend on the output of ld or ar from this + # target. Apparently putting the script step after the link step isn't + # sufficient to ensure proper ordering in all cases. With an input + # declared but no outputs, the script step should run every time, as + # desired. + ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase({ + 'inputPaths': ['$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_PATH)'], + 'name': 'Postbuild "' + postbuild['postbuild_name'] + '"', + 'shellScript': script, + 'showEnvVarsInLog': 0, + }) + xct.AppendProperty('buildPhases', ssbp) + + # Add dependencies before libraries, because adding a dependency may imply + # adding a library. It's preferable to keep dependencies listed first + # during a link phase so that they can override symbols that would + # otherwise be provided by libraries, which will usually include system + # libraries. On some systems, ld is finicky and even requires the + # libraries to be ordered in such a way that unresolved symbols in + # earlier-listed libraries may only be resolved by later-listed libraries. + # The Mac linker doesn't work that way, but other platforms do, and so + # their linker invocations need to be constructed in this way. There's + # no compelling reason for Xcode's linker invocations to differ. + + if 'dependencies' in spec: + for dependency in spec['dependencies']: + xct.AddDependency(xcode_targets[dependency]) + # The support project also gets the dependencies (in case they are + # needed for the actions/rules to work). + if support_xct: + support_xct.AddDependency(xcode_targets[dependency]) + + if 'libraries' in spec: + for library in spec['libraries']: + xct.FrameworksPhase().AddFile(library) + # Add the library's directory to LIBRARY_SEARCH_PATHS if necessary. + # I wish Xcode handled this automatically. + library_dir = posixpath.dirname(library) + if library_dir not in xcode_standard_library_dirs and ( + not xct.HasBuildSetting(_library_search_paths_var) or + library_dir not in xct.GetBuildSetting(_library_search_paths_var)): + xct.AppendBuildSetting(_library_search_paths_var, library_dir) + + for configuration_name in configuration_names: + configuration = spec['configurations'][configuration_name] + xcbc = xct.ConfigurationNamed(configuration_name) + for include_dir in configuration.get('mac_framework_dirs', []): + xcbc.AppendBuildSetting('FRAMEWORK_SEARCH_PATHS', include_dir) + for include_dir in configuration.get('include_dirs', []): + xcbc.AppendBuildSetting('HEADER_SEARCH_PATHS', include_dir) + if 'defines' in configuration: + for define in configuration['defines']: + set_define = EscapeXCodeArgument(define) + xcbc.AppendBuildSetting('GCC_PREPROCESSOR_DEFINITIONS', set_define) + if 'xcode_settings' in configuration: + for xck, xcv in configuration['xcode_settings'].iteritems(): + xcbc.SetBuildSetting(xck, xcv) + if 'xcode_config_file' in configuration: + config_ref = pbxp.AddOrGetFileInRootGroup( + configuration['xcode_config_file']) + xcbc.SetBaseConfiguration(config_ref) + + build_files = [] + for build_file, build_file_dict in data.iteritems(): + if build_file.endswith('.gyp'): + build_files.append(build_file) + + for build_file in build_files: + xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) + + for build_file in build_files: + xcode_projects[build_file].Finalize2(xcode_targets, + xcode_target_to_target_dict) + + for build_file in build_files: + xcode_projects[build_file].Write() diff --git a/tools/gyp/pylib/gyp/input.py b/tools/gyp/pylib/gyp/input.py new file mode 100644 index 000000000..119de08dd --- /dev/null +++ b/tools/gyp/pylib/gyp/input.py @@ -0,0 +1,2486 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from compiler.ast import Const +from compiler.ast import Dict +from compiler.ast import Discard +from compiler.ast import List +from compiler.ast import Module +from compiler.ast import Node +from compiler.ast import Stmt +import compiler +import copy +import gyp.common +import optparse +import os.path +import re +import shlex +import subprocess +import sys + + +# A list of types that are treated as linkable. +linkable_types = ['executable', 'shared_library', 'loadable_module'] + +# A list of sections that contain links to other targets. +dependency_sections = ['dependencies', 'export_dependent_settings'] + +# base_path_sections is a list of sections defined by GYP that contain +# pathnames. The generators can provide more keys, the two lists are merged +# into path_sections, but you should call IsPathSection instead of using either +# list directly. +base_path_sections = [ + 'destination', + 'files', + 'include_dirs', + 'inputs', + 'libraries', + 'outputs', + 'sources', +] +path_sections = [] + + +def IsPathSection(section): + # If section ends in one of these characters, it's applied to a section + # without the trailing characters. '/' is notably absent from this list, + # because there's no way for a regular expression to be treated as a path. + while section[-1:] in ('=', '+', '?', '!'): + section = section[0:-1] + + if section in path_sections or \ + section.endswith('_dir') or section.endswith('_dirs') or \ + section.endswith('_file') or section.endswith('_files') or \ + section.endswith('_path') or section.endswith('_paths'): + return True + return False + + +# base_non_configuraiton_keys is a list of key names that belong in the target +# itself and should not be propagated into its configurations. It is merged +# with a list that can come from the generator to +# create non_configuration_keys. +base_non_configuration_keys = [ + # Sections that must exist inside targets and not configurations. + 'actions', + 'configurations', + 'copies', + 'default_configuration', + 'dependencies', + 'dependencies_original', + 'link_languages', + 'libraries', + 'postbuilds', + 'product_dir', + 'product_extension', + 'product_name', + 'product_prefix', + 'rules', + 'run_as', + 'sources', + 'suppress_wildcard', + 'target_name', + 'toolset', + 'toolsets', + 'type', + 'variants', + + # Sections that can be found inside targets or configurations, but that + # should not be propagated from targets into their configurations. + 'variables', +] +non_configuration_keys = [] + +# Keys that do not belong inside a configuration dictionary. +invalid_configuration_keys = [ + 'actions', + 'all_dependent_settings', + 'configurations', + 'dependencies', + 'direct_dependent_settings', + 'libraries', + 'link_settings', + 'sources', + 'target_name', + 'type', +] + +# Controls how the generator want the build file paths. +absolute_build_file_paths = False + +# Controls whether or not the generator supports multiple toolsets. +multiple_toolsets = False + + +def GetIncludedBuildFiles(build_file_path, aux_data, included=None): + """Return a list of all build files included into build_file_path. + + The returned list will contain build_file_path as well as all other files + that it included, either directly or indirectly. Note that the list may + contain files that were included into a conditional section that evaluated + to false and was not merged into build_file_path's dict. + + aux_data is a dict containing a key for each build file or included build + file. Those keys provide access to dicts whose "included" keys contain + lists of all other files included by the build file. + + included should be left at its default None value by external callers. It + is used for recursion. + + The returned list will not contain any duplicate entries. Each build file + in the list will be relative to the current directory. + """ + + if included == None: + included = [] + + if build_file_path in included: + return included + + included.append(build_file_path) + + for included_build_file in aux_data[build_file_path].get('included', []): + GetIncludedBuildFiles(included_build_file, aux_data, included) + + return included + + +def CheckedEval(file_contents): + """Return the eval of a gyp file. + + The gyp file is restricted to dictionaries and lists only, and + repeated keys are not allowed. + + Note that this is slower than eval() is. + """ + + ast = compiler.parse(file_contents) + assert isinstance(ast, Module) + c1 = ast.getChildren() + assert c1[0] is None + assert isinstance(c1[1], Stmt) + c2 = c1[1].getChildren() + assert isinstance(c2[0], Discard) + c3 = c2[0].getChildren() + assert len(c3) == 1 + return CheckNode(c3[0], []) + + +def CheckNode(node, keypath): + if isinstance(node, Dict): + c = node.getChildren() + dict = {} + for n in range(0, len(c), 2): + assert isinstance(c[n], Const) + key = c[n].getChildren()[0] + if key in dict: + raise KeyError, "Key '" + key + "' repeated at level " + \ + repr(len(keypath) + 1) + " with key path '" + \ + '.'.join(keypath) + "'" + kp = list(keypath) # Make a copy of the list for descending this node. + kp.append(key) + dict[key] = CheckNode(c[n + 1], kp) + return dict + elif isinstance(node, List): + c = node.getChildren() + children = [] + for index, child in enumerate(c): + kp = list(keypath) # Copy list. + kp.append(repr(index)) + children.append(CheckNode(child, kp)) + return children + elif isinstance(node, Const): + return node.getChildren()[0] + else: + raise TypeError, "Unknown AST node at key path '" + '.'.join(keypath) + \ + "': " + repr(node) + + +def LoadOneBuildFile(build_file_path, data, aux_data, variables, includes, + is_target, check): + if build_file_path in data: + return data[build_file_path] + + if os.path.exists(build_file_path): + build_file_contents = open(build_file_path).read() + else: + raise Exception("%s not found (cwd: %s)" % (build_file_path, os.getcwd())) + + build_file_data = None + try: + if check: + build_file_data = CheckedEval(build_file_contents) + else: + build_file_data = eval(build_file_contents, {'__builtins__': None}, + None) + except SyntaxError, e: + e.filename = build_file_path + raise + except Exception, e: + gyp.common.ExceptionAppend(e, 'while reading ' + build_file_path) + raise + + data[build_file_path] = build_file_data + aux_data[build_file_path] = {} + + # Scan for includes and merge them in. + try: + if is_target: + LoadBuildFileIncludesIntoDict(build_file_data, build_file_path, data, + aux_data, variables, includes, check) + else: + LoadBuildFileIncludesIntoDict(build_file_data, build_file_path, data, + aux_data, variables, None, check) + except Exception, e: + gyp.common.ExceptionAppend(e, + 'while reading includes of ' + build_file_path) + raise + + return build_file_data + + +def LoadBuildFileIncludesIntoDict(subdict, subdict_path, data, aux_data, + variables, includes, check): + includes_list = [] + if includes != None: + includes_list.extend(includes) + if 'includes' in subdict: + for include in subdict['includes']: + # "include" is specified relative to subdict_path, so compute the real + # path to include by appending the provided "include" to the directory + # in which subdict_path resides. + relative_include = \ + os.path.normpath(os.path.join(os.path.dirname(subdict_path), include)) + includes_list.append(relative_include) + # Unhook the includes list, it's no longer needed. + del subdict['includes'] + + # Merge in the included files. + for include in includes_list: + if not 'included' in aux_data[subdict_path]: + aux_data[subdict_path]['included'] = [] + aux_data[subdict_path]['included'].append(include) + + gyp.DebugOutput(gyp.DEBUG_INCLUDES, "Loading Included File: '%s'" % include) + + MergeDicts(subdict, + LoadOneBuildFile(include, data, aux_data, variables, None, + False, check), + subdict_path, include) + + # Recurse into subdictionaries. + for k, v in subdict.iteritems(): + if v.__class__ == dict: + LoadBuildFileIncludesIntoDict(v, subdict_path, data, aux_data, variables, + None, check) + elif v.__class__ == list: + LoadBuildFileIncludesIntoList(v, subdict_path, data, aux_data, variables, + check) + + +# This recurses into lists so that it can look for dicts. +def LoadBuildFileIncludesIntoList(sublist, sublist_path, data, aux_data, + variables, check): + for item in sublist: + if item.__class__ == dict: + LoadBuildFileIncludesIntoDict(item, sublist_path, data, aux_data, + variables, None, check) + elif item.__class__ == list: + LoadBuildFileIncludesIntoList(item, sublist_path, data, aux_data, + variables, check) + +# Processes toolsets in all the targets. This recurses into condition entries +# since they can contain toolsets as well. +def ProcessToolsetsInDict(data): + if 'targets' in data: + target_list = data['targets'] + new_target_list = [] + for target in target_list: + # If this target already has an explicit 'toolset', and no 'toolsets' + # list, don't modify it further. + if 'toolset' in target and 'toolsets' not in target: + new_target_list.append(target) + continue + if multiple_toolsets: + toolsets = target.get('toolsets', ['target']) + else: + toolsets = ['target'] + # Make sure this 'toolsets' definition is only processed once. + if 'toolsets' in target: + del target['toolsets'] + if len(toolsets) > 0: + # Optimization: only do copies if more than one toolset is specified. + for build in toolsets[1:]: + new_target = copy.deepcopy(target) + new_target['toolset'] = build + new_target_list.append(new_target) + target['toolset'] = toolsets[0] + new_target_list.append(target) + data['targets'] = new_target_list + if 'conditions' in data: + for condition in data['conditions']: + if isinstance(condition, list): + for condition_dict in condition[1:]: + ProcessToolsetsInDict(condition_dict) + + +# TODO(mark): I don't love this name. It just means that it's going to load +# a build file that contains targets and is expected to provide a targets dict +# that contains the targets... +def LoadTargetBuildFile(build_file_path, data, aux_data, variables, includes, + depth, check): + # If depth is set, predefine the DEPTH variable to be a relative path from + # this build file's directory to the directory identified by depth. + if depth: + # TODO(dglazkov) The backslash/forward-slash replacement at the end is a + # temporary measure. This should really be addressed by keeping all paths + # in POSIX until actual project generation. + d = gyp.common.RelativePath(depth, os.path.dirname(build_file_path)) + if d == '': + variables['DEPTH'] = '.' + else: + variables['DEPTH'] = d.replace('\\', '/') + + # If the generator needs absolue paths, then do so. + if absolute_build_file_paths: + build_file_path = os.path.abspath(build_file_path) + + if build_file_path in data['target_build_files']: + # Already loaded. + return + data['target_build_files'].add(build_file_path) + + gyp.DebugOutput(gyp.DEBUG_INCLUDES, + "Loading Target Build File '%s'" % build_file_path) + + build_file_data = LoadOneBuildFile(build_file_path, data, aux_data, variables, + includes, True, check) + + # Store DEPTH for later use in generators. + build_file_data['_DEPTH'] = depth + + # Set up the included_files key indicating which .gyp files contributed to + # this target dict. + if 'included_files' in build_file_data: + raise KeyError, build_file_path + ' must not contain included_files key' + + included = GetIncludedBuildFiles(build_file_path, aux_data) + build_file_data['included_files'] = [] + for included_file in included: + # included_file is relative to the current directory, but it needs to + # be made relative to build_file_path's directory. + included_relative = \ + gyp.common.RelativePath(included_file, + os.path.dirname(build_file_path)) + build_file_data['included_files'].append(included_relative) + + # Do a first round of toolsets expansion so that conditions can be defined + # per toolset. + ProcessToolsetsInDict(build_file_data) + + # Apply "pre"/"early" variable expansions and condition evaluations. + ProcessVariablesAndConditionsInDict( + build_file_data, PHASE_EARLY, variables, build_file_path) + + # Since some toolsets might have been defined conditionally, perform + # a second round of toolsets expansion now. + ProcessToolsetsInDict(build_file_data) + + # Look at each project's target_defaults dict, and merge settings into + # targets. + if 'target_defaults' in build_file_data: + index = 0 + if 'targets' in build_file_data: + while index < len(build_file_data['targets']): + # This procedure needs to give the impression that target_defaults is + # used as defaults, and the individual targets inherit from that. + # The individual targets need to be merged into the defaults. Make + # a deep copy of the defaults for each target, merge the target dict + # as found in the input file into that copy, and then hook up the + # copy with the target-specific data merged into it as the replacement + # target dict. + old_target_dict = build_file_data['targets'][index] + new_target_dict = copy.deepcopy(build_file_data['target_defaults']) + MergeDicts(new_target_dict, old_target_dict, + build_file_path, build_file_path) + build_file_data['targets'][index] = new_target_dict + index = index + 1 + else: + raise Exception, \ + "Unable to find targets in build file %s" % build_file_path + + # No longer needed. + del build_file_data['target_defaults'] + + # Look for dependencies. This means that dependency resolution occurs + # after "pre" conditionals and variable expansion, but before "post" - + # in other words, you can't put a "dependencies" section inside a "post" + # conditional within a target. + + if 'targets' in build_file_data: + for target_dict in build_file_data['targets']: + if 'dependencies' not in target_dict: + continue + for dependency in target_dict['dependencies']: + other_build_file = \ + gyp.common.ResolveTarget(build_file_path, dependency, None)[0] + try: + LoadTargetBuildFile(other_build_file, data, aux_data, variables, + includes, depth, check) + except Exception, e: + gyp.common.ExceptionAppend( + e, 'while loading dependencies of %s' % build_file_path) + raise + + return data + + +# Look for the bracket that matches the first bracket seen in a +# string, and return the start and end as a tuple. For example, if +# the input is something like "<(foo <(bar)) blah", then it would +# return (1, 13), indicating the entire string except for the leading +# "<" and trailing " blah". +def FindEnclosingBracketGroup(input): + brackets = { '}': '{', + ']': '[', + ')': '(', } + stack = [] + count = 0 + start = -1 + for char in input: + if char in brackets.values(): + stack.append(char) + if start == -1: + start = count + if char in brackets.keys(): + try: + last_bracket = stack.pop() + except IndexError: + return (-1, -1) + if last_bracket != brackets[char]: + return (-1, -1) + if len(stack) == 0: + return (start, count + 1) + count = count + 1 + return (-1, -1) + + +canonical_int_re = re.compile('^(0|-?[1-9][0-9]*)$') + + +def IsStrCanonicalInt(string): + """Returns True if |string| is in its canonical integer form. + + The canonical form is such that str(int(string)) == string. + """ + if not isinstance(string, str) or not canonical_int_re.match(string): + return False + + return True + + +# This matches things like "<(asdf)", "(?P<(?:(?:!?@?)|\|)?)' + '(?P[-a-zA-Z0-9_.]+)?' + '\((?P\s*\[?)' + '(?P.*?)(\]?)\))') + +# This matches the same as early_variable_re, but with '>' instead of '<'. +late_variable_re = re.compile( + '(?P(?P>(?:(?:!?@?)|\|)?)' + '(?P[-a-zA-Z0-9_.]+)?' + '\((?P\s*\[?)' + '(?P.*?)(\]?)\))') + +# This matches the same as early_variable_re, but with '^' instead of '<'. +latelate_variable_re = re.compile( + '(?P(?P[\^](?:(?:!?@?)|\|)?)' + '(?P[-a-zA-Z0-9_.]+)?' + '\((?P\s*\[?)' + '(?P.*?)(\]?)\))') + +# Global cache of results from running commands so they don't have to be run +# more then once. +cached_command_results = {} + + +def FixupPlatformCommand(cmd): + if sys.platform == 'win32': + if type(cmd) == list: + cmd = [re.sub('^cat ', 'type ', cmd[0])] + cmd[1:] + else: + cmd = re.sub('^cat ', 'type ', cmd) + return cmd + + +PHASE_EARLY = 0 +PHASE_LATE = 1 +PHASE_LATELATE = 2 + + +def ExpandVariables(input, phase, variables, build_file): + # Look for the pattern that gets expanded into variables + if phase == PHASE_EARLY: + variable_re = early_variable_re + expansion_symbol = '<' + elif phase == PHASE_LATE: + variable_re = late_variable_re + expansion_symbol = '>' + elif phase == PHASE_LATELATE: + variable_re = latelate_variable_re + expansion_symbol = '^' + else: + assert False + + input_str = str(input) + if IsStrCanonicalInt(input_str): + return int(input_str) + + # Do a quick scan to determine if an expensive regex search is warranted. + if expansion_symbol not in input_str: + return input_str + + # Get the entire list of matches as a list of MatchObject instances. + # (using findall here would return strings instead of MatchObjects). + matches = [match for match in variable_re.finditer(input_str)] + if not matches: + return input_str + + output = input_str + # Reverse the list of matches so that replacements are done right-to-left. + # That ensures that earlier replacements won't mess up the string in a + # way that causes later calls to find the earlier substituted text instead + # of what's intended for replacement. + matches.reverse() + for match_group in matches: + match = match_group.groupdict() + gyp.DebugOutput(gyp.DEBUG_VARIABLES, + "Matches: %s" % repr(match)) + # match['replace'] is the substring to look for, match['type'] + # is the character code for the replacement type (< > ! <| >| <@ + # >@ !@), match['is_array'] contains a '[' for command + # arrays, and match['content'] is the name of the variable (< >) + # or command to run (!). match['command_string'] is an optional + # command string. Currently, only 'pymod_do_main' is supported. + + # run_command is true if a ! variant is used. + run_command = '!' in match['type'] + command_string = match['command_string'] + + # file_list is true if a | variant is used. + file_list = '|' in match['type'] + + # Capture these now so we can adjust them later. + replace_start = match_group.start('replace') + replace_end = match_group.end('replace') + + # Find the ending paren, and re-evaluate the contained string. + (c_start, c_end) = FindEnclosingBracketGroup(input_str[replace_start:]) + + # Adjust the replacement range to match the entire command + # found by FindEnclosingBracketGroup (since the variable_re + # probably doesn't match the entire command if it contained + # nested variables). + replace_end = replace_start + c_end + + # Find the "real" replacement, matching the appropriate closing + # paren, and adjust the replacement start and end. + replacement = input_str[replace_start:replace_end] + + # Figure out what the contents of the variable parens are. + contents_start = replace_start + c_start + 1 + contents_end = replace_end - 1 + contents = input_str[contents_start:contents_end] + + # Do filter substitution now for <|(). + # Admittedly, this is different than the evaluation order in other + # contexts. However, since filtration has no chance to run on <|(), + # this seems like the only obvious way to give them access to filters. + if file_list: + processed_variables = copy.deepcopy(variables) + ProcessListFiltersInDict(contents, processed_variables) + # Recurse to expand variables in the contents + contents = ExpandVariables(contents, phase, + processed_variables, build_file) + else: + # Recurse to expand variables in the contents + contents = ExpandVariables(contents, phase, variables, build_file) + + # Strip off leading/trailing whitespace so that variable matches are + # simpler below (and because they are rarely needed). + contents = contents.strip() + + # expand_to_list is true if an @ variant is used. In that case, + # the expansion should result in a list. Note that the caller + # is to be expecting a list in return, and not all callers do + # because not all are working in list context. Also, for list + # expansions, there can be no other text besides the variable + # expansion in the input string. + expand_to_list = '@' in match['type'] and input_str == replacement + + if run_command or file_list: + # Find the build file's directory, so commands can be run or file lists + # generated relative to it. + build_file_dir = os.path.dirname(build_file) + if build_file_dir == '': + # If build_file is just a leaf filename indicating a file in the + # current directory, build_file_dir might be an empty string. Set + # it to None to signal to subprocess.Popen that it should run the + # command in the current directory. + build_file_dir = None + + # Support <|(listfile.txt ...) which generates a file + # containing items from a gyp list, generated at gyp time. + # This works around actions/rules which have more inputs than will + # fit on the command line. + if file_list: + if type(contents) == list: + contents_list = contents + else: + contents_list = contents.split(' ') + replacement = contents_list[0] + path = replacement + if not os.path.isabs(path): + path = os.path.join(build_file_dir, path) + f = gyp.common.WriteOnDiff(path) + for i in contents_list[1:]: + f.write('%s\n' % i) + f.close() + + elif run_command: + use_shell = True + if match['is_array']: + contents = eval(contents) + use_shell = False + + # Check for a cached value to avoid executing commands, or generating + # file lists more than once. + # TODO(http://code.google.com/p/gyp/issues/detail?id=112): It is + # possible that the command being invoked depends on the current + # directory. For that case the syntax needs to be extended so that the + # directory is also used in cache_key (it becomes a tuple). + # TODO(http://code.google.com/p/gyp/issues/detail?id=111): In theory, + # someone could author a set of GYP files where each time the command + # is invoked it produces different output by design. When the need + # arises, the syntax should be extended to support no caching off a + # command's output so it is run every time. + cache_key = str(contents) + cached_value = cached_command_results.get(cache_key, None) + if cached_value is None: + gyp.DebugOutput(gyp.DEBUG_VARIABLES, + "Executing command '%s' in directory '%s'" % + (contents,build_file_dir)) + + replacement = '' + + if command_string == 'pymod_do_main': + # (sources/) etc. to resolve to + # and empty list if undefined. This allows actions to: + # 'action!': [ + # '>@(_sources!)', + # ], + # 'action/': [ + # '>@(_sources/)', + # ], + replacement = [] + else: + raise KeyError, 'Undefined variable ' + contents + \ + ' in ' + build_file + else: + replacement = variables[contents] + + if isinstance(replacement, list): + for item in replacement: + if (not contents[-1] == '/' and + not isinstance(item, str) and not isinstance(item, int)): + raise TypeError, 'Variable ' + contents + \ + ' must expand to a string or list of strings; ' + \ + 'list contains a ' + \ + item.__class__.__name__ + # Run through the list and handle variable expansions in it. Since + # the list is guaranteed not to contain dicts, this won't do anything + # with conditions sections. + ProcessVariablesAndConditionsInList(replacement, phase, variables, + build_file) + elif not isinstance(replacement, str) and \ + not isinstance(replacement, int): + raise TypeError, 'Variable ' + contents + \ + ' must expand to a string or list of strings; ' + \ + 'found a ' + replacement.__class__.__name__ + + if expand_to_list: + # Expanding in list context. It's guaranteed that there's only one + # replacement to do in |input_str| and that it's this replacement. See + # above. + if isinstance(replacement, list): + # If it's already a list, make a copy. + output = replacement[:] + else: + # Split it the same way sh would split arguments. + output = shlex.split(str(replacement)) + else: + # Expanding in string context. + encoded_replacement = '' + if isinstance(replacement, list): + # When expanding a list into string context, turn the list items + # into a string in a way that will work with a subprocess call. + # + # TODO(mark): This isn't completely correct. This should + # call a generator-provided function that observes the + # proper list-to-argument quoting rules on a specific + # platform instead of just calling the POSIX encoding + # routine. + encoded_replacement = gyp.common.EncodePOSIXShellList(replacement) + else: + encoded_replacement = replacement + + output = output[:replace_start] + str(encoded_replacement) + \ + output[replace_end:] + # Prepare for the next match iteration. + input_str = output + + # Look for more matches now that we've replaced some, to deal with + # expanding local variables (variables defined in the same + # variables block as this one). + gyp.DebugOutput(gyp.DEBUG_VARIABLES, + "Found output %s, recursing." % repr(output)) + if isinstance(output, list): + if output and isinstance(output[0], list): + # Leave output alone if it's a list of lists. + # We don't want such lists to be stringified. + pass + else: + new_output = [] + for item in output: + new_output.append( + ExpandVariables(item, phase, variables, build_file)) + output = new_output + else: + output = ExpandVariables(output, phase, variables, build_file) + + # Convert all strings that are canonically-represented integers into integers. + if isinstance(output, list): + for index in xrange(0, len(output)): + if IsStrCanonicalInt(output[index]): + output[index] = int(output[index]) + elif IsStrCanonicalInt(output): + output = int(output) + + return output + + +def ProcessConditionsInDict(the_dict, phase, variables, build_file): + # Process a 'conditions' or 'target_conditions' section in the_dict, + # depending on phase. + # early -> conditions + # late -> target_conditions + # latelate -> no conditions + # + # Each item in a conditions list consists of cond_expr, a string expression + # evaluated as the condition, and true_dict, a dict that will be merged into + # the_dict if cond_expr evaluates to true. Optionally, a third item, + # false_dict, may be present. false_dict is merged into the_dict if + # cond_expr evaluates to false. + # + # Any dict merged into the_dict will be recursively processed for nested + # conditionals and other expansions, also according to phase, immediately + # prior to being merged. + + if phase == PHASE_EARLY: + conditions_key = 'conditions' + elif phase == PHASE_LATE: + conditions_key = 'target_conditions' + elif phase == PHASE_LATELATE: + return + else: + assert False + + if not conditions_key in the_dict: + return + + conditions_list = the_dict[conditions_key] + # Unhook the conditions list, it's no longer needed. + del the_dict[conditions_key] + + for condition in conditions_list: + if not isinstance(condition, list): + raise TypeError, conditions_key + ' must be a list' + if len(condition) != 2 and len(condition) != 3: + # It's possible that condition[0] won't work in which case this + # attempt will raise its own IndexError. That's probably fine. + raise IndexError, conditions_key + ' ' + condition[0] + \ + ' must be length 2 or 3, not ' + str(len(condition)) + + [cond_expr, true_dict] = condition[0:2] + false_dict = None + if len(condition) == 3: + false_dict = condition[2] + + # Do expansions on the condition itself. Since the conditon can naturally + # contain variable references without needing to resort to GYP expansion + # syntax, this is of dubious value for variables, but someone might want to + # use a command expansion directly inside a condition. + cond_expr_expanded = ExpandVariables(cond_expr, phase, variables, + build_file) + if not isinstance(cond_expr_expanded, str) and \ + not isinstance(cond_expr_expanded, int): + raise ValueError, \ + 'Variable expansion in this context permits str and int ' + \ + 'only, found ' + expanded.__class__.__name__ + + try: + ast_code = compile(cond_expr_expanded, '', 'eval') + + if eval(ast_code, {'__builtins__': None}, variables): + merge_dict = true_dict + else: + merge_dict = false_dict + except SyntaxError, e: + syntax_error = SyntaxError('%s while evaluating condition \'%s\' in %s ' + 'at character %d.' % + (str(e.args[0]), e.text, build_file, e.offset), + e.filename, e.lineno, e.offset, e.text) + raise syntax_error + except NameError, e: + gyp.common.ExceptionAppend(e, 'while evaluating condition \'%s\' in %s' % + (cond_expr_expanded, build_file)) + raise + + if merge_dict != None: + # Expand variables and nested conditinals in the merge_dict before + # merging it. + ProcessVariablesAndConditionsInDict(merge_dict, phase, + variables, build_file) + + MergeDicts(the_dict, merge_dict, build_file, build_file) + + +def LoadAutomaticVariablesFromDict(variables, the_dict): + # Any keys with plain string values in the_dict become automatic variables. + # The variable name is the key name with a "_" character prepended. + for key, value in the_dict.iteritems(): + if isinstance(value, str) or isinstance(value, int) or \ + isinstance(value, list): + variables['_' + key] = value + + +def LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key): + # Any keys in the_dict's "variables" dict, if it has one, becomes a + # variable. The variable name is the key name in the "variables" dict. + # Variables that end with the % character are set only if they are unset in + # the variables dict. the_dict_key is the name of the key that accesses + # the_dict in the_dict's parent dict. If the_dict's parent is not a dict + # (it could be a list or it could be parentless because it is a root dict), + # the_dict_key will be None. + for key, value in the_dict.get('variables', {}).iteritems(): + if not isinstance(value, str) and not isinstance(value, int) and \ + not isinstance(value, list): + continue + + if key.endswith('%'): + variable_name = key[:-1] + if variable_name in variables: + # If the variable is already set, don't set it. + continue + if the_dict_key is 'variables' and variable_name in the_dict: + # If the variable is set without a % in the_dict, and the_dict is a + # variables dict (making |variables| a varaibles sub-dict of a + # variables dict), use the_dict's definition. + value = the_dict[variable_name] + else: + variable_name = key + + variables[variable_name] = value + + +def ProcessVariablesAndConditionsInDict(the_dict, phase, variables_in, + build_file, the_dict_key=None): + """Handle all variable and command expansion and conditional evaluation. + + This function is the public entry point for all variable expansions and + conditional evaluations. The variables_in dictionary will not be modified + by this function. + """ + + # Make a copy of the variables_in dict that can be modified during the + # loading of automatics and the loading of the variables dict. + variables = variables_in.copy() + LoadAutomaticVariablesFromDict(variables, the_dict) + + if 'variables' in the_dict: + # Make sure all the local variables are added to the variables + # list before we process them so that you can reference one + # variable from another. They will be fully expanded by recursion + # in ExpandVariables. + for key, value in the_dict['variables'].iteritems(): + variables[key] = value + + # Handle the associated variables dict first, so that any variable + # references within can be resolved prior to using them as variables. + # Pass a copy of the variables dict to avoid having it be tainted. + # Otherwise, it would have extra automatics added for everything that + # should just be an ordinary variable in this scope. + ProcessVariablesAndConditionsInDict(the_dict['variables'], phase, + variables, build_file, 'variables') + + LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key) + + for key, value in the_dict.iteritems(): + # Skip "variables", which was already processed if present. + if key != 'variables' and isinstance(value, str): + expanded = ExpandVariables(value, phase, variables, build_file) + if not isinstance(expanded, str) and not isinstance(expanded, int): + raise ValueError, \ + 'Variable expansion in this context permits str and int ' + \ + 'only, found ' + expanded.__class__.__name__ + ' for ' + key + the_dict[key] = expanded + + # Variable expansion may have resulted in changes to automatics. Reload. + # TODO(mark): Optimization: only reload if no changes were made. + variables = variables_in.copy() + LoadAutomaticVariablesFromDict(variables, the_dict) + LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key) + + # Process conditions in this dict. This is done after variable expansion + # so that conditions may take advantage of expanded variables. For example, + # if the_dict contains: + # {'type': '<(library_type)', + # 'conditions': [['_type=="static_library"', { ... }]]}, + # _type, as used in the condition, will only be set to the value of + # library_type if variable expansion is performed before condition + # processing. However, condition processing should occur prior to recursion + # so that variables (both automatic and "variables" dict type) may be + # adjusted by conditions sections, merged into the_dict, and have the + # intended impact on contained dicts. + # + # This arrangement means that a "conditions" section containing a "variables" + # section will only have those variables effective in subdicts, not in + # the_dict. The workaround is to put a "conditions" section within a + # "variables" section. For example: + # {'conditions': [['os=="mac"', {'variables': {'define': 'IS_MAC'}}]], + # 'defines': ['<(define)'], + # 'my_subdict': {'defines': ['<(define)']}}, + # will not result in "IS_MAC" being appended to the "defines" list in the + # current scope but would result in it being appended to the "defines" list + # within "my_subdict". By comparison: + # {'variables': {'conditions': [['os=="mac"', {'define': 'IS_MAC'}]]}, + # 'defines': ['<(define)'], + # 'my_subdict': {'defines': ['<(define)']}}, + # will append "IS_MAC" to both "defines" lists. + + # Evaluate conditions sections, allowing variable expansions within them + # as well as nested conditionals. This will process a 'conditions' or + # 'target_conditions' section, perform appropriate merging and recursive + # conditional and variable processing, and then remove the conditions section + # from the_dict if it is present. + ProcessConditionsInDict(the_dict, phase, variables, build_file) + + # Conditional processing may have resulted in changes to automatics or the + # variables dict. Reload. + variables = variables_in.copy() + LoadAutomaticVariablesFromDict(variables, the_dict) + LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key) + + # Recurse into child dicts, or process child lists which may result in + # further recursion into descendant dicts. + for key, value in the_dict.iteritems(): + # Skip "variables" and string values, which were already processed if + # present. + if key == 'variables' or isinstance(value, str): + continue + if isinstance(value, dict): + # Pass a copy of the variables dict so that subdicts can't influence + # parents. + ProcessVariablesAndConditionsInDict(value, phase, variables, + build_file, key) + elif isinstance(value, list): + # The list itself can't influence the variables dict, and + # ProcessVariablesAndConditionsInList will make copies of the variables + # dict if it needs to pass it to something that can influence it. No + # copy is necessary here. + ProcessVariablesAndConditionsInList(value, phase, variables, + build_file) + elif not isinstance(value, int): + raise TypeError, 'Unknown type ' + value.__class__.__name__ + \ + ' for ' + key + + +def ProcessVariablesAndConditionsInList(the_list, phase, variables, + build_file): + # Iterate using an index so that new values can be assigned into the_list. + index = 0 + while index < len(the_list): + item = the_list[index] + if isinstance(item, dict): + # Make a copy of the variables dict so that it won't influence anything + # outside of its own scope. + ProcessVariablesAndConditionsInDict(item, phase, variables, build_file) + elif isinstance(item, list): + ProcessVariablesAndConditionsInList(item, phase, variables, build_file) + elif isinstance(item, str): + expanded = ExpandVariables(item, phase, variables, build_file) + if isinstance(expanded, str) or isinstance(expanded, int): + the_list[index] = expanded + elif isinstance(expanded, list): + the_list[index:index+1] = expanded + index += len(expanded) + + # index now identifies the next item to examine. Continue right now + # without falling into the index increment below. + continue + else: + raise ValueError, \ + 'Variable expansion in this context permits strings and ' + \ + 'lists only, found ' + expanded.__class__.__name__ + ' at ' + \ + index + elif not isinstance(item, int): + raise TypeError, 'Unknown type ' + item.__class__.__name__ + \ + ' at index ' + index + index = index + 1 + + +def BuildTargetsDict(data): + """Builds a dict mapping fully-qualified target names to their target dicts. + + |data| is a dict mapping loaded build files by pathname relative to the + current directory. Values in |data| are build file contents. For each + |data| value with a "targets" key, the value of the "targets" key is taken + as a list containing target dicts. Each target's fully-qualified name is + constructed from the pathname of the build file (|data| key) and its + "target_name" property. These fully-qualified names are used as the keys + in the returned dict. These keys provide access to the target dicts, + the dicts in the "targets" lists. + """ + + targets = {} + for build_file in data['target_build_files']: + for target in data[build_file].get('targets', []): + target_name = gyp.common.QualifiedTarget(build_file, + target['target_name'], + target['toolset']) + if target_name in targets: + raise KeyError, 'Duplicate target definitions for ' + target_name + targets[target_name] = target + + return targets + + +def QualifyDependencies(targets): + """Make dependency links fully-qualified relative to the current directory. + + |targets| is a dict mapping fully-qualified target names to their target + dicts. For each target in this dict, keys known to contain dependency + links are examined, and any dependencies referenced will be rewritten + so that they are fully-qualified and relative to the current directory. + All rewritten dependencies are suitable for use as keys to |targets| or a + similar dict. + """ + + all_dependency_sections = [dep + op + for dep in dependency_sections + for op in ('', '!', '/')] + + for target, target_dict in targets.iteritems(): + target_build_file = gyp.common.BuildFile(target) + toolset = target_dict['toolset'] + for dependency_key in all_dependency_sections: + dependencies = target_dict.get(dependency_key, []) + for index in xrange(0, len(dependencies)): + dep_file, dep_target, dep_toolset = gyp.common.ResolveTarget( + target_build_file, dependencies[index], toolset) + if not multiple_toolsets: + # Ignore toolset specification in the dependency if it is specified. + dep_toolset = toolset + dependency = gyp.common.QualifiedTarget(dep_file, + dep_target, + dep_toolset) + dependencies[index] = dependency + + # Make sure anything appearing in a list other than "dependencies" also + # appears in the "dependencies" list. + if dependency_key != 'dependencies' and \ + dependency not in target_dict['dependencies']: + raise KeyError, 'Found ' + dependency + ' in ' + dependency_key + \ + ' of ' + target + ', but not in dependencies' + + +def ExpandWildcardDependencies(targets, data): + """Expands dependencies specified as build_file:*. + + For each target in |targets|, examines sections containing links to other + targets. If any such section contains a link of the form build_file:*, it + is taken as a wildcard link, and is expanded to list each target in + build_file. The |data| dict provides access to build file dicts. + + Any target that does not wish to be included by wildcard can provide an + optional "suppress_wildcard" key in its target dict. When present and + true, a wildcard dependency link will not include such targets. + + All dependency names, including the keys to |targets| and the values in each + dependency list, must be qualified when this function is called. + """ + + for target, target_dict in targets.iteritems(): + toolset = target_dict['toolset'] + target_build_file = gyp.common.BuildFile(target) + for dependency_key in dependency_sections: + dependencies = target_dict.get(dependency_key, []) + + # Loop this way instead of "for dependency in" or "for index in xrange" + # because the dependencies list will be modified within the loop body. + index = 0 + while index < len(dependencies): + (dependency_build_file, dependency_target, dependency_toolset) = \ + gyp.common.ParseQualifiedTarget(dependencies[index]) + if dependency_target != '*' and dependency_toolset != '*': + # Not a wildcard. Keep it moving. + index = index + 1 + continue + + if dependency_build_file == target_build_file: + # It's an error for a target to depend on all other targets in + # the same file, because a target cannot depend on itself. + raise KeyError, 'Found wildcard in ' + dependency_key + ' of ' + \ + target + ' referring to same build file' + + # Take the wildcard out and adjust the index so that the next + # dependency in the list will be processed the next time through the + # loop. + del dependencies[index] + index = index - 1 + + # Loop through the targets in the other build file, adding them to + # this target's list of dependencies in place of the removed + # wildcard. + dependency_target_dicts = data[dependency_build_file]['targets'] + for dependency_target_dict in dependency_target_dicts: + if int(dependency_target_dict.get('suppress_wildcard', False)): + continue + dependency_target_name = dependency_target_dict['target_name'] + if (dependency_target != '*' and + dependency_target != dependency_target_name): + continue + dependency_target_toolset = dependency_target_dict['toolset'] + if (dependency_toolset != '*' and + dependency_toolset != dependency_target_toolset): + continue + dependency = gyp.common.QualifiedTarget(dependency_build_file, + dependency_target_name, + dependency_target_toolset) + index = index + 1 + dependencies.insert(index, dependency) + + index = index + 1 + + +def Unify(l): + """Removes duplicate elements from l, keeping the first element.""" + seen = {} + return [seen.setdefault(e, e) for e in l if e not in seen] + + +def RemoveDuplicateDependencies(targets): + """Makes sure every dependency appears only once in all targets's dependency + lists.""" + for target_name, target_dict in targets.iteritems(): + for dependency_key in dependency_sections: + dependencies = target_dict.get(dependency_key, []) + if dependencies: + target_dict[dependency_key] = Unify(dependencies) + + +class DependencyGraphNode(object): + """ + + Attributes: + ref: A reference to an object that this DependencyGraphNode represents. + dependencies: List of DependencyGraphNodes on which this one depends. + dependents: List of DependencyGraphNodes that depend on this one. + """ + + class CircularException(Exception): + pass + + def __init__(self, ref): + self.ref = ref + self.dependencies = [] + self.dependents = [] + + def FlattenToList(self): + # flat_list is the sorted list of dependencies - actually, the list items + # are the "ref" attributes of DependencyGraphNodes. Every target will + # appear in flat_list after all of its dependencies, and before all of its + # dependents. + flat_list = [] + + # in_degree_zeros is the list of DependencyGraphNodes that have no + # dependencies not in flat_list. Initially, it is a copy of the children + # of this node, because when the graph was built, nodes with no + # dependencies were made implicit dependents of the root node. + in_degree_zeros = set(self.dependents[:]) + + while in_degree_zeros: + # Nodes in in_degree_zeros have no dependencies not in flat_list, so they + # can be appended to flat_list. Take these nodes out of in_degree_zeros + # as work progresses, so that the next node to process from the list can + # always be accessed at a consistent position. + node = in_degree_zeros.pop() + flat_list.append(node.ref) + + # Look at dependents of the node just added to flat_list. Some of them + # may now belong in in_degree_zeros. + for node_dependent in node.dependents: + is_in_degree_zero = True + for node_dependent_dependency in node_dependent.dependencies: + if not node_dependent_dependency.ref in flat_list: + # The dependent one or more dependencies not in flat_list. There + # will be more chances to add it to flat_list when examining + # it again as a dependent of those other dependencies, provided + # that there are no cycles. + is_in_degree_zero = False + break + + if is_in_degree_zero: + # All of the dependent's dependencies are already in flat_list. Add + # it to in_degree_zeros where it will be processed in a future + # iteration of the outer loop. + in_degree_zeros.add(node_dependent) + + return flat_list + + def DirectDependencies(self, dependencies=None): + """Returns a list of just direct dependencies.""" + if dependencies == None: + dependencies = [] + + for dependency in self.dependencies: + # Check for None, corresponding to the root node. + if dependency.ref != None and dependency.ref not in dependencies: + dependencies.append(dependency.ref) + + return dependencies + + def _AddImportedDependencies(self, targets, dependencies=None): + """Given a list of direct dependencies, adds indirect dependencies that + other dependencies have declared to export their settings. + + This method does not operate on self. Rather, it operates on the list + of dependencies in the |dependencies| argument. For each dependency in + that list, if any declares that it exports the settings of one of its + own dependencies, those dependencies whose settings are "passed through" + are added to the list. As new items are added to the list, they too will + be processed, so it is possible to import settings through multiple levels + of dependencies. + + This method is not terribly useful on its own, it depends on being + "primed" with a list of direct dependencies such as one provided by + DirectDependencies. DirectAndImportedDependencies is intended to be the + public entry point. + """ + + if dependencies == None: + dependencies = [] + + index = 0 + while index < len(dependencies): + dependency = dependencies[index] + dependency_dict = targets[dependency] + # Add any dependencies whose settings should be imported to the list + # if not already present. Newly-added items will be checked for + # their own imports when the list iteration reaches them. + # Rather than simply appending new items, insert them after the + # dependency that exported them. This is done to more closely match + # the depth-first method used by DeepDependencies. + add_index = 1 + for imported_dependency in \ + dependency_dict.get('export_dependent_settings', []): + if imported_dependency not in dependencies: + dependencies.insert(index + add_index, imported_dependency) + add_index = add_index + 1 + index = index + 1 + + return dependencies + + def DirectAndImportedDependencies(self, targets, dependencies=None): + """Returns a list of a target's direct dependencies and all indirect + dependencies that a dependency has advertised settings should be exported + through the dependency for. + """ + + dependencies = self.DirectDependencies(dependencies) + return self._AddImportedDependencies(targets, dependencies) + + def DeepDependencies(self, dependencies=None): + """Returns a list of all of a target's dependencies, recursively.""" + if dependencies == None: + dependencies = [] + + for dependency in self.dependencies: + # Check for None, corresponding to the root node. + if dependency.ref != None and dependency.ref not in dependencies: + dependencies.append(dependency.ref) + dependency.DeepDependencies(dependencies) + + return dependencies + + def LinkDependencies(self, targets, dependencies=None, initial=True): + """Returns a list of dependency targets that are linked into this target. + + This function has a split personality, depending on the setting of + |initial|. Outside callers should always leave |initial| at its default + setting. + + When adding a target to the list of dependencies, this function will + recurse into itself with |initial| set to False, to collect dependencies + that are linked into the linkable target for which the list is being built. + """ + if dependencies == None: + dependencies = [] + + # Check for None, corresponding to the root node. + if self.ref == None: + return dependencies + + # It's kind of sucky that |targets| has to be passed into this function, + # but that's presently the easiest way to access the target dicts so that + # this function can find target types. + + if not 'target_name' in targets[self.ref]: + raise Exception("Missing 'target_name' field in target.") + + try: + target_type = targets[self.ref]['type'] + except KeyError, e: + raise Exception("Missing 'type' field in target %s" % + targets[self.ref]['target_name']) + + is_linkable = target_type in linkable_types + + if initial and not is_linkable: + # If this is the first target being examined and it's not linkable, + # return an empty list of link dependencies, because the link + # dependencies are intended to apply to the target itself (initial is + # True) and this target won't be linked. + return dependencies + + # Don't traverse 'none' targets if explicitly excluded. + if (target_type == 'none' and + not targets[self.ref].get('dependencies_traverse', True)): + if self.ref not in dependencies: + dependencies.append(self.ref) + return dependencies + + # Executables and loadable modules are already fully and finally linked. + # Nothing else can be a link dependency of them, there can only be + # dependencies in the sense that a dependent target might run an + # executable or load the loadable_module. + if not initial and target_type in ('executable', 'loadable_module'): + return dependencies + + # The target is linkable, add it to the list of link dependencies. + if self.ref not in dependencies: + dependencies.append(self.ref) + if initial or not is_linkable: + # If this is a subsequent target and it's linkable, don't look any + # further for linkable dependencies, as they'll already be linked into + # this target linkable. Always look at dependencies of the initial + # target, and always look at dependencies of non-linkables. + for dependency in self.dependencies: + dependency.LinkDependencies(targets, dependencies, False) + + return dependencies + + +def BuildDependencyList(targets): + # Create a DependencyGraphNode for each target. Put it into a dict for easy + # access. + dependency_nodes = {} + for target, spec in targets.iteritems(): + if not target in dependency_nodes: + dependency_nodes[target] = DependencyGraphNode(target) + + # Set up the dependency links. Targets that have no dependencies are treated + # as dependent on root_node. + root_node = DependencyGraphNode(None) + for target, spec in targets.iteritems(): + target_node = dependency_nodes[target] + target_build_file = gyp.common.BuildFile(target) + if not 'dependencies' in spec or len(spec['dependencies']) == 0: + target_node.dependencies = [root_node] + root_node.dependents.append(target_node) + else: + dependencies = spec['dependencies'] + for index in xrange(0, len(dependencies)): + try: + dependency = dependencies[index] + dependency_node = dependency_nodes[dependency] + target_node.dependencies.append(dependency_node) + dependency_node.dependents.append(target_node) + except KeyError, e: + gyp.common.ExceptionAppend(e, + 'while trying to load target %s' % target) + raise + + flat_list = root_node.FlattenToList() + + # If there's anything left unvisited, there must be a circular dependency + # (cycle). If you need to figure out what's wrong, look for elements of + # targets that are not in flat_list. + if len(flat_list) != len(targets): + raise DependencyGraphNode.CircularException, \ + 'Some targets not reachable, cycle in dependency graph detected: ' + \ + ' '.join(set(flat_list) ^ set(targets)) + + return [dependency_nodes, flat_list] + + +def VerifyNoGYPFileCircularDependencies(targets): + # Create a DependencyGraphNode for each gyp file containing a target. Put + # it into a dict for easy access. + dependency_nodes = {} + for target in targets.iterkeys(): + build_file = gyp.common.BuildFile(target) + if not build_file in dependency_nodes: + dependency_nodes[build_file] = DependencyGraphNode(build_file) + + # Set up the dependency links. + for target, spec in targets.iteritems(): + build_file = gyp.common.BuildFile(target) + build_file_node = dependency_nodes[build_file] + target_dependencies = spec.get('dependencies', []) + for dependency in target_dependencies: + try: + dependency_build_file = gyp.common.BuildFile(dependency) + if dependency_build_file == build_file: + # A .gyp file is allowed to refer back to itself. + continue + dependency_node = dependency_nodes[dependency_build_file] + if dependency_node not in build_file_node.dependencies: + build_file_node.dependencies.append(dependency_node) + dependency_node.dependents.append(build_file_node) + except KeyError, e: + gyp.common.ExceptionAppend( + e, 'while computing dependencies of .gyp file %s' % build_file) + raise + + # Files that have no dependencies are treated as dependent on root_node. + root_node = DependencyGraphNode(None) + for build_file_node in dependency_nodes.itervalues(): + if len(build_file_node.dependencies) == 0: + build_file_node.dependencies.append(root_node) + root_node.dependents.append(build_file_node) + + flat_list = root_node.FlattenToList() + + # If there's anything left unvisited, there must be a circular dependency + # (cycle). + if len(flat_list) != len(dependency_nodes): + bad_files = [] + for file in dependency_nodes.iterkeys(): + if not file in flat_list: + bad_files.append(file) + raise DependencyGraphNode.CircularException, \ + 'Some files not reachable, cycle in .gyp file dependency graph ' + \ + 'detected involving some or all of: ' + \ + ' '.join(bad_files) + + +def DoDependentSettings(key, flat_list, targets, dependency_nodes): + # key should be one of all_dependent_settings, direct_dependent_settings, + # or link_settings. + + for target in flat_list: + target_dict = targets[target] + build_file = gyp.common.BuildFile(target) + + if key == 'all_dependent_settings': + dependencies = dependency_nodes[target].DeepDependencies() + elif key == 'direct_dependent_settings': + dependencies = \ + dependency_nodes[target].DirectAndImportedDependencies(targets) + elif key == 'link_settings': + dependencies = dependency_nodes[target].LinkDependencies(targets) + else: + raise KeyError, "DoDependentSettings doesn't know how to determine " + \ + 'dependencies for ' + key + + for dependency in dependencies: + dependency_dict = targets[dependency] + if not key in dependency_dict: + continue + dependency_build_file = gyp.common.BuildFile(dependency) + MergeDicts(target_dict, dependency_dict[key], + build_file, dependency_build_file) + + +def AdjustStaticLibraryDependencies(flat_list, targets, dependency_nodes, + sort_dependencies): + # Recompute target "dependencies" properties. For each static library + # target, remove "dependencies" entries referring to other static libraries, + # unless the dependency has the "hard_dependency" attribute set. For each + # linkable target, add a "dependencies" entry referring to all of the + # target's computed list of link dependencies (including static libraries + # if no such entry is already present. + for target in flat_list: + target_dict = targets[target] + target_type = target_dict['type'] + + if target_type == 'static_library': + if not 'dependencies' in target_dict: + continue + + target_dict['dependencies_original'] = target_dict.get( + 'dependencies', [])[:] + + # A static library should not depend on another static library unless + # the dependency relationship is "hard," which should only be done when + # a dependent relies on some side effect other than just the build + # product, like a rule or action output. Further, if a target has a + # non-hard dependency, but that dependency exports a hard dependency, + # the non-hard dependency can safely be removed, but the exported hard + # dependency must be added to the target to keep the same dependency + # ordering. + dependencies = \ + dependency_nodes[target].DirectAndImportedDependencies(targets) + index = 0 + while index < len(dependencies): + dependency = dependencies[index] + dependency_dict = targets[dependency] + + # Remove every non-hard static library dependency and remove every + # non-static library dependency that isn't a direct dependency. + if (dependency_dict['type'] == 'static_library' and \ + not dependency_dict.get('hard_dependency', False)) or \ + (dependency_dict['type'] != 'static_library' and \ + not dependency in target_dict['dependencies']): + # Take the dependency out of the list, and don't increment index + # because the next dependency to analyze will shift into the index + # formerly occupied by the one being removed. + del dependencies[index] + else: + index = index + 1 + + # Update the dependencies. If the dependencies list is empty, it's not + # needed, so unhook it. + if len(dependencies) > 0: + target_dict['dependencies'] = dependencies + else: + del target_dict['dependencies'] + + elif target_type in linkable_types: + # Get a list of dependency targets that should be linked into this + # target. Add them to the dependencies list if they're not already + # present. + + link_dependencies = dependency_nodes[target].LinkDependencies(targets) + for dependency in link_dependencies: + if dependency == target: + continue + if not 'dependencies' in target_dict: + target_dict['dependencies'] = [] + if not dependency in target_dict['dependencies']: + target_dict['dependencies'].append(dependency) + # Sort the dependencies list in the order from dependents to dependencies. + # e.g. If A and B depend on C and C depends on D, sort them in A, B, C, D. + # Note: flat_list is already sorted in the order from dependencies to + # dependents. + if sort_dependencies and 'dependencies' in target_dict: + target_dict['dependencies'] = [dep for dep in reversed(flat_list) + if dep in target_dict['dependencies']] + + +# Initialize this here to speed up MakePathRelative. +exception_re = re.compile(r'''["']?[-/$<>^]''') + + +def MakePathRelative(to_file, fro_file, item): + # If item is a relative path, it's relative to the build file dict that it's + # coming from. Fix it up to make it relative to the build file dict that + # it's going into. + # Exception: any |item| that begins with these special characters is + # returned without modification. + # / Used when a path is already absolute (shortcut optimization; + # such paths would be returned as absolute anyway) + # $ Used for build environment variables + # - Used for some build environment flags (such as -lapr-1 in a + # "libraries" section) + # < Used for our own variable and command expansions (see ExpandVariables) + # > Used for our own variable and command expansions (see ExpandVariables) + # ^ Used for our own variable and command expansions (see ExpandVariables) + # + # "/' Used when a value is quoted. If these are present, then we + # check the second character instead. + # + if to_file == fro_file or exception_re.match(item): + return item + else: + # TODO(dglazkov) The backslash/forward-slash replacement at the end is a + # temporary measure. This should really be addressed by keeping all paths + # in POSIX until actual project generation. + ret = os.path.normpath(os.path.join( + gyp.common.RelativePath(os.path.dirname(fro_file), + os.path.dirname(to_file)), + item)).replace('\\', '/') + if item[-1] == '/': + ret += '/' + return ret + +def MergeLists(to, fro, to_file, fro_file, is_paths=False, append=True): + def is_hashable(x): + try: + hash(x) + except TypeError: + return False + return True + # If x is hashable, returns whether x is in s. Else returns whether x is in l. + def is_in_set_or_list(x, s, l): + if is_hashable(x): + return x in s + return x in l + + prepend_index = 0 + + # Make membership testing of hashables in |to| (in particular, strings) + # faster. + hashable_to_set = set([x for x in to if is_hashable(x)]) + + for item in fro: + singleton = False + if isinstance(item, str) or isinstance(item, int): + # The cheap and easy case. + if is_paths: + to_item = MakePathRelative(to_file, fro_file, item) + else: + to_item = item + + if not isinstance(item, str) or not item.startswith('-'): + # Any string that doesn't begin with a "-" is a singleton - it can + # only appear once in a list, to be enforced by the list merge append + # or prepend. + singleton = True + elif isinstance(item, dict): + # Make a copy of the dictionary, continuing to look for paths to fix. + # The other intelligent aspects of merge processing won't apply because + # item is being merged into an empty dict. + to_item = {} + MergeDicts(to_item, item, to_file, fro_file) + elif isinstance(item, list): + # Recurse, making a copy of the list. If the list contains any + # descendant dicts, path fixing will occur. Note that here, custom + # values for is_paths and append are dropped; those are only to be + # applied to |to| and |fro|, not sublists of |fro|. append shouldn't + # matter anyway because the new |to_item| list is empty. + to_item = [] + MergeLists(to_item, item, to_file, fro_file) + else: + raise TypeError, \ + 'Attempt to merge list item of unsupported type ' + \ + item.__class__.__name__ + + if append: + # If appending a singleton that's already in the list, don't append. + # This ensures that the earliest occurrence of the item will stay put. + if not singleton or not is_in_set_or_list(to_item, hashable_to_set, to): + to.append(to_item) + if is_hashable(to_item): + hashable_to_set.add(to_item) + else: + # If prepending a singleton that's already in the list, remove the + # existing instance and proceed with the prepend. This ensures that the + # item appears at the earliest possible position in the list. + while singleton and to_item in to: + to.remove(to_item) + + # Don't just insert everything at index 0. That would prepend the new + # items to the list in reverse order, which would be an unwelcome + # surprise. + to.insert(prepend_index, to_item) + if is_hashable(to_item): + hashable_to_set.add(to_item) + prepend_index = prepend_index + 1 + + +def MergeDicts(to, fro, to_file, fro_file): + # I wanted to name the parameter "from" but it's a Python keyword... + for k, v in fro.iteritems(): + # It would be nice to do "if not k in to: to[k] = v" but that wouldn't give + # copy semantics. Something else may want to merge from the |fro| dict + # later, and having the same dict ref pointed to twice in the tree isn't + # what anyone wants considering that the dicts may subsequently be + # modified. + if k in to: + bad_merge = False + if isinstance(v, str) or isinstance(v, int): + if not (isinstance(to[k], str) or isinstance(to[k], int)): + bad_merge = True + elif v.__class__ != to[k].__class__: + bad_merge = True + + if bad_merge: + raise TypeError, \ + 'Attempt to merge dict value of type ' + v.__class__.__name__ + \ + ' into incompatible type ' + to[k].__class__.__name__ + \ + ' for key ' + k + if isinstance(v, str) or isinstance(v, int): + # Overwrite the existing value, if any. Cheap and easy. + is_path = IsPathSection(k) + if is_path: + to[k] = MakePathRelative(to_file, fro_file, v) + else: + to[k] = v + elif isinstance(v, dict): + # Recurse, guaranteeing copies will be made of objects that require it. + if not k in to: + to[k] = {} + MergeDicts(to[k], v, to_file, fro_file) + elif isinstance(v, list): + # Lists in dicts can be merged with different policies, depending on + # how the key in the "from" dict (k, the from-key) is written. + # + # If the from-key has ...the to-list will have this action + # this character appended:... applied when receiving the from-list: + # = replace + # + prepend + # ? set, only if to-list does not yet exist + # (none) append + # + # This logic is list-specific, but since it relies on the associated + # dict key, it's checked in this dict-oriented function. + ext = k[-1] + append = True + if ext == '=': + list_base = k[:-1] + lists_incompatible = [list_base, list_base + '?'] + to[list_base] = [] + elif ext == '+': + list_base = k[:-1] + lists_incompatible = [list_base + '=', list_base + '?'] + append = False + elif ext == '?': + list_base = k[:-1] + lists_incompatible = [list_base, list_base + '=', list_base + '+'] + else: + list_base = k + lists_incompatible = [list_base + '=', list_base + '?'] + + # Some combinations of merge policies appearing together are meaningless. + # It's stupid to replace and append simultaneously, for example. Append + # and prepend are the only policies that can coexist. + for list_incompatible in lists_incompatible: + if list_incompatible in fro: + raise KeyError, 'Incompatible list policies ' + k + ' and ' + \ + list_incompatible + + if list_base in to: + if ext == '?': + # If the key ends in "?", the list will only be merged if it doesn't + # already exist. + continue + if not isinstance(to[list_base], list): + # This may not have been checked above if merging in a list with an + # extension character. + raise TypeError, \ + 'Attempt to merge dict value of type ' + v.__class__.__name__ + \ + ' into incompatible type ' + to[list_base].__class__.__name__ + \ + ' for key ' + list_base + '(' + k + ')' + else: + to[list_base] = [] + + # Call MergeLists, which will make copies of objects that require it. + # MergeLists can recurse back into MergeDicts, although this will be + # to make copies of dicts (with paths fixed), there will be no + # subsequent dict "merging" once entering a list because lists are + # always replaced, appended to, or prepended to. + is_paths = IsPathSection(list_base) + MergeLists(to[list_base], v, to_file, fro_file, is_paths, append) + else: + raise TypeError, \ + 'Attempt to merge dict value of unsupported type ' + \ + v.__class__.__name__ + ' for key ' + k + + +def MergeConfigWithInheritance(new_configuration_dict, build_file, + target_dict, configuration, visited): + # Skip if previously visted. + if configuration in visited: + return + + # Look at this configuration. + configuration_dict = target_dict['configurations'][configuration] + + # Merge in parents. + for parent in configuration_dict.get('inherit_from', []): + MergeConfigWithInheritance(new_configuration_dict, build_file, + target_dict, parent, visited + [configuration]) + + # Merge it into the new config. + MergeDicts(new_configuration_dict, configuration_dict, + build_file, build_file) + + # Drop abstract. + if 'abstract' in new_configuration_dict: + del new_configuration_dict['abstract'] + + +def SetUpConfigurations(target, target_dict): + # key_suffixes is a list of key suffixes that might appear on key names. + # These suffixes are handled in conditional evaluations (for =, +, and ?) + # and rules/exclude processing (for ! and /). Keys with these suffixes + # should be treated the same as keys without. + key_suffixes = ['=', '+', '?', '!', '/'] + + build_file = gyp.common.BuildFile(target) + + # Provide a single configuration by default if none exists. + # TODO(mark): Signal an error if default_configurations exists but + # configurations does not. + if not 'configurations' in target_dict: + target_dict['configurations'] = {'Default': {}} + if not 'default_configuration' in target_dict: + concrete = [i for i in target_dict['configurations'].keys() + if not target_dict['configurations'][i].get('abstract')] + target_dict['default_configuration'] = sorted(concrete)[0] + + for configuration in target_dict['configurations'].keys(): + old_configuration_dict = target_dict['configurations'][configuration] + # Skip abstract configurations (saves work only). + if old_configuration_dict.get('abstract'): + continue + # Configurations inherit (most) settings from the enclosing target scope. + # Get the inheritance relationship right by making a copy of the target + # dict. + new_configuration_dict = copy.deepcopy(target_dict) + + # Take out the bits that don't belong in a "configurations" section. + # Since configuration setup is done before conditional, exclude, and rules + # processing, be careful with handling of the suffix characters used in + # those phases. + delete_keys = [] + for key in new_configuration_dict: + key_ext = key[-1:] + if key_ext in key_suffixes: + key_base = key[:-1] + else: + key_base = key + if key_base in non_configuration_keys: + delete_keys.append(key) + + for key in delete_keys: + del new_configuration_dict[key] + + # Merge in configuration (with all its parents first). + MergeConfigWithInheritance(new_configuration_dict, build_file, + target_dict, configuration, []) + + # Put the new result back into the target dict as a configuration. + target_dict['configurations'][configuration] = new_configuration_dict + + # Now drop all the abstract ones. + for configuration in target_dict['configurations'].keys(): + old_configuration_dict = target_dict['configurations'][configuration] + if old_configuration_dict.get('abstract'): + del target_dict['configurations'][configuration] + + # Now that all of the target's configurations have been built, go through + # the target dict's keys and remove everything that's been moved into a + # "configurations" section. + delete_keys = [] + for key in target_dict: + key_ext = key[-1:] + if key_ext in key_suffixes: + key_base = key[:-1] + else: + key_base = key + if not key_base in non_configuration_keys: + delete_keys.append(key) + for key in delete_keys: + del target_dict[key] + + # Check the configurations to see if they contain invalid keys. + for configuration in target_dict['configurations'].keys(): + configuration_dict = target_dict['configurations'][configuration] + for key in configuration_dict.keys(): + if key in invalid_configuration_keys: + raise KeyError, ('%s not allowed in the %s configuration, found in ' + 'target %s' % (key, configuration, target)) + + + +def ProcessListFiltersInDict(name, the_dict): + """Process regular expression and exclusion-based filters on lists. + + An exclusion list is in a dict key named with a trailing "!", like + "sources!". Every item in such a list is removed from the associated + main list, which in this example, would be "sources". Removed items are + placed into a "sources_excluded" list in the dict. + + Regular expression (regex) filters are contained in dict keys named with a + trailing "/", such as "sources/" to operate on the "sources" list. Regex + filters in a dict take the form: + 'sources/': [ ['exclude', '_(linux|mac|win)\\.cc$'], + ['include', '_mac\\.cc$'] ], + The first filter says to exclude all files ending in _linux.cc, _mac.cc, and + _win.cc. The second filter then includes all files ending in _mac.cc that + are now or were once in the "sources" list. Items matching an "exclude" + filter are subject to the same processing as would occur if they were listed + by name in an exclusion list (ending in "!"). Items matching an "include" + filter are brought back into the main list if previously excluded by an + exclusion list or exclusion regex filter. Subsequent matching "exclude" + patterns can still cause items to be excluded after matching an "include". + """ + + # Look through the dictionary for any lists whose keys end in "!" or "/". + # These are lists that will be treated as exclude lists and regular + # expression-based exclude/include lists. Collect the lists that are + # needed first, looking for the lists that they operate on, and assemble + # then into |lists|. This is done in a separate loop up front, because + # the _included and _excluded keys need to be added to the_dict, and that + # can't be done while iterating through it. + + lists = [] + del_lists = [] + for key, value in the_dict.iteritems(): + operation = key[-1] + if operation != '!' and operation != '/': + continue + + if not isinstance(value, list): + raise ValueError, name + ' key ' + key + ' must be list, not ' + \ + value.__class__.__name__ + + list_key = key[:-1] + if list_key not in the_dict: + # This happens when there's a list like "sources!" but no corresponding + # "sources" list. Since there's nothing for it to operate on, queue up + # the "sources!" list for deletion now. + del_lists.append(key) + continue + + if not isinstance(the_dict[list_key], list): + raise ValueError, name + ' key ' + list_key + \ + ' must be list, not ' + \ + value.__class__.__name__ + ' when applying ' + \ + {'!': 'exclusion', '/': 'regex'}[operation] + + if not list_key in lists: + lists.append(list_key) + + # Delete the lists that are known to be unneeded at this point. + for del_list in del_lists: + del the_dict[del_list] + + for list_key in lists: + the_list = the_dict[list_key] + + # Initialize the list_actions list, which is parallel to the_list. Each + # item in list_actions identifies whether the corresponding item in + # the_list should be excluded, unconditionally preserved (included), or + # whether no exclusion or inclusion has been applied. Items for which + # no exclusion or inclusion has been applied (yet) have value -1, items + # excluded have value 0, and items included have value 1. Includes and + # excludes override previous actions. All items in list_actions are + # initialized to -1 because no excludes or includes have been processed + # yet. + list_actions = list((-1,) * len(the_list)) + + exclude_key = list_key + '!' + if exclude_key in the_dict: + for exclude_item in the_dict[exclude_key]: + for index in xrange(0, len(the_list)): + if exclude_item == the_list[index]: + # This item matches the exclude_item, so set its action to 0 + # (exclude). + list_actions[index] = 0 + + # The "whatever!" list is no longer needed, dump it. + del the_dict[exclude_key] + + regex_key = list_key + '/' + if regex_key in the_dict: + for regex_item in the_dict[regex_key]: + [action, pattern] = regex_item + pattern_re = re.compile(pattern) + + if action == 'exclude': + # This item matches an exclude regex, so set its value to 0 (exclude). + action_value = 0 + elif action == 'include': + # This item matches an include regex, so set its value to 1 (include). + action_value = 1 + else: + # This is an action that doesn't make any sense. + raise ValueError, 'Unrecognized action ' + action + ' in ' + name + \ + ' key ' + regex_key + + for index in xrange(0, len(the_list)): + list_item = the_list[index] + if list_actions[index] == action_value: + # Even if the regex matches, nothing will change so continue (regex + # searches are expensive). + continue + if pattern_re.search(list_item): + # Regular expression match. + list_actions[index] = action_value + + # The "whatever/" list is no longer needed, dump it. + del the_dict[regex_key] + + # Add excluded items to the excluded list. + # + # Note that exclude_key ("sources!") is different from excluded_key + # ("sources_excluded"). The exclude_key list is input and it was already + # processed and deleted; the excluded_key list is output and it's about + # to be created. + excluded_key = list_key + '_excluded' + if excluded_key in the_dict: + raise KeyError, \ + name + ' key ' + excluded_key + ' must not be present prior ' + \ + ' to applying exclusion/regex filters for ' + list_key + + excluded_list = [] + + # Go backwards through the list_actions list so that as items are deleted, + # the indices of items that haven't been seen yet don't shift. That means + # that things need to be prepended to excluded_list to maintain them in the + # same order that they existed in the_list. + for index in xrange(len(list_actions) - 1, -1, -1): + if list_actions[index] == 0: + # Dump anything with action 0 (exclude). Keep anything with action 1 + # (include) or -1 (no include or exclude seen for the item). + excluded_list.insert(0, the_list[index]) + del the_list[index] + + # If anything was excluded, put the excluded list into the_dict at + # excluded_key. + if len(excluded_list) > 0: + the_dict[excluded_key] = excluded_list + + # Now recurse into subdicts and lists that may contain dicts. + for key, value in the_dict.iteritems(): + if isinstance(value, dict): + ProcessListFiltersInDict(key, value) + elif isinstance(value, list): + ProcessListFiltersInList(key, value) + + +def ProcessListFiltersInList(name, the_list): + for item in the_list: + if isinstance(item, dict): + ProcessListFiltersInDict(name, item) + elif isinstance(item, list): + ProcessListFiltersInList(name, item) + + +def ValidateTargetType(target, target_dict): + """Ensures the 'type' field on the target is one of the known types. + + Arguments: + target: string, name of target. + target_dict: dict, target spec. + + Raises an exception on error. + """ + VALID_TARGET_TYPES = ('executable', 'loadable_module', + 'static_library', 'shared_library', + 'none') + target_type = target_dict.get('type', None) + if target_type not in VALID_TARGET_TYPES: + raise Exception("Target %s has an invalid target type '%s'. " + "Must be one of %s." % + (target, target_type, '/'.join(VALID_TARGET_TYPES))) + + +def ValidateSourcesInTarget(target, target_dict, build_file): + # TODO: Check if MSVC allows this for non-static_library targets. + if target_dict.get('type', None) != 'static_library': + return + sources = target_dict.get('sources', []) + basenames = {} + for source in sources: + name, ext = os.path.splitext(source) + is_compiled_file = ext in [ + '.c', '.cc', '.cpp', '.cxx', '.m', '.mm', '.s', '.S'] + if not is_compiled_file: + continue + basename = os.path.basename(name) # Don't include extension. + basenames.setdefault(basename, []).append(source) + + error = '' + for basename, files in basenames.iteritems(): + if len(files) > 1: + error += ' %s: %s\n' % (basename, ' '.join(files)) + + if error: + print ('static library %s has several files with the same basename:\n' % + target + error + 'Some build systems, e.g. MSVC08, ' + 'cannot handle that.') + raise KeyError, 'Duplicate basenames in sources section, see list above' + + +def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules): + """Ensures that the rules sections in target_dict are valid and consistent, + and determines which sources they apply to. + + Arguments: + target: string, name of target. + target_dict: dict, target spec containing "rules" and "sources" lists. + extra_sources_for_rules: a list of keys to scan for rule matches in + addition to 'sources'. + """ + + # Dicts to map between values found in rules' 'rule_name' and 'extension' + # keys and the rule dicts themselves. + rule_names = {} + rule_extensions = {} + + rules = target_dict.get('rules', []) + for rule in rules: + # Make sure that there's no conflict among rule names and extensions. + rule_name = rule['rule_name'] + if rule_name in rule_names: + raise KeyError, 'rule %s exists in duplicate, target %s' % \ + (rule_name, target) + rule_names[rule_name] = rule + + rule_extension = rule['extension'] + if rule_extension in rule_extensions: + raise KeyError, ('extension %s associated with multiple rules, ' + + 'target %s rules %s and %s') % \ + (rule_extension, target, + rule_extensions[rule_extension]['rule_name'], + rule_name) + rule_extensions[rule_extension] = rule + + # Make sure rule_sources isn't already there. It's going to be + # created below if needed. + if 'rule_sources' in rule: + raise KeyError, \ + 'rule_sources must not exist in input, target %s rule %s' % \ + (target, rule_name) + extension = rule['extension'] + + rule_sources = [] + source_keys = ['sources'] + source_keys.extend(extra_sources_for_rules) + for source_key in source_keys: + for source in target_dict.get(source_key, []): + (source_root, source_extension) = os.path.splitext(source) + if source_extension.startswith('.'): + source_extension = source_extension[1:] + if source_extension == extension: + rule_sources.append(source) + + if len(rule_sources) > 0: + rule['rule_sources'] = rule_sources + + +def ValidateRunAsInTarget(target, target_dict, build_file): + target_name = target_dict.get('target_name') + run_as = target_dict.get('run_as') + if not run_as: + return + if not isinstance(run_as, dict): + raise Exception("The 'run_as' in target %s from file %s should be a " + "dictionary." % + (target_name, build_file)) + action = run_as.get('action') + if not action: + raise Exception("The 'run_as' in target %s from file %s must have an " + "'action' section." % + (target_name, build_file)) + if not isinstance(action, list): + raise Exception("The 'action' for 'run_as' in target %s from file %s " + "must be a list." % + (target_name, build_file)) + working_directory = run_as.get('working_directory') + if working_directory and not isinstance(working_directory, str): + raise Exception("The 'working_directory' for 'run_as' in target %s " + "in file %s should be a string." % + (target_name, build_file)) + environment = run_as.get('environment') + if environment and not isinstance(environment, dict): + raise Exception("The 'environment' for 'run_as' in target %s " + "in file %s should be a dictionary." % + (target_name, build_file)) + + +def ValidateActionsInTarget(target, target_dict, build_file): + '''Validates the inputs to the actions in a target.''' + target_name = target_dict.get('target_name') + actions = target_dict.get('actions', []) + for action in actions: + action_name = action.get('action_name') + if not action_name: + raise Exception("Anonymous action in target %s. " + "An action must have an 'action_name' field." % + target_name) + inputs = action.get('inputs', None) + if inputs is None: + raise Exception('Action in target %s has no inputs.' % target_name) + action_command = action.get('action') + if action_command and not action_command[0]: + raise Exception("Empty action as command in target %s." % target_name) + + +def TurnIntIntoStrInDict(the_dict): + """Given dict the_dict, recursively converts all integers into strings. + """ + # Use items instead of iteritems because there's no need to try to look at + # reinserted keys and their associated values. + for k, v in the_dict.items(): + if isinstance(v, int): + v = str(v) + the_dict[k] = v + elif isinstance(v, dict): + TurnIntIntoStrInDict(v) + elif isinstance(v, list): + TurnIntIntoStrInList(v) + + if isinstance(k, int): + the_dict[str(k)] = v + del the_dict[k] + + +def TurnIntIntoStrInList(the_list): + """Given list the_list, recursively converts all integers into strings. + """ + for index in xrange(0, len(the_list)): + item = the_list[index] + if isinstance(item, int): + the_list[index] = str(item) + elif isinstance(item, dict): + TurnIntIntoStrInDict(item) + elif isinstance(item, list): + TurnIntIntoStrInList(item) + + +def VerifyNoCollidingTargets(targets): + """Verify that no two targets in the same directory share the same name. + + Arguments: + targets: A list of targets in the form 'path/to/file.gyp:target_name'. + """ + # Keep a dict going from 'subdirectory:target_name' to 'foo.gyp'. + used = {} + for target in targets: + # Separate out 'path/to/file.gyp, 'target_name' from + # 'path/to/file.gyp:target_name'. + path, name = target.rsplit(':', 1) + # Separate out 'path/to', 'file.gyp' from 'path/to/file.gyp'. + subdir, gyp = os.path.split(path) + # Use '.' for the current directory '', so that the error messages make + # more sense. + if not subdir: + subdir = '.' + # Prepare a key like 'path/to:target_name'. + key = subdir + ':' + name + if key in used: + # Complain if this target is already used. + raise Exception('Duplicate target name "%s" in directory "%s" used both ' + 'in "%s" and "%s".' % (name, subdir, gyp, used[key])) + used[key] = gyp + + +def Load(build_files, variables, includes, depth, generator_input_info, check, + circular_check): + # Set up path_sections and non_configuration_keys with the default data plus + # the generator-specifc data. + global path_sections + path_sections = base_path_sections[:] + path_sections.extend(generator_input_info['path_sections']) + + global non_configuration_keys + non_configuration_keys = base_non_configuration_keys[:] + non_configuration_keys.extend(generator_input_info['non_configuration_keys']) + + # TODO(mark) handle variants if the generator doesn't want them directly. + generator_handles_variants = \ + generator_input_info['generator_handles_variants'] + + global absolute_build_file_paths + absolute_build_file_paths = \ + generator_input_info['generator_wants_absolute_build_file_paths'] + + global multiple_toolsets + multiple_toolsets = generator_input_info[ + 'generator_supports_multiple_toolsets'] + + # A generator can have other lists (in addition to sources) be processed + # for rules. + extra_sources_for_rules = generator_input_info['extra_sources_for_rules'] + + # Load build files. This loads every target-containing build file into + # the |data| dictionary such that the keys to |data| are build file names, + # and the values are the entire build file contents after "early" or "pre" + # processing has been done and includes have been resolved. + # NOTE: data contains both "target" files (.gyp) and "includes" (.gypi), as + # well as meta-data (e.g. 'included_files' key). 'target_build_files' keeps + # track of the keys corresponding to "target" files. + data = {'target_build_files': set()} + aux_data = {} + for build_file in build_files: + # Normalize paths everywhere. This is important because paths will be + # used as keys to the data dict and for references between input files. + build_file = os.path.normpath(build_file) + try: + LoadTargetBuildFile(build_file, data, aux_data, variables, includes, + depth, check) + except Exception, e: + gyp.common.ExceptionAppend(e, 'while trying to load %s' % build_file) + raise + + # Build a dict to access each target's subdict by qualified name. + targets = BuildTargetsDict(data) + + # Fully qualify all dependency links. + QualifyDependencies(targets) + + # Expand dependencies specified as build_file:*. + ExpandWildcardDependencies(targets, data) + + # Apply exclude (!) and regex (/) list filters only for dependency_sections. + for target_name, target_dict in targets.iteritems(): + tmp_dict = {} + for key_base in dependency_sections: + for op in ('', '!', '/'): + key = key_base + op + if key in target_dict: + tmp_dict[key] = target_dict[key] + del target_dict[key] + ProcessListFiltersInDict(target_name, tmp_dict) + # Write the results back to |target_dict|. + for key in tmp_dict: + target_dict[key] = tmp_dict[key] + + # Make sure every dependency appears at most once. + RemoveDuplicateDependencies(targets) + + if circular_check: + # Make sure that any targets in a.gyp don't contain dependencies in other + # .gyp files that further depend on a.gyp. + VerifyNoGYPFileCircularDependencies(targets) + + [dependency_nodes, flat_list] = BuildDependencyList(targets) + + # Check that no two targets in the same directory have the same name. + VerifyNoCollidingTargets(flat_list) + + # Handle dependent settings of various types. + for settings_type in ['all_dependent_settings', + 'direct_dependent_settings', + 'link_settings']: + DoDependentSettings(settings_type, flat_list, targets, dependency_nodes) + + # Take out the dependent settings now that they've been published to all + # of the targets that require them. + for target in flat_list: + if settings_type in targets[target]: + del targets[target][settings_type] + + # Make sure static libraries don't declare dependencies on other static + # libraries, but that linkables depend on all unlinked static libraries + # that they need so that their link steps will be correct. + gii = generator_input_info + if gii['generator_wants_static_library_dependencies_adjusted']: + AdjustStaticLibraryDependencies(flat_list, targets, dependency_nodes, + gii['generator_wants_sorted_dependencies']) + + # Apply "post"/"late"/"target" variable expansions and condition evaluations. + for target in flat_list: + target_dict = targets[target] + build_file = gyp.common.BuildFile(target) + ProcessVariablesAndConditionsInDict( + target_dict, PHASE_LATE, variables, build_file) + + # Move everything that can go into a "configurations" section into one. + for target in flat_list: + target_dict = targets[target] + SetUpConfigurations(target, target_dict) + + # Apply exclude (!) and regex (/) list filters. + for target in flat_list: + target_dict = targets[target] + ProcessListFiltersInDict(target, target_dict) + + # Apply "latelate" variable expansions and condition evaluations. + for target in flat_list: + target_dict = targets[target] + build_file = gyp.common.BuildFile(target) + ProcessVariablesAndConditionsInDict( + target_dict, PHASE_LATELATE, variables, build_file) + + # Make sure that the rules make sense, and build up rule_sources lists as + # needed. Not all generators will need to use the rule_sources lists, but + # some may, and it seems best to build the list in a common spot. + # Also validate actions and run_as elements in targets. + for target in flat_list: + target_dict = targets[target] + build_file = gyp.common.BuildFile(target) + ValidateTargetType(target, target_dict) + # TODO(thakis): Get vpx_scale/arm/scalesystemdependent.c to be renamed to + # scalesystemdependent_arm_additions.c or similar. + if 'arm' not in variables.get('target_arch', ''): + ValidateSourcesInTarget(target, target_dict, build_file) + ValidateRulesInTarget(target, target_dict, extra_sources_for_rules) + ValidateRunAsInTarget(target, target_dict, build_file) + ValidateActionsInTarget(target, target_dict, build_file) + + # Generators might not expect ints. Turn them into strs. + TurnIntIntoStrInDict(data) + + # TODO(mark): Return |data| for now because the generator needs a list of + # build files that came in. In the future, maybe it should just accept + # a list, and not the whole data dict. + return [flat_list, targets, data] diff --git a/tools/gyp/pylib/gyp/mac_tool.py b/tools/gyp/pylib/gyp/mac_tool.py new file mode 100755 index 000000000..b918c5826 --- /dev/null +++ b/tools/gyp/pylib/gyp/mac_tool.py @@ -0,0 +1,209 @@ +#!/usr/bin/env python +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Utility functions to perform Xcode-style build steps. + +These functions are executed via gyp-mac-tool when using the Makefile generator. +""" + +import fcntl +import os +import plistlib +import re +import shutil +import string +import subprocess +import sys + + +def main(args): + executor = MacTool() + exit_code = executor.Dispatch(args) + if exit_code is not None: + sys.exit(exit_code) + + +class MacTool(object): + """This class performs all the Mac tooling steps. The methods can either be + executed directly, or dispatched from an argument list.""" + + def Dispatch(self, args): + """Dispatches a string command to a method.""" + if len(args) < 1: + raise Exception("Not enough arguments") + + method = "Exec%s" % self._CommandifyName(args[0]) + return getattr(self, method)(*args[1:]) + + def _CommandifyName(self, name_string): + """Transforms a tool name like copy-info-plist to CopyInfoPlist""" + return name_string.title().replace('-', '') + + def ExecCopyBundleResource(self, source, dest): + """Copies a resource file to the bundle/Resources directory, performing any + necessary compilation on each resource.""" + extension = os.path.splitext(source)[1].lower() + if os.path.isdir(source): + # Copy tree. + if os.path.exists(dest): + shutil.rmtree(dest) + shutil.copytree(source, dest) + elif extension == '.xib': + return self._CopyXIBFile(source, dest) + elif extension == '.strings': + self._CopyStringsFile(source, dest) + else: + shutil.copyfile(source, dest) + + def _CopyXIBFile(self, source, dest): + """Compiles a XIB file with ibtool into a binary plist in the bundle.""" + tools_dir = os.environ.get('DEVELOPER_BIN_DIR', '/usr/bin') + args = [os.path.join(tools_dir, 'ibtool'), '--errors', '--warnings', + '--notices', '--output-format', 'human-readable-text', '--compile', + dest, source] + ibtool_section_re = re.compile(r'/\*.*\*/') + ibtool_re = re.compile(r'.*note:.*is clipping its content') + ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE) + current_section_header = None + for line in ibtoolout.stdout: + if ibtool_section_re.match(line): + current_section_header = line + elif not ibtool_re.match(line): + if current_section_header: + sys.stdout.write(current_section_header) + current_section_header = None + sys.stdout.write(line) + return ibtoolout.returncode + + def _CopyStringsFile(self, source, dest): + """Copies a .strings file using iconv to reconvert the input into UTF-16.""" + input_code = self._DetectInputEncoding(source) or "UTF-8" + fp = open(dest, 'w') + args = ['/usr/bin/iconv', '--from-code', input_code, '--to-code', + 'UTF-16', source] + subprocess.call(args, stdout=fp) + fp.close() + + def _DetectInputEncoding(self, file_name): + """Reads the first few bytes from file_name and tries to guess the text + encoding. Returns None as a guess if it can't detect it.""" + fp = open(file_name, 'rb') + try: + header = fp.read(3) + except e: + fp.close() + return None + fp.close() + if header.startswith("\xFE\xFF"): + return "UTF-16BE" + elif header.startswith("\xFF\xFE"): + return "UTF-16LE" + elif header.startswith("\xEF\xBB\xBF"): + return "UTF-8" + else: + return None + + def ExecCopyInfoPlist(self, source, dest): + """Copies the |source| Info.plist to the destination directory |dest|.""" + # Read the source Info.plist into memory. + fd = open(source, 'r') + lines = fd.read() + fd.close() + + # Go through all the environment variables and replace them as variables in + # the file. + for key in os.environ: + if key.startswith('_'): + continue + evar = '${%s}' % key + lines = string.replace(lines, evar, os.environ[key]) + + # Write out the file with variables replaced. + fd = open(dest, 'w') + fd.write(lines) + fd.close() + + # Now write out PkgInfo file now that the Info.plist file has been + # "compiled". + self._WritePkgInfo(dest) + + def _WritePkgInfo(self, info_plist): + """This writes the PkgInfo file from the data stored in Info.plist.""" + plist = plistlib.readPlist(info_plist) + if not plist: + return + + # Only create PkgInfo for executable types. + package_type = plist['CFBundlePackageType'] + if package_type != 'APPL': + return + + # The format of PkgInfo is eight characters, representing the bundle type + # and bundle signature, each four characters. If that is missing, four + # '?' characters are used instead. + signature_code = plist.get('CFBundleSignature', '????') + if len(signature_code) != 4: # Wrong length resets everything, too. + signature_code = '?' * 4 + + dest = os.path.join(os.path.dirname(info_plist), 'PkgInfo') + fp = open(dest, 'w') + fp.write('%s%s' % (package_type, signature_code)) + fp.close() + + def ExecFlock(self, lockfile, *cmd_list): + """Emulates the most basic behavior of Linux's flock(1).""" + # Rely on exception handling to report errors. + fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666) + fcntl.flock(fd, fcntl.LOCK_EX) + return subprocess.call(cmd_list) + + def ExecFilterLibtool(self, *cmd_list): + """Calls libtool and filters out 'libtool: file: foo.o has no symbols'.""" + libtool_re = re.compile(r'^libtool: file: .* has no symbols$') + libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE) + for line in libtoolout.stderr: + if not libtool_re.match(line): + sys.stderr.write(line) + return libtoolout.returncode + + def ExecPackageFramework(self, framework, version): + """Takes a path to Something.framework and the Current version of that and + sets up all the symlinks.""" + # Find the name of the binary based on the part before the ".framework". + binary = os.path.basename(framework).split('.')[0] + + CURRENT = 'Current' + RESOURCES = 'Resources' + VERSIONS = 'Versions' + + if not os.path.exists(os.path.join(framework, VERSIONS, version, binary)): + # Binary-less frameworks don't seem to contain symlinks (see e.g. + # chromium's out/Debug/org.chromium.Chromium.manifest/ bundle). + return + + # Move into the framework directory to set the symlinks correctly. + pwd = os.getcwd() + os.chdir(framework) + + # Set up the Current version. + self._Relink(version, os.path.join(VERSIONS, CURRENT)) + + # Set up the root symlinks. + self._Relink(os.path.join(VERSIONS, CURRENT, binary), binary) + self._Relink(os.path.join(VERSIONS, CURRENT, RESOURCES), RESOURCES) + + # Back to where we were before! + os.chdir(pwd) + + def _Relink(self, dest, link): + """Creates a symlink to |dest| named |link|. If |link| already exists, + it is overwritten.""" + if os.path.lexists(link): + os.remove(link) + os.symlink(dest, link) + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/tools/gyp/pylib/gyp/msvs_emulation.py b/tools/gyp/pylib/gyp/msvs_emulation.py new file mode 100644 index 000000000..a57e11abd --- /dev/null +++ b/tools/gyp/pylib/gyp/msvs_emulation.py @@ -0,0 +1,559 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +This module helps emulate Visual Studio 2008 behavior on top of other +build systems, primarily ninja. +""" + +import os +import re +import subprocess +import sys + +import gyp.MSVSVersion + +windows_quoter_regex = re.compile(r'(\\*)"') + +def QuoteForRspFile(arg): + """Quote a command line argument so that it appears as one argument when + processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for + Windows programs).""" + # See http://goo.gl/cuFbX and http://goo.gl/dhPnp including the comment + # threads. This is actually the quoting rules for CommandLineToArgvW, not + # for the shell, because the shell doesn't do anything in Windows. This + # works more or less because most programs (including the compiler, etc.) + # use that function to handle command line arguments. + + # For a literal quote, CommandLineToArgvW requires 2n+1 backslashes + # preceding it, and results in n backslashes + the quote. So we substitute + # in 2* what we match, +1 more, plus the quote. + arg = windows_quoter_regex.sub(lambda mo: 2 * mo.group(1) + '\\"', arg) + + # %'s also need to be doubled otherwise they're interpreted as batch + # positional arguments. Also make sure to escape the % so that they're + # passed literally through escaping so they can be singled to just the + # original %. Otherwise, trying to pass the literal representation that + # looks like an environment variable to the shell (e.g. %PATH%) would fail. + arg = arg.replace('%', '%%') + + # These commands are used in rsp files, so no escaping for the shell (via ^) + # is necessary. + + # Finally, wrap the whole thing in quotes so that the above quote rule + # applies and whitespace isn't a word break. + return '"' + arg + '"' + + +def EncodeRspFileList(args): + """Process a list of arguments using QuoteCmdExeArgument.""" + # Note that the first argument is assumed to be the command. Don't add + # quotes around it because then built-ins like 'echo', etc. won't work. + # Take care to normpath only the path in the case of 'call ../x.bat' because + # otherwise the whole thing is incorrectly interpreted as a path and not + # normalized correctly. + if not args: return '' + if args[0].startswith('call '): + call, program = args[0].split(' ', 1) + program = call + ' ' + os.path.normpath(program) + else: + program = os.path.normpath(args[0]) + return program + ' ' + ' '.join(QuoteForRspFile(arg) for arg in args[1:]) + + +def _GenericRetrieve(root, default, path): + """Given a list of dictionary keys |path| and a tree of dicts |root|, find + value at path, or return |default| if any of the path doesn't exist.""" + if not root: + return default + if not path: + return root + return _GenericRetrieve(root.get(path[0]), default, path[1:]) + + +def _AddPrefix(element, prefix): + """Add |prefix| to |element| or each subelement if element is iterable.""" + if element is None: + return element + # Note, not Iterable because we don't want to handle strings like that. + if isinstance(element, list) or isinstance(element, tuple): + return [prefix + e for e in element] + else: + return prefix + element + + +def _DoRemapping(element, map): + """If |element| then remap it through |map|. If |element| is iterable then + each item will be remapped. Any elements not found will be removed.""" + if map is not None and element is not None: + if not callable(map): + map = map.get # Assume it's a dict, otherwise a callable to do the remap. + if isinstance(element, list) or isinstance(element, tuple): + element = filter(None, [map(elem) for elem in element]) + else: + element = map(element) + return element + + +def _AppendOrReturn(append, element): + """If |append| is None, simply return |element|. If |append| is not None, + then add |element| to it, adding each item in |element| if it's a list or + tuple.""" + if append is not None and element is not None: + if isinstance(element, list) or isinstance(element, tuple): + append.extend(element) + else: + append.append(element) + else: + return element + + +def _FindDirectXInstallation(): + """Try to find an installation location for the DirectX SDK. Check for the + standard environment variable, and if that doesn't exist, try to find + via the registry. May return None if not found in either location.""" + dxsdk_dir = os.environ.get('DXSDK_DIR') + if not dxsdk_dir: + # Setup params to pass to and attempt to launch reg.exe. + cmd = ['reg.exe', 'query', r'HKLM\Software\Microsoft\DirectX', '/s'] + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + for line in p.communicate()[0].splitlines(): + if 'InstallPath' in line: + dxsdk_dir = line.split(' ')[3] + "\\" + return dxsdk_dir + + +class MsvsSettings(object): + """A class that understands the gyp 'msvs_...' values (especially the + msvs_settings field). They largely correpond to the VS2008 IDE DOM. This + class helps map those settings to command line options.""" + + def __init__(self, spec, generator_flags): + self.spec = spec + self.vs_version = GetVSVersion(generator_flags) + self.dxsdk_dir = _FindDirectXInstallation() + + # Try to find an installation location for the Windows DDK by checking + # the WDK_DIR environment variable, may be None. + self.wdk_dir = os.environ.get('WDK_DIR') + + supported_fields = [ + ('msvs_configuration_attributes', dict), + ('msvs_settings', dict), + ('msvs_system_include_dirs', list), + ('msvs_disabled_warnings', list), + ('msvs_precompiled_header', str), + ('msvs_precompiled_source', str), + ] + configs = spec['configurations'] + for field, default in supported_fields: + setattr(self, field, {}) + for configname, config in configs.iteritems(): + getattr(self, field)[configname] = config.get(field, default()) + + self.msvs_cygwin_dirs = spec.get('msvs_cygwin_dirs', ['.']) + + def GetVSMacroEnv(self, base_to_build=None): + """Get a dict of variables mapping internal VS macro names to their gyp + equivalents.""" + replacements = { + '$(VSInstallDir)': self.vs_version.Path(), + '$(VCInstallDir)': os.path.join(self.vs_version.Path(), 'VC') + '\\', + '$(OutDir)\\': base_to_build + '\\' if base_to_build else '', + '$(IntDir)': '$!INTERMEDIATE_DIR', + '$(InputPath)': '${source}', + '$(InputName)': '${root}', + '$(ProjectName)': self.spec['target_name'], + '$(PlatformName)': 'Win32', # TODO(scottmg): Support for x64 toolchain. + } + # Chromium uses DXSDK_DIR in include/lib paths, but it may or may not be + # set. This happens when the SDK is sync'd via src-internal, rather than + # by typical end-user installation of the SDK. If it's not set, we don't + # want to leave the unexpanded variable in the path, so simply strip it. + replacements['$(DXSDK_DIR)'] = self.dxsdk_dir if self.dxsdk_dir else '' + replacements['$(WDK_DIR)'] = self.wdk_dir if self.wdk_dir else '' + return replacements + + def ConvertVSMacros(self, s, base_to_build=None): + """Convert from VS macro names to something equivalent.""" + env = self.GetVSMacroEnv(base_to_build) + return ExpandMacros(s, env) + + def AdjustLibraries(self, libraries): + """Strip -l from library if it's specified with that.""" + return [lib[2:] if lib.startswith('-l') else lib for lib in libraries] + + def _GetAndMunge(self, field, path, default, prefix, append, map): + """Retrieve a value from |field| at |path| or return |default|. If + |append| is specified, and the item is found, it will be appended to that + object instead of returned. If |map| is specified, results will be + remapped through |map| before being returned or appended.""" + result = _GenericRetrieve(field, default, path) + result = _DoRemapping(result, map) + result = _AddPrefix(result, prefix) + return _AppendOrReturn(append, result) + + class _GetWrapper(object): + def __init__(self, parent, field, base_path, append=None): + self.parent = parent + self.field = field + self.base_path = [base_path] + self.append = append + def __call__(self, name, map=None, prefix='', default=None): + return self.parent._GetAndMunge(self.field, self.base_path + [name], + default=default, prefix=prefix, append=self.append, map=map) + + def _Setting(self, path, config, + default=None, prefix='', append=None, map=None): + """_GetAndMunge for msvs_settings.""" + return self._GetAndMunge( + self.msvs_settings[config], path, default, prefix, append, map) + + def _ConfigAttrib(self, path, config, + default=None, prefix='', append=None, map=None): + """_GetAndMunge for msvs_configuration_attributes.""" + return self._GetAndMunge( + self.msvs_configuration_attributes[config], + path, default, prefix, append, map) + + def AdjustIncludeDirs(self, include_dirs, config): + """Updates include_dirs to expand VS specific paths, and adds the system + include dirs used for platform SDK and similar.""" + includes = include_dirs + self.msvs_system_include_dirs[config] + includes.extend(self._Setting( + ('VCCLCompilerTool', 'AdditionalIncludeDirectories'), config, default=[])) + return [self.ConvertVSMacros(p) for p in includes] + + def GetComputedDefines(self, config): + """Returns the set of defines that are injected to the defines list based + on other VS settings.""" + defines = [] + if self._ConfigAttrib(['CharacterSet'], config) == '1': + defines.extend(('_UNICODE', 'UNICODE')) + if self._ConfigAttrib(['CharacterSet'], config) == '2': + defines.append('_MBCS') + defines.extend(self._Setting( + ('VCCLCompilerTool', 'PreprocessorDefinitions'), config, default=[])) + return defines + + def GetOutputName(self, config, expand_special): + """Gets the explicitly overridden output name for a target or returns None + if it's not overridden.""" + type = self.spec['type'] + root = 'VCLibrarianTool' if type == 'static_library' else 'VCLinkerTool' + # TODO(scottmg): Handle OutputDirectory without OutputFile. + output_file = self._Setting((root, 'OutputFile'), config) + if output_file: + output_file = expand_special(self.ConvertVSMacros(output_file)) + return output_file + + def GetCflags(self, config): + """Returns the flags that need to be added to .c and .cc compilations.""" + cflags = [] + cflags.extend(['/wd' + w for w in self.msvs_disabled_warnings[config]]) + cl = self._GetWrapper(self, self.msvs_settings[config], + 'VCCLCompilerTool', append=cflags) + cl('Optimization', + map={'0': 'd', '1': '1', '2': '2', '3': 'x'}, prefix='/O') + cl('InlineFunctionExpansion', prefix='/Ob') + cl('OmitFramePointers', map={'false': '-', 'true': ''}, prefix='/Oy') + cl('FavorSizeOrSpeed', map={'1': 't', '2': 's'}, prefix='/O') + cl('WholeProgramOptimization', map={'true': '/GL'}) + cl('WarningLevel', prefix='/W') + cl('WarnAsError', map={'true': '/WX'}) + cl('DebugInformationFormat', + map={'1': '7', '3': 'i', '4': 'I'}, prefix='/Z') + cl('RuntimeTypeInfo', map={'true': '/GR', 'false': '/GR-'}) + cl('EnableFunctionLevelLinking', map={'true': '/Gy', 'false': '/Gy-'}) + cl('MinimalRebuild', map={'true': '/Gm'}) + cl('BufferSecurityCheck', map={'true': '/GS', 'false': '/GS-'}) + cl('BasicRuntimeChecks', map={'1': 's', '2': 'u', '3': '1'}, prefix='/RTC') + cl('RuntimeLibrary', + map={'0': 'T', '1': 'Td', '2': 'D', '3': 'Dd'}, prefix='/M') + cl('ExceptionHandling', map={'1': 'sc','2': 'a'}, prefix='/EH') + cl('AdditionalOptions', prefix='') + # ninja handles parallelism by itself, don't have the compiler do it too. + cflags = filter(lambda x: not x.startswith('/MP'), cflags) + return cflags + + def GetPrecompiledHeader(self, config, gyp_to_build_path): + """Returns an object that handles the generation of precompiled header + build steps.""" + return _PchHelper(self, config, gyp_to_build_path) + + def _GetPchFlags(self, config, extension): + """Get the flags to be added to the cflags for precompiled header support. + """ + # The PCH is only built once by a particular source file. Usage of PCH must + # only be for the same language (i.e. C vs. C++), so only include the pch + # flags when the language matches. + if self.msvs_precompiled_header[config]: + source_ext = os.path.splitext(self.msvs_precompiled_source[config])[1] + if _LanguageMatchesForPch(source_ext, extension): + pch = os.path.split(self.msvs_precompiled_header[config])[1] + return ['/Yu' + pch, '/FI' + pch, '/Fp${pchprefix}.' + pch + '.pch'] + return [] + + def GetCflagsC(self, config): + """Returns the flags that need to be added to .c compilations.""" + return self._GetPchFlags(config, '.c') + + def GetCflagsCC(self, config): + """Returns the flags that need to be added to .cc compilations.""" + return ['/TP'] + self._GetPchFlags(config, '.cc') + + def _GetAdditionalLibraryDirectories(self, root, config, gyp_to_build_path): + """Get and normalize the list of paths in AdditionalLibraryDirectories + setting.""" + libpaths = self._Setting((root, 'AdditionalLibraryDirectories'), + config, default=[]) + libpaths = [os.path.normpath(gyp_to_build_path(self.ConvertVSMacros(p))) + for p in libpaths] + return ['/LIBPATH:"' + p + '"' for p in libpaths] + + def GetLibFlags(self, config, gyp_to_build_path): + """Returns the flags that need to be added to lib commands.""" + libflags = [] + lib = self._GetWrapper(self, self.msvs_settings[config], + 'VCLibrarianTool', append=libflags) + libflags.extend(self._GetAdditionalLibraryDirectories( + 'VCLibrarianTool', config, gyp_to_build_path)) + lib('AdditionalOptions') + return libflags + + def _GetDefFileAsLdflags(self, spec, ldflags, gyp_to_build_path): + """.def files get implicitly converted to a ModuleDefinitionFile for the + linker in the VS generator. Emulate that behaviour here.""" + def_file = '' + if spec['type'] in ('shared_library', 'loadable_module', 'executable'): + def_files = [s for s in spec.get('sources', []) if s.endswith('.def')] + if len(def_files) == 1: + ldflags.append('/DEF:"%s"' % gyp_to_build_path(def_files[0])) + elif len(def_files) > 1: + raise Exception("Multiple .def files") + + def GetLdflags(self, config, gyp_to_build_path, expand_special): + """Returns the flags that need to be added to link commands.""" + ldflags = [] + ld = self._GetWrapper(self, self.msvs_settings[config], + 'VCLinkerTool', append=ldflags) + self._GetDefFileAsLdflags(self.spec, ldflags, gyp_to_build_path) + ld('GenerateDebugInformation', map={'true': '/DEBUG'}) + ld('TargetMachine', map={'1': 'X86', '17': 'X64'}, prefix='/MACHINE:') + ldflags.extend(self._GetAdditionalLibraryDirectories( + 'VCLinkerTool', config, gyp_to_build_path)) + ld('DelayLoadDLLs', prefix='/DELAYLOAD:') + out = self.GetOutputName(config, expand_special) + if out: + ldflags.append('/OUT:' + out) + ld('AdditionalOptions', prefix='') + ld('SubSystem', map={'1': 'CONSOLE', '2': 'WINDOWS'}, prefix='/SUBSYSTEM:') + ld('LinkIncremental', map={'1': ':NO', '2': ''}, prefix='/INCREMENTAL') + ld('FixedBaseAddress', map={'1': ':NO', '2': ''}, prefix='/FIXED') + ld('RandomizedBaseAddress', + map={'1': ':NO', '2': ''}, prefix='/DYNAMICBASE') + ld('DataExecutionPrevention', + map={'1': ':NO', '2': ''}, prefix='/NXCOMPAT') + ld('OptimizeReferences', map={'1': 'NOREF', '2': 'REF'}, prefix='/OPT:') + ld('EnableCOMDATFolding', map={'1': 'NOICF', '2': 'ICF'}, prefix='/OPT:') + ld('LinkTimeCodeGeneration', map={'1': '/LTCG'}) + ld('IgnoreDefaultLibraryNames', prefix='/NODEFAULTLIB:') + ld('ResourceOnlyDLL', map={'true': '/NOENTRY'}) + ld('EntryPointSymbol', prefix='/ENTRY:') + # TODO(scottmg): This should sort of be somewhere else (not really a flag). + ld('AdditionalDependencies', prefix='') + # TODO(scottmg): These too. + ldflags.extend(('kernel32.lib', 'user32.lib', 'gdi32.lib', 'winspool.lib', + 'comdlg32.lib', 'advapi32.lib', 'shell32.lib', 'ole32.lib', + 'oleaut32.lib', 'uuid.lib', 'odbc32.lib', 'DelayImp.lib')) + + # If the base address is not specifically controlled, DYNAMICBASE should + # be on by default. + base_flags = filter(lambda x: 'DYNAMICBASE' in x or x == '/FIXED', + ldflags) + if not base_flags: + ldflags.append('/DYNAMICBASE') + + # If the NXCOMPAT flag has not been specified, default to on. Despite the + # documentation that says this only defaults to on when the subsystem is + # Vista or greater (which applies to the linker), the IDE defaults it on + # unless it's explicitly off. + if not filter(lambda x: 'NXCOMPAT' in x, ldflags): + ldflags.append('/NXCOMPAT') + + return ldflags + + def IsUseLibraryDependencyInputs(self, config): + """Returns whether the target should be linked via Use Library Dependency + Inputs (using component .objs of a given .lib).""" + uldi = self._Setting(('VCLinkerTool', 'UseLibraryDependencyInputs'), config) + return uldi == 'true' + + def GetRcflags(self, config, gyp_to_ninja_path): + """Returns the flags that need to be added to invocations of the resource + compiler.""" + rcflags = [] + rc = self._GetWrapper(self, self.msvs_settings[config], + 'VCResourceCompilerTool', append=rcflags) + rc('AdditionalIncludeDirectories', map=gyp_to_ninja_path, prefix='/I') + rcflags.append('/I' + gyp_to_ninja_path('.')) + rc('PreprocessorDefinitions', prefix='/d') + # /l arg must be in hex without leading '0x' + rc('Culture', prefix='/l', map=lambda x: hex(int(x))[2:]) + return rcflags + + def BuildCygwinBashCommandLine(self, args, path_to_base): + """Build a command line that runs args via cygwin bash. We assume that all + incoming paths are in Windows normpath'd form, so they need to be + converted to posix style for the part of the command line that's passed to + bash. We also have to do some Visual Studio macro emulation here because + various rules use magic VS names for things. Also note that rules that + contain ninja variables cannot be fixed here (for example ${source}), so + the outer generator needs to make sure that the paths that are written out + are in posix style, if the command line will be used here.""" + cygwin_dir = os.path.normpath( + os.path.join(path_to_base, self.msvs_cygwin_dirs[0])) + cd = ('cd %s' % path_to_base).replace('\\', '/') + args = [a.replace('\\', '/') for a in args] + args = ["'%s'" % a.replace("'", "\\'") for a in args] + bash_cmd = ' '.join(args) + cmd = ( + 'call "%s\\setup_env.bat" && set CYGWIN=nontsec && ' % cygwin_dir + + 'bash -c "%s ; %s"' % (cd, bash_cmd)) + return cmd + + def IsRuleRunUnderCygwin(self, rule): + """Determine if an action should be run under cygwin. If the variable is + unset, or set to 1 we use cygwin.""" + return int(rule.get('msvs_cygwin_shell', + self.spec.get('msvs_cygwin_shell', 1))) != 0 + + def HasExplicitIdlRules(self, spec): + """Determine if there's an explicit rule for idl files. When there isn't we + need to generate implicit rules to build MIDL .idl files.""" + for rule in spec.get('rules', []): + if rule['extension'] == 'idl' and int(rule.get('msvs_external_rule', 0)): + return True + return False + + def GetIdlBuildData(self, source, config): + """Determine the implicit outputs for an idl file. Returns output + directory, outputs, and variables and flags that are required.""" + midl_get = self._GetWrapper(self, self.msvs_settings[config], 'VCMIDLTool') + def midl(name, default=None): + return self.ConvertVSMacros(midl_get(name, default=default)) + tlb = midl('TypeLibraryName', default='${root}.tlb') + header = midl('HeaderFileName', default='${root}.h') + dlldata = midl('DLLDataFileName', default='dlldata.c') + iid = midl('InterfaceIdentifierFileName', default='${root}_i.c') + proxy = midl('ProxyFileName', default='${root}_p.c') + # Note that .tlb is not included in the outputs as it is not always + # generated depending on the content of the input idl file. + outdir = midl('OutputDirectory', default='') + output = [header, dlldata, iid, proxy] + variables = [('tlb', tlb), + ('h', header), + ('dlldata', dlldata), + ('iid', iid), + ('proxy', proxy)] + # TODO(scottmg): Are there configuration settings to set these flags? + flags = ['/char', 'signed', '/env', 'win32', '/Oicf'] + return outdir, output, variables, flags + + +def _LanguageMatchesForPch(source_ext, pch_source_ext): + c_exts = ('.c',) + cc_exts = ('.cc', '.cxx', '.cpp') + return ((source_ext in c_exts and pch_source_ext in c_exts) or + (source_ext in cc_exts and pch_source_ext in cc_exts)) + +class PrecompiledHeader(object): + """Helper to generate dependencies and build rules to handle generation of + precompiled headers. Interface matches the GCH handler in xcode_emulation.py. + """ + def __init__(self, settings, config, gyp_to_build_path): + self.settings = settings + self.config = config + self.gyp_to_build_path = gyp_to_build_path + + def _PchHeader(self): + """Get the header that will appear in an #include line for all source + files.""" + return os.path.split(self.settings.msvs_precompiled_header[self.config])[1] + + def _PchSource(self): + """Get the source file that is built once to compile the pch data.""" + return self.gyp_to_build_path( + self.settings.msvs_precompiled_source[self.config]) + + def _PchOutput(self): + """Get the name of the output of the compiled pch data.""" + return '${pchprefix}.' + self._PchHeader() + '.pch' + + def GetObjDependencies(self, sources, objs): + """Given a list of sources files and the corresponding object files, + returns a list of the pch files that should be depended upon. The + additional wrapping in the return value is for interface compatability + with make.py on Mac, and xcode_emulation.py.""" + if not self._PchHeader(): + return [] + source = self._PchSource() + assert source + pch_ext = os.path.splitext(self._PchSource())[1] + for source in sources: + if _LanguageMatchesForPch(os.path.splitext(source)[1], pch_ext): + return [(None, None, self._PchOutput())] + return [] + + def GetPchBuildCommands(self): + """Returns [(path_to_pch, language_flag, language, header)]. + |path_to_gch| and |header| are relative to the build directory.""" + header = self._PchHeader() + source = self._PchSource() + if not source or not header: + return [] + ext = os.path.splitext(source)[1] + lang = 'c' if ext == '.c' else 'cc' + return [(self._PchOutput(), '/Yc' + header, lang, source)] + + +vs_version = None +def GetVSVersion(generator_flags): + global vs_version + if not vs_version: + vs_version = gyp.MSVSVersion.SelectVisualStudioVersion( + generator_flags.get('msvs_version', 'auto')) + return vs_version + +def _GetBinaryPath(generator_flags, tool): + vs = GetVSVersion(generator_flags) + return ('"' + vs.ToolPath(tool) + '"') + +def GetCLPath(generator_flags): + return _GetBinaryPath(generator_flags, 'cl.exe') + +def GetLinkPath(generator_flags): + return _GetBinaryPath(generator_flags, 'link.exe') + +def GetLibPath(generator_flags): + return _GetBinaryPath(generator_flags, 'lib.exe') + +def GetMidlPath(generator_flags): + return _GetBinaryPath(generator_flags, 'midl.exe') + +def GetRCPath(generator_flags): + return _GetBinaryPath(generator_flags, 'rc.exe') + +def GetVsvarsPath(generator_flags): + vs = GetVSVersion(generator_flags) + return vs.SetupScript() + +def ExpandMacros(string, expansions): + """Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv + for the canonical way to retrieve a suitable dict.""" + if '$' in string: + for old, new in expansions.iteritems(): + assert '$(' not in new, new + string = string.replace(old, new) + return string diff --git a/tools/gyp/pylib/gyp/ninja_syntax.py b/tools/gyp/pylib/gyp/ninja_syntax.py new file mode 100644 index 000000000..25b9f7442 --- /dev/null +++ b/tools/gyp/pylib/gyp/ninja_syntax.py @@ -0,0 +1,155 @@ +# This file comes from +# https://github.com/martine/ninja/blob/master/misc/ninja_syntax.py +# Do not edit! Edit the upstream one instead. + +"""Python module for generating .ninja files. + +Note that this is emphatically not a required piece of Ninja; it's +just a helpful utility for build-file-generation systems that already +use Python. +""" + +import textwrap +import re + +def escape_spaces(word): + return word.replace('$ ','$$ ').replace(' ','$ ') + +class Writer(object): + def __init__(self, output, width=78): + self.output = output + self.width = width + + def newline(self): + self.output.write('\n') + + def comment(self, text): + for line in textwrap.wrap(text, self.width - 2): + self.output.write('# ' + line + '\n') + + def variable(self, key, value, indent=0): + if value is None: + return + if isinstance(value, list): + value = ' '.join(filter(None, value)) # Filter out empty strings. + self._line('%s = %s' % (key, value), indent) + + def rule(self, name, command, description=None, depfile=None, + generator=False, restat=False, deplist=None, rspfile=None, + rspfile_content=None): + self._line('rule %s' % name) + self.variable('command', command, indent=1) + if description: + self.variable('description', description, indent=1) + if depfile: + self.variable('depfile', depfile, indent=1) + if deplist: + self.variable('deplist', deplist, indent=1) + if generator: + self.variable('generator', '1', indent=1) + if restat: + self.variable('restat', '1', indent=1) + if rspfile: + self.variable('rspfile', rspfile, indent=1) + if rspfile_content: + self.variable('rspfile_content', rspfile_content, indent=1) + + def build(self, outputs, rule, inputs=None, implicit=None, order_only=None, + variables=None): + outputs = self._as_list(outputs) + all_inputs = self._as_list(inputs)[:] + out_outputs = list(map(escape_spaces, outputs)) + all_inputs = list(map(escape_spaces, all_inputs)) + + if implicit: + implicit = map(escape_spaces, self._as_list(implicit)) + all_inputs.append('|') + all_inputs.extend(implicit) + if order_only: + order_only = map(escape_spaces, self._as_list(order_only)) + all_inputs.append('||') + all_inputs.extend(order_only) + + self._line('build %s: %s %s' % (' '.join(out_outputs), + rule, + ' '.join(all_inputs))) + + if variables: + if isinstance(variables, dict): + iterator = variables.iteritems() + else: + iterator = iter(variables) + + for key, val in iterator: + self.variable(key, val, indent=1) + + return outputs + + def include(self, path): + self._line('include %s' % path) + + def subninja(self, path): + self._line('subninja %s' % path) + + def default(self, paths): + self._line('default %s' % ' '.join(self._as_list(paths))) + + def _count_dollars_before_index(self, s, i): + """Returns the number of '$' characters right in front of s[i].""" + dollar_count = 0 + dollar_index = i - 1 + while dollar_index > 0 and s[dollar_index] == '$': + dollar_count += 1 + dollar_index -= 1 + return dollar_count + + def _line(self, text, indent=0): + """Write 'text' word-wrapped at self.width characters.""" + leading_space = ' ' * indent + while len(leading_space) + len(text) > self.width: + # The text is too wide; wrap if possible. + + # Find the rightmost space that would obey our width constraint and + # that's not an escaped space. + available_space = self.width - len(leading_space) - len(' $') + space = available_space + while True: + space = text.rfind(' ', 0, space) + if space < 0 or \ + self._count_dollars_before_index(text, space) % 2 == 0: + break + + if space < 0: + # No such space; just use the first unescaped space we can find. + space = available_space - 1 + while True: + space = text.find(' ', space + 1) + if space < 0 or \ + self._count_dollars_before_index(text, space) % 2 == 0: + break + if space < 0: + # Give up on breaking. + break + + self.output.write(leading_space + text[0:space] + ' $\n') + text = text[space+1:] + + # Subsequent lines are continuations, so indent them. + leading_space = ' ' * (indent+2) + + self.output.write(leading_space + text + '\n') + + def _as_list(self, input): + if input is None: + return [] + if isinstance(input, list): + return input + return [input] + + +def escape(string): + """Escape a string such that it can be embedded into a Ninja file without + further interpretation.""" + assert '\n' not in string, 'Ninja syntax does not allow newlines' + # We only have one special metacharacter: '$'. + return string.replace('$', '$$') diff --git a/tools/gyp/pylib/gyp/sun_tool.py b/tools/gyp/pylib/gyp/sun_tool.py new file mode 100755 index 000000000..90d59c824 --- /dev/null +++ b/tools/gyp/pylib/gyp/sun_tool.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""These functions are executed via gyp-sun-tool when using the Makefile +generator.""" + +import fcntl +import os +import struct +import subprocess +import sys + + +def main(args): + executor = SunTool() + executor.Dispatch(args) + + +class SunTool(object): + """This class performs all the SunOS tooling steps. The methods can either be + executed directly, or dispatched from an argument list.""" + + def Dispatch(self, args): + """Dispatches a string command to a method.""" + if len(args) < 1: + raise Exception("Not enough arguments") + + method = "Exec%s" % self._CommandifyName(args[0]) + getattr(self, method)(*args[1:]) + + def _CommandifyName(self, name_string): + """Transforms a tool name like copy-info-plist to CopyInfoPlist""" + return name_string.title().replace('-', '') + + def ExecFlock(self, lockfile, *cmd_list): + """Emulates the most basic behavior of Linux's flock(1).""" + # Rely on exception handling to report errors. + # Note that the stock python on SunOS has a bug + # where fcntl.flock(fd, LOCK_EX) always fails + # with EBADF, that's why we use this F_SETLK + # hack instead. + fd = os.open(lockfile, os.O_WRONLY|os.O_NOCTTY|os.O_CREAT, 0666) + op = struct.pack('hhllhhl', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0) + fcntl.fcntl(fd, fcntl.F_SETLK, op) + return subprocess.call(cmd_list) + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/tools/gyp/pylib/gyp/system_test.py b/tools/gyp/pylib/gyp/system_test.py new file mode 100755 index 000000000..51c71e36b --- /dev/null +++ b/tools/gyp/pylib/gyp/system_test.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os +import tempfile +import shutil +import subprocess + + +def TestCommands(commands, files={}, env={}): + """Run commands in a temporary directory, returning true if they all succeed. + Return false on failures or if any commands produce output. + + Arguments: + commands: an array of shell-interpretable commands, e.g. ['ls -l', 'pwd'] + each will be expanded with Python %-expansion using env first. + files: a dictionary mapping filename to contents; + files will be created in the temporary directory before running + the command. + env: a dictionary of strings to expand commands with. + """ + tempdir = tempfile.mkdtemp() + try: + for name, contents in files.items(): + f = open(os.path.join(tempdir, name), 'wb') + f.write(contents) + f.close() + for command in commands: + proc = subprocess.Popen(command % env, shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + cwd=tempdir) + output = proc.communicate()[0] + if proc.returncode != 0 or output: + return False + return True + finally: + shutil.rmtree(tempdir) + return False + + +def TestArSupportsT(ar_command='ar', cc_command='cc'): + """Test whether 'ar' supports the 'T' flag.""" + return TestCommands(['%(cc)s -c test.c', + '%(ar)s crsT test.a test.o', + '%(cc)s test.a'], + files={'test.c': 'int main(){}'}, + env={'ar': ar_command, 'cc': cc_command}) + + +def main(): + # Run the various test functions and print the results. + def RunTest(description, function, **kwargs): + print "Testing " + description + ':', + if function(**kwargs): + print 'ok' + else: + print 'fail' + RunTest("ar 'T' flag", TestArSupportsT) + RunTest("ar 'T' flag with ccache", TestArSupportsT, cc_command='ccache cc') + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/tools/gyp/pylib/gyp/win_tool.py b/tools/gyp/pylib/gyp/win_tool.py new file mode 100644 index 000000000..a248d74f5 --- /dev/null +++ b/tools/gyp/pylib/gyp/win_tool.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Utility functions for Windows builds. + +These functions are executed via gyp-win-tool when using the ninja generator. +""" + +import os +import shutil +import subprocess +import sys + + +def main(args): + executor = WinTool() + exit_code = executor.Dispatch(args) + if exit_code is not None: + sys.exit(exit_code) + + +class WinTool(object): + """This class performs all the Windows tooling steps. The methods can either + be executed directly, or dispatched from an argument list.""" + + def Dispatch(self, args): + """Dispatches a string command to a method.""" + if len(args) < 1: + raise Exception("Not enough arguments") + + method = "Exec%s" % self._CommandifyName(args[0]) + return getattr(self, method)(*args[1:]) + + def _CommandifyName(self, name_string): + """Transforms a tool name like recursive-mirror to RecursiveMirror.""" + return name_string.title().replace('-', '') + + def ExecStamp(self, path): + """Simple stamp command.""" + open(path, 'w').close() + + def ExecRecursiveMirror(self, source, dest): + """Emulation of rm -rf out && cp -af in out.""" + if os.path.exists(dest): + if os.path.isdir(dest): + shutil.rmtree(dest) + else: + os.unlink(dest) + if os.path.isdir(source): + shutil.copytree(source, dest) + else: + shutil.copy2(source, dest) + + def ExecLinkWrapper(self, *args): + """Filter diagnostic output from link that looks like: + ' Creating library ui.dll.lib and object ui.dll.exp' + This happens when there are exports from the dll or exe. + """ + popen = subprocess.Popen( + args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + out, _ = popen.communicate() + for line in out.splitlines(): + if not line.startswith(' Creating library '): + print line + return popen.returncode + + def ExecMidlWrapper(self, outdir, tlb, h, dlldata, iid, proxy, idl, *flags): + """Filter noisy filenames output from MIDL compile step that isn't + quietable via command line flags. + """ + args = ['midl', '/nologo'] + list(flags) + [ + '/out', outdir, + '/tlb', tlb, + '/h', h, + '/dlldata', dlldata, + '/iid', iid, + '/proxy', proxy, + idl] + popen = subprocess.Popen( + args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + out, _ = popen.communicate() + # Filter junk out of stdout, and write filtered versions. Output we want + # to filter is pairs of lines that look like this: + # Processing C:\Program Files (x86)\Microsoft SDKs\...\include\objidl.idl + # objidl.idl + lines = out.splitlines() + prefix = 'Processing ' + processing = set(os.path.basename(x) for x in lines if x.startswith(prefix)) + for line in lines: + if not line.startswith(prefix) and line not in processing: + print line + return popen.returncode + + def ExecRcWrapper(self, *args): + """Filter logo banner from invocations of rc.exe. Older versions of RC + don't support the /nologo flag.""" + popen = subprocess.Popen( + args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + out, _ = popen.communicate() + for line in out.splitlines(): + if (not line.startswith('Microsoft (R) Windows (R) Resource Compiler') and + not line.startswith('Copyright (C) Microsoft Corporation') and + line): + print line + return popen.returncode + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py new file mode 100644 index 000000000..ce2dabf96 --- /dev/null +++ b/tools/gyp/pylib/gyp/xcode_emulation.py @@ -0,0 +1,1038 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +This module contains classes that help to emulate xcodebuild behavior on top of +other build systems, such as make and ninja. +""" + +import gyp.common +import os.path +import re +import shlex + +class XcodeSettings(object): + """A class that understands the gyp 'xcode_settings' object.""" + + # Computed lazily by _GetSdkBaseDir(). Shared by all XcodeSettings, so cached + # at class-level for efficiency. + _sdk_base_dir = None + + def __init__(self, spec): + self.spec = spec + + # Per-target 'xcode_settings' are pushed down into configs earlier by gyp. + # This means self.xcode_settings[config] always contains all settings + # for that config -- the per-target settings as well. Settings that are + # the same for all configs are implicitly per-target settings. + self.xcode_settings = {} + configs = spec['configurations'] + for configname, config in configs.iteritems(): + self.xcode_settings[configname] = config.get('xcode_settings', {}) + + # This is only non-None temporarily during the execution of some methods. + self.configname = None + + # Used by _AdjustLibrary to match .a and .dylib entries in libraries. + self.library_re = re.compile(r'^lib([^/]+)\.(a|dylib)$') + + def _Settings(self): + assert self.configname + return self.xcode_settings[self.configname] + + def _Test(self, test_key, cond_key, default): + return self._Settings().get(test_key, default) == cond_key + + def _Appendf(self, lst, test_key, format_str, default=None): + if test_key in self._Settings(): + lst.append(format_str % str(self._Settings()[test_key])) + elif default: + lst.append(format_str % str(default)) + + def _WarnUnimplemented(self, test_key): + if test_key in self._Settings(): + print 'Warning: Ignoring not yet implemented key "%s".' % test_key + + def _IsBundle(self): + return int(self.spec.get('mac_bundle', 0)) != 0 + + def GetFrameworkVersion(self): + """Returns the framework version of the current target. Only valid for + bundles.""" + assert self._IsBundle() + return self.GetPerTargetSetting('FRAMEWORK_VERSION', default='A') + + def GetWrapperExtension(self): + """Returns the bundle extension (.app, .framework, .plugin, etc). Only + valid for bundles.""" + assert self._IsBundle() + if self.spec['type'] in ('loadable_module', 'shared_library'): + default_wrapper_extension = { + 'loadable_module': 'bundle', + 'shared_library': 'framework', + }[self.spec['type']] + wrapper_extension = self.GetPerTargetSetting( + 'WRAPPER_EXTENSION', default=default_wrapper_extension) + return '.' + self.spec.get('product_extension', wrapper_extension) + elif self.spec['type'] == 'executable': + return '.app' + else: + assert False, "Don't know extension for '%s', target '%s'" % ( + self.spec['type'], self.spec['target_name']) + + def GetProductName(self): + """Returns PRODUCT_NAME.""" + return self.spec.get('product_name', self.spec['target_name']) + + def GetFullProductName(self): + """Returns FULL_PRODUCT_NAME.""" + if self._IsBundle(): + return self.GetWrapperName() + else: + return self._GetStandaloneBinaryPath() + + def GetWrapperName(self): + """Returns the directory name of the bundle represented by this target. + Only valid for bundles.""" + assert self._IsBundle() + return self.GetProductName() + self.GetWrapperExtension() + + def GetBundleContentsFolderPath(self): + """Returns the qualified path to the bundle's contents folder. E.g. + Chromium.app/Contents or Foo.bundle/Versions/A. Only valid for bundles.""" + assert self._IsBundle() + if self.spec['type'] == 'shared_library': + return os.path.join( + self.GetWrapperName(), 'Versions', self.GetFrameworkVersion()) + else: + # loadable_modules have a 'Contents' folder like executables. + return os.path.join(self.GetWrapperName(), 'Contents') + + def GetBundleResourceFolder(self): + """Returns the qualified path to the bundle's resource folder. E.g. + Chromium.app/Contents/Resources. Only valid for bundles.""" + assert self._IsBundle() + return os.path.join(self.GetBundleContentsFolderPath(), 'Resources') + + def GetBundlePlistPath(self): + """Returns the qualified path to the bundle's plist file. E.g. + Chromium.app/Contents/Info.plist. Only valid for bundles.""" + assert self._IsBundle() + if self.spec['type'] in ('executable', 'loadable_module'): + return os.path.join(self.GetBundleContentsFolderPath(), 'Info.plist') + else: + return os.path.join(self.GetBundleContentsFolderPath(), + 'Resources', 'Info.plist') + + def GetProductType(self): + """Returns the PRODUCT_TYPE of this target.""" + if self._IsBundle(): + return { + 'executable': 'com.apple.product-type.application', + 'loadable_module': 'com.apple.product-type.bundle', + 'shared_library': 'com.apple.product-type.framework', + }[self.spec['type']] + else: + return { + 'executable': 'com.apple.product-type.tool', + 'loadable_module': 'com.apple.product-type.library.dynamic', + 'shared_library': 'com.apple.product-type.library.dynamic', + 'static_library': 'com.apple.product-type.library.static', + }[self.spec['type']] + + def GetMachOType(self): + """Returns the MACH_O_TYPE of this target.""" + # Weird, but matches Xcode. + if not self._IsBundle() and self.spec['type'] == 'executable': + return '' + return { + 'executable': 'mh_execute', + 'static_library': 'staticlib', + 'shared_library': 'mh_dylib', + 'loadable_module': 'mh_bundle', + }[self.spec['type']] + + def _GetBundleBinaryPath(self): + """Returns the name of the bundle binary of by this target. + E.g. Chromium.app/Contents/MacOS/Chromium. Only valid for bundles.""" + assert self._IsBundle() + if self.spec['type'] in ('shared_library'): + path = self.GetBundleContentsFolderPath() + elif self.spec['type'] in ('executable', 'loadable_module'): + path = os.path.join(self.GetBundleContentsFolderPath(), 'MacOS') + return os.path.join(path, self.GetExecutableName()) + + def _GetStandaloneExecutableSuffix(self): + if 'product_extension' in self.spec: + return '.' + self.spec['product_extension'] + return { + 'executable': '', + 'static_library': '.a', + 'shared_library': '.dylib', + 'loadable_module': '.so', + }[self.spec['type']] + + def _GetStandaloneExecutablePrefix(self): + return self.spec.get('product_prefix', { + 'executable': '', + 'static_library': 'lib', + 'shared_library': 'lib', + # Non-bundled loadable_modules are called foo.so for some reason + # (that is, .so and no prefix) with the xcode build -- match that. + 'loadable_module': '', + }[self.spec['type']]) + + def _GetStandaloneBinaryPath(self): + """Returns the name of the non-bundle binary represented by this target. + E.g. hello_world. Only valid for non-bundles.""" + assert not self._IsBundle() + assert self.spec['type'] in ( + 'executable', 'shared_library', 'static_library', 'loadable_module'), ( + 'Unexpected type %s' % self.spec['type']) + target = self.spec['target_name'] + if self.spec['type'] == 'static_library': + if target[:3] == 'lib': + target = target[3:] + elif self.spec['type'] in ('loadable_module', 'shared_library'): + if target[:3] == 'lib': + target = target[3:] + + target_prefix = self._GetStandaloneExecutablePrefix() + target = self.spec.get('product_name', target) + target_ext = self._GetStandaloneExecutableSuffix() + return target_prefix + target + target_ext + + def GetExecutableName(self): + """Returns the executable name of the bundle represented by this target. + E.g. Chromium.""" + if self._IsBundle(): + return self.spec.get('product_name', self.spec['target_name']) + else: + return self._GetStandaloneBinaryPath() + + def GetExecutablePath(self): + """Returns the directory name of the bundle represented by this target. E.g. + Chromium.app/Contents/MacOS/Chromium.""" + if self._IsBundle(): + return self._GetBundleBinaryPath() + else: + return self._GetStandaloneBinaryPath() + + def _GetSdkBaseDir(self): + """Returns the root of the 'Developer' directory. On Xcode 4.2 and prior, + this is usually just /Developer. Xcode 4.3 moved that folder into the Xcode + bundle.""" + if not XcodeSettings._sdk_base_dir: + import subprocess + job = subprocess.Popen(['xcode-select', '-print-path'], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + out, err = job.communicate() + if job.returncode != 0: + print out + raise Exception('Error %d running xcode-select' % job.returncode) + # The Developer folder moved in Xcode 4.3. + xcode43_sdk_path = os.path.join( + out.rstrip(), 'Platforms/MacOSX.platform/Developer/SDKs') + if os.path.isdir(xcode43_sdk_path): + XcodeSettings._sdk_base_dir = xcode43_sdk_path + else: + XcodeSettings._sdk_base_dir = os.path.join(out.rstrip(), 'SDKs') + return XcodeSettings._sdk_base_dir + + def _SdkPath(self): + sdk_root = self.GetPerTargetSetting('SDKROOT', default='macosx10.5') + if sdk_root.startswith('macosx'): + sdk_root = 'MacOSX' + sdk_root[len('macosx'):] + return os.path.join(self._GetSdkBaseDir(), '%s.sdk' % sdk_root) + + def GetCflags(self, configname): + """Returns flags that need to be added to .c, .cc, .m, and .mm + compilations.""" + # This functions (and the similar ones below) do not offer complete + # emulation of all xcode_settings keys. They're implemented on demand. + + self.configname = configname + cflags = [] + + sdk_root = self._SdkPath() + if 'SDKROOT' in self._Settings(): + cflags.append('-isysroot %s' % sdk_root) + + if self._Test('GCC_CHAR_IS_UNSIGNED_CHAR', 'YES', default='NO'): + cflags.append('-funsigned-char') + + if self._Test('GCC_CW_ASM_SYNTAX', 'YES', default='YES'): + cflags.append('-fasm-blocks') + + if 'GCC_DYNAMIC_NO_PIC' in self._Settings(): + if self._Settings()['GCC_DYNAMIC_NO_PIC'] == 'YES': + cflags.append('-mdynamic-no-pic') + else: + pass + # TODO: In this case, it depends on the target. xcode passes + # mdynamic-no-pic by default for executable and possibly static lib + # according to mento + + if self._Test('GCC_ENABLE_PASCAL_STRINGS', 'YES', default='YES'): + cflags.append('-mpascal-strings') + + self._Appendf(cflags, 'GCC_OPTIMIZATION_LEVEL', '-O%s', default='s') + + if self._Test('GCC_GENERATE_DEBUGGING_SYMBOLS', 'YES', default='YES'): + dbg_format = self._Settings().get('DEBUG_INFORMATION_FORMAT', 'dwarf') + if dbg_format == 'dwarf': + cflags.append('-gdwarf-2') + elif dbg_format == 'stabs': + raise NotImplementedError('stabs debug format is not supported yet.') + elif dbg_format == 'dwarf-with-dsym': + cflags.append('-gdwarf-2') + else: + raise NotImplementedError('Unknown debug format %s' % dbg_format) + + if self._Test('GCC_SYMBOLS_PRIVATE_EXTERN', 'YES', default='NO'): + cflags.append('-fvisibility=hidden') + + if self._Test('GCC_TREAT_WARNINGS_AS_ERRORS', 'YES', default='NO'): + cflags.append('-Werror') + + if self._Test('GCC_WARN_ABOUT_MISSING_NEWLINE', 'YES', default='NO'): + cflags.append('-Wnewline-eof') + + self._Appendf(cflags, 'MACOSX_DEPLOYMENT_TARGET', '-mmacosx-version-min=%s') + + # TODO: + if self._Test('COPY_PHASE_STRIP', 'YES', default='NO'): + self._WarnUnimplemented('COPY_PHASE_STRIP') + self._WarnUnimplemented('GCC_DEBUGGING_SYMBOLS') + self._WarnUnimplemented('GCC_ENABLE_OBJC_EXCEPTIONS') + + # TODO: This is exported correctly, but assigning to it is not supported. + self._WarnUnimplemented('MACH_O_TYPE') + self._WarnUnimplemented('PRODUCT_TYPE') + + archs = self._Settings().get('ARCHS', ['i386']) + if len(archs) != 1: + # TODO: Supporting fat binaries will be annoying. + self._WarnUnimplemented('ARCHS') + archs = ['i386'] + cflags.append('-arch ' + archs[0]) + + if archs[0] in ('i386', 'x86_64'): + if self._Test('GCC_ENABLE_SSE3_EXTENSIONS', 'YES', default='NO'): + cflags.append('-msse3') + if self._Test('GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS', 'YES', + default='NO'): + cflags.append('-mssse3') # Note 3rd 's'. + if self._Test('GCC_ENABLE_SSE41_EXTENSIONS', 'YES', default='NO'): + cflags.append('-msse4.1') + if self._Test('GCC_ENABLE_SSE42_EXTENSIONS', 'YES', default='NO'): + cflags.append('-msse4.2') + + cflags += self._Settings().get('WARNING_CFLAGS', []) + + config = self.spec['configurations'][self.configname] + framework_dirs = config.get('mac_framework_dirs', []) + for directory in framework_dirs: + cflags.append('-F ' + directory.replace('$(SDKROOT)', sdk_root)) + + self.configname = None + return cflags + + def GetCflagsC(self, configname): + """Returns flags that need to be added to .c, and .m compilations.""" + self.configname = configname + cflags_c = [] + self._Appendf(cflags_c, 'GCC_C_LANGUAGE_STANDARD', '-std=%s') + cflags_c += self._Settings().get('OTHER_CFLAGS', []) + self.configname = None + return cflags_c + + def GetCflagsCC(self, configname): + """Returns flags that need to be added to .cc, and .mm compilations.""" + self.configname = configname + cflags_cc = [] + if self._Test('GCC_ENABLE_CPP_RTTI', 'NO', default='YES'): + cflags_cc.append('-fno-rtti') + if self._Test('GCC_ENABLE_CPP_EXCEPTIONS', 'NO', default='YES'): + cflags_cc.append('-fno-exceptions') + if self._Test('GCC_INLINES_ARE_PRIVATE_EXTERN', 'YES', default='NO'): + cflags_cc.append('-fvisibility-inlines-hidden') + if self._Test('GCC_THREADSAFE_STATICS', 'NO', default='YES'): + cflags_cc.append('-fno-threadsafe-statics') + if self._Test('GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO', 'NO', default='YES'): + cflags_cc.append('-Wno-invalid-offsetof') + + other_ccflags = [] + + for flag in self._Settings().get('OTHER_CPLUSPLUSFLAGS', ['$(inherited)']): + # TODO: More general variable expansion. Missing in many other places too. + if flag in ('$inherited', '$(inherited)', '${inherited}'): + flag = '$OTHER_CFLAGS' + if flag in ('$OTHER_CFLAGS', '$(OTHER_CFLAGS)', '${OTHER_CFLAGS}'): + other_ccflags += self._Settings().get('OTHER_CFLAGS', []) + else: + other_ccflags.append(flag) + cflags_cc += other_ccflags + + self.configname = None + return cflags_cc + + def _AddObjectiveCGarbageCollectionFlags(self, flags): + gc_policy = self._Settings().get('GCC_ENABLE_OBJC_GC', 'unsupported') + if gc_policy == 'supported': + flags.append('-fobjc-gc') + elif gc_policy == 'required': + flags.append('-fobjc-gc-only') + + def GetCflagsObjC(self, configname): + """Returns flags that need to be added to .m compilations.""" + self.configname = configname + cflags_objc = [] + + self._AddObjectiveCGarbageCollectionFlags(cflags_objc) + + self.configname = None + return cflags_objc + + def GetCflagsObjCC(self, configname): + """Returns flags that need to be added to .mm compilations.""" + self.configname = configname + cflags_objcc = [] + self._AddObjectiveCGarbageCollectionFlags(cflags_objcc) + if self._Test('GCC_OBJC_CALL_CXX_CDTORS', 'YES', default='NO'): + cflags_objcc.append('-fobjc-call-cxx-cdtors') + self.configname = None + return cflags_objcc + + def GetInstallNameBase(self): + """Return DYLIB_INSTALL_NAME_BASE for this target.""" + # Xcode sets this for shared_libraries, and for nonbundled loadable_modules. + if (self.spec['type'] != 'shared_library' and + (self.spec['type'] != 'loadable_module' or self._IsBundle())): + return None + install_base = self.GetPerTargetSetting( + 'DYLIB_INSTALL_NAME_BASE', + default='/Library/Frameworks' if self._IsBundle() else '/usr/local/lib') + return install_base + + def _StandardizePath(self, path): + """Do :standardizepath processing for path.""" + # I'm not quite sure what :standardizepath does. Just call normpath(), + # but don't let @executable_path/../foo collapse to foo. + if '/' in path: + prefix, rest = '', path + if path.startswith('@'): + prefix, rest = path.split('/', 1) + rest = os.path.normpath(rest) # :standardizepath + path = os.path.join(prefix, rest) + return path + + def GetInstallName(self): + """Return LD_DYLIB_INSTALL_NAME for this target.""" + # Xcode sets this for shared_libraries, and for nonbundled loadable_modules. + if (self.spec['type'] != 'shared_library' and + (self.spec['type'] != 'loadable_module' or self._IsBundle())): + return None + + default_install_name = \ + '$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)' + install_name = self.GetPerTargetSetting( + 'LD_DYLIB_INSTALL_NAME', default=default_install_name) + + # Hardcode support for the variables used in chromium for now, to + # unblock people using the make build. + if '$' in install_name: + assert install_name in ('$(DYLIB_INSTALL_NAME_BASE:standardizepath)/' + '$(WRAPPER_NAME)/$(PRODUCT_NAME)', default_install_name), ( + 'Variables in LD_DYLIB_INSTALL_NAME are not generally supported ' + 'yet in target \'%s\' (got \'%s\')' % + (self.spec['target_name'], install_name)) + + install_name = install_name.replace( + '$(DYLIB_INSTALL_NAME_BASE:standardizepath)', + self._StandardizePath(self.GetInstallNameBase())) + if self._IsBundle(): + # These are only valid for bundles, hence the |if|. + install_name = install_name.replace( + '$(WRAPPER_NAME)', self.GetWrapperName()) + install_name = install_name.replace( + '$(PRODUCT_NAME)', self.GetProductName()) + else: + assert '$(WRAPPER_NAME)' not in install_name + assert '$(PRODUCT_NAME)' not in install_name + + install_name = install_name.replace( + '$(EXECUTABLE_PATH)', self.GetExecutablePath()) + return install_name + + def _MapLinkerFlagFilename(self, ldflag, gyp_to_build_path): + """Checks if ldflag contains a filename and if so remaps it from + gyp-directory-relative to build-directory-relative.""" + # This list is expanded on demand. + # They get matched as: + # -exported_symbols_list file + # -Wl,exported_symbols_list file + # -Wl,exported_symbols_list,file + LINKER_FILE = '(\S+)' + WORD = '\S+' + linker_flags = [ + ['-exported_symbols_list', LINKER_FILE], # Needed for NaCl. + ['-unexported_symbols_list', LINKER_FILE], + ['-reexported_symbols_list', LINKER_FILE], + ['-sectcreate', WORD, WORD, LINKER_FILE], # Needed for remoting. + ] + for flag_pattern in linker_flags: + regex = re.compile('(?:-Wl,)?' + '[ ,]'.join(flag_pattern)) + m = regex.match(ldflag) + if m: + ldflag = ldflag[:m.start(1)] + gyp_to_build_path(m.group(1)) + \ + ldflag[m.end(1):] + # Required for ffmpeg (no idea why they don't use LIBRARY_SEARCH_PATHS, + # TODO(thakis): Update ffmpeg.gyp): + if ldflag.startswith('-L'): + ldflag = '-L' + gyp_to_build_path(ldflag[len('-L'):]) + return ldflag + + def GetLdflags(self, configname, product_dir, gyp_to_build_path): + """Returns flags that need to be passed to the linker. + + Args: + configname: The name of the configuration to get ld flags for. + product_dir: The directory where products such static and dynamic + libraries are placed. This is added to the library search path. + gyp_to_build_path: A function that converts paths relative to the + current gyp file to paths relative to the build direcotry. + """ + self.configname = configname + ldflags = [] + + # The xcode build is relative to a gyp file's directory, and OTHER_LDFLAGS + # can contain entries that depend on this. Explicitly absolutify these. + for ldflag in self._Settings().get('OTHER_LDFLAGS', []): + ldflags.append(self._MapLinkerFlagFilename(ldflag, gyp_to_build_path)) + + if self._Test('DEAD_CODE_STRIPPING', 'YES', default='NO'): + ldflags.append('-Wl,-dead_strip') + + if self._Test('PREBINDING', 'YES', default='NO'): + ldflags.append('-Wl,-prebind') + + self._Appendf( + ldflags, 'DYLIB_COMPATIBILITY_VERSION', '-compatibility_version %s') + self._Appendf( + ldflags, 'DYLIB_CURRENT_VERSION', '-current_version %s') + self._Appendf( + ldflags, 'MACOSX_DEPLOYMENT_TARGET', '-mmacosx-version-min=%s') + if 'SDKROOT' in self._Settings(): + ldflags.append('-isysroot ' + self._SdkPath()) + + for library_path in self._Settings().get('LIBRARY_SEARCH_PATHS', []): + ldflags.append('-L' + gyp_to_build_path(library_path)) + + if 'ORDER_FILE' in self._Settings(): + ldflags.append('-Wl,-order_file ' + + '-Wl,' + gyp_to_build_path( + self._Settings()['ORDER_FILE'])) + + archs = self._Settings().get('ARCHS', ['i386']) + if len(archs) != 1: + # TODO: Supporting fat binaries will be annoying. + self._WarnUnimplemented('ARCHS') + archs = ['i386'] + ldflags.append('-arch ' + archs[0]) + + # Xcode adds the product directory by default. + ldflags.append('-L' + product_dir) + + install_name = self.GetInstallName() + if install_name: + ldflags.append('-install_name ' + install_name.replace(' ', r'\ ')) + + for rpath in self._Settings().get('LD_RUNPATH_SEARCH_PATHS', []): + ldflags.append('-Wl,-rpath,' + rpath) + + self.configname = None + return ldflags + + def GetPerTargetSettings(self): + """Gets a list of all the per-target settings. This will only fetch keys + whose values are the same across all configurations.""" + first_pass = True + result = {} + for configname in sorted(self.xcode_settings.keys()): + if first_pass: + result = dict(self.xcode_settings[configname]) + first_pass = False + else: + for key, value in self.xcode_settings[configname].iteritems(): + if key not in result: + continue + elif result[key] != value: + del result[key] + return result + + def GetPerTargetSetting(self, setting, default=None): + """Tries to get xcode_settings.setting from spec. Assumes that the setting + has the same value in all configurations and throws otherwise.""" + first_pass = True + result = None + for configname in sorted(self.xcode_settings.keys()): + if first_pass: + result = self.xcode_settings[configname].get(setting, None) + first_pass = False + else: + assert result == self.xcode_settings[configname].get(setting, None), ( + "Expected per-target setting for '%s', got per-config setting " + "(target %s)" % (setting, spec['target_name'])) + if result is None: + return default + return result + + def _GetStripPostbuilds(self, configname, output_binary, quiet): + """Returns a list of shell commands that contain the shell commands + neccessary to strip this target's binary. These should be run as postbuilds + before the actual postbuilds run.""" + self.configname = configname + + result = [] + if (self._Test('DEPLOYMENT_POSTPROCESSING', 'YES', default='NO') and + self._Test('STRIP_INSTALLED_PRODUCT', 'YES', default='NO')): + + default_strip_style = 'debugging' + if self._IsBundle(): + default_strip_style = 'non-global' + elif self.spec['type'] == 'executable': + default_strip_style = 'all' + + strip_style = self._Settings().get('STRIP_STYLE', default_strip_style) + strip_flags = { + 'all': '', + 'non-global': '-x', + 'debugging': '-S', + }[strip_style] + + explicit_strip_flags = self._Settings().get('STRIPFLAGS', '') + if explicit_strip_flags: + strip_flags += ' ' + _NormalizeEnvVarReferences(explicit_strip_flags) + + if not quiet: + result.append('echo STRIP\\(%s\\)' % self.spec['target_name']) + result.append('strip %s %s' % (strip_flags, output_binary)) + + self.configname = None + return result + + def _GetDebugInfoPostbuilds(self, configname, output, output_binary, quiet): + """Returns a list of shell commands that contain the shell commands + neccessary to massage this target's debug information. These should be run + as postbuilds before the actual postbuilds run.""" + self.configname = configname + + # For static libraries, no dSYMs are created. + result = [] + if (self._Test('GCC_GENERATE_DEBUGGING_SYMBOLS', 'YES', default='YES') and + self._Test( + 'DEBUG_INFORMATION_FORMAT', 'dwarf-with-dsym', default='dwarf') and + self.spec['type'] != 'static_library'): + if not quiet: + result.append('echo DSYMUTIL\\(%s\\)' % self.spec['target_name']) + result.append('dsymutil %s -o %s' % (output_binary, output + '.dSYM')) + + self.configname = None + return result + + def GetTargetPostbuilds(self, configname, output, output_binary, quiet=False): + """Returns a list of shell commands that contain the shell commands + to run as postbuilds for this target, before the actual postbuilds.""" + # dSYMs need to build before stripping happens. + return ( + self._GetDebugInfoPostbuilds(configname, output, output_binary, quiet) + + self._GetStripPostbuilds(configname, output_binary, quiet)) + + def _AdjustLibrary(self, library): + if library.endswith('.framework'): + l = '-framework ' + os.path.splitext(os.path.basename(library))[0] + else: + m = self.library_re.match(library) + if m: + l = '-l' + m.group(1) + else: + l = library + return l.replace('$(SDKROOT)', self._SdkPath()) + + def AdjustLibraries(self, libraries): + """Transforms entries like 'Cocoa.framework' in libraries into entries like + '-framework Cocoa', 'libcrypto.dylib' into '-lcrypto', etc. + """ + libraries = [ self._AdjustLibrary(library) for library in libraries] + return libraries + + +class MacPrefixHeader(object): + """A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature. + + This feature consists of several pieces: + * If GCC_PREFIX_HEADER is present, all compilations in that project get an + additional |-include path_to_prefix_header| cflag. + * If GCC_PRECOMPILE_PREFIX_HEADER is present too, then the prefix header is + instead compiled, and all other compilations in the project get an + additional |-include path_to_compiled_header| instead. + + Compiled prefix headers have the extension gch. There is one gch file for + every language used in the project (c, cc, m, mm), since gch files for + different languages aren't compatible. + + gch files themselves are built with the target's normal cflags, but they + obviously don't get the |-include| flag. Instead, they need a -x flag that + describes their language. + + All o files in the target need to depend on the gch file, to make sure + it's built before any o file is built. + + This class helps with some of these tasks, but it needs help from the build + system for writing dependencies to the gch files, for writing build commands + for the gch files, and for figuring out the location of the gch files. + """ + def __init__(self, xcode_settings, + gyp_path_to_build_path, gyp_path_to_build_output): + """If xcode_settings is None, all methods on this class are no-ops. + + Args: + gyp_path_to_build_path: A function that takes a gyp-relative path, + and returns a path relative to the build directory. + gyp_path_to_build_output: A function that takes a gyp-relative path and + a language code ('c', 'cc', 'm', or 'mm'), and that returns a path + to where the output of precompiling that path for that language + should be placed (without the trailing '.gch'). + """ + # This doesn't support per-configuration prefix headers. Good enough + # for now. + self.header = None + self.compile_headers = False + if xcode_settings: + self.header = xcode_settings.GetPerTargetSetting('GCC_PREFIX_HEADER') + self.compile_headers = xcode_settings.GetPerTargetSetting( + 'GCC_PRECOMPILE_PREFIX_HEADER', default='NO') != 'NO' + self.compiled_headers = {} + if self.header: + if self.compile_headers: + for lang in ['c', 'cc', 'm', 'mm']: + self.compiled_headers[lang] = gyp_path_to_build_output( + self.header, lang) + self.header = gyp_path_to_build_path(self.header) + + def GetInclude(self, lang): + """Gets the cflags to include the prefix header for language |lang|.""" + if self.compile_headers and lang in self.compiled_headers: + return '-include %s' % self.compiled_headers[lang] + elif self.header: + return '-include %s' % self.header + else: + return '' + + def _Gch(self, lang): + """Returns the actual file name of the prefix header for language |lang|.""" + assert self.compile_headers + return self.compiled_headers[lang] + '.gch' + + def GetObjDependencies(self, sources, objs): + """Given a list of source files and the corresponding object files, returns + a list of (source, object, gch) tuples, where |gch| is the build-directory + relative path to the gch file each object file depends on. |compilable[i]| + has to be the source file belonging to |objs[i]|.""" + if not self.header or not self.compile_headers: + return [] + + result = [] + for source, obj in zip(sources, objs): + ext = os.path.splitext(source)[1] + lang = { + '.c': 'c', + '.cpp': 'cc', '.cc': 'cc', '.cxx': 'cc', + '.m': 'm', + '.mm': 'mm', + }.get(ext, None) + if lang: + result.append((source, obj, self._Gch(lang))) + return result + + def GetPchBuildCommands(self): + """Returns [(path_to_gch, language_flag, language, header)]. + |path_to_gch| and |header| are relative to the build directory. + """ + if not self.header or not self.compile_headers: + return [] + return [ + (self._Gch('c'), '-x c-header', 'c', self.header), + (self._Gch('cc'), '-x c++-header', 'cc', self.header), + (self._Gch('m'), '-x objective-c-header', 'm', self.header), + (self._Gch('mm'), '-x objective-c++-header', 'mm', self.header), + ] + + +def MergeGlobalXcodeSettingsToSpec(global_dict, spec): + """Merges the global xcode_settings dictionary into each configuration of the + target represented by spec. For keys that are both in the global and the local + xcode_settings dict, the local key gets precendence. + """ + # The xcode generator special-cases global xcode_settings and does something + # that amounts to merging in the global xcode_settings into each local + # xcode_settings dict. + global_xcode_settings = global_dict.get('xcode_settings', {}) + for config in spec['configurations'].values(): + if 'xcode_settings' in config: + new_settings = global_xcode_settings.copy() + new_settings.update(config['xcode_settings']) + config['xcode_settings'] = new_settings + + +def IsMacBundle(flavor, spec): + """Returns if |spec| should be treated as a bundle. + + Bundles are directories with a certain subdirectory structure, instead of + just a single file. Bundle rules do not produce a binary but also package + resources into that directory.""" + is_mac_bundle = (int(spec.get('mac_bundle', 0)) != 0 and flavor == 'mac') + if is_mac_bundle: + assert spec['type'] != 'none', ( + 'mac_bundle targets cannot have type none (target "%s")' % + spec['target_name']) + return is_mac_bundle + + +def GetMacBundleResources(product_dir, xcode_settings, resources): + """Yields (output, resource) pairs for every resource in |resources|. + Only call this for mac bundle targets. + + Args: + product_dir: Path to the directory containing the output bundle, + relative to the build directory. + xcode_settings: The XcodeSettings of the current target. + resources: A list of bundle resources, relative to the build directory. + """ + dest = os.path.join(product_dir, + xcode_settings.GetBundleResourceFolder()) + for res in resources: + output = dest + + # The make generator doesn't support it, so forbid it everywhere + # to keep the generators more interchangable. + assert ' ' not in res, ( + "Spaces in resource filenames not supported (%s)" % res) + + # Split into (path,file). + res_parts = os.path.split(res) + + # Now split the path into (prefix,maybe.lproj). + lproj_parts = os.path.split(res_parts[0]) + # If the resource lives in a .lproj bundle, add that to the destination. + if lproj_parts[1].endswith('.lproj'): + output = os.path.join(output, lproj_parts[1]) + + output = os.path.join(output, res_parts[1]) + # Compiled XIB files are referred to by .nib. + if output.endswith('.xib'): + output = output[0:-3] + 'nib' + + yield output, res + + +def GetMacInfoPlist(product_dir, xcode_settings, gyp_path_to_build_path): + """Returns (info_plist, dest_plist, defines, extra_env), where: + * |info_plist| is the sourc plist path, relative to the + build directory, + * |dest_plist| is the destination plist path, relative to the + build directory, + * |defines| is a list of preprocessor defines (empty if the plist + shouldn't be preprocessed, + * |extra_env| is a dict of env variables that should be exported when + invoking |mac_tool copy-info-plist|. + + Only call this for mac bundle targets. + + Args: + product_dir: Path to the directory containing the output bundle, + relative to the build directory. + xcode_settings: The XcodeSettings of the current target. + gyp_to_build_path: A function that converts paths relative to the + current gyp file to paths relative to the build direcotry. + """ + info_plist = xcode_settings.GetPerTargetSetting('INFOPLIST_FILE') + if not info_plist: + return None, None, [], {} + + # The make generator doesn't support it, so forbid it everywhere + # to keep the generators more interchangable. + assert ' ' not in info_plist, ( + "Spaces in Info.plist filenames not supported (%s)" % info_plist) + + info_plist = gyp_path_to_build_path(info_plist) + + # If explicitly set to preprocess the plist, invoke the C preprocessor and + # specify any defines as -D flags. + if xcode_settings.GetPerTargetSetting( + 'INFOPLIST_PREPROCESS', default='NO') == 'YES': + # Create an intermediate file based on the path. + defines = shlex.split(xcode_settings.GetPerTargetSetting( + 'INFOPLIST_PREPROCESSOR_DEFINITIONS', default='')) + else: + defines = [] + + dest_plist = os.path.join(product_dir, xcode_settings.GetBundlePlistPath()) + extra_env = xcode_settings.GetPerTargetSettings() + + return info_plist, dest_plist, defines, extra_env + + +def _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration, + additional_settings=None): + """Return the environment variables that Xcode would set. See + http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW153 + for a full list. + + Args: + xcode_settings: An XcodeSettings object. If this is None, this function + returns an empty dict. + built_products_dir: Absolute path to the built products dir. + srcroot: Absolute path to the source root. + configuration: The build configuration name. + additional_settings: An optional dict with more values to add to the + result. + """ + if not xcode_settings: return {} + + # This function is considered a friend of XcodeSettings, so let it reach into + # its implementation details. + spec = xcode_settings.spec + + # These are filled in on a as-needed basis. + env = { + 'BUILT_PRODUCTS_DIR' : built_products_dir, + 'CONFIGURATION' : configuration, + 'PRODUCT_NAME' : xcode_settings.GetProductName(), + # See /Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Specifications/MacOSX\ Product\ Types.xcspec for FULL_PRODUCT_NAME + 'SRCROOT' : srcroot, + 'SOURCE_ROOT': '${SRCROOT}', + # This is not true for static libraries, but currently the env is only + # written for bundles: + 'TARGET_BUILD_DIR' : built_products_dir, + 'TEMP_DIR' : '${TMPDIR}', + } + if spec['type'] in ( + 'executable', 'static_library', 'shared_library', 'loadable_module'): + env['EXECUTABLE_NAME'] = xcode_settings.GetExecutableName() + env['EXECUTABLE_PATH'] = xcode_settings.GetExecutablePath() + env['FULL_PRODUCT_NAME'] = xcode_settings.GetFullProductName() + mach_o_type = xcode_settings.GetMachOType() + if mach_o_type: + env['MACH_O_TYPE'] = mach_o_type + env['PRODUCT_TYPE'] = xcode_settings.GetProductType() + if xcode_settings._IsBundle(): + env['CONTENTS_FOLDER_PATH'] = \ + xcode_settings.GetBundleContentsFolderPath() + env['UNLOCALIZED_RESOURCES_FOLDER_PATH'] = \ + xcode_settings.GetBundleResourceFolder() + env['INFOPLIST_PATH'] = xcode_settings.GetBundlePlistPath() + env['WRAPPER_NAME'] = xcode_settings.GetWrapperName() + + install_name = xcode_settings.GetInstallName() + if install_name: + env['LD_DYLIB_INSTALL_NAME'] = install_name + install_name_base = xcode_settings.GetInstallNameBase() + if install_name_base: + env['DYLIB_INSTALL_NAME_BASE'] = install_name_base + + if not additional_settings: + additional_settings = {} + else: + # Flatten lists to strings. + for k in additional_settings: + if not isinstance(additional_settings[k], str): + additional_settings[k] = ' '.join(additional_settings[k]) + additional_settings.update(env) + + for k in additional_settings: + additional_settings[k] = _NormalizeEnvVarReferences(additional_settings[k]) + + return additional_settings + + +def _NormalizeEnvVarReferences(str): + """Takes a string containing variable references in the form ${FOO}, $(FOO), + or $FOO, and returns a string with all variable references in the form ${FOO}. + """ + # $FOO -> ${FOO} + str = re.sub(r'\$([a-zA-Z_][a-zA-Z0-9_]*)', r'${\1}', str) + + # $(FOO) -> ${FOO} + matches = re.findall(r'(\$\(([a-zA-Z0-9\-_]+)\))', str) + for match in matches: + to_replace, variable = match + assert '$(' not in match, '$($(FOO)) variables not supported: ' + match + str = str.replace(to_replace, '${' + variable + '}') + + return str + + +def ExpandEnvVars(string, expansions): + """Expands ${VARIABLES}, $(VARIABLES), and $VARIABLES in string per the + expansions list. If the variable expands to something that references + another variable, this variable is expanded as well if it's in env -- + until no variables present in env are left.""" + for k, v in reversed(expansions): + string = string.replace('${' + k + '}', v) + string = string.replace('$(' + k + ')', v) + string = string.replace('$' + k, v) + return string + + +def _TopologicallySortedEnvVarKeys(env): + """Takes a dict |env| whose values are strings that can refer to other keys, + for example env['foo'] = '$(bar) and $(baz)'. Returns a list L of all keys of + env such that key2 is after key1 in L if env[key2] refers to env[key1]. + + Throws an Exception in case of dependency cycles. + """ + # Since environment variables can refer to other variables, the evaluation + # order is important. Below is the logic to compute the dependency graph + # and sort it. + regex = re.compile(r'\$\{([a-zA-Z0-9\-_]+)\}') + def GetEdges(node): + # Use a definition of edges such that user_of_variable -> used_varible. + # This happens to be easier in this case, since a variable's + # definition contains all variables it references in a single string. + # We can then reverse the result of the topological sort at the end. + # Since: reverse(topsort(DAG)) = topsort(reverse_edges(DAG)) + matches = set([v for v in regex.findall(env[node]) if v in env]) + for dependee in matches: + assert '${' not in dependee, 'Nested variables not supported: ' + dependee + return matches + + try: + # Topologically sort, and then reverse, because we used an edge definition + # that's inverted from the expected result of this function (see comment + # above). + order = gyp.common.TopologicallySorted(env.keys(), GetEdges) + order.reverse() + return order + except gyp.common.CycleError, e: + raise Exception( + 'Xcode environment variables are cyclically dependent: ' + str(e.nodes)) + + +def GetSortedXcodeEnv(xcode_settings, built_products_dir, srcroot, + configuration, additional_settings=None): + env = _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration, + additional_settings) + return [(key, env[key]) for key in _TopologicallySortedEnvVarKeys(env)] + + +def GetSpecPostbuildCommands(spec, quiet=False): + """Returns the list of postbuilds explicitly defined on |spec|, in a form + executable by a shell.""" + postbuilds = [] + for postbuild in spec.get('postbuilds', []): + if not quiet: + postbuilds.append('echo POSTBUILD\\(%s\\) %s' % ( + spec['target_name'], postbuild['postbuild_name'])) + postbuilds.append(gyp.common.EncodePOSIXShellList(postbuild['action'])) + return postbuilds diff --git a/tools/gyp/pylib/gyp/xcodeproj_file.py b/tools/gyp/pylib/gyp/xcodeproj_file.py new file mode 100644 index 000000000..403407a41 --- /dev/null +++ b/tools/gyp/pylib/gyp/xcodeproj_file.py @@ -0,0 +1,2836 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Xcode project file generator. + +This module is both an Xcode project file generator and a documentation of the +Xcode project file format. Knowledge of the project file format was gained +based on extensive experience with Xcode, and by making changes to projects in +Xcode.app and observing the resultant changes in the associated project files. + +XCODE PROJECT FILES + +The generator targets the file format as written by Xcode 3.2 (specifically, +3.2.6), but past experience has taught that the format has not changed +significantly in the past several years, and future versions of Xcode are able +to read older project files. + +Xcode project files are "bundled": the project "file" from an end-user's +perspective is actually a directory with an ".xcodeproj" extension. The +project file from this module's perspective is actually a file inside this +directory, always named "project.pbxproj". This file contains a complete +description of the project and is all that is needed to use the xcodeproj. +Other files contained in the xcodeproj directory are simply used to store +per-user settings, such as the state of various UI elements in the Xcode +application. + +The project.pbxproj file is a property list, stored in a format almost +identical to the NeXTstep property list format. The file is able to carry +Unicode data, and is encoded in UTF-8. The root element in the property list +is a dictionary that contains several properties of minimal interest, and two +properties of immense interest. The most important property is a dictionary +named "objects". The entire structure of the project is represented by the +children of this property. The objects dictionary is keyed by unique 96-bit +values represented by 24 uppercase hexadecimal characters. Each value in the +objects dictionary is itself a dictionary, describing an individual object. + +Each object in the dictionary is a member of a class, which is identified by +the "isa" property of each object. A variety of classes are represented in a +project file. Objects can refer to other objects by ID, using the 24-character +hexadecimal object key. A project's objects form a tree, with a root object +of class PBXProject at the root. As an example, the PBXProject object serves +as parent to an XCConfigurationList object defining the build configurations +used in the project, a PBXGroup object serving as a container for all files +referenced in the project, and a list of target objects, each of which defines +a target in the project. There are several different types of target object, +such as PBXNativeTarget and PBXAggregateTarget. In this module, this +relationship is expressed by having each target type derive from an abstract +base named XCTarget. + +The project.pbxproj file's root dictionary also contains a property, sibling to +the "objects" dictionary, named "rootObject". The value of rootObject is a +24-character object key referring to the root PBXProject object in the +objects dictionary. + +In Xcode, every file used as input to a target or produced as a final product +of a target must appear somewhere in the hierarchy rooted at the PBXGroup +object referenced by the PBXProject's mainGroup property. A PBXGroup is +generally represented as a folder in the Xcode application. PBXGroups can +contain other PBXGroups as well as PBXFileReferences, which are pointers to +actual files. + +Each XCTarget contains a list of build phases, represented in this module by +the abstract base XCBuildPhase. Examples of concrete XCBuildPhase derivations +are PBXSourcesBuildPhase and PBXFrameworksBuildPhase, which correspond to the +"Compile Sources" and "Link Binary With Libraries" phases displayed in the +Xcode application. Files used as input to these phases (for example, source +files in the former case and libraries and frameworks in the latter) are +represented by PBXBuildFile objects, referenced by elements of "files" lists +in XCTarget objects. Each PBXBuildFile object refers to a PBXBuildFile +object as a "weak" reference: it does not "own" the PBXBuildFile, which is +owned by the root object's mainGroup or a descendant group. In most cases, the +layer of indirection between an XCBuildPhase and a PBXFileReference via a +PBXBuildFile appears extraneous, but there's actually one reason for this: +file-specific compiler flags are added to the PBXBuildFile object so as to +allow a single file to be a member of multiple targets while having distinct +compiler flags for each. These flags can be modified in the Xcode applciation +in the "Build" tab of a File Info window. + +When a project is open in the Xcode application, Xcode will rewrite it. As +such, this module is careful to adhere to the formatting used by Xcode, to +avoid insignificant changes appearing in the file when it is used in the +Xcode application. This will keep version control repositories happy, and +makes it possible to compare a project file used in Xcode to one generated by +this module to determine if any significant changes were made in the +application. + +Xcode has its own way of assigning 24-character identifiers to each object, +which is not duplicated here. Because the identifier only is only generated +once, when an object is created, and is then left unchanged, there is no need +to attempt to duplicate Xcode's behavior in this area. The generator is free +to select any identifier, even at random, to refer to the objects it creates, +and Xcode will retain those identifiers and use them when subsequently +rewriting the project file. However, the generator would choose new random +identifiers each time the project files are generated, leading to difficulties +comparing "used" project files to "pristine" ones produced by this module, +and causing the appearance of changes as every object identifier is changed +when updated projects are checked in to a version control repository. To +mitigate this problem, this module chooses identifiers in a more deterministic +way, by hashing a description of each object as well as its parent and ancestor +objects. This strategy should result in minimal "shift" in IDs as successive +generations of project files are produced. + +THIS MODULE + +This module introduces several classes, all derived from the XCObject class. +Nearly all of the "brains" are built into the XCObject class, which understands +how to create and modify objects, maintain the proper tree structure, compute +identifiers, and print objects. For the most part, classes derived from +XCObject need only provide a _schema class object, a dictionary that +expresses what properties objects of the class may contain. + +Given this structure, it's possible to build a minimal project file by creating +objects of the appropriate types and making the proper connections: + + config_list = XCConfigurationList() + group = PBXGroup() + project = PBXProject({'buildConfigurationList': config_list, + 'mainGroup': group}) + +With the project object set up, it can be added to an XCProjectFile object. +XCProjectFile is a pseudo-class in the sense that it is a concrete XCObject +subclass that does not actually correspond to a class type found in a project +file. Rather, it is used to represent the project file's root dictionary. +Printing an XCProjectFile will print the entire project file, including the +full "objects" dictionary. + + project_file = XCProjectFile({'rootObject': project}) + project_file.ComputeIDs() + project_file.Print() + +Xcode project files are always encoded in UTF-8. This module will accept +strings of either the str class or the unicode class. Strings of class str +are assumed to already be encoded in UTF-8. Obviously, if you're just using +ASCII, you won't encounter difficulties because ASCII is a UTF-8 subset. +Strings of class unicode are handled properly and encoded in UTF-8 when +a project file is output. +""" + +import gyp.common +import posixpath +import re +import struct +import sys + +# hashlib is supplied as of Python 2.5 as the replacement interface for sha +# and other secure hashes. In 2.6, sha is deprecated. Import hashlib if +# available, avoiding a deprecation warning under 2.6. Import sha otherwise, +# preserving 2.4 compatibility. +try: + import hashlib + _new_sha1 = hashlib.sha1 +except ImportError: + import sha + _new_sha1 = sha.new + + +# See XCObject._EncodeString. This pattern is used to determine when a string +# can be printed unquoted. Strings that match this pattern may be printed +# unquoted. Strings that do not match must be quoted and may be further +# transformed to be properly encoded. Note that this expression matches the +# characters listed with "+", for 1 or more occurrences: if a string is empty, +# it must not match this pattern, because it needs to be encoded as "". +_unquoted = re.compile('^[A-Za-z0-9$./_]+$') + +# Strings that match this pattern are quoted regardless of what _unquoted says. +# Oddly, Xcode will quote any string with a run of three or more underscores. +_quoted = re.compile('___') + +# This pattern should match any character that needs to be escaped by +# XCObject._EncodeString. See that function. +_escaped = re.compile('[\\\\"]|[^ -~]') + + +# Used by SourceTreeAndPathFromPath +_path_leading_variable = re.compile('^\$\((.*?)\)(/(.*))?$') + +def SourceTreeAndPathFromPath(input_path): + """Given input_path, returns a tuple with sourceTree and path values. + + Examples: + input_path (source_tree, output_path) + '$(VAR)/path' ('VAR', 'path') + '$(VAR)' ('VAR', None) + 'path' (None, 'path') + """ + + source_group_match = _path_leading_variable.match(input_path) + if source_group_match: + source_tree = source_group_match.group(1) + output_path = source_group_match.group(3) # This may be None. + else: + source_tree = None + output_path = input_path + + return (source_tree, output_path) + +def ConvertVariablesToShellSyntax(input_string): + return re.sub('\$\((.*?)\)', '${\\1}', input_string) + +class XCObject(object): + """The abstract base of all class types used in Xcode project files. + + Class variables: + _schema: A dictionary defining the properties of this class. The keys to + _schema are string property keys as used in project files. Values + are a list of four or five elements: + [ is_list, property_type, is_strong, is_required, default ] + is_list: True if the property described is a list, as opposed + to a single element. + property_type: The type to use as the value of the property, + or if is_list is True, the type to use for each + element of the value's list. property_type must + be an XCObject subclass, or one of the built-in + types str, int, or dict. + is_strong: If property_type is an XCObject subclass, is_strong + is True to assert that this class "owns," or serves + as parent, to the property value (or, if is_list is + True, values). is_strong must be False if + property_type is not an XCObject subclass. + is_required: True if the property is required for the class. + Note that is_required being True does not preclude + an empty string ("", in the case of property_type + str) or list ([], in the case of is_list True) from + being set for the property. + default: Optional. If is_requried is True, default may be set + to provide a default value for objects that do not supply + their own value. If is_required is True and default + is not provided, users of the class must supply their own + value for the property. + Note that although the values of the array are expressed in + boolean terms, subclasses provide values as integers to conserve + horizontal space. + _should_print_single_line: False in XCObject. Subclasses whose objects + should be written to the project file in the + alternate single-line format, such as + PBXFileReference and PBXBuildFile, should + set this to True. + _encode_transforms: Used by _EncodeString to encode unprintable characters. + The index into this list is the ordinal of the + character to transform; each value is a string + used to represent the character in the output. XCObject + provides an _encode_transforms list suitable for most + XCObject subclasses. + _alternate_encode_transforms: Provided for subclasses that wish to use + the alternate encoding rules. Xcode seems + to use these rules when printing objects in + single-line format. Subclasses that desire + this behavior should set _encode_transforms + to _alternate_encode_transforms. + _hashables: A list of XCObject subclasses that can be hashed by ComputeIDs + to construct this object's ID. Most classes that need custom + hashing behavior should do it by overriding Hashables, + but in some cases an object's parent may wish to push a + hashable value into its child, and it can do so by appending + to _hashables. + Attribues: + id: The object's identifier, a 24-character uppercase hexadecimal string. + Usually, objects being created should not set id until the entire + project file structure is built. At that point, UpdateIDs() should + be called on the root object to assign deterministic values for id to + each object in the tree. + parent: The object's parent. This is set by a parent XCObject when a child + object is added to it. + _properties: The object's property dictionary. An object's properties are + described by its class' _schema variable. + """ + + _schema = {} + _should_print_single_line = False + + # See _EncodeString. + _encode_transforms = [] + i = 0 + while i < ord(' '): + _encode_transforms.append('\\U%04x' % i) + i = i + 1 + _encode_transforms[7] = '\\a' + _encode_transforms[8] = '\\b' + _encode_transforms[9] = '\\t' + _encode_transforms[10] = '\\n' + _encode_transforms[11] = '\\v' + _encode_transforms[12] = '\\f' + _encode_transforms[13] = '\\n' + + _alternate_encode_transforms = list(_encode_transforms) + _alternate_encode_transforms[9] = chr(9) + _alternate_encode_transforms[10] = chr(10) + _alternate_encode_transforms[11] = chr(11) + + def __init__(self, properties=None, id=None, parent=None): + self.id = id + self.parent = parent + self._properties = {} + self._hashables = [] + self._SetDefaultsFromSchema() + self.UpdateProperties(properties) + + def __repr__(self): + try: + name = self.Name() + except NotImplementedError: + return '<%s at 0x%x>' % (self.__class__.__name__, id(self)) + return '<%s %r at 0x%x>' % (self.__class__.__name__, name, id(self)) + + def Copy(self): + """Make a copy of this object. + + The new object will have its own copy of lists and dicts. Any XCObject + objects owned by this object (marked "strong") will be copied in the + new object, even those found in lists. If this object has any weak + references to other XCObjects, the same references are added to the new + object without making a copy. + """ + + that = self.__class__(id=self.id, parent=self.parent) + for key, value in self._properties.iteritems(): + is_strong = self._schema[key][2] + + if isinstance(value, XCObject): + if is_strong: + new_value = value.Copy() + new_value.parent = that + that._properties[key] = new_value + else: + that._properties[key] = value + elif isinstance(value, str) or isinstance(value, unicode) or \ + isinstance(value, int): + that._properties[key] = value + elif isinstance(value, list): + if is_strong: + # If is_strong is True, each element is an XCObject, so it's safe to + # call Copy. + that._properties[key] = [] + for item in value: + new_item = item.Copy() + new_item.parent = that + that._properties[key].append(new_item) + else: + that._properties[key] = value[:] + elif isinstance(value, dict): + # dicts are never strong. + if is_strong: + raise TypeError, 'Strong dict for key ' + key + ' in ' + \ + self.__class__.__name__ + else: + that._properties[key] = value.copy() + else: + raise TypeError, 'Unexpected type ' + value.__class__.__name__ + \ + ' for key ' + key + ' in ' + self.__class__.__name__ + + return that + + def Name(self): + """Return the name corresponding to an object. + + Not all objects necessarily need to be nameable, and not all that do have + a "name" property. Override as needed. + """ + + # If the schema indicates that "name" is required, try to access the + # property even if it doesn't exist. This will result in a KeyError + # being raised for the property that should be present, which seems more + # appropriate than NotImplementedError in this case. + if 'name' in self._properties or \ + ('name' in self._schema and self._schema['name'][3]): + return self._properties['name'] + + raise NotImplementedError, \ + self.__class__.__name__ + ' must implement Name' + + def Comment(self): + """Return a comment string for the object. + + Most objects just use their name as the comment, but PBXProject uses + different values. + + The returned comment is not escaped and does not have any comment marker + strings applied to it. + """ + + return self.Name() + + def Hashables(self): + hashables = [self.__class__.__name__] + + name = self.Name() + if name != None: + hashables.append(name) + + hashables.extend(self._hashables) + + return hashables + + def ComputeIDs(self, recursive=True, overwrite=True, hash=None): + """Set "id" properties deterministically. + + An object's "id" property is set based on a hash of its class type and + name, as well as the class type and name of all ancestor objects. As + such, it is only advisable to call ComputeIDs once an entire project file + tree is built. + + If recursive is True, recurse into all descendant objects and update their + hashes. + + If overwrite is True, any existing value set in the "id" property will be + replaced. + """ + + def _HashUpdate(hash, data): + """Update hash with data's length and contents. + + If the hash were updated only with the value of data, it would be + possible for clowns to induce collisions by manipulating the names of + their objects. By adding the length, it's exceedingly less likely that + ID collisions will be encountered, intentionally or not. + """ + + hash.update(struct.pack('>i', len(data))) + hash.update(data) + + if hash is None: + hash = _new_sha1() + + hashables = self.Hashables() + assert len(hashables) > 0 + for hashable in hashables: + _HashUpdate(hash, hashable) + + if recursive: + for child in self.Children(): + child.ComputeIDs(recursive, overwrite, hash.copy()) + + if overwrite or self.id is None: + # Xcode IDs are only 96 bits (24 hex characters), but a SHA-1 digest is + # is 160 bits. Instead of throwing out 64 bits of the digest, xor them + # into the portion that gets used. + assert hash.digest_size % 4 == 0 + digest_int_count = hash.digest_size / 4 + digest_ints = struct.unpack('>' + 'I' * digest_int_count, hash.digest()) + id_ints = [0, 0, 0] + for index in xrange(0, digest_int_count): + id_ints[index % 3] ^= digest_ints[index] + self.id = '%08X%08X%08X' % tuple(id_ints) + + def EnsureNoIDCollisions(self): + """Verifies that no two objects have the same ID. Checks all descendants. + """ + + ids = {} + descendants = self.Descendants() + for descendant in descendants: + if descendant.id in ids: + other = ids[descendant.id] + raise KeyError, \ + 'Duplicate ID %s, objects "%s" and "%s" in "%s"' % \ + (descendant.id, str(descendant._properties), + str(other._properties), self._properties['rootObject'].Name()) + ids[descendant.id] = descendant + + def Children(self): + """Returns a list of all of this object's owned (strong) children.""" + + children = [] + for property, attributes in self._schema.iteritems(): + (is_list, property_type, is_strong) = attributes[0:3] + if is_strong and property in self._properties: + if not is_list: + children.append(self._properties[property]) + else: + children.extend(self._properties[property]) + return children + + def Descendants(self): + """Returns a list of all of this object's descendants, including this + object. + """ + + children = self.Children() + descendants = [self] + for child in children: + descendants.extend(child.Descendants()) + return descendants + + def PBXProjectAncestor(self): + # The base case for recursion is defined at PBXProject.PBXProjectAncestor. + if self.parent: + return self.parent.PBXProjectAncestor() + return None + + def _EncodeComment(self, comment): + """Encodes a comment to be placed in the project file output, mimicing + Xcode behavior. + """ + + # This mimics Xcode behavior by wrapping the comment in "/*" and "*/". If + # the string already contains a "*/", it is turned into "(*)/". This keeps + # the file writer from outputting something that would be treated as the + # end of a comment in the middle of something intended to be entirely a + # comment. + + return '/* ' + comment.replace('*/', '(*)/') + ' */' + + def _EncodeTransform(self, match): + # This function works closely with _EncodeString. It will only be called + # by re.sub with match.group(0) containing a character matched by the + # the _escaped expression. + char = match.group(0) + + # Backslashes (\) and quotation marks (") are always replaced with a + # backslash-escaped version of the same. Everything else gets its + # replacement from the class' _encode_transforms array. + if char == '\\': + return '\\\\' + if char == '"': + return '\\"' + return self._encode_transforms[ord(char)] + + def _EncodeString(self, value): + """Encodes a string to be placed in the project file output, mimicing + Xcode behavior. + """ + + # Use quotation marks when any character outside of the range A-Z, a-z, 0-9, + # $ (dollar sign), . (period), and _ (underscore) is present. Also use + # quotation marks to represent empty strings. + # + # Escape " (double-quote) and \ (backslash) by preceding them with a + # backslash. + # + # Some characters below the printable ASCII range are encoded specially: + # 7 ^G BEL is encoded as "\a" + # 8 ^H BS is encoded as "\b" + # 11 ^K VT is encoded as "\v" + # 12 ^L NP is encoded as "\f" + # 127 ^? DEL is passed through as-is without escaping + # - In PBXFileReference and PBXBuildFile objects: + # 9 ^I HT is passed through as-is without escaping + # 10 ^J NL is passed through as-is without escaping + # 13 ^M CR is passed through as-is without escaping + # - In other objects: + # 9 ^I HT is encoded as "\t" + # 10 ^J NL is encoded as "\n" + # 13 ^M CR is encoded as "\n" rendering it indistinguishable from + # 10 ^J NL + # All other nonprintable characters within the ASCII range (0 through 127 + # inclusive) are encoded as "\U001f" referring to the Unicode code point in + # hexadecimal. For example, character 14 (^N SO) is encoded as "\U000e". + # Characters above the ASCII range are passed through to the output encoded + # as UTF-8 without any escaping. These mappings are contained in the + # class' _encode_transforms list. + + if _unquoted.search(value) and not _quoted.search(value): + return value + + return '"' + _escaped.sub(self._EncodeTransform, value) + '"' + + def _XCPrint(self, file, tabs, line): + file.write('\t' * tabs + line) + + def _XCPrintableValue(self, tabs, value, flatten_list=False): + """Returns a representation of value that may be printed in a project file, + mimicing Xcode's behavior. + + _XCPrintableValue can handle str and int values, XCObjects (which are + made printable by returning their id property), and list and dict objects + composed of any of the above types. When printing a list or dict, and + _should_print_single_line is False, the tabs parameter is used to determine + how much to indent the lines corresponding to the items in the list or + dict. + + If flatten_list is True, single-element lists will be transformed into + strings. + """ + + printable = '' + comment = None + + if self._should_print_single_line: + sep = ' ' + element_tabs = '' + end_tabs = '' + else: + sep = '\n' + element_tabs = '\t' * (tabs + 1) + end_tabs = '\t' * tabs + + if isinstance(value, XCObject): + printable += value.id + comment = value.Comment() + elif isinstance(value, str): + printable += self._EncodeString(value) + elif isinstance(value, unicode): + printable += self._EncodeString(value.encode('utf-8')) + elif isinstance(value, int): + printable += str(value) + elif isinstance(value, list): + if flatten_list and len(value) <= 1: + if len(value) == 0: + printable += self._EncodeString('') + else: + printable += self._EncodeString(value[0]) + else: + printable = '(' + sep + for item in value: + printable += element_tabs + \ + self._XCPrintableValue(tabs + 1, item, flatten_list) + \ + ',' + sep + printable += end_tabs + ')' + elif isinstance(value, dict): + printable = '{' + sep + for item_key, item_value in sorted(value.iteritems()): + printable += element_tabs + \ + self._XCPrintableValue(tabs + 1, item_key, flatten_list) + ' = ' + \ + self._XCPrintableValue(tabs + 1, item_value, flatten_list) + ';' + \ + sep + printable += end_tabs + '}' + else: + raise TypeError, "Can't make " + value.__class__.__name__ + ' printable' + + if comment != None: + printable += ' ' + self._EncodeComment(comment) + + return printable + + def _XCKVPrint(self, file, tabs, key, value): + """Prints a key and value, members of an XCObject's _properties dictionary, + to file. + + tabs is an int identifying the indentation level. If the class' + _should_print_single_line variable is True, tabs is ignored and the + key-value pair will be followed by a space insead of a newline. + """ + + if self._should_print_single_line: + printable = '' + after_kv = ' ' + else: + printable = '\t' * tabs + after_kv = '\n' + + # Xcode usually prints remoteGlobalIDString values in PBXContainerItemProxy + # objects without comments. Sometimes it prints them with comments, but + # the majority of the time, it doesn't. To avoid unnecessary changes to + # the project file after Xcode opens it, don't write comments for + # remoteGlobalIDString. This is a sucky hack and it would certainly be + # cleaner to extend the schema to indicate whether or not a comment should + # be printed, but since this is the only case where the problem occurs and + # Xcode itself can't seem to make up its mind, the hack will suffice. + # + # Also see PBXContainerItemProxy._schema['remoteGlobalIDString']. + if key == 'remoteGlobalIDString' and isinstance(self, + PBXContainerItemProxy): + value_to_print = value.id + else: + value_to_print = value + + # PBXBuildFile's settings property is represented in the output as a dict, + # but a hack here has it represented as a string. Arrange to strip off the + # quotes so that it shows up in the output as expected. + if key == 'settings' and isinstance(self, PBXBuildFile): + strip_value_quotes = True + else: + strip_value_quotes = False + + # In another one-off, let's set flatten_list on buildSettings properties + # of XCBuildConfiguration objects, because that's how Xcode treats them. + if key == 'buildSettings' and isinstance(self, XCBuildConfiguration): + flatten_list = True + else: + flatten_list = False + + try: + printable_key = self._XCPrintableValue(tabs, key, flatten_list) + printable_value = self._XCPrintableValue(tabs, value_to_print, + flatten_list) + if strip_value_quotes and len(printable_value) > 1 and \ + printable_value[0] == '"' and printable_value[-1] == '"': + printable_value = printable_value[1:-1] + printable += printable_key + ' = ' + printable_value + ';' + after_kv + except TypeError, e: + gyp.common.ExceptionAppend(e, + 'while printing key "%s"' % key) + raise + + self._XCPrint(file, 0, printable) + + def Print(self, file=sys.stdout): + """Prints a reprentation of this object to file, adhering to Xcode output + formatting. + """ + + self.VerifyHasRequiredProperties() + + if self._should_print_single_line: + # When printing an object in a single line, Xcode doesn't put any space + # between the beginning of a dictionary (or presumably a list) and the + # first contained item, so you wind up with snippets like + # ...CDEF = {isa = PBXFileReference; fileRef = 0123... + # If it were me, I would have put a space in there after the opening + # curly, but I guess this is just another one of those inconsistencies + # between how Xcode prints PBXFileReference and PBXBuildFile objects as + # compared to other objects. Mimic Xcode's behavior here by using an + # empty string for sep. + sep = '' + end_tabs = 0 + else: + sep = '\n' + end_tabs = 2 + + # Start the object. For example, '\t\tPBXProject = {\n'. + self._XCPrint(file, 2, self._XCPrintableValue(2, self) + ' = {' + sep) + + # "isa" isn't in the _properties dictionary, it's an intrinsic property + # of the class which the object belongs to. Xcode always outputs "isa" + # as the first element of an object dictionary. + self._XCKVPrint(file, 3, 'isa', self.__class__.__name__) + + # The remaining elements of an object dictionary are sorted alphabetically. + for property, value in sorted(self._properties.iteritems()): + self._XCKVPrint(file, 3, property, value) + + # End the object. + self._XCPrint(file, end_tabs, '};\n') + + def UpdateProperties(self, properties, do_copy=False): + """Merge the supplied properties into the _properties dictionary. + + The input properties must adhere to the class schema or a KeyError or + TypeError exception will be raised. If adding an object of an XCObject + subclass and the schema indicates a strong relationship, the object's + parent will be set to this object. + + If do_copy is True, then lists, dicts, strong-owned XCObjects, and + strong-owned XCObjects in lists will be copied instead of having their + references added. + """ + + if properties is None: + return + + for property, value in properties.iteritems(): + # Make sure the property is in the schema. + if not property in self._schema: + raise KeyError, property + ' not in ' + self.__class__.__name__ + + # Make sure the property conforms to the schema. + (is_list, property_type, is_strong) = self._schema[property][0:3] + if is_list: + if value.__class__ != list: + raise TypeError, \ + property + ' of ' + self.__class__.__name__ + \ + ' must be list, not ' + value.__class__.__name__ + for item in value: + if not isinstance(item, property_type) and \ + not (item.__class__ == unicode and property_type == str): + # Accept unicode where str is specified. str is treated as + # UTF-8-encoded. + raise TypeError, \ + 'item of ' + property + ' of ' + self.__class__.__name__ + \ + ' must be ' + property_type.__name__ + ', not ' + \ + item.__class__.__name__ + elif not isinstance(value, property_type) and \ + not (value.__class__ == unicode and property_type == str): + # Accept unicode where str is specified. str is treated as + # UTF-8-encoded. + raise TypeError, \ + property + ' of ' + self.__class__.__name__ + ' must be ' + \ + property_type.__name__ + ', not ' + value.__class__.__name__ + + # Checks passed, perform the assignment. + if do_copy: + if isinstance(value, XCObject): + if is_strong: + self._properties[property] = value.Copy() + else: + self._properties[property] = value + elif isinstance(value, str) or isinstance(value, unicode) or \ + isinstance(value, int): + self._properties[property] = value + elif isinstance(value, list): + if is_strong: + # If is_strong is True, each element is an XCObject, so it's safe + # to call Copy. + self._properties[property] = [] + for item in value: + self._properties[property].append(item.Copy()) + else: + self._properties[property] = value[:] + elif isinstance(value, dict): + self._properties[property] = value.copy() + else: + raise TypeError, "Don't know how to copy a " + \ + value.__class__.__name__ + ' object for ' + \ + property + ' in ' + self.__class__.__name__ + else: + self._properties[property] = value + + # Set up the child's back-reference to this object. Don't use |value| + # any more because it may not be right if do_copy is true. + if is_strong: + if not is_list: + self._properties[property].parent = self + else: + for item in self._properties[property]: + item.parent = self + + def HasProperty(self, key): + return key in self._properties + + def GetProperty(self, key): + return self._properties[key] + + def SetProperty(self, key, value): + self.UpdateProperties({key: value}) + + def DelProperty(self, key): + if key in self._properties: + del self._properties[key] + + def AppendProperty(self, key, value): + # TODO(mark): Support ExtendProperty too (and make this call that)? + + # Schema validation. + if not key in self._schema: + raise KeyError, key + ' not in ' + self.__class__.__name__ + + (is_list, property_type, is_strong) = self._schema[key][0:3] + if not is_list: + raise TypeError, key + ' of ' + self.__class__.__name__ + ' must be list' + if not isinstance(value, property_type): + raise TypeError, 'item of ' + key + ' of ' + self.__class__.__name__ + \ + ' must be ' + property_type.__name__ + ', not ' + \ + value.__class__.__name__ + + # If the property doesn't exist yet, create a new empty list to receive the + # item. + if not key in self._properties: + self._properties[key] = [] + + # Set up the ownership link. + if is_strong: + value.parent = self + + # Store the item. + self._properties[key].append(value) + + def VerifyHasRequiredProperties(self): + """Ensure that all properties identified as required by the schema are + set. + """ + + # TODO(mark): A stronger verification mechanism is needed. Some + # subclasses need to perform validation beyond what the schema can enforce. + for property, attributes in self._schema.iteritems(): + (is_list, property_type, is_strong, is_required) = attributes[0:4] + if is_required and not property in self._properties: + raise KeyError, self.__class__.__name__ + ' requires ' + property + + def _SetDefaultsFromSchema(self): + """Assign object default values according to the schema. This will not + overwrite properties that have already been set.""" + + defaults = {} + for property, attributes in self._schema.iteritems(): + (is_list, property_type, is_strong, is_required) = attributes[0:4] + if is_required and len(attributes) >= 5 and \ + not property in self._properties: + default = attributes[4] + + defaults[property] = default + + if len(defaults) > 0: + # Use do_copy=True so that each new object gets its own copy of strong + # objects, lists, and dicts. + self.UpdateProperties(defaults, do_copy=True) + + +class XCHierarchicalElement(XCObject): + """Abstract base for PBXGroup and PBXFileReference. Not represented in a + project file.""" + + # TODO(mark): Do name and path belong here? Probably so. + # If path is set and name is not, name may have a default value. Name will + # be set to the basename of path, if the basename of path is different from + # the full value of path. If path is already just a leaf name, name will + # not be set. + _schema = XCObject._schema.copy() + _schema.update({ + 'comments': [0, str, 0, 0], + 'fileEncoding': [0, str, 0, 0], + 'includeInIndex': [0, int, 0, 0], + 'indentWidth': [0, int, 0, 0], + 'lineEnding': [0, int, 0, 0], + 'sourceTree': [0, str, 0, 1, ''], + 'tabWidth': [0, int, 0, 0], + 'usesTabs': [0, int, 0, 0], + 'wrapsLines': [0, int, 0, 0], + }) + + def __init__(self, properties=None, id=None, parent=None): + # super + XCObject.__init__(self, properties, id, parent) + if 'path' in self._properties and not 'name' in self._properties: + path = self._properties['path'] + name = posixpath.basename(path) + if name != '' and path != name: + self.SetProperty('name', name) + + if 'path' in self._properties and \ + (not 'sourceTree' in self._properties or \ + self._properties['sourceTree'] == ''): + # If the pathname begins with an Xcode variable like "$(SDKROOT)/", take + # the variable out and make the path be relative to that variable by + # assigning the variable name as the sourceTree. + (source_tree, path) = SourceTreeAndPathFromPath(self._properties['path']) + if source_tree != None: + self._properties['sourceTree'] = source_tree + if path != None: + self._properties['path'] = path + if source_tree != None and path is None and \ + not 'name' in self._properties: + # The path was of the form "$(SDKROOT)" with no path following it. + # This object is now relative to that variable, so it has no path + # attribute of its own. It does, however, keep a name. + del self._properties['path'] + self._properties['name'] = source_tree + + def Name(self): + if 'name' in self._properties: + return self._properties['name'] + elif 'path' in self._properties: + return self._properties['path'] + else: + # This happens in the case of the root PBXGroup. + return None + + def Hashables(self): + """Custom hashables for XCHierarchicalElements. + + XCHierarchicalElements are special. Generally, their hashes shouldn't + change if the paths don't change. The normal XCObject implementation of + Hashables adds a hashable for each object, which means that if + the hierarchical structure changes (possibly due to changes caused when + TakeOverOnlyChild runs and encounters slight changes in the hierarchy), + the hashes will change. For example, if a project file initially contains + a/b/f1 and a/b becomes collapsed into a/b, f1 will have a single parent + a/b. If someone later adds a/f2 to the project file, a/b can no longer be + collapsed, and f1 winds up with parent b and grandparent a. That would + be sufficient to change f1's hash. + + To counteract this problem, hashables for all XCHierarchicalElements except + for the main group (which has neither a name nor a path) are taken to be + just the set of path components. Because hashables are inherited from + parents, this provides assurance that a/b/f1 has the same set of hashables + whether its parent is b or a/b. + + The main group is a special case. As it is permitted to have no name or + path, it is permitted to use the standard XCObject hash mechanism. This + is not considered a problem because there can be only one main group. + """ + + if self == self.PBXProjectAncestor()._properties['mainGroup']: + # super + return XCObject.Hashables(self) + + hashables = [] + + # Put the name in first, ensuring that if TakeOverOnlyChild collapses + # children into a top-level group like "Source", the name always goes + # into the list of hashables without interfering with path components. + if 'name' in self._properties: + # Make it less likely for people to manipulate hashes by following the + # pattern of always pushing an object type value onto the list first. + hashables.append(self.__class__.__name__ + '.name') + hashables.append(self._properties['name']) + + # NOTE: This still has the problem that if an absolute path is encountered, + # including paths with a sourceTree, they'll still inherit their parents' + # hashables, even though the paths aren't relative to their parents. This + # is not expected to be much of a problem in practice. + path = self.PathFromSourceTreeAndPath() + if path != None: + components = path.split(posixpath.sep) + for component in components: + hashables.append(self.__class__.__name__ + '.path') + hashables.append(component) + + hashables.extend(self._hashables) + + return hashables + + def Compare(self, other): + # Allow comparison of these types. PBXGroup has the highest sort rank; + # PBXVariantGroup is treated as equal to PBXFileReference. + valid_class_types = { + PBXFileReference: 'file', + PBXGroup: 'group', + PBXVariantGroup: 'file', + } + self_type = valid_class_types[self.__class__] + other_type = valid_class_types[other.__class__] + + if self_type == other_type: + # If the two objects are of the same sort rank, compare their names. + return cmp(self.Name(), other.Name()) + + # Otherwise, sort groups before everything else. + if self_type == 'group': + return -1 + return 1 + + def CompareRootGroup(self, other): + # This function should be used only to compare direct children of the + # containing PBXProject's mainGroup. These groups should appear in the + # listed order. + # TODO(mark): "Build" is used by gyp.generator.xcode, perhaps the + # generator should have a way of influencing this list rather than having + # to hardcode for the generator here. + order = ['Source', 'Intermediates', 'Projects', 'Frameworks', 'Products', + 'Build'] + + # If the groups aren't in the listed order, do a name comparison. + # Otherwise, groups in the listed order should come before those that + # aren't. + self_name = self.Name() + other_name = other.Name() + self_in = isinstance(self, PBXGroup) and self_name in order + other_in = isinstance(self, PBXGroup) and other_name in order + if not self_in and not other_in: + return self.Compare(other) + if self_name in order and not other_name in order: + return -1 + if other_name in order and not self_name in order: + return 1 + + # If both groups are in the listed order, go by the defined order. + self_index = order.index(self_name) + other_index = order.index(other_name) + if self_index < other_index: + return -1 + if self_index > other_index: + return 1 + return 0 + + def PathFromSourceTreeAndPath(self): + # Turn the object's sourceTree and path properties into a single flat + # string of a form comparable to the path parameter. If there's a + # sourceTree property other than "", wrap it in $(...) for the + # comparison. + components = [] + if self._properties['sourceTree'] != '': + components.append('$(' + self._properties['sourceTree'] + ')') + if 'path' in self._properties: + components.append(self._properties['path']) + + if len(components) > 0: + return posixpath.join(*components) + + return None + + def FullPath(self): + # Returns a full path to self relative to the project file, or relative + # to some other source tree. Start with self, and walk up the chain of + # parents prepending their paths, if any, until no more parents are + # available (project-relative path) or until a path relative to some + # source tree is found. + xche = self + path = None + while isinstance(xche, XCHierarchicalElement) and \ + (path is None or \ + (not path.startswith('/') and not path.startswith('$'))): + this_path = xche.PathFromSourceTreeAndPath() + if this_path != None and path != None: + path = posixpath.join(this_path, path) + elif this_path != None: + path = this_path + xche = xche.parent + + return path + + +class PBXGroup(XCHierarchicalElement): + """ + Attributes: + _children_by_path: Maps pathnames of children of this PBXGroup to the + actual child XCHierarchicalElement objects. + _variant_children_by_name_and_path: Maps (name, path) tuples of + PBXVariantGroup children to the actual child PBXVariantGroup objects. + """ + + _schema = XCHierarchicalElement._schema.copy() + _schema.update({ + 'children': [1, XCHierarchicalElement, 1, 1, []], + 'name': [0, str, 0, 0], + 'path': [0, str, 0, 0], + }) + + def __init__(self, properties=None, id=None, parent=None): + # super + XCHierarchicalElement.__init__(self, properties, id, parent) + self._children_by_path = {} + self._variant_children_by_name_and_path = {} + for child in self._properties.get('children', []): + self._AddChildToDicts(child) + + def _AddChildToDicts(self, child): + # Sets up this PBXGroup object's dicts to reference the child properly. + child_path = child.PathFromSourceTreeAndPath() + if child_path: + if child_path in self._children_by_path: + raise ValueError, 'Found multiple children with path ' + child_path + self._children_by_path[child_path] = child + + if isinstance(child, PBXVariantGroup): + child_name = child._properties.get('name', None) + key = (child_name, child_path) + if key in self._variant_children_by_name_and_path: + raise ValueError, 'Found multiple PBXVariantGroup children with ' + \ + 'name ' + str(child_name) + ' and path ' + \ + str(child_path) + self._variant_children_by_name_and_path[key] = child + + def AppendChild(self, child): + # Callers should use this instead of calling + # AppendProperty('children', child) directly because this function + # maintains the group's dicts. + self.AppendProperty('children', child) + self._AddChildToDicts(child) + + def GetChildByName(self, name): + # This is not currently optimized with a dict as GetChildByPath is because + # it has few callers. Most callers probably want GetChildByPath. This + # function is only useful to get children that have names but no paths, + # which is rare. The children of the main group ("Source", "Products", + # etc.) is pretty much the only case where this likely to come up. + # + # TODO(mark): Maybe this should raise an error if more than one child is + # present with the same name. + if not 'children' in self._properties: + return None + + for child in self._properties['children']: + if child.Name() == name: + return child + + return None + + def GetChildByPath(self, path): + if not path: + return None + + if path in self._children_by_path: + return self._children_by_path[path] + + return None + + def GetChildByRemoteObject(self, remote_object): + # This method is a little bit esoteric. Given a remote_object, which + # should be a PBXFileReference in another project file, this method will + # return this group's PBXReferenceProxy object serving as a local proxy + # for the remote PBXFileReference. + # + # This function might benefit from a dict optimization as GetChildByPath + # for some workloads, but profiling shows that it's not currently a + # problem. + if not 'children' in self._properties: + return None + + for child in self._properties['children']: + if not isinstance(child, PBXReferenceProxy): + continue + + container_proxy = child._properties['remoteRef'] + if container_proxy._properties['remoteGlobalIDString'] == remote_object: + return child + + return None + + def AddOrGetFileByPath(self, path, hierarchical): + """Returns an existing or new file reference corresponding to path. + + If hierarchical is True, this method will create or use the necessary + hierarchical group structure corresponding to path. Otherwise, it will + look in and create an item in the current group only. + + If an existing matching reference is found, it is returned, otherwise, a + new one will be created, added to the correct group, and returned. + + If path identifies a directory by virtue of carrying a trailing slash, + this method returns a PBXFileReference of "folder" type. If path + identifies a variant, by virtue of it identifying a file inside a directory + with an ".lproj" extension, this method returns a PBXVariantGroup + containing the variant named by path, and possibly other variants. For + all other paths, a "normal" PBXFileReference will be returned. + """ + + # Adding or getting a directory? Directories end with a trailing slash. + is_dir = False + if path.endswith('/'): + is_dir = True + normpath = posixpath.normpath(path) + if is_dir: + normpath = path + '/' + else: + normpath = path + + # Adding or getting a variant? Variants are files inside directories + # with an ".lproj" extension. Xcode uses variants for localization. For + # a variant path/to/Language.lproj/MainMenu.nib, put a variant group named + # MainMenu.nib inside path/to, and give it a variant named Language. In + # this example, grandparent would be set to path/to and parent_root would + # be set to Language. + variant_name = None + parent = posixpath.dirname(path) + grandparent = posixpath.dirname(parent) + parent_basename = posixpath.basename(parent) + (parent_root, parent_ext) = posixpath.splitext(parent_basename) + if parent_ext == '.lproj': + variant_name = parent_root + if grandparent == '': + grandparent = None + + # Putting a directory inside a variant group is not currently supported. + assert not is_dir or variant_name is None + + path_split = path.split(posixpath.sep) + if len(path_split) == 1 or \ + ((is_dir or variant_name != None) and len(path_split) == 2) or \ + not hierarchical: + # The PBXFileReference or PBXVariantGroup will be added to or gotten from + # this PBXGroup, no recursion necessary. + if variant_name is None: + # Add or get a PBXFileReference. + file_ref = self.GetChildByPath(normpath) + if file_ref != None: + assert file_ref.__class__ == PBXFileReference + else: + file_ref = PBXFileReference({'path': path}) + self.AppendChild(file_ref) + else: + # Add or get a PBXVariantGroup. The variant group name is the same + # as the basename (MainMenu.nib in the example above). grandparent + # specifies the path to the variant group itself, and path_split[-2:] + # is the path of the specific variant relative to its group. + variant_group_name = posixpath.basename(path) + variant_group_ref = self.AddOrGetVariantGroupByNameAndPath( + variant_group_name, grandparent) + variant_path = posixpath.sep.join(path_split[-2:]) + variant_ref = variant_group_ref.GetChildByPath(variant_path) + if variant_ref != None: + assert variant_ref.__class__ == PBXFileReference + else: + variant_ref = PBXFileReference({'name': variant_name, + 'path': variant_path}) + variant_group_ref.AppendChild(variant_ref) + # The caller is interested in the variant group, not the specific + # variant file. + file_ref = variant_group_ref + return file_ref + else: + # Hierarchical recursion. Add or get a PBXGroup corresponding to the + # outermost path component, and then recurse into it, chopping off that + # path component. + next_dir = path_split[0] + group_ref = self.GetChildByPath(next_dir) + if group_ref != None: + assert group_ref.__class__ == PBXGroup + else: + group_ref = PBXGroup({'path': next_dir}) + self.AppendChild(group_ref) + return group_ref.AddOrGetFileByPath(posixpath.sep.join(path_split[1:]), + hierarchical) + + def AddOrGetVariantGroupByNameAndPath(self, name, path): + """Returns an existing or new PBXVariantGroup for name and path. + + If a PBXVariantGroup identified by the name and path arguments is already + present as a child of this object, it is returned. Otherwise, a new + PBXVariantGroup with the correct properties is created, added as a child, + and returned. + + This method will generally be called by AddOrGetFileByPath, which knows + when to create a variant group based on the structure of the pathnames + passed to it. + """ + + key = (name, path) + if key in self._variant_children_by_name_and_path: + variant_group_ref = self._variant_children_by_name_and_path[key] + assert variant_group_ref.__class__ == PBXVariantGroup + return variant_group_ref + + variant_group_properties = {'name': name} + if path != None: + variant_group_properties['path'] = path + variant_group_ref = PBXVariantGroup(variant_group_properties) + self.AppendChild(variant_group_ref) + + return variant_group_ref + + def TakeOverOnlyChild(self, recurse=False): + """If this PBXGroup has only one child and it's also a PBXGroup, take + it over by making all of its children this object's children. + + This function will continue to take over only children when those children + are groups. If there are three PBXGroups representing a, b, and c, with + c inside b and b inside a, and a and b have no other children, this will + result in a taking over both b and c, forming a PBXGroup for a/b/c. + + If recurse is True, this function will recurse into children and ask them + to collapse themselves by taking over only children as well. Assuming + an example hierarchy with files at a/b/c/d1, a/b/c/d2, and a/b/c/d3/e/f + (d1, d2, and f are files, the rest are groups), recursion will result in + a group for a/b/c containing a group for d3/e. + """ + + # At this stage, check that child class types are PBXGroup exactly, + # instead of using isinstance. The only subclass of PBXGroup, + # PBXVariantGroup, should not participate in reparenting in the same way: + # reparenting by merging different object types would be wrong. + while len(self._properties['children']) == 1 and \ + self._properties['children'][0].__class__ == PBXGroup: + # Loop to take over the innermost only-child group possible. + + child = self._properties['children'][0] + + # Assume the child's properties, including its children. Save a copy + # of this object's old properties, because they'll still be needed. + # This object retains its existing id and parent attributes. + old_properties = self._properties + self._properties = child._properties + self._children_by_path = child._children_by_path + + if not 'sourceTree' in self._properties or \ + self._properties['sourceTree'] == '': + # The child was relative to its parent. Fix up the path. Note that + # children with a sourceTree other than "" are not relative to + # their parents, so no path fix-up is needed in that case. + if 'path' in old_properties: + if 'path' in self._properties: + # Both the original parent and child have paths set. + self._properties['path'] = posixpath.join(old_properties['path'], + self._properties['path']) + else: + # Only the original parent has a path, use it. + self._properties['path'] = old_properties['path'] + if 'sourceTree' in old_properties: + # The original parent had a sourceTree set, use it. + self._properties['sourceTree'] = old_properties['sourceTree'] + + # If the original parent had a name set, keep using it. If the original + # parent didn't have a name but the child did, let the child's name + # live on. If the name attribute seems unnecessary now, get rid of it. + if 'name' in old_properties and old_properties['name'] != None and \ + old_properties['name'] != self.Name(): + self._properties['name'] = old_properties['name'] + if 'name' in self._properties and 'path' in self._properties and \ + self._properties['name'] == self._properties['path']: + del self._properties['name'] + + # Notify all children of their new parent. + for child in self._properties['children']: + child.parent = self + + # If asked to recurse, recurse. + if recurse: + for child in self._properties['children']: + if child.__class__ == PBXGroup: + child.TakeOverOnlyChild(recurse) + + def SortGroup(self): + self._properties['children'] = \ + sorted(self._properties['children'], cmp=lambda x,y: x.Compare(y)) + + # Recurse. + for child in self._properties['children']: + if isinstance(child, PBXGroup): + child.SortGroup() + + +class XCFileLikeElement(XCHierarchicalElement): + # Abstract base for objects that can be used as the fileRef property of + # PBXBuildFile. + + def PathHashables(self): + # A PBXBuildFile that refers to this object will call this method to + # obtain additional hashables specific to this XCFileLikeElement. Don't + # just use this object's hashables, they're not specific and unique enough + # on their own (without access to the parent hashables.) Instead, provide + # hashables that identify this object by path by getting its hashables as + # well as the hashables of ancestor XCHierarchicalElement objects. + + hashables = [] + xche = self + while xche != None and isinstance(xche, XCHierarchicalElement): + xche_hashables = xche.Hashables() + for index in xrange(0, len(xche_hashables)): + hashables.insert(index, xche_hashables[index]) + xche = xche.parent + return hashables + + +class XCContainerPortal(XCObject): + # Abstract base for objects that can be used as the containerPortal property + # of PBXContainerItemProxy. + pass + + +class XCRemoteObject(XCObject): + # Abstract base for objects that can be used as the remoteGlobalIDString + # property of PBXContainerItemProxy. + pass + + +class PBXFileReference(XCFileLikeElement, XCContainerPortal, XCRemoteObject): + _schema = XCFileLikeElement._schema.copy() + _schema.update({ + 'explicitFileType': [0, str, 0, 0], + 'lastKnownFileType': [0, str, 0, 0], + 'name': [0, str, 0, 0], + 'path': [0, str, 0, 1], + }) + + # Weird output rules for PBXFileReference. + _should_print_single_line = True + # super + _encode_transforms = XCFileLikeElement._alternate_encode_transforms + + def __init__(self, properties=None, id=None, parent=None): + # super + XCFileLikeElement.__init__(self, properties, id, parent) + if 'path' in self._properties and self._properties['path'].endswith('/'): + self._properties['path'] = self._properties['path'][:-1] + is_dir = True + else: + is_dir = False + + if 'path' in self._properties and \ + not 'lastKnownFileType' in self._properties and \ + not 'explicitFileType' in self._properties: + # TODO(mark): This is the replacement for a replacement for a quick hack. + # It is no longer incredibly sucky, but this list needs to be extended. + extension_map = { + 'a': 'archive.ar', + 'app': 'wrapper.application', + 'bdic': 'file', + 'bundle': 'wrapper.cfbundle', + 'c': 'sourcecode.c.c', + 'cc': 'sourcecode.cpp.cpp', + 'cpp': 'sourcecode.cpp.cpp', + 'css': 'text.css', + 'cxx': 'sourcecode.cpp.cpp', + 'dylib': 'compiled.mach-o.dylib', + 'framework': 'wrapper.framework', + 'h': 'sourcecode.c.h', + 'hxx': 'sourcecode.cpp.h', + 'icns': 'image.icns', + 'java': 'sourcecode.java', + 'js': 'sourcecode.javascript', + 'm': 'sourcecode.c.objc', + 'mm': 'sourcecode.cpp.objcpp', + 'nib': 'wrapper.nib', + 'o': 'compiled.mach-o.objfile', + 'pdf': 'image.pdf', + 'pl': 'text.script.perl', + 'plist': 'text.plist.xml', + 'pm': 'text.script.perl', + 'png': 'image.png', + 'py': 'text.script.python', + 'r': 'sourcecode.rez', + 'rez': 'sourcecode.rez', + 's': 'sourcecode.asm', + 'strings': 'text.plist.strings', + 'ttf': 'file', + 'xcconfig': 'text.xcconfig', + 'xib': 'file.xib', + 'y': 'sourcecode.yacc', + } + + if is_dir: + file_type = 'folder' + else: + basename = posixpath.basename(self._properties['path']) + (root, ext) = posixpath.splitext(basename) + # Check the map using a lowercase extension. + # TODO(mark): Maybe it should try with the original case first and fall + # back to lowercase, in case there are any instances where case + # matters. There currently aren't. + if ext != '': + ext = ext[1:].lower() + + # TODO(mark): "text" is the default value, but "file" is appropriate + # for unrecognized files not containing text. Xcode seems to choose + # based on content. + file_type = extension_map.get(ext, 'text') + + self._properties['lastKnownFileType'] = file_type + + +class PBXVariantGroup(PBXGroup, XCFileLikeElement): + """PBXVariantGroup is used by Xcode to represent localizations.""" + # No additions to the schema relative to PBXGroup. + pass + + +# PBXReferenceProxy is also an XCFileLikeElement subclass. It is defined below +# because it uses PBXContainerItemProxy, defined below. + + +class XCBuildConfiguration(XCObject): + _schema = XCObject._schema.copy() + _schema.update({ + 'baseConfigurationReference': [0, PBXFileReference, 0, 0], + 'buildSettings': [0, dict, 0, 1, {}], + 'name': [0, str, 0, 1], + }) + + def HasBuildSetting(self, key): + return key in self._properties['buildSettings'] + + def GetBuildSetting(self, key): + return self._properties['buildSettings'][key] + + def SetBuildSetting(self, key, value): + # TODO(mark): If a list, copy? + self._properties['buildSettings'][key] = value + + def AppendBuildSetting(self, key, value): + if not key in self._properties['buildSettings']: + self._properties['buildSettings'][key] = [] + self._properties['buildSettings'][key].append(value) + + def DelBuildSetting(self, key): + if key in self._properties['buildSettings']: + del self._properties['buildSettings'][key] + + def SetBaseConfiguration(self, value): + self._properties['baseConfigurationReference'] = value + +class XCConfigurationList(XCObject): + # _configs is the default list of configurations. + _configs = [ XCBuildConfiguration({'name': 'Debug'}), + XCBuildConfiguration({'name': 'Release'}) ] + + _schema = XCObject._schema.copy() + _schema.update({ + 'buildConfigurations': [1, XCBuildConfiguration, 1, 1, _configs], + 'defaultConfigurationIsVisible': [0, int, 0, 1, 1], + 'defaultConfigurationName': [0, str, 0, 1, 'Release'], + }) + + def Name(self): + return 'Build configuration list for ' + \ + self.parent.__class__.__name__ + ' "' + self.parent.Name() + '"' + + def ConfigurationNamed(self, name): + """Convenience accessor to obtain an XCBuildConfiguration by name.""" + for configuration in self._properties['buildConfigurations']: + if configuration._properties['name'] == name: + return configuration + + raise KeyError, name + + def DefaultConfiguration(self): + """Convenience accessor to obtain the default XCBuildConfiguration.""" + return self.ConfigurationNamed(self._properties['defaultConfigurationName']) + + def HasBuildSetting(self, key): + """Determines the state of a build setting in all XCBuildConfiguration + child objects. + + If all child objects have key in their build settings, and the value is the + same in all child objects, returns 1. + + If no child objects have the key in their build settings, returns 0. + + If some, but not all, child objects have the key in their build settings, + or if any children have different values for the key, returns -1. + """ + + has = None + value = None + for configuration in self._properties['buildConfigurations']: + configuration_has = configuration.HasBuildSetting(key) + if has is None: + has = configuration_has + elif has != configuration_has: + return -1 + + if configuration_has: + configuration_value = configuration.GetBuildSetting(key) + if value is None: + value = configuration_value + elif value != configuration_value: + return -1 + + if not has: + return 0 + + return 1 + + def GetBuildSetting(self, key): + """Gets the build setting for key. + + All child XCConfiguration objects must have the same value set for the + setting, or a ValueError will be raised. + """ + + # TODO(mark): This is wrong for build settings that are lists. The list + # contents should be compared (and a list copy returned?) + + value = None + for configuration in self._properties['buildConfigurations']: + configuration_value = configuration.GetBuildSetting(key) + if value is None: + value = configuration_value + else: + if value != configuration_value: + raise ValueError, 'Variant values for ' + key + + return value + + def SetBuildSetting(self, key, value): + """Sets the build setting for key to value in all child + XCBuildConfiguration objects. + """ + + for configuration in self._properties['buildConfigurations']: + configuration.SetBuildSetting(key, value) + + def AppendBuildSetting(self, key, value): + """Appends value to the build setting for key, which is treated as a list, + in all child XCBuildConfiguration objects. + """ + + for configuration in self._properties['buildConfigurations']: + configuration.AppendBuildSetting(key, value) + + def DelBuildSetting(self, key): + """Deletes the build setting key from all child XCBuildConfiguration + objects. + """ + + for configuration in self._properties['buildConfigurations']: + configuration.DelBuildSetting(key) + + def SetBaseConfiguration(self, value): + """Sets the build configuration in all child XCBuildConfiguration objects. + """ + + for configuration in self._properties['buildConfigurations']: + configuration.SetBaseConfiguration(value) + + +class PBXBuildFile(XCObject): + _schema = XCObject._schema.copy() + _schema.update({ + 'fileRef': [0, XCFileLikeElement, 0, 1], + 'settings': [0, str, 0, 0], # hack, it's a dict + }) + + # Weird output rules for PBXBuildFile. + _should_print_single_line = True + _encode_transforms = XCObject._alternate_encode_transforms + + def Name(self): + # Example: "main.cc in Sources" + return self._properties['fileRef'].Name() + ' in ' + self.parent.Name() + + def Hashables(self): + # super + hashables = XCObject.Hashables(self) + + # It is not sufficient to just rely on Name() to get the + # XCFileLikeElement's name, because that is not a complete pathname. + # PathHashables returns hashables unique enough that no two + # PBXBuildFiles should wind up with the same set of hashables, unless + # someone adds the same file multiple times to the same target. That + # would be considered invalid anyway. + hashables.extend(self._properties['fileRef'].PathHashables()) + + return hashables + + +class XCBuildPhase(XCObject): + """Abstract base for build phase classes. Not represented in a project + file. + + Attributes: + _files_by_path: A dict mapping each path of a child in the files list by + path (keys) to the corresponding PBXBuildFile children (values). + _files_by_xcfilelikeelement: A dict mapping each XCFileLikeElement (keys) + to the corresponding PBXBuildFile children (values). + """ + + # TODO(mark): Some build phase types, like PBXShellScriptBuildPhase, don't + # actually have a "files" list. XCBuildPhase should not have "files" but + # another abstract subclass of it should provide this, and concrete build + # phase types that do have "files" lists should be derived from that new + # abstract subclass. XCBuildPhase should only provide buildActionMask and + # runOnlyForDeploymentPostprocessing, and not files or the various + # file-related methods and attributes. + + _schema = XCObject._schema.copy() + _schema.update({ + 'buildActionMask': [0, int, 0, 1, 0x7fffffff], + 'files': [1, PBXBuildFile, 1, 1, []], + 'runOnlyForDeploymentPostprocessing': [0, int, 0, 1, 0], + }) + + def __init__(self, properties=None, id=None, parent=None): + # super + XCObject.__init__(self, properties, id, parent) + + self._files_by_path = {} + self._files_by_xcfilelikeelement = {} + for pbxbuildfile in self._properties.get('files', []): + self._AddBuildFileToDicts(pbxbuildfile) + + def FileGroup(self, path): + # Subclasses must override this by returning a two-element tuple. The + # first item in the tuple should be the PBXGroup to which "path" should be + # added, either as a child or deeper descendant. The second item should + # be a boolean indicating whether files should be added into hierarchical + # groups or one single flat group. + raise NotImplementedError, \ + self.__class__.__name__ + ' must implement FileGroup' + + def _AddPathToDict(self, pbxbuildfile, path): + """Adds path to the dict tracking paths belonging to this build phase. + + If the path is already a member of this build phase, raises an exception. + """ + + if path in self._files_by_path: + raise ValueError, 'Found multiple build files with path ' + path + self._files_by_path[path] = pbxbuildfile + + def _AddBuildFileToDicts(self, pbxbuildfile, path=None): + """Maintains the _files_by_path and _files_by_xcfilelikeelement dicts. + + If path is specified, then it is the path that is being added to the + phase, and pbxbuildfile must contain either a PBXFileReference directly + referencing that path, or it must contain a PBXVariantGroup that itself + contains a PBXFileReference referencing the path. + + If path is not specified, either the PBXFileReference's path or the paths + of all children of the PBXVariantGroup are taken as being added to the + phase. + + If the path is already present in the phase, raises an exception. + + If the PBXFileReference or PBXVariantGroup referenced by pbxbuildfile + are already present in the phase, referenced by a different PBXBuildFile + object, raises an exception. This does not raise an exception when + a PBXFileReference or PBXVariantGroup reappear and are referenced by the + same PBXBuildFile that has already introduced them, because in the case + of PBXVariantGroup objects, they may correspond to multiple paths that are + not all added simultaneously. When this situation occurs, the path needs + to be added to _files_by_path, but nothing needs to change in + _files_by_xcfilelikeelement, and the caller should have avoided adding + the PBXBuildFile if it is already present in the list of children. + """ + + xcfilelikeelement = pbxbuildfile._properties['fileRef'] + + paths = [] + if path != None: + # It's best when the caller provides the path. + if isinstance(xcfilelikeelement, PBXVariantGroup): + paths.append(path) + else: + # If the caller didn't provide a path, there can be either multiple + # paths (PBXVariantGroup) or one. + if isinstance(xcfilelikeelement, PBXVariantGroup): + for variant in xcfilelikeelement._properties['children']: + paths.append(variant.FullPath()) + else: + paths.append(xcfilelikeelement.FullPath()) + + # Add the paths first, because if something's going to raise, the + # messages provided by _AddPathToDict are more useful owing to its + # having access to a real pathname and not just an object's Name(). + for a_path in paths: + self._AddPathToDict(pbxbuildfile, a_path) + + # If another PBXBuildFile references this XCFileLikeElement, there's a + # problem. + if xcfilelikeelement in self._files_by_xcfilelikeelement and \ + self._files_by_xcfilelikeelement[xcfilelikeelement] != pbxbuildfile: + raise ValueError, 'Found multiple build files for ' + \ + xcfilelikeelement.Name() + self._files_by_xcfilelikeelement[xcfilelikeelement] = pbxbuildfile + + def AppendBuildFile(self, pbxbuildfile, path=None): + # Callers should use this instead of calling + # AppendProperty('files', pbxbuildfile) directly because this function + # maintains the object's dicts. Better yet, callers can just call AddFile + # with a pathname and not worry about building their own PBXBuildFile + # objects. + self.AppendProperty('files', pbxbuildfile) + self._AddBuildFileToDicts(pbxbuildfile, path) + + def AddFile(self, path, settings=None): + (file_group, hierarchical) = self.FileGroup(path) + file_ref = file_group.AddOrGetFileByPath(path, hierarchical) + + if file_ref in self._files_by_xcfilelikeelement and \ + isinstance(file_ref, PBXVariantGroup): + # There's already a PBXBuildFile in this phase corresponding to the + # PBXVariantGroup. path just provides a new variant that belongs to + # the group. Add the path to the dict. + pbxbuildfile = self._files_by_xcfilelikeelement[file_ref] + self._AddBuildFileToDicts(pbxbuildfile, path) + else: + # Add a new PBXBuildFile to get file_ref into the phase. + if settings is None: + pbxbuildfile = PBXBuildFile({'fileRef': file_ref}) + else: + pbxbuildfile = PBXBuildFile({'fileRef': file_ref, 'settings': settings}) + self.AppendBuildFile(pbxbuildfile, path) + + +class PBXHeadersBuildPhase(XCBuildPhase): + # No additions to the schema relative to XCBuildPhase. + + def Name(self): + return 'Headers' + + def FileGroup(self, path): + return self.PBXProjectAncestor().RootGroupForPath(path) + + +class PBXResourcesBuildPhase(XCBuildPhase): + # No additions to the schema relative to XCBuildPhase. + + def Name(self): + return 'Resources' + + def FileGroup(self, path): + return self.PBXProjectAncestor().RootGroupForPath(path) + + +class PBXSourcesBuildPhase(XCBuildPhase): + # No additions to the schema relative to XCBuildPhase. + + def Name(self): + return 'Sources' + + def FileGroup(self, path): + return self.PBXProjectAncestor().RootGroupForPath(path) + + +class PBXFrameworksBuildPhase(XCBuildPhase): + # No additions to the schema relative to XCBuildPhase. + + def Name(self): + return 'Frameworks' + + def FileGroup(self, path): + (root, ext) = posixpath.splitext(path) + if ext != '': + ext = ext[1:].lower() + if ext == 'o': + # .o files are added to Xcode Frameworks phases, but conceptually aren't + # frameworks, they're more like sources or intermediates. Redirect them + # to show up in one of those other groups. + return self.PBXProjectAncestor().RootGroupForPath(path) + else: + return (self.PBXProjectAncestor().FrameworksGroup(), False) + + +class PBXShellScriptBuildPhase(XCBuildPhase): + _schema = XCBuildPhase._schema.copy() + _schema.update({ + 'inputPaths': [1, str, 0, 1, []], + 'name': [0, str, 0, 0], + 'outputPaths': [1, str, 0, 1, []], + 'shellPath': [0, str, 0, 1, '/bin/sh'], + 'shellScript': [0, str, 0, 1], + 'showEnvVarsInLog': [0, int, 0, 0], + }) + + def Name(self): + if 'name' in self._properties: + return self._properties['name'] + + return 'ShellScript' + + +class PBXCopyFilesBuildPhase(XCBuildPhase): + _schema = XCBuildPhase._schema.copy() + _schema.update({ + 'dstPath': [0, str, 0, 1], + 'dstSubfolderSpec': [0, int, 0, 1], + 'name': [0, str, 0, 0], + }) + + # path_tree_re matches "$(DIR)/path" or just "$(DIR)". Match group 1 is + # "DIR", match group 3 is "path" or None. + path_tree_re = re.compile('^\\$\\((.*)\\)(/(.*)|)$') + + # path_tree_to_subfolder maps names of Xcode variables to the associated + # dstSubfolderSpec property value used in a PBXCopyFilesBuildPhase object. + path_tree_to_subfolder = { + 'BUILT_PRODUCTS_DIR': 16, # Products Directory + # Other types that can be chosen via the Xcode UI. + # TODO(mark): Map Xcode variable names to these. + # : 1, # Wrapper + # : 6, # Executables: 6 + # : 7, # Resources + # : 15, # Java Resources + # : 10, # Frameworks + # : 11, # Shared Frameworks + # : 12, # Shared Support + # : 13, # PlugIns + } + + def Name(self): + if 'name' in self._properties: + return self._properties['name'] + + return 'CopyFiles' + + def FileGroup(self, path): + return self.PBXProjectAncestor().RootGroupForPath(path) + + def SetDestination(self, path): + """Set the dstSubfolderSpec and dstPath properties from path. + + path may be specified in the same notation used for XCHierarchicalElements, + specifically, "$(DIR)/path". + """ + + path_tree_match = self.path_tree_re.search(path) + if path_tree_match: + # Everything else needs to be relative to an Xcode variable. + path_tree = path_tree_match.group(1) + relative_path = path_tree_match.group(3) + + if path_tree in self.path_tree_to_subfolder: + subfolder = self.path_tree_to_subfolder[path_tree] + if relative_path is None: + relative_path = '' + else: + # The path starts with an unrecognized Xcode variable + # name like $(SRCROOT). Xcode will still handle this + # as an "absolute path" that starts with the variable. + subfolder = 0 + relative_path = path + elif path.startswith('/'): + # Special case. Absolute paths are in dstSubfolderSpec 0. + subfolder = 0 + relative_path = path[1:] + else: + raise ValueError, 'Can\'t use path %s in a %s' % \ + (path, self.__class__.__name__) + + self._properties['dstPath'] = relative_path + self._properties['dstSubfolderSpec'] = subfolder + + +class PBXBuildRule(XCObject): + _schema = XCObject._schema.copy() + _schema.update({ + 'compilerSpec': [0, str, 0, 1], + 'filePatterns': [0, str, 0, 0], + 'fileType': [0, str, 0, 1], + 'isEditable': [0, int, 0, 1, 1], + 'outputFiles': [1, str, 0, 1, []], + 'script': [0, str, 0, 0], + }) + + def Name(self): + # Not very inspired, but it's what Xcode uses. + return self.__class__.__name__ + + def Hashables(self): + # super + hashables = XCObject.Hashables(self) + + # Use the hashables of the weak objects that this object refers to. + hashables.append(self._properties['fileType']) + if 'filePatterns' in self._properties: + hashables.append(self._properties['filePatterns']) + return hashables + + +class PBXContainerItemProxy(XCObject): + # When referencing an item in this project file, containerPortal is the + # PBXProject root object of this project file. When referencing an item in + # another project file, containerPortal is a PBXFileReference identifying + # the other project file. + # + # When serving as a proxy to an XCTarget (in this project file or another), + # proxyType is 1. When serving as a proxy to a PBXFileReference (in another + # project file), proxyType is 2. Type 2 is used for references to the + # producs of the other project file's targets. + # + # Xcode is weird about remoteGlobalIDString. Usually, it's printed without + # a comment, indicating that it's tracked internally simply as a string, but + # sometimes it's printed with a comment (usually when the object is initially + # created), indicating that it's tracked as a project file object at least + # sometimes. This module always tracks it as an object, but contains a hack + # to prevent it from printing the comment in the project file output. See + # _XCKVPrint. + _schema = XCObject._schema.copy() + _schema.update({ + 'containerPortal': [0, XCContainerPortal, 0, 1], + 'proxyType': [0, int, 0, 1], + 'remoteGlobalIDString': [0, XCRemoteObject, 0, 1], + 'remoteInfo': [0, str, 0, 1], + }) + + def __repr__(self): + props = self._properties + name = '%s.gyp:%s' % (props['containerPortal'].Name(), props['remoteInfo']) + return '<%s %r at 0x%x>' % (self.__class__.__name__, name, id(self)) + + def Name(self): + # Admittedly not the best name, but it's what Xcode uses. + return self.__class__.__name__ + + def Hashables(self): + # super + hashables = XCObject.Hashables(self) + + # Use the hashables of the weak objects that this object refers to. + hashables.extend(self._properties['containerPortal'].Hashables()) + hashables.extend(self._properties['remoteGlobalIDString'].Hashables()) + return hashables + + +class PBXTargetDependency(XCObject): + # The "target" property accepts an XCTarget object, and obviously not + # NoneType. But XCTarget is defined below, so it can't be put into the + # schema yet. The definition of PBXTargetDependency can't be moved below + # XCTarget because XCTarget's own schema references PBXTargetDependency. + # Python doesn't deal well with this circular relationship, and doesn't have + # a real way to do forward declarations. To work around, the type of + # the "target" property is reset below, after XCTarget is defined. + # + # At least one of "name" and "target" is required. + _schema = XCObject._schema.copy() + _schema.update({ + 'name': [0, str, 0, 0], + 'target': [0, None.__class__, 0, 0], + 'targetProxy': [0, PBXContainerItemProxy, 1, 1], + }) + + def __repr__(self): + name = self._properties.get('name') or self._properties['target'].Name() + return '<%s %r at 0x%x>' % (self.__class__.__name__, name, id(self)) + + def Name(self): + # Admittedly not the best name, but it's what Xcode uses. + return self.__class__.__name__ + + def Hashables(self): + # super + hashables = XCObject.Hashables(self) + + # Use the hashables of the weak objects that this object refers to. + hashables.extend(self._properties['targetProxy'].Hashables()) + return hashables + + +class PBXReferenceProxy(XCFileLikeElement): + _schema = XCFileLikeElement._schema.copy() + _schema.update({ + 'fileType': [0, str, 0, 1], + 'path': [0, str, 0, 1], + 'remoteRef': [0, PBXContainerItemProxy, 1, 1], + }) + + +class XCTarget(XCRemoteObject): + # An XCTarget is really just an XCObject, the XCRemoteObject thing is just + # to allow PBXProject to be used in the remoteGlobalIDString property of + # PBXContainerItemProxy. + # + # Setting a "name" property at instantiation may also affect "productName", + # which may in turn affect the "PRODUCT_NAME" build setting in children of + # "buildConfigurationList". See __init__ below. + _schema = XCRemoteObject._schema.copy() + _schema.update({ + 'buildConfigurationList': [0, XCConfigurationList, 1, 1, + XCConfigurationList()], + 'buildPhases': [1, XCBuildPhase, 1, 1, []], + 'dependencies': [1, PBXTargetDependency, 1, 1, []], + 'name': [0, str, 0, 1], + 'productName': [0, str, 0, 1], + }) + + def __init__(self, properties=None, id=None, parent=None, + force_outdir=None, force_prefix=None, force_extension=None): + # super + XCRemoteObject.__init__(self, properties, id, parent) + + # Set up additional defaults not expressed in the schema. If a "name" + # property was supplied, set "productName" if it is not present. Also set + # the "PRODUCT_NAME" build setting in each configuration, but only if + # the setting is not present in any build configuration. + if 'name' in self._properties: + if not 'productName' in self._properties: + self.SetProperty('productName', self._properties['name']) + + if 'productName' in self._properties: + if 'buildConfigurationList' in self._properties: + configs = self._properties['buildConfigurationList'] + if configs.HasBuildSetting('PRODUCT_NAME') == 0: + configs.SetBuildSetting('PRODUCT_NAME', + self._properties['productName']) + + def AddDependency(self, other): + pbxproject = self.PBXProjectAncestor() + other_pbxproject = other.PBXProjectAncestor() + if pbxproject == other_pbxproject: + # Add a dependency to another target in the same project file. + container = PBXContainerItemProxy({'containerPortal': pbxproject, + 'proxyType': 1, + 'remoteGlobalIDString': other, + 'remoteInfo': other.Name()}) + dependency = PBXTargetDependency({'target': other, + 'targetProxy': container}) + self.AppendProperty('dependencies', dependency) + else: + # Add a dependency to a target in a different project file. + other_project_ref = \ + pbxproject.AddOrGetProjectReference(other_pbxproject)[1] + container = PBXContainerItemProxy({ + 'containerPortal': other_project_ref, + 'proxyType': 1, + 'remoteGlobalIDString': other, + 'remoteInfo': other.Name(), + }) + dependency = PBXTargetDependency({'name': other.Name(), + 'targetProxy': container}) + self.AppendProperty('dependencies', dependency) + + # Proxy all of these through to the build configuration list. + + def ConfigurationNamed(self, name): + return self._properties['buildConfigurationList'].ConfigurationNamed(name) + + def DefaultConfiguration(self): + return self._properties['buildConfigurationList'].DefaultConfiguration() + + def HasBuildSetting(self, key): + return self._properties['buildConfigurationList'].HasBuildSetting(key) + + def GetBuildSetting(self, key): + return self._properties['buildConfigurationList'].GetBuildSetting(key) + + def SetBuildSetting(self, key, value): + return self._properties['buildConfigurationList'].SetBuildSetting(key, \ + value) + + def AppendBuildSetting(self, key, value): + return self._properties['buildConfigurationList'].AppendBuildSetting(key, \ + value) + + def DelBuildSetting(self, key): + return self._properties['buildConfigurationList'].DelBuildSetting(key) + + +# Redefine the type of the "target" property. See PBXTargetDependency._schema +# above. +PBXTargetDependency._schema['target'][1] = XCTarget + + +class PBXNativeTarget(XCTarget): + # buildPhases is overridden in the schema to be able to set defaults. + # + # NOTE: Contrary to most objects, it is advisable to set parent when + # constructing PBXNativeTarget. A parent of an XCTarget must be a PBXProject + # object. A parent reference is required for a PBXNativeTarget during + # construction to be able to set up the target defaults for productReference, + # because a PBXBuildFile object must be created for the target and it must + # be added to the PBXProject's mainGroup hierarchy. + _schema = XCTarget._schema.copy() + _schema.update({ + 'buildPhases': [1, XCBuildPhase, 1, 1, + [PBXSourcesBuildPhase(), PBXFrameworksBuildPhase()]], + 'buildRules': [1, PBXBuildRule, 1, 1, []], + 'productReference': [0, PBXFileReference, 0, 1], + 'productType': [0, str, 0, 1], + }) + + # Mapping from Xcode product-types to settings. The settings are: + # filetype : used for explicitFileType in the project file + # prefix : the prefix for the file name + # suffix : the suffix for the filen ame + _product_filetypes = { + 'com.apple.product-type.application': ['wrapper.application', + '', '.app'], + 'com.apple.product-type.bundle': ['wrapper.cfbundle', + '', '.bundle'], + 'com.apple.product-type.framework': ['wrapper.framework', + '', '.framework'], + 'com.apple.product-type.library.dynamic': ['compiled.mach-o.dylib', + 'lib', '.dylib'], + 'com.apple.product-type.library.static': ['archive.ar', + 'lib', '.a'], + 'com.apple.product-type.tool': ['compiled.mach-o.executable', + '', ''], + 'com.googlecode.gyp.xcode.bundle': ['compiled.mach-o.dylib', + '', '.so'], + } + + def __init__(self, properties=None, id=None, parent=None, + force_outdir=None, force_prefix=None, force_extension=None): + # super + XCTarget.__init__(self, properties, id, parent) + + if 'productName' in self._properties and \ + 'productType' in self._properties and \ + not 'productReference' in self._properties and \ + self._properties['productType'] in self._product_filetypes: + products_group = None + pbxproject = self.PBXProjectAncestor() + if pbxproject != None: + products_group = pbxproject.ProductsGroup() + + if products_group != None: + (filetype, prefix, suffix) = \ + self._product_filetypes[self._properties['productType']] + # Xcode does not have a distinct type for loadable modules that are + # pure BSD targets (not in a bundle wrapper). GYP allows such modules + # to be specified by setting a target type to loadable_module without + # having mac_bundle set. These are mapped to the pseudo-product type + # com.googlecode.gyp.xcode.bundle. + # + # By picking up this special type and converting it to a dynamic + # library (com.apple.product-type.library.dynamic) with fix-ups, + # single-file loadable modules can be produced. + # + # MACH_O_TYPE is changed to mh_bundle to produce the proper file type + # (as opposed to mh_dylib). In order for linking to succeed, + # DYLIB_CURRENT_VERSION and DYLIB_COMPATIBILITY_VERSION must be + # cleared. They are meaningless for type mh_bundle. + # + # Finally, the .so extension is forcibly applied over the default + # (.dylib), unless another forced extension is already selected. + # .dylib is plainly wrong, and .bundle is used by loadable_modules in + # bundle wrappers (com.apple.product-type.bundle). .so seems an odd + # choice because it's used as the extension on many other systems that + # don't distinguish between linkable shared libraries and non-linkable + # loadable modules, but there's precedent: Python loadable modules on + # Mac OS X use an .so extension. + if self._properties['productType'] == 'com.googlecode.gyp.xcode.bundle': + self._properties['productType'] = \ + 'com.apple.product-type.library.dynamic' + self.SetBuildSetting('MACH_O_TYPE', 'mh_bundle') + self.SetBuildSetting('DYLIB_CURRENT_VERSION', '') + self.SetBuildSetting('DYLIB_COMPATIBILITY_VERSION', '') + if force_extension is None: + force_extension = suffix[1:] + + if force_extension is not None: + # If it's a wrapper (bundle), set WRAPPER_EXTENSION. + if filetype.startswith('wrapper.'): + self.SetBuildSetting('WRAPPER_EXTENSION', force_extension) + else: + # Extension override. + suffix = '.' + force_extension + self.SetBuildSetting('EXECUTABLE_EXTENSION', force_extension) + + if filetype.startswith('compiled.mach-o.executable'): + product_name = self._properties['productName'] + product_name += suffix + suffix = '' + self.SetProperty('productName', product_name) + self.SetBuildSetting('PRODUCT_NAME', product_name) + + # Xcode handles most prefixes based on the target type, however there + # are exceptions. If a "BSD Dynamic Library" target is added in the + # Xcode UI, Xcode sets EXECUTABLE_PREFIX. This check duplicates that + # behavior. + if force_prefix is not None: + prefix = force_prefix + if filetype.startswith('wrapper.'): + self.SetBuildSetting('WRAPPER_PREFIX', prefix) + else: + self.SetBuildSetting('EXECUTABLE_PREFIX', prefix) + + if force_outdir is not None: + self.SetBuildSetting('TARGET_BUILD_DIR', force_outdir) + + # TODO(tvl): Remove the below hack. + # http://code.google.com/p/gyp/issues/detail?id=122 + + # Some targets include the prefix in the target_name. These targets + # really should just add a product_name setting that doesn't include + # the prefix. For example: + # target_name = 'libevent', product_name = 'event' + # This check cleans up for them. + product_name = self._properties['productName'] + prefix_len = len(prefix) + if prefix_len and (product_name[:prefix_len] == prefix): + product_name = product_name[prefix_len:] + self.SetProperty('productName', product_name) + self.SetBuildSetting('PRODUCT_NAME', product_name) + + ref_props = { + 'explicitFileType': filetype, + 'includeInIndex': 0, + 'path': prefix + product_name + suffix, + 'sourceTree': 'BUILT_PRODUCTS_DIR', + } + file_ref = PBXFileReference(ref_props) + products_group.AppendChild(file_ref) + self.SetProperty('productReference', file_ref) + + def GetBuildPhaseByType(self, type): + if not 'buildPhases' in self._properties: + return None + + the_phase = None + for phase in self._properties['buildPhases']: + if isinstance(phase, type): + # Some phases may be present in multiples in a well-formed project file, + # but phases like PBXSourcesBuildPhase may only be present singly, and + # this function is intended as an aid to GetBuildPhaseByType. Loop + # over the entire list of phases and assert if more than one of the + # desired type is found. + assert the_phase is None + the_phase = phase + + return the_phase + + def HeadersPhase(self): + headers_phase = self.GetBuildPhaseByType(PBXHeadersBuildPhase) + if headers_phase is None: + headers_phase = PBXHeadersBuildPhase() + + # The headers phase should come before the resources, sources, and + # frameworks phases, if any. + insert_at = len(self._properties['buildPhases']) + for index in xrange(0, len(self._properties['buildPhases'])): + phase = self._properties['buildPhases'][index] + if isinstance(phase, PBXResourcesBuildPhase) or \ + isinstance(phase, PBXSourcesBuildPhase) or \ + isinstance(phase, PBXFrameworksBuildPhase): + insert_at = index + break + + self._properties['buildPhases'].insert(insert_at, headers_phase) + headers_phase.parent = self + + return headers_phase + + def ResourcesPhase(self): + resources_phase = self.GetBuildPhaseByType(PBXResourcesBuildPhase) + if resources_phase is None: + resources_phase = PBXResourcesBuildPhase() + + # The resources phase should come before the sources and frameworks + # phases, if any. + insert_at = len(self._properties['buildPhases']) + for index in xrange(0, len(self._properties['buildPhases'])): + phase = self._properties['buildPhases'][index] + if isinstance(phase, PBXSourcesBuildPhase) or \ + isinstance(phase, PBXFrameworksBuildPhase): + insert_at = index + break + + self._properties['buildPhases'].insert(insert_at, resources_phase) + resources_phase.parent = self + + return resources_phase + + def SourcesPhase(self): + sources_phase = self.GetBuildPhaseByType(PBXSourcesBuildPhase) + if sources_phase is None: + sources_phase = PBXSourcesBuildPhase() + self.AppendProperty('buildPhases', sources_phase) + + return sources_phase + + def FrameworksPhase(self): + frameworks_phase = self.GetBuildPhaseByType(PBXFrameworksBuildPhase) + if frameworks_phase is None: + frameworks_phase = PBXFrameworksBuildPhase() + self.AppendProperty('buildPhases', frameworks_phase) + + return frameworks_phase + + def AddDependency(self, other): + # super + XCTarget.AddDependency(self, other) + + static_library_type = 'com.apple.product-type.library.static' + shared_library_type = 'com.apple.product-type.library.dynamic' + framework_type = 'com.apple.product-type.framework' + if isinstance(other, PBXNativeTarget) and \ + 'productType' in self._properties and \ + self._properties['productType'] != static_library_type and \ + 'productType' in other._properties and \ + (other._properties['productType'] == static_library_type or \ + ((other._properties['productType'] == shared_library_type or \ + other._properties['productType'] == framework_type) and \ + ((not other.HasBuildSetting('MACH_O_TYPE')) or + other.GetBuildSetting('MACH_O_TYPE') != 'mh_bundle'))): + + file_ref = other.GetProperty('productReference') + + pbxproject = self.PBXProjectAncestor() + other_pbxproject = other.PBXProjectAncestor() + if pbxproject != other_pbxproject: + other_project_product_group = \ + pbxproject.AddOrGetProjectReference(other_pbxproject)[0] + file_ref = other_project_product_group.GetChildByRemoteObject(file_ref) + + self.FrameworksPhase().AppendProperty('files', + PBXBuildFile({'fileRef': file_ref})) + + +class PBXAggregateTarget(XCTarget): + pass + + +class PBXProject(XCContainerPortal): + # A PBXProject is really just an XCObject, the XCContainerPortal thing is + # just to allow PBXProject to be used in the containerPortal property of + # PBXContainerItemProxy. + """ + + Attributes: + path: "sample.xcodeproj". TODO(mark) Document me! + _other_pbxprojects: A dictionary, keyed by other PBXProject objects. Each + value is a reference to the dict in the + projectReferences list associated with the keyed + PBXProject. + """ + + _schema = XCContainerPortal._schema.copy() + _schema.update({ + 'attributes': [0, dict, 0, 0], + 'buildConfigurationList': [0, XCConfigurationList, 1, 1, + XCConfigurationList()], + 'compatibilityVersion': [0, str, 0, 1, 'Xcode 3.2'], + 'hasScannedForEncodings': [0, int, 0, 1, 1], + 'mainGroup': [0, PBXGroup, 1, 1, PBXGroup()], + 'projectDirPath': [0, str, 0, 1, ''], + 'projectReferences': [1, dict, 0, 0], + 'projectRoot': [0, str, 0, 1, ''], + 'targets': [1, XCTarget, 1, 1, []], + }) + + def __init__(self, properties=None, id=None, parent=None, path=None): + self.path = path + self._other_pbxprojects = {} + # super + return XCContainerPortal.__init__(self, properties, id, parent) + + def Name(self): + name = self.path + if name[-10:] == '.xcodeproj': + name = name[:-10] + return posixpath.basename(name) + + def Path(self): + return self.path + + def Comment(self): + return 'Project object' + + def Children(self): + # super + children = XCContainerPortal.Children(self) + + # Add children that the schema doesn't know about. Maybe there's a more + # elegant way around this, but this is the only case where we need to own + # objects in a dictionary (that is itself in a list), and three lines for + # a one-off isn't that big a deal. + if 'projectReferences' in self._properties: + for reference in self._properties['projectReferences']: + children.append(reference['ProductGroup']) + + return children + + def PBXProjectAncestor(self): + return self + + def _GroupByName(self, name): + if not 'mainGroup' in self._properties: + self.SetProperty('mainGroup', PBXGroup()) + + main_group = self._properties['mainGroup'] + group = main_group.GetChildByName(name) + if group is None: + group = PBXGroup({'name': name}) + main_group.AppendChild(group) + + return group + + # SourceGroup and ProductsGroup are created by default in Xcode's own + # templates. + def SourceGroup(self): + return self._GroupByName('Source') + + def ProductsGroup(self): + return self._GroupByName('Products') + + # IntermediatesGroup is used to collect source-like files that are generated + # by rules or script phases and are placed in intermediate directories such + # as DerivedSources. + def IntermediatesGroup(self): + return self._GroupByName('Intermediates') + + # FrameworksGroup and ProjectsGroup are top-level groups used to collect + # frameworks and projects. + def FrameworksGroup(self): + return self._GroupByName('Frameworks') + + def ProjectsGroup(self): + return self._GroupByName('Projects') + + def RootGroupForPath(self, path): + """Returns a PBXGroup child of this object to which path should be added. + + This method is intended to choose between SourceGroup and + IntermediatesGroup on the basis of whether path is present in a source + directory or an intermediates directory. For the purposes of this + determination, any path located within a derived file directory such as + PROJECT_DERIVED_FILE_DIR is treated as being in an intermediates + directory. + + The returned value is a two-element tuple. The first element is the + PBXGroup, and the second element specifies whether that group should be + organized hierarchically (True) or as a single flat list (False). + """ + + # TODO(mark): make this a class variable and bind to self on call? + # Also, this list is nowhere near exhaustive. + # INTERMEDIATE_DIR and SHARED_INTERMEDIATE_DIR are used by + # gyp.generator.xcode. There should probably be some way for that module + # to push the names in, rather than having to hard-code them here. + source_tree_groups = { + 'DERIVED_FILE_DIR': (self.IntermediatesGroup, True), + 'INTERMEDIATE_DIR': (self.IntermediatesGroup, True), + 'PROJECT_DERIVED_FILE_DIR': (self.IntermediatesGroup, True), + 'SHARED_INTERMEDIATE_DIR': (self.IntermediatesGroup, True), + } + + (source_tree, path) = SourceTreeAndPathFromPath(path) + if source_tree != None and source_tree in source_tree_groups: + (group_func, hierarchical) = source_tree_groups[source_tree] + group = group_func() + return (group, hierarchical) + + # TODO(mark): make additional choices based on file extension. + + return (self.SourceGroup(), True) + + def AddOrGetFileInRootGroup(self, path): + """Returns a PBXFileReference corresponding to path in the correct group + according to RootGroupForPath's heuristics. + + If an existing PBXFileReference for path exists, it will be returned. + Otherwise, one will be created and returned. + """ + + (group, hierarchical) = self.RootGroupForPath(path) + return group.AddOrGetFileByPath(path, hierarchical) + + def RootGroupsTakeOverOnlyChildren(self, recurse=False): + """Calls TakeOverOnlyChild for all groups in the main group.""" + + for group in self._properties['mainGroup']._properties['children']: + if isinstance(group, PBXGroup): + group.TakeOverOnlyChild(recurse) + + def SortGroups(self): + # Sort the children of the mainGroup (like "Source" and "Products") + # according to their defined order. + self._properties['mainGroup']._properties['children'] = \ + sorted(self._properties['mainGroup']._properties['children'], + cmp=lambda x,y: x.CompareRootGroup(y)) + + # Sort everything else by putting group before files, and going + # alphabetically by name within sections of groups and files. SortGroup + # is recursive. + for group in self._properties['mainGroup']._properties['children']: + if not isinstance(group, PBXGroup): + continue + + if group.Name() == 'Products': + # The Products group is a special case. Instead of sorting + # alphabetically, sort things in the order of the targets that + # produce the products. To do this, just build up a new list of + # products based on the targets. + products = [] + for target in self._properties['targets']: + if not isinstance(target, PBXNativeTarget): + continue + product = target._properties['productReference'] + # Make sure that the product is already in the products group. + assert product in group._properties['children'] + products.append(product) + + # Make sure that this process doesn't miss anything that was already + # in the products group. + assert len(products) == len(group._properties['children']) + group._properties['children'] = products + else: + group.SortGroup() + + def AddOrGetProjectReference(self, other_pbxproject): + """Add a reference to another project file (via PBXProject object) to this + one. + + Returns [ProductGroup, ProjectRef]. ProductGroup is a PBXGroup object in + this project file that contains a PBXReferenceProxy object for each + product of each PBXNativeTarget in the other project file. ProjectRef is + a PBXFileReference to the other project file. + + If this project file already references the other project file, the + existing ProductGroup and ProjectRef are returned. The ProductGroup will + still be updated if necessary. + """ + + if not 'projectReferences' in self._properties: + self._properties['projectReferences'] = [] + + product_group = None + project_ref = None + + if not other_pbxproject in self._other_pbxprojects: + # This project file isn't yet linked to the other one. Establish the + # link. + product_group = PBXGroup({'name': 'Products'}) + + # ProductGroup is strong. + product_group.parent = self + + # There's nothing unique about this PBXGroup, and if left alone, it will + # wind up with the same set of hashables as all other PBXGroup objects + # owned by the projectReferences list. Add the hashables of the + # remote PBXProject that it's related to. + product_group._hashables.extend(other_pbxproject.Hashables()) + + # The other project reports its path as relative to the same directory + # that this project's path is relative to. The other project's path + # is not necessarily already relative to this project. Figure out the + # pathname that this project needs to use to refer to the other one. + this_path = posixpath.dirname(self.Path()) + projectDirPath = self.GetProperty('projectDirPath') + if projectDirPath: + if posixpath.isabs(projectDirPath[0]): + this_path = projectDirPath + else: + this_path = posixpath.join(this_path, projectDirPath) + other_path = gyp.common.RelativePath(other_pbxproject.Path(), this_path) + + # ProjectRef is weak (it's owned by the mainGroup hierarchy). + project_ref = PBXFileReference({ + 'lastKnownFileType': 'wrapper.pb-project', + 'path': other_path, + 'sourceTree': 'SOURCE_ROOT', + }) + self.ProjectsGroup().AppendChild(project_ref) + + ref_dict = {'ProductGroup': product_group, 'ProjectRef': project_ref} + self._other_pbxprojects[other_pbxproject] = ref_dict + self.AppendProperty('projectReferences', ref_dict) + + # Xcode seems to sort this list case-insensitively + self._properties['projectReferences'] = \ + sorted(self._properties['projectReferences'], cmp=lambda x,y: + cmp(x['ProjectRef'].Name().lower(), + y['ProjectRef'].Name().lower())) + else: + # The link already exists. Pull out the relevnt data. + project_ref_dict = self._other_pbxprojects[other_pbxproject] + product_group = project_ref_dict['ProductGroup'] + project_ref = project_ref_dict['ProjectRef'] + + self._SetUpProductReferences(other_pbxproject, product_group, project_ref) + + return [product_group, project_ref] + + def _SetUpProductReferences(self, other_pbxproject, product_group, + project_ref): + # TODO(mark): This only adds references to products in other_pbxproject + # when they don't exist in this pbxproject. Perhaps it should also + # remove references from this pbxproject that are no longer present in + # other_pbxproject. Perhaps it should update various properties if they + # change. + for target in other_pbxproject._properties['targets']: + if not isinstance(target, PBXNativeTarget): + continue + + other_fileref = target._properties['productReference'] + if product_group.GetChildByRemoteObject(other_fileref) is None: + # Xcode sets remoteInfo to the name of the target and not the name + # of its product, despite this proxy being a reference to the product. + container_item = PBXContainerItemProxy({ + 'containerPortal': project_ref, + 'proxyType': 2, + 'remoteGlobalIDString': other_fileref, + 'remoteInfo': target.Name() + }) + # TODO(mark): Does sourceTree get copied straight over from the other + # project? Can the other project ever have lastKnownFileType here + # instead of explicitFileType? (Use it if so?) Can path ever be + # unset? (I don't think so.) Can other_fileref have name set, and + # does it impact the PBXReferenceProxy if so? These are the questions + # that perhaps will be answered one day. + reference_proxy = PBXReferenceProxy({ + 'fileType': other_fileref._properties['explicitFileType'], + 'path': other_fileref._properties['path'], + 'sourceTree': other_fileref._properties['sourceTree'], + 'remoteRef': container_item, + }) + + product_group.AppendChild(reference_proxy) + + def SortRemoteProductReferences(self): + # For each remote project file, sort the associated ProductGroup in the + # same order that the targets are sorted in the remote project file. This + # is the sort order used by Xcode. + + def CompareProducts(x, y, remote_products): + # x and y are PBXReferenceProxy objects. Go through their associated + # PBXContainerItem to get the remote PBXFileReference, which will be + # present in the remote_products list. + x_remote = x._properties['remoteRef']._properties['remoteGlobalIDString'] + y_remote = y._properties['remoteRef']._properties['remoteGlobalIDString'] + x_index = remote_products.index(x_remote) + y_index = remote_products.index(y_remote) + + # Use the order of each remote PBXFileReference in remote_products to + # determine the sort order. + return cmp(x_index, y_index) + + for other_pbxproject, ref_dict in self._other_pbxprojects.iteritems(): + # Build up a list of products in the remote project file, ordered the + # same as the targets that produce them. + remote_products = [] + for target in other_pbxproject._properties['targets']: + if not isinstance(target, PBXNativeTarget): + continue + remote_products.append(target._properties['productReference']) + + # Sort the PBXReferenceProxy children according to the list of remote + # products. + product_group = ref_dict['ProductGroup'] + product_group._properties['children'] = sorted( + product_group._properties['children'], + cmp=lambda x, y: CompareProducts(x, y, remote_products)) + + +class XCProjectFile(XCObject): + _schema = XCObject._schema.copy() + _schema.update({ + 'archiveVersion': [0, int, 0, 1, 1], + 'classes': [0, dict, 0, 1, {}], + 'objectVersion': [0, int, 0, 1, 45], + 'rootObject': [0, PBXProject, 1, 1], + }) + + def SetXcodeVersion(self, version): + version_to_object_version = { + '2.4': 45, + '3.0': 45, + '3.1': 45, + '3.2': 46, + } + if not version in version_to_object_version: + supported_str = ', '.join(sorted(version_to_object_version.keys())) + raise Exception( + 'Unsupported Xcode version %s (supported: %s)' % + ( version, supported_str ) ) + compatibility_version = 'Xcode %s' % version + self._properties['rootObject'].SetProperty('compatibilityVersion', + compatibility_version) + self.SetProperty('objectVersion', version_to_object_version[version]); + + def ComputeIDs(self, recursive=True, overwrite=True, hash=None): + # Although XCProjectFile is implemented here as an XCObject, it's not a + # proper object in the Xcode sense, and it certainly doesn't have its own + # ID. Pass through an attempt to update IDs to the real root object. + if recursive: + self._properties['rootObject'].ComputeIDs(recursive, overwrite, hash) + + def Print(self, file=sys.stdout): + self.VerifyHasRequiredProperties() + + # Add the special "objects" property, which will be caught and handled + # separately during printing. This structure allows a fairly standard + # loop do the normal printing. + self._properties['objects'] = {} + self._XCPrint(file, 0, '// !$*UTF8*$!\n') + if self._should_print_single_line: + self._XCPrint(file, 0, '{ ') + else: + self._XCPrint(file, 0, '{\n') + for property, value in sorted(self._properties.iteritems(), + cmp=lambda x, y: cmp(x, y)): + if property == 'objects': + self._PrintObjects(file) + else: + self._XCKVPrint(file, 1, property, value) + self._XCPrint(file, 0, '}\n') + del self._properties['objects'] + + def _PrintObjects(self, file): + if self._should_print_single_line: + self._XCPrint(file, 0, 'objects = {') + else: + self._XCPrint(file, 1, 'objects = {\n') + + objects_by_class = {} + for object in self.Descendants(): + if object == self: + continue + class_name = object.__class__.__name__ + if not class_name in objects_by_class: + objects_by_class[class_name] = [] + objects_by_class[class_name].append(object) + + for class_name in sorted(objects_by_class): + self._XCPrint(file, 0, '\n') + self._XCPrint(file, 0, '/* Begin ' + class_name + ' section */\n') + for object in sorted(objects_by_class[class_name], + cmp=lambda x, y: cmp(x.id, y.id)): + object.Print(file) + self._XCPrint(file, 0, '/* End ' + class_name + ' section */\n') + + if self._should_print_single_line: + self._XCPrint(file, 0, '}; ') + else: + self._XCPrint(file, 1, '};\n') diff --git a/tools/gyp/pylib/gyp/xml_fix.py b/tools/gyp/pylib/gyp/xml_fix.py new file mode 100644 index 000000000..5de848158 --- /dev/null +++ b/tools/gyp/pylib/gyp/xml_fix.py @@ -0,0 +1,69 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Applies a fix to CR LF TAB handling in xml.dom. + +Fixes this: http://code.google.com/p/chromium/issues/detail?id=76293 +Working around this: http://bugs.python.org/issue5752 +TODO(bradnelson): Consider dropping this when we drop XP support. +""" + + +import xml.dom.minidom + + +def _Replacement_write_data(writer, data, is_attrib=False): + """Writes datachars to writer.""" + data = data.replace("&", "&").replace("<", "<") + data = data.replace("\"", """).replace(">", ">") + if is_attrib: + data = data.replace( + "\r", " ").replace( + "\n", " ").replace( + "\t", " ") + writer.write(data) + + +def _Replacement_writexml(self, writer, indent="", addindent="", newl=""): + # indent = current indentation + # addindent = indentation to add to higher levels + # newl = newline string + writer.write(indent+"<" + self.tagName) + + attrs = self._get_attributes() + a_names = attrs.keys() + a_names.sort() + + for a_name in a_names: + writer.write(" %s=\"" % a_name) + _Replacement_write_data(writer, attrs[a_name].value, is_attrib=True) + writer.write("\"") + if self.childNodes: + writer.write(">%s" % newl) + for node in self.childNodes: + node.writexml(writer, indent + addindent, addindent, newl) + writer.write("%s%s" % (indent, self.tagName, newl)) + else: + writer.write("/>%s" % newl) + + +class XmlFix(object): + """Object to manage temporary patching of xml.dom.minidom.""" + + def __init__(self): + # Preserve current xml.dom.minidom functions. + self.write_data = xml.dom.minidom._write_data + self.writexml = xml.dom.minidom.Element.writexml + # Inject replacement versions of a function and a method. + xml.dom.minidom._write_data = _Replacement_write_data + xml.dom.minidom.Element.writexml = _Replacement_writexml + + def Cleanup(self): + if self.write_data: + xml.dom.minidom._write_data = self.write_data + xml.dom.minidom.Element.writexml = self.writexml + self.write_data = None + + def __del__(self): + self.Cleanup() diff --git a/tools/gyp/pylintrc b/tools/gyp/pylintrc new file mode 100644 index 000000000..d7c23d2a2 --- /dev/null +++ b/tools/gyp/pylintrc @@ -0,0 +1,307 @@ +[MASTER] + +# Specify a configuration file. +#rcfile= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Profiled execution. +profile=no + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS + +# Pickle collected data for later comparisons. +persistent=yes + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + + +[MESSAGES CONTROL] + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time. +#enable= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). +# C0103: Invalid name "NN" (should match [a-z_][a-z0-9_]{2,30}$) +# C0111: Missing docstring +# C0302: Too many lines in module (NN) +# R0902: Too many instance attributes (N/7) +# R0903: Too few public methods (N/2) +# R0904: Too many public methods (NN/20) +# R0912: Too many branches (NN/12) +# R0913: Too many arguments (N/5) +# R0914: Too many local variables (NN/15) +# R0915: Too many statements (NN/50) +# W0141: Used builtin function 'map' +# W0142: Used * or ** magic +# W0232: Class has no __init__ method +# W0511: TODO +# W0603: Using the global statement +# +# These should be enabled eventually: +# C0112: Empty docstring +# C0301: Line too long (NN/80) +# C0321: More than one statement on single line +# C0322: Operator not preceded by a space +# C0323: Operator not followed by a space +# C0324: Comma not followed by a space +# E0101: Explicit return in __init__ +# E0102: function already defined line NN +# E1002: Use of super on an old style class +# E1101: Instance of 'XX' has no 'YY' member +# E1103: Instance of 'XX' has no 'XX' member (but some types could not be inferred) +# E0602: Undefined variable 'XX' +# F0401: Unable to import 'XX' +# R0201: Method could be a function +# R0801: Similar lines in N files +# W0102: Dangerous default value {} as argument +# W0104: Statement seems to have no effect +# W0105: String statement has no effect +# W0108: Lambda may not be necessary +# W0201: Attribute 'XX' defined outside __init__ +# W0212: Access to a protected member XX of a client class +# W0221: Arguments number differs from overridden method +# W0223: Method 'XX' is abstract in class 'YY' but is not overridden +# W0231: __init__ method from base class 'XX' is not called +# W0301: Unnecessary semicolon +# W0311: Bad indentation. Found NN spaces, expected NN +# W0401: Wildcard import XX +# W0402: Uses of a deprecated module 'string' +# W0403: Relative import 'XX', should be 'YY.XX' +# W0404: Reimport 'XX' (imported line NN) +# W0601: Global variable 'XX' undefined at the module level +# W0602: Using global for 'XX' but no assignment is done +# W0611: Unused import pprint +# W0612: Unused variable 'XX' +# W0613: Unused argument 'XX' +# W0614: Unused import XX from wildcard import +# W0621: Redefining name 'XX' from outer scope (line NN) +# W0622: Redefining built-in 'NN' +# W0631: Using possibly undefined loop variable 'XX' +# W0701: Raising a string exception +# W0702: No exception type(s) specified +disable=C0103,C0111,C0302,R0902,R0903,R0904,R0912,R0913,R0914,R0915,W0141,W0142,W0232,W0511,W0603,C0112,C0301,C0321,C0322,C0323,C0324,E0101,E0102,E1002,E1101,E1103,E0602,F0401,R0201,R0801,W0102,W0104,W0105,W0108,W0201,W0212,W0221,W0223,W0231,W0301,W0311,W0401,W0402,W0403,W0404,W0601,W0602,W0611,W0612,W0613,W0614,W0621,W0622,W0631,W0701,W0702 + + +[REPORTS] + +# Set the output format. Available formats are text, parseable, colorized, msvs +# (visual studio) and html +output-format=text + +# Include message's id in output +include-ids=yes + +# Put messages in a separate file for each module / package specified on the +# command line instead of printing them on stdout. Reports (if any) will be +# written in a file name "pylint_global.[txt|html]". +files-output=no + +# Tells whether to display a full report or only the messages +reports=no + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Add a comment according to your evaluation note. This is used by the global +# evaluation report (RP0004). +comment=no + + +[VARIABLES] + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# A regular expression matching the beginning of the name of dummy variables +# (i.e. not used). +dummy-variables-rgx=_|dummy + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins= + + +[TYPECHECK] + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# List of classes names for which member attributes should not be checked +# (useful for classes with attributes dynamically set). +ignored-classes=SQLObject + +# When zope mode is activated, add a predefined set of Zope acquired attributes +# to generated-members. +zope=no + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E0201 when accessed. Python regular +# expressions are accepted. +generated-members=REQUEST,acl_users,aq_parent + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME,XXX,TODO + + +[SIMILARITIES] + +# Minimum lines number of a similarity. +min-similarity-lines=4 + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + + +[FORMAT] + +# Maximum number of characters on a single line. +max-line-length=80 + +# Maximum number of lines in a module +max-module-lines=1000 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + + +[BASIC] + +# Required attributes for module, separated by a comma +required-attributes= + +# List of builtins function names that should not be used, separated by a comma +bad-functions=map,filter,apply,input + +# Regular expression which should only match correct module names +module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Regular expression which should only match correct module level names +const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ + +# Regular expression which should only match correct class names +class-rgx=[A-Z_][a-zA-Z0-9]+$ + +# Regular expression which should only match correct function names +function-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct method names +method-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct instance attribute names +attr-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct argument names +argument-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct variable names +variable-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct list comprehension / +# generator expression variable names +inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ + +# Good variable names which should always be accepted, separated by a comma +good-names=i,j,k,ex,Run,_ + +# Bad variable names which should always be refused, separated by a comma +bad-names=foo,bar,baz,toto,tutu,tata + +# Regular expression which should only match functions or classes name which do +# not require a docstring +no-docstring-rgx=__.*__ + + +[DESIGN] + +# Maximum number of arguments for function / method +max-args=5 + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore +ignored-argument-names=_.* + +# Maximum number of locals for function / method body +max-locals=15 + +# Maximum number of return / yield for function / method body +max-returns=6 + +# Maximum number of branch for function / method body +max-branchs=12 + +# Maximum number of statements in function / method body +max-statements=50 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + + +[CLASSES] + +# List of interface methods to ignore, separated by a comma. This is used for +# instance to not check methods defines in Zope's Interface base class. +ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__,__new__,setUp + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + + +[IMPORTS] + +# Deprecated modules which should not be used, separated by a comma +deprecated-modules=regsub,string,TERMIOS,Bastion,rexec + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled) +import-graph= + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled) +ext-import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled) +int-import-graph= + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. Defaults to +# "Exception" +overgeneral-exceptions=Exception diff --git a/tools/gyp/samples/samples b/tools/gyp/samples/samples new file mode 100755 index 000000000..804b61899 --- /dev/null +++ b/tools/gyp/samples/samples @@ -0,0 +1,81 @@ +#!/usr/bin/python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os.path +import shutil +import sys + + +gyps = [ + 'app/app.gyp', + 'base/base.gyp', + 'build/temp_gyp/googleurl.gyp', + 'build/all.gyp', + 'build/common.gypi', + 'build/external_code.gypi', + 'chrome/test/security_tests/security_tests.gyp', + 'chrome/third_party/hunspell/hunspell.gyp', + 'chrome/chrome.gyp', + 'media/media.gyp', + 'net/net.gyp', + 'printing/printing.gyp', + 'sdch/sdch.gyp', + 'skia/skia.gyp', + 'testing/gmock.gyp', + 'testing/gtest.gyp', + 'third_party/bzip2/bzip2.gyp', + 'third_party/icu38/icu38.gyp', + 'third_party/libevent/libevent.gyp', + 'third_party/libjpeg/libjpeg.gyp', + 'third_party/libpng/libpng.gyp', + 'third_party/libxml/libxml.gyp', + 'third_party/libxslt/libxslt.gyp', + 'third_party/lzma_sdk/lzma_sdk.gyp', + 'third_party/modp_b64/modp_b64.gyp', + 'third_party/npapi/npapi.gyp', + 'third_party/sqlite/sqlite.gyp', + 'third_party/zlib/zlib.gyp', + 'v8/tools/gyp/v8.gyp', + 'webkit/activex_shim/activex_shim.gyp', + 'webkit/activex_shim_dll/activex_shim_dll.gyp', + 'webkit/build/action_csspropertynames.py', + 'webkit/build/action_cssvaluekeywords.py', + 'webkit/build/action_jsconfig.py', + 'webkit/build/action_makenames.py', + 'webkit/build/action_maketokenizer.py', + 'webkit/build/action_useragentstylesheets.py', + 'webkit/build/rule_binding.py', + 'webkit/build/rule_bison.py', + 'webkit/build/rule_gperf.py', + 'webkit/tools/test_shell/test_shell.gyp', + 'webkit/webkit.gyp', +] + + +def Main(argv): + if len(argv) != 3 or argv[1] not in ['push', 'pull']: + print 'Usage: %s push/pull PATH_TO_CHROME' % argv[0] + return 1 + + path_to_chrome = argv[2] + + for g in gyps: + chrome_file = os.path.join(path_to_chrome, g) + local_file = os.path.join(os.path.dirname(argv[0]), os.path.split(g)[1]) + if argv[1] == 'push': + print 'Copying %s to %s' % (local_file, chrome_file) + shutil.copyfile(local_file, chrome_file) + elif argv[1] == 'pull': + print 'Copying %s to %s' % (chrome_file, local_file) + shutil.copyfile(chrome_file, local_file) + else: + assert False + + return 0 + + +if __name__ == '__main__': + sys.exit(Main(sys.argv)) diff --git a/tools/gyp/samples/samples.bat b/tools/gyp/samples/samples.bat new file mode 100644 index 000000000..778d9c90f --- /dev/null +++ b/tools/gyp/samples/samples.bat @@ -0,0 +1,5 @@ +@rem Copyright (c) 2009 Google Inc. All rights reserved. +@rem Use of this source code is governed by a BSD-style license that can be +@rem found in the LICENSE file. + +@python %~dp0/samples %* diff --git a/tools/gyp/setup.py b/tools/gyp/setup.py new file mode 100755 index 000000000..ed2b41a3c --- /dev/null +++ b/tools/gyp/setup.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from distutils.core import setup +from distutils.command.install import install +from distutils.command.install_lib import install_lib +from distutils.command.install_scripts import install_scripts + +setup( + name='gyp', + version='0.1', + description='Generate Your Projects', + author='Chromium Authors', + author_email='chromium-dev@googlegroups.com', + url='http://code.google.com/p/gyp', + package_dir = {'': 'pylib'}, + packages=['gyp', 'gyp.generator'], + + scripts = ['gyp'], + cmdclass = {'install': install, + 'install_lib': install_lib, + 'install_scripts': install_scripts}, +) diff --git a/tools/gyp/test/actions-bare/gyptest-bare.py b/tools/gyp/test/actions-bare/gyptest-bare.py new file mode 100755 index 000000000..b0c10938d --- /dev/null +++ b/tools/gyp/test/actions-bare/gyptest-bare.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies actions which are not depended on by other targets get executed. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('bare.gyp', chdir='src') +test.relocate('src', 'relocate/src') +test.build('bare.gyp', chdir='relocate/src') + +file_content = 'Hello from bare.py\n' + +test.built_file_must_match('out.txt', file_content, chdir='relocate/src') + +test.pass_test() diff --git a/tools/gyp/test/actions-bare/src/bare.gyp b/tools/gyp/test/actions-bare/src/bare.gyp new file mode 100644 index 000000000..3d28f099d --- /dev/null +++ b/tools/gyp/test/actions-bare/src/bare.gyp @@ -0,0 +1,25 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'bare', + 'type': 'none', + 'actions': [ + { + 'action_name': 'action1', + 'inputs': [ + 'bare.py', + ], + 'outputs': [ + '<(PRODUCT_DIR)/out.txt', + ], + 'action': ['python', 'bare.py', '<(PRODUCT_DIR)/out.txt'], + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/actions-bare/src/bare.py b/tools/gyp/test/actions-bare/src/bare.py new file mode 100755 index 000000000..12307500f --- /dev/null +++ b/tools/gyp/test/actions-bare/src/bare.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +f = open(sys.argv[1], 'wb') +f.write('Hello from bare.py\n') +f.close() diff --git a/tools/gyp/test/actions-multiple/gyptest-all.py b/tools/gyp/test/actions-multiple/gyptest-all.py new file mode 100755 index 000000000..2a083de9b --- /dev/null +++ b/tools/gyp/test/actions-multiple/gyptest-all.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies two actions can be attached to the same input files. +""" + +import sys + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('actions.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +# Test of fine-grained dependencies for generators that can build individual +# files on demand. +# In particular: +# - TargetA depends on TargetB. +# - TargetA and TargetB are 'none' type with actions attached. +# - TargetA has multiple actions. +# - An output from one of the actions in TargetA (not the first listed), +# is requested as the build target. +# Ensure that TargetB gets built. +# +# This sub-test can only be done with generators/build tools that can +# be asked to build individual files rather than whole targets (make, ninja). +if test.format in ['make', 'ninja']: + # Select location of target based on generator. + if test.format == 'make': + target = 'multi2.txt' + elif test.format == 'ninja': + if sys.platform in ['win32', 'cygwin']: + target = '..\\..\\multi2.txt' + else: + target = '../../multi2.txt' + else: + assert False + test.build('actions.gyp', chdir='relocate/src', target=target) + test.must_contain('relocate/src/multi2.txt', 'hello there') + test.must_contain('relocate/src/multi_dep.txt', 'hello there') + + +# Test that two actions can be attached to the same inputs. +test.build('actions.gyp', test.ALL, chdir='relocate/src') +test.must_contain('relocate/src/output1.txt', 'hello there') +test.must_contain('relocate/src/output2.txt', 'hello there') +test.must_contain('relocate/src/output3.txt', 'hello there') +test.must_contain('relocate/src/output4.txt', 'hello there') + +# Test that process_outputs_as_sources works in conjuction with merged +# actions. +test.run_built_executable( + 'multiple_action_source_filter', + chdir='relocate/src', + stdout=( + '{\n' + 'bar\n' + 'car\n' + 'dar\n' + 'ear\n' + '}\n' + ), +) + + +test.pass_test() diff --git a/tools/gyp/test/actions-multiple/src/actions.gyp b/tools/gyp/test/actions-multiple/src/actions.gyp new file mode 100644 index 000000000..c70a58f70 --- /dev/null +++ b/tools/gyp/test/actions-multiple/src/actions.gyp @@ -0,0 +1,226 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables': { + # Have a long string so that actions will exceed xp 512 character + # command limit on xp. + 'long_string': + 'abcdefghijklmnopqrstuvwxyz0123456789' + 'abcdefghijklmnopqrstuvwxyz0123456789' + 'abcdefghijklmnopqrstuvwxyz0123456789' + 'abcdefghijklmnopqrstuvwxyz0123456789' + 'abcdefghijklmnopqrstuvwxyz0123456789' + 'abcdefghijklmnopqrstuvwxyz0123456789' + 'abcdefghijklmnopqrstuvwxyz0123456789' + 'abcdefghijklmnopqrstuvwxyz0123456789' + 'abcdefghijklmnopqrstuvwxyz0123456789' + 'abcdefghijklmnopqrstuvwxyz0123456789' + 'abcdefghijklmnopqrstuvwxyz0123456789' + }, + 'targets': [ + { + 'target_name': 'multiple_action_target', + 'type': 'none', + 'actions': [ + { + 'action_name': 'action1', + 'inputs': [ + 'copy.py', + 'input.txt', + ], + 'outputs': [ + 'output1.txt', + ], + 'action': [ + 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + { + 'action_name': 'action2', + 'inputs': [ + 'copy.py', + 'input.txt', + ], + 'outputs': [ + 'output2.txt', + ], + 'action': [ + 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + { + 'action_name': 'action3', + 'inputs': [ + 'copy.py', + 'input.txt', + ], + 'outputs': [ + 'output3.txt', + ], + 'action': [ + 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + { + 'action_name': 'action4', + 'inputs': [ + 'copy.py', + 'input.txt', + ], + 'outputs': [ + 'output4.txt', + ], + 'action': [ + 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + { + 'target_name': 'multiple_action_source_filter', + 'type': 'executable', + 'sources': [ + 'main.c', + # TODO(bradnelson): add foo.c here once this issue is fixed: + # http://code.google.com/p/gyp/issues/detail?id=175 + ], + 'actions': [ + { + 'action_name': 'action1', + 'inputs': [ + 'foo.c', + 'filter.py', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/output1.c', + ], + 'process_outputs_as_sources': 1, + 'action': [ + 'python', 'filter.py', 'foo', 'bar', 'foo.c', '<@(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + { + 'action_name': 'action2', + 'inputs': [ + 'foo.c', + 'filter.py', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/output2.c', + ], + 'process_outputs_as_sources': 1, + 'action': [ + 'python', 'filter.py', 'foo', 'car', 'foo.c', '<@(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + { + 'action_name': 'action3', + 'inputs': [ + 'foo.c', + 'filter.py', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/output3.c', + ], + 'process_outputs_as_sources': 1, + 'action': [ + 'python', 'filter.py', 'foo', 'dar', 'foo.c', '<@(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + { + 'action_name': 'action4', + 'inputs': [ + 'foo.c', + 'filter.py', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/output4.c', + ], + 'process_outputs_as_sources': 1, + 'action': [ + 'python', 'filter.py', 'foo', 'ear', 'foo.c', '<@(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + { + 'target_name': 'multiple_dependent_target', + 'type': 'none', + 'actions': [ + { + 'action_name': 'action1', + 'inputs': [ + 'copy.py', + 'input.txt', + ], + 'outputs': [ + 'multi1.txt', + ], + 'action': [ + 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + { + 'action_name': 'action2', + 'inputs': [ + 'copy.py', + 'input.txt', + ], + 'outputs': [ + 'multi2.txt', + ], + 'action': [ + 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + 'dependencies': [ + 'multiple_required_target', + ], + }, + { + 'target_name': 'multiple_required_target', + 'type': 'none', + 'actions': [ + { + 'action_name': 'multi_dep', + 'inputs': [ + 'copy.py', + 'input.txt', + ], + 'outputs': [ + 'multi_dep.txt', + ], + 'process_outputs_as_sources': 1, + 'action': [ + 'python', '<@(_inputs)', '<(_outputs)', '<(long_string)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/actions-multiple/src/copy.py b/tools/gyp/test/actions-multiple/src/copy.py new file mode 100755 index 000000000..077467938 --- /dev/null +++ b/tools/gyp/test/actions-multiple/src/copy.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import shutil +import sys + +shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/tools/gyp/test/actions-multiple/src/filter.py b/tools/gyp/test/actions-multiple/src/filter.py new file mode 100755 index 000000000..f61a5fa59 --- /dev/null +++ b/tools/gyp/test/actions-multiple/src/filter.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +import sys + +data = open(sys.argv[3], 'r').read() +fh = open(sys.argv[4], 'w') +fh.write(data.replace(sys.argv[1], sys.argv[2])) +fh.close() diff --git a/tools/gyp/test/actions-multiple/src/foo.c b/tools/gyp/test/actions-multiple/src/foo.c new file mode 100644 index 000000000..23c4ef7f2 --- /dev/null +++ b/tools/gyp/test/actions-multiple/src/foo.c @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include + +void foo(void) { + printf("foo\n"); +} diff --git a/tools/gyp/test/actions-multiple/src/input.txt b/tools/gyp/test/actions-multiple/src/input.txt new file mode 100644 index 000000000..c7c7da3c6 --- /dev/null +++ b/tools/gyp/test/actions-multiple/src/input.txt @@ -0,0 +1 @@ +hello there diff --git a/tools/gyp/test/actions-multiple/src/main.c b/tools/gyp/test/actions-multiple/src/main.c new file mode 100644 index 000000000..0a420b903 --- /dev/null +++ b/tools/gyp/test/actions-multiple/src/main.c @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include + +void bar(void); +void car(void); +void dar(void); +void ear(void); + +int main() { + printf("{\n"); + bar(); + car(); + dar(); + ear(); + printf("}\n"); + return 0; +} diff --git a/tools/gyp/test/actions-none/gyptest-none.py b/tools/gyp/test/actions-none/gyptest-none.py new file mode 100755 index 000000000..d013a4ac1 --- /dev/null +++ b/tools/gyp/test/actions-none/gyptest-none.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies actions can be in 'none' type targets with source files. +""" + +import TestGyp + +test = TestGyp.TestGyp() +# TODO(bradnelson): fix scons. +if test.format == 'scons': + test.skip_test() + +test.run_gyp('none_with_source_files.gyp', chdir='src') +test.relocate('src', 'relocate/src') +test.build('none_with_source_files.gyp', chdir='relocate/src') + +file_content = 'foo.cc\n' + +test.built_file_must_match('fake.out', file_content, chdir='relocate/src') + +test.pass_test() diff --git a/tools/gyp/test/actions-none/src/fake_cross.py b/tools/gyp/test/actions-none/src/fake_cross.py new file mode 100644 index 000000000..2913f66a6 --- /dev/null +++ b/tools/gyp/test/actions-none/src/fake_cross.py @@ -0,0 +1,12 @@ +#!/usr/bin/python +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +import sys + +fh = open(sys.argv[-1], 'wb') +for filename in sys.argv[1:-1]: + fh.write(open(filename).read()) +fh.close() diff --git a/tools/gyp/test/actions-none/src/foo.cc b/tools/gyp/test/actions-none/src/foo.cc new file mode 100644 index 000000000..c6c61745b --- /dev/null +++ b/tools/gyp/test/actions-none/src/foo.cc @@ -0,0 +1 @@ +foo.cc diff --git a/tools/gyp/test/actions-none/src/none_with_source_files.gyp b/tools/gyp/test/actions-none/src/none_with_source_files.gyp new file mode 100644 index 000000000..e2aaebc10 --- /dev/null +++ b/tools/gyp/test/actions-none/src/none_with_source_files.gyp @@ -0,0 +1,35 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Test that 'none' type targets can have .cc files in them. + +{ + 'targets': [ + { + 'target_name': 'none_with_sources', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'foo.cc', + ], + 'actions': [ + { + 'action_name': 'fake_cross', + 'inputs': [ + 'fake_cross.py', + '<@(_sources)', + ], + 'outputs': [ + '<(PRODUCT_DIR)/fake.out', + ], + 'action': [ + 'python', '<@(_inputs)', '<@(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + } + ], + }, + ], +} diff --git a/tools/gyp/test/actions-subdir/gyptest-action.py b/tools/gyp/test/actions-subdir/gyptest-action.py new file mode 100755 index 000000000..09cfef189 --- /dev/null +++ b/tools/gyp/test/actions-subdir/gyptest-action.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Test actions that output to PRODUCT_DIR. +""" + +import TestGyp + +# TODO fix this for xcode: http://code.google.com/p/gyp/issues/detail?id=88 +test = TestGyp.TestGyp(formats=['!xcode']) + +test.run_gyp('none.gyp', chdir='src') + +test.build('none.gyp', test.ALL, chdir='src') + +file_content = 'Hello from make-file.py\n' +subdir_file_content = 'Hello from make-subdir-file.py\n' + +test.built_file_must_match('file.out', file_content, chdir='src') +test.built_file_must_match('subdir_file.out', subdir_file_content, chdir='src') + +test.pass_test() diff --git a/tools/gyp/test/actions-subdir/src/make-file.py b/tools/gyp/test/actions-subdir/src/make-file.py new file mode 100755 index 000000000..74e55811d --- /dev/null +++ b/tools/gyp/test/actions-subdir/src/make-file.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +contents = 'Hello from make-file.py\n' + +open(sys.argv[1], 'wb').write(contents) diff --git a/tools/gyp/test/actions-subdir/src/none.gyp b/tools/gyp/test/actions-subdir/src/none.gyp new file mode 100644 index 000000000..23f8d25a5 --- /dev/null +++ b/tools/gyp/test/actions-subdir/src/none.gyp @@ -0,0 +1,31 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'file', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'actions': [ + { + 'action_name': 'make-file', + 'inputs': [ + 'make-file.py', + ], + 'outputs': [ + '<(PRODUCT_DIR)/file.out', + ], + 'action': [ + 'python', '<(_inputs)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + } + ], + 'dependencies': [ + 'subdir/subdir.gyp:subdir_file', + ], + }, + ], +} diff --git a/tools/gyp/test/actions-subdir/src/subdir/make-subdir-file.py b/tools/gyp/test/actions-subdir/src/subdir/make-subdir-file.py new file mode 100755 index 000000000..80ce19ae0 --- /dev/null +++ b/tools/gyp/test/actions-subdir/src/subdir/make-subdir-file.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +contents = 'Hello from make-subdir-file.py\n' + +open(sys.argv[1], 'wb').write(contents) diff --git a/tools/gyp/test/actions-subdir/src/subdir/subdir.gyp b/tools/gyp/test/actions-subdir/src/subdir/subdir.gyp new file mode 100644 index 000000000..0315d4eb8 --- /dev/null +++ b/tools/gyp/test/actions-subdir/src/subdir/subdir.gyp @@ -0,0 +1,28 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'subdir_file', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'actions': [ + { + 'action_name': 'make-subdir-file', + 'inputs': [ + 'make-subdir-file.py', + ], + 'outputs': [ + '<(PRODUCT_DIR)/subdir_file.out', + ], + 'action': [ + 'python', '<(_inputs)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + } + ], + }, + ], +} diff --git a/tools/gyp/test/actions/gyptest-all.py b/tools/gyp/test/actions/gyptest-all.py new file mode 100755 index 000000000..ad04f1f28 --- /dev/null +++ b/tools/gyp/test/actions/gyptest-all.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simple actions when using an explicit build target of 'all'. +""" + +import glob +import os +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_all') + +test.run_gyp('actions.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +# Some gyp files use an action that mentions an output but never +# writes it as a means to making the action run on every build. That +# doesn't mesh well with ninja's semantics. TODO(evan): figure out +# how to work always-run actions in to ninja. +if test.format == 'ninja': + test.build('actions.gyp', test.ALL, chdir='relocate/src') +else: + # Test that an "always run" action increases a counter on multiple + # invocations, and that a dependent action updates in step. + test.build('actions.gyp', test.ALL, chdir='relocate/src') + test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1') + test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1') + test.build('actions.gyp', test.ALL, chdir='relocate/src') + test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') + test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') + + # The "always run" action only counts to 2, but the dependent target + # will count forever if it's allowed to run. This verifies that the + # dependent target only runs when the "always run" action generates + # new output, not just because the "always run" ran. + test.build('actions.gyp', test.ALL, chdir='relocate/src') + test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') + test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') + +expect = """\ +Hello from program.c +Hello from make-prog1.py +Hello from make-prog2.py +""" + +if test.format == 'xcode': + chdir = 'relocate/src/subdir1' +else: + chdir = 'relocate/src' +test.run_built_executable('program', chdir=chdir, stdout=expect) + + +test.must_match('relocate/src/subdir2/file.out', "Hello from make-file.py\n") + + +expect = "Hello from generate_main.py\n" + +if test.format == 'xcode': + chdir = 'relocate/src/subdir3' +else: + chdir = 'relocate/src' +test.run_built_executable('null_input', chdir=chdir, stdout=expect) + + +# Clean out files which may have been created if test.ALL was run. +def clean_dep_files(): + for file in (glob.glob('relocate/src/dep_*.txt') + + glob.glob('relocate/src/deps_all_done_*.txt')): + if os.path.exists(file): + os.remove(file) + +# Confirm our clean. +clean_dep_files() +test.must_not_exist('relocate/src/dep_1.txt') +test.must_not_exist('relocate/src/deps_all_done_first_123.txt') + +# Make sure all deps finish before an action is run on a 'None' target. +# If using the Make builder, add -j to make things more difficult. +arguments = [] +if test.format == 'make': + arguments = ['-j'] +test.build('actions.gyp', 'action_with_dependencies_123', chdir='relocate/src', + arguments=arguments) +test.must_exist('relocate/src/deps_all_done_first_123.txt') + +# Try again with a target that has deps in reverse. Output files from +# previous tests deleted. Confirm this execution did NOT run the ALL +# target which would mess up our dep tests. +clean_dep_files() +test.build('actions.gyp', 'action_with_dependencies_321', chdir='relocate/src', + arguments=arguments) +test.must_exist('relocate/src/deps_all_done_first_321.txt') +test.must_not_exist('relocate/src/deps_all_done_first_123.txt') + + +test.pass_test() diff --git a/tools/gyp/test/actions/gyptest-default.py b/tools/gyp/test/actions/gyptest-default.py new file mode 100755 index 000000000..b5bf7e99d --- /dev/null +++ b/tools/gyp/test/actions/gyptest-default.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simple actions when using the default build target. +""" + +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_default') + +test.run_gyp('actions.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +# Some gyp files use an action that mentions an output but never +# writes it as a means to making the action run on every build. That +# doesn't mesh well with ninja's semantics. TODO(evan): figure out +# how to work always-run actions in to ninja. +if test.format == 'ninja': + test.build('actions.gyp', test.ALL, chdir='relocate/src') +else: + # Test that an "always run" action increases a counter on multiple + # invocations, and that a dependent action updates in step. + test.build('actions.gyp', chdir='relocate/src') + test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '1') + test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '1') + test.build('actions.gyp', chdir='relocate/src') + test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') + test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') + + # The "always run" action only counts to 2, but the dependent target + # will count forever if it's allowed to run. This verifies that the + # dependent target only runs when the "always run" action generates + # new output, not just because the "always run" ran. + test.build('actions.gyp', test.ALL, chdir='relocate/src') + test.must_match('relocate/src/subdir1/actions-out/action-counter.txt', '2') + test.must_match('relocate/src/subdir1/actions-out/action-counter_2.txt', '2') + +expect = """\ +Hello from program.c +Hello from make-prog1.py +Hello from make-prog2.py +""" + +if test.format == 'xcode': + chdir = 'relocate/src/subdir1' +else: + chdir = 'relocate/src' +test.run_built_executable('program', chdir=chdir, stdout=expect) + + +test.must_match('relocate/src/subdir2/file.out', "Hello from make-file.py\n") + + +expect = "Hello from generate_main.py\n" + +if test.format == 'xcode': + chdir = 'relocate/src/subdir3' +else: + chdir = 'relocate/src' +test.run_built_executable('null_input', chdir=chdir, stdout=expect) + + +test.pass_test() diff --git a/tools/gyp/test/actions/gyptest-errors.py b/tools/gyp/test/actions/gyptest-errors.py new file mode 100755 index 000000000..e1ef883e1 --- /dev/null +++ b/tools/gyp/test/actions/gyptest-errors.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies behavior for different action configuration errors: +exit status of 1, and the expected error message must be in stderr. +""" + +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_errors') + + +test.run_gyp('action_missing_name.gyp', chdir='src', status=1, stderr=None) +expect = [ + "Anonymous action in target broken_actions2. An action must have an 'action_name' field.", +] +test.must_contain_all_lines(test.stderr(), expect) + + +test.pass_test() diff --git a/tools/gyp/test/actions/src/action_missing_name.gyp b/tools/gyp/test/actions/src/action_missing_name.gyp new file mode 100644 index 000000000..00424c35a --- /dev/null +++ b/tools/gyp/test/actions/src/action_missing_name.gyp @@ -0,0 +1,24 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'broken_actions2', + 'type': 'none', + 'actions': [ + { + 'inputs': [ + 'no_name.input', + ], + 'action': [ + 'python', + '-c', + 'print \'missing name\'', + ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/actions/src/actions.gyp b/tools/gyp/test/actions/src/actions.gyp new file mode 100644 index 000000000..5d2db1955 --- /dev/null +++ b/tools/gyp/test/actions/src/actions.gyp @@ -0,0 +1,114 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'pull_in_all_actions', + 'type': 'none', + 'dependencies': [ + 'subdir1/executable.gyp:*', + 'subdir2/none.gyp:*', + 'subdir3/null_input.gyp:*', + ], + }, + { + 'target_name': 'depend_on_always_run_action', + 'type': 'none', + 'dependencies': [ 'subdir1/executable.gyp:counter' ], + 'actions': [ + { + 'action_name': 'use_always_run_output', + 'inputs': [ + 'subdir1/actions-out/action-counter.txt', + 'subdir1/counter.py', + ], + 'outputs': [ + 'subdir1/actions-out/action-counter_2.txt', + ], + 'action': [ + 'python', 'subdir1/counter.py', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + + # Three deps which don't finish immediately. + # Each one has a small delay then creates a file. + # Delays are 1.0, 1.1, and 2.0 seconds. + { + 'target_name': 'dep_1', + 'type': 'none', + 'actions': [{ + 'inputs': [ 'actions.gyp' ], + 'outputs': [ 'dep_1.txt' ], + 'action_name': 'dep_1', + 'action': [ 'python', '-c', + 'import time; time.sleep(1); open(\'dep_1.txt\', \'w\')' ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }], + }, + { + 'target_name': 'dep_2', + 'type': 'none', + 'actions': [{ + 'inputs': [ 'actions.gyp' ], + 'outputs': [ 'dep_2.txt' ], + 'action_name': 'dep_2', + 'action': [ 'python', '-c', + 'import time; time.sleep(1.1); open(\'dep_2.txt\', \'w\')' ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }], + }, + { + 'target_name': 'dep_3', + 'type': 'none', + 'actions': [{ + 'inputs': [ 'actions.gyp' ], + 'outputs': [ 'dep_3.txt' ], + 'action_name': 'dep_3', + 'action': [ 'python', '-c', + 'import time; time.sleep(2.0); open(\'dep_3.txt\', \'w\')' ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }], + }, + + # An action which assumes the deps have completed. + # Does NOT list the output files of it's deps as inputs. + # On success create the file deps_all_done_first.txt. + { + 'target_name': 'action_with_dependencies_123', + 'type': 'none', + 'dependencies': [ 'dep_1', 'dep_2', 'dep_3' ], + 'actions': [{ + 'inputs': [ 'actions.gyp' ], + 'outputs': [ 'deps_all_done_first_123.txt' ], + 'action_name': 'action_with_dependencies_123', + 'action': [ 'python', 'confirm-dep-files.py', '<(_outputs)' ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }], + }, + # Same as above but with deps in reverse. + { + 'target_name': 'action_with_dependencies_321', + 'type': 'none', + 'dependencies': [ 'dep_3', 'dep_2', 'dep_1' ], + 'actions': [{ + 'inputs': [ 'actions.gyp' ], + 'outputs': [ 'deps_all_done_first_321.txt' ], + 'action_name': 'action_with_dependencies_321', + 'action': [ 'python', 'confirm-dep-files.py', '<(_outputs)' ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }], + }, + + ], +} diff --git a/tools/gyp/test/actions/src/confirm-dep-files.py b/tools/gyp/test/actions/src/confirm-dep-files.py new file mode 100755 index 000000000..3b8463057 --- /dev/null +++ b/tools/gyp/test/actions/src/confirm-dep-files.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Confirms presence of files generated by our targets we depend on. +If they exist, create a new file. + +Note target's input files are explicitly NOT defined in the gyp file +so they can't easily be passed to this script as args. +""" + +import os +import sys + +outfile = sys.argv[1] # Example value we expect: deps_all_done_first_123.txt +if (os.path.exists("dep_1.txt") and + os.path.exists("dep_2.txt") and + os.path.exists("dep_3.txt")): + open(outfile, "w") diff --git a/tools/gyp/test/actions/src/subdir1/counter.py b/tools/gyp/test/actions/src/subdir1/counter.py new file mode 100755 index 000000000..3612d7d2b --- /dev/null +++ b/tools/gyp/test/actions/src/subdir1/counter.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys +import time + +output = sys.argv[1] +persistoutput = "%s.persist" % sys.argv[1] + +count = 0 +try: + count = open(persistoutput, 'r').read() +except: + pass +count = int(count) + 1 + +if len(sys.argv) > 2: + max_count = int(sys.argv[2]) + if count > max_count: + count = max_count + +oldcount = 0 +try: + oldcount = open(output, 'r').read() +except: + pass + +# Save the count in a file that is undeclared, and thus hidden, to gyp. We need +# to do this because, prior to running commands, scons deletes any declared +# outputs, so we would lose our count if we just wrote to the given output file. +# (The other option is to use Precious() in the scons generator, but that seems +# too heavy-handed just to support this somewhat unrealistic test case, and +# might lead to unintended side-effects). +open(persistoutput, 'w').write('%d' % (count)) + +# Only write the given output file if the count has changed. +if int(oldcount) != count: + open(output, 'w').write('%d' % (count)) + # Sleep so the next run changes the file time sufficiently to make the build + # detect the file as changed. + time.sleep(1) + +sys.exit(0) diff --git a/tools/gyp/test/actions/src/subdir1/executable.gyp b/tools/gyp/test/actions/src/subdir1/executable.gyp new file mode 100644 index 000000000..6a1ce4f91 --- /dev/null +++ b/tools/gyp/test/actions/src/subdir1/executable.gyp @@ -0,0 +1,74 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'program', + 'type': 'executable', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'program.c', + ], + 'actions': [ + { + 'action_name': 'make-prog1', + 'inputs': [ + 'make-prog1.py', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/prog1.c', + ], + 'action': [ + 'python', '<(_inputs)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + { + 'action_name': 'make-prog2', + 'inputs': [ + 'make-prog2.py', + ], + 'outputs': [ + 'actions-out/prog2.c', + ], + 'action': [ + 'python', '<(_inputs)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + { + 'target_name': 'counter', + 'type': 'none', + 'actions': [ + { + # This action should always run, regardless of whether or not it's + # inputs or the command-line change. We do this by creating a dummy + # first output, which is always missing, thus causing the build to + # always try to recreate it. Actual output files should be listed + # after the dummy one, and dependent targets should list the real + # output(s) in their inputs + # (see '../actions.gyp:depend_on_always_run_action'). + 'action_name': 'action_counter', + 'inputs': [ + 'counter.py', + ], + 'outputs': [ + 'actions-out/action-counter.txt.always', + 'actions-out/action-counter.txt', + ], + 'action': [ + 'python', '<(_inputs)', 'actions-out/action-counter.txt', '2', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/actions/src/subdir1/make-prog1.py b/tools/gyp/test/actions/src/subdir1/make-prog1.py new file mode 100755 index 000000000..7ea1d8a2d --- /dev/null +++ b/tools/gyp/test/actions/src/subdir1/make-prog1.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +contents = r""" +#include + +void prog1(void) +{ + printf("Hello from make-prog1.py\n"); +} +""" + +open(sys.argv[1], 'w').write(contents) + +sys.exit(0) diff --git a/tools/gyp/test/actions/src/subdir1/make-prog2.py b/tools/gyp/test/actions/src/subdir1/make-prog2.py new file mode 100755 index 000000000..0bfe4973c --- /dev/null +++ b/tools/gyp/test/actions/src/subdir1/make-prog2.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +contents = r""" +#include + +void prog2(void) +{ + printf("Hello from make-prog2.py\n"); +} +""" + +open(sys.argv[1], 'w').write(contents) + +sys.exit(0) diff --git a/tools/gyp/test/actions/src/subdir1/program.c b/tools/gyp/test/actions/src/subdir1/program.c new file mode 100644 index 000000000..d5f661d90 --- /dev/null +++ b/tools/gyp/test/actions/src/subdir1/program.c @@ -0,0 +1,12 @@ +#include + +extern void prog1(void); +extern void prog2(void); + +int main(int argc, char *argv[]) +{ + printf("Hello from program.c\n"); + prog1(); + prog2(); + return 0; +} diff --git a/tools/gyp/test/actions/src/subdir2/make-file.py b/tools/gyp/test/actions/src/subdir2/make-file.py new file mode 100755 index 000000000..fff065314 --- /dev/null +++ b/tools/gyp/test/actions/src/subdir2/make-file.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +contents = "Hello from make-file.py\n" + +open(sys.argv[1], 'wb').write(contents) diff --git a/tools/gyp/test/actions/src/subdir2/none.gyp b/tools/gyp/test/actions/src/subdir2/none.gyp new file mode 100644 index 000000000..2caa97d55 --- /dev/null +++ b/tools/gyp/test/actions/src/subdir2/none.gyp @@ -0,0 +1,33 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'file', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'actions': [ + { + 'action_name': 'make-file', + 'inputs': [ + 'make-file.py', + ], + 'outputs': [ + 'file.out', + # TODO: enhance testing infrastructure to test this + # without having to hard-code the intermediate dir paths. + #'<(INTERMEDIATE_DIR)/file.out', + ], + 'action': [ + 'python', '<(_inputs)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + } + ], + }, + ], +} diff --git a/tools/gyp/test/actions/src/subdir3/generate_main.py b/tools/gyp/test/actions/src/subdir3/generate_main.py new file mode 100755 index 000000000..b90b3aa6d --- /dev/null +++ b/tools/gyp/test/actions/src/subdir3/generate_main.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +contents = """ +#include + +int main(int argc, char *argv[]) +{ + printf("Hello from generate_main.py\\n"); + return 0; +} +""" + +open(sys.argv[1], 'w').write(contents) + +sys.exit(0) diff --git a/tools/gyp/test/actions/src/subdir3/null_input.gyp b/tools/gyp/test/actions/src/subdir3/null_input.gyp new file mode 100644 index 000000000..9b0bea5fd --- /dev/null +++ b/tools/gyp/test/actions/src/subdir3/null_input.gyp @@ -0,0 +1,29 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'null_input', + 'type': 'executable', + 'msvs_cygwin_shell': 0, + 'actions': [ + { + 'action_name': 'generate_main', + 'process_outputs_as_sources': 1, + 'inputs': [], + 'outputs': [ + '<(INTERMEDIATE_DIR)/main.c', + ], + 'action': [ + # TODO: we can't just use <(_outputs) here?! + 'python', 'generate_main.py', '<(INTERMEDIATE_DIR)/main.c', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/additional-targets/gyptest-additional.py b/tools/gyp/test/additional-targets/gyptest-additional.py new file mode 100755 index 000000000..af35b33de --- /dev/null +++ b/tools/gyp/test/additional-targets/gyptest-additional.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simple actions when using an explicit build target of 'all'. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('all.gyp', chdir='src') +test.relocate('src', 'relocate/src') + +# Build all. +test.build('all.gyp', chdir='relocate/src') + +if test.format=='xcode': + chdir = 'relocate/src/dir1' +else: + chdir = 'relocate/src' + +# Output is as expected. +file_content = 'Hello from emit.py\n' +test.built_file_must_match('out2.txt', file_content, chdir=chdir) + +test.built_file_must_not_exist('out.txt', chdir='relocate/src') +test.built_file_must_not_exist('foolib1', + type=test.SHARED_LIB, + chdir=chdir) + +# TODO(mmoss) Make consistent with scons, with 'dir1' before 'out/Default'? +if test.format in ('make', 'ninja'): + chdir='relocate/src' +else: + chdir='relocate/src/dir1' + +# Build the action explicitly. +test.build('actions.gyp', 'action1_target', chdir=chdir) + +# Check that things got run. +file_content = 'Hello from emit.py\n' +test.built_file_must_exist('out.txt', chdir=chdir) + +# Build the shared library explicitly. +test.build('actions.gyp', 'foolib1', chdir=chdir) + +test.built_file_must_exist('foolib1', + type=test.SHARED_LIB, + chdir=chdir) + +test.pass_test() diff --git a/tools/gyp/test/additional-targets/src/all.gyp b/tools/gyp/test/additional-targets/src/all.gyp new file mode 100644 index 000000000..21c83080a --- /dev/null +++ b/tools/gyp/test/additional-targets/src/all.gyp @@ -0,0 +1,13 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'all_targets', + 'type': 'none', + 'dependencies': ['dir1/actions.gyp:*'], + }, + ], +} diff --git a/tools/gyp/test/additional-targets/src/dir1/actions.gyp b/tools/gyp/test/additional-targets/src/dir1/actions.gyp new file mode 100644 index 000000000..5089c8091 --- /dev/null +++ b/tools/gyp/test/additional-targets/src/dir1/actions.gyp @@ -0,0 +1,56 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'action1_target', + 'type': 'none', + 'suppress_wildcard': 1, + 'actions': [ + { + 'action_name': 'action1', + 'inputs': [ + 'emit.py', + ], + 'outputs': [ + '<(PRODUCT_DIR)/out.txt', + ], + 'action': ['python', 'emit.py', '<(PRODUCT_DIR)/out.txt'], + 'msvs_cygwin_shell': 0, + }, + ], + }, + { + 'target_name': 'action2_target', + 'type': 'none', + 'actions': [ + { + 'action_name': 'action2', + 'inputs': [ + 'emit.py', + ], + 'outputs': [ + '<(PRODUCT_DIR)/out2.txt', + ], + 'action': ['python', 'emit.py', '<(PRODUCT_DIR)/out2.txt'], + 'msvs_cygwin_shell': 0, + }, + ], + }, + { + 'target_name': 'foolib1', + 'type': 'shared_library', + 'suppress_wildcard': 1, + 'sources': ['lib1.c'], + }, + ], + 'conditions': [ + ['OS=="linux"', { + 'target_defaults': { + 'cflags': ['-fPIC'], + }, + }], + ], +} diff --git a/tools/gyp/test/additional-targets/src/dir1/emit.py b/tools/gyp/test/additional-targets/src/dir1/emit.py new file mode 100755 index 000000000..fd3138738 --- /dev/null +++ b/tools/gyp/test/additional-targets/src/dir1/emit.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +f = open(sys.argv[1], 'wb') +f.write('Hello from emit.py\n') +f.close() diff --git a/tools/gyp/test/additional-targets/src/dir1/lib1.c b/tools/gyp/test/additional-targets/src/dir1/lib1.c new file mode 100644 index 000000000..df4cb10f7 --- /dev/null +++ b/tools/gyp/test/additional-targets/src/dir1/lib1.c @@ -0,0 +1,6 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int func1(void) { + return 42; +} diff --git a/tools/gyp/test/assembly/gyptest-assembly.py b/tools/gyp/test/assembly/gyptest-assembly.py new file mode 100755 index 000000000..8a8431054 --- /dev/null +++ b/tools/gyp/test/assembly/gyptest-assembly.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +A basic test of compiling assembler files. +""" + +import sys +import TestGyp + +if sys.platform != 'win32': + # TODO(bradnelson): get this working for windows. + test = TestGyp.TestGyp(formats=['!msvs']) + + test.run_gyp('assembly.gyp', chdir='src') + + test.relocate('src', 'relocate/src') + + test.build('assembly.gyp', test.ALL, chdir='relocate/src') + + expect = """\ +Hello from program.c +Got 42. +""" + test.run_built_executable('program', chdir='relocate/src', stdout=expect) + + + test.pass_test() diff --git a/tools/gyp/test/assembly/src/as.bat b/tools/gyp/test/assembly/src/as.bat new file mode 100644 index 000000000..0a47382cb --- /dev/null +++ b/tools/gyp/test/assembly/src/as.bat @@ -0,0 +1,4 @@ +@echo off +:: Mock windows assembler. +cl /c %1 /Fo"%2" + diff --git a/tools/gyp/test/assembly/src/assembly.gyp b/tools/gyp/test/assembly/src/assembly.gyp new file mode 100644 index 000000000..872dd5ec0 --- /dev/null +++ b/tools/gyp/test/assembly/src/assembly.gyp @@ -0,0 +1,59 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'conditions': [ + ['OS=="win"', { + 'defines': ['PLATFORM_WIN'], + }], + ['OS=="mac"', { + 'defines': ['PLATFORM_MAC'], + }], + ['OS=="linux"', { + 'defines': ['PLATFORM_LINUX'], + }], + ], + }, + 'targets': [ + { + 'target_name': 'program', + 'type': 'executable', + 'dependencies': ['lib1'], + 'sources': [ + 'program.c', + ], + }, + { + 'target_name': 'lib1', + 'type': 'static_library', + 'sources': [ + 'lib1.S', + ], + }, + ], + 'conditions': [ + ['OS=="win"', { + 'target_defaults': { + 'rules': [ + { + 'rule_name': 'assembler', + 'msvs_cygwin_shell': 0, + 'extension': 'S', + 'inputs': [ + 'as.bat', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj', + ], + 'action': + ['as.bat', 'lib1.c', '<(_outputs)'], + 'message': 'Building assembly file <(RULE_INPUT_PATH)', + 'process_outputs_as_sources': 1, + }, + ], + }, + },], + ], +} diff --git a/tools/gyp/test/assembly/src/lib1.S b/tools/gyp/test/assembly/src/lib1.S new file mode 100644 index 000000000..e7102bf24 --- /dev/null +++ b/tools/gyp/test/assembly/src/lib1.S @@ -0,0 +1,10 @@ +#if PLATFORM_WINDOWS || PLATFORM_MAC +# define IDENTIFIER(n) _##n +#else /* Linux */ +# define IDENTIFIER(n) n +#endif + +.globl IDENTIFIER(lib1_function) +IDENTIFIER(lib1_function): + movl $42, %eax + ret diff --git a/tools/gyp/test/assembly/src/lib1.c b/tools/gyp/test/assembly/src/lib1.c new file mode 100644 index 000000000..be21ecd5f --- /dev/null +++ b/tools/gyp/test/assembly/src/lib1.c @@ -0,0 +1,3 @@ +int lib1_function(void) { + return 42; +} diff --git a/tools/gyp/test/assembly/src/program.c b/tools/gyp/test/assembly/src/program.c new file mode 100644 index 000000000..ecce3b0bb --- /dev/null +++ b/tools/gyp/test/assembly/src/program.c @@ -0,0 +1,12 @@ +#include + +extern int lib1_function(void); + +int main(int argc, char *argv[]) +{ + fprintf(stdout, "Hello from program.c\n"); + fflush(stdout); + fprintf(stdout, "Got %d.\n", lib1_function()); + fflush(stdout); + return 0; +} diff --git a/tools/gyp/test/builddir/gyptest-all.py b/tools/gyp/test/builddir/gyptest-all.py new file mode 100755 index 000000000..885d680bd --- /dev/null +++ b/tools/gyp/test/builddir/gyptest-all.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify the settings that cause a set of programs to be created in +a specific build directory, and that no intermediate built files +get created outside of that build directory hierarchy even when +referred to with deeply-nested ../../.. paths. +""" + +import TestGyp + +# TODO(mmoss): Make only supports (theoretically) a single, global build +# directory (through GYP_GENERATOR_FLAGS 'output_dir'), rather than +# gyp-file-specific settings (e.g. the stuff in builddir.gypi) that the other +# generators support, so this doesn't work yet for make. +# TODO(mmoss) Make also has the issue that the top-level Makefile is written to +# the "--depth" location, which is one level above 'src', but then this test +# moves 'src' somewhere else, leaving the Makefile behind, so make can't find +# its sources. I'm not sure if make is wrong for writing outside the current +# directory, or if the test is wrong for assuming everything generated is under +# the current directory. +test = TestGyp.TestGyp(formats=['!make', '!ninja']) + +test.run_gyp('prog1.gyp', '--depth=..', chdir='src') + +test.relocate('src', 'relocate/src') + +test.subdir('relocate/builddir') + +# Make sure that all the built ../../etc. files only get put under builddir, +# by making all of relocate read-only and then making only builddir writable. +test.writable('relocate', False) +test.writable('relocate/builddir', True) + +# Suppress the test infrastructure's setting SYMROOT on the command line. +test.build('prog1.gyp', test.ALL, SYMROOT=None, chdir='relocate/src') + +expect1 = """\ +Hello from prog1.c +Hello from func1.c +""" + +expect2 = """\ +Hello from subdir2/prog2.c +Hello from func2.c +""" + +expect3 = """\ +Hello from subdir2/subdir3/prog3.c +Hello from func3.c +""" + +expect4 = """\ +Hello from subdir2/subdir3/subdir4/prog4.c +Hello from func4.c +""" + +expect5 = """\ +Hello from subdir2/subdir3/subdir4/subdir5/prog5.c +Hello from func5.c +""" + +def run_builddir(prog, expect): + dir = 'relocate/builddir/Default/' + test.run(program=test.workpath(dir + prog), stdout=expect) + +run_builddir('prog1', expect1) +run_builddir('prog2', expect2) +run_builddir('prog3', expect3) +run_builddir('prog4', expect4) +run_builddir('prog5', expect5) + +test.pass_test() diff --git a/tools/gyp/test/builddir/gyptest-default.py b/tools/gyp/test/builddir/gyptest-default.py new file mode 100755 index 000000000..8c6302618 --- /dev/null +++ b/tools/gyp/test/builddir/gyptest-default.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify the settings that cause a set of programs to be created in +a specific build directory, and that no intermediate built files +get created outside of that build directory hierarchy even when +referred to with deeply-nested ../../.. paths. +""" + +import TestGyp + +# TODO(mmoss): Make only supports (theoretically) a single, global build +# directory (through GYP_GENERATOR_FLAGS 'output_dir'), rather than +# gyp-file-specific settings (e.g. the stuff in builddir.gypi) that the other +# generators support, so this doesn't work yet for make. +# TODO(mmoss) Make also has the issue that the top-level Makefile is written to +# the "--depth" location, which is one level above 'src', but then this test +# moves 'src' somewhere else, leaving the Makefile behind, so make can't find +# its sources. I'm not sure if make is wrong for writing outside the current +# directory, or if the test is wrong for assuming everything generated is under +# the current directory. +test = TestGyp.TestGyp(formats=['!make', '!ninja']) + +test.run_gyp('prog1.gyp', '--depth=..', chdir='src') + +test.relocate('src', 'relocate/src') + +test.subdir('relocate/builddir') + +# Make sure that all the built ../../etc. files only get put under builddir, +# by making all of relocate read-only and then making only builddir writable. +test.writable('relocate', False) +test.writable('relocate/builddir', True) + +# Suppress the test infrastructure's setting SYMROOT on the command line. +test.build('prog1.gyp', SYMROOT=None, chdir='relocate/src') + +expect1 = """\ +Hello from prog1.c +Hello from func1.c +""" + +expect2 = """\ +Hello from subdir2/prog2.c +Hello from func2.c +""" + +expect3 = """\ +Hello from subdir2/subdir3/prog3.c +Hello from func3.c +""" + +expect4 = """\ +Hello from subdir2/subdir3/subdir4/prog4.c +Hello from func4.c +""" + +expect5 = """\ +Hello from subdir2/subdir3/subdir4/subdir5/prog5.c +Hello from func5.c +""" + +def run_builddir(prog, expect): + dir = 'relocate/builddir/Default/' + test.run(program=test.workpath(dir + prog), stdout=expect) + +run_builddir('prog1', expect1) +run_builddir('prog2', expect2) +run_builddir('prog3', expect3) +run_builddir('prog4', expect4) +run_builddir('prog5', expect5) + +test.pass_test() diff --git a/tools/gyp/test/builddir/src/builddir.gypi b/tools/gyp/test/builddir/src/builddir.gypi new file mode 100644 index 000000000..e3c61475b --- /dev/null +++ b/tools/gyp/test/builddir/src/builddir.gypi @@ -0,0 +1,21 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'configurations': { + 'Default': { + 'msvs_configuration_attributes': { + 'OutputDirectory': '<(DEPTH)\\builddir\Default', + }, + }, + }, + }, + 'scons_settings': { + 'sconsbuild_dir': '<(DEPTH)/builddir', + }, + 'xcode_settings': { + 'SYMROOT': '<(DEPTH)/builddir', + }, +} diff --git a/tools/gyp/test/builddir/src/func1.c b/tools/gyp/test/builddir/src/func1.c new file mode 100644 index 000000000..b8e6a0695 --- /dev/null +++ b/tools/gyp/test/builddir/src/func1.c @@ -0,0 +1,6 @@ +#include + +void func1(void) +{ + printf("Hello from func1.c\n"); +} diff --git a/tools/gyp/test/builddir/src/func2.c b/tools/gyp/test/builddir/src/func2.c new file mode 100644 index 000000000..14aabac47 --- /dev/null +++ b/tools/gyp/test/builddir/src/func2.c @@ -0,0 +1,6 @@ +#include + +void func2(void) +{ + printf("Hello from func2.c\n"); +} diff --git a/tools/gyp/test/builddir/src/func3.c b/tools/gyp/test/builddir/src/func3.c new file mode 100644 index 000000000..3b4edeae6 --- /dev/null +++ b/tools/gyp/test/builddir/src/func3.c @@ -0,0 +1,6 @@ +#include + +void func3(void) +{ + printf("Hello from func3.c\n"); +} diff --git a/tools/gyp/test/builddir/src/func4.c b/tools/gyp/test/builddir/src/func4.c new file mode 100644 index 000000000..732891b79 --- /dev/null +++ b/tools/gyp/test/builddir/src/func4.c @@ -0,0 +1,6 @@ +#include + +void func4(void) +{ + printf("Hello from func4.c\n"); +} diff --git a/tools/gyp/test/builddir/src/func5.c b/tools/gyp/test/builddir/src/func5.c new file mode 100644 index 000000000..18fdfabbb --- /dev/null +++ b/tools/gyp/test/builddir/src/func5.c @@ -0,0 +1,6 @@ +#include + +void func5(void) +{ + printf("Hello from func5.c\n"); +} diff --git a/tools/gyp/test/builddir/src/prog1.c b/tools/gyp/test/builddir/src/prog1.c new file mode 100644 index 000000000..674ca747b --- /dev/null +++ b/tools/gyp/test/builddir/src/prog1.c @@ -0,0 +1,10 @@ +#include + +extern void func1(void); + +int main(int argc, char *argv[]) +{ + printf("Hello from prog1.c\n"); + func1(); + return 0; +} diff --git a/tools/gyp/test/builddir/src/prog1.gyp b/tools/gyp/test/builddir/src/prog1.gyp new file mode 100644 index 000000000..5b96f035e --- /dev/null +++ b/tools/gyp/test/builddir/src/prog1.gyp @@ -0,0 +1,30 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + 'builddir.gypi', + ], + 'targets': [ + { + 'target_name': 'pull_in_all', + 'type': 'none', + 'dependencies': [ + 'prog1', + 'subdir2/prog2.gyp:prog2', + 'subdir2/subdir3/prog3.gyp:prog3', + 'subdir2/subdir3/subdir4/prog4.gyp:prog4', + 'subdir2/subdir3/subdir4/subdir5/prog5.gyp:prog5', + ], + }, + { + 'target_name': 'prog1', + 'type': 'executable', + 'sources': [ + 'prog1.c', + 'func1.c', + ], + }, + ], +} diff --git a/tools/gyp/test/builddir/src/subdir2/prog2.c b/tools/gyp/test/builddir/src/subdir2/prog2.c new file mode 100644 index 000000000..bbdf4f060 --- /dev/null +++ b/tools/gyp/test/builddir/src/subdir2/prog2.c @@ -0,0 +1,10 @@ +#include + +extern void func2(void); + +int main(int argc, char *argv[]) +{ + printf("Hello from subdir2/prog2.c\n"); + func2(); + return 0; +} diff --git a/tools/gyp/test/builddir/src/subdir2/prog2.gyp b/tools/gyp/test/builddir/src/subdir2/prog2.gyp new file mode 100644 index 000000000..96299b646 --- /dev/null +++ b/tools/gyp/test/builddir/src/subdir2/prog2.gyp @@ -0,0 +1,19 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + '../builddir.gypi', + ], + 'targets': [ + { + 'target_name': 'prog2', + 'type': 'executable', + 'sources': [ + 'prog2.c', + '../func2.c', + ], + }, + ], +} diff --git a/tools/gyp/test/builddir/src/subdir2/subdir3/prog3.c b/tools/gyp/test/builddir/src/subdir2/subdir3/prog3.c new file mode 100644 index 000000000..10c530b23 --- /dev/null +++ b/tools/gyp/test/builddir/src/subdir2/subdir3/prog3.c @@ -0,0 +1,10 @@ +#include + +extern void func3(void); + +int main(int argc, char *argv[]) +{ + printf("Hello from subdir2/subdir3/prog3.c\n"); + func3(); + return 0; +} diff --git a/tools/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp b/tools/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp new file mode 100644 index 000000000..d7df43c7b --- /dev/null +++ b/tools/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp @@ -0,0 +1,19 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + '../../builddir.gypi', + ], + 'targets': [ + { + 'target_name': 'prog3', + 'type': 'executable', + 'sources': [ + 'prog3.c', + '../../func3.c', + ], + }, + ], +} diff --git a/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c b/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c new file mode 100644 index 000000000..dcba9a9d4 --- /dev/null +++ b/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c @@ -0,0 +1,10 @@ +#include + +extern void func4(void); + +int main(int argc, char *argv[]) +{ + printf("Hello from subdir2/subdir3/subdir4/prog4.c\n"); + func4(); + return 0; +} diff --git a/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp b/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp new file mode 100644 index 000000000..862a8a18c --- /dev/null +++ b/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp @@ -0,0 +1,19 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + '../../../builddir.gypi', + ], + 'targets': [ + { + 'target_name': 'prog4', + 'type': 'executable', + 'sources': [ + 'prog4.c', + '../../../func4.c', + ], + }, + ], +} diff --git a/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c b/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c new file mode 100644 index 000000000..69132e576 --- /dev/null +++ b/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c @@ -0,0 +1,10 @@ +#include + +extern void func5(void); + +int main(int argc, char *argv[]) +{ + printf("Hello from subdir2/subdir3/subdir4/subdir5/prog5.c\n"); + func5(); + return 0; +} diff --git a/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp b/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp new file mode 100644 index 000000000..fe1c9cbf5 --- /dev/null +++ b/tools/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp @@ -0,0 +1,19 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + '../../../../builddir.gypi', + ], + 'targets': [ + { + 'target_name': 'prog5', + 'type': 'executable', + 'sources': [ + 'prog5.c', + '../../../../func5.c', + ], + }, + ], +} diff --git a/tools/gyp/test/cflags/cflags.c b/tools/gyp/test/cflags/cflags.c new file mode 100644 index 000000000..c1e245207 --- /dev/null +++ b/tools/gyp/test/cflags/cflags.c @@ -0,0 +1,15 @@ +/* Copyright (c) 2010 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +int main(int argc, char *argv[]) +{ +#ifdef __OPTIMIZE__ + printf("Using an optimization flag\n"); +#else + printf("Using no optimization flag\n"); +#endif + return 0; +} diff --git a/tools/gyp/test/cflags/cflags.gyp b/tools/gyp/test/cflags/cflags.gyp new file mode 100644 index 000000000..9003fb167 --- /dev/null +++ b/tools/gyp/test/cflags/cflags.gyp @@ -0,0 +1,16 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'cflags', + 'type': 'executable', + 'opt': '-Os', + 'sources': [ + 'cflags.c', + ], + }, + ], +} diff --git a/tools/gyp/test/cflags/gyptest-cflags.py b/tools/gyp/test/cflags/gyptest-cflags.py new file mode 100755 index 000000000..acc424a2c --- /dev/null +++ b/tools/gyp/test/cflags/gyptest-cflags.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python + +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies build of an executable with C++ define specified by a gyp define, and +the use of the environment during regeneration when the gyp file changes. +""" + +import os +import TestGyp + +env_stack = [] + + +def PushEnv(): + env_copy = os.environ.copy() + env_stack.append(env_copy) + +def PopEnv(): + os.eniron=env_stack.pop() + +# Regenerating build files when a gyp file changes is currently only supported +# by the make generator. +test = TestGyp.TestGyp(formats=['make']) + +try: + PushEnv() + os.environ['CFLAGS'] = '-O0' + test.run_gyp('cflags.gyp') +finally: + # We clear the environ after calling gyp. When the auto-regeneration happens, + # the same define should be reused anyway. Reset to empty string first in + # case the platform doesn't support unsetenv. + PopEnv() + +test.build('cflags.gyp') + +expect = """\ +Using no optimization flag +""" +test.run_built_executable('cflags', stdout=expect) + +test.sleep() + +try: + PushEnv() + os.environ['CFLAGS'] = '-O2' + test.run_gyp('cflags.gyp') +finally: + # We clear the environ after calling gyp. When the auto-regeneration happens, + # the same define should be reused anyway. Reset to empty string first in + # case the platform doesn't support unsetenv. + PopEnv() + +test.build('cflags.gyp') + +expect = """\ +Using an optimization flag +""" +test.run_built_executable('cflags', stdout=expect) + +test.pass_test() diff --git a/tools/gyp/test/compilable/gyptest-headers.py b/tools/gyp/test/compilable/gyptest-headers.py new file mode 100755 index 000000000..91760216f --- /dev/null +++ b/tools/gyp/test/compilable/gyptest-headers.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that .hpp files are ignored when included in the source list on all +platforms. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('headers.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('headers.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +Hello from program.c +Hello from lib1.c +""" +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + + +test.pass_test() diff --git a/tools/gyp/test/compilable/src/headers.gyp b/tools/gyp/test/compilable/src/headers.gyp new file mode 100644 index 000000000..b6c2a8857 --- /dev/null +++ b/tools/gyp/test/compilable/src/headers.gyp @@ -0,0 +1,26 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'program', + 'type': 'executable', + 'dependencies': [ + 'lib1' + ], + 'sources': [ + 'program.cpp', + ], + }, + { + 'target_name': 'lib1', + 'type': 'static_library', + 'sources': [ + 'lib1.hpp', + 'lib1.cpp', + ], + }, + ], +} diff --git a/tools/gyp/test/compilable/src/lib1.cpp b/tools/gyp/test/compilable/src/lib1.cpp new file mode 100644 index 000000000..51bc31a40 --- /dev/null +++ b/tools/gyp/test/compilable/src/lib1.cpp @@ -0,0 +1,7 @@ +#include +#include "lib1.hpp" + +void lib1_function(void) { + fprintf(stdout, "Hello from lib1.c\n"); + fflush(stdout); +} diff --git a/tools/gyp/test/compilable/src/lib1.hpp b/tools/gyp/test/compilable/src/lib1.hpp new file mode 100644 index 000000000..72e63e8ac --- /dev/null +++ b/tools/gyp/test/compilable/src/lib1.hpp @@ -0,0 +1,6 @@ +#ifndef _lib1_hpp +#define _lib1_hpp + +extern void lib1_function(void); + +#endif diff --git a/tools/gyp/test/compilable/src/program.cpp b/tools/gyp/test/compilable/src/program.cpp new file mode 100644 index 000000000..81420bad4 --- /dev/null +++ b/tools/gyp/test/compilable/src/program.cpp @@ -0,0 +1,9 @@ +#include +#include "lib1.hpp" + +int main(int argc, char *argv[]) { + fprintf(stdout, "Hello from program.c\n"); + fflush(stdout); + lib1_function(); + return 0; +} diff --git a/tools/gyp/test/configurations/basics/configurations.c b/tools/gyp/test/configurations/basics/configurations.c new file mode 100644 index 000000000..6c1f90016 --- /dev/null +++ b/tools/gyp/test/configurations/basics/configurations.c @@ -0,0 +1,15 @@ +#include + +int main(int argc, char *argv[]) +{ +#ifdef FOO + printf("Foo configuration\n"); +#endif +#ifdef DEBUG + printf("Debug configuration\n"); +#endif +#ifdef RELEASE + printf("Release configuration\n"); +#endif + return 0; +} diff --git a/tools/gyp/test/configurations/basics/configurations.gyp b/tools/gyp/test/configurations/basics/configurations.gyp new file mode 100644 index 000000000..93f1d8d5c --- /dev/null +++ b/tools/gyp/test/configurations/basics/configurations.gyp @@ -0,0 +1,32 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'executable', + 'sources': [ + 'configurations.c', + ], + 'configurations': { + 'Debug': { + 'defines': [ + 'DEBUG', + ], + }, + 'Release': { + 'defines': [ + 'RELEASE', + ], + }, + 'Foo': { + 'defines': [ + 'FOO', + ], + }, + } + }, + ], +} diff --git a/tools/gyp/test/configurations/basics/gyptest-configurations.py b/tools/gyp/test/configurations/basics/gyptest-configurations.py new file mode 100755 index 000000000..27cd2e87d --- /dev/null +++ b/tools/gyp/test/configurations/basics/gyptest-configurations.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies build of an executable in three different configurations. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('configurations.gyp') + +test.set_configuration('Release') +test.build('configurations.gyp') +test.run_built_executable('configurations', stdout="Release configuration\n") + +test.set_configuration('Debug') +test.build('configurations.gyp') +test.run_built_executable('configurations', stdout="Debug configuration\n") + +test.set_configuration('Foo') +test.build('configurations.gyp') +test.run_built_executable('configurations', stdout="Foo configuration\n") + +test.pass_test() diff --git a/tools/gyp/test/configurations/inheritance/configurations.c b/tools/gyp/test/configurations/inheritance/configurations.c new file mode 100644 index 000000000..2d5565eeb --- /dev/null +++ b/tools/gyp/test/configurations/inheritance/configurations.c @@ -0,0 +1,21 @@ +#include + +int main(int argc, char *argv[]) +{ +#ifdef BASE + printf("Base configuration\n"); +#endif +#ifdef COMMON + printf("Common configuration\n"); +#endif +#ifdef COMMON2 + printf("Common2 configuration\n"); +#endif +#ifdef DEBUG + printf("Debug configuration\n"); +#endif +#ifdef RELEASE + printf("Release configuration\n"); +#endif + return 0; +} diff --git a/tools/gyp/test/configurations/inheritance/configurations.gyp b/tools/gyp/test/configurations/inheritance/configurations.gyp new file mode 100644 index 000000000..9441376b4 --- /dev/null +++ b/tools/gyp/test/configurations/inheritance/configurations.gyp @@ -0,0 +1,40 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'configurations': { + 'Base': { + 'abstract': 1, + 'defines': ['BASE'], + }, + 'Common': { + 'abstract': 1, + 'inherit_from': ['Base'], + 'defines': ['COMMON'], + }, + 'Common2': { + 'abstract': 1, + 'defines': ['COMMON2'], + }, + 'Debug': { + 'inherit_from': ['Common', 'Common2'], + 'defines': ['DEBUG'], + }, + 'Release': { + 'inherit_from': ['Common', 'Common2'], + 'defines': ['RELEASE'], + }, + }, + }, + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'executable', + 'sources': [ + 'configurations.c', + ], + }, + ], +} diff --git a/tools/gyp/test/configurations/inheritance/gyptest-inheritance.py b/tools/gyp/test/configurations/inheritance/gyptest-inheritance.py new file mode 100755 index 000000000..22c73a375 --- /dev/null +++ b/tools/gyp/test/configurations/inheritance/gyptest-inheritance.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies build of an executable in three different configurations. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('configurations.gyp') + +test.set_configuration('Release') +test.build('configurations.gyp') +test.run_built_executable('configurations', + stdout=('Base configuration\n' + 'Common configuration\n' + 'Common2 configuration\n' + 'Release configuration\n')) + +test.set_configuration('Debug') +test.build('configurations.gyp') +test.run_built_executable('configurations', + stdout=('Base configuration\n' + 'Common configuration\n' + 'Common2 configuration\n' + 'Debug configuration\n')) + +test.pass_test() diff --git a/tools/gyp/test/configurations/invalid/actions.gyp b/tools/gyp/test/configurations/invalid/actions.gyp new file mode 100644 index 000000000..a6e42089e --- /dev/null +++ b/tools/gyp/test/configurations/invalid/actions.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'actions': [ + ], + }, + } + }, + ], +} diff --git a/tools/gyp/test/configurations/invalid/all_dependent_settings.gyp b/tools/gyp/test/configurations/invalid/all_dependent_settings.gyp new file mode 100644 index 000000000..b16a245df --- /dev/null +++ b/tools/gyp/test/configurations/invalid/all_dependent_settings.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'all_dependent_settings': [ + ], + }, + } + }, + ], +} diff --git a/tools/gyp/test/configurations/invalid/configurations.gyp b/tools/gyp/test/configurations/invalid/configurations.gyp new file mode 100644 index 000000000..2cfc96004 --- /dev/null +++ b/tools/gyp/test/configurations/invalid/configurations.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'configurations': [ + ], + }, + } + }, + ], +} diff --git a/tools/gyp/test/configurations/invalid/dependencies.gyp b/tools/gyp/test/configurations/invalid/dependencies.gyp new file mode 100644 index 000000000..74633f3f1 --- /dev/null +++ b/tools/gyp/test/configurations/invalid/dependencies.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'dependencies': [ + ], + }, + } + }, + ], +} diff --git a/tools/gyp/test/configurations/invalid/direct_dependent_settings.gyp b/tools/gyp/test/configurations/invalid/direct_dependent_settings.gyp new file mode 100644 index 000000000..8a0f2e95e --- /dev/null +++ b/tools/gyp/test/configurations/invalid/direct_dependent_settings.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'direct_dependent_settings': [ + ], + }, + } + }, + ], +} diff --git a/tools/gyp/test/configurations/invalid/gyptest-configurations.py b/tools/gyp/test/configurations/invalid/gyptest-configurations.py new file mode 100755 index 000000000..d76cdedb0 --- /dev/null +++ b/tools/gyp/test/configurations/invalid/gyptest-configurations.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python + +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies build of an executable in three different configurations. +""" + +import TestGyp + +# Keys that do not belong inside a configuration dictionary. +invalid_configuration_keys = [ + 'actions', + 'all_dependent_settings', + 'configurations', + 'dependencies', + 'direct_dependent_settings', + 'libraries', + 'link_settings', + 'sources', + 'target_name', + 'type', +] + +test = TestGyp.TestGyp() + +if test.format == 'scons': + test.skip_test('TODO: http://code.google.com/p/gyp/issues/detail?id=176\n') + +for test_key in invalid_configuration_keys: + test.run_gyp('%s.gyp' % test_key, status=1, stderr=None) + expect = ['%s not allowed in the Debug configuration, found in target ' + '%s.gyp:configurations#target' % (test_key, test_key)] + test.must_contain_all_lines(test.stderr(), expect) + +test.pass_test() diff --git a/tools/gyp/test/configurations/invalid/libraries.gyp b/tools/gyp/test/configurations/invalid/libraries.gyp new file mode 100644 index 000000000..c4014ed40 --- /dev/null +++ b/tools/gyp/test/configurations/invalid/libraries.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'libraries': [ + ], + }, + } + }, + ], +} diff --git a/tools/gyp/test/configurations/invalid/link_settings.gyp b/tools/gyp/test/configurations/invalid/link_settings.gyp new file mode 100644 index 000000000..2f0e1c46f --- /dev/null +++ b/tools/gyp/test/configurations/invalid/link_settings.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'link_settings': [ + ], + }, + } + }, + ], +} diff --git a/tools/gyp/test/configurations/invalid/sources.gyp b/tools/gyp/test/configurations/invalid/sources.gyp new file mode 100644 index 000000000..b38cca038 --- /dev/null +++ b/tools/gyp/test/configurations/invalid/sources.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'sources': [ + ], + }, + } + }, + ], +} diff --git a/tools/gyp/test/configurations/invalid/target_name.gyp b/tools/gyp/test/configurations/invalid/target_name.gyp new file mode 100644 index 000000000..83baad95d --- /dev/null +++ b/tools/gyp/test/configurations/invalid/target_name.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'target_name': [ + ], + }, + } + }, + ], +} diff --git a/tools/gyp/test/configurations/invalid/type.gyp b/tools/gyp/test/configurations/invalid/type.gyp new file mode 100644 index 000000000..bc55898b8 --- /dev/null +++ b/tools/gyp/test/configurations/invalid/type.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'none', + 'configurations': { + 'Debug': { + 'type': [ + ], + }, + } + }, + ], +} diff --git a/tools/gyp/test/configurations/target_platform/configurations.gyp b/tools/gyp/test/configurations/target_platform/configurations.gyp new file mode 100644 index 000000000..d15429f4e --- /dev/null +++ b/tools/gyp/test/configurations/target_platform/configurations.gyp @@ -0,0 +1,58 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'configurations': { + 'Debug_Win32': { + 'msvs_configuration_platform': 'Win32', + }, + 'Debug_x64': { + 'msvs_configuration_platform': 'x64', + }, + }, + }, + 'targets': [ + { + 'target_name': 'left', + 'type': 'static_library', + 'sources': [ + 'left.c', + ], + 'configurations': { + 'Debug_Win32': { + 'msvs_target_platform': 'x64', + }, + }, + }, + { + 'target_name': 'right', + 'type': 'static_library', + 'sources': [ + 'right.c', + ], + }, + { + 'target_name': 'front_left', + 'type': 'executable', + 'dependencies': ['left'], + 'sources': [ + 'front.c', + ], + 'configurations': { + 'Debug_Win32': { + 'msvs_target_platform': 'x64', + }, + }, + }, + { + 'target_name': 'front_right', + 'type': 'executable', + 'dependencies': ['right'], + 'sources': [ + 'front.c', + ], + }, + ], +} diff --git a/tools/gyp/test/configurations/target_platform/front.c b/tools/gyp/test/configurations/target_platform/front.c new file mode 100644 index 000000000..12b1d0aa3 --- /dev/null +++ b/tools/gyp/test/configurations/target_platform/front.c @@ -0,0 +1,8 @@ +#include + +const char *message(void); + +int main(int argc, char *argv[]) { + printf("%s\n", message()); + return 0; +} diff --git a/tools/gyp/test/configurations/target_platform/gyptest-target_platform.py b/tools/gyp/test/configurations/target_platform/gyptest-target_platform.py new file mode 100755 index 000000000..ae4e9e5a2 --- /dev/null +++ b/tools/gyp/test/configurations/target_platform/gyptest-target_platform.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Tests the msvs specific msvs_target_platform option. +""" + +import TestGyp +import TestCommon + + +def RunX64(exe, stdout): + try: + test.run_built_executable(exe, stdout=stdout) + except WindowsError, e: + # Assume the exe is 64-bit if it can't load on 32-bit systems. + # Both versions of the error are required because different versions + # of python seem to return different errors for invalid exe type. + if e.errno != 193 and '[Error 193]' not in str(e): + raise + + +test = TestGyp.TestGyp(formats=['msvs']) + +test.run_gyp('configurations.gyp') + +test.set_configuration('Debug|x64') +test.build('configurations.gyp', rebuild=True) +RunX64('front_left', stdout=('left\n')) +RunX64('front_right', stdout=('right\n')) + +test.set_configuration('Debug|Win32') +test.build('configurations.gyp', rebuild=True) +RunX64('front_left', stdout=('left\n')) +test.run_built_executable('front_right', stdout=('right\n')) + +test.pass_test() diff --git a/tools/gyp/test/configurations/target_platform/left.c b/tools/gyp/test/configurations/target_platform/left.c new file mode 100644 index 000000000..1ce2ea122 --- /dev/null +++ b/tools/gyp/test/configurations/target_platform/left.c @@ -0,0 +1,3 @@ +const char *message(void) { + return "left"; +} diff --git a/tools/gyp/test/configurations/target_platform/right.c b/tools/gyp/test/configurations/target_platform/right.c new file mode 100644 index 000000000..b1578492f --- /dev/null +++ b/tools/gyp/test/configurations/target_platform/right.c @@ -0,0 +1,3 @@ +const char *message(void) { + return "right"; +} diff --git a/tools/gyp/test/configurations/x64/configurations.c b/tools/gyp/test/configurations/x64/configurations.c new file mode 100644 index 000000000..72c97e31d --- /dev/null +++ b/tools/gyp/test/configurations/x64/configurations.c @@ -0,0 +1,12 @@ +#include + +int main(int argc, char *argv[]) { + if (sizeof(void*) == 4) { + printf("Running Win32\n"); + } else if (sizeof(void*) == 8) { + printf("Running x64\n"); + } else { + printf("Unexpected platform\n"); + } + return 0; +} diff --git a/tools/gyp/test/configurations/x64/configurations.gyp b/tools/gyp/test/configurations/x64/configurations.gyp new file mode 100644 index 000000000..06ffa3758 --- /dev/null +++ b/tools/gyp/test/configurations/x64/configurations.gyp @@ -0,0 +1,26 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'configurations': { + 'Debug': { + 'msvs_configuration_platform': 'Win32', + }, + 'Debug_x64': { + 'inherit_from': ['Debug'], + 'msvs_configuration_platform': 'x64', + }, + }, + }, + 'targets': [ + { + 'target_name': 'configurations', + 'type': 'executable', + 'sources': [ + 'configurations.c', + ], + }, + ], +} diff --git a/tools/gyp/test/configurations/x64/gyptest-x86.py b/tools/gyp/test/configurations/x64/gyptest-x86.py new file mode 100755 index 000000000..254ea6fbc --- /dev/null +++ b/tools/gyp/test/configurations/x64/gyptest-x86.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies build of an executable in three different configurations. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['msvs']) + +test.run_gyp('configurations.gyp') + +for platform in ['Win32', 'x64']: + test.set_configuration('Debug|%s' % platform) + test.build('configurations.gyp', rebuild=True) + try: + test.run_built_executable('configurations', + stdout=('Running %s\n' % platform)) + except WindowsError, e: + # Assume the exe is 64-bit if it can't load on 32-bit systems. + if platform == 'x64' and (e.errno == 193 or '[Error 193]' in str(e)): + continue + raise + +test.pass_test() diff --git a/tools/gyp/test/copies/gyptest-all.py b/tools/gyp/test/copies/gyptest-all.py new file mode 100755 index 000000000..8542ab7b9 --- /dev/null +++ b/tools/gyp/test/copies/gyptest-all.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies file copies using an explicit build target of 'all'. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('copies.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('copies.gyp', test.ALL, chdir='relocate/src') + +test.must_match(['relocate', 'src', 'copies-out', 'file1'], 'file1 contents\n') + +test.built_file_must_match('copies-out/file2', + 'file2 contents\n', + chdir='relocate/src') + +test.built_file_must_match('copies-out/directory/file3', + 'file3 contents\n', + chdir='relocate/src') +test.built_file_must_match('copies-out/directory/file4', + 'file4 contents\n', + chdir='relocate/src') +test.built_file_must_match('copies-out/directory/subdir/file5', + 'file5 contents\n', + chdir='relocate/src') +test.built_file_must_match('copies-out/subdir/file6', + 'file6 contents\n', + chdir='relocate/src') + +test.pass_test() diff --git a/tools/gyp/test/copies/gyptest-default.py b/tools/gyp/test/copies/gyptest-default.py new file mode 100755 index 000000000..a5d1bf9c3 --- /dev/null +++ b/tools/gyp/test/copies/gyptest-default.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies file copies using the build tool default. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('copies.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('copies.gyp', chdir='relocate/src') + +test.must_match(['relocate', 'src', 'copies-out', 'file1'], 'file1 contents\n') + +test.built_file_must_match('copies-out/file2', + 'file2 contents\n', + chdir='relocate/src') + +test.built_file_must_match('copies-out/directory/file3', + 'file3 contents\n', + chdir='relocate/src') +test.built_file_must_match('copies-out/directory/file4', + 'file4 contents\n', + chdir='relocate/src') +test.built_file_must_match('copies-out/directory/subdir/file5', + 'file5 contents\n', + chdir='relocate/src') +test.built_file_must_match('copies-out/subdir/file6', + 'file6 contents\n', + chdir='relocate/src') + +test.pass_test() diff --git a/tools/gyp/test/copies/gyptest-slash.py b/tools/gyp/test/copies/gyptest-slash.py new file mode 100755 index 000000000..81a4f42a3 --- /dev/null +++ b/tools/gyp/test/copies/gyptest-slash.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies file copies with a trailing slash in the destination directory. +""" + +import TestGyp + +test = TestGyp.TestGyp() +test.run_gyp('copies-slash.gyp', chdir='src') +test.relocate('src', 'relocate/src') +test.build('copies-slash.gyp', chdir='relocate/src') + +test.built_file_must_match('copies-out-slash/directory/file3', + 'file3 contents\n', + chdir='relocate/src') +test.built_file_must_match('copies-out-slash/directory/file4', + 'file4 contents\n', + chdir='relocate/src') +test.built_file_must_match('copies-out-slash/directory/subdir/file5', + 'file5 contents\n', + chdir='relocate/src') + +test.built_file_must_match('copies-out-slash-2/directory/file3', + 'file3 contents\n', + chdir='relocate/src') +test.built_file_must_match('copies-out-slash-2/directory/file4', + 'file4 contents\n', + chdir='relocate/src') +test.built_file_must_match('copies-out-slash-2/directory/subdir/file5', + 'file5 contents\n', + chdir='relocate/src') + +test.pass_test() diff --git a/tools/gyp/test/copies/src/copies-slash.gyp b/tools/gyp/test/copies/src/copies-slash.gyp new file mode 100644 index 000000000..9bf54bd18 --- /dev/null +++ b/tools/gyp/test/copies/src/copies-slash.gyp @@ -0,0 +1,36 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + # A trailing slash on the destination directory should be ignored. + { + 'target_name': 'copies_recursive_trailing_slash', + 'type': 'none', + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/copies-out-slash/', + 'files': [ + 'directory/', + ], + }, + ], + }, + # Even if the source directory is below <(PRODUCT_DIR). + { + 'target_name': 'copies_recursive_trailing_slash_in_product_dir', + 'type': 'none', + 'dependencies': [ ':copies_recursive_trailing_slash' ], + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/copies-out-slash-2/', + 'files': [ + '<(PRODUCT_DIR)/copies-out-slash/directory/', + ], + }, + ], + }, + ], +} + diff --git a/tools/gyp/test/copies/src/copies.gyp b/tools/gyp/test/copies/src/copies.gyp new file mode 100644 index 000000000..ce2e0cabc --- /dev/null +++ b/tools/gyp/test/copies/src/copies.gyp @@ -0,0 +1,70 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'copies1', + 'type': 'none', + 'copies': [ + { + 'destination': 'copies-out', + 'files': [ + 'file1', + ], + }, + ], + }, + { + 'target_name': 'copies2', + 'type': 'none', + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/copies-out', + 'files': [ + 'file2', + ], + }, + ], + }, + # Copy a directory tree. + { + 'target_name': 'copies_recursive', + 'type': 'none', + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/copies-out', + 'files': [ + 'directory/', + ], + }, + ], + }, + # Copy a directory from deeper in the tree (this should not reproduce the + # entire directory path in the destination, only the final directory). + { + 'target_name': 'copies_recursive_depth', + 'type': 'none', + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/copies-out', + 'files': [ + 'parentdir/subdir/', + ], + }, + ], + }, + # Verify that a null 'files' list doesn't gag the generators. + { + 'target_name': 'copies_null', + 'type': 'none', + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/copies-null', + 'files': [], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/copies/src/directory/file3 b/tools/gyp/test/copies/src/directory/file3 new file mode 100644 index 000000000..43f16f352 --- /dev/null +++ b/tools/gyp/test/copies/src/directory/file3 @@ -0,0 +1 @@ +file3 contents diff --git a/tools/gyp/test/copies/src/directory/file4 b/tools/gyp/test/copies/src/directory/file4 new file mode 100644 index 000000000..5f7270a08 --- /dev/null +++ b/tools/gyp/test/copies/src/directory/file4 @@ -0,0 +1 @@ +file4 contents diff --git a/tools/gyp/test/copies/src/directory/subdir/file5 b/tools/gyp/test/copies/src/directory/subdir/file5 new file mode 100644 index 000000000..41f47186b --- /dev/null +++ b/tools/gyp/test/copies/src/directory/subdir/file5 @@ -0,0 +1 @@ +file5 contents diff --git a/tools/gyp/test/copies/src/file1 b/tools/gyp/test/copies/src/file1 new file mode 100644 index 000000000..84d55c575 --- /dev/null +++ b/tools/gyp/test/copies/src/file1 @@ -0,0 +1 @@ +file1 contents diff --git a/tools/gyp/test/copies/src/file2 b/tools/gyp/test/copies/src/file2 new file mode 100644 index 000000000..af1b8ae35 --- /dev/null +++ b/tools/gyp/test/copies/src/file2 @@ -0,0 +1 @@ +file2 contents diff --git a/tools/gyp/test/copies/src/parentdir/subdir/file6 b/tools/gyp/test/copies/src/parentdir/subdir/file6 new file mode 100644 index 000000000..f5d575734 --- /dev/null +++ b/tools/gyp/test/copies/src/parentdir/subdir/file6 @@ -0,0 +1 @@ +file6 contents diff --git a/tools/gyp/test/cxxflags/cxxflags.cc b/tools/gyp/test/cxxflags/cxxflags.cc new file mode 100644 index 000000000..c1e245207 --- /dev/null +++ b/tools/gyp/test/cxxflags/cxxflags.cc @@ -0,0 +1,15 @@ +/* Copyright (c) 2010 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +int main(int argc, char *argv[]) +{ +#ifdef __OPTIMIZE__ + printf("Using an optimization flag\n"); +#else + printf("Using no optimization flag\n"); +#endif + return 0; +} diff --git a/tools/gyp/test/cxxflags/cxxflags.gyp b/tools/gyp/test/cxxflags/cxxflags.gyp new file mode 100644 index 000000000..24d883aae --- /dev/null +++ b/tools/gyp/test/cxxflags/cxxflags.gyp @@ -0,0 +1,16 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'cxxflags', + 'type': 'executable', + 'opt': '-Os', + 'sources': [ + 'cxxflags.cc', + ], + }, + ], +} diff --git a/tools/gyp/test/cxxflags/gyptest-cxxflags.py b/tools/gyp/test/cxxflags/gyptest-cxxflags.py new file mode 100755 index 000000000..2e5a6d947 --- /dev/null +++ b/tools/gyp/test/cxxflags/gyptest-cxxflags.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python + +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies build of an executable with C++ define specified by a gyp define, and +the use of the environment during regeneration when the gyp file changes. +""" + +import os +import TestGyp + +env_stack = [] + + +def PushEnv(): + env_copy = os.environ.copy() + env_stack.append(env_copy) + +def PopEnv(): + os.eniron=env_stack.pop() + +# Regenerating build files when a gyp file changes is currently only supported +# by the make generator. +test = TestGyp.TestGyp(formats=['make']) + +try: + PushEnv() + os.environ['CXXFLAGS'] = '-O0' + test.run_gyp('cxxflags.gyp') +finally: + # We clear the environ after calling gyp. When the auto-regeneration happens, + # the same define should be reused anyway. Reset to empty string first in + # case the platform doesn't support unsetenv. + PopEnv() + +test.build('cxxflags.gyp') + +expect = """\ +Using no optimization flag +""" +test.run_built_executable('cxxflags', stdout=expect) + +test.sleep() + +try: + PushEnv() + os.environ['CXXFLAGS'] = '-O2' + test.run_gyp('cxxflags.gyp') +finally: + # We clear the environ after calling gyp. When the auto-regeneration happens, + # the same define should be reused anyway. Reset to empty string first in + # case the platform doesn't support unsetenv. + PopEnv() + +test.build('cxxflags.gyp') + +expect = """\ +Using an optimization flag +""" +test.run_built_executable('cxxflags', stdout=expect) + +test.pass_test() diff --git a/tools/gyp/test/defines-escaping/defines-escaping.c b/tools/gyp/test/defines-escaping/defines-escaping.c new file mode 100644 index 000000000..440757222 --- /dev/null +++ b/tools/gyp/test/defines-escaping/defines-escaping.c @@ -0,0 +1,11 @@ +/* Copyright (c) 2010 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +int main(int argc, char *argv[]) +{ + printf(TEST_FORMAT, TEST_ARGS); + return 0; +} diff --git a/tools/gyp/test/defines-escaping/defines-escaping.gyp b/tools/gyp/test/defines-escaping/defines-escaping.gyp new file mode 100644 index 000000000..6f0f3fde4 --- /dev/null +++ b/tools/gyp/test/defines-escaping/defines-escaping.gyp @@ -0,0 +1,19 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'defines_escaping', + 'type': 'executable', + 'sources': [ + 'defines-escaping.c', + ], + 'defines': [ + 'TEST_FORMAT="<(test_format)"', + 'TEST_ARGS=<(test_args)', + ], + }, + ], +} diff --git a/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py b/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py new file mode 100755 index 000000000..eb18a3d36 --- /dev/null +++ b/tools/gyp/test/defines-escaping/gyptest-defines-escaping.py @@ -0,0 +1,184 @@ +#!/usr/bin/env python + +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies build of an executable with C++ define specified by a gyp define using +various special characters such as quotes, commas, etc. +""" + +import os +import TestGyp + +test = TestGyp.TestGyp() + +# Tests string literals, percents, and backslash escapes. +try: + os.environ['GYP_DEFINES'] = ( + r"""test_format='\n%s\n' """ + r"""test_args='"Simple test of %s with a literal"'""") + test.run_gyp('defines-escaping.gyp') +finally: + del os.environ['GYP_DEFINES'] + +test.build('defines-escaping.gyp') + +expect = """ +Simple test of %s with a literal +""" +test.run_built_executable('defines_escaping', stdout=expect) + + +# Test multiple comma-and-space-separated string literals. +try: + os.environ['GYP_DEFINES'] = \ + r"""test_format='\n%s and %s\n' test_args='"foo", "bar"'""" + test.run_gyp('defines-escaping.gyp') +finally: + del os.environ['GYP_DEFINES'] + +test.sleep() +test.touch('defines-escaping.c') +test.build('defines-escaping.gyp') + +expect = """ +foo and bar +""" +test.run_built_executable('defines_escaping', stdout=expect) + + +# Test string literals containing quotes. +try: + os.environ['GYP_DEFINES'] = ( + r"""test_format='\n%s %s %s %s %s\n' """ + r"""test_args='"\"These,\"",""" + r""" "\"words,\"",""" + r""" "\"are,\"",""" + r""" "\"in,\"",""" + r""" "\"quotes.\""'""") + test.run_gyp('defines-escaping.gyp') +finally: + del os.environ['GYP_DEFINES'] + +test.sleep() +test.touch('defines-escaping.c') +test.build('defines-escaping.gyp') + +expect = """ +"These," "words," "are," "in," "quotes." +""" +test.run_built_executable('defines_escaping', stdout=expect) + + +# Test string literals containing single quotes. +try: + os.environ['GYP_DEFINES'] = ( + r"""test_format='\n%s %s %s %s %s\n' """ + r"""test_args="\"'These,'\",""" + r""" \"'words,'\",""" + r""" \"'are,'\",""" + r""" \"'in,'\",""" + r""" \"'quotes.'\"" """) + test.run_gyp('defines-escaping.gyp') +finally: + del os.environ['GYP_DEFINES'] + +test.sleep() +test.touch('defines-escaping.c') +test.build('defines-escaping.gyp') + +expect = """ +'These,' 'words,' 'are,' 'in,' 'quotes.' +""" +test.run_built_executable('defines_escaping', stdout=expect) + + +# Test string literals containing different numbers of backslashes before quotes +# (to exercise Windows' quoting behaviour). +try: + os.environ['GYP_DEFINES'] = ( + r"""test_format='\n%s\n%s\n%s\n' """ + r"""test_args='"\\\"1 visible slash\\\"",""" + r""" "\\\\\"2 visible slashes\\\\\"",""" + r""" "\\\\\\\"3 visible slashes\\\\\\\""'""") + test.run_gyp('defines-escaping.gyp') +finally: + del os.environ['GYP_DEFINES'] + +test.sleep() +test.touch('defines-escaping.c') +test.build('defines-escaping.gyp') + +expect = r""" +\"1 visible slash\" +\\"2 visible slashes\\" +\\\"3 visible slashes\\\" +""" +test.run_built_executable('defines_escaping', stdout=expect) + + +# Test that various scary sequences are passed unfettered. +try: + os.environ['GYP_DEFINES'] = ( + r"""test_format='\n%s\n' """ + r"""test_args='"$foo, " `foo`;"'""") + test.run_gyp('defines-escaping.gyp') +finally: + del os.environ['GYP_DEFINES'] + +test.sleep() +test.touch('defines-escaping.c') +test.build('defines-escaping.gyp') + +expect = """ +$foo, " `foo`; +""" +test.run_built_executable('defines_escaping', stdout=expect) + + +# VisualStudio 2010 can't handle passing %PATH% +if not (test.format == 'msvs' and test.uses_msbuild): + try: + os.environ['GYP_DEFINES'] = ( + """test_format='%s' """ + """test_args='"%PATH%"'""") + test.run_gyp('defines-escaping.gyp') + finally: + del os.environ['GYP_DEFINES'] + + test.sleep() + test.touch('defines-escaping.c') + test.build('defines-escaping.gyp') + + expect = "%PATH%" + test.run_built_executable('defines_escaping', stdout=expect) + + +# Test commas and semi-colons preceded by backslashes (to exercise Windows' +# quoting behaviour). +try: + os.environ['GYP_DEFINES'] = ( + r"""test_format='\n%s\n%s\n' """ + r"""test_args='"\\, \\\\;",""" + # Same thing again, but enclosed in visible quotes. + r""" "\"\\, \\\\;\""'""") + test.run_gyp('defines-escaping.gyp') +finally: + del os.environ['GYP_DEFINES'] + +test.sleep() +test.touch('defines-escaping.c') +test.build('defines-escaping.gyp') + +expect = r""" +\, \\; +"\, \\;" +""" +test.run_built_executable('defines_escaping', stdout=expect) + +# We deliberately do not test having an odd number of quotes in a string +# literal because that isn't feasible in MSVS. + +test.pass_test() diff --git a/tools/gyp/test/defines/defines-env.gyp b/tools/gyp/test/defines/defines-env.gyp new file mode 100644 index 000000000..1781546ae --- /dev/null +++ b/tools/gyp/test/defines/defines-env.gyp @@ -0,0 +1,22 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables': { + 'value%': '5', + }, + 'targets': [ + { + 'target_name': 'defines', + 'type': 'executable', + 'sources': [ + 'defines.c', + ], + 'defines': [ + 'VALUE=<(value)', + ], + }, + ], +} + diff --git a/tools/gyp/test/defines/defines.c b/tools/gyp/test/defines/defines.c new file mode 100644 index 000000000..e0ef5212d --- /dev/null +++ b/tools/gyp/test/defines/defines.c @@ -0,0 +1,23 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +int main(int argc, char *argv[]) +{ +#ifdef FOO + printf("FOO is defined\n"); +#endif + printf("VALUE is %d\n", VALUE); + +#ifdef PAREN_VALUE + printf("2*PAREN_VALUE is %d\n", 2*PAREN_VALUE); +#endif + +#ifdef HASH_VALUE + printf("HASH_VALUE is %s\n", HASH_VALUE); +#endif + + return 0; +} diff --git a/tools/gyp/test/defines/defines.gyp b/tools/gyp/test/defines/defines.gyp new file mode 100644 index 000000000..90a755eb8 --- /dev/null +++ b/tools/gyp/test/defines/defines.gyp @@ -0,0 +1,38 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'defines', + 'type': 'executable', + 'sources': [ + 'defines.c', + ], + 'defines': [ + 'FOO', + 'VALUE=1', + 'PAREN_VALUE=(1+2+3)', + 'HASH_VALUE="a#1"', + ], + }, + ], + 'conditions': [ + ['OS=="fakeos"', { + 'targets': [ + { + 'target_name': 'fakeosprogram', + 'type': 'executable', + 'sources': [ + 'defines.c', + ], + 'defines': [ + 'FOO', + 'VALUE=1', + ], + }, + ], + }], + ], +} diff --git a/tools/gyp/test/defines/gyptest-define-override.py b/tools/gyp/test/defines/gyptest-define-override.py new file mode 100755 index 000000000..82e325af2 --- /dev/null +++ b/tools/gyp/test/defines/gyptest-define-override.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that a default gyp define can be overridden. +""" + +import os +import TestGyp + +test = TestGyp.TestGyp() + +# Command-line define +test.run_gyp('defines.gyp', '-D', 'OS=fakeos') +test.build('defines.gyp') +test.built_file_must_exist('fakeosprogram', type=test.EXECUTABLE) +# Clean up the exe so subsequent tests don't find an old exe. +os.remove(test.built_file_path('fakeosprogram', type=test.EXECUTABLE)) + +# Without "OS" override, fokeosprogram shouldn't be built. +test.run_gyp('defines.gyp') +test.build('defines.gyp') +test.built_file_must_not_exist('fakeosprogram', type=test.EXECUTABLE) + +# Environment define +os.environ['GYP_DEFINES'] = 'OS=fakeos' +test.run_gyp('defines.gyp') +test.build('defines.gyp') +test.built_file_must_exist('fakeosprogram', type=test.EXECUTABLE) + +test.pass_test() diff --git a/tools/gyp/test/defines/gyptest-defines-env-regyp.py b/tools/gyp/test/defines/gyptest-defines-env-regyp.py new file mode 100755 index 000000000..1c37b83b8 --- /dev/null +++ b/tools/gyp/test/defines/gyptest-defines-env-regyp.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies build of an executable with C++ define specified by a gyp define, and +the use of the environment during regeneration when the gyp file changes. +""" + +import os +import TestGyp + +# Regenerating build files when a gyp file changes is currently only supported +# by the make generator. +test = TestGyp.TestGyp(formats=['make']) + +try: + os.environ['GYP_DEFINES'] = 'value=50' + test.run_gyp('defines.gyp') +finally: + # We clear the environ after calling gyp. When the auto-regeneration happens, + # the same define should be reused anyway. Reset to empty string first in + # case the platform doesn't support unsetenv. + os.environ['GYP_DEFINES'] = '' + del os.environ['GYP_DEFINES'] + +test.build('defines.gyp') + +expect = """\ +FOO is defined +VALUE is 1 +2*PAREN_VALUE is 12 +HASH_VALUE is a#1 +""" +test.run_built_executable('defines', stdout=expect) + +# Sleep so that the changed gyp file will have a newer timestamp than the +# previously generated build files. +test.sleep() +test.write('defines.gyp', test.read('defines-env.gyp')) + +test.build('defines.gyp', test.ALL) + +expect = """\ +VALUE is 50 +""" +test.run_built_executable('defines', stdout=expect) + +test.pass_test() diff --git a/tools/gyp/test/defines/gyptest-defines-env.py b/tools/gyp/test/defines/gyptest-defines-env.py new file mode 100755 index 000000000..6b4e7175a --- /dev/null +++ b/tools/gyp/test/defines/gyptest-defines-env.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies build of an executable with C++ define specified by a gyp define. +""" + +import os +import TestGyp + +test = TestGyp.TestGyp() + +# With the value only given in environment, it should be used. +try: + os.environ['GYP_DEFINES'] = 'value=10' + test.run_gyp('defines-env.gyp') +finally: + del os.environ['GYP_DEFINES'] + +test.build('defines-env.gyp') + +expect = """\ +VALUE is 10 +""" +test.run_built_executable('defines', stdout=expect) + + +# With the value given in both command line and environment, +# command line should take precedence. +try: + os.environ['GYP_DEFINES'] = 'value=20' + test.run_gyp('defines-env.gyp', '-Dvalue=25') +finally: + del os.environ['GYP_DEFINES'] + +test.sleep() +test.touch('defines.c') +test.build('defines-env.gyp') + +expect = """\ +VALUE is 25 +""" +test.run_built_executable('defines', stdout=expect) + + +# With the value only given in environment, it should be ignored if +# --ignore-environment is specified. +try: + os.environ['GYP_DEFINES'] = 'value=30' + test.run_gyp('defines-env.gyp', '--ignore-environment') +finally: + del os.environ['GYP_DEFINES'] + +test.sleep() +test.touch('defines.c') +test.build('defines-env.gyp') + +expect = """\ +VALUE is 5 +""" +test.run_built_executable('defines', stdout=expect) + + +# With the value given in both command line and environment, and +# --ignore-environment also specified, command line should still be used. +try: + os.environ['GYP_DEFINES'] = 'value=40' + test.run_gyp('defines-env.gyp', '--ignore-environment', '-Dvalue=45') +finally: + del os.environ['GYP_DEFINES'] + +test.sleep() +test.touch('defines.c') +test.build('defines-env.gyp') + +expect = """\ +VALUE is 45 +""" +test.run_built_executable('defines', stdout=expect) + + +test.pass_test() diff --git a/tools/gyp/test/defines/gyptest-defines.py b/tools/gyp/test/defines/gyptest-defines.py new file mode 100755 index 000000000..33e50f8c4 --- /dev/null +++ b/tools/gyp/test/defines/gyptest-defines.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies build of an executable with C++ defines. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('defines.gyp') + +test.build('defines.gyp') + +expect = """\ +FOO is defined +VALUE is 1 +2*PAREN_VALUE is 12 +HASH_VALUE is a#1 +""" +test.run_built_executable('defines', stdout=expect) + +test.pass_test() diff --git a/tools/gyp/test/dependencies/a.c b/tools/gyp/test/dependencies/a.c new file mode 100755 index 000000000..3bba111d2 --- /dev/null +++ b/tools/gyp/test/dependencies/a.c @@ -0,0 +1,9 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +extern int funcB(); + +int funcA() { + return funcB(); +} diff --git a/tools/gyp/test/dependencies/b/b.c b/tools/gyp/test/dependencies/b/b.c new file mode 100755 index 000000000..b5e771bcc --- /dev/null +++ b/tools/gyp/test/dependencies/b/b.c @@ -0,0 +1,3 @@ +int funcB() { + return 2; +} diff --git a/tools/gyp/test/dependencies/b/b.gyp b/tools/gyp/test/dependencies/b/b.gyp new file mode 100755 index 000000000..893dc64d6 --- /dev/null +++ b/tools/gyp/test/dependencies/b/b.gyp @@ -0,0 +1,22 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'b', + 'type': 'static_library', + 'sources': [ + 'b.c', + ], + }, + { + 'target_name': 'b3', + 'type': 'static_library', + 'sources': [ + 'b3.c', + ], + }, + ], +} diff --git a/tools/gyp/test/dependencies/b/b3.c b/tools/gyp/test/dependencies/b/b3.c new file mode 100755 index 000000000..287f67ff3 --- /dev/null +++ b/tools/gyp/test/dependencies/b/b3.c @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +int funcB() { + return 3; +} diff --git a/tools/gyp/test/dependencies/c/c.c b/tools/gyp/test/dependencies/c/c.c new file mode 100644 index 000000000..4949daf3e --- /dev/null +++ b/tools/gyp/test/dependencies/c/c.c @@ -0,0 +1,4 @@ +int funcC() { + return 3 + // Intentional syntax error. This file should never be compiled, so this + // shouldn't be a problem. diff --git a/tools/gyp/test/dependencies/c/c.gyp b/tools/gyp/test/dependencies/c/c.gyp new file mode 100644 index 000000000..eabebea9e --- /dev/null +++ b/tools/gyp/test/dependencies/c/c.gyp @@ -0,0 +1,22 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'c_unused', + 'type': 'static_library', + 'sources': [ + 'c.c', + ], + }, + { + 'target_name': 'd', + 'type': 'static_library', + 'sources': [ + 'd.c', + ], + }, + ], +} diff --git a/tools/gyp/test/dependencies/c/d.c b/tools/gyp/test/dependencies/c/d.c new file mode 100644 index 000000000..05465fc1a --- /dev/null +++ b/tools/gyp/test/dependencies/c/d.c @@ -0,0 +1,3 @@ +int funcD() { + return 4; +} diff --git a/tools/gyp/test/dependencies/double_dependency.gyp b/tools/gyp/test/dependencies/double_dependency.gyp new file mode 100644 index 000000000..c4a2d0013 --- /dev/null +++ b/tools/gyp/test/dependencies/double_dependency.gyp @@ -0,0 +1,23 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'double_dependency', + 'type': 'shared_library', + 'dependencies': [ + 'double_dependent.gyp:double_dependent', + ], + 'conditions': [ + ['1==1', { + 'dependencies': [ + 'double_dependent.gyp:*', + ], + }], + ], + }, + ], +} + diff --git a/tools/gyp/test/dependencies/double_dependent.gyp b/tools/gyp/test/dependencies/double_dependent.gyp new file mode 100644 index 000000000..334caff72 --- /dev/null +++ b/tools/gyp/test/dependencies/double_dependent.gyp @@ -0,0 +1,12 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'double_dependent', + 'type': 'none', + }, + ], +} diff --git a/tools/gyp/test/dependencies/extra_targets.gyp b/tools/gyp/test/dependencies/extra_targets.gyp new file mode 100644 index 000000000..c1a26de42 --- /dev/null +++ b/tools/gyp/test/dependencies/extra_targets.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'a', + 'type': 'static_library', + 'sources': [ + 'a.c', + ], + # This only depends on the "d" target; other targets in c.gyp + # should not become part of the build (unlike with 'c/c.gyp:*'). + 'dependencies': ['c/c.gyp:d'], + }, + ], +} diff --git a/tools/gyp/test/dependencies/gyptest-double-dependency.py b/tools/gyp/test/dependencies/gyptest-double-dependency.py new file mode 100644 index 000000000..7692740c5 --- /dev/null +++ b/tools/gyp/test/dependencies/gyptest-double-dependency.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify that pulling in a dependency a second time in a conditional works for +shared_library targets. Regression test for http://crbug.com/122588 +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('double_dependency.gyp') + +# If running gyp worked, all is well. +test.pass_test() diff --git a/tools/gyp/test/dependencies/gyptest-extra-targets.py b/tools/gyp/test/dependencies/gyptest-extra-targets.py new file mode 100755 index 000000000..3752f7445 --- /dev/null +++ b/tools/gyp/test/dependencies/gyptest-extra-targets.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify that dependencies don't pull unused targets into the build. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('extra_targets.gyp') + +# This should fail if it tries to build 'c_unused' since 'c/c.c' has a syntax +# error and won't compile. +test.build('extra_targets.gyp', test.ALL) + +test.pass_test() diff --git a/tools/gyp/test/dependencies/gyptest-lib-only.py b/tools/gyp/test/dependencies/gyptest-lib-only.py new file mode 100755 index 000000000..02159f5f1 --- /dev/null +++ b/tools/gyp/test/dependencies/gyptest-lib-only.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify that a link time only dependency will get pulled into the set of built +targets, even if no executable uses it. +""" + +import TestGyp + +import sys + +test = TestGyp.TestGyp() + +test.run_gyp('lib_only.gyp') + +test.build('lib_only.gyp', test.ALL) + +test.built_file_must_exist('a', type=test.STATIC_LIB) + +# TODO(bradnelson/mark): +# On linux and windows a library target will at least pull its link dependencies +# into the generated sln/_main.scons, since not doing so confuses users. +# This is not currently implemented on mac, which has the opposite behavior. +if sys.platform == 'darwin': + if test.format == 'xcode': + test.built_file_must_not_exist('b', type=test.STATIC_LIB) + else: + assert test.format in ('make', 'ninja') + test.built_file_must_exist('b', type=test.STATIC_LIB) +else: + # Make puts the resulting library in a directory matching the input gyp file; + # for the 'b' library, that is in the 'b' subdirectory. + test.built_file_must_exist('b', type=test.STATIC_LIB, subdir='b') + +test.pass_test() diff --git a/tools/gyp/test/dependencies/gyptest-none-traversal.py b/tools/gyp/test/dependencies/gyptest-none-traversal.py new file mode 100755 index 000000000..c09063dad --- /dev/null +++ b/tools/gyp/test/dependencies/gyptest-none-traversal.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify that static library dependencies don't traverse none targets, unless +explicitly specified. +""" + +import TestGyp + +import sys + +test = TestGyp.TestGyp() + +test.run_gyp('none_traversal.gyp') + +test.build('none_traversal.gyp', test.ALL) + +test.run_built_executable('needs_chain', stdout="2\n") +test.run_built_executable('doesnt_need_chain', stdout="3\n") + +test.pass_test() diff --git a/tools/gyp/test/dependencies/lib_only.gyp b/tools/gyp/test/dependencies/lib_only.gyp new file mode 100755 index 000000000..f6c84dea6 --- /dev/null +++ b/tools/gyp/test/dependencies/lib_only.gyp @@ -0,0 +1,16 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'a', + 'type': 'static_library', + 'sources': [ + 'a.c', + ], + 'dependencies': ['b/b.gyp:b'], + }, + ], +} diff --git a/tools/gyp/test/dependencies/main.c b/tools/gyp/test/dependencies/main.c new file mode 100644 index 000000000..185bd482f --- /dev/null +++ b/tools/gyp/test/dependencies/main.c @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include + +extern int funcA(); + +int main() { + printf("%d\n", funcA()); + return 0; +} diff --git a/tools/gyp/test/dependencies/none_traversal.gyp b/tools/gyp/test/dependencies/none_traversal.gyp new file mode 100755 index 000000000..3d8ab30af --- /dev/null +++ b/tools/gyp/test/dependencies/none_traversal.gyp @@ -0,0 +1,46 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'needs_chain', + 'type': 'executable', + 'sources': [ + 'a.c', + 'main.c', + ], + 'dependencies': ['chain'], + }, + { + 'target_name': 'chain', + 'type': 'none', + 'dependencies': ['b/b.gyp:b'], + }, + { + 'target_name': 'doesnt_need_chain', + 'type': 'executable', + 'sources': [ + 'main.c', + ], + 'dependencies': ['no_chain', 'other_chain'], + }, + { + 'target_name': 'no_chain', + 'type': 'none', + 'sources': [ + ], + 'dependencies': ['b/b.gyp:b'], + 'dependencies_traverse': 0, + }, + { + 'target_name': 'other_chain', + 'type': 'static_library', + 'sources': [ + 'a.c', + ], + 'dependencies': ['b/b.gyp:b3'], + }, + ], +} diff --git a/tools/gyp/test/dependency-copy/gyptest-copy.py b/tools/gyp/test/dependency-copy/gyptest-copy.py new file mode 100755 index 000000000..5ba7c73d4 --- /dev/null +++ b/tools/gyp/test/dependency-copy/gyptest-copy.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies dependencies do the copy step. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('copies.gyp', chdir='src') + +test.build('copies.gyp', 'proj2', chdir='src') + +test.run_built_executable('proj1', + chdir='src', + stdout="Hello from file1.c\n") +test.run_built_executable('proj2', + chdir='src', + stdout="Hello from file2.c\n") + +test.pass_test() diff --git a/tools/gyp/test/dependency-copy/src/copies.gyp b/tools/gyp/test/dependency-copy/src/copies.gyp new file mode 100644 index 000000000..4176b1878 --- /dev/null +++ b/tools/gyp/test/dependency-copy/src/copies.gyp @@ -0,0 +1,25 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'proj1', + 'type': 'executable', + 'sources': [ + 'file1.c', + ], + }, + { + 'target_name': 'proj2', + 'type': 'executable', + 'sources': [ + 'file2.c', + ], + 'dependencies': [ + 'proj1', + ] + }, + ], +} diff --git a/tools/gyp/test/dependency-copy/src/file1.c b/tools/gyp/test/dependency-copy/src/file1.c new file mode 100644 index 000000000..3caf5d634 --- /dev/null +++ b/tools/gyp/test/dependency-copy/src/file1.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + printf("Hello from file1.c\n"); + return 0; +} diff --git a/tools/gyp/test/dependency-copy/src/file2.c b/tools/gyp/test/dependency-copy/src/file2.c new file mode 100644 index 000000000..ed45cc012 --- /dev/null +++ b/tools/gyp/test/dependency-copy/src/file2.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + printf("Hello from file2.c\n"); + return 0; +} diff --git a/tools/gyp/test/exclusion/exclusion.gyp b/tools/gyp/test/exclusion/exclusion.gyp new file mode 100644 index 000000000..1232dabae --- /dev/null +++ b/tools/gyp/test/exclusion/exclusion.gyp @@ -0,0 +1,23 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'hello', + 'type': 'executable', + 'sources': [ + 'hello.c', + 'bogus.c', + 'also/not/real.c', + 'also/not/real2.c', + ], + 'sources!': [ + 'bogus.c', + 'also/not/real.c', + 'also/not/real2.c', + ], + }, + ], +} diff --git a/tools/gyp/test/exclusion/gyptest-exclusion.py b/tools/gyp/test/exclusion/gyptest-exclusion.py new file mode 100755 index 000000000..1fc32bf87 --- /dev/null +++ b/tools/gyp/test/exclusion/gyptest-exclusion.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that exclusions (e.g. sources!) are respected. Excluded sources +that do not exist should not prevent the build from succeeding. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('exclusion.gyp') +test.build('exclusion.gyp') + +# executables +test.built_file_must_exist('hello' + test._exe, test.EXECUTABLE, bare=True) + +test.pass_test() diff --git a/tools/gyp/test/exclusion/hello.c b/tools/gyp/test/exclusion/hello.c new file mode 100644 index 000000000..30e8d5416 --- /dev/null +++ b/tools/gyp/test/exclusion/hello.c @@ -0,0 +1,15 @@ +/* Copyright (c) 2010 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +int func1(void) { + return 42; +} + +int main(int argc, char *argv[]) { + printf("Hello, world!\n"); + printf("%d\n", func1()); + return 0; +} diff --git a/tools/gyp/test/external-cross-compile/gyptest-cross.py b/tools/gyp/test/external-cross-compile/gyptest-cross.py new file mode 100755 index 000000000..6b8df816d --- /dev/null +++ b/tools/gyp/test/external-cross-compile/gyptest-cross.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that actions can be + a source scanner can be used to implement, +cross-compiles (for Native Client at this point). +""" + +import TestGyp + +test = TestGyp.TestGyp() + +# TODO(bradnelson): fix scons. +if test.format == 'scons': + test.skip_test() + +test.run_gyp('cross.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('cross.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +From test1.cc +From test2.c +From test3.cc +From test4.c +""" +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + + +test.pass_test() diff --git a/tools/gyp/test/external-cross-compile/src/bogus1.cc b/tools/gyp/test/external-cross-compile/src/bogus1.cc new file mode 100644 index 000000000..1b8d01199 --- /dev/null +++ b/tools/gyp/test/external-cross-compile/src/bogus1.cc @@ -0,0 +1 @@ +From bogus1.cc diff --git a/tools/gyp/test/external-cross-compile/src/bogus2.c b/tools/gyp/test/external-cross-compile/src/bogus2.c new file mode 100644 index 000000000..cbf4a123c --- /dev/null +++ b/tools/gyp/test/external-cross-compile/src/bogus2.c @@ -0,0 +1 @@ +From bogus2.c diff --git a/tools/gyp/test/external-cross-compile/src/cross.gyp b/tools/gyp/test/external-cross-compile/src/cross.gyp new file mode 100644 index 000000000..aeda76b5b --- /dev/null +++ b/tools/gyp/test/external-cross-compile/src/cross.gyp @@ -0,0 +1,83 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': ['cross_compile.gypi'], + 'target_defaults': { + 'variables': { + 'nix_lame%': 0, + }, + 'target_conditions': [ + ['nix_lame==1', { + 'sources/': [ + ['exclude', 'lame'], + ], + }], + ], + }, + 'targets': [ + { + 'target_name': 'program', + 'type': 'executable', + 'dependencies': [ + 'program_inc', + ], + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', + ], + 'sources': [ + 'program.cc', + ], + }, + { + 'target_name': 'program_inc', + 'type': 'none', + 'dependencies': ['cross_program'], + 'actions': [ + { + 'action_name': 'program_inc', + 'inputs': ['<(SHARED_INTERMEDIATE_DIR)/cross_program.fake'], + 'outputs': ['<(SHARED_INTERMEDIATE_DIR)/cross_program.h'], + 'action': ['python', 'tochar.py', '<@(_inputs)', '<@(_outputs)'], + }, + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + { + 'target_name': 'cross_program', + 'type': 'none', + 'variables': { + 'cross': 1, + 'nix_lame': 1, + }, + 'dependencies': ['cross_lib'], + 'sources': [ + 'test1.cc', + 'test2.c', + 'very_lame.cc', + '<(SHARED_INTERMEDIATE_DIR)/cross_lib.fake', + ], + }, + { + 'target_name': 'cross_lib', + 'type': 'none', + 'variables': { + 'cross': 1, + 'nix_lame': 1, + }, + 'sources': [ + 'test3.cc', + 'test4.c', + 'bogus1.cc', + 'bogus2.c', + 'sort_of_lame.cc', + ], + 'sources!': [ + 'bogus1.cc', + 'bogus2.c', + ], + }, + ], +} diff --git a/tools/gyp/test/external-cross-compile/src/cross_compile.gypi b/tools/gyp/test/external-cross-compile/src/cross_compile.gypi new file mode 100644 index 000000000..36e651903 --- /dev/null +++ b/tools/gyp/test/external-cross-compile/src/cross_compile.gypi @@ -0,0 +1,23 @@ +{ + 'target_defaults': { + 'variables': { + 'cross%': 0, + }, + 'target_conditions': [ + ['cross==1', { + 'actions': [ + { + 'action_name': 'cross compile >(_target_name)', + 'inputs': ['^@(_sources)'], + 'outputs': ['<(SHARED_INTERMEDIATE_DIR)/>(_target_name).fake'], + 'action': [ + 'python', 'fake_cross.py', '>@(_outputs)', '^@(_sources)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }], + ], + }, +} diff --git a/tools/gyp/test/external-cross-compile/src/fake_cross.py b/tools/gyp/test/external-cross-compile/src/fake_cross.py new file mode 100644 index 000000000..05eacc6a6 --- /dev/null +++ b/tools/gyp/test/external-cross-compile/src/fake_cross.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +fh = open(sys.argv[1], 'w') + +filenames = sys.argv[2:] + +for filename in filenames: + subfile = open(filename) + data = subfile.read() + subfile.close() + fh.write(data) + +fh.close() diff --git a/tools/gyp/test/external-cross-compile/src/program.cc b/tools/gyp/test/external-cross-compile/src/program.cc new file mode 100644 index 000000000..a50ca367a --- /dev/null +++ b/tools/gyp/test/external-cross-compile/src/program.cc @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2012 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include + +static char data[] = { +#include "cross_program.h" +}; + +int main(int argc, char *argv[]) { + fwrite(data, 1, sizeof(data), stdout); + return 0; +} diff --git a/tools/gyp/test/external-cross-compile/src/test1.cc b/tools/gyp/test/external-cross-compile/src/test1.cc new file mode 100644 index 000000000..b584c31d1 --- /dev/null +++ b/tools/gyp/test/external-cross-compile/src/test1.cc @@ -0,0 +1 @@ +From test1.cc diff --git a/tools/gyp/test/external-cross-compile/src/test2.c b/tools/gyp/test/external-cross-compile/src/test2.c new file mode 100644 index 000000000..367ae19ea --- /dev/null +++ b/tools/gyp/test/external-cross-compile/src/test2.c @@ -0,0 +1 @@ +From test2.c diff --git a/tools/gyp/test/external-cross-compile/src/test3.cc b/tools/gyp/test/external-cross-compile/src/test3.cc new file mode 100644 index 000000000..9eb64735b --- /dev/null +++ b/tools/gyp/test/external-cross-compile/src/test3.cc @@ -0,0 +1 @@ +From test3.cc diff --git a/tools/gyp/test/external-cross-compile/src/test4.c b/tools/gyp/test/external-cross-compile/src/test4.c new file mode 100644 index 000000000..8ecc33ec1 --- /dev/null +++ b/tools/gyp/test/external-cross-compile/src/test4.c @@ -0,0 +1 @@ +From test4.c diff --git a/tools/gyp/test/external-cross-compile/src/tochar.py b/tools/gyp/test/external-cross-compile/src/tochar.py new file mode 100644 index 000000000..c0780d984 --- /dev/null +++ b/tools/gyp/test/external-cross-compile/src/tochar.py @@ -0,0 +1,13 @@ +#!/usr/bin/python +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +src = open(sys.argv[1]) +dst = open(sys.argv[2], 'w') +for ch in src.read(): + dst.write('%d,\n' % ord(ch)) +src.close() +dst.close() diff --git a/tools/gyp/test/generator-output/actions/actions.gyp b/tools/gyp/test/generator-output/actions/actions.gyp new file mode 100644 index 000000000..dded59aff --- /dev/null +++ b/tools/gyp/test/generator-output/actions/actions.gyp @@ -0,0 +1,16 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'pull_in_all_actions', + 'type': 'none', + 'dependencies': [ + 'subdir1/executable.gyp:*', + 'subdir2/none.gyp:*', + ], + }, + ], +} diff --git a/tools/gyp/test/generator-output/actions/build/README.txt b/tools/gyp/test/generator-output/actions/build/README.txt new file mode 100644 index 000000000..1b052c9a2 --- /dev/null +++ b/tools/gyp/test/generator-output/actions/build/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/actions/subdir1/actions-out/README.txt b/tools/gyp/test/generator-output/actions/subdir1/actions-out/README.txt new file mode 100644 index 000000000..1b052c9a2 --- /dev/null +++ b/tools/gyp/test/generator-output/actions/subdir1/actions-out/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/actions/subdir1/build/README.txt b/tools/gyp/test/generator-output/actions/subdir1/build/README.txt new file mode 100644 index 000000000..1b052c9a2 --- /dev/null +++ b/tools/gyp/test/generator-output/actions/subdir1/build/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/actions/subdir1/executable.gyp b/tools/gyp/test/generator-output/actions/subdir1/executable.gyp new file mode 100644 index 000000000..6bdd60a1f --- /dev/null +++ b/tools/gyp/test/generator-output/actions/subdir1/executable.gyp @@ -0,0 +1,44 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'program', + 'type': 'executable', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'program.c', + ], + 'actions': [ + { + 'action_name': 'make-prog1', + 'inputs': [ + 'make-prog1.py', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/prog1.c', + ], + 'action': [ + 'python', '<(_inputs)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + { + 'action_name': 'make-prog2', + 'inputs': [ + 'make-prog2.py', + ], + 'outputs': [ + 'actions-out/prog2.c', + ], + 'action': [ + 'python', '<(_inputs)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/generator-output/actions/subdir1/make-prog1.py b/tools/gyp/test/generator-output/actions/subdir1/make-prog1.py new file mode 100755 index 000000000..7ea1d8a2d --- /dev/null +++ b/tools/gyp/test/generator-output/actions/subdir1/make-prog1.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +contents = r""" +#include + +void prog1(void) +{ + printf("Hello from make-prog1.py\n"); +} +""" + +open(sys.argv[1], 'w').write(contents) + +sys.exit(0) diff --git a/tools/gyp/test/generator-output/actions/subdir1/make-prog2.py b/tools/gyp/test/generator-output/actions/subdir1/make-prog2.py new file mode 100755 index 000000000..0bfe4973c --- /dev/null +++ b/tools/gyp/test/generator-output/actions/subdir1/make-prog2.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +contents = r""" +#include + +void prog2(void) +{ + printf("Hello from make-prog2.py\n"); +} +""" + +open(sys.argv[1], 'w').write(contents) + +sys.exit(0) diff --git a/tools/gyp/test/generator-output/actions/subdir1/program.c b/tools/gyp/test/generator-output/actions/subdir1/program.c new file mode 100644 index 000000000..d5f661d90 --- /dev/null +++ b/tools/gyp/test/generator-output/actions/subdir1/program.c @@ -0,0 +1,12 @@ +#include + +extern void prog1(void); +extern void prog2(void); + +int main(int argc, char *argv[]) +{ + printf("Hello from program.c\n"); + prog1(); + prog2(); + return 0; +} diff --git a/tools/gyp/test/generator-output/actions/subdir2/actions-out/README.txt b/tools/gyp/test/generator-output/actions/subdir2/actions-out/README.txt new file mode 100644 index 000000000..1b052c9a2 --- /dev/null +++ b/tools/gyp/test/generator-output/actions/subdir2/actions-out/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/actions/subdir2/build/README.txt b/tools/gyp/test/generator-output/actions/subdir2/build/README.txt new file mode 100644 index 000000000..1b052c9a2 --- /dev/null +++ b/tools/gyp/test/generator-output/actions/subdir2/build/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/actions/subdir2/make-file.py b/tools/gyp/test/generator-output/actions/subdir2/make-file.py new file mode 100755 index 000000000..fff065314 --- /dev/null +++ b/tools/gyp/test/generator-output/actions/subdir2/make-file.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +contents = "Hello from make-file.py\n" + +open(sys.argv[1], 'wb').write(contents) diff --git a/tools/gyp/test/generator-output/actions/subdir2/none.gyp b/tools/gyp/test/generator-output/actions/subdir2/none.gyp new file mode 100644 index 000000000..f98f52753 --- /dev/null +++ b/tools/gyp/test/generator-output/actions/subdir2/none.gyp @@ -0,0 +1,31 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'file', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'actions': [ + { + 'action_name': 'make-file', + 'inputs': [ + 'make-file.py', + ], + 'outputs': [ + 'actions-out/file.out', + # TODO: enhance testing infrastructure to test this + # without having to hard-code the intermediate dir paths. + #'<(INTERMEDIATE_DIR)/file.out', + ], + 'action': [ + 'python', '<(_inputs)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + } + ], + }, + ], +} diff --git a/tools/gyp/test/generator-output/copies/build/README.txt b/tools/gyp/test/generator-output/copies/build/README.txt new file mode 100644 index 000000000..90ef88619 --- /dev/null +++ b/tools/gyp/test/generator-output/copies/build/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/copies/copies-out/README.txt b/tools/gyp/test/generator-output/copies/copies-out/README.txt new file mode 100644 index 000000000..90ef88619 --- /dev/null +++ b/tools/gyp/test/generator-output/copies/copies-out/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/copies/copies.gyp b/tools/gyp/test/generator-output/copies/copies.gyp new file mode 100644 index 000000000..479a3d9b6 --- /dev/null +++ b/tools/gyp/test/generator-output/copies/copies.gyp @@ -0,0 +1,50 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'pull_in_subdir', + 'type': 'none', + 'dependencies': [ + 'subdir/subdir.gyp:*', + ], + }, + { + 'target_name': 'copies1', + 'type': 'none', + 'copies': [ + { + 'destination': 'copies-out', + 'files': [ + 'file1', + ], + }, + ], + }, + { + 'target_name': 'copies2', + 'type': 'none', + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/copies-out', + 'files': [ + 'file2', + ], + }, + ], + }, + # Verify that a null 'files' list doesn't gag the generators. + { + 'target_name': 'copies_null', + 'type': 'none', + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/copies-null', + 'files': [], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/generator-output/copies/file1 b/tools/gyp/test/generator-output/copies/file1 new file mode 100644 index 000000000..84d55c575 --- /dev/null +++ b/tools/gyp/test/generator-output/copies/file1 @@ -0,0 +1 @@ +file1 contents diff --git a/tools/gyp/test/generator-output/copies/file2 b/tools/gyp/test/generator-output/copies/file2 new file mode 100644 index 000000000..af1b8ae35 --- /dev/null +++ b/tools/gyp/test/generator-output/copies/file2 @@ -0,0 +1 @@ +file2 contents diff --git a/tools/gyp/test/generator-output/copies/subdir/build/README.txt b/tools/gyp/test/generator-output/copies/subdir/build/README.txt new file mode 100644 index 000000000..90ef88619 --- /dev/null +++ b/tools/gyp/test/generator-output/copies/subdir/build/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/copies/subdir/copies-out/README.txt b/tools/gyp/test/generator-output/copies/subdir/copies-out/README.txt new file mode 100644 index 000000000..90ef88619 --- /dev/null +++ b/tools/gyp/test/generator-output/copies/subdir/copies-out/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/copies/subdir/file3 b/tools/gyp/test/generator-output/copies/subdir/file3 new file mode 100644 index 000000000..43f16f352 --- /dev/null +++ b/tools/gyp/test/generator-output/copies/subdir/file3 @@ -0,0 +1 @@ +file3 contents diff --git a/tools/gyp/test/generator-output/copies/subdir/file4 b/tools/gyp/test/generator-output/copies/subdir/file4 new file mode 100644 index 000000000..5f7270a08 --- /dev/null +++ b/tools/gyp/test/generator-output/copies/subdir/file4 @@ -0,0 +1 @@ +file4 contents diff --git a/tools/gyp/test/generator-output/copies/subdir/subdir.gyp b/tools/gyp/test/generator-output/copies/subdir/subdir.gyp new file mode 100644 index 000000000..af031d283 --- /dev/null +++ b/tools/gyp/test/generator-output/copies/subdir/subdir.gyp @@ -0,0 +1,32 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'copies3', + 'type': 'none', + 'copies': [ + { + 'destination': 'copies-out', + 'files': [ + 'file3', + ], + }, + ], + }, + { + 'target_name': 'copies4', + 'type': 'none', + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/copies-out', + 'files': [ + 'file4', + ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/generator-output/gyptest-actions.py b/tools/gyp/test/generator-output/gyptest-actions.py new file mode 100755 index 000000000..6e62720c2 --- /dev/null +++ b/tools/gyp/test/generator-output/gyptest-actions.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies --generator-output= behavior when using actions. +""" + +import TestGyp + +# Ninja doesn't support --generator-output. +test = TestGyp.TestGyp(formats=['!ninja']) + +# All the generated files should go under 'gypfiles'. The source directory +# ('actions') should be untouched. +test.writable(test.workpath('actions'), False) +test.run_gyp('actions.gyp', + '--generator-output=' + test.workpath('gypfiles'), + chdir='actions') + +test.writable(test.workpath('actions'), True) + +test.relocate('actions', 'relocate/actions') +test.relocate('gypfiles', 'relocate/gypfiles') + +test.writable(test.workpath('relocate/actions'), False) + +# Some of the action outputs use "pure" relative paths (i.e. without prefixes +# like <(INTERMEDIATE_DIR) or <(PROGRAM_DIR)). Even though we are building under +# 'gypfiles', such outputs will still be created relative to the original .gyp +# sources. Projects probably wouldn't normally do this, since it kind of defeats +# the purpose of '--generator-output', but it is supported behaviour. +test.writable(test.workpath('relocate/actions/build'), True) +test.writable(test.workpath('relocate/actions/subdir1/build'), True) +test.writable(test.workpath('relocate/actions/subdir1/actions-out'), True) +test.writable(test.workpath('relocate/actions/subdir2/build'), True) +test.writable(test.workpath('relocate/actions/subdir2/actions-out'), True) + +test.build('actions.gyp', test.ALL, chdir='relocate/gypfiles') + +expect = """\ +Hello from program.c +Hello from make-prog1.py +Hello from make-prog2.py +""" + +if test.format == 'xcode': + chdir = 'relocate/actions/subdir1' +else: + chdir = 'relocate/gypfiles' +test.run_built_executable('program', chdir=chdir, stdout=expect) + +test.must_match('relocate/actions/subdir2/actions-out/file.out', + "Hello from make-file.py\n") + +test.pass_test() diff --git a/tools/gyp/test/generator-output/gyptest-copies.py b/tools/gyp/test/generator-output/gyptest-copies.py new file mode 100755 index 000000000..83ba013f0 --- /dev/null +++ b/tools/gyp/test/generator-output/gyptest-copies.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies file copies with --generator-output using an explicit build +target of 'all'. +""" + +import TestGyp + +# Ninja doesn't support --generator-output. +test = TestGyp.TestGyp(formats=['!ninja']) + +test.writable(test.workpath('copies'), False) + +test.run_gyp('copies.gyp', + '--generator-output=' + test.workpath('gypfiles'), + chdir='copies') + +test.writable(test.workpath('copies'), True) + +test.relocate('copies', 'relocate/copies') +test.relocate('gypfiles', 'relocate/gypfiles') + +test.writable(test.workpath('relocate/copies'), False) + +test.writable(test.workpath('relocate/copies/build'), True) +test.writable(test.workpath('relocate/copies/copies-out'), True) +test.writable(test.workpath('relocate/copies/subdir/build'), True) +test.writable(test.workpath('relocate/copies/subdir/copies-out'), True) + +test.build('copies.gyp', test.ALL, chdir='relocate/gypfiles') + +test.must_match(['relocate', 'copies', 'copies-out', 'file1'], + "file1 contents\n") + +if test.format == 'xcode': + chdir = 'relocate/copies/build' +elif test.format == 'make': + chdir = 'relocate/gypfiles/out' +else: + chdir = 'relocate/gypfiles' +test.must_match([chdir, 'Default', 'copies-out', 'file2'], "file2 contents\n") + +test.must_match(['relocate', 'copies', 'subdir', 'copies-out', 'file3'], + "file3 contents\n") + +if test.format == 'xcode': + chdir = 'relocate/copies/subdir/build' +elif test.format == 'make': + chdir = 'relocate/gypfiles/out' +else: + chdir = 'relocate/gypfiles' +test.must_match([chdir, 'Default', 'copies-out', 'file4'], "file4 contents\n") + +test.pass_test() diff --git a/tools/gyp/test/generator-output/gyptest-mac-bundle.py b/tools/gyp/test/generator-output/gyptest-mac-bundle.py new file mode 100644 index 000000000..d8ad91081 --- /dev/null +++ b/tools/gyp/test/generator-output/gyptest-mac-bundle.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies mac bundles work with --generator-output. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + # Ninja doesn't support --generator-output. + test = TestGyp.TestGyp(formats=['!ninja']) + + MAC_BUNDLE_DIR = 'mac-bundle' + GYPFILES_DIR = 'gypfiles' + test.writable(test.workpath(MAC_BUNDLE_DIR), False) + test.run_gyp('test.gyp', + '--generator-output=' + test.workpath(GYPFILES_DIR), + chdir=MAC_BUNDLE_DIR) + test.writable(test.workpath(MAC_BUNDLE_DIR), True) + + test.build('test.gyp', test.ALL, chdir=GYPFILES_DIR) + + test.pass_test() diff --git a/tools/gyp/test/generator-output/gyptest-relocate.py b/tools/gyp/test/generator-output/gyptest-relocate.py new file mode 100755 index 000000000..31a98ea1c --- /dev/null +++ b/tools/gyp/test/generator-output/gyptest-relocate.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that a project hierarchy created with the --generator-output= +option can be built even when it's relocated to a different path. +""" + +import TestGyp + +# Ninja doesn't support --generator-output. +test = TestGyp.TestGyp(formats=['!ninja']) + +test.writable(test.workpath('src'), False) + +test.run_gyp('prog1.gyp', + '-Dset_symroot=1', + '--generator-output=' + test.workpath('gypfiles'), + chdir='src') + +test.writable(test.workpath('src'), True) + +test.relocate('src', 'relocate/src') +test.relocate('gypfiles', 'relocate/gypfiles') + +test.writable(test.workpath('relocate/src'), False) + +test.writable(test.workpath('relocate/src/build'), True) +test.writable(test.workpath('relocate/src/subdir2/build'), True) +test.writable(test.workpath('relocate/src/subdir3/build'), True) + +test.build('prog1.gyp', test.ALL, chdir='relocate/gypfiles') + +chdir = 'relocate/gypfiles' + +expect = """\ +Hello from %s +Hello from inc.h +Hello from inc1/include1.h +Hello from inc2/include2.h +Hello from inc3/include3.h +Hello from subdir2/deeper/deeper.h +""" + +if test.format == 'xcode': + chdir = 'relocate/src' +test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c') + +if test.format == 'xcode': + chdir = 'relocate/src/subdir2' +test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c') + +if test.format == 'xcode': + chdir = 'relocate/src/subdir3' +test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c') + +test.pass_test() diff --git a/tools/gyp/test/generator-output/gyptest-rules.py b/tools/gyp/test/generator-output/gyptest-rules.py new file mode 100755 index 000000000..678416a2f --- /dev/null +++ b/tools/gyp/test/generator-output/gyptest-rules.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies --generator-output= behavior when using rules. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['!ninja']) + +test.writable(test.workpath('rules'), False) + +test.run_gyp('rules.gyp', + '--generator-output=' + test.workpath('gypfiles'), + chdir='rules') + +test.writable(test.workpath('rules'), True) + +test.relocate('rules', 'relocate/rules') +test.relocate('gypfiles', 'relocate/gypfiles') + +test.writable(test.workpath('relocate/rules'), False) + +test.writable(test.workpath('relocate/rules/build'), True) +test.writable(test.workpath('relocate/rules/subdir1/build'), True) +test.writable(test.workpath('relocate/rules/subdir2/build'), True) +test.writable(test.workpath('relocate/rules/subdir2/rules-out'), True) + +test.build('rules.gyp', test.ALL, chdir='relocate/gypfiles') + +expect = """\ +Hello from program.c +Hello from function1.in1 +Hello from function2.in1 +Hello from define3.in0 +Hello from define4.in0 +""" + +if test.format == 'xcode': + chdir = 'relocate/rules/subdir1' +else: + chdir = 'relocate/gypfiles' +test.run_built_executable('program', chdir=chdir, stdout=expect) + +test.must_match('relocate/rules/subdir2/rules-out/file1.out', + "Hello from file1.in0\n") +test.must_match('relocate/rules/subdir2/rules-out/file2.out', + "Hello from file2.in0\n") +test.must_match('relocate/rules/subdir2/rules-out/file3.out', + "Hello from file3.in1\n") +test.must_match('relocate/rules/subdir2/rules-out/file4.out', + "Hello from file4.in1\n") + +test.pass_test() diff --git a/tools/gyp/test/generator-output/gyptest-subdir2-deep.py b/tools/gyp/test/generator-output/gyptest-subdir2-deep.py new file mode 100755 index 000000000..cb5ea15bf --- /dev/null +++ b/tools/gyp/test/generator-output/gyptest-subdir2-deep.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies building a target from a .gyp file a few subdirectories +deep when the --generator-output= option is used to put the build +configuration files in a separate directory tree. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['!ninja']) + +test.writable(test.workpath('src'), False) + +test.writable(test.workpath('src/subdir2/deeper/build'), True) + +test.run_gyp('deeper.gyp', + '-Dset_symroot=1', + '--generator-output=' + test.workpath('gypfiles'), + chdir='src/subdir2/deeper') + +test.build('deeper.gyp', test.ALL, chdir='gypfiles') + +chdir = 'gypfiles' + +if test.format == 'xcode': + chdir = 'src/subdir2/deeper' +test.run_built_executable('deeper', + chdir=chdir, + stdout="Hello from deeper.c\n") + +test.pass_test() diff --git a/tools/gyp/test/generator-output/gyptest-top-all.py b/tools/gyp/test/generator-output/gyptest-top-all.py new file mode 100755 index 000000000..4841f9b6b --- /dev/null +++ b/tools/gyp/test/generator-output/gyptest-top-all.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies building a project hierarchy created when the --generator-output= +option is used to put the build configuration files in a separate +directory tree. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['!ninja']) + +test.writable(test.workpath('src'), False) + +test.run_gyp('prog1.gyp', + '-Dset_symroot=1', + '--generator-output=' + test.workpath('gypfiles'), + chdir='src') + +test.writable(test.workpath('src/build'), True) +test.writable(test.workpath('src/subdir2/build'), True) +test.writable(test.workpath('src/subdir3/build'), True) + +test.build('prog1.gyp', test.ALL, chdir='gypfiles') + +chdir = 'gypfiles' + +expect = """\ +Hello from %s +Hello from inc.h +Hello from inc1/include1.h +Hello from inc2/include2.h +Hello from inc3/include3.h +Hello from subdir2/deeper/deeper.h +""" + +if test.format == 'xcode': + chdir = 'src' +test.run_built_executable('prog1', chdir=chdir, stdout=expect % 'prog1.c') + +if test.format == 'xcode': + chdir = 'src/subdir2' +test.run_built_executable('prog2', chdir=chdir, stdout=expect % 'prog2.c') + +if test.format == 'xcode': + chdir = 'src/subdir3' +test.run_built_executable('prog3', chdir=chdir, stdout=expect % 'prog3.c') + +test.pass_test() diff --git a/tools/gyp/test/generator-output/mac-bundle/Info.plist b/tools/gyp/test/generator-output/mac-bundle/Info.plist new file mode 100644 index 000000000..8cb142e9f --- /dev/null +++ b/tools/gyp/test/generator-output/mac-bundle/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.google.${PRODUCT_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ause + CFBundleVersion + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/tools/gyp/test/generator-output/mac-bundle/app.order b/tools/gyp/test/generator-output/mac-bundle/app.order new file mode 100644 index 000000000..4eb9e89d3 --- /dev/null +++ b/tools/gyp/test/generator-output/mac-bundle/app.order @@ -0,0 +1 @@ +_main diff --git a/tools/gyp/test/generator-output/mac-bundle/header.h b/tools/gyp/test/generator-output/mac-bundle/header.h new file mode 100644 index 000000000..7ed777512 --- /dev/null +++ b/tools/gyp/test/generator-output/mac-bundle/header.h @@ -0,0 +1 @@ +int f(); diff --git a/tools/gyp/test/generator-output/mac-bundle/main.c b/tools/gyp/test/generator-output/mac-bundle/main.c new file mode 100644 index 000000000..237c8ce18 --- /dev/null +++ b/tools/gyp/test/generator-output/mac-bundle/main.c @@ -0,0 +1 @@ +int main() {} diff --git a/tools/gyp/test/generator-output/mac-bundle/resource.sb b/tools/gyp/test/generator-output/mac-bundle/resource.sb new file mode 100644 index 000000000..731befc45 --- /dev/null +++ b/tools/gyp/test/generator-output/mac-bundle/resource.sb @@ -0,0 +1 @@ +A text file. diff --git a/tools/gyp/test/generator-output/mac-bundle/test.gyp b/tools/gyp/test/generator-output/mac-bundle/test.gyp new file mode 100644 index 000000000..35ac674f6 --- /dev/null +++ b/tools/gyp/test/generator-output/mac-bundle/test.gyp @@ -0,0 +1,25 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'test_app', + 'product_name': 'Test App Gyp', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ + 'main.c', + ], + 'mac_bundle_resources': [ + 'resource.sb', + ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'Info.plist', + 'ORDER_FILE': 'app.order', + 'GCC_PREFIX_HEADER': 'header.h', + 'GCC_PRECOMPILE_PREFIX_HEADER': 'YES', + }, + }, + ], +} diff --git a/tools/gyp/test/generator-output/rules/build/README.txt b/tools/gyp/test/generator-output/rules/build/README.txt new file mode 100644 index 000000000..1b052c9a2 --- /dev/null +++ b/tools/gyp/test/generator-output/rules/build/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/rules/copy-file.py b/tools/gyp/test/generator-output/rules/copy-file.py new file mode 100755 index 000000000..938c336ad --- /dev/null +++ b/tools/gyp/test/generator-output/rules/copy-file.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +contents = open(sys.argv[1], 'r').read() +open(sys.argv[2], 'wb').write(contents) + +sys.exit(0) diff --git a/tools/gyp/test/generator-output/rules/rules.gyp b/tools/gyp/test/generator-output/rules/rules.gyp new file mode 100644 index 000000000..dded59aff --- /dev/null +++ b/tools/gyp/test/generator-output/rules/rules.gyp @@ -0,0 +1,16 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'pull_in_all_actions', + 'type': 'none', + 'dependencies': [ + 'subdir1/executable.gyp:*', + 'subdir2/none.gyp:*', + ], + }, + ], +} diff --git a/tools/gyp/test/generator-output/rules/subdir1/build/README.txt b/tools/gyp/test/generator-output/rules/subdir1/build/README.txt new file mode 100644 index 000000000..1b052c9a2 --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir1/build/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/rules/subdir1/define3.in0 b/tools/gyp/test/generator-output/rules/subdir1/define3.in0 new file mode 100644 index 000000000..cc29c643f --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir1/define3.in0 @@ -0,0 +1 @@ +#define STRING3 "Hello from define3.in0\n" diff --git a/tools/gyp/test/generator-output/rules/subdir1/define4.in0 b/tools/gyp/test/generator-output/rules/subdir1/define4.in0 new file mode 100644 index 000000000..c9b0467b3 --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir1/define4.in0 @@ -0,0 +1 @@ +#define STRING4 "Hello from define4.in0\n" diff --git a/tools/gyp/test/generator-output/rules/subdir1/executable.gyp b/tools/gyp/test/generator-output/rules/subdir1/executable.gyp new file mode 100644 index 000000000..2fd89a0d5 --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir1/executable.gyp @@ -0,0 +1,59 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'program', + 'type': 'executable', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'program.c', + 'function1.in1', + 'function2.in1', + 'define3.in0', + 'define4.in0', + ], + 'include_dirs': [ + '<(INTERMEDIATE_DIR)', + ], + 'rules': [ + { + 'rule_name': 'copy_file_0', + 'extension': 'in0', + 'inputs': [ + '../copy-file.py', + ], + 'outputs': [ + # TODO: fix SCons and Make to support generated files not + # in a variable-named path like <(INTERMEDIATE_DIR) + #'<(RULE_INPUT_ROOT).c', + '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).h', + ], + 'action': [ + 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 0, + }, + { + 'rule_name': 'copy_file_1', + 'extension': 'in1', + 'inputs': [ + '../copy-file.py', + ], + 'outputs': [ + # TODO: fix SCons and Make to support generated files not + # in a variable-named path like <(INTERMEDIATE_DIR) + #'<(RULE_INPUT_ROOT).c', + '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).c', + ], + 'action': [ + 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/generator-output/rules/subdir1/function1.in1 b/tools/gyp/test/generator-output/rules/subdir1/function1.in1 new file mode 100644 index 000000000..545e7ca16 --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir1/function1.in1 @@ -0,0 +1,6 @@ +#include + +void function1(void) +{ + printf("Hello from function1.in1\n"); +} diff --git a/tools/gyp/test/generator-output/rules/subdir1/function2.in1 b/tools/gyp/test/generator-output/rules/subdir1/function2.in1 new file mode 100644 index 000000000..6bad43f9c --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir1/function2.in1 @@ -0,0 +1,6 @@ +#include + +void function2(void) +{ + printf("Hello from function2.in1\n"); +} diff --git a/tools/gyp/test/generator-output/rules/subdir1/program.c b/tools/gyp/test/generator-output/rules/subdir1/program.c new file mode 100644 index 000000000..27fd31ed4 --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir1/program.c @@ -0,0 +1,18 @@ +#include +#include "define3.h" +#include "define4.h" + +extern void function1(void); +extern void function2(void); +extern void function3(void); +extern void function4(void); + +int main(int argc, char *argv[]) +{ + printf("Hello from program.c\n"); + function1(); + function2(); + printf("%s", STRING3); + printf("%s", STRING4); + return 0; +} diff --git a/tools/gyp/test/generator-output/rules/subdir2/build/README.txt b/tools/gyp/test/generator-output/rules/subdir2/build/README.txt new file mode 100644 index 000000000..1b052c9a2 --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir2/build/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/rules/subdir2/file1.in0 b/tools/gyp/test/generator-output/rules/subdir2/file1.in0 new file mode 100644 index 000000000..7aca64f4c --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir2/file1.in0 @@ -0,0 +1 @@ +Hello from file1.in0 diff --git a/tools/gyp/test/generator-output/rules/subdir2/file2.in0 b/tools/gyp/test/generator-output/rules/subdir2/file2.in0 new file mode 100644 index 000000000..80a281a2a --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir2/file2.in0 @@ -0,0 +1 @@ +Hello from file2.in0 diff --git a/tools/gyp/test/generator-output/rules/subdir2/file3.in1 b/tools/gyp/test/generator-output/rules/subdir2/file3.in1 new file mode 100644 index 000000000..60ae2e793 --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir2/file3.in1 @@ -0,0 +1 @@ +Hello from file3.in1 diff --git a/tools/gyp/test/generator-output/rules/subdir2/file4.in1 b/tools/gyp/test/generator-output/rules/subdir2/file4.in1 new file mode 100644 index 000000000..5a3c30720 --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir2/file4.in1 @@ -0,0 +1 @@ +Hello from file4.in1 diff --git a/tools/gyp/test/generator-output/rules/subdir2/none.gyp b/tools/gyp/test/generator-output/rules/subdir2/none.gyp new file mode 100644 index 000000000..664cbd9cb --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir2/none.gyp @@ -0,0 +1,49 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'files', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'file1.in0', + 'file2.in0', + 'file3.in1', + 'file4.in1', + ], + 'rules': [ + { + 'rule_name': 'copy_file_0', + 'extension': 'in0', + 'inputs': [ + '../copy-file.py', + ], + 'outputs': [ + 'rules-out/<(RULE_INPUT_ROOT).out', + ], + 'action': [ + 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 0, + }, + { + 'rule_name': 'copy_file_1', + 'extension': 'in1', + 'inputs': [ + '../copy-file.py', + ], + 'outputs': [ + 'rules-out/<(RULE_INPUT_ROOT).out', + ], + 'action': [ + 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/generator-output/rules/subdir2/rules-out/README.txt b/tools/gyp/test/generator-output/rules/subdir2/rules-out/README.txt new file mode 100644 index 000000000..1b052c9a2 --- /dev/null +++ b/tools/gyp/test/generator-output/rules/subdir2/rules-out/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/src/build/README.txt b/tools/gyp/test/generator-output/src/build/README.txt new file mode 100644 index 000000000..90ef88619 --- /dev/null +++ b/tools/gyp/test/generator-output/src/build/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/src/inc.h b/tools/gyp/test/generator-output/src/inc.h new file mode 100644 index 000000000..57aa1a5a7 --- /dev/null +++ b/tools/gyp/test/generator-output/src/inc.h @@ -0,0 +1 @@ +#define INC_STRING "inc.h" diff --git a/tools/gyp/test/generator-output/src/inc1/include1.h b/tools/gyp/test/generator-output/src/inc1/include1.h new file mode 100644 index 000000000..1d59065fc --- /dev/null +++ b/tools/gyp/test/generator-output/src/inc1/include1.h @@ -0,0 +1 @@ +#define INCLUDE1_STRING "inc1/include1.h" diff --git a/tools/gyp/test/generator-output/src/prog1.c b/tools/gyp/test/generator-output/src/prog1.c new file mode 100644 index 000000000..656f81d5f --- /dev/null +++ b/tools/gyp/test/generator-output/src/prog1.c @@ -0,0 +1,18 @@ +#include + +#include "inc.h" +#include "include1.h" +#include "include2.h" +#include "include3.h" +#include "deeper.h" + +int main(int argc, char *argv[]) +{ + printf("Hello from prog1.c\n"); + printf("Hello from %s\n", INC_STRING); + printf("Hello from %s\n", INCLUDE1_STRING); + printf("Hello from %s\n", INCLUDE2_STRING); + printf("Hello from %s\n", INCLUDE3_STRING); + printf("Hello from %s\n", DEEPER_STRING); + return 0; +} diff --git a/tools/gyp/test/generator-output/src/prog1.gyp b/tools/gyp/test/generator-output/src/prog1.gyp new file mode 100644 index 000000000..d50e6fb0a --- /dev/null +++ b/tools/gyp/test/generator-output/src/prog1.gyp @@ -0,0 +1,28 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + 'symroot.gypi', + ], + 'targets': [ + { + 'target_name': 'prog1', + 'type': 'executable', + 'dependencies': [ + 'subdir2/prog2.gyp:prog2', + ], + 'include_dirs': [ + '.', + 'inc1', + 'subdir2/inc2', + 'subdir3/inc3', + 'subdir2/deeper', + ], + 'sources': [ + 'prog1.c', + ], + }, + ], +} diff --git a/tools/gyp/test/generator-output/src/subdir2/build/README.txt b/tools/gyp/test/generator-output/src/subdir2/build/README.txt new file mode 100644 index 000000000..90ef88619 --- /dev/null +++ b/tools/gyp/test/generator-output/src/subdir2/build/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/src/subdir2/deeper/build/README.txt b/tools/gyp/test/generator-output/src/subdir2/deeper/build/README.txt new file mode 100644 index 000000000..90ef88619 --- /dev/null +++ b/tools/gyp/test/generator-output/src/subdir2/deeper/build/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.c b/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.c new file mode 100644 index 000000000..56c49d1f7 --- /dev/null +++ b/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + printf("Hello from deeper.c\n"); + return 0; +} diff --git a/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp b/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp new file mode 100644 index 000000000..864877087 --- /dev/null +++ b/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + '../../symroot.gypi', + ], + 'targets': [ + { + 'target_name': 'deeper', + 'type': 'executable', + 'sources': [ + 'deeper.c', + ], + }, + ], +} diff --git a/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.h b/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.h new file mode 100644 index 000000000..f6484a0fe --- /dev/null +++ b/tools/gyp/test/generator-output/src/subdir2/deeper/deeper.h @@ -0,0 +1 @@ +#define DEEPER_STRING "subdir2/deeper/deeper.h" diff --git a/tools/gyp/test/generator-output/src/subdir2/inc2/include2.h b/tools/gyp/test/generator-output/src/subdir2/inc2/include2.h new file mode 100644 index 000000000..1ccfa5dea --- /dev/null +++ b/tools/gyp/test/generator-output/src/subdir2/inc2/include2.h @@ -0,0 +1 @@ +#define INCLUDE2_STRING "inc2/include2.h" diff --git a/tools/gyp/test/generator-output/src/subdir2/prog2.c b/tools/gyp/test/generator-output/src/subdir2/prog2.c new file mode 100644 index 000000000..38d6c84d1 --- /dev/null +++ b/tools/gyp/test/generator-output/src/subdir2/prog2.c @@ -0,0 +1,18 @@ +#include + +#include "inc.h" +#include "include1.h" +#include "include2.h" +#include "include3.h" +#include "deeper.h" + +int main(int argc, char *argv[]) +{ + printf("Hello from prog2.c\n"); + printf("Hello from %s\n", INC_STRING); + printf("Hello from %s\n", INCLUDE1_STRING); + printf("Hello from %s\n", INCLUDE2_STRING); + printf("Hello from %s\n", INCLUDE3_STRING); + printf("Hello from %s\n", DEEPER_STRING); + return 0; +} diff --git a/tools/gyp/test/generator-output/src/subdir2/prog2.gyp b/tools/gyp/test/generator-output/src/subdir2/prog2.gyp new file mode 100644 index 000000000..7176ed8be --- /dev/null +++ b/tools/gyp/test/generator-output/src/subdir2/prog2.gyp @@ -0,0 +1,28 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + '../symroot.gypi', + ], + 'targets': [ + { + 'target_name': 'prog2', + 'type': 'executable', + 'include_dirs': [ + '..', + '../inc1', + 'inc2', + '../subdir3/inc3', + 'deeper', + ], + 'dependencies': [ + '../subdir3/prog3.gyp:prog3', + ], + 'sources': [ + 'prog2.c', + ], + }, + ], +} diff --git a/tools/gyp/test/generator-output/src/subdir3/build/README.txt b/tools/gyp/test/generator-output/src/subdir3/build/README.txt new file mode 100644 index 000000000..90ef88619 --- /dev/null +++ b/tools/gyp/test/generator-output/src/subdir3/build/README.txt @@ -0,0 +1,4 @@ +A place-holder for this Xcode build output directory, so that the +test script can verify that .xcodeproj files are not created in +their normal location by making the src/ read-only, and then +selectively making this build directory writable. diff --git a/tools/gyp/test/generator-output/src/subdir3/inc3/include3.h b/tools/gyp/test/generator-output/src/subdir3/inc3/include3.h new file mode 100644 index 000000000..bf53bf1f0 --- /dev/null +++ b/tools/gyp/test/generator-output/src/subdir3/inc3/include3.h @@ -0,0 +1 @@ +#define INCLUDE3_STRING "inc3/include3.h" diff --git a/tools/gyp/test/generator-output/src/subdir3/prog3.c b/tools/gyp/test/generator-output/src/subdir3/prog3.c new file mode 100644 index 000000000..7848b45ab --- /dev/null +++ b/tools/gyp/test/generator-output/src/subdir3/prog3.c @@ -0,0 +1,18 @@ +#include + +#include "inc.h" +#include "include1.h" +#include "include2.h" +#include "include3.h" +#include "deeper.h" + +int main(int argc, char *argv[]) +{ + printf("Hello from prog3.c\n"); + printf("Hello from %s\n", INC_STRING); + printf("Hello from %s\n", INCLUDE1_STRING); + printf("Hello from %s\n", INCLUDE2_STRING); + printf("Hello from %s\n", INCLUDE3_STRING); + printf("Hello from %s\n", DEEPER_STRING); + return 0; +} diff --git a/tools/gyp/test/generator-output/src/subdir3/prog3.gyp b/tools/gyp/test/generator-output/src/subdir3/prog3.gyp new file mode 100644 index 000000000..46c5e000a --- /dev/null +++ b/tools/gyp/test/generator-output/src/subdir3/prog3.gyp @@ -0,0 +1,25 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + '../symroot.gypi', + ], + 'targets': [ + { + 'target_name': 'prog3', + 'type': 'executable', + 'include_dirs': [ + '..', + '../inc1', + '../subdir2/inc2', + 'inc3', + '../subdir2/deeper', + ], + 'sources': [ + 'prog3.c', + ], + }, + ], +} diff --git a/tools/gyp/test/generator-output/src/symroot.gypi b/tools/gyp/test/generator-output/src/symroot.gypi new file mode 100644 index 000000000..519916427 --- /dev/null +++ b/tools/gyp/test/generator-output/src/symroot.gypi @@ -0,0 +1,16 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables': { + 'set_symroot%': 0, + }, + 'conditions': [ + ['set_symroot == 1', { + 'xcode_settings': { + 'SYMROOT': '<(DEPTH)/build', + }, + }], + ], +} diff --git a/tools/gyp/test/hard_dependency/gyptest-exported-hard-dependency.py b/tools/gyp/test/hard_dependency/gyptest-exported-hard-dependency.py new file mode 100755 index 000000000..ba5152880 --- /dev/null +++ b/tools/gyp/test/hard_dependency/gyptest-exported-hard-dependency.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify that a hard_dependency that is exported is pulled in as a dependency +for a target if the target is a static library and if the generator will +remove dependencies between static libraries. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +if test.format == 'dump_dependency_json': + test.skip_test('Skipping test; dependency JSON does not adjust ' \ + 'static libraries.\n') + +test.run_gyp('hard_dependency.gyp', chdir='src') + +chdir = 'relocate/src' +test.relocate('src', chdir) + +test.build('hard_dependency.gyp', 'c', chdir=chdir) + +# The 'a' static library should be built, as it has actions with side-effects +# that are necessary to compile 'c'. Even though 'c' does not directly depend +# on 'a', because 'a' is a hard_dependency that 'b' exports, 'c' should import +# it as a hard_dependency and ensure it is built before building 'c'. +test.built_file_must_exist('a', type=test.STATIC_LIB, chdir=chdir) +test.built_file_must_not_exist('b', type=test.STATIC_LIB, chdir=chdir) +test.built_file_must_exist('c', type=test.STATIC_LIB, chdir=chdir) +test.built_file_must_not_exist('d', type=test.STATIC_LIB, chdir=chdir) + +test.pass_test() diff --git a/tools/gyp/test/hard_dependency/gyptest-no-exported-hard-dependency.py b/tools/gyp/test/hard_dependency/gyptest-no-exported-hard-dependency.py new file mode 100755 index 000000000..10774ca2a --- /dev/null +++ b/tools/gyp/test/hard_dependency/gyptest-no-exported-hard-dependency.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify that a hard_dependency that is not exported is not pulled in as a +dependency for a target if the target does not explicitly specify a dependency +and none of its dependencies export the hard_dependency. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +if test.format == 'dump_dependency_json': + test.skip_test('Skipping test; dependency JSON does not adjust ' \ + 'static libaries.\n') + +test.run_gyp('hard_dependency.gyp', chdir='src') + +chdir = 'relocate/src' +test.relocate('src', chdir) + +test.build('hard_dependency.gyp', 'd', chdir=chdir) + +# Because 'c' does not export a hard_dependency, only the target 'd' should +# be built. This is because the 'd' target does not need the generated headers +# in order to be compiled. +test.built_file_must_not_exist('a', type=test.STATIC_LIB, chdir=chdir) +test.built_file_must_not_exist('b', type=test.STATIC_LIB, chdir=chdir) +test.built_file_must_not_exist('c', type=test.STATIC_LIB, chdir=chdir) +test.built_file_must_exist('d', type=test.STATIC_LIB, chdir=chdir) + +test.pass_test() diff --git a/tools/gyp/test/hard_dependency/src/a.c b/tools/gyp/test/hard_dependency/src/a.c new file mode 100644 index 000000000..0fa0223c9 --- /dev/null +++ b/tools/gyp/test/hard_dependency/src/a.c @@ -0,0 +1,9 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include "a.h" + +int funcA() { + return 42; +} diff --git a/tools/gyp/test/hard_dependency/src/a.h b/tools/gyp/test/hard_dependency/src/a.h new file mode 100644 index 000000000..854a06504 --- /dev/null +++ b/tools/gyp/test/hard_dependency/src/a.h @@ -0,0 +1,12 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#ifndef A_H_ +#define A_H_ + +#include "generated.h" + +int funcA(); + +#endif // A_H_ diff --git a/tools/gyp/test/hard_dependency/src/b.c b/tools/gyp/test/hard_dependency/src/b.c new file mode 100644 index 000000000..0baace929 --- /dev/null +++ b/tools/gyp/test/hard_dependency/src/b.c @@ -0,0 +1,9 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include "a.h" + +int funcB() { + return funcA(); +} diff --git a/tools/gyp/test/hard_dependency/src/b.h b/tools/gyp/test/hard_dependency/src/b.h new file mode 100644 index 000000000..22b48cefe --- /dev/null +++ b/tools/gyp/test/hard_dependency/src/b.h @@ -0,0 +1,12 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#ifndef B_H_ +#define B_H_ + +#include "a.h" + +int funcB(); + +#endif // B_H_ diff --git a/tools/gyp/test/hard_dependency/src/c.c b/tools/gyp/test/hard_dependency/src/c.c new file mode 100644 index 000000000..7d0068208 --- /dev/null +++ b/tools/gyp/test/hard_dependency/src/c.c @@ -0,0 +1,10 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include "b.h" +#include "c.h" + +int funcC() { + return funcB(); +} diff --git a/tools/gyp/test/hard_dependency/src/c.h b/tools/gyp/test/hard_dependency/src/c.h new file mode 100644 index 000000000..f4ea7fefa --- /dev/null +++ b/tools/gyp/test/hard_dependency/src/c.h @@ -0,0 +1,10 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#ifndef C_H_ +#define C_H_ + +int funcC(); + +#endif // C_H_ diff --git a/tools/gyp/test/hard_dependency/src/d.c b/tools/gyp/test/hard_dependency/src/d.c new file mode 100644 index 000000000..d016c3ce7 --- /dev/null +++ b/tools/gyp/test/hard_dependency/src/d.c @@ -0,0 +1,9 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include "c.h" + +int funcD() { + return funcC(); +} diff --git a/tools/gyp/test/hard_dependency/src/emit.py b/tools/gyp/test/hard_dependency/src/emit.py new file mode 100755 index 000000000..2df74b79a --- /dev/null +++ b/tools/gyp/test/hard_dependency/src/emit.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +f = open(sys.argv[1], 'wb') +f.write('/* Hello World */\n') +f.close() diff --git a/tools/gyp/test/hard_dependency/src/hard_dependency.gyp b/tools/gyp/test/hard_dependency/src/hard_dependency.gyp new file mode 100644 index 000000000..4479c5f04 --- /dev/null +++ b/tools/gyp/test/hard_dependency/src/hard_dependency.gyp @@ -0,0 +1,78 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'a', + 'type': 'static_library', + 'sources': [ + 'a.c', + 'a.h', + ], + 'hard_dependency': 1, + 'actions': [ + { + 'action_name': 'generate_headers', + 'inputs': [ + 'emit.py' + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/generated.h' + ], + 'action': [ + 'python', + 'emit.py', + '<(SHARED_INTERMEDIATE_DIR)/generated.h', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', + ], + }, + }, + { + 'target_name': 'b', + 'type': 'static_library', + 'sources': [ + 'b.c', + 'b.h', + ], + 'dependencies': [ + 'a', + ], + 'export_dependent_settings': [ + 'a', + ], + }, + { + 'target_name': 'c', + 'type': 'static_library', + 'sources': [ + 'c.c', + 'c.h', + ], + 'dependencies': [ + 'b', + ], + }, + { + 'target_name': 'd', + 'type': 'static_library', + 'sources': [ + 'd.c', + ], + 'dependencies': [ + 'c', + ], + } + ], +} diff --git a/tools/gyp/test/hello/gyptest-all.py b/tools/gyp/test/hello/gyptest-all.py new file mode 100755 index 000000000..1739b6886 --- /dev/null +++ b/tools/gyp/test/hello/gyptest-all.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simplest-possible build of a "Hello, world!" program +using an explicit build target of 'all'. +""" + +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_all') + +test.run_gyp('hello.gyp') + +test.build('hello.gyp', test.ALL) + +test.run_built_executable('hello', stdout="Hello, world!\n") + +test.up_to_date('hello.gyp', test.ALL) + +test.pass_test() diff --git a/tools/gyp/test/hello/gyptest-default.py b/tools/gyp/test/hello/gyptest-default.py new file mode 100755 index 000000000..22377e7ac --- /dev/null +++ b/tools/gyp/test/hello/gyptest-default.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simplest-possible build of a "Hello, world!" program +using the default build target. +""" + +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_default') + +test.run_gyp('hello.gyp') + +test.build('hello.gyp') + +test.run_built_executable('hello', stdout="Hello, world!\n") + +test.up_to_date('hello.gyp', test.DEFAULT) + +test.pass_test() diff --git a/tools/gyp/test/hello/gyptest-disable-regyp.py b/tools/gyp/test/hello/gyptest-disable-regyp.py new file mode 100755 index 000000000..1e4b30667 --- /dev/null +++ b/tools/gyp/test/hello/gyptest-disable-regyp.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that Makefiles don't get rebuilt when a source gyp file changes and +the disable_regeneration generator flag is set. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('hello.gyp', '-Gauto_regeneration=0') + +test.build('hello.gyp', test.ALL) + +test.run_built_executable('hello', stdout="Hello, world!\n") + +# Sleep so that the changed gyp file will have a newer timestamp than the +# previously generated build files. +test.sleep() +test.write('hello.gyp', test.read('hello2.gyp')) + +test.build('hello.gyp', test.ALL) + +# Should still be the old executable, as regeneration was disabled. +test.run_built_executable('hello', stdout="Hello, world!\n") + +test.pass_test() diff --git a/tools/gyp/test/hello/gyptest-regyp.py b/tools/gyp/test/hello/gyptest-regyp.py new file mode 100755 index 000000000..827c7235c --- /dev/null +++ b/tools/gyp/test/hello/gyptest-regyp.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that Makefiles get rebuilt when a source gyp file changes. +""" + +import TestGyp + +# Regenerating build files when a gyp file changes is currently only supported +# by the make generator. +test = TestGyp.TestGyp(formats=['make']) + +test.run_gyp('hello.gyp') + +test.build('hello.gyp', test.ALL) + +test.run_built_executable('hello', stdout="Hello, world!\n") + +# Sleep so that the changed gyp file will have a newer timestamp than the +# previously generated build files. +test.sleep() +test.write('hello.gyp', test.read('hello2.gyp')) + +test.build('hello.gyp', test.ALL) + +test.run_built_executable('hello', stdout="Hello, two!\n") + +test.pass_test() diff --git a/tools/gyp/test/hello/gyptest-target.py b/tools/gyp/test/hello/gyptest-target.py new file mode 100755 index 000000000..1abaf7057 --- /dev/null +++ b/tools/gyp/test/hello/gyptest-target.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simplest-possible build of a "Hello, world!" program +using an explicit build target of 'hello'. +""" + +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_target') + +test.run_gyp('hello.gyp') + +test.build('hello.gyp', 'hello') + +test.run_built_executable('hello', stdout="Hello, world!\n") + +test.up_to_date('hello.gyp', 'hello') + +test.pass_test() diff --git a/tools/gyp/test/hello/hello.c b/tools/gyp/test/hello/hello.c new file mode 100644 index 000000000..8dbecc049 --- /dev/null +++ b/tools/gyp/test/hello/hello.c @@ -0,0 +1,11 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +int main(int argc, char *argv[]) +{ + printf("Hello, world!\n"); + return 0; +} diff --git a/tools/gyp/test/hello/hello.gyp b/tools/gyp/test/hello/hello.gyp new file mode 100644 index 000000000..1974d51cc --- /dev/null +++ b/tools/gyp/test/hello/hello.gyp @@ -0,0 +1,15 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'hello', + 'type': 'executable', + 'sources': [ + 'hello.c', + ], + }, + ], +} diff --git a/tools/gyp/test/hello/hello2.c b/tools/gyp/test/hello/hello2.c new file mode 100644 index 000000000..19ef3fbd5 --- /dev/null +++ b/tools/gyp/test/hello/hello2.c @@ -0,0 +1,11 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +int main(int argc, char *argv[]) +{ + printf("Hello, two!\n"); + return 0; +} diff --git a/tools/gyp/test/hello/hello2.gyp b/tools/gyp/test/hello/hello2.gyp new file mode 100644 index 000000000..25b08caf3 --- /dev/null +++ b/tools/gyp/test/hello/hello2.gyp @@ -0,0 +1,15 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'hello', + 'type': 'executable', + 'sources': [ + 'hello2.c', + ], + }, + ], +} diff --git a/tools/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py b/tools/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py new file mode 100755 index 000000000..59573414a --- /dev/null +++ b/tools/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies inclusion of $HOME/.gyp/include.gypi works properly with relocation +and with regeneration. +""" + +import os +import TestGyp + +# Regenerating build files when a gyp file changes is currently only supported +# by the make generator. +test = TestGyp.TestGyp(formats=['make']) + +os.environ['HOME'] = os.path.abspath('home') + +test.run_gyp('all.gyp', chdir='src') + +# After relocating, we should still be able to build (build file shouldn't +# contain relative reference to ~/.gyp/include.gypi) +test.relocate('src', 'relocate/src') + +test.build('all.gyp', test.ALL, chdir='relocate/src') + +test.run_built_executable('printfoo', + chdir='relocate/src', + stdout='FOO is fromhome\n') + +# Building should notice any changes to ~/.gyp/include.gypi and regyp. +test.sleep() + +test.write('home/.gyp/include.gypi', test.read('home2/.gyp/include.gypi')) + +test.build('all.gyp', test.ALL, chdir='relocate/src') + +test.run_built_executable('printfoo', + chdir='relocate/src', + stdout='FOO is fromhome2\n') + +test.pass_test() diff --git a/tools/gyp/test/home_dot_gyp/gyptest-home-includes.py b/tools/gyp/test/home_dot_gyp/gyptest-home-includes.py new file mode 100755 index 000000000..8ad52556b --- /dev/null +++ b/tools/gyp/test/home_dot_gyp/gyptest-home-includes.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies inclusion of $HOME/.gyp/include.gypi works. +""" + +import os +import TestGyp + +test = TestGyp.TestGyp() + +os.environ['HOME'] = os.path.abspath('home') + +test.run_gyp('all.gyp', chdir='src') + +# After relocating, we should still be able to build (build file shouldn't +# contain relative reference to ~/.gyp/include.gypi) +test.relocate('src', 'relocate/src') + +test.build('all.gyp', test.ALL, chdir='relocate/src') + +test.run_built_executable('printfoo', + chdir='relocate/src', + stdout='FOO is fromhome\n') + +test.pass_test() diff --git a/tools/gyp/test/home_dot_gyp/home/.gyp/include.gypi b/tools/gyp/test/home_dot_gyp/home/.gyp/include.gypi new file mode 100644 index 000000000..fcfb39bef --- /dev/null +++ b/tools/gyp/test/home_dot_gyp/home/.gyp/include.gypi @@ -0,0 +1,5 @@ +{ + 'variables': { + 'foo': '"fromhome"', + }, +} diff --git a/tools/gyp/test/home_dot_gyp/home2/.gyp/include.gypi b/tools/gyp/test/home_dot_gyp/home2/.gyp/include.gypi new file mode 100644 index 000000000..f0d84b31a --- /dev/null +++ b/tools/gyp/test/home_dot_gyp/home2/.gyp/include.gypi @@ -0,0 +1,5 @@ +{ + 'variables': { + 'foo': '"fromhome2"', + }, +} diff --git a/tools/gyp/test/home_dot_gyp/src/all.gyp b/tools/gyp/test/home_dot_gyp/src/all.gyp new file mode 100644 index 000000000..14b6aea28 --- /dev/null +++ b/tools/gyp/test/home_dot_gyp/src/all.gyp @@ -0,0 +1,22 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables': { + 'foo%': '"fromdefault"', + }, + 'targets': [ + { + 'target_name': 'printfoo', + 'type': 'executable', + 'sources': [ + 'printfoo.c', + ], + 'defines': [ + 'FOO=<(foo)', + ], + }, + ], +} + diff --git a/tools/gyp/test/home_dot_gyp/src/printfoo.c b/tools/gyp/test/home_dot_gyp/src/printfoo.c new file mode 100644 index 000000000..92d2cbacb --- /dev/null +++ b/tools/gyp/test/home_dot_gyp/src/printfoo.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + printf("FOO is %s\n", FOO); + return 0; +} diff --git a/tools/gyp/test/include_dirs/gyptest-all.py b/tools/gyp/test/include_dirs/gyptest-all.py new file mode 100755 index 000000000..94a1338d4 --- /dev/null +++ b/tools/gyp/test/include_dirs/gyptest-all.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies use of include_dirs when using an explicit build target of 'all'. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +if test.format == 'scons': + test.skip_test('TODO: http://code.google.com/p/gyp/issues/detail?id=176\n') + +test.run_gyp('includes.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('includes.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +Hello from includes.c +Hello from inc.h +Hello from include1.h +Hello from subdir/inc2/include2.h +Hello from shadow2/shadow.h +""" +test.run_built_executable('includes', stdout=expect, chdir='relocate/src') + +if test.format == 'xcode': + chdir='relocate/src/subdir' +else: + chdir='relocate/src' + +expect = """\ +Hello from subdir/subdir_includes.c +Hello from subdir/inc.h +Hello from include1.h +Hello from subdir/inc2/include2.h +""" +test.run_built_executable('subdir_includes', stdout=expect, chdir=chdir) + +test.pass_test() diff --git a/tools/gyp/test/include_dirs/gyptest-default.py b/tools/gyp/test/include_dirs/gyptest-default.py new file mode 100755 index 000000000..42acd1f96 --- /dev/null +++ b/tools/gyp/test/include_dirs/gyptest-default.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies use of include_dirs when using the default build target. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +if test.format == 'scons': + test.skip_test('TODO: http://code.google.com/p/gyp/issues/detail?id=176\n') + +test.run_gyp('includes.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('includes.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +Hello from includes.c +Hello from inc.h +Hello from include1.h +Hello from subdir/inc2/include2.h +Hello from shadow2/shadow.h +""" +test.run_built_executable('includes', stdout=expect, chdir='relocate/src') + +if test.format == 'xcode': + chdir='relocate/src/subdir' +else: + chdir='relocate/src' + +expect = """\ +Hello from subdir/subdir_includes.c +Hello from subdir/inc.h +Hello from include1.h +Hello from subdir/inc2/include2.h +""" +test.run_built_executable('subdir_includes', stdout=expect, chdir=chdir) + +test.pass_test() diff --git a/tools/gyp/test/include_dirs/src/inc.h b/tools/gyp/test/include_dirs/src/inc.h new file mode 100644 index 000000000..0398d6915 --- /dev/null +++ b/tools/gyp/test/include_dirs/src/inc.h @@ -0,0 +1 @@ +#define INC_STRING "inc.h" diff --git a/tools/gyp/test/include_dirs/src/inc1/include1.h b/tools/gyp/test/include_dirs/src/inc1/include1.h new file mode 100644 index 000000000..43356b5f4 --- /dev/null +++ b/tools/gyp/test/include_dirs/src/inc1/include1.h @@ -0,0 +1 @@ +#define INCLUDE1_STRING "include1.h" diff --git a/tools/gyp/test/include_dirs/src/includes.c b/tools/gyp/test/include_dirs/src/includes.c new file mode 100644 index 000000000..e2afbd3ed --- /dev/null +++ b/tools/gyp/test/include_dirs/src/includes.c @@ -0,0 +1,19 @@ +#include + +#include "inc.h" +#include "include1.h" +#include "include2.h" +#include "shadow.h" + +int main(int argc, char *argv[]) +{ + printf("Hello from includes.c\n"); + printf("Hello from %s\n", INC_STRING); + printf("Hello from %s\n", INCLUDE1_STRING); + printf("Hello from %s\n", INCLUDE2_STRING); + /* Test that include_dirs happen first: The gyp file has a -Ishadow1 + cflag and an include_dir of shadow2. Including shadow.h should get + the shadow.h from the include_dir. */ + printf("Hello from %s\n", SHADOW_STRING); + return 0; +} diff --git a/tools/gyp/test/include_dirs/src/includes.gyp b/tools/gyp/test/include_dirs/src/includes.gyp new file mode 100644 index 000000000..359269020 --- /dev/null +++ b/tools/gyp/test/include_dirs/src/includes.gyp @@ -0,0 +1,27 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'includes', + 'type': 'executable', + 'dependencies': [ + 'subdir/subdir_includes.gyp:subdir_includes', + ], + 'cflags': [ + '-Ishadow1', + ], + 'include_dirs': [ + '.', + 'inc1', + 'shadow2', + 'subdir/inc2', + ], + 'sources': [ + 'includes.c', + ], + }, + ], +} diff --git a/tools/gyp/test/include_dirs/src/shadow1/shadow.h b/tools/gyp/test/include_dirs/src/shadow1/shadow.h new file mode 100644 index 000000000..80f6de20b --- /dev/null +++ b/tools/gyp/test/include_dirs/src/shadow1/shadow.h @@ -0,0 +1 @@ +#define SHADOW_STRING "shadow1/shadow.h" diff --git a/tools/gyp/test/include_dirs/src/shadow2/shadow.h b/tools/gyp/test/include_dirs/src/shadow2/shadow.h new file mode 100644 index 000000000..fad5ccd08 --- /dev/null +++ b/tools/gyp/test/include_dirs/src/shadow2/shadow.h @@ -0,0 +1 @@ +#define SHADOW_STRING "shadow2/shadow.h" diff --git a/tools/gyp/test/include_dirs/src/subdir/inc.h b/tools/gyp/test/include_dirs/src/subdir/inc.h new file mode 100644 index 000000000..0a68d7b36 --- /dev/null +++ b/tools/gyp/test/include_dirs/src/subdir/inc.h @@ -0,0 +1 @@ +#define INC_STRING "subdir/inc.h" diff --git a/tools/gyp/test/include_dirs/src/subdir/inc2/include2.h b/tools/gyp/test/include_dirs/src/subdir/inc2/include2.h new file mode 100644 index 000000000..721577eff --- /dev/null +++ b/tools/gyp/test/include_dirs/src/subdir/inc2/include2.h @@ -0,0 +1 @@ +#define INCLUDE2_STRING "subdir/inc2/include2.h" diff --git a/tools/gyp/test/include_dirs/src/subdir/subdir_includes.c b/tools/gyp/test/include_dirs/src/subdir/subdir_includes.c new file mode 100644 index 000000000..727f68220 --- /dev/null +++ b/tools/gyp/test/include_dirs/src/subdir/subdir_includes.c @@ -0,0 +1,14 @@ +#include + +#include "inc.h" +#include "include1.h" +#include "include2.h" + +int main(int argc, char *argv[]) +{ + printf("Hello from subdir/subdir_includes.c\n"); + printf("Hello from %s\n", INC_STRING); + printf("Hello from %s\n", INCLUDE1_STRING); + printf("Hello from %s\n", INCLUDE2_STRING); + return 0; +} diff --git a/tools/gyp/test/include_dirs/src/subdir/subdir_includes.gyp b/tools/gyp/test/include_dirs/src/subdir/subdir_includes.gyp new file mode 100644 index 000000000..257d052c3 --- /dev/null +++ b/tools/gyp/test/include_dirs/src/subdir/subdir_includes.gyp @@ -0,0 +1,20 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'subdir_includes', + 'type': 'executable', + 'include_dirs': [ + '.', + '../inc1', + 'inc2', + ], + 'sources': [ + 'subdir_includes.c', + ], + }, + ], +} diff --git a/tools/gyp/test/intermediate_dir/gyptest-intermediate-dir.py b/tools/gyp/test/intermediate_dir/gyptest-intermediate-dir.py new file mode 100755 index 000000000..91957538c --- /dev/null +++ b/tools/gyp/test/intermediate_dir/gyptest-intermediate-dir.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that targets have independent INTERMEDIATE_DIRs. +""" + +import TestGyp + +import os +import sys + +test = TestGyp.TestGyp() + +test.run_gyp('test.gyp', chdir='src') +test.build('test.gyp', 'target1', chdir='src') +# Check stuff exists. +intermediate_file1 = test.read('src/outfile.txt') +test.must_contain(intermediate_file1, 'target1') + +shared_intermediate_file1 = test.read('src/shared_outfile.txt') +test.must_contain(shared_intermediate_file1, 'shared_target1') + +test.run_gyp('test2.gyp', chdir='src') +# Force the shared intermediate to be rebuilt. +test.sleep() +test.touch('src/shared_infile.txt') +test.build('test2.gyp', 'target2', chdir='src') +# Check INTERMEDIATE_DIR file didn't get overwritten but SHARED_INTERMEDIATE_DIR +# file did. +intermediate_file2 = test.read('src/outfile.txt') +test.must_contain(intermediate_file1, 'target1') +test.must_contain(intermediate_file2, 'target2') + +shared_intermediate_file2 = test.read('src/shared_outfile.txt') +if shared_intermediate_file1 != shared_intermediate_file2: + test.fail_test(shared_intermediate_file1 + ' != ' + shared_intermediate_file2) + +test.must_contain(shared_intermediate_file1, 'shared_target2') +test.must_contain(shared_intermediate_file2, 'shared_target2') + +test.pass_test() diff --git a/tools/gyp/test/intermediate_dir/src/script.py b/tools/gyp/test/intermediate_dir/src/script.py new file mode 100755 index 000000000..fa828a06b --- /dev/null +++ b/tools/gyp/test/intermediate_dir/src/script.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Takes 3 arguments. Writes the 1st argument to the file in the 2nd argument, +# and writes the absolute path to the file in the 2nd argument to the file in +# the 3rd argument. + +import os +import shlex +import sys + +if len(sys.argv) == 3 and ' ' in sys.argv[2]: + sys.argv[2], fourth = shlex.split(sys.argv[2]) + sys.argv.append(fourth) + +#print >>sys.stderr, sys.argv + +with open(sys.argv[2], 'w') as f: + f.write(sys.argv[1]) + +with open(sys.argv[3], 'w') as f: + f.write(os.path.abspath(sys.argv[2])) diff --git a/tools/gyp/test/intermediate_dir/src/shared_infile.txt b/tools/gyp/test/intermediate_dir/src/shared_infile.txt new file mode 100644 index 000000000..e2aba15d0 --- /dev/null +++ b/tools/gyp/test/intermediate_dir/src/shared_infile.txt @@ -0,0 +1 @@ +dummy input diff --git a/tools/gyp/test/intermediate_dir/src/test.gyp b/tools/gyp/test/intermediate_dir/src/test.gyp new file mode 100644 index 000000000..b61e7e8ea --- /dev/null +++ b/tools/gyp/test/intermediate_dir/src/test.gyp @@ -0,0 +1,42 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'target1', + 'type': 'none', + 'actions': [ + { + 'action_name': 'intermediate', + 'inputs': [], + 'outputs': [ + '<(INTERMEDIATE_DIR)/intermediate_out.txt', + 'outfile.txt', + ], + 'action': [ + 'python', 'script.py', 'target1', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + { + 'action_name': 'shared_intermediate', + 'inputs': [ + 'shared_infile.txt', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/intermediate_out.txt', + 'shared_outfile.txt', + ], + 'action': [ + 'python', 'script.py', 'shared_target1', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/intermediate_dir/src/test2.gyp b/tools/gyp/test/intermediate_dir/src/test2.gyp new file mode 100644 index 000000000..41f556466 --- /dev/null +++ b/tools/gyp/test/intermediate_dir/src/test2.gyp @@ -0,0 +1,42 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'target2', + 'type': 'none', + 'actions': [ + { + 'action_name': 'intermediate', + 'inputs': [], + 'outputs': [ + '<(INTERMEDIATE_DIR)/intermediate_out.txt', + 'outfile.txt', + ], + 'action': [ + 'python', 'script.py', 'target2', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + { + 'action_name': 'shared_intermediate', + 'inputs': [ + 'shared_infile.txt', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/intermediate_out.txt', + 'shared_outfile.txt', + ], + 'action': [ + 'python', 'script.py', 'shared_target2', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/lib/README.txt b/tools/gyp/test/lib/README.txt new file mode 100644 index 000000000..b3d724574 --- /dev/null +++ b/tools/gyp/test/lib/README.txt @@ -0,0 +1,17 @@ +Supporting modules for GYP testing. + + TestCmd.py + TestCommon.py + + Modules for generic testing of command-line utilities, + specifically including the ability to copy a test configuration + to temporary directories (with default cleanup on exit) as part + of running test scripts that invoke commands, compare actual + against expected output, etc. + + Our copies of these come from the SCons project, + http://www.scons.org/. + + TestGyp.py + + Modules for GYP-specific tests, of course. diff --git a/tools/gyp/test/lib/TestCmd.py b/tools/gyp/test/lib/TestCmd.py new file mode 100644 index 000000000..45d901ca2 --- /dev/null +++ b/tools/gyp/test/lib/TestCmd.py @@ -0,0 +1,1594 @@ +""" +TestCmd.py: a testing framework for commands and scripts. + +The TestCmd module provides a framework for portable automated testing +of executable commands and scripts (in any language, not just Python), +especially commands and scripts that require file system interaction. + +In addition to running tests and evaluating conditions, the TestCmd +module manages and cleans up one or more temporary workspace +directories, and provides methods for creating files and directories in +those workspace directories from in-line data, here-documents), allowing +tests to be completely self-contained. + +A TestCmd environment object is created via the usual invocation: + + import TestCmd + test = TestCmd.TestCmd() + +There are a bunch of keyword arguments available at instantiation: + + test = TestCmd.TestCmd(description = 'string', + program = 'program_or_script_to_test', + interpreter = 'script_interpreter', + workdir = 'prefix', + subdir = 'subdir', + verbose = Boolean, + match = default_match_function, + diff = default_diff_function, + combine = Boolean) + +There are a bunch of methods that let you do different things: + + test.verbose_set(1) + + test.description_set('string') + + test.program_set('program_or_script_to_test') + + test.interpreter_set('script_interpreter') + test.interpreter_set(['script_interpreter', 'arg']) + + test.workdir_set('prefix') + test.workdir_set('') + + test.workpath('file') + test.workpath('subdir', 'file') + + test.subdir('subdir', ...) + + test.rmdir('subdir', ...) + + test.write('file', "contents\n") + test.write(['subdir', 'file'], "contents\n") + + test.read('file') + test.read(['subdir', 'file']) + test.read('file', mode) + test.read(['subdir', 'file'], mode) + + test.writable('dir', 1) + test.writable('dir', None) + + test.preserve(condition, ...) + + test.cleanup(condition) + + test.command_args(program = 'program_or_script_to_run', + interpreter = 'script_interpreter', + arguments = 'arguments to pass to program') + + test.run(program = 'program_or_script_to_run', + interpreter = 'script_interpreter', + arguments = 'arguments to pass to program', + chdir = 'directory_to_chdir_to', + stdin = 'input to feed to the program\n') + universal_newlines = True) + + p = test.start(program = 'program_or_script_to_run', + interpreter = 'script_interpreter', + arguments = 'arguments to pass to program', + universal_newlines = None) + + test.finish(self, p) + + test.pass_test() + test.pass_test(condition) + test.pass_test(condition, function) + + test.fail_test() + test.fail_test(condition) + test.fail_test(condition, function) + test.fail_test(condition, function, skip) + + test.no_result() + test.no_result(condition) + test.no_result(condition, function) + test.no_result(condition, function, skip) + + test.stdout() + test.stdout(run) + + test.stderr() + test.stderr(run) + + test.symlink(target, link) + + test.banner(string) + test.banner(string, width) + + test.diff(actual, expected) + + test.match(actual, expected) + + test.match_exact("actual 1\nactual 2\n", "expected 1\nexpected 2\n") + test.match_exact(["actual 1\n", "actual 2\n"], + ["expected 1\n", "expected 2\n"]) + + test.match_re("actual 1\nactual 2\n", regex_string) + test.match_re(["actual 1\n", "actual 2\n"], list_of_regexes) + + test.match_re_dotall("actual 1\nactual 2\n", regex_string) + test.match_re_dotall(["actual 1\n", "actual 2\n"], list_of_regexes) + + test.tempdir() + test.tempdir('temporary-directory') + + test.sleep() + test.sleep(seconds) + + test.where_is('foo') + test.where_is('foo', 'PATH1:PATH2') + test.where_is('foo', 'PATH1;PATH2', '.suffix3;.suffix4') + + test.unlink('file') + test.unlink('subdir', 'file') + +The TestCmd module provides pass_test(), fail_test(), and no_result() +unbound functions that report test results for use with the Aegis change +management system. These methods terminate the test immediately, +reporting PASSED, FAILED, or NO RESULT respectively, and exiting with +status 0 (success), 1 or 2 respectively. This allows for a distinction +between an actual failed test and a test that could not be properly +evaluated because of an external condition (such as a full file system +or incorrect permissions). + + import TestCmd + + TestCmd.pass_test() + TestCmd.pass_test(condition) + TestCmd.pass_test(condition, function) + + TestCmd.fail_test() + TestCmd.fail_test(condition) + TestCmd.fail_test(condition, function) + TestCmd.fail_test(condition, function, skip) + + TestCmd.no_result() + TestCmd.no_result(condition) + TestCmd.no_result(condition, function) + TestCmd.no_result(condition, function, skip) + +The TestCmd module also provides unbound functions that handle matching +in the same way as the match_*() methods described above. + + import TestCmd + + test = TestCmd.TestCmd(match = TestCmd.match_exact) + + test = TestCmd.TestCmd(match = TestCmd.match_re) + + test = TestCmd.TestCmd(match = TestCmd.match_re_dotall) + +The TestCmd module provides unbound functions that can be used for the +"diff" argument to TestCmd.TestCmd instantiation: + + import TestCmd + + test = TestCmd.TestCmd(match = TestCmd.match_re, + diff = TestCmd.diff_re) + + test = TestCmd.TestCmd(diff = TestCmd.simple_diff) + +The "diff" argument can also be used with standard difflib functions: + + import difflib + + test = TestCmd.TestCmd(diff = difflib.context_diff) + + test = TestCmd.TestCmd(diff = difflib.unified_diff) + +Lastly, the where_is() method also exists in an unbound function +version. + + import TestCmd + + TestCmd.where_is('foo') + TestCmd.where_is('foo', 'PATH1:PATH2') + TestCmd.where_is('foo', 'PATH1;PATH2', '.suffix3;.suffix4') +""" + +# Copyright 2000-2010 Steven Knight +# This module is free software, and you may redistribute it and/or modify +# it under the same terms as Python itself, so long as this copyright message +# and disclaimer are retained in their original form. +# +# IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +# SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF +# THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +# DAMAGE. +# +# THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, +# AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, +# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +__author__ = "Steven Knight " +__revision__ = "TestCmd.py 0.37.D001 2010/01/11 16:55:50 knight" +__version__ = "0.37" + +import errno +import os +import os.path +import re +import shutil +import stat +import string +import sys +import tempfile +import time +import traceback +import types +import UserList + +__all__ = [ + 'diff_re', + 'fail_test', + 'no_result', + 'pass_test', + 'match_exact', + 'match_re', + 'match_re_dotall', + 'python_executable', + 'TestCmd' +] + +try: + import difflib +except ImportError: + __all__.append('simple_diff') + +def is_List(e): + return type(e) is types.ListType \ + or isinstance(e, UserList.UserList) + +try: + from UserString import UserString +except ImportError: + class UserString: + pass + +if hasattr(types, 'UnicodeType'): + def is_String(e): + return type(e) is types.StringType \ + or type(e) is types.UnicodeType \ + or isinstance(e, UserString) +else: + def is_String(e): + return type(e) is types.StringType or isinstance(e, UserString) + +tempfile.template = 'testcmd.' +if os.name in ('posix', 'nt'): + tempfile.template = 'testcmd.' + str(os.getpid()) + '.' +else: + tempfile.template = 'testcmd.' + +re_space = re.compile('\s') + +_Cleanup = [] + +_chain_to_exitfunc = None + +def _clean(): + global _Cleanup + cleanlist = filter(None, _Cleanup) + del _Cleanup[:] + cleanlist.reverse() + for test in cleanlist: + test.cleanup() + if _chain_to_exitfunc: + _chain_to_exitfunc() + +try: + import atexit +except ImportError: + # TODO(1.5): atexit requires python 2.0, so chain sys.exitfunc + try: + _chain_to_exitfunc = sys.exitfunc + except AttributeError: + pass + sys.exitfunc = _clean +else: + atexit.register(_clean) + +try: + zip +except NameError: + def zip(*lists): + result = [] + for i in xrange(min(map(len, lists))): + result.append(tuple(map(lambda l, i=i: l[i], lists))) + return result + +class Collector: + def __init__(self, top): + self.entries = [top] + def __call__(self, arg, dirname, names): + pathjoin = lambda n, d=dirname: os.path.join(d, n) + self.entries.extend(map(pathjoin, names)) + +def _caller(tblist, skip): + string = "" + arr = [] + for file, line, name, text in tblist: + if file[-10:] == "TestCmd.py": + break + arr = [(file, line, name, text)] + arr + atfrom = "at" + for file, line, name, text in arr[skip:]: + if name in ("?", ""): + name = "" + else: + name = " (" + name + ")" + string = string + ("%s line %d of %s%s\n" % (atfrom, line, file, name)) + atfrom = "\tfrom" + return string + +def fail_test(self = None, condition = 1, function = None, skip = 0): + """Cause the test to fail. + + By default, the fail_test() method reports that the test FAILED + and exits with a status of 1. If a condition argument is supplied, + the test fails only if the condition is true. + """ + if not condition: + return + if not function is None: + function() + of = "" + desc = "" + sep = " " + if not self is None: + if self.program: + of = " of " + self.program + sep = "\n\t" + if self.description: + desc = " [" + self.description + "]" + sep = "\n\t" + + at = _caller(traceback.extract_stack(), skip) + sys.stderr.write("FAILED test" + of + desc + sep + at) + + sys.exit(1) + +def no_result(self = None, condition = 1, function = None, skip = 0): + """Causes a test to exit with no valid result. + + By default, the no_result() method reports NO RESULT for the test + and exits with a status of 2. If a condition argument is supplied, + the test fails only if the condition is true. + """ + if not condition: + return + if not function is None: + function() + of = "" + desc = "" + sep = " " + if not self is None: + if self.program: + of = " of " + self.program + sep = "\n\t" + if self.description: + desc = " [" + self.description + "]" + sep = "\n\t" + + at = _caller(traceback.extract_stack(), skip) + sys.stderr.write("NO RESULT for test" + of + desc + sep + at) + + sys.exit(2) + +def pass_test(self = None, condition = 1, function = None): + """Causes a test to pass. + + By default, the pass_test() method reports PASSED for the test + and exits with a status of 0. If a condition argument is supplied, + the test passes only if the condition is true. + """ + if not condition: + return + if not function is None: + function() + sys.stderr.write("PASSED\n") + sys.exit(0) + +def match_exact(lines = None, matches = None): + """ + """ + if not is_List(lines): + lines = string.split(lines, "\n") + if not is_List(matches): + matches = string.split(matches, "\n") + if len(lines) != len(matches): + return + for i in range(len(lines)): + if lines[i] != matches[i]: + return + return 1 + +def match_re(lines = None, res = None): + """ + """ + if not is_List(lines): + lines = string.split(lines, "\n") + if not is_List(res): + res = string.split(res, "\n") + if len(lines) != len(res): + return + for i in range(len(lines)): + s = "^" + res[i] + "$" + try: + expr = re.compile(s) + except re.error, e: + msg = "Regular expression error in %s: %s" + raise re.error, msg % (repr(s), e[0]) + if not expr.search(lines[i]): + return + return 1 + +def match_re_dotall(lines = None, res = None): + """ + """ + if not type(lines) is type(""): + lines = string.join(lines, "\n") + if not type(res) is type(""): + res = string.join(res, "\n") + s = "^" + res + "$" + try: + expr = re.compile(s, re.DOTALL) + except re.error, e: + msg = "Regular expression error in %s: %s" + raise re.error, msg % (repr(s), e[0]) + if expr.match(lines): + return 1 + +try: + import difflib +except ImportError: + pass +else: + def simple_diff(a, b, fromfile='', tofile='', + fromfiledate='', tofiledate='', n=3, lineterm='\n'): + """ + A function with the same calling signature as difflib.context_diff + (diff -c) and difflib.unified_diff (diff -u) but which prints + output like the simple, unadorned 'diff" command. + """ + sm = difflib.SequenceMatcher(None, a, b) + def comma(x1, x2): + return x1+1 == x2 and str(x2) or '%s,%s' % (x1+1, x2) + result = [] + for op, a1, a2, b1, b2 in sm.get_opcodes(): + if op == 'delete': + result.append("%sd%d" % (comma(a1, a2), b1)) + result.extend(map(lambda l: '< ' + l, a[a1:a2])) + elif op == 'insert': + result.append("%da%s" % (a1, comma(b1, b2))) + result.extend(map(lambda l: '> ' + l, b[b1:b2])) + elif op == 'replace': + result.append("%sc%s" % (comma(a1, a2), comma(b1, b2))) + result.extend(map(lambda l: '< ' + l, a[a1:a2])) + result.append('---') + result.extend(map(lambda l: '> ' + l, b[b1:b2])) + return result + +def diff_re(a, b, fromfile='', tofile='', + fromfiledate='', tofiledate='', n=3, lineterm='\n'): + """ + A simple "diff" of two sets of lines when the expected lines + are regular expressions. This is a really dumb thing that + just compares each line in turn, so it doesn't look for + chunks of matching lines and the like--but at least it lets + you know exactly which line first didn't compare correctl... + """ + result = [] + diff = len(a) - len(b) + if diff < 0: + a = a + ['']*(-diff) + elif diff > 0: + b = b + ['']*diff + i = 0 + for aline, bline in zip(a, b): + s = "^" + aline + "$" + try: + expr = re.compile(s) + except re.error, e: + msg = "Regular expression error in %s: %s" + raise re.error, msg % (repr(s), e[0]) + if not expr.search(bline): + result.append("%sc%s" % (i+1, i+1)) + result.append('< ' + repr(a[i])) + result.append('---') + result.append('> ' + repr(b[i])) + i = i+1 + return result + +if os.name == 'java': + + python_executable = os.path.join(sys.prefix, 'jython') + +else: + + python_executable = sys.executable + +if sys.platform == 'win32': + + default_sleep_seconds = 2 + + def where_is(file, path=None, pathext=None): + if path is None: + path = os.environ['PATH'] + if is_String(path): + path = string.split(path, os.pathsep) + if pathext is None: + pathext = os.environ['PATHEXT'] + if is_String(pathext): + pathext = string.split(pathext, os.pathsep) + for ext in pathext: + if string.lower(ext) == string.lower(file[-len(ext):]): + pathext = [''] + break + for dir in path: + f = os.path.join(dir, file) + for ext in pathext: + fext = f + ext + if os.path.isfile(fext): + return fext + return None + +else: + + def where_is(file, path=None, pathext=None): + if path is None: + path = os.environ['PATH'] + if is_String(path): + path = string.split(path, os.pathsep) + for dir in path: + f = os.path.join(dir, file) + if os.path.isfile(f): + try: + st = os.stat(f) + except OSError: + continue + if stat.S_IMODE(st[stat.ST_MODE]) & 0111: + return f + return None + + default_sleep_seconds = 1 + + + +try: + import subprocess +except ImportError: + # The subprocess module doesn't exist in this version of Python, + # so we're going to cobble up something that looks just enough + # like its API for our purposes below. + import new + + subprocess = new.module('subprocess') + + subprocess.PIPE = 'PIPE' + subprocess.STDOUT = 'STDOUT' + subprocess.mswindows = (sys.platform == 'win32') + + try: + import popen2 + popen2.Popen3 + except AttributeError: + class Popen3: + universal_newlines = 1 + def __init__(self, command, **kw): + if sys.platform == 'win32' and command[0] == '"': + command = '"' + command + '"' + (stdin, stdout, stderr) = os.popen3(' ' + command) + self.stdin = stdin + self.stdout = stdout + self.stderr = stderr + def close_output(self): + self.stdout.close() + self.resultcode = self.stderr.close() + def wait(self): + resultcode = self.resultcode + if os.WIFEXITED(resultcode): + return os.WEXITSTATUS(resultcode) + elif os.WIFSIGNALED(resultcode): + return os.WTERMSIG(resultcode) + else: + return None + + else: + try: + popen2.Popen4 + except AttributeError: + # A cribbed Popen4 class, with some retrofitted code from + # the Python 1.5 Popen3 class methods to do certain things + # by hand. + class Popen4(popen2.Popen3): + childerr = None + + def __init__(self, cmd, bufsize=-1): + p2cread, p2cwrite = os.pipe() + c2pread, c2pwrite = os.pipe() + self.pid = os.fork() + if self.pid == 0: + # Child + os.dup2(p2cread, 0) + os.dup2(c2pwrite, 1) + os.dup2(c2pwrite, 2) + for i in range(3, popen2.MAXFD): + try: + os.close(i) + except: pass + try: + os.execvp(cmd[0], cmd) + finally: + os._exit(1) + # Shouldn't come here, I guess + os._exit(1) + os.close(p2cread) + self.tochild = os.fdopen(p2cwrite, 'w', bufsize) + os.close(c2pwrite) + self.fromchild = os.fdopen(c2pread, 'r', bufsize) + popen2._active.append(self) + + popen2.Popen4 = Popen4 + + class Popen3(popen2.Popen3, popen2.Popen4): + universal_newlines = 1 + def __init__(self, command, **kw): + if kw.get('stderr') == 'STDOUT': + apply(popen2.Popen4.__init__, (self, command, 1)) + else: + apply(popen2.Popen3.__init__, (self, command, 1)) + self.stdin = self.tochild + self.stdout = self.fromchild + self.stderr = self.childerr + def wait(self, *args, **kw): + resultcode = apply(popen2.Popen3.wait, (self,)+args, kw) + if os.WIFEXITED(resultcode): + return os.WEXITSTATUS(resultcode) + elif os.WIFSIGNALED(resultcode): + return os.WTERMSIG(resultcode) + else: + return None + + subprocess.Popen = Popen3 + + + +# From Josiah Carlson, +# ASPN : Python Cookbook : Module to allow Asynchronous subprocess use on Windows and Posix platforms +# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554 + +PIPE = subprocess.PIPE + +if subprocess.mswindows: + from win32file import ReadFile, WriteFile + from win32pipe import PeekNamedPipe + import msvcrt +else: + import select + import fcntl + + try: fcntl.F_GETFL + except AttributeError: fcntl.F_GETFL = 3 + + try: fcntl.F_SETFL + except AttributeError: fcntl.F_SETFL = 4 + +class Popen(subprocess.Popen): + def recv(self, maxsize=None): + return self._recv('stdout', maxsize) + + def recv_err(self, maxsize=None): + return self._recv('stderr', maxsize) + + def send_recv(self, input='', maxsize=None): + return self.send(input), self.recv(maxsize), self.recv_err(maxsize) + + def get_conn_maxsize(self, which, maxsize): + if maxsize is None: + maxsize = 1024 + elif maxsize < 1: + maxsize = 1 + return getattr(self, which), maxsize + + def _close(self, which): + getattr(self, which).close() + setattr(self, which, None) + + if subprocess.mswindows: + def send(self, input): + if not self.stdin: + return None + + try: + x = msvcrt.get_osfhandle(self.stdin.fileno()) + (errCode, written) = WriteFile(x, input) + except ValueError: + return self._close('stdin') + except (subprocess.pywintypes.error, Exception), why: + if why[0] in (109, errno.ESHUTDOWN): + return self._close('stdin') + raise + + return written + + def _recv(self, which, maxsize): + conn, maxsize = self.get_conn_maxsize(which, maxsize) + if conn is None: + return None + + try: + x = msvcrt.get_osfhandle(conn.fileno()) + (read, nAvail, nMessage) = PeekNamedPipe(x, 0) + if maxsize < nAvail: + nAvail = maxsize + if nAvail > 0: + (errCode, read) = ReadFile(x, nAvail, None) + except ValueError: + return self._close(which) + except (subprocess.pywintypes.error, Exception), why: + if why[0] in (109, errno.ESHUTDOWN): + return self._close(which) + raise + + #if self.universal_newlines: + # read = self._translate_newlines(read) + return read + + else: + def send(self, input): + if not self.stdin: + return None + + if not select.select([], [self.stdin], [], 0)[1]: + return 0 + + try: + written = os.write(self.stdin.fileno(), input) + except OSError, why: + if why[0] == errno.EPIPE: #broken pipe + return self._close('stdin') + raise + + return written + + def _recv(self, which, maxsize): + conn, maxsize = self.get_conn_maxsize(which, maxsize) + if conn is None: + return None + + try: + flags = fcntl.fcntl(conn, fcntl.F_GETFL) + except TypeError: + flags = None + else: + if not conn.closed: + fcntl.fcntl(conn, fcntl.F_SETFL, flags| os.O_NONBLOCK) + + try: + if not select.select([conn], [], [], 0)[0]: + return '' + + r = conn.read(maxsize) + if not r: + return self._close(which) + + #if self.universal_newlines: + # r = self._translate_newlines(r) + return r + finally: + if not conn.closed and not flags is None: + fcntl.fcntl(conn, fcntl.F_SETFL, flags) + +disconnect_message = "Other end disconnected!" + +def recv_some(p, t=.1, e=1, tr=5, stderr=0): + if tr < 1: + tr = 1 + x = time.time()+t + y = [] + r = '' + pr = p.recv + if stderr: + pr = p.recv_err + while time.time() < x or r: + r = pr() + if r is None: + if e: + raise Exception(disconnect_message) + else: + break + elif r: + y.append(r) + else: + time.sleep(max((x-time.time())/tr, 0)) + return ''.join(y) + +# TODO(3.0: rewrite to use memoryview() +def send_all(p, data): + while len(data): + sent = p.send(data) + if sent is None: + raise Exception(disconnect_message) + data = buffer(data, sent) + + + +try: + object +except NameError: + class object: + pass + + + +class TestCmd(object): + """Class TestCmd + """ + + def __init__(self, description = None, + program = None, + interpreter = None, + workdir = None, + subdir = None, + verbose = None, + match = None, + diff = None, + combine = 0, + universal_newlines = 1): + self._cwd = os.getcwd() + self.description_set(description) + self.program_set(program) + self.interpreter_set(interpreter) + if verbose is None: + try: + verbose = max( 0, int(os.environ.get('TESTCMD_VERBOSE', 0)) ) + except ValueError: + verbose = 0 + self.verbose_set(verbose) + self.combine = combine + self.universal_newlines = universal_newlines + if match is not None: + self.match_function = match + else: + self.match_function = match_re + if diff is not None: + self.diff_function = diff + else: + try: + difflib + except NameError: + pass + else: + self.diff_function = simple_diff + #self.diff_function = difflib.context_diff + #self.diff_function = difflib.unified_diff + self._dirlist = [] + self._preserve = {'pass_test': 0, 'fail_test': 0, 'no_result': 0} + if os.environ.has_key('PRESERVE') and not os.environ['PRESERVE'] is '': + self._preserve['pass_test'] = os.environ['PRESERVE'] + self._preserve['fail_test'] = os.environ['PRESERVE'] + self._preserve['no_result'] = os.environ['PRESERVE'] + else: + try: + self._preserve['pass_test'] = os.environ['PRESERVE_PASS'] + except KeyError: + pass + try: + self._preserve['fail_test'] = os.environ['PRESERVE_FAIL'] + except KeyError: + pass + try: + self._preserve['no_result'] = os.environ['PRESERVE_NO_RESULT'] + except KeyError: + pass + self._stdout = [] + self._stderr = [] + self.status = None + self.condition = 'no_result' + self.workdir_set(workdir) + self.subdir(subdir) + + def __del__(self): + self.cleanup() + + def __repr__(self): + return "%x" % id(self) + + banner_char = '=' + banner_width = 80 + + def banner(self, s, width=None): + if width is None: + width = self.banner_width + return s + self.banner_char * (width - len(s)) + + if os.name == 'posix': + + def escape(self, arg): + "escape shell special characters" + slash = '\\' + special = '"$' + + arg = string.replace(arg, slash, slash+slash) + for c in special: + arg = string.replace(arg, c, slash+c) + + if re_space.search(arg): + arg = '"' + arg + '"' + return arg + + else: + + # Windows does not allow special characters in file names + # anyway, so no need for an escape function, we will just quote + # the arg. + def escape(self, arg): + if re_space.search(arg): + arg = '"' + arg + '"' + return arg + + def canonicalize(self, path): + if is_List(path): + path = apply(os.path.join, tuple(path)) + if not os.path.isabs(path): + path = os.path.join(self.workdir, path) + return path + + def chmod(self, path, mode): + """Changes permissions on the specified file or directory + path name.""" + path = self.canonicalize(path) + os.chmod(path, mode) + + def cleanup(self, condition = None): + """Removes any temporary working directories for the specified + TestCmd environment. If the environment variable PRESERVE was + set when the TestCmd environment was created, temporary working + directories are not removed. If any of the environment variables + PRESERVE_PASS, PRESERVE_FAIL, or PRESERVE_NO_RESULT were set + when the TestCmd environment was created, then temporary working + directories are not removed if the test passed, failed, or had + no result, respectively. Temporary working directories are also + preserved for conditions specified via the preserve method. + + Typically, this method is not called directly, but is used when + the script exits to clean up temporary working directories as + appropriate for the exit status. + """ + if not self._dirlist: + return + os.chdir(self._cwd) + self.workdir = None + if condition is None: + condition = self.condition + if self._preserve[condition]: + for dir in self._dirlist: + print "Preserved directory", dir + else: + list = self._dirlist[:] + list.reverse() + for dir in list: + self.writable(dir, 1) + shutil.rmtree(dir, ignore_errors = 1) + self._dirlist = [] + + try: + global _Cleanup + _Cleanup.remove(self) + except (AttributeError, ValueError): + pass + + def command_args(self, program = None, + interpreter = None, + arguments = None): + if program: + if type(program) == type('') and not os.path.isabs(program): + program = os.path.join(self._cwd, program) + else: + program = self.program + if not interpreter: + interpreter = self.interpreter + if not type(program) in [type([]), type(())]: + program = [program] + cmd = list(program) + if interpreter: + if not type(interpreter) in [type([]), type(())]: + interpreter = [interpreter] + cmd = list(interpreter) + cmd + if arguments: + if type(arguments) == type(''): + arguments = string.split(arguments) + cmd.extend(arguments) + return cmd + + def description_set(self, description): + """Set the description of the functionality being tested. + """ + self.description = description + + try: + difflib + except NameError: + def diff(self, a, b, name, *args, **kw): + print self.banner('Expected %s' % name) + print a + print self.banner('Actual %s' % name) + print b + else: + def diff(self, a, b, name, *args, **kw): + print self.banner(name) + args = (a.splitlines(), b.splitlines()) + args + lines = apply(self.diff_function, args, kw) + for l in lines: + print l + + def fail_test(self, condition = 1, function = None, skip = 0): + """Cause the test to fail. + """ + if not condition: + return + self.condition = 'fail_test' + fail_test(self = self, + condition = condition, + function = function, + skip = skip) + + def interpreter_set(self, interpreter): + """Set the program to be used to interpret the program + under test as a script. + """ + self.interpreter = interpreter + + def match(self, lines, matches): + """Compare actual and expected file contents. + """ + return self.match_function(lines, matches) + + def match_exact(self, lines, matches): + """Compare actual and expected file contents. + """ + return match_exact(lines, matches) + + def match_re(self, lines, res): + """Compare actual and expected file contents. + """ + return match_re(lines, res) + + def match_re_dotall(self, lines, res): + """Compare actual and expected file contents. + """ + return match_re_dotall(lines, res) + + def no_result(self, condition = 1, function = None, skip = 0): + """Report that the test could not be run. + """ + if not condition: + return + self.condition = 'no_result' + no_result(self = self, + condition = condition, + function = function, + skip = skip) + + def pass_test(self, condition = 1, function = None): + """Cause the test to pass. + """ + if not condition: + return + self.condition = 'pass_test' + pass_test(self = self, condition = condition, function = function) + + def preserve(self, *conditions): + """Arrange for the temporary working directories for the + specified TestCmd environment to be preserved for one or more + conditions. If no conditions are specified, arranges for + the temporary working directories to be preserved for all + conditions. + """ + if conditions is (): + conditions = ('pass_test', 'fail_test', 'no_result') + for cond in conditions: + self._preserve[cond] = 1 + + def program_set(self, program): + """Set the executable program or script to be tested. + """ + if program and not os.path.isabs(program): + program = os.path.join(self._cwd, program) + self.program = program + + def read(self, file, mode = 'rb'): + """Reads and returns the contents of the specified file name. + The file name may be a list, in which case the elements are + concatenated with the os.path.join() method. The file is + assumed to be under the temporary working directory unless it + is an absolute path name. The I/O mode for the file may + be specified; it must begin with an 'r'. The default is + 'rb' (binary read). + """ + file = self.canonicalize(file) + if mode[0] != 'r': + raise ValueError, "mode must begin with 'r'" + with open(file, mode) as f: + result = f.read() + return result + + def rmdir(self, dir): + """Removes the specified dir name. + The dir name may be a list, in which case the elements are + concatenated with the os.path.join() method. The dir is + assumed to be under the temporary working directory unless it + is an absolute path name. + The dir must be empty. + """ + dir = self.canonicalize(dir) + os.rmdir(dir) + + def start(self, program = None, + interpreter = None, + arguments = None, + universal_newlines = None, + **kw): + """ + Starts a program or script for the test environment. + + The specified program will have the original directory + prepended unless it is enclosed in a [list]. + """ + cmd = self.command_args(program, interpreter, arguments) + cmd_string = string.join(map(self.escape, cmd), ' ') + if self.verbose: + sys.stderr.write(cmd_string + "\n") + if universal_newlines is None: + universal_newlines = self.universal_newlines + + # On Windows, if we make stdin a pipe when we plan to send + # no input, and the test program exits before + # Popen calls msvcrt.open_osfhandle, that call will fail. + # So don't use a pipe for stdin if we don't need one. + stdin = kw.get('stdin', None) + if stdin is not None: + stdin = subprocess.PIPE + + combine = kw.get('combine', self.combine) + if combine: + stderr_value = subprocess.STDOUT + else: + stderr_value = subprocess.PIPE + + return Popen(cmd, + stdin=stdin, + stdout=subprocess.PIPE, + stderr=stderr_value, + universal_newlines=universal_newlines) + + def finish(self, popen, **kw): + """ + Finishes and waits for the process being run under control of + the specified popen argument, recording the exit status, + standard output and error output. + """ + popen.stdin.close() + self.status = popen.wait() + if not self.status: + self.status = 0 + self._stdout.append(popen.stdout.read()) + if popen.stderr: + stderr = popen.stderr.read() + else: + stderr = '' + self._stderr.append(stderr) + + def run(self, program = None, + interpreter = None, + arguments = None, + chdir = None, + stdin = None, + universal_newlines = None): + """Runs a test of the program or script for the test + environment. Standard output and error output are saved for + future retrieval via the stdout() and stderr() methods. + + The specified program will have the original directory + prepended unless it is enclosed in a [list]. + """ + if chdir: + oldcwd = os.getcwd() + if not os.path.isabs(chdir): + chdir = os.path.join(self.workpath(chdir)) + if self.verbose: + sys.stderr.write("chdir(" + chdir + ")\n") + os.chdir(chdir) + p = self.start(program, + interpreter, + arguments, + universal_newlines, + stdin=stdin) + if stdin: + if is_List(stdin): + for line in stdin: + p.stdin.write(line) + else: + p.stdin.write(stdin) + p.stdin.close() + + out = p.stdout.read() + if p.stderr is None: + err = '' + else: + err = p.stderr.read() + try: + close_output = p.close_output + except AttributeError: + p.stdout.close() + if not p.stderr is None: + p.stderr.close() + else: + close_output() + + self._stdout.append(out) + self._stderr.append(err) + + self.status = p.wait() + if not self.status: + self.status = 0 + + if chdir: + os.chdir(oldcwd) + if self.verbose >= 2: + write = sys.stdout.write + write('============ STATUS: %d\n' % self.status) + out = self.stdout() + if out or self.verbose >= 3: + write('============ BEGIN STDOUT (len=%d):\n' % len(out)) + write(out) + write('============ END STDOUT\n') + err = self.stderr() + if err or self.verbose >= 3: + write('============ BEGIN STDERR (len=%d)\n' % len(err)) + write(err) + write('============ END STDERR\n') + + def sleep(self, seconds = default_sleep_seconds): + """Sleeps at least the specified number of seconds. If no + number is specified, sleeps at least the minimum number of + seconds necessary to advance file time stamps on the current + system. Sleeping more seconds is all right. + """ + time.sleep(seconds) + + def stderr(self, run = None): + """Returns the error output from the specified run number. + If there is no specified run number, then returns the error + output of the last run. If the run number is less than zero, + then returns the error output from that many runs back from the + current run. + """ + if not run: + run = len(self._stderr) + elif run < 0: + run = len(self._stderr) + run + run = run - 1 + return self._stderr[run] + + def stdout(self, run = None): + """Returns the standard output from the specified run number. + If there is no specified run number, then returns the standard + output of the last run. If the run number is less than zero, + then returns the standard output from that many runs back from + the current run. + """ + if not run: + run = len(self._stdout) + elif run < 0: + run = len(self._stdout) + run + run = run - 1 + return self._stdout[run] + + def subdir(self, *subdirs): + """Create new subdirectories under the temporary working + directory, one for each argument. An argument may be a list, + in which case the list elements are concatenated using the + os.path.join() method. Subdirectories multiple levels deep + must be created using a separate argument for each level: + + test.subdir('sub', ['sub', 'dir'], ['sub', 'dir', 'ectory']) + + Returns the number of subdirectories actually created. + """ + count = 0 + for sub in subdirs: + if sub is None: + continue + if is_List(sub): + sub = apply(os.path.join, tuple(sub)) + new = os.path.join(self.workdir, sub) + try: + os.mkdir(new) + except OSError: + pass + else: + count = count + 1 + return count + + def symlink(self, target, link): + """Creates a symlink to the specified target. + The link name may be a list, in which case the elements are + concatenated with the os.path.join() method. The link is + assumed to be under the temporary working directory unless it + is an absolute path name. The target is *not* assumed to be + under the temporary working directory. + """ + link = self.canonicalize(link) + os.symlink(target, link) + + def tempdir(self, path=None): + """Creates a temporary directory. + A unique directory name is generated if no path name is specified. + The directory is created, and will be removed when the TestCmd + object is destroyed. + """ + if path is None: + try: + path = tempfile.mktemp(prefix=tempfile.template) + except TypeError: + path = tempfile.mktemp() + os.mkdir(path) + + # Symlinks in the path will report things + # differently from os.getcwd(), so chdir there + # and back to fetch the canonical path. + cwd = os.getcwd() + try: + os.chdir(path) + path = os.getcwd() + finally: + os.chdir(cwd) + + # Uppercase the drive letter since the case of drive + # letters is pretty much random on win32: + drive,rest = os.path.splitdrive(path) + if drive: + path = string.upper(drive) + rest + + # + self._dirlist.append(path) + global _Cleanup + try: + _Cleanup.index(self) + except ValueError: + _Cleanup.append(self) + + return path + + def touch(self, path, mtime=None): + """Updates the modification time on the specified file or + directory path name. The default is to update to the + current time if no explicit modification time is specified. + """ + path = self.canonicalize(path) + atime = os.path.getatime(path) + if mtime is None: + mtime = time.time() + os.utime(path, (atime, mtime)) + + def unlink(self, file): + """Unlinks the specified file name. + The file name may be a list, in which case the elements are + concatenated with the os.path.join() method. The file is + assumed to be under the temporary working directory unless it + is an absolute path name. + """ + file = self.canonicalize(file) + os.unlink(file) + + def verbose_set(self, verbose): + """Set the verbose level. + """ + self.verbose = verbose + + def where_is(self, file, path=None, pathext=None): + """Find an executable file. + """ + if is_List(file): + file = apply(os.path.join, tuple(file)) + if not os.path.isabs(file): + file = where_is(file, path, pathext) + return file + + def workdir_set(self, path): + """Creates a temporary working directory with the specified + path name. If the path is a null string (''), a unique + directory name is created. + """ + if (path != None): + if path == '': + path = None + path = self.tempdir(path) + self.workdir = path + + def workpath(self, *args): + """Returns the absolute path name to a subdirectory or file + within the current temporary working directory. Concatenates + the temporary working directory name with the specified + arguments using the os.path.join() method. + """ + return apply(os.path.join, (self.workdir,) + tuple(args)) + + def readable(self, top, read=1): + """Make the specified directory tree readable (read == 1) + or not (read == None). + + This method has no effect on Windows systems, which use a + completely different mechanism to control file readability. + """ + + if sys.platform == 'win32': + return + + if read: + def do_chmod(fname): + try: st = os.stat(fname) + except OSError: pass + else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]|stat.S_IREAD)) + else: + def do_chmod(fname): + try: st = os.stat(fname) + except OSError: pass + else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]&~stat.S_IREAD)) + + if os.path.isfile(top): + # If it's a file, that's easy, just chmod it. + do_chmod(top) + elif read: + # It's a directory and we're trying to turn on read + # permission, so it's also pretty easy, just chmod the + # directory and then chmod every entry on our walk down the + # tree. Because os.path.walk() is top-down, we'll enable + # read permission on any directories that have it disabled + # before os.path.walk() tries to list their contents. + do_chmod(top) + + def chmod_entries(arg, dirname, names, do_chmod=do_chmod): + for n in names: + do_chmod(os.path.join(dirname, n)) + + os.path.walk(top, chmod_entries, None) + else: + # It's a directory and we're trying to turn off read + # permission, which means we have to chmod the directoreis + # in the tree bottom-up, lest disabling read permission from + # the top down get in the way of being able to get at lower + # parts of the tree. But os.path.walk() visits things top + # down, so we just use an object to collect a list of all + # of the entries in the tree, reverse the list, and then + # chmod the reversed (bottom-up) list. + col = Collector(top) + os.path.walk(top, col, None) + col.entries.reverse() + for d in col.entries: do_chmod(d) + + def writable(self, top, write=1): + """Make the specified directory tree writable (write == 1) + or not (write == None). + """ + + if sys.platform == 'win32': + + if write: + def do_chmod(fname): + try: os.chmod(fname, stat.S_IWRITE) + except OSError: pass + else: + def do_chmod(fname): + try: os.chmod(fname, stat.S_IREAD) + except OSError: pass + + else: + + if write: + def do_chmod(fname): + try: st = os.stat(fname) + except OSError: pass + else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]|0200)) + else: + def do_chmod(fname): + try: st = os.stat(fname) + except OSError: pass + else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]&~0200)) + + if os.path.isfile(top): + do_chmod(top) + else: + col = Collector(top) + os.path.walk(top, col, None) + for d in col.entries: do_chmod(d) + + def executable(self, top, execute=1): + """Make the specified directory tree executable (execute == 1) + or not (execute == None). + + This method has no effect on Windows systems, which use a + completely different mechanism to control file executability. + """ + + if sys.platform == 'win32': + return + + if execute: + def do_chmod(fname): + try: st = os.stat(fname) + except OSError: pass + else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]|stat.S_IEXEC)) + else: + def do_chmod(fname): + try: st = os.stat(fname) + except OSError: pass + else: os.chmod(fname, stat.S_IMODE(st[stat.ST_MODE]&~stat.S_IEXEC)) + + if os.path.isfile(top): + # If it's a file, that's easy, just chmod it. + do_chmod(top) + elif execute: + # It's a directory and we're trying to turn on execute + # permission, so it's also pretty easy, just chmod the + # directory and then chmod every entry on our walk down the + # tree. Because os.path.walk() is top-down, we'll enable + # execute permission on any directories that have it disabled + # before os.path.walk() tries to list their contents. + do_chmod(top) + + def chmod_entries(arg, dirname, names, do_chmod=do_chmod): + for n in names: + do_chmod(os.path.join(dirname, n)) + + os.path.walk(top, chmod_entries, None) + else: + # It's a directory and we're trying to turn off execute + # permission, which means we have to chmod the directories + # in the tree bottom-up, lest disabling execute permission from + # the top down get in the way of being able to get at lower + # parts of the tree. But os.path.walk() visits things top + # down, so we just use an object to collect a list of all + # of the entries in the tree, reverse the list, and then + # chmod the reversed (bottom-up) list. + col = Collector(top) + os.path.walk(top, col, None) + col.entries.reverse() + for d in col.entries: do_chmod(d) + + def write(self, file, content, mode = 'wb'): + """Writes the specified content text (second argument) to the + specified file name (first argument). The file name may be + a list, in which case the elements are concatenated with the + os.path.join() method. The file is created under the temporary + working directory. Any subdirectories in the path must already + exist. The I/O mode for the file may be specified; it must + begin with a 'w'. The default is 'wb' (binary write). + """ + file = self.canonicalize(file) + if mode[0] != 'w': + raise ValueError, "mode must begin with 'w'" + with open(file, mode) as f: + f.write(content) + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/tools/gyp/test/lib/TestCommon.py b/tools/gyp/test/lib/TestCommon.py new file mode 100644 index 000000000..6e01f3aff --- /dev/null +++ b/tools/gyp/test/lib/TestCommon.py @@ -0,0 +1,578 @@ +""" +TestCommon.py: a testing framework for commands and scripts + with commonly useful error handling + +The TestCommon module provides a simple, high-level interface for writing +tests of executable commands and scripts, especially commands and scripts +that interact with the file system. All methods throw exceptions and +exit on failure, with useful error messages. This makes a number of +explicit checks unnecessary, making the test scripts themselves simpler +to write and easier to read. + +The TestCommon class is a subclass of the TestCmd class. In essence, +TestCommon is a wrapper that handles common TestCmd error conditions in +useful ways. You can use TestCommon directly, or subclass it for your +program and add additional (or override) methods to tailor it to your +program's specific needs. Alternatively, the TestCommon class serves +as a useful example of how to define your own TestCmd subclass. + +As a subclass of TestCmd, TestCommon provides access to all of the +variables and methods from the TestCmd module. Consequently, you can +use any variable or method documented in the TestCmd module without +having to explicitly import TestCmd. + +A TestCommon environment object is created via the usual invocation: + + import TestCommon + test = TestCommon.TestCommon() + +You can use all of the TestCmd keyword arguments when instantiating a +TestCommon object; see the TestCmd documentation for details. + +Here is an overview of the methods and keyword arguments that are +provided by the TestCommon class: + + test.must_be_writable('file1', ['file2', ...]) + + test.must_contain('file', 'required text\n') + + test.must_contain_all_lines(output, lines, ['title', find]) + + test.must_contain_any_line(output, lines, ['title', find]) + + test.must_exist('file1', ['file2', ...]) + + test.must_match('file', "expected contents\n") + + test.must_not_be_writable('file1', ['file2', ...]) + + test.must_not_contain('file', 'banned text\n') + + test.must_not_contain_any_line(output, lines, ['title', find]) + + test.must_not_exist('file1', ['file2', ...]) + + test.run(options = "options to be prepended to arguments", + stdout = "expected standard output from the program", + stderr = "expected error output from the program", + status = expected_status, + match = match_function) + +The TestCommon module also provides the following variables + + TestCommon.python_executable + TestCommon.exe_suffix + TestCommon.obj_suffix + TestCommon.shobj_prefix + TestCommon.shobj_suffix + TestCommon.lib_prefix + TestCommon.lib_suffix + TestCommon.dll_prefix + TestCommon.dll_suffix + +""" + +# Copyright 2000-2010 Steven Knight +# This module is free software, and you may redistribute it and/or modify +# it under the same terms as Python itself, so long as this copyright message +# and disclaimer are retained in their original form. +# +# IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +# SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF +# THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +# DAMAGE. +# +# THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +# PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, +# AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, +# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +__author__ = "Steven Knight " +__revision__ = "TestCommon.py 0.37.D001 2010/01/11 16:55:50 knight" +__version__ = "0.37" + +import copy +import os +import os.path +import stat +import string +import sys +import types +import UserList + +from TestCmd import * +from TestCmd import __all__ + +__all__.extend([ 'TestCommon', + 'exe_suffix', + 'obj_suffix', + 'shobj_prefix', + 'shobj_suffix', + 'lib_prefix', + 'lib_suffix', + 'dll_prefix', + 'dll_suffix', + ]) + +# Variables that describe the prefixes and suffixes on this system. +if sys.platform == 'win32': + exe_suffix = '.exe' + obj_suffix = '.obj' + shobj_suffix = '.obj' + shobj_prefix = '' + lib_prefix = '' + lib_suffix = '.lib' + dll_prefix = '' + dll_suffix = '.dll' +elif sys.platform == 'cygwin': + exe_suffix = '.exe' + obj_suffix = '.o' + shobj_suffix = '.os' + shobj_prefix = '' + lib_prefix = 'lib' + lib_suffix = '.a' + dll_prefix = '' + dll_suffix = '.dll' +elif string.find(sys.platform, 'irix') != -1: + exe_suffix = '' + obj_suffix = '.o' + shobj_suffix = '.o' + shobj_prefix = '' + lib_prefix = 'lib' + lib_suffix = '.a' + dll_prefix = 'lib' + dll_suffix = '.so' +elif string.find(sys.platform, 'darwin') != -1: + exe_suffix = '' + obj_suffix = '.o' + shobj_suffix = '.os' + shobj_prefix = '' + lib_prefix = 'lib' + lib_suffix = '.a' + dll_prefix = 'lib' + dll_suffix = '.dylib' +elif string.find(sys.platform, 'sunos') != -1: + exe_suffix = '' + obj_suffix = '.o' + shobj_suffix = '.os' + shobj_prefix = 'so_' + lib_prefix = 'lib' + lib_suffix = '.a' + dll_prefix = 'lib' + dll_suffix = '.dylib' +else: + exe_suffix = '' + obj_suffix = '.o' + shobj_suffix = '.os' + shobj_prefix = '' + lib_prefix = 'lib' + lib_suffix = '.a' + dll_prefix = 'lib' + dll_suffix = '.so' + +def is_List(e): + return type(e) is types.ListType \ + or isinstance(e, UserList.UserList) + +def is_writable(f): + mode = os.stat(f)[stat.ST_MODE] + return mode & stat.S_IWUSR + +def separate_files(flist): + existing = [] + missing = [] + for f in flist: + if os.path.exists(f): + existing.append(f) + else: + missing.append(f) + return existing, missing + +def _failed(self, status = 0): + if self.status is None or status is None: + return None + try: + return _status(self) not in status + except TypeError: + # status wasn't an iterable + return _status(self) != status +def _status(self): + return self.status + +class TestCommon(TestCmd): + + # Additional methods from the Perl Test::Cmd::Common module + # that we may wish to add in the future: + # + # $test->subdir('subdir', ...); + # + # $test->copy('src_file', 'dst_file'); + + def __init__(self, **kw): + """Initialize a new TestCommon instance. This involves just + calling the base class initialization, and then changing directory + to the workdir. + """ + apply(TestCmd.__init__, [self], kw) + os.chdir(self.workdir) + + def must_be_writable(self, *files): + """Ensures that the specified file(s) exist and are writable. + An individual file can be specified as a list of directory names, + in which case the pathname will be constructed by concatenating + them. Exits FAILED if any of the files does not exist or is + not writable. + """ + files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files) + existing, missing = separate_files(files) + unwritable = filter(lambda x, iw=is_writable: not iw(x), existing) + if missing: + print "Missing files: `%s'" % string.join(missing, "', `") + if unwritable: + print "Unwritable files: `%s'" % string.join(unwritable, "', `") + self.fail_test(missing + unwritable) + + def must_contain(self, file, required, mode = 'rb'): + """Ensures that the specified file contains the required text. + """ + file_contents = self.read(file, mode) + contains = (string.find(file_contents, required) != -1) + if not contains: + print "File `%s' does not contain required string." % file + print self.banner('Required string ') + print required + print self.banner('%s contents ' % file) + print file_contents + self.fail_test(not contains) + + def must_contain_all_lines(self, output, lines, title=None, find=None): + """Ensures that the specified output string (first argument) + contains all of the specified lines (second argument). + + An optional third argument can be used to describe the type + of output being searched, and only shows up in failure output. + + An optional fourth argument can be used to supply a different + function, of the form "find(line, output), to use when searching + for lines in the output. + """ + if find is None: + find = lambda o, l: string.find(o, l) != -1 + missing = [] + for line in lines: + if not find(output, line): + missing.append(line) + + if missing: + if title is None: + title = 'output' + sys.stdout.write("Missing expected lines from %s:\n" % title) + for line in missing: + sys.stdout.write(' ' + repr(line) + '\n') + sys.stdout.write(self.banner(title + ' ')) + sys.stdout.write(output) + self.fail_test() + + def must_contain_any_line(self, output, lines, title=None, find=None): + """Ensures that the specified output string (first argument) + contains at least one of the specified lines (second argument). + + An optional third argument can be used to describe the type + of output being searched, and only shows up in failure output. + + An optional fourth argument can be used to supply a different + function, of the form "find(line, output), to use when searching + for lines in the output. + """ + if find is None: + find = lambda o, l: string.find(o, l) != -1 + for line in lines: + if find(output, line): + return + + if title is None: + title = 'output' + sys.stdout.write("Missing any expected line from %s:\n" % title) + for line in lines: + sys.stdout.write(' ' + repr(line) + '\n') + sys.stdout.write(self.banner(title + ' ')) + sys.stdout.write(output) + self.fail_test() + + def must_contain_lines(self, lines, output, title=None): + # Deprecated; retain for backwards compatibility. + return self.must_contain_all_lines(output, lines, title) + + def must_exist(self, *files): + """Ensures that the specified file(s) must exist. An individual + file be specified as a list of directory names, in which case the + pathname will be constructed by concatenating them. Exits FAILED + if any of the files does not exist. + """ + files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files) + missing = filter(lambda x: not os.path.exists(x), files) + if missing: + print "Missing files: `%s'" % string.join(missing, "', `") + self.fail_test(missing) + + def must_match(self, file, expect, mode = 'rb'): + """Matches the contents of the specified file (first argument) + against the expected contents (second argument). The expected + contents are a list of lines or a string which will be split + on newlines. + """ + file_contents = self.read(file, mode) + try: + self.fail_test(not self.match(file_contents, expect)) + except KeyboardInterrupt: + raise + except: + print "Unexpected contents of `%s'" % file + self.diff(expect, file_contents, 'contents ') + raise + + def must_not_contain(self, file, banned, mode = 'rb'): + """Ensures that the specified file doesn't contain the banned text. + """ + file_contents = self.read(file, mode) + contains = (string.find(file_contents, banned) != -1) + if contains: + print "File `%s' contains banned string." % file + print self.banner('Banned string ') + print banned + print self.banner('%s contents ' % file) + print file_contents + self.fail_test(contains) + + def must_not_contain_any_line(self, output, lines, title=None, find=None): + """Ensures that the specified output string (first argument) + does not contain any of the specified lines (second argument). + + An optional third argument can be used to describe the type + of output being searched, and only shows up in failure output. + + An optional fourth argument can be used to supply a different + function, of the form "find(line, output), to use when searching + for lines in the output. + """ + if find is None: + find = lambda o, l: string.find(o, l) != -1 + unexpected = [] + for line in lines: + if find(output, line): + unexpected.append(line) + + if unexpected: + if title is None: + title = 'output' + sys.stdout.write("Unexpected lines in %s:\n" % title) + for line in unexpected: + sys.stdout.write(' ' + repr(line) + '\n') + sys.stdout.write(self.banner(title + ' ')) + sys.stdout.write(output) + self.fail_test() + + def must_not_contain_lines(self, lines, output, title=None): + return self.must_not_contain_any_line(output, lines, title) + + def must_not_exist(self, *files): + """Ensures that the specified file(s) must not exist. + An individual file be specified as a list of directory names, in + which case the pathname will be constructed by concatenating them. + Exits FAILED if any of the files exists. + """ + files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files) + existing = filter(os.path.exists, files) + if existing: + print "Unexpected files exist: `%s'" % string.join(existing, "', `") + self.fail_test(existing) + + + def must_not_be_writable(self, *files): + """Ensures that the specified file(s) exist and are not writable. + An individual file can be specified as a list of directory names, + in which case the pathname will be constructed by concatenating + them. Exits FAILED if any of the files does not exist or is + writable. + """ + files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files) + existing, missing = separate_files(files) + writable = filter(is_writable, existing) + if missing: + print "Missing files: `%s'" % string.join(missing, "', `") + if writable: + print "Writable files: `%s'" % string.join(writable, "', `") + self.fail_test(missing + writable) + + def _complete(self, actual_stdout, expected_stdout, + actual_stderr, expected_stderr, status, match): + """ + Post-processes running a subcommand, checking for failure + status and displaying output appropriately. + """ + if _failed(self, status): + expect = '' + if status != 0: + expect = " (expected %s)" % str(status) + print "%s returned %s%s" % (self.program, str(_status(self)), expect) + print self.banner('STDOUT ') + print actual_stdout + print self.banner('STDERR ') + print actual_stderr + self.fail_test() + if not expected_stdout is None and not match(actual_stdout, expected_stdout): + self.diff(expected_stdout, actual_stdout, 'STDOUT ') + if actual_stderr: + print self.banner('STDERR ') + print actual_stderr + self.fail_test() + if not expected_stderr is None and not match(actual_stderr, expected_stderr): + print self.banner('STDOUT ') + print actual_stdout + self.diff(expected_stderr, actual_stderr, 'STDERR ') + self.fail_test() + + def start(self, program = None, + interpreter = None, + arguments = None, + universal_newlines = None, + **kw): + """ + Starts a program or script for the test environment. + + This handles the "options" keyword argument and exceptions. + """ + try: + options = kw['options'] + del kw['options'] + except KeyError: + pass + else: + if options: + if arguments is None: + arguments = options + else: + arguments = options + " " + arguments + try: + return apply(TestCmd.start, + (self, program, interpreter, arguments, universal_newlines), + kw) + except KeyboardInterrupt: + raise + except Exception, e: + print self.banner('STDOUT ') + try: + print self.stdout() + except IndexError: + pass + print self.banner('STDERR ') + try: + print self.stderr() + except IndexError: + pass + cmd_args = self.command_args(program, interpreter, arguments) + sys.stderr.write('Exception trying to execute: %s\n' % cmd_args) + raise e + + def finish(self, popen, stdout = None, stderr = '', status = 0, **kw): + """ + Finishes and waits for the process being run under control of + the specified popen argument. Additional arguments are similar + to those of the run() method: + + stdout The expected standard output from + the command. A value of None means + don't test standard output. + + stderr The expected error output from + the command. A value of None means + don't test error output. + + status The expected exit status from the + command. A value of None means don't + test exit status. + """ + apply(TestCmd.finish, (self, popen,), kw) + match = kw.get('match', self.match) + self._complete(self.stdout(), stdout, + self.stderr(), stderr, status, match) + + def run(self, options = None, arguments = None, + stdout = None, stderr = '', status = 0, **kw): + """Runs the program under test, checking that the test succeeded. + + The arguments are the same as the base TestCmd.run() method, + with the addition of: + + options Extra options that get appended to the beginning + of the arguments. + + stdout The expected standard output from + the command. A value of None means + don't test standard output. + + stderr The expected error output from + the command. A value of None means + don't test error output. + + status The expected exit status from the + command. A value of None means don't + test exit status. + + By default, this expects a successful exit (status = 0), does + not test standard output (stdout = None), and expects that error + output is empty (stderr = ""). + """ + if options: + if arguments is None: + arguments = options + else: + arguments = options + " " + arguments + kw['arguments'] = arguments + try: + match = kw['match'] + del kw['match'] + except KeyError: + match = self.match + apply(TestCmd.run, [self], kw) + self._complete(self.stdout(), stdout, + self.stderr(), stderr, status, match) + + def skip_test(self, message="Skipping test.\n"): + """Skips a test. + + Proper test-skipping behavior is dependent on the external + TESTCOMMON_PASS_SKIPS environment variable. If set, we treat + the skip as a PASS (exit 0), and otherwise treat it as NO RESULT. + In either case, we print the specified message as an indication + that the substance of the test was skipped. + + (This was originally added to support development under Aegis. + Technically, skipping a test is a NO RESULT, but Aegis would + treat that as a test failure and prevent the change from going to + the next step. Since we ddn't want to force anyone using Aegis + to have to install absolutely every tool used by the tests, we + would actually report to Aegis that a skipped test has PASSED + so that the workflow isn't held up.) + """ + if message: + sys.stdout.write(message) + sys.stdout.flush() + pass_skips = os.environ.get('TESTCOMMON_PASS_SKIPS') + if pass_skips in [None, 0, '0']: + # skip=1 means skip this function when showing where this + # result came from. They only care about the line where the + # script called test.skip_test(), not the line number where + # we call test.no_result(). + self.no_result(skip=1) + else: + # We're under the development directory for this change, + # so this is an Aegis invocation; pass the test (exit 0). + self.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/tools/gyp/test/lib/TestGyp.py b/tools/gyp/test/lib/TestGyp.py new file mode 100644 index 000000000..f258ff160 --- /dev/null +++ b/tools/gyp/test/lib/TestGyp.py @@ -0,0 +1,860 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +TestGyp.py: a testing framework for GYP integration tests. +""" + +import os +import re +import shutil +import stat +import subprocess +import sys +import tempfile + +import TestCommon +from TestCommon import __all__ + +__all__.extend([ + 'TestGyp', +]) + + +class TestGypBase(TestCommon.TestCommon): + """ + Class for controlling end-to-end tests of gyp generators. + + Instantiating this class will create a temporary directory and + arrange for its destruction (via the TestCmd superclass) and + copy all of the non-gyptest files in the directory hierarchy of the + executing script. + + The default behavior is to test the 'gyp' or 'gyp.bat' file in the + current directory. An alternative may be specified explicitly on + instantiation, or by setting the TESTGYP_GYP environment variable. + + This class should be subclassed for each supported gyp generator + (format). Various abstract methods below define calling signatures + used by the test scripts to invoke builds on the generated build + configuration and to run executables generated by those builds. + """ + + build_tool = None + build_tool_list = [] + + _exe = TestCommon.exe_suffix + _obj = TestCommon.obj_suffix + shobj_ = TestCommon.shobj_prefix + _shobj = TestCommon.shobj_suffix + lib_ = TestCommon.lib_prefix + _lib = TestCommon.lib_suffix + dll_ = TestCommon.dll_prefix + _dll = TestCommon.dll_suffix + + # Constants to represent different targets. + ALL = '__all__' + DEFAULT = '__default__' + + # Constants for different target types. + EXECUTABLE = '__executable__' + STATIC_LIB = '__static_lib__' + SHARED_LIB = '__shared_lib__' + + def __init__(self, gyp=None, *args, **kw): + self.origin_cwd = os.path.abspath(os.path.dirname(sys.argv[0])) + + if not gyp: + gyp = os.environ.get('TESTGYP_GYP') + if not gyp: + if sys.platform == 'win32': + gyp = 'gyp.bat' + else: + gyp = 'gyp' + self.gyp = os.path.abspath(gyp) + + self.initialize_build_tool() + + if not kw.has_key('match'): + kw['match'] = TestCommon.match_exact + + # Put test output in out/testworkarea by default. + # Use temporary names so there are no collisions. + workdir = os.path.join('out', kw.get('workdir', 'testworkarea')) + # Create work area if it doesn't already exist. + try: + os.makedirs(workdir) + except OSError: + pass + kw['workdir'] = tempfile.mktemp(prefix='testgyp.', dir=workdir) + + formats = kw.get('formats', []) + if kw.has_key('formats'): + del kw['formats'] + + super(TestGypBase, self).__init__(*args, **kw) + + excluded_formats = set([f for f in formats if f[0] == '!']) + included_formats = set(formats) - excluded_formats + if ('!'+self.format in excluded_formats or + included_formats and self.format not in included_formats): + msg = 'Invalid test for %r format; skipping test.\n' + self.skip_test(msg % self.format) + + self.copy_test_configuration(self.origin_cwd, self.workdir) + self.set_configuration(None) + + # Set $HOME so that gyp doesn't read the user's actual + # ~/.gyp/include.gypi file, which may contain variables + # and other settings that would change the output. + os.environ['HOME'] = self.workpath() + # Clear $GYP_DEFINES for the same reason. + if 'GYP_DEFINES' in os.environ: + del os.environ['GYP_DEFINES'] + + def built_file_must_exist(self, name, type=None, **kw): + """ + Fails the test if the specified built file name does not exist. + """ + return self.must_exist(self.built_file_path(name, type, **kw)) + + def built_file_must_not_exist(self, name, type=None, **kw): + """ + Fails the test if the specified built file name exists. + """ + return self.must_not_exist(self.built_file_path(name, type, **kw)) + + def built_file_must_match(self, name, contents, **kw): + """ + Fails the test if the contents of the specified built file name + do not match the specified contents. + """ + return self.must_match(self.built_file_path(name, **kw), contents) + + def built_file_must_not_match(self, name, contents, **kw): + """ + Fails the test if the contents of the specified built file name + match the specified contents. + """ + return self.must_not_match(self.built_file_path(name, **kw), contents) + + def copy_test_configuration(self, source_dir, dest_dir): + """ + Copies the test configuration from the specified source_dir + (the directory in which the test script lives) to the + specified dest_dir (a temporary working directory). + + This ignores all files and directories that begin with + the string 'gyptest', and all '.svn' subdirectories. + """ + for root, dirs, files in os.walk(source_dir): + if '.svn' in dirs: + dirs.remove('.svn') + dirs = [ d for d in dirs if not d.startswith('gyptest') ] + files = [ f for f in files if not f.startswith('gyptest') ] + for dirname in dirs: + source = os.path.join(root, dirname) + destination = source.replace(source_dir, dest_dir) + os.mkdir(destination) + if sys.platform != 'win32': + shutil.copystat(source, destination) + for filename in files: + source = os.path.join(root, filename) + destination = source.replace(source_dir, dest_dir) + shutil.copy2(source, destination) + + def initialize_build_tool(self): + """ + Initializes the .build_tool attribute. + + Searches the .build_tool_list for an executable name on the user's + $PATH. The first tool on the list is used as-is if nothing is found + on the current $PATH. + """ + for build_tool in self.build_tool_list: + if not build_tool: + continue + if os.path.isabs(build_tool): + self.build_tool = build_tool + return + build_tool = self.where_is(build_tool) + if build_tool: + self.build_tool = build_tool + return + + if self.build_tool_list: + self.build_tool = self.build_tool_list[0] + + def relocate(self, source, destination): + """ + Renames (relocates) the specified source (usually a directory) + to the specified destination, creating the destination directory + first if necessary. + + Note: Don't use this as a generic "rename" operation. In the + future, "relocating" parts of a GYP tree may affect the state of + the test to modify the behavior of later method calls. + """ + destination_dir = os.path.dirname(destination) + if not os.path.exists(destination_dir): + self.subdir(destination_dir) + os.rename(source, destination) + + def report_not_up_to_date(self): + """ + Reports that a build is not up-to-date. + + This provides common reporting for formats that have complicated + conditions for checking whether a build is up-to-date. Formats + that expect exact output from the command (make, scons) can + just set stdout= when they call the run_build() method. + """ + print "Build is not up-to-date:" + print self.banner('STDOUT ') + print self.stdout() + stderr = self.stderr() + if stderr: + print self.banner('STDERR ') + print stderr + + def run_gyp(self, gyp_file, *args, **kw): + """ + Runs gyp against the specified gyp_file with the specified args. + """ + # TODO: --depth=. works around Chromium-specific tree climbing. + depth = '.' + if 'depth' in kw: + depth = kw['depth'] + del kw['depth'] + args = ('--depth='+depth, '--format='+self.format, gyp_file) + args + return self.run(program=self.gyp, arguments=args, **kw) + + def run(self, *args, **kw): + """ + Executes a program by calling the superclass .run() method. + + This exists to provide a common place to filter out keyword + arguments implemented in this layer, without having to update + the tool-specific subclasses or clutter the tests themselves + with platform-specific code. + """ + if kw.has_key('SYMROOT'): + del kw['SYMROOT'] + super(TestGypBase, self).run(*args, **kw) + + def set_configuration(self, configuration): + """ + Sets the configuration, to be used for invoking the build + tool and testing potential built output. + """ + self.configuration = configuration + + def configuration_dirname(self): + if self.configuration: + return self.configuration.split('|')[0] + else: + return 'Default' + + def configuration_buildname(self): + if self.configuration: + return self.configuration + else: + return 'Default' + + # + # Abstract methods to be defined by format-specific subclasses. + # + + def build(self, gyp_file, target=None, **kw): + """ + Runs a build of the specified target against the configuration + generated from the specified gyp_file. + + A 'target' argument of None or the special value TestGyp.DEFAULT + specifies the default argument for the underlying build tool. + A 'target' argument of TestGyp.ALL specifies the 'all' target + (if any) of the underlying build tool. + """ + raise NotImplementedError + + def built_file_path(self, name, type=None, **kw): + """ + Returns a path to the specified file name, of the specified type. + """ + raise NotImplementedError + + def built_file_basename(self, name, type=None, **kw): + """ + Returns the base name of the specified file name, of the specified type. + + A bare=True keyword argument specifies that prefixes and suffixes shouldn't + be applied. + """ + if not kw.get('bare'): + if type == self.EXECUTABLE: + name = name + self._exe + elif type == self.STATIC_LIB: + name = self.lib_ + name + self._lib + elif type == self.SHARED_LIB: + name = self.dll_ + name + self._dll + return name + + def run_built_executable(self, name, *args, **kw): + """ + Runs an executable program built from a gyp-generated configuration. + + The specified name should be independent of any particular generator. + Subclasses should find the output executable in the appropriate + output build directory, tack on any necessary executable suffix, etc. + """ + raise NotImplementedError + + def up_to_date(self, gyp_file, target=None, **kw): + """ + Verifies that a build of the specified target is up to date. + + The subclass should implement this by calling build() + (or a reasonable equivalent), checking whatever conditions + will tell it the build was an "up to date" null build, and + failing if it isn't. + """ + raise NotImplementedError + + +class TestGypGypd(TestGypBase): + """ + Subclass for testing the GYP 'gypd' generator (spit out the + internal data structure as pretty-printed Python). + """ + format = 'gypd' + + +class TestGypMake(TestGypBase): + """ + Subclass for testing the GYP Make generator. + """ + format = 'make' + build_tool_list = ['make'] + ALL = 'all' + def build(self, gyp_file, target=None, **kw): + """ + Runs a Make build using the Makefiles generated from the specified + gyp_file. + """ + arguments = kw.get('arguments', [])[:] + if self.configuration: + arguments.append('BUILDTYPE=' + self.configuration) + if target not in (None, self.DEFAULT): + arguments.append(target) + # Sub-directory builds provide per-gyp Makefiles (i.e. + # Makefile.gyp_filename), so use that if there is no Makefile. + chdir = kw.get('chdir', '') + if not os.path.exists(os.path.join(chdir, 'Makefile')): + print "NO Makefile in " + os.path.join(chdir, 'Makefile') + arguments.insert(0, '-f') + arguments.insert(1, os.path.splitext(gyp_file)[0] + '.Makefile') + kw['arguments'] = arguments + return self.run(program=self.build_tool, **kw) + def up_to_date(self, gyp_file, target=None, **kw): + """ + Verifies that a build of the specified Make target is up to date. + """ + if target in (None, self.DEFAULT): + message_target = 'all' + else: + message_target = target + kw['stdout'] = "make: Nothing to be done for `%s'.\n" % message_target + return self.build(gyp_file, target, **kw) + def run_built_executable(self, name, *args, **kw): + """ + Runs an executable built by Make. + """ + configuration = self.configuration_dirname() + libdir = os.path.join('out', configuration, 'lib') + # TODO(piman): when everything is cross-compile safe, remove lib.target + if sys.platform == 'darwin': + # Mac puts target shared libraries right in the product directory. + configuration = self.configuration_dirname() + os.environ['DYLD_LIBRARY_PATH'] = ( + libdir + '.host:' + os.path.join('out', configuration)) + else: + os.environ['LD_LIBRARY_PATH'] = libdir + '.host:' + libdir + '.target' + # Enclosing the name in a list avoids prepending the original dir. + program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] + return self.run(program=program, *args, **kw) + def built_file_path(self, name, type=None, **kw): + """ + Returns a path to the specified file name, of the specified type, + as built by Make. + + Built files are in the subdirectory 'out/{configuration}'. + The default is 'out/Default'. + + A chdir= keyword argument specifies the source directory + relative to which the output subdirectory can be found. + + "type" values of STATIC_LIB or SHARED_LIB append the necessary + prefixes and suffixes to a platform-independent library base name. + + A subdir= keyword argument specifies a library subdirectory within + the default 'obj.target'. + """ + result = [] + chdir = kw.get('chdir') + if chdir: + result.append(chdir) + configuration = self.configuration_dirname() + result.extend(['out', configuration]) + if type == self.STATIC_LIB and sys.platform != 'darwin': + result.append('obj.target') + elif type == self.SHARED_LIB and sys.platform != 'darwin': + result.append('lib.target') + subdir = kw.get('subdir') + if subdir: + result.append(subdir) + result.append(self.built_file_basename(name, type, **kw)) + return self.workpath(*result) + + +def FindVisualStudioInstallation(): + """Returns appropriate values for .build_tool and .uses_msbuild fields + of TestGypBase for Visual Studio. + + We use the value specified by GYP_MSVS_VERSION. If not specified, we + search %PATH% and %PATHEXT% for a devenv.{exe,bat,...} executable. + Failing that, we search for likely deployment paths. + """ + possible_roots = ['C:\\Program Files (x86)', 'C:\\Program Files', + 'E:\\Program Files (x86)', 'E:\\Program Files'] + possible_paths = { + '2010': r'Microsoft Visual Studio 10.0\Common7\IDE\devenv.com', + '2008': r'Microsoft Visual Studio 9.0\Common7\IDE\devenv.com', + '2005': r'Microsoft Visual Studio 8\Common7\IDE\devenv.com'} + msvs_version = os.environ.get('GYP_MSVS_VERSION', 'auto') + build_tool = None + if msvs_version in possible_paths: + # Check that the path to the specified GYP_MSVS_VERSION exists. + path = possible_paths[msvs_version] + for r in possible_roots: + bt = os.path.join(r, path) + if os.path.exists(bt): + build_tool = bt + uses_msbuild = msvs_version >= '2010' + return build_tool, uses_msbuild + else: + print ('Warning: Environment variable GYP_MSVS_VERSION specifies "%s" ' + 'but corresponding "%s" was not found.' % (msvs_version, path)) + if build_tool: + # We found 'devenv' on the path, use that and try to guess the version. + for version, path in possible_paths.iteritems(): + if build_tool.find(path) >= 0: + uses_msbuild = version >= '2010' + return build_tool, uses_msbuild + else: + # If not, assume not MSBuild. + uses_msbuild = False + return build_tool, uses_msbuild + # Neither GYP_MSVS_VERSION nor the path help us out. Iterate through + # the choices looking for a match. + for version, path in possible_paths.iteritems(): + for r in possible_roots: + bt = os.path.join(r, path) + if os.path.exists(bt): + build_tool = bt + uses_msbuild = msvs_version >= '2010' + return build_tool, uses_msbuild + print 'Error: could not find devenv' + sys.exit(1) + +class TestGypOnMSToolchain(TestGypBase): + """ + Common subclass for testing generators that target the Microsoft Visual + Studio toolchain (cl, link, dumpbin, etc.) + """ + @staticmethod + def _ComputeVsvarsPath(devenv_path): + devenv_dir = os.path.split(devenv_path)[0] + vsvars_path = os.path.join(devenv_path, '../../Tools/vsvars32.bat') + return vsvars_path + + def initialize_build_tool(self): + super(TestGypOnMSToolchain, self).initialize_build_tool() + if sys.platform in ('win32', 'cygwin'): + self.devenv_path, self.uses_msbuild = FindVisualStudioInstallation() + self.vsvars_path = TestGypOnMSToolchain._ComputeVsvarsPath( + self.devenv_path) + + def run_dumpbin(self, *dumpbin_args): + """Run the dumpbin tool with the specified arguments, and capturing and + returning stdout.""" + assert sys.platform in ('win32', 'cygwin') + cmd = os.environ.get('COMSPEC', 'cmd.exe') + arguments = [cmd, '/c', self.vsvars_path, '&&', 'dumpbin'] + arguments.extend(dumpbin_args) + proc = subprocess.Popen(arguments, stdout=subprocess.PIPE) + output = proc.communicate()[0] + assert not proc.returncode + return output + +class TestGypNinja(TestGypOnMSToolchain): + """ + Subclass for testing the GYP Ninja generator. + """ + format = 'ninja' + build_tool_list = ['ninja'] + ALL = 'all' + DEFAULT = 'all' + + def initialize_build_tool(self): + super(TestGypNinja, self).initialize_build_tool() + if sys.platform == 'win32': + # Compiler and linker aren't in the path by default on Windows, so we + # make our "build tool" be set up + run ninja. + self.build_tool = os.environ.get('COMSPEC', 'cmd.exe') + self.helper_args = ['/c', self.vsvars_path, '&&', 'ninja'] + + def run_gyp(self, gyp_file, *args, **kw): + TestGypBase.run_gyp(self, gyp_file, *args, **kw) + + def build(self, gyp_file, target=None, **kw): + arguments = kw.get('arguments', [])[:] + + # Add a -C output/path to the command line. + arguments.append('-C') + arguments.append(os.path.join('out', self.configuration_dirname())) + + if target is None: + target = 'all' + arguments.append(target) + + if sys.platform == 'win32': + arguments = self.helper_args + arguments + + kw['arguments'] = arguments + return self.run(program=self.build_tool, **kw) + + def run_built_executable(self, name, *args, **kw): + # Enclosing the name in a list avoids prepending the original dir. + program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] + if sys.platform == 'darwin': + configuration = self.configuration_dirname() + os.environ['DYLD_LIBRARY_PATH'] = os.path.join('out', configuration) + return self.run(program=program, *args, **kw) + + def built_file_path(self, name, type=None, **kw): + result = [] + chdir = kw.get('chdir') + if chdir: + result.append(chdir) + result.append('out') + result.append(self.configuration_dirname()) + if type == self.STATIC_LIB: + if sys.platform != 'darwin': + result.append('obj') + elif type == self.SHARED_LIB: + if sys.platform != 'darwin' and sys.platform != 'win32': + result.append('lib') + subdir = kw.get('subdir') + if subdir: + result.append(subdir) + result.append(self.built_file_basename(name, type, **kw)) + return self.workpath(*result) + + def up_to_date(self, gyp_file, target=None, **kw): + result = self.build(gyp_file, target, **kw) + if not result: + stdout = self.stdout() + if 'ninja: no work to do' not in stdout: + self.report_not_up_to_date() + self.fail_test() + return result + + +class TestGypMSVS(TestGypOnMSToolchain): + """ + Subclass for testing the GYP Visual Studio generator. + """ + format = 'msvs' + + u = r'=== Build: 0 succeeded, 0 failed, (\d+) up-to-date, 0 skipped ===' + up_to_date_re = re.compile(u, re.M) + + # Initial None element will indicate to our .initialize_build_tool() + # method below that 'devenv' was not found on %PATH%. + # + # Note: we must use devenv.com to be able to capture build output. + # Directly executing devenv.exe only sends output to BuildLog.htm. + build_tool_list = [None, 'devenv.com'] + + def initialize_build_tool(self): + super(TestGypMSVS, self).initialize_build_tool() + self.build_tool = self.devenv_path + + def build(self, gyp_file, target=None, rebuild=False, **kw): + """ + Runs a Visual Studio build using the configuration generated + from the specified gyp_file. + """ + configuration = self.configuration_buildname() + if rebuild: + build = '/Rebuild' + else: + build = '/Build' + arguments = kw.get('arguments', [])[:] + arguments.extend([gyp_file.replace('.gyp', '.sln'), + build, configuration]) + # Note: the Visual Studio generator doesn't add an explicit 'all' + # target, so we just treat it the same as the default. + if target not in (None, self.ALL, self.DEFAULT): + arguments.extend(['/Project', target]) + if self.configuration: + arguments.extend(['/ProjectConfig', self.configuration]) + kw['arguments'] = arguments + return self.run(program=self.build_tool, **kw) + def up_to_date(self, gyp_file, target=None, **kw): + """ + Verifies that a build of the specified Visual Studio target is up to date. + + Beware that VS2010 will behave strangely if you build under + C:\USERS\yourname\AppData\Local. It will cause needless work. The ouptut + will be "1 succeeded and 0 up to date". MSBuild tracing reveals that: + "Project 'C:\Users\...\AppData\Local\...vcxproj' not up to date because + 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 10.0\VC\BIN\1033\CLUI.DLL' + was modified at 02/21/2011 17:03:30, which is newer than '' which was + modified at 01/01/0001 00:00:00. + + The workaround is to specify a workdir when instantiating the test, e.g. + test = TestGyp.TestGyp(workdir='workarea') + """ + result = self.build(gyp_file, target, **kw) + if not result: + stdout = self.stdout() + + m = self.up_to_date_re.search(stdout) + up_to_date = m and int(m.group(1)) > 0 + if not up_to_date: + self.report_not_up_to_date() + self.fail_test() + return result + def run_built_executable(self, name, *args, **kw): + """ + Runs an executable built by Visual Studio. + """ + configuration = self.configuration_dirname() + # Enclosing the name in a list avoids prepending the original dir. + program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] + return self.run(program=program, *args, **kw) + def built_file_path(self, name, type=None, **kw): + """ + Returns a path to the specified file name, of the specified type, + as built by Visual Studio. + + Built files are in a subdirectory that matches the configuration + name. The default is 'Default'. + + A chdir= keyword argument specifies the source directory + relative to which the output subdirectory can be found. + + "type" values of STATIC_LIB or SHARED_LIB append the necessary + prefixes and suffixes to a platform-independent library base name. + """ + result = [] + chdir = kw.get('chdir') + if chdir: + result.append(chdir) + result.append(self.configuration_dirname()) + if type == self.STATIC_LIB: + result.append('lib') + result.append(self.built_file_basename(name, type, **kw)) + return self.workpath(*result) + + +class TestGypSCons(TestGypBase): + """ + Subclass for testing the GYP SCons generator. + """ + format = 'scons' + build_tool_list = ['scons', 'scons.py'] + ALL = 'all' + def build(self, gyp_file, target=None, **kw): + """ + Runs a scons build using the SCons configuration generated from the + specified gyp_file. + """ + arguments = kw.get('arguments', [])[:] + dirname = os.path.dirname(gyp_file) + if dirname: + arguments.extend(['-C', dirname]) + if self.configuration: + arguments.append('--mode=' + self.configuration) + if target not in (None, self.DEFAULT): + arguments.append(target) + kw['arguments'] = arguments + return self.run(program=self.build_tool, **kw) + def up_to_date(self, gyp_file, target=None, **kw): + """ + Verifies that a build of the specified SCons target is up to date. + """ + if target in (None, self.DEFAULT): + up_to_date_targets = 'all' + else: + up_to_date_targets = target + up_to_date_lines = [] + for arg in up_to_date_targets.split(): + up_to_date_lines.append("scons: `%s' is up to date.\n" % arg) + kw['stdout'] = ''.join(up_to_date_lines) + arguments = kw.get('arguments', [])[:] + arguments.append('-Q') + kw['arguments'] = arguments + return self.build(gyp_file, target, **kw) + def run_built_executable(self, name, *args, **kw): + """ + Runs an executable built by scons. + """ + configuration = self.configuration_dirname() + os.environ['LD_LIBRARY_PATH'] = os.path.join(configuration, 'lib') + # Enclosing the name in a list avoids prepending the original dir. + program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] + return self.run(program=program, *args, **kw) + def built_file_path(self, name, type=None, **kw): + """ + Returns a path to the specified file name, of the specified type, + as built by Scons. + + Built files are in a subdirectory that matches the configuration + name. The default is 'Default'. + + A chdir= keyword argument specifies the source directory + relative to which the output subdirectory can be found. + + "type" values of STATIC_LIB or SHARED_LIB append the necessary + prefixes and suffixes to a platform-independent library base name. + """ + result = [] + chdir = kw.get('chdir') + if chdir: + result.append(chdir) + result.append(self.configuration_dirname()) + if type in (self.STATIC_LIB, self.SHARED_LIB): + result.append('lib') + result.append(self.built_file_basename(name, type, **kw)) + return self.workpath(*result) + + +class TestGypXcode(TestGypBase): + """ + Subclass for testing the GYP Xcode generator. + """ + format = 'xcode' + build_tool_list = ['xcodebuild'] + + phase_script_execution = ("\n" + "PhaseScriptExecution /\\S+/Script-[0-9A-F]+\\.sh\n" + " cd /\\S+\n" + " /bin/sh -c /\\S+/Script-[0-9A-F]+\\.sh\n" + "(make: Nothing to be done for `all'\\.\n)?") + + strip_up_to_date_expressions = [ + # Various actions or rules can run even when the overall build target + # is up to date. Strip those phases' GYP-generated output. + re.compile(phase_script_execution, re.S), + + # The message from distcc_pump can trail the "BUILD SUCCEEDED" + # message, so strip that, too. + re.compile('__________Shutting down distcc-pump include server\n', re.S), + ] + + up_to_date_endings = ( + 'Checking Dependencies...\n** BUILD SUCCEEDED **\n', # Xcode 3.0/3.1 + 'Check dependencies\n** BUILD SUCCEEDED **\n\n', # Xcode 3.2 + ) + + def build(self, gyp_file, target=None, **kw): + """ + Runs an xcodebuild using the .xcodeproj generated from the specified + gyp_file. + """ + # Be sure we're working with a copy of 'arguments' since we modify it. + # The caller may not be expecting it to be modified. + arguments = kw.get('arguments', [])[:] + arguments.extend(['-project', gyp_file.replace('.gyp', '.xcodeproj')]) + if target == self.ALL: + arguments.append('-alltargets',) + elif target not in (None, self.DEFAULT): + arguments.extend(['-target', target]) + if self.configuration: + arguments.extend(['-configuration', self.configuration]) + symroot = kw.get('SYMROOT', '$SRCROOT/build') + if symroot: + arguments.append('SYMROOT='+symroot) + kw['arguments'] = arguments + return self.run(program=self.build_tool, **kw) + def up_to_date(self, gyp_file, target=None, **kw): + """ + Verifies that a build of the specified Xcode target is up to date. + """ + result = self.build(gyp_file, target, **kw) + if not result: + output = self.stdout() + for expression in self.strip_up_to_date_expressions: + output = expression.sub('', output) + if not output.endswith(self.up_to_date_endings): + self.report_not_up_to_date() + self.fail_test() + return result + def run_built_executable(self, name, *args, **kw): + """ + Runs an executable built by xcodebuild. + """ + configuration = self.configuration_dirname() + os.environ['DYLD_LIBRARY_PATH'] = os.path.join('build', configuration) + # Enclosing the name in a list avoids prepending the original dir. + program = [self.built_file_path(name, type=self.EXECUTABLE, **kw)] + return self.run(program=program, *args, **kw) + def built_file_path(self, name, type=None, **kw): + """ + Returns a path to the specified file name, of the specified type, + as built by Xcode. + + Built files are in the subdirectory 'build/{configuration}'. + The default is 'build/Default'. + + A chdir= keyword argument specifies the source directory + relative to which the output subdirectory can be found. + + "type" values of STATIC_LIB or SHARED_LIB append the necessary + prefixes and suffixes to a platform-independent library base name. + """ + result = [] + chdir = kw.get('chdir') + if chdir: + result.append(chdir) + configuration = self.configuration_dirname() + result.extend(['build', configuration]) + result.append(self.built_file_basename(name, type, **kw)) + return self.workpath(*result) + + +format_class_list = [ + TestGypGypd, + TestGypMake, + TestGypMSVS, + TestGypNinja, + TestGypSCons, + TestGypXcode, +] + +def TestGyp(*args, **kw): + """ + Returns an appropriate TestGyp* instance for a specified GYP format. + """ + format = kw.get('format') + if format: + del kw['format'] + else: + format = os.environ.get('TESTGYP_FORMAT') + for format_class in format_class_list: + if format == format_class.format: + return format_class(*args, **kw) + raise Exception, "unknown format %r" % format diff --git a/tools/gyp/test/library/gyptest-shared-obj-install-path.py b/tools/gyp/test/library/gyptest-shared-obj-install-path.py new file mode 100755 index 000000000..2cf1a2845 --- /dev/null +++ b/tools/gyp/test/library/gyptest-shared-obj-install-path.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that .so files that are order only dependencies are specified by +their install location rather than by their alias. +""" + +# Python 2.5 needs this for the with statement. +from __future__ import with_statement + +import os +import TestGyp + +test = TestGyp.TestGyp(formats=['make']) + +test.run_gyp('shared_dependency.gyp', + chdir='src') +test.relocate('src', 'relocate/src') + +test.build('shared_dependency.gyp', test.ALL, chdir='relocate/src') + +with open('relocate/src/Makefile') as makefile: + make_contents = makefile.read() + +# If we remove the code to generate lib1, Make should still be able +# to build lib2 since lib1.so already exists. +make_contents = make_contents.replace('include lib1.target.mk', '') +with open('relocate/src/Makefile', 'w') as makefile: + makefile.write(make_contents) + +test.build('shared_dependency.gyp', test.ALL, chdir='relocate/src') + +test.pass_test() diff --git a/tools/gyp/test/library/gyptest-shared.py b/tools/gyp/test/library/gyptest-shared.py new file mode 100755 index 000000000..a1d2985d9 --- /dev/null +++ b/tools/gyp/test/library/gyptest-shared.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simple build of a "Hello, world!" program with shared libraries, +including verifying that libraries are rebuilt correctly when functions +move between libraries. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('library.gyp', + '-Dlibrary=shared_library', + '-Dmoveable_function=lib1', + chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('library.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +Hello from program.c +Hello from lib1.c +Hello from lib2.c +Hello from lib1_moveable.c +""" +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + + +test.run_gyp('library.gyp', + '-Dlibrary=shared_library', + '-Dmoveable_function=lib2', + chdir='relocate/src') + +# Update program.c to force a rebuild. +test.sleep() +contents = test.read('relocate/src/program.c') +contents = contents.replace('Hello', 'Hello again') +test.write('relocate/src/program.c', contents) + +test.build('library.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +Hello again from program.c +Hello from lib1.c +Hello from lib2.c +Hello from lib2_moveable.c +""" +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + + +test.run_gyp('library.gyp', + '-Dlibrary=shared_library', + '-Dmoveable_function=lib1', + chdir='relocate/src') + +# Update program.c to force a rebuild. +test.sleep() +contents = test.read('relocate/src/program.c') +contents = contents.replace('again', 'again again') +test.write('relocate/src/program.c', contents) + +# TODO(sgk): we have to force a rebuild of lib2 so that it weeds out +# the "moved" module. This should be done in gyp by adding a dependency +# on the generated .vcproj file itself. +test.touch('relocate/src/lib2.c') + +test.build('library.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +Hello again again from program.c +Hello from lib1.c +Hello from lib2.c +Hello from lib1_moveable.c +""" +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + + +test.pass_test() diff --git a/tools/gyp/test/library/gyptest-static.py b/tools/gyp/test/library/gyptest-static.py new file mode 100755 index 000000000..4bc71c496 --- /dev/null +++ b/tools/gyp/test/library/gyptest-static.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simple build of a "Hello, world!" program with static libraries, +including verifying that libraries are rebuilt correctly when functions +move between libraries. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('library.gyp', + '-Dlibrary=static_library', + '-Dmoveable_function=lib1', + chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('library.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +Hello from program.c +Hello from lib1.c +Hello from lib2.c +Hello from lib1_moveable.c +""" +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + + +test.run_gyp('library.gyp', + '-Dlibrary=static_library', + '-Dmoveable_function=lib2', + chdir='relocate/src') + +# Update program.c to force a rebuild. +test.sleep() +contents = test.read('relocate/src/program.c') +contents = contents.replace('Hello', 'Hello again') +test.write('relocate/src/program.c', contents) + +test.build('library.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +Hello again from program.c +Hello from lib1.c +Hello from lib2.c +Hello from lib2_moveable.c +""" +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + + +test.run_gyp('library.gyp', + '-Dlibrary=static_library', + '-Dmoveable_function=lib1', + chdir='relocate/src') + +# Update program.c and lib2.c to force a rebuild. +test.sleep() +contents = test.read('relocate/src/program.c') +contents = contents.replace('again', 'again again') +test.write('relocate/src/program.c', contents) + +# TODO(sgk): we have to force a rebuild of lib2 so that it weeds out +# the "moved" module. This should be done in gyp by adding a dependency +# on the generated .vcproj file itself. +test.touch('relocate/src/lib2.c') + +test.build('library.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +Hello again again from program.c +Hello from lib1.c +Hello from lib2.c +Hello from lib1_moveable.c +""" +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + + +test.pass_test() diff --git a/tools/gyp/test/library/src/lib1.c b/tools/gyp/test/library/src/lib1.c new file mode 100644 index 000000000..3866b1b84 --- /dev/null +++ b/tools/gyp/test/library/src/lib1.c @@ -0,0 +1,10 @@ +#include + +#ifdef _WIN32 +__declspec(dllexport) +#endif +void lib1_function(void) +{ + fprintf(stdout, "Hello from lib1.c\n"); + fflush(stdout); +} diff --git a/tools/gyp/test/library/src/lib1_moveable.c b/tools/gyp/test/library/src/lib1_moveable.c new file mode 100644 index 000000000..5d3cc1d9a --- /dev/null +++ b/tools/gyp/test/library/src/lib1_moveable.c @@ -0,0 +1,10 @@ +#include + +#ifdef _WIN32 +__declspec(dllexport) +#endif +void moveable_function(void) +{ + fprintf(stdout, "Hello from lib1_moveable.c\n"); + fflush(stdout); +} diff --git a/tools/gyp/test/library/src/lib2.c b/tools/gyp/test/library/src/lib2.c new file mode 100644 index 000000000..21dda7265 --- /dev/null +++ b/tools/gyp/test/library/src/lib2.c @@ -0,0 +1,10 @@ +#include + +#ifdef _WIN32 +__declspec(dllexport) +#endif +void lib2_function(void) +{ + fprintf(stdout, "Hello from lib2.c\n"); + fflush(stdout); +} diff --git a/tools/gyp/test/library/src/lib2_moveable.c b/tools/gyp/test/library/src/lib2_moveable.c new file mode 100644 index 000000000..f645071d1 --- /dev/null +++ b/tools/gyp/test/library/src/lib2_moveable.c @@ -0,0 +1,10 @@ +#include + +#ifdef _WIN32 +__declspec(dllexport) +#endif +void moveable_function(void) +{ + fprintf(stdout, "Hello from lib2_moveable.c\n"); + fflush(stdout); +} diff --git a/tools/gyp/test/library/src/library.gyp b/tools/gyp/test/library/src/library.gyp new file mode 100644 index 000000000..bc3551642 --- /dev/null +++ b/tools/gyp/test/library/src/library.gyp @@ -0,0 +1,58 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables': { + 'moveable_function%': 0, + }, + 'targets': [ + { + 'target_name': 'program', + 'type': 'executable', + 'dependencies': [ + 'lib1', + 'lib2', + ], + 'sources': [ + 'program.c', + ], + }, + { + 'target_name': 'lib1', + 'type': '<(library)', + 'sources': [ + 'lib1.c', + ], + 'conditions': [ + ['moveable_function=="lib1"', { + 'sources': [ + 'lib1_moveable.c', + ], + }], + ], + }, + { + 'target_name': 'lib2', + 'type': '<(library)', + 'sources': [ + 'lib2.c', + ], + 'conditions': [ + ['moveable_function=="lib2"', { + 'sources': [ + 'lib2_moveable.c', + ], + }], + ], + }, + ], + 'conditions': [ + ['OS=="linux"', { + 'target_defaults': { + # Support 64-bit shared libs (also works fine for 32-bit). + 'cflags': ['-fPIC'], + }, + }], + ], +} diff --git a/tools/gyp/test/library/src/program.c b/tools/gyp/test/library/src/program.c new file mode 100644 index 000000000..d7712cced --- /dev/null +++ b/tools/gyp/test/library/src/program.c @@ -0,0 +1,15 @@ +#include + +extern void lib1_function(void); +extern void lib2_function(void); +extern void moveable_function(void); + +int main(int argc, char *argv[]) +{ + fprintf(stdout, "Hello from program.c\n"); + fflush(stdout); + lib1_function(); + lib2_function(); + moveable_function(); + return 0; +} diff --git a/tools/gyp/test/library/src/shared_dependency.gyp b/tools/gyp/test/library/src/shared_dependency.gyp new file mode 100644 index 000000000..7d29f5de5 --- /dev/null +++ b/tools/gyp/test/library/src/shared_dependency.gyp @@ -0,0 +1,33 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'lib1', + 'type': 'shared_library', + 'sources': [ + 'lib1.c', + ], + }, + { + 'target_name': 'lib2', + 'type': 'shared_library', + 'sources': [ + 'lib2.c', + ], + 'dependencies': [ + 'lib1', + ], + }, + ], + 'conditions': [ + ['OS=="linux"', { + 'target_defaults': { + # Support 64-bit shared libs (also works fine for 32-bit). + 'cflags': ['-fPIC'], + }, + }], + ], +} diff --git a/tools/gyp/test/link-objects/base.c b/tools/gyp/test/link-objects/base.c new file mode 100644 index 000000000..2bc29a1b1 --- /dev/null +++ b/tools/gyp/test/link-objects/base.c @@ -0,0 +1,6 @@ +void extra(); + +int main(int argc, char** argv) { + extra(); + return 0; +} diff --git a/tools/gyp/test/link-objects/extra.c b/tools/gyp/test/link-objects/extra.c new file mode 100644 index 000000000..1d7ee09b1 --- /dev/null +++ b/tools/gyp/test/link-objects/extra.c @@ -0,0 +1,5 @@ +#include + +void extra() { + printf("PASS\n"); +} diff --git a/tools/gyp/test/link-objects/gyptest-all.py b/tools/gyp/test/link-objects/gyptest-all.py new file mode 100755 index 000000000..45bd6e189 --- /dev/null +++ b/tools/gyp/test/link-objects/gyptest-all.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Put an object file on the sources list. +Expect the result to link ok. +""" + +import TestGyp + +import sys + +if sys.platform != 'darwin': + # Currently only works under the linux make build. + test = TestGyp.TestGyp(formats=['make']) + + test.run_gyp('link-objects.gyp') + + test.build('link-objects.gyp', test.ALL) + + test.run_built_executable('link-objects', stdout="PASS\n") + + test.up_to_date('link-objects.gyp', test.ALL) + + test.pass_test() diff --git a/tools/gyp/test/link-objects/link-objects.gyp b/tools/gyp/test/link-objects/link-objects.gyp new file mode 100644 index 000000000..ab7285553 --- /dev/null +++ b/tools/gyp/test/link-objects/link-objects.gyp @@ -0,0 +1,24 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'link-objects', + 'type': 'executable', + 'actions': [ + { + 'action_name': 'build extra object', + 'inputs': ['extra.c'], + 'outputs': ['extra.o'], + 'action': ['gcc', '-o', 'extra.o', '-c', 'extra.c'], + 'process_outputs_as_sources': 1, + }, + ], + 'sources': [ + 'base.c', + ], + }, + ], +} diff --git a/tools/gyp/test/mac/action-envvars/action/action.gyp b/tools/gyp/test/mac/action-envvars/action/action.gyp new file mode 100644 index 000000000..d9d65745c --- /dev/null +++ b/tools/gyp/test/mac/action-envvars/action/action.gyp @@ -0,0 +1,34 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'action', + 'type': 'none', + 'actions': [ + { + 'inputs': [ ], + 'outputs': [ + '<(PRODUCT_DIR)/result', + '<(SHARED_INTERMEDIATE_DIR)/tempfile', + ], + 'action_name': 'Test action', + 'action': ['./action.sh', '<(SHARED_INTERMEDIATE_DIR)/tempfile' ], + }, + { + 'inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/tempfile', + ], + 'outputs': [ + '<(PRODUCT_DIR)/other_result', + ], + 'action_name': 'Other test action', + 'action': ['cp', '<(SHARED_INTERMEDIATE_DIR)/tempfile', + '<(PRODUCT_DIR)/other_result' ], + }, + ], + }, + ], +} + diff --git a/tools/gyp/test/mac/action-envvars/action/action.sh b/tools/gyp/test/mac/action-envvars/action/action.sh new file mode 100755 index 000000000..48d5f6bf8 --- /dev/null +++ b/tools/gyp/test/mac/action-envvars/action/action.sh @@ -0,0 +1,8 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e + +echo 'Test output' > "${BUILT_PRODUCTS_DIR}/result" +echo 'Other output' > "$1" diff --git a/tools/gyp/test/mac/app-bundle/TestApp/English.lproj/InfoPlist.strings b/tools/gyp/test/mac/app-bundle/TestApp/English.lproj/InfoPlist.strings new file mode 100644 index 000000000..452e7fabf --- /dev/null +++ b/tools/gyp/test/mac/app-bundle/TestApp/English.lproj/InfoPlist.strings @@ -0,0 +1,3 @@ +/* Localized versions of Info.plist keys */ + +NSHumanReadableCopyright = "Copyright ©2011 Google Inc." diff --git a/tools/gyp/test/mac/app-bundle/TestApp/English.lproj/MainMenu.xib b/tools/gyp/test/mac/app-bundle/TestApp/English.lproj/MainMenu.xib new file mode 100644 index 000000000..452459678 --- /dev/null +++ b/tools/gyp/test/mac/app-bundle/TestApp/English.lproj/MainMenu.xib @@ -0,0 +1,4119 @@ + + + + 1060 + 10A324 + 719 + 1015 + 418.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 719 + + + YES + + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + TestApp + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + TestApp + + YES + + + About TestApp + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide TestApp + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit TestApp + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + Save As… + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Paste and Match Style + V + 1572864 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + Show Spelling and Grammar + : + 1048576 + 2147483647 + + + + + + Check Document Now + ; + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + Correct Spelling Automatically + + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Show Substitutions + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Dashes + + 2147483647 + + + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + Text Replacement + + 2147483647 + + + + + + + + + Transformations + + 2147483647 + + + submenuAction: + + Transformations + + YES + + + Make Upper Case + + 2147483647 + + + + + + Make Lower Case + + 2147483647 + + + + + + Capitalize + + 2147483647 + + + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Writing Direction + + 2147483647 + + + submenuAction: + + Writing Direction + + YES + + + YES + Paragraph + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + YES + Selection + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 2147483647 + + + submenuAction: + + Help + + YES + + + TestApp Help + ? + 1048576 + 2147483647 + + + + + _NSHelpMenu + + + + _NSMainMenu + + + 15 + 2 + {{335, 390}, {480, 360}} + 1954021376 + TestApp + NSWindow + + {1.79769e+308, 1.79769e+308} + + + 256 + {480, 360} + + + {{0, 0}, {1920, 1178}} + {1.79769e+308, 1.79769e+308} + + + TestAppAppDelegate + + + NSFontManager + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + addFontTrait: + + + + 421 + + + + addFontTrait: + + + + 422 + + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + terminate: + + + + 449 + + + + toggleAutomaticSpellingCorrection: + + + + 456 + + + + orderFrontSubstitutionsPanel: + + + + 458 + + + + toggleAutomaticDashSubstitution: + + + + 461 + + + + toggleAutomaticTextReplacement: + + + + 463 + + + + uppercaseWord: + + + + 464 + + + + capitalizeWord: + + + + 467 + + + + lowercaseWord: + + + + 468 + + + + pasteAsPlainText: + + + + 486 + + + + performFindPanelAction: + + + + 487 + + + + performFindPanelAction: + + + + 488 + + + + performFindPanelAction: + + + + 489 + + + + showHelp: + + + + 493 + + + + delegate + + + + 495 + + + + alignCenter: + + + + 518 + + + + pasteRuler: + + + + 519 + + + + toggleRuler: + + + + 520 + + + + alignRight: + + + + 521 + + + + copyRuler: + + + + 522 + + + + alignJustified: + + + + 523 + + + + alignLeft: + + + + 524 + + + + makeBaseWritingDirectionNatural: + + + + 525 + + + + makeBaseWritingDirectionLeftToRight: + + + + 526 + + + + makeBaseWritingDirectionRightToLeft: + + + + 527 + + + + makeTextWritingDirectionNatural: + + + + 528 + + + + makeTextWritingDirectionLeftToRight: + + + + 529 + + + + makeTextWritingDirectionRightToLeft: + + + + 530 + + + + window + + + + 532 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + + + 80 + + + + + 78 + + + + + 72 + + + + + 82 + + + + + 124 + + + YES + + + + + + 77 + + + + + 73 + + + + + 79 + + + + + 112 + + + + + 74 + + + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + + + 144 + + + + + 129 + + + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + YES + + + + + + 372 + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + + 377 + + + YES + + + + + + 388 + + + YES + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + YES + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + YES + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + YES + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + YES + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 420 + + + + + 450 + + + YES + + + + + + 451 + + + YES + + + + + + + + 452 + + + + + 453 + + + + + 454 + + + + + 457 + + + + + 459 + + + + + 460 + + + + + 462 + + + + + 465 + + + + + 466 + + + + + 485 + + + + + 490 + + + YES + + + + + + 491 + + + YES + + + + + + 492 + + + + + 494 + + + + + 496 + + + YES + + + + + + 497 + + + YES + + + + + + + + + + + + + + + 498 + + + + + 499 + + + + + 500 + + + + + 501 + + + + + 502 + + + + + 503 + + + YES + + + + + + 504 + + + + + 505 + + + + + 506 + + + + + 507 + + + + + 508 + + + YES + + + + + + + + + + + + + + 509 + + + + + 510 + + + + + 511 + + + + + 512 + + + + + 513 + + + + + 514 + + + + + 515 + + + + + 516 + + + + + 517 + + + + + + + YES + + YES + -3.IBPluginDependency + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBEditorWindowLastContentRect + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBEditorWindowLastContentRect + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBEditorWindowLastContentRect + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBEditorWindowLastContentRect + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBEditorWindowLastContentRect + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBEditorWindowLastContentRect + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBEditorWindowLastContentRect + 371.IBPluginDependency + 371.IBWindowTemplateEditedContentRect + 371.NSWindowTemplate.visibleAtLaunch + 371.editorWindowContentRectSynchronizationRect + 371.windowTemplate.maxSize + 372.IBPluginDependency + 375.IBPluginDependency + 376.IBEditorWindowLastContentRect + 376.IBPluginDependency + 377.IBPluginDependency + 388.IBEditorWindowLastContentRect + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 419.IBPluginDependency + 450.IBPluginDependency + 451.IBEditorWindowLastContentRect + 451.IBPluginDependency + 452.IBPluginDependency + 453.IBPluginDependency + 454.IBPluginDependency + 457.IBPluginDependency + 459.IBPluginDependency + 460.IBPluginDependency + 462.IBPluginDependency + 465.IBPluginDependency + 466.IBPluginDependency + 485.IBPluginDependency + 490.IBPluginDependency + 491.IBEditorWindowLastContentRect + 491.IBPluginDependency + 492.IBPluginDependency + 496.IBPluginDependency + 497.IBEditorWindowLastContentRect + 497.IBPluginDependency + 498.IBPluginDependency + 499.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 500.IBPluginDependency + 501.IBPluginDependency + 502.IBPluginDependency + 503.IBPluginDependency + 504.IBPluginDependency + 505.IBPluginDependency + 506.IBPluginDependency + 507.IBPluginDependency + 508.IBEditorWindowLastContentRect + 508.IBPluginDependency + 509.IBPluginDependency + 510.IBPluginDependency + 511.IBPluginDependency + 512.IBPluginDependency + 513.IBPluginDependency + 514.IBPluginDependency + 515.IBPluginDependency + 516.IBPluginDependency + 517.IBPluginDependency + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{753, 187}, {275, 113}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{547, 180}, {254, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{187, 434}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{753, 217}, {238, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{654, 239}, {194, 73}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{380, 836}, {512, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{6, 978}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + {{604, 269}, {231, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{746, 287}, {220, 133}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{380, 496}, {480, 360}} + com.apple.InterfaceBuilder.CocoaPlugin + {{380, 496}, {480, 360}} + + {{33, 99}, {480, 360}} + {3.40282e+38, 3.40282e+38} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{591, 420}, {83, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{523, 2}, {178, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{753, 197}, {170, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{725, 289}, {246, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{674, 260}, {204, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{878, 180}, {164, 173}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + {{286, 129}, {275, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{452, 109}, {196, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{145, 474}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + + YES + + + + + YES + + + YES + + + + 532 + + + + YES + + TestAppAppDelegate + NSObject + + window + NSWindow + + + IBProjectSource + TestAppAppDelegate.h + + + + + YES + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSBrowser + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSBrowser.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSDocument + NSObject + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + id + id + id + id + id + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocument.h + + + + NSDocument + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentScripting.h + + + + NSDocumentController + NSObject + + YES + + YES + clearRecentDocuments: + newDocument: + openDocument: + saveAllDocuments: + + + YES + id + id + id + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentController.h + + + + NSFontManager + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMatrix + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSMatrix.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSMenuItem + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSMovieView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMovieView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTableView + NSControl + + + + NSText + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSTextView + NSText + + IBFrameworkSource + AppKit.framework/Headers/NSTextView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../TestApp.xcodeproj + 3 + + diff --git a/tools/gyp/test/mac/app-bundle/TestApp/TestApp-Info.plist b/tools/gyp/test/mac/app-bundle/TestApp/TestApp-Info.plist new file mode 100644 index 000000000..8cb142e9f --- /dev/null +++ b/tools/gyp/test/mac/app-bundle/TestApp/TestApp-Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.google.${PRODUCT_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ause + CFBundleVersion + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.h b/tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.h new file mode 100644 index 000000000..518645eae --- /dev/null +++ b/tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.h @@ -0,0 +1,13 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import + +@interface TestAppAppDelegate : NSObject { + NSWindow *window; +} + +@property (assign) IBOutlet NSWindow *window; + +@end diff --git a/tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.m b/tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.m new file mode 100644 index 000000000..9aafa4200 --- /dev/null +++ b/tools/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.m @@ -0,0 +1,15 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "TestAppAppDelegate.h" + +@implementation TestAppAppDelegate + +@synthesize window; + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Insert code here to initialize your application +} + +@end diff --git a/tools/gyp/test/mac/app-bundle/TestApp/main.m b/tools/gyp/test/mac/app-bundle/TestApp/main.m new file mode 100644 index 000000000..df6a12d06 --- /dev/null +++ b/tools/gyp/test/mac/app-bundle/TestApp/main.m @@ -0,0 +1,10 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import + +int main(int argc, char *argv[]) +{ + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/tools/gyp/test/mac/app-bundle/empty.c b/tools/gyp/test/mac/app-bundle/empty.c new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/mac/app-bundle/test.gyp b/tools/gyp/test/mac/app-bundle/test.gyp new file mode 100644 index 000000000..f51c7b4b6 --- /dev/null +++ b/tools/gyp/test/mac/app-bundle/test.gyp @@ -0,0 +1,39 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'dep_framework', + 'product_name': 'Dependency Framework', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'empty.c', ], + }, + { + 'target_name': 'test_app', + 'product_name': 'Test App Gyp', + 'type': 'executable', + 'mac_bundle': 1, + 'dependencies': [ 'dep_framework', ], + 'sources': [ + 'TestApp/main.m', + 'TestApp/TestApp_Prefix.pch', + 'TestApp/TestAppAppDelegate.h', + 'TestApp/TestAppAppDelegate.m', + ], + 'mac_bundle_resources': [ + 'TestApp/English.lproj/InfoPlist.strings', + 'TestApp/English.lproj/MainMenu.xib', + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', + ], + }, + 'xcode_settings': { + 'INFOPLIST_FILE': 'TestApp/TestApp-Info.plist', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/archs/my_file.cc b/tools/gyp/test/mac/archs/my_file.cc new file mode 100644 index 000000000..94216a74d --- /dev/null +++ b/tools/gyp/test/mac/archs/my_file.cc @@ -0,0 +1,4 @@ +/* Copyright (c) 2012 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ +int x = 1; diff --git a/tools/gyp/test/mac/archs/my_main_file.cc b/tools/gyp/test/mac/archs/my_main_file.cc new file mode 100644 index 000000000..f1fa06f27 --- /dev/null +++ b/tools/gyp/test/mac/archs/my_main_file.cc @@ -0,0 +1,9 @@ +/* Copyright (c) 2012 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ +#include +extern int x; +int main() { + printf("hello, world %d\n", x); +} + diff --git a/tools/gyp/test/mac/archs/test-archs-x86_64.gyp b/tools/gyp/test/mac/archs/test-archs-x86_64.gyp new file mode 100644 index 000000000..d11a89627 --- /dev/null +++ b/tools/gyp/test/mac/archs/test-archs-x86_64.gyp @@ -0,0 +1,27 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'lib', + 'product_name': 'Test64', + 'type': 'static_library', + 'sources': [ 'my_file.cc' ], + 'xcode_settings': { + 'ARCHS': [ 'x86_64' ], + }, + }, + { + 'target_name': 'exe', + 'product_name': 'Test64', + 'type': 'executable', + 'dependencies': [ 'lib' ], + 'sources': [ 'my_main_file.cc' ], + 'xcode_settings': { + 'ARCHS': [ 'x86_64' ], + }, + }, + ] +} diff --git a/tools/gyp/test/mac/archs/test-no-archs.gyp b/tools/gyp/test/mac/archs/test-no-archs.gyp new file mode 100644 index 000000000..8f3b6b47c --- /dev/null +++ b/tools/gyp/test/mac/archs/test-no-archs.gyp @@ -0,0 +1,21 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'lib', + 'product_name': 'Test', + 'type': 'static_library', + 'sources': [ 'my_file.cc' ], + }, + { + 'target_name': 'exe', + 'product_name': 'Test', + 'type': 'executable', + 'dependencies': [ 'lib' ], + 'sources': [ 'my_main_file.cc' ], + }, + ] +} diff --git a/tools/gyp/test/mac/cflags/ccfile.cc b/tools/gyp/test/mac/cflags/ccfile.cc new file mode 100644 index 000000000..1a54d18ee --- /dev/null +++ b/tools/gyp/test/mac/cflags/ccfile.cc @@ -0,0 +1,7 @@ +#ifdef CFLAG +#error CFLAG should not be set +#endif + +#ifndef CCFLAG +#error CCFLAG should be set +#endif diff --git a/tools/gyp/test/mac/cflags/ccfile_withcflags.cc b/tools/gyp/test/mac/cflags/ccfile_withcflags.cc new file mode 100644 index 000000000..de078a064 --- /dev/null +++ b/tools/gyp/test/mac/cflags/ccfile_withcflags.cc @@ -0,0 +1,7 @@ +#ifndef CFLAG +#error CFLAG should be set +#endif + +#ifndef CCFLAG +#error CCFLAG should be set +#endif diff --git a/tools/gyp/test/mac/cflags/cfile.c b/tools/gyp/test/mac/cflags/cfile.c new file mode 100644 index 000000000..0af9d0af5 --- /dev/null +++ b/tools/gyp/test/mac/cflags/cfile.c @@ -0,0 +1,7 @@ +#ifndef CFLAG +#error CFLAG should be set +#endif + +#ifdef CCFLAG +#error CCFLAG should not be set +#endif diff --git a/tools/gyp/test/mac/cflags/cppfile.cpp b/tools/gyp/test/mac/cflags/cppfile.cpp new file mode 100644 index 000000000..1a54d18ee --- /dev/null +++ b/tools/gyp/test/mac/cflags/cppfile.cpp @@ -0,0 +1,7 @@ +#ifdef CFLAG +#error CFLAG should not be set +#endif + +#ifndef CCFLAG +#error CCFLAG should be set +#endif diff --git a/tools/gyp/test/mac/cflags/cppfile_withcflags.cpp b/tools/gyp/test/mac/cflags/cppfile_withcflags.cpp new file mode 100644 index 000000000..de078a064 --- /dev/null +++ b/tools/gyp/test/mac/cflags/cppfile_withcflags.cpp @@ -0,0 +1,7 @@ +#ifndef CFLAG +#error CFLAG should be set +#endif + +#ifndef CCFLAG +#error CCFLAG should be set +#endif diff --git a/tools/gyp/test/mac/cflags/cxxfile.cxx b/tools/gyp/test/mac/cflags/cxxfile.cxx new file mode 100644 index 000000000..1a54d18ee --- /dev/null +++ b/tools/gyp/test/mac/cflags/cxxfile.cxx @@ -0,0 +1,7 @@ +#ifdef CFLAG +#error CFLAG should not be set +#endif + +#ifndef CCFLAG +#error CCFLAG should be set +#endif diff --git a/tools/gyp/test/mac/cflags/cxxfile_withcflags.cxx b/tools/gyp/test/mac/cflags/cxxfile_withcflags.cxx new file mode 100644 index 000000000..de078a064 --- /dev/null +++ b/tools/gyp/test/mac/cflags/cxxfile_withcflags.cxx @@ -0,0 +1,7 @@ +#ifndef CFLAG +#error CFLAG should be set +#endif + +#ifndef CCFLAG +#error CCFLAG should be set +#endif diff --git a/tools/gyp/test/mac/cflags/mfile.m b/tools/gyp/test/mac/cflags/mfile.m new file mode 100644 index 000000000..0af9d0af5 --- /dev/null +++ b/tools/gyp/test/mac/cflags/mfile.m @@ -0,0 +1,7 @@ +#ifndef CFLAG +#error CFLAG should be set +#endif + +#ifdef CCFLAG +#error CCFLAG should not be set +#endif diff --git a/tools/gyp/test/mac/cflags/mmfile.mm b/tools/gyp/test/mac/cflags/mmfile.mm new file mode 100644 index 000000000..1a54d18ee --- /dev/null +++ b/tools/gyp/test/mac/cflags/mmfile.mm @@ -0,0 +1,7 @@ +#ifdef CFLAG +#error CFLAG should not be set +#endif + +#ifndef CCFLAG +#error CCFLAG should be set +#endif diff --git a/tools/gyp/test/mac/cflags/mmfile_withcflags.mm b/tools/gyp/test/mac/cflags/mmfile_withcflags.mm new file mode 100644 index 000000000..de078a064 --- /dev/null +++ b/tools/gyp/test/mac/cflags/mmfile_withcflags.mm @@ -0,0 +1,7 @@ +#ifndef CFLAG +#error CFLAG should be set +#endif + +#ifndef CCFLAG +#error CCFLAG should be set +#endif diff --git a/tools/gyp/test/mac/cflags/test.gyp b/tools/gyp/test/mac/cflags/test.gyp new file mode 100644 index 000000000..6b04b5f2f --- /dev/null +++ b/tools/gyp/test/mac/cflags/test.gyp @@ -0,0 +1,119 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'mytarget', + 'type': 'shared_library', + 'sources': [ + 'cfile.c', + 'mfile.m', + 'ccfile.cc', + 'cppfile.cpp', + 'cxxfile.cxx', + 'mmfile.mm', + ], + 'xcode_settings': { + # Normally, defines would go in 'defines' instead. This is just for + # testing. + 'OTHER_CFLAGS': [ + '-DCFLAG', + ], + 'OTHER_CPLUSPLUSFLAGS': [ + '-DCCFLAG', + ], + 'GCC_C_LANGUAGE_STANDARD': 'c99', + }, + }, + { + 'target_name': 'mytarget_reuse_cflags', + 'type': 'shared_library', + 'sources': [ + 'cfile.c', + 'mfile.m', + 'ccfile_withcflags.cc', + 'cppfile_withcflags.cpp', + 'cxxfile_withcflags.cxx', + 'mmfile_withcflags.mm', + ], + 'xcode_settings': { + 'OTHER_CFLAGS': [ + '-DCFLAG', + ], + 'OTHER_CPLUSPLUSFLAGS': [ + '$OTHER_CFLAGS', + '-DCCFLAG', + ], + # This is a C-only flag, to check these don't get added to C++ files. + 'GCC_C_LANGUAGE_STANDARD': 'c99', + }, + }, + { + 'target_name': 'mytarget_inherit_cflags', + 'type': 'shared_library', + 'sources': [ + 'cfile.c', + 'mfile.m', + 'ccfile_withcflags.cc', + 'cppfile_withcflags.cpp', + 'cxxfile_withcflags.cxx', + 'mmfile_withcflags.mm', + ], + 'xcode_settings': { + 'OTHER_CFLAGS': [ + '-DCFLAG', + ], + 'OTHER_CPLUSPLUSFLAGS': [ + '$inherited', + '-DCCFLAG', + ], + 'GCC_C_LANGUAGE_STANDARD': 'c99', + }, + }, + { + 'target_name': 'mytarget_inherit_cflags_parens', + 'type': 'shared_library', + 'sources': [ + 'cfile.c', + 'mfile.m', + 'ccfile_withcflags.cc', + 'cppfile_withcflags.cpp', + 'cxxfile_withcflags.cxx', + 'mmfile_withcflags.mm', + ], + 'xcode_settings': { + 'OTHER_CFLAGS': [ + '-DCFLAG', + ], + 'OTHER_CPLUSPLUSFLAGS': [ + '$(inherited)', + '-DCCFLAG', + ], + 'GCC_C_LANGUAGE_STANDARD': 'c99', + }, + }, + { + 'target_name': 'mytarget_inherit_cflags_braces', + 'type': 'shared_library', + 'sources': [ + 'cfile.c', + 'mfile.m', + 'ccfile_withcflags.cc', + 'cppfile_withcflags.cpp', + 'cxxfile_withcflags.cxx', + 'mmfile_withcflags.mm', + ], + 'xcode_settings': { + 'OTHER_CFLAGS': [ + '-DCFLAG', + ], + 'OTHER_CPLUSPLUSFLAGS': [ + '${inherited}', + '-DCCFLAG', + ], + 'GCC_C_LANGUAGE_STANDARD': 'c99', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/copy-dylib/empty.c b/tools/gyp/test/mac/copy-dylib/empty.c new file mode 100644 index 000000000..237c8ce18 --- /dev/null +++ b/tools/gyp/test/mac/copy-dylib/empty.c @@ -0,0 +1 @@ +int main() {} diff --git a/tools/gyp/test/mac/copy-dylib/test.gyp b/tools/gyp/test/mac/copy-dylib/test.gyp new file mode 100644 index 000000000..4210c5146 --- /dev/null +++ b/tools/gyp/test/mac/copy-dylib/test.gyp @@ -0,0 +1,31 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'my_dylib', + 'type': 'shared_library', + 'sources': [ 'empty.c', ], + }, + { + 'target_name': 'test_app', + 'product_name': 'Test App', + 'type': 'executable', + 'mac_bundle': 1, + 'dependencies': [ 'my_dylib', ], + 'sources': [ + 'empty.c', + ], + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/Test App.app/Contents/Resources', + 'files': [ + '<(PRODUCT_DIR)/libmy_dylib.dylib', + ], + }, + ], + }, + ], +} + diff --git a/tools/gyp/test/mac/debuginfo/file.c b/tools/gyp/test/mac/debuginfo/file.c new file mode 100644 index 000000000..9cddaf1b0 --- /dev/null +++ b/tools/gyp/test/mac/debuginfo/file.c @@ -0,0 +1,6 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +void f() {} +int main() {} diff --git a/tools/gyp/test/mac/debuginfo/test.gyp b/tools/gyp/test/mac/debuginfo/test.gyp new file mode 100644 index 000000000..3faf6b5c7 --- /dev/null +++ b/tools/gyp/test/mac/debuginfo/test.gyp @@ -0,0 +1,82 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'nonbundle_static_library', + 'type': 'static_library', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + }, + }, + { + 'target_name': 'nonbundle_shared_library', + 'type': 'shared_library', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + }, + }, + { + 'target_name': 'nonbundle_loadable_module', + 'type': 'loadable_module', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + }, + }, + { + 'target_name': 'nonbundle_executable', + 'type': 'executable', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + }, + }, + + { + 'target_name': 'bundle_shared_library', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + }, + }, + { + 'target_name': 'bundle_loadable_module', + 'type': 'loadable_module', + 'mac_bundle': 1, + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + }, + }, + { + 'target_name': 'my_app', + 'product_name': 'My App', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/depend-on-bundle/English.lproj/InfoPlist.strings b/tools/gyp/test/mac/depend-on-bundle/English.lproj/InfoPlist.strings new file mode 100644 index 000000000..b92732c79 --- /dev/null +++ b/tools/gyp/test/mac/depend-on-bundle/English.lproj/InfoPlist.strings @@ -0,0 +1 @@ +/* Localized versions of Info.plist keys */ diff --git a/tools/gyp/test/mac/depend-on-bundle/Info.plist b/tools/gyp/test/mac/depend-on-bundle/Info.plist new file mode 100644 index 000000000..5e05a5190 --- /dev/null +++ b/tools/gyp/test/mac/depend-on-bundle/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSPrincipalClass + + + diff --git a/tools/gyp/test/mac/depend-on-bundle/bundle.c b/tools/gyp/test/mac/depend-on-bundle/bundle.c new file mode 100644 index 000000000..d64ff8ca2 --- /dev/null +++ b/tools/gyp/test/mac/depend-on-bundle/bundle.c @@ -0,0 +1 @@ +int f() { return 42; } diff --git a/tools/gyp/test/mac/depend-on-bundle/executable.c b/tools/gyp/test/mac/depend-on-bundle/executable.c new file mode 100644 index 000000000..931bce637 --- /dev/null +++ b/tools/gyp/test/mac/depend-on-bundle/executable.c @@ -0,0 +1,4 @@ +int f(); +int main() { + return f(); +} diff --git a/tools/gyp/test/mac/depend-on-bundle/test.gyp b/tools/gyp/test/mac/depend-on-bundle/test.gyp new file mode 100644 index 000000000..e00b10541 --- /dev/null +++ b/tools/gyp/test/mac/depend-on-bundle/test.gyp @@ -0,0 +1,28 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'my_bundle', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'bundle.c' ], + 'mac_bundle_resources': [ + 'English.lproj/InfoPlist.strings', + ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'Info.plist', + } + }, + { + 'target_name': 'dependent_on_bundle', + 'type': 'executable', + 'sources': [ 'executable.c' ], + 'dependencies': [ + 'my_bundle', + ], + }, + ], +} + diff --git a/tools/gyp/test/mac/framework-headers/myframework.h b/tools/gyp/test/mac/framework-headers/myframework.h new file mode 100644 index 000000000..961fc701b --- /dev/null +++ b/tools/gyp/test/mac/framework-headers/myframework.h @@ -0,0 +1,8 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import + +@interface TestObject : NSObject +@end diff --git a/tools/gyp/test/mac/framework-headers/myframework.m b/tools/gyp/test/mac/framework-headers/myframework.m new file mode 100644 index 000000000..13d53a37a --- /dev/null +++ b/tools/gyp/test/mac/framework-headers/myframework.m @@ -0,0 +1,8 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "myframework.h" + +@implementation TestObject +@end diff --git a/tools/gyp/test/mac/framework-headers/test.gyp b/tools/gyp/test/mac/framework-headers/test.gyp new file mode 100644 index 000000000..70ed00715 --- /dev/null +++ b/tools/gyp/test/mac/framework-headers/test.gyp @@ -0,0 +1,44 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'test_framework_headers_framework', + 'product_name': 'TestFramework', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ + 'myframework.h', + 'myframework.m', + ], + 'mac_framework_headers': [ + 'myframework.h', + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/Foundation.framework', + ], + }, + },{ + 'target_name': 'test_framework_headers_static', + 'product_name': 'TestLibrary', + 'type': 'static_library', + 'xcode_settings': { + 'PUBLIC_HEADERS_FOLDER_PATH': 'include', + }, + 'sources': [ + 'myframework.h', + 'myframework.m', + ], + 'mac_framework_headers': [ + 'myframework.h', + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/Foundation.framework', + ], + }, + }, + ], +} diff --git a/tools/gyp/test/mac/framework/TestFramework/English.lproj/InfoPlist.strings b/tools/gyp/test/mac/framework/TestFramework/English.lproj/InfoPlist.strings new file mode 100644 index 000000000..88f65cf6e --- /dev/null +++ b/tools/gyp/test/mac/framework/TestFramework/English.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/tools/gyp/test/mac/framework/TestFramework/Info.plist b/tools/gyp/test/mac/framework/TestFramework/Info.plist new file mode 100644 index 000000000..5e05a5190 --- /dev/null +++ b/tools/gyp/test/mac/framework/TestFramework/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSPrincipalClass + + + diff --git a/tools/gyp/test/mac/framework/TestFramework/ObjCVector.h b/tools/gyp/test/mac/framework/TestFramework/ObjCVector.h new file mode 100644 index 000000000..c2450960c --- /dev/null +++ b/tools/gyp/test/mac/framework/TestFramework/ObjCVector.h @@ -0,0 +1,28 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import + +#ifdef __cplusplus +struct ObjCVectorImp; +#else +typedef struct _ObjCVectorImpT ObjCVectorImp; +#endif + +@interface ObjCVector : NSObject { + @private + ObjCVectorImp* imp_; +} + +- (id)init; + +- (void)addObject:(id)obj; +- (void)addObject:(id)obj atIndex:(NSUInteger)index; + +- (void)removeObject:(id)obj; +- (void)removeObjectAtIndex:(NSUInteger)index; + +- (id)objectAtIndex:(NSUInteger)index; + +@end diff --git a/tools/gyp/test/mac/framework/TestFramework/ObjCVector.mm b/tools/gyp/test/mac/framework/TestFramework/ObjCVector.mm new file mode 100644 index 000000000..cbf431f28 --- /dev/null +++ b/tools/gyp/test/mac/framework/TestFramework/ObjCVector.mm @@ -0,0 +1,63 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ObjCVectorInternal.h" +#import "ObjCVector.h" + +#include + +@interface ObjCVector (Private) +- (std::vector::iterator)makeIterator:(NSUInteger)index; +@end + +@implementation ObjCVector + +- (id)init { + if ((self = [super init])) { + imp_ = new ObjCVectorImp(); + } + return self; +} + +- (void)dealloc { + delete imp_; + [super dealloc]; +} + +- (void)addObject:(id)obj { + imp_->v.push_back([obj retain]); +} + +- (void)addObject:(id)obj atIndex:(NSUInteger)index { + imp_->v.insert([self makeIterator:index], [obj retain]); +} + +- (void)removeObject:(id)obj { + for (std::vector::iterator it = imp_->v.begin(); + it != imp_->v.end(); + ++it) { + if ([*it isEqual:obj]) { + [*it autorelease]; + imp_->v.erase(it); + return; + } + } +} + +- (void)removeObjectAtIndex:(NSUInteger)index { + [imp_->v[index] autorelease]; + imp_->v.erase([self makeIterator:index]); +} + +- (id)objectAtIndex:(NSUInteger)index { + return imp_->v[index]; +} + +- (std::vector::iterator)makeIterator:(NSUInteger)index { + std::vector::iterator it = imp_->v.begin(); + it += index; + return it; +} + +@end diff --git a/tools/gyp/test/mac/framework/TestFramework/ObjCVectorInternal.h b/tools/gyp/test/mac/framework/TestFramework/ObjCVectorInternal.h new file mode 100644 index 000000000..fb6c98258 --- /dev/null +++ b/tools/gyp/test/mac/framework/TestFramework/ObjCVectorInternal.h @@ -0,0 +1,9 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +struct ObjCVectorImp { + std::vector v; +}; diff --git a/tools/gyp/test/mac/framework/TestFramework/TestFramework_Prefix.pch b/tools/gyp/test/mac/framework/TestFramework/TestFramework_Prefix.pch new file mode 100644 index 000000000..394f41d95 --- /dev/null +++ b/tools/gyp/test/mac/framework/TestFramework/TestFramework_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'TestFramework' target in the 'TestFramework' project. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/tools/gyp/test/mac/framework/empty.c b/tools/gyp/test/mac/framework/empty.c new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/mac/framework/framework.gyp b/tools/gyp/test/mac/framework/framework.gyp new file mode 100644 index 000000000..7480e526c --- /dev/null +++ b/tools/gyp/test/mac/framework/framework.gyp @@ -0,0 +1,74 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'dep_framework', + 'product_name': 'Dependency Bundle', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'empty.c', ], + }, + { + 'target_name': 'test_framework', + 'product_name': 'Test Framework', + 'type': 'shared_library', + 'mac_bundle': 1, + 'dependencies': [ 'dep_framework', ], + 'sources': [ + 'TestFramework/ObjCVector.h', + 'TestFramework/ObjCVectorInternal.h', + 'TestFramework/ObjCVector.mm', + ], + 'mac_framework_headers': [ + 'TestFramework/ObjCVector.h', + ], + 'mac_bundle_resources': [ + 'TestFramework/English.lproj/InfoPlist.strings', + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', + ], + }, + 'xcode_settings': { + 'INFOPLIST_FILE': 'TestFramework/Info.plist', + 'GCC_DYNAMIC_NO_PIC': 'NO', + }, + 'copies': [ + # Test copying to a file that has envvars in its dest path. + # Needs to be in a mac_bundle target, else CONTENTS_FOLDER_PATH isn't + # set. + { + 'destination': '<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Libraries', + 'files': [ + 'empty.c', + ], + }, + ], + }, + { + 'target_name': 'copy_target', + 'type': 'none', + 'dependencies': [ 'test_framework', 'dep_framework', ], + 'copies': [ + # Test copying directories with spaces in src and dest paths. + { + 'destination': '<(PRODUCT_DIR)/Test Framework.framework/foo', + 'files': [ + '<(PRODUCT_DIR)/Dependency Bundle.framework', + ], + }, + ], + 'actions': [ + { + 'action_name': 'aektschn', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/touched_file'], + 'action': ['touch', '${BUILT_PRODUCTS_DIR}/action_file'], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/mac/global-settings/src/dir1/dir1.gyp b/tools/gyp/test/mac/global-settings/src/dir1/dir1.gyp new file mode 100644 index 000000000..153e34ddd --- /dev/null +++ b/tools/gyp/test/mac/global-settings/src/dir1/dir1.gyp @@ -0,0 +1,11 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'dir1_target', + 'type': 'none', + }, + ], +} diff --git a/tools/gyp/test/mac/global-settings/src/dir2/dir2.gyp b/tools/gyp/test/mac/global-settings/src/dir2/dir2.gyp new file mode 100644 index 000000000..cda46c839 --- /dev/null +++ b/tools/gyp/test/mac/global-settings/src/dir2/dir2.gyp @@ -0,0 +1,22 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'dir2_target', + 'type': 'none', + 'dependencies': [ + '../dir1/dir1.gyp:dir1_target', + ], + 'actions': [ + { + 'inputs': [ ], + 'outputs': [ '<(PRODUCT_DIR)/file.txt' ], + 'action_name': 'Test action', + 'action': ['cp', 'file.txt', '${BUILT_PRODUCTS_DIR}/file.txt' ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/mac/global-settings/src/dir2/file.txt b/tools/gyp/test/mac/global-settings/src/dir2/file.txt new file mode 100644 index 000000000..58da2d8e9 --- /dev/null +++ b/tools/gyp/test/mac/global-settings/src/dir2/file.txt @@ -0,0 +1 @@ +File. diff --git a/tools/gyp/test/mac/gyptest-action-envvars.py b/tools/gyp/test/mac/gyptest-action-envvars.py new file mode 100644 index 000000000..b4f37c43a --- /dev/null +++ b/tools/gyp/test/mac/gyptest-action-envvars.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that env vars work with actions, with relative directory paths. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + CHDIR = 'action-envvars' + test.run_gyp('action/action.gyp', chdir=CHDIR) + test.build('action/action.gyp', 'action', chdir=CHDIR, SYMROOT='../build') + + result_file = test.built_file_path('result', chdir=CHDIR) + test.must_exist(result_file) + test.must_contain(result_file, 'Test output') + + other_result_file = test.built_file_path('other_result', chdir=CHDIR) + test.must_exist(other_result_file) + test.must_contain(other_result_file, 'Other output') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-app.py b/tools/gyp/test/mac/gyptest-app.py new file mode 100755 index 000000000..a93b156a7 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-app.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that app bundles are built correctly. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('test.gyp', chdir='app-bundle') + + test.build('test.gyp', test.ALL, chdir='app-bundle') + + # Binary + test.built_file_must_exist('Test App Gyp.app/Contents/MacOS/Test App Gyp', + chdir='app-bundle') + + # Info.plist + info_plist = test.built_file_path('Test App Gyp.app/Contents/Info.plist', + chdir='app-bundle') + test.must_exist(info_plist) + test.must_contain(info_plist, 'com.google.Test App Gyp') # Variable expansion + + # Resources + test.built_file_must_exist( + 'Test App Gyp.app/Contents/Resources/English.lproj/InfoPlist.strings', + chdir='app-bundle') + test.built_file_must_exist( + 'Test App Gyp.app/Contents/Resources/English.lproj/MainMenu.nib', + chdir='app-bundle') + + # Packaging + test.built_file_must_exist('Test App Gyp.app/Contents/PkgInfo', + chdir='app-bundle') + test.built_file_must_match('Test App Gyp.app/Contents/PkgInfo', 'APPLause', + chdir='app-bundle') + + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-archs.py b/tools/gyp/test/mac/gyptest-archs.py new file mode 100644 index 000000000..781e9ef16 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-archs.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Tests things related to ARCHS. +""" + +import TestGyp + +import subprocess +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + def CheckFileType(file, expected): + proc = subprocess.Popen(['file', '-b', file], stdout=subprocess.PIPE) + o = proc.communicate()[0].strip() + assert not proc.returncode + if o != expected: + print 'File: Expected %s, got %s' % (expected, o) + test.fail_test() + + test.run_gyp('test-no-archs.gyp', chdir='archs') + test.build('test-no-archs.gyp', test.ALL, chdir='archs') + result_file = test.built_file_path('Test', chdir='archs') + test.must_exist(result_file) + CheckFileType(result_file, 'Mach-O executable i386') + + test.run_gyp('test-archs-x86_64.gyp', chdir='archs') + test.build('test-archs-x86_64.gyp', test.ALL, chdir='archs') + result_file = test.built_file_path('Test64', chdir='archs') + test.must_exist(result_file) + CheckFileType(result_file, 'Mach-O 64-bit executable x86_64') diff --git a/tools/gyp/test/mac/gyptest-cflags.py b/tools/gyp/test/mac/gyptest-cflags.py new file mode 100644 index 000000000..388832298 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-cflags.py @@ -0,0 +1,21 @@ + +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that compile-time flags work. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + CHDIR = 'cflags' + test.run_gyp('test.gyp', chdir=CHDIR) + test.build('test.gyp', test.ALL, chdir=CHDIR) + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-copies.py b/tools/gyp/test/mac/gyptest-copies.py new file mode 100755 index 000000000..c88065ead --- /dev/null +++ b/tools/gyp/test/mac/gyptest-copies.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that 'copies' with app bundles are handled correctly. +""" + +import TestGyp + +import os +import sys +import time + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('framework.gyp', chdir='framework') + + test.build('framework.gyp', 'copy_target', chdir='framework') + + # Check that the copy succeeded. + test.built_file_must_exist( + 'Test Framework.framework/foo/Dependency Bundle.framework', + chdir='framework') + test.built_file_must_exist( + 'Test Framework.framework/foo/Dependency Bundle.framework/Versions/A', + chdir='framework') + test.built_file_must_exist( + 'Test Framework.framework/Versions/A/Libraries/empty.c', + chdir='framework') + + + # Check that rebuilding the target a few times works. + dep_bundle = test.built_file_path('Dependency Bundle.framework', + chdir='framework') + mtime = os.path.getmtime(dep_bundle) + atime = os.path.getatime(dep_bundle) + for i in range(3): + os.utime(dep_bundle, (atime + i * 1000, mtime + i * 1000)) + test.build('framework.gyp', 'copy_target', chdir='framework') + + + # Check that actions ran. + test.built_file_must_exist('action_file', chdir='framework') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-copy-dylib.py b/tools/gyp/test/mac/gyptest-copy-dylib.py new file mode 100644 index 000000000..253623d1c --- /dev/null +++ b/tools/gyp/test/mac/gyptest-copy-dylib.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that dylibs can be copied into app bundles. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('test.gyp', chdir='copy-dylib') + + test.build('test.gyp', 'test_app', chdir='copy-dylib') + + test.built_file_must_exist( + 'Test App.app/Contents/Resources/libmy_dylib.dylib', chdir='copy-dylib') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-debuginfo.py b/tools/gyp/test/mac/gyptest-debuginfo.py new file mode 100755 index 000000000..a0e9438e2 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-debuginfo.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Tests things related to debug information generation. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('test.gyp', chdir='debuginfo') + + test.build('test.gyp', test.ALL, chdir='debuginfo') + + test.built_file_must_exist('libnonbundle_shared_library.dylib.dSYM', + chdir='debuginfo') + test.built_file_must_exist('nonbundle_loadable_module.so.dSYM', + chdir='debuginfo') + test.built_file_must_exist('nonbundle_executable.dSYM', + chdir='debuginfo') + + test.built_file_must_exist('bundle_shared_library.framework.dSYM', + chdir='debuginfo') + test.built_file_must_exist('bundle_loadable_module.bundle.dSYM', + chdir='debuginfo') + test.built_file_must_exist('My App.app.dSYM', + chdir='debuginfo') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-depend-on-bundle.py b/tools/gyp/test/mac/gyptest-depend-on-bundle.py new file mode 100644 index 000000000..5cccb0322 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-depend-on-bundle.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that a dependency on a bundle causes the whole bundle to be built. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('test.gyp', chdir='depend-on-bundle') + + test.build('test.gyp', 'dependent_on_bundle', chdir='depend-on-bundle') + + # Binary itself. + test.built_file_must_exist('dependent_on_bundle', chdir='depend-on-bundle') + + # Bundle dependency. + test.built_file_must_exist( + 'my_bundle.framework/Versions/A/my_bundle', + chdir='depend-on-bundle') + test.built_file_must_exist( # package_framework + 'my_bundle.framework/my_bundle', + chdir='depend-on-bundle') + test.built_file_must_exist( # plist + 'my_bundle.framework/Versions/A/Resources/Info.plist', + chdir='depend-on-bundle') + test.built_file_must_exist( + 'my_bundle.framework/Versions/A/Resources/English.lproj/' # Resources + 'InfoPlist.strings', + chdir='depend-on-bundle') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-framework-headers.py b/tools/gyp/test/mac/gyptest-framework-headers.py new file mode 100644 index 000000000..aa13a742c --- /dev/null +++ b/tools/gyp/test/mac/gyptest-framework-headers.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that mac_framework_headers works properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + # TODO(thakis): Make this work with ninja, make. http://crbug.com/129013 + test = TestGyp.TestGyp(formats=['xcode']) + + CHDIR = 'framework-headers' + test.run_gyp('test.gyp', chdir=CHDIR) + + # Test that headers are installed for frameworks + test.build('test.gyp', 'test_framework_headers_framework', chdir=CHDIR) + + test.built_file_must_exist( + 'TestFramework.framework/Versions/A/TestFramework', chdir=CHDIR) + + test.built_file_must_exist( + 'TestFramework.framework/Versions/A/Headers/myframework.h', chdir=CHDIR) + + # Test that headers are installed for static libraries. + test.build('test.gyp', 'test_framework_headers_static', chdir=CHDIR) + + test.built_file_must_exist('libTestLibrary.a', chdir=CHDIR) + + test.built_file_must_exist('include/myframework.h', chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-framework.py b/tools/gyp/test/mac/gyptest-framework.py new file mode 100755 index 000000000..e4342d842 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-framework.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that app bundles are built correctly. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('framework.gyp', chdir='framework') + + test.build('framework.gyp', 'test_framework', chdir='framework') + + # Binary + test.built_file_must_exist( + 'Test Framework.framework/Versions/A/Test Framework', + chdir='framework') + + # Info.plist + test.built_file_must_exist( + 'Test Framework.framework/Versions/A/Resources/Info.plist', + chdir='framework') + + # Resources + test.built_file_must_exist( + 'Test Framework.framework/Versions/A/Resources/English.lproj/' + 'InfoPlist.strings', + chdir='framework') + + # Symlinks created by packaging process + test.built_file_must_exist('Test Framework.framework/Versions/Current', + chdir='framework') + test.built_file_must_exist('Test Framework.framework/Resources', + chdir='framework') + test.built_file_must_exist('Test Framework.framework/Test Framework', + chdir='framework') + # PkgInfo. + test.built_file_must_not_exist( + 'Test Framework.framework/Versions/A/Resources/PkgInfo', + chdir='framework') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-global-settings.py b/tools/gyp/test/mac/gyptest-global-settings.py new file mode 100644 index 000000000..648d32cde --- /dev/null +++ b/tools/gyp/test/mac/gyptest-global-settings.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that the global xcode_settings processing doesn't throw. +Regression test for http://crbug.com/109163 +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + test.run_gyp('src/dir2/dir2.gyp', chdir='global-settings', depth='src') + # run_gyp shouldn't throw. + + # Check that BUILT_PRODUCTS_DIR was set correctly, too. + test.build('dir2/dir2.gyp', 'dir2_target', chdir='global-settings/src', + SYMROOT='../build') + test.built_file_must_exist('file.txt', chdir='global-settings/src') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-infoplist-process.py b/tools/gyp/test/mac/gyptest-infoplist-process.py new file mode 100755 index 000000000..20874a398 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-infoplist-process.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies the Info.plist preprocessor functionality. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + CHDIR = 'infoplist-process' + INFO_PLIST_PATH = 'Test.app/Contents/Info.plist' + + # First process both keys. + test.set_configuration('One') + test.run_gyp('test1.gyp', chdir=CHDIR) + test.build('test1.gyp', test.ALL, chdir=CHDIR) + info_plist = test.built_file_path(INFO_PLIST_PATH, chdir=CHDIR) + test.must_exist(info_plist) + test.must_contain(info_plist, 'Foo') + test.must_contain(info_plist, 'Bar') + + # Then process a single key. + test.set_configuration('Two') + test.run_gyp('test2.gyp', chdir=CHDIR) + test.build('test2.gyp', chdir=CHDIR) + info_plist = test.built_file_path(INFO_PLIST_PATH, chdir=CHDIR) + test.must_exist(info_plist) + test.must_contain(info_plist, 'com.google.Test') # Normal expansion works. + test.must_contain(info_plist, 'Foo (Bar)') + test.must_contain(info_plist, 'PROCESSED_KEY2') + + # Then turn off the processor. + test.set_configuration('Three') + test.run_gyp('test3.gyp', chdir=CHDIR) + test.build('test3.gyp', chdir=CHDIR) + info_plist = test.built_file_path('Test App.app/Contents/Info.plist', + chdir=CHDIR) + test.must_exist(info_plist) + test.must_contain(info_plist, 'com.google.Test') # Normal expansion works. + test.must_contain(info_plist, 'PROCESSED_KEY1') + test.must_contain(info_plist, 'PROCESSED_KEY2') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-installname.py b/tools/gyp/test/mac/gyptest-installname.py new file mode 100644 index 000000000..c300820f6 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-installname.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that LD_DYLIB_INSTALL_NAME and DYLIB_INSTALL_NAME_BASE are handled +correctly. +""" + +import TestGyp + +import re +import subprocess +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + CHDIR = 'installname' + test.run_gyp('test.gyp', chdir=CHDIR) + test.build('test.gyp', test.ALL, chdir=CHDIR) + + def GetInstallname(p): + p = test.built_file_path(p, chdir=CHDIR) + r = re.compile(r'cmd LC_ID_DYLIB.*?name (.*?) \(offset \d+\)', re.DOTALL) + proc = subprocess.Popen(['otool', '-l', p], stdout=subprocess.PIPE) + o = proc.communicate()[0] + assert not proc.returncode + m = r.search(o) + assert m + return m.group(1) + + if (GetInstallname('libdefault_installname.dylib') != + '/usr/local/lib/libdefault_installname.dylib'): + test.fail_test() + + if (GetInstallname('My Framework.framework/My Framework') != + '/Library/Frameworks/My Framework.framework/' + 'Versions/A/My Framework'): + test.fail_test() + + if (GetInstallname('libexplicit_installname.dylib') != + 'Trapped in a dynamiclib factory'): + test.fail_test() + + if (GetInstallname('libexplicit_installname_base.dylib') != + '@executable_path/../../../libexplicit_installname_base.dylib'): + test.fail_test() + + if (GetInstallname('My Other Framework.framework/My Other Framework') != + '@executable_path/../../../My Other Framework.framework/' + 'Versions/A/My Other Framework'): + test.fail_test() + + if (GetInstallname('libexplicit_installname_with_base.dylib') != + '/usr/local/lib/libexplicit_installname_with_base.dylib'): + test.fail_test() + + if (GetInstallname('libexplicit_installname_with_explicit_base.dylib') != + '@executable_path/../libexplicit_installname_with_explicit_base.dylib'): + test.fail_test() + + if (GetInstallname('libboth_base_and_installname.dylib') != + 'Still trapped in a dynamiclib factory'): + test.fail_test() + + if (GetInstallname('install_name_with_info_plist.framework/' + 'install_name_with_info_plist') != + '/Library/Frameworks/install_name_with_info_plist.framework/' + 'Versions/A/install_name_with_info_plist'): + test.fail_test() + + if ('DYLIB_INSTALL_NAME_BASE:standardizepath: command not found' in + test.stdout()): + test.fail_test() + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-ldflags.py b/tools/gyp/test/mac/gyptest-ldflags.py new file mode 100644 index 000000000..4da40490d --- /dev/null +++ b/tools/gyp/test/mac/gyptest-ldflags.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that filenames passed to various linker flags are converted into +build-directory relative paths correctly. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + CHDIR = 'ldflags' + test.run_gyp('subdirectory/test.gyp', chdir=CHDIR) + + test.build('subdirectory/test.gyp', test.ALL, chdir=CHDIR) + + test.pass_test() + + +# These flags from `man ld` couldl show up in OTHER_LDFLAGS and need path +# translation. +# +# Done: +# -exported_symbols_list filename +# -unexported_symbols_list file +# -reexported_symbols_list file +# -sectcreate segname sectname file +# +# Will be done on demand: +# -weak_library path_to_library +# -reexport_library path_to_library +# -lazy_library path_to_library +# -upward_library path_to_library +# -syslibroot rootdir +# -framework name[,suffix] +# -weak_framework name[,suffix] +# -reexport_framework name[,suffix] +# -lazy_framework name[,suffix] +# -upward_framework name[,suffix] +# -force_load path_to_archive +# -filelist file[,dirname] +# -dtrace file +# -order_file file # should use ORDER_FILE +# -exported_symbols_order file +# -bundle_loader executable # should use BUNDLE_LOADER +# -alias_list filename +# -seg_addr_table filename +# -dylib_file install_name:file_name +# -interposable_list filename +# -object_path_lto filename +# +# +# obsolete: +# -sectorder segname sectname orderfile +# -seg_addr_table_filename path +# +# +# ??: +# -map map_file_path +# -sub_library library_name +# -sub_umbrella framework_name diff --git a/tools/gyp/test/mac/gyptest-libraries.py b/tools/gyp/test/mac/gyptest-libraries.py new file mode 100755 index 000000000..46814d65a --- /dev/null +++ b/tools/gyp/test/mac/gyptest-libraries.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies libraries (in link_settings) are properly found. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('subdir/test.gyp', chdir='libraries') + + test.build('subdir/test.gyp', test.ALL, chdir='libraries') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-loadable-module.py b/tools/gyp/test/mac/gyptest-loadable-module.py new file mode 100755 index 000000000..e5e022c9f --- /dev/null +++ b/tools/gyp/test/mac/gyptest-loadable-module.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Tests that a loadable_module target is built correctly. +""" + +import TestGyp + +import os +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('test.gyp', chdir='loadable-module') + test.build('test.gyp', test.ALL, chdir='loadable-module') + + # Binary. + test.built_file_must_exist( + 'test_loadable_module.plugin/Contents/MacOS/test_loadable_module', + chdir='loadable-module') + + # Info.plist. + info_plist = test.built_file_path( + 'test_loadable_module.plugin/Contents/Info.plist', + chdir='loadable-module') + test.must_exist(info_plist) + test.must_contain(info_plist, """ + CFBundleExecutable + test_loadable_module +""") + + # PkgInfo. + test.built_file_must_not_exist( + 'test_loadable_module.plugin/Contents/PkgInfo', + chdir='loadable-module') + test.built_file_must_not_exist( + 'test_loadable_module.plugin/Contents/Resources', + chdir='loadable-module') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-missing-cfbundlesignature.py b/tools/gyp/test/mac/gyptest-missing-cfbundlesignature.py new file mode 100644 index 000000000..ef7a8d1bd --- /dev/null +++ b/tools/gyp/test/mac/gyptest-missing-cfbundlesignature.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that an Info.plist with CFBundleSignature works. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('test.gyp', chdir='missing-cfbundlesignature') + test.build('test.gyp', test.ALL, chdir='missing-cfbundlesignature') + + test.built_file_must_match('mytarget.app/Contents/PkgInfo', 'APPL????', + chdir='missing-cfbundlesignature') + + test.built_file_must_match('myothertarget.app/Contents/PkgInfo', 'APPL????', + chdir='missing-cfbundlesignature') + + test.built_file_must_match('thirdtarget.app/Contents/PkgInfo', 'APPL????', + chdir='missing-cfbundlesignature') + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-non-strs-flattened-to-env.py b/tools/gyp/test/mac/gyptest-non-strs-flattened-to-env.py new file mode 100644 index 000000000..504dcd589 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-non-strs-flattened-to-env.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that list xcode_settings are flattened before being exported to the +environment. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + CHDIR = 'non-strs-flattened-to-env' + INFO_PLIST_PATH = 'Test.app/Contents/Info.plist' + + test.run_gyp('test.gyp', chdir=CHDIR) + test.build('test.gyp', test.ALL, chdir=CHDIR) + info_plist = test.built_file_path(INFO_PLIST_PATH, chdir=CHDIR) + test.must_exist(info_plist) + test.must_contain(info_plist, '''\ +\tMy Variable +\tsome expansion''') + test.must_contain(info_plist, '''\ +\tCFlags +\t-fstack-protector-all -fno-strict-aliasing -DS="A Space"''') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-objc-gc.py b/tools/gyp/test/mac/gyptest-objc-gc.py new file mode 100644 index 000000000..45df99a75 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-objc-gc.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that objc settings are handled correctly. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + # set |match| to ignore build stderr output. + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'], + match = lambda a, b: True) + + CHDIR = 'objc-gc' + test.run_gyp('test.gyp', chdir=CHDIR) + + build_error_code = { + 'xcode': [1, 65], # Linker error code. 1 on Xcode 3, 65 on Xcode 4 + 'make': 2, + 'ninja': 1, + }[test.format] + + test.build('test.gyp', 'gc_exe_fails', chdir=CHDIR, status=build_error_code) + test.build( + 'test.gyp', 'gc_off_exe_req_lib', chdir=CHDIR, status=build_error_code) + + test.build('test.gyp', 'gc_req_exe', chdir=CHDIR) + test.run_built_executable('gc_req_exe', chdir=CHDIR, stdout="gc on: 1\n") + + test.build('test.gyp', 'gc_exe_req_lib', chdir=CHDIR) + test.run_built_executable('gc_exe_req_lib', chdir=CHDIR, stdout="gc on: 1\n") + + test.build('test.gyp', 'gc_exe', chdir=CHDIR) + test.run_built_executable('gc_exe', chdir=CHDIR, stdout="gc on: 1\n") + + test.build('test.gyp', 'gc_off_exe', chdir=CHDIR) + test.run_built_executable('gc_off_exe', chdir=CHDIR, stdout="gc on: 0\n") + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-postbuild-copy-bundle.py b/tools/gyp/test/mac/gyptest-postbuild-copy-bundle.py new file mode 100644 index 000000000..0f63ad524 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-postbuild-copy-bundle.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that a postbuild copying a dependend framework into an app bundle is +rerun if the resources in the framework change. +""" + +import TestGyp + +import os.path +import sys + +if sys.platform == 'darwin': + # TODO(thakis): Make this pass with the make generator, http://crbug.com/95529 + test = TestGyp.TestGyp(formats=['ninja', 'xcode']) + + CHDIR = 'postbuild-copy-bundle' + test.run_gyp('test.gyp', chdir=CHDIR) + + app_bundle_dir = test.built_file_path('Test app.app', chdir=CHDIR) + bundled_framework_dir = os.path.join( + app_bundle_dir, 'Contents', 'My Framework.framework', 'Resources') + final_plist_path = os.path.join(bundled_framework_dir, 'Info.plist') + final_resource_path = os.path.join(bundled_framework_dir, 'resource_file.sb') + + # Check that the dependency was built and copied into the app bundle: + test.build('test.gyp', 'test_app', chdir=CHDIR) + test.must_exist(final_resource_path) + test.must_match(final_resource_path, + 'This is included in the framework bundle.\n') + + test.must_exist(final_plist_path) + test.must_contain(final_plist_path, '''\ +\tRandomKey +\tRandomValue''') + + # Touch the dependency's bundle resource, and check that the modification + # makes it all the way into the app bundle: + test.sleep() + test.write('postbuild-copy-bundle/resource_file.sb', 'New text\n') + test.build('test.gyp', 'test_app', chdir=CHDIR) + + test.must_exist(final_resource_path) + test.must_match(final_resource_path, 'New text\n') + + # Check the same for the plist file. + test.sleep() + contents = test.read('postbuild-copy-bundle/Framework-Info.plist') + contents = contents.replace('RandomValue', 'NewRandomValue') + test.write('postbuild-copy-bundle/Framework-Info.plist', contents) + test.build('test.gyp', 'test_app', chdir=CHDIR) + + test.must_exist(final_plist_path) + test.must_contain(final_plist_path, '''\ +\tRandomKey +\tNewRandomValue''') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-postbuild-defaults.py b/tools/gyp/test/mac/gyptest-postbuild-defaults.py new file mode 100644 index 000000000..0560904c2 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-postbuild-defaults.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that a postbuild invoking |defaults| works. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + CHDIR = 'postbuild-defaults' + test.run_gyp('test.gyp', chdir=CHDIR) + test.build('test.gyp', test.ALL, chdir=CHDIR) + + result_file = test.built_file_path('result', chdir=CHDIR) + test.must_exist(result_file) + test.must_contain(result_file, '''\ +Test +${PRODUCT_NAME} +''') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-postbuild-fail.py b/tools/gyp/test/mac/gyptest-postbuild-fail.py new file mode 100755 index 000000000..dba0d6f04 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-postbuild-fail.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that a failing postbuild step lets the build fail. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + # set |match| to ignore build stderr output. + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'], + match = lambda a, b: True) + + test.run_gyp('test.gyp', chdir='postbuild-fail') + + build_error_code = { + 'xcode': 1, + 'make': 2, + 'ninja': 1, + }[test.format] + + + # If a postbuild fails, all postbuilds should be re-run on the next build. + # However, even if the first postbuild fails the other postbuilds are still + # executed. + + + # Non-bundles + test.build('test.gyp', 'nonbundle', chdir='postbuild-fail', + status=build_error_code) + test.built_file_must_exist('static_touch', + chdir='postbuild-fail') + # Check for non-up-to-date-ness by checking if building again produces an + # error. + test.build('test.gyp', 'nonbundle', chdir='postbuild-fail', + status=build_error_code) + + + # Bundles + test.build('test.gyp', 'bundle', chdir='postbuild-fail', + status=build_error_code) + test.built_file_must_exist('dynamic_touch', + chdir='postbuild-fail') + # Check for non-up-to-date-ness by checking if building again produces an + # error. + test.build('test.gyp', 'bundle', chdir='postbuild-fail', + status=build_error_code) + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-postbuild-multiple-configurations.py b/tools/gyp/test/mac/gyptest-postbuild-multiple-configurations.py new file mode 100644 index 000000000..84694f36c --- /dev/null +++ b/tools/gyp/test/mac/gyptest-postbuild-multiple-configurations.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that a postbuild work in projects with multiple configurations. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + CHDIR = 'postbuild-multiple-configurations' + test.run_gyp('test.gyp', chdir=CHDIR) + + for configuration in ['Debug', 'Release']: + test.set_configuration(configuration) + test.build('test.gyp', test.ALL, chdir=CHDIR) + test.built_file_must_exist('postbuild-file', chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-postbuild-static-library.gyp b/tools/gyp/test/mac/gyptest-postbuild-static-library.gyp new file mode 100644 index 000000000..8f9a6ebcb --- /dev/null +++ b/tools/gyp/test/mac/gyptest-postbuild-static-library.gyp @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that a postbuilds on static libraries work, and that sourceless +libraries don't cause failures at gyp time. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['make', 'xcode']) + + CHDIR = 'postbuild-static-library' + test.run_gyp('test.gyp', chdir=CHDIR) + test.build('test.gyp', 'my_lib', chdir=CHDIR) + # Building my_sourceless_lib doesn't work with make. gyp should probably + # forbid sourceless static libraries, since they're pretty pointless. + # But they shouldn't cause gyp time exceptions. + + test.built_file_must_exist('postbuild-file', chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-postbuild.py b/tools/gyp/test/mac/gyptest-postbuild.py new file mode 100755 index 000000000..684e7b842 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-postbuild.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that postbuild steps work. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('test.gyp', chdir='postbuilds') + + test.build('test.gyp', test.ALL, chdir='postbuilds') + + # See comment in test/subdirectory/gyptest-subdir-default.py + if test.format == 'xcode': + chdir = 'postbuilds/subdirectory' + else: + chdir = 'postbuilds' + + # Created by the postbuild scripts + test.built_file_must_exist('el.a_touch', + type=test.STATIC_LIB, + chdir='postbuilds') + test.built_file_must_exist('el.a_gyp_touch', + type=test.STATIC_LIB, + chdir='postbuilds') + test.built_file_must_exist('nest_el.a_touch', + type=test.STATIC_LIB, + chdir=chdir) + test.built_file_must_exist( + 'dyna.framework/Versions/A/dyna_touch', + chdir='postbuilds') + test.built_file_must_exist( + 'dyna.framework/Versions/A/dyna_gyp_touch', + chdir='postbuilds') + test.built_file_must_exist( + 'nest_dyna.framework/Versions/A/nest_dyna_touch', + chdir=chdir) + test.built_file_must_exist('dyna_standalone.dylib_gyp_touch', + type=test.SHARED_LIB, + chdir='postbuilds') + test.built_file_must_exist('copied_file.txt', chdir='postbuilds') + test.built_file_must_exist('copied_file_2.txt', chdir=chdir) + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-prefixheader.py b/tools/gyp/test/mac/gyptest-prefixheader.py new file mode 100755 index 000000000..768551f9b --- /dev/null +++ b/tools/gyp/test/mac/gyptest-prefixheader.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that GCC_PREFIX_HEADER works. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + test.run_gyp('test.gyp', chdir='prefixheader') + test.build('test.gyp', test.ALL, chdir='prefixheader') + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-rebuild.py b/tools/gyp/test/mac/gyptest-rebuild.py new file mode 100755 index 000000000..0f26e9612 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-rebuild.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that app bundles are rebuilt correctly. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + CHDIR = 'rebuild' + test.run_gyp('test.gyp', chdir=CHDIR) + + test.build('test.gyp', 'test_app', chdir=CHDIR) + + # Touch a source file, rebuild, and check that the app target is up-to-date. + test.touch('rebuild/main.c') + test.build('test.gyp', 'test_app', chdir=CHDIR) + + test.up_to_date('test.gyp', 'test_app', chdir=CHDIR) + + # Xcode runs postbuilds on every build, so targets with postbuilds are + # never marked as up_to_date. + if test.format != 'xcode': + # Same for a framework bundle. + test.build('test.gyp', 'test_framework_postbuilds', chdir=CHDIR) + test.up_to_date('test.gyp', 'test_framework_postbuilds', chdir=CHDIR) + + # Test that an app bundle with a postbuild that touches the app binary needs + # to be built only once. + test.build('test.gyp', 'test_app_postbuilds', chdir=CHDIR) + test.up_to_date('test.gyp', 'test_app_postbuilds', chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-rpath.py b/tools/gyp/test/mac/gyptest-rpath.py new file mode 100644 index 000000000..2440d548e --- /dev/null +++ b/tools/gyp/test/mac/gyptest-rpath.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that LD_DYLIB_INSTALL_NAME and DYLIB_INSTALL_NAME_BASE are handled +correctly. +""" + +import TestGyp + +import re +import subprocess +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + CHDIR = 'rpath' + test.run_gyp('test.gyp', chdir=CHDIR) + test.build('test.gyp', test.ALL, chdir=CHDIR) + + def GetRpaths(p): + p = test.built_file_path(p, chdir=CHDIR) + r = re.compile(r'cmd LC_RPATH.*?path (.*?) \(offset \d+\)', re.DOTALL) + proc = subprocess.Popen(['otool', '-l', p], stdout=subprocess.PIPE) + o = proc.communicate()[0] + assert not proc.returncode + return r.findall(o) + + if (GetRpaths('libdefault_rpath.dylib') != []): + test.fail_test() + + if (GetRpaths('libexplicit_rpath.dylib') != ['@executable_path/.']): + test.fail_test() + + if (GetRpaths('libexplicit_rpaths_escaped.dylib') != + ['First rpath', 'Second rpath']): + test.fail_test() + + if (GetRpaths('My Framework.framework/My Framework') != ['@loader_path/.']): + test.fail_test() + + if (GetRpaths('executable') != ['@executable_path/.']): + test.fail_test() + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-sdkroot.py b/tools/gyp/test/mac/gyptest-sdkroot.py new file mode 100644 index 000000000..b4bef3e92 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-sdkroot.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that setting SDKROOT works. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('test.gyp', chdir='sdkroot') + test.build('test.gyp', test.ALL, chdir='sdkroot') + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-sourceless-module.gyp b/tools/gyp/test/mac/gyptest-sourceless-module.gyp new file mode 100644 index 000000000..c3ea73a17 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-sourceless-module.gyp @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that bundles that have no 'sources' (pure resource containers) work. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('test.gyp', chdir='sourceless-module') + + # Just needs to build without errors. + test.build('test.gyp', 'empty_bundle', chdir='sourceless-module') + test.built_file_must_not_exist( + 'empty_bundle.bundle', chdir='sourceless-module') + + # Needs to build, and contain a resource. + test.build('test.gyp', 'resource_bundle', chdir='sourceless-module') + + test.built_file_must_exist( + 'resource_bundle.bundle/Contents/Resources/foo.manifest', + chdir='sourceless-module') + test.built_file_must_not_exist( + 'resource_bundle.bundle/Contents/MacOS/resource_bundle', + chdir='sourceless-module') + + # Needs to build and cause the bundle to be built. + test.build( + 'test.gyp', 'dependent_on_resource_bundle', chdir='sourceless-module') + + test.built_file_must_exist( + 'resource_bundle.bundle/Contents/Resources/foo.manifest', + chdir='sourceless-module') + test.built_file_must_not_exist( + 'resource_bundle.bundle/Contents/MacOS/resource_bundle', + chdir='sourceless-module') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-strip.py b/tools/gyp/test/mac/gyptest-strip.py new file mode 100755 index 000000000..3a4683933 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-strip.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that stripping works. +""" + +import TestGyp + +import re +import subprocess +import sys +import time + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('test.gyp', chdir='strip') + + test.build('test.gyp', test.ALL, chdir='strip') + + # Lightweight check if stripping was done. + def OutPath(s): + return test.built_file_path(s, type=test.SHARED_LIB, chdir='strip') + + def CheckNsyms(p, n_expected): + r = re.compile(r'nsyms\s+(\d+)') + proc = subprocess.Popen(['otool', '-l', p], stdout=subprocess.PIPE) + o = proc.communicate()[0] + assert not proc.returncode + m = r.search(o) + n = int(m.group(1)) + if n != n_expected: + print 'Stripping: Expected %d symbols, got %d' % (n_expected, n) + test.fail_test() + + # The actual numbers here are not interesting, they just need to be the same + # in both the xcode and the make build. + CheckNsyms(OutPath('no_postprocess'), 11) + CheckNsyms(OutPath('no_strip'), 11) + CheckNsyms(OutPath('strip_all'), 0) + CheckNsyms(OutPath('strip_nonglobal'), 2) + CheckNsyms(OutPath('strip_debugging'), 3) + CheckNsyms(OutPath('strip_all_custom_flags'), 0) + CheckNsyms(test.built_file_path( + 'strip_all_bundle.framework/Versions/A/strip_all_bundle', chdir='strip'), + 0) + CheckNsyms(OutPath('strip_save'), 3) + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-type-envvars.py b/tools/gyp/test/mac/gyptest-type-envvars.py new file mode 100755 index 000000000..61596bae2 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-type-envvars.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Test that MACH_O_TYPE etc are set correctly. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + test.run_gyp('test.gyp', chdir='type_envvars') + + test.build('test.gyp', test.ALL, chdir='type_envvars') + + # The actual test is done by postbuild scripts during |test.build()|. + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-xcode-env-order.py b/tools/gyp/test/mac/gyptest-xcode-env-order.py new file mode 100755 index 000000000..d1c854287 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-xcode-env-order.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that dependent Xcode settings are processed correctly. +""" + +import TestGyp + +import sys + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + CHDIR = 'xcode-env-order' + INFO_PLIST_PATH = 'Test.app/Contents/Info.plist' + + test.run_gyp('test.gyp', chdir=CHDIR) + test.build('test.gyp', test.ALL, chdir=CHDIR) + + # Env vars in 'copies' filenames. + test.built_file_must_exist('Test-copy-brace/main.c', chdir=CHDIR) + test.built_file_must_exist('Test-copy-paren/main.c', chdir=CHDIR) + test.built_file_must_exist('Test-copy-bare/main.c', chdir=CHDIR) + + # Env vars in 'actions' filenames and inline actions + test.built_file_must_exist('action-copy-brace.txt', chdir=CHDIR) + test.built_file_must_exist('action-copy-paren.txt', chdir=CHDIR) + test.built_file_must_exist('action-copy-bare.txt', chdir=CHDIR) + + # Env vars in Info.plist. + info_plist = test.built_file_path(INFO_PLIST_PATH, chdir=CHDIR) + test.must_exist(info_plist) + + test.must_contain(info_plist, '''\ +\tBraceProcessedKey1 +\tD:/Source/Project/Test''') + test.must_contain(info_plist, '''\ +\tBraceProcessedKey2 +\t/Source/Project/Test''') + test.must_contain(info_plist, '''\ +\tBraceProcessedKey3 +\tcom.apple.product-type.application:D:/Source/Project/Test''') + + test.must_contain(info_plist, '''\ +\tParenProcessedKey1 +\tD:/Source/Project/Test''') + test.must_contain(info_plist, '''\ +\tParenProcessedKey2 +\t/Source/Project/Test''') + test.must_contain(info_plist, '''\ +\tParenProcessedKey3 +\tcom.apple.product-type.application:D:/Source/Project/Test''') + + test.must_contain(info_plist, '''\ +\tBareProcessedKey1 +\tD:/Source/Project/Test''') + test.must_contain(info_plist, '''\ +\tBareProcessedKey2 +\t/Source/Project/Test''') + # NOTE: For bare variables, $PRODUCT_TYPE is not replaced! It _is_ replaced + # if it's not right at the start of the string (e.g. ':$PRODUCT_TYPE'), so + # this looks like an Xcode bug. This bug isn't emulated (yet?), so check this + # only for Xcode. + if test.format == 'xcode': + test.must_contain(info_plist, '''\ +\tBareProcessedKey3 +\t$PRODUCT_TYPE:D:/Source/Project/Test''') + + test.must_contain(info_plist, '''\ +\tMixedProcessedKey +\t/Source/Project:Test:mh_execute''') + + test.pass_test() diff --git a/tools/gyp/test/mac/gyptest-xcode-gcc.py b/tools/gyp/test/mac/gyptest-xcode-gcc.py new file mode 100644 index 000000000..5f5de7608 --- /dev/null +++ b/tools/gyp/test/mac/gyptest-xcode-gcc.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that xcode-style GCC_... settings are handled properly. +""" + +import TestGyp + +import sys + +def IgnoreOutput(string, expected_string): + return True + +if sys.platform == 'darwin': + test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + + CHDIR = 'xcode-gcc' + test.run_gyp('test.gyp', chdir=CHDIR) + + # List of targets that'll pass. It expects targets of the same name with + # '-fail' appended that'll fail to build. + targets = [ + 'warn_about_invalid_offsetof_macro', + 'warn_about_missing_newline', + ] + + for target in targets: + test.build('test.gyp', target, chdir=CHDIR) + test.built_file_must_exist(target, chdir=CHDIR) + fail_target = target + '-fail' + test.build('test.gyp', fail_target, chdir=CHDIR, status=None, + stderr=None, match=IgnoreOutput) + test.built_file_must_not_exist(fail_target, chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/mac/infoplist-process/Info.plist b/tools/gyp/test/mac/infoplist-process/Info.plist new file mode 100644 index 000000000..cb65721f4 --- /dev/null +++ b/tools/gyp/test/mac/infoplist-process/Info.plist @@ -0,0 +1,36 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.google.${PRODUCT_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + ProcessedKey1 + PROCESSED_KEY1 + ProcessedKey2 + PROCESSED_KEY2 + + diff --git a/tools/gyp/test/mac/infoplist-process/main.c b/tools/gyp/test/mac/infoplist-process/main.c new file mode 100644 index 000000000..1bf4b2a11 --- /dev/null +++ b/tools/gyp/test/mac/infoplist-process/main.c @@ -0,0 +1,7 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + return 0; +} diff --git a/tools/gyp/test/mac/infoplist-process/test1.gyp b/tools/gyp/test/mac/infoplist-process/test1.gyp new file mode 100644 index 000000000..bc625a968 --- /dev/null +++ b/tools/gyp/test/mac/infoplist-process/test1.gyp @@ -0,0 +1,25 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'test_app', + 'product_name': 'Test', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ + 'main.c', + ], + 'configurations': { + 'One': { + }, + }, + 'xcode_settings': { + 'INFOPLIST_FILE': 'Info.plist', + 'INFOPLIST_PREPROCESS': 'YES', + 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'PROCESSED_KEY1=Foo PROCESSED_KEY2=Bar', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/infoplist-process/test2.gyp b/tools/gyp/test/mac/infoplist-process/test2.gyp new file mode 100644 index 000000000..ecfbc9f64 --- /dev/null +++ b/tools/gyp/test/mac/infoplist-process/test2.gyp @@ -0,0 +1,25 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'test_app', + 'product_name': 'Test', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ + 'main.c', + ], + 'configurations': { + 'Two': { + }, + }, + 'xcode_settings': { + 'INFOPLIST_FILE': 'Info.plist', + 'INFOPLIST_PREPROCESS': 'YES', + 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'PROCESSED_KEY1="Foo (Bar)"', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/infoplist-process/test3.gyp b/tools/gyp/test/mac/infoplist-process/test3.gyp new file mode 100644 index 000000000..be8fe75a5 --- /dev/null +++ b/tools/gyp/test/mac/infoplist-process/test3.gyp @@ -0,0 +1,25 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'test_app', + 'product_name': 'Test App', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ + 'main.c', + ], + 'configurations': { + 'Three': { + }, + }, + 'xcode_settings': { + 'INFOPLIST_FILE': 'Info.plist', + 'INFOPLIST_PREPROCESS': 'NO', + 'INFOPLIST_PREPROCESSOR_DEFINITIONS': 'PROCESSED_KEY1=Foo', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/installname/Info.plist b/tools/gyp/test/mac/installname/Info.plist new file mode 100644 index 000000000..5e05a5190 --- /dev/null +++ b/tools/gyp/test/mac/installname/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSPrincipalClass + + + diff --git a/tools/gyp/test/mac/installname/file.c b/tools/gyp/test/mac/installname/file.c new file mode 100644 index 000000000..a39fce095 --- /dev/null +++ b/tools/gyp/test/mac/installname/file.c @@ -0,0 +1 @@ +int f() { return 0; } diff --git a/tools/gyp/test/mac/installname/main.c b/tools/gyp/test/mac/installname/main.c new file mode 100644 index 000000000..237c8ce18 --- /dev/null +++ b/tools/gyp/test/mac/installname/main.c @@ -0,0 +1 @@ +int main() {} diff --git a/tools/gyp/test/mac/installname/test.gyp b/tools/gyp/test/mac/installname/test.gyp new file mode 100644 index 000000000..60c867ff1 --- /dev/null +++ b/tools/gyp/test/mac/installname/test.gyp @@ -0,0 +1,93 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'default_installname', + 'type': 'shared_library', + 'sources': [ 'file.c' ], + }, + { + 'target_name': 'default_bundle_installname', + 'product_name': 'My Framework', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'file.c' ], + }, + { + 'target_name': 'explicit_installname', + 'type': 'shared_library', + 'sources': [ 'file.c' ], + 'xcode_settings': { + 'LD_DYLIB_INSTALL_NAME': 'Trapped in a dynamiclib factory', + }, + }, + { + 'target_name': 'explicit_installname_base', + 'type': 'shared_library', + 'sources': [ 'file.c' ], + 'xcode_settings': { + 'DYLIB_INSTALL_NAME_BASE': '@executable_path/../../..', + + }, + }, + { + 'target_name': 'explicit_installname_base_bundle', + 'product_name': 'My Other Framework', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'file.c' ], + 'xcode_settings': { + 'DYLIB_INSTALL_NAME_BASE': '@executable_path/../../..', + + }, + }, + { + 'target_name': 'both_base_and_installname', + 'type': 'shared_library', + 'sources': [ 'file.c' ], + 'xcode_settings': { + # LD_DYLIB_INSTALL_NAME wins. + 'LD_DYLIB_INSTALL_NAME': 'Still trapped in a dynamiclib factory', + 'DYLIB_INSTALL_NAME_BASE': '@executable_path/../../..', + }, + }, + { + 'target_name': 'explicit_installname_with_base', + 'type': 'shared_library', + 'sources': [ 'file.c' ], + 'xcode_settings': { + 'LD_DYLIB_INSTALL_NAME': '$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)', + }, + }, + { + 'target_name': 'explicit_installname_with_explicit_base', + 'type': 'shared_library', + 'sources': [ 'file.c' ], + 'xcode_settings': { + 'DYLIB_INSTALL_NAME_BASE': '@executable_path/..', + 'LD_DYLIB_INSTALL_NAME': '$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)', + }, + }, + { + 'target_name': 'executable', + 'type': 'executable', + 'sources': [ 'main.c' ], + 'xcode_settings': { + 'LD_DYLIB_INSTALL_NAME': 'Should be ignored for not shared_lib', + }, + }, + # Regression test for http://crbug.com/113918 + { + 'target_name': 'install_name_with_info_plist', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'file.c' ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'Info.plist', + 'LD_DYLIB_INSTALL_NAME': '$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/ldflags/subdirectory/Info.plist b/tools/gyp/test/mac/ldflags/subdirectory/Info.plist new file mode 100644 index 000000000..5f5e9abfb --- /dev/null +++ b/tools/gyp/test/mac/ldflags/subdirectory/Info.plist @@ -0,0 +1,8 @@ + + + + + CFBundleSignature + ???? + + diff --git a/tools/gyp/test/mac/ldflags/subdirectory/file.c b/tools/gyp/test/mac/ldflags/subdirectory/file.c new file mode 100644 index 000000000..90c45543b --- /dev/null +++ b/tools/gyp/test/mac/ldflags/subdirectory/file.c @@ -0,0 +1,2 @@ +void f() {} +void g() {} diff --git a/tools/gyp/test/mac/ldflags/subdirectory/symbol_list.def b/tools/gyp/test/mac/ldflags/subdirectory/symbol_list.def new file mode 100644 index 000000000..0ab7543b1 --- /dev/null +++ b/tools/gyp/test/mac/ldflags/subdirectory/symbol_list.def @@ -0,0 +1 @@ +_f diff --git a/tools/gyp/test/mac/ldflags/subdirectory/test.gyp b/tools/gyp/test/mac/ldflags/subdirectory/test.gyp new file mode 100644 index 000000000..db00c7465 --- /dev/null +++ b/tools/gyp/test/mac/ldflags/subdirectory/test.gyp @@ -0,0 +1,66 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'raw', + 'type': 'shared_library', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + '-exported_symbols_list symbol_list.def', + '-sectcreate __TEXT __info_plist Info.plist', + ], + }, + }, + # TODO(thakis): This form should ideally be supported, too. (But + # -Wlfoo,bar,baz is cleaner so people should use that anyway.) + #{ + # 'target_name': 'raw_sep', + # 'type': 'shared_library', + # 'sources': [ 'file.c', ], + # 'xcode_settings': { + # 'OTHER_LDFLAGS': [ + # '-exported_symbols_list', 'symbol_list.def', + # '-sectcreate', '__TEXT', '__info_plist', 'Info.plist', + # ], + # }, + #}, + { + 'target_name': 'wl_space', + 'type': 'shared_library', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + # Works because clang passes unknown files on to the linker. + '-Wl,-exported_symbols_list symbol_list.def', + ], + }, + }, + # TODO(thakis): This form should ideally be supported, too. (But + # -Wlfoo,bar,baz is cleaner so people should use that anyway.) + #{ + # 'target_name': 'wl_space_sep', + # 'type': 'shared_library', + # 'sources': [ 'file.c', ], + # 'xcode_settings': { + # 'OTHER_LDFLAGS': [ + # # Works because clang passes unknown files on to the linker. + # '-Wl,-exported_symbols_list', 'symbol_list.def', + # ], + # }, + #}, + { + 'target_name': 'wl_comma', + 'type': 'shared_library', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + '-Wl,-exported_symbols_list,symbol_list.def', + '-Wl,-sectcreate,__TEXT,__info_plist,Info.plist', + ], + }, + }, + ], +} diff --git a/tools/gyp/test/mac/libraries/subdir/README.txt b/tools/gyp/test/mac/libraries/subdir/README.txt new file mode 100644 index 000000000..4031ded85 --- /dev/null +++ b/tools/gyp/test/mac/libraries/subdir/README.txt @@ -0,0 +1 @@ +Make things live in a subdirectory, to make sure that DEPTH works correctly. diff --git a/tools/gyp/test/mac/libraries/subdir/hello.cc b/tools/gyp/test/mac/libraries/subdir/hello.cc new file mode 100644 index 000000000..a43554c8c --- /dev/null +++ b/tools/gyp/test/mac/libraries/subdir/hello.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +int main() { + std::cout << "Hello, world!" << std::endl; + return 0; +} diff --git a/tools/gyp/test/mac/libraries/subdir/mylib.c b/tools/gyp/test/mac/libraries/subdir/mylib.c new file mode 100644 index 000000000..e771991e8 --- /dev/null +++ b/tools/gyp/test/mac/libraries/subdir/mylib.c @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int my_foo(int x) { + return x + 1; +} diff --git a/tools/gyp/test/mac/libraries/subdir/test.gyp b/tools/gyp/test/mac/libraries/subdir/test.gyp new file mode 100644 index 000000000..80a026977 --- /dev/null +++ b/tools/gyp/test/mac/libraries/subdir/test.gyp @@ -0,0 +1,66 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'libraries-test', + 'type': 'executable', + 'sources': [ + 'hello.cc', + ], + 'link_settings': { + 'libraries': [ + 'libcrypto.dylib', + 'libfl.a', + ], + }, + }, + { + # This creates a static library and puts it in a nonstandard location for + # libraries-search-path-test. + 'target_name': 'mylib', + 'type': 'static_library', + 'sources': [ + 'mylib.c', + ], + 'postbuilds': [ + { + 'postbuild_name': 'Make a secret location', + 'action': [ + 'mkdir', + '-p', + '${SRCROOT}/../secret_location', + ], + }, + { + 'postbuild_name': 'Copy to secret location, with secret name', + 'action': [ + 'cp', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', + '${SRCROOT}/../secret_location/libmysecretlib.a', + ], + }, + ], + }, + { + 'target_name': 'libraries-search-path-test', + 'type': 'executable', + 'dependencies': [ 'mylib' ], + 'sources': [ + 'hello.cc', + ], + 'xcode_settings': { + 'LIBRARY_SEARCH_PATHS': [ + '<(DEPTH)/secret_location', + ], + }, + 'link_settings': { + 'libraries': [ + 'libmysecretlib.a', + ], + }, + }, + ], +} diff --git a/tools/gyp/test/mac/loadable-module/Info.plist b/tools/gyp/test/mac/loadable-module/Info.plist new file mode 100644 index 000000000..f6607aebd --- /dev/null +++ b/tools/gyp/test/mac/loadable-module/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.google.test_loadable_module + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + BRPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CFPlugInDynamicRegisterFunction + + CFPlugInDynamicRegistration + NO + + diff --git a/tools/gyp/test/mac/loadable-module/module.c b/tools/gyp/test/mac/loadable-module/module.c new file mode 100644 index 000000000..958453834 --- /dev/null +++ b/tools/gyp/test/mac/loadable-module/module.c @@ -0,0 +1,11 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int SuperFly() { + return 42; +} + +const char* SuperFoo() { + return "Hello World"; +} diff --git a/tools/gyp/test/mac/loadable-module/test.gyp b/tools/gyp/test/mac/loadable-module/test.gyp new file mode 100644 index 000000000..3c8a5309d --- /dev/null +++ b/tools/gyp/test/mac/loadable-module/test.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_loadable_module', + 'type': 'loadable_module', + 'mac_bundle': 1, + 'sources': [ 'module.c' ], + 'product_extension': 'plugin', + 'xcode_settings': { + 'INFOPLIST_FILE': 'Info.plist', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/missing-cfbundlesignature/Info.plist b/tools/gyp/test/mac/missing-cfbundlesignature/Info.plist new file mode 100644 index 000000000..0c3167488 --- /dev/null +++ b/tools/gyp/test/mac/missing-cfbundlesignature/Info.plist @@ -0,0 +1,10 @@ + + + + + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundlePackageType + APPL + + diff --git a/tools/gyp/test/mac/missing-cfbundlesignature/Other-Info.plist b/tools/gyp/test/mac/missing-cfbundlesignature/Other-Info.plist new file mode 100644 index 000000000..47095281c --- /dev/null +++ b/tools/gyp/test/mac/missing-cfbundlesignature/Other-Info.plist @@ -0,0 +1,12 @@ + + + + + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundlePackageType + APPL + CFBundleSignature + F + + diff --git a/tools/gyp/test/mac/missing-cfbundlesignature/Third-Info.plist b/tools/gyp/test/mac/missing-cfbundlesignature/Third-Info.plist new file mode 100644 index 000000000..5b61fe266 --- /dev/null +++ b/tools/gyp/test/mac/missing-cfbundlesignature/Third-Info.plist @@ -0,0 +1,12 @@ + + + + + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundlePackageType + APPL + CFBundleSignature + some really long string + + diff --git a/tools/gyp/test/mac/missing-cfbundlesignature/file.c b/tools/gyp/test/mac/missing-cfbundlesignature/file.c new file mode 100644 index 000000000..237c8ce18 --- /dev/null +++ b/tools/gyp/test/mac/missing-cfbundlesignature/file.c @@ -0,0 +1 @@ +int main() {} diff --git a/tools/gyp/test/mac/missing-cfbundlesignature/test.gyp b/tools/gyp/test/mac/missing-cfbundlesignature/test.gyp new file mode 100644 index 000000000..b50cc2791 --- /dev/null +++ b/tools/gyp/test/mac/missing-cfbundlesignature/test.gyp @@ -0,0 +1,34 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'mytarget', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'Info.plist', + }, + }, + { + 'target_name': 'myothertarget', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'Other-Info.plist', + }, + }, + { + 'target_name': 'thirdtarget', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'Third-Info.plist', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/non-strs-flattened-to-env/Info.plist b/tools/gyp/test/mac/non-strs-flattened-to-env/Info.plist new file mode 100644 index 000000000..11fc4b660 --- /dev/null +++ b/tools/gyp/test/mac/non-strs-flattened-to-env/Info.plist @@ -0,0 +1,15 @@ + + + + + + CFBundlePackageType + APPL + CFBundleSignature + ???? + My Variable + ${MY_VAR} + CFlags + ${OTHER_CFLAGS} + + diff --git a/tools/gyp/test/mac/non-strs-flattened-to-env/main.c b/tools/gyp/test/mac/non-strs-flattened-to-env/main.c new file mode 100644 index 000000000..1711567ef --- /dev/null +++ b/tools/gyp/test/mac/non-strs-flattened-to-env/main.c @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + return 0; +} diff --git a/tools/gyp/test/mac/non-strs-flattened-to-env/test.gyp b/tools/gyp/test/mac/non-strs-flattened-to-env/test.gyp new file mode 100644 index 000000000..58814b73f --- /dev/null +++ b/tools/gyp/test/mac/non-strs-flattened-to-env/test.gyp @@ -0,0 +1,24 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'test_app', + 'product_name': 'Test', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ 'main.c', ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'Info.plist', + 'MY_VAR': 'some expansion', + 'OTHER_CFLAGS': [ + # Just some (more than one) random flags. + '-fstack-protector-all', + '-fno-strict-aliasing', + '-DS="A Space"', # Would normally be in 'defines' + ], + }, + }, + ], +} diff --git a/tools/gyp/test/mac/objc-gc/c-file.c b/tools/gyp/test/mac/objc-gc/c-file.c new file mode 100644 index 000000000..2855a00ea --- /dev/null +++ b/tools/gyp/test/mac/objc-gc/c-file.c @@ -0,0 +1 @@ +void c_fun() {} diff --git a/tools/gyp/test/mac/objc-gc/cc-file.cc b/tools/gyp/test/mac/objc-gc/cc-file.cc new file mode 100644 index 000000000..71e47a012 --- /dev/null +++ b/tools/gyp/test/mac/objc-gc/cc-file.cc @@ -0,0 +1 @@ +void cc_fun() {} diff --git a/tools/gyp/test/mac/objc-gc/main.m b/tools/gyp/test/mac/objc-gc/main.m new file mode 100644 index 000000000..1a87f8e70 --- /dev/null +++ b/tools/gyp/test/mac/objc-gc/main.m @@ -0,0 +1,6 @@ +#import + +int main() { + printf("gc on: %d\n", [NSGarbageCollector defaultCollector] != NULL); + return 0; +} diff --git a/tools/gyp/test/mac/objc-gc/needs-gc-mm.mm b/tools/gyp/test/mac/objc-gc/needs-gc-mm.mm new file mode 100644 index 000000000..fc3fee9f3 --- /dev/null +++ b/tools/gyp/test/mac/objc-gc/needs-gc-mm.mm @@ -0,0 +1 @@ +void objcpp_fun() { } diff --git a/tools/gyp/test/mac/objc-gc/needs-gc.m b/tools/gyp/test/mac/objc-gc/needs-gc.m new file mode 100644 index 000000000..ca77976b1 --- /dev/null +++ b/tools/gyp/test/mac/objc-gc/needs-gc.m @@ -0,0 +1 @@ +void objc_fun() { } diff --git a/tools/gyp/test/mac/objc-gc/test.gyp b/tools/gyp/test/mac/objc-gc/test.gyp new file mode 100644 index 000000000..4d827c1b3 --- /dev/null +++ b/tools/gyp/test/mac/objc-gc/test.gyp @@ -0,0 +1,102 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + # For some reason, static_library targets that are built with gc=required + # and then linked to executables that don't use gc, the linker doesn't + # complain. For shared_libraries it does, so use that. + { + 'target_name': 'no_gc_lib', + 'type': 'shared_library', + 'sources': [ + 'c-file.c', + 'cc-file.cc', + 'needs-gc-mm.mm', + 'needs-gc.m', + ], + }, + { + 'target_name': 'gc_lib', + 'type': 'shared_library', + 'sources': [ + 'c-file.c', + 'cc-file.cc', + 'needs-gc-mm.mm', + 'needs-gc.m', + ], + 'xcode_settings': { + 'GCC_ENABLE_OBJC_GC': 'supported', + }, + }, + { + 'target_name': 'gc_req_lib', + 'type': 'shared_library', + 'sources': [ + 'c-file.c', + 'cc-file.cc', + 'needs-gc-mm.mm', + 'needs-gc.m', + ], + 'xcode_settings': { + 'GCC_ENABLE_OBJC_GC': 'required', + }, + }, + + { + 'target_name': 'gc_exe_fails', + 'type': 'executable', + 'sources': [ 'main.m' ], + 'dependencies': [ 'no_gc_lib' ], + 'xcode_settings': { + 'GCC_ENABLE_OBJC_GC': 'required', + }, + 'libraries': [ 'Foundation.framework' ], + }, + { + 'target_name': 'gc_req_exe', + 'type': 'executable', + 'sources': [ 'main.m' ], + 'dependencies': [ 'gc_lib' ], + 'xcode_settings': { + 'GCC_ENABLE_OBJC_GC': 'required', + }, + 'libraries': [ 'Foundation.framework' ], + }, + { + 'target_name': 'gc_exe_req_lib', + 'type': 'executable', + 'sources': [ 'main.m' ], + 'dependencies': [ 'gc_req_lib' ], + 'xcode_settings': { + 'GCC_ENABLE_OBJC_GC': 'supported', + }, + 'libraries': [ 'Foundation.framework' ], + }, + { + 'target_name': 'gc_exe', + 'type': 'executable', + 'sources': [ 'main.m' ], + 'dependencies': [ 'gc_lib' ], + 'xcode_settings': { + 'GCC_ENABLE_OBJC_GC': 'supported', + }, + 'libraries': [ 'Foundation.framework' ], + }, + { + 'target_name': 'gc_off_exe_req_lib', + 'type': 'executable', + 'sources': [ 'main.m' ], + 'dependencies': [ 'gc_req_lib' ], + 'libraries': [ 'Foundation.framework' ], + }, + { + 'target_name': 'gc_off_exe', + 'type': 'executable', + 'sources': [ 'main.m' ], + 'dependencies': [ 'gc_lib' ], + 'libraries': [ 'Foundation.framework' ], + }, + ], +} + diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/Framework-Info.plist b/tools/gyp/test/mac/postbuild-copy-bundle/Framework-Info.plist new file mode 100644 index 000000000..ec36829c0 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-copy-bundle/Framework-Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSPrincipalClass + + RandomKey + RandomValue + + diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/TestApp-Info.plist b/tools/gyp/test/mac/postbuild-copy-bundle/TestApp-Info.plist new file mode 100644 index 000000000..98fd51520 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-copy-bundle/TestApp-Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.google.${PRODUCT_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/empty.c b/tools/gyp/test/mac/postbuild-copy-bundle/empty.c new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/main.c b/tools/gyp/test/mac/postbuild-copy-bundle/main.c new file mode 100644 index 000000000..21c196352 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-copy-bundle/main.c @@ -0,0 +1,4 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +int main() {} diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/postbuild-copy-framework.sh b/tools/gyp/test/mac/postbuild-copy-bundle/postbuild-copy-framework.sh new file mode 100755 index 000000000..930fec661 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-copy-bundle/postbuild-copy-framework.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e + +rsync -acC --delete "$1" "$2" diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/resource_file.sb b/tools/gyp/test/mac/postbuild-copy-bundle/resource_file.sb new file mode 100644 index 000000000..42057fa23 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-copy-bundle/resource_file.sb @@ -0,0 +1 @@ +This is included in the framework bundle. diff --git a/tools/gyp/test/mac/postbuild-copy-bundle/test.gyp b/tools/gyp/test/mac/postbuild-copy-bundle/test.gyp new file mode 100644 index 000000000..547737ce5 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-copy-bundle/test.gyp @@ -0,0 +1,43 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'test_bundle', + 'product_name': 'My Framework', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'empty.c', ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'Framework-Info.plist', + }, + 'mac_bundle_resources': [ + 'resource_file.sb', + ], + }, + { + 'target_name': 'test_app', + 'product_name': 'Test App', + 'type': 'executable', + 'mac_bundle': 1, + 'dependencies': [ + 'test_bundle', + ], + 'sources': [ 'main.c', ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'TestApp-Info.plist', + }, + 'postbuilds': [ + { + 'postbuild_name': 'Copy dependent framework into app', + 'action': [ + './postbuild-copy-framework.sh', + '${BUILT_PRODUCTS_DIR}/My Framework.framework', + '${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/', + ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/mac/postbuild-defaults/Info.plist b/tools/gyp/test/mac/postbuild-defaults/Info.plist new file mode 100644 index 000000000..d3f54d76c --- /dev/null +++ b/tools/gyp/test/mac/postbuild-defaults/Info.plist @@ -0,0 +1,13 @@ + + + + + + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleName + ${PRODUCT_NAME} + + diff --git a/tools/gyp/test/mac/postbuild-defaults/main.c b/tools/gyp/test/mac/postbuild-defaults/main.c new file mode 100644 index 000000000..1711567ef --- /dev/null +++ b/tools/gyp/test/mac/postbuild-defaults/main.c @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + return 0; +} diff --git a/tools/gyp/test/mac/postbuild-defaults/postbuild-defaults.sh b/tools/gyp/test/mac/postbuild-defaults/postbuild-defaults.sh new file mode 100755 index 000000000..56af2a832 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-defaults/postbuild-defaults.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e + +# This is the built Info.plist in the output directory. +PLIST="${BUILT_PRODUCTS_DIR}"/Test.app/Contents/Info # No trailing .plist +echo $(defaults read "${PLIST}" "CFBundleName") > "${BUILT_PRODUCTS_DIR}/result" + +# This is the source Info.plist next to this script file. +PLIST="${SRCROOT}"/Info # No trailing .plist +echo $(defaults read "${PLIST}" "CFBundleName") \ + >> "${BUILT_PRODUCTS_DIR}/result" diff --git a/tools/gyp/test/mac/postbuild-defaults/test.gyp b/tools/gyp/test/mac/postbuild-defaults/test.gyp new file mode 100644 index 000000000..be0a075ef --- /dev/null +++ b/tools/gyp/test/mac/postbuild-defaults/test.gyp @@ -0,0 +1,26 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'test_app', + 'product_name': 'Test', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ 'main.c', ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'Info.plist', + }, + 'postbuilds': [ + { + 'postbuild_name': 'Postbuild that calls defaults', + 'action': [ + './postbuild-defaults.sh', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', + ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/mac/postbuild-fail/file.c b/tools/gyp/test/mac/postbuild-fail/file.c new file mode 100644 index 000000000..91695b10c --- /dev/null +++ b/tools/gyp/test/mac/postbuild-fail/file.c @@ -0,0 +1,6 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// That's right, this is copyrighted. +void f() {} diff --git a/tools/gyp/test/mac/postbuild-fail/postbuild-fail.sh b/tools/gyp/test/mac/postbuild-fail/postbuild-fail.sh new file mode 100755 index 000000000..dc1a60d98 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-fail/postbuild-fail.sh @@ -0,0 +1,6 @@ +#!/usr/bin/bash +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +exit 1 diff --git a/tools/gyp/test/mac/postbuild-fail/test.gyp b/tools/gyp/test/mac/postbuild-fail/test.gyp new file mode 100644 index 000000000..e63283db0 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-fail/test.gyp @@ -0,0 +1,38 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'nonbundle', + 'type': 'static_library', + 'sources': [ 'file.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'Postbuild Fail', + 'action': [ './postbuild-fail.sh', ], + }, + { + 'postbuild_name': 'Runs after failing postbuild', + 'action': [ './touch-static.sh', ], + }, + ], + }, + { + 'target_name': 'bundle', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'file.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'Postbuild Fail', + 'action': [ './postbuild-fail.sh', ], + }, + { + 'postbuild_name': 'Runs after failing postbuild', + 'action': [ './touch-dynamic.sh', ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/mac/postbuild-fail/touch-dynamic.sh b/tools/gyp/test/mac/postbuild-fail/touch-dynamic.sh new file mode 100755 index 000000000..a388a6410 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-fail/touch-dynamic.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e +touch "${BUILT_PRODUCTS_DIR}/dynamic_touch" diff --git a/tools/gyp/test/mac/postbuild-fail/touch-static.sh b/tools/gyp/test/mac/postbuild-fail/touch-static.sh new file mode 100755 index 000000000..97ecaa686 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-fail/touch-static.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e +touch "${BUILT_PRODUCTS_DIR}/static_touch" diff --git a/tools/gyp/test/mac/postbuild-multiple-configurations/main.c b/tools/gyp/test/mac/postbuild-multiple-configurations/main.c new file mode 100644 index 000000000..21c196352 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-multiple-configurations/main.c @@ -0,0 +1,4 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +int main() {} diff --git a/tools/gyp/test/mac/postbuild-multiple-configurations/postbuild-touch-file.sh b/tools/gyp/test/mac/postbuild-multiple-configurations/postbuild-touch-file.sh new file mode 100755 index 000000000..b6170cf7a --- /dev/null +++ b/tools/gyp/test/mac/postbuild-multiple-configurations/postbuild-touch-file.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +touch "${BUILT_PRODUCTS_DIR}/postbuild-file" diff --git a/tools/gyp/test/mac/postbuild-multiple-configurations/test.gyp b/tools/gyp/test/mac/postbuild-multiple-configurations/test.gyp new file mode 100644 index 000000000..c350b20d6 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-multiple-configurations/test.gyp @@ -0,0 +1,26 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'target_defaults': { + 'configurations': { + 'Debug': {}, + 'Release': {}, + }, + }, + 'targets': [ + { + 'target_name': 'random_target', + 'type': 'executable', + 'sources': [ 'main.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'Touch a file.', + 'action': [ + './postbuild-touch-file.sh', + ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/mac/postbuild-static-library/empty.c b/tools/gyp/test/mac/postbuild-static-library/empty.c new file mode 100644 index 000000000..9554336c0 --- /dev/null +++ b/tools/gyp/test/mac/postbuild-static-library/empty.c @@ -0,0 +1,4 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +void f() {} diff --git a/tools/gyp/test/mac/postbuild-static-library/postbuild-touch-file.sh b/tools/gyp/test/mac/postbuild-static-library/postbuild-touch-file.sh new file mode 100755 index 000000000..37de4de4f --- /dev/null +++ b/tools/gyp/test/mac/postbuild-static-library/postbuild-touch-file.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +touch "${BUILT_PRODUCTS_DIR}/$1" diff --git a/tools/gyp/test/mac/postbuild-static-library/test.gyp b/tools/gyp/test/mac/postbuild-static-library/test.gyp new file mode 100644 index 000000000..9ef55a0af --- /dev/null +++ b/tools/gyp/test/mac/postbuild-static-library/test.gyp @@ -0,0 +1,34 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'my_lib', + 'type': 'static_library', + 'sources': [ 'empty.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'Postbuild that touches a file', + 'action': [ + './postbuild-touch-file.sh', 'postbuild-file' + ], + }, + ], + }, + + { + 'target_name': 'my_sourceless_lib', + 'type': 'static_library', + 'dependencies': [ 'my_lib' ], + 'postbuilds': [ + { + 'postbuild_name': 'Postbuild that touches a file', + 'action': [ + './postbuild-touch-file.sh', 'postbuild-file-sourceless' + ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/mac/postbuilds/copy.sh b/tools/gyp/test/mac/postbuilds/copy.sh new file mode 100755 index 000000000..ecad0381d --- /dev/null +++ b/tools/gyp/test/mac/postbuilds/copy.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +cp "$@" diff --git a/tools/gyp/test/mac/postbuilds/file.c b/tools/gyp/test/mac/postbuilds/file.c new file mode 100644 index 000000000..653e71ff7 --- /dev/null +++ b/tools/gyp/test/mac/postbuilds/file.c @@ -0,0 +1,4 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +void f() {} diff --git a/tools/gyp/test/mac/postbuilds/file_g.c b/tools/gyp/test/mac/postbuilds/file_g.c new file mode 100644 index 000000000..0f7849d20 --- /dev/null +++ b/tools/gyp/test/mac/postbuilds/file_g.c @@ -0,0 +1,4 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +void g() {} diff --git a/tools/gyp/test/mac/postbuilds/file_h.c b/tools/gyp/test/mac/postbuilds/file_h.c new file mode 100644 index 000000000..521d1f4d5 --- /dev/null +++ b/tools/gyp/test/mac/postbuilds/file_h.c @@ -0,0 +1,4 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +void h() {} diff --git a/tools/gyp/test/mac/postbuilds/script/shared_library_postbuild.sh b/tools/gyp/test/mac/postbuilds/script/shared_library_postbuild.sh new file mode 100755 index 000000000..c623c8bf2 --- /dev/null +++ b/tools/gyp/test/mac/postbuilds/script/shared_library_postbuild.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e + +lib="${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" +nm ${lib} > /dev/null # Just make sure this works. + +pattern="${1}" + +if [ $pattern != "a|b" ]; then + echo "Parameter quoting is broken" + exit 1 +fi + +if [ "${2}" != "arg with spaces" ]; then + echo "Parameter space escaping is broken" + exit 1 +fi + +touch "${lib}"_touch diff --git a/tools/gyp/test/mac/postbuilds/script/static_library_postbuild.sh b/tools/gyp/test/mac/postbuilds/script/static_library_postbuild.sh new file mode 100755 index 000000000..2bf09b34e --- /dev/null +++ b/tools/gyp/test/mac/postbuilds/script/static_library_postbuild.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e + +lib="${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}" +nm ${lib} > /dev/null # Just make sure this works. + +pattern="${1}" + +if [ $pattern != "a|b" ]; then + echo "Parameter quote escaping is broken" + exit 1 +fi + +if [ "${2}" != "arg with spaces" ]; then + echo "Parameter space escaping is broken" + exit 1 +fi + +touch "${lib}"_touch.a diff --git a/tools/gyp/test/mac/postbuilds/subdirectory/copied_file.txt b/tools/gyp/test/mac/postbuilds/subdirectory/copied_file.txt new file mode 100644 index 000000000..a634f85b6 --- /dev/null +++ b/tools/gyp/test/mac/postbuilds/subdirectory/copied_file.txt @@ -0,0 +1 @@ +This file should be copied to the products dir. diff --git a/tools/gyp/test/mac/postbuilds/subdirectory/nested_target.gyp b/tools/gyp/test/mac/postbuilds/subdirectory/nested_target.gyp new file mode 100644 index 000000000..6d4f2395e --- /dev/null +++ b/tools/gyp/test/mac/postbuilds/subdirectory/nested_target.gyp @@ -0,0 +1,53 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'nest_el', + 'type': 'static_library', + 'sources': [ '../file_g.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'Static library postbuild', + 'variables': { + 'some_regex': 'a|b', + }, + 'action': [ + '../script/static_library_postbuild.sh', + '<(some_regex)', + 'arg with spaces', + ], + }, + ], + }, + { + 'target_name': 'nest_dyna', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ '../file_h.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'Dynamic library postbuild', + 'variables': { + 'some_regex': 'a|b', + }, + 'action': [ + '../script/shared_library_postbuild.sh', + '<(some_regex)', + 'arg with spaces', + ], + }, + { + 'postbuild_name': 'Test paths relative to gyp file', + 'action': [ + '../copy.sh', + './copied_file.txt', + '${BUILT_PRODUCTS_DIR}/copied_file_2.txt', + ], + }, + ], + }, + ], +} + diff --git a/tools/gyp/test/mac/postbuilds/test.gyp b/tools/gyp/test/mac/postbuilds/test.gyp new file mode 100644 index 000000000..1f0eed8df --- /dev/null +++ b/tools/gyp/test/mac/postbuilds/test.gyp @@ -0,0 +1,87 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'el', + 'type': 'static_library', + 'sources': [ 'file.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'Static library postbuild', + 'variables': { + 'some_regex': 'a|b', + }, + 'action': [ + 'script/static_library_postbuild.sh', + '<(some_regex)', + 'arg with spaces', + ], + }, + { + 'postbuild_name': 'Test variable in gyp file', + 'action': [ + 'cp', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}_gyp_touch.a', + ], + }, + ], + }, + { + 'target_name': 'dyna', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'file.c', ], + 'dependencies': [ + 'subdirectory/nested_target.gyp:nest_dyna', + 'subdirectory/nested_target.gyp:nest_el', + ], + 'postbuilds': [ + { + 'postbuild_name': 'Dynamic library postbuild', + 'variables': { + 'some_regex': 'a|b', + }, + 'action': [ + 'script/shared_library_postbuild.sh', + '<(some_regex)', + 'arg with spaces', + ], + }, + { + 'postbuild_name': 'Test variable in gyp file', + 'action': [ + 'cp', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}_gyp_touch', + ], + }, + { + 'postbuild_name': 'Test paths relative to gyp file', + 'action': [ + './copy.sh', + 'subdirectory/copied_file.txt', + '${BUILT_PRODUCTS_DIR}', + ], + }, + ], + }, + { + 'target_name': 'dyna_standalone', + 'type': 'shared_library', + 'sources': [ 'file.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'Test variable in gyp file', + 'action': [ + 'cp', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}_gyp_touch.dylib', + ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/mac/prefixheader/file.c b/tools/gyp/test/mac/prefixheader/file.c new file mode 100644 index 000000000..d0b39d1f6 --- /dev/null +++ b/tools/gyp/test/mac/prefixheader/file.c @@ -0,0 +1 @@ +MyInt f() { return 0; } diff --git a/tools/gyp/test/mac/prefixheader/file.cc b/tools/gyp/test/mac/prefixheader/file.cc new file mode 100644 index 000000000..d0b39d1f6 --- /dev/null +++ b/tools/gyp/test/mac/prefixheader/file.cc @@ -0,0 +1 @@ +MyInt f() { return 0; } diff --git a/tools/gyp/test/mac/prefixheader/file.m b/tools/gyp/test/mac/prefixheader/file.m new file mode 100644 index 000000000..d0b39d1f6 --- /dev/null +++ b/tools/gyp/test/mac/prefixheader/file.m @@ -0,0 +1 @@ +MyInt f() { return 0; } diff --git a/tools/gyp/test/mac/prefixheader/file.mm b/tools/gyp/test/mac/prefixheader/file.mm new file mode 100644 index 000000000..d0b39d1f6 --- /dev/null +++ b/tools/gyp/test/mac/prefixheader/file.mm @@ -0,0 +1 @@ +MyInt f() { return 0; } diff --git a/tools/gyp/test/mac/prefixheader/header.h b/tools/gyp/test/mac/prefixheader/header.h new file mode 100644 index 000000000..0716e500c --- /dev/null +++ b/tools/gyp/test/mac/prefixheader/header.h @@ -0,0 +1 @@ +typedef int MyInt; diff --git a/tools/gyp/test/mac/prefixheader/test.gyp b/tools/gyp/test/mac/prefixheader/test.gyp new file mode 100644 index 000000000..7e6b1af80 --- /dev/null +++ b/tools/gyp/test/mac/prefixheader/test.gyp @@ -0,0 +1,82 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'prefix_header_c', + 'type': 'static_library', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'GCC_PREFIX_HEADER': 'header.h', + }, + }, + { + 'target_name': 'precompiled_prefix_header_c', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'GCC_PREFIX_HEADER': 'header.h', + 'GCC_PRECOMPILE_PREFIX_HEADER': 'YES', + }, + }, + + { + 'target_name': 'prefix_header_cc', + 'type': 'static_library', + 'sources': [ 'file.cc', ], + 'xcode_settings': { + 'GCC_PREFIX_HEADER': 'header.h', + }, + }, + { + 'target_name': 'precompiled_prefix_header_cc', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'file.cc', ], + 'xcode_settings': { + 'GCC_PREFIX_HEADER': 'header.h', + 'GCC_PRECOMPILE_PREFIX_HEADER': 'YES', + }, + }, + + { + 'target_name': 'prefix_header_m', + 'type': 'static_library', + 'sources': [ 'file.m', ], + 'xcode_settings': { + 'GCC_PREFIX_HEADER': 'header.h', + }, + }, + { + 'target_name': 'precompiled_prefix_header_m', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'file.m', ], + 'xcode_settings': { + 'GCC_PREFIX_HEADER': 'header.h', + 'GCC_PRECOMPILE_PREFIX_HEADER': 'YES', + }, + }, + + { + 'target_name': 'prefix_header_mm', + 'type': 'static_library', + 'sources': [ 'file.mm', ], + 'xcode_settings': { + 'GCC_PREFIX_HEADER': 'header.h', + }, + }, + { + 'target_name': 'precompiled_prefix_header_mm', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'file.mm', ], + 'xcode_settings': { + 'GCC_PREFIX_HEADER': 'header.h', + 'GCC_PRECOMPILE_PREFIX_HEADER': 'YES', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/rebuild/TestApp-Info.plist b/tools/gyp/test/mac/rebuild/TestApp-Info.plist new file mode 100644 index 000000000..98fd51520 --- /dev/null +++ b/tools/gyp/test/mac/rebuild/TestApp-Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.google.${PRODUCT_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/tools/gyp/test/mac/rebuild/delay-touch.sh b/tools/gyp/test/mac/rebuild/delay-touch.sh new file mode 100755 index 000000000..7caf105b6 --- /dev/null +++ b/tools/gyp/test/mac/rebuild/delay-touch.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -e + +sleep 1 # mtime resolution is 1 sec on unix. +touch "$1" diff --git a/tools/gyp/test/mac/rebuild/empty.c b/tools/gyp/test/mac/rebuild/empty.c new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/mac/rebuild/main.c b/tools/gyp/test/mac/rebuild/main.c new file mode 100644 index 000000000..237c8ce18 --- /dev/null +++ b/tools/gyp/test/mac/rebuild/main.c @@ -0,0 +1 @@ +int main() {} diff --git a/tools/gyp/test/mac/rebuild/test.gyp b/tools/gyp/test/mac/rebuild/test.gyp new file mode 100644 index 000000000..15b4e4ef2 --- /dev/null +++ b/tools/gyp/test/mac/rebuild/test.gyp @@ -0,0 +1,56 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'test_app', + 'product_name': 'Test App', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ + 'main.c', + ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'TestApp-Info.plist', + }, + }, + { + 'target_name': 'test_app_postbuilds', + 'product_name': 'Test App 2', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ + 'main.c', + ], + 'xcode_settings': { + 'INFOPLIST_FILE': 'TestApp-Info.plist', + }, + 'postbuilds': [ + { + 'postbuild_name': 'Postbuild that touches the app binary', + 'action': [ + './delay-touch.sh', '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', + ], + }, + ], + }, + { + 'target_name': 'test_framework_postbuilds', + 'product_name': 'Test Framework', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ + 'empty.c', + ], + 'postbuilds': [ + { + 'postbuild_name': 'Postbuild that touches the framework binary', + 'action': [ + './delay-touch.sh', '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}', + ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/mac/rpath/file.c b/tools/gyp/test/mac/rpath/file.c new file mode 100644 index 000000000..56757a701 --- /dev/null +++ b/tools/gyp/test/mac/rpath/file.c @@ -0,0 +1 @@ +void f() {} diff --git a/tools/gyp/test/mac/rpath/main.c b/tools/gyp/test/mac/rpath/main.c new file mode 100644 index 000000000..237c8ce18 --- /dev/null +++ b/tools/gyp/test/mac/rpath/main.c @@ -0,0 +1 @@ +int main() {} diff --git a/tools/gyp/test/mac/rpath/test.gyp b/tools/gyp/test/mac/rpath/test.gyp new file mode 100644 index 000000000..7255cb7cd --- /dev/null +++ b/tools/gyp/test/mac/rpath/test.gyp @@ -0,0 +1,48 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'default_rpath', + 'type': 'shared_library', + 'sources': [ 'file.c' ], + }, + { + 'target_name': 'explicit_rpath', + 'type': 'shared_library', + 'sources': [ 'file.c' ], + 'xcode_settings': { + 'LD_RUNPATH_SEARCH_PATHS': ['@executable_path/.'], + }, + }, + { + 'target_name': 'explicit_rpaths_escaped', + 'type': 'shared_library', + 'sources': [ 'file.c' ], + 'xcode_settings': { + # Xcode requires spaces to be escaped, else it ends up adding two + # independent rpaths. + 'LD_RUNPATH_SEARCH_PATHS': ['First\\ rpath', 'Second\\ rpath'], + }, + }, + { + 'target_name': 'explicit_rpaths_bundle', + 'product_name': 'My Framework', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'file.c' ], + 'xcode_settings': { + 'LD_RUNPATH_SEARCH_PATHS': ['@loader_path/.'], + }, + }, + { + 'target_name': 'executable', + 'type': 'executable', + 'sources': [ 'main.c' ], + 'xcode_settings': { + 'LD_RUNPATH_SEARCH_PATHS': ['@executable_path/.'], + }, + }, + ], +} diff --git a/tools/gyp/test/mac/sdkroot/file.cc b/tools/gyp/test/mac/sdkroot/file.cc new file mode 100644 index 000000000..13ae97104 --- /dev/null +++ b/tools/gyp/test/mac/sdkroot/file.cc @@ -0,0 +1,5 @@ +#include +using std::map; + +int main() { +} diff --git a/tools/gyp/test/mac/sdkroot/test.gyp b/tools/gyp/test/mac/sdkroot/test.gyp new file mode 100644 index 000000000..388e0572a --- /dev/null +++ b/tools/gyp/test/mac/sdkroot/test.gyp @@ -0,0 +1,15 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'mytarget', + 'type': 'executable', + 'sources': [ 'file.cc', ], + 'xcode_settings': { + 'SDKROOT': 'macosx10.6', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/sourceless-module/empty.c b/tools/gyp/test/mac/sourceless-module/empty.c new file mode 100644 index 000000000..237c8ce18 --- /dev/null +++ b/tools/gyp/test/mac/sourceless-module/empty.c @@ -0,0 +1 @@ +int main() {} diff --git a/tools/gyp/test/mac/sourceless-module/test.gyp b/tools/gyp/test/mac/sourceless-module/test.gyp new file mode 100644 index 000000000..49dc2af9c --- /dev/null +++ b/tools/gyp/test/mac/sourceless-module/test.gyp @@ -0,0 +1,39 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'empty_bundle', + 'type': 'loadable_module', + 'mac_bundle': 1, + }, + { + 'target_name': 'resource_bundle', + 'type': 'loadable_module', + 'mac_bundle': 1, + 'actions': [ + { + 'action_name': 'Add Resource', + 'inputs': [], + 'outputs': [ + '<(INTERMEDIATE_DIR)/app_manifest/foo.manifest', + ], + 'action': [ + 'touch', '<(INTERMEDIATE_DIR)/app_manifest/foo.manifest', + ], + 'process_outputs_as_mac_bundle_resources': 1, + }, + ], + }, + { + 'target_name': 'dependent_on_resource_bundle', + 'type': 'executable', + 'sources': [ 'empty.c' ], + 'dependencies': [ + 'resource_bundle', + ], + }, + ], +} + diff --git a/tools/gyp/test/mac/strip/file.c b/tools/gyp/test/mac/strip/file.c new file mode 100644 index 000000000..421f0405f --- /dev/null +++ b/tools/gyp/test/mac/strip/file.c @@ -0,0 +1,9 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +static void the_static_function() {} + +void the_function() { + the_static_function(); +} diff --git a/tools/gyp/test/mac/strip/strip.saves b/tools/gyp/test/mac/strip/strip.saves new file mode 100644 index 000000000..b60ca6285 --- /dev/null +++ b/tools/gyp/test/mac/strip/strip.saves @@ -0,0 +1,5 @@ +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This file would list symbols that should not be stripped. diff --git a/tools/gyp/test/mac/strip/subdirectory/nested_file.c b/tools/gyp/test/mac/strip/subdirectory/nested_file.c new file mode 100644 index 000000000..50daa6c13 --- /dev/null +++ b/tools/gyp/test/mac/strip/subdirectory/nested_file.c @@ -0,0 +1 @@ +void nested_f() {} diff --git a/tools/gyp/test/mac/strip/subdirectory/nested_strip.saves b/tools/gyp/test/mac/strip/subdirectory/nested_strip.saves new file mode 100644 index 000000000..d434c0ef4 --- /dev/null +++ b/tools/gyp/test/mac/strip/subdirectory/nested_strip.saves @@ -0,0 +1,5 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This file would list symbols that should not be stripped. diff --git a/tools/gyp/test/mac/strip/subdirectory/subdirectory.gyp b/tools/gyp/test/mac/strip/subdirectory/subdirectory.gyp new file mode 100644 index 000000000..5d0d19091 --- /dev/null +++ b/tools/gyp/test/mac/strip/subdirectory/subdirectory.gyp @@ -0,0 +1,38 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'nested_strip_save', + 'type': 'shared_library', + 'sources': [ 'nested_file.c', ], + 'xcode_settings': { + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + 'STRIPFLAGS': '-s $(CHROMIUM_STRIP_SAVE_FILE)', + 'CHROMIUM_STRIP_SAVE_FILE': 'nested_strip.saves', + }, + }, + { + 'target_name': 'nested_strip_save_postbuild', + 'type': 'shared_library', + 'sources': [ 'nested_file.c', ], + 'xcode_settings': { + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + 'STRIPFLAGS': '-s $(CHROMIUM_STRIP_SAVE_FILE)', + 'CHROMIUM_STRIP_SAVE_FILE': 'nested_strip.saves', + }, + 'postbuilds': [ + { + 'postbuild_name': 'Action that reads CHROMIUM_STRIP_SAVE_FILE', + 'action': [ + './test_reading_save_file_from_postbuild.sh', + ], + }, + ], + }, + ], +} + diff --git a/tools/gyp/test/mac/strip/subdirectory/test_reading_save_file_from_postbuild.sh b/tools/gyp/test/mac/strip/subdirectory/test_reading_save_file_from_postbuild.sh new file mode 100755 index 000000000..976943680 --- /dev/null +++ b/tools/gyp/test/mac/strip/subdirectory/test_reading_save_file_from_postbuild.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -e + +test -f ${CHROMIUM_STRIP_SAVE_FILE} diff --git a/tools/gyp/test/mac/strip/test.gyp b/tools/gyp/test/mac/strip/test.gyp new file mode 100644 index 000000000..2558aa91b --- /dev/null +++ b/tools/gyp/test/mac/strip/test.gyp @@ -0,0 +1,119 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# These xcode_settings affect stripping: +# "Deployment postprocessing involves stripping the binary, and setting +# its file mode, owner, and group." +#'DEPLOYMENT_POSTPROCESSING': 'YES', + +# "Specifies whether to strip symbol information from the binary. +# Prerequisite: $DEPLOYMENT_POSTPROCESSING = YES" "Default Value: 'NO'" +#'STRIP_INSTALLED_PRODUCT': 'YES', + +# "Values: +# * all: Strips the binary completely, removing the symbol table and +# relocation information +# * non-global: Strips nonglobal symbols but saves external symbols. +# * debugging: Strips debugging symbols but saves local and global +# symbols." +# (maps to no flag, -x, -S in that order) +#'STRIP_STYLE': 'non-global', + +# "Additional strip flags" +#'STRIPFLAGS': '-c', + +# "YES: Copied binaries are stripped of debugging symbols. This does +# not cause the binary produced by the linker to be stripped. Use +# 'STRIP_INSTALLED_PRODUCT (Strip Linked Product)' to have the linker +# strip the binary." +#'COPY_PHASE_STRIP': 'NO', +{ + 'targets': [ + { + 'target_name': 'no_postprocess', + 'type': 'shared_library', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEPLOYMENT_POSTPROCESSING': 'NO', + 'STRIP_INSTALLED_PRODUCT': 'YES', + }, + }, + { + 'target_name': 'no_strip', + 'type': 'shared_library', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'NO', + }, + }, + { + 'target_name': 'strip_all', + 'type': 'shared_library', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + 'STRIP_STYLE': 'all', + }, + }, + { + 'target_name': 'strip_nonglobal', + 'type': 'shared_library', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + 'STRIP_STYLE': 'non-global', + }, + }, + { + 'target_name': 'strip_debugging', + 'type': 'shared_library', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + 'STRIP_STYLE': 'debugging', + }, + }, + { + 'target_name': 'strip_all_custom_flags', + 'type': 'shared_library', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + 'STRIP_STYLE': 'all', + 'STRIPFLAGS': '-c', + }, + }, + { + 'target_name': 'strip_all_bundle', + 'type': 'shared_library', + 'mac_bundle': '1', + 'sources': [ 'file.c', ], + 'xcode_settings': { + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + 'STRIP_STYLE': 'all', + }, + }, + { + 'target_name': 'strip_save', + 'type': 'shared_library', + 'sources': [ 'file.c', ], + 'dependencies': [ + 'subdirectory/subdirectory.gyp:nested_strip_save', + 'subdirectory/subdirectory.gyp:nested_strip_save_postbuild', + ], + 'xcode_settings': { + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + 'STRIPFLAGS': '-s $(CHROMIUM_STRIP_SAVE_FILE)', + 'CHROMIUM_STRIP_SAVE_FILE': 'strip.saves', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/type_envvars/file.c b/tools/gyp/test/mac/type_envvars/file.c new file mode 100644 index 000000000..9cddaf1b0 --- /dev/null +++ b/tools/gyp/test/mac/type_envvars/file.c @@ -0,0 +1,6 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +void f() {} +int main() {} diff --git a/tools/gyp/test/mac/type_envvars/test.gyp b/tools/gyp/test/mac/type_envvars/test.gyp new file mode 100644 index 000000000..465670056 --- /dev/null +++ b/tools/gyp/test/mac/type_envvars/test.gyp @@ -0,0 +1,100 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'my_app', + 'product_name': 'My App', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ 'file.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'envtest', + 'action': [ './test_bundle_executable.sh', ], + }, + ], + }, + { + 'target_name': 'bundle_loadable_module', + 'type': 'loadable_module', + 'mac_bundle': 1, + 'sources': [ 'file.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'envtest', + 'action': [ './test_bundle_loadable_module.sh', ], + }, + ], + }, + { + 'target_name': 'bundle_shared_library', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'file.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'envtest', + 'action': [ './test_bundle_shared_library.sh', ], + }, + ], + }, + # Types 'static_library' and 'none' can't exist as bundles. + + { + 'target_name': 'nonbundle_executable', + 'type': 'executable', + 'sources': [ 'file.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'envtest', + 'action': [ './test_nonbundle_executable.sh', ], + }, + ], + }, + { + 'target_name': 'nonbundle_loadable_module', + 'type': 'loadable_module', + 'sources': [ 'file.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'envtest', + 'action': [ './test_nonbundle_loadable_module.sh', ], + }, + ], + }, + { + 'target_name': 'nonbundle_shared_library', + 'type': 'shared_library', + 'sources': [ 'file.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'envtest', + 'action': [ './test_nonbundle_shared_library.sh', ], + }, + ], + }, + { + 'target_name': 'nonbundle_static_library', + 'type': 'static_library', + 'sources': [ 'file.c', ], + 'postbuilds': [ + { + 'postbuild_name': 'envtest', + 'action': [ './test_nonbundle_static_library.sh', ], + }, + ], + }, + { + 'target_name': 'nonbundle_none', + 'type': 'none', + 'postbuilds': [ + { + 'postbuild_name': 'envtest', + 'action': [ './test_nonbundle_none.sh', ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/mac/type_envvars/test_bundle_executable.sh b/tools/gyp/test/mac/type_envvars/test_bundle_executable.sh new file mode 100755 index 000000000..f57bdf799 --- /dev/null +++ b/tools/gyp/test/mac/type_envvars/test_bundle_executable.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e + +test $MACH_O_TYPE = mh_execute +test $PRODUCT_TYPE = com.apple.product-type.application +test "${PRODUCT_NAME}" = "My App" +test "${FULL_PRODUCT_NAME}" = "My App.app" + +test "${EXECUTABLE_NAME}" = "My App" +test "${EXECUTABLE_PATH}" = "My App.app/Contents/MacOS/My App" +test "${WRAPPER_NAME}" = "My App.app" + +[[ ! $DYLIB_INSTALL_NAME_BASE && ${DYLIB_INSTALL_NAME_BASE-_} ]] +[[ ! $LD_DYLIB_INSTALL_NAME && ${LD_DYLIB_INSTALL_NAME-_} ]] diff --git a/tools/gyp/test/mac/type_envvars/test_bundle_loadable_module.sh b/tools/gyp/test/mac/type_envvars/test_bundle_loadable_module.sh new file mode 100755 index 000000000..89628961d --- /dev/null +++ b/tools/gyp/test/mac/type_envvars/test_bundle_loadable_module.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e + +test $MACH_O_TYPE = mh_bundle +test $PRODUCT_TYPE = com.apple.product-type.bundle +test $PRODUCT_NAME = bundle_loadable_module +test $FULL_PRODUCT_NAME = bundle_loadable_module.bundle + +test $EXECUTABLE_NAME = bundle_loadable_module +test $EXECUTABLE_PATH = \ + "bundle_loadable_module.bundle/Contents/MacOS/bundle_loadable_module" +test $WRAPPER_NAME = bundle_loadable_module.bundle + +[[ ! $DYLIB_INSTALL_NAME_BASE && ${DYLIB_INSTALL_NAME_BASE-_} ]] +[[ ! $LD_DYLIB_INSTALL_NAME && ${LD_DYLIB_INSTALL_NAME-_} ]] diff --git a/tools/gyp/test/mac/type_envvars/test_bundle_shared_library.sh b/tools/gyp/test/mac/type_envvars/test_bundle_shared_library.sh new file mode 100755 index 000000000..0474876d7 --- /dev/null +++ b/tools/gyp/test/mac/type_envvars/test_bundle_shared_library.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e + +test $MACH_O_TYPE = mh_dylib +test $PRODUCT_TYPE = com.apple.product-type.framework +test $PRODUCT_NAME = bundle_shared_library +test $FULL_PRODUCT_NAME = bundle_shared_library.framework + +test $EXECUTABLE_NAME = bundle_shared_library +test $EXECUTABLE_PATH = \ + "bundle_shared_library.framework/Versions/A/bundle_shared_library" +test $WRAPPER_NAME = bundle_shared_library.framework + +test $DYLIB_INSTALL_NAME_BASE = "/Library/Frameworks" +test $LD_DYLIB_INSTALL_NAME = \ + "/Library/Frameworks/bundle_shared_library.framework/Versions/A/bundle_shared_library" diff --git a/tools/gyp/test/mac/type_envvars/test_nonbundle_executable.sh b/tools/gyp/test/mac/type_envvars/test_nonbundle_executable.sh new file mode 100755 index 000000000..45e762c38 --- /dev/null +++ b/tools/gyp/test/mac/type_envvars/test_nonbundle_executable.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e +# For some reason, Xcode doesn't set MACH_O_TYPE for non-bundle executables. +# Check for "not set", not just "empty": +[[ ! $MACH_O_TYPE && ${MACH_O_TYPE-_} ]] +test $PRODUCT_TYPE = com.apple.product-type.tool +test $PRODUCT_NAME = nonbundle_executable +test $FULL_PRODUCT_NAME = nonbundle_executable + +test $EXECUTABLE_NAME = nonbundle_executable +test $EXECUTABLE_PATH = nonbundle_executable +[[ ! $WRAPPER_NAME && ${WRAPPER_NAME-_} ]] + +[[ ! $DYLIB_INSTALL_NAME_BASE && ${DYLIB_INSTALL_NAME_BASE-_} ]] +[[ ! $LD_DYLIB_INSTALL_NAME && ${LD_DYLIB_INSTALL_NAME-_} ]] diff --git a/tools/gyp/test/mac/type_envvars/test_nonbundle_loadable_module.sh b/tools/gyp/test/mac/type_envvars/test_nonbundle_loadable_module.sh new file mode 100755 index 000000000..3e8cb3324 --- /dev/null +++ b/tools/gyp/test/mac/type_envvars/test_nonbundle_loadable_module.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e + +test $MACH_O_TYPE = mh_bundle +test $PRODUCT_TYPE = com.apple.product-type.library.dynamic +test $PRODUCT_NAME = nonbundle_loadable_module +test $FULL_PRODUCT_NAME = nonbundle_loadable_module.so + +test $EXECUTABLE_NAME = nonbundle_loadable_module.so +test $EXECUTABLE_PATH = nonbundle_loadable_module.so +[[ ! $WRAPPER_NAME && ${WRAPPER_NAME-_} ]] + +test $DYLIB_INSTALL_NAME_BASE = "/usr/local/lib" +test $LD_DYLIB_INSTALL_NAME = "/usr/local/lib/nonbundle_loadable_module.so" diff --git a/tools/gyp/test/mac/type_envvars/test_nonbundle_none.sh b/tools/gyp/test/mac/type_envvars/test_nonbundle_none.sh new file mode 100755 index 000000000..acf58c147 --- /dev/null +++ b/tools/gyp/test/mac/type_envvars/test_nonbundle_none.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e + +# Check for "not set", not just "empty": +[[ ! $MACH_O_TYPE && ${MACH_O_TYPE-_} ]] +[[ ! $PRODUCT_TYPE && ${PRODUCT_TYPE-_} ]] +test $PRODUCT_NAME = nonbundle_none +[[ ! $FULL_PRODUCT_NAME && ${FULL_PRODUCT_NAME-_} ]] + +[[ ! $EXECUTABLE_NAME && ${EXECUTABLE_NAME-_} ]] +[[ ! $EXECUTABLE_PATH && ${EXECUTABLE_PATH-_} ]] +[[ ! $WRAPPER_NAME && ${WRAPPER_NAME-_} ]] + +[[ ! $DYLIB_INSTALL_NAME_BASE && ${DYLIB_INSTALL_NAME_BASE-_} ]] +[[ ! $LD_DYLIB_INSTALL_NAME && ${LD_DYLIB_INSTALL_NAME-_} ]] diff --git a/tools/gyp/test/mac/type_envvars/test_nonbundle_shared_library.sh b/tools/gyp/test/mac/type_envvars/test_nonbundle_shared_library.sh new file mode 100755 index 000000000..3e206a93a --- /dev/null +++ b/tools/gyp/test/mac/type_envvars/test_nonbundle_shared_library.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e + +test $MACH_O_TYPE = mh_dylib +test $PRODUCT_TYPE = com.apple.product-type.library.dynamic +test $PRODUCT_NAME = nonbundle_shared_library +test $FULL_PRODUCT_NAME = libnonbundle_shared_library.dylib + +test $EXECUTABLE_NAME = libnonbundle_shared_library.dylib +test $EXECUTABLE_PATH = libnonbundle_shared_library.dylib +[[ ! $WRAPPER_NAME && ${WRAPPER_NAME-_} ]] + +test $DYLIB_INSTALL_NAME_BASE = "/usr/local/lib" +test $LD_DYLIB_INSTALL_NAME = "/usr/local/lib/libnonbundle_shared_library.dylib" diff --git a/tools/gyp/test/mac/type_envvars/test_nonbundle_static_library.sh b/tools/gyp/test/mac/type_envvars/test_nonbundle_static_library.sh new file mode 100755 index 000000000..f16b08c04 --- /dev/null +++ b/tools/gyp/test/mac/type_envvars/test_nonbundle_static_library.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +set -e + +test $MACH_O_TYPE = staticlib +test $PRODUCT_TYPE = com.apple.product-type.library.static +test $PRODUCT_NAME = nonbundle_static_library +test $FULL_PRODUCT_NAME = libnonbundle_static_library.a + +test $EXECUTABLE_NAME = libnonbundle_static_library.a +test $EXECUTABLE_PATH = libnonbundle_static_library.a +[[ ! $WRAPPER_NAME && ${WRAPPER_NAME-_} ]] + +[[ ! $DYLIB_INSTALL_NAME_BASE && ${DYLIB_INSTALL_NAME_BASE-_} ]] +[[ ! $LD_DYLIB_INSTALL_NAME && ${LD_DYLIB_INSTALL_NAME-_} ]] diff --git a/tools/gyp/test/mac/xcode-env-order/Info.plist b/tools/gyp/test/mac/xcode-env-order/Info.plist new file mode 100644 index 000000000..e11f21e52 --- /dev/null +++ b/tools/gyp/test/mac/xcode-env-order/Info.plist @@ -0,0 +1,56 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.google.${PRODUCT_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + BraceProcessedKey1 + ${BRACE_DEPENDENT_KEY1} + BraceProcessedKey2 + ${BRACE_DEPENDENT_KEY2} + BraceProcessedKey3 + ${BRACE_DEPENDENT_KEY3} + + ParenProcessedKey1 + ${PAREN_DEPENDENT_KEY1} + ParenProcessedKey2 + ${PAREN_DEPENDENT_KEY2} + ParenProcessedKey3 + ${PAREN_DEPENDENT_KEY3} + + BareProcessedKey1 + ${BARE_DEPENDENT_KEY1} + BareProcessedKey2 + ${BARE_DEPENDENT_KEY2} + BareProcessedKey3 + ${BARE_DEPENDENT_KEY3} + + MixedProcessedKey + ${MIXED_DEPENDENT_KEY} + + diff --git a/tools/gyp/test/mac/xcode-env-order/main.c b/tools/gyp/test/mac/xcode-env-order/main.c new file mode 100644 index 000000000..1bf4b2a11 --- /dev/null +++ b/tools/gyp/test/mac/xcode-env-order/main.c @@ -0,0 +1,7 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + return 0; +} diff --git a/tools/gyp/test/mac/xcode-env-order/test.gyp b/tools/gyp/test/mac/xcode-env-order/test.gyp new file mode 100644 index 000000000..8433faea3 --- /dev/null +++ b/tools/gyp/test/mac/xcode-env-order/test.gyp @@ -0,0 +1,83 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'test_app', + 'product_name': 'Test', + 'type': 'executable', + 'mac_bundle': 1, + 'sources': [ + 'main.c', + ], + # Env vars in copies. + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/${PRODUCT_NAME}-copy-brace', + 'files': [ 'main.c', ], # ${SOURCE_ROOT} doesn't work with xcode + }, + { + 'destination': '<(PRODUCT_DIR)/$(PRODUCT_NAME)-copy-paren', + 'files': [ '$(SOURCE_ROOT)/main.c', ], + }, + { + 'destination': '<(PRODUCT_DIR)/$PRODUCT_NAME-copy-bare', + 'files': [ 'main.c', ], # $SOURCE_ROOT doesn't work with xcode + }, + ], + # Env vars in actions. + 'actions': [ + { + 'action_name': 'Action copy braces ${PRODUCT_NAME}', + 'description': 'Action copy braces ${PRODUCT_NAME}', + 'inputs': [ '${SOURCE_ROOT}/main.c' ], + # Referencing ${PRODUCT_NAME} in action outputs doesn't work with + # the Xcode generator (PRODUCT_NAME expands to "Test Support"). + 'outputs': [ '<(PRODUCT_DIR)/action-copy-brace.txt' ], + 'action': [ 'cp', '${SOURCE_ROOT}/main.c', + '<(PRODUCT_DIR)/action-copy-brace.txt' ], + }, + { + 'action_name': 'Action copy parens ${PRODUCT_NAME}', + 'description': 'Action copy parens ${PRODUCT_NAME}', + 'inputs': [ '${SOURCE_ROOT}/main.c' ], + # Referencing ${PRODUCT_NAME} in action outputs doesn't work with + # the Xcode generator (PRODUCT_NAME expands to "Test Support"). + 'outputs': [ '<(PRODUCT_DIR)/action-copy-paren.txt' ], + 'action': [ 'cp', '${SOURCE_ROOT}/main.c', + '<(PRODUCT_DIR)/action-copy-paren.txt' ], + }, + { + 'action_name': 'Action copy bare ${PRODUCT_NAME}', + 'description': 'Action copy bare ${PRODUCT_NAME}', + 'inputs': [ '${SOURCE_ROOT}/main.c' ], + # Referencing ${PRODUCT_NAME} in action outputs doesn't work with + # the Xcode generator (PRODUCT_NAME expands to "Test Support"). + 'outputs': [ '<(PRODUCT_DIR)/action-copy-bare.txt' ], + 'action': [ 'cp', '${SOURCE_ROOT}/main.c', + '<(PRODUCT_DIR)/action-copy-bare.txt' ], + }, + ], + # Env vars in copies. + 'xcode_settings': { + 'INFOPLIST_FILE': 'Info.plist', + 'STRING_KEY': '/Source/Project', + + 'BRACE_DEPENDENT_KEY2': '${STRING_KEY}/${PRODUCT_NAME}', + 'BRACE_DEPENDENT_KEY1': 'D:${BRACE_DEPENDENT_KEY2}', + 'BRACE_DEPENDENT_KEY3': '${PRODUCT_TYPE}:${BRACE_DEPENDENT_KEY1}', + + 'PAREN_DEPENDENT_KEY2': '$(STRING_KEY)/$(PRODUCT_NAME)', + 'PAREN_DEPENDENT_KEY1': 'D:$(PAREN_DEPENDENT_KEY2)', + 'PAREN_DEPENDENT_KEY3': '$(PRODUCT_TYPE):$(PAREN_DEPENDENT_KEY1)', + + 'BARE_DEPENDENT_KEY2': '$STRING_KEY/$PRODUCT_NAME', + 'BARE_DEPENDENT_KEY1': 'D:$BARE_DEPENDENT_KEY2', + 'BARE_DEPENDENT_KEY3': '$PRODUCT_TYPE:$BARE_DEPENDENT_KEY1', + + 'MIXED_DEPENDENT_KEY': '${STRING_KEY}:$(PRODUCT_NAME):$MACH_O_TYPE', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/xcode-gcc/test.gyp b/tools/gyp/test/mac/xcode-gcc/test.gyp new file mode 100644 index 000000000..1ca8b215d --- /dev/null +++ b/tools/gyp/test/mac/xcode-gcc/test.gyp @@ -0,0 +1,60 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'target_defaults': { + 'xcode_settings': { + 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES', + }, + }, + + 'variables': { + # Non-failing tests should check that these trivial files in every language + # still compile correctly. + 'valid_sources': [ + 'valid_c.c', + 'valid_cc.cc', + 'valid_m.m', + 'valid_mm.mm', + ], + }, + + # Targets come in pairs: 'foo' and 'foo-fail', with the former building with + # no warnings and the latter not. + 'targets': [ + # GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO (default: YES): + { + 'target_name': 'warn_about_invalid_offsetof_macro', + 'type': 'executable', + 'sources': [ + 'warn_about_invalid_offsetof_macro.cc', + '<@(valid_sources)', + ], + 'xcode_settings': { + 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'NO', + }, + }, + { + 'target_name': 'warn_about_invalid_offsetof_macro-fail', + 'type': 'executable', + 'sources': [ 'warn_about_invalid_offsetof_macro.cc', ], + }, + # GCC_WARN_ABOUT_MISSING_NEWLINE (default: NO): + { + 'target_name': 'warn_about_missing_newline', + 'type': 'executable', + 'sources': [ + 'warn_about_missing_newline.c', + '<@(valid_sources)', + ], + }, + { + 'target_name': 'warn_about_missing_newline-fail', + 'type': 'executable', + 'sources': [ 'warn_about_missing_newline.c', ], + 'xcode_settings': { + 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', + }, + }, + ], +} diff --git a/tools/gyp/test/mac/xcode-gcc/valid_c.c b/tools/gyp/test/mac/xcode-gcc/valid_c.c new file mode 100644 index 000000000..2b10ac3ed --- /dev/null +++ b/tools/gyp/test/mac/xcode-gcc/valid_c.c @@ -0,0 +1,8 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file exists to test that valid C files compile correctly. + +void FunctionInCFile(void) { +} diff --git a/tools/gyp/test/mac/xcode-gcc/valid_cc.cc b/tools/gyp/test/mac/xcode-gcc/valid_cc.cc new file mode 100644 index 000000000..31cddc3c9 --- /dev/null +++ b/tools/gyp/test/mac/xcode-gcc/valid_cc.cc @@ -0,0 +1,8 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file exists to test that valid C++ files compile correctly. + +void FunctionInCCFile() { +} diff --git a/tools/gyp/test/mac/xcode-gcc/valid_m.m b/tools/gyp/test/mac/xcode-gcc/valid_m.m new file mode 100644 index 000000000..95bddb272 --- /dev/null +++ b/tools/gyp/test/mac/xcode-gcc/valid_m.m @@ -0,0 +1,8 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file exists to test that valid Objective-C files compile correctly. + +void FunctionInMFile(void) { +} diff --git a/tools/gyp/test/mac/xcode-gcc/valid_mm.mm b/tools/gyp/test/mac/xcode-gcc/valid_mm.mm new file mode 100644 index 000000000..a7db7e3ad --- /dev/null +++ b/tools/gyp/test/mac/xcode-gcc/valid_mm.mm @@ -0,0 +1,8 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file exists to test that valid Objective-C++ files compile correctly. + +void FunctionInMMFile() { +} diff --git a/tools/gyp/test/mac/xcode-gcc/warn_about_invalid_offsetof_macro.cc b/tools/gyp/test/mac/xcode-gcc/warn_about_invalid_offsetof_macro.cc new file mode 100644 index 000000000..4a4612be0 --- /dev/null +++ b/tools/gyp/test/mac/xcode-gcc/warn_about_invalid_offsetof_macro.cc @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#define offsetof(st, m) ((unsigned)((char*)&((st*)0)->m - (char*)0)) + +struct MyStruct { + virtual void MyFunc() = 0; + int my_member; +}; + +int main() { + unsigned x = offsetof(MyStruct, my_member); + return x ? 0 : 1; +} diff --git a/tools/gyp/test/mac/xcode-gcc/warn_about_missing_newline.c b/tools/gyp/test/mac/xcode-gcc/warn_about_missing_newline.c new file mode 100644 index 000000000..6faf0895d --- /dev/null +++ b/tools/gyp/test/mac/xcode-gcc/warn_about_missing_newline.c @@ -0,0 +1,8 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Important: Don't terminate this file with a newline. +int main() { + return 0; +} \ No newline at end of file diff --git a/tools/gyp/test/make/dependencies.gyp b/tools/gyp/test/make/dependencies.gyp new file mode 100644 index 000000000..e2bee24fc --- /dev/null +++ b/tools/gyp/test/make/dependencies.gyp @@ -0,0 +1,15 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'main', + 'type': 'executable', + 'sources': [ + 'main.cc', + ], + }, + ], +} diff --git a/tools/gyp/test/make/gyptest-dependencies.py b/tools/gyp/test/make/gyptest-dependencies.py new file mode 100755 index 000000000..d215f7678 --- /dev/null +++ b/tools/gyp/test/make/gyptest-dependencies.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that .d files and all.deps are properly generated. +""" + +import TestGyp + +# .d files are only used by the make build. +test = TestGyp.TestGyp(formats=['make']) + +test.run_gyp('dependencies.gyp') + +test.build('dependencies.gyp', test.ALL) + +deps_file = test.built_file_path(".deps/out/Default/obj.target/main/main.o.d") +test.must_contain(deps_file, "main.h") + +# Build a second time to make sure we generate all.deps. +test.build('dependencies.gyp', test.ALL) + +test.pass_test() diff --git a/tools/gyp/test/make/gyptest-noload.py b/tools/gyp/test/make/gyptest-noload.py new file mode 100755 index 000000000..1f5103315 --- /dev/null +++ b/tools/gyp/test/make/gyptest-noload.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python + +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Tests the use of the NO_LOAD flag which makes loading sub .mk files +optional. +""" + +# Python 2.5 needs this for the with statement. +from __future__ import with_statement + +import os +import TestGyp + +test = TestGyp.TestGyp(formats=['make']) + +test.run_gyp('all.gyp', chdir='noload') + +test.relocate('noload', 'relocate/noload') + +test.build('build/all.gyp', test.ALL, chdir='relocate/noload') +test.run_built_executable('exe', chdir='relocate/noload', + stdout='Hello from shared.c.\n') + +# Just sanity test that NO_LOAD=lib doesn't break anything. +test.build('build/all.gyp', test.ALL, chdir='relocate/noload', + arguments=['NO_LOAD=lib']) +test.run_built_executable('exe', chdir='relocate/noload', + stdout='Hello from shared.c.\n') +test.build('build/all.gyp', test.ALL, chdir='relocate/noload', + arguments=['NO_LOAD=z']) +test.run_built_executable('exe', chdir='relocate/noload', + stdout='Hello from shared.c.\n') + +# Make sure we can rebuild without reloading the sub .mk file. +with open('relocate/noload/main.c', 'a') as src_file: + src_file.write("\n") +test.build('build/all.gyp', test.ALL, chdir='relocate/noload', + arguments=['NO_LOAD=lib']) +test.run_built_executable('exe', chdir='relocate/noload', + stdout='Hello from shared.c.\n') + +# Change shared.c, but verify that it doesn't get rebuild if we don't load it. +with open('relocate/noload/lib/shared.c', 'w') as shared_file: + shared_file.write( + '#include "shared.h"\n' + 'const char kSharedStr[] = "modified";\n' + ) +test.build('build/all.gyp', test.ALL, chdir='relocate/noload', + arguments=['NO_LOAD=lib']) +test.run_built_executable('exe', chdir='relocate/noload', + stdout='Hello from shared.c.\n') + +test.pass_test() diff --git a/tools/gyp/test/make/main.cc b/tools/gyp/test/make/main.cc new file mode 100644 index 000000000..70ac6e46a --- /dev/null +++ b/tools/gyp/test/make/main.cc @@ -0,0 +1,12 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +#include "main.h" + +int main(int argc, char *argv[]) { + printf("hello world\n"); + return 0; +} diff --git a/tools/gyp/test/make/main.h b/tools/gyp/test/make/main.h new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/make/noload/all.gyp b/tools/gyp/test/make/noload/all.gyp new file mode 100644 index 000000000..1617a9e97 --- /dev/null +++ b/tools/gyp/test/make/noload/all.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'exe', + 'type': 'executable', + 'sources': [ + 'main.c', + ], + 'dependencies': [ + 'lib/shared.gyp:shared', + ], + }, + ], +} diff --git a/tools/gyp/test/make/noload/lib/shared.c b/tools/gyp/test/make/noload/lib/shared.c new file mode 100644 index 000000000..51776c5ac --- /dev/null +++ b/tools/gyp/test/make/noload/lib/shared.c @@ -0,0 +1,3 @@ +#include "shared.h" + +const char kSharedStr[] = "shared.c"; diff --git a/tools/gyp/test/make/noload/lib/shared.gyp b/tools/gyp/test/make/noload/lib/shared.gyp new file mode 100644 index 000000000..8a8841b3a --- /dev/null +++ b/tools/gyp/test/make/noload/lib/shared.gyp @@ -0,0 +1,16 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'shared', + 'type': 'shared_library', + 'sources': [ + 'shared.c', + 'shared.h', + ], + }, + ], +} diff --git a/tools/gyp/test/make/noload/lib/shared.h b/tools/gyp/test/make/noload/lib/shared.h new file mode 100644 index 000000000..a21da7538 --- /dev/null +++ b/tools/gyp/test/make/noload/lib/shared.h @@ -0,0 +1 @@ +extern const char kSharedStr[]; diff --git a/tools/gyp/test/make/noload/main.c b/tools/gyp/test/make/noload/main.c new file mode 100644 index 000000000..46d3c52c2 --- /dev/null +++ b/tools/gyp/test/make/noload/main.c @@ -0,0 +1,9 @@ +#include + +#include "lib/shared.h" + +int main(int argc, char *argv[]) +{ + printf("Hello from %s.\n", kSharedStr); + return 0; +} diff --git a/tools/gyp/test/many-actions/file0 b/tools/gyp/test/many-actions/file0 new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/many-actions/file1 b/tools/gyp/test/many-actions/file1 new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/many-actions/file2 b/tools/gyp/test/many-actions/file2 new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/many-actions/file3 b/tools/gyp/test/many-actions/file3 new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/many-actions/file4 b/tools/gyp/test/many-actions/file4 new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/many-actions/gyptest-many-actions-unsorted.py b/tools/gyp/test/many-actions/gyptest-many-actions-unsorted.py new file mode 100644 index 000000000..5cb033878 --- /dev/null +++ b/tools/gyp/test/many-actions/gyptest-many-actions-unsorted.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure lots of actions in the same target don't cause exceeding command +line length. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('many-actions-unsorted.gyp') +test.build('many-actions-unsorted.gyp', test.ALL) +for i in range(15): + test.built_file_must_exist('generated_%d.h' % i) + +# Make sure the optimized cygwin setup doesn't cause problems for incremental +# builds. +test.touch('file1') +test.build('many-actions-unsorted.gyp', test.ALL) + +test.touch('file0') +test.build('many-actions-unsorted.gyp', test.ALL) + +test.touch('file2') +test.touch('file3') +test.touch('file4') +test.build('many-actions-unsorted.gyp', test.ALL) + +test.pass_test() diff --git a/tools/gyp/test/many-actions/gyptest-many-actions.py b/tools/gyp/test/many-actions/gyptest-many-actions.py new file mode 100644 index 000000000..9c71641f3 --- /dev/null +++ b/tools/gyp/test/many-actions/gyptest-many-actions.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure lots of actions in the same target don't cause exceeding command +line length. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('many-actions.gyp') +test.build('many-actions.gyp', test.ALL) +for i in range(200): + test.built_file_must_exist('generated_%d.h' % i) +test.pass_test() diff --git a/tools/gyp/test/many-actions/many-actions-unsorted.gyp b/tools/gyp/test/many-actions/many-actions-unsorted.gyp new file mode 100644 index 000000000..eec79fe8d --- /dev/null +++ b/tools/gyp/test/many-actions/many-actions-unsorted.gyp @@ -0,0 +1,154 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'msvs_cygwin_dirs': ['../../../../<(DEPTH)/third_party/cygwin'], + }, + 'targets': [ + { + 'target_name': 'a', + 'type': 'none', + 'actions': [ + # Notice that the inputs go 0, 1, ..., 0, 1, .... This is to test + # a regression in the msvs generator in _AddActions. + { + 'action_name': 'do_0', + 'inputs': ['file0'], + 'outputs': ['<(PRODUCT_DIR)/generated_0.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_0.h', + ], + }, + { + 'action_name': 'do_1', + 'inputs': ['file1'], + 'outputs': ['<(PRODUCT_DIR)/generated_1.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_1.h', + ], + }, + { + 'action_name': 'do_2', + 'inputs': ['file2'], + 'outputs': ['<(PRODUCT_DIR)/generated_2.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_2.h', + ], + }, + { + 'action_name': 'do_3', + 'inputs': ['file3'], + 'outputs': ['<(PRODUCT_DIR)/generated_3.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_3.h', + ], + }, + { + 'action_name': 'do_4', + 'inputs': ['file4'], + 'outputs': ['<(PRODUCT_DIR)/generated_4.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_4.h', + ], + }, + { + 'action_name': 'do_5', + 'inputs': ['file0'], + 'outputs': ['<(PRODUCT_DIR)/generated_5.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_5.h', + ], + }, + { + 'action_name': 'do_6', + 'inputs': ['file1'], + 'outputs': ['<(PRODUCT_DIR)/generated_6.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_6.h', + ], + }, + { + 'action_name': 'do_7', + 'inputs': ['file2'], + 'outputs': ['<(PRODUCT_DIR)/generated_7.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_7.h', + ], + }, + { + 'action_name': 'do_8', + 'inputs': ['file3'], + 'outputs': ['<(PRODUCT_DIR)/generated_8.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_8.h', + ], + }, + { + 'action_name': 'do_9', + 'inputs': ['file4'], + 'outputs': ['<(PRODUCT_DIR)/generated_9.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_9.h', + ], + }, + { + 'action_name': 'do_10', + 'inputs': ['file0'], + 'outputs': ['<(PRODUCT_DIR)/generated_10.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_10.h', + ], + }, + { + 'action_name': 'do_11', + 'inputs': ['file1'], + 'outputs': ['<(PRODUCT_DIR)/generated_11.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_11.h', + ], + }, + { + 'action_name': 'do_12', + 'inputs': ['file2'], + 'outputs': ['<(PRODUCT_DIR)/generated_12.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_12.h', + ], + }, + { + 'action_name': 'do_13', + 'inputs': ['file3'], + 'outputs': ['<(PRODUCT_DIR)/generated_13.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_13.h', + ], + }, + { + 'action_name': 'do_14', + 'inputs': ['file4'], + 'outputs': ['<(PRODUCT_DIR)/generated_14.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_14.h', + ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/many-actions/many-actions.gyp b/tools/gyp/test/many-actions/many-actions.gyp new file mode 100644 index 000000000..38545d2d8 --- /dev/null +++ b/tools/gyp/test/many-actions/many-actions.gyp @@ -0,0 +1,1817 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'msvs_cygwin_dirs': ['../../../../<(DEPTH)/third_party/cygwin'], + }, + 'targets': [ + { + 'target_name': 'a', + 'type': 'none', + 'actions': [ + { + 'action_name': 'do_0', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_0.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_0.h', + ], + }, + { + 'action_name': 'do_1', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_1.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_1.h', + ], + }, + { + 'action_name': 'do_2', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_2.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_2.h', + ], + }, + { + 'action_name': 'do_3', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_3.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_3.h', + ], + }, + { + 'action_name': 'do_4', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_4.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_4.h', + ], + }, + { + 'action_name': 'do_5', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_5.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_5.h', + ], + }, + { + 'action_name': 'do_6', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_6.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_6.h', + ], + }, + { + 'action_name': 'do_7', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_7.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_7.h', + ], + }, + { + 'action_name': 'do_8', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_8.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_8.h', + ], + }, + { + 'action_name': 'do_9', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_9.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_9.h', + ], + }, + { + 'action_name': 'do_10', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_10.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_10.h', + ], + }, + { + 'action_name': 'do_11', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_11.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_11.h', + ], + }, + { + 'action_name': 'do_12', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_12.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_12.h', + ], + }, + { + 'action_name': 'do_13', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_13.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_13.h', + ], + }, + { + 'action_name': 'do_14', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_14.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_14.h', + ], + }, + { + 'action_name': 'do_15', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_15.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_15.h', + ], + }, + { + 'action_name': 'do_16', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_16.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_16.h', + ], + }, + { + 'action_name': 'do_17', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_17.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_17.h', + ], + }, + { + 'action_name': 'do_18', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_18.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_18.h', + ], + }, + { + 'action_name': 'do_19', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_19.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_19.h', + ], + }, + { + 'action_name': 'do_20', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_20.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_20.h', + ], + }, + { + 'action_name': 'do_21', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_21.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_21.h', + ], + }, + { + 'action_name': 'do_22', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_22.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_22.h', + ], + }, + { + 'action_name': 'do_23', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_23.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_23.h', + ], + }, + { + 'action_name': 'do_24', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_24.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_24.h', + ], + }, + { + 'action_name': 'do_25', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_25.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_25.h', + ], + }, + { + 'action_name': 'do_26', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_26.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_26.h', + ], + }, + { + 'action_name': 'do_27', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_27.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_27.h', + ], + }, + { + 'action_name': 'do_28', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_28.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_28.h', + ], + }, + { + 'action_name': 'do_29', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_29.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_29.h', + ], + }, + { + 'action_name': 'do_30', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_30.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_30.h', + ], + }, + { + 'action_name': 'do_31', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_31.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_31.h', + ], + }, + { + 'action_name': 'do_32', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_32.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_32.h', + ], + }, + { + 'action_name': 'do_33', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_33.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_33.h', + ], + }, + { + 'action_name': 'do_34', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_34.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_34.h', + ], + }, + { + 'action_name': 'do_35', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_35.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_35.h', + ], + }, + { + 'action_name': 'do_36', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_36.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_36.h', + ], + }, + { + 'action_name': 'do_37', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_37.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_37.h', + ], + }, + { + 'action_name': 'do_38', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_38.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_38.h', + ], + }, + { + 'action_name': 'do_39', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_39.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_39.h', + ], + }, + { + 'action_name': 'do_40', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_40.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_40.h', + ], + }, + { + 'action_name': 'do_41', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_41.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_41.h', + ], + }, + { + 'action_name': 'do_42', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_42.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_42.h', + ], + }, + { + 'action_name': 'do_43', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_43.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_43.h', + ], + }, + { + 'action_name': 'do_44', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_44.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_44.h', + ], + }, + { + 'action_name': 'do_45', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_45.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_45.h', + ], + }, + { + 'action_name': 'do_46', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_46.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_46.h', + ], + }, + { + 'action_name': 'do_47', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_47.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_47.h', + ], + }, + { + 'action_name': 'do_48', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_48.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_48.h', + ], + }, + { + 'action_name': 'do_49', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_49.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_49.h', + ], + }, + { + 'action_name': 'do_50', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_50.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_50.h', + ], + }, + { + 'action_name': 'do_51', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_51.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_51.h', + ], + }, + { + 'action_name': 'do_52', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_52.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_52.h', + ], + }, + { + 'action_name': 'do_53', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_53.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_53.h', + ], + }, + { + 'action_name': 'do_54', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_54.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_54.h', + ], + }, + { + 'action_name': 'do_55', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_55.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_55.h', + ], + }, + { + 'action_name': 'do_56', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_56.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_56.h', + ], + }, + { + 'action_name': 'do_57', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_57.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_57.h', + ], + }, + { + 'action_name': 'do_58', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_58.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_58.h', + ], + }, + { + 'action_name': 'do_59', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_59.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_59.h', + ], + }, + { + 'action_name': 'do_60', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_60.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_60.h', + ], + }, + { + 'action_name': 'do_61', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_61.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_61.h', + ], + }, + { + 'action_name': 'do_62', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_62.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_62.h', + ], + }, + { + 'action_name': 'do_63', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_63.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_63.h', + ], + }, + { + 'action_name': 'do_64', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_64.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_64.h', + ], + }, + { + 'action_name': 'do_65', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_65.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_65.h', + ], + }, + { + 'action_name': 'do_66', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_66.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_66.h', + ], + }, + { + 'action_name': 'do_67', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_67.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_67.h', + ], + }, + { + 'action_name': 'do_68', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_68.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_68.h', + ], + }, + { + 'action_name': 'do_69', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_69.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_69.h', + ], + }, + { + 'action_name': 'do_70', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_70.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_70.h', + ], + }, + { + 'action_name': 'do_71', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_71.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_71.h', + ], + }, + { + 'action_name': 'do_72', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_72.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_72.h', + ], + }, + { + 'action_name': 'do_73', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_73.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_73.h', + ], + }, + { + 'action_name': 'do_74', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_74.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_74.h', + ], + }, + { + 'action_name': 'do_75', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_75.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_75.h', + ], + }, + { + 'action_name': 'do_76', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_76.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_76.h', + ], + }, + { + 'action_name': 'do_77', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_77.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_77.h', + ], + }, + { + 'action_name': 'do_78', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_78.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_78.h', + ], + }, + { + 'action_name': 'do_79', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_79.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_79.h', + ], + }, + { + 'action_name': 'do_80', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_80.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_80.h', + ], + }, + { + 'action_name': 'do_81', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_81.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_81.h', + ], + }, + { + 'action_name': 'do_82', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_82.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_82.h', + ], + }, + { + 'action_name': 'do_83', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_83.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_83.h', + ], + }, + { + 'action_name': 'do_84', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_84.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_84.h', + ], + }, + { + 'action_name': 'do_85', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_85.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_85.h', + ], + }, + { + 'action_name': 'do_86', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_86.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_86.h', + ], + }, + { + 'action_name': 'do_87', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_87.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_87.h', + ], + }, + { + 'action_name': 'do_88', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_88.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_88.h', + ], + }, + { + 'action_name': 'do_89', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_89.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_89.h', + ], + }, + { + 'action_name': 'do_90', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_90.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_90.h', + ], + }, + { + 'action_name': 'do_91', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_91.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_91.h', + ], + }, + { + 'action_name': 'do_92', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_92.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_92.h', + ], + }, + { + 'action_name': 'do_93', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_93.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_93.h', + ], + }, + { + 'action_name': 'do_94', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_94.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_94.h', + ], + }, + { + 'action_name': 'do_95', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_95.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_95.h', + ], + }, + { + 'action_name': 'do_96', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_96.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_96.h', + ], + }, + { + 'action_name': 'do_97', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_97.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_97.h', + ], + }, + { + 'action_name': 'do_98', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_98.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_98.h', + ], + }, + { + 'action_name': 'do_99', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_99.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_99.h', + ], + }, + { + 'action_name': 'do_100', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_100.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_100.h', + ], + }, + { + 'action_name': 'do_101', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_101.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_101.h', + ], + }, + { + 'action_name': 'do_102', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_102.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_102.h', + ], + }, + { + 'action_name': 'do_103', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_103.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_103.h', + ], + }, + { + 'action_name': 'do_104', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_104.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_104.h', + ], + }, + { + 'action_name': 'do_105', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_105.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_105.h', + ], + }, + { + 'action_name': 'do_106', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_106.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_106.h', + ], + }, + { + 'action_name': 'do_107', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_107.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_107.h', + ], + }, + { + 'action_name': 'do_108', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_108.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_108.h', + ], + }, + { + 'action_name': 'do_109', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_109.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_109.h', + ], + }, + { + 'action_name': 'do_110', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_110.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_110.h', + ], + }, + { + 'action_name': 'do_111', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_111.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_111.h', + ], + }, + { + 'action_name': 'do_112', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_112.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_112.h', + ], + }, + { + 'action_name': 'do_113', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_113.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_113.h', + ], + }, + { + 'action_name': 'do_114', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_114.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_114.h', + ], + }, + { + 'action_name': 'do_115', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_115.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_115.h', + ], + }, + { + 'action_name': 'do_116', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_116.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_116.h', + ], + }, + { + 'action_name': 'do_117', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_117.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_117.h', + ], + }, + { + 'action_name': 'do_118', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_118.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_118.h', + ], + }, + { + 'action_name': 'do_119', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_119.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_119.h', + ], + }, + { + 'action_name': 'do_120', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_120.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_120.h', + ], + }, + { + 'action_name': 'do_121', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_121.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_121.h', + ], + }, + { + 'action_name': 'do_122', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_122.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_122.h', + ], + }, + { + 'action_name': 'do_123', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_123.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_123.h', + ], + }, + { + 'action_name': 'do_124', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_124.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_124.h', + ], + }, + { + 'action_name': 'do_125', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_125.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_125.h', + ], + }, + { + 'action_name': 'do_126', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_126.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_126.h', + ], + }, + { + 'action_name': 'do_127', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_127.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_127.h', + ], + }, + { + 'action_name': 'do_128', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_128.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_128.h', + ], + }, + { + 'action_name': 'do_129', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_129.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_129.h', + ], + }, + { + 'action_name': 'do_130', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_130.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_130.h', + ], + }, + { + 'action_name': 'do_131', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_131.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_131.h', + ], + }, + { + 'action_name': 'do_132', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_132.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_132.h', + ], + }, + { + 'action_name': 'do_133', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_133.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_133.h', + ], + }, + { + 'action_name': 'do_134', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_134.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_134.h', + ], + }, + { + 'action_name': 'do_135', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_135.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_135.h', + ], + }, + { + 'action_name': 'do_136', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_136.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_136.h', + ], + }, + { + 'action_name': 'do_137', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_137.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_137.h', + ], + }, + { + 'action_name': 'do_138', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_138.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_138.h', + ], + }, + { + 'action_name': 'do_139', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_139.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_139.h', + ], + }, + { + 'action_name': 'do_140', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_140.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_140.h', + ], + }, + { + 'action_name': 'do_141', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_141.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_141.h', + ], + }, + { + 'action_name': 'do_142', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_142.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_142.h', + ], + }, + { + 'action_name': 'do_143', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_143.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_143.h', + ], + }, + { + 'action_name': 'do_144', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_144.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_144.h', + ], + }, + { + 'action_name': 'do_145', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_145.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_145.h', + ], + }, + { + 'action_name': 'do_146', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_146.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_146.h', + ], + }, + { + 'action_name': 'do_147', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_147.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_147.h', + ], + }, + { + 'action_name': 'do_148', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_148.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_148.h', + ], + }, + { + 'action_name': 'do_149', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_149.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_149.h', + ], + }, + { + 'action_name': 'do_150', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_150.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_150.h', + ], + }, + { + 'action_name': 'do_151', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_151.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_151.h', + ], + }, + { + 'action_name': 'do_152', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_152.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_152.h', + ], + }, + { + 'action_name': 'do_153', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_153.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_153.h', + ], + }, + { + 'action_name': 'do_154', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_154.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_154.h', + ], + }, + { + 'action_name': 'do_155', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_155.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_155.h', + ], + }, + { + 'action_name': 'do_156', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_156.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_156.h', + ], + }, + { + 'action_name': 'do_157', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_157.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_157.h', + ], + }, + { + 'action_name': 'do_158', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_158.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_158.h', + ], + }, + { + 'action_name': 'do_159', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_159.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_159.h', + ], + }, + { + 'action_name': 'do_160', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_160.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_160.h', + ], + }, + { + 'action_name': 'do_161', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_161.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_161.h', + ], + }, + { + 'action_name': 'do_162', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_162.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_162.h', + ], + }, + { + 'action_name': 'do_163', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_163.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_163.h', + ], + }, + { + 'action_name': 'do_164', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_164.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_164.h', + ], + }, + { + 'action_name': 'do_165', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_165.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_165.h', + ], + }, + { + 'action_name': 'do_166', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_166.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_166.h', + ], + }, + { + 'action_name': 'do_167', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_167.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_167.h', + ], + }, + { + 'action_name': 'do_168', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_168.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_168.h', + ], + }, + { + 'action_name': 'do_169', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_169.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_169.h', + ], + }, + { + 'action_name': 'do_170', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_170.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_170.h', + ], + }, + { + 'action_name': 'do_171', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_171.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_171.h', + ], + }, + { + 'action_name': 'do_172', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_172.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_172.h', + ], + }, + { + 'action_name': 'do_173', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_173.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_173.h', + ], + }, + { + 'action_name': 'do_174', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_174.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_174.h', + ], + }, + { + 'action_name': 'do_175', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_175.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_175.h', + ], + }, + { + 'action_name': 'do_176', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_176.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_176.h', + ], + }, + { + 'action_name': 'do_177', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_177.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_177.h', + ], + }, + { + 'action_name': 'do_178', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_178.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_178.h', + ], + }, + { + 'action_name': 'do_179', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_179.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_179.h', + ], + }, + { + 'action_name': 'do_180', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_180.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_180.h', + ], + }, + { + 'action_name': 'do_181', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_181.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_181.h', + ], + }, + { + 'action_name': 'do_182', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_182.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_182.h', + ], + }, + { + 'action_name': 'do_183', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_183.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_183.h', + ], + }, + { + 'action_name': 'do_184', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_184.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_184.h', + ], + }, + { + 'action_name': 'do_185', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_185.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_185.h', + ], + }, + { + 'action_name': 'do_186', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_186.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_186.h', + ], + }, + { + 'action_name': 'do_187', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_187.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_187.h', + ], + }, + { + 'action_name': 'do_188', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_188.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_188.h', + ], + }, + { + 'action_name': 'do_189', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_189.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_189.h', + ], + }, + { + 'action_name': 'do_190', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_190.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_190.h', + ], + }, + { + 'action_name': 'do_191', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_191.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_191.h', + ], + }, + { + 'action_name': 'do_192', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_192.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_192.h', + ], + }, + { + 'action_name': 'do_193', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_193.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_193.h', + ], + }, + { + 'action_name': 'do_194', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_194.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_194.h', + ], + }, + { + 'action_name': 'do_195', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_195.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_195.h', + ], + }, + { + 'action_name': 'do_196', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_196.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_196.h', + ], + }, + { + 'action_name': 'do_197', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_197.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_197.h', + ], + }, + { + 'action_name': 'do_198', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_198.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_198.h', + ], + }, + { + 'action_name': 'do_199', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/generated_199.h'], + 'action': [ + 'touch', + '<(PRODUCT_DIR)/generated_199.h', + ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/module/gyptest-default.py b/tools/gyp/test/module/gyptest-default.py new file mode 100755 index 000000000..6b1c9b6a8 --- /dev/null +++ b/tools/gyp/test/module/gyptest-default.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simple build of a "Hello, world!" program with loadable modules. The +default for all platforms should be to output the loadable modules to the same +path as the executable. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('module.gyp', chdir='src') + +test.build('module.gyp', test.ALL, chdir='src') + +expect = """\ +Hello from program.c +Hello from lib1.c +Hello from lib2.c +""" +test.run_built_executable('program', chdir='src', stdout=expect) + +test.pass_test() diff --git a/tools/gyp/test/module/src/lib1.c b/tools/gyp/test/module/src/lib1.c new file mode 100644 index 000000000..8de0e94be --- /dev/null +++ b/tools/gyp/test/module/src/lib1.c @@ -0,0 +1,10 @@ +#include + +#ifdef _WIN32 +__declspec(dllexport) +#endif +void module_main(void) +{ + fprintf(stdout, "Hello from lib1.c\n"); + fflush(stdout); +} diff --git a/tools/gyp/test/module/src/lib2.c b/tools/gyp/test/module/src/lib2.c new file mode 100644 index 000000000..266396dc9 --- /dev/null +++ b/tools/gyp/test/module/src/lib2.c @@ -0,0 +1,10 @@ +#include + +#ifdef _WIN32 +__declspec(dllexport) +#endif +void module_main(void) +{ + fprintf(stdout, "Hello from lib2.c\n"); + fflush(stdout); +} diff --git a/tools/gyp/test/module/src/module.gyp b/tools/gyp/test/module/src/module.gyp new file mode 100644 index 000000000..cc567ef7b --- /dev/null +++ b/tools/gyp/test/module/src/module.gyp @@ -0,0 +1,55 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'conditions': [ + ['OS=="win"', { + 'defines': ['PLATFORM_WIN'], + }], + ['OS=="mac"', { + 'defines': ['PLATFORM_MAC'], + }], + ['OS=="linux"', { + 'defines': ['PLATFORM_LINUX'], + # Support 64-bit shared libs (also works fine for 32-bit). + 'cflags': ['-fPIC'], + 'libraries': ['-ldl'], + }], + ], + }, + 'targets': [ + { + 'target_name': 'program', + 'type': 'executable', + 'dependencies': [ + 'lib1', + 'lib2', + ], + 'sources': [ + 'program.c', + ], + }, + { + 'target_name': 'lib1', + 'type': 'loadable_module', + 'product_name': 'lib1', + 'product_prefix': '', + 'xcode_settings': {'OTHER_LDFLAGS': ['-dynamiclib'], 'MACH_O_TYPE': ''}, + 'sources': [ + 'lib1.c', + ], + }, + { + 'target_name': 'lib2', + 'product_name': 'lib2', + 'product_prefix': '', + 'type': 'loadable_module', + 'xcode_settings': {'OTHER_LDFLAGS': ['-dynamiclib'], 'MACH_O_TYPE': ''}, + 'sources': [ + 'lib2.c', + ], + }, + ], +} diff --git a/tools/gyp/test/module/src/program.c b/tools/gyp/test/module/src/program.c new file mode 100644 index 000000000..b2f332091 --- /dev/null +++ b/tools/gyp/test/module/src/program.c @@ -0,0 +1,111 @@ +#include +#include + +#if defined(PLATFORM_WIN) +#include +#elif defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) +#include +#include +#include +#include +#define MAX_PATH PATH_MAX +#endif + +#if defined(PLATFORM_WIN) +#define MODULE_SUFFIX ".dll" +#elif defined(PLATFORM_MAC) +#define MODULE_SUFFIX ".so" +#elif defined(PLATFORM_LINUX) +#define MODULE_SUFFIX ".so" +#endif + +typedef void (*module_symbol)(void); +char bin_path[MAX_PATH + 1]; + + +void CallModule(const char* module) { + char module_path[MAX_PATH + 1]; + const char* module_function = "module_main"; + module_symbol funcptr; +#if defined(PLATFORM_WIN) + HMODULE dl; + char drive[_MAX_DRIVE]; + char dir[_MAX_DIR]; + + if (_splitpath_s(bin_path, drive, _MAX_DRIVE, dir, _MAX_DIR, + NULL, 0, NULL, 0)) { + fprintf(stderr, "Failed to split executable path.\n"); + return; + } + if (_makepath_s(module_path, MAX_PATH, drive, dir, module, MODULE_SUFFIX)) { + fprintf(stderr, "Failed to calculate module path.\n"); + return; + } + + dl = LoadLibrary(module_path); + if (!dl) { + fprintf(stderr, "Failed to open module: %s\n", module_path); + return; + } + + funcptr = (module_symbol) GetProcAddress(dl, module_function); + if (!funcptr) { + fprintf(stderr, "Failed to find symbol: %s\n", module_function); + return; + } + funcptr(); + + FreeLibrary(dl); +#elif defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) + void* dl; + char* path_copy = strdup(bin_path); + char* bin_dir = dirname(path_copy); + int path_size = snprintf(module_path, MAX_PATH, "%s/%s%s", bin_dir, module, + MODULE_SUFFIX); + free(path_copy); + if (path_size < 0 || path_size > MAX_PATH) { + fprintf(stderr, "Failed to calculate module path.\n"); + return; + } + module_path[path_size] = 0; + + dl = dlopen(module_path, RTLD_LAZY); + if (!dl) { + fprintf(stderr, "Failed to open module: %s\n", module_path); + return; + } + + funcptr = dlsym(dl, module_function); + if (!funcptr) { + fprintf(stderr, "Failed to find symbol: %s\n", module_function); + return; + } + funcptr(); + + dlclose(dl); +#endif +} + +int main(int argc, char *argv[]) +{ + fprintf(stdout, "Hello from program.c\n"); + fflush(stdout); + +#if defined(PLATFORM_WIN) + if (!GetModuleFileName(NULL, bin_path, MAX_PATH)) { + fprintf(stderr, "Failed to determine executable path.\n"); + return; + } +#elif defined(PLATFORM_MAC) || defined(PLATFORM_LINUX) + // Using argv[0] should be OK here since we control how the tests run, and + // can avoid exec and such issues that make it unreliable. + if (!realpath(argv[0], bin_path)) { + fprintf(stderr, "Failed to determine executable path (%s).\n", argv[0]); + return; + } +#endif + + CallModule("lib1"); + CallModule("lib2"); + return 0; +} diff --git a/tools/gyp/test/msvs/config_attrs/gyptest-config_attrs.py b/tools/gyp/test/msvs/config_attrs/gyptest-config_attrs.py new file mode 100644 index 000000000..15f4b4ef2 --- /dev/null +++ b/tools/gyp/test/msvs/config_attrs/gyptest-config_attrs.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that msvs_configuration_attributes and +msbuild_configuration_attributes are applied by using +them to set the OutputDirectory. +""" + +import TestGyp +import os + +test = TestGyp.TestGyp(workdir='workarea_all',formats=['msvs']) + +vc_version = 'VC90' + +if os.getenv('GYP_MSVS_VERSION'): + vc_version = ['VC90','VC100'][int(os.getenv('GYP_MSVS_VERSION')) >= 2010] + +expected_exe_file = os.path.join(test.workdir, vc_version, 'hello.exe') + +test.run_gyp('hello.gyp') + +test.build('hello.gyp') + +test.must_exist(expected_exe_file) + +test.pass_test() diff --git a/tools/gyp/test/msvs/config_attrs/hello.c b/tools/gyp/test/msvs/config_attrs/hello.c new file mode 100644 index 000000000..5a8072db8 --- /dev/null +++ b/tools/gyp/test/msvs/config_attrs/hello.c @@ -0,0 +1,11 @@ +/* Copyright (c) 2012 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +int main(int argc, char *argv[]) +{ + printf("Hello, world!\n"); + return 0; +} \ No newline at end of file diff --git a/tools/gyp/test/msvs/config_attrs/hello.gyp b/tools/gyp/test/msvs/config_attrs/hello.gyp new file mode 100644 index 000000000..810a80edd --- /dev/null +++ b/tools/gyp/test/msvs/config_attrs/hello.gyp @@ -0,0 +1,21 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'hello', + 'type': 'executable', + 'sources': [ + 'hello.c', + ], + 'msvs_configuration_attributes': { + 'OutputDirectory':'$(SolutionDir)VC90/' + }, + 'msbuild_configuration_attributes': { + 'OutputDirectory':'$(SolutionDir)VC100/', + }, + }, + ], +} diff --git a/tools/gyp/test/msvs/express/base/base.gyp b/tools/gyp/test/msvs/express/base/base.gyp new file mode 100644 index 000000000..b7c9fc6d8 --- /dev/null +++ b/tools/gyp/test/msvs/express/base/base.gyp @@ -0,0 +1,22 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'a', + 'type': 'static_library', + 'sources': [ + 'a.c', + ], + }, + { + 'target_name': 'b', + 'type': 'static_library', + 'sources': [ + 'b.c', + ], + }, + ], +} diff --git a/tools/gyp/test/msvs/express/express.gyp b/tools/gyp/test/msvs/express/express.gyp new file mode 100644 index 000000000..917abe2cc --- /dev/null +++ b/tools/gyp/test/msvs/express/express.gyp @@ -0,0 +1,19 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'express', + 'type': 'executable', + 'dependencies': [ + 'base/base.gyp:a', + 'base/base.gyp:b', + ], + 'sources': [ + 'main.c', + ], + }, + ], +} diff --git a/tools/gyp/test/msvs/express/gyptest-express.py b/tools/gyp/test/msvs/express/gyptest-express.py new file mode 100755 index 000000000..54c06f664 --- /dev/null +++ b/tools/gyp/test/msvs/express/gyptest-express.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that flat solutions get generated for Express versions of +Visual Studio. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['msvs']) + +test.run_gyp('express.gyp', '-G', 'msvs_version=2005') +test.must_contain('express.sln', '(base)') + +test.run_gyp('express.gyp', '-G', 'msvs_version=2008') +test.must_contain('express.sln', '(base)') + +test.run_gyp('express.gyp', '-G', 'msvs_version=2005e') +test.must_not_contain('express.sln', '(base)') + +test.run_gyp('express.gyp', '-G', 'msvs_version=2008e') +test.must_not_contain('express.sln', '(base)') + + +test.pass_test() diff --git a/tools/gyp/test/msvs/list_excluded/gyptest-all.py b/tools/gyp/test/msvs/list_excluded/gyptest-all.py new file mode 100644 index 000000000..5a370f6b4 --- /dev/null +++ b/tools/gyp/test/msvs/list_excluded/gyptest-all.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that msvs_list_excluded_files=0 doesn't list files that would +normally be in _excluded_files, and that if that flag is not set, then they +are still listed. +""" + +import os +import TestGyp + +test = TestGyp.TestGyp(formats=['msvs'], workdir='workarea_all') + + +# with the flag set to 0 +try: + os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_list_excluded_files=0' + test.run_gyp('hello_exclude.gyp') +finally: + del os.environ['GYP_GENERATOR_FLAGS'] +if test.uses_msbuild: + test.must_not_contain('hello.vcxproj', 'hello_mac') +else: + test.must_not_contain('hello.vcproj', 'hello_mac') + + +# with the flag not set +test.run_gyp('hello_exclude.gyp') +if test.uses_msbuild: + test.must_contain('hello.vcxproj', 'hello_mac') +else: + test.must_contain('hello.vcproj', 'hello_mac') + + +# with the flag explicitly set to 1 +try: + os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_list_excluded_files=1' + test.run_gyp('hello_exclude.gyp') +finally: + del os.environ['GYP_GENERATOR_FLAGS'] +if test.uses_msbuild: + test.must_contain('hello.vcxproj', 'hello_mac') +else: + test.must_contain('hello.vcproj', 'hello_mac') + + +test.pass_test() diff --git a/tools/gyp/test/msvs/list_excluded/hello.cpp b/tools/gyp/test/msvs/list_excluded/hello.cpp new file mode 100644 index 000000000..69acc38bd --- /dev/null +++ b/tools/gyp/test/msvs/list_excluded/hello.cpp @@ -0,0 +1,10 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +int main(int argc, char *argv[]) { + printf("Hello, world!\n"); + return 0; +} diff --git a/tools/gyp/test/msvs/list_excluded/hello_exclude.gyp b/tools/gyp/test/msvs/list_excluded/hello_exclude.gyp new file mode 100644 index 000000000..aa160f236 --- /dev/null +++ b/tools/gyp/test/msvs/list_excluded/hello_exclude.gyp @@ -0,0 +1,19 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'hello', + 'type': 'executable', + 'sources': [ + 'hello.cpp', + 'hello_mac.cpp', + ], + 'conditions': [ + ['OS!="mac"', {'sources!': ['hello_mac.cpp']}], + ] + }, + ], +} diff --git a/tools/gyp/test/msvs/list_excluded/hello_mac.cpp b/tools/gyp/test/msvs/list_excluded/hello_mac.cpp new file mode 100644 index 000000000..b9f6242c4 --- /dev/null +++ b/tools/gyp/test/msvs/list_excluded/hello_mac.cpp @@ -0,0 +1,10 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +int hello2() { + printf("Hello, two!\n"); + return 0; +} diff --git a/tools/gyp/test/msvs/missing_sources/gyptest-missing.py b/tools/gyp/test/msvs/missing_sources/gyptest-missing.py new file mode 100644 index 000000000..fe183b96d --- /dev/null +++ b/tools/gyp/test/msvs/missing_sources/gyptest-missing.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that missing 'sources' files are treated as fatal errors when the +the generator flag 'msvs_error_on_missing_sources' is set. +""" + +import TestGyp +import os + +test = TestGyp.TestGyp(formats=['msvs'], workdir='workarea_all') + +# With the flag not set +test.run_gyp('hello_missing.gyp') + +# With the flag explicitly set to 0 +try: + os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_error_on_missing_sources=0' + test.run_gyp('hello_missing.gyp') +finally: + del os.environ['GYP_GENERATOR_FLAGS'] + +# With the flag explicitly set to 1 +try: + os.environ['GYP_GENERATOR_FLAGS'] = 'msvs_error_on_missing_sources=1' + # Test to make sure GYP raises an exception (exit status 1). Since this will + # also print a backtrace, ensure that TestGyp is not checking that stderr is + # empty by specifying None, which means do not perform any checking. + # Instead, stderr is checked below to ensure it contains the expected + # output. + test.run_gyp('hello_missing.gyp', status=1, stderr=None) +finally: + del os.environ['GYP_GENERATOR_FLAGS'] +test.must_contain_any_line(test.stderr(), + ["Missing input files:"]) + +test.pass_test() \ No newline at end of file diff --git a/tools/gyp/test/msvs/missing_sources/hello_missing.gyp b/tools/gyp/test/msvs/missing_sources/hello_missing.gyp new file mode 100644 index 000000000..c08926bbf --- /dev/null +++ b/tools/gyp/test/msvs/missing_sources/hello_missing.gyp @@ -0,0 +1,15 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'hello', + 'type': 'executable', + 'sources': [ + 'hello_missing.cpp', + ], + }, + ], +} diff --git a/tools/gyp/test/msvs/props/AppName.props b/tools/gyp/test/msvs/props/AppName.props new file mode 100644 index 000000000..b688f663d --- /dev/null +++ b/tools/gyp/test/msvs/props/AppName.props @@ -0,0 +1,14 @@ + + + + Greet + + + <_ProjectFileVersion>10.0.40219.1 + + + + $(AppName) + + + diff --git a/tools/gyp/test/msvs/props/AppName.vsprops b/tools/gyp/test/msvs/props/AppName.vsprops new file mode 100644 index 000000000..84b9af380 --- /dev/null +++ b/tools/gyp/test/msvs/props/AppName.vsprops @@ -0,0 +1,11 @@ + + + + diff --git a/tools/gyp/test/msvs/props/gyptest-props.py b/tools/gyp/test/msvs/props/gyptest-props.py new file mode 100644 index 000000000..abd4df224 --- /dev/null +++ b/tools/gyp/test/msvs/props/gyptest-props.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies props files are added by using a +props file to set the name of the built executable. +""" + +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_all', formats=['msvs']) + +test.run_gyp('hello.gyp') + +test.build('hello.gyp') + +test.built_file_must_exist('Greet.exe') + +test.pass_test() diff --git a/tools/gyp/test/msvs/props/hello.c b/tools/gyp/test/msvs/props/hello.c new file mode 100644 index 000000000..b41318dc0 --- /dev/null +++ b/tools/gyp/test/msvs/props/hello.c @@ -0,0 +1,11 @@ +/* Copyright (c) 2012 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +int main(int argc, char *argv[]) +{ + printf("Hello, world!\n"); + return 0; +} diff --git a/tools/gyp/test/msvs/props/hello.gyp b/tools/gyp/test/msvs/props/hello.gyp new file mode 100644 index 000000000..5a58317fa --- /dev/null +++ b/tools/gyp/test/msvs/props/hello.gyp @@ -0,0 +1,22 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +{ + 'targets': [ + { + 'target_name': 'hello', + 'product_name': '$(AppName)', + 'type': 'executable', + 'sources': [ + 'hello.c', + ], + 'msvs_props': [ + '$(SolutionDir)AppName.vsprops' + ], + 'msbuild_props': [ + '$(SolutionDir)AppName.props' + ], + }, + ], +} + diff --git a/tools/gyp/test/msvs/shared_output/common.gypi b/tools/gyp/test/msvs/shared_output/common.gypi new file mode 100644 index 000000000..c6fa341d6 --- /dev/null +++ b/tools/gyp/test/msvs/shared_output/common.gypi @@ -0,0 +1,17 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'default_configuration': 'Baz', + 'configurations': { + 'Baz': { + 'msvs_configuration_attributes': { + 'OutputDirectory': '<(DEPTH)/foo', + 'IntermediateDirectory': '$(OutDir)/bar', + }, + }, + }, + }, +} diff --git a/tools/gyp/test/msvs/shared_output/gyptest-shared_output.py b/tools/gyp/test/msvs/shared_output/gyptest-shared_output.py new file mode 100644 index 000000000..c52d33481 --- /dev/null +++ b/tools/gyp/test/msvs/shared_output/gyptest-shared_output.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Test checking that IntermediateDirectory can be defined in terms of +OutputDirectory. We previously had emitted the definition of +IntermediateDirectory before the definition of OutputDirectory. +This is required so that $(IntDir) can be based on $(OutDir). +""" + +import TestGyp +import os + +# NOTE: This test really is vcbuild/msbuild specific (not applicable to windows +# ninja), as it is testing the msvs output location when opening an .sln +# other than all.sln. +test = TestGyp.TestGyp(workdir='workarea_shared_output', formats=['msvs']) + +test.run_gyp('hello.gyp') +test.set_configuration('Baz') + +test.build('there/there.gyp', test.ALL) +test.must_exist(os.path.join(test.workdir, 'foo', 'there.exe')) +test.must_exist(os.path.join(test.workdir, 'foo', 'bar', 'there.obj')) + +test.build('hello.gyp', test.ALL) +test.must_exist(os.path.join(test.workdir, 'foo', 'hello.exe')) +test.must_exist(os.path.join(test.workdir, 'foo', 'bar', 'hello.obj')) + +test.pass_test() diff --git a/tools/gyp/test/msvs/shared_output/hello.c b/tools/gyp/test/msvs/shared_output/hello.c new file mode 100644 index 000000000..44d1b0dc9 --- /dev/null +++ b/tools/gyp/test/msvs/shared_output/hello.c @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2012 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include + +int main(int argc, char *argv[]) { + printf("Hello, world!\n"); + return 0; +} diff --git a/tools/gyp/test/msvs/shared_output/hello.gyp b/tools/gyp/test/msvs/shared_output/hello.gyp new file mode 100644 index 000000000..f80e5cfca --- /dev/null +++ b/tools/gyp/test/msvs/shared_output/hello.gyp @@ -0,0 +1,21 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': ['common.gypi'], + 'targets': [ + { + 'target_name': 'pull_in_there', + 'type': 'none', + 'dependencies': ['there/there.gyp:*'], + }, + { + 'target_name': 'hello', + 'type': 'executable', + 'sources': [ + 'hello.c', + ], + }, + ], +} diff --git a/tools/gyp/test/msvs/shared_output/there/there.c b/tools/gyp/test/msvs/shared_output/there/there.c new file mode 100644 index 000000000..44d1b0dc9 --- /dev/null +++ b/tools/gyp/test/msvs/shared_output/there/there.c @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2012 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include + +int main(int argc, char *argv[]) { + printf("Hello, world!\n"); + return 0; +} diff --git a/tools/gyp/test/msvs/shared_output/there/there.gyp b/tools/gyp/test/msvs/shared_output/there/there.gyp new file mode 100644 index 000000000..56feff326 --- /dev/null +++ b/tools/gyp/test/msvs/shared_output/there/there.gyp @@ -0,0 +1,16 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': ['../common.gypi'], + 'targets': [ + { + 'target_name': 'there', + 'type': 'executable', + 'sources': [ + 'there.c', + ], + }, + ], +} diff --git a/tools/gyp/test/msvs/uldi2010/gyptest-all.py b/tools/gyp/test/msvs/uldi2010/gyptest-all.py new file mode 100644 index 000000000..cc248fbd6 --- /dev/null +++ b/tools/gyp/test/msvs/uldi2010/gyptest-all.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that uldi can be disabled on a per-project-reference basis in vs2010. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['msvs'], workdir='workarea_all') + +test.run_gyp('hello.gyp') + +if test.uses_msbuild: + test.must_contain('hello.vcxproj', 'false') + +test.pass_test() diff --git a/tools/gyp/test/msvs/uldi2010/hello.c b/tools/gyp/test/msvs/uldi2010/hello.c new file mode 100644 index 000000000..276909369 --- /dev/null +++ b/tools/gyp/test/msvs/uldi2010/hello.c @@ -0,0 +1,13 @@ +/* Copyright (c) 2012 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +extern int hello2(); + +int main(int argc, char *argv[]) { + printf("Hello, world!\n"); + hello2(); + return 0; +} diff --git a/tools/gyp/test/msvs/uldi2010/hello.gyp b/tools/gyp/test/msvs/uldi2010/hello.gyp new file mode 100644 index 000000000..a2bf2badb --- /dev/null +++ b/tools/gyp/test/msvs/uldi2010/hello.gyp @@ -0,0 +1,26 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'hello', + 'type': 'executable', + 'sources': [ + 'hello.c', + ], + 'dependencies': [ + 'hellolib', + ] + }, + { + 'target_name': 'hellolib', + 'type': 'static_library', + 'sources': [ + 'hello2.c', + ], + 'msvs_2010_disable_uldi_when_referenced': 1, + }, + ], +} diff --git a/tools/gyp/test/msvs/uldi2010/hello2.c b/tools/gyp/test/msvs/uldi2010/hello2.c new file mode 100644 index 000000000..e2f23238d --- /dev/null +++ b/tools/gyp/test/msvs/uldi2010/hello2.c @@ -0,0 +1,10 @@ +/* Copyright (c) 2012 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +int hello2() { + printf("Hello, two!\n"); + return 0; +} diff --git a/tools/gyp/test/multiple-targets/gyptest-all.py b/tools/gyp/test/multiple-targets/gyptest-all.py new file mode 100755 index 000000000..9f157c4f8 --- /dev/null +++ b/tools/gyp/test/multiple-targets/gyptest-all.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('multiple.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +# TODO(sgk): remove stderr=None when the --generator-output= support +# gets rid of the scons warning +test.build('multiple.gyp', test.ALL, chdir='relocate/src', stderr=None) + +expect1 = """\ +hello from prog1.c +hello from common.c +""" + +expect2 = """\ +hello from prog2.c +hello from common.c +""" + +test.run_built_executable('prog1', stdout=expect1, chdir='relocate/src') +test.run_built_executable('prog2', stdout=expect2, chdir='relocate/src') + +test.pass_test() diff --git a/tools/gyp/test/multiple-targets/gyptest-default.py b/tools/gyp/test/multiple-targets/gyptest-default.py new file mode 100755 index 000000000..8d5072d23 --- /dev/null +++ b/tools/gyp/test/multiple-targets/gyptest-default.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('multiple.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +# TODO(sgk): remove stderr=None when the --generator-output= support +# gets rid of the scons warning +test.build('multiple.gyp', chdir='relocate/src', stderr=None) + +expect1 = """\ +hello from prog1.c +hello from common.c +""" + +expect2 = """\ +hello from prog2.c +hello from common.c +""" + +test.run_built_executable('prog1', stdout=expect1, chdir='relocate/src') +test.run_built_executable('prog2', stdout=expect2, chdir='relocate/src') + +test.pass_test() diff --git a/tools/gyp/test/multiple-targets/src/common.c b/tools/gyp/test/multiple-targets/src/common.c new file mode 100644 index 000000000..f1df7c143 --- /dev/null +++ b/tools/gyp/test/multiple-targets/src/common.c @@ -0,0 +1,7 @@ +#include + +void common(void) +{ + printf("hello from common.c\n"); + return; +} diff --git a/tools/gyp/test/multiple-targets/src/multiple.gyp b/tools/gyp/test/multiple-targets/src/multiple.gyp new file mode 100644 index 000000000..3db4ea30c --- /dev/null +++ b/tools/gyp/test/multiple-targets/src/multiple.gyp @@ -0,0 +1,24 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'prog1', + 'type': 'executable', + 'sources': [ + 'prog1.c', + 'common.c', + ], + }, + { + 'target_name': 'prog2', + 'type': 'executable', + 'sources': [ + 'prog2.c', + 'common.c', + ], + }, + ], +} diff --git a/tools/gyp/test/multiple-targets/src/prog1.c b/tools/gyp/test/multiple-targets/src/prog1.c new file mode 100644 index 000000000..d55f8af1d --- /dev/null +++ b/tools/gyp/test/multiple-targets/src/prog1.c @@ -0,0 +1,10 @@ +#include + +extern void common(void); + +int main(int argc, char *argv[]) +{ + printf("hello from prog1.c\n"); + common(); + return 0; +} diff --git a/tools/gyp/test/multiple-targets/src/prog2.c b/tools/gyp/test/multiple-targets/src/prog2.c new file mode 100644 index 000000000..760590eb6 --- /dev/null +++ b/tools/gyp/test/multiple-targets/src/prog2.c @@ -0,0 +1,10 @@ +#include + +extern void common(void); + +int main(int argc, char *argv[]) +{ + printf("hello from prog2.c\n"); + common(); + return 0; +} diff --git a/tools/gyp/test/ninja/action_dependencies/gyptest-action-dependencies.py b/tools/gyp/test/ninja/action_dependencies/gyptest-action-dependencies.py new file mode 100755 index 000000000..9c5acea8c --- /dev/null +++ b/tools/gyp/test/ninja/action_dependencies/gyptest-action-dependencies.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify that building an object file correctly depends on running actions in +dependent targets, but not the targets themselves. +""" + +import os +import sys +import TestGyp + +# NOTE(piman): This test will not work with other generators because: +# - it explicitly tests the optimization, which is not implemented (yet?) on +# other generators +# - it relies on the exact path to output object files, which is generator +# dependent, and actually, relies on the ability to build only that object file, +# which I don't think is available on all generators. +# TODO(piman): Extend to other generators when possible. +test = TestGyp.TestGyp(formats=['ninja']) + +test.run_gyp('action_dependencies.gyp', chdir='src') + +chdir = 'relocate/src' +test.relocate('src', chdir) + +objext = '.obj' if sys.platform == 'win32' else '.o' + +test.build('action_dependencies.gyp', + os.path.join('obj', 'b.b' + objext), + chdir=chdir) + +# The 'a' actions should be run (letting b.c compile), but the a static library +# should not be built. +test.built_file_must_not_exist('a', type=test.STATIC_LIB, chdir=chdir) +test.built_file_must_not_exist('b', type=test.STATIC_LIB, chdir=chdir) +test.built_file_must_exist(os.path.join('obj', 'b.b' + objext), chdir=chdir) + +test.build('action_dependencies.gyp', + os.path.join('obj', 'c.c' + objext), + chdir=chdir) + +# 'a' and 'b' should be built, so that the 'c' action succeeds, letting c.c +# compile +test.built_file_must_exist('a', type=test.STATIC_LIB, chdir=chdir) +test.built_file_must_exist('b', type=test.EXECUTABLE, chdir=chdir) +test.built_file_must_exist(os.path.join('obj', 'c.c' + objext), chdir=chdir) + + +test.pass_test() diff --git a/tools/gyp/test/ninja/action_dependencies/src/a.c b/tools/gyp/test/ninja/action_dependencies/src/a.c new file mode 100644 index 000000000..4d7af9b26 --- /dev/null +++ b/tools/gyp/test/ninja/action_dependencies/src/a.c @@ -0,0 +1,10 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "a.h" + +int funcA() { + return 42; +} diff --git a/tools/gyp/test/ninja/action_dependencies/src/a.h b/tools/gyp/test/ninja/action_dependencies/src/a.h new file mode 100644 index 000000000..335db5673 --- /dev/null +++ b/tools/gyp/test/ninja/action_dependencies/src/a.h @@ -0,0 +1,13 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef A_H_ +#define A_H_ + +#include "a/generated.h" + +int funcA(); + +#endif // A_H_ diff --git a/tools/gyp/test/ninja/action_dependencies/src/action_dependencies.gyp b/tools/gyp/test/ninja/action_dependencies/src/action_dependencies.gyp new file mode 100644 index 000000000..5baa7a7d4 --- /dev/null +++ b/tools/gyp/test/ninja/action_dependencies/src/action_dependencies.gyp @@ -0,0 +1,88 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'a', + 'type': 'static_library', + 'sources': [ + 'a.c', + 'a.h', + ], + 'actions': [ + { + 'action_name': 'generate_headers', + 'inputs': [ + 'emit.py' + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/a/generated.h' + ], + 'action': [ + 'python', + 'emit.py', + '<(SHARED_INTERMEDIATE_DIR)/a/generated.h', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', + ], + }, + }, + { + 'target_name': 'b', + 'type': 'executable', + 'sources': [ + 'b.c', + 'b.h', + ], + 'dependencies': [ + 'a', + ], + }, + { + 'target_name': 'c', + 'type': 'static_library', + 'sources': [ + 'c.c', + 'c.h', + ], + 'dependencies': [ + 'b', + ], + 'actions': [ + { + 'action_name': 'generate_headers', + 'inputs': [ + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/c/generated.h' + ], + 'action': [ + '<(PRODUCT_DIR)/b', + '<(SHARED_INTERMEDIATE_DIR)/c/generated.h', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', + ], + }, + }, + ], +} diff --git a/tools/gyp/test/ninja/action_dependencies/src/b.c b/tools/gyp/test/ninja/action_dependencies/src/b.c new file mode 100644 index 000000000..824464695 --- /dev/null +++ b/tools/gyp/test/ninja/action_dependencies/src/b.c @@ -0,0 +1,18 @@ +/* Copyright (c) 2012 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include + +#include "b.h" + +int main(int argc, char** argv) { + FILE* f; + if (argc < 2) + return 1; + f = fopen(argv[1], "wt"); + fprintf(f, "#define VALUE %d\n", funcA()); + fclose(f); + return 0; +} diff --git a/tools/gyp/test/ninja/action_dependencies/src/b.h b/tools/gyp/test/ninja/action_dependencies/src/b.h new file mode 100644 index 000000000..91362cd89 --- /dev/null +++ b/tools/gyp/test/ninja/action_dependencies/src/b.h @@ -0,0 +1,13 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef B_H_ +#define B_H_ + +#include "a.h" + +int funcB(); + +#endif // B_H_ diff --git a/tools/gyp/test/ninja/action_dependencies/src/c.c b/tools/gyp/test/ninja/action_dependencies/src/c.c new file mode 100644 index 000000000..b412087ec --- /dev/null +++ b/tools/gyp/test/ninja/action_dependencies/src/c.c @@ -0,0 +1,10 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "c.h" + +int funcC() { + return VALUE; +} diff --git a/tools/gyp/test/ninja/action_dependencies/src/c.h b/tools/gyp/test/ninja/action_dependencies/src/c.h new file mode 100644 index 000000000..c81a45bbe --- /dev/null +++ b/tools/gyp/test/ninja/action_dependencies/src/c.h @@ -0,0 +1,13 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef C_H_ +#define C_H_ + +#include "c/generated.h" + +int funcC(); + +#endif // C_H_ diff --git a/tools/gyp/test/ninja/action_dependencies/src/emit.py b/tools/gyp/test/ninja/action_dependencies/src/emit.py new file mode 100755 index 000000000..2df74b79a --- /dev/null +++ b/tools/gyp/test/ninja/action_dependencies/src/emit.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +f = open(sys.argv[1], 'wb') +f.write('/* Hello World */\n') +f.close() diff --git a/tools/gyp/test/ninja/chained-dependency/chained-dependency.gyp b/tools/gyp/test/ninja/chained-dependency/chained-dependency.gyp new file mode 100644 index 000000000..3fe68ae85 --- /dev/null +++ b/tools/gyp/test/ninja/chained-dependency/chained-dependency.gyp @@ -0,0 +1,53 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + # This first target generates a header. + { + 'target_name': 'generate_header', + 'type': 'none', + 'msvs_cygwin_shell': '0', + 'actions': [ + { + 'action_name': 'generate header', + 'inputs': [], + 'outputs': ['<(SHARED_INTERMEDIATE_DIR)/generated/header.h'], + 'action': [ + 'python', '-c', 'open(<(_outputs), "w")' + ] + }, + ], + 'all_dependent_settings': { + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', + ], + }, + }, + + # This intermediate target does nothing other than pull in a + # dependency on the above generated target. + { + 'target_name': 'chain', + 'type': 'none', + 'dependencies': [ + 'generate_header', + ], + }, + + # This final target is: + # - a static library (so gyp doesn't transitively pull in dependencies); + # - that relies on the generated file two dependencies away. + { + 'target_name': 'chained', + 'type': 'static_library', + 'dependencies': [ + 'chain', + ], + 'sources': [ + 'chained.c', + ], + }, + ], +} diff --git a/tools/gyp/test/ninja/chained-dependency/chained.c b/tools/gyp/test/ninja/chained-dependency/chained.c new file mode 100644 index 000000000..e4eb5e861 --- /dev/null +++ b/tools/gyp/test/ninja/chained-dependency/chained.c @@ -0,0 +1,5 @@ +#include "generated/header.h" + +int main(int argc, char** argv) { + return 0; +} diff --git a/tools/gyp/test/ninja/chained-dependency/gyptest-chained-dependency.py b/tools/gyp/test/ninja/chained-dependency/gyptest-chained-dependency.py new file mode 100755 index 000000000..9fcd9a45d --- /dev/null +++ b/tools/gyp/test/ninja/chained-dependency/gyptest-chained-dependency.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that files generated by two-steps-removed actions are built before +dependent compile steps. +""" + +import os +import sys +import TestGyp + +# This test is Ninja-specific in that: +# - the bug only showed nondeterministically in parallel builds; +# - it relies on a ninja-specific output file path. + +test = TestGyp.TestGyp(formats=['ninja']) +test.run_gyp('chained-dependency.gyp') +objext = '.obj' if sys.platform == 'win32' else '.o' +test.build('chained-dependency.gyp', + os.path.join('obj', 'chained.chained' + objext)) +# The test passes if the .o file builds successfully. +test.pass_test() diff --git a/tools/gyp/test/ninja/normalize-paths-win/gyptest-normalize-paths.py b/tools/gyp/test/ninja/normalize-paths-win/gyptest-normalize-paths.py new file mode 100644 index 000000000..af48d071c --- /dev/null +++ b/tools/gyp/test/ninja/normalize-paths-win/gyptest-normalize-paths.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure paths are normalized with VS macros properly expanded on Windows. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['ninja']) + + test.run_gyp('normalize-paths.gyp') + + # We can't use existence tests because any case will pass, so we check the + # contents of ninja files directly since that's what we're most concerned + # with anyway. + subninja = open(test.built_file_path('obj/some_target.ninja')).read() + if '$!product_dir' in subninja: + test.fail_test() + if 'out\\Default' in subninja: + test.fail_test() + + second = open(test.built_file_path('obj/second.ninja')).read() + if ('..\\..\\things\\AnotherName.exe' in second or + 'AnotherName.exe' not in second): + test.fail_test() + + action = open(test.built_file_path('obj/action.ninja')).read() + if '..\\..\\out\\Default' in action: + test.fail_test() + if '..\\..\\SomethingElse' in action or 'SomethingElse' not in action: + test.fail_test() + if '..\\..\\SomeOtherInput' in action or 'SomeOtherInput' not in action: + test.fail_test() + + test.pass_test() diff --git a/tools/gyp/test/ninja/normalize-paths-win/hello.cc b/tools/gyp/test/ninja/normalize-paths-win/hello.cc new file mode 100644 index 000000000..1711567ef --- /dev/null +++ b/tools/gyp/test/ninja/normalize-paths-win/hello.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + return 0; +} diff --git a/tools/gyp/test/ninja/normalize-paths-win/normalize-paths.gyp b/tools/gyp/test/ninja/normalize-paths-win/normalize-paths.gyp new file mode 100644 index 000000000..ba0ee2815 --- /dev/null +++ b/tools/gyp/test/ninja/normalize-paths-win/normalize-paths.gyp @@ -0,0 +1,56 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'Some_Target', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'OutputFile': '<(PRODUCT_DIR)/stuff/AnotherName.exe', + }, + }, + 'sources': [ + 'HeLLo.cc', + 'blOrP.idl', + ], + }, + { + 'target_name': 'second', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'OutputFile': '$(OutDir)\\things\\AnotherName.exe', + }, + }, + 'sources': [ + 'HeLLo.cc', + ], + }, + { + 'target_name': 'action', + 'type': 'none', + 'msvs_cygwin_shell': '0', + 'actions': [ + { + 'inputs': [ + '$(IntDir)\\SomeInput', + '$(OutDir)\\SomeOtherInput', + ], + 'outputs': [ + '<(PRODUCT_DIR)/ReSuLt', + '<(SHARED_INTERMEDIATE_DIR)/TempFile', + '$(OutDir)\SomethingElse', + ], + 'action_name': 'Test action', + # Unfortunately, we can't normalize this field because it's + # free-form. Fortunately, ninja doesn't inspect it at all (only the + # inputs and outputs) so it's not mandatory. + 'action': [], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/no-output/gyptest-no-output.py b/tools/gyp/test/no-output/gyptest-no-output.py new file mode 100755 index 000000000..bf9a0b5aa --- /dev/null +++ b/tools/gyp/test/no-output/gyptest-no-output.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verified things don't explode when there are targets without outputs. +""" + +import TestGyp + +# TODO(evan): in ninja when there are no targets, there is no 'all' +# target either. Disabling this test for now. +test = TestGyp.TestGyp(formats=['!ninja']) + +test.run_gyp('nooutput.gyp', chdir='src') +test.relocate('src', 'relocate/src') +test.build('nooutput.gyp', chdir='relocate/src') + +test.pass_test() diff --git a/tools/gyp/test/no-output/src/nooutput.gyp b/tools/gyp/test/no-output/src/nooutput.gyp new file mode 100644 index 000000000..c40124efc --- /dev/null +++ b/tools/gyp/test/no-output/src/nooutput.gyp @@ -0,0 +1,17 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'no_output', + 'type': 'none', + 'direct_dependent_settings': { + 'defines': [ + 'NADA', + ], + }, + }, + ], +} diff --git a/tools/gyp/test/product/gyptest-product.py b/tools/gyp/test/product/gyptest-product.py new file mode 100755 index 000000000..e9790f30d --- /dev/null +++ b/tools/gyp/test/product/gyptest-product.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simplest-possible build of a "Hello, world!" program +using the default build target. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('product.gyp') +test.build('product.gyp') + +# executables +test.built_file_must_exist('alt1' + test._exe, test.EXECUTABLE, bare=True) +test.built_file_must_exist('hello2.stuff', test.EXECUTABLE, bare=True) +test.built_file_must_exist('yoalt3.stuff', test.EXECUTABLE, bare=True) + +# shared libraries +test.built_file_must_exist(test.dll_ + 'alt4' + test._dll, + test.SHARED_LIB, bare=True) +test.built_file_must_exist(test.dll_ + 'hello5.stuff', + test.SHARED_LIB, bare=True) +test.built_file_must_exist('yoalt6.stuff', test.SHARED_LIB, bare=True) + +# static libraries +test.built_file_must_exist(test.lib_ + 'alt7' + test._lib, + test.STATIC_LIB, bare=True) +test.built_file_must_exist(test.lib_ + 'hello8.stuff', + test.STATIC_LIB, bare=True) +test.built_file_must_exist('yoalt9.stuff', test.STATIC_LIB, bare=True) + +# alternate product_dir +test.built_file_must_exist('bob/yoalt10.stuff', test.EXECUTABLE, bare=True) +test.built_file_must_exist('bob/yoalt11.stuff', test.EXECUTABLE, bare=True) +test.built_file_must_exist('bob/yoalt12.stuff', test.EXECUTABLE, bare=True) + +test.pass_test() diff --git a/tools/gyp/test/product/hello.c b/tools/gyp/test/product/hello.c new file mode 100644 index 000000000..94798f3e7 --- /dev/null +++ b/tools/gyp/test/product/hello.c @@ -0,0 +1,15 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +int func1(void) { + return 42; +} + +int main(int argc, char *argv[]) { + printf("Hello, world!\n"); + printf("%d\n", func1()); + return 0; +} diff --git a/tools/gyp/test/product/product.gyp b/tools/gyp/test/product/product.gyp new file mode 100644 index 000000000..c25eaaacb --- /dev/null +++ b/tools/gyp/test/product/product.gyp @@ -0,0 +1,128 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'hello1', + 'product_name': 'alt1', + 'type': 'executable', + 'sources': [ + 'hello.c', + ], + }, + { + 'target_name': 'hello2', + 'product_extension': 'stuff', + 'type': 'executable', + 'sources': [ + 'hello.c', + ], + }, + { + 'target_name': 'hello3', + 'product_name': 'alt3', + 'product_extension': 'stuff', + 'product_prefix': 'yo', + 'type': 'executable', + 'sources': [ + 'hello.c', + ], + }, + + { + 'target_name': 'hello4', + 'product_name': 'alt4', + 'type': 'shared_library', + 'sources': [ + 'hello.c', + ], + }, + { + 'target_name': 'hello5', + 'product_extension': 'stuff', + 'type': 'shared_library', + 'sources': [ + 'hello.c', + ], + }, + { + 'target_name': 'hello6', + 'product_name': 'alt6', + 'product_extension': 'stuff', + 'product_prefix': 'yo', + 'type': 'shared_library', + 'sources': [ + 'hello.c', + ], + }, + + { + 'target_name': 'hello7', + 'product_name': 'alt7', + 'type': 'static_library', + 'sources': [ + 'hello.c', + ], + }, + { + 'target_name': 'hello8', + 'product_extension': 'stuff', + 'type': 'static_library', + 'sources': [ + 'hello.c', + ], + }, + { + 'target_name': 'hello9', + 'product_name': 'alt9', + 'product_extension': 'stuff', + 'product_prefix': 'yo', + 'type': 'static_library', + 'sources': [ + 'hello.c', + ], + }, + { + 'target_name': 'hello10', + 'product_name': 'alt10', + 'product_extension': 'stuff', + 'product_prefix': 'yo', + 'product_dir': '<(PRODUCT_DIR)/bob', + 'type': 'executable', + 'sources': [ + 'hello.c', + ], + }, + { + 'target_name': 'hello11', + 'product_name': 'alt11', + 'product_extension': 'stuff', + 'product_prefix': 'yo', + 'product_dir': '<(PRODUCT_DIR)/bob', + 'type': 'shared_library', + 'sources': [ + 'hello.c', + ], + }, + { + 'target_name': 'hello12', + 'product_name': 'alt12', + 'product_extension': 'stuff', + 'product_prefix': 'yo', + 'product_dir': '<(PRODUCT_DIR)/bob', + 'type': 'static_library', + 'sources': [ + 'hello.c', + ], + }, + ], + 'conditions': [ + ['OS=="linux"', { + 'target_defaults': { + 'cflags': ['-fPIC'], + }, + }], + ], +} diff --git a/tools/gyp/test/relative/foo/a/a.cc b/tools/gyp/test/relative/foo/a/a.cc new file mode 100644 index 000000000..7d1c95344 --- /dev/null +++ b/tools/gyp/test/relative/foo/a/a.cc @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +int main() { + return 0; +} diff --git a/tools/gyp/test/relative/foo/a/a.gyp b/tools/gyp/test/relative/foo/a/a.gyp new file mode 100644 index 000000000..66316ac68 --- /dev/null +++ b/tools/gyp/test/relative/foo/a/a.gyp @@ -0,0 +1,13 @@ +{ + 'targets': [ + { + 'target_name': 'a', + 'type': 'executable', + 'sources': ['a.cc'], + 'dependencies': [ + '../../foo/b/b.gyp:b', + 'c/c.gyp:c', + ], + }, + ], +} diff --git a/tools/gyp/test/relative/foo/a/c/c.cc b/tools/gyp/test/relative/foo/a/c/c.cc new file mode 100644 index 000000000..9d2247168 --- /dev/null +++ b/tools/gyp/test/relative/foo/a/c/c.cc @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +int func() { + return 0; +} diff --git a/tools/gyp/test/relative/foo/a/c/c.gyp b/tools/gyp/test/relative/foo/a/c/c.gyp new file mode 100644 index 000000000..c1f087db9 --- /dev/null +++ b/tools/gyp/test/relative/foo/a/c/c.gyp @@ -0,0 +1,12 @@ +{ + 'targets': [ + { + 'target_name': 'c', + 'type': 'static_library', + 'sources': ['c.cc'], + 'dependencies': [ + '../../b/b.gyp:b', + ], + }, + ], +} diff --git a/tools/gyp/test/relative/foo/b/b.cc b/tools/gyp/test/relative/foo/b/b.cc new file mode 100644 index 000000000..011d59ceb --- /dev/null +++ b/tools/gyp/test/relative/foo/b/b.cc @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +int func2() { + return 0; +} diff --git a/tools/gyp/test/relative/foo/b/b.gyp b/tools/gyp/test/relative/foo/b/b.gyp new file mode 100644 index 000000000..0ebe4533d --- /dev/null +++ b/tools/gyp/test/relative/foo/b/b.gyp @@ -0,0 +1,9 @@ +{ + 'targets': [ + { + 'target_name': 'b', + 'type': 'static_library', + 'sources': ['b.cc'], + }, + ], +} diff --git a/tools/gyp/test/relative/gyptest-default.py b/tools/gyp/test/relative/gyptest-default.py new file mode 100755 index 000000000..2d657aa67 --- /dev/null +++ b/tools/gyp/test/relative/gyptest-default.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simplest-possible build of a "Hello, world!" program +using the default build target. +""" + +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_default', formats=['msvs']) + +# Run from down in foo. +test.run_gyp('a.gyp', chdir='foo/a') +sln = test.workpath('foo/a/a.sln') +sln_data = open(sln, 'rb').read() +vcproj = sln_data.count('b.vcproj') +vcxproj = sln_data.count('b.vcxproj') +if (vcproj, vcxproj) not in [(1, 0), (0, 1)]: + test.fail_test() + +test.pass_test() diff --git a/tools/gyp/test/restat/gyptest-restat.py b/tools/gyp/test/restat/gyptest-restat.py new file mode 100644 index 000000000..87379044d --- /dev/null +++ b/tools/gyp/test/restat/gyptest-restat.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify that dependent rules are executed iff a dependency action modifies its +outputs. +""" + +import TestGyp +import os + +test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) + +test.run_gyp('restat.gyp', chdir='src') + +chdir = 'relocate/src' +test.relocate('src', chdir) + +# Building 'dependent' the first time generates 'side_effect', but building it +# the second time doesn't, because 'create_intermediate' doesn't update its +# output. +test.build('restat.gyp', 'dependent', chdir=chdir) +test.built_file_must_exist('side_effect', chdir=chdir) +os.remove(test.built_file_path('side_effect', chdir=chdir)) +test.build('restat.gyp', 'dependent', chdir=chdir) +test.built_file_must_not_exist('side_effect', chdir=chdir) + +test.pass_test() diff --git a/tools/gyp/test/restat/src/create_intermediate.py b/tools/gyp/test/restat/src/create_intermediate.py new file mode 100644 index 000000000..a4d745037 --- /dev/null +++ b/tools/gyp/test/restat/src/create_intermediate.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os +import sys + +""" +Create argv[1] iff it doesn't already exist. +""" + +outfile = sys.argv[1] +if os.path.exists(outfile): + sys.exit() +open(outfile, "wb").close() diff --git a/tools/gyp/test/restat/src/restat.gyp b/tools/gyp/test/restat/src/restat.gyp new file mode 100644 index 000000000..ff020e0ce --- /dev/null +++ b/tools/gyp/test/restat/src/restat.gyp @@ -0,0 +1,50 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'create_intermediate', + 'type': 'none', + 'msvs_cygwin_shell': '0', + 'actions': [ + { + 'action_name': 'create_intermediate', + 'inputs': [ + 'create_intermediate.py', + ], + 'outputs': [ + '<(PRODUCT_DIR)/intermediate', + 'ALWAYS.run.ALWAYS', + ], + 'action': [ + 'python', 'create_intermediate.py', '<(PRODUCT_DIR)/intermediate', + ], + }, + ], + }, + { + 'target_name': 'dependent', + 'type': 'none', + 'msvs_cygwin_shell': '0', + 'dependencies': [ + 'create_intermediate', + ], + 'actions': [ + { + 'action_name': 'dependent', + 'inputs': [ + '<(PRODUCT_DIR)/intermediate', + ], + 'outputs': [ + '<(PRODUCT_DIR)/dependent' + ], + 'action': [ + 'python', 'touch.py', '<(PRODUCT_DIR)/dependent', '<(PRODUCT_DIR)/side_effect', + ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/restat/src/touch.py b/tools/gyp/test/restat/src/touch.py new file mode 100644 index 000000000..7cd781a90 --- /dev/null +++ b/tools/gyp/test/restat/src/touch.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os +import sys + +"""Cross-platform touch.""" + +for fname in sys.argv[1:]: + if os.path.exists(fname): + os.utime(fname, None) + else: + open(fname, 'w').close() diff --git a/tools/gyp/test/rules-dirname/gyptest-dirname.py b/tools/gyp/test/rules-dirname/gyptest-dirname.py new file mode 100755 index 000000000..6e684a4c4 --- /dev/null +++ b/tools/gyp/test/rules-dirname/gyptest-dirname.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simple rules when using an explicit build target of 'all'. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['make', 'ninja', 'xcode']) + +test.run_gyp('actions.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('actions.gyp', chdir='relocate/src') + +expect = """\ +hi c +hello baz +""" +if test.format == 'xcode': + chdir = 'relocate/src/subdir' +else: + chdir = 'relocate/src' +test.run_built_executable('gencc_int_output', chdir=chdir, stdout=expect) + +if test.format == 'msvs': + test.must_exist('relocate/src/subdir/foo/bar/baz.printed') + test.must_exist('relocate/src/subdir/a/b/c.printed') +else: + test.must_match('relocate/src/subdir/foo/bar/baz.printed', 'foo/bar') + test.must_match('relocate/src/subdir/a/b/c.printed', 'a/b') + +test.pass_test() diff --git a/tools/gyp/test/rules-dirname/src/actions.gyp b/tools/gyp/test/rules-dirname/src/actions.gyp new file mode 100644 index 000000000..c5693c6c9 --- /dev/null +++ b/tools/gyp/test/rules-dirname/src/actions.gyp @@ -0,0 +1,15 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'pull_in_all_actions', + 'type': 'none', + 'dependencies': [ + 'subdir/input-rule-dirname.gyp:*', + ], + }, + ], +} diff --git a/tools/gyp/test/rules-dirname/src/copy-file.py b/tools/gyp/test/rules-dirname/src/copy-file.py new file mode 100755 index 000000000..9774ccc96 --- /dev/null +++ b/tools/gyp/test/rules-dirname/src/copy-file.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +import sys + +contents = open(sys.argv[1], 'r').read() +open(sys.argv[2], 'wb').write(contents) + +sys.exit(0) diff --git a/tools/gyp/test/rules-dirname/src/subdir/a/b/c.gencc b/tools/gyp/test/rules-dirname/src/subdir/a/b/c.gencc new file mode 100644 index 000000000..a4c8eea95 --- /dev/null +++ b/tools/gyp/test/rules-dirname/src/subdir/a/b/c.gencc @@ -0,0 +1,11 @@ +// -*- mode: c++ -*- +#include + +using std::cout; +using std::endl; + +namespace gen { + void c() { + cout << "hi c" << endl; + } +} diff --git a/tools/gyp/test/rules-dirname/src/subdir/a/b/c.printvars b/tools/gyp/test/rules-dirname/src/subdir/a/b/c.printvars new file mode 100644 index 000000000..cc4561dc4 --- /dev/null +++ b/tools/gyp/test/rules-dirname/src/subdir/a/b/c.printvars @@ -0,0 +1 @@ +# Empty file for testing build rules diff --git a/tools/gyp/test/rules-dirname/src/subdir/foo/bar/baz.gencc b/tools/gyp/test/rules-dirname/src/subdir/foo/bar/baz.gencc new file mode 100644 index 000000000..ff01c2ee5 --- /dev/null +++ b/tools/gyp/test/rules-dirname/src/subdir/foo/bar/baz.gencc @@ -0,0 +1,11 @@ +// -*- mode: c++ -*- +#include + +using std::cout; +using std::endl; + +namespace gen { + void baz() { + cout << "hello baz" << endl; + } +} diff --git a/tools/gyp/test/rules-dirname/src/subdir/foo/bar/baz.printvars b/tools/gyp/test/rules-dirname/src/subdir/foo/bar/baz.printvars new file mode 100644 index 000000000..cc4561dc4 --- /dev/null +++ b/tools/gyp/test/rules-dirname/src/subdir/foo/bar/baz.printvars @@ -0,0 +1 @@ +# Empty file for testing build rules diff --git a/tools/gyp/test/rules-dirname/src/subdir/input-rule-dirname.gyp b/tools/gyp/test/rules-dirname/src/subdir/input-rule-dirname.gyp new file mode 100644 index 000000000..6f41d4f48 --- /dev/null +++ b/tools/gyp/test/rules-dirname/src/subdir/input-rule-dirname.gyp @@ -0,0 +1,92 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'print_rule_input_path', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'foo/bar/baz.printvars', + 'a/b/c.printvars', + ], + 'rules': [ + { + 'rule_name': 'printvars', + 'extension': 'printvars', + 'inputs': [ + 'printvars.py', + ], + 'outputs': [ + '<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).printed', + ], + 'action': [ + 'python', '<@(_inputs)', '<(RULE_INPUT_DIRNAME)', '<@(_outputs)', + ], + }, + ], + }, + { + 'target_name': 'gencc_int_output', + 'type': 'executable', + 'msvs_cygwin_shell': 0, + 'msvs_cygwin_dirs': ['../../../../../../<(DEPTH)/third_party/cygwin'], + 'sources': [ + 'foo/bar/baz.gencc', + 'a/b/c.gencc', + 'main.cc', + ], + 'conditions': [ + ['OS=="win"', { + 'dependencies': [ + 'cygwin', + ], + }], + ], + 'rules': [ + { + 'rule_name': 'gencc', + 'extension': 'gencc', + 'msvs_external_rule': 1, + 'inputs': [ + '<(DEPTH)/copy-file.py', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).cc', + ], + 'action': [ + 'python', '<@(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + ], + }, + ], + 'conditions': [ + ['OS=="win"', { + 'targets': [ + { + 'target_name': 'cygwin', + 'type': 'none', + 'actions': [ + { + 'action_name': 'setup_mount', + 'msvs_cygwin_shell': 0, + 'inputs': [ + '../../../../../../<(DEPTH)/third_party/cygwin/setup_mount.bat', + ], + # Visual Studio requires an output file, or else the + # custom build step won't run. + 'outputs': [ + '<(INTERMEDIATE_DIR)/_always_run_setup_mount.marker', + ], + 'action': ['<@(_inputs)'], + }, + ], + }, + ], + }], + ], +} diff --git a/tools/gyp/test/rules-dirname/src/subdir/main.cc b/tools/gyp/test/rules-dirname/src/subdir/main.cc new file mode 100644 index 000000000..bacc568ad --- /dev/null +++ b/tools/gyp/test/rules-dirname/src/subdir/main.cc @@ -0,0 +1,12 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +namespace gen { + extern void c(); + extern void baz(); +} + +int main() { + gen::c(); + gen::baz(); +} diff --git a/tools/gyp/test/rules-dirname/src/subdir/printvars.py b/tools/gyp/test/rules-dirname/src/subdir/printvars.py new file mode 100755 index 000000000..ef3d92e8c --- /dev/null +++ b/tools/gyp/test/rules-dirname/src/subdir/printvars.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Prints interesting vars +""" + +import sys; + +out = open(sys.argv[2], 'w') +out.write(sys.argv[1]); diff --git a/tools/gyp/test/rules-rebuild/gyptest-all.py b/tools/gyp/test/rules-rebuild/gyptest-all.py new file mode 100755 index 000000000..aaaa2a6e6 --- /dev/null +++ b/tools/gyp/test/rules-rebuild/gyptest-all.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that a rule that generates multiple outputs rebuilds +correctly when the inputs change. +""" + +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_all') + +test.run_gyp('same_target.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + + +test.build('same_target.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +Hello from main.c +Hello from prog1.in! +Hello from prog2.in! +""" + +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + +test.up_to_date('same_target.gyp', 'program', chdir='relocate/src') + + +test.sleep() +contents = test.read(['relocate', 'src', 'prog1.in']) +contents = contents.replace('!', ' AGAIN!') +test.write(['relocate', 'src', 'prog1.in'], contents) + +test.build('same_target.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +Hello from main.c +Hello from prog1.in AGAIN! +Hello from prog2.in! +""" + +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + +test.up_to_date('same_target.gyp', 'program', chdir='relocate/src') + + +test.sleep() +contents = test.read(['relocate', 'src', 'prog2.in']) +contents = contents.replace('!', ' AGAIN!') +test.write(['relocate', 'src', 'prog2.in'], contents) + +test.build('same_target.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +Hello from main.c +Hello from prog1.in AGAIN! +Hello from prog2.in AGAIN! +""" + +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + +test.up_to_date('same_target.gyp', 'program', chdir='relocate/src') + + +test.pass_test() diff --git a/tools/gyp/test/rules-rebuild/gyptest-default.py b/tools/gyp/test/rules-rebuild/gyptest-default.py new file mode 100755 index 000000000..ac3f0209a --- /dev/null +++ b/tools/gyp/test/rules-rebuild/gyptest-default.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that a rule that generates multiple outputs rebuilds +correctly when the inputs change. +""" + +import TestGyp + +test = TestGyp.TestGyp(workdir='workarea_default') + +test.run_gyp('same_target.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + + +test.build('same_target.gyp', chdir='relocate/src') + +expect = """\ +Hello from main.c +Hello from prog1.in! +Hello from prog2.in! +""" + +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + +test.up_to_date('same_target.gyp', 'program', chdir='relocate/src') + + +test.sleep() +contents = test.read(['relocate', 'src', 'prog1.in']) +contents = contents.replace('!', ' AGAIN!') +test.write(['relocate', 'src', 'prog1.in'], contents) + +test.build('same_target.gyp', chdir='relocate/src') + +expect = """\ +Hello from main.c +Hello from prog1.in AGAIN! +Hello from prog2.in! +""" + +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + +test.up_to_date('same_target.gyp', 'program', chdir='relocate/src') + + +test.sleep() +contents = test.read(['relocate', 'src', 'prog2.in']) +contents = contents.replace('!', ' AGAIN!') +test.write(['relocate', 'src', 'prog2.in'], contents) + +test.build('same_target.gyp', chdir='relocate/src') + +expect = """\ +Hello from main.c +Hello from prog1.in AGAIN! +Hello from prog2.in AGAIN! +""" + +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + +test.up_to_date('same_target.gyp', 'program', chdir='relocate/src') + + +# Test that modifying a rule's inputs (specifically, make-sources.py) causes +# the targets to be built. + +test.sleep() +contents = test.read(['relocate', 'src', 'make-sources.py']) +contents = contents.replace('%s', 'the amazing %s') +test.write(['relocate', 'src', 'make-sources.py'], contents) + +test.build('same_target.gyp', chdir='relocate/src') + +expect = """\ +Hello from main.c +Hello from the amazing prog1.in AGAIN! +Hello from the amazing prog2.in AGAIN! +""" + +test.run_built_executable('program', chdir='relocate/src', stdout=expect) + +test.up_to_date('same_target.gyp', 'program', chdir='relocate/src') + + +test.pass_test() diff --git a/tools/gyp/test/rules-rebuild/src/main.c b/tools/gyp/test/rules-rebuild/src/main.c new file mode 100644 index 000000000..bdc5ec875 --- /dev/null +++ b/tools/gyp/test/rules-rebuild/src/main.c @@ -0,0 +1,12 @@ +#include + +extern void prog1(void); +extern void prog2(void); + +int main(int argc, char *argv[]) +{ + printf("Hello from main.c\n"); + prog1(); + prog2(); + return 0; +} diff --git a/tools/gyp/test/rules-rebuild/src/make-sources.py b/tools/gyp/test/rules-rebuild/src/make-sources.py new file mode 100755 index 000000000..7ec022780 --- /dev/null +++ b/tools/gyp/test/rules-rebuild/src/make-sources.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +assert len(sys.argv) == 4, sys.argv + +(in_file, c_file, h_file) = sys.argv[1:] + +def write_file(filename, contents): + open(filename, 'wb').write(contents) + +write_file(c_file, open(in_file, 'rb').read()) + +write_file(h_file, '#define NAME "%s"\n' % in_file) + +sys.exit(0) diff --git a/tools/gyp/test/rules-rebuild/src/prog1.in b/tools/gyp/test/rules-rebuild/src/prog1.in new file mode 100644 index 000000000..191b00ef1 --- /dev/null +++ b/tools/gyp/test/rules-rebuild/src/prog1.in @@ -0,0 +1,7 @@ +#include +#include "prog1.h" + +void prog1(void) +{ + printf("Hello from %s!\n", NAME); +} diff --git a/tools/gyp/test/rules-rebuild/src/prog2.in b/tools/gyp/test/rules-rebuild/src/prog2.in new file mode 100644 index 000000000..7bfac5104 --- /dev/null +++ b/tools/gyp/test/rules-rebuild/src/prog2.in @@ -0,0 +1,7 @@ +#include +#include "prog2.h" + +void prog2(void) +{ + printf("Hello from %s!\n", NAME); +} diff --git a/tools/gyp/test/rules-rebuild/src/same_target.gyp b/tools/gyp/test/rules-rebuild/src/same_target.gyp new file mode 100644 index 000000000..22ba56056 --- /dev/null +++ b/tools/gyp/test/rules-rebuild/src/same_target.gyp @@ -0,0 +1,31 @@ +{ + 'targets': [ + { + 'target_name': 'program', + 'type': 'executable', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'main.c', + 'prog1.in', + 'prog2.in', + ], + 'rules': [ + { + 'rule_name': 'make_sources', + 'extension': 'in', + 'inputs': [ + 'make-sources.py', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).c', + '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).h', + ], + 'action': [ + 'python', '<(_inputs)', '<(RULE_INPUT_NAME)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/rules-variables/gyptest-rules-variables.py b/tools/gyp/test/rules-variables/gyptest-rules-variables.py new file mode 100755 index 000000000..06ee5ca83 --- /dev/null +++ b/tools/gyp/test/rules-variables/gyptest-rules-variables.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies rules related variables are expanded. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['ninja']) + +test.relocate('src', 'relocate/src') + +test.run_gyp('variables.gyp', chdir='relocate/src') + +test.build('variables.gyp', chdir='relocate/src') + +test.run_built_executable('all_rule_variables', + chdir='relocate/src', + stdout="input_root\ninput_dirname\ninput_path\n" + + "input_ext\ninput_name\n") + +test.pass_test() diff --git a/tools/gyp/test/rules-variables/src/input_ext.c b/tools/gyp/test/rules-variables/src/input_ext.c new file mode 100644 index 000000000..f41e73ef8 --- /dev/null +++ b/tools/gyp/test/rules-variables/src/input_ext.c @@ -0,0 +1,9 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +void input_ext() { + printf("input_ext\n"); +} diff --git a/tools/gyp/test/rules-variables/src/input_name/test.c b/tools/gyp/test/rules-variables/src/input_name/test.c new file mode 100644 index 000000000..e28b74d11 --- /dev/null +++ b/tools/gyp/test/rules-variables/src/input_name/test.c @@ -0,0 +1,9 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +void input_name() { + printf("input_name\n"); +} diff --git a/tools/gyp/test/rules-variables/src/input_path/subdir/test.c b/tools/gyp/test/rules-variables/src/input_path/subdir/test.c new file mode 100644 index 000000000..403dbbda4 --- /dev/null +++ b/tools/gyp/test/rules-variables/src/input_path/subdir/test.c @@ -0,0 +1,9 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +void input_path() { + printf("input_path\n"); +} diff --git a/tools/gyp/test/rules-variables/src/subdir/input_dirname.c b/tools/gyp/test/rules-variables/src/subdir/input_dirname.c new file mode 100644 index 000000000..40cecd87d --- /dev/null +++ b/tools/gyp/test/rules-variables/src/subdir/input_dirname.c @@ -0,0 +1,9 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +void input_dirname() { + printf("input_dirname\n"); +} diff --git a/tools/gyp/test/rules-variables/src/subdir/test.c b/tools/gyp/test/rules-variables/src/subdir/test.c new file mode 100644 index 000000000..6c0280b8a --- /dev/null +++ b/tools/gyp/test/rules-variables/src/subdir/test.c @@ -0,0 +1,18 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +extern void input_root(); +extern void input_dirname(); +extern void input_path(); +extern void input_ext(); +extern void input_name(); + +int main() { + input_root(); + input_dirname(); + input_path(); + input_ext(); + input_name(); + return 0; +} diff --git a/tools/gyp/test/rules-variables/src/test.input_root.c b/tools/gyp/test/rules-variables/src/test.input_root.c new file mode 100644 index 000000000..33a7740a5 --- /dev/null +++ b/tools/gyp/test/rules-variables/src/test.input_root.c @@ -0,0 +1,9 @@ +// Copyright (c) 2011 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +void input_root() { + printf("input_root\n"); +} diff --git a/tools/gyp/test/rules-variables/src/variables.gyp b/tools/gyp/test/rules-variables/src/variables.gyp new file mode 100644 index 000000000..6debba12e --- /dev/null +++ b/tools/gyp/test/rules-variables/src/variables.gyp @@ -0,0 +1,40 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + # This test shouldn't ever actually need to execute its rules: there's no + # command line that generates any output anyway. However, there's something + # slightly broken in either ninja or (maybe more likely?) on the win32 VM + # gypbots that breaks dependency checking and causes this rule to want to + # run. When it does run, the cygwin path is wrong, so the do-nothing step + # fails. + # TODO: Investigate and fix whatever's actually failing and remove this. + 'msvs_cygwin_dirs': ['../../../../../../<(DEPTH)/third_party/cygwin'], + }, + 'targets': [ + { + 'target_name': 'all_rule_variables', + 'type': 'executable', + 'sources': [ + 'subdir/test.c', + ], + 'rules': [ + { + 'rule_name': 'rule_variable', + 'extension': 'c', + 'outputs': [ + '<(RULE_INPUT_ROOT).input_root.c', + '<(RULE_INPUT_DIRNAME)/input_dirname.c', + 'input_path/<(RULE_INPUT_PATH)', + 'input_ext<(RULE_INPUT_EXT)', + 'input_name/<(RULE_INPUT_NAME)', + ], + 'action': [], + 'process_outputs_as_sources': 1, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/rules/gyptest-all.py b/tools/gyp/test/rules/gyptest-all.py new file mode 100755 index 000000000..d869fd3a8 --- /dev/null +++ b/tools/gyp/test/rules/gyptest-all.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simple rules when using an explicit build target of 'all'. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('no_action_with_rules_fails.gyp', chdir='src/noaction', status=1, + stderr=None) + +test.run_gyp('actions.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('actions.gyp', test.ALL, chdir='relocate/src') + +expect = """\ +Hello from program.c +Hello from function1.in +Hello from function2.in +""" + +if test.format == 'xcode': + chdir = 'relocate/src/subdir1' +else: + chdir = 'relocate/src' +test.run_built_executable('program', chdir=chdir, stdout=expect) + +expect = """\ +Hello from program.c +Hello from function3.in +""" + +if test.format == 'xcode': + chdir = 'relocate/src/subdir3' +else: + chdir = 'relocate/src' +test.run_built_executable('program2', chdir=chdir, stdout=expect) + +test.must_match('relocate/src/subdir2/file1.out', 'Hello from file1.in\n') +test.must_match('relocate/src/subdir2/file2.out', 'Hello from file2.in\n') + +test.must_match('relocate/src/subdir2/file1.out2', 'Hello from file1.in\n') +test.must_match('relocate/src/subdir2/file2.out2', 'Hello from file2.in\n') + +test.must_match('relocate/src/external/file1.external_rules.out', + 'Hello from file1.in\n') +test.must_match('relocate/src/external/file2.external_rules.out', + 'Hello from file2.in\n') + +expect = """\ +Hello from program.c +Got 41. +""" + +if test.format == 'xcode': + chdir = 'relocate/src/subdir4' +else: + chdir = 'relocate/src' +test.run_built_executable('program4', chdir=chdir, stdout=expect) + +test.pass_test() diff --git a/tools/gyp/test/rules/gyptest-default.py b/tools/gyp/test/rules/gyptest-default.py new file mode 100755 index 000000000..117c53db0 --- /dev/null +++ b/tools/gyp/test/rules/gyptest-default.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies simple rules when using an explicit build target of 'all'. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('actions.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('actions.gyp', chdir='relocate/src') + +expect = """\ +Hello from program.c +Hello from function1.in +Hello from function2.in +""" + +if test.format == 'xcode': + chdir = 'relocate/src/subdir1' +else: + chdir = 'relocate/src' +test.run_built_executable('program', chdir=chdir, stdout=expect) + +expect = """\ +Hello from program.c +Hello from function3.in +""" + +if test.format == 'xcode': + chdir = 'relocate/src/subdir3' +else: + chdir = 'relocate/src' +test.run_built_executable('program2', chdir=chdir, stdout=expect) + +test.must_match('relocate/src/subdir2/file1.out', 'Hello from file1.in\n') +test.must_match('relocate/src/subdir2/file2.out', 'Hello from file2.in\n') + +test.must_match('relocate/src/subdir2/file1.out2', 'Hello from file1.in\n') +test.must_match('relocate/src/subdir2/file2.out2', 'Hello from file2.in\n') + +test.must_match('relocate/src/external/file1.external_rules.out', + 'Hello from file1.in\n') +test.must_match('relocate/src/external/file2.external_rules.out', + 'Hello from file2.in\n') + +test.pass_test() diff --git a/tools/gyp/test/rules/gyptest-input-root.py b/tools/gyp/test/rules/gyptest-input-root.py new file mode 100755 index 000000000..92bade6d4 --- /dev/null +++ b/tools/gyp/test/rules/gyptest-input-root.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that RULE_INPUT_ROOT isn't turned into a path in rule actions +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('input-root.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('input-root.gyp', target='test', chdir='relocate/src') + +expect = """\ +Hello somefile +""" + +test.run_built_executable('test', chdir='relocate/src', stdout=expect) +test.pass_test() diff --git a/tools/gyp/test/rules/src/actions.gyp b/tools/gyp/test/rules/src/actions.gyp new file mode 100644 index 000000000..5c0a40b0c --- /dev/null +++ b/tools/gyp/test/rules/src/actions.gyp @@ -0,0 +1,22 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'pull_in_all_actions', + 'type': 'none', + 'dependencies': [ + 'subdir1/executable.gyp:*', + 'subdir2/never_used.gyp:*', + 'subdir2/no_inputs.gyp:*', + 'subdir2/no_action.gyp:*', + 'subdir2/none.gyp:*', + 'subdir3/executable2.gyp:*', + 'subdir4/build-asm.gyp:*', + 'external/external.gyp:*', + ], + }, + ], +} diff --git a/tools/gyp/test/rules/src/copy-file.py b/tools/gyp/test/rules/src/copy-file.py new file mode 100755 index 000000000..5a5feae1f --- /dev/null +++ b/tools/gyp/test/rules/src/copy-file.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +import sys + +contents = open(sys.argv[1], 'r').read() +open(sys.argv[2], 'wb').write(contents) + +sys.exit(0) diff --git a/tools/gyp/test/rules/src/external/external.gyp b/tools/gyp/test/rules/src/external/external.gyp new file mode 100644 index 000000000..b28174f57 --- /dev/null +++ b/tools/gyp/test/rules/src/external/external.gyp @@ -0,0 +1,66 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Test that the case where there are no inputs (other than the +# file the rule applies to). +{ + 'target_defaults': { + 'msvs_cygwin_dirs': ['../../../../../../<(DEPTH)/third_party/cygwin'], + }, + 'targets': [ + { + 'target_name': 'external_rules', + 'type': 'none', + 'sources': [ + 'file1.in', + 'file2.in', + ], + 'conditions': [ + ['OS=="win"', { + 'dependencies': [ + 'cygwin', + ], + }], + ], + 'rules': [ + { + 'rule_name': 'copy_file', + 'extension': 'in', + 'msvs_external_rule': 1, + 'outputs': [ + '<(RULE_INPUT_ROOT).external_rules.out', + ], + 'action': [ + 'python', '../copy-file.py', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + }, + ], + }, + ], + 'conditions': [ + ['OS=="win"', { + 'targets': [ + { + 'target_name': 'cygwin', + 'type': 'none', + 'actions': [ + { + 'action_name': 'setup_mount', + 'msvs_cygwin_shell': 0, + 'inputs': [ + '../../../../../../<(DEPTH)/third_party/cygwin/setup_mount.bat', + ], + # Visual Studio requires an output file, or else the + # custom build step won't run. + 'outputs': [ + '<(INTERMEDIATE_DIR)/_always_run_setup_mount.marker', + ], + 'action': ['<@(_inputs)'], + }, + ], + }, + ], + }], + ], +} diff --git a/tools/gyp/test/rules/src/external/file1.in b/tools/gyp/test/rules/src/external/file1.in new file mode 100644 index 000000000..86ac3ad38 --- /dev/null +++ b/tools/gyp/test/rules/src/external/file1.in @@ -0,0 +1 @@ +Hello from file1.in diff --git a/tools/gyp/test/rules/src/external/file2.in b/tools/gyp/test/rules/src/external/file2.in new file mode 100644 index 000000000..bf83d8ece --- /dev/null +++ b/tools/gyp/test/rules/src/external/file2.in @@ -0,0 +1 @@ +Hello from file2.in diff --git a/tools/gyp/test/rules/src/input-root.gyp b/tools/gyp/test/rules/src/input-root.gyp new file mode 100644 index 000000000..b6600e767 --- /dev/null +++ b/tools/gyp/test/rules/src/input-root.gyp @@ -0,0 +1,24 @@ +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test', + 'type': 'executable', + 'sources': [ 'somefile.ext', ], + 'rules': [{ + 'rule_name': 'rule', + 'extension': 'ext', + 'inputs': [ 'rule.py', ], + 'outputs': [ '<(RULE_INPUT_ROOT).cc', ], + 'action': [ 'python', 'rule.py', '<(RULE_INPUT_ROOT)', ], + 'message': 'Processing <(RULE_INPUT_PATH)', + 'process_outputs_as_sources': 1, + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }], + }, + ], +} diff --git a/tools/gyp/test/rules/src/noaction/file1.in b/tools/gyp/test/rules/src/noaction/file1.in new file mode 100644 index 000000000..86ac3ad38 --- /dev/null +++ b/tools/gyp/test/rules/src/noaction/file1.in @@ -0,0 +1 @@ +Hello from file1.in diff --git a/tools/gyp/test/rules/src/noaction/no_action_with_rules_fails.gyp b/tools/gyp/test/rules/src/noaction/no_action_with_rules_fails.gyp new file mode 100644 index 000000000..9b6a65629 --- /dev/null +++ b/tools/gyp/test/rules/src/noaction/no_action_with_rules_fails.gyp @@ -0,0 +1,37 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Test the case where there's no action but there are input rules that should +# be processed results in a gyp failure. +{ + 'targets': [ + { + 'target_name': 'extension_does_match_sources_but_no_action', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'file1.in', + ], + 'rules': [ + { + 'rule_name': 'assembled', + 'extension': 'in', + 'outputs': [ + '<(RULE_INPUT_ROOT).in', + ], + 'conditions': [ + # Always fails. + [ '"true"=="false"', { + 'action': [ + 'python', '../copy-file.py', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + 'message': 'test_rule', + }], + ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/rules/src/rule.py b/tools/gyp/test/rules/src/rule.py new file mode 100755 index 000000000..8a1f36ded --- /dev/null +++ b/tools/gyp/test/rules/src/rule.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +f = open(sys.argv[1] + ".cc", "w") +f.write("""\ +#include + +int main() { + puts("Hello %s"); + return 0; +} +""" % sys.argv[1]) +f.close() diff --git a/tools/gyp/test/rules/src/somefile.ext b/tools/gyp/test/rules/src/somefile.ext new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/rules/src/subdir1/executable.gyp b/tools/gyp/test/rules/src/subdir1/executable.gyp new file mode 100644 index 000000000..302857789 --- /dev/null +++ b/tools/gyp/test/rules/src/subdir1/executable.gyp @@ -0,0 +1,37 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'program', + 'type': 'executable', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'program.c', + 'function1.in', + 'function2.in', + ], + 'rules': [ + { + 'rule_name': 'copy_file', + 'extension': 'in', + 'inputs': [ + '../copy-file.py', + ], + 'outputs': [ + # TODO: fix SCons and Make to support generated files not + # in a variable-named path like <(INTERMEDIATE_DIR) + #'<(RULE_INPUT_ROOT).c', + '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).c', + ], + 'action': [ + 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/rules/src/subdir1/function1.in b/tools/gyp/test/rules/src/subdir1/function1.in new file mode 100644 index 000000000..60ff28949 --- /dev/null +++ b/tools/gyp/test/rules/src/subdir1/function1.in @@ -0,0 +1,6 @@ +#include + +void function1(void) +{ + printf("Hello from function1.in\n"); +} diff --git a/tools/gyp/test/rules/src/subdir1/function2.in b/tools/gyp/test/rules/src/subdir1/function2.in new file mode 100644 index 000000000..0fcfc03fd --- /dev/null +++ b/tools/gyp/test/rules/src/subdir1/function2.in @@ -0,0 +1,6 @@ +#include + +void function2(void) +{ + printf("Hello from function2.in\n"); +} diff --git a/tools/gyp/test/rules/src/subdir1/program.c b/tools/gyp/test/rules/src/subdir1/program.c new file mode 100644 index 000000000..258d7f99e --- /dev/null +++ b/tools/gyp/test/rules/src/subdir1/program.c @@ -0,0 +1,12 @@ +#include + +extern void function1(void); +extern void function2(void); + +int main(int argc, char *argv[]) +{ + printf("Hello from program.c\n"); + function1(); + function2(); + return 0; +} diff --git a/tools/gyp/test/rules/src/subdir2/file1.in b/tools/gyp/test/rules/src/subdir2/file1.in new file mode 100644 index 000000000..86ac3ad38 --- /dev/null +++ b/tools/gyp/test/rules/src/subdir2/file1.in @@ -0,0 +1 @@ +Hello from file1.in diff --git a/tools/gyp/test/rules/src/subdir2/file2.in b/tools/gyp/test/rules/src/subdir2/file2.in new file mode 100644 index 000000000..bf83d8ece --- /dev/null +++ b/tools/gyp/test/rules/src/subdir2/file2.in @@ -0,0 +1 @@ +Hello from file2.in diff --git a/tools/gyp/test/rules/src/subdir2/never_used.gyp b/tools/gyp/test/rules/src/subdir2/never_used.gyp new file mode 100644 index 000000000..17f6f5537 --- /dev/null +++ b/tools/gyp/test/rules/src/subdir2/never_used.gyp @@ -0,0 +1,31 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Test that the case where there is a rule that doesn't apply to anything. +{ + 'targets': [ + { + 'target_name': 'files_no_input2', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'file1.in', + 'file2.in', + ], + 'rules': [ + { + 'rule_name': 'copy_file3', + 'extension': 'in2', + 'outputs': [ + '<(RULE_INPUT_ROOT).out3', + ], + 'action': [ + 'python', '../copy-file.py', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/rules/src/subdir2/no_action.gyp b/tools/gyp/test/rules/src/subdir2/no_action.gyp new file mode 100644 index 000000000..ffa1cefe1 --- /dev/null +++ b/tools/gyp/test/rules/src/subdir2/no_action.gyp @@ -0,0 +1,38 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Test that the case where an action is only specified under a conditional is +# evaluated appropriately. +{ + 'targets': [ + { + 'target_name': 'extension_does_not_match_sources_and_no_action', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'file1.in', + 'file2.in', + ], + 'rules': [ + { + 'rule_name': 'assemble', + 'extension': 'asm', + 'outputs': [ + '<(RULE_INPUT_ROOT).fail', + ], + 'conditions': [ + # Always fails. + [ '"true"=="false"', { + 'action': [ + 'python', '../copy-file.py', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + 'message': 'test_rule', + }], + ], + }, + ], + }, + ], +} diff --git a/tools/gyp/test/rules/src/subdir2/no_inputs.gyp b/tools/gyp/test/rules/src/subdir2/no_inputs.gyp new file mode 100644 index 000000000..e61a1a3ff --- /dev/null +++ b/tools/gyp/test/rules/src/subdir2/no_inputs.gyp @@ -0,0 +1,32 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Test that the case where there are no inputs (other than the +# file the rule applies to). +{ + 'targets': [ + { + 'target_name': 'files_no_input', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'file1.in', + 'file2.in', + ], + 'rules': [ + { + 'rule_name': 'copy_file2', + 'extension': 'in', + 'outputs': [ + '<(RULE_INPUT_ROOT).out2', + ], + 'action': [ + 'python', '../copy-file.py', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/rules/src/subdir2/none.gyp b/tools/gyp/test/rules/src/subdir2/none.gyp new file mode 100644 index 000000000..38bcdabdf --- /dev/null +++ b/tools/gyp/test/rules/src/subdir2/none.gyp @@ -0,0 +1,33 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'files', + 'type': 'none', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'file1.in', + 'file2.in', + ], + 'rules': [ + { + 'rule_name': 'copy_file', + 'extension': 'in', + 'inputs': [ + '../copy-file.py', + ], + 'outputs': [ + '<(RULE_INPUT_ROOT).out', + ], + 'action': [ + 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/rules/src/subdir3/executable2.gyp b/tools/gyp/test/rules/src/subdir3/executable2.gyp new file mode 100644 index 000000000..a2a528fc7 --- /dev/null +++ b/tools/gyp/test/rules/src/subdir3/executable2.gyp @@ -0,0 +1,37 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This one tests that rules are properly written if extensions are different +# between the target's sources (program.c) and the generated files +# (function3.cc) + +{ + 'targets': [ + { + 'target_name': 'program2', + 'type': 'executable', + 'msvs_cygwin_shell': 0, + 'sources': [ + 'program.c', + 'function3.in', + ], + 'rules': [ + { + 'rule_name': 'copy_file', + 'extension': 'in', + 'inputs': [ + '../copy-file.py', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).cc', + ], + 'action': [ + 'python', '<(_inputs)', '<(RULE_INPUT_PATH)', '<@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/rules/src/subdir3/function3.in b/tools/gyp/test/rules/src/subdir3/function3.in new file mode 100644 index 000000000..99f46ab05 --- /dev/null +++ b/tools/gyp/test/rules/src/subdir3/function3.in @@ -0,0 +1,6 @@ +#include + +extern "C" void function3(void) +{ + printf("Hello from function3.in\n"); +} diff --git a/tools/gyp/test/rules/src/subdir3/program.c b/tools/gyp/test/rules/src/subdir3/program.c new file mode 100644 index 000000000..94f6c5091 --- /dev/null +++ b/tools/gyp/test/rules/src/subdir3/program.c @@ -0,0 +1,10 @@ +#include + +extern void function3(void); + +int main(int argc, char *argv[]) +{ + printf("Hello from program.c\n"); + function3(); + return 0; +} diff --git a/tools/gyp/test/rules/src/subdir4/asm-function.asm b/tools/gyp/test/rules/src/subdir4/asm-function.asm new file mode 100644 index 000000000..ed47cade9 --- /dev/null +++ b/tools/gyp/test/rules/src/subdir4/asm-function.asm @@ -0,0 +1,10 @@ +#if PLATFORM_WINDOWS || PLATFORM_MAC +# define IDENTIFIER(n) _##n +#else /* Linux */ +# define IDENTIFIER(n) n +#endif + +.globl IDENTIFIER(asm_function) +IDENTIFIER(asm_function): + movl $41, %eax + ret diff --git a/tools/gyp/test/rules/src/subdir4/build-asm.gyp b/tools/gyp/test/rules/src/subdir4/build-asm.gyp new file mode 100644 index 000000000..be4a612d1 --- /dev/null +++ b/tools/gyp/test/rules/src/subdir4/build-asm.gyp @@ -0,0 +1,49 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This one tests that assembly files ended as .s and .S are compiled. + +{ + 'target_defaults': { + 'conditions': [ + ['OS=="win"', { + 'defines': ['PLATFORM_WIN'], + }], + ['OS=="mac"', { + 'defines': ['PLATFORM_MAC'], + }], + ['OS=="linux"', { + 'defines': ['PLATFORM_LINUX'], + }], + ], + }, + 'targets': [ + { + 'target_name': 'program4', + 'type': 'executable', + 'sources': [ + 'asm-function.asm', + 'program.c', + ], + 'conditions': [ + ['OS=="linux" or OS=="mac"', { + 'rules': [ + { + 'rule_name': 'convert_asm', + 'extension': 'asm', + 'inputs': [], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).S', + ], + 'action': [ + 'bash', '-c', 'mv <(RULE_INPUT_PATH) <@(_outputs)', + ], + 'process_outputs_as_sources': 1, + }, + ], + }], + ], + }, + ], +} diff --git a/tools/gyp/test/rules/src/subdir4/program.c b/tools/gyp/test/rules/src/subdir4/program.c new file mode 100644 index 000000000..424759062 --- /dev/null +++ b/tools/gyp/test/rules/src/subdir4/program.c @@ -0,0 +1,19 @@ +#include + +// Use the assembly function in linux and mac where it is built. +#if PLATFORM_LINUX || PLATFORM_MAC +extern int asm_function(void); +#else +int asm_function() { + return 41; +} +#endif + +int main(int argc, char *argv[]) +{ + fprintf(stdout, "Hello from program.c\n"); + fflush(stdout); + fprintf(stdout, "Got %d.\n", asm_function()); + fflush(stdout); + return 0; +} diff --git a/tools/gyp/test/same-gyp-name/gyptest-all.py b/tools/gyp/test/same-gyp-name/gyptest-all.py new file mode 100755 index 000000000..04fafd43b --- /dev/null +++ b/tools/gyp/test/same-gyp-name/gyptest-all.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Build a .gyp that depends on 2 gyp files with the same name. +""" + +import TestGyp + +# This causes a problem on XCode (duplicate ID). +# See http://code.google.com/p/gyp/issues/detail?id=114 +test = TestGyp.TestGyp(formats=['!xcode']) + +test.run_gyp('all.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('all.gyp', test.ALL, chdir='relocate/src') + +expect1 = """\ +Hello from main1.cc +""" + +expect2 = """\ +Hello from main2.cc +""" + +test.run_built_executable('program1', chdir='relocate/src', stdout=expect1) +test.run_built_executable('program2', chdir='relocate/src', stdout=expect2) + +test.pass_test() diff --git a/tools/gyp/test/same-gyp-name/gyptest-default.py b/tools/gyp/test/same-gyp-name/gyptest-default.py new file mode 100755 index 000000000..78f2cffb1 --- /dev/null +++ b/tools/gyp/test/same-gyp-name/gyptest-default.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Build a .gyp that depends on 2 gyp files with the same name. +""" + +import TestGyp + +# This causes a problem on XCode (duplicate ID). +# See http://code.google.com/p/gyp/issues/detail?id=114 +test = TestGyp.TestGyp(formats=['!xcode']) + +test.run_gyp('all.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('all.gyp', chdir='relocate/src') + +expect1 = """\ +Hello from main1.cc +""" + +expect2 = """\ +Hello from main2.cc +""" + +test.run_built_executable('program1', chdir='relocate/src', stdout=expect1) +test.run_built_executable('program2', chdir='relocate/src', stdout=expect2) + +test.pass_test() diff --git a/tools/gyp/test/same-gyp-name/src/all.gyp b/tools/gyp/test/same-gyp-name/src/all.gyp new file mode 100644 index 000000000..229f02ea8 --- /dev/null +++ b/tools/gyp/test/same-gyp-name/src/all.gyp @@ -0,0 +1,16 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'all_exes', + 'type': 'none', + 'dependencies': [ + 'subdir1/executable.gyp:*', + 'subdir2/executable.gyp:*', + ], + }, + ], +} diff --git a/tools/gyp/test/same-gyp-name/src/subdir1/executable.gyp b/tools/gyp/test/same-gyp-name/src/subdir1/executable.gyp new file mode 100644 index 000000000..82483b4c6 --- /dev/null +++ b/tools/gyp/test/same-gyp-name/src/subdir1/executable.gyp @@ -0,0 +1,15 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'program1', + 'type': 'executable', + 'sources': [ + 'main1.cc', + ], + }, + ], +} diff --git a/tools/gyp/test/same-gyp-name/src/subdir1/main1.cc b/tools/gyp/test/same-gyp-name/src/subdir1/main1.cc new file mode 100644 index 000000000..364555832 --- /dev/null +++ b/tools/gyp/test/same-gyp-name/src/subdir1/main1.cc @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello from main1.cc\n"); + return 0; +} diff --git a/tools/gyp/test/same-gyp-name/src/subdir2/executable.gyp b/tools/gyp/test/same-gyp-name/src/subdir2/executable.gyp new file mode 100644 index 000000000..e3537013e --- /dev/null +++ b/tools/gyp/test/same-gyp-name/src/subdir2/executable.gyp @@ -0,0 +1,15 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'program2', + 'type': 'executable', + 'sources': [ + 'main2.cc', + ], + }, + ], +} diff --git a/tools/gyp/test/same-gyp-name/src/subdir2/main2.cc b/tools/gyp/test/same-gyp-name/src/subdir2/main2.cc new file mode 100644 index 000000000..0c724dee3 --- /dev/null +++ b/tools/gyp/test/same-gyp-name/src/subdir2/main2.cc @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello from main2.cc\n"); + return 0; +} diff --git a/tools/gyp/test/same-rule-output-file-name/gyptest-all.py b/tools/gyp/test/same-rule-output-file-name/gyptest-all.py new file mode 100644 index 000000000..964e6b772 --- /dev/null +++ b/tools/gyp/test/same-rule-output-file-name/gyptest-all.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Tests the use of rules with the same output file name. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('subdirs.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('subdirs.gyp', test.ALL, chdir='relocate/src') +test.must_exist('relocate/src/subdir1/rule.txt') +test.must_exist('relocate/src/subdir2/rule.txt') + +test.pass_test() diff --git a/tools/gyp/test/same-rule-output-file-name/src/subdir1/subdir1.gyp b/tools/gyp/test/same-rule-output-file-name/src/subdir1/subdir1.gyp new file mode 100644 index 000000000..bff381a5a --- /dev/null +++ b/tools/gyp/test/same-rule-output-file-name/src/subdir1/subdir1.gyp @@ -0,0 +1,30 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'target1', + 'type': 'none', + 'sources': [ + '../touch.py' + ], + 'rules': [ + { + 'rule_name': 'rule1', + 'extension': 'py', + 'inputs': [], + 'outputs': [ + 'rule.txt', + ], + 'action': [ + 'python', '../touch.py', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/same-rule-output-file-name/src/subdir2/subdir2.gyp b/tools/gyp/test/same-rule-output-file-name/src/subdir2/subdir2.gyp new file mode 100644 index 000000000..12a35600a --- /dev/null +++ b/tools/gyp/test/same-rule-output-file-name/src/subdir2/subdir2.gyp @@ -0,0 +1,30 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'target2', + 'type': 'none', + 'sources': [ + '../touch.py' + ], + 'rules': [ + { + 'rule_name': 'rule2', + 'extension': 'py', + 'inputs': [], + 'outputs': [ + 'rule.txt', + ], + 'action': [ + 'python', '../touch.py', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/same-rule-output-file-name/src/subdirs.gyp b/tools/gyp/test/same-rule-output-file-name/src/subdirs.gyp new file mode 100644 index 000000000..25259a38f --- /dev/null +++ b/tools/gyp/test/same-rule-output-file-name/src/subdirs.gyp @@ -0,0 +1,16 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'subdirs', + 'type': 'none', + 'dependencies': [ + 'subdir1/subdir1.gyp:*', + 'subdir2/subdir2.gyp:*', + ], + }, + ], +} diff --git a/tools/gyp/test/same-rule-output-file-name/src/touch.py b/tools/gyp/test/same-rule-output-file-name/src/touch.py new file mode 100644 index 000000000..4247dac6e --- /dev/null +++ b/tools/gyp/test/same-rule-output-file-name/src/touch.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import shlex +import sys + +# Trim quotes +sys.argv[1], = shlex.split(sys.argv[1]) + +f = open(sys.argv[1], 'w+') +f.write('Hello from touch.py\n') +f.close() diff --git a/tools/gyp/test/same-source-file-name/gyptest-all.py b/tools/gyp/test/same-source-file-name/gyptest-all.py new file mode 100755 index 000000000..4c215027c --- /dev/null +++ b/tools/gyp/test/same-source-file-name/gyptest-all.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Build a .gyp with two targets that share a common .c source file. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('all.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('all.gyp', test.ALL, chdir='relocate/src') + +expect1 = """\ +Hello from prog1.c +Hello prog1 from func.c +""" + +expect2 = """\ +Hello from prog2.c +Hello prog2 from func.c +""" + +test.run_built_executable('prog1', chdir='relocate/src', stdout=expect1) +test.run_built_executable('prog2', chdir='relocate/src', stdout=expect2) + +test.pass_test() diff --git a/tools/gyp/test/same-source-file-name/gyptest-default.py b/tools/gyp/test/same-source-file-name/gyptest-default.py new file mode 100755 index 000000000..98757c269 --- /dev/null +++ b/tools/gyp/test/same-source-file-name/gyptest-default.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Build a .gyp with two targets that share a common .c source file. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('all.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('all.gyp', chdir='relocate/src') + +expect1 = """\ +Hello from prog1.c +Hello prog1 from func.c +""" + +expect2 = """\ +Hello from prog2.c +Hello prog2 from func.c +""" + +test.run_built_executable('prog1', chdir='relocate/src', stdout=expect1) +test.run_built_executable('prog2', chdir='relocate/src', stdout=expect2) + +test.pass_test() diff --git a/tools/gyp/test/same-source-file-name/gyptest-fail.py b/tools/gyp/test/same-source-file-name/gyptest-fail.py new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/same-source-file-name/src/all.gyp b/tools/gyp/test/same-source-file-name/src/all.gyp new file mode 100644 index 000000000..4fe052c66 --- /dev/null +++ b/tools/gyp/test/same-source-file-name/src/all.gyp @@ -0,0 +1,30 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'prog1', + 'type': 'executable', + 'defines': [ + 'PROG="prog1"', + ], + 'sources': [ + 'prog1.c', + 'func.c', + ], + }, + { + 'target_name': 'prog2', + 'type': 'executable', + 'defines': [ + 'PROG="prog2"', + ], + 'sources': [ + 'prog2.c', + 'func.c', + ], + }, + ], +} diff --git a/tools/gyp/test/same-source-file-name/src/double.gyp b/tools/gyp/test/same-source-file-name/src/double.gyp new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/same-source-file-name/src/func.c b/tools/gyp/test/same-source-file-name/src/func.c new file mode 100644 index 000000000..e069c692a --- /dev/null +++ b/tools/gyp/test/same-source-file-name/src/func.c @@ -0,0 +1,6 @@ +#include + +void func(void) +{ + printf("Hello %s from func.c\n", PROG); +} diff --git a/tools/gyp/test/same-source-file-name/src/prog1.c b/tools/gyp/test/same-source-file-name/src/prog1.c new file mode 100644 index 000000000..c8940fedc --- /dev/null +++ b/tools/gyp/test/same-source-file-name/src/prog1.c @@ -0,0 +1,16 @@ +#include + +extern void func(void); + +int main(int argc, char *argv[]) +{ + printf("Hello from prog1.c\n"); + func(); + /* + * Uncomment to test same-named files in different directories, + * which Visual Studio doesn't support. + subdir1_func(); + subdir2_func(); + */ + return 0; +} diff --git a/tools/gyp/test/same-source-file-name/src/prog2.c b/tools/gyp/test/same-source-file-name/src/prog2.c new file mode 100644 index 000000000..e6605c2bd --- /dev/null +++ b/tools/gyp/test/same-source-file-name/src/prog2.c @@ -0,0 +1,16 @@ +#include + +extern void func(void); + +int main(int argc, char *argv[]) +{ + printf("Hello from prog2.c\n"); + func(); + /* + * Uncomment to test same-named files in different directories, + * which Visual Studio doesn't support. + subdir1_func(); + subdir2_func(); + */ + return 0; +} diff --git a/tools/gyp/test/same-source-file-name/src/subdir1/func.c b/tools/gyp/test/same-source-file-name/src/subdir1/func.c new file mode 100644 index 000000000..b73450d10 --- /dev/null +++ b/tools/gyp/test/same-source-file-name/src/subdir1/func.c @@ -0,0 +1,6 @@ +#include + +void subdir1_func(void) +{ + printf("Hello %s from subdir1/func.c\n", PROG); +} diff --git a/tools/gyp/test/same-source-file-name/src/subdir2/func.c b/tools/gyp/test/same-source-file-name/src/subdir2/func.c new file mode 100644 index 000000000..0248b5720 --- /dev/null +++ b/tools/gyp/test/same-source-file-name/src/subdir2/func.c @@ -0,0 +1,6 @@ +#include + +void subdir2_func(void) +{ + printf("Hello %s from subdir2/func.c\n", PROG); +} diff --git a/tools/gyp/test/same-target-name-different-directory/gyptest-all.py b/tools/gyp/test/same-target-name-different-directory/gyptest-all.py new file mode 100644 index 000000000..adeeffc1d --- /dev/null +++ b/tools/gyp/test/same-target-name-different-directory/gyptest-all.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Test cases when multiple targets in different directories have the same name. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['ninja', 'make']) + +test.run_gyp('subdirs.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +# Test that we build all targets. +test.build('subdirs.gyp', 'target', chdir='relocate/src') +test.must_exist('relocate/src/subdir1/action1.txt') +test.must_exist('relocate/src/subdir2/action2.txt') + +# Test that we build all targets using the correct actions, even if they have +# the same names. +test.build('subdirs.gyp', 'target_same_action_name', chdir='relocate/src') +test.must_exist('relocate/src/subdir1/action.txt') +test.must_exist('relocate/src/subdir2/action.txt') + +# Test that we build all targets using the correct rules, even if they have +# the same names. +test.build('subdirs.gyp', 'target_same_rule_name', chdir='relocate/src') +test.must_exist('relocate/src/subdir1/rule.txt') +test.must_exist('relocate/src/subdir2/rule.txt') + +test.pass_test() diff --git a/tools/gyp/test/same-target-name-different-directory/src/subdir1/subdir1.gyp b/tools/gyp/test/same-target-name-different-directory/src/subdir1/subdir1.gyp new file mode 100644 index 000000000..d4ec2e679 --- /dev/null +++ b/tools/gyp/test/same-target-name-different-directory/src/subdir1/subdir1.gyp @@ -0,0 +1,66 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'target', + 'type': 'none', + 'actions': [ + { + 'action_name': 'action1', + 'inputs': [], + 'outputs': [ + 'action1.txt', + ], + 'action': [ + 'python', '../touch.py', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + { + 'target_name': 'target_same_action_name', + 'type': 'none', + 'actions': [ + { + 'action_name': 'action', + 'inputs': [], + 'outputs': [ + 'action.txt', + ], + 'action': [ + 'python', '../touch.py', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + { + 'target_name': 'target_same_rule_name', + 'type': 'none', + 'sources': [ + '../touch.py' + ], + 'rules': [ + { + 'rule_name': 'rule', + 'extension': 'py', + 'inputs': [], + 'outputs': [ + 'rule.txt', + ], + 'action': [ + 'python', '../touch.py', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/same-target-name-different-directory/src/subdir2/subdir2.gyp b/tools/gyp/test/same-target-name-different-directory/src/subdir2/subdir2.gyp new file mode 100644 index 000000000..9006d450b --- /dev/null +++ b/tools/gyp/test/same-target-name-different-directory/src/subdir2/subdir2.gyp @@ -0,0 +1,66 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'target', + 'type': 'none', + 'actions': [ + { + 'action_name': 'action2', + 'inputs': [], + 'outputs': [ + 'action2.txt', + ], + 'action': [ + 'python', '../touch.py', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + { + 'target_name': 'target_same_action_name', + 'type': 'none', + 'actions': [ + { + 'action_name': 'action', + 'inputs': [], + 'outputs': [ + 'action.txt', + ], + 'action': [ + 'python', '../touch.py', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + { + 'target_name': 'target_same_rule_name', + 'type': 'none', + 'sources': [ + '../touch.py' + ], + 'rules': [ + { + 'rule_name': 'rule', + 'extension': 'py', + 'inputs': [], + 'outputs': [ + 'rule.txt', + ], + 'action': [ + 'python', '../touch.py', '<(_outputs)', + ], + # Allows the test to run without hermetic cygwin on windows. + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/tools/gyp/test/same-target-name-different-directory/src/subdirs.gyp b/tools/gyp/test/same-target-name-different-directory/src/subdirs.gyp new file mode 100644 index 000000000..65413e73b --- /dev/null +++ b/tools/gyp/test/same-target-name-different-directory/src/subdirs.gyp @@ -0,0 +1,16 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'subdirs', + 'type': 'none', + 'dependencies': [ + 'subdir1/subdir1.gyp:*', + 'subdir2/subdir2.gyp:*', + ], + }, + ], +} diff --git a/tools/gyp/test/same-target-name-different-directory/src/touch.py b/tools/gyp/test/same-target-name-different-directory/src/touch.py new file mode 100644 index 000000000..4247dac6e --- /dev/null +++ b/tools/gyp/test/same-target-name-different-directory/src/touch.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import shlex +import sys + +# Trim quotes +sys.argv[1], = shlex.split(sys.argv[1]) + +f = open(sys.argv[1], 'w+') +f.write('Hello from touch.py\n') +f.close() diff --git a/tools/gyp/test/same-target-name/gyptest-same-target-name.py b/tools/gyp/test/same-target-name/gyptest-same-target-name.py new file mode 100755 index 000000000..bfe5540f3 --- /dev/null +++ b/tools/gyp/test/same-target-name/gyptest-same-target-name.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Check that duplicate targets in a directory gives an error. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +# Require that gyp files with duplicate targets spit out an error. +test.run_gyp('all.gyp', chdir='src', status=1, stderr=None) + +test.pass_test() diff --git a/tools/gyp/test/same-target-name/src/all.gyp b/tools/gyp/test/same-target-name/src/all.gyp new file mode 100644 index 000000000..ac16976da --- /dev/null +++ b/tools/gyp/test/same-target-name/src/all.gyp @@ -0,0 +1,16 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'all_exes', + 'type': 'none', + 'dependencies': [ + 'executable1.gyp:*', + 'executable2.gyp:*', + ], + }, + ], +} diff --git a/tools/gyp/test/same-target-name/src/executable1.gyp b/tools/gyp/test/same-target-name/src/executable1.gyp new file mode 100644 index 000000000..3c492c1b3 --- /dev/null +++ b/tools/gyp/test/same-target-name/src/executable1.gyp @@ -0,0 +1,15 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'program', + 'type': 'executable', + 'sources': [ + 'main1.cc', + ], + }, + ], +} diff --git a/tools/gyp/test/same-target-name/src/executable2.gyp b/tools/gyp/test/same-target-name/src/executable2.gyp new file mode 100644 index 000000000..41e84a61c --- /dev/null +++ b/tools/gyp/test/same-target-name/src/executable2.gyp @@ -0,0 +1,15 @@ +# Copyright (c) 2010 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'program', + 'type': 'executable', + 'sources': [ + 'main2.cc', + ], + }, + ], +} diff --git a/tools/gyp/test/sanitize-rule-names/blah.S b/tools/gyp/test/sanitize-rule-names/blah.S new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/sanitize-rule-names/gyptest-sanitize-rule-names.py b/tools/gyp/test/sanitize-rule-names/gyptest-sanitize-rule-names.py new file mode 100644 index 000000000..968a0ce5c --- /dev/null +++ b/tools/gyp/test/sanitize-rule-names/gyptest-sanitize-rule-names.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure rule names with non-"normal" characters in them don't cause +broken build files. This test was originally causing broken .ninja files. +""" + +import TestGyp + +test = TestGyp.TestGyp() +test.run_gyp('sanitize-rule-names.gyp') +test.build('sanitize-rule-names.gyp', test.ALL) +test.pass_test() diff --git a/tools/gyp/test/sanitize-rule-names/hello.cc b/tools/gyp/test/sanitize-rule-names/hello.cc new file mode 100644 index 000000000..1711567ef --- /dev/null +++ b/tools/gyp/test/sanitize-rule-names/hello.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + return 0; +} diff --git a/tools/gyp/test/sanitize-rule-names/sanitize-rule-names.gyp b/tools/gyp/test/sanitize-rule-names/sanitize-rule-names.gyp new file mode 100644 index 000000000..184253e96 --- /dev/null +++ b/tools/gyp/test/sanitize-rule-names/sanitize-rule-names.gyp @@ -0,0 +1,27 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 's_test', + 'type': 'executable', + 'rules': [ + { + # Make sure this rule name doesn't cause an invalid ninja file. + 'rule_name': 'rule name with odd characters ()/', + 'extension': 'S', + 'outputs': ['outfile'], + 'msvs_cygwin_shell': 0, + 'msvs_quote_cmd': 0, + 'action': ['python', 'script.py', '<(RULE_INPUT_PATH)', 'outfile'], + }, + ], + 'sources': [ + 'blah.S', + 'hello.cc', + ], + }, + ], +} diff --git a/tools/gyp/test/sanitize-rule-names/script.py b/tools/gyp/test/sanitize-rule-names/script.py new file mode 100644 index 000000000..ae2efa1df --- /dev/null +++ b/tools/gyp/test/sanitize-rule-names/script.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import shutil +import sys + +shutil.copyfile(*sys.argv[1:]) diff --git a/tools/gyp/test/scons_tools/gyptest-tools.py b/tools/gyp/test/scons_tools/gyptest-tools.py new file mode 100755 index 000000000..e97f5e631 --- /dev/null +++ b/tools/gyp/test/scons_tools/gyptest-tools.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that a scons build picks up tools modules specified +via 'scons_tools' in the 'scons_settings' dictionary. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('tools.gyp') + +test.build('tools.gyp', test.ALL) + +if test.format == 'scons': + expect = "Hello, world!\n" +else: + expect = "" +test.run_built_executable('tools', stdout=expect) + +test.pass_test() diff --git a/tools/gyp/test/scons_tools/site_scons/site_tools/this_tool.py b/tools/gyp/test/scons_tools/site_scons/site_tools/this_tool.py new file mode 100644 index 000000000..10c89476d --- /dev/null +++ b/tools/gyp/test/scons_tools/site_scons/site_tools/this_tool.py @@ -0,0 +1,10 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# SCons "tool" module that simply sets a -D value. +def generate(env): + env['CPPDEFINES'] = ['THIS_TOOL'] + +def exists(env): + pass diff --git a/tools/gyp/test/scons_tools/tools.c b/tools/gyp/test/scons_tools/tools.c new file mode 100644 index 000000000..78dc0e31e --- /dev/null +++ b/tools/gyp/test/scons_tools/tools.c @@ -0,0 +1,13 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +int main(int argc, char *argv[]) +{ +#ifdef THIS_TOOL + printf("Hello, world!\n"); +#endif + return 0; +} diff --git a/tools/gyp/test/scons_tools/tools.gyp b/tools/gyp/test/scons_tools/tools.gyp new file mode 100644 index 000000000..736ba3f22 --- /dev/null +++ b/tools/gyp/test/scons_tools/tools.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'tools', + 'type': 'executable', + 'sources': [ + 'tools.c', + ], + }, + ], + 'scons_settings': { + 'tools': ['default', 'this_tool'], + }, +} diff --git a/tools/gyp/test/sibling/gyptest-all.py b/tools/gyp/test/sibling/gyptest-all.py new file mode 100755 index 000000000..7e80cf823 --- /dev/null +++ b/tools/gyp/test/sibling/gyptest-all.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('build/all.gyp', chdir='src') + +test.build('build/all.gyp', test.ALL, chdir='src') + +chdir = 'src/build' + +# The top-level Makefile is in the directory where gyp was run. +# TODO(mmoss) Should the Makefile go in the directory of the passed in .gyp +# file? What about when passing in multiple .gyp files? Would sub-project +# Makefiles (see http://codereview.chromium.org/340008 comments) solve this? +if test.format in ('make', 'ninja'): + chdir = 'src' + +if test.format == 'xcode': + chdir = 'src/prog1' +test.run_built_executable('prog1', + chdir=chdir, + stdout="Hello from prog1.c\n") + +if test.format == 'xcode': + chdir = 'src/prog2' +test.run_built_executable('prog2', + chdir=chdir, + stdout="Hello from prog2.c\n") + +test.pass_test() diff --git a/tools/gyp/test/sibling/gyptest-relocate.py b/tools/gyp/test/sibling/gyptest-relocate.py new file mode 100755 index 000000000..7c8654818 --- /dev/null +++ b/tools/gyp/test/sibling/gyptest-relocate.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('build/all.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('build/all.gyp', test.ALL, chdir='relocate/src') + +chdir = 'relocate/src/build' + +# The top-level Makefile is in the directory where gyp was run. +# TODO(mmoss) Should the Makefile go in the directory of the passed in .gyp +# file? What about when passing in multiple .gyp files? Would sub-project +# Makefiles (see http://codereview.chromium.org/340008 comments) solve this? +if test.format in ('make', 'ninja'): + chdir = 'relocate/src' + +if test.format == 'xcode': + chdir = 'relocate/src/prog1' +test.run_built_executable('prog1', + chdir=chdir, + stdout="Hello from prog1.c\n") + +if test.format == 'xcode': + chdir = 'relocate/src/prog2' +test.run_built_executable('prog2', + chdir=chdir, + stdout="Hello from prog2.c\n") + +test.pass_test() diff --git a/tools/gyp/test/sibling/src/build/all.gyp b/tools/gyp/test/sibling/src/build/all.gyp new file mode 100644 index 000000000..6eafdf99b --- /dev/null +++ b/tools/gyp/test/sibling/src/build/all.gyp @@ -0,0 +1,17 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + # TODO(sgk): a target name of 'all' leads to a scons dependency cycle + 'target_name': 'All', + 'type': 'none', + 'dependencies': [ + '../prog1/prog1.gyp:*', + '../prog2/prog2.gyp:*', + ], + }, + ], +} diff --git a/tools/gyp/test/sibling/src/prog1/prog1.c b/tools/gyp/test/sibling/src/prog1/prog1.c new file mode 100644 index 000000000..161ae8a38 --- /dev/null +++ b/tools/gyp/test/sibling/src/prog1/prog1.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + printf("Hello from prog1.c\n"); + return 0; +} diff --git a/tools/gyp/test/sibling/src/prog1/prog1.gyp b/tools/gyp/test/sibling/src/prog1/prog1.gyp new file mode 100644 index 000000000..fbe38b97a --- /dev/null +++ b/tools/gyp/test/sibling/src/prog1/prog1.gyp @@ -0,0 +1,15 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'prog1', + 'type': 'executable', + 'sources': [ + 'prog1.c', + ], + }, + ], +} diff --git a/tools/gyp/test/sibling/src/prog2/prog2.c b/tools/gyp/test/sibling/src/prog2/prog2.c new file mode 100644 index 000000000..7635ae8c1 --- /dev/null +++ b/tools/gyp/test/sibling/src/prog2/prog2.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + printf("Hello from prog2.c\n"); + return 0; +} diff --git a/tools/gyp/test/sibling/src/prog2/prog2.gyp b/tools/gyp/test/sibling/src/prog2/prog2.gyp new file mode 100644 index 000000000..593454836 --- /dev/null +++ b/tools/gyp/test/sibling/src/prog2/prog2.gyp @@ -0,0 +1,15 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'prog2', + 'type': 'executable', + 'sources': [ + 'prog2.c', + ], + }, + ], +} diff --git a/tools/gyp/test/small/gyptest-small.py b/tools/gyp/test/small/gyptest-small.py new file mode 100755 index 000000000..3ed9d26f4 --- /dev/null +++ b/tools/gyp/test/small/gyptest-small.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Runs small tests. +""" + +import imp +import os +import sys +import unittest + +import TestGyp + + +test = TestGyp.TestGyp() + +# Add pylib to the import path (so tests can import their dependencies). +# This is consistant with the path.append done in the top file "gyp". +sys.path.append(os.path.join(test._cwd, 'pylib')) + +# Add new test suites here. +files_to_test = [ + 'pylib/gyp/MSVSSettings_test.py', + 'pylib/gyp/easy_xml_test.py', + 'pylib/gyp/generator/msvs_test.py', + 'pylib/gyp/generator/ninja_test.py', + 'pylib/gyp/common_test.py', +] + +# Collect all the suites from the above files. +suites = [] +for filename in files_to_test: + # Carve the module name out of the path. + name = os.path.splitext(os.path.split(filename)[1])[0] + # Find the complete module path. + full_filename = os.path.join(test._cwd, filename) + # Load the module. + module = imp.load_source(name, full_filename) + # Add it to the list of test suites. + suites.append(unittest.defaultTestLoader.loadTestsFromModule(module)) +# Create combined suite. +all_tests = unittest.TestSuite(suites) + +# Run all the tests. +result = unittest.TextTestRunner(verbosity=2).run(all_tests) +if result.failures or result.errors: + test.fail_test() + +test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-SYMROOT-all.py b/tools/gyp/test/subdirectory/gyptest-SYMROOT-all.py new file mode 100755 index 000000000..b7509041a --- /dev/null +++ b/tools/gyp/test/subdirectory/gyptest-SYMROOT-all.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies building a target and a subsidiary dependent target from a +.gyp file in a subdirectory, without specifying an explicit output build +directory, and using the generated solution or project file at the top +of the tree as the entry point. + +The configuration sets the Xcode SYMROOT variable and uses --depth= +to make Xcode behave like the other build tools--that is, put all +built targets in a single output build directory at the top of the tree. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('prog1.gyp', '-Dset_symroot=1', '--depth=.', chdir='src') + +test.relocate('src', 'relocate/src') + +# Suppress the test infrastructure's setting SYMROOT on the command line. +test.build('prog1.gyp', test.ALL, SYMROOT=None, chdir='relocate/src') + +test.run_built_executable('prog1', + stdout="Hello from prog1.c\n", + chdir='relocate/src') +test.run_built_executable('prog2', + stdout="Hello from prog2.c\n", + chdir='relocate/src') + +test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-SYMROOT-default.py b/tools/gyp/test/subdirectory/gyptest-SYMROOT-default.py new file mode 100755 index 000000000..c64ae7da3 --- /dev/null +++ b/tools/gyp/test/subdirectory/gyptest-SYMROOT-default.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies building a target and a subsidiary dependent target from a +.gyp file in a subdirectory, without specifying an explicit output build +directory, and using the generated solution or project file at the top +of the tree as the entry point. + +The configuration sets the Xcode SYMROOT variable and uses --depth= +to make Xcode behave like the other build tools--that is, put all +built targets in a single output build directory at the top of the tree. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('prog1.gyp', '-Dset_symroot=1', '--depth=.', chdir='src') + +test.relocate('src', 'relocate/src') + +# Suppress the test infrastructure's setting SYMROOT on the command line. +test.build('prog1.gyp', SYMROOT=None, chdir='relocate/src') + +test.run_built_executable('prog1', + stdout="Hello from prog1.c\n", + chdir='relocate/src') + +test.run_built_executable('prog2', + stdout="Hello from prog2.c\n", + chdir='relocate/src') + +test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-subdir-all.py b/tools/gyp/test/subdirectory/gyptest-subdir-all.py new file mode 100755 index 000000000..26686cf11 --- /dev/null +++ b/tools/gyp/test/subdirectory/gyptest-subdir-all.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies building a subsidiary dependent target from a .gyp file in a +subdirectory, without specifying an explicit output build directory, +and using the subdirectory's solution or project file as the entry point. +""" + +import TestGyp + +# Ninja doesn't support running from subdirectories. +test = TestGyp.TestGyp(formats=['!ninja']) + +test.run_gyp('prog1.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +chdir = 'relocate/src/subdir' +target = test.ALL + +test.build('prog2.gyp', target, chdir=chdir) + +test.built_file_must_not_exist('prog1', type=test.EXECUTABLE, chdir=chdir) + +test.run_built_executable('prog2', + chdir=chdir, + stdout="Hello from prog2.c\n") + +test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-subdir-default.py b/tools/gyp/test/subdirectory/gyptest-subdir-default.py new file mode 100755 index 000000000..92edcd217 --- /dev/null +++ b/tools/gyp/test/subdirectory/gyptest-subdir-default.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies building a subsidiary dependent target from a .gyp file in a +subdirectory, without specifying an explicit output build directory, +and using the subdirectory's solution or project file as the entry point. +""" + +import TestGyp +import errno + +# Ninja doesn't support running from subdirectories. +test = TestGyp.TestGyp(formats=['!ninja']) + +test.run_gyp('prog1.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +chdir = 'relocate/src/subdir' + +test.build('prog2.gyp', chdir=chdir) + +test.built_file_must_not_exist('prog1', type=test.EXECUTABLE, chdir=chdir) + +test.run_built_executable('prog2', + chdir=chdir, + stdout="Hello from prog2.c\n") + +test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-subdir2-deep.py b/tools/gyp/test/subdirectory/gyptest-subdir2-deep.py new file mode 100755 index 000000000..48548982f --- /dev/null +++ b/tools/gyp/test/subdirectory/gyptest-subdir2-deep.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies building a project rooted several layers under src_dir works. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('prog3.gyp', chdir='src/subdir/subdir2') + +test.relocate('src', 'relocate/src') + +test.build('prog3.gyp', test.ALL, chdir='relocate/src/subdir/subdir2') + +test.run_built_executable('prog3', + chdir='relocate/src/subdir/subdir2', + stdout="Hello from prog3.c\n") + +test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-top-all.py b/tools/gyp/test/subdirectory/gyptest-top-all.py new file mode 100755 index 000000000..a29a41b4d --- /dev/null +++ b/tools/gyp/test/subdirectory/gyptest-top-all.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies building a target and a subsidiary dependent target from a +.gyp file in a subdirectory, without specifying an explicit output build +directory, and using the generated solution or project file at the top +of the tree as the entry point. + +There is a difference here in the default behavior of the underlying +build tools. Specifically, when building the entire "solution", Xcode +puts the output of each project relative to the .xcodeproj directory, +while Visual Studio (and our implementations of SCons and Make) put it +in a build directory relative to the "solution"--that is, the entry-point +from which you built the entire tree. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('prog1.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('prog1.gyp', test.ALL, chdir='relocate/src') + +test.run_built_executable('prog1', + stdout="Hello from prog1.c\n", + chdir='relocate/src') + +if test.format == 'xcode': + chdir = 'relocate/src/subdir' +else: + chdir = 'relocate/src' +test.run_built_executable('prog2', + chdir=chdir, + stdout="Hello from prog2.c\n") + +test.pass_test() diff --git a/tools/gyp/test/subdirectory/gyptest-top-default.py b/tools/gyp/test/subdirectory/gyptest-top-default.py new file mode 100755 index 000000000..ac5f60dbc --- /dev/null +++ b/tools/gyp/test/subdirectory/gyptest-top-default.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies building a target and a subsidiary dependent target from a +.gyp file in a subdirectory, without specifying an explicit output build +directory, and using the generated solution or project file at the top +of the tree as the entry point. + +There is a difference here in the default behavior of the underlying +build tools. Specifically, when building the entire "solution", Xcode +puts the output of each project relative to the .xcodeproj directory, +while Visual Studio (and our implementations of SCons and Make) put it +in a build directory relative to the "solution"--that is, the entry-point +from which you built the entire tree. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('prog1.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('prog1.gyp', chdir='relocate/src') + +test.run_built_executable('prog1', + stdout="Hello from prog1.c\n", + chdir='relocate/src') + +if test.format == 'xcode': + chdir = 'relocate/src/subdir' +else: + chdir = 'relocate/src' +test.run_built_executable('prog2', + chdir=chdir, + stdout="Hello from prog2.c\n") + +test.pass_test() diff --git a/tools/gyp/test/subdirectory/src/prog1.c b/tools/gyp/test/subdirectory/src/prog1.c new file mode 100644 index 000000000..161ae8a38 --- /dev/null +++ b/tools/gyp/test/subdirectory/src/prog1.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + printf("Hello from prog1.c\n"); + return 0; +} diff --git a/tools/gyp/test/subdirectory/src/prog1.gyp b/tools/gyp/test/subdirectory/src/prog1.gyp new file mode 100644 index 000000000..2aa66ce7d --- /dev/null +++ b/tools/gyp/test/subdirectory/src/prog1.gyp @@ -0,0 +1,21 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + 'symroot.gypi', + ], + 'targets': [ + { + 'target_name': 'prog1', + 'type': 'executable', + 'dependencies': [ + 'subdir/prog2.gyp:prog2', + ], + 'sources': [ + 'prog1.c', + ], + }, + ], +} diff --git a/tools/gyp/test/subdirectory/src/subdir/prog2.c b/tools/gyp/test/subdirectory/src/subdir/prog2.c new file mode 100644 index 000000000..7635ae8c1 --- /dev/null +++ b/tools/gyp/test/subdirectory/src/subdir/prog2.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + printf("Hello from prog2.c\n"); + return 0; +} diff --git a/tools/gyp/test/subdirectory/src/subdir/prog2.gyp b/tools/gyp/test/subdirectory/src/subdir/prog2.gyp new file mode 100644 index 000000000..c6cd35f7f --- /dev/null +++ b/tools/gyp/test/subdirectory/src/subdir/prog2.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + '../symroot.gypi', + ], + 'targets': [ + { + 'target_name': 'prog2', + 'type': 'executable', + 'sources': [ + 'prog2.c', + ], + }, + ], +} diff --git a/tools/gyp/test/subdirectory/src/subdir/subdir2/prog3.c b/tools/gyp/test/subdirectory/src/subdir/subdir2/prog3.c new file mode 100644 index 000000000..7cfb0fa94 --- /dev/null +++ b/tools/gyp/test/subdirectory/src/subdir/subdir2/prog3.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + printf("Hello from prog3.c\n"); + return 0; +} diff --git a/tools/gyp/test/subdirectory/src/subdir/subdir2/prog3.gyp b/tools/gyp/test/subdirectory/src/subdir/subdir2/prog3.gyp new file mode 100644 index 000000000..b49fb5911 --- /dev/null +++ b/tools/gyp/test/subdirectory/src/subdir/subdir2/prog3.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'includes': [ + '../../symroot.gypi', + ], + 'targets': [ + { + 'target_name': 'prog3', + 'type': 'executable', + 'sources': [ + 'prog3.c', + ], + }, + ], +} diff --git a/tools/gyp/test/subdirectory/src/symroot.gypi b/tools/gyp/test/subdirectory/src/symroot.gypi new file mode 100644 index 000000000..519916427 --- /dev/null +++ b/tools/gyp/test/subdirectory/src/symroot.gypi @@ -0,0 +1,16 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables': { + 'set_symroot%': 0, + }, + 'conditions': [ + ['set_symroot == 1', { + 'xcode_settings': { + 'SYMROOT': '<(DEPTH)/build', + }, + }], + ], +} diff --git a/tools/gyp/test/toolsets/gyptest-toolsets.py b/tools/gyp/test/toolsets/gyptest-toolsets.py new file mode 100755 index 000000000..19737f83d --- /dev/null +++ b/tools/gyp/test/toolsets/gyptest-toolsets.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that toolsets are correctly applied +""" + +import TestGyp + +# Multiple toolsets are currently only supported by the make generator. +test = TestGyp.TestGyp(formats=['make']) + +test.run_gyp('toolsets.gyp') + +test.build('toolsets.gyp', test.ALL) + +test.run_built_executable('host-main', stdout="Host\n") +test.run_built_executable('target-main', stdout="Target\n") + +test.pass_test() diff --git a/tools/gyp/test/toolsets/main.cc b/tools/gyp/test/toolsets/main.cc new file mode 100644 index 000000000..0f353ae54 --- /dev/null +++ b/tools/gyp/test/toolsets/main.cc @@ -0,0 +1,11 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include + +const char *GetToolset(); + +int main(int argc, char *argv[]) { + printf("%s\n", GetToolset()); +} diff --git a/tools/gyp/test/toolsets/toolsets.cc b/tools/gyp/test/toolsets/toolsets.cc new file mode 100644 index 000000000..a45fa029c --- /dev/null +++ b/tools/gyp/test/toolsets/toolsets.cc @@ -0,0 +1,11 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +const char *GetToolset() { +#ifdef TARGET + return "Target"; +#else + return "Host"; +#endif +} diff --git a/tools/gyp/test/toolsets/toolsets.gyp b/tools/gyp/test/toolsets/toolsets.gyp new file mode 100644 index 000000000..6afa7ecec --- /dev/null +++ b/tools/gyp/test/toolsets/toolsets.gyp @@ -0,0 +1,49 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'target_conditions': [ + ['_toolset=="target"', {'defines': ['TARGET']}] + ] + }, + 'targets': [ + { + 'target_name': 'toolsets', + 'type': 'static_library', + 'toolsets': ['target', 'host'], + 'sources': [ + 'toolsets.cc', + ], + }, + { + 'target_name': 'host-main', + 'type': 'executable', + 'toolsets': ['host'], + 'dependencies': ['toolsets'], + 'sources': [ + 'main.cc', + ], + }, + { + 'target_name': 'target-main', + 'type': 'executable', + 'dependencies': ['toolsets'], + 'sources': [ + 'main.cc', + ], + }, + # This tests that build systems can handle a shared library being build for + # both host and target. + { + 'target_name': 'janus', + 'type': 'shared_library', + 'toolsets': ['target', 'host'], + 'sources': [ + 'toolsets.cc', + ], + 'cflags': [ '-fPIC' ], + }, + ], +} diff --git a/tools/gyp/test/toplevel-dir/gyptest-toplevel-dir.py b/tools/gyp/test/toplevel-dir/gyptest-toplevel-dir.py new file mode 100755 index 000000000..4daa6b2c1 --- /dev/null +++ b/tools/gyp/test/toplevel-dir/gyptest-toplevel-dir.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies building a subsidiary dependent target from a .gyp file in a +subdirectory, without specifying an explicit output build directory, +and using the subdirectory's solution or project file as the entry point. +""" + +import TestGyp +import errno + +test = TestGyp.TestGyp(formats=['ninja', 'make']) + +# We want our Makefile to be one dir up from main.gyp. +test.run_gyp('main.gyp', '--toplevel-dir=..', chdir='src/sub1') + +toplevel_dir = 'src' + +test.build('all', chdir=toplevel_dir) + +test.built_file_must_exist('prog1', type=test.EXECUTABLE, chdir=toplevel_dir) + +test.run_built_executable('prog1', + chdir=toplevel_dir, + stdout="Hello from prog1.c\n") + +test.pass_test() diff --git a/tools/gyp/test/toplevel-dir/src/sub1/main.gyp b/tools/gyp/test/toplevel-dir/src/sub1/main.gyp new file mode 100644 index 000000000..33219010e --- /dev/null +++ b/tools/gyp/test/toplevel-dir/src/sub1/main.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'prog1', + 'type': 'executable', + 'dependencies': [ + '<(DEPTH)/../sub2/prog2.gyp:prog2', + ], + 'sources': [ + 'prog1.c', + ], + }, + ], +} diff --git a/tools/gyp/test/toplevel-dir/src/sub1/prog1.c b/tools/gyp/test/toplevel-dir/src/sub1/prog1.c new file mode 100644 index 000000000..161ae8a38 --- /dev/null +++ b/tools/gyp/test/toplevel-dir/src/sub1/prog1.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + printf("Hello from prog1.c\n"); + return 0; +} diff --git a/tools/gyp/test/toplevel-dir/src/sub2/prog2.c b/tools/gyp/test/toplevel-dir/src/sub2/prog2.c new file mode 100644 index 000000000..7635ae8c1 --- /dev/null +++ b/tools/gyp/test/toplevel-dir/src/sub2/prog2.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + printf("Hello from prog2.c\n"); + return 0; +} diff --git a/tools/gyp/test/toplevel-dir/src/sub2/prog2.gyp b/tools/gyp/test/toplevel-dir/src/sub2/prog2.gyp new file mode 100644 index 000000000..593454836 --- /dev/null +++ b/tools/gyp/test/toplevel-dir/src/sub2/prog2.gyp @@ -0,0 +1,15 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'prog2', + 'type': 'executable', + 'sources': [ + 'prog2.c', + ], + }, + ], +} diff --git a/tools/gyp/test/variables/commands/commands-repeated.gyp b/tools/gyp/test/variables/commands/commands-repeated.gyp new file mode 100644 index 000000000..822ae4f05 --- /dev/null +++ b/tools/gyp/test/variables/commands/commands-repeated.gyp @@ -0,0 +1,128 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This is a simple test file to make sure that variable substitution +# happens correctly. Run "run_tests.py" using python to generate the +# output from this gyp file. + +{ + 'variables': { + 'pi': 'import math; print math.pi', + 'third_letters': "<(other_letters)HIJK", + 'letters_list': 'ABCD', + 'other_letters': '<(letters_list)EFG', + 'check_included': '<(included_variable)', + 'check_lists': [ + '<(included_variable)', + '<(third_letters)', + ], + 'check_int': 5, + 'check_str_int': '6', + 'check_list_int': [ + 7, + '8', + 9, + ], + 'not_int_1': ' 10', + 'not_int_2': '11 ', + 'not_int_3': '012', + 'not_int_4': '13.0', + 'not_int_5': '+14', + 'negative_int': '-15', + 'zero_int': '0', + }, + 'includes': [ + 'commands.gypi', + ], + 'targets': [ + { + 'target_name': 'foo', + 'type': 'none', + 'variables': { + 'var1': ' commands.gyp.stdout +python ../../../gyp --ignore-environment --debug variables --debug general --format gypd --depth . commands.gyp > commands.gyp.ignore-env.stdout +cp -f commands.gypd commands.gypd.golden +python ../../../gyp --debug variables --debug general --format gypd --depth . commands-repeated.gyp > commands-repeated.gyp.stdout +cp -f commands-repeated.gypd commands-repeated.gypd.golden diff --git a/tools/gyp/test/variables/filelist/filelist.gyp.stdout b/tools/gyp/test/variables/filelist/filelist.gyp.stdout new file mode 100644 index 000000000..9c6a9173e --- /dev/null +++ b/tools/gyp/test/variables/filelist/filelist.gyp.stdout @@ -0,0 +1,42 @@ +GENERAL:__init__.py:357:main running with these options: +GENERAL:__init__.py:364:main check: None +GENERAL:__init__.py:364:main circular_check: True +GENERAL:__init__.py:364:main debug: ['variables', 'general'] +GENERAL:__init__.py:364:main defines: None +GENERAL:__init__.py:362:main depth: '.' +GENERAL:__init__.py:364:main formats: ['gypd'] +GENERAL:__init__.py:364:main generator_flags: [] +GENERAL:__init__.py:364:main generator_output: None +GENERAL:__init__.py:364:main includes: None +GENERAL:__init__.py:364:main msvs_version: None +GENERAL:__init__.py:362:main suffix: '' +GENERAL:__init__.py:364:main toplevel_dir: None +GENERAL:__init__.py:364:main use_environment: True +GENERAL:__init__.py:418:main cmdline_default_variables: {} +GENERAL:__init__.py:444:main generator_flags: {} +VARIABLES:input.py:562:ExpandVariables Matches: {'content': 'names.txt <@(names', 'is_array': '', 'replace': '<|(names.txt <@(names)', 'type': '<|', 'command_string': None} +VARIABLES:input.py:562:ExpandVariables Matches: {'content': 'names', 'is_array': '', 'replace': '<@(names)', 'type': '<@', 'command_string': None} +VARIABLES:input.py:797:ExpandVariables Found output 'names.txt John Jacob Jingleheimer Schmidt', recursing. +VARIABLES:input.py:797:ExpandVariables Found output 'names.txt', recursing. +VARIABLES:input.py:562:ExpandVariables Matches: {'content': 'names_listfile', 'is_array': '', 'replace': '<(names_listfile)', 'type': '<', 'command_string': None} +VARIABLES:input.py:797:ExpandVariables Found output 'names.txt', recursing. +VARIABLES:input.py:562:ExpandVariables Matches: {'content': 'names_listfile', 'is_array': '', 'replace': '<(names_listfile)', 'type': '<', 'command_string': None} +VARIABLES:input.py:797:ExpandVariables Found output 'names.txt', recursing. +VARIABLES:input.py:562:ExpandVariables Matches: {'content': 'cat <(names_listfile', 'is_array': '', 'replace': ' filelist.gyp.stdout +cp -f src/filelist.gypd filelist.gypd.golden diff --git a/tools/gyp/test/variables/latelate/gyptest-latelate.py b/tools/gyp/test/variables/latelate/gyptest-latelate.py new file mode 100755 index 000000000..2d77dfec5 --- /dev/null +++ b/tools/gyp/test/variables/latelate/gyptest-latelate.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that ^(latelate) style variables work. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('latelate.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('latelate.gyp', test.ALL, chdir='relocate/src') + +test.run_built_executable( + 'program', chdir='relocate/src', stdout='program.cc\n') + + +test.pass_test() diff --git a/tools/gyp/test/variables/latelate/src/latelate.gyp b/tools/gyp/test/variables/latelate/src/latelate.gyp new file mode 100644 index 000000000..312f3765b --- /dev/null +++ b/tools/gyp/test/variables/latelate/src/latelate.gyp @@ -0,0 +1,34 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'target_conditions': [ + ['has_lame==1', { + 'sources/': [ + ['exclude', 'lame'], + ], + }], + ], + }, + 'targets': [ + { + 'target_name': 'program', + 'type': 'executable', + 'variables': { + 'has_lame': 1, + }, + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)', + ], + 'defines': [ + 'FOO="^(_sources)"', + ], + 'sources': [ + 'program.cc', + 'this_is_lame.cc', + ], + }, + ], +} diff --git a/tools/gyp/test/variables/latelate/src/program.cc b/tools/gyp/test/variables/latelate/src/program.cc new file mode 100644 index 000000000..4c6d6e048 --- /dev/null +++ b/tools/gyp/test/variables/latelate/src/program.cc @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2012 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include + + +int main(int argc, char *argv[]) { + printf(FOO "\n"); + return 0; +} diff --git a/tools/gyp/test/variants/gyptest-variants.py b/tools/gyp/test/variants/gyptest-variants.py new file mode 100755 index 000000000..ce2455f66 --- /dev/null +++ b/tools/gyp/test/variants/gyptest-variants.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify handling of build variants. + +TODO: Right now, only the SCons generator supports this, so the +test case is SCons-specific. In particular, it relise on SCons' +ability to rebuild in response to changes on the command line. It +may be simpler to just drop this feature if the other generators +can't be made to behave the same way. +""" + +import TestGyp + +test = TestGyp.TestGyp(formats=['scons']) + +test.run_gyp('variants.gyp', chdir='src') + +test.relocate('src', 'relocate/src') + +test.build('variants.gyp', chdir='relocate/src') + +test.run_built_executable('variants', + chdir='relocate/src', + stdout="Hello, world!\n") + +test.sleep() +test.build('variants.gyp', 'VARIANT1=1', chdir='relocate/src') + +test.run_built_executable('variants', + chdir='relocate/src', + stdout="Hello from VARIANT1\n") + +test.sleep() +test.build('variants.gyp', 'VARIANT2=1', chdir='relocate/src') + +test.run_built_executable('variants', + chdir='relocate/src', + stdout="Hello from VARIANT2\n") + +test.pass_test() diff --git a/tools/gyp/test/variants/src/variants.c b/tools/gyp/test/variants/src/variants.c new file mode 100644 index 000000000..3018e40df --- /dev/null +++ b/tools/gyp/test/variants/src/variants.c @@ -0,0 +1,13 @@ +#include + +int main(int argc, char *argv[]) +{ +#if defined(VARIANT1) + printf("Hello from VARIANT1\n"); +#elif defined(VARIANT2) + printf("Hello from VARIANT2\n"); +#else + printf("Hello, world!\n"); +#endif + return 0; +} diff --git a/tools/gyp/test/variants/src/variants.gyp b/tools/gyp/test/variants/src/variants.gyp new file mode 100644 index 000000000..0305ca747 --- /dev/null +++ b/tools/gyp/test/variants/src/variants.gyp @@ -0,0 +1,27 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'variants', + 'type': 'executable', + 'sources': [ + 'variants.c', + ], + 'variants': { + 'variant1' : { + 'defines': [ + 'VARIANT1', + ], + }, + 'variant2' : { + 'defines': [ + 'VARIANT2', + ], + }, + }, + }, + ], +} diff --git a/tools/gyp/test/win/asm-files/asm-files.gyp b/tools/gyp/test/win/asm-files/asm-files.gyp new file mode 100644 index 000000000..b1f132cee --- /dev/null +++ b/tools/gyp/test/win/asm-files/asm-files.gyp @@ -0,0 +1,17 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'sources_with_asm', + 'type': 'executable', + 'sources': [ + 'hello.cc', + 'b.s', + 'c.S', + ], + }, + ] +} diff --git a/tools/gyp/test/win/asm-files/b.s b/tools/gyp/test/win/asm-files/b.s new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/win/asm-files/c.S b/tools/gyp/test/win/asm-files/c.S new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/win/asm-files/hello.cc b/tools/gyp/test/win/asm-files/hello.cc new file mode 100644 index 000000000..1711567ef --- /dev/null +++ b/tools/gyp/test/win/asm-files/hello.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/batch-file-action/batch-file-action.gyp b/tools/gyp/test/win/batch-file-action/batch-file-action.gyp new file mode 100644 index 000000000..e4db9af9d --- /dev/null +++ b/tools/gyp/test/win/batch-file-action/batch-file-action.gyp @@ -0,0 +1,21 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_batch', + 'type': 'none', + 'actions': [ + { + 'action_name': 'copy_to_output', + 'inputs': ['infile'], + 'outputs': ['outfile'], + 'action': ['somecmd.bat', 'infile', 'outfile'], + 'msvs_cygwin_shell': 0, + } + ], + }, + ] +} diff --git a/tools/gyp/test/win/batch-file-action/infile b/tools/gyp/test/win/batch-file-action/infile new file mode 100644 index 000000000..3f9177e45 --- /dev/null +++ b/tools/gyp/test/win/batch-file-action/infile @@ -0,0 +1 @@ +input diff --git a/tools/gyp/test/win/batch-file-action/somecmd.bat b/tools/gyp/test/win/batch-file-action/somecmd.bat new file mode 100644 index 000000000..d48775374 --- /dev/null +++ b/tools/gyp/test/win/batch-file-action/somecmd.bat @@ -0,0 +1,5 @@ +@echo off +:: The redirs to nul are important. %2 can end up being an unterminated "'d +:: string, so the remainder of the command line becomes the target file name, +:: which in turn fails because it's a filename containing >, nul, etc. +copy /y %1 %2 >nul 2>nul diff --git a/tools/gyp/test/win/command-quote/a.S b/tools/gyp/test/win/command-quote/a.S new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/win/command-quote/bat with spaces.bat b/tools/gyp/test/win/command-quote/bat with spaces.bat new file mode 100644 index 000000000..dc3508f9a --- /dev/null +++ b/tools/gyp/test/win/command-quote/bat with spaces.bat @@ -0,0 +1,7 @@ +@echo off + +:: Copyright (c) 2012 Google Inc. All rights reserved. +:: Use of this source code is governed by a BSD-style license that can be +:: found in the LICENSE file. + +copy %1 %2 diff --git a/tools/gyp/test/win/command-quote/command-quote.gyp b/tools/gyp/test/win/command-quote/command-quote.gyp new file mode 100644 index 000000000..2e596dc61 --- /dev/null +++ b/tools/gyp/test/win/command-quote/command-quote.gyp @@ -0,0 +1,50 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_batch', + 'type': 'none', + 'rules': [ + { + 'rule_name': 'build_with_batch', + 'msvs_cygwin_shell': 0, + 'extension': 'S', + 'inputs': ['<(RULE_INPUT_PATH)'], + 'outputs': ['output.obj'], + 'action': ['call go.bat', '<(RULE_INPUT_PATH)', 'output.obj'], + },], + 'sources': ['a.S'], + }, + { + 'target_name': 'test_call_separate', + 'type': 'none', + 'rules': [ + { + 'rule_name': 'build_with_batch2', + 'msvs_cygwin_shell': 0, + 'extension': 'S', + 'inputs': ['<(RULE_INPUT_PATH)'], + 'outputs': ['output2.obj'], + 'action': ['call', 'go.bat', '<(RULE_INPUT_PATH)', 'output2.obj'], + },], + 'sources': ['a.S'], + }, + { + 'target_name': 'test_with_spaces', + 'type': 'none', + 'rules': [ + { + 'rule_name': 'build_with_batch3', + 'msvs_cygwin_shell': 0, + 'extension': 'S', + 'inputs': ['<(RULE_INPUT_PATH)'], + 'outputs': ['output3.obj'], + 'action': ['bat with spaces.bat', '<(RULE_INPUT_PATH)', 'output3.obj'], + },], + 'sources': ['a.S'], + }, + ] +} diff --git a/tools/gyp/test/win/command-quote/go.bat b/tools/gyp/test/win/command-quote/go.bat new file mode 100644 index 000000000..dc3508f9a --- /dev/null +++ b/tools/gyp/test/win/command-quote/go.bat @@ -0,0 +1,7 @@ +@echo off + +:: Copyright (c) 2012 Google Inc. All rights reserved. +:: Use of this source code is governed by a BSD-style license that can be +:: found in the LICENSE file. + +copy %1 %2 diff --git a/tools/gyp/test/win/command-quote/subdir/and/another/in-subdir.gyp b/tools/gyp/test/win/command-quote/subdir/and/another/in-subdir.gyp new file mode 100644 index 000000000..be363bbc8 --- /dev/null +++ b/tools/gyp/test/win/command-quote/subdir/and/another/in-subdir.gyp @@ -0,0 +1,28 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_batch_depth', + 'type': 'none', + 'variables': { + # Taken from native_client/build/common.gypi. Seems unintentional (a + # string in a 1 element list)? But since it works on other generators, + # I guess it should work here too. + 'filepath': [ 'call <(DEPTH)/../../../go.bat' ], + }, + 'rules': [ + { + 'rule_name': 'build_with_batch4', + 'msvs_cygwin_shell': 0, + 'extension': 'S', + 'inputs': ['<(RULE_INPUT_PATH)'], + 'outputs': ['output4.obj'], + 'action': ['<@(filepath)', '<(RULE_INPUT_PATH)', 'output4.obj'], + },], + 'sources': ['<(DEPTH)\\..\\..\\..\\a.S'], + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/additional-include-dirs.cc b/tools/gyp/test/win/compiler-flags/additional-include-dirs.cc new file mode 100644 index 000000000..f1e11dd12 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/additional-include-dirs.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// No path qualification to test compiler include dir specification. +#include "header.h" + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/additional-include-dirs.gyp b/tools/gyp/test/win/compiler-flags/additional-include-dirs.gyp new file mode 100644 index 000000000..42c7e849f --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/additional-include-dirs.gyp @@ -0,0 +1,20 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_incs', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'AdditionalIncludeDirectories': [ + 'subdir', + ], + } + }, + 'sources': ['additional-include-dirs.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/additional-options.cc b/tools/gyp/test/win/compiler-flags/additional-options.cc new file mode 100644 index 000000000..c79572baf --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/additional-options.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + // Generate a warning that will appear at level 4, but not level 1 + // (truncation and unused local). + char c = 123456; + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/additional-options.gyp b/tools/gyp/test/win/compiler-flags/additional-options.gyp new file mode 100644 index 000000000..6a365a206 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/additional-options.gyp @@ -0,0 +1,31 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_additional_none', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '4', + 'WarnAsError': 'true', + } + }, + 'sources': ['additional-options.cc'], + }, + { + 'target_name': 'test_additional_one', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '4', + 'WarnAsError': 'true', + 'AdditionalOptions': [ '/W1' ], + } + }, + 'sources': ['additional-options.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/buffer-security-check.gyp b/tools/gyp/test/win/compiler-flags/buffer-security-check.gyp new file mode 100644 index 000000000..cc5a12b95 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/buffer-security-check.gyp @@ -0,0 +1,51 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + # Turn debug information on so that we can see the name of the buffer + # security check cookie in the disassembly. + { + 'target_name': 'test_bsc_unset', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + 'sources': ['buffer-security.cc'], + }, + { + 'target_name': 'test_bsc_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'BufferSecurityCheck': 'false', + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + 'sources': ['buffer-security.cc'], + }, + { + 'target_name': 'test_bsc_on', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'BufferSecurityCheck': 'true', + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + 'sources': ['buffer-security.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/buffer-security.cc b/tools/gyp/test/win/compiler-flags/buffer-security.cc new file mode 100644 index 000000000..e8a48a2a6 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/buffer-security.cc @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include +#include + +int main() { + char* stuff = reinterpret_cast(_alloca(256)); + strcpy(stuff, "blah"); + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/character-set-mbcs.cc b/tools/gyp/test/win/compiler-flags/character-set-mbcs.cc new file mode 100644 index 000000000..328630473 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/character-set-mbcs.cc @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef _MBCS +#error +#endif + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/character-set-unicode.cc b/tools/gyp/test/win/compiler-flags/character-set-unicode.cc new file mode 100644 index 000000000..32e69724a --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/character-set-unicode.cc @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef _UNICODE +#error +#endif + +#ifndef UNICODE +#error +#endif + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/character-set.gyp b/tools/gyp/test/win/compiler-flags/character-set.gyp new file mode 100644 index 000000000..3dc45557d --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/character-set.gyp @@ -0,0 +1,35 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_cs_notset', + 'product_name': 'test_cs_notset', + 'type': 'executable', + 'msvs_configuration_attributes': { + 'CharacterSet': '0' + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_cs_unicode', + 'product_name': 'test_cs_unicode', + 'type': 'executable', + 'msvs_configuration_attributes': { + 'CharacterSet': '1' + }, + 'sources': ['character-set-unicode.cc'], + }, + { + 'target_name': 'test_cs_mbcs', + 'product_name': 'test_cs_mbcs', + 'type': 'executable', + 'msvs_configuration_attributes': { + 'CharacterSet': '2' + }, + 'sources': ['character-set-mbcs.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/debug-format.gyp b/tools/gyp/test/win/compiler-flags/debug-format.gyp new file mode 100644 index 000000000..daaed23ff --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/debug-format.gyp @@ -0,0 +1,48 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test-debug-format-off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '0' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test-debug-format-oldstyle', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '1' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test-debug-format-pdb', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '3' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test-debug-format-editcontinue', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '4' + } + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/exception-handling-on.cc b/tools/gyp/test/win/compiler-flags/exception-handling-on.cc new file mode 100644 index 000000000..5d9a3af77 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/exception-handling-on.cc @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include +#include + +void fail() { + try { + int i = 0, j = 1; + j /= i; + } catch(...) { + exit(1); + } +} + +int main() { + __try { + fail(); + } __except(EXCEPTION_EXECUTE_HANDLER) { + return 2; + } + return 3; +} diff --git a/tools/gyp/test/win/compiler-flags/exception-handling.gyp b/tools/gyp/test/win/compiler-flags/exception-handling.gyp new file mode 100644 index 000000000..c266768dd --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/exception-handling.gyp @@ -0,0 +1,46 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + # Optimization disabled so that the exception-causing code is not removed + # (divide by zero was getting optimized away in VS2010). + { + 'target_name': 'test_eh_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'ExceptionHandling': '0', + 'WarnAsError': 'true', + 'Optimization': '0', + } + }, + 'sources': ['exception-handling-on.cc'], + }, + { + 'target_name': 'test_eh_s', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'ExceptionHandling': '1', + 'WarnAsError': 'true', + 'Optimization': '0', + } + }, + 'sources': ['exception-handling-on.cc'], + }, + { + 'target_name': 'test_eh_a', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'ExceptionHandling': '2', + 'WarnAsError': 'true', + 'Optimization': '0', + } + }, + 'sources': ['exception-handling-on.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/function-level-linking.cc b/tools/gyp/test/win/compiler-flags/function-level-linking.cc new file mode 100644 index 000000000..495227281 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/function-level-linking.cc @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int comdat_function() { + return 1; +} + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/function-level-linking.gyp b/tools/gyp/test/win/compiler-flags/function-level-linking.gyp new file mode 100644 index 000000000..5858586a2 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/function-level-linking.gyp @@ -0,0 +1,28 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_fll_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableFunctionLevelLinking': 'false' + } + }, + 'sources': ['function-level-linking.cc'], + }, + { + 'target_name': 'test_fll_on', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableFunctionLevelLinking': 'true', + } + }, + 'sources': ['function-level-linking.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/hello.cc b/tools/gyp/test/win/compiler-flags/hello.cc new file mode 100644 index 000000000..1711567ef --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/hello.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/optimizations.gyp b/tools/gyp/test/win/compiler-flags/optimizations.gyp new file mode 100644 index 000000000..fd4b07005 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/optimizations.gyp @@ -0,0 +1,147 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_opt_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '0' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_lev_size', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '1' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_lev_speed', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '2' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_lev_max', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '3' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_unset', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_fpo', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'OmitFramePointers': 'true' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_fpo_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'OmitFramePointers': 'false' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_inline_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'InlineFunctionExpansion': '0' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_inline_manual', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'InlineFunctionExpansion': '1' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_inline_auto', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'InlineFunctionExpansion': '2' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_neither', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'FavorSizeOrSpeed': '0' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_speed', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'FavorSizeOrSpeed': '1' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_size', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'FavorSizeOrSpeed': '2' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_opt_wpo', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WholeProgramOptimization': 'true' + } + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/pdbname.cc b/tools/gyp/test/win/compiler-flags/pdbname.cc new file mode 100644 index 000000000..0fe05d5af --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/pdbname.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int some_function() { + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/pdbname.gyp b/tools/gyp/test/win/compiler-flags/pdbname.gyp new file mode 100644 index 000000000..8fcf75472 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/pdbname.gyp @@ -0,0 +1,24 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_pdbname', + 'type': 'executable', + 'sources': [ + 'hello.cc', + 'pdbname.cc', + ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/rtti-on.cc b/tools/gyp/test/win/compiler-flags/rtti-on.cc new file mode 100644 index 000000000..2d3ad03ae --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/rtti-on.cc @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef _CPPRTTI +#error +#endif + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/rtti.gyp b/tools/gyp/test/win/compiler-flags/rtti.gyp new file mode 100644 index 000000000..704cd58f5 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/rtti.gyp @@ -0,0 +1,37 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_rtti_off', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeTypeInfo': 'false', + 'WarnAsError': 'true' + } + }, + 'sources': ['rtti-on.cc'], + }, + { + 'target_name': 'test_rtti_on', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeTypeInfo': 'true', + 'WarnAsError': 'true' + } + }, + 'sources': ['rtti-on.cc'], + }, + { + 'target_name': 'test_rtti_unset', + 'type': 'executable', + 'msvs_settings': { + }, + 'sources': ['rtti-on.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/runtime-checks.cc b/tools/gyp/test/win/compiler-flags/runtime-checks.cc new file mode 100644 index 000000000..fdb811da8 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/runtime-checks.cc @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef __MSVC_RUNTIME_CHECKS +#error +#endif + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/runtime-checks.gyp b/tools/gyp/test/win/compiler-flags/runtime-checks.gyp new file mode 100644 index 000000000..8ea309205 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/runtime-checks.gyp @@ -0,0 +1,29 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_brc_none', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '0', + } + }, + 'sources': ['runtime-checks.cc'], + }, + { + 'target_name': 'test_brc_1', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'Optimization': '0', + 'BasicRuntimeChecks': '3' + } + }, + 'sources': ['runtime-checks.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/runtime-library-md.cc b/tools/gyp/test/win/compiler-flags/runtime-library-md.cc new file mode 100644 index 000000000..87c83021d --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/runtime-library-md.cc @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef _MT +#error +#endif + +#ifdef _DEBUG +#error +#endif + +#ifndef _DLL +#error +#endif + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/runtime-library-mdd.cc b/tools/gyp/test/win/compiler-flags/runtime-library-mdd.cc new file mode 100644 index 000000000..9f175e493 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/runtime-library-mdd.cc @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef _MT +#error +#endif + +#ifndef _DEBUG +#error +#endif + +#ifndef _DLL +#error +#endif + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/runtime-library-mt.cc b/tools/gyp/test/win/compiler-flags/runtime-library-mt.cc new file mode 100644 index 000000000..27e62b63d --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/runtime-library-mt.cc @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef _MT +#error +#endif + +#ifdef _DEBUG +#error +#endif + +#ifdef _DLL +#error +#endif + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/runtime-library-mtd.cc b/tools/gyp/test/win/compiler-flags/runtime-library-mtd.cc new file mode 100644 index 000000000..a9921db9e --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/runtime-library-mtd.cc @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef _MT +#error +#endif + +#ifndef _DEBUG +#error +#endif + +#ifdef _DLL +#error +#endif + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/runtime-library.gyp b/tools/gyp/test/win/compiler-flags/runtime-library.gyp new file mode 100644 index 000000000..04afc391c --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/runtime-library.gyp @@ -0,0 +1,48 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_rl_md', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': '2' + } + }, + 'sources': ['runtime-library-md.cc'], + }, + { + 'target_name': 'test_rl_mdd', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': '3' + } + }, + 'sources': ['runtime-library-mdd.cc'], + }, + { + 'target_name': 'test_rl_mt', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': '0' + } + }, + 'sources': ['runtime-library-mt.cc'], + }, + { + 'target_name': 'test_rl_mtd', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'RuntimeLibrary': '1' + } + }, + 'sources': ['runtime-library-mtd.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/subdir/header.h b/tools/gyp/test/win/compiler-flags/subdir/header.h new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/win/compiler-flags/warning-as-error.cc b/tools/gyp/test/win/compiler-flags/warning-as-error.cc new file mode 100644 index 000000000..fd2130aca --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/warning-as-error.cc @@ -0,0 +1,9 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + // Cause a warning, even at /W1 + int export; + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/warning-as-error.gyp b/tools/gyp/test/win/compiler-flags/warning-as-error.gyp new file mode 100644 index 000000000..d71f26114 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/warning-as-error.gyp @@ -0,0 +1,37 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_warn_as_error_false', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarnAsError': 'false' + } + }, + 'sources': ['warning-as-error.cc'] + }, + { + 'target_name': 'test_warn_as_error_true', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarnAsError': 'true' + } + }, + 'sources': ['warning-as-error.cc'] + }, + { + 'target_name': 'test_warn_as_error_unset', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + } + }, + 'sources': ['warning-as-error.cc'] + }, + ] +} diff --git a/tools/gyp/test/win/compiler-flags/warning-level.gyp b/tools/gyp/test/win/compiler-flags/warning-level.gyp new file mode 100644 index 000000000..2297aa7ca --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/warning-level.gyp @@ -0,0 +1,115 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + # Level 1 + { + 'target_name': 'test_wl1_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '1', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level1.cc'], + }, + { + 'target_name': 'test_wl1_pass', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '1', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level2.cc'], + }, + + # Level 2 + { + 'target_name': 'test_wl2_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '2', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level2.cc'], + }, + { + 'target_name': 'test_wl2_pass', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '2', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level3.cc'], + }, + + # Level 3 + { + 'target_name': 'test_wl3_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '3', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level3.cc'], + }, + { + 'target_name': 'test_wl3_pass', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '3', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level4.cc'], + }, + + + # Level 4 + { + 'target_name': 'test_wl4_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '4', + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level4.cc'], + }, + + # Default level + { + 'target_name': 'test_def_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarnAsError': 'true', + } + }, + 'sources': ['warning-level1.cc'], + }, + { + 'target_name': 'test_def_pass', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + } + }, + 'sources': ['warning-level2.cc'], + }, + + ] +} diff --git a/tools/gyp/test/win/compiler-flags/warning-level1.cc b/tools/gyp/test/win/compiler-flags/warning-level1.cc new file mode 100644 index 000000000..119578d69 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/warning-level1.cc @@ -0,0 +1,8 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + int export; // Cause a level 1 warning (C4237). + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/warning-level2.cc b/tools/gyp/test/win/compiler-flags/warning-level2.cc new file mode 100644 index 000000000..9a2670318 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/warning-level2.cc @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int f(int x) { + return 0; +} + +int main() { + double x = 10.1; + // Cause a level 2 warning (C4243). + return f(x); + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/warning-level3.cc b/tools/gyp/test/win/compiler-flags/warning-level3.cc new file mode 100644 index 000000000..e0a9f3cdd --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/warning-level3.cc @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Cause a level 3 warning (C4359). +struct __declspec(align(8)) C8 { __int64 i; }; +struct __declspec(align(4)) C4 { C8 m8; }; + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/compiler-flags/warning-level4.cc b/tools/gyp/test/win/compiler-flags/warning-level4.cc new file mode 100644 index 000000000..48a4fb701 --- /dev/null +++ b/tools/gyp/test/win/compiler-flags/warning-level4.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + const int i = -1; + // Cause a level 4 warning (C4245). + unsigned int j = i; + return 0; +} diff --git a/tools/gyp/test/win/gyptest-asm-files.py b/tools/gyp/test/win/gyptest-asm-files.py new file mode 100644 index 000000000..007b52eb2 --- /dev/null +++ b/tools/gyp/test/win/gyptest-asm-files.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure .s files aren't passed to cl. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'asm-files' + test.run_gyp('asm-files.gyp', chdir=CHDIR) + # The compiler will error out if it's passed the .s files, so just make sure + # the build succeeds. The compiler doesn't directly support building + # assembler files on Windows, they have to be built explicitly with a + # third-party tool. + test.build('asm-files.gyp', test.ALL, chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-additional-include-dirs.py b/tools/gyp/test/win/gyptest-cl-additional-include-dirs.py new file mode 100644 index 000000000..1fabfa975 --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-additional-include-dirs.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure additional include dirs are extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('additional-include-dirs.gyp', chdir=CHDIR) + test.build('additional-include-dirs.gyp', test.ALL, chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-additional-options.py b/tools/gyp/test/win/gyptest-cl-additional-options.py new file mode 100644 index 000000000..e9aea10dc --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-additional-options.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure additional manual compiler flags are extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('additional-options.gyp', chdir=CHDIR) + + # Warning level not overidden, must fail. + test.build('additional-options.gyp', 'test_additional_none', chdir=CHDIR, + status=1) + + # Warning level is overridden, must succeed. + test.build('additional-options.gyp', 'test_additional_one', chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-buffer-security-check.py b/tools/gyp/test/win/gyptest-cl-buffer-security-check.py new file mode 100644 index 000000000..e22869c3d --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-buffer-security-check.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure buffer security check setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('buffer-security-check.gyp', chdir=CHDIR) + test.build('buffer-security-check.gyp', chdir=CHDIR) + + def GetDisassemblyOfMain(exe): + # The standard library uses buffer security checks independent of our + # buffer security settings, so we extract just our code (i.e. main()) to + # check against. + full_path = test.built_file_path(exe, chdir=CHDIR) + output = test.run_dumpbin('/disasm', full_path) + result = [] + in_main = False + for line in output.splitlines(): + if line == '_main:': + in_main = True + elif in_main: + # Disassembly of next function starts. + if line.startswith('_'): + break + result.append(line) + return '\n'.join(result) + + # Buffer security checks are on by default, make sure security_cookie + # appears in the disassembly of our code. + if 'security_cookie' not in GetDisassemblyOfMain('test_bsc_unset.exe'): + test.fail_test() + + # Explicitly on. + if 'security_cookie' not in GetDisassemblyOfMain('test_bsc_on.exe'): + test.fail_test() + + # Explicitly off, shouldn't be a reference to the security cookie. + if 'security_cookie' in GetDisassemblyOfMain('test_bsc_off.exe'): + test.fail_test() + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-character-set.py b/tools/gyp/test/win/gyptest-cl-character-set.py new file mode 100644 index 000000000..7fabb6722 --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-character-set.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure character set setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('character-set.gyp', chdir=CHDIR) + test.build('character-set.gyp', test.ALL, chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-debug-format.py b/tools/gyp/test/win/gyptest-cl-debug-format.py new file mode 100644 index 000000000..6c68a619b --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-debug-format.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure debug format settings are extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('debug-format.gyp', chdir=CHDIR) + + # While there's ways to via .pdb contents, the .pdb doesn't include + # which style the debug information was created from, so we resort to just + # verifying the flags are correct on the command line. + + ninja_file = test.built_file_path('obj/test-debug-format-off.ninja', + chdir=CHDIR) + test.must_not_contain(ninja_file, '/Z7') + test.must_not_contain(ninja_file, '/Zi') + test.must_not_contain(ninja_file, '/ZI') + + ninja_file = test.built_file_path('obj/test-debug-format-oldstyle.ninja', + chdir=CHDIR) + test.must_contain(ninja_file, '/Z7') + + ninja_file = test.built_file_path('obj/test-debug-format-pdb.ninja', + chdir=CHDIR) + test.must_contain(ninja_file, '/Zi') + + ninja_file = test.built_file_path('obj/test-debug-format-editcontinue.ninja', + chdir=CHDIR) + test.must_contain(ninja_file, '/ZI') + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-exception-handling.py b/tools/gyp/test/win/gyptest-cl-exception-handling.py new file mode 100644 index 000000000..5738a5407 --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-exception-handling.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure exception handling settings are extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('exception-handling.gyp', chdir=CHDIR) + + # Must fail. + test.build('exception-handling.gyp', 'test_eh_off', chdir=CHDIR, + status=1) + + # Must succeed. + test.build('exception-handling.gyp', 'test_eh_s', chdir=CHDIR) + test.build('exception-handling.gyp', 'test_eh_a', chdir=CHDIR) + + # Error code must be 1 if EHa, and 2 if EHsc. + test.run_built_executable('test_eh_a', chdir=CHDIR, status=1) + test.run_built_executable('test_eh_s', chdir=CHDIR, status=2) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-function-level-linking.py b/tools/gyp/test/win/gyptest-cl-function-level-linking.py new file mode 100644 index 000000000..17c29e235 --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-function-level-linking.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure function-level linking setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('function-level-linking.gyp', chdir=CHDIR) + test.build('function-level-linking.gyp', test.ALL, chdir=CHDIR) + + def CheckForSectionString(binary, search_for, should_exist): + output = test.run_dumpbin('/headers', binary) + if should_exist and search_for not in output: + print 'Did not find "%s" in %s' % (search_for, binary) + test.fail_test() + elif not should_exist and search_for in output: + print 'Found "%s" in %s (and shouldn\'t have)' % (search_for, binary) + test.fail_test() + + def Object(proj, obj): + sep = '.' if test.format == 'ninja' else '\\' + return 'obj\\%s%s%s' % (proj, sep, obj) + + look_for = '''COMDAT; sym= "int __cdecl comdat_function''' + + # When function level linking is on, the functions should be listed as + # separate comdat entries. + + CheckForSectionString( + test.built_file_path(Object('test_fll_on', 'function-level-linking.obj'), + chdir=CHDIR), + look_for, + should_exist=True) + + CheckForSectionString( + test.built_file_path(Object('test_fll_off', 'function-level-linking.obj'), + chdir=CHDIR), + look_for, + should_exist=False) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-optimizations.py b/tools/gyp/test/win/gyptest-cl-optimizations.py new file mode 100644 index 000000000..9afd34423 --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-optimizations.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure optimization settings are extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('optimizations.gyp', chdir=CHDIR) + + # It's hard to map flags to output contents in a non-fragile way (especially + # handling both 2008/2010), so just verify the correct ninja command line + # contents. + + ninja_file = test.built_file_path('obj/test_opt_off.ninja', chdir=CHDIR) + test.must_contain(ninja_file, 'cflags = /Od') + + ninja_file = test.built_file_path('obj/test_opt_lev_size.ninja', chdir=CHDIR) + test.must_contain(ninja_file, 'cflags = /O1') + + ninja_file = test.built_file_path('obj/test_opt_lev_speed.ninja', chdir=CHDIR) + test.must_contain(ninja_file, 'cflags = /O2') + + ninja_file = test.built_file_path('obj/test_opt_lev_max.ninja', chdir=CHDIR) + test.must_contain(ninja_file, 'cflags = /Ox') + + ninja_file = test.built_file_path('obj/test_opt_unset.ninja', chdir=CHDIR) + test.must_not_contain(ninja_file, '/Od') + test.must_not_contain(ninja_file, '/O1') + test.must_not_contain(ninja_file, '/O2') + test.must_not_contain(ninja_file, '/Ox') + + ninja_file = test.built_file_path('obj/test_opt_fpo.ninja', chdir=CHDIR) + test.must_contain(ninja_file, '/Oy') + test.must_not_contain(ninja_file, '/Oy-') + + ninja_file = test.built_file_path('obj/test_opt_fpo_off.ninja', chdir=CHDIR) + test.must_contain(ninja_file, '/Oy-') + + ninja_file = test.built_file_path('obj/test_opt_inline_off.ninja', + chdir=CHDIR) + test.must_contain(ninja_file, '/Ob0') + + ninja_file = test.built_file_path('obj/test_opt_inline_manual.ninja', + chdir=CHDIR) + test.must_contain(ninja_file, '/Ob1') + + ninja_file = test.built_file_path('obj/test_opt_inline_auto.ninja', + chdir=CHDIR) + test.must_contain(ninja_file, '/Ob2') + + ninja_file = test.built_file_path('obj/test_opt_neither.ninja', + chdir=CHDIR) + test.must_not_contain(ninja_file, '/Os') + test.must_not_contain(ninja_file, '/Ot') + + ninja_file = test.built_file_path('obj/test_opt_size.ninja', + chdir=CHDIR) + test.must_contain(ninja_file, '/Os') + + ninja_file = test.built_file_path('obj/test_opt_speed.ninja', + chdir=CHDIR) + test.must_contain(ninja_file, '/Ot') + + ninja_file = test.built_file_path('obj/test_opt_wpo.ninja', + chdir=CHDIR) + test.must_contain(ninja_file, '/GL') + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-pdbname.py b/tools/gyp/test/win/gyptest-cl-pdbname.py new file mode 100644 index 000000000..63bb37c87 --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-pdbname.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure pdb is named as expected (shared between .cc files). +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('pdbname.gyp', chdir=CHDIR) + test.build('pdbname.gyp', test.ALL, chdir=CHDIR) + + # Confirm that the default behaviour is to name the .pdb per-target (rather + # than per .cc file). + test.built_file_must_exist('test_pdbname.pdb', chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-rtti.py b/tools/gyp/test/win/gyptest-cl-rtti.py new file mode 100644 index 000000000..d49a09437 --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-rtti.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure RTTI setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('rtti.gyp', chdir=CHDIR) + + # Must fail. + test.build('rtti.gyp', 'test_rtti_off', chdir=CHDIR, status=1) + + # Must succeed. + test.build('rtti.gyp', 'test_rtti_on', chdir=CHDIR) + + # Must succeed. + test.build('rtti.gyp', 'test_rtti_unset', chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-runtime-checks.py b/tools/gyp/test/win/gyptest-cl-runtime-checks.py new file mode 100644 index 000000000..4fd529f89 --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-runtime-checks.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure RTC setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('runtime-checks.gyp', chdir=CHDIR) + + # Runtime checks disabled, should fail. + test.build('runtime-checks.gyp', 'test_brc_none', chdir=CHDIR, status=1) + + # Runtime checks enabled, should pass. + test.build('runtime-checks.gyp', 'test_brc_1', chdir=CHDIR) + + # TODO(scottmg): There are other less frequently used/partial options, but + # it's not clear how to verify them, so ignore for now. + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-runtime-library.py b/tools/gyp/test/win/gyptest-cl-runtime-library.py new file mode 100644 index 000000000..53c149297 --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-runtime-library.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure runtime C library setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('runtime-library.gyp', chdir=CHDIR) + test.build('runtime-library.gyp', test.ALL, chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-warning-as-error.py b/tools/gyp/test/win/gyptest-cl-warning-as-error.py new file mode 100644 index 000000000..d4ef1b362 --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-warning-as-error.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure warning-as-error is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('warning-as-error.gyp', chdir=CHDIR) + + # The source file contains a warning, so if WarnAsError is false (or + # default, which is also false), then the build should succeed, otherwise it + # must fail. + + test.build('warning-as-error.gyp', 'test_warn_as_error_false', chdir=CHDIR) + test.build('warning-as-error.gyp', 'test_warn_as_error_unset', chdir=CHDIR) + test.build('warning-as-error.gyp', 'test_warn_as_error_true', chdir=CHDIR, + status=1) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-cl-warning-level.py b/tools/gyp/test/win/gyptest-cl-warning-level.py new file mode 100644 index 000000000..62a5b39b6 --- /dev/null +++ b/tools/gyp/test/win/gyptest-cl-warning-level.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure warning level is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'compiler-flags' + test.run_gyp('warning-level.gyp', chdir=CHDIR) + + # A separate target for each warning level: one pass (compiling a file + # containing a warning that's above the specified level); and one fail + # (compiling a file at the specified level). No pass for 4 of course, + # because it would have to have no warnings. The default warning level is + # equivalent to level 1. + + test.build('warning-level.gyp', 'test_wl1_fail', chdir=CHDIR, status=1) + test.build('warning-level.gyp', 'test_wl1_pass', chdir=CHDIR) + + test.build('warning-level.gyp', 'test_wl2_fail', chdir=CHDIR, status=1) + test.build('warning-level.gyp', 'test_wl2_pass', chdir=CHDIR) + + test.build('warning-level.gyp', 'test_wl3_fail', chdir=CHDIR, status=1) + test.build('warning-level.gyp', 'test_wl3_pass', chdir=CHDIR) + + test.build('warning-level.gyp', 'test_wl4_fail', chdir=CHDIR, status=1) + + test.build('warning-level.gyp', 'test_def_fail', chdir=CHDIR, status=1) + test.build('warning-level.gyp', 'test_def_pass', chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-command-quote.py b/tools/gyp/test/win/gyptest-command-quote.py new file mode 100644 index 000000000..312831b09 --- /dev/null +++ b/tools/gyp/test/win/gyptest-command-quote.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" + +Make sure the program in a command can be a called batch file, or an +application in the path. Specifically, this means not quoting something like +"call x.bat", lest the shell look for a program named "call x.bat", rather +than calling "x.bat". +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + CHDIR = 'command-quote' + test.run_gyp('command-quote.gyp', chdir=CHDIR) + + test.build('command-quote.gyp', 'test_batch', chdir=CHDIR) + test.build('command-quote.gyp', 'test_call_separate', chdir=CHDIR) + + # We confirm that this fails because other generators don't handle spaces in + # inputs so it's preferable to not have it work here. + test.build('command-quote.gyp', 'test_with_spaces', chdir=CHDIR, status=1) + + CHDIR = 'command-quote/subdir/and/another' + test.run_gyp('in-subdir.gyp', chdir=CHDIR) + test.build('in-subdir.gyp', 'test_batch_depth', chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-additional-deps.py b/tools/gyp/test/win/gyptest-link-additional-deps.py new file mode 100644 index 000000000..62c57366f --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-additional-deps.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure additional library dependencies are handled. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('additional-deps.gyp', chdir=CHDIR) + test.build('additional-deps.gyp', test.ALL, chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-additional-options.py b/tools/gyp/test/win/gyptest-link-additional-options.py new file mode 100644 index 000000000..7e57ae476 --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-additional-options.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure additional options are handled. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('additional-options.gyp', chdir=CHDIR) + test.build('additional-options.gyp', test.ALL, chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-aslr.py b/tools/gyp/test/win/gyptest-link-aslr.py new file mode 100644 index 000000000..e765017d3 --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-aslr.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure aslr setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('aslr.gyp', chdir=CHDIR) + test.build('aslr.gyp', test.ALL, chdir=CHDIR) + + def HasDynamicBase(exe): + full_path = test.built_file_path(exe, chdir=CHDIR) + output = test.run_dumpbin('/headers', full_path) + return ' Dynamic base' in output + + # Default is to be on. + if not HasDynamicBase('test_aslr_default.exe'): + test.fail_test() + if HasDynamicBase('test_aslr_no.exe'): + test.fail_test() + if not HasDynamicBase('test_aslr_yes.exe'): + test.fail_test() + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-debug-info.py b/tools/gyp/test/win/gyptest-link-debug-info.py new file mode 100644 index 000000000..33e8ac48b --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-debug-info.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure debug info setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('debug-info.gyp', chdir=CHDIR) + test.build('debug-info.gyp', test.ALL, chdir=CHDIR) + + suffix = '.exe.pdb' if test.format == 'ninja' else '.pdb' + test.built_file_must_not_exist('test_debug_off%s' % suffix, chdir=CHDIR) + test.built_file_must_exist('test_debug_on%s' % suffix, chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-default-libs.py b/tools/gyp/test/win/gyptest-link-default-libs.py new file mode 100644 index 000000000..526e98cba --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-default-libs.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure we include the default libs. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('default-libs.gyp', chdir=CHDIR) + test.build('default-libs.gyp', test.ALL, chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-deffile.py b/tools/gyp/test/win/gyptest-link-deffile.py new file mode 100644 index 000000000..94df874f8 --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-deffile.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure a .def file is handled in the link. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + + # Multiple .def files doesn't make any sense, should fail at generate time. + test.run_gyp('deffile-multiple.gyp', chdir=CHDIR, stderr=None, status=1) + + test.run_gyp('deffile.gyp', chdir=CHDIR) + test.build('deffile.gyp', test.ALL, chdir=CHDIR) + + def HasExport(binary, export): + full_path = test.built_file_path(binary, chdir=CHDIR) + output = test.run_dumpbin('/exports', full_path) + return export in output + + # Make sure we only have the export when the .def file is in use. + + if HasExport('test_deffile_dll_notexported.dll', 'AnExportedFunction'): + test.fail_test() + if not HasExport('test_deffile_dll_ok.dll', 'AnExportedFunction'): + test.fail_test() + + if HasExport('test_deffile_exe_notexported.exe', 'AnExportedFunction'): + test.fail_test() + if not HasExport('test_deffile_exe_ok.exe', 'AnExportedFunction'): + test.fail_test() + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-delay-load-dlls.py b/tools/gyp/test/win/gyptest-link-delay-load-dlls.py new file mode 100644 index 000000000..3880247b4 --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-delay-load-dlls.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure delay load setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('delay-load-dlls.gyp', chdir=CHDIR) + test.build('delay-load-dlls.gyp', test.ALL, chdir=CHDIR) + + prefix = 'contains the following delay load imports:' + shell32_look_for = prefix + '\r\n\r\n SHELL32.dll' + + output = test.run_dumpbin( + '/all', test.built_file_path('test_dld_none.exe', chdir=CHDIR)) + if prefix in output: + test.fail_test() + + output = test.run_dumpbin( + '/all', test.built_file_path('test_dld_shell32.exe', chdir=CHDIR)) + if shell32_look_for not in output: + test.fail_test() + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-entrypointsymbol.py b/tools/gyp/test/win/gyptest-link-entrypointsymbol.py new file mode 100644 index 000000000..e88174a08 --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-entrypointsymbol.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure entrypointsymbol setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('entrypointsymbol.gyp', chdir=CHDIR) + + test.build('entrypointsymbol.gyp', 'test_ok', chdir=CHDIR) + test.build('entrypointsymbol.gyp', 'test_fail', chdir=CHDIR, status=1) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-fixed-base.py b/tools/gyp/test/win/gyptest-link-fixed-base.py new file mode 100644 index 000000000..725a87028 --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-fixed-base.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure fixed base setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('fixed-base.gyp', chdir=CHDIR) + test.build('fixed-base.gyp', test.ALL, chdir=CHDIR) + + def GetHeaders(exe): + full_path = test.built_file_path(exe, chdir=CHDIR) + return test.run_dumpbin('/headers', full_path) + + # For exe, default is fixed, for dll, it's not fixed. + if 'Relocations stripped' not in GetHeaders('test_fixed_default_exe.exe'): + test.fail_test() + if 'Relocations stripped' in GetHeaders('test_fixed_default_dll.dll'): + test.fail_test() + + # Explicitly not fixed. + if 'Relocations stripped' in GetHeaders('test_fixed_no.exe'): + test.fail_test() + + # Explicitly fixed. + if 'Relocations stripped' not in GetHeaders('test_fixed_yes.exe'): + test.fail_test() + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-incremental.py b/tools/gyp/test/win/gyptest-link-incremental.py new file mode 100644 index 000000000..e7184e162 --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-incremental.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure incremental linking setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('incremental.gyp', chdir=CHDIR) + test.build('incremental.gyp', test.ALL, chdir=CHDIR) + + def HasILTTables(exe): + full_path = test.built_file_path(exe, chdir=CHDIR) + output = test.run_dumpbin('/disasm', full_path) + return '@ILT+' in output + + # Default or unset is to be on. + if not HasILTTables('test_incremental_unset.exe'): + test.fail_test() + if not HasILTTables('test_incremental_default.exe'): + test.fail_test() + if HasILTTables('test_incremental_no.exe'): + test.fail_test() + if not HasILTTables('test_incremental_yes.exe'): + test.fail_test() + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-library-adjust.py b/tools/gyp/test/win/gyptest-link-library-adjust.py new file mode 100644 index 000000000..71d1c0936 --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-library-adjust.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure link_settings containing -lblah.lib is remapped to just blah.lib. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('library-adjust.gyp', chdir=CHDIR) + test.build('library-adjust.gyp', test.ALL, chdir=CHDIR) + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-library-directories.py b/tools/gyp/test/win/gyptest-link-library-directories.py new file mode 100644 index 000000000..8308e14fc --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-library-directories.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure libpath is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + + # Build subdirectory library. + test.run_gyp('subdir/library.gyp', chdir=CHDIR) + test.build('subdir/library.gyp', test.ALL, chdir=CHDIR) + + # And then try to link the main project against the library using only + # LIBPATH to find it. + test.run_gyp('library-directories.gyp', chdir=CHDIR) + + # Without additional paths specified, should fail. + test.build('library-directories.gyp', 'test_libdirs_none', chdir=CHDIR, + status=1) + + # With the additional library directory, should pass. + test.build('library-directories.gyp', 'test_libdirs_with', chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-nodefaultlib.py b/tools/gyp/test/win/gyptest-link-nodefaultlib.py new file mode 100644 index 000000000..f00760b88 --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-nodefaultlib.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure nodefaultlib setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('nodefaultlib.gyp', chdir=CHDIR) + + test.build('nodefaultlib.gyp', 'test_ok', chdir=CHDIR) + test.build('nodefaultlib.gyp', 'test_fail', chdir=CHDIR, status=1) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-nxcompat.py b/tools/gyp/test/win/gyptest-link-nxcompat.py new file mode 100644 index 000000000..660074397 --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-nxcompat.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure nxcompat setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('nxcompat.gyp', chdir=CHDIR) + test.build('nxcompat.gyp', test.ALL, chdir=CHDIR) + + def GetHeaders(exe): + return test.run_dumpbin('/headers', test.built_file_path(exe, chdir=CHDIR)) + + # NXCOMPAT is on by default. + if 'NX compatible' not in GetHeaders('test_nxcompat_default.exe'): + test.fail_test() + + # Explicitly off, should not be marked NX compatiable. + if 'NX compatible' in GetHeaders('test_nxcompat_no.exe'): + test.fail_test() + + # Explicitly on. + if 'NX compatible' not in GetHeaders('test_nxcompat_yes.exe'): + test.fail_test() + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-opt-icf.py b/tools/gyp/test/win/gyptest-link-opt-icf.py new file mode 100644 index 000000000..3c48ef6eb --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-opt-icf.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure comdat folding optimization setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('opt-icf.gyp', chdir=CHDIR) + test.build('opt-icf.gyp', chdir=CHDIR) + + # We're specifying /DEBUG so the default is to not merge identical + # functions, so all of the similar_functions should be preserved. + output = test.run_dumpbin( + '/disasm', test.built_file_path('test_opticf_default.exe', chdir=CHDIR)) + if output.count('similar_function') != 6: # 3 definitions, 3 calls. + test.fail_test() + + # Explicitly off, all functions preserved seperately. + output = test.run_dumpbin( + '/disasm', test.built_file_path('test_opticf_no.exe', chdir=CHDIR)) + if output.count('similar_function') != 6: # 3 definitions, 3 calls. + test.fail_test() + + # Explicitly on, all but one removed. + output = test.run_dumpbin( + '/disasm', test.built_file_path('test_opticf_yes.exe', chdir=CHDIR)) + if output.count('similar_function') != 4: # 1 definition, 3 calls. + test.fail_test() + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-opt-ref.py b/tools/gyp/test/win/gyptest-link-opt-ref.py new file mode 100644 index 000000000..586b7afcd --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-opt-ref.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure reference optimization setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('opt-ref.gyp', chdir=CHDIR) + test.build('opt-ref.gyp', chdir=CHDIR) + + # We're specifying /DEBUG so the default is to not remove unused functions. + output = test.run_dumpbin( + '/disasm', test.built_file_path('test_optref_default.exe', chdir=CHDIR)) + if 'unused_function' not in output: + test.fail_test() + + # Explicitly off, unused_function preserved. + output = test.run_dumpbin( + '/disasm', test.built_file_path('test_optref_no.exe', chdir=CHDIR)) + if 'unused_function' not in output: + test.fail_test() + + # Explicitly on, should be removed. + output = test.run_dumpbin( + '/disasm', test.built_file_path('test_optref_yes.exe', chdir=CHDIR)) + if 'unused_function' in output: + test.fail_test() + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-outputfile.py b/tools/gyp/test/win/gyptest-link-outputfile.py new file mode 100644 index 000000000..b98cdff0f --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-outputfile.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure linker OutputFile setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('outputfile.gyp', chdir=CHDIR) + test.build('outputfile.gyp', test.ALL, chdir=CHDIR) + + test.built_file_must_exist('blorp.exe', chdir=CHDIR) + test.built_file_must_exist('blorp.dll', chdir=CHDIR) + test.built_file_must_exist('subdir/blorp.exe', chdir=CHDIR) + test.built_file_must_exist('blorp.lib', chdir=CHDIR) + test.built_file_must_exist('subdir/blorp.lib', chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-restat-importlib.py b/tools/gyp/test/win/gyptest-link-restat-importlib.py new file mode 100644 index 000000000..16249cc2e --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-restat-importlib.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure we don't cause unnecessary builds due to import libs appearing +to be out of date. +""" + +import TestGyp + +import sys +import time + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'importlib' + test.run_gyp('importlib.gyp', chdir=CHDIR) + test.build('importlib.gyp', test.ALL, chdir=CHDIR) + + # Delay briefly so that there's time for this touch not to have the + # timestamp as the previous run. + test.sleep() + + # Touch the .cc file; the .dll will rebuild, but the import libs timestamp + # won't be updated. + test.touch('importlib/has-exports.cc') + test.build('importlib.gyp', 'test_importlib', chdir=CHDIR) + + # This is the important part. The .dll above will relink and have an updated + # timestamp, however the import .libs timestamp won't be updated. So, we + # have to handle restating inputs in ninja so the final binary doesn't + # continually relink (due to thinking the .lib isn't up to date). + test.up_to_date('importlib.gyp', test.ALL, chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-subsystem.py b/tools/gyp/test/win/gyptest-link-subsystem.py new file mode 100644 index 000000000..94d2a127b --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-subsystem.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure subsystem setting is extracted properly. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'linker-flags' + test.run_gyp('subsystem.gyp', chdir=CHDIR) + + test.build('subsystem.gyp', 'test_console_ok', chdir=CHDIR) + test.build('subsystem.gyp', 'test_console_fail', chdir=CHDIR, status=1) + test.build('subsystem.gyp', 'test_windows_ok', chdir=CHDIR) + test.build('subsystem.gyp', 'test_windows_fail', chdir=CHDIR, status=1) + + # TODO(scottmg): There are other subsystems (WinCE, etc.) that we don't use. + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-link-uldi.py b/tools/gyp/test/win/gyptest-link-uldi.py new file mode 100644 index 000000000..62c5892c5 --- /dev/null +++ b/tools/gyp/test/win/gyptest-link-uldi.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure that when ULDI is on, we link .objs that make up .libs rather than +the .libs themselves. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'uldi' + test.run_gyp('uldi.gyp', chdir=CHDIR) + # When linking with ULDI, the duplicated function from the lib will be an + # error. + test.build('uldi.gyp', 'final_uldi', chdir=CHDIR, status=1) + # And when in libs, the duplicated function will be silently dropped, so the + # build succeeds. + test.build('uldi.gyp', 'final_no_uldi', chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-long-command-line.py b/tools/gyp/test/win/gyptest-long-command-line.py new file mode 100644 index 000000000..8f8b7a3bb --- /dev/null +++ b/tools/gyp/test/win/gyptest-long-command-line.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure long command lines work. +""" + +import TestGyp + +import subprocess +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['ninja', 'msvs']) + + CHDIR = 'long-command-line' + test.run_gyp('long-command-line.gyp', chdir=CHDIR) + test.build('long-command-line.gyp', test.ALL, chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-macro-projectname.py b/tools/gyp/test/win/gyptest-macro-projectname.py new file mode 100644 index 000000000..e411cc04a --- /dev/null +++ b/tools/gyp/test/win/gyptest-macro-projectname.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure macro expansion of $(ProjectName) is handled. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'vs-macros' + test.run_gyp('projectname.gyp', chdir=CHDIR) + test.build('projectname.gyp', test.ALL, chdir=CHDIR) + test.built_file_must_exist('test_expansions_plus_something.exe', chdir=CHDIR) + test.built_file_must_exist( + 'test_with_product_name_plus_something.exe', chdir=CHDIR) + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-macro-vcinstalldir.py b/tools/gyp/test/win/gyptest-macro-vcinstalldir.py new file mode 100644 index 000000000..37396e161 --- /dev/null +++ b/tools/gyp/test/win/gyptest-macro-vcinstalldir.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure macro expansion of $(VCInstallDir) is handled, and specifically +always / terminated for compatibility. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'vs-macros' + test.run_gyp('vcinstalldir.gyp', chdir=CHDIR) + # This fails on VS because the trailing slash escapes the trailing quote. + test.build('vcinstalldir.gyp', 'test_slash_trailing', chdir=CHDIR, status=1) + test.build('vcinstalldir.gyp', 'test_slash_dir', chdir=CHDIR) + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-macros-containing-gyp.py b/tools/gyp/test/win/gyptest-macros-containing-gyp.py new file mode 100644 index 000000000..f6eaf63db --- /dev/null +++ b/tools/gyp/test/win/gyptest-macros-containing-gyp.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Handle VS macro expansion containing gyp variables. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'vs-macros' + test.run_gyp('containing-gyp.gyp', chdir=CHDIR) + test.build('containing-gyp.gyp', test.ALL, chdir=CHDIR) + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-macros-in-inputs-and-outputs.py b/tools/gyp/test/win/gyptest-macros-in-inputs-and-outputs.py new file mode 100644 index 000000000..3d6fa74e4 --- /dev/null +++ b/tools/gyp/test/win/gyptest-macros-in-inputs-and-outputs.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Handle macro expansion in inputs and outputs of rules. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'vs-macros' + test.run_gyp('input-output-macros.gyp', chdir=CHDIR) + + test.build('input-output-macros.gyp', 'test_expansions', chdir=CHDIR) + + test.built_file_must_exist('stuff.blah.something', + content='Random data file.\nModified.', + chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-midl-rules.py b/tools/gyp/test/win/gyptest-midl-rules.py new file mode 100644 index 000000000..86a84e165 --- /dev/null +++ b/tools/gyp/test/win/gyptest-midl-rules.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Handle default .idl build rules. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'idl-rules' + test.run_gyp('basic-idl.gyp', chdir=CHDIR) + test.build('basic-idl.gyp', test.ALL, chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-quoting-commands.py b/tools/gyp/test/win/gyptest-quoting-commands.py new file mode 100644 index 000000000..b40f99f08 --- /dev/null +++ b/tools/gyp/test/win/gyptest-quoting-commands.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure batch files run as actions. Regression test for previously missing +trailing quote on command line. cmd typically will implicitly insert a missing +quote, but if the command ends in a quote, it will not insert another, so the +command can sometimes become unterminated. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'batch-file-action' + test.run_gyp('batch-file-action.gyp', chdir=CHDIR) + test.build('batch-file-action.gyp', test.ALL, chdir=CHDIR) + + test.pass_test() diff --git a/tools/gyp/test/win/gyptest-rc-build.py b/tools/gyp/test/win/gyptest-rc-build.py new file mode 100644 index 000000000..7026992e9 --- /dev/null +++ b/tools/gyp/test/win/gyptest-rc-build.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Make sure we build and include .rc files. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja']) + + CHDIR = 'rc-build' + test.run_gyp('hello.gyp', chdir=CHDIR) + test.build('hello.gyp', test.ALL, chdir=CHDIR) + test.run_built_executable('with_resources', chdir=CHDIR, status=4) + + test.pass_test() diff --git a/tools/gyp/test/win/idl-rules/basic-idl.gyp b/tools/gyp/test/win/idl-rules/basic-idl.gyp new file mode 100644 index 000000000..b980e527f --- /dev/null +++ b/tools/gyp/test/win/idl-rules/basic-idl.gyp @@ -0,0 +1,30 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables': { + 'midl_out_dir': '<(SHARED_INTERMEDIATE_DIR)', + }, + 'targets': [ + { + 'target_name': 'idl_test', + 'type': 'executable', + 'sources': [ + 'history_indexer.idl', + '<(midl_out_dir)/history_indexer.h', + '<(midl_out_dir)/history_indexer_i.c', + 'history_indexer_user.cc', + ], + 'include_dirs': [ + '<(midl_out_dir)', + ], + 'msvs_settings': { + 'VCMIDLTool': { + 'OutputDirectory': '<(midl_out_dir)', + 'HeaderFileName': '<(RULE_INPUT_ROOT).h', + }, + }, + }, + ], +} diff --git a/tools/gyp/test/win/idl-rules/history_indexer.idl b/tools/gyp/test/win/idl-rules/history_indexer.idl new file mode 100644 index 000000000..e866ce6d9 --- /dev/null +++ b/tools/gyp/test/win/idl-rules/history_indexer.idl @@ -0,0 +1,17 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import "oaidl.idl"; +import "ocidl.idl"; + +[ + object, + uuid(9C1100DD-51D4-4827-AE9F-3B8FAC4AED72), + oleautomation, + nonextensible, + pointer_default(unique) +] +interface IChromeHistoryIndexer : IUnknown { + HRESULT SomeFunction([in] VARIANT begin_time, [in] VARIANT end_time); +}; diff --git a/tools/gyp/test/win/idl-rules/history_indexer_user.cc b/tools/gyp/test/win/idl-rules/history_indexer_user.cc new file mode 100644 index 000000000..071a9ffef --- /dev/null +++ b/tools/gyp/test/win/idl-rules/history_indexer_user.cc @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "history_indexer.h" + +// Use the thing in the IDL. +int main() { + IChromeHistoryIndexer** indexer = 0; + IID fake_iid; + CoCreateInstance(fake_iid, NULL, CLSCTX_INPROC, + __uuidof(IChromeHistoryIndexer), + reinterpret_cast(indexer)); + return 0; +} diff --git a/tools/gyp/test/win/importlib/has-exports.cc b/tools/gyp/test/win/importlib/has-exports.cc new file mode 100644 index 000000000..3f62d6c60 --- /dev/null +++ b/tools/gyp/test/win/importlib/has-exports.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +__declspec(dllexport) void some_function() { +} + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/importlib/hello.cc b/tools/gyp/test/win/importlib/hello.cc new file mode 100644 index 000000000..66ff68c11 --- /dev/null +++ b/tools/gyp/test/win/importlib/hello.cc @@ -0,0 +1,9 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +__declspec(dllimport) void some_function(); + +int main() { + some_function(); +} diff --git a/tools/gyp/test/win/importlib/importlib.gyp b/tools/gyp/test/win/importlib/importlib.gyp new file mode 100644 index 000000000..ab15b1893 --- /dev/null +++ b/tools/gyp/test/win/importlib/importlib.gyp @@ -0,0 +1,30 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_importlib', + 'type': 'shared_library', + 'msvs_settings': { + 'VCLinkerTool': { + 'LinkIncremental': '2', + } + }, + 'sources': ['has-exports.cc'], + }, + + { + 'target_name': 'test_linkagainst', + 'type': 'executable', + 'dependencies': ['test_importlib'], + 'msvs_settings': { + 'VCLinkerTool': { + 'LinkIncremental': '2', + } + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/additional-deps.cc b/tools/gyp/test/win/linker-flags/additional-deps.cc new file mode 100644 index 000000000..7dfb589d2 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/additional-deps.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +int main() { + WSAStartup(0, 0); + return 0; +} diff --git a/tools/gyp/test/win/linker-flags/additional-deps.gyp b/tools/gyp/test/win/linker-flags/additional-deps.gyp new file mode 100644 index 000000000..55afe64fb --- /dev/null +++ b/tools/gyp/test/win/linker-flags/additional-deps.gyp @@ -0,0 +1,30 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_deps_none', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_deps_few', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'AdditionalDependencies': [ + 'wininet.lib', + 'ws2_32.lib', + ] + } + }, + 'sources': ['additional-deps.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/additional-options.gyp b/tools/gyp/test/win/linker-flags/additional-options.gyp new file mode 100644 index 000000000..cab3994cd --- /dev/null +++ b/tools/gyp/test/win/linker-flags/additional-options.gyp @@ -0,0 +1,29 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_additional_none', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_additional_few', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'AdditionalOptions': [ + '/dynamicbase:no', + ] + } + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/aslr.gyp b/tools/gyp/test/win/linker-flags/aslr.gyp new file mode 100644 index 000000000..b3aefd50b --- /dev/null +++ b/tools/gyp/test/win/linker-flags/aslr.gyp @@ -0,0 +1,35 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_aslr_default', + 'type': 'executable', + 'msvs_settings': { + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_aslr_no', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'RandomizedBaseAddress': '1', + }, + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_aslr_yes', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'RandomizedBaseAddress': '2', + } + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/debug-info.gyp b/tools/gyp/test/win/linker-flags/debug-info.gyp new file mode 100644 index 000000000..d47d0ecce --- /dev/null +++ b/tools/gyp/test/win/linker-flags/debug-info.gyp @@ -0,0 +1,28 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_debug_off', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'GenerateDebugInformation': 'false' + }, + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_debug_on', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true' + }, + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/default-libs.cc b/tools/gyp/test/win/linker-flags/default-libs.cc new file mode 100644 index 000000000..2c78cccba --- /dev/null +++ b/tools/gyp/test/win/linker-flags/default-libs.cc @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include +#include +#include +#include +#include +#include + +// Reference something in each of the default-linked libraries to cause a link +// error if one is not correctly included. + +extern "C" void* __puiHead; // DelayImp + +int main() { + CopyFile(0, 0, 0); // kernel32 + MessageBox(0, 0, 0, 0); // user32 + CreateDC(0, 0, 0, 0); // gdi32 + AddPrinter(0, 0, 0); // winspool + FindText(0); // comdlg32 + ClearEventLog(0, 0); // advapi32 + SHGetSettings(0, 0); // shell32 + OleFlushClipboard(); // ole32 + VarAdd(0, 0, 0); // oleaut32 + printf("%p", &CLSID_FileOpenDialog); // uuid + SQLAllocHandle(0, 0, 0); // odbc32 + return 0; +} diff --git a/tools/gyp/test/win/linker-flags/default-libs.gyp b/tools/gyp/test/win/linker-flags/default-libs.gyp new file mode 100644 index 000000000..dfceaebfb --- /dev/null +++ b/tools/gyp/test/win/linker-flags/default-libs.gyp @@ -0,0 +1,13 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_default', + 'type': 'executable', + 'sources': ['default-libs.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/deffile-multiple.gyp b/tools/gyp/test/win/linker-flags/deffile-multiple.gyp new file mode 100644 index 000000000..c74a9af20 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/deffile-multiple.gyp @@ -0,0 +1,17 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_deffile_multiple_fail', + 'type': 'shared_library', + 'sources': [ + 'deffile.cc', + 'deffile.def', + 'deffile2.def', + ], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/deffile.cc b/tools/gyp/test/win/linker-flags/deffile.cc new file mode 100644 index 000000000..bf58c6126 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/deffile.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +void AnExportedFunction() { +} + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/linker-flags/deffile.def b/tools/gyp/test/win/linker-flags/deffile.def new file mode 100644 index 000000000..ba9d399bd --- /dev/null +++ b/tools/gyp/test/win/linker-flags/deffile.def @@ -0,0 +1,8 @@ +; Copyright (c) 2012 Google Inc. All rights reserved. +; Use of this source code is governed by a BSD-style license that can be +; found in the LICENSE file. + +LIBRARY test_deffile_ok + +EXPORTS + AnExportedFunction diff --git a/tools/gyp/test/win/linker-flags/deffile.gyp b/tools/gyp/test/win/linker-flags/deffile.gyp new file mode 100644 index 000000000..7b241d5e3 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/deffile.gyp @@ -0,0 +1,38 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_deffile_dll_ok', + 'type': 'shared_library', + 'sources': [ + 'deffile.cc', + 'deffile.def', + ], + }, + { + 'target_name': 'test_deffile_dll_notexported', + 'type': 'shared_library', + 'sources': [ + 'deffile.cc', + ], + }, + { + 'target_name': 'test_deffile_exe_ok', + 'type': 'executable', + 'sources': [ + 'deffile.cc', + 'deffile.def', + ], + }, + { + 'target_name': 'test_deffile_exe_notexported', + 'type': 'executable', + 'sources': [ + 'deffile.cc', + ], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/delay-load-dlls.gyp b/tools/gyp/test/win/linker-flags/delay-load-dlls.gyp new file mode 100644 index 000000000..93ca311c4 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/delay-load-dlls.gyp @@ -0,0 +1,27 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_dld_none', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + } + }, + 'sources': ['delay-load.cc'], + }, + { + 'target_name': 'test_dld_shell32', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'DelayLoadDLLs': ['shell32.dll'] + } + }, + 'sources': ['delay-load.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/delay-load.cc b/tools/gyp/test/win/linker-flags/delay-load.cc new file mode 100644 index 000000000..2be34aa87 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/delay-load.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +int main() { + SHCreateDirectory(0, 0); + return 0; +} diff --git a/tools/gyp/test/win/linker-flags/entrypointsymbol.cc b/tools/gyp/test/win/linker-flags/entrypointsymbol.cc new file mode 100644 index 000000000..b567bc87b --- /dev/null +++ b/tools/gyp/test/win/linker-flags/entrypointsymbol.cc @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// The entry point specified by link.exe /ENTRY option. +extern "C" void MainEntryPoint() { +} + +// Still needed because the linker checks for existence of one of main, wmain, +// WinMain, or wMain to offer informative diagnositics. +int main() { + return 0; +} diff --git a/tools/gyp/test/win/linker-flags/entrypointsymbol.gyp b/tools/gyp/test/win/linker-flags/entrypointsymbol.gyp new file mode 100644 index 000000000..7f2c14252 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/entrypointsymbol.gyp @@ -0,0 +1,28 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_ok', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'EntryPointSymbol': 'MainEntryPoint', + } + }, + 'sources': ['entrypointsymbol.cc'], + }, + { + 'target_name': 'test_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'EntryPointSymbol': 'MainEntryPoint', + } + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/fixed-base.gyp b/tools/gyp/test/win/linker-flags/fixed-base.gyp new file mode 100644 index 000000000..cc2982eb2 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/fixed-base.gyp @@ -0,0 +1,52 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + # Disable DYNAMICBASE for these tests because it implies/doesn't imply + # FIXED in certain cases so it complicates the test for FIXED. + { + 'target_name': 'test_fixed_default_exe', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'RandomizedBaseAddress': '1', + }, + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_fixed_default_dll', + 'type': 'shared_library', + 'msvs_settings': { + 'VCLinkerTool': { + 'RandomizedBaseAddress': '1', + }, + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_fixed_no', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'FixedBaseAddress': '1', + 'RandomizedBaseAddress': '1', + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_fixed_yes', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'FixedBaseAddress': '2', + 'RandomizedBaseAddress': '1', + }, + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/hello.cc b/tools/gyp/test/win/linker-flags/hello.cc new file mode 100644 index 000000000..1711567ef --- /dev/null +++ b/tools/gyp/test/win/linker-flags/hello.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/linker-flags/incremental.gyp b/tools/gyp/test/win/linker-flags/incremental.gyp new file mode 100644 index 000000000..59f310325 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/incremental.gyp @@ -0,0 +1,65 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + # Turn on debug information so the incremental linking tables have a + # visible symbolic name in the disassembly. + { + 'target_name': 'test_incremental_unset', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_incremental_default', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + 'LinkIncremental': '0', + }, + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_incremental_no', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + 'LinkIncremental': '1', + }, + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_incremental_yes', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + 'LinkIncremental': '2', + } + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/library-adjust.cc b/tools/gyp/test/win/linker-flags/library-adjust.cc new file mode 100644 index 000000000..7dfb589d2 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/library-adjust.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +int main() { + WSAStartup(0, 0); + return 0; +} diff --git a/tools/gyp/test/win/linker-flags/library-adjust.gyp b/tools/gyp/test/win/linker-flags/library-adjust.gyp new file mode 100644 index 000000000..10e9996f5 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/library-adjust.gyp @@ -0,0 +1,16 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_adjust', + 'type': 'executable', + 'libraries': [ + '-lws2_32.lib' + ], + 'sources': ['library-adjust.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/library-directories-define.cc b/tools/gyp/test/win/linker-flags/library-directories-define.cc new file mode 100644 index 000000000..211ef062c --- /dev/null +++ b/tools/gyp/test/win/linker-flags/library-directories-define.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int library_function() { + return 0; +} diff --git a/tools/gyp/test/win/linker-flags/library-directories-reference.cc b/tools/gyp/test/win/linker-flags/library-directories-reference.cc new file mode 100644 index 000000000..335097839 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/library-directories-reference.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +extern int library_function(); + +int main() { + library_function(); + return 0; +} diff --git a/tools/gyp/test/win/linker-flags/library-directories.gyp b/tools/gyp/test/win/linker-flags/library-directories.gyp new file mode 100644 index 000000000..25395d6c8 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/library-directories.gyp @@ -0,0 +1,42 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_libdirs_none', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'AdditionalDependencies': [ + 'test_lib.lib', + ], + }, + }, + 'sources': ['library-directories-reference.cc'], + }, + { + 'target_name': 'test_libdirs_with', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + # NOTE: Don't use this for general dependencies between gyp + # libraries (use 'dependencies' instead). This is done here only for + # testing. + # + # This setting should only be used to depend on third party prebuilt + # libraries that are stored as binaries at a known location. + 'AdditionalLibraryDirectories': [ + '<(DEPTH)/out/Default/obj/subdir', # ninja style + '<(DEPTH)/subdir/Default/lib', # msvs style + ], + 'AdditionalDependencies': [ + 'test_lib.lib', + ], + }, + }, + 'sources': ['library-directories-reference.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/nodefaultlib.cc b/tools/gyp/test/win/linker-flags/nodefaultlib.cc new file mode 100644 index 000000000..24b6eca43 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/nodefaultlib.cc @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Include entry point function that's excluded by removing C runtime libraries. +extern "C" void mainCRTStartup() { +} + +// Still needed because the linker checks for existence of one of main, wmain, +// WinMain, or wMain to offer informative diagnositics. +int main() { + return 0; +} diff --git a/tools/gyp/test/win/linker-flags/nodefaultlib.gyp b/tools/gyp/test/win/linker-flags/nodefaultlib.gyp new file mode 100644 index 000000000..4fb452a18 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/nodefaultlib.gyp @@ -0,0 +1,30 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_ok', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'IgnoreDefaultLibraryNames': + ['libcmtd.lib', 'libcmt.lib', 'msvcrt.lib', 'msvcrtd.lib'], + } + }, + 'sources': ['nodefaultlib.cc'], + }, + { + 'target_name': 'test_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'IgnoreDefaultLibraryNames': + ['libcmtd.lib', 'libcmt.lib', 'msvcrt.lib', 'msvcrtd.lib'], + } + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/nxcompat.gyp b/tools/gyp/test/win/linker-flags/nxcompat.gyp new file mode 100644 index 000000000..fa4118cbd --- /dev/null +++ b/tools/gyp/test/win/linker-flags/nxcompat.gyp @@ -0,0 +1,35 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_nxcompat_default', + 'type': 'executable', + 'msvs_settings': { + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_nxcompat_no', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'DataExecutionPrevention': '1', + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_nxcompat_yes', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'DataExecutionPrevention': '2', + }, + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/opt-icf.cc b/tools/gyp/test/win/linker-flags/opt-icf.cc new file mode 100644 index 000000000..1f12156b7 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/opt-icf.cc @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +void similar_function0(char* x) { + while (*x) { + ++x; + } +} + +void similar_function1(char* p) { + while (*p) { + ++p; + } +} + +void similar_function2(char* q) { + while (*q) { + ++q; + } +} + +int main() { + char* x = "hello"; + similar_function0(x); + similar_function1(x); + similar_function2(x); + return 0; +} diff --git a/tools/gyp/test/win/linker-flags/opt-icf.gyp b/tools/gyp/test/win/linker-flags/opt-icf.gyp new file mode 100644 index 000000000..effe8021c --- /dev/null +++ b/tools/gyp/test/win/linker-flags/opt-icf.gyp @@ -0,0 +1,63 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + # Have to turn on function level linking here to get the function packaged + # as a COMDAT so that it's eligible for merging. Also turn on debug + # information so that the symbol names for the code appear in the dump. + # Finally, specify non-incremental linking so that there's not a bunch of + # extra "similar_function"s in the output (the ILT jump table). + { + 'target_name': 'test_opticf_default', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableFunctionLevelLinking': 'true', + 'DebugInformationFormat': '3', + 'Optimization': '0', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + 'LinkIncremental': '1', + }, + }, + 'sources': ['opt-icf.cc'], + }, + { + 'target_name': 'test_opticf_no', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableFunctionLevelLinking': 'true', + 'DebugInformationFormat': '3', + 'Optimization': '0', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + 'EnableCOMDATFolding': '1', + 'LinkIncremental': '1', + }, + }, + 'sources': ['opt-icf.cc'], + }, + { + 'target_name': 'test_opticf_yes', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableFunctionLevelLinking': 'true', + 'DebugInformationFormat': '3', + 'Optimization': '0', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + 'EnableCOMDATFolding': '2', + 'LinkIncremental': '1', + }, + }, + 'sources': ['opt-icf.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/opt-ref.cc b/tools/gyp/test/win/linker-flags/opt-ref.cc new file mode 100644 index 000000000..afaa328a5 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/opt-ref.cc @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int unused_function() { + return 0; +} + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/linker-flags/opt-ref.gyp b/tools/gyp/test/win/linker-flags/opt-ref.gyp new file mode 100644 index 000000000..69d0281a0 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/opt-ref.gyp @@ -0,0 +1,56 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + # Have to turn on function level linking here to get the function packaged + # as a COMDAT so that it's eligible for optimizing away. Also turn on + # debug information so that the symbol names for the code appear in the + # dump (so we can verify if they are included in the final exe). + { + 'target_name': 'test_optref_default', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableFunctionLevelLinking': 'true', + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + }, + 'sources': ['opt-ref.cc'], + }, + { + 'target_name': 'test_optref_no', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableFunctionLevelLinking': 'true', + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + 'OptimizeReferences': '1', + }, + }, + 'sources': ['opt-ref.cc'], + }, + { + 'target_name': 'test_optref_yes', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'EnableFunctionLevelLinking': 'true', + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + 'OptimizeReferences': '2', + }, + }, + 'sources': ['opt-ref.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/outputfile.gyp b/tools/gyp/test/win/linker-flags/outputfile.gyp new file mode 100644 index 000000000..1022ec2e2 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/outputfile.gyp @@ -0,0 +1,58 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_output_exe', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'OutputFile': '$(OutDir)\\blorp.exe' + }, + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_output_exe2', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'OutputFile': '$(OutDir)\\subdir\\blorp.exe' + }, + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_output_dll', + 'type': 'shared_library', + 'msvs_settings': { + 'VCLinkerTool': { + 'OutputFile': '$(OutDir)\\blorp.dll' + }, + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_output_lib', + 'type': 'static_library', + 'msvs_settings': { + 'VCLibrarianTool': { + 'OutputFile': '$(OutDir)\\blorp.lib' + }, + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_output_lib2', + 'type': 'static_library', + 'msvs_settings': { + 'VCLibrarianTool': { + 'OutputFile': '$(OutDir)\\subdir\\blorp.lib' + }, + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/subdir/library.gyp b/tools/gyp/test/win/linker-flags/subdir/library.gyp new file mode 100644 index 000000000..519577f0d --- /dev/null +++ b/tools/gyp/test/win/linker-flags/subdir/library.gyp @@ -0,0 +1,13 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_lib', + 'type': 'static_library', + 'sources': ['../library-directories-define.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/linker-flags/subsystem-windows.cc b/tools/gyp/test/win/linker-flags/subsystem-windows.cc new file mode 100644 index 000000000..ac99da808 --- /dev/null +++ b/tools/gyp/test/win/linker-flags/subsystem-windows.cc @@ -0,0 +1,9 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { + return 0; +} diff --git a/tools/gyp/test/win/linker-flags/subsystem.gyp b/tools/gyp/test/win/linker-flags/subsystem.gyp new file mode 100644 index 000000000..ec68e805c --- /dev/null +++ b/tools/gyp/test/win/linker-flags/subsystem.gyp @@ -0,0 +1,48 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_console_ok', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'SubSystem': '1' + } + }, + 'sources': ['hello.cc'], + }, + { + 'target_name': 'test_console_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'SubSystem': '1' + } + }, + 'sources': ['subsystem-windows.cc'], + }, + { + 'target_name': 'test_windows_ok', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'SubSystem': '2' + } + }, + 'sources': ['subsystem-windows.cc'], + }, + { + 'target_name': 'test_windows_fail', + 'type': 'executable', + 'msvs_settings': { + 'VCLinkerTool': { + 'SubSystem': '2' + } + }, + 'sources': ['hello.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/long-command-line/function.cc b/tools/gyp/test/win/long-command-line/function.cc new file mode 100644 index 000000000..af44b2cab --- /dev/null +++ b/tools/gyp/test/win/long-command-line/function.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int func() { + return 0; +} diff --git a/tools/gyp/test/win/long-command-line/hello.cc b/tools/gyp/test/win/long-command-line/hello.cc new file mode 100644 index 000000000..1711567ef --- /dev/null +++ b/tools/gyp/test/win/long-command-line/hello.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/long-command-line/long-command-line.gyp b/tools/gyp/test/win/long-command-line/long-command-line.gyp new file mode 100644 index 000000000..964c94fa9 --- /dev/null +++ b/tools/gyp/test/win/long-command-line/long-command-line.gyp @@ -0,0 +1,54 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'longexe', + 'type': 'executable', + 'msvs_settings': { + # Use this as a simple way to get a long command. + 'VCCLCompilerTool': { + 'AdditionalOptions': '/nologo ' * 8000, + }, + 'VCLinkerTool': { + 'AdditionalOptions': '/nologo ' * 8000, + }, + }, + 'sources': [ + 'hello.cc', + ], + }, + { + 'target_name': 'longlib', + 'type': 'static_library', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'AdditionalOptions': '/nologo ' * 8000, + }, + 'VCLibrarianTool': { + 'AdditionalOptions': '/nologo ' * 8000, + }, + }, + 'sources': [ + 'function.cc', + ], + }, + { + 'target_name': 'longdll', + 'type': 'shared_library', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'AdditionalOptions': '/nologo ' * 8000, + }, + 'VCLinkerTool': { + 'AdditionalOptions': '/nologo ' * 8000, + }, + }, + 'sources': [ + 'hello.cc', + ], + }, + ] +} diff --git a/tools/gyp/test/win/precompiled/gyptest-all.py b/tools/gyp/test/win/precompiled/gyptest-all.py new file mode 100644 index 000000000..9fb5e62ed --- /dev/null +++ b/tools/gyp/test/win/precompiled/gyptest-all.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verifies that precompiled headers can be specified. +""" + +import TestGyp + +import sys + +if sys.platform == 'win32': + test = TestGyp.TestGyp(formats=['msvs', 'ninja'], workdir='workarea_all') + test.run_gyp('hello.gyp') + test.build('hello.gyp', 'hello') + test.run_built_executable('hello', stdout="Hello, world!\nHello, two!\n") + test.up_to_date('hello.gyp', test.ALL) + test.pass_test() diff --git a/tools/gyp/test/win/precompiled/hello.c b/tools/gyp/test/win/precompiled/hello.c new file mode 100644 index 000000000..d1abbb9e5 --- /dev/null +++ b/tools/gyp/test/win/precompiled/hello.c @@ -0,0 +1,14 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +// Note the abscence of a stdio.h include. This will be inserted because of the +// precompiled header. + +extern int hello2(); + +int main(int argc, char *argv[]) { + printf("Hello, world!\n"); + hello2(); + return 0; +} diff --git a/tools/gyp/test/win/precompiled/hello.gyp b/tools/gyp/test/win/precompiled/hello.gyp new file mode 100644 index 000000000..5f82c5359 --- /dev/null +++ b/tools/gyp/test/win/precompiled/hello.gyp @@ -0,0 +1,28 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'hello', + 'type': 'executable', + 'sources': [ + 'hello.c', + 'hello2.c', + 'precomp.c', + ], + 'msvs_precompiled_header': 'stdio.h', + 'msvs_precompiled_source': 'precomp.c', + + # Required so that the printf actually causes a build failure + # if the pch isn't included. + 'msvs_settings': { + 'VCCLCompilerTool': { + 'WarningLevel': '3', + 'WarnAsError': 'true', + }, + }, + }, + ], +} diff --git a/tools/gyp/test/win/precompiled/hello2.c b/tools/gyp/test/win/precompiled/hello2.c new file mode 100644 index 000000000..d6d53111f --- /dev/null +++ b/tools/gyp/test/win/precompiled/hello2.c @@ -0,0 +1,13 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +// Unlike hello.c, this file specifies the headers. + +#include +#include + +int hello2() { + printf("Hello, two!\n"); + return 0; +} diff --git a/tools/gyp/test/win/precompiled/precomp.c b/tools/gyp/test/win/precompiled/precomp.c new file mode 100644 index 000000000..517c61a36 --- /dev/null +++ b/tools/gyp/test/win/precompiled/precomp.c @@ -0,0 +1,8 @@ +/* Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +// The precompiled header does not have to be the first one in the file. + +#include +#include diff --git a/tools/gyp/test/win/rc-build/Resource.h b/tools/gyp/test/win/rc-build/Resource.h new file mode 100644 index 000000000..137acf39b --- /dev/null +++ b/tools/gyp/test/win/rc-build/Resource.h @@ -0,0 +1,26 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by hello.rc +// + +#define IDS_APP_TITLE 103 + +#define IDR_MAINFRAME 128 +#define IDI_HELLO 107 +#define IDI_SMALL 108 +#define IDC_HELLO 109 +#ifndef IDC_STATIC +#define IDC_STATIC -1 +#endif +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS + +#define _APS_NO_MFC 130 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/tools/gyp/test/win/rc-build/hello.cpp b/tools/gyp/test/win/rc-build/hello.cpp new file mode 100644 index 000000000..f552ca159 --- /dev/null +++ b/tools/gyp/test/win/rc-build/hello.cpp @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#define WIN32_LEAN_AND_MEAN +#include +#include + +#include "resource.h" + +#define MAX_LOADSTRING 100 + +TCHAR szTitle[MAX_LOADSTRING]; +TCHAR szWindowClass[MAX_LOADSTRING]; + +int APIENTRY _tWinMain( + HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) { + // Make sure we can load some resources. + int count = 0; + LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + if (szTitle[0] != 0) ++count; + LoadString(hInstance, IDC_HELLO, szWindowClass, MAX_LOADSTRING); + if (szWindowClass[0] != 0) ++count; + if (LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SMALL)) != NULL) ++count; + if (LoadIcon(hInstance, MAKEINTRESOURCE(IDI_HELLO)) != NULL) ++count; + return count; +} diff --git a/tools/gyp/test/win/rc-build/hello.gyp b/tools/gyp/test/win/rc-build/hello.gyp new file mode 100644 index 000000000..8a0440976 --- /dev/null +++ b/tools/gyp/test/win/rc-build/hello.gyp @@ -0,0 +1,58 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'with_resources', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + 'VCResourceCompilerTool': { + 'Culture' : '1033', + }, + }, + 'sources': [ + 'hello.cpp', + 'hello.rc', + ], + }, + { + 'target_name': 'with_resources_subdir', + 'type': 'executable', + 'msvs_settings': { + 'VCCLCompilerTool': { + 'DebugInformationFormat': '3', + }, + 'VCLinkerTool': { + 'GenerateDebugInformation': 'true', + }, + 'VCResourceCompilerTool': { + 'Culture' : '1033', + }, + }, + 'sources': [ + 'hello.cpp', + 'subdir/hello2.rc', + ], + }, + { + 'target_name': 'resource_only_dll', + 'type': 'shared_library', + 'msvs_settings': { + 'VCLinkerTool': { + 'ResourceOnlyDLL': 'true', + }, + }, + 'sources': [ + 'hello.rc', + ], + }, + ], +} diff --git a/tools/gyp/test/win/rc-build/hello.h b/tools/gyp/test/win/rc-build/hello.h new file mode 100644 index 000000000..e60f2eb7e --- /dev/null +++ b/tools/gyp/test/win/rc-build/hello.h @@ -0,0 +1,3 @@ +#pragma once + +#include "resource.h" diff --git a/tools/gyp/test/win/rc-build/hello.ico b/tools/gyp/test/win/rc-build/hello.ico new file mode 100644 index 000000000..d551aa3aa Binary files /dev/null and b/tools/gyp/test/win/rc-build/hello.ico differ diff --git a/tools/gyp/test/win/rc-build/hello.rc b/tools/gyp/test/win/rc-build/hello.rc new file mode 100644 index 000000000..c9a7af6a0 --- /dev/null +++ b/tools/gyp/test/win/rc-build/hello.rc @@ -0,0 +1,86 @@ +//Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#ifndef APSTUDIO_INVOKED +#include "targetver.h" +#endif +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(932) + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. + +IDI_HELLO ICON "hello.ico" +IDI_SMALL ICON "small.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#ifndef APSTUDIO_INVOKED\r\n" + "#include ""targetver.h""\r\n" + "#endif\r\n" + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDC_HELLO "HELLO" + IDS_APP_TITLE "hello" +END + +#endif +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/tools/gyp/test/win/rc-build/small.ico b/tools/gyp/test/win/rc-build/small.ico new file mode 100644 index 000000000..d551aa3aa Binary files /dev/null and b/tools/gyp/test/win/rc-build/small.ico differ diff --git a/tools/gyp/test/win/rc-build/subdir/hello2.rc b/tools/gyp/test/win/rc-build/subdir/hello2.rc new file mode 100644 index 000000000..4c8eab109 --- /dev/null +++ b/tools/gyp/test/win/rc-build/subdir/hello2.rc @@ -0,0 +1,87 @@ +//Microsoft Visual C++ generated resource script. +// +#include "subdir/include.h" +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#ifndef APSTUDIO_INVOKED +#include "targetver.h" +#endif +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(932) + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. + +IDI_HELLO ICON "hello.ico" +IDI_SMALL ICON "small.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#ifndef APSTUDIO_INVOKED\r\n" + "#include ""targetver.h""\r\n" + "#endif\r\n" + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDC_HELLO "HELLO" + IDS_APP_TITLE "hello" +END + +#endif +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/tools/gyp/test/win/rc-build/subdir/include.h b/tools/gyp/test/win/rc-build/subdir/include.h new file mode 100644 index 000000000..f15c48b42 --- /dev/null +++ b/tools/gyp/test/win/rc-build/subdir/include.h @@ -0,0 +1 @@ +// Just exists to make sure it can be included. diff --git a/tools/gyp/test/win/rc-build/targetver.h b/tools/gyp/test/win/rc-build/targetver.h new file mode 100644 index 000000000..f583181df --- /dev/null +++ b/tools/gyp/test/win/rc-build/targetver.h @@ -0,0 +1,24 @@ +#pragma once + +// The following macros define the minimum required platform. The minimum required platform +// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run +// your application. The macros work by enabling all features available on platform versions up to and +// including the version specified. + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Specifies that the minimum required platform is Windows Vista. +#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. +#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. +#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. +#endif diff --git a/tools/gyp/test/win/uldi/a.cc b/tools/gyp/test/win/uldi/a.cc new file mode 100644 index 000000000..0fe05d5af --- /dev/null +++ b/tools/gyp/test/win/uldi/a.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int some_function() { + return 0; +} diff --git a/tools/gyp/test/win/uldi/b.cc b/tools/gyp/test/win/uldi/b.cc new file mode 100644 index 000000000..0fe05d5af --- /dev/null +++ b/tools/gyp/test/win/uldi/b.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int some_function() { + return 0; +} diff --git a/tools/gyp/test/win/uldi/main.cc b/tools/gyp/test/win/uldi/main.cc new file mode 100644 index 000000000..81b46d863 --- /dev/null +++ b/tools/gyp/test/win/uldi/main.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +extern int some_function(); + +int main() { + some_function(); + return 0; +} diff --git a/tools/gyp/test/win/uldi/uldi.gyp b/tools/gyp/test/win/uldi/uldi.gyp new file mode 100644 index 000000000..c32f5e095 --- /dev/null +++ b/tools/gyp/test/win/uldi/uldi.gyp @@ -0,0 +1,45 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'lib1', + 'type': 'static_library', + 'sources': ['a.cc'], + }, + { + 'target_name': 'final_uldi', + 'type': 'executable', + 'dependencies': [ + 'lib1', + 'lib2', + ], + 'msvs_settings': { + 'VCLinkerTool': { + 'UseLibraryDependencyInputs': 'true' + }, + }, + 'sources': ['main.cc'], + }, + { + 'target_name': 'final_no_uldi', + 'type': 'executable', + 'dependencies': [ + 'lib1', + 'lib2', + ], + 'sources': ['main.cc'], + }, + { + 'target_name': 'lib2', + 'type': 'static_library', + # b.cc has the same named function as a.cc, but don't use the same name + # so that the .obj will have a different name. If the obj file has the + # same name, the linker will discard the obj file, invalidating the + # test. + 'sources': ['b.cc'], + }, + ] +} diff --git a/tools/gyp/test/win/vs-macros/as.py b/tools/gyp/test/win/vs-macros/as.py new file mode 100644 index 000000000..e0bc3ae6f --- /dev/null +++ b/tools/gyp/test/win/vs-macros/as.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from optparse import OptionParser + +parser = OptionParser() +parser.add_option('-a', dest='platform') +parser.add_option('-o', dest='output') +parser.add_option('-p', dest='path') +(options, args) = parser.parse_args() + +f = open(options.output, 'w') +print >>f, 'options', options +print >>f, 'args', args +f.close() diff --git a/tools/gyp/test/win/vs-macros/containing-gyp.gyp b/tools/gyp/test/win/vs-macros/containing-gyp.gyp new file mode 100644 index 000000000..fa799a4e4 --- /dev/null +++ b/tools/gyp/test/win/vs-macros/containing-gyp.gyp @@ -0,0 +1,40 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_expansions', + 'msvs_cygwin_shell': 0, + 'type': 'none', + 'rules': [ + { + 'rule_name': 'assembler (gnu-compatible)', + 'msvs_cygwin_shell': 0, + 'msvs_quote_cmd': 0, + 'extension': 'S', + 'inputs': [ + 'as.py', + '$(InputPath)' + ], + 'outputs': [ + '$(IntDir)/$(InputName).obj', + ], + 'action': + ['python', + 'as.py', + '-a', '$(PlatformName)', + '-o', '$(IntDir)/$(InputName).obj', + '-p', '<(DEPTH)', + '$(InputPath)'], + 'message': 'Building assembly language file $(InputPath)', + 'process_outputs_as_sources': 1, + }, + ], + 'sources': [ + 'input.S', + ], + }, + ] +} diff --git a/tools/gyp/test/win/vs-macros/do_stuff.py b/tools/gyp/test/win/vs-macros/do_stuff.py new file mode 100644 index 000000000..4669d3139 --- /dev/null +++ b/tools/gyp/test/win/vs-macros/do_stuff.py @@ -0,0 +1,8 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +input = open(sys.argv[1], "r").read() +open(sys.argv[2], "w").write(input + "Modified.") diff --git a/tools/gyp/test/win/vs-macros/hello.cc b/tools/gyp/test/win/vs-macros/hello.cc new file mode 100644 index 000000000..1711567ef --- /dev/null +++ b/tools/gyp/test/win/vs-macros/hello.cc @@ -0,0 +1,7 @@ +// Copyright (c) 2012 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +int main() { + return 0; +} diff --git a/tools/gyp/test/win/vs-macros/input-output-macros.gyp b/tools/gyp/test/win/vs-macros/input-output-macros.gyp new file mode 100644 index 000000000..b7a3c1e3b --- /dev/null +++ b/tools/gyp/test/win/vs-macros/input-output-macros.gyp @@ -0,0 +1,33 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_expansions', + 'msvs_cygwin_shell': 0, + 'type': 'none', + 'rules': [ + { + 'rule_name': 'generate_file', + 'extension': 'blah', + 'inputs': [ + '<(RULE_INPUT_PATH)', + 'do_stuff.py', + ], + 'outputs': [ + '$(OutDir)\\<(RULE_INPUT_NAME).something', + ], + 'action': ['python', + 'do_stuff.py', + '<(RULE_INPUT_PATH)', + '$(OutDir)\\<(RULE_INPUT_NAME).something',], + }, + ], + 'sources': [ + 'stuff.blah', + ], + }, + ] +} diff --git a/tools/gyp/test/win/vs-macros/input.S b/tools/gyp/test/win/vs-macros/input.S new file mode 100644 index 000000000..e69de29bb diff --git a/tools/gyp/test/win/vs-macros/projectname.gyp b/tools/gyp/test/win/vs-macros/projectname.gyp new file mode 100644 index 000000000..625a17764 --- /dev/null +++ b/tools/gyp/test/win/vs-macros/projectname.gyp @@ -0,0 +1,29 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_expansions', + 'type': 'executable', + 'sources': ['hello.cc'], + 'msvs_settings': { + 'VCLinkerTool': { + 'OutputFile': '$(OutDir)\\$(ProjectName)_plus_something.exe', + }, + }, + }, + { + 'target_name': 'test_with_product_name', + 'product_name': 'prod_name', + 'type': 'executable', + 'sources': ['hello.cc'], + 'msvs_settings': { + 'VCLinkerTool': { + 'OutputFile': '$(OutDir)\\$(ProjectName)_plus_something.exe', + }, + }, + }, + ] +} diff --git a/tools/gyp/test/win/vs-macros/stuff.blah b/tools/gyp/test/win/vs-macros/stuff.blah new file mode 100644 index 000000000..d438b4a78 --- /dev/null +++ b/tools/gyp/test/win/vs-macros/stuff.blah @@ -0,0 +1 @@ +Random data file. diff --git a/tools/gyp/test/win/vs-macros/test_exists.py b/tools/gyp/test/win/vs-macros/test_exists.py new file mode 100644 index 000000000..f5c90ad6f --- /dev/null +++ b/tools/gyp/test/win/vs-macros/test_exists.py @@ -0,0 +1,10 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os +import sys + +if not os.path.exists(sys.argv[1]): + raise +open(sys.argv[2], 'w').close() diff --git a/tools/gyp/test/win/vs-macros/vcinstalldir.gyp b/tools/gyp/test/win/vs-macros/vcinstalldir.gyp new file mode 100644 index 000000000..3763a4eb1 --- /dev/null +++ b/tools/gyp/test/win/vs-macros/vcinstalldir.gyp @@ -0,0 +1,41 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'test_slash_trailing', + 'type': 'none', + 'msvs_cygwin_shell': '0', + 'actions': [ + { + 'action_name': 'root', + 'inputs': [], + 'outputs': ['out1'], + 'action': ['python', 'test_exists.py', '$(VCInstallDir)', 'out1'] + }, + ], + }, + { + 'target_name': 'test_slash_dir', + 'type': 'none', + 'msvs_cygwin_shell': '0', + 'actions': [ + { + 'action_name': 'bin', + 'inputs': [], + 'outputs': ['out2'], + 'action': ['python', 'test_exists.py', '$(VCInstallDir)bin', 'out2'], + }, + { + 'action_name': 'compiler', + 'inputs': [], + 'outputs': ['out3'], + 'action': [ + 'python', 'test_exists.py', '$(VCInstallDir)bin\\cl.exe', 'out3'], + }, + ], + }, + ] +} diff --git a/tools/gyp/tools/README b/tools/gyp/tools/README new file mode 100644 index 000000000..712e4efbb --- /dev/null +++ b/tools/gyp/tools/README @@ -0,0 +1,15 @@ +pretty_vcproj: + Usage: pretty_vcproj.py "c:\path\to\vcproj.vcproj" [key1=value1] [key2=value2] + + They key/value pair are used to resolve vsprops name. + + For example, if I want to diff the base.vcproj project: + + pretty_vcproj.py z:\dev\src-chrome\src\base\build\base.vcproj "$(SolutionDir)=z:\dev\src-chrome\src\chrome\\" "$(CHROMIUM_BUILD)=" "$(CHROME_BUILD_TYPE)=" > orignal.txt + pretty_vcproj.py z:\dev\src-chrome\src\base\base_gyp.vcproj "$(SolutionDir)=z:\dev\src-chrome\src\chrome\\" "$(CHROMIUM_BUILD)=" "$(CHROME_BUILD_TYPE)=" > gyp.txt + + And you can use your favorite diff tool to see the changes. + + Note: In the case of base.vcproj, the original vcproj is one level up the generated one. + I suggest you do a search and replace for '"..\' and replace it with '"' in original.txt + before you perform the diff. \ No newline at end of file diff --git a/tools/gyp/tools/Xcode/README b/tools/gyp/tools/Xcode/README new file mode 100644 index 000000000..2492a2c2f --- /dev/null +++ b/tools/gyp/tools/Xcode/README @@ -0,0 +1,5 @@ +Specifications contains syntax formatters for Xcode 3. These do not appear to be supported yet on Xcode 4. To use these with Xcode 3 please install both the gyp.pbfilespec and gyp.xclangspec files in + +~/Library/Application Support/Developer/Shared/Xcode/Specifications/ + +and restart Xcode. \ No newline at end of file diff --git a/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec b/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec new file mode 100644 index 000000000..85e2e268a --- /dev/null +++ b/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec @@ -0,0 +1,27 @@ +/* + gyp.pbfilespec + GYP source file spec for Xcode 3 + + There is not much documentation available regarding the format + of .pbfilespec files. As a starting point, see for instance the + outdated documentation at: + http://maxao.free.fr/xcode-plugin-interface/specifications.html + and the files in: + /Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/ + + Place this file in directory: + ~/Library/Application Support/Developer/Shared/Xcode/Specifications/ +*/ + +( + { + Identifier = sourcecode.gyp; + BasedOn = sourcecode; + Name = "GYP Files"; + Extensions = ("gyp", "gypi"); + MIMETypes = ("text/gyp"); + Language = "xcode.lang.gyp"; + IsTextFile = YES; + IsSourceFile = YES; + } +) diff --git a/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec b/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec new file mode 100644 index 000000000..3b3506d31 --- /dev/null +++ b/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec @@ -0,0 +1,226 @@ +/* + Copyright (c) 2011 Google Inc. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. + + gyp.xclangspec + GYP language specification for Xcode 3 + + There is not much documentation available regarding the format + of .xclangspec files. As a starting point, see for instance the + outdated documentation at: + http://maxao.free.fr/xcode-plugin-interface/specifications.html + and the files in: + /Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/ + + Place this file in directory: + ~/Library/Application Support/Developer/Shared/Xcode/Specifications/ +*/ + +( + + { + Identifier = "xcode.lang.gyp.keyword"; + Syntax = { + Words = ( + "and", + "or", + " "%s"' % (src, dst) + + print '}' + + +def main(): + if len(sys.argv) < 2: + print >>sys.stderr, __doc__ + print >>sys.stderr + print >>sys.stderr, 'usage: %s target1 target2...' % (sys.argv[0]) + return 1 + + edges = LoadEdges('dump.json', sys.argv[1:]) + + WriteGraph(edges) + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/tools/gyp/tools/pretty_gyp.py b/tools/gyp/tools/pretty_gyp.py new file mode 100755 index 000000000..c51d35872 --- /dev/null +++ b/tools/gyp/tools/pretty_gyp.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Pretty-prints the contents of a GYP file.""" + +import sys +import re + + +# Regex to remove comments when we're counting braces. +COMMENT_RE = re.compile(r'\s*#.*') + +# Regex to remove quoted strings when we're counting braces. +# It takes into account quoted quotes, and makes sure that the quotes match. +# NOTE: It does not handle quotes that span more than one line, or +# cases where an escaped quote is preceeded by an escaped backslash. +QUOTE_RE_STR = r'(?P[\'"])(.*?)(? 0: + after = True + + # This catches the special case of a closing brace having something + # other than just whitespace ahead of it -- we don't want to + # unindent that until after this line is printed so it stays with + # the previous indentation level. + if cnt < 0 and closing_prefix_re.match(stripline): + after = True + return (cnt, after) + + +def prettyprint_input(lines): + """Does the main work of indenting the input based on the brace counts.""" + indent = 0 + basic_offset = 2 + last_line = "" + for line in lines: + if COMMENT_RE.match(line): + print line + else: + line = line.strip('\r\n\t ') # Otherwise doesn't strip \r on Unix. + if len(line) > 0: + (brace_diff, after) = count_braces(line) + if brace_diff != 0: + if after: + print " " * (basic_offset * indent) + line + indent += brace_diff + else: + indent += brace_diff + print " " * (basic_offset * indent) + line + else: + print " " * (basic_offset * indent) + line + else: + print "" + last_line = line + + +def main(): + if len(sys.argv) > 1: + data = open(sys.argv[1]).read().splitlines() + else: + data = sys.stdin.read().splitlines() + # Split up the double braces. + lines = split_double_braces(data) + + # Indent and print the output. + prettyprint_input(lines) + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/tools/gyp/tools/pretty_sln.py b/tools/gyp/tools/pretty_sln.py new file mode 100755 index 000000000..3195d8581 --- /dev/null +++ b/tools/gyp/tools/pretty_sln.py @@ -0,0 +1,168 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Prints the information in a sln file in a diffable way. + + It first outputs each projects in alphabetical order with their + dependencies. + + Then it outputs a possible build order. +""" + +__author__ = 'nsylvain (Nicolas Sylvain)' + +import os +import re +import sys +import pretty_vcproj + +def BuildProject(project, built, projects, deps): + # if all dependencies are done, we can build it, otherwise we try to build the + # dependency. + # This is not infinite-recursion proof. + for dep in deps[project]: + if dep not in built: + BuildProject(dep, built, projects, deps) + print project + built.append(project) + +def ParseSolution(solution_file): + # All projects, their clsid and paths. + projects = dict() + + # A list of dependencies associated with a project. + dependencies = dict() + + # Regular expressions that matches the SLN format. + # The first line of a project definition. + begin_project = re.compile(('^Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942' + '}"\) = "(.*)", "(.*)", "(.*)"$')) + # The last line of a project definition. + end_project = re.compile('^EndProject$') + # The first line of a dependency list. + begin_dep = re.compile('ProjectSection\(ProjectDependencies\) = postProject$') + # The last line of a dependency list. + end_dep = re.compile('EndProjectSection$') + # A line describing a dependency. + dep_line = re.compile(' *({.*}) = ({.*})$') + + in_deps = False + solution = open(solution_file) + for line in solution: + results = begin_project.search(line) + if results: + # Hack to remove icu because the diff is too different. + if results.group(1).find('icu') != -1: + continue + # We remove "_gyp" from the names because it helps to diff them. + current_project = results.group(1).replace('_gyp', '') + projects[current_project] = [results.group(2).replace('_gyp', ''), + results.group(3), + results.group(2)] + dependencies[current_project] = [] + continue + + results = end_project.search(line) + if results: + current_project = None + continue + + results = begin_dep.search(line) + if results: + in_deps = True + continue + + results = end_dep.search(line) + if results: + in_deps = False + continue + + results = dep_line.search(line) + if results and in_deps and current_project: + dependencies[current_project].append(results.group(1)) + continue + + # Change all dependencies clsid to name instead. + for project in dependencies: + # For each dependencies in this project + new_dep_array = [] + for dep in dependencies[project]: + # Look for the project name matching this cldis + for project_info in projects: + if projects[project_info][1] == dep: + new_dep_array.append(project_info) + dependencies[project] = sorted(new_dep_array) + + return (projects, dependencies) + +def PrintDependencies(projects, deps): + print "---------------------------------------" + print "Dependencies for all projects" + print "---------------------------------------" + print "-- --" + + for (project, dep_list) in sorted(deps.items()): + print "Project : %s" % project + print "Path : %s" % projects[project][0] + if dep_list: + for dep in dep_list: + print " - %s" % dep + print "" + + print "-- --" + +def PrintBuildOrder(projects, deps): + print "---------------------------------------" + print "Build order " + print "---------------------------------------" + print "-- --" + + built = [] + for (project, _) in sorted(deps.items()): + if project not in built: + BuildProject(project, built, projects, deps) + + print "-- --" + +def PrintVCProj(projects): + + for project in projects: + print "-------------------------------------" + print "-------------------------------------" + print project + print project + print project + print "-------------------------------------" + print "-------------------------------------" + + project_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[1]), + projects[project][2])) + + pretty = pretty_vcproj + argv = [ '', + project_path, + '$(SolutionDir)=%s\\' % os.path.dirname(sys.argv[1]), + ] + argv.extend(sys.argv[3:]) + pretty.main(argv) + +def main(): + # check if we have exactly 1 parameter. + if len(sys.argv) < 2: + print 'Usage: %s "c:\\path\\to\\project.sln"' % sys.argv[0] + return 1 + + (projects, deps) = ParseSolution(sys.argv[1]) + PrintDependencies(projects, deps) + PrintBuildOrder(projects, deps) + + if '--recursive' in sys.argv: + PrintVCProj(projects) + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/tools/gyp/tools/pretty_vcproj.py b/tools/gyp/tools/pretty_vcproj.py new file mode 100755 index 000000000..6099bd7cc --- /dev/null +++ b/tools/gyp/tools/pretty_vcproj.py @@ -0,0 +1,329 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Make the format of a vcproj really pretty. + + This script normalize and sort an xml. It also fetches all the properties + inside linked vsprops and include them explicitly in the vcproj. + + It outputs the resulting xml to stdout. +""" + +__author__ = 'nsylvain (Nicolas Sylvain)' + +import os +import sys + +from xml.dom.minidom import parse +from xml.dom.minidom import Node + +REPLACEMENTS = dict() +ARGUMENTS = None + + +class CmpTuple(object): + """Compare function between 2 tuple.""" + def __call__(self, x, y): + return cmp(x[0], y[0]) + + +class CmpNode(object): + """Compare function between 2 xml nodes.""" + + def __call__(self, x, y): + def get_string(node): + node_string = "node" + node_string += node.nodeName + if node.nodeValue: + node_string += node.nodeValue + + if node.attributes: + # We first sort by name, if present. + node_string += node.getAttribute("Name") + + all_nodes = [] + for (name, value) in node.attributes.items(): + all_nodes.append((name, value)) + + all_nodes.sort(CmpTuple()) + for (name, value) in all_nodes: + node_string += name + node_string += value + + return node_string + + return cmp(get_string(x), get_string(y)) + + +def PrettyPrintNode(node, indent=0): + if node.nodeType == Node.TEXT_NODE: + if node.data.strip(): + print '%s%s' % (' '*indent, node.data.strip()) + return + + if node.childNodes: + node.normalize() + # Get the number of attributes + attr_count = 0 + if node.attributes: + attr_count = node.attributes.length + + # Print the main tag + if attr_count == 0: + print '%s<%s>' % (' '*indent, node.nodeName) + else: + print '%s<%s' % (' '*indent, node.nodeName) + + all_attributes = [] + for (name, value) in node.attributes.items(): + all_attributes.append((name, value)) + all_attributes.sort(CmpTuple()) + for (name, value) in all_attributes: + print '%s %s="%s"' % (' '*indent, name, value) + print '%s>' % (' '*indent) + if node.nodeValue: + print '%s %s' % (' '*indent, node.nodeValue) + + for sub_node in node.childNodes: + PrettyPrintNode(sub_node, indent=indent+2) + print '%s' % (' '*indent, node.nodeName) + + +def FlattenFilter(node): + """Returns a list of all the node and sub nodes.""" + node_list = [] + + if (node.attributes and + node.getAttribute('Name') == '_excluded_files'): + # We don't add the "_excluded_files" filter. + return [] + + for current in node.childNodes: + if current.nodeName == 'Filter': + node_list.extend(FlattenFilter(current)) + else: + node_list.append(current) + + return node_list + + +def FixFilenames(filenames, current_directory): + new_list = [] + for filename in filenames: + if filename: + for key in REPLACEMENTS: + filename = filename.replace(key, REPLACEMENTS[key]) + os.chdir(current_directory) + filename = filename.strip('"\' ') + if filename.startswith('$'): + new_list.append(filename) + else: + new_list.append(os.path.abspath(filename)) + return new_list + + +def AbsoluteNode(node): + """Makes all the properties we know about in this node absolute.""" + if node.attributes: + for (name, value) in node.attributes.items(): + if name in ['InheritedPropertySheets', 'RelativePath', + 'AdditionalIncludeDirectories', + 'IntermediateDirectory', 'OutputDirectory', + 'AdditionalLibraryDirectories']: + # We want to fix up these paths + path_list = value.split(';') + new_list = FixFilenames(path_list, os.path.dirname(ARGUMENTS[1])) + node.setAttribute(name, ';'.join(new_list)) + if not value: + node.removeAttribute(name) + + +def CleanupVcproj(node): + """For each sub node, we call recursively this function.""" + for sub_node in node.childNodes: + AbsoluteNode(sub_node) + CleanupVcproj(sub_node) + + # Normalize the node, and remove all extranous whitespaces. + for sub_node in node.childNodes: + if sub_node.nodeType == Node.TEXT_NODE: + sub_node.data = sub_node.data.replace("\r", "") + sub_node.data = sub_node.data.replace("\n", "") + sub_node.data = sub_node.data.rstrip() + + # Fix all the semicolon separated attributes to be sorted, and we also + # remove the dups. + if node.attributes: + for (name, value) in node.attributes.items(): + sorted_list = sorted(value.split(';')) + unique_list = [] + for i in sorted_list: + if not unique_list.count(i): + unique_list.append(i) + node.setAttribute(name, ';'.join(unique_list)) + if not value: + node.removeAttribute(name) + + if node.childNodes: + node.normalize() + + # For each node, take a copy, and remove it from the list. + node_array = [] + while node.childNodes and node.childNodes[0]: + # Take a copy of the node and remove it from the list. + current = node.childNodes[0] + node.removeChild(current) + + # If the child is a filter, we want to append all its children + # to this same list. + if current.nodeName == 'Filter': + node_array.extend(FlattenFilter(current)) + else: + node_array.append(current) + + + # Sort the list. + node_array.sort(CmpNode()) + + # Insert the nodes in the correct order. + for new_node in node_array: + # But don't append empty tool node. + if new_node.nodeName == 'Tool': + if new_node.attributes and new_node.attributes.length == 1: + # This one was empty. + continue + if new_node.nodeName == 'UserMacro': + continue + node.appendChild(new_node) + + +def GetConfiguationNodes(vcproj): + #TODO(nsylvain): Find a better way to navigate the xml. + nodes = [] + for node in vcproj.childNodes: + if node.nodeName == "Configurations": + for sub_node in node.childNodes: + if sub_node.nodeName == "Configuration": + nodes.append(sub_node) + + return nodes + + +def GetChildrenVsprops(filename): + dom = parse(filename) + if dom.documentElement.attributes: + vsprops = dom.documentElement.getAttribute('InheritedPropertySheets') + return FixFilenames(vsprops.split(';'), os.path.dirname(filename)) + return [] + +def SeekToNode(node1, child2): + # A text node does not have properties. + if child2.nodeType == Node.TEXT_NODE: + return None + + # Get the name of the current node. + current_name = child2.getAttribute("Name") + if not current_name: + # There is no name. We don't know how to merge. + return None + + # Look through all the nodes to find a match. + for sub_node in node1.childNodes: + if sub_node.nodeName == child2.nodeName: + name = sub_node.getAttribute("Name") + if name == current_name: + return sub_node + + # No match. We give up. + return None + + +def MergeAttributes(node1, node2): + # No attributes to merge? + if not node2.attributes: + return + + for (name, value2) in node2.attributes.items(): + # Don't merge the 'Name' attribute. + if name == 'Name': + continue + value1 = node1.getAttribute(name) + if value1: + # The attribute exist in the main node. If it's equal, we leave it + # untouched, otherwise we concatenate it. + if value1 != value2: + node1.setAttribute(name, ';'.join([value1, value2])) + else: + # The attribute does nto exist in the main node. We append this one. + node1.setAttribute(name, value2) + + # If the attribute was a property sheet attributes, we remove it, since + # they are useless. + if name == 'InheritedPropertySheets': + node1.removeAttribute(name) + + +def MergeProperties(node1, node2): + MergeAttributes(node1, node2) + for child2 in node2.childNodes: + child1 = SeekToNode(node1, child2) + if child1: + MergeProperties(child1, child2) + else: + node1.appendChild(child2.cloneNode(True)) + + +def main(argv): + """Main function of this vcproj prettifier.""" + global ARGUMENTS + ARGUMENTS = argv + + # check if we have exactly 1 parameter. + if len(argv) < 2: + print ('Usage: %s "c:\\path\\to\\vcproj.vcproj" [key1=value1] ' + '[key2=value2]' % argv[0]) + return 1 + + # Parse the keys + for i in range(2, len(argv)): + (key, value) = argv[i].split('=') + REPLACEMENTS[key] = value + + # Open the vcproj and parse the xml. + dom = parse(argv[1]) + + # First thing we need to do is find the Configuration Node and merge them + # with the vsprops they include. + for configuration_node in GetConfiguationNodes(dom.documentElement): + # Get the property sheets associated with this configuration. + vsprops = configuration_node.getAttribute('InheritedPropertySheets') + + # Fix the filenames to be absolute. + vsprops_list = FixFilenames(vsprops.strip().split(';'), + os.path.dirname(argv[1])) + + # Extend the list of vsprops with all vsprops contained in the current + # vsprops. + for current_vsprops in vsprops_list: + vsprops_list.extend(GetChildrenVsprops(current_vsprops)) + + # Now that we have all the vsprops, we need to merge them. + for current_vsprops in vsprops_list: + MergeProperties(configuration_node, + parse(current_vsprops).documentElement) + + # Now that everything is merged, we need to cleanup the xml. + CleanupVcproj(dom.documentElement) + + # Finally, we use the prett xml function to print the vcproj back to the + # user. + #print dom.toprettyxml(newl="\n") + PrettyPrintNode(dom.documentElement) + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/tools/gyp_cef b/tools/gyp_cef new file mode 100644 index 000000000..bee642d8f --- /dev/null +++ b/tools/gyp_cef @@ -0,0 +1,155 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 The Chromium Embedded Framework Authors. +# Portions copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This script is wrapper for CEF/Chromium that adds some support for how GYP +# is invoked by Chromium beyond what can be done in the gclient hooks. + +import glob +import os +import shlex +import subprocess +import sys + +# The CEF root directory is the parent directory of _this_ script. +cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) + +# The Chromium source directory is the parent directory of CEF. +chrome_src = os.path.abspath(os.path.join(cef_dir, 'chromium')) + +sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) +import gyp + +# Add paths so that pymod_do_main(grit_info ...) can import files. +sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit')) +sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build')) + + +# On Windows, Psyco shortens warm runs of build/gyp_chromium by about +# 20 seconds on a z600 machine with 12 GB of RAM, from 90 down to 70 +# seconds. Conversely, memory usage of build/gyp_chromium with Psyco +# maxes out at about 158 MB vs. 132 MB without it. +# +# Psyco uses native libraries, so we need to load a different +# installation depending on which OS we are running under. It has not +# been tested whether using Psyco on our Mac and Linux builds is worth +# it (the GYP running time is a lot shorter, so the JIT startup cost +# may not be worth it). +if sys.platform == 'win32': + try: + sys.path.insert(0, os.path.join(chrome_src, 'third_party', 'psyco_win32')) + import psyco + except: + psyco = None +else: + psyco = None + +def apply_gyp_environment(file_path=None): + """ + Reads in a *.gyp_env file and applies the valid keys to os.environ. + """ + if not file_path or not os.path.exists(file_path): + return + file_contents = open(file_path).read() + try: + file_data = eval(file_contents, {'__builtins__': None}, None) + except SyntaxError, e: + e.filename = os.path.abspath(file_path) + raise + supported_vars = ( 'CHROMIUM_GYP_SYNTAX_CHECK', + 'GYP_DEFINES', + 'GYP_GENERATOR_FLAGS', + 'GYP_GENERATOR_OUTPUT', ) + for var in supported_vars: + val = file_data.get(var) + if val: + if var in os.environ: + print 'INFO: Environment value for "%s" overrides value in %s.' % ( + var, os.path.abspath(file_path) + ) + else: + os.environ[var] = val + +def additional_include_files(args=[]): + """ + Returns a list of additional (.gypi) files to include, without + duplicating ones that are already specified on the command line. + """ + # Determine the include files specified on the command line. + # This doesn't cover all the different option formats you can use, + # but it's mainly intended to avoid duplicating flags on the automatic + # makefile regeneration which only uses this format. + specified_includes = set() + for arg in args: + if arg.startswith('-I') and len(arg) > 2: + specified_includes.add(os.path.realpath(arg[2:])) + + result = [] + def AddInclude(path): + if os.path.realpath(path) not in specified_includes: + result.append(path) + + # Always include common.gypi. + AddInclude(os.path.join(chrome_src, 'build', 'common.gypi')) + + # Optionally add supplemental .gypi files if present. + supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi')) + for supplement in supplements: + AddInclude(supplement) + + return result + +if __name__ == '__main__': + args = sys.argv[1:] + + # Use the Psyco JIT if available. + if psyco: + psyco.profile() + print "Enabled Psyco JIT." + + # Fall back on hermetic python if we happen to get run under cygwin. + # TODO(bradnelson): take this out once this issue is fixed: + # http://code.google.com/p/gyp/issues/detail?id=177 + if sys.platform == 'cygwin': + python_dir = os.path.join(chrome_src, 'third_party', 'python_26') + env = os.environ.copy() + env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') + p = subprocess.Popen( + [os.path.join(python_dir, 'python.exe')] + sys.argv, + env=env, shell=False) + p.communicate() + sys.exit(p.returncode) + + if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ: + # Update the environment based on chromium.gyp_env + gyp_env_path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env') + apply_gyp_environment(gyp_env_path) + + args.extend(['-I' + i for i in additional_include_files(args)]) + + # There shouldn't be a circular dependency relationship between .gyp files, + # but in Chromium's .gyp files, on non-Mac platforms, circular relationships + # currently exist. The check for circular dependencies is currently + # bypassed on other platforms, but is left enabled on the Mac, where a + # violation of the rule causes Xcode to misbehave badly. + # TODO(mark): Find and kill remaining circular dependencies, and remove this + # option. http://crbug.com/35878. + # TODO(tc): Fix circular dependencies in ChromiumOS then add linux2 to the + # list. + if sys.platform not in ('darwin',): + args.append('--no-circular-check') + + # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check + # to enfore syntax checking. + syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') + if syntax_check and int(syntax_check): + args.append('--check') + + print 'Updating projects from gyp files...' + sys.stdout.flush() + + # Off we go... + sys.exit(gyp.main(args)) diff --git a/tools/make_capi_header.py b/tools/make_capi_header.py new file mode 100644 index 000000000..b0b667a59 --- /dev/null +++ b/tools/make_capi_header.py @@ -0,0 +1,174 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +from cef_parser import * +from date_util import * + +def make_capi_global_funcs(funcs, defined_names, translate_map, indent): + result = '' + first = True + for func in funcs: + comment = func.get_comment() + if first or len(comment) > 0: + result += '\n'+format_comment(comment, indent, translate_map); + if func.get_retval().get_type().is_result_string(): + result += indent+'// The resulting string must be freed by calling cef_string_userfree_free().\n' + result += wrap_code(indent+'CEF_EXPORT '+ + func.get_capi_proto(defined_names)+';') + if first: + first = False + return result + +def make_capi_member_funcs(funcs, defined_names, translate_map, indent): + result = '' + first = True + for func in funcs: + comment = func.get_comment() + if first or len(comment) > 0: + result += '\n'+format_comment(comment, indent, translate_map) + if func.get_retval().get_type().is_result_string(): + result += indent+'// The resulting string must be freed by calling cef_string_userfree_free().\n' + parts = func.get_capi_parts() + result += wrap_code(indent+parts['retval']+' (CEF_CALLBACK *'+ + parts['name']+')('+ + string.join(parts['args'], ', ')+');') + if first: + first = False + return result + +def make_capi_header(header, filename): + # structure names that have already been defined + defined_names = header.get_defined_structs() + + # map of strings that will be changed in C++ comments + translate_map = header.get_capi_translations() + + # header string + result = \ +"""// Copyright (c) $YEAR$ Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file was generated by the CEF translator tool and should not edited +// by hand. See the translator.README.txt file in the tools directory for +// more information. +// + +#ifndef $GUARD$ +#define $GUARD$ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include "include/capi/cef_base_capi.h" + +""" + # output global functions + funcs = header.get_funcs(filename) + if len(funcs) > 0: + result += make_capi_global_funcs(funcs, defined_names, translate_map, '') + + # output classes + classes = header.get_classes(filename) + for cls in classes: + # virtual functions are inside the structure + classname = cls.get_capi_name() + result += '\n'+format_comment(cls.get_comment(), '', translate_map); + result += 'typedef struct _'+classname+ \ + ' {\n ///\n // Base structure.\n ///\n cef_base_t base;\n' + funcs = cls.get_virtual_funcs() + result += make_capi_member_funcs(funcs, defined_names, + translate_map, ' ') + result += '} '+classname+';\n\n' + + defined_names.append(cls.get_capi_name()) + + # static functions become global + funcs = cls.get_static_funcs() + if len(funcs) > 0: + result += make_capi_global_funcs(funcs, defined_names, + translate_map, '')+'\n' + + # footer string + result += \ +""" +#ifdef __cplusplus +} +#endif + +#endif // $GUARD$ +""" + + # add the copyright year + result = result.replace('$YEAR$', get_year()) + # add the guard string + guard = 'CEF_INCLUDE_CAPI_'+string.upper(filename.replace('.', '_capi_'))+'_' + result = result.replace('$GUARD$', guard) + + return result + + +def write_capi_header(header, filepath, backup): + capi_path = get_capi_file_name(filepath) + if path_exists(capi_path): + oldcontents = read_file(capi_path) + else: + oldcontents = '' + + filename = os.path.split(filepath)[1] + newcontents = make_capi_header(header, filename) + if newcontents != oldcontents: + if backup and oldcontents != '': + backup_file(capi_path) + write_file(capi_path, newcontents) + return True + + return False + + +# test the module +if __name__ == "__main__": + import sys + + # verify that the correct number of command-line arguments are provided + if len(sys.argv) < 2: + sys.stderr.write('Usage: '+sys.argv[0]+' ') + sys.exit() + + # create the header object + header = obj_header() + header.add_file(sys.argv[1]) + + # dump the result to stdout + filename = os.path.split(sys.argv[1])[1] + sys.stdout.write(make_capi_header(header, filename)) diff --git a/tools/make_capi_header.pyc b/tools/make_capi_header.pyc new file mode 100644 index 000000000..3ecc26e52 Binary files /dev/null and b/tools/make_capi_header.pyc differ diff --git a/tools/make_cppdocs.bat b/tools/make_cppdocs.bat new file mode 100644 index 000000000..279436074 --- /dev/null +++ b/tools/make_cppdocs.bat @@ -0,0 +1,18 @@ +@echo off +setlocal + +if "%1"=="" ( +set CPPDOC_EXE="C:\Program Files (x86)\richfeit\CppDoc\CppDoc.exe" +set CPPDOC_REV="XXX" +) else ( +set CPPDOC_EXE="C:\Program Files (x86)\richfeit\CppDoc\cppdoc_cmd.exe" +set CPPDOC_REV="%1" +) + +if not exist %CPPDOC_EXE% ( +echo ERROR: Please install CppDoc from http://www.cppdoc.com/ +) else ( +%CPPDOC_EXE% -overwrite -title="CEF3 C++ API Docs - Revision %CPPDOC_REV%" -footer="
    Chromium Embedded Framework (CEF) Copyright © 2012 Marshall A. Greenblatt
    " -namespace-as-project -comment-format="///;//;///" -classdir=projects -module="cppdoc-standard" -extensions=h -languages="c=cpp,cc=cpp,cpp=cpp,cs=csharp,cxx=cpp,h=cpp,hpp=cpp,hxx=cpp,java=java" -D"OS_WIN" -D"USING_CEF_SHARED" -D"__cplusplus" -D"CEF_STRING_TYPE_UTF16" -enable-author=false -enable-deprecations=true -enable-since=true -enable-version=false -file-links-for-globals=false -generate-deprecations-list=false -generate-hierarchy=true -header-background-dark="#ccccff" -header-background-light="#eeeeff" -include-private=false -include-protected=true -index-file-base=index -overview-html=overview.html -reduce-summary-font=true -selected-text-background=navy -selected-text-foreground=white -separate-index-pages=false -show-cppdoc-version=false -show-timestamp=false -summary-html=project.html -suppress-details=false -suppress-frames-links=false -table-background=white -wrap-long-lines=false ..\include #cef_runnable.h #cef_tuple.h #capi "..\docs\index.html" +) + +endlocal \ No newline at end of file diff --git a/tools/make_cpptoc_header.py b/tools/make_cpptoc_header.py new file mode 100644 index 000000000..4f930e224 --- /dev/null +++ b/tools/make_cpptoc_header.py @@ -0,0 +1,106 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +from cef_parser import * + +def make_cpptoc_header(header, clsname): + cls = header.get_class(clsname) + if cls is None: + raise Exception('Class does not exist: '+clsname) + + dllside = cls.is_library_side() + defname = string.upper(get_capi_name(clsname[3:], False)) + capiname = cls.get_capi_name() + + result = get_copyright() + + result += '#ifndef CEF_LIBCEF_DLL_CPPTOC_'+defname+'_CPPTOC_H_\n'+ \ + '#define CEF_LIBCEF_DLL_CPPTOC_'+defname+'_CPPTOC_H_\n' + \ + '#pragma once\n' + + if dllside: + result += """ +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED +""" + else: + result += """ +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED +""" + + # include the headers for this class + result += '\n#include "include/'+cls.get_file_name()+'"\n' \ + '#include "include/capi/'+cls.get_capi_file_name()+'"\n' + + # include headers for any forward declared classes that are not in the same file + declares = cls.get_forward_declares() + for declare in declares: + dcls = header.get_class(declare) + if dcls.get_file_name() != cls.get_file_name(): + result += '#include "include/'+dcls.get_file_name()+'"\n' \ + '#include "include/capi/'+dcls.get_capi_file_name()+'"\n' + + result += """#include "libcef_dll/cpptoc/cpptoc.h" + +// Wrap a C++ class with a C structure. +""" + + if dllside: + result += '// This class may be instantiated and accessed DLL-side only.\n' + else: + result += '// This class may be instantiated and accessed wrapper-side only.\n' + + result += 'class '+clsname+'CppToC\n'+ \ + ' : public CefCppToC<'+clsname+'CppToC, '+clsname+', '+capiname+'> {\n'+ \ + ' public:\n'+ \ + ' explicit '+clsname+'CppToC('+clsname+'* cls);\n'+ \ + ' virtual ~'+clsname+'CppToC() {}\n'+ \ + '};\n\n' + + if dllside: + result += '#endif // BUILDING_CEF_SHARED\n' + else: + result += '#endif // USING_CEF_SHARED\n' + + result += '#endif // CEF_LIBCEF_DLL_CPPTOC_'+defname+'_CPPTOC_H_\n' + + return wrap_code(result) + + +def write_cpptoc_header(header, clsname, dir, backup): + file = dir+os.sep+get_capi_name(clsname[3:], False)+'_cpptoc.h' + + if path_exists(file): + oldcontents = read_file(file) + else: + oldcontents = '' + + newcontents = make_cpptoc_header(header, clsname) + if newcontents != oldcontents: + if backup and oldcontents != '': + backup_file(file) + write_file(file, newcontents) + return True + + return False + + +# test the module +if __name__ == "__main__": + import sys + + # verify that the correct number of command-line arguments are provided + if len(sys.argv) < 3: + sys.stderr.write('Usage: '+sys.argv[0]+' ') + sys.exit() + + # create the header object + header = obj_header() + header.add_file(sys.argv[1]) + + # dump the result to stdout + sys.stdout.write(make_cpptoc_header(header, sys.argv[2])) diff --git a/tools/make_cpptoc_header.pyc b/tools/make_cpptoc_header.pyc new file mode 100644 index 000000000..c91a88673 Binary files /dev/null and b/tools/make_cpptoc_header.pyc differ diff --git a/tools/make_cpptoc_impl.py b/tools/make_cpptoc_impl.py new file mode 100644 index 000000000..0872b362e --- /dev/null +++ b/tools/make_cpptoc_impl.py @@ -0,0 +1,563 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +from cef_parser import * + +def make_cpptoc_impl_proto(name, func, parts): + if isinstance(func, obj_function_virtual): + proto = parts['retval']+' CEF_CALLBACK' + else: + proto = 'CEF_EXPORT '+parts['retval'] + + proto += ' '+name+'('+string.join(parts['args'], ', ')+')' + return proto + +def make_cpptoc_function_impl_existing(name, func, impl, defined_names): + notify(name+' has manual edits') + + # retrieve the C API prototype parts + parts = func.get_capi_parts(defined_names) + + changes = format_translation_changes(impl, parts) + if len(changes) > 0: + notify(name+' prototype changed') + + return wrap_code(make_cpptoc_impl_proto(name, func, parts))+'{'+ \ + changes+impl['body']+'\n}\n' + return result + +def make_cpptoc_function_impl_new(name, func, defined_names): + # retrieve the C API prototype parts + parts = func.get_capi_parts(defined_names) + result = make_cpptoc_impl_proto(name, func, parts)+' {' + + invalid = [] + + # retrieve the function arguments + args = func.get_arguments() + + # determine the argument types + for arg in args: + if arg.get_arg_type() == 'invalid': + invalid.append(arg.get_name()) + + # retrieve the function return value + retval = func.get_retval() + retval_type = retval.get_retval_type() + if retval_type == 'invalid': + invalid.append('(return value)') + retval_default = '' + else: + retval_default = retval.get_retval_default(True) + if len(retval_default) > 0: + retval_default = ' '+retval_default; + + if len(invalid) > 0: + notify(name+' could not be autogenerated') + # code could not be auto-generated + result += '\n // BEGIN DELETE BEFORE MODIFYING' + result += '\n // AUTO-GENERATED CONTENT' + result += '\n // COULD NOT IMPLEMENT DUE TO: '+string.join(invalid, ', ') + result += '\n #pragma message("Warning: "__FILE__": '+name+' is not implemented")' + result += '\n // END DELETE BEFORE MODIFYING' + result += '\n}\n\n' + return wrap_code(result) + + result += '\n // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING\n' + + result_len = len(result) + + optional = [] + + # parameter verification + if isinstance(func, obj_function_virtual): + result += '\n DCHECK(self);'\ + '\n if (!self)'\ + '\n return'+retval_default+';' + + for arg in args: + arg_type = arg.get_arg_type() + arg_name = arg.get_type().get_name() + + # skip optional params + optional_params = arg.parent.get_attrib_list('optional_param') + if not optional_params is None and arg_name in optional_params: + optional.append(arg_name) + continue + + comment = '\n // Verify param: '+arg_name+'; type: '+arg_type + + if arg_type == 'simple_byref' or arg_type == 'simple_byref_const' or \ + arg_type == 'simple_byaddr' or arg_type == 'bool_byref' or arg_type == 'bool_byaddr' or \ + arg_type == 'struct_byref_const' or arg_type == 'struct_byref' or \ + arg_type == 'string_byref_const' or arg_type == 'string_byref' or \ + arg_type == 'refptr_same' or arg_type == 'refptr_same_byref' or \ + arg_type == 'refptr_diff' or arg_type == 'refptr_diff_byref' or \ + arg_type == 'string_vec_byref' or arg_type == 'string_vec_byref_const' or \ + arg_type == 'string_map_single_byref' or arg_type == 'string_map_single_byref_const' or \ + arg_type == 'string_map_multi_byref' or arg_type == 'string_map_multi_byref_const': + result += comment+\ + '\n DCHECK('+arg_name+');'\ + '\n if (!'+arg_name+')'\ + '\n return'+retval_default+';' + elif arg_type == 'simple_vec_byref' or arg_type == 'bool_vec_byref' or \ + arg_type == 'refptr_vec_same_byref' or arg_type == 'refptr_vec_diff_byref': + result += comment+\ + '\n DCHECK('+arg_name+'Count && (*'+arg_name+'Count == 0 || '+arg_name+'));'\ + '\n if (!'+arg_name+'Count || (*'+arg_name+'Count > 0 && !'+arg_name+'))'\ + '\n return'+retval_default+';' + elif arg_type == 'simple_vec_byref_const' or arg_type == 'bool_vec_byref_const' or \ + arg_type == 'refptr_vec_same_byref_const' or arg_type == 'refptr_vec_diff_byref_const': + result += comment+\ + '\n DCHECK('+arg_name+'Count == 0 || '+arg_name+');'\ + '\n if ('+arg_name+'Count > 0 && !'+arg_name+')'\ + '\n return'+retval_default+';' + + # check index params + index_params = arg.parent.get_attrib_list('index_param') + if not index_params is None and arg_name in index_params: + result += comment+\ + '\n DCHECK_GE('+arg_name+', 0);'\ + '\n if ('+arg_name+' < 0)'\ + '\n return'+retval_default+';' + + if len(optional) > 0: + result += '\n // Unverified params: '+string.join(optional,', ') + + if len(result) != result_len: + result += '\n' + result_len = len(result) + + # parameter translation + params = [] + + for arg in args: + arg_type = arg.get_arg_type() + arg_name = arg.get_type().get_name() + + comment = '\n // Translate param: '+arg_name+'; type: '+arg_type + + if arg_type == 'simple_byval' or arg_type == 'simple_byaddr': + params.append(arg_name) + elif arg_type == 'simple_byref' or arg_type == 'simple_byref_const': + data_type = arg.get_type().get_type() + default = arg.get_type().get_result_simple_default() + result += comment+\ + '\n '+data_type+' '+arg_name+'Val = '+arg_name+'?*'+arg_name+':'+default+';' + params.append(arg_name+'Val') + elif arg_type == 'bool_byval': + params.append(arg_name+'?true:false') + elif arg_type == 'bool_byref' or arg_type == 'bool_byaddr': + result += comment+\ + '\n bool '+arg_name+'Bool = ('+arg_name+' && *'+arg_name+')?true:false;' + if arg_type == 'bool_byref': + params.append(arg_name+'Bool') + else: + params.append('&'+arg_name+'Bool') + elif arg_type == 'struct_byref_const': + struct_type = arg.get_type().get_type() + result += comment+\ + '\n '+struct_type+' '+arg_name+'Obj;'\ + '\n if ('+arg_name+')'\ + '\n '+arg_name+'Obj.Set(*'+arg_name+', false);' + params.append(arg_name+'Obj') + elif arg_type == 'struct_byref': + struct_type = arg.get_type().get_type() + result += comment+\ + '\n '+struct_type+' '+arg_name+'Obj;'\ + '\n if ('+arg_name+')'\ + '\n '+arg_name+'Obj.AttachTo(*'+arg_name+');' + params.append(arg_name+'Obj') + elif arg_type == 'string_byref_const': + params.append('CefString('+arg_name+')') + elif arg_type == 'string_byref': + result += comment+\ + '\n CefString '+arg_name+'Str('+arg_name+');' + params.append(arg_name+'Str') + elif arg_type == 'refptr_same' or arg_type == 'refptr_diff': + refptr_class = arg.get_type().get_refptr_type() + if arg_type == 'refptr_same': + params.append(refptr_class+'CppToC::Unwrap('+arg_name+')') + else: + params.append(refptr_class+'CToCpp::Wrap('+arg_name+')') + elif arg_type == 'refptr_same_byref' or arg_type == 'refptr_diff_byref': + refptr_class = arg.get_type().get_refptr_type() + if arg_type == 'refptr_same_byref': + assign = refptr_class+'CppToC::Unwrap(*'+arg_name+')' + else: + assign = refptr_class+'CToCpp::Wrap(*'+arg_name+')' + result += comment+\ + '\n CefRefPtr<'+refptr_class+'> '+arg_name+'Ptr;'\ + '\n if ('+arg_name+' && *'+arg_name+')'\ + '\n '+arg_name+'Ptr = '+assign+';'\ + '\n '+refptr_class+'* '+arg_name+'Orig = '+arg_name+'Ptr.get();' + params.append(arg_name+'Ptr') + elif arg_type == 'string_vec_byref' or arg_type == 'string_vec_byref_const': + result += comment+\ + '\n std::vector '+arg_name+'List;'\ + '\n transfer_string_list_contents('+arg_name+', '+arg_name+'List);' + params.append(arg_name+'List') + elif arg_type == 'string_map_single_byref' or arg_type == 'string_map_single_byref_const': + result += comment+\ + '\n std::map '+arg_name+'Map;'\ + '\n transfer_string_map_contents('+arg_name+', '+arg_name+'Map);' + params.append(arg_name+'Map') + elif arg_type == 'string_map_multi_byref' or arg_type == 'string_map_multi_byref_const': + result += comment+\ + '\n std::multimap '+arg_name+'Multimap;'\ + '\n transfer_string_multimap_contents('+arg_name+', '+arg_name+'Multimap);' + params.append(arg_name+'Multimap') + elif arg_type == 'simple_vec_byref' or arg_type == 'bool_vec_byref' or \ + arg_type == 'refptr_vec_same_byref' or arg_type == 'refptr_vec_diff_byref': + vec_type = arg.get_type().get_vector_type() + if arg_type == 'simple_vec_byref': + assign = arg_name+'[i]' + elif arg_type == 'bool_vec_byref': + assign = arg_name+'[i]?true:false' + elif arg_type == 'refptr_vec_same_byref': + refptr_class = arg.get_type().get_refptr_type() + assign = refptr_class+'CppToC::Unwrap('+arg_name+'[i])' + elif arg_type == 'refptr_vec_diff_byref': + refptr_class = arg.get_type().get_refptr_type() + assign = refptr_class+'CToCpp::Wrap('+arg_name+'[i])' + result += comment+\ + '\n std::vector<'+vec_type+' > '+arg_name+'List;'\ + '\n if ('+arg_name+'Count && *'+arg_name+'Count > 0 && '+arg_name+') {'\ + '\n for (size_t i = 0; i < *'+arg_name+'Count; ++i) {'\ + '\n '+arg_name+'List.push_back('+assign+');'\ + '\n }'\ + '\n }' + params.append(arg_name+'List') + elif arg_type == 'simple_vec_byref_const' or arg_type == 'bool_vec_byref_const' or \ + arg_type == 'refptr_vec_same_byref_const' or arg_type == 'refptr_vec_diff_byref_const': + vec_type = arg.get_type().get_vector_type() + if arg_type == 'simple_vec_byref_const': + assign = arg_name+'[i]' + elif arg_type == 'bool_vec_byref_const': + assign = arg_name+'[i]?true:false' + elif arg_type == 'refptr_vec_same_byref_const': + refptr_class = arg.get_type().get_refptr_type() + assign = refptr_class+'CppToC::Unwrap('+arg_name+'[i])' + elif arg_type == 'refptr_vec_diff_byref_const': + refptr_class = arg.get_type().get_refptr_type() + assign = refptr_class+'CToCpp::Wrap('+arg_name+'[i])' + result += comment+\ + '\n std::vector<'+vec_type+' > '+arg_name+'List;'\ + '\n if ('+arg_name+'Count > 0) {'\ + '\n for (size_t i = 0; i < '+arg_name+'Count; ++i) {'\ + '\n '+arg_name+'List.push_back('+assign+');'\ + '\n }'\ + '\n }' + params.append(arg_name+'List') + + if len(result) != result_len: + result += '\n' + result_len = len(result) + + # execution + result += '\n // Execute\n ' + + if retval_type != 'none': + # has a return value + if retval_type == 'simple': + result += retval.get_type().get_result_simple_type() + else: + result += retval.get_type().get_type() + result += ' _retval = ' + + if isinstance(func.parent, obj_class): + # virtual and static class methods + if isinstance(func, obj_function_virtual): + result += func.parent.get_name()+'CppToC::Get(self)->' + else: + result += func.parent.get_name()+'::' + result += func.get_name()+'(' + + if len(params) > 0: + result += '\n '+string.join(params,',\n ') + + result += ');\n' + + result_len = len(result) + + # parameter restoration + for arg in args: + arg_type = arg.get_arg_type() + arg_name = arg.get_type().get_name() + + comment = '\n // Restore param: '+arg_name+'; type: '+arg_type + + if arg_type == 'simple_byref': + result += comment+\ + '\n if ('+arg_name+')'\ + '\n *'+arg_name+' = '+arg_name+'Val;' + elif arg_type == 'bool_byref' or arg_type == 'bool_byaddr': + result += comment+\ + '\n if ('+arg_name+')'\ + '\n *'+arg_name+' = '+arg_name+'Bool?true:false;' + elif arg_type == 'struct_byref': + result += comment+\ + '\n if ('+arg_name+')'\ + '\n '+arg_name+'Obj.DetachTo(*'+arg_name+');' + elif arg_type == 'refptr_same_byref' or arg_type == 'refptr_diff_byref': + refptr_class = arg.get_type().get_refptr_type() + if arg_type == 'refptr_same_byref': + assign = refptr_class+'CppToC::Wrap('+arg_name+'Ptr)' + else: + assign = refptr_class+'CToCpp::Unwrap('+arg_name+'Ptr)' + result += comment+\ + '\n if ('+arg_name+') {'\ + '\n if ('+arg_name+'Ptr.get()) {'\ + '\n if ('+arg_name+'Ptr.get() != '+arg_name+'Orig) {'\ + '\n *'+arg_name+' = '+assign+';'\ + '\n }'\ + '\n } else {'\ + '\n *'+arg_name+' = NULL;'\ + '\n }'\ + '\n }' + elif arg_type == 'string_vec_byref': + result += comment+\ + '\n cef_string_list_clear('+arg_name+');'\ + '\n transfer_string_list_contents('+arg_name+'List, '+arg_name+');' + elif arg_type == 'string_map_single_byref': + result += comment+\ + '\n cef_string_map_clear('+arg_name+');'\ + '\n transfer_string_map_contents('+arg_name+'Map, '+arg_name+');' + elif arg_type == 'string_map_multi_byref': + result += comment+\ + '\n cef_string_multimap_clear('+arg_name+');'\ + '\n transfer_string_multimap_contents('+arg_name+'Multimap, '+arg_name+');' + elif arg_type == 'simple_vec_byref' or arg_type == 'bool_vec_byref' or \ + arg_type == 'refptr_vec_same_byref' or arg_type == 'refptr_vec_diff_byref': + if arg_type == 'simple_vec_byref' or arg_type == 'bool_vec_byref': + assign = arg_name+'List[i]' + elif arg_type == 'refptr_vec_same_byref': + refptr_class = arg.get_type().get_refptr_type() + assign = refptr_class+'CppToC::Wrap('+arg_name+'List[i])' + elif arg_type == 'refptr_vec_diff_byref': + refptr_class = arg.get_type().get_refptr_type() + assign = refptr_class+'CToCpp::Unwrap('+arg_name+'List[i])' + result += comment+\ + '\n if ('+arg_name+'Count && '+arg_name+') {'\ + '\n *'+arg_name+'Count = std::min('+arg_name+'List.size(), *'+arg_name+'Count);'\ + '\n if (*'+arg_name+'Count > 0) {'\ + '\n for (size_t i = 0; i < *'+arg_name+'Count; ++i) {'\ + '\n '+arg_name+'[i] = '+assign+';'\ + '\n }'\ + '\n }'\ + '\n }' + + if len(result) != result_len: + result += '\n' + result_len = len(result) + + # special handling for the global cef_shutdown function + if name == 'cef_shutdown' and isinstance(func.parent, obj_header): + classes = func.parent.get_classes() + + names = [] + for cls in classes: + if cls.has_attrib('no_debugct_check'): + continue; + + if cls.is_library_side(): + names.append(cls.get_name()+'CppToC') + else: + names.append(cls.get_name()+'CToCpp') + + if len(names) > 0: + names = sorted(names) + result += '\n#ifndef NDEBUG'\ + '\n // Check that all wrapper objects have been destroyed' + for name in names: + result += '\n DCHECK_EQ('+name+'::DebugObjCt, 0);'; + result += '\n#endif // !NDEBUG' + + if len(result) != result_len: + result += '\n' + result_len = len(result) + + # return translation + if retval_type != 'none': + # has a return value + result += '\n // Return type: '+retval_type + if retval_type == 'simple' or retval_type == 'bool': + result += '\n return _retval;' + elif retval_type == 'string': + result += '\n return _retval.DetachToUserFree();' + elif retval_type == 'refptr_same': + refptr_class = retval.get_type().get_refptr_type() + result += '\n return '+refptr_class+'CppToC::Wrap(_retval);' + elif retval_type == 'refptr_diff': + refptr_class = retval.get_type().get_refptr_type() + result += '\n return '+refptr_class+'CToCpp::Unwrap(_retval);' + + if len(result) != result_len: + result += '\n' + + result += '}\n' + return wrap_code(result) + +def make_cpptoc_function_impl(funcs, existing, prefixname, defined_names): + impl = '' + + for func in funcs: + if not prefixname is None: + name = prefixname+'_'+func.get_capi_name() + else: + name = func.get_capi_name() + value = get_next_function_impl(existing, name) + if not value is None \ + and value['body'].find('// AUTO-GENERATED CONTENT') < 0: + # an implementation exists that was not auto-generated + impl += make_cpptoc_function_impl_existing(name, func, value, defined_names) + else: + impl += make_cpptoc_function_impl_new(name, func, defined_names) + + return impl + +def make_cpptoc_class_impl(header, clsname, impl): + # structure names that have already been defined + defined_names = header.get_defined_structs() + + # retrieve the class and populate the defined names + cls = header.get_class(clsname, defined_names) + if cls is None: + raise Exception('Class does not exist: '+clsname) + + capiname = cls.get_capi_name() + prefixname = get_capi_name(clsname[3:], False) + + # retrieve the existing virtual function implementations + existing = get_function_impls(impl, 'CEF_CALLBACK') + + # generate virtual functions + virtualimpl = make_cpptoc_function_impl(cls.get_virtual_funcs(), existing, prefixname, defined_names) + if len(virtualimpl) > 0: + virtualimpl = '\n// MEMBER FUNCTIONS - Body may be edited by hand.\n\n'+virtualimpl + + # the current class is already defined for static functions + defined_names.append(cls.get_capi_name()) + + # retrieve the existing static function implementations + existing = get_function_impls(impl, 'CEF_EXPORT') + + # generate static functions + staticimpl = make_cpptoc_function_impl(cls.get_static_funcs(), existing, None, defined_names) + if len(staticimpl) > 0: + staticimpl = '\n// GLOBAL FUNCTIONS - Body may be edited by hand.\n\n'+staticimpl + + resultingimpl = staticimpl + virtualimpl + + # determine what includes are required by identifying what translation + # classes are being used + includes = format_translation_includes(resultingimpl) + + # build the final output + result = get_copyright() + + result += includes+'\n'+resultingimpl+'\n' + + const = '// CONSTRUCTOR - Do not edit by hand.\n\n'+ \ + clsname+'CppToC::'+clsname+'CppToC('+clsname+'* cls)\n'+ \ + ' : CefCppToC<'+clsname+'CppToC, '+clsname+', '+capiname+'>(cls) '+ \ + '{\n'; + + funcs = cls.get_virtual_funcs() + for func in funcs: + name = func.get_capi_name() + const += ' struct_.struct_.'+name+' = '+prefixname+'_'+name+';\n' + + const += '}\n\n'+ \ + '#ifndef NDEBUG\n'+ \ + 'template<> long CefCppToC<'+clsname+'CppToC, '+clsname+', '+capiname+'>::DebugObjCt = 0;\n'+ \ + '#endif\n' + result += wrap_code(const) + + return result + +def make_cpptoc_global_impl(header, impl): + # structure names that have already been defined + defined_names = header.get_defined_structs() + + # retrieve the existing global function implementations + existing = get_function_impls(impl, 'CEF_EXPORT') + + # generate global functions + impl = make_cpptoc_function_impl(header.get_funcs(), existing, None, defined_names) + if len(impl) > 0: + impl = '\n// GLOBAL FUNCTIONS - Body may be edited by hand.\n\n'+impl + + includes = '' + + # include required headers for global functions + filenames = [] + for func in header.get_funcs(): + filename = func.get_file_name() + if not filename in filenames: + includes += '#include "include/'+func.get_file_name()+'"\n' \ + '#include "include/capi/'+func.get_capi_file_name()+'"\n' + filenames.append(filename) + + # determine what includes are required by identifying what translation + # classes are being used + includes += format_translation_includes(impl) + + # build the final output + result = get_copyright() + + result += includes+'\n'+impl + + return result + +def write_cpptoc_impl(header, clsname, dir, backup): + if clsname is None: + # global file + file = dir + else: + # class file + file = dir+os.sep+get_capi_name(clsname[3:], False)+'_cpptoc.cc' + + if path_exists(file): + oldcontents = read_file(file) + else: + oldcontents = '' + + if clsname is None: + newcontents = make_cpptoc_global_impl(header, oldcontents) + else: + newcontents = make_cpptoc_class_impl(header, clsname, oldcontents) + if newcontents != oldcontents: + if backup and oldcontents != '': + backup_file(file) + write_file(file, newcontents) + return True + + return False + + +# test the module +if __name__ == "__main__": + import sys + + # verify that the correct number of command-line arguments are provided + if len(sys.argv) < 4: + sys.stderr.write('Usage: '+sys.argv[0]+' ') + sys.exit() + + # create the header object + header = obj_header() + header.add_file(sys.argv[1]) + + # read the existing implementation file into memory + try: + f = open(sys.argv[3], 'r') + data = f.read() + except IOError, (errno, strerror): + raise Exception('Failed to read file '+sys.argv[3]+': '+strerror) + else: + f.close() + + # dump the result to stdout + sys.stdout.write(make_cpptoc_class_impl(header, sys.argv[2], data)) diff --git a/tools/make_cpptoc_impl.pyc b/tools/make_cpptoc_impl.pyc new file mode 100644 index 000000000..4ba243901 Binary files /dev/null and b/tools/make_cpptoc_impl.pyc differ diff --git a/tools/make_ctocpp_header.py b/tools/make_ctocpp_header.py new file mode 100644 index 000000000..027ac8a14 --- /dev/null +++ b/tools/make_ctocpp_header.py @@ -0,0 +1,122 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +from cef_parser import * + +def make_ctocpp_header(header, clsname): + cls = header.get_class(clsname) + if cls is None: + raise Exception('Class does not exist: '+clsname) + + clientside = cls.is_client_side() + defname = string.upper(get_capi_name(clsname[3:], False)) + capiname = cls.get_capi_name() + + result = get_copyright() + + result += '#ifndef CEF_LIBCEF_DLL_CTOCPP_'+defname+'_CTOCPP_H_\n'+ \ + '#define CEF_LIBCEF_DLL_CTOCPP_'+defname+'_CTOCPP_H_\n' + \ + '#pragma once\n' + + if clientside: + result += """ +#ifndef BUILDING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed DLL-side only") +#else // BUILDING_CEF_SHARED +""" + else: + result += """ +#ifndef USING_CEF_SHARED +#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") +#else // USING_CEF_SHARED +""" + + # build the function body + func_body = '' + funcs = cls.get_virtual_funcs() + for func in funcs: + func_body += ' virtual '+func.get_cpp_proto()+' OVERRIDE;\n' + + # include standard headers + if func_body.find('std::map') > 0 or func_body.find('std::multimap') > 0: + result += '\n#include ' + if func_body.find('std::vector') > 0: + result += '\n#include ' + + # include the headers for this class + result += '\n#include "include/'+cls.get_file_name()+'"'+ \ + '\n#include "include/capi/'+cls.get_capi_file_name()+'"\n' + + # include headers for any forward declared classes that are not in the same file + declares = cls.get_forward_declares() + for declare in declares: + dcls = header.get_class(declare) + if dcls.get_file_name() != cls.get_file_name(): + result += '#include "include/'+dcls.get_file_name()+'"\n' \ + '#include "include/capi/'+dcls.get_capi_file_name()+'"\n' + + result += """#include "libcef_dll/ctocpp/ctocpp.h" + +// Wrap a C structure with a C++ class. +""" + + if clientside: + result += '// This class may be instantiated and accessed DLL-side only.\n' + else: + result += '// This class may be instantiated and accessed wrapper-side only.\n' + + result += 'class '+clsname+'CToCpp\n'+ \ + ' : public CefCToCpp<'+clsname+'CToCpp, '+clsname+', '+capiname+'> {\n'+ \ + ' public:\n'+ \ + ' explicit '+clsname+'CToCpp('+capiname+'* str)\n'+ \ + ' : CefCToCpp<'+clsname+'CToCpp, '+clsname+', '+capiname+'>(str) {}\n'+ \ + ' virtual ~'+clsname+'CToCpp() {}\n\n'+ \ + ' // '+clsname+' methods\n'; + + result += func_body + result += '};\n\n' + + if clientside: + result += '#endif // BUILDING_CEF_SHARED\n' + else: + result += '#endif // USING_CEF_SHARED\n' + + result += '#endif // CEF_LIBCEF_DLL_CTOCPP_'+defname+'_CTOCPP_H_\n' + + return wrap_code(result) + + +def write_ctocpp_header(header, clsname, dir, backup): + file = dir+os.sep+get_capi_name(clsname[3:], False)+'_ctocpp.h' + + if path_exists(file): + oldcontents = read_file(file) + else: + oldcontents = '' + + newcontents = make_ctocpp_header(header, clsname) + if newcontents != oldcontents: + if backup and oldcontents != '': + backup_file(file) + write_file(file, newcontents) + return True + + return False + + +# test the module +if __name__ == "__main__": + import sys + + # verify that the correct number of command-line arguments are provided + if len(sys.argv) < 3: + sys.stderr.write('Usage: '+sys.argv[0]+' ') + sys.exit() + + # create the header object + header = obj_header() + header.add_file(sys.argv[1]) + + # dump the result to stdout + sys.stdout.write(make_ctocpp_header(header, sys.argv[2])) diff --git a/tools/make_ctocpp_header.pyc b/tools/make_ctocpp_header.pyc new file mode 100644 index 000000000..511620376 Binary files /dev/null and b/tools/make_ctocpp_header.pyc differ diff --git a/tools/make_ctocpp_impl.py b/tools/make_ctocpp_impl.py new file mode 100644 index 000000000..0ef21e4bc --- /dev/null +++ b/tools/make_ctocpp_impl.py @@ -0,0 +1,576 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +from cef_parser import * + +def make_ctocpp_impl_proto(clsname, name, func, parts): + const = '' + + if clsname is None: + proto = 'CEF_GLOBAL '+parts['retval']+' ' + else: + proto = parts['retval']+' '+clsname + if isinstance(func, obj_function_virtual): + proto += 'CToCpp' + if func.is_const(): + const = ' const' + + proto += '::' + + proto += name+'('+string.join(parts['args'], ', ')+')'+const + return proto + +def make_ctocpp_function_impl_existing(clsname, name, func, impl): + notify(name+' has manual edits') + + # retrieve the C++ prototype parts + parts = func.get_cpp_parts(True) + + changes = format_translation_changes(impl, parts) + if len(changes) > 0: + notify(name+' prototype changed') + + return wrap_code(make_ctocpp_impl_proto(clsname, name, func, parts))+'{'+ \ + changes+impl['body']+'\n}\n' + +def make_ctocpp_function_impl_new(clsname, name, func): + # build the C++ prototype + parts = func.get_cpp_parts(True) + result = make_ctocpp_impl_proto(clsname, name, func, parts)+' {' + + invalid = [] + + # retrieve the function arguments + args = func.get_arguments() + + # determine the argument types + for arg in args: + if arg.get_arg_type() == 'invalid': + invalid.append(arg.get_name()) + + # retrieve the function return value + retval = func.get_retval() + retval_type = retval.get_retval_type() + if retval_type == 'invalid': + invalid.append('(return value)') + retval_default = '' + else: + retval_default = retval.get_retval_default(False) + if len(retval_default) > 0: + retval_default = ' '+retval_default; + + # add revision check + if func.has_attrib('revision_check'): + result += '\n int build_revision = cef_build_revision();'\ + '\n if (build_revision != CEF_REVISION) {'\ + '\n // The libcef build revision does not match the CEF API revision.'\ + '\n DCHECK(false);'\ + '\n return'+retval_default+';'\ + '\n }\n' + + if isinstance(func, obj_function_virtual): + # add the structure size check + result += '\n if (CEF_MEMBER_MISSING(struct_, '+func.get_capi_name()+'))' + result += '\n return'+retval_default+';\n' + + if len(invalid) > 0: + notify(name+' could not be autogenerated') + # code could not be auto-generated + result += '\n // BEGIN DELETE BEFORE MODIFYING' + result += '\n // AUTO-GENERATED CONTENT' + result += '\n // COULD NOT IMPLEMENT DUE TO: '+string.join(invalid, ', ') + result += '\n #pragma message("Warning: "__FILE__": '+name+' is not implemented")' + result += '\n // END DELETE BEFORE MODIFYING' + result += '\n}\n\n' + return wrap_code(result) + + result += '\n // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING\n' + + result_len = len(result) + + optional = [] + + # parameter verification + for arg in args: + arg_type = arg.get_arg_type() + arg_name = arg.get_type().get_name() + + # skip optional params + optional_params = arg.parent.get_attrib_list('optional_param') + if not optional_params is None and arg_name in optional_params: + optional.append(arg_name) + continue + + comment = '\n // Verify param: '+arg_name+'; type: '+arg_type + + if arg_type == 'simple_byaddr' or arg_type == 'bool_byaddr': + result += comment+\ + '\n DCHECK('+arg_name+');'\ + '\n if (!'+arg_name+')'\ + '\n return'+retval_default+';' + elif arg_type == 'refptr_same' or arg_type == 'refptr_diff': + result += comment+\ + '\n DCHECK('+arg_name+'.get());'\ + '\n if (!'+arg_name+'.get())'\ + '\n return'+retval_default+';' + elif arg_type == 'string_byref_const': + result += comment+\ + '\n DCHECK(!'+arg_name+'.empty());'\ + '\n if ('+arg_name+'.empty())'\ + '\n return'+retval_default+';' + + # check index params + index_params = arg.parent.get_attrib_list('index_param') + if not index_params is None and arg_name in index_params: + result += comment+\ + '\n DCHECK_GE('+arg_name+', 0);'\ + '\n if ('+arg_name+' < 0)'\ + '\n return'+retval_default+';' + + if len(optional) > 0: + result += '\n // Unverified params: '+string.join(optional,', ') + + if len(result) != result_len: + result += '\n' + result_len = len(result) + + # parameter translation + params = [] + if isinstance(func, obj_function_virtual): + params.append('struct_') + + for arg in args: + arg_type = arg.get_arg_type() + arg_name = arg.get_type().get_name() + + comment = '\n // Translate param: '+arg_name+'; type: '+arg_type + + if arg_type == 'simple_byval' or arg_type == 'simple_byaddr' or \ + arg_type == 'bool_byval': + params.append(arg_name) + elif arg_type == 'simple_byref' or arg_type == 'simple_byref_const' or \ + arg_type == 'struct_byref_const' or arg_type == 'struct_byref': + params.append('&'+arg_name) + elif arg_type == 'bool_byref': + result += comment+\ + '\n int '+arg_name+'Int = '+arg_name+';' + params.append('&'+arg_name+'Int') + elif arg_type == 'bool_byaddr': + result += comment+\ + '\n int '+arg_name+'Int = '+arg_name+'?*'+arg_name+':0;' + params.append('&'+arg_name+'Int') + elif arg_type == 'string_byref_const': + params.append(arg_name+'.GetStruct()') + elif arg_type == 'string_byref': + params.append(arg_name+'.GetWritableStruct()') + elif arg_type == 'refptr_same': + refptr_class = arg.get_type().get_refptr_type() + params.append(refptr_class+'CToCpp::Unwrap('+arg_name+')') + elif arg_type == 'refptr_diff': + refptr_class = arg.get_type().get_refptr_type() + params.append(refptr_class+'CppToC::Wrap('+arg_name+')') + elif arg_type == 'refptr_same_byref' or arg_type == 'refptr_diff_byref': + refptr_class = arg.get_type().get_refptr_type() + refptr_struct = arg.get_type().get_result_refptr_type_root() + if arg_type == 'refptr_same_byref': + assign = refptr_class+'CToCpp::Unwrap('+arg_name+')' + else: + assign = refptr_class+'CppToC::Wrap('+arg_name+')' + result += comment+\ + '\n '+refptr_struct+'* '+arg_name+'Struct = NULL;'\ + '\n if ('+arg_name+'.get())'\ + '\n '+arg_name+'Struct = '+assign+';'\ + '\n '+refptr_struct+'* '+arg_name+'Orig = '+arg_name+'Struct;' + params.append('&'+arg_name+'Struct') + elif arg_type == 'string_vec_byref' or arg_type == 'string_vec_byref_const': + result += comment+\ + '\n cef_string_list_t '+arg_name+'List = cef_string_list_alloc();'\ + '\n DCHECK('+arg_name+'List);'\ + '\n if ('+arg_name+'List)'\ + '\n transfer_string_list_contents('+arg_name+', '+arg_name+'List);' + params.append(arg_name+'List') + elif arg_type == 'string_map_single_byref' or arg_type == 'string_map_single_byref_const': + result += comment+\ + '\n cef_string_map_t '+arg_name+'Map = cef_string_map_alloc();'\ + '\n DCHECK('+arg_name+'Map);'\ + '\n if ('+arg_name+'Map)'\ + '\n transfer_string_map_contents('+arg_name+', '+arg_name+'Map);' + params.append(arg_name+'Map') + elif arg_type == 'string_map_multi_byref' or arg_type == 'string_map_multi_byref_const': + result += comment+\ + '\n cef_string_multimap_t '+arg_name+'Multimap = cef_string_multimap_alloc();'\ + '\n DCHECK('+arg_name+'Multimap);'\ + '\n if ('+arg_name+'Multimap)'\ + '\n transfer_string_multimap_contents('+arg_name+', '+arg_name+'Multimap);' + params.append(arg_name+'Multimap') + elif arg_type == 'simple_vec_byref' or arg_type == 'bool_vec_byref' or \ + arg_type == 'refptr_vec_same_byref' or arg_type == 'refptr_vec_diff_byref': + count_func = arg.get_attrib_count_func() + vec_type = arg.get_type().get_result_vector_type_root() + if arg_type == 'refptr_vec_same_byref': + refptr_class = arg.get_type().get_refptr_type() + assign = refptr_class+'CToCpp::Unwrap('+arg_name+'[i])' + elif arg_type == 'refptr_vec_diff_byref': + refptr_class = arg.get_type().get_refptr_type() + assign = refptr_class+'CppToC::Wrap('+arg_name+'[i])' + else: + assign = arg_name+'[i]' + result += comment+\ + '\n size_t '+arg_name+'Size = '+arg_name+'.size();'\ + '\n size_t '+arg_name+'Count = std::max('+count_func+'(), '+arg_name+'Size);'\ + '\n '+vec_type+'* '+arg_name+'List = NULL;'\ + '\n if ('+arg_name+'Count > 0) {'\ + '\n '+arg_name+'List = new '+vec_type+'['+arg_name+'Count];'\ + '\n DCHECK('+arg_name+'List);'\ + '\n if ('+arg_name+'List) {'\ + '\n memset('+arg_name+'List, 0, sizeof('+vec_type+')*'+arg_name+'Count);'\ + '\n }'\ + '\n if ('+arg_name+'List && '+arg_name+'Size > 0) {'\ + '\n for (size_t i = 0; i < '+arg_name+'Size; ++i) {'\ + '\n '+arg_name+'List[i] = '+assign+';'\ + '\n }'\ + '\n }'\ + '\n }' + params.append('&'+arg_name+'Count') + params.append(arg_name+'List') + elif arg_type == 'simple_vec_byref_const' or arg_type == 'bool_vec_byref_const' or \ + arg_type == 'refptr_vec_same_byref_const' or arg_type == 'refptr_vec_diff_byref_const': + count_func = arg.get_attrib_count_func() + vec_type = arg.get_type().get_result_vector_type_root() + if arg_type == 'refptr_vec_same_byref_const': + refptr_class = arg.get_type().get_refptr_type() + assign = refptr_class+'CToCpp::Unwrap('+arg_name+'[i])' + elif arg_type == 'refptr_vec_diff_byref_const': + refptr_class = arg.get_type().get_refptr_type() + assign = refptr_class+'CppToC::Wrap('+arg_name+'[i])' + else: + assign = arg_name+'[i]' + result += comment+\ + '\n const size_t '+arg_name+'Count = '+arg_name+'.size();'\ + '\n '+vec_type+'* '+arg_name+'List = NULL;'\ + '\n if ('+arg_name+'Count > 0) {'\ + '\n '+arg_name+'List = new '+vec_type+'['+arg_name+'Count];'\ + '\n DCHECK('+arg_name+'List);'\ + '\n if ('+arg_name+'List) {'\ + '\n for (size_t i = 0; i < '+arg_name+'Count; ++i) {'\ + '\n '+arg_name+'List[i] = '+assign+';'\ + '\n }'\ + '\n }'\ + '\n }' + params.append(arg_name+'Count') + params.append(arg_name+'List') + + if len(result) != result_len: + result += '\n' + result_len = len(result) + + # execution + result += '\n // Execute\n ' + + if retval_type != 'none': + # has a return value + if retval_type == 'simple' or retval_type == 'bool': + result += retval.get_type().get_result_simple_type_root() + elif retval_type == 'string': + result += 'cef_string_userfree_t' + elif retval_type == 'refptr_same' or retval_type == 'refptr_diff': + refptr_struct = retval.get_type().get_result_refptr_type_root() + result += refptr_struct+'*' + + result += ' _retval = ' + + if isinstance(func, obj_function_virtual): + result += 'struct_->' + result += func.get_capi_name()+'(' + + if len(params) > 0: + if not isinstance(func, obj_function_virtual): + result += '\n ' + result += string.join(params,',\n ') + + result += ');\n' + + result_len = len(result) + + # parameter restoration + for arg in args: + arg_type = arg.get_arg_type() + arg_name = arg.get_type().get_name() + + comment = '\n // Restore param:'+arg_name+'; type: '+arg_type + + if arg_type == 'bool_byref': + result += comment+\ + '\n '+arg_name+' = '+arg_name+'Int?true:false;' + elif arg_type == 'bool_byaddr': + result += comment+\ + '\n if ('+arg_name+')'\ + '\n *'+arg_name+' = '+arg_name+'Int?true:false;' + elif arg_type == 'refptr_same_byref' or arg_type == 'refptr_diff_byref': + refptr_class = arg.get_type().get_refptr_type() + refptr_struct = arg.get_type().get_result_refptr_type_root() + if arg_type == 'refptr_same_byref': + assign = refptr_class+'CToCpp::Wrap('+arg_name+'Struct)' + else: + assign = refptr_class+'CppToC::Unwrap('+arg_name+'Struct)' + result += comment+\ + '\n if ('+arg_name+'Struct) {'\ + '\n if ('+arg_name+'Struct != '+arg_name+'Orig) {'\ + '\n '+arg_name+' = '+assign+';'\ + '\n }'\ + '\n } else {'\ + '\n '+arg_name+' = NULL;'\ + '\n }' + elif arg_type == 'string_vec_byref': + result += comment+\ + '\n if ('+arg_name+'List) {'\ + '\n '+arg_name+'.clear();'\ + '\n transfer_string_list_contents('+arg_name+'List, '+arg_name+');'\ + '\n cef_string_list_free('+arg_name+'List);'\ + '\n }' + elif arg_type == 'string_vec_byref_const': + result += comment+\ + '\n if ('+arg_name+'List)'\ + '\n cef_string_list_free('+arg_name+'List);' + elif arg_type == 'string_map_single_byref': + result += comment+\ + '\n if ('+arg_name+'Map) {'\ + '\n '+arg_name+'.clear();'\ + '\n transfer_string_map_contents('+arg_name+'Map, '+arg_name+');'\ + '\n cef_string_map_free('+arg_name+'Map);'\ + '\n }' + elif arg_type == 'string_map_single_byref_const': + result += comment+\ + '\n if ('+arg_name+'Map)'\ + '\n cef_string_map_free('+arg_name+'Map);' + elif arg_type == 'string_map_multi_byref': + result += comment+\ + '\n if ('+arg_name+'Multimap) {'\ + '\n '+arg_name+'.clear();'\ + '\n transfer_string_multimap_contents('+arg_name+'Multimap, '+arg_name+');'\ + '\n cef_string_multimap_free('+arg_name+'Multimap);'\ + '\n }' + elif arg_type == 'string_map_multi_byref_const': + result += comment+\ + '\n if ('+arg_name+'Multimap)'\ + '\n cef_string_multimap_free('+arg_name+'Multimap);' + elif arg_type == 'simple_vec_byref' or arg_type == 'bool_vec_byref' or \ + arg_type == 'refptr_vec_same_byref' or arg_type == 'refptr_vec_diff_byref': + count_func = arg.get_attrib_count_func() + vec_type = arg.get_type().get_result_vector_type_root() + if arg_type == 'refptr_vec_same_byref': + refptr_class = arg.get_type().get_refptr_type() + assign = refptr_class+'CToCpp::Wrap('+arg_name+'List[i])' + elif arg_type == 'refptr_vec_diff_byref': + refptr_class = arg.get_type().get_refptr_type() + assign = refptr_class+'CppToC::Unwrap('+arg_name+'List[i])' + elif arg_type == 'bool_vec_byref': + assign = arg_name+'List[i]?true:false' + else: + assign = arg_name+'List[i]' + result += comment+\ + '\n '+arg_name+'.clear();'\ + '\n if ('+arg_name+'Count > 0 && '+arg_name+'List) {'\ + '\n for (size_t i = 0; i < '+arg_name+'Count; ++i) {'\ + '\n '+arg_name+'.push_back('+assign+');'\ + '\n }'\ + '\n delete [] '+arg_name+'List;'\ + '\n }' + elif arg_type == 'simple_vec_byref_const' or arg_type == 'bool_vec_byref_const' or \ + arg_type == 'refptr_vec_same_byref_const' or arg_type == 'refptr_vec_diff_byref_const': + result += comment+\ + '\n if ('+arg_name+'List)'\ + '\n delete [] '+arg_name+'List;' + + if len(result) != result_len: + result += '\n' + result_len = len(result) + + # special handling for the global CefShutdown function + if name == 'CefShutdown' and isinstance(func.parent, obj_header): + classes = func.parent.get_classes() + + names = [] + for cls in classes: + if cls.has_attrib('no_debugct_check'): + continue; + + if cls.is_library_side(): + names.append(cls.get_name()+'CToCpp') + else: + names.append(cls.get_name()+'CppToC') + + if len(names) > 0: + names = sorted(names) + result += '\n#ifndef NDEBUG'\ + '\n // Check that all wrapper objects have been destroyed' + for name in names: + result += '\n DCHECK_EQ('+name+'::DebugObjCt, 0);'; + result += '\n#endif // !NDEBUG' + + if len(result) != result_len: + result += '\n' + result_len = len(result) + + # return translation + if retval_type != 'none': + # has a return value + result += '\n // Return type: '+retval_type + if retval_type == 'simple': + result += '\n return _retval;' + elif retval_type == 'bool': + result += '\n return _retval?true:false;' + elif retval_type == 'string': + result += '\n CefString _retvalStr;'\ + '\n _retvalStr.AttachToUserFree(_retval);'\ + '\n return _retvalStr;' + elif retval_type == 'refptr_same': + refptr_class = retval.get_type().get_refptr_type() + result += '\n return '+refptr_class+'CToCpp::Wrap(_retval);' + elif retval_type == 'refptr_diff': + refptr_class = retval.get_type().get_refptr_type() + result += '\n return '+refptr_class+'CppToC::Unwrap(_retval);' + + if len(result) != result_len: + result += '\n' + + result += '}\n' + return wrap_code(result) + +def make_ctocpp_function_impl(clsname, funcs, existing): + impl = '' + + for func in funcs: + name = func.get_name() + value = get_next_function_impl(existing, name) + if not value is None \ + and value['body'].find('// AUTO-GENERATED CONTENT') < 0: + # an implementation exists that was not auto-generated + impl += make_ctocpp_function_impl_existing(clsname, name, func, value) + else: + impl += make_ctocpp_function_impl_new(clsname, name, func) + + return impl + +def make_ctocpp_class_impl(header, clsname, impl): + cls = header.get_class(clsname) + if cls is None: + raise Exception('Class does not exist: '+clsname) + + capiname = cls.get_capi_name() + + # retrieve the existing virtual function implementations + existing = get_function_impls(impl, clsname+'CToCpp::') + + # generate virtual functions + virtualimpl = make_ctocpp_function_impl(clsname, cls.get_virtual_funcs(), existing) + if len(virtualimpl) > 0: + virtualimpl = '\n// VIRTUAL METHODS - Body may be edited by hand.\n\n'+virtualimpl + + # retrieve the existing static function implementations + existing = get_function_impls(impl, clsname+'::') + + # generate static functions + staticimpl = make_ctocpp_function_impl(clsname, cls.get_static_funcs(), existing) + if len(staticimpl) > 0: + staticimpl = '\n// STATIC METHODS - Body may be edited by hand.\n\n'+staticimpl + + resultingimpl = staticimpl + virtualimpl + + # determine what includes are required by identifying what translation + # classes are being used + includes = format_translation_includes(resultingimpl) + + # build the final output + result = get_copyright() + + result += includes+'\n'+resultingimpl+'\n' + + result += wrap_code('#ifndef NDEBUG\n'+ \ + 'template<> long CefCToCpp<'+clsname+'CToCpp, '+clsname+', '+capiname+'>::DebugObjCt = 0;\n'+ \ + '#endif\n') + + return result + +def make_ctocpp_global_impl(header, impl): + # retrieve the existing global function implementations + existing = get_function_impls(impl, 'CEF_GLOBAL') + + # generate static functions + impl = make_ctocpp_function_impl(None, header.get_funcs(), existing) + if len(impl) > 0: + impl = '\n// GLOBAL METHODS - Body may be edited by hand.\n\n'+impl + + includes = '' + + # include required headers for global functions + filenames = [] + for func in header.get_funcs(): + filename = func.get_file_name() + if not filename in filenames: + includes += '#include "include/'+func.get_file_name()+'"\n' \ + '#include "include/capi/'+func.get_capi_file_name()+'"\n' + filenames.append(filename) + + # determine what includes are required by identifying what translation + # classes are being used + includes += format_translation_includes(impl) + + # build the final output + result = get_copyright() + + result += includes+'\n// Define used to facilitate parsing.\n#define CEF_GLOBAL\n\n'+impl + + return result + +def write_ctocpp_impl(header, clsname, dir, backup): + if clsname is None: + # global file + file = dir + else: + # class file + file = dir+os.sep+get_capi_name(clsname[3:], False)+'_ctocpp.cc' + + if path_exists(file): + oldcontents = read_file(file) + else: + oldcontents = '' + + if clsname is None: + newcontents = make_ctocpp_global_impl(header, oldcontents) + else: + newcontents = make_ctocpp_class_impl(header, clsname, oldcontents) + if newcontents != oldcontents: + if backup and oldcontents != '': + backup_file(file) + write_file(file, newcontents) + return True + + return False + + +# test the module +if __name__ == "__main__": + import sys + + # verify that the correct number of command-line arguments are provided + if len(sys.argv) < 4: + sys.stderr.write('Usage: '+sys.argv[0]+' ') + sys.exit() + + # create the header object + header = obj_header() + header.add_file(sys.argv[1]) + + # read the existing implementation file into memory + try: + f = open(sys.argv[3], 'r') + data = f.read() + except IOError, (errno, strerror): + raise Exception('Failed to read file '+sys.argv[3]+': '+strerror) + else: + f.close() + + # dump the result to stdout + sys.stdout.write(make_ctocpp_class_impl(header, sys.argv[2], data)) diff --git a/tools/make_ctocpp_impl.pyc b/tools/make_ctocpp_impl.pyc new file mode 100644 index 000000000..3e276456c Binary files /dev/null and b/tools/make_ctocpp_impl.pyc differ diff --git a/tools/make_distrib.bat b/tools/make_distrib.bat new file mode 100644 index 000000000..b6663905d --- /dev/null +++ b/tools/make_distrib.bat @@ -0,0 +1,2 @@ +@echo off +..\..\third_party\python_26\python.exe make_distrib.py --output-dir ..\binary_distrib\ %* diff --git a/tools/make_distrib.py b/tools/make_distrib.py new file mode 100644 index 000000000..5527c2cad --- /dev/null +++ b/tools/make_distrib.py @@ -0,0 +1,464 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +from date_util import * +from file_util import * +from gclient_util import * +from optparse import OptionParser +import os +import re +import shlex +import subprocess +from svn_util import * +import sys +import zipfile + +def create_archive(input_dir, zip_file): + """ Creates a zip archive of the specified input directory. """ + zf = zipfile.ZipFile(zip_file, 'w', zipfile.ZIP_DEFLATED) + def addDir(dir): + for f in os.listdir(dir): + full_path = os.path.join(dir, f) + if os.path.isdir(full_path): + addDir(full_path) + else: + zf.write(full_path, os.path.relpath(full_path, \ + os.path.join(input_dir, os.pardir))) + addDir(input_dir) + zf.close() + +def create_readme(src, output_dir, cef_url, cef_rev, cef_ver, chromium_url, \ + chromium_rev, chromium_ver, date): + """ Creates the README.TXT file. """ + data = read_file(src) + data = data.replace('$CEF_URL$', cef_url) + data = data.replace('$CEF_REV$', cef_rev) + data = data.replace('$CEF_VER$', cef_ver) + data = data.replace('$CHROMIUM_URL$', chromium_url) + data = data.replace('$CHROMIUM_REV$', chromium_rev) + data = data.replace('$CHROMIUM_VER$', chromium_ver) + data = data.replace('$DATE$', date) + write_file(os.path.join(output_dir, 'README.txt'), data) + if not options.quiet: + sys.stdout.write('Creating README.TXT file.\n') + +def eval_file(src): + """ Loads and evaluates the contents of the specified file. """ + return eval(read_file(src), {'__builtins__': None}, None) + +def transfer_gypi_files(src_dir, gypi_paths, gypi_path_prefix, dst_dir, quiet): + """ Transfer files from one location to another. """ + for path in gypi_paths: + # skip gyp includes + if path[:2] == '<@': + continue + src = os.path.join(src_dir, path) + dst = os.path.join(dst_dir, path.replace(gypi_path_prefix, '')) + dst_path = os.path.dirname(dst) + make_dir(dst_path, quiet) + copy_file(src, dst, quiet) + +def normalize_headers(file, new_path = ''): + """ Normalize headers post-processing. Remove the path component from any + project include directives. """ + data = read_file(file) + data = re.sub(r'''#include \"(?!include\/)[a-zA-Z0-9_\/]+\/+([a-zA-Z0-9_\.]+)\"''', \ + "// Include path modified for CEF Binary Distribution.\n#include \""+new_path+"\\1\"", data) + write_file(file, data) + +def transfer_files(cef_dir, script_dir, transfer_cfg, output_dir, quiet): + """ Transfer files based on the specified configuration. """ + if not path_exists(transfer_cfg): + return + + configs = eval_file(transfer_cfg) + for cfg in configs: + dst = os.path.join(output_dir, cfg['target']) + + # perform a copy if source is specified + if not cfg['source'] is None: + src = os.path.join(cef_dir, cfg['source']) + dst_path = os.path.dirname(dst) + make_dir(dst_path, quiet) + copy_file(src, dst, quiet) + + # place a readme file in the destination directory + readme = os.path.join(dst_path, 'README-TRANSFER.txt') + if not path_exists(readme): + copy_file(os.path.join(script_dir, 'distrib/README-TRANSFER.txt'), readme) + open(readme, 'ab').write(cfg['source']+"\n") + + # perform any required post-processing + if 'post-process' in cfg: + post = cfg['post-process'] + if post == 'normalize_headers': + new_path = '' + if cfg.has_key('new_header_path'): + new_path = cfg['new_header_path'] + normalize_headers(dst, new_path) + +def generate_msvs_projects(version): + """ Generate MSVS projects for the specified version. """ + sys.stdout.write('Generating '+version+' project files...') + os.environ['GYP_MSVS_VERSION'] = version + gyper = [ 'python', 'tools/gyp_cef', os.path.relpath(os.path.join(output_dir, 'cefclient.gyp'), cef_dir) ] + RunAction(cef_dir, gyper); + move_file(os.path.relpath(os.path.join(output_dir, 'cefclient.sln')), \ + os.path.relpath(os.path.join(output_dir, 'cefclient'+version+'.sln'))) + +def fix_msvs_projects(): + """ Fix the output directory path in all .vcproj and .vcxproj files. """ + files = [] + for file in get_files(os.path.join(output_dir, '*.vcproj')): + files.append(file) + for file in get_files(os.path.join(output_dir, '*.vcxproj')): + files.append(file) + for file in files: + data = read_file(file) + data = data.replace('../../..\\build\\', '') + write_file(file, data) + +def run(command_line, working_dir): + """ Run a command. """ + sys.stdout.write('-------- Running "'+command_line+'" in "'+\ + working_dir+'"...'+"\n") + args = shlex.split(command_line.replace('\\', '\\\\')) + return subprocess.check_call(args, cwd=working_dir, env=os.environ, + shell=(sys.platform == 'win32')) + +# cannot be loaded as a module +if __name__ != "__main__": + sys.stderr.write('This file cannot be loaded as a module!') + sys.exit() + +# parse command-line options +disc = """ +This utility builds the CEF Binary Distribution. +""" + +parser = OptionParser(description=disc) +parser.add_option('--output-dir', dest='outputdir', metavar='DIR', + help='output directory [required]') +parser.add_option('--allow-partial', + action='store_true', dest='allowpartial', default=False, + help='allow creation of partial distributions') +parser.add_option('--no-symbols', + action='store_true', dest='nosymbols', default=False, + help='do not create symbol files') +parser.add_option('-q', '--quiet', + action='store_true', dest='quiet', default=False, + help='do not output detailed status information') +(options, args) = parser.parse_args() + +# the outputdir option is required +if options.outputdir is None: + parser.print_help(sys.stdout) + sys.exit() + +# script directory +script_dir = os.path.dirname(__file__) + +# CEF root directory +cef_dir = os.path.abspath(os.path.join(script_dir, os.pardir)) + +# src directory +src_dir = os.path.abspath(os.path.join(cef_dir, os.pardir)) + +# retrieve url, revision and date information +cef_info = get_svn_info(cef_dir) +cef_url = cef_info['url'] +cef_rev = cef_info['revision'] +chromium_info = get_svn_info(os.path.join(cef_dir, os.pardir)) +chromium_url = chromium_info['url'] +chromium_rev = chromium_info['revision'] +date = get_date() + +# Read and parse the version file (key=value pairs, one per line) +chrome = {} +lines = read_file(os.path.join(cef_dir, '../chrome/VERSION')).split("\n") +for line in lines: + parts = line.split('=', 1) + if len(parts) == 2: + chrome[parts[0]] = parts[1] + +cef_ver = '3.'+chrome['BUILD']+'.'+cef_rev +chromium_ver = chrome['MAJOR']+'.'+chrome['MINOR']+'.'+chrome['BUILD']+'.'+chrome['PATCH'] + +# Test the operating system. +platform = ''; +if sys.platform == 'win32': + platform = 'windows' +elif sys.platform == 'darwin': + platform = 'macosx' +elif sys.platform.startswith('linux'): + platform = 'linux' + +# output directory +output_dir = os.path.abspath(os.path.join(options.outputdir, \ + 'cef_binary_'+cef_ver+'_'+platform)) +remove_dir(output_dir, options.quiet) +make_dir(output_dir, options.quiet) + +if not options.nosymbols: + # symbol directory + symbol_dir = os.path.abspath(os.path.join(options.outputdir, \ + 'cef_binary_'+cef_ver+'_'+platform+'_symbols')) + remove_dir(symbol_dir, options.quiet) + make_dir(symbol_dir, options.quiet) + +# transfer the LICENSE.txt file +copy_file(os.path.join(cef_dir, 'LICENSE.txt'), output_dir, options.quiet) + +# read the variables list from the autogenerated cef_paths.gypi file +cef_paths = eval_file(os.path.join(cef_dir, 'cef_paths.gypi')) +cef_paths = cef_paths['variables'] + +# read the variables list from the manually edited cef_paths2.gypi file +cef_paths2 = eval_file(os.path.join(cef_dir, 'cef_paths2.gypi')) +cef_paths2 = cef_paths2['variables'] + +# create the include directory +include_dir = os.path.join(output_dir, 'include') +make_dir(include_dir, options.quiet) + +# create the cefclient directory +cefclient_dir = os.path.join(output_dir, 'cefclient') +make_dir(cefclient_dir, options.quiet) + +# create the libcef_dll_wrapper directory +wrapper_dir = os.path.join(output_dir, 'libcef_dll') +make_dir(wrapper_dir, options.quiet) + +# transfer common include files +transfer_gypi_files(cef_dir, cef_paths2['includes_common'], \ + 'include/', include_dir, options.quiet) +transfer_gypi_files(cef_dir, cef_paths2['includes_capi'], \ + 'include/', include_dir, options.quiet) +transfer_gypi_files(cef_dir, cef_paths2['includes_wrapper'], \ + 'include/', include_dir, options.quiet) +transfer_gypi_files(cef_dir, cef_paths['autogen_cpp_includes'], \ + 'include/', include_dir, options.quiet) +transfer_gypi_files(cef_dir, cef_paths['autogen_capi_includes'], \ + 'include/', include_dir, options.quiet) + +# transfer common cefclient files +transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_common'], \ + 'tests/cefclient/', cefclient_dir, options.quiet) + +# transfer common libcef_dll_wrapper files +transfer_gypi_files(cef_dir, cef_paths2['libcef_dll_wrapper_sources_common'], \ + 'libcef_dll/', wrapper_dir, options.quiet) +transfer_gypi_files(cef_dir, cef_paths['autogen_client_side'], \ + 'libcef_dll/', wrapper_dir, options.quiet) + +# transfer gyp files +copy_file(os.path.join(script_dir, 'distrib/cefclient.gyp'), output_dir, options.quiet) +paths_gypi = os.path.join(cef_dir, 'cef_paths2.gypi') +data = read_file(paths_gypi) +data = data.replace('tests/cefclient/', 'cefclient/') +write_file(os.path.join(output_dir, 'cef_paths2.gypi'), data) +copy_file(os.path.join(cef_dir, 'cef_paths.gypi'), \ + os.path.join(output_dir, 'cef_paths.gypi'), options.quiet) + +# transfer additional files +transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/transfer.cfg'), \ + output_dir, options.quiet) + +if platform == 'windows': + # create the README.TXT file + create_readme(os.path.join(script_dir, 'distrib/win/README.txt'), output_dir, cef_url, \ + cef_rev, cef_ver, chromium_url, chromium_rev, chromium_ver, date) + + # transfer include files + transfer_gypi_files(cef_dir, cef_paths2['includes_win'], \ + 'include/', include_dir, options.quiet) + + # transfer cefclient files + transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_win'], \ + 'tests/cefclient/', cefclient_dir, options.quiet) + + # transfer build/Debug files + build_dir = os.path.join(src_dir, 'build/Debug'); + if not options.allowpartial or path_exists(build_dir): + dst_dir = os.path.join(output_dir, 'Debug') + make_dir(dst_dir, options.quiet) + copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet) + copy_files(os.path.join(build_dir, '*.dll'), dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'cefclient.exe'), dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'cef.pak'), dst_dir, options.quiet) + copy_dir(os.path.join(build_dir, 'locales'), os.path.join(dst_dir, 'locales'), \ + options.quiet) + + # transfer lib/Debug files + dst_dir = os.path.join(output_dir, 'lib/Debug') + make_dir(dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'lib/libcef.lib'), dst_dir, options.quiet) + else: + sys.stderr.write("No Debug build files.\n") + + # transfer build/Release files + build_dir = os.path.join(src_dir, 'build/Release'); + if not options.allowpartial or path_exists(build_dir): + dst_dir = os.path.join(output_dir, 'Release') + make_dir(dst_dir, options.quiet) + copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet) + copy_files(os.path.join(build_dir, '*.dll'), dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'cefclient.exe'), dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'cef.pak'), dst_dir, options.quiet) + copy_dir(os.path.join(build_dir, 'locales'), os.path.join(dst_dir, 'locales'), \ + options.quiet) + + # transfer lib/Release files + dst_dir = os.path.join(output_dir, 'lib/Release') + make_dir(dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'lib/libcef.lib'), dst_dir, options.quiet) + + if not options.nosymbols: + # transfer symbols + copy_file(os.path.join(build_dir, 'libcef.pdb'), symbol_dir, options.quiet) + else: + sys.stderr.write("No Release build files.\n") + + # generate doc files + os.popen('make_cppdocs.bat '+cef_rev) + + # transfer docs files + dst_dir = os.path.join(output_dir, 'docs') + src_dir = os.path.join(cef_dir, 'docs') + if path_exists(src_dir): + copy_dir(src_dir, dst_dir, options.quiet) + + # transfer additional files, if any + transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/win/transfer.cfg'), \ + output_dir, options.quiet) + + # generate the project files + generate_msvs_projects('2005'); + generate_msvs_projects('2008'); + generate_msvs_projects('2010'); + fix_msvs_projects(); + +elif platform == 'macosx': + # create the README.TXT file + create_readme(os.path.join(script_dir, 'distrib/mac/README.txt'), output_dir, cef_url, \ + cef_rev, cef_ver, chromium_url, chromium_rev, chromium_ver, date) + + # transfer include files + transfer_gypi_files(cef_dir, cef_paths2['includes_mac'], \ + 'include/', include_dir, options.quiet) + + # transfer cefclient files + transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_mac'], \ + 'tests/cefclient/', cefclient_dir, options.quiet) + transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_mac_helper'], \ + 'tests/cefclient/', cefclient_dir, options.quiet) + + # transfer cefclient/mac files + copy_dir(os.path.join(cef_dir, 'tests/cefclient/mac/'), os.path.join(output_dir, 'cefclient/mac/'), \ + options.quiet) + + # transfer xcodebuild/Debug files + build_dir = os.path.join(src_dir, 'xcodebuild/Debug') + if not options.allowpartial or path_exists(build_dir): + dst_dir = os.path.join(output_dir, 'Debug') + make_dir(dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'ffmpegsumo.so'), dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'libcef.dylib'), dst_dir, options.quiet) + else: + build_dir = None + + # transfer xcodebuild/Release files + build_dir = os.path.join(src_dir, 'xcodebuild/Release') + if not options.allowpartial or path_exists(build_dir): + dst_dir = os.path.join(output_dir, 'Release') + make_dir(dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'ffmpegsumo.so'), dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'libcef.dylib'), dst_dir, options.quiet) + + if not options.nosymbols: + # create the real dSYM file from the "fake" dSYM file + sys.stdout.write("Creating the real dSYM file...\n") + src_path = os.path.join(build_dir, 'libcef.dylib.dSYM/Contents/Resources/DWARF/libcef.dylib') + dst_path = os.path.join(symbol_dir, 'libcef.dylib.dSYM') + run('dsymutil '+src_path+' -o '+dst_path, cef_dir) + else: + build_dir = None + + if not build_dir is None: + # transfer resource files + dst_dir = os.path.join(output_dir, 'Resources') + make_dir(dst_dir, options.quiet) + copy_files(os.path.join(build_dir, 'cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/*.*'), \ + dst_dir, options.quiet) + + # transfer additional files, if any + transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/mac/transfer.cfg'), \ + output_dir, options.quiet) + + # Generate Xcode project files + sys.stdout.write('Generating Xcode project files...') + gyper = [ 'python', 'tools/gyp_cef', os.path.relpath(os.path.join(output_dir, 'cefclient.gyp'), cef_dir) ] + RunAction(cef_dir, gyper); + + # Post-process the Xcode project to fix file paths + src_file = os.path.join(output_dir, 'cefclient.xcodeproj/project.pbxproj') + data = read_file(src_file) + data = data.replace('../../../build/mac/', 'tools/') + data = data.replace('../../../build', 'build') + data = data.replace('../../../xcodebuild', 'xcodebuild') + write_file(src_file, data) + +elif platform == 'linux': + # create the README.TXT file + create_readme(os.path.join(script_dir, 'distrib/linux/README.txt'), output_dir, cef_url, \ + cef_rev, cef_ver, chromium_url, chromium_rev, chromium_ver, date) + + # transfer out/Debug files + build_dir = os.path.join(src_dir, 'out/Debug'); + if not options.allowpartial or path_exists(build_dir): + dst_dir = os.path.join(output_dir, 'Debug') + make_dir(dst_dir, options.quiet) + copy_dir(os.path.join(build_dir, 'lib.target'), os.path.join(dst_dir, 'lib.target'), options.quiet) + copy_file(os.path.join(build_dir, 'cefclient'), dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'cef.pak'), dst_dir, options.quiet) + copy_dir(os.path.join(build_dir, 'locales'), os.path.join(dst_dir, 'locales'), options.quiet) + else: + sys.stderr.write("No Debug build files.\n") + + # transfer out/Release files + build_dir = os.path.join(src_dir, 'out/Release'); + if not options.allowpartial or path_exists(build_dir): + dst_dir = os.path.join(output_dir, 'Release') + make_dir(dst_dir, options.quiet) + copy_dir(os.path.join(build_dir, 'lib.target'), os.path.join(dst_dir, 'lib.target'), options.quiet) + copy_file(os.path.join(build_dir, 'cefclient'), dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'cef.pak'), dst_dir, options.quiet) + copy_dir(os.path.join(build_dir, 'locales'), os.path.join(dst_dir, 'locales'), options.quiet) + else: + sys.stderr.write("No Release build files.\n") + + # transfer include files + transfer_gypi_files(cef_dir, cef_paths2['includes_linux'], \ + 'include/', include_dir, options.quiet) + + # transfer cefclient files + transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_linux'], \ + 'tests/cefclient/', cefclient_dir, options.quiet) + + # transfer additional files, if any + transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/linux/transfer.cfg'), \ + output_dir, options.quiet) + +# Create an archive of the output directory +zip_file = os.path.split(output_dir)[1] + '.zip' +if not options.quiet: + sys.stdout.write('Creating '+zip_file+"...\n") +create_archive(output_dir, os.path.join(output_dir, os.pardir, zip_file)) + +if not options.nosymbols: + # Create an archive of the symbol directory + zip_file = os.path.split(symbol_dir)[1] + '.zip' + if not options.quiet: + sys.stdout.write('Creating '+zip_file+"...\n") + create_archive(symbol_dir, os.path.join(symbol_dir, os.pardir, zip_file)) diff --git a/tools/make_distrib.sh b/tools/make_distrib.sh new file mode 100755 index 000000000..273a3e16b --- /dev/null +++ b/tools/make_distrib.sh @@ -0,0 +1,2 @@ +#!/bin/sh +python make_distrib.py --output-dir ../binary_distrib/ $@ diff --git a/tools/make_gypi_file.py b/tools/make_gypi_file.py new file mode 100644 index 000000000..e5cefd7a9 --- /dev/null +++ b/tools/make_gypi_file.py @@ -0,0 +1,108 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +from cef_parser import * + +def make_gypi_file(header): + # header string + result = \ +"""# Copyright (c) $YEAR$ The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. +# +# --------------------------------------------------------------------------- +# +# This file was generated by the CEF translator tool and should not edited +# by hand. See the translator.README.txt file in the tools directory for +# more information. +# + +{ + 'variables': { +""" + + filenames = sorted(header.get_file_names()) + + # cpp includes + result += " 'autogen_cpp_includes': [\n" + for filename in filenames: + result += " 'include/"+filename+"',\n" + result += " ],\n" + + # capi includes + result += " 'autogen_capi_includes': [\n" + for filename in filenames: + result += " 'include/capi/"+get_capi_file_name(filename)+"',\n" + result += " ],\n" + + classes = sorted(header.get_class_names()) + + # library side includes + result += " 'autogen_library_side': [\n" + for clsname in classes: + cls = header.get_class(clsname) + filename = get_capi_name(clsname[3:], False) + if cls.is_library_side(): + result += " 'libcef_dll/cpptoc/"+filename+"_cpptoc.cc',\n" \ + " 'libcef_dll/cpptoc/"+filename+"_cpptoc.h',\n" + else: + result += " 'libcef_dll/ctocpp/"+filename+"_ctocpp.cc',\n" \ + " 'libcef_dll/ctocpp/"+filename+"_ctocpp.h',\n" + result += " ],\n" + + # client side includes + result += " 'autogen_client_side': [\n" + for clsname in classes: + cls = header.get_class(clsname) + filename = get_capi_name(clsname[3:], False) + if cls.is_library_side(): + result += " 'libcef_dll/ctocpp/"+filename+"_ctocpp.cc',\n" \ + " 'libcef_dll/ctocpp/"+filename+"_ctocpp.h',\n" + else: + result += " 'libcef_dll/cpptoc/"+filename+"_cpptoc.cc',\n" \ + " 'libcef_dll/cpptoc/"+filename+"_cpptoc.h',\n" + result += " ],\n" + + # footer string + result += \ +""" }, +} +""" + + # add the copyright year + result = result.replace('$YEAR$', get_year()) + + return result + +def write_gypi_file(header, file, backup): + if path_exists(file): + oldcontents = read_file(file) + else: + oldcontents = '' + + newcontents = make_gypi_file(header) + if newcontents != oldcontents: + if backup and oldcontents != '': + backup_file(file) + write_file(file, newcontents) + return True + + return False + + +# test the module +if __name__ == "__main__": + import sys + + # verify that the correct number of command-line arguments are provided + if len(sys.argv) < 2: + sys.stderr.write('Usage: '+sys.argv[0]+' ') + sys.exit() + + # create the header object + header = obj_header() + header.add_file(sys.argv[1]) + + # dump the result to stdout + sys.stdout.write(make_gypi_file(header)) diff --git a/tools/make_gypi_file.pyc b/tools/make_gypi_file.pyc new file mode 100644 index 000000000..d0c427b3d Binary files /dev/null and b/tools/make_gypi_file.pyc differ diff --git a/tools/make_pack_header.py b/tools/make_pack_header.py new file mode 100644 index 000000000..0b4cb2e04 --- /dev/null +++ b/tools/make_pack_header.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file. + +""" +A simple utility function to merge pack resource files into a single resource file. +""" + +from date_util import * +from file_util import * +import os +import re +import string +import sys + + +def MakeFileSegment(input): + result = """ + +// --------------------------------------------------------------------------- +// From $FILE$: +""" + + filename = os.path.split(input)[1] + result = result.replace('$FILE$', filename) + + contents = read_file(input) + + # identify the defines in the file + p = re.compile('#define\s([A-Za-z0-9_]{1,})\s([0-9]{1,})') + list = p.findall(contents) + for name, id in list: + result += "\n#define %s %s" % (name, id) + + return result + + +def MakeFile(output, input): + # header string + result = \ +"""// Copyright (c) $YEAR$ Marshall A. Greenblatt. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the name Chromium Embedded +// Framework nor the names of its contributors may be used to endorse +// or promote products derived from this software without specific prior +// written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// --------------------------------------------------------------------------- +// +// This file is generated by the make_pack_header.py tool. +// + +#ifndef $GUARD$ +#define $GUARD$ +#pragma once""" + + # sort the input files by name + input = sorted(input, key=lambda path: os.path.split(path)[1]) + + # generate the file segments + for file in input: + result += MakeFileSegment(file) + + # footer string + result += \ +""" + +#endif // $GUARD$ +""" + + # add the copyright year + result = result.replace('$YEAR$', get_year()) + # add the guard string + filename = os.path.split(output)[1] + guard = 'CEF_INCLUDE_'+string.upper(filename.replace('.', '_'))+'_' + result = result.replace('$GUARD$', guard) + + if path_exists(output): + old_contents = read_file(output) + else: + old_contents = '' + + if (result != old_contents): + write_file(output, result) + sys.stdout.write('File '+output+' updated.\n') + else: + sys.stdout.write('File '+output+' is already up to date.\n') + +def main(argv): + if len(argv) < 3: + print ("Usage:\n %s [input_file2] ... " % + argv[0]) + sys.exit(-1) + MakeFile(argv[1], argv[2:]) + + +if '__main__' == __name__: + main(sys.argv) diff --git a/tools/make_version_header.bat b/tools/make_version_header.bat new file mode 100644 index 000000000..03337156f --- /dev/null +++ b/tools/make_version_header.bat @@ -0,0 +1,2 @@ +@echo off +..\third_party\python_26\python.exe tools\make_version_header.py --header include\cef_version.h --version ../chrome/VERSION diff --git a/tools/make_version_header.py b/tools/make_version_header.py new file mode 100644 index 000000000..0158a8cd6 --- /dev/null +++ b/tools/make_version_header.py @@ -0,0 +1,133 @@ +# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +from date_util import * +from file_util import * +from optparse import OptionParser +import svn_util as svn +import git_util as git +import sys + +# cannot be loaded as a module +if __name__ != "__main__": + sys.stderr.write('This file cannot be loaded as a module!') + sys.exit() + + +# parse command-line options +disc = """ +This utility creates the version header file. +""" + +parser = OptionParser(description=disc) +parser.add_option('--header', dest='header', metavar='FILE', + help='output version header file [required]') +parser.add_option('--version', dest='version', metavar='FILE', + help='input Chrome version config file [required]') +parser.add_option('-q', '--quiet', + action='store_true', dest='quiet', default=False, + help='do not output detailed status information') +(options, args) = parser.parse_args() + +# the header option is required +if options.header is None or options.version is None: + parser.print_help(sys.stdout) + sys.exit() + +def write_svn_header(header, version): + """ Creates the header file for the current revision and Chrome version information + if the information has changed or if the file doesn't already exist. """ + + if not path_exists(version): + raise Exception('Version file '+version+' does not exist.') + + # Read and parse the version file (key=value pairs, one per line) + chrome = {} + lines = read_file(version).split("\n") + for line in lines: + parts = line.split('=', 1) + if len(parts) == 2: + chrome[parts[0]] = parts[1] + + if path_exists(header): + oldcontents = read_file(header) + else: + oldcontents = '' + + year = get_year() + + try: + revision = svn.get_revision() + except: + revision = git.get_svn_revision() + + newcontents = '// Copyright (c) '+year+' Marshall A. Greenblatt. All rights reserved.\n'+\ + '//\n'+\ + '// Redistribution and use in source and binary forms, with or without\n'+\ + '// modification, are permitted provided that the following conditions are\n'+\ + '// met:\n'+\ + '//\n'+\ + '// * Redistributions of source code must retain the above copyright\n'+\ + '// notice, this list of conditions and the following disclaimer.\n'+\ + '// * Redistributions in binary form must reproduce the above\n'+\ + '// copyright notice, this list of conditions and the following disclaimer\n'+\ + '// in the documentation and/or other materials provided with the\n'+\ + '// distribution.\n'+\ + '// * Neither the name of Google Inc. nor the name Chromium Embedded\n'+\ + '// Framework nor the names of its contributors may be used to endorse\n'+\ + '// or promote products derived from this software without specific prior\n'+\ + '// written permission.\n'+\ + '//\n'+\ + '// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n'+\ + '// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n'+\ + '// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n'+\ + '// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n'+\ + '// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n'+\ + '// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n'+\ + '// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n'+\ + '// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n'+\ + '// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n'+\ + '// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n'+\ + '// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n'+\ + '//\n'+\ + '// ---------------------------------------------------------------------------\n'+\ + '//\n'+\ + '// This file is generated by the make_version_header.py tool.\n'+\ + '//\n\n'+\ + '#ifndef CEF_INCLUDE_CEF_VERSION_H_\n'+\ + '#define CEF_INCLUDE_CEF_VERSION_H_\n\n'+\ + '#define CEF_REVISION ' + revision + '\n'+\ + '#define COPYRIGHT_YEAR ' + year + '\n\n'+\ + '#define CHROME_VERSION_MAJOR ' + chrome['MAJOR'] + '\n'+\ + '#define CHROME_VERSION_MINOR ' + chrome['MINOR'] + '\n'+\ + '#define CHROME_VERSION_BUILD ' + chrome['BUILD'] + '\n'+\ + '#define CHROME_VERSION_PATCH ' + chrome['PATCH'] + '\n\n'+\ + '#define DO_MAKE_STRING(p) #p\n'+\ + '#define MAKE_STRING(p) DO_MAKE_STRING(p)\n\n'+\ + '#ifndef APSTUDIO_HIDDEN_SYMBOLS\n\n'\ + '#ifdef __cplusplus\n'+\ + 'extern "C" {\n'+\ + '#endif\n\n'+\ + '#include "internal/cef_export.h"\n\n'+\ + '///\n'+\ + '// Returns the CEF build revision of the libcef library.\n'+\ + '///\n'+\ + 'CEF_EXPORT int cef_build_revision();\n\n'+\ + '#ifdef __cplusplus\n'+\ + '}\n'+\ + '#endif\n\n'+\ + '#endif // APSTUDIO_HIDDEN_SYMBOLS\n\n'+\ + '#endif // CEF_INCLUDE_CEF_VERSION_H_\n' + if newcontents != oldcontents: + write_file(header, newcontents) + return True + + return False + +written = write_svn_header(options.header, options.version) +if not options.quiet: + if written: + sys.stdout.write('File '+options.header+' updated.\n') + else: + sys.stdout.write('File '+options.header+' is already up to date.\n') diff --git a/tools/patch.bat b/tools/patch.bat new file mode 100644 index 000000000..b21981a0d --- /dev/null +++ b/tools/patch.bat @@ -0,0 +1,2 @@ +@echo off +..\third_party\python_26\python.exe tools\patcher.py --patch-config patch/patch.cfg \ No newline at end of file diff --git a/tools/patch.sh b/tools/patch.sh new file mode 100755 index 000000000..b9dde9bc0 --- /dev/null +++ b/tools/patch.sh @@ -0,0 +1,2 @@ +#!/bin/sh +python tools/patcher.py --patch-config patch/patch.cfg diff --git a/tools/patch_util.py b/tools/patch_util.py new file mode 100644 index 000000000..990b81f32 --- /dev/null +++ b/tools/patch_util.py @@ -0,0 +1,560 @@ +""" Patch utility to apply unified diffs """ +""" Brute-force line-by-line parsing + + Project home: http://code.google.com/p/python-patch/ + + This file is subject to the MIT license available here: + http://www.opensource.org/licenses/mit-license.php + + CEF Changes + ----------- + + 2009/07/22 + - Add a 'root_directory' argument to PatchInfo::apply + - Fix a Python 2.4 compile error in PatchInfo::parse_stream + +""" + +__author__ = "techtonik.rainforce.org" +__version__ = "8.12-1" + +import copy +import logging +import os +import re +from stat import * +# cStringIO doesn't support unicode in 2.5 +from StringIO import StringIO +from logging import debug, info, warning + +from os.path import exists, isfile +from os import unlink + +debugmode = False + + +def from_file(filename): + """ read and parse patch file + return PatchInfo() object + """ + + info("reading patch from file %s" % filename) + fp = open(filename, "rb") + patch = PatchInfo(fp) + fp.close() + return patch + + +def from_string(s): + """ parse text string and return PatchInfo() object """ + return PatchInfo( + StringIO.StringIO(s) + ) + + +class HunkInfo(object): + """ parsed hunk data (hunk starts with @@ -R +R @@) """ + + def __init__(self): + # define HunkInfo data members + self.startsrc=None + self.linessrc=None + self.starttgt=None + self.linestgt=None + self.invalid=False + self.text=[] + + def copy(self): + return copy.copy(self) + +# def apply(self, estream): +# """ write hunk data into enumerable stream +# return strings one by one until hunk is +# over +# +# enumerable stream are tuples (lineno, line) +# where lineno starts with 0 +# """ +# pass + + + + +class PatchInfo(object): + """ patch information container """ + + def __init__(self, stream=None): + """ parse incoming stream """ + + # define PatchInfo data members + # table with a row for every source file + + #: list of source filenames + self.source=None + self.target=None + #: list of lists of hunks + self.hunks=None + #: file endings statistics for every hunk + self.hunkends=None + + if stream: + self.parse_stream(stream) + + def copy(self): + return copy.copy(self) + + def parse_stream(self, stream): + """ parse unified diff """ + self.source = [] + self.target = [] + self.hunks = [] + self.hunkends = [] + + # define possible file regions that will direct the parser flow + header = False # comments before the patch body + filenames = False # lines starting with --- and +++ + + hunkhead = False # @@ -R +R @@ sequence + hunkbody = False # + hunkskip = False # skipping invalid hunk mode + + header = True + lineends = dict(lf=0, crlf=0, cr=0) + nextfileno = 0 + nexthunkno = 0 #: even if index starts with 0 user messages number hunks from 1 + + # hunkinfo holds parsed values, hunkactual - calculated + hunkinfo = HunkInfo() + hunkactual = dict(linessrc=None, linestgt=None) + + fe = enumerate(stream) + for lineno, line in fe: + + # analyze state + if header and line.startswith("--- "): + header = False + # switch to filenames state + filenames = True + #: skip hunkskip and hunkbody code until you read definition of hunkhead + if hunkbody: + # process line first + if re.match(r"^[- \+\\]", line): + # gather stats about line endings + if line.endswith("\r\n"): + self.hunkends[nextfileno-1]["crlf"] += 1 + elif line.endswith("\n"): + self.hunkends[nextfileno-1]["lf"] += 1 + elif line.endswith("\r"): + self.hunkends[nextfileno-1]["cr"] += 1 + + if line.startswith("-"): + hunkactual["linessrc"] += 1 + elif line.startswith("+"): + hunkactual["linestgt"] += 1 + elif not line.startswith("\\"): + hunkactual["linessrc"] += 1 + hunkactual["linestgt"] += 1 + hunkinfo.text.append(line) + # todo: handle \ No newline cases + else: + warning("invalid hunk no.%d at %d for target file %s" % (nexthunkno, lineno+1, self.target[nextfileno-1])) + # add hunk status node + self.hunks[nextfileno-1].append(hunkinfo.copy()) + self.hunks[nextfileno-1][nexthunkno-1]["invalid"] = True + # switch to hunkskip state + hunkbody = False + hunkskip = True + + # check exit conditions + if hunkactual["linessrc"] > hunkinfo.linessrc or hunkactual["linestgt"] > hunkinfo.linestgt: + warning("extra hunk no.%d lines at %d for target %s" % (nexthunkno, lineno+1, self.target[nextfileno-1])) + # add hunk status node + self.hunks[nextfileno-1].append(hunkinfo.copy()) + self.hunks[nextfileno-1][nexthunkno-1]["invalid"] = True + # switch to hunkskip state + hunkbody = False + hunkskip = True + elif hunkinfo.linessrc == hunkactual["linessrc"] and hunkinfo.linestgt == hunkactual["linestgt"]: + self.hunks[nextfileno-1].append(hunkinfo.copy()) + # switch to hunkskip state + hunkbody = False + hunkskip = True + + # detect mixed window/unix line ends + ends = self.hunkends[nextfileno-1] + if ((ends["cr"]!=0) + (ends["crlf"]!=0) + (ends["lf"]!=0)) > 1: + warning("inconsistent line ends in patch hunks for %s" % self.source[nextfileno-1]) + if debugmode: + debuglines = dict(ends) + debuglines.update(file=self.target[nextfileno-1], hunk=nexthunkno) + debug("crlf: %(crlf)d lf: %(lf)d cr: %(cr)d\t - file: %(file)s hunk: %(hunk)d" % debuglines) + + if hunkskip: + match = re.match("^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))?", line) + if match: + # switch to hunkhead state + hunkskip = False + hunkhead = True + elif line.startswith("--- "): + # switch to filenames state + hunkskip = False + filenames = True + if debugmode and len(self.source) > 0: + debug("- %2d hunks for %s" % (len(self.hunks[nextfileno-1]), self.source[nextfileno-1])) + + if filenames: + if line.startswith("--- "): + if nextfileno in self.source: + warning("skipping invalid patch for %s" % self.source[nextfileno]) + del self.source[nextfileno] + # double source filename line is encountered + # attempt to restart from this second line + re_filename = "^--- ([^\t]+)" + match = re.match(re_filename, line) + if not match: + warning("skipping invalid filename at line %d" % lineno) + # switch back to header state + filenames = False + header = True + else: + self.source.append(match.group(1)) + elif not line.startswith("+++ "): + if nextfileno in self.source: + warning("skipping invalid patch with no target for %s" % self.source[nextfileno]) + del self.source[nextfileno] + else: + # this should be unreachable + warning("skipping invalid target patch") + filenames = False + header = True + else: + if nextfileno in self.target: + warning("skipping invalid patch - double target at line %d" % lineno) + del self.source[nextfileno] + del self.target[nextfileno] + nextfileno -= 1 + # double target filename line is encountered + # switch back to header state + filenames = False + header = True + else: + re_filename = "^\+\+\+ ([^\t]+)" + match = re.match(re_filename, line) + if not match: + warning("skipping invalid patch - no target filename at line %d" % lineno) + # switch back to header state + filenames = False + header = True + else: + self.target.append(match.group(1)) + nextfileno += 1 + # switch to hunkhead state + filenames = False + hunkhead = True + nexthunkno = 0 + self.hunks.append([]) + self.hunkends.append(lineends.copy()) + continue + + + if hunkhead: + match = re.match("^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))?", line) + if not match: + if nextfileno-1 not in self.hunks: + warning("skipping invalid patch with no hunks for file %s" % self.target[nextfileno-1]) + # switch to header state + hunkhead = False + header = True + continue + else: + # switch to header state + hunkhead = False + header = True + else: + hunkinfo.startsrc = int(match.group(1)) + if match.group(3): + hunkinfo.linessrc = int(match.group(3)) + else: + hunkinfo.linessrc = 1 + hunkinfo.starttgt = int(match.group(4)) + if match.group(6): + hunkinfo.linestgt = int(match.group(6)) + else: + hunkinfo.linestgt = 1 + hunkinfo.invalid = False + hunkinfo.text = [] + + hunkactual["linessrc"] = hunkactual["linestgt"] = 0 + + # switch to hunkbody state + hunkhead = False + hunkbody = True + nexthunkno += 1 + continue + else: + if not hunkskip: + warning("patch file incomplete - %s" % filename) + # sys.exit(?) + else: + # duplicated message when an eof is reached + if debugmode and len(self.source) > 0: + debug("- %2d hunks for %s" % (len(self.hunks[nextfileno-1]), self.source[nextfileno-1])) + + info("total files: %d total hunks: %d" % (len(self.source), sum(len(hset) for hset in self.hunks))) + + def apply(self, root_directory = None): + """ apply parsed patch """ + + total = len(self.source) + for fileno, filename in enumerate(self.source): + + f2patch = filename + if not root_directory is None: + f2patch = root_directory + f2patch + if not exists(f2patch): + f2patch = self.target[fileno] + if not exists(f2patch): + warning("source/target file does not exist\n--- %s\n+++ %s" % (filename, f2patch)) + continue + if not isfile(f2patch): + warning("not a file - %s" % f2patch) + continue + filename = f2patch + + info("processing %d/%d:\t %s" % (fileno+1, total, filename)) + + # validate before patching + f2fp = open(filename) + hunkno = 0 + hunk = self.hunks[fileno][hunkno] + hunkfind = [] + hunkreplace = [] + validhunks = 0 + canpatch = False + for lineno, line in enumerate(f2fp): + if lineno+1 < hunk.startsrc: + continue + elif lineno+1 == hunk.startsrc: + hunkfind = [x[1:].rstrip("\r\n") for x in hunk.text if x[0] in " -"] + hunkreplace = [x[1:].rstrip("\r\n") for x in hunk.text if x[0] in " +"] + #pprint(hunkreplace) + hunklineno = 0 + + # todo \ No newline at end of file + + # check hunks in source file + if lineno+1 < hunk.startsrc+len(hunkfind)-1: + if line.rstrip("\r\n") == hunkfind[hunklineno]: + hunklineno+=1 + else: + debug("hunk no.%d doesn't match source file %s" % (hunkno+1, filename)) + # file may be already patched, but we will check other hunks anyway + hunkno += 1 + if hunkno < len(self.hunks[fileno]): + hunk = self.hunks[fileno][hunkno] + continue + else: + break + + # check if processed line is the last line + if lineno+1 == hunk.startsrc+len(hunkfind)-1: + debug("file %s hunk no.%d -- is ready to be patched" % (filename, hunkno+1)) + hunkno+=1 + validhunks+=1 + if hunkno < len(self.hunks[fileno]): + hunk = self.hunks[fileno][hunkno] + else: + if validhunks == len(self.hunks[fileno]): + # patch file + canpatch = True + break + else: + if hunkno < len(self.hunks[fileno]): + warning("premature end of source file %s at hunk %d" % (filename, hunkno+1)) + + f2fp.close() + + if validhunks < len(self.hunks[fileno]): + if check_patched(filename, self.hunks[fileno]): + warning("already patched %s" % filename) + else: + warning("source file is different - %s" % filename) + if canpatch: + backupname = filename+".orig" + if exists(backupname): + warning("can't backup original file to %s - aborting" % backupname) + else: + import shutil + shutil.move(filename, backupname) + if patch_hunks(backupname, filename, self.hunks[fileno]): + warning("successfully patched %s" % filename) + unlink(backupname) + else: + warning("error patching file %s" % filename) + shutil.copy(filename, filename+".invalid") + warning("invalid version is saved to %s" % filename+".invalid") + # todo: proper rejects + shutil.move(backupname, filename) + + # todo: check for premature eof + + + +def check_patched(filename, hunks): + matched = True + fp = open(filename) + + class NoMatch(Exception): + pass + + lineno = 1 + line = fp.readline() + hno = None + try: + if not len(line): + raise NoMatch + for hno, h in enumerate(hunks): + # skip to line just before hunk starts + while lineno < h.starttgt-1: + line = fp.readline() + lineno += 1 + if not len(line): + raise NoMatch + for hline in h.text: + # todo: \ No newline at the end of file + if not hline.startswith("-") and not hline.startswith("\\"): + line = fp.readline() + lineno += 1 + if not len(line): + raise NoMatch + if line.rstrip("\r\n") != hline[1:].rstrip("\r\n"): + warning("file is not patched - failed hunk: %d" % (hno+1)) + raise NoMatch + except NoMatch: + matched = False + # todo: display failed hunk, i.e. expected/found + + fp.close() + return matched + + + +def patch_stream(instream, hunks): + """ given a source stream and hunks iterable, yield patched stream + + converts lineends in hunk lines to the best suitable format + autodetected from input + """ + + # todo: At the moment substituted lineends may not be the same + # at the start and at the end of patching. Also issue a + # warning/throw about mixed lineends (is it really needed?) + + hunks = iter(hunks) + + srclineno = 1 + + lineends = {'\n':0, '\r\n':0, '\r':0} + def get_line(): + """ + local utility function - return line from source stream + collecting line end statistics on the way + """ + line = instream.readline() + # 'U' mode works only with text files + if line.endswith("\r\n"): + lineends["\r\n"] += 1 + elif line.endswith("\n"): + lineends["\n"] += 1 + elif line.endswith("\r"): + lineends["\r"] += 1 + return line + + + for hno, h in enumerate(hunks): + debug("hunk %d" % (hno+1)) + # skip to line just before hunk starts + while srclineno < h.startsrc: + yield get_line() + srclineno += 1 + + for hline in h.text: + # todo: check \ No newline at the end of file + if hline.startswith("-") or hline.startswith("\\"): + get_line() + srclineno += 1 + continue + else: + if not hline.startswith("+"): + get_line() + srclineno += 1 + line2write = hline[1:] + # detect if line ends are consistent in source file + if sum([bool(lineends[x]) for x in lineends]) == 1: + newline = [x for x in lineends if lineends[x] != 0][0] + yield line2write.rstrip("\r\n")+newline + else: # newlines are mixed + yield line2write + + for line in instream: + yield line + + + +def patch_hunks(srcname, tgtname, hunks): + # get the current file mode + mode = os.stat(srcname)[ST_MODE] + + src = open(srcname, "rb") + tgt = open(tgtname, "wb") + + debug("processing target file %s" % tgtname) + + tgt.writelines(patch_stream(src, hunks)) + + tgt.close() + src.close() + + # restore the file mode + os.chmod(tgtname, mode) + + return True + + + + + + +from optparse import OptionParser +from os.path import exists +import sys + +if __name__ == "__main__": + opt = OptionParser(usage="%prog [options] unipatch-file", version="python-patch %s" % __version__) + opt.add_option("-d", action="store_true", dest="debugmode", help="debug mode") + (options, args) = opt.parse_args() + + if not args: + opt.print_version() + print("") + opt.print_help() + sys.exit() + debugmode = options.debugmode + patchfile = args[0] + if not exists(patchfile) or not isfile(patchfile): + sys.exit("patch file does not exist - %s" % patchfile) + + + if debugmode: + logging.basicConfig(level=logging.DEBUG, format="%(levelname)8s %(message)s") + else: + logging.basicConfig(level=logging.INFO, format="%(message)s") + + + + patch = from_file(patchfile) + #pprint(patch) + patch.apply() + + # todo: document and test line ends handling logic - patch.py detects proper line-endings + # for inserted hunks and issues a warning if patched file has incosistent line ends diff --git a/tools/patch_util.pyc b/tools/patch_util.pyc new file mode 100644 index 000000000..482f4539e Binary files /dev/null and b/tools/patch_util.pyc differ diff --git a/tools/patcher.README.txt b/tools/patcher.README.txt new file mode 100644 index 000000000..2078770a4 --- /dev/null +++ b/tools/patcher.README.txt @@ -0,0 +1,32 @@ +Chromium Embedded Framework (CEF) Patch Application Tool -- patcher.py +------------------------------------------------------------------------------- + +Document Last Updated: July 23, 2009 + + +OVERVIEW +-------- + +The CEF patch application tool is used by the patch project to apply patches +to the Chromium and WebKit code bases. Currently only unified diff format is +supported. See the README.txt file in the patch directory for information on +how the patch project uses this tool. + +The 'patcher.bat' file can be used to run the patch application tool with +command-line arguments that match the default CEF directory structure and +output options. Run 'patcher.py -h' for a complete list of available command- +line arguments. + + +CREDITS +------- + +Thanks go to techtonik for developing the python-patch script. The +patch_util.py file is a slightly modified version of the original script which +can be found here: http://code.google.com/p/python-patch/ + + +WORK REMAINING +-------------- + +o Add support for the GIT patch format. diff --git a/tools/patcher.py b/tools/patcher.py new file mode 100644 index 000000000..ed5ff723e --- /dev/null +++ b/tools/patcher.py @@ -0,0 +1,98 @@ +# Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +import pickle +from optparse import OptionParser +import os +import sys +from file_util import * +from patch_util import * + + +# cannot be loaded as a module +if __name__ != "__main__": + sys.stderr.write('This file cannot be loaded as a module!') + sys.exit() + + +# parse command-line options +disc = """ +This utility applies patch files. +""" + +parser = OptionParser(description=disc) +parser.add_option('--patch-config', dest='patchconfig', metavar='DIR', + help='patch configuration file') +(options, args) = parser.parse_args() + +# the patchconfig option is required +if options.patchconfig is None: + parser.print_help(sys.stdout) + sys.exit() + +# normalize the patch directory value +patchdir = os.path.dirname(os.path.abspath(options.patchconfig)).replace('\\', '/') +if patchdir[-1] != '/': + patchdir += '/' + +# check if the patching should be skipped +if os.path.isfile(patchdir + 'NOPATCH'): + nopatch = True + sys.stdout.write('NOPATCH exists -- files have not been patched.\n') +else: + nopatch = False + # locate the patch configuration file + if not os.path.isfile(options.patchconfig): + sys.stderr.write('File '+options.patchconfig+' does not exist.\n') + sys.exit() + + scope = {} + execfile(options.patchconfig, scope) + patches = scope["patches"] + + for patch in patches: + file = patchdir+'patches/'+patch['name']+'.patch' + dopatch = True + + if 'condition' in patch: + # Check that the environment variable is set. + if patch['condition'] not in os.environ: + sys.stderr.write('Skipping patch file '+file+'\n') + dopatch = False + + if dopatch: + if not os.path.isfile(file): + sys.stderr.write('Patch file '+file+' does not exist.\n') + else: + sys.stderr.write('Reading patch file '+file+'\n') + dir = patch['path'] + patchObj = from_file(file) + patchObj.apply(dir) + +# read the current include file, if any +incfile = patchdir + 'patch_state.h' +if nopatch: + incnew = """// This file is generated by the patch tool and should not be edited manually. +#ifndef _PATCH_STATE_H +#define _PATCH_STATE_H +// No patches have been applied to the Chromium/WebKit source base. +#define CEF_PATCHES_APPLIED 0 +#endif // _PATCH_STATE_H +""" +else: + incnew = """// This file is generated by the patch tool and should not be edited manually. +#ifndef _PATCH_STATE_H +#define _PATCH_STATE_H +// Patches have been applied to the Chromium/WebKit source base. +#define CEF_PATCHES_APPLIED 1 +#endif // _PATCH_STATE_H +""" + +inccur = '' +if os.path.isfile(incfile): + inccur = read_file(incfile) + +if inccur != incnew: + sys.stdout.write('Writing file '+incfile+'.\n') + write_file(incfile, incnew) \ No newline at end of file diff --git a/tools/repack_locales.py b/tools/repack_locales.py new file mode 100644 index 000000000..5cf52be17 --- /dev/null +++ b/tools/repack_locales.py @@ -0,0 +1,184 @@ +#!/usr/bin/env python +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Helper script to repack paks for a list of locales. + +Gyp doesn't have any built-in looping capability, so this just provides a way to +loop over a list of locales when repacking pak files, thus avoiding a +proliferation of mostly duplicate, cut-n-paste gyp actions. +""" + +import getopt +import os +import sys + +sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', + 'tools', 'grit')) +from grit.format import data_pack + +# Some build paths defined by gyp. +GRIT_DIR = None +SHARE_INT_DIR = None +INT_DIR = None + + +class Usage(Exception): + def __init__(self, msg): + self.msg = msg + + +def calc_output(locale): + """Determine the file that will be generated for the given locale.""" + #e.g. '<(INTERMEDIATE_DIR)/repack/da.pak', + # For Fake Bidi, generate it at a fixed path so that tests can safely + # reference it. + if locale == 'fake-bidi': + return '%s/%s.pak' % (INT_DIR, locale) + if sys.platform in ('darwin',): + # For Cocoa to find the locale at runtime, it needs to use '_' instead + # of '-' (http://crbug.com/20441). Also, 'en-US' should be represented + # simply as 'en' (http://crbug.com/19165, http://crbug.com/25578). + if locale == 'en-US': + locale = 'en' + return '%s/repack/%s.lproj/locale.pak' % (INT_DIR, locale.replace('-', '_')) + else: + return os.path.join(INT_DIR, 'repack', locale + '.pak') + + +def calc_inputs(locale): + """Determine the files that need processing for the given locale.""" + inputs = [] + + #e.g. '<(grit_out_dir)/generated_resources_da.pak' + #inputs.append(os.path.join(GRIT_DIR, 'generated_resources_%s.pak' % locale)) + + #e.g. '<(grit_out_dir)/locale_settings_da.pak' + #inputs.append(os.path.join(GRIT_DIR, 'locale_settings_%s.pak' % locale)) + + #e.g. '<(grit_out_dir)/platform_locale_settings_da.pak' + #inputs.append(os.path.join(GRIT_DIR, + # 'platform_locale_settings_%s.pak' % locale)) + + #e.g. '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_da.pak' + inputs.append(os.path.join(SHARE_INT_DIR, 'webkit', + 'webkit_strings_%s.pak' % locale)) + + #e.g. '<(SHARED_INTERMEDIATE_DIR)/ui/ui_strings_da.pak', + inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'ui_strings', + 'ui_strings_%s.pak' % locale)) + + #e.g. '<(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings_da.pak', + inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'app_locale_settings', + 'app_locale_settings_%s.pak' % locale)) + + #e.g. '<(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_da.pak' + inputs.append(os.path.join(SHARE_INT_DIR, 'cef', + 'cef_strings_%s.pak' % locale)) + + return inputs + + +def list_outputs(locales): + """Returns the names of files that will be generated for the given locales. + + This is to provide gyp the list of output files, so build targets can + properly track what needs to be built. + """ + outputs = [] + for locale in locales: + outputs.append(calc_output(locale)) + # Quote each element so filename spaces don't mess up gyp's attempt to parse + # it into a list. + return " ".join(['"%s"' % x for x in outputs]) + + +def list_inputs(locales): + """Returns the names of files that will be processed for the given locales. + + This is to provide gyp the list of input files, so build targets can properly + track their prerequisites. + """ + inputs = [] + for locale in locales: + inputs += calc_inputs(locale) + # Quote each element so filename spaces don't mess up gyp's attempt to parse + # it into a list. + return " ".join(['"%s"' % x for x in inputs]) + + +def repack_locales(locales): + """ Loop over and repack the given locales.""" + for locale in locales: + inputs = [] + inputs += calc_inputs(locale) + output = calc_output(locale) + data_pack.DataPack.RePack(output, inputs) + + +def DoMain(argv): + global GRIT_DIR + global SHARE_INT_DIR + global INT_DIR + + short_options = 'iog:s:x:b:h' + long_options = 'help' + + print_inputs = False + print_outputs = False + usage_msg = '' + + helpstr = """\ +Usage: %s [-h] [-i | -o] -g -x -s [...] + -h, --help Print this help, then exit. + -i Print the expected input file list, then exit. + -o Print the expected output file list, then exit. + -g DIR GRIT build files output directory. + -x DIR Intermediate build files output directory. + -s DIR Shared intermediate build files output directory. + locale [...] One or more locales to repack.""" % ( + os.path.basename(__file__)) + + try: + opts, locales = getopt.getopt(argv, short_options, long_options) + except getopt.GetoptError, msg: + raise Usage(str(msg)) + + if not locales: + usage_msg = 'Please specificy at least one locale to process.\n' + + for o, a in opts: + if o in ('-i'): + print_inputs = True + elif o in ('-o'): + print_outputs = True + elif o in ('-g'): + GRIT_DIR = a + elif o in ('-s'): + SHARE_INT_DIR = a + elif o in ('-x'): + INT_DIR = a + elif o in ('-h', '--help'): + raise Usage(helpstr) + + if not (GRIT_DIR and INT_DIR and SHARE_INT_DIR): + usage_msg += 'Please specify all of "-g" and "-x" and "-s".\n' + if print_inputs and print_outputs: + usage_msg += 'Please specify only one of "-i" or "-o".\n' + + if usage_msg: + raise Usage(usage_msg) + + if print_inputs: + return list_inputs(locales) + + if print_outputs: + return list_outputs(locales) + + return repack_locales(locales) + +if __name__ == '__main__': + results = DoMain(sys.argv[1:]) + if results: + print results diff --git a/tools/svn_util.py b/tools/svn_util.py new file mode 100644 index 000000000..39f2dda82 --- /dev/null +++ b/tools/svn_util.py @@ -0,0 +1,57 @@ +# Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +import os +import sys +import urllib + +def check_url(url): + """ Check the URL and raise an exception if invalid. """ + if ':' in url[:7]: + parts = url.split(':', 1) + if (parts[0] == 'http' or parts[0] == 'https' or parts[0] == 'svn') and \ + parts[1] == urllib.quote(parts[1]): + return url + sys.stderr.write('Invalid URL: '+url+"\n") + raise Exception('Invalid URL: '+url) + +def get_svn_info(path): + """ Retrieves the URL and revision from svn info. """ + url = 'None' + rev = 'None' + if path[0:4] == 'http' or os.path.exists(path): + try: + stream = os.popen('svn info '+path) + for line in stream: + if line[0:4] == "URL:": + url = check_url(line[5:-1]) + elif line[0:9] == "Revision:": + rev = str(int(line[10:-1])) + except IOError, (errno, strerror): + sys.stderr.write('Failed to read svn info: '+strerror+"\n") + raise + return {'url': url, 'revision': rev} + +def get_revision(path = '.'): + """ Retrieves the revision from svn info. """ + info = get_svn_info(path) + if info['revision'] == 'None': + raise Exception('Unable to retrieve SVN revision for "'+path+'"') + return info['revision'] + +def get_changed_files(path = '.'): + """ Retrieves the list of changed files from svn status. """ + files = [] + if os.path.exists(path): + try: + stream = os.popen('svn status '+path) + for line in stream: + status = line[0] + # Return paths with add, modify and switch status. + if status == 'A' or status == 'M' or status == 'S': + files.append(line[8:].strip()) + except IOError, (errno, strerror): + sys.stderr.write('Failed to read svn status: '+strerror+"\n") + raise + return files diff --git a/tools/svn_util.pyc b/tools/svn_util.pyc new file mode 100644 index 000000000..48b95f950 Binary files /dev/null and b/tools/svn_util.pyc differ diff --git a/tools/translator.README.txt b/tools/translator.README.txt new file mode 100644 index 000000000..586133b6d --- /dev/null +++ b/tools/translator.README.txt @@ -0,0 +1,1697 @@ +Chromium Embedded Framework (CEF) Translator Tool -- translator.py +------------------------------------------------------------------------------- + +Document Last Updated: February 14, 2012 + + +OVERVIEW +-------- + +The CEF translator tool automatically generates CEF source code based on the +contents of the CEF header file (cef.h). The generated source code includes the +main C API header file (cef_capi.h) and all files in the libcef_dll/cpptoc and +libcef_dll/ctocpp directories. + +If any differences are detected between the new translator-generated output and +the file that currently exists on disk a backup of the existing file will be +created before the new file is written (this behavior can be controlled using +a command-line switch -- see 'translator.py -h' for more information). Header +files (*.h) are completely generated by the translator and should never be +edited by hand. Implementation files (*.cc) may contain user-created content +within method and function body blocks. The user-created content is extracted +from the existing file and inserted into the new translator-generated file. Any +differences between existing method/function prototypes and new method/function +prototypes in manually edited implementations will be noted as a warning in new +output file. + + // WARNING - CHANGED ATTRIBUTES + // REMOVED: const wchar_t* key + // ADDED: int index + // WARNING - CHANGED RETURN VALUE + // WAS: void + // NOW: int + #pragma message("Warning: "__FILE__": MyFunction prototype has changed") + +Auto-generated implementations will be added in the new output file for any +methods/functions that exist in the CEF header file but did not exist in the +current on-disk implementation file. Each time the translator re-generates the +implementation file it will warn if an implementation could not be auto- +generated. Delete the indicated portion of the generated code after adding the +implementation manually. + + size_t CEF_CALLBACK frame_new_func(struct _cef_frame_t* self) + { + // BEGIN DELETE BEFORE MODIFYING + // AUTO-GENERATED CONTENT + #pragma message("Warning: "__FILE__": frame_new_func is not implemented") + // END DELETE BEFORE MODIFYING + } + +If the complete function or method implementation has been auto-generated the +body of the function or method will contain the following comment. + + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING + +If you edit the implementation manually you should remove this comment so that +CEF will not discard your changes on the next run of the translator tool. + +The 'translator.[bat|sh]' file can be used to run the translator tool with +command- line arguments that match the default CEF directory structure and +output options. Run 'translator.py -h' for a complete list of available command- +line arguments. + + +HEADER ATTRIBUTES +----------------- + +Comment-based attribute tags are added before each function, class and method +definition in the CEF header file to provide the translator with additional +information about how the output should be generated. The attribute tags must +be in the form of a comma-delimited list of name=value pairs. Attribute names +and values must contain only alpha-numeric characters, numbers and underscores, +and must all exist on a single line. + + /*--cef(name1=value1,name2=value2,name3=value3)--*/ + +Supported method/function attributes: + + capi_name=[string] (Optional) Force a specific output name for the + resulting C API function. + optional_param=[param] (Optional) Parameter name that will be optional + instead of required. + index_param=[param] (Optional) Parameter name representing an index + value that will be verified as >= 0. + default_retval=[string] (Required for enumeration types, Optional for other + types) Specify the default return value. + count_func=[param:func] (Required for non-const non-string std::vector + types) Specify the C++ function that returns the + count of elements for a vector parameter. + revision_check (Optional) If set a revision check will be added + to the CToCpp version of the method/function. + +Supported class attributes: + + source=[library|client] (Required) Indicates whether the class + implementation is provided by the library or the + client. This effects the generation of guard + blocks in the cpptoc and ctocpp header files. + no_debugct_check (Optional) If set the debug reference count + of the object will not be checked on shutdown. + + +TRANSLATION RULES +----------------- + +All C++ names in the CEF header file are written in CamelCaps format and all +C API translations are generated in lowercase_underscore format. + + +Translating Classes and Methods +------------------------------- + +Class names and global function names must be prefixed with the 'Cef' string. + + Global function translation + C++: void CefShutdown() + C API: void cef_shutdown() + +The translation of a C++ class name to a C API structure name is prefixed with +'_' and postfixed with '_t'. A typedef of the C API structure to a value +without the prefixed '_' is also provided and may be used interchangeably. + + Class name translation + C++: class CefPostData + C API: typedef struct _cef_post_data_t { ... } cef_post_data_t + +The translation of a C++ virtual class method to a C API member function adds a +'self' structure pointer as the first parameter. This will always be a pointer +to the structure that contains the member function. + + Virtual method translation + C++: virtual void SetFocus(bool enable) + C API: void set_focus(struct _cef_browser_t* self, int enable) + +The translation of a C++ static class method to a C API global function +is prefixed with 'cef_classname_' where 'classname' is the +lowercase_underscore name of the class that contains the static method. Any +repeat of 'classname' in the function name is removed. + + Static method translation + C++: static CefRefPtr CreateRequest() + C API: struct _cef_request_t* cef_request_create() + +Implementation of the wrapper method/function body is generally formatted as +follows. + + Static/Global CppToC (without Return): + + CEF_EXPORT void cef_function(capi_params) + { + // Parameter Verification (Optional) + // Verify the C parameter values. + // ... + + // Parameter Translation (Optional) + // Convert C parameter values to C++ parameter values. + // ... + + // Execution + CefFunction(cpp_arams); + + // Parameter Restoration (Optional) + // Retore the C parameter values if changed. + // ... + } + + Static/Global CppToC (with Return): + + CEF_EXPORT capi_retval cef_function(capi_params) + { + // Parameter Verification (Optional) + // Verify the C parameter values. + // ... + + // Parameter Translation (Optional) + // Convert C parameter values to C++ parameter values. + // ... + + // Execution + cpp_retval _rv = CefFunction(cpp_params); + + // Parameter Restoration (Optional) + // Restore the C parameter values if changed. + // ... + + // Return Translation + // Convert the C++ return value to a C return value. + return ...; + } + + Static/Global CToCpp (without Return): + + void CefFunction(cpp_params) + { + // Parameter Verification (Optional) + // Verify the C++ parameter values. + // ... + + // Parameter Translation (Optional) + // Convert C++ parameter values to C parameter values. + // ... + + // Execution + cef_function(capi_params); + + // Parameter Restoration (Optional) + // Restore the C++ parameter values if changed. + // ... + } + + Static/Global CToCpp (with Return): + + cpp_retval CefFunction(cpp_params) + { + // Parameter Verification (Optional) + // Verify the C++ parameter values. + // ... + + // Parameter Translation (Optional) + // Convert C++ parameter values to C parameter values. + // ... + + // Execution + capi_retval _rv = cef_function(capi_params); + + // Parameter Restoration (Optional) + // Restore the C++ parameter values if changed. + // ... + + // Return Translation + // Convert the C return value to a C++ return value. + return ...; + } + + Member CppToC (without Return): + + CEF_CALLBACK void class_function(cef_class_t* self, capi_params) + { + // Parameter Verification. + // Verify the C parameter values. + DCHECK(self); + DCHECK(...); + if (!self || ...) + return; + + // Parameter Translation (Optional) + // Convert the C parameter values to C++ parameter values. + // ... + + // Execution + CefClassCppToC::Get(self)->CefFunction(cpp_params); + + // Parameter Restoration (Optional) + // Restore the C parameter values if changed. + // ... + } + + Member CppToC (with Return): + + CEF_CALLBACK capi_retval class_function(cef_class_t* self, capi_params) + { + // Parameter Verification. + // Verify the C parameter values. + DCHECK(self); + DCHECK(...); + if (!self || ...) + return default_retval; // Configured or defaulted automatically. + + // Parameter Translation (Optional) + // Convert the C parameter values to C++ parameter values. + // ... + + // Execution + cpp_retval _rv = CefClassCppToC::Get(self)->CefFunction(cpp_params); + + // Parameter Restoration (Optional) + // Restore the C parameter values if changed. + // ... + + // Return Translation + // Convert the C++ return value to a C return value. + return ...; + } + + Member CToCpp (without Return): + + void CefClassCToCpp::Function(cpp_params) + { + // Structure Verification + if (CEF_MEMBER_MISSING(struct_, function)) + return; + + // Parameter Verification (Optional) + // Verify the C++ parameter values. + // ... + + // Parameter Translation (Optional) + // Convert C++ parameter values to C parameter values. + // ... + + // Execution + struct_->class_function(struct_, capi_params); + + // Parameter Restoration (Optional) + // Restore the C++ parameter values if changed. + // ... + } + + Member CToCpp (with Return): + + cpp_retval CefClassCToCpp::Function(cpp_params) + { + // Structure Verification + if (CEF_MEMBER_MISSING(struct_, function)) + return default_retval; // Configured or defaulted automatically. + + // Parameter Verification (Optional) + // Verify the C++ parameter values. + // ... + + // Parameter Translation (Optional) + // Convert C++ parameter values to C parameter values. + // ... + + // Execution + capi_retval _rv = struct_->class_function(struct_, capi_params); + + // Parameter Restoration (Optional) + // Restore the C++ parameter values if changed. + // ... + + // Return Translation + // Convert the C return value to a C++ return value. + return ...; + } + + +Translating Data Types +---------------------- + +Data types that are available in both C++ and C are left unchanged. This +includes the 'double', 'int', 'long', 'size_t' and 'void' basic types. Other +data types have differing levels of support as indicated below. The translation +tool will terminate with an exception if it encounters a data type that it +cannot translate. + +Parameters: + + Simple/enumeration type by value (simple_byval): + C++: int value + C API: int value + + // CppToC Example + CEF_EXPORT void cef_function(int value) + { + // Execution + CefFunction(value); + } + + // CToCpp Example + void CefFunction(int value) + { + // Execution + cef_function(value); + } + + Simple/enumeration type by reference (simple_byref): + C++: int& value + C API: int* value + + // CppToC Example + CEF_EXPORT void cef_function(int* value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + int valueVal = value?*value:0; + + // Execution + CefFunction(valueVal); + + // Parameter Restoration + if (value) + *value = valueVal; + } + + // CToCpp Example + void CefFunction(int& value) + { + // Execution + cef_function(&value); + } + + Simple/enumeration const type by reference (simple_byref_const): + C++: const int& value + C API: const int* value + + // CppToC Example + CEF_EXPORT void cef_function(const int* value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + int valueVal = value?*value:0; + + // Execution + CefFunction(valueVal); + } + + // CToCpp Example + void CefFunction(const int& value) + { + // Execution + cef_function(&value); + } + + Simple/enumeration type by address (simple_byaddr): + C++: int* value + C API: int* value + + // CppToC Example + CEF_EXPORT void cef_function(int* value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Execution + CefFunction(value); + } + + // CToCpp Example + void CefFunction(int* value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Execution + cef_function(value); + } + + Boolean type by value (bool_byval): + C++: bool value + C API: int value + + // CppToC Example + CEF_EXPORT void cef_function(int value) + { + // Execution + CefFunction(value?true:false); + } + + // CToCpp Example + void CefFunction(bool value) + { + // Execution + cef_function(value); + } + + Boolean type by reference (bool_byref): + C++: bool& value + C API: int* value + + // CppToC Example + CEF_EXPORT void cef_function(int* value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + bool valueBool = (value && *value)?true:false; + + // Execution + CefFunction(valueBool); + + // Parameter Restoration + if (value) + *value = valueBool?true:false; + } + + // CToCpp Example + void CefFunction(bool& value) + { + // Parameter Translation + int valueInt = value; + + // Execution + cef_function(&valueInt); + + // Parameter Restoration + value = valueInt?true:false; + } + + Boolean type by address (bool_byaddr): + C++: bool* value + C API: int* value + + // CppToC Example + CEF_EXPORT void cef_function(int* value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + bool valueBool = (value && *value)?true:false; + + // Execution + CefFunction(&valueBool); + + // Parameter Restoration + if (value) + *value = valueBool?true:false; + } + + // CToCpp Example + void CefFunction(bool* value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + int valueInt = value?*value:0; + + // Execution + cef_function(&valueInt); + + // Parameter Restoration + if (value) + *value = valueInt?true:false; + } + + Structure const type by reference (struct_byref_const): + C++: const CefPopupFeatures& value + C API: const cef_popup_features_t* value + + // CppToC Example + CEF_EXPORT void cef_function(const cef_popup_features_t* value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + CefPopupFeatures valueObj; + // Reference the existing values instead of copying. + if (value) + valueObj.Set(*value, false); + + // Execution + CefFunction(valueObj); + } + + // CToCpp Example + void CefFunction(const CefPopupFeatures& value) + { + // Execution + cef_function(&value); + } + + Structure non-const type by reference (struct_byref): + C++: CefWindowInfo& value + C API: cef_window_info_t* value + + // CppToC Example + CEF_EXPORT void cef_function(cef_window_info_t* value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + CefWindowInfo valueObj; + // Take ownership of the values. + if (value) + valueObj.AttachTo(*value); + + // Execution + CefFunction(valueObj); + + // Parameter Restoration + // Return the values to the structure. + if (value) + valueObj.DetachTo(*value); + } + + // CToCpp Example + void CefFunction(CefWindowInfo& value) + { + // Execution + cef_function(&value); + } + + String const type by reference (string_byref_const): + C++: const CefString& value + C API: const cef_string_t* value + + // CppToC Example + CEF_EXPORT void cef_function(const cef_string_t* value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Execution + CefFunction(CefString(value)); + } + + // CToCpp Example + void CefFunction(const CefString& value) + { + // Execution + cef_function(value.GetStruct()); + } + + String non-const type by reference (string_byref): + C++: CefString& value + C API: cef_string_t* value + + // CppToC Example + CEF_EXPORT void cef_function(cef_string_t* value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + CefString valueStr(value); + + // Execution + CefFunction(valueStr); + } + + // CToCpp Example + void CefFunction(CefString& value) + { + // Execution + cef_function(value.GetWritableStruct()); + } + + Smart pointer type same boundary side (refptr_same): + C++: CefRefPtr value + C API: cef_browser_t* value + + // CppToC Example + CEF_EXPORT void cef_function(cef_browser_t* value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Execution + CefFunction(CefBrowserCppToC::Unwrap(value)); + } + + // CToCpp Example + void CefFunction(CefRefPtr value) + { + // Execution + cef_function(CefBrowserCToCpp::Unwrap(value)); + } + + Smart pointer type same boundary side by reference (refptr_same_byref): + C++: CefRefPtr& value + C API: cef_client_t** value + + // CppToC Example + CEF_EXPORT void cef_function(cef_client_t** value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + CefRefPtr valuePtr; + if (value && *value) + valuePtr = CefClientCppToC::Unwrap(*value); + CefClient* valueOrig = valuePtr.get(); + + // Execution + CefFunction(valuePtr); + + // Parameter Restoration + if (value) { + if (valuePtr.get()) { + if (valuePtr.get() != valueOrig) { + // The value has been changed. + *value = CefClientCppToC::Wrap(valuePtr); + } + } else { + *value = NULL; + } + } + } + + // CToCpp Example + void CefFunction(CefRefPtr& value) + { + // Parameter Translation + cef_client_t* valueStruct = NULL; + if(value.get()) + valueStruct = CefClientCToCpp::Unwrap(value); + cef_client_t* valueOrig = valueStruct; + + // Execution + cef_function(valueStuct); + + // Parameter Restoration + if (valueStruct) { + if (valueStruct != valueOrig) { + // The value was changed. + value = CefClientCToCpp::Wrap(valueStruct); + } + } else { + value = NULL; + } + } + + Smart pointer type different boundary side (refptr_diff): + C++: CefRefPtr value + C API: cef_browser_t* value + + // CppToC Example + CEF_EXPORT void cef_function(cef_browser_t* value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Execution + CefFunction(CefBrowserCToCpp::Wrap(value)); + } + + // CToCpp Example + void CefFunction(CefRefPtr value) + { + // Execution + cef_function(CefBrowserCppToC::Wrap(value)); + } + + Smart pointer type different boundary side by reference (refptr_diff_byref): + C++: CefRefPtr& value + C API: cef_client_t** value + + // CppToC Example + CEF_EXPORT void cef_function(cef_client_t** value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + CefRefPtr valuePtr; + if (value && *value) + valuePtr = CefClientCToCpp::Wrap(*value); + CefClient* valueOrig = valuePtr.get(); + + // Execution + CefFunction(valuePtr); + + // Parameter Restoration + if (value) { + if (valuePtr.get()) { + if (valuePtr.get() != valueOrig) { + // The value has been changed. + *value = CefClientCToCpp::Unwrap(valuePtr); + } + } else { + *value = NULL; + } + } + } + + // CToCpp Example + void CefFunction(CefRefPtr& value) + { + // Parameter Translation + cef_client_t* valueStruct = NULL; + if(value.get()) + valueStruct = CefClientCppToC::Wrap(value); + cef_client_t* valueOrig = valueStruct; + + // Execution + cef_function(valueStuct); + + // Parameter Restoration + if (valueStruct) { + if (valueStruct != valueOrig) { + // The value was changed. + value = CefClientCppToC::Unwrap(valueStruct); + } + } else { + value = NULL; + } + } + + String vector type by reference (string_vec_byref): + C++: std::vector& value + C API: cef_string_list_t value + + // CppToC Example + CEF_EXPORT void cef_function(cef_string_list_t value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + std::vector valueList; + transfer_string_list_contents(value, valueList); + + // Execution + CefFunction(valueList); + + // Parameter Restoration + cef_string_list_clear(value); + transfer_string_list_contents(valueList, value); + } + + // CToCpp Example + void CefFunction(std::vector& value) + { + // Parameter Translation + cef_string_list_t valueList = cef_string_list_alloc(); + DCHECK(valueList); + if (valueList) + transfer_string_list_contents(value, valueList); + + // Execution + cef_function(valueList); + + // Parameter Restoration + if (valueList) { + value.clear(); + transfer_string_list_contents(valueList, value); + cef_string_list_free(valueList); + } + } + + String vector const type by reference (string_vec_byref_const): + C++: const std::vector& value + C API: cef_string_list_t value + + // CppToC Example + CEF_EXPORT void cef_function(cef_string_list_t value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + std::vector valueList; + transfer_string_list_contents(value, valueList); + + // Execution + CefFunction(valueList); + } + + // CToCpp Example + void CefFunction(const std::vector& value) + { + // Parameter Translation + cef_string_list_t valueList = cef_string_list_alloc(); + DCHECK(valueList); + if (valueList) + transfer_string_list_contents(value, valueList); + + // Execution + cef_function(valueList); + + // Parameter Restoration + if (valueList) + cef_string_list_free(valueList); + } + + String-to-string single map type by reference (string_map_single_byref): + C++: std::map& value + C API: cef_string_map_t value + + // CppToC Example + CEF_EXPORT void cef_function(cef_string_map_t value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + std::map valueMap; + transfer_string_map_contents(value, valueMap); + + // Execution + CefFunction(valueMap); + + // Parameter Restoration + cef_string_map_clear(value); + transfer_string_map_contents(valueMap, value); + } + + // CToCpp Example + void CefFunction(std::map& value) + { + // Parameter Translation + cef_string_map_t valueMap = cef_string_map_alloc(); + DCHECK(valueMap); + if (valueMap) + transfer_string_map_contents(value, valueMap); + + // Execution + cef_function(valueMap); + + // Parameter Restoration + if (valueMap) { + value.clear(); + transfer_string_map_contents(valueMap, value); + cef_string_map_free(valueMap); + } + } + + String-to-string single map const type by reference + (string_map_single_byref_const): + C++: const std::map& value + C API: cef_string_map_t value + + // CppToC Example + CEF_EXPORT void cef_function(cef_string_map_t value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + std::map valueMap; + transfer_string_map_contents(value, valueMap); + + // Execution + CefFunction(valueMap); + } + + // CToCpp Example + void CefFunction(const std::map& value) + { + // Parameter Translation + cef_string_map_t valueMap = cef_string_map_alloc(); + DCHECK(valueMap); + if (valueMap) + transfer_string_map_contents(value, valueMap); + + // Execution + cef_function(valueMap); + + // Parameter Restoration + if (valueMap) + cef_string_map_free(valueMap); + } + + String-to-string multi map type by reference (string_map_multi_byref): + C++: std::multimap& value + C API: cef_string_multimap_t value + + // CppToC Example + CEF_EXPORT void cef_function(cef_string_multimap_t value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + std::multimap valueMultimap; + transfer_string_multimap_contents(value, valueMultimap); + + // Execution + CefFunction(valueMultimap); + + // Parameter Restoration + cef_string_multimap_clear(value); + transfer_string_multimap_contents(valueMultimap, value); + } + + // CToCpp Example + void CefFunction(std::multimap& value) + { + // Parameter Translation + cef_string_multimap_t valueMultimap = cef_string_multimap_alloc(); + DCHECK(valueMultimap); + if (valueMultimap) + transfer_string_multimap_contents(value, valueMultimap); + + // Execution + cef_function(valueMultimap); + + // Parameter Restoration + if (valueMultimap) { + value.clear(); + transfer_string_multimap_contents(valueMultimap, value); + cef_string_multimap_free(valueMultimap); + } + } + + String-to-string multi map const type by reference + (string_map_multi_byref_const): + C++: const std::multimap& value + C API: cef_string_multimap_t value + + // CppToC Example + CEF_EXPORT void cef_function(cef_string_multimap_t value) + { + // Parameter Verification + DHECK(value); + if (!value) + return; + + // Parameter Translation + std::multimap valueMultimap; + transfer_string_multimap_contents(value, valueMultimap); + + // Execution + CefFunction(valueMultimap); + } + + // CToCpp Example + void CefFunction(const std::multimap& value) + { + // Parameter Translation + cef_string_multimap_t valueMultimap = cef_string_multimap_alloc(); + DCHECK(valueMultimap); + if (valueMultimap) + transfer_string_multimap_contents(value, valueMultimap); + + // Execution + cef_function(valueMultimap); + + // Parameter Restoration + if (valueMultimap) + cef_string_multimap_free(valueMultimap); + } + + Simple/Enumeration vector non-const type by reference (simple_vec_byref): + C++: std::vector& value + C API: size_t* valueCount, int* value + + // CppToC Example + CEF_EXPORT void cef_function(size_t* valueCount, int* value) + { + // Parameter Verification + DCHECK(valueCount && (*valueCount == 0 || value)); + if (!valueCount || (*valueCount > 0 && !value)) + return; + + // Parameter Translation + std::vector valueList; + if (valueCount && *valueCount > 0 && value) { + for (size_t i = 0; i < *valueCount; ++i) + valueList.push_back(value[i]); + } + + // Execution + CefFunction(valueList); + + // Parameter Restoration + if (valueCount && value) { + *valueCount = std::min(valueList.size(), *valueCount); + if (*valueCount > 0) { + for (size_t i = 0; i < *valueCount; ++i) + value[i] = valueList[i]; + } + } + } + + // CToCpp Example + void CefFunction(std::vector& value) + { + // Parameter Translation + // Function identified by the "count_func" method attribute. + size_t valueSize = value.size(); + size_t valueCount = std::max(GetFunctionCount(), valueSize); + int* valueList = NULL; + if (valueCount > 0) { + valueList = new int[valueCount]; + DCHECK(valueList); + if (valueList) + memset(valueList, 0, sizeof(int)*valueCount); + if (valueList && valueSize > 0) { + for (size_t i = 0; i < valueSize; ++i) { + valueList[i] = value[i]; + } + } + } + + // Execution + cef_function(&valueCount, valueList); + + // Parameter Restoration + value.clear(); + if (valueCount > 0 && valueList) { + for (size_t i = 0; i < valueCount; ++i) + value.push_back(valueList[i]); + delete [] valueList; + } + } + + Simple/Enumeration vector const type by reference (simple_vec_byref_const): + C++: const std::vector& value + C API: size_t valueCount, int const* value + + // CppToC Example + CEF_EXPORT void cef_function(size_t valueCount, int const* value) + { + // Parameter Verification + DCHECK(valueCount == 0 || value); + if (valueCount > 0 && !value) + return; + + // Parameter Translation + std::vector valueList; + if (valueCount > 0) { + for (size_t i = 0; i < valueCount; ++i) + valueList.push_back(value[i]); + } + + // Execution + CefFunction(valueList); + } + + // CToCpp Example + void CefFunction(const std::vector& value) + { + // Parameter Translation + const size_t valueCount = value.size(); + int* valueList = NULL; + if (valueCount > 0) { + valueList = new int[valueCount]; + DCHECK(valueList); + if (valueList) { + for (size_t i = 0; i < valueCount; ++i) + valueList[i] = value[i]; + } + } + + // Execution + cef_function(valueCount, valueList); + + // Parameter Restoration + if (valueList) + delete [] valueList; + } + + Boolean vector non-const type by reference (bool_vec_byref): + C++: std::vector& value + C API: size_t* valueCount, int* value + + // CppToC Example + CEF_EXPORT void cef_function(size_t* valueCount, int* value) + { + // Parameter Verification + DCHECK(valueCount && (*valueCount == 0 || value)); + if (!valueCount || (*valueCount > 0 && !value)) + return; + + // Parameter Translation + std::vector valueList; + if (valueCount && *valueCount > 0 && value) { + for (size_t i = 0; i < *valueCount; ++i) + valueList.push_back(value[i]?true:false); + } + + // Execution + CefFunction(valueList); + + // Parameter Restoration + if (valueCount && value) { + *valueCount = std::min(valueList.size(), *valueCount); + if (*valueCount > 0) { + for (size_t i = 0; i < *valueCount; ++i) + value[i] = valueList[i]; + } + } + } + + // CToCpp Example + void CefFunction(std::vector& value) + { + // Parameter Translation + // Function identified by the "count_func" method attribute. + size_t valueSize = value.size(); + size_t valueCount = std::max(GetFunctionCount(), valueSize); + int* valueList = NULL; + if (valueCount > 0) { + valueList = new int[valueCount]; + DCHECK(valueList); + if (valueList) + memset(valueList, 0, sizeof(int)*valueCount); + if (valueList && valueSize > 0) { + for (size_t i = 0; i < valueSize; ++i) { + valueList[i] = value[i]; + } + } + } + + // Execution + cef_function(&valueCount, valueList); + + // Parameter Restoration + value.clear(); + if (valueCount > 0 && valueList) { + for (size_t i = 0; i < valueCount; ++i) + value.push_back(valueList[i]?true:false); + delete [] valueList; + } + } + + Boolean vector const type by reference (bool_vec_byref_const): + C++: const std::vector& value + C API: size_t valueCount, int const* value + + // CppToC Example + CEF_EXPORT void cef_function(size_t valueCount, int const* value) + { + // Parameter Verification + DCHECK(valueCount == 0 || value); + if (valueCount > 0 && !value) + return; + + // Parameter Translation + std::vector valueList; + if (valueCount > 0) { + for (size_t i = 0; i < valueCount; ++i) + valueList.push_back(value[i]?true:false); + } + + // Execution + CefFunction(valueList); + } + + // CToCpp Example + void CefFunction(const std::vector& value) + { + // Parameter Translation + const size_t valueCount = value.size(); + int* valueList = NULL; + if (valueCount > 0) { + valueList = new int[valueCount]; + DCHECK(valueList) + if (valueList) { + for (size_t i = 0; i < valueCount; ++i) + valueList[i] = value[i]; + } + } + + // Execution + cef_function(valueCount, valueList); + + // Parameter Restoration + if (valueList) + delete [] valueList; + } + + Smart pointer vector non-const type same boundary side by reference + (refptr_vec_same_byref): + C++: std::vector>& value + C API: size_t* valueCount, cef_post_data_element_t** value + + // CppToC Example + CEF_EXPORT void cef_function(size_t* valueCount, + cef_post_data_element_t** value) + { + // Parameter Verification + DCHECK(valueCount && (*valueCount == 0 || value)); + if (!valueCount || (*valueCount > 0 && !value)) + return; + + // Parameter Translation + std::vector> valueList; + if (valueCount && *valueCount > 0 && value) { + for (size_t i = 0; i < *valueCount; ++i) + valueList.push_back(CefPostDataElementCppToC::Unwrap(value[i])); + } + + // Execution + CefFunction(valueList); + + // Parameter Restoration + if (valueCount && value) { + *valueCount = std::min(valueList.size(), *valueCount); + if (*valueCount > 0) { + for (size_t i = 0; i < *valueCount; ++i) + value[i] = CefPostDataElementCppToC::Wrap(valueList[i]); + } + } + } + + // CToCpp Example + void CefFunction(std::vector& value) + { + // Parameter Translation + // Function identified by the "count_func" method attribute. + size_t valueSize = value.size(); + size_t valueCount = std::max(GetFunctionCount(), valueSize); + cef_post_data_element_t** valueList = NULL; + if (valueCount > 0) { + valueList = new cef_post_data_element_t*[valueCount]; + DCHECK(valueList); + if (valueList) + memset(valueList, 0, sizeof(cef_post_data_element_t*)*valueCount); + if (valueList && valueSize > 0) { + for (size_t i = 0; i < valueSize; ++i) { + valueList[i] = CefPostDataElementCToCpp::Unwrap(value[i]); + } + } + } + + // Execution + cef_function(&valueCount, valueList); + + // Parameter Restoration + value.clear(); + if (valueCount > 0 && valueList) { + for (size_t i = 0; i < valueCount; ++i) + value.push_back(CefPostDataElementCToCpp::Wrap(valueList[i])); + delete [] valueList; + } + } + + Smart pointer vector const type same boundary side by reference + (refptr_vec_same_byref_const): + C++: const std::vector>& value + C API: size_t valueCount, const cef_v8value_t** value + + // CppToC Example + CEF_EXPORT void cef_function(size_t valueCount, + const cef_v8value_t** value) + { + // Parameter Verification + DCHECK(valueCount == 0 || value); + if (valueCount > 0 && !value) + return; + + // Parameter Translation + std::vector> valueList; + if (valueCount > 0) { + for (size_t i = 0; i < valueCount; ++i) + valueList.push_back(CefV8ValueCppToC::Unwrap(value[i])); + } + + // Execution + CefFunction(valueList); + } + + // CToCpp Example + void CefFunction(const std::vector& value) + { + // Parameter Translation + const size_t valueCount = value.size(); + cef_v8value_t** valueList = NULL; + if (valueCount > 0) { + valueList = new int[valueCount]; + DCHECK(valueList); + if (valueList) { + for (size_t i = 0; i < valueCount; ++i) + valueList[i] = CefV8ValueCToCpp::Unwrap(value[i]); + } + } + + // Execution + cef_function(valueCount, valueList); + + // Parameter Restoration + if (valueList) + delete [] valueList; + } + + Smart pointer vector non-const type different boundary side by reference + (refptr_vec_diff_byref): + C++: std::vector>& value + C API: size_t* valueCount, cef_post_data_element_t** value + + // CppToC Example + CEF_EXPORT void cef_function(size_t* valueCount, + cef_post_data_element_t** value) + { + // Parameter Verification + DCHECK(valueCount && (*valueCount == 0 || value)); + if (!valueCount || (*valueCount > 0 && !value)) + return; + + // Parameter Translation + std::vector> valueList; + if (valueCount && *valueCount > 0 && value) { + for (size_t i = 0; i < *valueCount; ++i) + valueList.push_back(CefPostDataElementCToCpp::Wrap(value[i])); + } + + // Execution + CefFunction(valueList); + + // Parameter Restoration + if (valueCount && value) { + *valueCount = std::min(valueList.size(), *valueCount); + if (*valueCount > 0) { + for (size_t i = 0; i < *valueCount; ++i) + value[i] = CefPostDataElementCToCpp::Unwrap(valueList[i]); + } + } + } + + // CToCpp Example + void CefFunction(std::vector& value) + { + // Parameter Translation + // Function identified by the "count_func" method attribute. + size_t valueSize = value.size(); + size_t valueCount = std::max(GetFunctionCount(), valueSize); + cef_post_data_element_t** valueList = NULL; + if (valueCount > 0) { + valueList = new cef_post_data_element_t*[valueCount]; + DCHECK(valueList); + if (valueList) + memset(valueList, 0, sizeof(cef_post_data_element_t*)*valueCount); + if (valueList && valueSize > 0) { + for (size_t i = 0; i < valueSize; ++i) { + valueList[i] = CefPostDataElementCppToC::Wrap(value[i]); + } + } + } + + // Execution + cef_function(&valueCount, valueList); + + // Parameter Restoration + value.clear(); + if (valueCount > 0 && valueList) { + for (size_t i = 0; i < valueCount; ++i) + value.push_back(CefPostDataElementCppToC::Unwrap(valueList[i])); + delete [] valueList; + } + } + + Smart pointer vector const type different boundary side by reference + (refptr_vec_diff_byref_const): + C++: const std::vector>& value + C API: size_t valueCount, const cef_v8value_t** value + + // CppToC Example + CEF_EXPORT void cef_function(size_t valueCount, + const cef_v8value_t** value) + { + // Parameter Verification + DCHECK(valueCount == 0 || value); + if (valueCount > 0 && !value) + return; + + // Parameter Translation + std::vector> valueList; + if (valueCount > 0) { + for (size_t i = 0; i < valueCount; ++i) + valueList.push_back(CefV8ValueCToCpp::Wrap(value[i])); + } + + // Execution + CefFunction(valueList); + } + + // CToCpp Example + void CefFunction(const std::vector& value) + { + // Parameter Translation + const size_t valueCount = value.size(); + cef_v8value_t** valueList = NULL; + if (valueCount > 0) { + valueList = new int[valueCount]; + DCHECK(valueList); + if (valueList) { + for (size_t i = 0; i < valueCount; ++i) + valueList[i] = CefV8ValueCppToC::Wrap(value[i]); + } + } + + // Execution + cef_function(valueCount, valueList); + + // Parameter Restoration + if (valueList) + delete [] valueList; + } + +Return Values: + + Simple/Enumeration type (simple): + C++: int + C API: int + + // CppToC Example + CEF_EXPORT int cef_function() + { + // Execution + int _rv = CefFunction(); + + // Return Translation + return _rv; + } + + // CToCpp Example + int CefFunction() + { + // Execution + int _rv = cef_function(); + + // Return Translation + return _rv; + } + + Boolean type (bool): + C++: bool + C API: int + + // CppToC Example + CEF_EXPORT int cef_function() + { + // Execution + bool _rv = CefFunction(); + + // Return Translation + return _rv; + } + + // CToCpp Example + bool CefFunction() + { + // Execution + int _rv = cef_function(); + + // Return Translation + return _rv?true:false; + } + + String non-const by reference type (string): + C++: CefString + C API: cef_string_userfree_t + + // CppToC Example + CEF_EXPORT cef_string_userfree_t cef_function() + { + // Execution + CefString _rv = CefFunction(); + + // Return Translation + return _rv.DetachToUserFree(); + } + + // CToCpp Example + CefString CefFunction() + { + // Execution + cef_string_userfree_t _rv = cef_function(); + + // Return Translation + CefString _rvStr; + _rvStr.AttachToUserFree(_rv); + return _rvStr; + } + + Smart pointer type same boundary side (refptr_same): + C++: CefRefPtr + C API: cef_browser_t* + + // CppToC Example + CEF_EXPORT cef_browser_t* cef_function() + { + // Execution + CefRefPtr _rv = CefFunction(); + + // Return Translation + return CefBrowserCppToC::Wrap(_rv); + } + + // CToCpp Example + CefString CefFunction() + { + // Execution + cef_browser_t* _rv = cef_function(); + + // Return Translation + return CefBrowserCToCpp::Wrap(_rv); + } + + Smart pointer type different boundary side (refptr_diff): + C++: CefRefPtr + C API: cef_browser_t* + + // CppToC Example + CEF_EXPORT cef_browser_t* cef_function() + { + // Execution + CefRefPtr _rv = CefFunction(); + + // Return Translation + return CefBrowserCToCpp::Unwrap(_rv); + } + + // CToCpp Example + CefString CefFunction() + { + // Execution + cef_browser_t* _rv = cef_function(); + + // Return Translation + return CefBrowserCppToC::Unwrap(_rv); + } + + +Translating Comments +-------------------- + +Comments from the CEF header file are reproduced in the C API header file with +any referenced C++ types and terminology changed to reflect C API types and +terminology. + +C++: +// Create a new CefV8Value object of the specified type. These methods +// should only be called from within the JavaScript context -- either in a +// CefV8Handler::Execute() callback or a CefHandler::HandleJSBinding() +// callback. + +C API: +// Create a new cef_v8value_t object of the specified type. These functions +// should only be called from within the JavaScript context -- either in a +// cef_v8handler_t::execute() callback or a cef_handler_t::handle_jsbinding() +// callback. + +Situations where the user is responsible for freeing strings allocated and +returned by the library are also noted by comments in the C API header file. + +C API: + // The resulting string must be freed by calling cef_string_free(). + +A comment must occur immediately before the function, class or method that it +documents with no extra space in between. Comments may span multiple lines +but each line must start with the '//' comment identifier. + +C++: + // Set focus for the browser window. If |enable| is true focus will be set + // to the window. Otherwise, focus will be removed. + /*--cef()--*/ + virtual void SetFocus(bool enable) =0; + +If two comments are separated by an empty line it will be assumed that the +higher comment represents a section header and additional space will be added +before it in the translated output. + +C++: + // ARRAY METHODS - These methods are only available on arrays. + + // Returns the number of elements in the array. + /*--cef()--*/ + virtual int GetArrayLength() =0; + +Empty lines and lines with the comment identifier but no content are considered +paragraph breaks for the purposes of wrapping the translated text. Any content +indented more than one space is reproduced as-is without content translation +or wrapping. + +C++: +// Register a new V8 extension with the specified JavaScript extension code and +// handler. Functions implemented by the handler are prototyped using the +// keyword 'native'. The calling of a native function is restricted to the scope +// in which the prototype of the native function is defined. +// +// Example JavaScript extension code: +// +// // create the 'example' global object if it doesn't already exist. +// if (!example) +// example = {}; diff --git a/tools/translator.bat b/tools/translator.bat new file mode 100644 index 000000000..44b80f385 --- /dev/null +++ b/tools/translator.bat @@ -0,0 +1,3 @@ +@echo off +..\..\third_party\python_26\python.exe translator.py --cpp-header-dir ..\include --capi-header-dir ..\include\capi --cpptoc-global-impl ..\libcef_dll\libcef_dll.cc --ctocpp-global-impl ..\libcef_dll\wrapper\libcef_dll_wrapper.cc --cpptoc-dir ..\libcef_dll\cpptoc --ctocpp-dir ..\libcef_dll\ctocpp --gypi-file ..\cef_paths.gypi +pause \ No newline at end of file diff --git a/tools/translator.py b/tools/translator.py new file mode 100644 index 000000000..ab8b584c3 --- /dev/null +++ b/tools/translator.py @@ -0,0 +1,163 @@ +# Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights +# reserved. Use of this source code is governed by a BSD-style license that +# can be found in the LICENSE file. + +import sys +from cef_parser import * +from make_capi_header import * +from make_cpptoc_header import * +from make_cpptoc_impl import * +from make_ctocpp_header import * +from make_ctocpp_impl import * +from make_gypi_file import * +from optparse import OptionParser + + +# cannot be loaded as a module +if __name__ != "__main__": + sys.stderr.write('This file cannot be loaded as a module!') + sys.exit() + + +# parse command-line options +disc = """ +This utility generates files for the CEF C++ to C API translation layer. +""" + +parser = OptionParser(description=disc) +parser.add_option('--cpp-header-dir', dest='cppheaderdir', metavar='DIR', + help='input directory for C++ header files [required]') +parser.add_option('--capi-header-dir', dest='capiheaderdir', metavar='DIR', + help='output directory for C API header files') +parser.add_option('--cpptoc-global-impl', dest='cpptocglobalimpl', metavar='FILE', + help='input/output file for CppToC global translations') +parser.add_option('--ctocpp-global-impl', dest='ctocppglobalimpl', metavar='FILE', + help='input/output file for CppToC global translations') +parser.add_option('--cpptoc-dir', dest='cpptocdir', metavar='DIR', + help='input/output directory for CppToC class translations') +parser.add_option('--ctocpp-dir', dest='ctocppdir', metavar='DIR', + help='input/output directory for CppToC class translations') +parser.add_option('--gypi-file', dest='gypifile', metavar='FILE', + help='output file for path information') +parser.add_option('--no-cpptoc-header', + action='store_true', dest='nocpptocheader', default=False, + help='do not output the CppToC headers') +parser.add_option('--no-cpptoc-impl', + action='store_true', dest='nocpptocimpl', default=False, + help='do not output the CppToC implementations') +parser.add_option('--no-ctocpp-header', + action='store_true', dest='noctocppheader', default=False, + help='do not output the CToCpp headers') +parser.add_option('--no-ctocpp-impl', + action='store_true', dest='noctocppimpl', default=False, + help='do not output the CToCpp implementations') +parser.add_option('--no-backup', + action='store_true', dest='nobackup', default=False, + help='do not create a backup of modified files') +parser.add_option('-c', '--classes', dest='classes', action='append', + help='only translate the specified classes') +parser.add_option('-q', '--quiet', + action='store_true', dest='quiet', default=False, + help='do not output detailed status information') +(options, args) = parser.parse_args() + +# the cppheader option is required +if options.cppheaderdir is None: + parser.print_help(sys.stdout) + sys.exit() + +# make sure the header exists +if not path_exists(options.cppheaderdir): + sys.stderr.write('File '+options.cppheaderdir+' does not exist.') + sys.exit() + +# create the header object +if not options.quiet: + sys.stdout.write('Parsing C++ headers from '+options.cppheaderdir+'...\n') +header = obj_header() +header.add_directory(options.cppheaderdir) + +writect = 0 + +if not options.capiheaderdir is None: + #output the C API header + if not options.quiet: + sys.stdout.write('In C API header directory '+options.capiheaderdir+'...\n') + filenames = sorted(header.get_file_names()) + for filename in filenames: + if not options.quiet: + sys.stdout.write('Generating '+filename+' C API header...\n') + writect += write_capi_header(header, + os.path.join(options.capiheaderdir, filename), + not options.nobackup) + +# build the list of classes to parse +allclasses = header.get_class_names() +if not options.classes is None: + for cls in options.classes: + if not cls in allclasses: + sys.stderr.write('ERROR: Unknown class: '+cls) + sys.exit() + classes = options.classes +else: + classes = allclasses + +classes = sorted(classes) + +if not options.cpptocglobalimpl is None: + # output CppToC global file + if not options.quiet: + sys.stdout.write('Generating CppToC global implementation...\n') + writect += write_cpptoc_impl(header, None, options.cpptocglobalimpl, \ + not options.nobackup) + +if not options.ctocppglobalimpl is None: + # output CToCpp global file + if not options.quiet: + sys.stdout.write('Generating CToCpp global implementation...\n') + writect += write_ctocpp_impl(header, None, options.ctocppglobalimpl, \ + not options.nobackup) + +if not options.cpptocdir is None: + # output CppToC class files + if not options.quiet: + sys.stdout.write('In CppToC directory '+options.cpptocdir+'...\n') + + for cls in classes: + if not options.nocpptocheader: + if not options.quiet: + sys.stdout.write('Generating '+cls+'CppToC class header...\n') + writect += write_cpptoc_header(header, cls, options.cpptocdir, + not options.nobackup) + if not options.nocpptocimpl: + if not options.quiet: + sys.stdout.write('Generating '+cls+'CppToC class implementation...\n') + writect += write_cpptoc_impl(header, cls, options.cpptocdir, + not options.nobackup) + +if not options.ctocppdir is None: + # output CppToC class files + if not options.quiet: + sys.stdout.write('In CToCpp directory '+options.ctocppdir+'...\n') + for cls in classes: + if not options.nocpptocheader: + if not options.quiet: + sys.stdout.write('Generating '+cls+'CToCpp class header...\n') + writect += write_ctocpp_header(header, cls, options.ctocppdir, + not options.nobackup) + if not options.nocpptocimpl: + if not options.quiet: + sys.stdout.write('Generating '+cls+'CToCpp class implementation...\n') + writect += write_ctocpp_impl(header, cls, options.ctocppdir, + not options.nobackup) + +if not options.gypifile is None: + # output the gypi file + if not options.quiet: + sys.stdout.write('Generating '+options.gypifile+' file...\n') + writect += write_gypi_file(header, options.gypifile, not options.nobackup) + +if not options.quiet: + sys.stdout.write('Done - Wrote '+str(writect)+' files.\n') + + diff --git a/tools/translator.sh b/tools/translator.sh new file mode 100755 index 000000000..abd1c6e91 --- /dev/null +++ b/tools/translator.sh @@ -0,0 +1,2 @@ +#!/bin/sh +python translator.py --cpp-header-dir ../include --capi-header-dir ../include/capi --cpptoc-global-impl ../libcef_dll/libcef_dll.cc --ctocpp-global-impl ../libcef_dll/wrapper/libcef_dll_wrapper.cc --cpptoc-dir ../libcef_dll/cpptoc --ctocpp-dir ../libcef_dll/ctocpp --gypi-file ../cef_paths.gypi diff --git a/vendor/ack b/vendor/ack deleted file mode 100755 index a20f9f603..000000000 --- a/vendor/ack +++ /dev/null @@ -1,2784 +0,0 @@ -#!/usr/bin/env perl -# -# This file, ack, is generated code. -# Please DO NOT EDIT or send patches for it. -# -# Please take a look at the source from -# http://github.com/petdance/ack -# and submit patches against the individual files -# that build ack. -# - -use warnings; -use strict; - -our $VERSION = '1.96'; -# Check http://betterthangrep.com/ for updates - -# These are all our globals. - - -MAIN: { - if ( $App::Ack::VERSION ne $main::VERSION ) { - App::Ack::die( "Program/library version mismatch\n\t$0 is $main::VERSION\n\t$INC{'App/Ack.pm'} is $App::Ack::VERSION" ); - } - - # Do preliminary arg checking; - my $env_is_usable = 1; - for ( @ARGV ) { - last if ( $_ eq '--' ); - - # Priorities! Get the --thpppt checking out of the way. - /^--th[pt]+t+$/ && App::Ack::_thpppt($_); - - # See if we want to ignore the environment. (Don't tell Al Gore.) - if ( /^--(no)?env$/ ) { - $env_is_usable = defined $1 ? 0 : 1; - } - } - if ( $env_is_usable ) { - unshift( @ARGV, App::Ack::read_ackrc() ); - } - else { - my @keys = ( 'ACKRC', grep { /^ACK_/ } keys %ENV ); - delete @ENV{@keys}; - } - App::Ack::load_colors(); - - if ( exists $ENV{ACK_SWITCHES} ) { - App::Ack::warn( 'ACK_SWITCHES is no longer supported. Use ACK_OPTIONS.' ); - } - - if ( !@ARGV ) { - App::Ack::show_help(); - exit 1; - } - - main(); -} - -sub main { - my $opt = App::Ack::get_command_line_options(); - - $| = 1 if $opt->{flush}; # Unbuffer the output if flush mode - - if ( App::Ack::input_from_pipe() ) { - # We're going into filter mode - for ( qw( f g l ) ) { - $opt->{$_} and App::Ack::die( "Can't use -$_ when acting as a filter." ); - } - $opt->{show_filename} = 0; - $opt->{regex} = App::Ack::build_regex( defined $opt->{regex} ? $opt->{regex} : shift @ARGV, $opt ); - if ( my $nargs = @ARGV ) { - my $s = $nargs == 1 ? '' : 's'; - App::Ack::warn( "Ignoring $nargs argument$s on the command-line while acting as a filter." ); - } - - my $res = App::Ack::Resource::Basic->new( '-' ); - my $nmatches; - if ( $opt->{count} ) { - $nmatches = App::Ack::search_and_list( $res, $opt ); - } - else { - # normal searching - $nmatches = App::Ack::search_resource( $res, $opt ); - } - $res->close(); - App::Ack::exit_from_ack( $nmatches ); - } - - my $file_matching = $opt->{f} || $opt->{lines}; - if ( $file_matching ) { - App::Ack::die( "Can't specify both a regex ($opt->{regex}) and use one of --line, -f or -g." ) if $opt->{regex}; - } - else { - $opt->{regex} = App::Ack::build_regex( defined $opt->{regex} ? $opt->{regex} : shift @ARGV, $opt ); - } - - # check that all regexes do compile fine - App::Ack::check_regex( $_ ) for ( $opt->{regex}, $opt->{G} ); - - my $what = App::Ack::get_starting_points( \@ARGV, $opt ); - my $iter = App::Ack::get_iterator( $what, $opt ); - App::Ack::filetype_setup(); - - my $nmatches = 0; - - App::Ack::set_up_pager( $opt->{pager} ) if defined $opt->{pager}; - if ( $opt->{f} ) { - $nmatches = App::Ack::print_files( $iter, $opt ); - } - elsif ( $opt->{l} || $opt->{count} ) { - $nmatches = App::Ack::print_files_with_matches( $iter, $opt ); - } - else { - $nmatches = App::Ack::print_matches( $iter, $opt ); - } - close $App::Ack::fh; - App::Ack::exit_from_ack( $nmatches ); -} - -=head1 NAME - -ack - grep-like text finder - -=head1 SYNOPSIS - - ack [options] PATTERN [FILE...] - ack -f [options] [DIRECTORY...] - -=head1 DESCRIPTION - -Ack is designed as a replacement for 99% of the uses of F. - -Ack searches the named input FILEs (or standard input if no files are -named, or the file name - is given) for lines containing a match to the -given PATTERN. By default, ack prints the matching lines. - -Ack can also list files that would be searched, without actually searching -them, to let you take advantage of ack's file-type filtering capabilities. - -=head1 FILE SELECTION - -I is intelligent about the files it searches. It knows about -certain file types, based on both the extension on the file and, -in some cases, the contents of the file. These selections can be -made with the B<--type> option. - -With no file selections, I only searches files of types that -it recognizes. If you have a file called F, and I -doesn't know what a .wango file is, I won't search it. - -The B<-a> option tells I to select all files, regardless of -type. - -Some files will never be selected by I, even with B<-a>, -including: - -=over 4 - -=item * Backup files: Files matching F<#*#> or ending with F<~>. - -=item * Coredumps: Files matching F - -=back - -However, I always searches the files given on the command line, -no matter what type. Furthermore, by specifying the B<-u> option all -files will be searched. - -=head1 DIRECTORY SELECTION - -I descends through the directory tree of the starting directories -specified. However, it will ignore the shadow directories used by -many version control systems, and the build directories used by the -Perl MakeMaker system. You may add or remove a directory from this -list with the B<--[no]ignore-dir> option. The option may be repeated -to add/remove multiple directories from the ignore list. - -For a complete list of directories that do not get searched, run -F. - -=head1 WHEN TO USE GREP - -I trumps I as an everyday tool 99% of the time, but don't -throw I away, because there are times you'll still need it. - -E.g., searching through huge files looking for regexes that can be -expressed with I syntax should be quicker with I. - -If your script or parent program uses I C<--quiet> or -C<--silent> or needs exit 2 on IO error, use I. - -=head1 OPTIONS - -=over 4 - -=item B<-a>, B<--all> - -Operate on all files, regardless of type (but still skip directories -like F, F, etc.) - -=item B<-A I>, B<--after-context=I> - -Print I lines of trailing context after matching lines. - -=item B<-B I>, B<--before-context=I> - -Print I lines of leading context before matching lines. - -=item B<-C [I]>, B<--context[=I]> - -Print I lines (default 2) of context around matching lines. - -=item B<-c>, B<--count> - -Suppress normal output; instead print a count of matching lines for -each input file. If B<-l> is in effect, it will only show the -number of lines for each file that has lines matching. Without -B<-l>, some line counts may be zeroes. - -If combined with B<-h> (B<--no-filename>) ack outputs only one total count. - -=item B<--color>, B<--nocolor> - -B<--color> highlights the matching text. B<--nocolor> supresses -the color. This is on by default unless the output is redirected. - -On Windows, this option is off by default unless the -L module is installed or the C -environment variable is used. - -=item B<--color-filename=I> - -Sets the color to be used for filenames. - -=item B<--color-match=I> - -Sets the color to be used for matches. - -=item B<--color-lineno=I> - -Sets the color to be used for line numbers. - -=item B<--column> - -Show the column number of the first match. This is helpful for editors -that can place your cursor at a given position. - -=item B<--env>, B<--noenv> - -B<--noenv> disables all environment processing. No F<.ackrc> is read -and all environment variables are ignored. By default, F considers -F<.ackrc> and settings in the environment. - -=item B<--flush> - -B<--flush> flushes output immediately. This is off by default -unless ack is running interactively (when output goes to a pipe -or file). - -=item B<-f> - -Only print the files that would be searched, without actually doing -any searching. PATTERN must not be specified, or it will be taken as -a path to search. - -=item B<--follow>, B<--nofollow> - -Follow or don't follow symlinks, other than whatever starting files -or directories were specified on the command line. - -This is off by default. - -=item B<-G I> - -Only paths matching I are included in the search. The entire -path and filename are matched against I, and I is a -Perl regular expression, not a shell glob. - -The options B<-i>, B<-w>, B<-v>, and B<-Q> do not apply to this I. - -=item B<-g I> - -Print files where the relative path + filename matches I. This option is -a convenience shortcut for B<-f> B<-G I>. - -The options B<-i>, B<-w>, B<-v>, and B<-Q> do not apply to this I. - -=item B<--group>, B<--nogroup> - -B<--group> groups matches by file name with. This is the default when -used interactively. - -B<--nogroup> prints one result per line, like grep. This is the default -when output is redirected. - -=item B<-H>, B<--with-filename> - -Print the filename for each match. - -=item B<-h>, B<--no-filename> - -Suppress the prefixing of filenames on output when multiple files are -searched. - -=item B<--help> - -Print a short help statement. - -=item B<-i>, B<--ignore-case> - -Ignore case in the search strings. - -This applies only to the PATTERN, not to the regexes given for the B<-g> -and B<-G> options. - -=item B<--[no]ignore-dir=I> - -Ignore directory (as CVS, .svn, etc are ignored). May be used multiple times -to ignore multiple directories. For example, mason users may wish to include -B<--ignore-dir=data>. The B<--noignore-dir> option allows users to search -directories which would normally be ignored (perhaps to research the contents -of F<.svn/props> directories). - -The I must always be a simple directory name. Nested directories like -F are NOT supported. You would need to specify B<--ignore-dir=foo> and -then no files from any foo directory are taken into account by ack unless given -explicitly on the command line. - -=item B<--line=I> - -Only print line I of each file. Multiple lines can be given with multiple -B<--line> options or as a comma separated list (B<--line=3,5,7>). B<--line=4-7> -also works. The lines are always output in ascending order, no matter the -order given on the command line. - -=item B<-l>, B<--files-with-matches> - -Only print the filenames of matching files, instead of the matching text. - -=item B<-L>, B<--files-without-matches> - -Only print the filenames of files that do I match. This is equivalent -to specifying B<-l> and B<-v>. - -=item B<--match I> - -Specify the I explicitly. This is helpful if you don't want to put the -regex as your first argument, e.g. when executing multiple searches over the -same set of files. - - # search for foo and bar in given files - ack file1 t/file* --match foo - ack file1 t/file* --match bar - -=item B<-m=I>, B<--max-count=I> - -Stop reading a file after I matches. - -=item B<--man> - -Print this manual page. - -=item B<-n>, B<--no-recurse> - -No descending into subdirectories. - -=item B<-o> - -Show only the part of each line matching PATTERN (turns off text -highlighting) - -=item B<--output=I> - -Output the evaluation of I for each line (turns off text -highlighting) - -=item B<--pager=I> - -Direct ack's output through I. This can also be specified -via the C and C environment variables. - -Using --pager does not suppress grouping and coloring like piping -output on the command-line does. - -=item B<--passthru> - -Prints all lines, whether or not they match the expression. Highlighting -will still work, though, so it can be used to highlight matches while -still seeing the entire file, as in: - - # Watch a log file, and highlight a certain IP address - $ tail -f ~/access.log | ack --passthru 123.45.67.89 - -=item B<--print0> - -Only works in conjunction with -f, -g, -l or -c (filename output). The filenames -are output separated with a null byte instead of the usual newline. This is -helpful when dealing with filenames that contain whitespace, e.g. - - # remove all files of type html - ack -f --html --print0 | xargs -0 rm -f - -=item B<-Q>, B<--literal> - -Quote all metacharacters in PATTERN, it is treated as a literal. - -This applies only to the PATTERN, not to the regexes given for the B<-g> -and B<-G> options. - -=item B<-r>, B<-R>, B<--recurse> - -Recurse into sub-directories. This is the default and just here for -compatibility with grep. You can also use it for turning B<--no-recurse> off. - -=item B<--smart-case>, B<--no-smart-case> - -Ignore case in the search strings if PATTERN contains no uppercase -characters. This is similar to C in vim. This option is -off by default. - -B<-i> always overrides this option. - -This applies only to the PATTERN, not to the regexes given for the -B<-g> and B<-G> options. - -=item B<--sort-files> - -Sorts the found files lexically. Use this if you want your file -listings to be deterministic between runs of I. - -=item B<--show-types> - -Outputs the filetypes that ack associates with each file. - -Works with B<-f> and B<-g> options. - -=item B<--thpppt> - -Display the all-important Bill The Cat logo. Note that the exact -spelling of B<--thpppppt> is not important. It's checked against -a regular expression. - -=item B<--type=TYPE>, B<--type=noTYPE> - -Specify the types of files to include or exclude from a search. -TYPE is a filetype, like I or I. B<--type=perl> can -also be specified as B<--perl>, and B<--type=noperl> can be done -as B<--noperl>. - -If a file is of both type "foo" and "bar", specifying --foo and ---nobar will exclude the file, because an exclusion takes precedence -over an inclusion. - -Type specifications can be repeated and are ORed together. - -See I for a list of valid types. - -=item B<--type-add I=I<.EXTENSION>[,I<.EXT2>[,...]]> - -Files with the given EXTENSION(s) are recognized as being of (the -existing) type TYPE. See also L. - - -=item B<--type-set I=I<.EXTENSION>[,I<.EXT2>[,...]]> - -Files with the given EXTENSION(s) are recognized as being of type -TYPE. This replaces an existing definition for type TYPE. See also -L. - -=item B<-u>, B<--unrestricted> - -All files and directories (including blib/, core.*, ...) are searched, -nothing is skipped. When both B<-u> and B<--ignore-dir> are used, the -B<--ignore-dir> option has no effect. - -=item B<-v>, B<--invert-match> - -Invert match: select non-matching lines - -This applies only to the PATTERN, not to the regexes given for the B<-g> -and B<-G> options. - -=item B<--version> - -Display version and copyright information. - -=item B<-w>, B<--word-regexp> - -Force PATTERN to match only whole words. The PATTERN is wrapped with -C<\b> metacharacters. - -This applies only to the PATTERN, not to the regexes given for the B<-g> -and B<-G> options. - -=item B<-1> - -Stops after reporting first match of any kind. This is different -from B<--max-count=1> or B<-m1>, where only one match per file is -shown. Also, B<-1> works with B<-f> and B<-g>, where B<-m> does -not. - -=back - -=head1 THE .ackrc FILE - -The F<.ackrc> file contains command-line options that are prepended -to the command line before processing. Multiple options may live -on multiple lines. Lines beginning with a # are ignored. A F<.ackrc> -might look like this: - - # Always sort the files - --sort-files - - # Always color, even if piping to a another program - --color - - # Use "less -r" as my pager - --pager=less -r - -Note that arguments with spaces in them do not need to be quoted, -as they are not interpreted by the shell. Basically, each I -in the F<.ackrc> file is interpreted as one element of C<@ARGV>. - -F looks in your home directory for the F<.ackrc>. You can -specify another location with the F variable, below. - -If B<--noenv> is specified on the command line, the F<.ackrc> file -is ignored. - -=head1 Defining your own types - -ack allows you to define your own types in addition to the predefined -types. This is done with command line options that are best put into -an F<.ackrc> file - then you do not have to define your types over and -over again. In the following examples the options will always be shown -on one command line so that they can be easily copy & pasted. - -I searches for foo in all perl files. I -tells you, that perl files are files ending -in .pl, .pm, .pod or .t. So what if you would like to include .xs -files as well when searching for --perl files? I -does this for you. B<--type-add> appends -additional extensions to an existing type. - -If you want to define a new type, or completely redefine an existing -type, then use B<--type-set>. I defines the type I to include files with -the extensions .e or .eiffel. So to search for all eiffel files -containing the word Bertrand use I. -As usual, you can also write B<--type=eiffel> -instead of B<--eiffel>. Negation also works, so B<--noeiffel> excludes -all eiffel files from a search. Redefining also works: I -and I<.xs> files no longer belong to the type I. - -When defining your own types in the F<.ackrc> file you have to use -the following: - - --type-set=eiffel=.e,.eiffel - -or writing on separate lines - - --type-set - eiffel=.e,.eiffel - -The following does B work in the F<.ackrc> file: - - --type-set eiffel=.e,.eiffel - - -In order to see all currently defined types, use I<--help types>, e.g. -I - -Restrictions: - -=over 4 - -=item - -The types 'skipped', 'make', 'binary' and 'text' are considered "builtin" and -cannot be altered. - -=item - -The shebang line recognition of the types 'perl', 'ruby', 'php', 'python', -'shell' and 'xml' cannot be redefined by I<--type-set>, it is always -active. However, the shebang line is only examined for files where the -extension is not recognised. Therefore it is possible to say -I and -only find your shiny new I<.perl> files (and all files with unrecognized extension -and perl on the shebang line). - -=back - -=head1 ENVIRONMENT VARIABLES - -For commonly-used ack options, environment variables can make life much easier. -These variables are ignored if B<--noenv> is specified on the command line. - -=over 4 - -=item ACKRC - -Specifies the location of the F<.ackrc> file. If this file doesn't -exist, F looks in the default location. - -=item ACK_OPTIONS - -This variable specifies default options to be placed in front of -any explicit options on the command line. - -=item ACK_COLOR_FILENAME - -Specifies the color of the filename when it's printed in B<--group> -mode. By default, it's "bold green". - -The recognized attributes are clear, reset, dark, bold, underline, -underscore, blink, reverse, concealed black, red, green, yellow, -blue, magenta, on_black, on_red, on_green, on_yellow, on_blue, -on_magenta, on_cyan, and on_white. Case is not significant. -Underline and underscore are equivalent, as are clear and reset. -The color alone sets the foreground color, and on_color sets the -background color. - -This option can also be set with B<--color-filename>. - -=item ACK_COLOR_MATCH - -Specifies the color of the matching text when printed in B<--color> -mode. By default, it's "black on_yellow". - -This option can also be set with B<--color-match>. - -See B for the color specifications. - -=item ACK_COLOR_LINENO - -Specifies the color of the line number when printed in B<--color> -mode. By default, it's "bold yellow". - -This option can also be set with B<--color-lineno>. - -See B for the color specifications. - -=item ACK_PAGER - -Specifies a pager program, such as C, C or C, to which -ack will send its output. - -Using C does not suppress grouping and coloring like -piping output on the command-line does, except that on Windows -ack will assume that C does not support color. - -C overrides C if both are specified. - -=item ACK_PAGER_COLOR - -Specifies a pager program that understands ANSI color sequences. -Using C does not suppress grouping and coloring -like piping output on the command-line does. - -If you are not on Windows, you never need to use C. - -=back - -=head1 ACK & OTHER TOOLS - -=head2 Vim integration - -F integrates easily with the Vim text editor. Set this in your -F<.vimrc> to use F instead of F: - - set grepprg=ack\ -a - -That examples uses C<-a> to search through all files, but you may -use other default flags. Now you can search with F and easily -step through the results in Vim: - - :grep Dumper perllib - -=head2 Emacs integration - -Phil Jackson put together an F extension that "provides a -simple compilation mode ... has the ability to guess what files you -want to search for based on the major-mode." - -L - -=head2 TextMate integration - -Pedro Melo is a TextMate user who writes "I spend my day mostly -inside TextMate, and the built-in find-in-project sucks with large -projects. So I hacked a TextMate command that was using find + -grep to use ack. The result is the Search in Project with ack, and -you can find it here: -L" - -=head2 Shell and Return Code - -For greater compatibility with I, I in normal use returns -shell return or exit code of 0 only if something is found and 1 if -no match is found. - -(Shell exit code 1 is C<$?=256> in perl with C or backticks.) - -The I code 2 for errors is not used. - -If C<-f> or C<-g> are specified, then 0 is returned if at least one -file is found. If no files are found, then 1 is returned. - -=cut - -=head1 DEBUGGING ACK PROBLEMS - -If ack gives you output you're not expecting, start with a few simple steps. - -=head2 Use B<--noenv> - -Your environment variables and F<.ackrc> may be doing things you're -not expecting, or forgotten you specified. Use B<--noenv> to ignore -your environment and F<.ackrc>. - -=head2 Use B<-f> to see what files you're scanning - -The reason I created B<-f> in the first place was as a debugging -tool. If ack is not finding matches you think it should find, run -F to see what files are being checked. - -=head1 TIPS - -=head2 Use the F<.ackrc> file. - -The F<.ackrc> is the place to put all your options you use most of -the time but don't want to remember. Put all your --type-add and ---type-set definitions in it. If you like --smart-case, set it -there, too. I also set --sort-files there. - -=head2 Use F<-f> for working with big codesets - -Ack does more than search files. C will create a -list of all the Perl files in a tree, ideal for sending into F. -For example: - - # Change all "this" to "that" in all Perl files in a tree. - ack -f --perl | xargs perl -p -i -e's/this/that/g' - -or if you prefer: - - perl -p -i -e's/this/thatg/' $(ack -f --perl) - -=head2 Use F<-Q> when in doubt about metacharacters - -If you're searching for something with a regular expression -metacharacter, most often a period in a filename or IP address, add -the -Q to avoid false positives without all the backslashing. See -the following example for more... - -=head2 Use ack to watch log files - -Here's one I used the other day to find trouble spots for a website -visitor. The user had a problem loading F, so I -took the access log and scanned it with ack twice. - - ack -Q aa.bb.cc.dd /path/to/access.log | ack -Q -B5 troublesome.gif - -The first ack finds only the lines in the Apache log for the given -IP. The second finds the match on my troublesome GIF, and shows -the previous five lines from the log in each case. - -=head2 Share your knowledge - -Join the ack-users mailing list. Send me your tips and I may add -them here. - -=head1 FAQ - -=head2 Why isn't ack finding a match in (some file)? - -Probably because it's of a type that ack doesn't recognize. ack's -searching behavior is driven by filetype. B - -Use the C<-f> switch to see a list of files that ack will search -for you. - -If you want ack to search files that it doesn't recognize, use the -C<-a> switch. - -If you want ack to search every file, even ones that it always -ignores like coredumps and backup files, use the C<-u> switch. - -=head2 Why does ack ignore unknown files by default? - -ack is designed by a programmer, for programmers, for searching -large trees of code. Most codebases have a lot files in them which -aren't source files (like compiled object files, source control -metadata, etc), and grep wastes a lot of time searching through all -of those as well and returning matches from those files. - -That's why ack's behavior of not searching things it doesn't recognize -is one of its greatest strengths: the speed you get from only -searching the things that you want to be looking at. - -=head2 Wouldn't it be great if F did search & replace? - -No, ack will always be read-only. Perl has a perfectly good way -to do search & replace in files, using the C<-i>, C<-p> and C<-n> -switches. - -You can certainly use ack to select your files to update. For -example, to change all "foo" to "bar" in all PHP files, you can do -this from the Unix shell: - - $ perl -i -p -e's/foo/bar/g' $(ack -f --php) - -=head2 Can you make ack recognize F<.xyz> files? - -That's an enhancement. Please see the section in the manual about -enhancements. - -=head2 There's already a program/package called ack. - -Yes, I know. - -=head2 Why is it called ack if it's called ack-grep? - -The name of the program is "ack". Some packagers have called it -"ack-grep" when creating packages because there's already a package -out there called "ack" that has nothing to do with this ack. - -I suggest you make a symlink named F that points to F -because one of the crucial benefits of ack is having a name that's -so short and simple to type. - -To do that, run this with F or as root: - - ln -s /usr/bin/ack-grep /usr/bin/ack - -=head2 What does F mean? - -Nothing. I wanted a name that was easy to type and that you could -pronounce as a single syllable. - -=head2 Can I do multi-line regexes? - -No, ack does not support regexes that match multiple lines. Doing -so would require reading in the entire file at a time. - -If you want to see lines near your match, use the C<--A>, C<--B> -and C<--C> switches for displaying context. - -=head1 AUTHOR - -Andy Lester, C<< >> - -=head1 BUGS - -Please report any bugs or feature requests to the issues list at -Github: L - -=head1 ENHANCEMENTS - -All enhancement requests MUST first be posted to the ack-users -mailing list at L. I -will not consider a request without it first getting seen by other -ack users. This includes requests for new filetypes. - -There is a list of enhancements I want to make to F in the ack -issues list at Github: L - -Patches are always welcome, but patches with tests get the most -attention. - -=head1 SUPPORT - -Support for and information about F can be found at: - -=over 4 - -=item * The ack homepage - -L - -=item * The ack issues list at Github - -L - -=item * AnnoCPAN: Annotated CPAN documentation - -L - -=item * CPAN Ratings - -L - -=item * Search CPAN - -L - -=item * Git source repository - -L - -=back - -=head1 ACKNOWLEDGEMENTS - -How appropriate to have Inowledgements! - -Thanks to everyone who has contributed to ack in any way, including -Matthew Wild, -Scott Kyle, -Nick Hooey, -Bo Borgerson, -Mark Szymanski, -Marq Schneider, -Packy Anderson, -JR Boyens, -Dan Sully, -Ryan Niebur, -Kent Fredric, -Mike Morearty, -Ingmar Vanhassel, -Eric Van Dewoestine, -Sitaram Chamarty, -Adam James, -Richard Carlsson, -Pedro Melo, -AJ Schuster, -Phil Jackson, -Michael Schwern, -Jan Dubois, -Christopher J. Madsen, -Matthew Wickline, -David Dyck, -Jason Porritt, -Jjgod Jiang, -Thomas Klausner, -Uri Guttman, -Peter Lewis, -Kevin Riggle, -Ori Avtalion, -Torsten Blix, -Nigel Metheringham, -GEbor SzabE, -Tod Hagan, -Michael Hendricks, -Evar ArnfjErE Bjarmason, -Piers Cawley, -Stephen Steneker, -Elias Lutfallah, -Mark Leighton Fisher, -Matt Diephouse, -Christian Jaeger, -Bill Sully, -Bill Ricker, -David Golden, -Nilson Santos F. Jr, -Elliot Shank, -Merijn Broeren, -Uwe Voelker, -Rick Scott, -Ask BjErn Hansen, -Jerry Gay, -Will Coleda, -Mike O'Regan, -Slaven ReziE<0x107>, -Mark Stosberg, -David Alan Pisoni, -Adriano Ferreira, -James Keenan, -Leland Johnson, -Ricardo Signes -and Pete Krawczyk. - -=head1 COPYRIGHT & LICENSE - -Copyright 2005-2011 Andy Lester. - -This program is free software; you can redistribute it and/or modify -it under the terms of the Artistic License v2.0. - -=cut -package File::Next; - -use strict; -use warnings; - - -our $VERSION = '1.06'; - - - -use File::Spec (); - - -our $name; # name of the current file -our $dir; # dir of the current file - -our %files_defaults; -our %skip_dirs; - -BEGIN { - %files_defaults = ( - file_filter => undef, - descend_filter => undef, - error_handler => sub { CORE::die @_ }, - sort_files => undef, - follow_symlinks => 1, - ); - %skip_dirs = map {($_,1)} (File::Spec->curdir, File::Spec->updir); -} - - -sub files { - ($_[0] eq __PACKAGE__) && die 'File::Next::files must not be invoked as File::Next->files'; - - my ($parms,@queue) = _setup( \%files_defaults, @_ ); - my $filter = $parms->{file_filter}; - - return sub { - while (@queue) { - my ($dir,$file,$fullpath) = splice( @queue, 0, 3 ); - if ( -f $fullpath ) { - if ( $filter ) { - local $_ = $file; - local $File::Next::dir = $dir; - local $File::Next::name = $fullpath; - next if not $filter->(); - } - return wantarray ? ($dir,$file,$fullpath) : $fullpath; - } - elsif ( -d _ ) { - unshift( @queue, _candidate_files( $parms, $fullpath ) ); - } - } # while - - return; - }; # iterator -} - - - - - - - -sub sort_standard($$) { return $_[0]->[1] cmp $_[1]->[1] } -sub sort_reverse($$) { return $_[1]->[1] cmp $_[0]->[1] } - -sub reslash { - my $path = shift; - - my @parts = split( /\//, $path ); - - return $path if @parts < 2; - - return File::Spec->catfile( @parts ); -} - - - -sub _setup { - my $defaults = shift; - my $passed_parms = ref $_[0] eq 'HASH' ? {%{+shift}} : {}; # copy parm hash - - my %passed_parms = %{$passed_parms}; - - my $parms = {}; - for my $key ( keys %{$defaults} ) { - $parms->{$key} = - exists $passed_parms{$key} - ? delete $passed_parms{$key} - : $defaults->{$key}; - } - - # Any leftover keys are bogus - for my $badkey ( keys %passed_parms ) { - my $sub = (caller(1))[3]; - $parms->{error_handler}->( "Invalid option passed to $sub(): $badkey" ); - } - - # If it's not a code ref, assume standard sort - if ( $parms->{sort_files} && ( ref($parms->{sort_files}) ne 'CODE' ) ) { - $parms->{sort_files} = \&sort_standard; - } - my @queue; - - for ( @_ ) { - my $start = reslash( $_ ); - if (-d $start) { - push @queue, ($start,undef,$start); - } - else { - push @queue, (undef,$start,$start); - } - } - - return ($parms,@queue); -} - - -sub _candidate_files { - my $parms = shift; - my $dir = shift; - - my $dh; - if ( !opendir $dh, $dir ) { - $parms->{error_handler}->( "$dir: $!" ); - return; - } - - my @newfiles; - my $descend_filter = $parms->{descend_filter}; - my $follow_symlinks = $parms->{follow_symlinks}; - my $sort_sub = $parms->{sort_files}; - - for my $file ( grep { !exists $skip_dirs{$_} } readdir $dh ) { - my $has_stat; - - # Only do directory checking if we have a descend_filter - my $fullpath = File::Spec->catdir( $dir, $file ); - if ( !$follow_symlinks ) { - next if -l $fullpath; - $has_stat = 1; - } - - if ( $descend_filter ) { - if ( $has_stat ? (-d _) : (-d $fullpath) ) { - local $File::Next::dir = $fullpath; - local $_ = $file; - next if not $descend_filter->(); - } - } - if ( $sort_sub ) { - push( @newfiles, [ $dir, $file, $fullpath ] ); - } - else { - push( @newfiles, $dir, $file, $fullpath ); - } - } - closedir $dh; - - if ( $sort_sub ) { - return map { @{$_} } sort $sort_sub @newfiles; - } - - return @newfiles; -} - - -1; # End of File::Next -package App::Ack; - -use warnings; -use strict; - - - - -our $VERSION; -our $COPYRIGHT; -BEGIN { - $VERSION = '1.96'; - $COPYRIGHT = 'Copyright 2005-2011 Andy Lester.'; -} - -our $fh; - -BEGIN { - $fh = *STDOUT; -} - - -our %types; -our %type_wanted; -our %mappings; -our %ignore_dirs; - -our $input_from_pipe; -our $output_to_pipe; - -our $dir_sep_chars; -our $is_cygwin; -our $is_windows; - -use File::Spec (); -use File::Glob ':glob'; -use Getopt::Long (); - -BEGIN { - %ignore_dirs = ( - '.bzr' => 'Bazaar', - '.cdv' => 'Codeville', - '~.dep' => 'Interface Builder', - '~.dot' => 'Interface Builder', - '~.nib' => 'Interface Builder', - '~.plst' => 'Interface Builder', - '.git' => 'Git', - '.hg' => 'Mercurial', - '.pc' => 'quilt', - '.svn' => 'Subversion', - _MTN => 'Monotone', - blib => 'Perl module building', - CVS => 'CVS', - RCS => 'RCS', - SCCS => 'SCCS', - _darcs => 'darcs', - _sgbak => 'Vault/Fortress', - 'autom4te.cache' => 'autoconf', - 'cover_db' => 'Devel::Cover', - _build => 'Module::Build', - ); - - %mappings = ( - actionscript => [qw( as mxml )], - ada => [qw( ada adb ads )], - asm => [qw( asm s )], - batch => [qw( bat cmd )], - binary => q{Binary files, as defined by Perl's -B op (default: off)}, - cc => [qw( c h xs )], - cfmx => [qw( cfc cfm cfml )], - clojure => [qw( clj )], - cpp => [qw( cpp cc cxx m hpp hh h hxx )], - csharp => [qw( cs )], - css => [qw( css )], - delphi => [qw( pas int dfm nfm dof dpk dproj groupproj bdsgroup bdsproj )], - elisp => [qw( el )], - erlang => [qw( erl hrl )], - fortran => [qw( f f77 f90 f95 f03 for ftn fpp )], - go => [qw( go )], - groovy => [qw( groovy gtmpl gpp grunit )], - haskell => [qw( hs lhs )], - hh => [qw( h )], - html => [qw( htm html shtml xhtml )], - java => [qw( java properties )], - js => [qw( js )], - jsp => [qw( jsp jspx jhtm jhtml )], - lisp => [qw( lisp lsp )], - lua => [qw( lua )], - make => q{Makefiles (including *.mk and *.mak)}, - mason => [qw( mas mhtml mpl mtxt )], - objc => [qw( m h )], - objcpp => [qw( mm h )], - ocaml => [qw( ml mli )], - parrot => [qw( pir pasm pmc ops pod pg tg )], - perl => [qw( pl pm pm6 pod t )], - php => [qw( php phpt php3 php4 php5 phtml)], - plone => [qw( pt cpt metadata cpy py )], - python => [qw( py )], - rake => q{Rakefiles}, - ruby => [qw( rb rhtml rjs rxml erb rake spec )], - scala => [qw( scala )], - scheme => [qw( scm ss )], - shell => [qw( sh bash csh tcsh ksh zsh )], - skipped => q{Files, but not directories, normally skipped by ack (default: off)}, - smalltalk => [qw( st )], - sql => [qw( sql ctl )], - tcl => [qw( tcl itcl itk )], - tex => [qw( tex cls sty )], - text => q{Text files, as defined by Perl's -T op (default: off)}, - tt => [qw( tt tt2 ttml )], - vb => [qw( bas cls frm ctl vb resx )], - verilog => [qw( v vh sv )], - vhdl => [qw( vhd vhdl )], - vim => [qw( vim )], - yaml => [qw( yaml yml )], - xml => [qw( xml dtd xsl xslt ent )], - ); - - while ( my ($type,$exts) = each %mappings ) { - if ( ref $exts ) { - for my $ext ( @{$exts} ) { - push( @{$types{$ext}}, $type ); - } - } - } - # add manually Makefile extensions - push @{$types{$_}}, 'make' for qw{ mk mak }; - - # These have to be checked before any filehandle diddling. - $output_to_pipe = not -t *STDOUT; - $input_from_pipe = -p STDIN; - - $is_cygwin = ($^O eq 'cygwin'); - $is_windows = ($^O =~ /MSWin32/); - $dir_sep_chars = $is_windows ? quotemeta( '\\/' ) : quotemeta( File::Spec->catfile( '', '' ) ); -} - - -sub read_ackrc { - my @files = ( $ENV{ACKRC} ); - my @dirs = - $is_windows - ? ( $ENV{HOME}, $ENV{USERPROFILE} ) - : ( '~', $ENV{HOME} ); - for my $dir ( grep { defined } @dirs ) { - for my $file ( '.ackrc', '_ackrc' ) { - push( @files, bsd_glob( "$dir/$file", GLOB_TILDE ) ); - } - } - for my $filename ( @files ) { - if ( defined $filename && -e $filename ) { - open( my $fh, '<', $filename ) or App::Ack::die( "$filename: $!\n" ); - my @lines = grep { /./ && !/^\s*#/ } <$fh>; - chomp @lines; - close $fh or App::Ack::die( "$filename: $!\n" ); - - # get rid of leading and trailing whitespaces - for ( @lines ) { - s/^\s+//; - s/\s+$//; - } - - return @lines; - } - } - - return; -} - - -sub get_command_line_options { - my %opt = ( - pager => $ENV{ACK_PAGER_COLOR} || $ENV{ACK_PAGER}, - ); - - my $getopt_specs = { - 1 => sub { $opt{1} = $opt{m} = 1 }, - 'A|after-context=i' => \$opt{after_context}, - 'B|before-context=i' => \$opt{before_context}, - 'C|context:i' => sub { shift; my $val = shift; $opt{before_context} = $opt{after_context} = ($val || 2) }, - 'a|all-types' => \$opt{all}, - 'break!' => \$opt{break}, - c => \$opt{count}, - 'color|colour!' => \$opt{color}, - 'color-match=s' => \$ENV{ACK_COLOR_MATCH}, - 'color-filename=s' => \$ENV{ACK_COLOR_FILENAME}, - 'color-lineno=s' => \$ENV{ACK_COLOR_LINENO}, - 'column!' => \$opt{column}, - count => \$opt{count}, - 'env!' => sub { }, # ignore this option, it is handled beforehand - f => \$opt{f}, - flush => \$opt{flush}, - 'follow!' => \$opt{follow}, - 'g=s' => sub { shift; $opt{G} = shift; $opt{f} = 1 }, - 'G=s' => \$opt{G}, - 'group!' => sub { shift; $opt{heading} = $opt{break} = shift }, - 'heading!' => \$opt{heading}, - 'h|no-filename' => \$opt{h}, - 'H|with-filename' => \$opt{H}, - 'i|ignore-case' => \$opt{i}, - 'invert-file-match' => \$opt{invert_file_match}, - 'lines=s' => sub { shift; my $val = shift; push @{$opt{lines}}, $val }, - 'l|files-with-matches' => \$opt{l}, - 'L|files-without-matches' => sub { $opt{l} = $opt{v} = 1 }, - 'm|max-count=i' => \$opt{m}, - 'match=s' => \$opt{regex}, - 'n|no-recurse' => \$opt{n}, - o => sub { $opt{output} = '$&' }, - 'output=s' => \$opt{output}, - 'pager=s' => \$opt{pager}, - 'nopager' => sub { $opt{pager} = undef }, - 'passthru' => \$opt{passthru}, - 'print0' => \$opt{print0}, - 'Q|literal' => \$opt{Q}, - 'r|R|recurse' => sub { $opt{n} = 0 }, - 'show-types' => \$opt{show_types}, - 'smart-case!' => \$opt{smart_case}, - 'sort-files' => \$opt{sort_files}, - 'u|unrestricted' => \$opt{u}, - 'v|invert-match' => \$opt{v}, - 'w|word-regexp' => \$opt{w}, - - 'ignore-dirs=s' => sub { shift; my $dir = remove_dir_sep( shift ); $ignore_dirs{$dir} = '--ignore-dirs' }, - 'noignore-dirs=s' => sub { shift; my $dir = remove_dir_sep( shift ); delete $ignore_dirs{$dir} }, - - 'version' => sub { print_version_statement(); exit; }, - 'help|?:s' => sub { shift; show_help(@_); exit; }, - 'help-types'=> sub { show_help_types(); exit; }, - 'man' => sub { - require Pod::Usage; - Pod::Usage::pod2usage({ - -verbose => 2, - -exitval => 0, - }); - }, - - 'type=s' => sub { - # Whatever --type=xxx they specify, set it manually in the hash - my $dummy = shift; - my $type = shift; - my $wanted = ($type =~ s/^no//) ? 0 : 1; # must not be undef later - - if ( exists $type_wanted{ $type } ) { - $type_wanted{ $type } = $wanted; - } - else { - App::Ack::die( qq{Unknown --type "$type"} ); - } - }, # type sub - }; - - # Stick any default switches at the beginning, so they can be overridden - # by the command line switches. - unshift @ARGV, split( ' ', $ENV{ACK_OPTIONS} ) if defined $ENV{ACK_OPTIONS}; - - # first pass through options, looking for type definitions - def_types_from_ARGV(); - - for my $i ( filetypes_supported() ) { - $getopt_specs->{ "$i!" } = \$type_wanted{ $i }; - } - - - my $parser = Getopt::Long::Parser->new(); - $parser->configure( 'bundling', 'no_ignore_case', ); - $parser->getoptions( %{$getopt_specs} ) or - App::Ack::die( 'See ack --help, ack --help-types or ack --man for options.' ); - - my $to_screen = not output_to_pipe(); - my %defaults = ( - all => 0, - color => $to_screen, - follow => 0, - break => $to_screen, - heading => $to_screen, - before_context => 0, - after_context => 0, - ); - if ( $is_windows && $defaults{color} && not $ENV{ACK_PAGER_COLOR} ) { - if ( $ENV{ACK_PAGER} || not eval { require Win32::Console::ANSI } ) { - $defaults{color} = 0; - } - } - if ( $to_screen && $ENV{ACK_PAGER_COLOR} ) { - $defaults{color} = 1; - } - - while ( my ($key,$value) = each %defaults ) { - if ( not defined $opt{$key} ) { - $opt{$key} = $value; - } - } - - if ( defined $opt{m} && $opt{m} <= 0 ) { - App::Ack::die( '-m must be greater than zero' ); - } - - for ( qw( before_context after_context ) ) { - if ( defined $opt{$_} && $opt{$_} < 0 ) { - App::Ack::die( "--$_ may not be negative" ); - } - } - - if ( defined( my $val = $opt{output} ) ) { - $opt{output} = eval qq[ sub { "$val" } ]; - } - if ( defined( my $l = $opt{lines} ) ) { - # --line=1 --line=5 is equivalent to --line=1,5 - my @lines = split( /,/, join( ',', @{$l} ) ); - - # --line=1-3 is equivalent to --line=1,2,3 - @lines = map { - my @ret; - if ( /-/ ) { - my ($from, $to) = split /-/, $_; - if ( $from > $to ) { - App::Ack::warn( "ignoring --line=$from-$to" ); - @ret = (); - } - else { - @ret = ( $from .. $to ); - } - } - else { - @ret = ( $_ ); - }; - @ret - } @lines; - - if ( @lines ) { - my %uniq; - @uniq{ @lines } = (); - $opt{lines} = [ sort { $a <=> $b } keys %uniq ]; # numerical sort and each line occurs only once! - } - else { - # happens if there are only ignored --line directives - App::Ack::die( 'All --line options are invalid.' ); - } - } - - return \%opt; -} - - -sub def_types_from_ARGV { - my @typedef; - - my $parser = Getopt::Long::Parser->new(); - # pass_through => leave unrecognized command line arguments alone - # no_auto_abbrev => otherwise -c is expanded and not left alone - $parser->configure( 'no_ignore_case', 'pass_through', 'no_auto_abbrev' ); - $parser->getoptions( - 'type-set=s' => sub { shift; push @typedef, ['c', shift] }, - 'type-add=s' => sub { shift; push @typedef, ['a', shift] }, - ) or App::Ack::die( 'See ack --help or ack --man for options.' ); - - for my $td (@typedef) { - my ($type, $ext) = split /=/, $td->[1]; - - if ( $td->[0] eq 'c' ) { - # type-set - if ( exists $mappings{$type} ) { - # can't redefine types 'make', 'skipped', 'text' and 'binary' - App::Ack::die( qq{--type-set: Builtin type "$type" cannot be changed.} ) - if ref $mappings{$type} ne 'ARRAY'; - - delete_type($type); - } - } - else { - # type-add - - # can't append to types 'make', 'skipped', 'text' and 'binary' - App::Ack::die( qq{--type-add: Builtin type "$type" cannot be changed.} ) - if exists $mappings{$type} && ref $mappings{$type} ne 'ARRAY'; - - App::Ack::warn( qq{--type-add: Type "$type" does not exist, creating with "$ext" ...} ) - unless exists $mappings{$type}; - } - - my @exts = split /,/, $ext; - s/^\.// for @exts; - - if ( !exists $mappings{$type} || ref($mappings{$type}) eq 'ARRAY' ) { - push @{$mappings{$type}}, @exts; - for my $e ( @exts ) { - push @{$types{$e}}, $type; - } - } - else { - App::Ack::die( qq{Cannot append to type "$type".} ); - } - } - - return; -} - - -sub delete_type { - my $type = shift; - - App::Ack::die( qq{Internal error: Cannot delete builtin type "$type".} ) - unless ref $mappings{$type} eq 'ARRAY'; - - delete $mappings{$type}; - delete $type_wanted{$type}; - for my $ext ( keys %types ) { - $types{$ext} = [ grep { $_ ne $type } @{$types{$ext}} ]; - } -} - - -sub ignoredir_filter { - return !exists $ignore_dirs{$_} && !exists $ignore_dirs{$File::Next::dir}; -} - - -sub remove_dir_sep { - my $path = shift; - $path =~ s/[$dir_sep_chars]$//; - - return $path; -} - - -use constant TEXT => 'text'; - -sub filetypes { - my $filename = shift; - - my $basename = $filename; - $basename =~ s{.*[$dir_sep_chars]}{}; - - return 'skipped' unless is_searchable( $basename ); - - my $lc_basename = lc $basename; - return ('make',TEXT) if $lc_basename eq 'makefile' || $lc_basename eq 'gnumakefile'; - return ('rake','ruby',TEXT) if $lc_basename eq 'rakefile'; - - # If there's an extension, look it up - if ( $filename =~ m{\.([^\.$dir_sep_chars]+)$}o ) { - my $ref = $types{lc $1}; - return (@{$ref},TEXT) if $ref; - } - - # At this point, we can't tell from just the name. Now we have to - # open it and look inside. - - return unless -e $filename; - # From Elliot Shank: - # I can't see any reason that -r would fail on these-- the ACLs look - # fine, and no program has any of them open, so the busted Windows - # file locking model isn't getting in there. If I comment the if - # statement out, everything works fine - # So, for cygwin, don't bother trying to check for readability. - if ( !$is_cygwin ) { - if ( !-r $filename ) { - App::Ack::warn( "$filename: Permission denied" ); - return; - } - } - - return 'binary' if -B $filename; - - # If there's no extension, or we don't recognize it, check the shebang line - my $fh; - if ( !open( $fh, '<', $filename ) ) { - App::Ack::warn( "$filename: $!" ); - return; - } - my $header = <$fh>; - close $fh; - - if ( $header =~ /^#!/ ) { - return ($1,TEXT) if $header =~ /\b(ruby|lua|p(?:erl|hp|ython))-?(\d[\d.]*)?\b/; - return ('shell',TEXT) if $header =~ /\b(?:ba|t?c|k|z)?sh\b/; - } - else { - return ('xml',TEXT) if $header =~ /\Q{Q}; - if ( $opt->{w} ) { - $str = "\\b$str" if $str =~ /^\w/; - $str = "$str\\b" if $str =~ /\w$/; - } - - my $regex_is_lc = $str eq lc $str; - if ( $opt->{i} || ($opt->{smart_case} && $regex_is_lc) ) { - $str = "(?i)$str"; - } - - return $str; -} - - -sub check_regex { - my $regex = shift; - - return unless defined $regex; - - eval { qr/$regex/ }; - if ($@) { - (my $error = $@) =~ s/ at \S+ line \d+.*//; - chomp($error); - App::Ack::die( "Invalid regex '$regex':\n $error" ); - } - - return; -} - - - - -sub warn { - return CORE::warn( _my_program(), ': ', @_, "\n" ); -} - - -sub die { - return CORE::die( _my_program(), ': ', @_, "\n" ); -} - -sub _my_program { - require File::Basename; - return File::Basename::basename( $0 ); -} - - - -sub filetypes_supported { - return keys %mappings; -} - -sub _get_thpppt { - my $y = q{_ /|,\\'!.x',=(www)=, U }; - $y =~ tr/,x!w/\nOo_/; - return $y; -} - -sub _thpppt { - my $y = _get_thpppt(); - App::Ack::print( "$y ack $_[0]!\n" ); - exit 0; -} - -sub _key { - my $str = lc shift; - $str =~ s/[^a-z]//g; - - return $str; -} - - -sub show_help { - my $help_arg = shift || 0; - - return show_help_types() if $help_arg =~ /^types?/; - - my $ignore_dirs = _listify( sort { _key($a) cmp _key($b) } keys %ignore_dirs ); - - App::Ack::print( <<"END_OF_HELP" ); -Usage: ack [OPTION]... PATTERN [FILE] - -Search for PATTERN in each source file in the tree from cwd on down. -If [FILES] is specified, then only those files/directories are checked. -ack may also search STDIN, but only if no FILE are specified, or if -one of FILES is "-". - -Default switches may be specified in ACK_OPTIONS environment variable or -an .ackrc file. If you want no dependency on the environment, turn it -off with --noenv. - -Example: ack -i select - -Searching: - -i, --ignore-case Ignore case distinctions in PATTERN - --[no]smart-case Ignore case distinctions in PATTERN, - only if PATTERN contains no upper case - Ignored if -i is specified - -v, --invert-match Invert match: select non-matching lines - -w, --word-regexp Force PATTERN to match only whole words - -Q, --literal Quote all metacharacters; PATTERN is literal - -Search output: - --line=NUM Only print line(s) NUM of each file - -l, --files-with-matches - Only print filenames containing matches - -L, --files-without-matches - Only print filenames with no matches - -o Show only the part of a line matching PATTERN - (turns off text highlighting) - --passthru Print all lines, whether matching or not - --output=expr Output the evaluation of expr for each line - (turns off text highlighting) - --match PATTERN Specify PATTERN explicitly. - -m, --max-count=NUM Stop searching in each file after NUM matches - -1 Stop searching after one match of any kind - -H, --with-filename Print the filename for each match - -h, --no-filename Suppress the prefixing filename on output - -c, --count Show number of lines matching per file - --column Show the column number of the first match - - -A NUM, --after-context=NUM - Print NUM lines of trailing context after matching - lines. - -B NUM, --before-context=NUM - Print NUM lines of leading context before matching - lines. - -C [NUM], --context[=NUM] - Print NUM lines (default 2) of output context. - - --print0 Print null byte as separator between filenames, - only works with -f, -g, -l, -L or -c. - -File presentation: - --pager=COMMAND Pipes all ack output through COMMAND. For example, - --pager="less -R". Ignored if output is redirected. - --nopager Do not send output through a pager. Cancels any - setting in ~/.ackrc, ACK_PAGER or ACK_PAGER_COLOR. - --[no]heading Print a filename heading above each file's results. - (default: on when used interactively) - --[no]break Print a break between results from different files. - (default: on when used interactively) - --group Same as --heading --break - --nogroup Same as --noheading --nobreak - --[no]color Highlight the matching text (default: on unless - output is redirected, or on Windows) - --[no]colour Same as --[no]color - --color-filename=COLOR - --color-match=COLOR - --color-lineno=COLOR Set the color for filenames, matches, and line numbers. - --flush Flush output immediately, even when ack is used - non-interactively (when output goes to a pipe or - file). - -File finding: - -f Only print the files found, without searching. - The PATTERN must not be specified. - -g REGEX Same as -f, but only print files matching REGEX. - --sort-files Sort the found files lexically. - --invert-file-match Print/search handle files that do not match -g/-G. - --show-types Show which types each file has. - -File inclusion/exclusion: - -a, --all-types All file types searched; - Ignores CVS, .svn and other ignored directories - -u, --unrestricted All files and directories searched - --[no]ignore-dir=name Add/Remove directory from the list of ignored dirs - -r, -R, --recurse Recurse into subdirectories (ack's default behavior) - -n, --no-recurse No descending into subdirectories - -G REGEX Only search files that match REGEX - - --perl Include only Perl files. - --type=perl Include only Perl files. - --noperl Exclude Perl files. - --type=noperl Exclude Perl files. - See "ack --help type" for supported filetypes. - - --type-set TYPE=.EXTENSION[,.EXT2[,...]] - Files with the given EXTENSION(s) are recognized as - being of type TYPE. This replaces an existing - definition for type TYPE. - --type-add TYPE=.EXTENSION[,.EXT2[,...]] - Files with the given EXTENSION(s) are recognized as - being of (the existing) type TYPE - - --[no]follow Follow symlinks. Default is off. - - Directories ignored by default: - $ignore_dirs - - Files not checked for type: - /~\$/ - Unix backup files - /#.+#\$/ - Emacs swap files - /[._].*\\.swp\$/ - Vi(m) swap files - /core\\.\\d+\$/ - core dumps - /[.-]min\\.js\$/ - Minified javascript files - -Miscellaneous: - --noenv Ignore environment variables and ~/.ackrc - --help This help - --man Man page - --version Display version & copyright - --thpppt Bill the Cat - -Exit status is 0 if match, 1 if no match. - -This is version $VERSION of ack. -END_OF_HELP - - return; - } - - - -sub show_help_types { - App::Ack::print( <<'END_OF_HELP' ); -Usage: ack [OPTION]... PATTERN [FILES] - -The following is the list of filetypes supported by ack. You can -specify a file type with the --type=TYPE format, or the --TYPE -format. For example, both --type=perl and --perl work. - -Note that some extensions may appear in multiple types. For example, -.pod files are both Perl and Parrot. - -END_OF_HELP - - my @types = filetypes_supported(); - my $maxlen = 0; - for ( @types ) { - $maxlen = length if $maxlen < length; - } - for my $type ( sort @types ) { - next if $type =~ /^-/; # Stuff to not show - my $ext_list = $mappings{$type}; - - if ( ref $ext_list ) { - $ext_list = join( ' ', map { ".$_" } @{$ext_list} ); - } - App::Ack::print( sprintf( " --[no]%-*.*s %s\n", $maxlen, $maxlen, $type, $ext_list ) ); - } - - return; -} - -sub _listify { - my @whats = @_; - - return '' if !@whats; - - my $end = pop @whats; - my $str = @whats ? join( ', ', @whats ) . " and $end" : $end; - - no warnings 'once'; - require Text::Wrap; - $Text::Wrap::columns = 75; - return Text::Wrap::wrap( '', ' ', $str ); -} - - -sub get_version_statement { - require Config; - - my $copyright = get_copyright(); - my $this_perl = $Config::Config{perlpath}; - if ($^O ne 'VMS') { - my $ext = $Config::Config{_exe}; - $this_perl .= $ext unless $this_perl =~ m/$ext$/i; - } - my $ver = sprintf( '%vd', $^V ); - - return <<"END_OF_VERSION"; -ack $VERSION -Running under Perl $ver at $this_perl - -$copyright - -This program is free software. You may modify or distribute it -under the terms of the Artistic License v2.0. -END_OF_VERSION -} - - -sub print_version_statement { - App::Ack::print( get_version_statement() ); - - return; -} - - -sub get_copyright { - return $COPYRIGHT; -} - - -sub load_colors { - eval 'use Term::ANSIColor ()'; - - $ENV{ACK_COLOR_MATCH} ||= 'black on_yellow'; - $ENV{ACK_COLOR_FILENAME} ||= 'bold green'; - $ENV{ACK_COLOR_LINENO} ||= 'bold yellow'; - - return; -} - - -sub is_interesting { - return if /^\./; - - my $include; - - for my $type ( filetypes( $File::Next::name ) ) { - if ( defined $type_wanted{$type} ) { - if ( $type_wanted{$type} ) { - $include = 1; - } - else { - return; - } - } - } - - return $include; -} - - - -# print subs added in order to make it easy for a third party -# module (such as App::Wack) to redefine the display methods -# and show the results in a different way. -sub print { print {$fh} @_ } -sub print_first_filename { App::Ack::print( $_[0], "\n" ) } -sub print_blank_line { App::Ack::print( "\n" ) } -sub print_separator { App::Ack::print( "--\n" ) } -sub print_filename { App::Ack::print( $_[0], $_[1] ) } -sub print_line_no { App::Ack::print( $_[0], $_[1] ) } -sub print_column_no { App::Ack::print( $_[0], $_[1] ) } -sub print_count { - my $filename = shift; - my $nmatches = shift; - my $ors = shift; - my $count = shift; - my $show_filename = shift; - - if ($show_filename) { - App::Ack::print( $filename ); - App::Ack::print( ':', $nmatches ) if $count; - } - else { - App::Ack::print( $nmatches ) if $count; - } - App::Ack::print( $ors ); -} - -sub print_count0 { - my $filename = shift; - my $ors = shift; - my $show_filename = shift; - - if ($show_filename) { - App::Ack::print( $filename, ':0', $ors ); - } - else { - App::Ack::print( '0', $ors ); - } -} - - - -{ - my $filename; - my $regex; - my $display_filename; - - my $keep_context; - - my $last_output_line; # number of the last line that has been output - my $any_output; # has there been any output for the current file yet - my $context_overall_output_count; # has there been any output at all - -sub search_resource { - my $res = shift; - my $opt = shift; - - $filename = $res->name(); - - my $v = $opt->{v}; - my $passthru = $opt->{passthru}; - my $max = $opt->{m}; - my $nmatches = 0; - - $display_filename = undef; - - # for --line processing - my $has_lines = 0; - my @lines; - if ( defined $opt->{lines} ) { - $has_lines = 1; - @lines = ( @{$opt->{lines}}, -1 ); - undef $regex; # Don't match when printing matching line - } - else { - $regex = qr/$opt->{regex}/; - } - - # for context processing - $last_output_line = -1; - $any_output = 0; - my $before_context = $opt->{before_context}; - my $after_context = $opt->{after_context}; - - $keep_context = ($before_context || $after_context) && !$passthru; - - my @before; - my $before_starts_at_line; - my $after = 0; # number of lines still to print after a match - - while ( $res->next_text ) { - # XXX Optimize away the case when there are no more @lines to find. - # XXX $has_lines, $passthru and $v never change. Optimize. - if ( $has_lines - ? $. != $lines[0] # $lines[0] should be a scalar - : $v ? m/$regex/ : !m/$regex/ ) { - if ( $passthru ) { - App::Ack::print( $_ ); - next; - } - - if ( $keep_context ) { - if ( $after ) { - print_match_or_context( $opt, 0, $., $-[0], $+[0], $_ ); - $after--; - } - elsif ( $before_context ) { - if ( @before ) { - if ( @before >= $before_context ) { - shift @before; - ++$before_starts_at_line; - } - } - else { - $before_starts_at_line = $.; - } - push @before, $_; - } - last if $max && ( $nmatches >= $max ) && !$after; - } - next; - } # not a match - - ++$nmatches; - - # print an empty line as a divider before first line in each file (not before the first file) - if ( !$any_output && $opt->{show_filename} && $opt->{break} && defined( $context_overall_output_count ) ) { - App::Ack::print_blank_line(); - } - - shift @lines if $has_lines; - - if ( $res->is_binary ) { - App::Ack::print( "Binary file $filename matches\n" ); - last; - } - if ( $keep_context ) { - if ( @before ) { - print_match_or_context( $opt, 0, $before_starts_at_line, $-[0], $+[0], @before ); - @before = (); - $before_starts_at_line = 0; - } - if ( $max && $nmatches > $max ) { - --$after; - } - else { - $after = $after_context; - } - } - print_match_or_context( $opt, 1, $., $-[0], $+[0], $_ ); - - last if $max && ( $nmatches >= $max ) && !$after; - } # while - - return $nmatches; -} # search_resource() - - - -sub print_match_or_context { - my $opt = shift; # opts array - my $is_match = shift; # is there a match on the line? - my $line_no = shift; - my $match_start = shift; - my $match_end = shift; - - my $color = $opt->{color}; - my $heading = $opt->{heading}; - my $show_filename = $opt->{show_filename}; - my $show_column = $opt->{column}; - - if ( $show_filename ) { - if ( not defined $display_filename ) { - $display_filename = - $color - ? Term::ANSIColor::colored( $filename, $ENV{ACK_COLOR_FILENAME} ) - : $filename; - if ( $heading && !$any_output ) { - App::Ack::print_first_filename($display_filename); - } - } - } - - # Modified for Atom by Nathan Sobo to print a "\0" instead of a ":" as a separator - my $sep = $is_match ? "\0" : '-'; - my $output_func = $opt->{output}; - for ( @_ ) { - if ( $keep_context && !$output_func ) { - if ( ( $last_output_line != $line_no - 1 ) && - ( $any_output || ( !$heading && defined( $context_overall_output_count ) ) ) ) { - App::Ack::print_separator(); - } - # to ensure separators between different files when --noheading - - $last_output_line = $line_no; - } - - if ( $show_filename ) { - App::Ack::print_filename($display_filename, $sep) if not $heading; - my $display_line_no = - $color - ? Term::ANSIColor::colored( $line_no, $ENV{ACK_COLOR_LINENO} ) - : $line_no; - App::Ack::print_line_no($display_line_no, $sep); - } - - if ( $output_func ) { - while ( /$regex/go ) { - App::Ack::print( $output_func->() . "\n" ); - } - } - else { - if ( $color && $is_match && $regex && - s/$regex/Term::ANSIColor::colored( substr($_, $-[0], $+[0] - $-[0]), $ENV{ACK_COLOR_MATCH} )/eg ) { - # At the end of the line reset the color and remove newline - s/[\r\n]*\z/\e[0m\e[K/; - } - else { - # remove any kind of newline at the end of the line - s/[\r\n]*\z//; - } - if ( $show_column ) { - App::Ack::print_column_no( $match_start+1, $sep ); - } - App::Ack::print($_ . "\n"); - } - $any_output = 1; - ++$context_overall_output_count; - ++$line_no; - } - - return; -} # print_match_or_context() - -} # scope around search_resource() and print_match_or_context() - - -TOTAL_COUNT_SCOPE: { -my $total_count; - -sub get_total_count { - return $total_count; -} - -sub reset_total_count { - $total_count = 0; -} - - -sub search_and_list { - my $res = shift; - my $opt = shift; - - my $nmatches = 0; - my $count = $opt->{count}; - my $ors = $opt->{print0} ? "\0" : "\n"; # output record separator - my $show_filename = $opt->{show_filename}; - - my $regex = qr/$opt->{regex}/; - - if ( $opt->{v} ) { - while ( $res->next_text ) { - if ( /$regex/ ) { - return 0 unless $count; - } - else { - ++$nmatches; - } - } - } - else { - while ( $res->next_text ) { - if ( /$regex/ ) { - ++$nmatches; - last unless $count; - } - } - } - - if ( $opt->{show_total} ) { - $total_count += $nmatches; - } - else { - if ( $nmatches ) { - App::Ack::print_count( $res->name, $nmatches, $ors, $count, $show_filename ); - } - elsif ( $count && !$opt->{l} ) { - App::Ack::print_count0( $res->name, $ors, $show_filename ); - } - } - - return $nmatches ? 1 : 0; -} # search_and_list() - -} # scope around $total_count - - - -sub filetypes_supported_set { - return grep { defined $type_wanted{$_} && ($type_wanted{$_} == 1) } filetypes_supported(); -} - - - -sub print_files { - my $iter = shift; - my $opt = shift; - - my $ors = $opt->{print0} ? "\0" : "\n"; - - my $nmatches = 0; - while ( defined ( my $file = $iter->() ) ) { - App::Ack::print $file, $opt->{show_types} ? " => " . join( ',', filetypes( $file ) ) : (), $ors; - $nmatches++; - last if $opt->{1}; - } - - return $nmatches; -} - - -sub print_files_with_matches { - my $iter = shift; - my $opt = shift; - - # if we have -l and only 1 file given on command line (this means - # show_filename is set to 0), we want to see the filename nevertheless - $opt->{show_filename} = 1 if $opt->{l}; - - $opt->{show_filename} = 0 if $opt->{h}; - $opt->{show_filename} = 1 if $opt->{H}; - - # abuse options to hand in the show_total parameter to search_and_list - $opt->{show_total} = $opt->{count} && !$opt->{show_filename}; - reset_total_count(); - - my $nmatches = 0; - while ( defined ( my $filename = $iter->() ) ) { - my $repo = App::Ack::Repository::Basic->new( $filename ); - my $res; - while ( $res = $repo->next_resource() ) { - $nmatches += search_and_list( $res, $opt ); - $res->close(); - last if $nmatches && $opt->{1}; - } - $repo->close(); - } - - if ( $nmatches && $opt->{show_total} ) { - App::Ack::print_count('', get_total_count(), "\n", 1, 0 ) - } - - return $nmatches; -} - - -sub print_matches { - my $iter = shift; - my $opt = shift; - - $opt->{show_filename} = 0 if $opt->{h}; - $opt->{show_filename} = 1 if $opt->{H}; - - my $nmatches = 0; - while ( defined ( my $filename = $iter->() ) ) { - my $repo; - my $tarballs_work = 0; - if ( $tarballs_work && $filename =~ /\.tar\.gz$/ ) { - App::Ack::die( 'Not working here yet' ); - require App::Ack::Repository::Tar; # XXX Error checking - $repo = App::Ack::Repository::Tar->new( $filename ); - } - else { - $repo = App::Ack::Repository::Basic->new( $filename ); - } - $repo or next; - - while ( my $res = $repo->next_resource() ) { - my $needs_line_scan; - if ( $opt->{regex} && !$opt->{passthru} ) { - $needs_line_scan = $res->needs_line_scan( $opt ); - if ( $needs_line_scan ) { - $res->reset(); - } - } - else { - $needs_line_scan = 1; - } - if ( $needs_line_scan ) { - $nmatches += search_resource( $res, $opt ); - } - $res->close(); - } - last if $nmatches && $opt->{1}; - $repo->close(); - } - return $nmatches; -} - - -sub filetype_setup { - my $filetypes_supported_set = filetypes_supported_set(); - # If anyone says --no-whatever, we assume all other types must be on. - if ( !$filetypes_supported_set ) { - for my $i ( keys %type_wanted ) { - $type_wanted{$i} = 1 unless ( defined( $type_wanted{$i} ) || $i eq 'binary' || $i eq 'text' || $i eq 'skipped' ); - } - } - return; -} - - -EXPAND_FILENAMES_SCOPE: { - my $filter; - - sub expand_filenames { - my $argv = shift; - - my $attr; - my @files; - - foreach my $pattern ( @{$argv} ) { - my @results = bsd_glob( $pattern ); - - if (@results == 0) { - @results = $pattern; # Glob didn't match, pass it thru unchanged - } - elsif ( (@results > 1) or ($results[0] ne $pattern) ) { - if (not defined $filter) { - eval 'require Win32::File;'; - if ($@) { - $filter = 0; - } - else { - $filter = Win32::File::HIDDEN()|Win32::File::SYSTEM(); - } - } # end unless we've tried to load Win32::File - if ( $filter ) { - # Filter out hidden and system files: - @results = grep { not(Win32::File::GetAttributes($_, $attr) and $attr & $filter) } @results; - App::Ack::warn( "$pattern: Matched only hidden files" ) unless @results; - } # end if we can filter by file attributes - } # end elsif this pattern got expanded - - push @files, @results; - } # end foreach pattern - - return \@files; - } # end expand_filenames -} # EXPAND_FILENAMES_SCOPE - - - -sub get_starting_points { - my $argv = shift; - my $opt = shift; - - my @what; - - if ( @{$argv} ) { - @what = @{ $is_windows ? expand_filenames($argv) : $argv }; - $_ = File::Next::reslash( $_ ) for @what; - - # Show filenames unless we've specified one single file - $opt->{show_filename} = (@what > 1) || (!-f $what[0]); - } - else { - @what = '.'; # Assume current directory - $opt->{show_filename} = 1; - } - - for my $start_point (@what) { - App::Ack::warn( "$start_point: No such file or directory" ) unless -e $start_point; - } - return \@what; -} - -sub _match { - my ( $target, $expression, $invert_flag ) = @_; - - if ( $invert_flag ) { - return $target !~ $expression; - } - else { - return $target =~ $expression; - } -} - - -sub get_iterator { - my $what = shift; - my $opt = shift; - - # Starting points are always searched, no matter what - my %starting_point = map { ($_ => 1) } @{$what}; - - my $g_regex = defined $opt->{G} ? qr/$opt->{G}/ : undef; - my $file_filter; - - if ( $g_regex ) { - $file_filter - = $opt->{u} ? sub { _match( $File::Next::name, qr/$g_regex/, $opt->{invert_file_match} ) } # XXX Maybe this should be a 1, no? - : $opt->{all} ? sub { $starting_point{ $File::Next::name } || ( _match( $File::Next::name, qr/$g_regex/, $opt->{invert_file_match} ) && is_searchable( $_ ) ) } - : sub { $starting_point{ $File::Next::name } || ( _match( $File::Next::name, qr/$g_regex/, $opt->{invert_file_match} ) && is_interesting( @ _) ) } - ; - } - else { - $file_filter - = $opt->{u} ? sub {1} - : $opt->{all} ? sub { $starting_point{ $File::Next::name } || is_searchable( $_ ) } - : sub { $starting_point{ $File::Next::name } || is_interesting( @_ ) } - ; - } - - my $descend_filter - = $opt->{n} ? sub {0} - : $opt->{u} ? sub {1} - : \&ignoredir_filter; - - my $iter = - File::Next::files( { - file_filter => $file_filter, - descend_filter => $descend_filter, - error_handler => sub { my $msg = shift; App::Ack::warn( $msg ) }, - sort_files => $opt->{sort_files}, - follow_symlinks => $opt->{follow}, - }, @{$what} ); - return $iter; -} - - -sub set_up_pager { - my $command = shift; - - return if App::Ack::output_to_pipe(); - - my $pager; - if ( not open( $pager, '|-', $command ) ) { - App::Ack::die( qq{Unable to pipe to pager "$command": $!} ); - } - $fh = $pager; - - return; -} - - -sub input_from_pipe { - return $input_from_pipe; -} - - - -sub output_to_pipe { - return $output_to_pipe; -} - - -sub exit_from_ack { - my $nmatches = shift; - - my $rc = $nmatches ? 0 : 1; - exit $rc; -} - - - -1; # End of App::Ack -package App::Ack::Repository; - - -use warnings; -use strict; - -sub FAIL { - require Carp; - Carp::confess( 'Must be overloaded' ); -} - - -sub new { - FAIL(); -} - - -sub next_resource { - FAIL(); -} - - -sub close { - FAIL(); -} - -1; -package App::Ack::Resource; - - -use warnings; -use strict; - -sub FAIL { - require Carp; - Carp::confess( 'Must be overloaded' ); -} - - -sub new { - FAIL(); -} - - -sub name { - FAIL(); -} - - -sub is_binary { - FAIL(); -} - - - -sub needs_line_scan { - FAIL(); -} - - -sub reset { - FAIL(); -} - - -sub next_text { - FAIL(); -} - - -sub close { - FAIL(); -} - -1; -package App::Ack::Plugin::Basic; - - - -package App::Ack::Resource::Basic; - - -use warnings; -use strict; - - -our @ISA = qw( App::Ack::Resource ); - - -sub new { - my $class = shift; - my $filename = shift; - - my $self = bless { - filename => $filename, - fh => undef, - could_be_binary => undef, - opened => undef, - id => undef, - }, $class; - - if ( $self->{filename} eq '-' ) { - $self->{fh} = *STDIN; - $self->{could_be_binary} = 0; - } - else { - if ( !open( $self->{fh}, '<', $self->{filename} ) ) { - App::Ack::warn( "$self->{filename}: $!" ); - return; - } - $self->{could_be_binary} = 1; - } - - return $self; -} - - -sub name { - my $self = shift; - - return $self->{filename}; -} - - -sub is_binary { - my $self = shift; - - if ( $self->{could_be_binary} ) { - return -B $self->{filename}; - } - - return 0; -} - - - -sub needs_line_scan { - my $self = shift; - my $opt = shift; - - return 1 if $opt->{v}; - - my $size = -s $self->{fh}; - if ( $size == 0 ) { - return 0; - } - elsif ( $size > 100_000 ) { - return 1; - } - - my $buffer; - my $rc = sysread( $self->{fh}, $buffer, $size ); - if ( not defined $rc ) { - App::Ack::warn( "$self->{filename}: $!" ); - return 1; - } - return 0 unless $rc && ( $rc == $size ); - - my $regex = $opt->{regex}; - return $buffer =~ /$regex/m; -} - - -sub reset { - my $self = shift; - - seek( $self->{fh}, 0, 0 ) - or App::Ack::warn( "$self->{filename}: $!" ); - - return; -} - - -sub next_text { - if ( defined ($_ = readline $_[0]->{fh}) ) { - $. = ++$_[0]->{line}; - return 1; - } - - return; -} - - -sub close { - my $self = shift; - - if ( not close $self->{fh} ) { - App::Ack::warn( $self->name() . ": $!" ); - } - - return; -} - -package App::Ack::Repository::Basic; - - -our @ISA = qw( App::Ack::Repository ); - - -use warnings; -use strict; - -sub new { - my $class = shift; - my $filename = shift; - - my $self = bless { - filename => $filename, - nexted => 0, - }, $class; - - return $self; -} - - -sub next_resource { - my $self = shift; - - return if $self->{nexted}; - $self->{nexted} = 1; - - return App::Ack::Resource::Basic->new( $self->{filename} ); -} - - -sub close { -} - - - -1; diff --git a/vendor/ag b/vendor/ag deleted file mode 100755 index 63e16c228..000000000 Binary files a/vendor/ag and /dev/null differ diff --git a/vendor/assert.js b/vendor/assert.js deleted file mode 100644 index 41e208069..000000000 --- a/vendor/assert.js +++ /dev/null @@ -1,325 +0,0 @@ -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the 'Software'), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -// UTILITY -// var util = require('util'); -var pSlice = Array.prototype.slice; - -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = exports; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.message = options.message; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - var stackStartFunction = options.stackStartFunction || fail; - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } -}; -// util.inherits(assert.AssertionError, Error); - -function replacer(key, value) { - if (value === undefined) { - return '' + value; - } - if (typeof value === 'number' && (isNaN(value) || !isFinite(value))) { - return value.toString(); - } - if (typeof value === 'function' || value instanceof RegExp) { - return value.toString(); - } - return value; -} - -function truncate(s, n) { - if (typeof s == 'string') { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} - -assert.AssertionError.prototype.toString = function() { - if (this.message) { - return [ this.name + ':', this.message ].join(' '); - } else { - return [ - this.name + ':', - truncate(JSON.stringify(this.actual, replacer), 128), - this.operator, - truncate(JSON.stringify(this.expected, replacer), 128) - ].join(' '); - } -}; - -// assert.AssertionError instanceof Error - -assert.AssertionError.__proto__ = Error.prototype; - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -assert.ok = function ok(value, message) { - if (!!!value) fail(value, true, message, '==', assert.ok); -}; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -function _deepEqual(actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - - } else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { - if (actual.length != expected.length) return false; - - for (var i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) return false; - } - - return true; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (actual instanceof Date && expected instanceof Date) { - return actual.getTime() === expected.getTime(); - - // 7.3. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if (typeof actual != 'object' && typeof expected != 'object') { - return actual == expected; - - // 7.4. For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } -} - -function isUndefinedOrNull(value) { - return value === null || value === undefined; -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b) { - if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) - return false; - // an identical 'prototype' property. - if (a.prototype !== b.prototype) return false; - //~~~I've managed to break Object.keys through screwy arguments passing. - // Converting to array solves the problem. - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b); - } - try { - var ka = Object.keys(a), - kb = Object.keys(b), - key, i; - } catch (e) {//happens when one is a string literal and the other isn't - return false; - } - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key])) return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (expected instanceof RegExp) { - return expected.test(actual); - } else if (actual instanceof expected) { - return true; - } else if (expected.call({}, actual) === true) { - return true; - } - - return false; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (typeof expected === 'string') { - message = expected; - expected = null; - } - - try { - block(); - } catch (e) { - actual = e; - } - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail('Missing expected exception' + message); - } - - if (!shouldThrow && expectedException(actual, expected)) { - fail('Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [true].concat(pSlice.call(arguments))); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [false].concat(pSlice.call(arguments))); -}; - -assert.ifError = function(err) { if (err) {throw err;}}; diff --git a/vendor/coffee-script.js b/vendor/coffee-script.js deleted file mode 100644 index 18d9e9010..000000000 --- a/vendor/coffee-script.js +++ /dev/null @@ -1,4642 +0,0 @@ -// MODIFIED: -// Generated with `MINIFY=false cake build:browser` from CoffeeScript source -// Removed call to `define` at end of file so our wrapper kicks in - -/** - * CoffeeScript Compiler v1.2.0 - * http://coffeescript.org - * - * Copyright 2011, Jeremy Ashkenas - * Released under the MIT License - */ -(function(root) { - var CoffeeScript = function() { - function require(path){ return require[path]; } - require['./helpers'] = new function() { - var exports = this; - (function() { - var extend, flatten; - - exports.starts = function(string, literal, start) { - return literal === string.substr(start, literal.length); - }; - - exports.ends = function(string, literal, back) { - var len; - len = literal.length; - return literal === string.substr(string.length - len - (back || 0), len); - }; - - exports.compact = function(array) { - var item, _i, _len, _results; - _results = []; - for (_i = 0, _len = array.length; _i < _len; _i++) { - item = array[_i]; - if (item) _results.push(item); - } - return _results; - }; - - exports.count = function(string, substr) { - var num, pos; - num = pos = 0; - if (!substr.length) return 1 / 0; - while (pos = 1 + string.indexOf(substr, pos)) { - num++; - } - return num; - }; - - exports.merge = function(options, overrides) { - return extend(extend({}, options), overrides); - }; - - extend = exports.extend = function(object, properties) { - var key, val; - for (key in properties) { - val = properties[key]; - object[key] = val; - } - return object; - }; - - exports.flatten = flatten = function(array) { - var element, flattened, _i, _len; - flattened = []; - for (_i = 0, _len = array.length; _i < _len; _i++) { - element = array[_i]; - if (element instanceof Array) { - flattened = flattened.concat(flatten(element)); - } else { - flattened.push(element); - } - } - return flattened; - }; - - exports.del = function(obj, key) { - var val; - val = obj[key]; - delete obj[key]; - return val; - }; - - exports.last = function(array, back) { - return array[array.length - (back || 0) - 1]; - }; - -}).call(this); - -};require['./rewriter'] = new function() { - var exports = this; - (function() { - var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, left, rite, _i, _len, _ref, - __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, - __slice = Array.prototype.slice; - - exports.Rewriter = (function() { - - function Rewriter() {} - - Rewriter.prototype.rewrite = function(tokens) { - this.tokens = tokens; - this.removeLeadingNewlines(); - this.removeMidExpressionNewlines(); - this.closeOpenCalls(); - this.closeOpenIndexes(); - this.addImplicitIndentation(); - this.tagPostfixConditionals(); - this.addImplicitBraces(); - this.addImplicitParentheses(); - return this.tokens; - }; - - Rewriter.prototype.scanTokens = function(block) { - var i, token, tokens; - tokens = this.tokens; - i = 0; - while (token = tokens[i]) { - i += block.call(this, token, i, tokens); - } - return true; - }; - - Rewriter.prototype.detectEnd = function(i, condition, action) { - var levels, token, tokens, _ref, _ref2; - tokens = this.tokens; - levels = 0; - while (token = tokens[i]) { - if (levels === 0 && condition.call(this, token, i)) { - return action.call(this, token, i); - } - if (!token || levels < 0) return action.call(this, token, i - 1); - if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) { - levels += 1; - } else if (_ref2 = token[0], __indexOf.call(EXPRESSION_END, _ref2) >= 0) { - levels -= 1; - } - i += 1; - } - return i - 1; - }; - - Rewriter.prototype.removeLeadingNewlines = function() { - var i, tag, _len, _ref; - _ref = this.tokens; - for (i = 0, _len = _ref.length; i < _len; i++) { - tag = _ref[i][0]; - if (tag !== 'TERMINATOR') break; - } - if (i) return this.tokens.splice(0, i); - }; - - Rewriter.prototype.removeMidExpressionNewlines = function() { - return this.scanTokens(function(token, i, tokens) { - var _ref; - if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) { - return 1; - } - tokens.splice(i, 1); - return 0; - }); - }; - - Rewriter.prototype.closeOpenCalls = function() { - var action, condition; - condition = function(token, i) { - var _ref; - return ((_ref = token[0]) === ')' || _ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')'; - }; - action = function(token, i) { - return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END'; - }; - return this.scanTokens(function(token, i) { - if (token[0] === 'CALL_START') this.detectEnd(i + 1, condition, action); - return 1; - }); - }; - - Rewriter.prototype.closeOpenIndexes = function() { - var action, condition; - condition = function(token, i) { - var _ref; - return (_ref = token[0]) === ']' || _ref === 'INDEX_END'; - }; - action = function(token, i) { - return token[0] = 'INDEX_END'; - }; - return this.scanTokens(function(token, i) { - if (token[0] === 'INDEX_START') this.detectEnd(i + 1, condition, action); - return 1; - }); - }; - - Rewriter.prototype.addImplicitBraces = function() { - var action, condition, sameLine, stack, start, startIndent, startsLine; - stack = []; - start = null; - startsLine = null; - sameLine = true; - startIndent = 0; - condition = function(token, i) { - var one, tag, three, two, _ref, _ref2; - _ref = this.tokens.slice(i + 1, (i + 3) + 1 || 9e9), one = _ref[0], two = _ref[1], three = _ref[2]; - if ('HERECOMMENT' === (one != null ? one[0] : void 0)) return false; - tag = token[0]; - if (__indexOf.call(LINEBREAKS, tag) >= 0) sameLine = false; - return (((tag === 'TERMINATOR' || tag === 'OUTDENT') || (__indexOf.call(IMPLICIT_END, tag) >= 0 && sameLine)) && ((!startsLine && this.tag(i - 1) !== ',') || !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':'))) || (tag === ',' && one && ((_ref2 = one[0]) !== 'IDENTIFIER' && _ref2 !== 'NUMBER' && _ref2 !== 'STRING' && _ref2 !== '@' && _ref2 !== 'TERMINATOR' && _ref2 !== 'OUTDENT')); - }; - action = function(token, i) { - var tok; - tok = ['}', '}', token[2]]; - tok.generated = true; - return this.tokens.splice(i, 0, tok); - }; - return this.scanTokens(function(token, i, tokens) { - var ago, idx, prevTag, tag, tok, value, _ref, _ref2; - if (_ref = (tag = token[0]), __indexOf.call(EXPRESSION_START, _ref) >= 0) { - stack.push([(tag === 'INDENT' && this.tag(i - 1) === '{' ? '{' : tag), i]); - return 1; - } - if (__indexOf.call(EXPRESSION_END, tag) >= 0) { - start = stack.pop(); - return 1; - } - if (!(tag === ':' && ((ago = this.tag(i - 2)) === ':' || ((_ref2 = stack[stack.length - 1]) != null ? _ref2[0] : void 0) !== '{'))) { - return 1; - } - sameLine = true; - stack.push(['{']); - idx = ago === '@' ? i - 2 : i - 1; - while (this.tag(idx - 2) === 'HERECOMMENT') { - idx -= 2; - } - prevTag = this.tag(idx - 1); - startsLine = !prevTag || (__indexOf.call(LINEBREAKS, prevTag) >= 0); - value = new String('{'); - value.generated = true; - tok = ['{', value, token[2]]; - tok.generated = true; - tokens.splice(idx, 0, tok); - this.detectEnd(i + 2, condition, action); - return 2; - }); - }; - - Rewriter.prototype.addImplicitParentheses = function() { - var action, condition, noCall, seenControl, seenSingle; - noCall = seenSingle = seenControl = false; - condition = function(token, i) { - var post, tag, _ref, _ref2; - tag = token[0]; - if (!seenSingle && token.fromThen) return true; - if (tag === 'IF' || tag === 'ELSE' || tag === 'CATCH' || tag === '->' || tag === '=>' || tag === 'CLASS') { - seenSingle = true; - } - if (tag === 'IF' || tag === 'ELSE' || tag === 'SWITCH' || tag === 'TRY' || tag === '=') { - seenControl = true; - } - if ((tag === '.' || tag === '?.' || tag === '::') && this.tag(i - 1) === 'OUTDENT') { - return true; - } - return !token.generated && this.tag(i - 1) !== ',' && (__indexOf.call(IMPLICIT_END, tag) >= 0 || (tag === 'INDENT' && !seenControl)) && (tag !== 'INDENT' || (((_ref = this.tag(i - 2)) !== 'CLASS' && _ref !== 'EXTENDS') && (_ref2 = this.tag(i - 1), __indexOf.call(IMPLICIT_BLOCK, _ref2) < 0) && !((post = this.tokens[i + 1]) && post.generated && post[0] === '{'))); - }; - action = function(token, i) { - return this.tokens.splice(i, 0, ['CALL_END', ')', token[2]]); - }; - return this.scanTokens(function(token, i, tokens) { - var callObject, current, next, prev, tag, _ref, _ref2, _ref3; - tag = token[0]; - if (tag === 'CLASS' || tag === 'IF') noCall = true; - _ref = tokens.slice(i - 1, (i + 1) + 1 || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2]; - callObject = !noCall && tag === 'INDENT' && next && next.generated && next[0] === '{' && prev && (_ref2 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref2) >= 0); - seenSingle = false; - seenControl = false; - if (__indexOf.call(LINEBREAKS, tag) >= 0) noCall = false; - if (prev && !prev.spaced && tag === '?') token.call = true; - if (token.fromThen) return 1; - if (!(callObject || (prev != null ? prev.spaced : void 0) && (prev.call || (_ref3 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref3) >= 0)) && (__indexOf.call(IMPLICIT_CALL, tag) >= 0 || !(token.spaced || token.newLine) && __indexOf.call(IMPLICIT_UNSPACED_CALL, tag) >= 0))) { - return 1; - } - tokens.splice(i, 0, ['CALL_START', '(', token[2]]); - this.detectEnd(i + 1, condition, action); - if (prev[0] === '?') prev[0] = 'FUNC_EXIST'; - return 2; - }); - }; - - Rewriter.prototype.addImplicitIndentation = function() { - var action, condition, indent, outdent, starter; - starter = indent = outdent = null; - condition = function(token, i) { - var _ref; - return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && (starter !== 'IF' && starter !== 'THEN')); - }; - action = function(token, i) { - return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent); - }; - return this.scanTokens(function(token, i, tokens) { - var tag, _ref, _ref2; - tag = token[0]; - if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') { - tokens.splice(i, 1); - return 0; - } - if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') { - tokens.splice.apply(tokens, [i, 0].concat(__slice.call(this.indentation(token)))); - return 2; - } - if (tag === 'CATCH' && ((_ref = this.tag(i + 2)) === 'OUTDENT' || _ref === 'TERMINATOR' || _ref === 'FINALLY')) { - tokens.splice.apply(tokens, [i + 2, 0].concat(__slice.call(this.indentation(token)))); - return 4; - } - if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) { - starter = tag; - _ref2 = this.indentation(token), indent = _ref2[0], outdent = _ref2[1]; - if (starter === 'THEN') indent.fromThen = true; - indent.generated = outdent.generated = true; - tokens.splice(i + 1, 0, indent); - this.detectEnd(i + 2, condition, action); - if (tag === 'THEN') tokens.splice(i, 1); - return 1; - } - return 1; - }); - }; - - Rewriter.prototype.tagPostfixConditionals = function() { - var action, condition, original; - original = null; - condition = function(token, i) { - var _ref; - return (_ref = token[0]) === 'TERMINATOR' || _ref === 'INDENT'; - }; - action = function(token, i) { - if (token[0] !== 'INDENT' || (token.generated && !token.fromThen)) { - return original[0] = 'POST_' + original[0]; - } - }; - return this.scanTokens(function(token, i) { - if (token[0] !== 'IF') return 1; - original = token; - this.detectEnd(i + 1, condition, action); - return 1; - }); - }; - - Rewriter.prototype.indentation = function(token) { - return [['INDENT', 2, token[2]], ['OUTDENT', 2, token[2]]]; - }; - - Rewriter.prototype.tag = function(i) { - var _ref; - return (_ref = this.tokens[i]) != null ? _ref[0] : void 0; - }; - - return Rewriter; - - })(); - - BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END']]; - - exports.INVERSES = INVERSES = {}; - - EXPRESSION_START = []; - - EXPRESSION_END = []; - - for (_i = 0, _len = BALANCED_PAIRS.length; _i < _len; _i++) { - _ref = BALANCED_PAIRS[_i], left = _ref[0], rite = _ref[1]; - EXPRESSION_START.push(INVERSES[rite] = left); - EXPRESSION_END.push(INVERSES[left] = rite); - } - - EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END); - - IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS']; - - IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'UNARY', 'SUPER', '@', '->', '=>', '[', '(', '{', '--', '++']; - - IMPLICIT_UNSPACED_CALL = ['+', '-']; - - IMPLICIT_BLOCK = ['->', '=>', '{', '[', ',']; - - IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR']; - - SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN']; - - SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN']; - - LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT']; - -}).call(this); - -};require['./lexer'] = new function() { - var exports = this; - (function() { - var BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, key, last, starts, _ref, _ref2, - __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - - _ref = require('./rewriter'), Rewriter = _ref.Rewriter, INVERSES = _ref.INVERSES; - - _ref2 = require('./helpers'), count = _ref2.count, starts = _ref2.starts, compact = _ref2.compact, last = _ref2.last; - - exports.Lexer = Lexer = (function() { - - function Lexer() {} - - Lexer.prototype.tokenize = function(code, opts) { - var i, tag; - if (opts == null) opts = {}; - if (WHITESPACE.test(code)) code = "\n" + code; - code = code.replace(/\r/g, '').replace(TRAILING_SPACES, ''); - this.code = code; - this.line = opts.line || 0; - this.indent = 0; - this.indebt = 0; - this.outdebt = 0; - this.indents = []; - this.ends = []; - this.tokens = []; - i = 0; - while (this.chunk = code.slice(i)) { - i += this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken(); - } - this.closeIndentation(); - if (tag = this.ends.pop()) this.error("missing " + tag); - if (opts.rewrite === false) return this.tokens; - return (new Rewriter).rewrite(this.tokens); - }; - - Lexer.prototype.identifierToken = function() { - var colon, forcedIdentifier, id, input, match, prev, tag, _ref3, _ref4; - if (!(match = IDENTIFIER.exec(this.chunk))) return 0; - input = match[0], id = match[1], colon = match[2]; - if (id === 'own' && this.tag() === 'FOR') { - this.token('OWN', id); - return id.length; - } - forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref3 = prev[0]) === '.' || _ref3 === '?.' || _ref3 === '::') || !prev.spaced && prev[0] === '@'); - tag = 'IDENTIFIER'; - if (!forcedIdentifier && (__indexOf.call(JS_KEYWORDS, id) >= 0 || __indexOf.call(COFFEE_KEYWORDS, id) >= 0)) { - tag = id.toUpperCase(); - if (tag === 'WHEN' && (_ref4 = this.tag(), __indexOf.call(LINE_BREAK, _ref4) >= 0)) { - tag = 'LEADING_WHEN'; - } else if (tag === 'FOR') { - this.seenFor = true; - } else if (tag === 'UNLESS') { - tag = 'IF'; - } else if (__indexOf.call(UNARY, tag) >= 0) { - tag = 'UNARY'; - } else if (__indexOf.call(RELATION, tag) >= 0) { - if (tag !== 'INSTANCEOF' && this.seenFor) { - tag = 'FOR' + tag; - this.seenFor = false; - } else { - tag = 'RELATION'; - if (this.value() === '!') { - this.tokens.pop(); - id = '!' + id; - } - } - } - } - if (__indexOf.call(['eval', 'arguments'].concat(JS_FORBIDDEN), id) >= 0) { - if (forcedIdentifier) { - tag = 'IDENTIFIER'; - id = new String(id); - id.reserved = true; - } else if (__indexOf.call(RESERVED, id) >= 0) { - this.error("reserved word \"" + id + "\""); - } - } - if (!forcedIdentifier) { - if (__indexOf.call(COFFEE_ALIASES, id) >= 0) id = COFFEE_ALIAS_MAP[id]; - tag = (function() { - switch (id) { - case '!': - return 'UNARY'; - case '==': - case '!=': - return 'COMPARE'; - case '&&': - case '||': - return 'LOGIC'; - case 'true': - case 'false': - case 'null': - case 'undefined': - return 'BOOL'; - case 'break': - case 'continue': - return 'STATEMENT'; - default: - return tag; - } - })(); - } - this.token(tag, id); - if (colon) this.token(':', ':'); - return input.length; - }; - - Lexer.prototype.numberToken = function() { - var binaryLiteral, lexedLength, match, number; - if (!(match = NUMBER.exec(this.chunk))) return 0; - number = match[0]; - lexedLength = number.length; - if (binaryLiteral = /0b([01]+)/.exec(number)) { - number = (parseInt(binaryLiteral[1], 2)).toString(); - } - this.token('NUMBER', number); - return lexedLength; - }; - - Lexer.prototype.stringToken = function() { - var match, string; - switch (this.chunk.charAt(0)) { - case "'": - if (!(match = SIMPLESTR.exec(this.chunk))) return 0; - this.token('STRING', (string = match[0]).replace(MULTILINER, '\\\n')); - break; - case '"': - if (!(string = this.balancedString(this.chunk, '"'))) return 0; - if (0 < string.indexOf('#{', 1)) { - this.interpolateString(string.slice(1, -1)); - } else { - this.token('STRING', this.escapeLines(string)); - } - break; - default: - return 0; - } - this.line += count(string, '\n'); - return string.length; - }; - - Lexer.prototype.heredocToken = function() { - var doc, heredoc, match, quote; - if (!(match = HEREDOC.exec(this.chunk))) return 0; - heredoc = match[0]; - quote = heredoc.charAt(0); - doc = this.sanitizeHeredoc(match[2], { - quote: quote, - indent: null - }); - if (quote === '"' && 0 <= doc.indexOf('#{')) { - this.interpolateString(doc, { - heredoc: true - }); - } else { - this.token('STRING', this.makeString(doc, quote, true)); - } - this.line += count(heredoc, '\n'); - return heredoc.length; - }; - - Lexer.prototype.commentToken = function() { - var comment, here, match; - if (!(match = this.chunk.match(COMMENT))) return 0; - comment = match[0], here = match[1]; - if (here) { - this.token('HERECOMMENT', this.sanitizeHeredoc(here, { - herecomment: true, - indent: Array(this.indent + 1).join(' ') - })); - this.token('TERMINATOR', '\n'); - } - this.line += count(comment, '\n'); - return comment.length; - }; - - Lexer.prototype.jsToken = function() { - var match, script; - if (!(this.chunk.charAt(0) === '`' && (match = JSTOKEN.exec(this.chunk)))) { - return 0; - } - this.token('JS', (script = match[0]).slice(1, -1)); - return script.length; - }; - - Lexer.prototype.regexToken = function() { - var flags, length, match, prev, regex, _ref3, _ref4; - if (this.chunk.charAt(0) !== '/') return 0; - if (match = HEREGEX.exec(this.chunk)) { - length = this.heregexToken(match); - this.line += count(match[0], '\n'); - return length; - } - prev = last(this.tokens); - if (prev && (_ref3 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref3) >= 0)) { - return 0; - } - if (!(match = REGEX.exec(this.chunk))) return 0; - _ref4 = match, match = _ref4[0], regex = _ref4[1], flags = _ref4[2]; - if (regex.slice(0, 2) === '/*') { - this.error('regular expressions cannot begin with `*`'); - } - if (regex === '//') regex = '/(?:)/'; - this.token('REGEX', "" + regex + flags); - return match.length; - }; - - Lexer.prototype.heregexToken = function(match) { - var body, flags, heregex, re, tag, tokens, value, _i, _len, _ref3, _ref4, _ref5, _ref6; - heregex = match[0], body = match[1], flags = match[2]; - if (0 > body.indexOf('#{')) { - re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/'); - if (re.match(/^\*/)) { - this.error('regular expressions cannot begin with `*`'); - } - this.token('REGEX', "/" + (re || '(?:)') + "/" + flags); - return heregex.length; - } - this.token('IDENTIFIER', 'RegExp'); - this.tokens.push(['CALL_START', '(']); - tokens = []; - _ref3 = this.interpolateString(body, { - regex: true - }); - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - _ref4 = _ref3[_i], tag = _ref4[0], value = _ref4[1]; - if (tag === 'TOKENS') { - tokens.push.apply(tokens, value); - } else { - if (!(value = value.replace(HEREGEX_OMIT, ''))) continue; - value = value.replace(/\\/g, '\\\\'); - tokens.push(['STRING', this.makeString(value, '"', true)]); - } - tokens.push(['+', '+']); - } - tokens.pop(); - if (((_ref5 = tokens[0]) != null ? _ref5[0] : void 0) !== 'STRING') { - this.tokens.push(['STRING', '""'], ['+', '+']); - } - (_ref6 = this.tokens).push.apply(_ref6, tokens); - if (flags) this.tokens.push([',', ','], ['STRING', '"' + flags + '"']); - this.token(')', ')'); - return heregex.length; - }; - - Lexer.prototype.lineToken = function() { - var diff, indent, match, noNewlines, prev, size; - if (!(match = MULTI_DENT.exec(this.chunk))) return 0; - indent = match[0]; - this.line += count(indent, '\n'); - this.seenFor = false; - prev = last(this.tokens, 1); - size = indent.length - 1 - indent.lastIndexOf('\n'); - noNewlines = this.unfinished(); - if (size - this.indebt === this.indent) { - if (noNewlines) { - this.suppressNewlines(); - } else { - this.newlineToken(); - } - return indent.length; - } - if (size > this.indent) { - if (noNewlines) { - this.indebt = size - this.indent; - this.suppressNewlines(); - return indent.length; - } - diff = size - this.indent + this.outdebt; - this.token('INDENT', diff); - this.indents.push(diff); - this.ends.push('OUTDENT'); - this.outdebt = this.indebt = 0; - } else { - this.indebt = 0; - this.outdentToken(this.indent - size, noNewlines); - } - this.indent = size; - return indent.length; - }; - - Lexer.prototype.outdentToken = function(moveOut, noNewlines) { - var dent, len; - while (moveOut > 0) { - len = this.indents.length - 1; - if (this.indents[len] === void 0) { - moveOut = 0; - } else if (this.indents[len] === this.outdebt) { - moveOut -= this.outdebt; - this.outdebt = 0; - } else if (this.indents[len] < this.outdebt) { - this.outdebt -= this.indents[len]; - moveOut -= this.indents[len]; - } else { - dent = this.indents.pop() - this.outdebt; - moveOut -= dent; - this.outdebt = 0; - this.pair('OUTDENT'); - this.token('OUTDENT', dent); - } - } - if (dent) this.outdebt -= moveOut; - while (this.value() === ';') { - this.tokens.pop(); - } - if (!(this.tag() === 'TERMINATOR' || noNewlines)) { - this.token('TERMINATOR', '\n'); - } - return this; - }; - - Lexer.prototype.whitespaceToken = function() { - var match, nline, prev; - if (!((match = WHITESPACE.exec(this.chunk)) || (nline = this.chunk.charAt(0) === '\n'))) { - return 0; - } - prev = last(this.tokens); - if (prev) prev[match ? 'spaced' : 'newLine'] = true; - if (match) { - return match[0].length; - } else { - return 0; - } - }; - - Lexer.prototype.newlineToken = function() { - while (this.value() === ';') { - this.tokens.pop(); - } - if (this.tag() !== 'TERMINATOR') this.token('TERMINATOR', '\n'); - return this; - }; - - Lexer.prototype.suppressNewlines = function() { - if (this.value() === '\\') this.tokens.pop(); - return this; - }; - - Lexer.prototype.literalToken = function() { - var match, prev, tag, value, _ref3, _ref4, _ref5, _ref6; - if (match = OPERATOR.exec(this.chunk)) { - value = match[0]; - if (CODE.test(value)) this.tagParameters(); - } else { - value = this.chunk.charAt(0); - } - tag = value; - prev = last(this.tokens); - if (value === '=' && prev) { - if (!prev[1].reserved && (_ref3 = prev[1], __indexOf.call(JS_FORBIDDEN, _ref3) >= 0)) { - this.error("reserved word \"" + (this.value()) + "\" can't be assigned"); - } - if ((_ref4 = prev[1]) === '||' || _ref4 === '&&') { - prev[0] = 'COMPOUND_ASSIGN'; - prev[1] += '='; - return value.length; - } - } - if (value === ';') { - this.seenFor = false; - tag = 'TERMINATOR'; - } else if (__indexOf.call(MATH, value) >= 0) { - tag = 'MATH'; - } else if (__indexOf.call(COMPARE, value) >= 0) { - tag = 'COMPARE'; - } else if (__indexOf.call(COMPOUND_ASSIGN, value) >= 0) { - tag = 'COMPOUND_ASSIGN'; - } else if (__indexOf.call(UNARY, value) >= 0) { - tag = 'UNARY'; - } else if (__indexOf.call(SHIFT, value) >= 0) { - tag = 'SHIFT'; - } else if (__indexOf.call(LOGIC, value) >= 0 || value === '?' && (prev != null ? prev.spaced : void 0)) { - tag = 'LOGIC'; - } else if (prev && !prev.spaced) { - if (value === '(' && (_ref5 = prev[0], __indexOf.call(CALLABLE, _ref5) >= 0)) { - if (prev[0] === '?') prev[0] = 'FUNC_EXIST'; - tag = 'CALL_START'; - } else if (value === '[' && (_ref6 = prev[0], __indexOf.call(INDEXABLE, _ref6) >= 0)) { - tag = 'INDEX_START'; - switch (prev[0]) { - case '?': - prev[0] = 'INDEX_SOAK'; - } - } - } - switch (value) { - case '(': - case '{': - case '[': - this.ends.push(INVERSES[value]); - break; - case ')': - case '}': - case ']': - this.pair(value); - } - this.token(tag, value); - return value.length; - }; - - Lexer.prototype.sanitizeHeredoc = function(doc, options) { - var attempt, herecomment, indent, match, _ref3; - indent = options.indent, herecomment = options.herecomment; - if (herecomment) { - if (HEREDOC_ILLEGAL.test(doc)) { - this.error("block comment cannot contain \"*/\", starting"); - } - if (doc.indexOf('\n') <= 0) return doc; - } else { - while (match = HEREDOC_INDENT.exec(doc)) { - attempt = match[1]; - if (indent === null || (0 < (_ref3 = attempt.length) && _ref3 < indent.length)) { - indent = attempt; - } - } - } - if (indent) doc = doc.replace(RegExp("\\n" + indent, "g"), '\n'); - if (!herecomment) doc = doc.replace(/^\n/, ''); - return doc; - }; - - Lexer.prototype.tagParameters = function() { - var i, stack, tok, tokens; - if (this.tag() !== ')') return this; - stack = []; - tokens = this.tokens; - i = tokens.length; - tokens[--i][0] = 'PARAM_END'; - while (tok = tokens[--i]) { - switch (tok[0]) { - case ')': - stack.push(tok); - break; - case '(': - case 'CALL_START': - if (stack.length) { - stack.pop(); - } else if (tok[0] === '(') { - tok[0] = 'PARAM_START'; - return this; - } else { - return this; - } - } - } - return this; - }; - - Lexer.prototype.closeIndentation = function() { - return this.outdentToken(this.indent); - }; - - Lexer.prototype.balancedString = function(str, end) { - var i, letter, match, prev, stack, _ref3; - stack = [end]; - for (i = 1, _ref3 = str.length; 1 <= _ref3 ? i < _ref3 : i > _ref3; 1 <= _ref3 ? i++ : i--) { - switch (letter = str.charAt(i)) { - case '\\': - i++; - continue; - case end: - stack.pop(); - if (!stack.length) return str.slice(0, i + 1); - end = stack[stack.length - 1]; - continue; - } - if (end === '}' && (letter === '"' || letter === "'")) { - stack.push(end = letter); - } else if (end === '}' && letter === '/' && (match = HEREGEX.exec(str.slice(i)) || REGEX.exec(str.slice(i)))) { - i += match[0].length - 1; - } else if (end === '}' && letter === '{') { - stack.push(end = '}'); - } else if (end === '"' && prev === '#' && letter === '{') { - stack.push(end = '}'); - } - prev = letter; - } - return this.error("missing " + (stack.pop()) + ", starting"); - }; - - Lexer.prototype.interpolateString = function(str, options) { - var expr, heredoc, i, inner, interpolated, len, letter, nested, pi, regex, tag, tokens, value, _len, _ref3, _ref4, _ref5; - if (options == null) options = {}; - heredoc = options.heredoc, regex = options.regex; - tokens = []; - pi = 0; - i = -1; - while (letter = str.charAt(i += 1)) { - if (letter === '\\') { - i += 1; - continue; - } - if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) { - continue; - } - if (pi < i) tokens.push(['NEOSTRING', str.slice(pi, i)]); - inner = expr.slice(1, -1); - if (inner.length) { - nested = new Lexer().tokenize(inner, { - line: this.line, - rewrite: false - }); - nested.pop(); - if (((_ref3 = nested[0]) != null ? _ref3[0] : void 0) === 'TERMINATOR') { - nested.shift(); - } - if (len = nested.length) { - if (len > 1) { - nested.unshift(['(', '(', this.line]); - nested.push([')', ')', this.line]); - } - tokens.push(['TOKENS', nested]); - } - } - i += expr.length; - pi = i + 1; - } - if ((i > pi && pi < str.length)) tokens.push(['NEOSTRING', str.slice(pi)]); - if (regex) return tokens; - if (!tokens.length) return this.token('STRING', '""'); - if (tokens[0][0] !== 'NEOSTRING') tokens.unshift(['', '']); - if (interpolated = tokens.length > 1) this.token('(', '('); - for (i = 0, _len = tokens.length; i < _len; i++) { - _ref4 = tokens[i], tag = _ref4[0], value = _ref4[1]; - if (i) this.token('+', '+'); - if (tag === 'TOKENS') { - (_ref5 = this.tokens).push.apply(_ref5, value); - } else { - this.token('STRING', this.makeString(value, '"', heredoc)); - } - } - if (interpolated) this.token(')', ')'); - return tokens; - }; - - Lexer.prototype.pair = function(tag) { - var size, wanted; - if (tag !== (wanted = last(this.ends))) { - if ('OUTDENT' !== wanted) this.error("unmatched " + tag); - this.indent -= size = last(this.indents); - this.outdentToken(size, true); - return this.pair(tag); - } - return this.ends.pop(); - }; - - Lexer.prototype.token = function(tag, value) { - return this.tokens.push([tag, value, this.line]); - }; - - Lexer.prototype.tag = function(index, tag) { - var tok; - return (tok = last(this.tokens, index)) && (tag ? tok[0] = tag : tok[0]); - }; - - Lexer.prototype.value = function(index, val) { - var tok; - return (tok = last(this.tokens, index)) && (val ? tok[1] = val : tok[1]); - }; - - Lexer.prototype.unfinished = function() { - var _ref3; - return LINE_CONTINUER.test(this.chunk) || ((_ref3 = this.tag()) === '\\' || _ref3 === '.' || _ref3 === '?.' || _ref3 === 'UNARY' || _ref3 === 'MATH' || _ref3 === '+' || _ref3 === '-' || _ref3 === 'SHIFT' || _ref3 === 'RELATION' || _ref3 === 'COMPARE' || _ref3 === 'LOGIC' || _ref3 === 'COMPOUND_ASSIGN' || _ref3 === 'THROW' || _ref3 === 'EXTENDS'); - }; - - Lexer.prototype.escapeLines = function(str, heredoc) { - return str.replace(MULTILINER, heredoc ? '\\n' : ''); - }; - - Lexer.prototype.makeString = function(body, quote, heredoc) { - if (!body) return quote + quote; - body = body.replace(/\\([\s\S])/g, function(match, contents) { - if (contents === '\n' || contents === quote) { - return contents; - } else { - return match; - } - }); - body = body.replace(RegExp("" + quote, "g"), '\\$&'); - return quote + this.escapeLines(body, heredoc) + quote; - }; - - Lexer.prototype.error = function(message) { - throw SyntaxError("" + message + " on line " + (this.line + 1)); - }; - - return Lexer; - - })(); - - JS_KEYWORDS = ['true', 'false', 'null', 'this', 'new', 'delete', 'typeof', 'in', 'instanceof', 'return', 'throw', 'break', 'continue', 'debugger', 'if', 'else', 'switch', 'for', 'while', 'do', 'try', 'catch', 'finally', 'class', 'extends', 'super']; - - COFFEE_KEYWORDS = ['undefined', 'then', 'unless', 'until', 'loop', 'of', 'by', 'when']; - - COFFEE_ALIAS_MAP = { - and: '&&', - or: '||', - is: '==', - isnt: '!=', - not: '!', - yes: 'true', - no: 'false', - on: 'true', - off: 'false' - }; - - COFFEE_ALIASES = (function() { - var _results; - _results = []; - for (key in COFFEE_ALIAS_MAP) { - _results.push(key); - } - return _results; - })(); - - COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(COFFEE_ALIASES); - - RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', '__hasProp', '__extends', '__slice', '__bind', '__indexOf']; - - JS_FORBIDDEN = JS_KEYWORDS.concat(RESERVED); - - exports.RESERVED = RESERVED.concat(JS_KEYWORDS).concat(COFFEE_KEYWORDS); - - IDENTIFIER = /^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/; - - NUMBER = /^0x[\da-f]+|^0b[01]+|^\d*\.?\d+(?:e[+-]?\d+)?/i; - - HEREDOC = /^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/; - - OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?\.|\.{2,3})/; - - WHITESPACE = /^[^\n\S]+/; - - COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)?$)|^(?:\s*#(?!##[^#]).*)+/; - - CODE = /^[-=]>/; - - MULTI_DENT = /^(?:\n[^\n\S]*)+/; - - SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/; - - JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/; - - REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/; - - HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/; - - HEREGEX_OMIT = /\s+(?:#.*)?/g; - - MULTILINER = /\n/g; - - HEREDOC_INDENT = /\n+([^\n\S]*)/g; - - HEREDOC_ILLEGAL = /\*\//; - - LINE_CONTINUER = /^\s*(?:,|\??\.(?![.\d])|::)/; - - TRAILING_SPACES = /\s+$/; - - COMPOUND_ASSIGN = ['-=', '+=', '/=', '*=', '%=', '||=', '&&=', '?=', '<<=', '>>=', '>>>=', '&=', '^=', '|=']; - - UNARY = ['!', '~', 'NEW', 'TYPEOF', 'DELETE', 'DO']; - - LOGIC = ['&&', '||', '&', '|', '^']; - - SHIFT = ['<<', '>>', '>>>']; - - COMPARE = ['==', '!=', '<', '>', '<=', '>=']; - - MATH = ['*', '/', '%']; - - RELATION = ['IN', 'OF', 'INSTANCEOF']; - - BOOL = ['TRUE', 'FALSE', 'NULL', 'UNDEFINED']; - - NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', '++', '--', ']']; - - NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING'); - - CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER']; - - INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL'); - - LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR']; - -}).call(this); - -};require['./parser'] = new function() { - var exports = this; - /* Jison generated parser */ -var parser = (function(){ -var parser = {trace: function trace() { }, -yy: {}, -symbols_: {"error":2,"Root":3,"Body":4,"Block":5,"TERMINATOR":6,"Line":7,"Expression":8,"Statement":9,"Return":10,"Comment":11,"STATEMENT":12,"Value":13,"Invocation":14,"Code":15,"Operation":16,"Assign":17,"If":18,"Try":19,"While":20,"For":21,"Switch":22,"Class":23,"Throw":24,"INDENT":25,"OUTDENT":26,"Identifier":27,"IDENTIFIER":28,"AlphaNumeric":29,"NUMBER":30,"STRING":31,"Literal":32,"JS":33,"REGEX":34,"DEBUGGER":35,"BOOL":36,"Assignable":37,"=":38,"AssignObj":39,"ObjAssignable":40,":":41,"ThisProperty":42,"RETURN":43,"HERECOMMENT":44,"PARAM_START":45,"ParamList":46,"PARAM_END":47,"FuncGlyph":48,"->":49,"=>":50,"OptComma":51,",":52,"Param":53,"ParamVar":54,"...":55,"Array":56,"Object":57,"Splat":58,"SimpleAssignable":59,"Accessor":60,"Parenthetical":61,"Range":62,"This":63,".":64,"?.":65,"::":66,"Index":67,"INDEX_START":68,"IndexValue":69,"INDEX_END":70,"INDEX_SOAK":71,"Slice":72,"{":73,"AssignList":74,"}":75,"CLASS":76,"EXTENDS":77,"OptFuncExist":78,"Arguments":79,"SUPER":80,"FUNC_EXIST":81,"CALL_START":82,"CALL_END":83,"ArgList":84,"THIS":85,"@":86,"[":87,"]":88,"RangeDots":89,"..":90,"Arg":91,"SimpleArgs":92,"TRY":93,"Catch":94,"FINALLY":95,"CATCH":96,"THROW":97,"(":98,")":99,"WhileSource":100,"WHILE":101,"WHEN":102,"UNTIL":103,"Loop":104,"LOOP":105,"ForBody":106,"FOR":107,"ForStart":108,"ForSource":109,"ForVariables":110,"OWN":111,"ForValue":112,"FORIN":113,"FOROF":114,"BY":115,"SWITCH":116,"Whens":117,"ELSE":118,"When":119,"LEADING_WHEN":120,"IfBlock":121,"IF":122,"POST_IF":123,"UNARY":124,"-":125,"+":126,"--":127,"++":128,"?":129,"MATH":130,"SHIFT":131,"COMPARE":132,"LOGIC":133,"RELATION":134,"COMPOUND_ASSIGN":135,"$accept":0,"$end":1}, -terminals_: {2:"error",6:"TERMINATOR",12:"STATEMENT",25:"INDENT",26:"OUTDENT",28:"IDENTIFIER",30:"NUMBER",31:"STRING",33:"JS",34:"REGEX",35:"DEBUGGER",36:"BOOL",38:"=",41:":",43:"RETURN",44:"HERECOMMENT",45:"PARAM_START",47:"PARAM_END",49:"->",50:"=>",52:",",55:"...",64:".",65:"?.",66:"::",68:"INDEX_START",70:"INDEX_END",71:"INDEX_SOAK",73:"{",75:"}",76:"CLASS",77:"EXTENDS",80:"SUPER",81:"FUNC_EXIST",82:"CALL_START",83:"CALL_END",85:"THIS",86:"@",87:"[",88:"]",90:"..",93:"TRY",95:"FINALLY",96:"CATCH",97:"THROW",98:"(",99:")",101:"WHILE",102:"WHEN",103:"UNTIL",105:"LOOP",107:"FOR",111:"OWN",113:"FORIN",114:"FOROF",115:"BY",116:"SWITCH",118:"ELSE",120:"LEADING_WHEN",122:"IF",123:"POST_IF",124:"UNARY",125:"-",126:"+",127:"--",128:"++",129:"?",130:"MATH",131:"SHIFT",132:"COMPARE",133:"LOGIC",134:"RELATION",135:"COMPOUND_ASSIGN"}, -productions_: [0,[3,0],[3,1],[3,2],[4,1],[4,3],[4,2],[7,1],[7,1],[9,1],[9,1],[9,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[5,2],[5,3],[27,1],[29,1],[29,1],[32,1],[32,1],[32,1],[32,1],[32,1],[17,3],[17,4],[17,5],[39,1],[39,3],[39,5],[39,1],[40,1],[40,1],[40,1],[10,2],[10,1],[11,1],[15,5],[15,2],[48,1],[48,1],[51,0],[51,1],[46,0],[46,1],[46,3],[53,1],[53,2],[53,3],[54,1],[54,1],[54,1],[54,1],[58,2],[59,1],[59,2],[59,2],[59,1],[37,1],[37,1],[37,1],[13,1],[13,1],[13,1],[13,1],[13,1],[60,2],[60,2],[60,2],[60,1],[60,1],[67,3],[67,2],[69,1],[69,1],[57,4],[74,0],[74,1],[74,3],[74,4],[74,6],[23,1],[23,2],[23,3],[23,4],[23,2],[23,3],[23,4],[23,5],[14,3],[14,3],[14,1],[14,2],[78,0],[78,1],[79,2],[79,4],[63,1],[63,1],[42,2],[56,2],[56,4],[89,1],[89,1],[62,5],[72,3],[72,2],[72,2],[84,1],[84,3],[84,4],[84,4],[84,6],[91,1],[91,1],[92,1],[92,3],[19,2],[19,3],[19,4],[19,5],[94,3],[24,2],[61,3],[61,5],[100,2],[100,4],[100,2],[100,4],[20,2],[20,2],[20,2],[20,1],[104,2],[104,2],[21,2],[21,2],[21,2],[106,2],[106,2],[108,2],[108,3],[112,1],[112,1],[112,1],[110,1],[110,3],[109,2],[109,2],[109,4],[109,4],[109,4],[109,6],[109,6],[22,5],[22,7],[22,4],[22,6],[117,1],[117,2],[119,3],[119,4],[121,3],[121,5],[18,1],[18,3],[18,3],[18,3],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,5],[16,3]], -performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { - -var $0 = $$.length - 1; -switch (yystate) { -case 1:return this.$ = new yy.Block; -break; -case 2:return this.$ = $$[$0]; -break; -case 3:return this.$ = $$[$0-1]; -break; -case 4:this.$ = yy.Block.wrap([$$[$0]]); -break; -case 5:this.$ = $$[$0-2].push($$[$0]); -break; -case 6:this.$ = $$[$0-1]; -break; -case 7:this.$ = $$[$0]; -break; -case 8:this.$ = $$[$0]; -break; -case 9:this.$ = $$[$0]; -break; -case 10:this.$ = $$[$0]; -break; -case 11:this.$ = new yy.Literal($$[$0]); -break; -case 12:this.$ = $$[$0]; -break; -case 13:this.$ = $$[$0]; -break; -case 14:this.$ = $$[$0]; -break; -case 15:this.$ = $$[$0]; -break; -case 16:this.$ = $$[$0]; -break; -case 17:this.$ = $$[$0]; -break; -case 18:this.$ = $$[$0]; -break; -case 19:this.$ = $$[$0]; -break; -case 20:this.$ = $$[$0]; -break; -case 21:this.$ = $$[$0]; -break; -case 22:this.$ = $$[$0]; -break; -case 23:this.$ = $$[$0]; -break; -case 24:this.$ = new yy.Block; -break; -case 25:this.$ = $$[$0-1]; -break; -case 26:this.$ = new yy.Literal($$[$0]); -break; -case 27:this.$ = new yy.Literal($$[$0]); -break; -case 28:this.$ = new yy.Literal($$[$0]); -break; -case 29:this.$ = $$[$0]; -break; -case 30:this.$ = new yy.Literal($$[$0]); -break; -case 31:this.$ = new yy.Literal($$[$0]); -break; -case 32:this.$ = new yy.Literal($$[$0]); -break; -case 33:this.$ = (function () { - var val; - val = new yy.Literal($$[$0]); - if ($$[$0] === 'undefined') val.isUndefined = true; - return val; - }()); -break; -case 34:this.$ = new yy.Assign($$[$0-2], $$[$0]); -break; -case 35:this.$ = new yy.Assign($$[$0-3], $$[$0]); -break; -case 36:this.$ = new yy.Assign($$[$0-4], $$[$0-1]); -break; -case 37:this.$ = new yy.Value($$[$0]); -break; -case 38:this.$ = new yy.Assign(new yy.Value($$[$0-2]), $$[$0], 'object'); -break; -case 39:this.$ = new yy.Assign(new yy.Value($$[$0-4]), $$[$0-1], 'object'); -break; -case 40:this.$ = $$[$0]; -break; -case 41:this.$ = $$[$0]; -break; -case 42:this.$ = $$[$0]; -break; -case 43:this.$ = $$[$0]; -break; -case 44:this.$ = new yy.Return($$[$0]); -break; -case 45:this.$ = new yy.Return; -break; -case 46:this.$ = new yy.Comment($$[$0]); -break; -case 47:this.$ = new yy.Code($$[$0-3], $$[$0], $$[$0-1]); -break; -case 48:this.$ = new yy.Code([], $$[$0], $$[$0-1]); -break; -case 49:this.$ = 'func'; -break; -case 50:this.$ = 'boundfunc'; -break; -case 51:this.$ = $$[$0]; -break; -case 52:this.$ = $$[$0]; -break; -case 53:this.$ = []; -break; -case 54:this.$ = [$$[$0]]; -break; -case 55:this.$ = $$[$0-2].concat($$[$0]); -break; -case 56:this.$ = new yy.Param($$[$0]); -break; -case 57:this.$ = new yy.Param($$[$0-1], null, true); -break; -case 58:this.$ = new yy.Param($$[$0-2], $$[$0]); -break; -case 59:this.$ = $$[$0]; -break; -case 60:this.$ = $$[$0]; -break; -case 61:this.$ = $$[$0]; -break; -case 62:this.$ = $$[$0]; -break; -case 63:this.$ = new yy.Splat($$[$0-1]); -break; -case 64:this.$ = new yy.Value($$[$0]); -break; -case 65:this.$ = $$[$0-1].add($$[$0]); -break; -case 66:this.$ = new yy.Value($$[$0-1], [].concat($$[$0])); -break; -case 67:this.$ = $$[$0]; -break; -case 68:this.$ = $$[$0]; -break; -case 69:this.$ = new yy.Value($$[$0]); -break; -case 70:this.$ = new yy.Value($$[$0]); -break; -case 71:this.$ = $$[$0]; -break; -case 72:this.$ = new yy.Value($$[$0]); -break; -case 73:this.$ = new yy.Value($$[$0]); -break; -case 74:this.$ = new yy.Value($$[$0]); -break; -case 75:this.$ = $$[$0]; -break; -case 76:this.$ = new yy.Access($$[$0]); -break; -case 77:this.$ = new yy.Access($$[$0], 'soak'); -break; -case 78:this.$ = [new yy.Access(new yy.Literal('prototype')), new yy.Access($$[$0])]; -break; -case 79:this.$ = new yy.Access(new yy.Literal('prototype')); -break; -case 80:this.$ = $$[$0]; -break; -case 81:this.$ = $$[$0-1]; -break; -case 82:this.$ = yy.extend($$[$0], { - soak: true - }); -break; -case 83:this.$ = new yy.Index($$[$0]); -break; -case 84:this.$ = new yy.Slice($$[$0]); -break; -case 85:this.$ = new yy.Obj($$[$0-2], $$[$0-3].generated); -break; -case 86:this.$ = []; -break; -case 87:this.$ = [$$[$0]]; -break; -case 88:this.$ = $$[$0-2].concat($$[$0]); -break; -case 89:this.$ = $$[$0-3].concat($$[$0]); -break; -case 90:this.$ = $$[$0-5].concat($$[$0-2]); -break; -case 91:this.$ = new yy.Class; -break; -case 92:this.$ = new yy.Class(null, null, $$[$0]); -break; -case 93:this.$ = new yy.Class(null, $$[$0]); -break; -case 94:this.$ = new yy.Class(null, $$[$0-1], $$[$0]); -break; -case 95:this.$ = new yy.Class($$[$0]); -break; -case 96:this.$ = new yy.Class($$[$0-1], null, $$[$0]); -break; -case 97:this.$ = new yy.Class($$[$0-2], $$[$0]); -break; -case 98:this.$ = new yy.Class($$[$0-3], $$[$0-1], $$[$0]); -break; -case 99:this.$ = new yy.Call($$[$0-2], $$[$0], $$[$0-1]); -break; -case 100:this.$ = new yy.Call($$[$0-2], $$[$0], $$[$0-1]); -break; -case 101:this.$ = new yy.Call('super', [new yy.Splat(new yy.Literal('arguments'))]); -break; -case 102:this.$ = new yy.Call('super', $$[$0]); -break; -case 103:this.$ = false; -break; -case 104:this.$ = true; -break; -case 105:this.$ = []; -break; -case 106:this.$ = $$[$0-2]; -break; -case 107:this.$ = new yy.Value(new yy.Literal('this')); -break; -case 108:this.$ = new yy.Value(new yy.Literal('this')); -break; -case 109:this.$ = new yy.Value(new yy.Literal('this'), [new yy.Access($$[$0])], 'this'); -break; -case 110:this.$ = new yy.Arr([]); -break; -case 111:this.$ = new yy.Arr($$[$0-2]); -break; -case 112:this.$ = 'inclusive'; -break; -case 113:this.$ = 'exclusive'; -break; -case 114:this.$ = new yy.Range($$[$0-3], $$[$0-1], $$[$0-2]); -break; -case 115:this.$ = new yy.Range($$[$0-2], $$[$0], $$[$0-1]); -break; -case 116:this.$ = new yy.Range($$[$0-1], null, $$[$0]); -break; -case 117:this.$ = new yy.Range(null, $$[$0], $$[$0-1]); -break; -case 118:this.$ = [$$[$0]]; -break; -case 119:this.$ = $$[$0-2].concat($$[$0]); -break; -case 120:this.$ = $$[$0-3].concat($$[$0]); -break; -case 121:this.$ = $$[$0-2]; -break; -case 122:this.$ = $$[$0-5].concat($$[$0-2]); -break; -case 123:this.$ = $$[$0]; -break; -case 124:this.$ = $$[$0]; -break; -case 125:this.$ = $$[$0]; -break; -case 126:this.$ = [].concat($$[$0-2], $$[$0]); -break; -case 127:this.$ = new yy.Try($$[$0]); -break; -case 128:this.$ = new yy.Try($$[$0-1], $$[$0][0], $$[$0][1]); -break; -case 129:this.$ = new yy.Try($$[$0-2], null, null, $$[$0]); -break; -case 130:this.$ = new yy.Try($$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0]); -break; -case 131:this.$ = [$$[$0-1], $$[$0]]; -break; -case 132:this.$ = new yy.Throw($$[$0]); -break; -case 133:this.$ = new yy.Parens($$[$0-1]); -break; -case 134:this.$ = new yy.Parens($$[$0-2]); -break; -case 135:this.$ = new yy.While($$[$0]); -break; -case 136:this.$ = new yy.While($$[$0-2], { - guard: $$[$0] - }); -break; -case 137:this.$ = new yy.While($$[$0], { - invert: true - }); -break; -case 138:this.$ = new yy.While($$[$0-2], { - invert: true, - guard: $$[$0] - }); -break; -case 139:this.$ = $$[$0-1].addBody($$[$0]); -break; -case 140:this.$ = $$[$0].addBody(yy.Block.wrap([$$[$0-1]])); -break; -case 141:this.$ = $$[$0].addBody(yy.Block.wrap([$$[$0-1]])); -break; -case 142:this.$ = $$[$0]; -break; -case 143:this.$ = new yy.While(new yy.Literal('true')).addBody($$[$0]); -break; -case 144:this.$ = new yy.While(new yy.Literal('true')).addBody(yy.Block.wrap([$$[$0]])); -break; -case 145:this.$ = new yy.For($$[$0-1], $$[$0]); -break; -case 146:this.$ = new yy.For($$[$0-1], $$[$0]); -break; -case 147:this.$ = new yy.For($$[$0], $$[$0-1]); -break; -case 148:this.$ = { - source: new yy.Value($$[$0]) - }; -break; -case 149:this.$ = (function () { - $$[$0].own = $$[$0-1].own; - $$[$0].name = $$[$0-1][0]; - $$[$0].index = $$[$0-1][1]; - return $$[$0]; - }()); -break; -case 150:this.$ = $$[$0]; -break; -case 151:this.$ = (function () { - $$[$0].own = true; - return $$[$0]; - }()); -break; -case 152:this.$ = $$[$0]; -break; -case 153:this.$ = new yy.Value($$[$0]); -break; -case 154:this.$ = new yy.Value($$[$0]); -break; -case 155:this.$ = [$$[$0]]; -break; -case 156:this.$ = [$$[$0-2], $$[$0]]; -break; -case 157:this.$ = { - source: $$[$0] - }; -break; -case 158:this.$ = { - source: $$[$0], - object: true - }; -break; -case 159:this.$ = { - source: $$[$0-2], - guard: $$[$0] - }; -break; -case 160:this.$ = { - source: $$[$0-2], - guard: $$[$0], - object: true - }; -break; -case 161:this.$ = { - source: $$[$0-2], - step: $$[$0] - }; -break; -case 162:this.$ = { - source: $$[$0-4], - guard: $$[$0-2], - step: $$[$0] - }; -break; -case 163:this.$ = { - source: $$[$0-4], - step: $$[$0-2], - guard: $$[$0] - }; -break; -case 164:this.$ = new yy.Switch($$[$0-3], $$[$0-1]); -break; -case 165:this.$ = new yy.Switch($$[$0-5], $$[$0-3], $$[$0-1]); -break; -case 166:this.$ = new yy.Switch(null, $$[$0-1]); -break; -case 167:this.$ = new yy.Switch(null, $$[$0-3], $$[$0-1]); -break; -case 168:this.$ = $$[$0]; -break; -case 169:this.$ = $$[$0-1].concat($$[$0]); -break; -case 170:this.$ = [[$$[$0-1], $$[$0]]]; -break; -case 171:this.$ = [[$$[$0-2], $$[$0-1]]]; -break; -case 172:this.$ = new yy.If($$[$0-1], $$[$0], { - type: $$[$0-2] - }); -break; -case 173:this.$ = $$[$0-4].addElse(new yy.If($$[$0-1], $$[$0], { - type: $$[$0-2] - })); -break; -case 174:this.$ = $$[$0]; -break; -case 175:this.$ = $$[$0-2].addElse($$[$0]); -break; -case 176:this.$ = new yy.If($$[$0], yy.Block.wrap([$$[$0-2]]), { - type: $$[$0-1], - statement: true - }); -break; -case 177:this.$ = new yy.If($$[$0], yy.Block.wrap([$$[$0-2]]), { - type: $$[$0-1], - statement: true - }); -break; -case 178:this.$ = new yy.Op($$[$0-1], $$[$0]); -break; -case 179:this.$ = new yy.Op('-', $$[$0]); -break; -case 180:this.$ = new yy.Op('+', $$[$0]); -break; -case 181:this.$ = new yy.Op('--', $$[$0]); -break; -case 182:this.$ = new yy.Op('++', $$[$0]); -break; -case 183:this.$ = new yy.Op('--', $$[$0-1], null, true); -break; -case 184:this.$ = new yy.Op('++', $$[$0-1], null, true); -break; -case 185:this.$ = new yy.Existence($$[$0-1]); -break; -case 186:this.$ = new yy.Op('+', $$[$0-2], $$[$0]); -break; -case 187:this.$ = new yy.Op('-', $$[$0-2], $$[$0]); -break; -case 188:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); -break; -case 189:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); -break; -case 190:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); -break; -case 191:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); -break; -case 192:this.$ = (function () { - if ($$[$0-1].charAt(0) === '!') { - return new yy.Op($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert(); - } else { - return new yy.Op($$[$0-1], $$[$0-2], $$[$0]); - } - }()); -break; -case 193:this.$ = new yy.Assign($$[$0-2], $$[$0], $$[$0-1]); -break; -case 194:this.$ = new yy.Assign($$[$0-4], $$[$0-1], $$[$0-3]); -break; -case 195:this.$ = new yy.Extends($$[$0-2], $$[$0]); -break; -} -}, -table: [{1:[2,1],3:1,4:2,5:3,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[3]},{1:[2,2],6:[1,72]},{6:[1,73]},{1:[2,4],6:[2,4],26:[2,4],99:[2,4]},{4:75,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[1,74],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,7],6:[2,7],26:[2,7],99:[2,7],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,8],6:[2,8],26:[2,8],99:[2,8],100:88,101:[1,63],103:[1,64],106:89,107:[1,66],108:67,123:[1,87]},{1:[2,12],6:[2,12],25:[2,12],26:[2,12],47:[2,12],52:[2,12],55:[2,12],60:91,64:[1,93],65:[1,94],66:[1,95],67:96,68:[1,97],70:[2,12],71:[1,98],75:[2,12],78:90,81:[1,92],82:[2,103],83:[2,12],88:[2,12],90:[2,12],99:[2,12],101:[2,12],102:[2,12],103:[2,12],107:[2,12],115:[2,12],123:[2,12],125:[2,12],126:[2,12],129:[2,12],130:[2,12],131:[2,12],132:[2,12],133:[2,12],134:[2,12]},{1:[2,13],6:[2,13],25:[2,13],26:[2,13],47:[2,13],52:[2,13],55:[2,13],60:100,64:[1,93],65:[1,94],66:[1,95],67:96,68:[1,97],70:[2,13],71:[1,98],75:[2,13],78:99,81:[1,92],82:[2,103],83:[2,13],88:[2,13],90:[2,13],99:[2,13],101:[2,13],102:[2,13],103:[2,13],107:[2,13],115:[2,13],123:[2,13],125:[2,13],126:[2,13],129:[2,13],130:[2,13],131:[2,13],132:[2,13],133:[2,13],134:[2,13]},{1:[2,14],6:[2,14],25:[2,14],26:[2,14],47:[2,14],52:[2,14],55:[2,14],70:[2,14],75:[2,14],83:[2,14],88:[2,14],90:[2,14],99:[2,14],101:[2,14],102:[2,14],103:[2,14],107:[2,14],115:[2,14],123:[2,14],125:[2,14],126:[2,14],129:[2,14],130:[2,14],131:[2,14],132:[2,14],133:[2,14],134:[2,14]},{1:[2,15],6:[2,15],25:[2,15],26:[2,15],47:[2,15],52:[2,15],55:[2,15],70:[2,15],75:[2,15],83:[2,15],88:[2,15],90:[2,15],99:[2,15],101:[2,15],102:[2,15],103:[2,15],107:[2,15],115:[2,15],123:[2,15],125:[2,15],126:[2,15],129:[2,15],130:[2,15],131:[2,15],132:[2,15],133:[2,15],134:[2,15]},{1:[2,16],6:[2,16],25:[2,16],26:[2,16],47:[2,16],52:[2,16],55:[2,16],70:[2,16],75:[2,16],83:[2,16],88:[2,16],90:[2,16],99:[2,16],101:[2,16],102:[2,16],103:[2,16],107:[2,16],115:[2,16],123:[2,16],125:[2,16],126:[2,16],129:[2,16],130:[2,16],131:[2,16],132:[2,16],133:[2,16],134:[2,16]},{1:[2,17],6:[2,17],25:[2,17],26:[2,17],47:[2,17],52:[2,17],55:[2,17],70:[2,17],75:[2,17],83:[2,17],88:[2,17],90:[2,17],99:[2,17],101:[2,17],102:[2,17],103:[2,17],107:[2,17],115:[2,17],123:[2,17],125:[2,17],126:[2,17],129:[2,17],130:[2,17],131:[2,17],132:[2,17],133:[2,17],134:[2,17]},{1:[2,18],6:[2,18],25:[2,18],26:[2,18],47:[2,18],52:[2,18],55:[2,18],70:[2,18],75:[2,18],83:[2,18],88:[2,18],90:[2,18],99:[2,18],101:[2,18],102:[2,18],103:[2,18],107:[2,18],115:[2,18],123:[2,18],125:[2,18],126:[2,18],129:[2,18],130:[2,18],131:[2,18],132:[2,18],133:[2,18],134:[2,18]},{1:[2,19],6:[2,19],25:[2,19],26:[2,19],47:[2,19],52:[2,19],55:[2,19],70:[2,19],75:[2,19],83:[2,19],88:[2,19],90:[2,19],99:[2,19],101:[2,19],102:[2,19],103:[2,19],107:[2,19],115:[2,19],123:[2,19],125:[2,19],126:[2,19],129:[2,19],130:[2,19],131:[2,19],132:[2,19],133:[2,19],134:[2,19]},{1:[2,20],6:[2,20],25:[2,20],26:[2,20],47:[2,20],52:[2,20],55:[2,20],70:[2,20],75:[2,20],83:[2,20],88:[2,20],90:[2,20],99:[2,20],101:[2,20],102:[2,20],103:[2,20],107:[2,20],115:[2,20],123:[2,20],125:[2,20],126:[2,20],129:[2,20],130:[2,20],131:[2,20],132:[2,20],133:[2,20],134:[2,20]},{1:[2,21],6:[2,21],25:[2,21],26:[2,21],47:[2,21],52:[2,21],55:[2,21],70:[2,21],75:[2,21],83:[2,21],88:[2,21],90:[2,21],99:[2,21],101:[2,21],102:[2,21],103:[2,21],107:[2,21],115:[2,21],123:[2,21],125:[2,21],126:[2,21],129:[2,21],130:[2,21],131:[2,21],132:[2,21],133:[2,21],134:[2,21]},{1:[2,22],6:[2,22],25:[2,22],26:[2,22],47:[2,22],52:[2,22],55:[2,22],70:[2,22],75:[2,22],83:[2,22],88:[2,22],90:[2,22],99:[2,22],101:[2,22],102:[2,22],103:[2,22],107:[2,22],115:[2,22],123:[2,22],125:[2,22],126:[2,22],129:[2,22],130:[2,22],131:[2,22],132:[2,22],133:[2,22],134:[2,22]},{1:[2,23],6:[2,23],25:[2,23],26:[2,23],47:[2,23],52:[2,23],55:[2,23],70:[2,23],75:[2,23],83:[2,23],88:[2,23],90:[2,23],99:[2,23],101:[2,23],102:[2,23],103:[2,23],107:[2,23],115:[2,23],123:[2,23],125:[2,23],126:[2,23],129:[2,23],130:[2,23],131:[2,23],132:[2,23],133:[2,23],134:[2,23]},{1:[2,9],6:[2,9],26:[2,9],99:[2,9],101:[2,9],103:[2,9],107:[2,9],123:[2,9]},{1:[2,10],6:[2,10],26:[2,10],99:[2,10],101:[2,10],103:[2,10],107:[2,10],123:[2,10]},{1:[2,11],6:[2,11],26:[2,11],99:[2,11],101:[2,11],103:[2,11],107:[2,11],123:[2,11]},{1:[2,71],6:[2,71],25:[2,71],26:[2,71],38:[1,101],47:[2,71],52:[2,71],55:[2,71],64:[2,71],65:[2,71],66:[2,71],68:[2,71],70:[2,71],71:[2,71],75:[2,71],81:[2,71],82:[2,71],83:[2,71],88:[2,71],90:[2,71],99:[2,71],101:[2,71],102:[2,71],103:[2,71],107:[2,71],115:[2,71],123:[2,71],125:[2,71],126:[2,71],129:[2,71],130:[2,71],131:[2,71],132:[2,71],133:[2,71],134:[2,71]},{1:[2,72],6:[2,72],25:[2,72],26:[2,72],47:[2,72],52:[2,72],55:[2,72],64:[2,72],65:[2,72],66:[2,72],68:[2,72],70:[2,72],71:[2,72],75:[2,72],81:[2,72],82:[2,72],83:[2,72],88:[2,72],90:[2,72],99:[2,72],101:[2,72],102:[2,72],103:[2,72],107:[2,72],115:[2,72],123:[2,72],125:[2,72],126:[2,72],129:[2,72],130:[2,72],131:[2,72],132:[2,72],133:[2,72],134:[2,72]},{1:[2,73],6:[2,73],25:[2,73],26:[2,73],47:[2,73],52:[2,73],55:[2,73],64:[2,73],65:[2,73],66:[2,73],68:[2,73],70:[2,73],71:[2,73],75:[2,73],81:[2,73],82:[2,73],83:[2,73],88:[2,73],90:[2,73],99:[2,73],101:[2,73],102:[2,73],103:[2,73],107:[2,73],115:[2,73],123:[2,73],125:[2,73],126:[2,73],129:[2,73],130:[2,73],131:[2,73],132:[2,73],133:[2,73],134:[2,73]},{1:[2,74],6:[2,74],25:[2,74],26:[2,74],47:[2,74],52:[2,74],55:[2,74],64:[2,74],65:[2,74],66:[2,74],68:[2,74],70:[2,74],71:[2,74],75:[2,74],81:[2,74],82:[2,74],83:[2,74],88:[2,74],90:[2,74],99:[2,74],101:[2,74],102:[2,74],103:[2,74],107:[2,74],115:[2,74],123:[2,74],125:[2,74],126:[2,74],129:[2,74],130:[2,74],131:[2,74],132:[2,74],133:[2,74],134:[2,74]},{1:[2,75],6:[2,75],25:[2,75],26:[2,75],47:[2,75],52:[2,75],55:[2,75],64:[2,75],65:[2,75],66:[2,75],68:[2,75],70:[2,75],71:[2,75],75:[2,75],81:[2,75],82:[2,75],83:[2,75],88:[2,75],90:[2,75],99:[2,75],101:[2,75],102:[2,75],103:[2,75],107:[2,75],115:[2,75],123:[2,75],125:[2,75],126:[2,75],129:[2,75],130:[2,75],131:[2,75],132:[2,75],133:[2,75],134:[2,75]},{1:[2,101],6:[2,101],25:[2,101],26:[2,101],47:[2,101],52:[2,101],55:[2,101],64:[2,101],65:[2,101],66:[2,101],68:[2,101],70:[2,101],71:[2,101],75:[2,101],79:102,81:[2,101],82:[1,103],83:[2,101],88:[2,101],90:[2,101],99:[2,101],101:[2,101],102:[2,101],103:[2,101],107:[2,101],115:[2,101],123:[2,101],125:[2,101],126:[2,101],129:[2,101],130:[2,101],131:[2,101],132:[2,101],133:[2,101],134:[2,101]},{27:107,28:[1,71],42:108,46:104,47:[2,53],52:[2,53],53:105,54:106,56:109,57:110,73:[1,68],86:[1,111],87:[1,112]},{5:113,25:[1,5]},{8:114,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:116,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:117,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{13:119,14:120,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:121,42:61,56:47,57:48,59:118,61:25,62:26,63:27,73:[1,68],80:[1,28],85:[1,56],86:[1,57],87:[1,55],98:[1,54]},{13:119,14:120,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:121,42:61,56:47,57:48,59:122,61:25,62:26,63:27,73:[1,68],80:[1,28],85:[1,56],86:[1,57],87:[1,55],98:[1,54]},{1:[2,68],6:[2,68],25:[2,68],26:[2,68],38:[2,68],47:[2,68],52:[2,68],55:[2,68],64:[2,68],65:[2,68],66:[2,68],68:[2,68],70:[2,68],71:[2,68],75:[2,68],77:[1,126],81:[2,68],82:[2,68],83:[2,68],88:[2,68],90:[2,68],99:[2,68],101:[2,68],102:[2,68],103:[2,68],107:[2,68],115:[2,68],123:[2,68],125:[2,68],126:[2,68],127:[1,123],128:[1,124],129:[2,68],130:[2,68],131:[2,68],132:[2,68],133:[2,68],134:[2,68],135:[1,125]},{1:[2,174],6:[2,174],25:[2,174],26:[2,174],47:[2,174],52:[2,174],55:[2,174],70:[2,174],75:[2,174],83:[2,174],88:[2,174],90:[2,174],99:[2,174],101:[2,174],102:[2,174],103:[2,174],107:[2,174],115:[2,174],118:[1,127],123:[2,174],125:[2,174],126:[2,174],129:[2,174],130:[2,174],131:[2,174],132:[2,174],133:[2,174],134:[2,174]},{5:128,25:[1,5]},{5:129,25:[1,5]},{1:[2,142],6:[2,142],25:[2,142],26:[2,142],47:[2,142],52:[2,142],55:[2,142],70:[2,142],75:[2,142],83:[2,142],88:[2,142],90:[2,142],99:[2,142],101:[2,142],102:[2,142],103:[2,142],107:[2,142],115:[2,142],123:[2,142],125:[2,142],126:[2,142],129:[2,142],130:[2,142],131:[2,142],132:[2,142],133:[2,142],134:[2,142]},{5:130,25:[1,5]},{8:131,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,132],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,91],5:133,6:[2,91],13:119,14:120,25:[1,5],26:[2,91],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:121,42:61,47:[2,91],52:[2,91],55:[2,91],56:47,57:48,59:135,61:25,62:26,63:27,70:[2,91],73:[1,68],75:[2,91],77:[1,134],80:[1,28],83:[2,91],85:[1,56],86:[1,57],87:[1,55],88:[2,91],90:[2,91],98:[1,54],99:[2,91],101:[2,91],102:[2,91],103:[2,91],107:[2,91],115:[2,91],123:[2,91],125:[2,91],126:[2,91],129:[2,91],130:[2,91],131:[2,91],132:[2,91],133:[2,91],134:[2,91]},{8:136,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,45],6:[2,45],8:137,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,45],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],99:[2,45],100:39,101:[2,45],103:[2,45],104:40,105:[1,65],106:41,107:[2,45],108:67,116:[1,42],121:37,122:[1,62],123:[2,45],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,46],6:[2,46],25:[2,46],26:[2,46],52:[2,46],75:[2,46],99:[2,46],101:[2,46],103:[2,46],107:[2,46],123:[2,46]},{1:[2,69],6:[2,69],25:[2,69],26:[2,69],38:[2,69],47:[2,69],52:[2,69],55:[2,69],64:[2,69],65:[2,69],66:[2,69],68:[2,69],70:[2,69],71:[2,69],75:[2,69],81:[2,69],82:[2,69],83:[2,69],88:[2,69],90:[2,69],99:[2,69],101:[2,69],102:[2,69],103:[2,69],107:[2,69],115:[2,69],123:[2,69],125:[2,69],126:[2,69],129:[2,69],130:[2,69],131:[2,69],132:[2,69],133:[2,69],134:[2,69]},{1:[2,70],6:[2,70],25:[2,70],26:[2,70],38:[2,70],47:[2,70],52:[2,70],55:[2,70],64:[2,70],65:[2,70],66:[2,70],68:[2,70],70:[2,70],71:[2,70],75:[2,70],81:[2,70],82:[2,70],83:[2,70],88:[2,70],90:[2,70],99:[2,70],101:[2,70],102:[2,70],103:[2,70],107:[2,70],115:[2,70],123:[2,70],125:[2,70],126:[2,70],129:[2,70],130:[2,70],131:[2,70],132:[2,70],133:[2,70],134:[2,70]},{1:[2,29],6:[2,29],25:[2,29],26:[2,29],47:[2,29],52:[2,29],55:[2,29],64:[2,29],65:[2,29],66:[2,29],68:[2,29],70:[2,29],71:[2,29],75:[2,29],81:[2,29],82:[2,29],83:[2,29],88:[2,29],90:[2,29],99:[2,29],101:[2,29],102:[2,29],103:[2,29],107:[2,29],115:[2,29],123:[2,29],125:[2,29],126:[2,29],129:[2,29],130:[2,29],131:[2,29],132:[2,29],133:[2,29],134:[2,29]},{1:[2,30],6:[2,30],25:[2,30],26:[2,30],47:[2,30],52:[2,30],55:[2,30],64:[2,30],65:[2,30],66:[2,30],68:[2,30],70:[2,30],71:[2,30],75:[2,30],81:[2,30],82:[2,30],83:[2,30],88:[2,30],90:[2,30],99:[2,30],101:[2,30],102:[2,30],103:[2,30],107:[2,30],115:[2,30],123:[2,30],125:[2,30],126:[2,30],129:[2,30],130:[2,30],131:[2,30],132:[2,30],133:[2,30],134:[2,30]},{1:[2,31],6:[2,31],25:[2,31],26:[2,31],47:[2,31],52:[2,31],55:[2,31],64:[2,31],65:[2,31],66:[2,31],68:[2,31],70:[2,31],71:[2,31],75:[2,31],81:[2,31],82:[2,31],83:[2,31],88:[2,31],90:[2,31],99:[2,31],101:[2,31],102:[2,31],103:[2,31],107:[2,31],115:[2,31],123:[2,31],125:[2,31],126:[2,31],129:[2,31],130:[2,31],131:[2,31],132:[2,31],133:[2,31],134:[2,31]},{1:[2,32],6:[2,32],25:[2,32],26:[2,32],47:[2,32],52:[2,32],55:[2,32],64:[2,32],65:[2,32],66:[2,32],68:[2,32],70:[2,32],71:[2,32],75:[2,32],81:[2,32],82:[2,32],83:[2,32],88:[2,32],90:[2,32],99:[2,32],101:[2,32],102:[2,32],103:[2,32],107:[2,32],115:[2,32],123:[2,32],125:[2,32],126:[2,32],129:[2,32],130:[2,32],131:[2,32],132:[2,32],133:[2,32],134:[2,32]},{1:[2,33],6:[2,33],25:[2,33],26:[2,33],47:[2,33],52:[2,33],55:[2,33],64:[2,33],65:[2,33],66:[2,33],68:[2,33],70:[2,33],71:[2,33],75:[2,33],81:[2,33],82:[2,33],83:[2,33],88:[2,33],90:[2,33],99:[2,33],101:[2,33],102:[2,33],103:[2,33],107:[2,33],115:[2,33],123:[2,33],125:[2,33],126:[2,33],129:[2,33],130:[2,33],131:[2,33],132:[2,33],133:[2,33],134:[2,33]},{4:138,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,139],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:140,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,144],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,58:145,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],84:142,85:[1,56],86:[1,57],87:[1,55],88:[1,141],91:143,93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,107],6:[2,107],25:[2,107],26:[2,107],47:[2,107],52:[2,107],55:[2,107],64:[2,107],65:[2,107],66:[2,107],68:[2,107],70:[2,107],71:[2,107],75:[2,107],81:[2,107],82:[2,107],83:[2,107],88:[2,107],90:[2,107],99:[2,107],101:[2,107],102:[2,107],103:[2,107],107:[2,107],115:[2,107],123:[2,107],125:[2,107],126:[2,107],129:[2,107],130:[2,107],131:[2,107],132:[2,107],133:[2,107],134:[2,107]},{1:[2,108],6:[2,108],25:[2,108],26:[2,108],27:146,28:[1,71],47:[2,108],52:[2,108],55:[2,108],64:[2,108],65:[2,108],66:[2,108],68:[2,108],70:[2,108],71:[2,108],75:[2,108],81:[2,108],82:[2,108],83:[2,108],88:[2,108],90:[2,108],99:[2,108],101:[2,108],102:[2,108],103:[2,108],107:[2,108],115:[2,108],123:[2,108],125:[2,108],126:[2,108],129:[2,108],130:[2,108],131:[2,108],132:[2,108],133:[2,108],134:[2,108]},{25:[2,49]},{25:[2,50]},{1:[2,64],6:[2,64],25:[2,64],26:[2,64],38:[2,64],47:[2,64],52:[2,64],55:[2,64],64:[2,64],65:[2,64],66:[2,64],68:[2,64],70:[2,64],71:[2,64],75:[2,64],77:[2,64],81:[2,64],82:[2,64],83:[2,64],88:[2,64],90:[2,64],99:[2,64],101:[2,64],102:[2,64],103:[2,64],107:[2,64],115:[2,64],123:[2,64],125:[2,64],126:[2,64],127:[2,64],128:[2,64],129:[2,64],130:[2,64],131:[2,64],132:[2,64],133:[2,64],134:[2,64],135:[2,64]},{1:[2,67],6:[2,67],25:[2,67],26:[2,67],38:[2,67],47:[2,67],52:[2,67],55:[2,67],64:[2,67],65:[2,67],66:[2,67],68:[2,67],70:[2,67],71:[2,67],75:[2,67],77:[2,67],81:[2,67],82:[2,67],83:[2,67],88:[2,67],90:[2,67],99:[2,67],101:[2,67],102:[2,67],103:[2,67],107:[2,67],115:[2,67],123:[2,67],125:[2,67],126:[2,67],127:[2,67],128:[2,67],129:[2,67],130:[2,67],131:[2,67],132:[2,67],133:[2,67],134:[2,67],135:[2,67]},{8:147,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:148,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:149,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{5:150,8:151,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{27:156,28:[1,71],56:157,57:158,62:152,73:[1,68],87:[1,55],110:153,111:[1,154],112:155},{109:159,113:[1,160],114:[1,161]},{6:[2,86],11:165,25:[2,86],27:166,28:[1,71],29:167,30:[1,69],31:[1,70],39:163,40:164,42:168,44:[1,46],52:[2,86],74:162,75:[2,86],86:[1,111]},{1:[2,27],6:[2,27],25:[2,27],26:[2,27],41:[2,27],47:[2,27],52:[2,27],55:[2,27],64:[2,27],65:[2,27],66:[2,27],68:[2,27],70:[2,27],71:[2,27],75:[2,27],81:[2,27],82:[2,27],83:[2,27],88:[2,27],90:[2,27],99:[2,27],101:[2,27],102:[2,27],103:[2,27],107:[2,27],115:[2,27],123:[2,27],125:[2,27],126:[2,27],129:[2,27],130:[2,27],131:[2,27],132:[2,27],133:[2,27],134:[2,27]},{1:[2,28],6:[2,28],25:[2,28],26:[2,28],41:[2,28],47:[2,28],52:[2,28],55:[2,28],64:[2,28],65:[2,28],66:[2,28],68:[2,28],70:[2,28],71:[2,28],75:[2,28],81:[2,28],82:[2,28],83:[2,28],88:[2,28],90:[2,28],99:[2,28],101:[2,28],102:[2,28],103:[2,28],107:[2,28],115:[2,28],123:[2,28],125:[2,28],126:[2,28],129:[2,28],130:[2,28],131:[2,28],132:[2,28],133:[2,28],134:[2,28]},{1:[2,26],6:[2,26],25:[2,26],26:[2,26],38:[2,26],41:[2,26],47:[2,26],52:[2,26],55:[2,26],64:[2,26],65:[2,26],66:[2,26],68:[2,26],70:[2,26],71:[2,26],75:[2,26],77:[2,26],81:[2,26],82:[2,26],83:[2,26],88:[2,26],90:[2,26],99:[2,26],101:[2,26],102:[2,26],103:[2,26],107:[2,26],113:[2,26],114:[2,26],115:[2,26],123:[2,26],125:[2,26],126:[2,26],127:[2,26],128:[2,26],129:[2,26],130:[2,26],131:[2,26],132:[2,26],133:[2,26],134:[2,26],135:[2,26]},{1:[2,6],6:[2,6],7:169,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,6],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],99:[2,6],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,3]},{1:[2,24],6:[2,24],25:[2,24],26:[2,24],47:[2,24],52:[2,24],55:[2,24],70:[2,24],75:[2,24],83:[2,24],88:[2,24],90:[2,24],95:[2,24],96:[2,24],99:[2,24],101:[2,24],102:[2,24],103:[2,24],107:[2,24],115:[2,24],118:[2,24],120:[2,24],123:[2,24],125:[2,24],126:[2,24],129:[2,24],130:[2,24],131:[2,24],132:[2,24],133:[2,24],134:[2,24]},{6:[1,72],26:[1,170]},{1:[2,185],6:[2,185],25:[2,185],26:[2,185],47:[2,185],52:[2,185],55:[2,185],70:[2,185],75:[2,185],83:[2,185],88:[2,185],90:[2,185],99:[2,185],101:[2,185],102:[2,185],103:[2,185],107:[2,185],115:[2,185],123:[2,185],125:[2,185],126:[2,185],129:[2,185],130:[2,185],131:[2,185],132:[2,185],133:[2,185],134:[2,185]},{8:171,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:172,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:173,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:174,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:175,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:176,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:177,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:178,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,141],6:[2,141],25:[2,141],26:[2,141],47:[2,141],52:[2,141],55:[2,141],70:[2,141],75:[2,141],83:[2,141],88:[2,141],90:[2,141],99:[2,141],101:[2,141],102:[2,141],103:[2,141],107:[2,141],115:[2,141],123:[2,141],125:[2,141],126:[2,141],129:[2,141],130:[2,141],131:[2,141],132:[2,141],133:[2,141],134:[2,141]},{1:[2,146],6:[2,146],25:[2,146],26:[2,146],47:[2,146],52:[2,146],55:[2,146],70:[2,146],75:[2,146],83:[2,146],88:[2,146],90:[2,146],99:[2,146],101:[2,146],102:[2,146],103:[2,146],107:[2,146],115:[2,146],123:[2,146],125:[2,146],126:[2,146],129:[2,146],130:[2,146],131:[2,146],132:[2,146],133:[2,146],134:[2,146]},{8:179,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,140],6:[2,140],25:[2,140],26:[2,140],47:[2,140],52:[2,140],55:[2,140],70:[2,140],75:[2,140],83:[2,140],88:[2,140],90:[2,140],99:[2,140],101:[2,140],102:[2,140],103:[2,140],107:[2,140],115:[2,140],123:[2,140],125:[2,140],126:[2,140],129:[2,140],130:[2,140],131:[2,140],132:[2,140],133:[2,140],134:[2,140]},{1:[2,145],6:[2,145],25:[2,145],26:[2,145],47:[2,145],52:[2,145],55:[2,145],70:[2,145],75:[2,145],83:[2,145],88:[2,145],90:[2,145],99:[2,145],101:[2,145],102:[2,145],103:[2,145],107:[2,145],115:[2,145],123:[2,145],125:[2,145],126:[2,145],129:[2,145],130:[2,145],131:[2,145],132:[2,145],133:[2,145],134:[2,145]},{79:180,82:[1,103]},{1:[2,65],6:[2,65],25:[2,65],26:[2,65],38:[2,65],47:[2,65],52:[2,65],55:[2,65],64:[2,65],65:[2,65],66:[2,65],68:[2,65],70:[2,65],71:[2,65],75:[2,65],77:[2,65],81:[2,65],82:[2,65],83:[2,65],88:[2,65],90:[2,65],99:[2,65],101:[2,65],102:[2,65],103:[2,65],107:[2,65],115:[2,65],123:[2,65],125:[2,65],126:[2,65],127:[2,65],128:[2,65],129:[2,65],130:[2,65],131:[2,65],132:[2,65],133:[2,65],134:[2,65],135:[2,65]},{82:[2,104]},{27:181,28:[1,71]},{27:182,28:[1,71]},{1:[2,79],6:[2,79],25:[2,79],26:[2,79],27:183,28:[1,71],38:[2,79],47:[2,79],52:[2,79],55:[2,79],64:[2,79],65:[2,79],66:[2,79],68:[2,79],70:[2,79],71:[2,79],75:[2,79],77:[2,79],81:[2,79],82:[2,79],83:[2,79],88:[2,79],90:[2,79],99:[2,79],101:[2,79],102:[2,79],103:[2,79],107:[2,79],115:[2,79],123:[2,79],125:[2,79],126:[2,79],127:[2,79],128:[2,79],129:[2,79],130:[2,79],131:[2,79],132:[2,79],133:[2,79],134:[2,79],135:[2,79]},{1:[2,80],6:[2,80],25:[2,80],26:[2,80],38:[2,80],47:[2,80],52:[2,80],55:[2,80],64:[2,80],65:[2,80],66:[2,80],68:[2,80],70:[2,80],71:[2,80],75:[2,80],77:[2,80],81:[2,80],82:[2,80],83:[2,80],88:[2,80],90:[2,80],99:[2,80],101:[2,80],102:[2,80],103:[2,80],107:[2,80],115:[2,80],123:[2,80],125:[2,80],126:[2,80],127:[2,80],128:[2,80],129:[2,80],130:[2,80],131:[2,80],132:[2,80],133:[2,80],134:[2,80],135:[2,80]},{8:185,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],55:[1,189],56:47,57:48,59:36,61:25,62:26,63:27,69:184,72:186,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],89:187,90:[1,188],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{67:190,68:[1,97],71:[1,98]},{79:191,82:[1,103]},{1:[2,66],6:[2,66],25:[2,66],26:[2,66],38:[2,66],47:[2,66],52:[2,66],55:[2,66],64:[2,66],65:[2,66],66:[2,66],68:[2,66],70:[2,66],71:[2,66],75:[2,66],77:[2,66],81:[2,66],82:[2,66],83:[2,66],88:[2,66],90:[2,66],99:[2,66],101:[2,66],102:[2,66],103:[2,66],107:[2,66],115:[2,66],123:[2,66],125:[2,66],126:[2,66],127:[2,66],128:[2,66],129:[2,66],130:[2,66],131:[2,66],132:[2,66],133:[2,66],134:[2,66],135:[2,66]},{6:[1,193],8:192,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,194],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,102],6:[2,102],25:[2,102],26:[2,102],47:[2,102],52:[2,102],55:[2,102],64:[2,102],65:[2,102],66:[2,102],68:[2,102],70:[2,102],71:[2,102],75:[2,102],81:[2,102],82:[2,102],83:[2,102],88:[2,102],90:[2,102],99:[2,102],101:[2,102],102:[2,102],103:[2,102],107:[2,102],115:[2,102],123:[2,102],125:[2,102],126:[2,102],129:[2,102],130:[2,102],131:[2,102],132:[2,102],133:[2,102],134:[2,102]},{8:197,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,144],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,58:145,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],83:[1,195],84:196,85:[1,56],86:[1,57],87:[1,55],91:143,93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{47:[1,198],52:[1,199]},{47:[2,54],52:[2,54]},{38:[1,201],47:[2,56],52:[2,56],55:[1,200]},{38:[2,59],47:[2,59],52:[2,59],55:[2,59]},{38:[2,60],47:[2,60],52:[2,60],55:[2,60]},{38:[2,61],47:[2,61],52:[2,61],55:[2,61]},{38:[2,62],47:[2,62],52:[2,62],55:[2,62]},{27:146,28:[1,71]},{8:197,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,144],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,58:145,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],84:142,85:[1,56],86:[1,57],87:[1,55],88:[1,141],91:143,93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,48],6:[2,48],25:[2,48],26:[2,48],47:[2,48],52:[2,48],55:[2,48],70:[2,48],75:[2,48],83:[2,48],88:[2,48],90:[2,48],99:[2,48],101:[2,48],102:[2,48],103:[2,48],107:[2,48],115:[2,48],123:[2,48],125:[2,48],126:[2,48],129:[2,48],130:[2,48],131:[2,48],132:[2,48],133:[2,48],134:[2,48]},{1:[2,178],6:[2,178],25:[2,178],26:[2,178],47:[2,178],52:[2,178],55:[2,178],70:[2,178],75:[2,178],83:[2,178],88:[2,178],90:[2,178],99:[2,178],100:85,101:[2,178],102:[2,178],103:[2,178],106:86,107:[2,178],108:67,115:[2,178],123:[2,178],125:[2,178],126:[2,178],129:[1,76],130:[2,178],131:[2,178],132:[2,178],133:[2,178],134:[2,178]},{100:88,101:[1,63],103:[1,64],106:89,107:[1,66],108:67,123:[1,87]},{1:[2,179],6:[2,179],25:[2,179],26:[2,179],47:[2,179],52:[2,179],55:[2,179],70:[2,179],75:[2,179],83:[2,179],88:[2,179],90:[2,179],99:[2,179],100:85,101:[2,179],102:[2,179],103:[2,179],106:86,107:[2,179],108:67,115:[2,179],123:[2,179],125:[2,179],126:[2,179],129:[1,76],130:[2,179],131:[2,179],132:[2,179],133:[2,179],134:[2,179]},{1:[2,180],6:[2,180],25:[2,180],26:[2,180],47:[2,180],52:[2,180],55:[2,180],70:[2,180],75:[2,180],83:[2,180],88:[2,180],90:[2,180],99:[2,180],100:85,101:[2,180],102:[2,180],103:[2,180],106:86,107:[2,180],108:67,115:[2,180],123:[2,180],125:[2,180],126:[2,180],129:[1,76],130:[2,180],131:[2,180],132:[2,180],133:[2,180],134:[2,180]},{1:[2,181],6:[2,181],25:[2,181],26:[2,181],47:[2,181],52:[2,181],55:[2,181],64:[2,68],65:[2,68],66:[2,68],68:[2,68],70:[2,181],71:[2,68],75:[2,181],81:[2,68],82:[2,68],83:[2,181],88:[2,181],90:[2,181],99:[2,181],101:[2,181],102:[2,181],103:[2,181],107:[2,181],115:[2,181],123:[2,181],125:[2,181],126:[2,181],129:[2,181],130:[2,181],131:[2,181],132:[2,181],133:[2,181],134:[2,181]},{60:91,64:[1,93],65:[1,94],66:[1,95],67:96,68:[1,97],71:[1,98],78:90,81:[1,92],82:[2,103]},{60:100,64:[1,93],65:[1,94],66:[1,95],67:96,68:[1,97],71:[1,98],78:99,81:[1,92],82:[2,103]},{64:[2,71],65:[2,71],66:[2,71],68:[2,71],71:[2,71],81:[2,71],82:[2,71]},{1:[2,182],6:[2,182],25:[2,182],26:[2,182],47:[2,182],52:[2,182],55:[2,182],64:[2,68],65:[2,68],66:[2,68],68:[2,68],70:[2,182],71:[2,68],75:[2,182],81:[2,68],82:[2,68],83:[2,182],88:[2,182],90:[2,182],99:[2,182],101:[2,182],102:[2,182],103:[2,182],107:[2,182],115:[2,182],123:[2,182],125:[2,182],126:[2,182],129:[2,182],130:[2,182],131:[2,182],132:[2,182],133:[2,182],134:[2,182]},{1:[2,183],6:[2,183],25:[2,183],26:[2,183],47:[2,183],52:[2,183],55:[2,183],70:[2,183],75:[2,183],83:[2,183],88:[2,183],90:[2,183],99:[2,183],101:[2,183],102:[2,183],103:[2,183],107:[2,183],115:[2,183],123:[2,183],125:[2,183],126:[2,183],129:[2,183],130:[2,183],131:[2,183],132:[2,183],133:[2,183],134:[2,183]},{1:[2,184],6:[2,184],25:[2,184],26:[2,184],47:[2,184],52:[2,184],55:[2,184],70:[2,184],75:[2,184],83:[2,184],88:[2,184],90:[2,184],99:[2,184],101:[2,184],102:[2,184],103:[2,184],107:[2,184],115:[2,184],123:[2,184],125:[2,184],126:[2,184],129:[2,184],130:[2,184],131:[2,184],132:[2,184],133:[2,184],134:[2,184]},{8:202,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,203],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:204,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{5:205,25:[1,5],122:[1,206]},{1:[2,127],6:[2,127],25:[2,127],26:[2,127],47:[2,127],52:[2,127],55:[2,127],70:[2,127],75:[2,127],83:[2,127],88:[2,127],90:[2,127],94:207,95:[1,208],96:[1,209],99:[2,127],101:[2,127],102:[2,127],103:[2,127],107:[2,127],115:[2,127],123:[2,127],125:[2,127],126:[2,127],129:[2,127],130:[2,127],131:[2,127],132:[2,127],133:[2,127],134:[2,127]},{1:[2,139],6:[2,139],25:[2,139],26:[2,139],47:[2,139],52:[2,139],55:[2,139],70:[2,139],75:[2,139],83:[2,139],88:[2,139],90:[2,139],99:[2,139],101:[2,139],102:[2,139],103:[2,139],107:[2,139],115:[2,139],123:[2,139],125:[2,139],126:[2,139],129:[2,139],130:[2,139],131:[2,139],132:[2,139],133:[2,139],134:[2,139]},{1:[2,147],6:[2,147],25:[2,147],26:[2,147],47:[2,147],52:[2,147],55:[2,147],70:[2,147],75:[2,147],83:[2,147],88:[2,147],90:[2,147],99:[2,147],101:[2,147],102:[2,147],103:[2,147],107:[2,147],115:[2,147],123:[2,147],125:[2,147],126:[2,147],129:[2,147],130:[2,147],131:[2,147],132:[2,147],133:[2,147],134:[2,147]},{25:[1,210],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{117:211,119:212,120:[1,213]},{1:[2,92],6:[2,92],25:[2,92],26:[2,92],47:[2,92],52:[2,92],55:[2,92],70:[2,92],75:[2,92],83:[2,92],88:[2,92],90:[2,92],99:[2,92],101:[2,92],102:[2,92],103:[2,92],107:[2,92],115:[2,92],123:[2,92],125:[2,92],126:[2,92],129:[2,92],130:[2,92],131:[2,92],132:[2,92],133:[2,92],134:[2,92]},{8:214,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,95],5:215,6:[2,95],25:[1,5],26:[2,95],47:[2,95],52:[2,95],55:[2,95],64:[2,68],65:[2,68],66:[2,68],68:[2,68],70:[2,95],71:[2,68],75:[2,95],77:[1,216],81:[2,68],82:[2,68],83:[2,95],88:[2,95],90:[2,95],99:[2,95],101:[2,95],102:[2,95],103:[2,95],107:[2,95],115:[2,95],123:[2,95],125:[2,95],126:[2,95],129:[2,95],130:[2,95],131:[2,95],132:[2,95],133:[2,95],134:[2,95]},{1:[2,132],6:[2,132],25:[2,132],26:[2,132],47:[2,132],52:[2,132],55:[2,132],70:[2,132],75:[2,132],83:[2,132],88:[2,132],90:[2,132],99:[2,132],100:85,101:[2,132],102:[2,132],103:[2,132],106:86,107:[2,132],108:67,115:[2,132],123:[2,132],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,44],6:[2,44],26:[2,44],99:[2,44],100:85,101:[2,44],103:[2,44],106:86,107:[2,44],108:67,123:[2,44],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{6:[1,72],99:[1,217]},{4:218,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[2,123],25:[2,123],52:[2,123],55:[1,220],88:[2,123],89:219,90:[1,188],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,110],6:[2,110],25:[2,110],26:[2,110],38:[2,110],47:[2,110],52:[2,110],55:[2,110],64:[2,110],65:[2,110],66:[2,110],68:[2,110],70:[2,110],71:[2,110],75:[2,110],81:[2,110],82:[2,110],83:[2,110],88:[2,110],90:[2,110],99:[2,110],101:[2,110],102:[2,110],103:[2,110],107:[2,110],113:[2,110],114:[2,110],115:[2,110],123:[2,110],125:[2,110],126:[2,110],129:[2,110],130:[2,110],131:[2,110],132:[2,110],133:[2,110],134:[2,110]},{6:[2,51],25:[2,51],51:221,52:[1,222],88:[2,51]},{6:[2,118],25:[2,118],26:[2,118],52:[2,118],83:[2,118],88:[2,118]},{8:197,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,144],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,58:145,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],84:223,85:[1,56],86:[1,57],87:[1,55],91:143,93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[2,124],25:[2,124],26:[2,124],52:[2,124],83:[2,124],88:[2,124]},{1:[2,109],6:[2,109],25:[2,109],26:[2,109],38:[2,109],41:[2,109],47:[2,109],52:[2,109],55:[2,109],64:[2,109],65:[2,109],66:[2,109],68:[2,109],70:[2,109],71:[2,109],75:[2,109],77:[2,109],81:[2,109],82:[2,109],83:[2,109],88:[2,109],90:[2,109],99:[2,109],101:[2,109],102:[2,109],103:[2,109],107:[2,109],115:[2,109],123:[2,109],125:[2,109],126:[2,109],127:[2,109],128:[2,109],129:[2,109],130:[2,109],131:[2,109],132:[2,109],133:[2,109],134:[2,109],135:[2,109]},{5:224,25:[1,5],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,135],6:[2,135],25:[2,135],26:[2,135],47:[2,135],52:[2,135],55:[2,135],70:[2,135],75:[2,135],83:[2,135],88:[2,135],90:[2,135],99:[2,135],100:85,101:[1,63],102:[1,225],103:[1,64],106:86,107:[1,66],108:67,115:[2,135],123:[2,135],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,137],6:[2,137],25:[2,137],26:[2,137],47:[2,137],52:[2,137],55:[2,137],70:[2,137],75:[2,137],83:[2,137],88:[2,137],90:[2,137],99:[2,137],100:85,101:[1,63],102:[1,226],103:[1,64],106:86,107:[1,66],108:67,115:[2,137],123:[2,137],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,143],6:[2,143],25:[2,143],26:[2,143],47:[2,143],52:[2,143],55:[2,143],70:[2,143],75:[2,143],83:[2,143],88:[2,143],90:[2,143],99:[2,143],101:[2,143],102:[2,143],103:[2,143],107:[2,143],115:[2,143],123:[2,143],125:[2,143],126:[2,143],129:[2,143],130:[2,143],131:[2,143],132:[2,143],133:[2,143],134:[2,143]},{1:[2,144],6:[2,144],25:[2,144],26:[2,144],47:[2,144],52:[2,144],55:[2,144],70:[2,144],75:[2,144],83:[2,144],88:[2,144],90:[2,144],99:[2,144],100:85,101:[1,63],102:[2,144],103:[1,64],106:86,107:[1,66],108:67,115:[2,144],123:[2,144],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,148],6:[2,148],25:[2,148],26:[2,148],47:[2,148],52:[2,148],55:[2,148],70:[2,148],75:[2,148],83:[2,148],88:[2,148],90:[2,148],99:[2,148],101:[2,148],102:[2,148],103:[2,148],107:[2,148],115:[2,148],123:[2,148],125:[2,148],126:[2,148],129:[2,148],130:[2,148],131:[2,148],132:[2,148],133:[2,148],134:[2,148]},{113:[2,150],114:[2,150]},{27:156,28:[1,71],56:157,57:158,73:[1,68],87:[1,112],110:227,112:155},{52:[1,228],113:[2,155],114:[2,155]},{52:[2,152],113:[2,152],114:[2,152]},{52:[2,153],113:[2,153],114:[2,153]},{52:[2,154],113:[2,154],114:[2,154]},{1:[2,149],6:[2,149],25:[2,149],26:[2,149],47:[2,149],52:[2,149],55:[2,149],70:[2,149],75:[2,149],83:[2,149],88:[2,149],90:[2,149],99:[2,149],101:[2,149],102:[2,149],103:[2,149],107:[2,149],115:[2,149],123:[2,149],125:[2,149],126:[2,149],129:[2,149],130:[2,149],131:[2,149],132:[2,149],133:[2,149],134:[2,149]},{8:229,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:230,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[2,51],25:[2,51],51:231,52:[1,232],75:[2,51]},{6:[2,87],25:[2,87],26:[2,87],52:[2,87],75:[2,87]},{6:[2,37],25:[2,37],26:[2,37],41:[1,233],52:[2,37],75:[2,37]},{6:[2,40],25:[2,40],26:[2,40],52:[2,40],75:[2,40]},{6:[2,41],25:[2,41],26:[2,41],41:[2,41],52:[2,41],75:[2,41]},{6:[2,42],25:[2,42],26:[2,42],41:[2,42],52:[2,42],75:[2,42]},{6:[2,43],25:[2,43],26:[2,43],41:[2,43],52:[2,43],75:[2,43]},{1:[2,5],6:[2,5],26:[2,5],99:[2,5]},{1:[2,25],6:[2,25],25:[2,25],26:[2,25],47:[2,25],52:[2,25],55:[2,25],70:[2,25],75:[2,25],83:[2,25],88:[2,25],90:[2,25],95:[2,25],96:[2,25],99:[2,25],101:[2,25],102:[2,25],103:[2,25],107:[2,25],115:[2,25],118:[2,25],120:[2,25],123:[2,25],125:[2,25],126:[2,25],129:[2,25],130:[2,25],131:[2,25],132:[2,25],133:[2,25],134:[2,25]},{1:[2,186],6:[2,186],25:[2,186],26:[2,186],47:[2,186],52:[2,186],55:[2,186],70:[2,186],75:[2,186],83:[2,186],88:[2,186],90:[2,186],99:[2,186],100:85,101:[2,186],102:[2,186],103:[2,186],106:86,107:[2,186],108:67,115:[2,186],123:[2,186],125:[2,186],126:[2,186],129:[1,76],130:[1,79],131:[2,186],132:[2,186],133:[2,186],134:[2,186]},{1:[2,187],6:[2,187],25:[2,187],26:[2,187],47:[2,187],52:[2,187],55:[2,187],70:[2,187],75:[2,187],83:[2,187],88:[2,187],90:[2,187],99:[2,187],100:85,101:[2,187],102:[2,187],103:[2,187],106:86,107:[2,187],108:67,115:[2,187],123:[2,187],125:[2,187],126:[2,187],129:[1,76],130:[1,79],131:[2,187],132:[2,187],133:[2,187],134:[2,187]},{1:[2,188],6:[2,188],25:[2,188],26:[2,188],47:[2,188],52:[2,188],55:[2,188],70:[2,188],75:[2,188],83:[2,188],88:[2,188],90:[2,188],99:[2,188],100:85,101:[2,188],102:[2,188],103:[2,188],106:86,107:[2,188],108:67,115:[2,188],123:[2,188],125:[2,188],126:[2,188],129:[1,76],130:[2,188],131:[2,188],132:[2,188],133:[2,188],134:[2,188]},{1:[2,189],6:[2,189],25:[2,189],26:[2,189],47:[2,189],52:[2,189],55:[2,189],70:[2,189],75:[2,189],83:[2,189],88:[2,189],90:[2,189],99:[2,189],100:85,101:[2,189],102:[2,189],103:[2,189],106:86,107:[2,189],108:67,115:[2,189],123:[2,189],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[2,189],132:[2,189],133:[2,189],134:[2,189]},{1:[2,190],6:[2,190],25:[2,190],26:[2,190],47:[2,190],52:[2,190],55:[2,190],70:[2,190],75:[2,190],83:[2,190],88:[2,190],90:[2,190],99:[2,190],100:85,101:[2,190],102:[2,190],103:[2,190],106:86,107:[2,190],108:67,115:[2,190],123:[2,190],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[2,190],133:[2,190],134:[1,83]},{1:[2,191],6:[2,191],25:[2,191],26:[2,191],47:[2,191],52:[2,191],55:[2,191],70:[2,191],75:[2,191],83:[2,191],88:[2,191],90:[2,191],99:[2,191],100:85,101:[2,191],102:[2,191],103:[2,191],106:86,107:[2,191],108:67,115:[2,191],123:[2,191],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[2,191],134:[1,83]},{1:[2,192],6:[2,192],25:[2,192],26:[2,192],47:[2,192],52:[2,192],55:[2,192],70:[2,192],75:[2,192],83:[2,192],88:[2,192],90:[2,192],99:[2,192],100:85,101:[2,192],102:[2,192],103:[2,192],106:86,107:[2,192],108:67,115:[2,192],123:[2,192],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[2,192],133:[2,192],134:[2,192]},{1:[2,177],6:[2,177],25:[2,177],26:[2,177],47:[2,177],52:[2,177],55:[2,177],70:[2,177],75:[2,177],83:[2,177],88:[2,177],90:[2,177],99:[2,177],100:85,101:[1,63],102:[2,177],103:[1,64],106:86,107:[1,66],108:67,115:[2,177],123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,176],6:[2,176],25:[2,176],26:[2,176],47:[2,176],52:[2,176],55:[2,176],70:[2,176],75:[2,176],83:[2,176],88:[2,176],90:[2,176],99:[2,176],100:85,101:[1,63],102:[2,176],103:[1,64],106:86,107:[1,66],108:67,115:[2,176],123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,99],6:[2,99],25:[2,99],26:[2,99],47:[2,99],52:[2,99],55:[2,99],64:[2,99],65:[2,99],66:[2,99],68:[2,99],70:[2,99],71:[2,99],75:[2,99],81:[2,99],82:[2,99],83:[2,99],88:[2,99],90:[2,99],99:[2,99],101:[2,99],102:[2,99],103:[2,99],107:[2,99],115:[2,99],123:[2,99],125:[2,99],126:[2,99],129:[2,99],130:[2,99],131:[2,99],132:[2,99],133:[2,99],134:[2,99]},{1:[2,76],6:[2,76],25:[2,76],26:[2,76],38:[2,76],47:[2,76],52:[2,76],55:[2,76],64:[2,76],65:[2,76],66:[2,76],68:[2,76],70:[2,76],71:[2,76],75:[2,76],77:[2,76],81:[2,76],82:[2,76],83:[2,76],88:[2,76],90:[2,76],99:[2,76],101:[2,76],102:[2,76],103:[2,76],107:[2,76],115:[2,76],123:[2,76],125:[2,76],126:[2,76],127:[2,76],128:[2,76],129:[2,76],130:[2,76],131:[2,76],132:[2,76],133:[2,76],134:[2,76],135:[2,76]},{1:[2,77],6:[2,77],25:[2,77],26:[2,77],38:[2,77],47:[2,77],52:[2,77],55:[2,77],64:[2,77],65:[2,77],66:[2,77],68:[2,77],70:[2,77],71:[2,77],75:[2,77],77:[2,77],81:[2,77],82:[2,77],83:[2,77],88:[2,77],90:[2,77],99:[2,77],101:[2,77],102:[2,77],103:[2,77],107:[2,77],115:[2,77],123:[2,77],125:[2,77],126:[2,77],127:[2,77],128:[2,77],129:[2,77],130:[2,77],131:[2,77],132:[2,77],133:[2,77],134:[2,77],135:[2,77]},{1:[2,78],6:[2,78],25:[2,78],26:[2,78],38:[2,78],47:[2,78],52:[2,78],55:[2,78],64:[2,78],65:[2,78],66:[2,78],68:[2,78],70:[2,78],71:[2,78],75:[2,78],77:[2,78],81:[2,78],82:[2,78],83:[2,78],88:[2,78],90:[2,78],99:[2,78],101:[2,78],102:[2,78],103:[2,78],107:[2,78],115:[2,78],123:[2,78],125:[2,78],126:[2,78],127:[2,78],128:[2,78],129:[2,78],130:[2,78],131:[2,78],132:[2,78],133:[2,78],134:[2,78],135:[2,78]},{70:[1,234]},{55:[1,189],70:[2,83],89:235,90:[1,188],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{70:[2,84]},{8:236,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{12:[2,112],28:[2,112],30:[2,112],31:[2,112],33:[2,112],34:[2,112],35:[2,112],36:[2,112],43:[2,112],44:[2,112],45:[2,112],49:[2,112],50:[2,112],70:[2,112],73:[2,112],76:[2,112],80:[2,112],85:[2,112],86:[2,112],87:[2,112],93:[2,112],97:[2,112],98:[2,112],101:[2,112],103:[2,112],105:[2,112],107:[2,112],116:[2,112],122:[2,112],124:[2,112],125:[2,112],126:[2,112],127:[2,112],128:[2,112]},{12:[2,113],28:[2,113],30:[2,113],31:[2,113],33:[2,113],34:[2,113],35:[2,113],36:[2,113],43:[2,113],44:[2,113],45:[2,113],49:[2,113],50:[2,113],70:[2,113],73:[2,113],76:[2,113],80:[2,113],85:[2,113],86:[2,113],87:[2,113],93:[2,113],97:[2,113],98:[2,113],101:[2,113],103:[2,113],105:[2,113],107:[2,113],116:[2,113],122:[2,113],124:[2,113],125:[2,113],126:[2,113],127:[2,113],128:[2,113]},{1:[2,82],6:[2,82],25:[2,82],26:[2,82],38:[2,82],47:[2,82],52:[2,82],55:[2,82],64:[2,82],65:[2,82],66:[2,82],68:[2,82],70:[2,82],71:[2,82],75:[2,82],77:[2,82],81:[2,82],82:[2,82],83:[2,82],88:[2,82],90:[2,82],99:[2,82],101:[2,82],102:[2,82],103:[2,82],107:[2,82],115:[2,82],123:[2,82],125:[2,82],126:[2,82],127:[2,82],128:[2,82],129:[2,82],130:[2,82],131:[2,82],132:[2,82],133:[2,82],134:[2,82],135:[2,82]},{1:[2,100],6:[2,100],25:[2,100],26:[2,100],47:[2,100],52:[2,100],55:[2,100],64:[2,100],65:[2,100],66:[2,100],68:[2,100],70:[2,100],71:[2,100],75:[2,100],81:[2,100],82:[2,100],83:[2,100],88:[2,100],90:[2,100],99:[2,100],101:[2,100],102:[2,100],103:[2,100],107:[2,100],115:[2,100],123:[2,100],125:[2,100],126:[2,100],129:[2,100],130:[2,100],131:[2,100],132:[2,100],133:[2,100],134:[2,100]},{1:[2,34],6:[2,34],25:[2,34],26:[2,34],47:[2,34],52:[2,34],55:[2,34],70:[2,34],75:[2,34],83:[2,34],88:[2,34],90:[2,34],99:[2,34],100:85,101:[2,34],102:[2,34],103:[2,34],106:86,107:[2,34],108:67,115:[2,34],123:[2,34],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{8:237,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:238,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,105],6:[2,105],25:[2,105],26:[2,105],47:[2,105],52:[2,105],55:[2,105],64:[2,105],65:[2,105],66:[2,105],68:[2,105],70:[2,105],71:[2,105],75:[2,105],81:[2,105],82:[2,105],83:[2,105],88:[2,105],90:[2,105],99:[2,105],101:[2,105],102:[2,105],103:[2,105],107:[2,105],115:[2,105],123:[2,105],125:[2,105],126:[2,105],129:[2,105],130:[2,105],131:[2,105],132:[2,105],133:[2,105],134:[2,105]},{6:[2,51],25:[2,51],51:239,52:[1,222],83:[2,51]},{6:[2,123],25:[2,123],26:[2,123],52:[2,123],55:[1,240],83:[2,123],88:[2,123],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{48:241,49:[1,58],50:[1,59]},{27:107,28:[1,71],42:108,53:242,54:106,56:109,57:110,73:[1,68],86:[1,111],87:[1,112]},{47:[2,57],52:[2,57]},{8:243,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,193],6:[2,193],25:[2,193],26:[2,193],47:[2,193],52:[2,193],55:[2,193],70:[2,193],75:[2,193],83:[2,193],88:[2,193],90:[2,193],99:[2,193],100:85,101:[2,193],102:[2,193],103:[2,193],106:86,107:[2,193],108:67,115:[2,193],123:[2,193],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{8:244,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,195],6:[2,195],25:[2,195],26:[2,195],47:[2,195],52:[2,195],55:[2,195],70:[2,195],75:[2,195],83:[2,195],88:[2,195],90:[2,195],99:[2,195],100:85,101:[2,195],102:[2,195],103:[2,195],106:86,107:[2,195],108:67,115:[2,195],123:[2,195],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,175],6:[2,175],25:[2,175],26:[2,175],47:[2,175],52:[2,175],55:[2,175],70:[2,175],75:[2,175],83:[2,175],88:[2,175],90:[2,175],99:[2,175],101:[2,175],102:[2,175],103:[2,175],107:[2,175],115:[2,175],123:[2,175],125:[2,175],126:[2,175],129:[2,175],130:[2,175],131:[2,175],132:[2,175],133:[2,175],134:[2,175]},{8:245,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,128],6:[2,128],25:[2,128],26:[2,128],47:[2,128],52:[2,128],55:[2,128],70:[2,128],75:[2,128],83:[2,128],88:[2,128],90:[2,128],95:[1,246],99:[2,128],101:[2,128],102:[2,128],103:[2,128],107:[2,128],115:[2,128],123:[2,128],125:[2,128],126:[2,128],129:[2,128],130:[2,128],131:[2,128],132:[2,128],133:[2,128],134:[2,128]},{5:247,25:[1,5]},{27:248,28:[1,71]},{117:249,119:212,120:[1,213]},{26:[1,250],118:[1,251],119:252,120:[1,213]},{26:[2,168],118:[2,168],120:[2,168]},{8:254,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],92:253,93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,93],5:255,6:[2,93],25:[1,5],26:[2,93],47:[2,93],52:[2,93],55:[2,93],70:[2,93],75:[2,93],83:[2,93],88:[2,93],90:[2,93],99:[2,93],100:85,101:[1,63],102:[2,93],103:[1,64],106:86,107:[1,66],108:67,115:[2,93],123:[2,93],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,96],6:[2,96],25:[2,96],26:[2,96],47:[2,96],52:[2,96],55:[2,96],70:[2,96],75:[2,96],83:[2,96],88:[2,96],90:[2,96],99:[2,96],101:[2,96],102:[2,96],103:[2,96],107:[2,96],115:[2,96],123:[2,96],125:[2,96],126:[2,96],129:[2,96],130:[2,96],131:[2,96],132:[2,96],133:[2,96],134:[2,96]},{8:256,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,133],6:[2,133],25:[2,133],26:[2,133],47:[2,133],52:[2,133],55:[2,133],64:[2,133],65:[2,133],66:[2,133],68:[2,133],70:[2,133],71:[2,133],75:[2,133],81:[2,133],82:[2,133],83:[2,133],88:[2,133],90:[2,133],99:[2,133],101:[2,133],102:[2,133],103:[2,133],107:[2,133],115:[2,133],123:[2,133],125:[2,133],126:[2,133],129:[2,133],130:[2,133],131:[2,133],132:[2,133],133:[2,133],134:[2,133]},{6:[1,72],26:[1,257]},{8:258,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[2,63],12:[2,113],25:[2,63],28:[2,113],30:[2,113],31:[2,113],33:[2,113],34:[2,113],35:[2,113],36:[2,113],43:[2,113],44:[2,113],45:[2,113],49:[2,113],50:[2,113],52:[2,63],73:[2,113],76:[2,113],80:[2,113],85:[2,113],86:[2,113],87:[2,113],88:[2,63],93:[2,113],97:[2,113],98:[2,113],101:[2,113],103:[2,113],105:[2,113],107:[2,113],116:[2,113],122:[2,113],124:[2,113],125:[2,113],126:[2,113],127:[2,113],128:[2,113]},{6:[1,260],25:[1,261],88:[1,259]},{6:[2,52],8:197,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[2,52],26:[2,52],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,58:145,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],83:[2,52],85:[1,56],86:[1,57],87:[1,55],88:[2,52],91:262,93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[2,51],25:[2,51],26:[2,51],51:263,52:[1,222]},{1:[2,172],6:[2,172],25:[2,172],26:[2,172],47:[2,172],52:[2,172],55:[2,172],70:[2,172],75:[2,172],83:[2,172],88:[2,172],90:[2,172],99:[2,172],101:[2,172],102:[2,172],103:[2,172],107:[2,172],115:[2,172],118:[2,172],123:[2,172],125:[2,172],126:[2,172],129:[2,172],130:[2,172],131:[2,172],132:[2,172],133:[2,172],134:[2,172]},{8:264,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:265,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{113:[2,151],114:[2,151]},{27:156,28:[1,71],56:157,57:158,73:[1,68],87:[1,112],112:266},{1:[2,157],6:[2,157],25:[2,157],26:[2,157],47:[2,157],52:[2,157],55:[2,157],70:[2,157],75:[2,157],83:[2,157],88:[2,157],90:[2,157],99:[2,157],100:85,101:[2,157],102:[1,267],103:[2,157],106:86,107:[2,157],108:67,115:[1,268],123:[2,157],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,158],6:[2,158],25:[2,158],26:[2,158],47:[2,158],52:[2,158],55:[2,158],70:[2,158],75:[2,158],83:[2,158],88:[2,158],90:[2,158],99:[2,158],100:85,101:[2,158],102:[1,269],103:[2,158],106:86,107:[2,158],108:67,115:[2,158],123:[2,158],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{6:[1,271],25:[1,272],75:[1,270]},{6:[2,52],11:165,25:[2,52],26:[2,52],27:166,28:[1,71],29:167,30:[1,69],31:[1,70],39:273,40:164,42:168,44:[1,46],75:[2,52],86:[1,111]},{8:274,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,275],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,81],6:[2,81],25:[2,81],26:[2,81],38:[2,81],47:[2,81],52:[2,81],55:[2,81],64:[2,81],65:[2,81],66:[2,81],68:[2,81],70:[2,81],71:[2,81],75:[2,81],77:[2,81],81:[2,81],82:[2,81],83:[2,81],88:[2,81],90:[2,81],99:[2,81],101:[2,81],102:[2,81],103:[2,81],107:[2,81],115:[2,81],123:[2,81],125:[2,81],126:[2,81],127:[2,81],128:[2,81],129:[2,81],130:[2,81],131:[2,81],132:[2,81],133:[2,81],134:[2,81],135:[2,81]},{8:276,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,70:[2,116],73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{70:[2,117],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,35],6:[2,35],25:[2,35],26:[2,35],47:[2,35],52:[2,35],55:[2,35],70:[2,35],75:[2,35],83:[2,35],88:[2,35],90:[2,35],99:[2,35],100:85,101:[2,35],102:[2,35],103:[2,35],106:86,107:[2,35],108:67,115:[2,35],123:[2,35],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{26:[1,277],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{6:[1,260],25:[1,261],83:[1,278]},{6:[2,63],25:[2,63],26:[2,63],52:[2,63],83:[2,63],88:[2,63]},{5:279,25:[1,5]},{47:[2,55],52:[2,55]},{47:[2,58],52:[2,58],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{26:[1,280],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{5:281,25:[1,5],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{5:282,25:[1,5]},{1:[2,129],6:[2,129],25:[2,129],26:[2,129],47:[2,129],52:[2,129],55:[2,129],70:[2,129],75:[2,129],83:[2,129],88:[2,129],90:[2,129],99:[2,129],101:[2,129],102:[2,129],103:[2,129],107:[2,129],115:[2,129],123:[2,129],125:[2,129],126:[2,129],129:[2,129],130:[2,129],131:[2,129],132:[2,129],133:[2,129],134:[2,129]},{5:283,25:[1,5]},{26:[1,284],118:[1,285],119:252,120:[1,213]},{1:[2,166],6:[2,166],25:[2,166],26:[2,166],47:[2,166],52:[2,166],55:[2,166],70:[2,166],75:[2,166],83:[2,166],88:[2,166],90:[2,166],99:[2,166],101:[2,166],102:[2,166],103:[2,166],107:[2,166],115:[2,166],123:[2,166],125:[2,166],126:[2,166],129:[2,166],130:[2,166],131:[2,166],132:[2,166],133:[2,166],134:[2,166]},{5:286,25:[1,5]},{26:[2,169],118:[2,169],120:[2,169]},{5:287,25:[1,5],52:[1,288]},{25:[2,125],52:[2,125],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,94],6:[2,94],25:[2,94],26:[2,94],47:[2,94],52:[2,94],55:[2,94],70:[2,94],75:[2,94],83:[2,94],88:[2,94],90:[2,94],99:[2,94],101:[2,94],102:[2,94],103:[2,94],107:[2,94],115:[2,94],123:[2,94],125:[2,94],126:[2,94],129:[2,94],130:[2,94],131:[2,94],132:[2,94],133:[2,94],134:[2,94]},{1:[2,97],5:289,6:[2,97],25:[1,5],26:[2,97],47:[2,97],52:[2,97],55:[2,97],70:[2,97],75:[2,97],83:[2,97],88:[2,97],90:[2,97],99:[2,97],100:85,101:[1,63],102:[2,97],103:[1,64],106:86,107:[1,66],108:67,115:[2,97],123:[2,97],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{99:[1,290]},{88:[1,291],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,111],6:[2,111],25:[2,111],26:[2,111],38:[2,111],47:[2,111],52:[2,111],55:[2,111],64:[2,111],65:[2,111],66:[2,111],68:[2,111],70:[2,111],71:[2,111],75:[2,111],81:[2,111],82:[2,111],83:[2,111],88:[2,111],90:[2,111],99:[2,111],101:[2,111],102:[2,111],103:[2,111],107:[2,111],113:[2,111],114:[2,111],115:[2,111],123:[2,111],125:[2,111],126:[2,111],129:[2,111],130:[2,111],131:[2,111],132:[2,111],133:[2,111],134:[2,111]},{8:197,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,58:145,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],91:292,93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:197,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,144],27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,58:145,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],84:293,85:[1,56],86:[1,57],87:[1,55],91:143,93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[2,119],25:[2,119],26:[2,119],52:[2,119],83:[2,119],88:[2,119]},{6:[1,260],25:[1,261],26:[1,294]},{1:[2,136],6:[2,136],25:[2,136],26:[2,136],47:[2,136],52:[2,136],55:[2,136],70:[2,136],75:[2,136],83:[2,136],88:[2,136],90:[2,136],99:[2,136],100:85,101:[1,63],102:[2,136],103:[1,64],106:86,107:[1,66],108:67,115:[2,136],123:[2,136],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,138],6:[2,138],25:[2,138],26:[2,138],47:[2,138],52:[2,138],55:[2,138],70:[2,138],75:[2,138],83:[2,138],88:[2,138],90:[2,138],99:[2,138],100:85,101:[1,63],102:[2,138],103:[1,64],106:86,107:[1,66],108:67,115:[2,138],123:[2,138],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{113:[2,156],114:[2,156]},{8:295,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:296,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:297,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,85],6:[2,85],25:[2,85],26:[2,85],38:[2,85],47:[2,85],52:[2,85],55:[2,85],64:[2,85],65:[2,85],66:[2,85],68:[2,85],70:[2,85],71:[2,85],75:[2,85],81:[2,85],82:[2,85],83:[2,85],88:[2,85],90:[2,85],99:[2,85],101:[2,85],102:[2,85],103:[2,85],107:[2,85],113:[2,85],114:[2,85],115:[2,85],123:[2,85],125:[2,85],126:[2,85],129:[2,85],130:[2,85],131:[2,85],132:[2,85],133:[2,85],134:[2,85]},{11:165,27:166,28:[1,71],29:167,30:[1,69],31:[1,70],39:298,40:164,42:168,44:[1,46],86:[1,111]},{6:[2,86],11:165,25:[2,86],26:[2,86],27:166,28:[1,71],29:167,30:[1,69],31:[1,70],39:163,40:164,42:168,44:[1,46],52:[2,86],74:299,86:[1,111]},{6:[2,88],25:[2,88],26:[2,88],52:[2,88],75:[2,88]},{6:[2,38],25:[2,38],26:[2,38],52:[2,38],75:[2,38],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{8:300,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{70:[2,115],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,36],6:[2,36],25:[2,36],26:[2,36],47:[2,36],52:[2,36],55:[2,36],70:[2,36],75:[2,36],83:[2,36],88:[2,36],90:[2,36],99:[2,36],101:[2,36],102:[2,36],103:[2,36],107:[2,36],115:[2,36],123:[2,36],125:[2,36],126:[2,36],129:[2,36],130:[2,36],131:[2,36],132:[2,36],133:[2,36],134:[2,36]},{1:[2,106],6:[2,106],25:[2,106],26:[2,106],47:[2,106],52:[2,106],55:[2,106],64:[2,106],65:[2,106],66:[2,106],68:[2,106],70:[2,106],71:[2,106],75:[2,106],81:[2,106],82:[2,106],83:[2,106],88:[2,106],90:[2,106],99:[2,106],101:[2,106],102:[2,106],103:[2,106],107:[2,106],115:[2,106],123:[2,106],125:[2,106],126:[2,106],129:[2,106],130:[2,106],131:[2,106],132:[2,106],133:[2,106],134:[2,106]},{1:[2,47],6:[2,47],25:[2,47],26:[2,47],47:[2,47],52:[2,47],55:[2,47],70:[2,47],75:[2,47],83:[2,47],88:[2,47],90:[2,47],99:[2,47],101:[2,47],102:[2,47],103:[2,47],107:[2,47],115:[2,47],123:[2,47],125:[2,47],126:[2,47],129:[2,47],130:[2,47],131:[2,47],132:[2,47],133:[2,47],134:[2,47]},{1:[2,194],6:[2,194],25:[2,194],26:[2,194],47:[2,194],52:[2,194],55:[2,194],70:[2,194],75:[2,194],83:[2,194],88:[2,194],90:[2,194],99:[2,194],101:[2,194],102:[2,194],103:[2,194],107:[2,194],115:[2,194],123:[2,194],125:[2,194],126:[2,194],129:[2,194],130:[2,194],131:[2,194],132:[2,194],133:[2,194],134:[2,194]},{1:[2,173],6:[2,173],25:[2,173],26:[2,173],47:[2,173],52:[2,173],55:[2,173],70:[2,173],75:[2,173],83:[2,173],88:[2,173],90:[2,173],99:[2,173],101:[2,173],102:[2,173],103:[2,173],107:[2,173],115:[2,173],118:[2,173],123:[2,173],125:[2,173],126:[2,173],129:[2,173],130:[2,173],131:[2,173],132:[2,173],133:[2,173],134:[2,173]},{1:[2,130],6:[2,130],25:[2,130],26:[2,130],47:[2,130],52:[2,130],55:[2,130],70:[2,130],75:[2,130],83:[2,130],88:[2,130],90:[2,130],99:[2,130],101:[2,130],102:[2,130],103:[2,130],107:[2,130],115:[2,130],123:[2,130],125:[2,130],126:[2,130],129:[2,130],130:[2,130],131:[2,130],132:[2,130],133:[2,130],134:[2,130]},{1:[2,131],6:[2,131],25:[2,131],26:[2,131],47:[2,131],52:[2,131],55:[2,131],70:[2,131],75:[2,131],83:[2,131],88:[2,131],90:[2,131],95:[2,131],99:[2,131],101:[2,131],102:[2,131],103:[2,131],107:[2,131],115:[2,131],123:[2,131],125:[2,131],126:[2,131],129:[2,131],130:[2,131],131:[2,131],132:[2,131],133:[2,131],134:[2,131]},{1:[2,164],6:[2,164],25:[2,164],26:[2,164],47:[2,164],52:[2,164],55:[2,164],70:[2,164],75:[2,164],83:[2,164],88:[2,164],90:[2,164],99:[2,164],101:[2,164],102:[2,164],103:[2,164],107:[2,164],115:[2,164],123:[2,164],125:[2,164],126:[2,164],129:[2,164],130:[2,164],131:[2,164],132:[2,164],133:[2,164],134:[2,164]},{5:301,25:[1,5]},{26:[1,302]},{6:[1,303],26:[2,170],118:[2,170],120:[2,170]},{8:304,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{1:[2,98],6:[2,98],25:[2,98],26:[2,98],47:[2,98],52:[2,98],55:[2,98],70:[2,98],75:[2,98],83:[2,98],88:[2,98],90:[2,98],99:[2,98],101:[2,98],102:[2,98],103:[2,98],107:[2,98],115:[2,98],123:[2,98],125:[2,98],126:[2,98],129:[2,98],130:[2,98],131:[2,98],132:[2,98],133:[2,98],134:[2,98]},{1:[2,134],6:[2,134],25:[2,134],26:[2,134],47:[2,134],52:[2,134],55:[2,134],64:[2,134],65:[2,134],66:[2,134],68:[2,134],70:[2,134],71:[2,134],75:[2,134],81:[2,134],82:[2,134],83:[2,134],88:[2,134],90:[2,134],99:[2,134],101:[2,134],102:[2,134],103:[2,134],107:[2,134],115:[2,134],123:[2,134],125:[2,134],126:[2,134],129:[2,134],130:[2,134],131:[2,134],132:[2,134],133:[2,134],134:[2,134]},{1:[2,114],6:[2,114],25:[2,114],26:[2,114],47:[2,114],52:[2,114],55:[2,114],64:[2,114],65:[2,114],66:[2,114],68:[2,114],70:[2,114],71:[2,114],75:[2,114],81:[2,114],82:[2,114],83:[2,114],88:[2,114],90:[2,114],99:[2,114],101:[2,114],102:[2,114],103:[2,114],107:[2,114],115:[2,114],123:[2,114],125:[2,114],126:[2,114],129:[2,114],130:[2,114],131:[2,114],132:[2,114],133:[2,114],134:[2,114]},{6:[2,120],25:[2,120],26:[2,120],52:[2,120],83:[2,120],88:[2,120]},{6:[2,51],25:[2,51],26:[2,51],51:305,52:[1,222]},{6:[2,121],25:[2,121],26:[2,121],52:[2,121],83:[2,121],88:[2,121]},{1:[2,159],6:[2,159],25:[2,159],26:[2,159],47:[2,159],52:[2,159],55:[2,159],70:[2,159],75:[2,159],83:[2,159],88:[2,159],90:[2,159],99:[2,159],100:85,101:[2,159],102:[2,159],103:[2,159],106:86,107:[2,159],108:67,115:[1,306],123:[2,159],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,161],6:[2,161],25:[2,161],26:[2,161],47:[2,161],52:[2,161],55:[2,161],70:[2,161],75:[2,161],83:[2,161],88:[2,161],90:[2,161],99:[2,161],100:85,101:[2,161],102:[1,307],103:[2,161],106:86,107:[2,161],108:67,115:[2,161],123:[2,161],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,160],6:[2,160],25:[2,160],26:[2,160],47:[2,160],52:[2,160],55:[2,160],70:[2,160],75:[2,160],83:[2,160],88:[2,160],90:[2,160],99:[2,160],100:85,101:[2,160],102:[2,160],103:[2,160],106:86,107:[2,160],108:67,115:[2,160],123:[2,160],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{6:[2,89],25:[2,89],26:[2,89],52:[2,89],75:[2,89]},{6:[2,51],25:[2,51],26:[2,51],51:308,52:[1,232]},{26:[1,309],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{26:[1,310]},{1:[2,167],6:[2,167],25:[2,167],26:[2,167],47:[2,167],52:[2,167],55:[2,167],70:[2,167],75:[2,167],83:[2,167],88:[2,167],90:[2,167],99:[2,167],101:[2,167],102:[2,167],103:[2,167],107:[2,167],115:[2,167],123:[2,167],125:[2,167],126:[2,167],129:[2,167],130:[2,167],131:[2,167],132:[2,167],133:[2,167],134:[2,167]},{26:[2,171],118:[2,171],120:[2,171]},{25:[2,126],52:[2,126],100:85,101:[1,63],103:[1,64],106:86,107:[1,66],108:67,123:[1,84],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{6:[1,260],25:[1,261],26:[1,311]},{8:312,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{8:313,9:115,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:60,28:[1,71],29:49,30:[1,69],31:[1,70],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:23,42:61,43:[1,45],44:[1,46],45:[1,29],48:30,49:[1,58],50:[1,59],56:47,57:48,59:36,61:25,62:26,63:27,73:[1,68],76:[1,43],80:[1,28],85:[1,56],86:[1,57],87:[1,55],93:[1,38],97:[1,44],98:[1,54],100:39,101:[1,63],103:[1,64],104:40,105:[1,65],106:41,107:[1,66],108:67,116:[1,42],121:37,122:[1,62],124:[1,31],125:[1,32],126:[1,33],127:[1,34],128:[1,35]},{6:[1,271],25:[1,272],26:[1,314]},{6:[2,39],25:[2,39],26:[2,39],52:[2,39],75:[2,39]},{1:[2,165],6:[2,165],25:[2,165],26:[2,165],47:[2,165],52:[2,165],55:[2,165],70:[2,165],75:[2,165],83:[2,165],88:[2,165],90:[2,165],99:[2,165],101:[2,165],102:[2,165],103:[2,165],107:[2,165],115:[2,165],123:[2,165],125:[2,165],126:[2,165],129:[2,165],130:[2,165],131:[2,165],132:[2,165],133:[2,165],134:[2,165]},{6:[2,122],25:[2,122],26:[2,122],52:[2,122],83:[2,122],88:[2,122]},{1:[2,162],6:[2,162],25:[2,162],26:[2,162],47:[2,162],52:[2,162],55:[2,162],70:[2,162],75:[2,162],83:[2,162],88:[2,162],90:[2,162],99:[2,162],100:85,101:[2,162],102:[2,162],103:[2,162],106:86,107:[2,162],108:67,115:[2,162],123:[2,162],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{1:[2,163],6:[2,163],25:[2,163],26:[2,163],47:[2,163],52:[2,163],55:[2,163],70:[2,163],75:[2,163],83:[2,163],88:[2,163],90:[2,163],99:[2,163],100:85,101:[2,163],102:[2,163],103:[2,163],106:86,107:[2,163],108:67,115:[2,163],123:[2,163],125:[1,78],126:[1,77],129:[1,76],130:[1,79],131:[1,80],132:[1,81],133:[1,82],134:[1,83]},{6:[2,90],25:[2,90],26:[2,90],52:[2,90],75:[2,90]}], -defaultActions: {58:[2,49],59:[2,50],73:[2,3],92:[2,104],186:[2,84]}, -parseError: function parseError(str, hash) { - throw new Error(str); -}, -parse: function parse(input) { - var self = this, - stack = [0], - vstack = [null], // semantic value stack - lstack = [], // location stack - table = this.table, - yytext = '', - yylineno = 0, - yyleng = 0, - recovering = 0, - TERROR = 2, - EOF = 1; - - //this.reductionCount = this.shiftCount = 0; - - this.lexer.setInput(input); - this.lexer.yy = this.yy; - this.yy.lexer = this.lexer; - if (typeof this.lexer.yylloc == 'undefined') - this.lexer.yylloc = {}; - var yyloc = this.lexer.yylloc; - lstack.push(yyloc); - - if (typeof this.yy.parseError === 'function') - this.parseError = this.yy.parseError; - - function popStack (n) { - stack.length = stack.length - 2*n; - vstack.length = vstack.length - n; - lstack.length = lstack.length - n; - } - - function lex() { - var token; - token = self.lexer.lex() || 1; // $end = 1 - // if token isn't its numeric value, convert - if (typeof token !== 'number') { - token = self.symbols_[token] || token; - } - return token; - }; - - var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected; - while (true) { - // retreive state number from top of stack - state = stack[stack.length-1]; - - // use default actions if available - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol == null) - symbol = lex(); - // read action for current state and first input - action = table[state] && table[state][symbol]; - } - - // handle parse error - if (typeof action === 'undefined' || !action.length || !action[0]) { - - if (!recovering) { - // Report error - expected = []; - for (p in table[state]) if (this.terminals_[p] && p > 2) { - expected.push("'"+this.terminals_[p]+"'"); - } - var errStr = ''; - if (this.lexer.showPosition) { - errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+'\nExpecting '+expected.join(', '); - } else { - errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " + - (symbol == 1 /*EOF*/ ? "end of input" : - ("'"+(this.terminals_[symbol] || symbol)+"'")); - } - this.parseError(errStr, - {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); - } - - // just recovered from another error - if (recovering == 3) { - if (symbol == EOF) { - throw new Error(errStr || 'Parsing halted.'); - } - - // discard current lookahead and grab another - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - symbol = lex(); - } - - // try to recover from error - while (1) { - // check for error recovery rule in this state - if ((TERROR.toString()) in table[state]) { - break; - } - if (state == 0) { - throw new Error(errStr || 'Parsing halted.'); - } - popStack(1); - state = stack[stack.length-1]; - } - - preErrorSymbol = symbol; // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - state = stack[stack.length-1]; - action = table[state] && table[state][TERROR]; - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error - } - - // this shouldn't happen, unless resolve defaults are off - if (action[0] instanceof Array && action.length > 1) { - throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol); - } - - switch (action[0]) { - - case 1: // shift - //this.shiftCount++; - - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); // push state - symbol = null; - if (!preErrorSymbol) { // normal execution/no error - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - if (recovering > 0) - recovering--; - } else { // error just occurred, resume old lookahead f/ before error - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - - case 2: // reduce - //this.reductionCount++; - - len = this.productions_[action[1]][1]; - - // perform semantic action - yyval.$ = vstack[vstack.length-len]; // default to $$ = $1 - // default location, uses first token for firsts, last for lasts - yyval._$ = { - first_line: lstack[lstack.length-(len||1)].first_line, - last_line: lstack[lstack.length-1].last_line, - first_column: lstack[lstack.length-(len||1)].first_column, - last_column: lstack[lstack.length-1].last_column - }; - r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); - - if (typeof r !== 'undefined') { - return r; - } - - // pop off stack - if (len) { - stack = stack.slice(0,-1*len*2); - vstack = vstack.slice(0, -1*len); - lstack = lstack.slice(0, -1*len); - } - - stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) - vstack.push(yyval.$); - lstack.push(yyval._$); - // goto new state = table[STATE][NONTERMINAL] - newState = table[stack[stack.length-2]][stack[stack.length-1]]; - stack.push(newState); - break; - - case 3: // accept - return true; - } - - } - - return true; -}}; -return parser; -})(); -if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = parser; -exports.parse = function () { return parser.parse.apply(parser, arguments); } -exports.main = function commonjsMain(args) { - if (!args[1]) - throw new Error('Usage: '+args[0]+' FILE'); - if (typeof process !== 'undefined') { - var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8"); - } else { - var cwd = require("file").path(require("file").cwd()); - var source = cwd.join(args[1]).read({charset: "utf-8"}); - } - return exports.parser.parse(source); -} -if (typeof module !== 'undefined' && require.main === module) { - exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); -} -} -};require['./scope'] = new function() { - var exports = this; - (function() { - var Scope, extend, last, _ref; - - _ref = require('./helpers'), extend = _ref.extend, last = _ref.last; - - exports.Scope = Scope = (function() { - - Scope.root = null; - - function Scope(parent, expressions, method) { - this.parent = parent; - this.expressions = expressions; - this.method = method; - this.variables = [ - { - name: 'arguments', - type: 'arguments' - } - ]; - this.positions = {}; - if (!this.parent) Scope.root = this; - } - - Scope.prototype.add = function(name, type, immediate) { - if (this.shared && !immediate) return this.parent.add(name, type, immediate); - if (Object.prototype.hasOwnProperty.call(this.positions, name)) { - return this.variables[this.positions[name]].type = type; - } else { - return this.positions[name] = this.variables.push({ - name: name, - type: type - }) - 1; - } - }; - - Scope.prototype.find = function(name, options) { - if (this.check(name, options)) return true; - this.add(name, 'var'); - return false; - }; - - Scope.prototype.parameter = function(name) { - if (this.shared && this.parent.check(name, true)) return; - return this.add(name, 'param'); - }; - - Scope.prototype.check = function(name, immediate) { - var found, _ref2; - found = !!this.type(name); - if (found || immediate) return found; - return !!((_ref2 = this.parent) != null ? _ref2.check(name) : void 0); - }; - - Scope.prototype.temporary = function(name, index) { - if (name.length > 1) { - return '_' + name + (index > 1 ? index : ''); - } else { - return '_' + (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a'); - } - }; - - Scope.prototype.type = function(name) { - var v, _i, _len, _ref2; - _ref2 = this.variables; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - v = _ref2[_i]; - if (v.name === name) return v.type; - } - return null; - }; - - Scope.prototype.freeVariable = function(name, reserve) { - var index, temp; - if (reserve == null) reserve = true; - index = 0; - while (this.check((temp = this.temporary(name, index)))) { - index++; - } - if (reserve) this.add(temp, 'var', true); - return temp; - }; - - Scope.prototype.assign = function(name, value) { - this.add(name, { - value: value, - assigned: true - }, true); - return this.hasAssignments = true; - }; - - Scope.prototype.hasDeclarations = function() { - return !!this.declaredVariables().length; - }; - - Scope.prototype.declaredVariables = function() { - var realVars, tempVars, v, _i, _len, _ref2; - realVars = []; - tempVars = []; - _ref2 = this.variables; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - v = _ref2[_i]; - if (v.type === 'var') { - (v.name.charAt(0) === '_' ? tempVars : realVars).push(v.name); - } - } - return realVars.sort().concat(tempVars.sort()); - }; - - Scope.prototype.assignedVariables = function() { - var v, _i, _len, _ref2, _results; - _ref2 = this.variables; - _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - v = _ref2[_i]; - if (v.type.assigned) _results.push("" + v.name + " = " + v.type.value); - } - return _results; - }; - - return Scope; - - })(); - -}).call(this); - -};require['./nodes'] = new function() { - var exports = this; - (function() { - var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, compact, del, ends, extend, flatten, last, merge, multident, starts, unfoldSoak, utility, _ref, - __hasProp = Object.prototype.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }, - __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - - Scope = require('./scope').Scope; - - RESERVED = require('./lexer').RESERVED; - - _ref = require('./helpers'), compact = _ref.compact, flatten = _ref.flatten, extend = _ref.extend, merge = _ref.merge, del = _ref.del, starts = _ref.starts, ends = _ref.ends, last = _ref.last; - - exports.extend = extend; - - YES = function() { - return true; - }; - - NO = function() { - return false; - }; - - THIS = function() { - return this; - }; - - NEGATE = function() { - this.negated = !this.negated; - return this; - }; - - exports.Base = Base = (function() { - - function Base() {} - - Base.prototype.compile = function(o, lvl) { - var node; - o = extend({}, o); - if (lvl) o.level = lvl; - node = this.unfoldSoak(o) || this; - node.tab = o.indent; - if (o.level === LEVEL_TOP || !node.isStatement(o)) { - return node.compileNode(o); - } else { - return node.compileClosure(o); - } - }; - - Base.prototype.compileClosure = function(o) { - if (this.jumps()) { - throw SyntaxError('cannot use a pure statement in an expression.'); - } - o.sharedScope = true; - return Closure.wrap(this).compileNode(o); - }; - - Base.prototype.cache = function(o, level, reused) { - var ref, sub; - if (!this.isComplex()) { - ref = level ? this.compile(o, level) : this; - return [ref, ref]; - } else { - ref = new Literal(reused || o.scope.freeVariable('ref')); - sub = new Assign(ref, this); - if (level) { - return [sub.compile(o, level), ref.value]; - } else { - return [sub, ref]; - } - } - }; - - Base.prototype.compileLoopReference = function(o, name) { - var src, tmp; - src = tmp = this.compile(o, LEVEL_LIST); - if (!((-Infinity < +src && +src < Infinity) || IDENTIFIER.test(src) && o.scope.check(src, true))) { - src = "" + (tmp = o.scope.freeVariable(name)) + " = " + src; - } - return [src, tmp]; - }; - - Base.prototype.makeReturn = function(res) { - var me; - me = this.unwrapAll(); - if (res) { - return new Call(new Literal("" + res + ".push"), [me]); - } else { - return new Return(me); - } - }; - - Base.prototype.contains = function(pred) { - var contains; - contains = false; - this.traverseChildren(false, function(node) { - if (pred(node)) { - contains = true; - return false; - } - }); - return contains; - }; - - Base.prototype.containsType = function(type) { - return this instanceof type || this.contains(function(node) { - return node instanceof type; - }); - }; - - Base.prototype.lastNonComment = function(list) { - var i; - i = list.length; - while (i--) { - if (!(list[i] instanceof Comment)) return list[i]; - } - return null; - }; - - Base.prototype.toString = function(idt, name) { - var tree; - if (idt == null) idt = ''; - if (name == null) name = this.constructor.name; - tree = '\n' + idt + name; - if (this.soak) tree += '?'; - this.eachChild(function(node) { - return tree += node.toString(idt + TAB); - }); - return tree; - }; - - Base.prototype.eachChild = function(func) { - var attr, child, _i, _j, _len, _len2, _ref2, _ref3; - if (!this.children) return this; - _ref2 = this.children; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - attr = _ref2[_i]; - if (this[attr]) { - _ref3 = flatten([this[attr]]); - for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { - child = _ref3[_j]; - if (func(child) === false) return this; - } - } - } - return this; - }; - - Base.prototype.traverseChildren = function(crossScope, func) { - return this.eachChild(function(child) { - if (func(child) === false) return false; - return child.traverseChildren(crossScope, func); - }); - }; - - Base.prototype.invert = function() { - return new Op('!', this); - }; - - Base.prototype.unwrapAll = function() { - var node; - node = this; - while (node !== (node = node.unwrap())) { - continue; - } - return node; - }; - - Base.prototype.children = []; - - Base.prototype.isStatement = NO; - - Base.prototype.jumps = NO; - - Base.prototype.isComplex = YES; - - Base.prototype.isChainable = NO; - - Base.prototype.isAssignable = NO; - - Base.prototype.unwrap = THIS; - - Base.prototype.unfoldSoak = NO; - - Base.prototype.assigns = NO; - - return Base; - - })(); - - exports.Block = Block = (function(_super) { - - __extends(Block, _super); - - function Block(nodes) { - this.expressions = compact(flatten(nodes || [])); - } - - Block.prototype.children = ['expressions']; - - Block.prototype.push = function(node) { - this.expressions.push(node); - return this; - }; - - Block.prototype.pop = function() { - return this.expressions.pop(); - }; - - Block.prototype.unshift = function(node) { - this.expressions.unshift(node); - return this; - }; - - Block.prototype.unwrap = function() { - if (this.expressions.length === 1) { - return this.expressions[0]; - } else { - return this; - } - }; - - Block.prototype.isEmpty = function() { - return !this.expressions.length; - }; - - Block.prototype.isStatement = function(o) { - var exp, _i, _len, _ref2; - _ref2 = this.expressions; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - exp = _ref2[_i]; - if (exp.isStatement(o)) return true; - } - return false; - }; - - Block.prototype.jumps = function(o) { - var exp, _i, _len, _ref2; - _ref2 = this.expressions; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - exp = _ref2[_i]; - if (exp.jumps(o)) return exp; - } - }; - - Block.prototype.makeReturn = function(res) { - var expr, len; - len = this.expressions.length; - while (len--) { - expr = this.expressions[len]; - if (!(expr instanceof Comment)) { - this.expressions[len] = expr.makeReturn(res); - if (expr instanceof Return && !expr.expression) { - this.expressions.splice(len, 1); - } - break; - } - } - return this; - }; - - Block.prototype.compile = function(o, level) { - if (o == null) o = {}; - if (o.scope) { - return Block.__super__.compile.call(this, o, level); - } else { - return this.compileRoot(o); - } - }; - - Block.prototype.compileNode = function(o) { - var code, codes, node, top, _i, _len, _ref2; - this.tab = o.indent; - top = o.level === LEVEL_TOP; - codes = []; - _ref2 = this.expressions; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - node = _ref2[_i]; - node = node.unwrapAll(); - node = node.unfoldSoak(o) || node; - if (node instanceof Block) { - codes.push(node.compileNode(o)); - } else if (top) { - node.front = true; - code = node.compile(o); - codes.push(node.isStatement(o) ? code : "" + this.tab + code + ";"); - } else { - codes.push(node.compile(o, LEVEL_LIST)); - } - } - if (top) { - if (this.spaced) { - return "\n" + (codes.join('\n\n')) + "\n"; - } else { - return codes.join('\n'); - } - } - code = codes.join(', ') || 'void 0'; - if (codes.length > 1 && o.level >= LEVEL_LIST) { - return "(" + code + ")"; - } else { - return code; - } - }; - - Block.prototype.compileRoot = function(o) { - var code, exp, i, prelude, preludeExps, rest; - o.indent = o.bare ? '' : TAB; - o.scope = new Scope(null, this, null); - o.level = LEVEL_TOP; - this.spaced = true; - prelude = ""; - if (!o.bare) { - preludeExps = (function() { - var _len, _ref2, _results; - _ref2 = this.expressions; - _results = []; - for (i = 0, _len = _ref2.length; i < _len; i++) { - exp = _ref2[i]; - if (!(exp.unwrap() instanceof Comment)) break; - _results.push(exp); - } - return _results; - }).call(this); - rest = this.expressions.slice(preludeExps.length); - this.expressions = preludeExps; - if (preludeExps.length) { - prelude = "" + (this.compileNode(merge(o, { - indent: '' - }))) + "\n"; - } - this.expressions = rest; - } - code = this.compileWithDeclarations(o); - if (o.bare) return code; - return "" + prelude + "(function() {\n" + code + "\n}).call(this);\n"; - }; - - Block.prototype.compileWithDeclarations = function(o) { - var assigns, code, declars, exp, i, post, rest, scope, spaced, _len, _ref2, _ref3, _ref4; - code = post = ''; - _ref2 = this.expressions; - for (i = 0, _len = _ref2.length; i < _len; i++) { - exp = _ref2[i]; - exp = exp.unwrap(); - if (!(exp instanceof Comment || exp instanceof Literal)) break; - } - o = merge(o, { - level: LEVEL_TOP - }); - if (i) { - rest = this.expressions.splice(i, 9e9); - _ref3 = [this.spaced, false], spaced = _ref3[0], this.spaced = _ref3[1]; - _ref4 = [this.compileNode(o), spaced], code = _ref4[0], this.spaced = _ref4[1]; - this.expressions = rest; - } - post = this.compileNode(o); - scope = o.scope; - if (scope.expressions === this) { - declars = o.scope.hasDeclarations(); - assigns = scope.hasAssignments; - if (declars || assigns) { - if (i) code += '\n'; - code += "" + this.tab + "var "; - if (declars) code += scope.declaredVariables().join(', '); - if (assigns) { - if (declars) code += ",\n" + (this.tab + TAB); - code += scope.assignedVariables().join(",\n" + (this.tab + TAB)); - } - code += ';\n'; - } - } - return code + post; - }; - - Block.wrap = function(nodes) { - if (nodes.length === 1 && nodes[0] instanceof Block) return nodes[0]; - return new Block(nodes); - }; - - return Block; - - })(Base); - - exports.Literal = Literal = (function(_super) { - - __extends(Literal, _super); - - function Literal(value) { - this.value = value; - } - - Literal.prototype.makeReturn = function() { - if (this.isStatement()) { - return this; - } else { - return Literal.__super__.makeReturn.apply(this, arguments); - } - }; - - Literal.prototype.isAssignable = function() { - return IDENTIFIER.test(this.value); - }; - - Literal.prototype.isStatement = function() { - var _ref2; - return (_ref2 = this.value) === 'break' || _ref2 === 'continue' || _ref2 === 'debugger'; - }; - - Literal.prototype.isComplex = NO; - - Literal.prototype.assigns = function(name) { - return name === this.value; - }; - - Literal.prototype.jumps = function(o) { - if (this.value === 'break' && !((o != null ? o.loop : void 0) || (o != null ? o.block : void 0))) { - return this; - } - if (this.value === 'continue' && !(o != null ? o.loop : void 0)) return this; - }; - - Literal.prototype.compileNode = function(o) { - var code, _ref2, _ref3; - code = this.isUndefined ? o.level >= LEVEL_ACCESS ? '(void 0)' : 'void 0' : this.value === 'this' ? ((_ref2 = o.scope.method) != null ? _ref2.bound : void 0) ? o.scope.method.context : this.value : this.value.reserved && ((_ref3 = "" + this.value) !== 'eval' && _ref3 !== 'arguments') ? "\"" + this.value + "\"" : this.value; - if (this.isStatement()) { - return "" + this.tab + code + ";"; - } else { - return code; - } - }; - - Literal.prototype.toString = function() { - return ' "' + this.value + '"'; - }; - - return Literal; - - })(Base); - - exports.Return = Return = (function(_super) { - - __extends(Return, _super); - - function Return(expr) { - if (expr && !expr.unwrap().isUndefined) this.expression = expr; - } - - Return.prototype.children = ['expression']; - - Return.prototype.isStatement = YES; - - Return.prototype.makeReturn = THIS; - - Return.prototype.jumps = THIS; - - Return.prototype.compile = function(o, level) { - var expr, _ref2; - expr = (_ref2 = this.expression) != null ? _ref2.makeReturn() : void 0; - if (expr && !(expr instanceof Return)) { - return expr.compile(o, level); - } else { - return Return.__super__.compile.call(this, o, level); - } - }; - - Return.prototype.compileNode = function(o) { - return this.tab + ("return" + [this.expression ? " " + (this.expression.compile(o, LEVEL_PAREN)) : void 0] + ";"); - }; - - return Return; - - })(Base); - - exports.Value = Value = (function(_super) { - - __extends(Value, _super); - - function Value(base, props, tag) { - if (!props && base instanceof Value) return base; - this.base = base; - this.properties = props || []; - if (tag) this[tag] = true; - return this; - } - - Value.prototype.children = ['base', 'properties']; - - Value.prototype.add = function(props) { - this.properties = this.properties.concat(props); - return this; - }; - - Value.prototype.hasProperties = function() { - return !!this.properties.length; - }; - - Value.prototype.isArray = function() { - return !this.properties.length && this.base instanceof Arr; - }; - - Value.prototype.isComplex = function() { - return this.hasProperties() || this.base.isComplex(); - }; - - Value.prototype.isAssignable = function() { - return this.hasProperties() || this.base.isAssignable(); - }; - - Value.prototype.isSimpleNumber = function() { - return this.base instanceof Literal && SIMPLENUM.test(this.base.value); - }; - - Value.prototype.isAtomic = function() { - var node, _i, _len, _ref2; - _ref2 = this.properties.concat(this.base); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - node = _ref2[_i]; - if (node.soak || node instanceof Call) return false; - } - return true; - }; - - Value.prototype.isStatement = function(o) { - return !this.properties.length && this.base.isStatement(o); - }; - - Value.prototype.assigns = function(name) { - return !this.properties.length && this.base.assigns(name); - }; - - Value.prototype.jumps = function(o) { - return !this.properties.length && this.base.jumps(o); - }; - - Value.prototype.isObject = function(onlyGenerated) { - if (this.properties.length) return false; - return (this.base instanceof Obj) && (!onlyGenerated || this.base.generated); - }; - - Value.prototype.isSplice = function() { - return last(this.properties) instanceof Slice; - }; - - Value.prototype.unwrap = function() { - if (this.properties.length) { - return this; - } else { - return this.base; - } - }; - - Value.prototype.cacheReference = function(o) { - var base, bref, name, nref; - name = last(this.properties); - if (this.properties.length < 2 && !this.base.isComplex() && !(name != null ? name.isComplex() : void 0)) { - return [this, this]; - } - base = new Value(this.base, this.properties.slice(0, -1)); - if (base.isComplex()) { - bref = new Literal(o.scope.freeVariable('base')); - base = new Value(new Parens(new Assign(bref, base))); - } - if (!name) return [base, bref]; - if (name.isComplex()) { - nref = new Literal(o.scope.freeVariable('name')); - name = new Index(new Assign(nref, name.index)); - nref = new Index(nref); - } - return [base.add(name), new Value(bref || base.base, [nref || name])]; - }; - - Value.prototype.compileNode = function(o) { - var code, prop, props, _i, _len; - this.base.front = this.front; - props = this.properties; - code = this.base.compile(o, props.length ? LEVEL_ACCESS : null); - if ((this.base instanceof Parens || props.length) && SIMPLENUM.test(code)) { - code = "" + code + "."; - } - for (_i = 0, _len = props.length; _i < _len; _i++) { - prop = props[_i]; - code += prop.compile(o); - } - return code; - }; - - Value.prototype.unfoldSoak = function(o) { - var result, - _this = this; - if (this.unfoldedSoak != null) return this.unfoldedSoak; - result = (function() { - var fst, i, ifn, prop, ref, snd, _len, _ref2; - if (ifn = _this.base.unfoldSoak(o)) { - Array.prototype.push.apply(ifn.body.properties, _this.properties); - return ifn; - } - _ref2 = _this.properties; - for (i = 0, _len = _ref2.length; i < _len; i++) { - prop = _ref2[i]; - if (!prop.soak) continue; - prop.soak = false; - fst = new Value(_this.base, _this.properties.slice(0, i)); - snd = new Value(_this.base, _this.properties.slice(i)); - if (fst.isComplex()) { - ref = new Literal(o.scope.freeVariable('ref')); - fst = new Parens(new Assign(ref, fst)); - snd.base = ref; - } - return new If(new Existence(fst), snd, { - soak: true - }); - } - return null; - })(); - return this.unfoldedSoak = result || false; - }; - - return Value; - - })(Base); - - exports.Comment = Comment = (function(_super) { - - __extends(Comment, _super); - - function Comment(comment) { - this.comment = comment; - } - - Comment.prototype.isStatement = YES; - - Comment.prototype.makeReturn = THIS; - - Comment.prototype.compileNode = function(o, level) { - var code; - code = '/*' + multident(this.comment, this.tab) + ("\n" + this.tab + "*/"); - if ((level || o.level) === LEVEL_TOP) code = o.indent + code; - return code; - }; - - return Comment; - - })(Base); - - exports.Call = Call = (function(_super) { - - __extends(Call, _super); - - function Call(variable, args, soak) { - this.args = args != null ? args : []; - this.soak = soak; - this.isNew = false; - this.isSuper = variable === 'super'; - this.variable = this.isSuper ? null : variable; - } - - Call.prototype.children = ['variable', 'args']; - - Call.prototype.newInstance = function() { - var base, _ref2; - base = ((_ref2 = this.variable) != null ? _ref2.base : void 0) || this.variable; - if (base instanceof Call && !base.isNew) { - base.newInstance(); - } else { - this.isNew = true; - } - return this; - }; - - Call.prototype.superReference = function(o) { - var accesses, method, name; - method = o.scope.method; - if (!method) throw SyntaxError('cannot call super outside of a function.'); - name = method.name; - if (name == null) { - throw SyntaxError('cannot call super on an anonymous function.'); - } - if (method.klass) { - accesses = [new Access(new Literal('__super__'))]; - if (method.static) accesses.push(new Access(new Literal('constructor'))); - accesses.push(new Access(new Literal(name))); - return (new Value(new Literal(method.klass), accesses)).compile(o); - } else { - return "" + name + ".__super__.constructor"; - } - }; - - Call.prototype.unfoldSoak = function(o) { - var call, ifn, left, list, rite, _i, _len, _ref2, _ref3; - if (this.soak) { - if (this.variable) { - if (ifn = unfoldSoak(o, this, 'variable')) return ifn; - _ref2 = new Value(this.variable).cacheReference(o), left = _ref2[0], rite = _ref2[1]; - } else { - left = new Literal(this.superReference(o)); - rite = new Value(left); - } - rite = new Call(rite, this.args); - rite.isNew = this.isNew; - left = new Literal("typeof " + (left.compile(o)) + " === \"function\""); - return new If(left, new Value(rite), { - soak: true - }); - } - call = this; - list = []; - while (true) { - if (call.variable instanceof Call) { - list.push(call); - call = call.variable; - continue; - } - if (!(call.variable instanceof Value)) break; - list.push(call); - if (!((call = call.variable.base) instanceof Call)) break; - } - _ref3 = list.reverse(); - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - call = _ref3[_i]; - if (ifn) { - if (call.variable instanceof Call) { - call.variable = ifn; - } else { - call.variable.base = ifn; - } - } - ifn = unfoldSoak(o, call, 'variable'); - } - return ifn; - }; - - Call.prototype.filterImplicitObjects = function(list) { - var node, nodes, obj, prop, properties, _i, _j, _len, _len2, _ref2; - nodes = []; - for (_i = 0, _len = list.length; _i < _len; _i++) { - node = list[_i]; - if (!((typeof node.isObject === "function" ? node.isObject() : void 0) && node.base.generated)) { - nodes.push(node); - continue; - } - obj = null; - _ref2 = node.base.properties; - for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { - prop = _ref2[_j]; - if (prop instanceof Assign || prop instanceof Comment) { - if (!obj) nodes.push(obj = new Obj(properties = [], true)); - properties.push(prop); - } else { - nodes.push(prop); - obj = null; - } - } - } - return nodes; - }; - - Call.prototype.compileNode = function(o) { - var arg, args, code, _ref2; - if ((_ref2 = this.variable) != null) _ref2.front = this.front; - if (code = Splat.compileSplattedArray(o, this.args, true)) { - return this.compileSplat(o, code); - } - args = this.filterImplicitObjects(this.args); - args = ((function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = args.length; _i < _len; _i++) { - arg = args[_i]; - _results.push(arg.compile(o, LEVEL_LIST)); - } - return _results; - })()).join(', '); - if (this.isSuper) { - return this.superReference(o) + (".call(this" + (args && ', ' + args) + ")"); - } else { - return (this.isNew ? 'new ' : '') + this.variable.compile(o, LEVEL_ACCESS) + ("(" + args + ")"); - } - }; - - Call.prototype.compileSuper = function(args, o) { - return "" + (this.superReference(o)) + ".call(this" + (args.length ? ', ' : '') + args + ")"; - }; - - Call.prototype.compileSplat = function(o, splatArgs) { - var base, fun, idt, name, ref; - if (this.isSuper) { - return "" + (this.superReference(o)) + ".apply(this, " + splatArgs + ")"; - } - if (this.isNew) { - idt = this.tab + TAB; - return "(function(func, args, ctor) {\n" + idt + "ctor.prototype = func.prototype;\n" + idt + "var child = new ctor, result = func.apply(child, args);\n" + idt + "return typeof result === \"object\" ? result : child;\n" + this.tab + "})(" + (this.variable.compile(o, LEVEL_LIST)) + ", " + splatArgs + ", function() {})"; - } - base = new Value(this.variable); - if ((name = base.properties.pop()) && base.isComplex()) { - ref = o.scope.freeVariable('ref'); - fun = "(" + ref + " = " + (base.compile(o, LEVEL_LIST)) + ")" + (name.compile(o)); - } else { - fun = base.compile(o, LEVEL_ACCESS); - if (SIMPLENUM.test(fun)) fun = "(" + fun + ")"; - if (name) { - ref = fun; - fun += name.compile(o); - } else { - ref = 'null'; - } - } - return "" + fun + ".apply(" + ref + ", " + splatArgs + ")"; - }; - - return Call; - - })(Base); - - exports.Extends = Extends = (function(_super) { - - __extends(Extends, _super); - - function Extends(child, parent) { - this.child = child; - this.parent = parent; - } - - Extends.prototype.children = ['child', 'parent']; - - Extends.prototype.compile = function(o) { - return new Call(new Value(new Literal(utility('extends'))), [this.child, this.parent]).compile(o); - }; - - return Extends; - - })(Base); - - exports.Access = Access = (function(_super) { - - __extends(Access, _super); - - function Access(name, tag) { - this.name = name; - this.name.asKey = true; - this.soak = tag === 'soak'; - } - - Access.prototype.children = ['name']; - - Access.prototype.compile = function(o) { - var name; - name = this.name.compile(o); - if (IDENTIFIER.test(name)) { - return "." + name; - } else { - return "[" + name + "]"; - } - }; - - Access.prototype.isComplex = NO; - - return Access; - - })(Base); - - exports.Index = Index = (function(_super) { - - __extends(Index, _super); - - function Index(index) { - this.index = index; - } - - Index.prototype.children = ['index']; - - Index.prototype.compile = function(o) { - return "[" + (this.index.compile(o, LEVEL_PAREN)) + "]"; - }; - - Index.prototype.isComplex = function() { - return this.index.isComplex(); - }; - - return Index; - - })(Base); - - exports.Range = Range = (function(_super) { - - __extends(Range, _super); - - Range.prototype.children = ['from', 'to']; - - function Range(from, to, tag) { - this.from = from; - this.to = to; - this.exclusive = tag === 'exclusive'; - this.equals = this.exclusive ? '' : '='; - } - - Range.prototype.compileVariables = function(o) { - var step, _ref2, _ref3, _ref4, _ref5; - o = merge(o, { - top: true - }); - _ref2 = this.from.cache(o, LEVEL_LIST), this.fromC = _ref2[0], this.fromVar = _ref2[1]; - _ref3 = this.to.cache(o, LEVEL_LIST), this.toC = _ref3[0], this.toVar = _ref3[1]; - if (step = del(o, 'step')) { - _ref4 = step.cache(o, LEVEL_LIST), this.step = _ref4[0], this.stepVar = _ref4[1]; - } - _ref5 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)], this.fromNum = _ref5[0], this.toNum = _ref5[1]; - if (this.stepVar) return this.stepNum = this.stepVar.match(SIMPLENUM); - }; - - Range.prototype.compileNode = function(o) { - var cond, condPart, from, gt, idx, known, lt, stepPart, to, varPart, _ref2, _ref3; - if (!this.fromVar) this.compileVariables(o); - if (!o.index) return this.compileArray(o); - known = this.fromNum && this.toNum; - idx = del(o, 'index'); - varPart = "" + idx + " = " + this.fromC; - if (this.toC !== this.toVar) varPart += ", " + this.toC; - if (this.step !== this.stepVar) varPart += ", " + this.step; - _ref2 = ["" + idx + " <" + this.equals, "" + idx + " >" + this.equals], lt = _ref2[0], gt = _ref2[1]; - condPart = this.stepNum ? +this.stepNum > 0 ? "" + lt + " " + this.toVar : "" + gt + " " + this.toVar : known ? ((_ref3 = [+this.fromNum, +this.toNum], from = _ref3[0], to = _ref3[1], _ref3), from <= to ? "" + lt + " " + to : "" + gt + " " + to) : (cond = "" + this.fromVar + " <= " + this.toVar, "" + cond + " ? " + lt + " " + this.toVar + " : " + gt + " " + this.toVar); - stepPart = this.stepVar ? "" + idx + " += " + this.stepVar : known ? from <= to ? "" + idx + "++" : "" + idx + "--" : "" + cond + " ? " + idx + "++ : " + idx + "--"; - return "" + varPart + "; " + condPart + "; " + stepPart; - }; - - Range.prototype.compileArray = function(o) { - var args, body, cond, hasArgs, i, idt, post, pre, range, result, vars, _i, _ref2, _ref3, _results; - if (this.fromNum && this.toNum && Math.abs(this.fromNum - this.toNum) <= 20) { - range = (function() { - _results = []; - for (var _i = _ref2 = +this.fromNum, _ref3 = +this.toNum; _ref2 <= _ref3 ? _i <= _ref3 : _i >= _ref3; _ref2 <= _ref3 ? _i++ : _i--){ _results.push(_i); } - return _results; - }).apply(this); - if (this.exclusive) range.pop(); - return "[" + (range.join(', ')) + "]"; - } - idt = this.tab + TAB; - i = o.scope.freeVariable('i'); - result = o.scope.freeVariable('results'); - pre = "\n" + idt + result + " = [];"; - if (this.fromNum && this.toNum) { - o.index = i; - body = this.compileNode(o); - } else { - vars = ("" + i + " = " + this.fromC) + (this.toC !== this.toVar ? ", " + this.toC : ''); - cond = "" + this.fromVar + " <= " + this.toVar; - body = "var " + vars + "; " + cond + " ? " + i + " <" + this.equals + " " + this.toVar + " : " + i + " >" + this.equals + " " + this.toVar + "; " + cond + " ? " + i + "++ : " + i + "--"; - } - post = "{ " + result + ".push(" + i + "); }\n" + idt + "return " + result + ";\n" + o.indent; - hasArgs = function(node) { - return node != null ? node.contains(function(n) { - return n instanceof Literal && n.value === 'arguments' && !n.asKey; - }) : void 0; - }; - if (hasArgs(this.from) || hasArgs(this.to)) args = ', arguments'; - return "(function() {" + pre + "\n" + idt + "for (" + body + ")" + post + "}).apply(this" + (args != null ? args : '') + ")"; - }; - - return Range; - - })(Base); - - exports.Slice = Slice = (function(_super) { - - __extends(Slice, _super); - - Slice.prototype.children = ['range']; - - function Slice(range) { - this.range = range; - Slice.__super__.constructor.call(this); - } - - Slice.prototype.compileNode = function(o) { - var compiled, from, fromStr, to, toStr, _ref2; - _ref2 = this.range, to = _ref2.to, from = _ref2.from; - fromStr = from && from.compile(o, LEVEL_PAREN) || '0'; - compiled = to && to.compile(o, LEVEL_ACCESS); - if (to && !(!this.range.exclusive && +compiled === -1)) { - toStr = ', ' + (this.range.exclusive ? compiled : SIMPLENUM.test(compiled) ? (+compiled + 1).toString() : "" + compiled + " + 1 || 9e9"); - } - return ".slice(" + fromStr + (toStr || '') + ")"; - }; - - return Slice; - - })(Base); - - exports.Obj = Obj = (function(_super) { - - __extends(Obj, _super); - - function Obj(props, generated) { - this.generated = generated != null ? generated : false; - this.objects = this.properties = props || []; - } - - Obj.prototype.children = ['properties']; - - Obj.prototype.compileNode = function(o) { - var i, idt, indent, join, lastNoncom, node, obj, prop, props, _i, _len; - props = this.properties; - if (!props.length) return (this.front ? '({})' : '{}'); - if (this.generated) { - for (_i = 0, _len = props.length; _i < _len; _i++) { - node = props[_i]; - if (node instanceof Value) { - throw new Error('cannot have an implicit value in an implicit object'); - } - } - } - idt = o.indent += TAB; - lastNoncom = this.lastNonComment(this.properties); - props = (function() { - var _len2, _results; - _results = []; - for (i = 0, _len2 = props.length; i < _len2; i++) { - prop = props[i]; - join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n'; - indent = prop instanceof Comment ? '' : idt; - if (prop instanceof Value && prop["this"]) { - prop = new Assign(prop.properties[0].name, prop, 'object'); - } - if (!(prop instanceof Comment)) { - if (!(prop instanceof Assign)) prop = new Assign(prop, prop, 'object'); - (prop.variable.base || prop.variable).asKey = true; - } - _results.push(indent + prop.compile(o, LEVEL_TOP) + join); - } - return _results; - })(); - props = props.join(''); - obj = "{" + (props && '\n' + props + '\n' + this.tab) + "}"; - if (this.front) { - return "(" + obj + ")"; - } else { - return obj; - } - }; - - Obj.prototype.assigns = function(name) { - var prop, _i, _len, _ref2; - _ref2 = this.properties; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - prop = _ref2[_i]; - if (prop.assigns(name)) return true; - } - return false; - }; - - return Obj; - - })(Base); - - exports.Arr = Arr = (function(_super) { - - __extends(Arr, _super); - - function Arr(objs) { - this.objects = objs || []; - } - - Arr.prototype.children = ['objects']; - - Arr.prototype.filterImplicitObjects = Call.prototype.filterImplicitObjects; - - Arr.prototype.compileNode = function(o) { - var code, obj, objs; - if (!this.objects.length) return '[]'; - o.indent += TAB; - objs = this.filterImplicitObjects(this.objects); - if (code = Splat.compileSplattedArray(o, objs)) return code; - code = ((function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = objs.length; _i < _len; _i++) { - obj = objs[_i]; - _results.push(obj.compile(o, LEVEL_LIST)); - } - return _results; - })()).join(', '); - if (code.indexOf('\n') >= 0) { - return "[\n" + o.indent + code + "\n" + this.tab + "]"; - } else { - return "[" + code + "]"; - } - }; - - Arr.prototype.assigns = function(name) { - var obj, _i, _len, _ref2; - _ref2 = this.objects; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - obj = _ref2[_i]; - if (obj.assigns(name)) return true; - } - return false; - }; - - return Arr; - - })(Base); - - exports.Class = Class = (function(_super) { - - __extends(Class, _super); - - function Class(variable, parent, body) { - this.variable = variable; - this.parent = parent; - this.body = body != null ? body : new Block; - this.boundFuncs = []; - this.body.classBody = true; - } - - Class.prototype.children = ['variable', 'parent', 'body']; - - Class.prototype.determineName = function() { - var decl, tail; - if (!this.variable) return null; - decl = (tail = last(this.variable.properties)) ? tail instanceof Access && tail.name.value : this.variable.base.value; - return decl && (decl = IDENTIFIER.test(decl) && decl); - }; - - Class.prototype.setContext = function(name) { - return this.body.traverseChildren(false, function(node) { - if (node.classBody) return false; - if (node instanceof Literal && node.value === 'this') { - return node.value = name; - } else if (node instanceof Code) { - node.klass = name; - if (node.bound) return node.context = name; - } - }); - }; - - Class.prototype.addBoundFunctions = function(o) { - var bvar, lhs, _i, _len, _ref2, _results; - if (this.boundFuncs.length) { - _ref2 = this.boundFuncs; - _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - bvar = _ref2[_i]; - lhs = (new Value(new Literal("this"), [new Access(bvar)])).compile(o); - _results.push(this.ctor.body.unshift(new Literal("" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)"))); - } - return _results; - } - }; - - Class.prototype.addProperties = function(node, name, o) { - var assign, base, exprs, func, props; - props = node.base.properties.slice(0); - exprs = (function() { - var _results; - _results = []; - while (assign = props.shift()) { - if (assign instanceof Assign) { - base = assign.variable.base; - delete assign.context; - func = assign.value; - if (base.value === 'constructor') { - if (this.ctor) { - throw new Error('cannot define more than one constructor in a class'); - } - if (func.bound) { - throw new Error('cannot define a constructor as a bound function'); - } - if (func instanceof Code) { - assign = this.ctor = func; - } else { - this.externalCtor = o.scope.freeVariable('class'); - assign = new Assign(new Literal(this.externalCtor), func); - } - } else { - if (assign.variable["this"]) { - func.static = true; - if (func.bound) func.context = name; - } else { - assign.variable = new Value(new Literal(name), [new Access(new Literal('prototype')), new Access(base)]); - if (func instanceof Code && func.bound) { - this.boundFuncs.push(base); - func.bound = false; - } - } - } - } - _results.push(assign); - } - return _results; - }).call(this); - return compact(exprs); - }; - - Class.prototype.walkBody = function(name, o) { - var _this = this; - return this.traverseChildren(false, function(child) { - var exps, i, node, _len, _ref2; - if (child instanceof Class) return false; - if (child instanceof Block) { - _ref2 = exps = child.expressions; - for (i = 0, _len = _ref2.length; i < _len; i++) { - node = _ref2[i]; - if (node instanceof Value && node.isObject(true)) { - exps[i] = _this.addProperties(node, name, o); - } - } - return child.expressions = exps = flatten(exps); - } - }); - }; - - Class.prototype.ensureConstructor = function(name) { - if (!this.ctor) { - this.ctor = new Code; - if (this.parent) { - this.ctor.body.push(new Literal("" + name + ".__super__.constructor.apply(this, arguments)")); - } - if (this.externalCtor) { - this.ctor.body.push(new Literal("" + this.externalCtor + ".apply(this, arguments)")); - } - this.body.expressions.unshift(this.ctor); - } - this.ctor.ctor = this.ctor.name = name; - this.ctor.klass = null; - return this.ctor.noReturn = true; - }; - - Class.prototype.compileNode = function(o) { - var call, decl, klass, lname, name; - decl = this.determineName(); - name = decl || this.name || '_Class'; - if (name.reserved) name = "_" + name; - lname = new Literal(name); - this.setContext(name); - this.walkBody(name, o); - this.ensureConstructor(name); - this.body.spaced = true; - if (!(this.ctor instanceof Code)) this.body.expressions.unshift(this.ctor); - this.body.expressions.push(lname); - this.addBoundFunctions(o); - call = Closure.wrap(this.body); - if (this.parent) { - this.superClass = new Literal(o.scope.freeVariable('super', false)); - this.body.expressions.unshift(new Extends(lname, this.superClass)); - call.args.push(this.parent); - call.variable.params.push(new Param(this.superClass)); - } - klass = new Parens(call, true); - if (this.variable) klass = new Assign(this.variable, klass); - return klass.compile(o); - }; - - return Class; - - })(Base); - - exports.Assign = Assign = (function(_super) { - - __extends(Assign, _super); - - function Assign(variable, value, context, options) { - this.variable = variable; - this.value = value; - this.context = context; - this.param = options && options.param; - this.subpattern = options && options.subpattern; - } - - Assign.prototype.children = ['variable', 'value']; - - Assign.prototype.isStatement = function(o) { - return (o != null ? o.level : void 0) === LEVEL_TOP && (this.context != null) && __indexOf.call(this.context, "?") >= 0; - }; - - Assign.prototype.assigns = function(name) { - return this[this.context === 'object' ? 'value' : 'variable'].assigns(name); - }; - - Assign.prototype.unfoldSoak = function(o) { - return unfoldSoak(o, this, 'variable'); - }; - - Assign.prototype.compileNode = function(o) { - var isValue, match, name, val, varBase, _ref2, _ref3, _ref4, _ref5; - if (isValue = this.variable instanceof Value) { - if (this.variable.isArray() || this.variable.isObject()) { - return this.compilePatternMatch(o); - } - if (this.variable.isSplice()) return this.compileSplice(o); - if ((_ref2 = this.context) === '||=' || _ref2 === '&&=' || _ref2 === '?=') { - return this.compileConditional(o); - } - } - name = this.variable.compile(o, LEVEL_LIST); - if (!this.context) { - if (!(varBase = this.variable.unwrapAll()).isAssignable()) { - throw SyntaxError("\"" + (this.variable.compile(o)) + "\" cannot be assigned."); - } - if (!(typeof varBase.hasProperties === "function" ? varBase.hasProperties() : void 0)) { - if (this.param) { - o.scope.add(name, 'var'); - } else { - o.scope.find(name); - } - } - } - if (this.value instanceof Code && (match = METHOD_DEF.exec(name))) { - if (match[1]) this.value.klass = match[1]; - this.value.name = (_ref3 = (_ref4 = (_ref5 = match[2]) != null ? _ref5 : match[3]) != null ? _ref4 : match[4]) != null ? _ref3 : match[5]; - } - val = this.value.compile(o, LEVEL_LIST); - if (this.context === 'object') return "" + name + ": " + val; - val = name + (" " + (this.context || '=') + " ") + val; - if (o.level <= LEVEL_LIST) { - return val; - } else { - return "(" + val + ")"; - } - }; - - Assign.prototype.compilePatternMatch = function(o) { - var acc, assigns, code, i, idx, isObject, ivar, name, obj, objects, olen, ref, rest, splat, top, val, value, vvar, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8; - top = o.level === LEVEL_TOP; - value = this.value; - objects = this.variable.base.objects; - if (!(olen = objects.length)) { - code = value.compile(o); - if (o.level >= LEVEL_OP) { - return "(" + code + ")"; - } else { - return code; - } - } - isObject = this.variable.isObject(); - if (top && olen === 1 && !((obj = objects[0]) instanceof Splat)) { - if (obj instanceof Assign) { - _ref2 = obj, (_ref3 = _ref2.variable, idx = _ref3.base), obj = _ref2.value; - } else { - if (obj.base instanceof Parens) { - _ref4 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref4[0], idx = _ref4[1]; - } else { - idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(0); - } - } - acc = IDENTIFIER.test(idx.unwrap().value || 0); - value = new Value(value); - value.properties.push(new (acc ? Access : Index)(idx)); - if (_ref5 = obj.unwrap().value, __indexOf.call(['arguments', 'eval'].concat(RESERVED), _ref5) >= 0) { - throw new SyntaxError("assignment to a reserved word: " + (obj.compile(o)) + " = " + (value.compile(o))); - } - return new Assign(obj, value, null, { - param: this.param - }).compile(o, LEVEL_TOP); - } - vvar = value.compile(o, LEVEL_LIST); - assigns = []; - splat = false; - if (!IDENTIFIER.test(vvar) || this.variable.assigns(vvar)) { - assigns.push("" + (ref = o.scope.freeVariable('ref')) + " = " + vvar); - vvar = ref; - } - for (i = 0, _len = objects.length; i < _len; i++) { - obj = objects[i]; - idx = i; - if (isObject) { - if (obj instanceof Assign) { - _ref6 = obj, (_ref7 = _ref6.variable, idx = _ref7.base), obj = _ref6.value; - } else { - if (obj.base instanceof Parens) { - _ref8 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref8[0], idx = _ref8[1]; - } else { - idx = obj["this"] ? obj.properties[0].name : obj; - } - } - } - if (!splat && obj instanceof Splat) { - name = obj.name.unwrap().value; - obj = obj.unwrap(); - val = "" + olen + " <= " + vvar + ".length ? " + (utility('slice')) + ".call(" + vvar + ", " + i; - if (rest = olen - i - 1) { - ivar = o.scope.freeVariable('i'); - val += ", " + ivar + " = " + vvar + ".length - " + rest + ") : (" + ivar + " = " + i + ", [])"; - } else { - val += ") : []"; - } - val = new Literal(val); - splat = "" + ivar + "++"; - } else { - name = obj.unwrap().value; - if (obj instanceof Splat) { - obj = obj.name.compile(o); - throw new SyntaxError("multiple splats are disallowed in an assignment: " + obj + "..."); - } - if (typeof idx === 'number') { - idx = new Literal(splat || idx); - acc = false; - } else { - acc = isObject && IDENTIFIER.test(idx.unwrap().value || 0); - } - val = new Value(new Literal(vvar), [new (acc ? Access : Index)(idx)]); - } - if ((name != null) && __indexOf.call(['arguments', 'eval'].concat(RESERVED), name) >= 0) { - throw new SyntaxError("assignment to a reserved word: " + (obj.compile(o)) + " = " + (val.compile(o))); - } - assigns.push(new Assign(obj, val, null, { - param: this.param, - subpattern: true - }).compile(o, LEVEL_LIST)); - } - if (!(top || this.subpattern)) assigns.push(vvar); - code = assigns.join(', '); - if (o.level < LEVEL_LIST) { - return code; - } else { - return "(" + code + ")"; - } - }; - - Assign.prototype.compileConditional = function(o) { - var left, rite, _ref2; - _ref2 = this.variable.cacheReference(o), left = _ref2[0], rite = _ref2[1]; - if (__indexOf.call(this.context, "?") >= 0) o.isExistentialEquals = true; - return new Op(this.context.slice(0, -1), left, new Assign(rite, this.value, '=')).compile(o); - }; - - Assign.prototype.compileSplice = function(o) { - var code, exclusive, from, fromDecl, fromRef, name, to, valDef, valRef, _ref2, _ref3, _ref4; - _ref2 = this.variable.properties.pop().range, from = _ref2.from, to = _ref2.to, exclusive = _ref2.exclusive; - name = this.variable.compile(o); - _ref3 = (from != null ? from.cache(o, LEVEL_OP) : void 0) || ['0', '0'], fromDecl = _ref3[0], fromRef = _ref3[1]; - if (to) { - if ((from != null ? from.isSimpleNumber() : void 0) && to.isSimpleNumber()) { - to = +to.compile(o) - +fromRef; - if (!exclusive) to += 1; - } else { - to = to.compile(o, LEVEL_ACCESS) + ' - ' + fromRef; - if (!exclusive) to += ' + 1'; - } - } else { - to = "9e9"; - } - _ref4 = this.value.cache(o, LEVEL_LIST), valDef = _ref4[0], valRef = _ref4[1]; - code = "[].splice.apply(" + name + ", [" + fromDecl + ", " + to + "].concat(" + valDef + ")), " + valRef; - if (o.level > LEVEL_TOP) { - return "(" + code + ")"; - } else { - return code; - } - }; - - return Assign; - - })(Base); - - exports.Code = Code = (function(_super) { - - __extends(Code, _super); - - function Code(params, body, tag) { - this.params = params || []; - this.body = body || new Block; - this.bound = tag === 'boundfunc'; - if (this.bound) this.context = '_this'; - } - - Code.prototype.children = ['params', 'body']; - - Code.prototype.isStatement = function() { - return !!this.ctor; - }; - - Code.prototype.jumps = NO; - - Code.prototype.compileNode = function(o) { - var code, exprs, i, idt, lit, p, param, ref, splats, v, val, vars, wasEmpty, _i, _j, _k, _len, _len2, _len3, _len4, _ref2, _ref3, _ref4, _ref5, _ref6; - o.scope = new Scope(o.scope, this.body, this); - o.scope.shared = del(o, 'sharedScope'); - o.indent += TAB; - delete o.bare; - vars = []; - exprs = []; - _ref2 = this.params; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - param = _ref2[_i]; - if (!param.splat) continue; - _ref3 = this.params; - for (_j = 0, _len2 = _ref3.length; _j < _len2; _j++) { - p = _ref3[_j]; - if (p.name.value) o.scope.add(p.name.value, 'var', true); - } - splats = new Assign(new Value(new Arr((function() { - var _k, _len3, _ref4, _results; - _ref4 = this.params; - _results = []; - for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) { - p = _ref4[_k]; - _results.push(p.asReference(o)); - } - return _results; - }).call(this))), new Value(new Literal('arguments'))); - break; - } - _ref4 = this.params; - for (_k = 0, _len3 = _ref4.length; _k < _len3; _k++) { - param = _ref4[_k]; - if (param.isComplex()) { - val = ref = param.asReference(o); - if (param.value) val = new Op('?', ref, param.value); - exprs.push(new Assign(new Value(param.name), val, '=', { - param: true - })); - } else { - ref = param; - if (param.value) { - lit = new Literal(ref.name.value + ' == null'); - val = new Assign(new Value(param.name), param.value, '='); - exprs.push(new If(lit, val)); - } - } - if (!splats) vars.push(ref); - } - wasEmpty = this.body.isEmpty(); - if (splats) exprs.unshift(splats); - if (exprs.length) { - (_ref5 = this.body.expressions).unshift.apply(_ref5, exprs); - } - if (!splats) { - for (i = 0, _len4 = vars.length; i < _len4; i++) { - v = vars[i]; - o.scope.parameter(vars[i] = v.compile(o)); - } - } - if (!(wasEmpty || this.noReturn)) this.body.makeReturn(); - if (this.bound) { - if ((_ref6 = o.scope.parent.method) != null ? _ref6.bound : void 0) { - this.bound = this.context = o.scope.parent.method.context; - } else if (!this.static) { - o.scope.parent.assign('_this', 'this'); - } - } - idt = o.indent; - code = 'function'; - if (this.ctor) code += ' ' + this.name; - code += '(' + vars.join(', ') + ') {'; - if (!this.body.isEmpty()) { - code += "\n" + (this.body.compileWithDeclarations(o)) + "\n" + this.tab; - } - code += '}'; - if (this.ctor) return this.tab + code; - if (this.front || (o.level >= LEVEL_ACCESS)) { - return "(" + code + ")"; - } else { - return code; - } - }; - - Code.prototype.traverseChildren = function(crossScope, func) { - if (crossScope) { - return Code.__super__.traverseChildren.call(this, crossScope, func); - } - }; - - return Code; - - })(Base); - - exports.Param = Param = (function(_super) { - - __extends(Param, _super); - - function Param(name, value, splat) { - this.name = name; - this.value = value; - this.splat = splat; - } - - Param.prototype.children = ['name', 'value']; - - Param.prototype.compile = function(o) { - return this.name.compile(o, LEVEL_LIST); - }; - - Param.prototype.asReference = function(o) { - var node; - if (this.reference) return this.reference; - node = this.name; - if (node["this"]) { - node = node.properties[0].name; - if (node.value.reserved) node = new Literal('_' + node.value); - } else if (node.isComplex()) { - node = new Literal(o.scope.freeVariable('arg')); - } - node = new Value(node); - if (this.splat) node = new Splat(node); - return this.reference = node; - }; - - Param.prototype.isComplex = function() { - return this.name.isComplex(); - }; - - return Param; - - })(Base); - - exports.Splat = Splat = (function(_super) { - - __extends(Splat, _super); - - Splat.prototype.children = ['name']; - - Splat.prototype.isAssignable = YES; - - function Splat(name) { - this.name = name.compile ? name : new Literal(name); - } - - Splat.prototype.assigns = function(name) { - return this.name.assigns(name); - }; - - Splat.prototype.compile = function(o) { - if (this.index != null) { - return this.compileParam(o); - } else { - return this.name.compile(o); - } - }; - - Splat.prototype.unwrap = function() { - return this.name; - }; - - Splat.compileSplattedArray = function(o, list, apply) { - var args, base, code, i, index, node, _len; - index = -1; - while ((node = list[++index]) && !(node instanceof Splat)) { - continue; - } - if (index >= list.length) return ''; - if (list.length === 1) { - code = list[0].compile(o, LEVEL_LIST); - if (apply) return code; - return "" + (utility('slice')) + ".call(" + code + ")"; - } - args = list.slice(index); - for (i = 0, _len = args.length; i < _len; i++) { - node = args[i]; - code = node.compile(o, LEVEL_LIST); - args[i] = node instanceof Splat ? "" + (utility('slice')) + ".call(" + code + ")" : "[" + code + "]"; - } - if (index === 0) { - return args[0] + (".concat(" + (args.slice(1).join(', ')) + ")"); - } - base = (function() { - var _i, _len2, _ref2, _results; - _ref2 = list.slice(0, index); - _results = []; - for (_i = 0, _len2 = _ref2.length; _i < _len2; _i++) { - node = _ref2[_i]; - _results.push(node.compile(o, LEVEL_LIST)); - } - return _results; - })(); - return "[" + (base.join(', ')) + "].concat(" + (args.join(', ')) + ")"; - }; - - return Splat; - - })(Base); - - exports.While = While = (function(_super) { - - __extends(While, _super); - - function While(condition, options) { - this.condition = (options != null ? options.invert : void 0) ? condition.invert() : condition; - this.guard = options != null ? options.guard : void 0; - } - - While.prototype.children = ['condition', 'guard', 'body']; - - While.prototype.isStatement = YES; - - While.prototype.makeReturn = function(res) { - if (res) { - return While.__super__.makeReturn.apply(this, arguments); - } else { - this.returns = !this.jumps({ - loop: true - }); - return this; - } - }; - - While.prototype.addBody = function(body) { - this.body = body; - return this; - }; - - While.prototype.jumps = function() { - var expressions, node, _i, _len; - expressions = this.body.expressions; - if (!expressions.length) return false; - for (_i = 0, _len = expressions.length; _i < _len; _i++) { - node = expressions[_i]; - if (node.jumps({ - loop: true - })) return node; - } - return false; - }; - - While.prototype.compileNode = function(o) { - var body, code, rvar, set; - o.indent += TAB; - set = ''; - body = this.body; - if (body.isEmpty()) { - body = ''; - } else { - if (this.returns) { - body.makeReturn(rvar = o.scope.freeVariable('results')); - set = "" + this.tab + rvar + " = [];\n"; - } - if (this.guard) { - if (body.expressions.length > 1) { - body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue"))); - } else { - if (this.guard) body = Block.wrap([new If(this.guard, body)]); - } - } - body = "\n" + (body.compile(o, LEVEL_TOP)) + "\n" + this.tab; - } - code = set + this.tab + ("while (" + (this.condition.compile(o, LEVEL_PAREN)) + ") {" + body + "}"); - if (this.returns) code += "\n" + this.tab + "return " + rvar + ";"; - return code; - }; - - return While; - - })(Base); - - exports.Op = Op = (function(_super) { - var CONVERSIONS, INVERSIONS; - - __extends(Op, _super); - - function Op(op, first, second, flip) { - var call; - if (op === 'in') return new In(first, second); - if (op === 'do') { - call = new Call(first, first.params || []); - call["do"] = true; - return call; - } - if (op === 'new') { - if (first instanceof Call && !first["do"] && !first.isNew) { - return first.newInstance(); - } - if (first instanceof Code && first.bound || first["do"]) { - first = new Parens(first); - } - } - this.operator = CONVERSIONS[op] || op; - this.first = first; - this.second = second; - this.flip = !!flip; - return this; - } - - CONVERSIONS = { - '==': '===', - '!=': '!==', - 'of': 'in' - }; - - INVERSIONS = { - '!==': '===', - '===': '!==' - }; - - Op.prototype.children = ['first', 'second']; - - Op.prototype.isSimpleNumber = NO; - - Op.prototype.isUnary = function() { - return !this.second; - }; - - Op.prototype.isComplex = function() { - var _ref2; - return !(this.isUnary() && ((_ref2 = this.operator) === '+' || _ref2 === '-')) || this.first.isComplex(); - }; - - Op.prototype.isChainable = function() { - var _ref2; - return (_ref2 = this.operator) === '<' || _ref2 === '>' || _ref2 === '>=' || _ref2 === '<=' || _ref2 === '===' || _ref2 === '!=='; - }; - - Op.prototype.invert = function() { - var allInvertable, curr, fst, op, _ref2; - if (this.isChainable() && this.first.isChainable()) { - allInvertable = true; - curr = this; - while (curr && curr.operator) { - allInvertable && (allInvertable = curr.operator in INVERSIONS); - curr = curr.first; - } - if (!allInvertable) return new Parens(this).invert(); - curr = this; - while (curr && curr.operator) { - curr.invert = !curr.invert; - curr.operator = INVERSIONS[curr.operator]; - curr = curr.first; - } - return this; - } else if (op = INVERSIONS[this.operator]) { - this.operator = op; - if (this.first.unwrap() instanceof Op) this.first.invert(); - return this; - } else if (this.second) { - return new Parens(this).invert(); - } else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref2 = fst.operator) === '!' || _ref2 === 'in' || _ref2 === 'instanceof')) { - return fst; - } else { - return new Op('!', this); - } - }; - - Op.prototype.unfoldSoak = function(o) { - var _ref2; - return ((_ref2 = this.operator) === '++' || _ref2 === '--' || _ref2 === 'delete') && unfoldSoak(o, this, 'first'); - }; - - Op.prototype.compileNode = function(o) { - var code, isChain; - isChain = this.isChainable() && this.first.isChainable(); - if (!isChain) this.first.front = this.front; - if (this.isUnary()) return this.compileUnary(o); - if (isChain) return this.compileChain(o); - if (this.operator === '?') return this.compileExistence(o); - code = this.first.compile(o, LEVEL_OP) + ' ' + this.operator + ' ' + this.second.compile(o, LEVEL_OP); - if (o.level <= LEVEL_OP) { - return code; - } else { - return "(" + code + ")"; - } - }; - - Op.prototype.compileChain = function(o) { - var code, fst, shared, _ref2; - _ref2 = this.first.second.cache(o), this.first.second = _ref2[0], shared = _ref2[1]; - fst = this.first.compile(o, LEVEL_OP); - code = "" + fst + " " + (this.invert ? '&&' : '||') + " " + (shared.compile(o)) + " " + this.operator + " " + (this.second.compile(o, LEVEL_OP)); - return "(" + code + ")"; - }; - - Op.prototype.compileExistence = function(o) { - var fst, ref; - if (this.first.isComplex() && o.level > LEVEL_TOP) { - ref = new Literal(o.scope.freeVariable('ref')); - fst = new Parens(new Assign(ref, this.first)); - } else { - fst = this.first; - ref = fst; - } - return new If(new Existence(fst), ref, { - type: 'if' - }).addElse(this.second).compile(o); - }; - - Op.prototype.compileUnary = function(o) { - var op, parts, plusMinus; - parts = [op = this.operator]; - plusMinus = op === '+' || op === '-'; - if ((op === 'new' || op === 'typeof' || op === 'delete') || plusMinus && this.first instanceof Op && this.first.operator === op) { - parts.push(' '); - } - if ((plusMinus && this.first instanceof Op) || (op === 'new' && this.first.isStatement(o))) { - this.first = new Parens(this.first); - } - parts.push(this.first.compile(o, LEVEL_OP)); - if (this.flip) parts.reverse(); - return parts.join(''); - }; - - Op.prototype.toString = function(idt) { - return Op.__super__.toString.call(this, idt, this.constructor.name + ' ' + this.operator); - }; - - return Op; - - })(Base); - - exports.In = In = (function(_super) { - - __extends(In, _super); - - function In(object, array) { - this.object = object; - this.array = array; - } - - In.prototype.children = ['object', 'array']; - - In.prototype.invert = NEGATE; - - In.prototype.compileNode = function(o) { - var hasSplat, obj, _i, _len, _ref2; - if (this.array instanceof Value && this.array.isArray()) { - _ref2 = this.array.base.objects; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - obj = _ref2[_i]; - if (!(obj instanceof Splat)) continue; - hasSplat = true; - break; - } - if (!hasSplat) return this.compileOrTest(o); - } - return this.compileLoopTest(o); - }; - - In.prototype.compileOrTest = function(o) { - var cmp, cnj, i, item, ref, sub, tests, _ref2, _ref3; - if (this.array.base.objects.length === 0) return "" + (!!this.negated); - _ref2 = this.object.cache(o, LEVEL_OP), sub = _ref2[0], ref = _ref2[1]; - _ref3 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref3[0], cnj = _ref3[1]; - tests = (function() { - var _len, _ref4, _results; - _ref4 = this.array.base.objects; - _results = []; - for (i = 0, _len = _ref4.length; i < _len; i++) { - item = _ref4[i]; - _results.push((i ? ref : sub) + cmp + item.compile(o, LEVEL_ACCESS)); - } - return _results; - }).call(this); - tests = tests.join(cnj); - if (o.level < LEVEL_OP) { - return tests; - } else { - return "(" + tests + ")"; - } - }; - - In.prototype.compileLoopTest = function(o) { - var code, ref, sub, _ref2; - _ref2 = this.object.cache(o, LEVEL_LIST), sub = _ref2[0], ref = _ref2[1]; - code = utility('indexOf') + (".call(" + (this.array.compile(o, LEVEL_LIST)) + ", " + ref + ") ") + (this.negated ? '< 0' : '>= 0'); - if (sub === ref) return code; - code = sub + ', ' + code; - if (o.level < LEVEL_LIST) { - return code; - } else { - return "(" + code + ")"; - } - }; - - In.prototype.toString = function(idt) { - return In.__super__.toString.call(this, idt, this.constructor.name + (this.negated ? '!' : '')); - }; - - return In; - - })(Base); - - exports.Try = Try = (function(_super) { - - __extends(Try, _super); - - function Try(attempt, error, recovery, ensure) { - this.attempt = attempt; - this.error = error; - this.recovery = recovery; - this.ensure = ensure; - } - - Try.prototype.children = ['attempt', 'recovery', 'ensure']; - - Try.prototype.isStatement = YES; - - Try.prototype.jumps = function(o) { - var _ref2; - return this.attempt.jumps(o) || ((_ref2 = this.recovery) != null ? _ref2.jumps(o) : void 0); - }; - - Try.prototype.makeReturn = function(res) { - if (this.attempt) this.attempt = this.attempt.makeReturn(res); - if (this.recovery) this.recovery = this.recovery.makeReturn(res); - return this; - }; - - Try.prototype.compileNode = function(o) { - var catchPart, ensurePart, errorPart, tryPart; - o.indent += TAB; - errorPart = this.error ? " (" + (this.error.compile(o)) + ") " : ' '; - tryPart = this.attempt.compile(o, LEVEL_TOP); - catchPart = this.recovery ? (!o.scope.check(this.error.value) ? o.scope.add(this.error.value, 'param') : void 0, " catch" + errorPart + "{\n" + (this.recovery.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}") : !(this.ensure || this.recovery) ? ' catch (_error) {}' : void 0; - ensurePart = this.ensure ? " finally {\n" + (this.ensure.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}" : ''; - return "" + this.tab + "try {\n" + tryPart + "\n" + this.tab + "}" + (catchPart || '') + ensurePart; - }; - - return Try; - - })(Base); - - exports.Throw = Throw = (function(_super) { - - __extends(Throw, _super); - - function Throw(expression) { - this.expression = expression; - } - - Throw.prototype.children = ['expression']; - - Throw.prototype.isStatement = YES; - - Throw.prototype.jumps = NO; - - Throw.prototype.makeReturn = THIS; - - Throw.prototype.compileNode = function(o) { - return this.tab + ("throw " + (this.expression.compile(o)) + ";"); - }; - - return Throw; - - })(Base); - - exports.Existence = Existence = (function(_super) { - - __extends(Existence, _super); - - function Existence(expression) { - this.expression = expression; - } - - Existence.prototype.children = ['expression']; - - Existence.prototype.invert = NEGATE; - - Existence.prototype.compileNode = function(o) { - var cmp, cnj, code, _ref2; - this.expression.front = this.front; - code = this.expression.compile(o, LEVEL_OP); - if (IDENTIFIER.test(code) && !o.scope.check(code)) { - _ref2 = this.negated ? ['===', '||'] : ['!==', '&&'], cmp = _ref2[0], cnj = _ref2[1]; - code = "typeof " + code + " " + cmp + " \"undefined\" " + cnj + " " + code + " " + cmp + " null"; - } else { - code = "" + code + " " + (this.negated ? '==' : '!=') + " null"; - } - if (o.level <= LEVEL_COND) { - return code; - } else { - return "(" + code + ")"; - } - }; - - return Existence; - - })(Base); - - exports.Parens = Parens = (function(_super) { - - __extends(Parens, _super); - - function Parens(body) { - this.body = body; - } - - Parens.prototype.children = ['body']; - - Parens.prototype.unwrap = function() { - return this.body; - }; - - Parens.prototype.isComplex = function() { - return this.body.isComplex(); - }; - - Parens.prototype.compileNode = function(o) { - var bare, code, expr; - expr = this.body.unwrap(); - if (expr instanceof Value && expr.isAtomic()) { - expr.front = this.front; - return expr.compile(o); - } - code = expr.compile(o, LEVEL_PAREN); - bare = o.level < LEVEL_OP && (expr instanceof Op || expr instanceof Call || (expr instanceof For && expr.returns)); - if (bare) { - return code; - } else { - return "(" + code + ")"; - } - }; - - return Parens; - - })(Base); - - exports.For = For = (function(_super) { - - __extends(For, _super); - - function For(body, source) { - var _ref2; - this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index; - this.body = Block.wrap([body]); - this.own = !!source.own; - this.object = !!source.object; - if (this.object) { - _ref2 = [this.index, this.name], this.name = _ref2[0], this.index = _ref2[1]; - } - if (this.index instanceof Value) { - throw SyntaxError('index cannot be a pattern matching expression'); - } - this.range = this.source instanceof Value && this.source.base instanceof Range && !this.source.properties.length; - this.pattern = this.name instanceof Value; - if (this.range && this.index) { - throw SyntaxError('indexes do not apply to range loops'); - } - if (this.range && this.pattern) { - throw SyntaxError('cannot pattern match over range loops'); - } - this.returns = false; - } - - For.prototype.children = ['body', 'source', 'guard', 'step']; - - For.prototype.compileNode = function(o) { - var body, defPart, forPart, forVarPart, guardPart, idt1, index, ivar, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, stepPart, stepvar, svar, varPart, _ref2; - body = Block.wrap([this.body]); - lastJumps = (_ref2 = last(body.expressions)) != null ? _ref2.jumps() : void 0; - if (lastJumps && lastJumps instanceof Return) this.returns = false; - source = this.range ? this.source.base : this.source; - scope = o.scope; - name = this.name && this.name.compile(o, LEVEL_LIST); - index = this.index && this.index.compile(o, LEVEL_LIST); - if (name && !this.pattern) { - scope.find(name, { - immediate: true - }); - } - if (index) { - scope.find(index, { - immediate: true - }); - } - if (this.returns) rvar = scope.freeVariable('results'); - ivar = (this.range ? name : index) || scope.freeVariable('i'); - if (this.step && !this.range) stepvar = scope.freeVariable("step"); - if (this.pattern) name = ivar; - varPart = ''; - guardPart = ''; - defPart = ''; - idt1 = this.tab + TAB; - if (this.range) { - forPart = source.compile(merge(o, { - index: ivar, - step: this.step - })); - } else { - svar = this.source.compile(o, LEVEL_LIST); - if ((name || this.own) && !IDENTIFIER.test(svar)) { - defPart = "" + this.tab + (ref = scope.freeVariable('ref')) + " = " + svar + ";\n"; - svar = ref; - } - if (name && !this.pattern) { - namePart = "" + name + " = " + svar + "[" + ivar + "]"; - } - if (!this.object) { - lvar = scope.freeVariable('len'); - forVarPart = ("" + ivar + " = 0, " + lvar + " = " + svar + ".length") + (this.step ? ", " + stepvar + " = " + (this.step.compile(o, LEVEL_OP)) : ''); - stepPart = this.step ? "" + ivar + " += " + stepvar : "" + ivar + "++"; - forPart = "" + forVarPart + "; " + ivar + " < " + lvar + "; " + stepPart; - } - } - if (this.returns) { - resultPart = "" + this.tab + rvar + " = [];\n"; - returnResult = "\n" + this.tab + "return " + rvar + ";"; - body.makeReturn(rvar); - } - if (this.guard) { - if (body.expressions.length > 1) { - body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue"))); - } else { - if (this.guard) body = Block.wrap([new If(this.guard, body)]); - } - } - if (this.pattern) { - body.expressions.unshift(new Assign(this.name, new Literal("" + svar + "[" + ivar + "]"))); - } - defPart += this.pluckDirectCall(o, body); - if (namePart) varPart = "\n" + idt1 + namePart + ";"; - if (this.object) { - forPart = "" + ivar + " in " + svar; - if (this.own) { - guardPart = "\n" + idt1 + "if (!" + (utility('hasProp')) + ".call(" + svar + ", " + ivar + ")) continue;"; - } - } - body = body.compile(merge(o, { - indent: idt1 - }), LEVEL_TOP); - if (body) body = '\n' + body + '\n'; - return "" + defPart + (resultPart || '') + this.tab + "for (" + forPart + ") {" + guardPart + varPart + body + this.tab + "}" + (returnResult || ''); - }; - - For.prototype.pluckDirectCall = function(o, body) { - var base, defs, expr, fn, idx, ref, val, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; - defs = ''; - _ref2 = body.expressions; - for (idx = 0, _len = _ref2.length; idx < _len; idx++) { - expr = _ref2[idx]; - expr = expr.unwrapAll(); - if (!(expr instanceof Call)) continue; - val = expr.variable.unwrapAll(); - if (!((val instanceof Code) || (val instanceof Value && ((_ref3 = val.base) != null ? _ref3.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref4 = (_ref5 = val.properties[0].name) != null ? _ref5.value : void 0) === 'call' || _ref4 === 'apply')))) { - continue; - } - fn = ((_ref6 = val.base) != null ? _ref6.unwrapAll() : void 0) || val; - ref = new Literal(o.scope.freeVariable('fn')); - base = new Value(ref); - if (val.base) _ref7 = [base, val], val.base = _ref7[0], base = _ref7[1]; - body.expressions[idx] = new Call(base, expr.args); - defs += this.tab + new Assign(ref, fn).compile(o, LEVEL_TOP) + ';\n'; - } - return defs; - }; - - return For; - - })(While); - - exports.Switch = Switch = (function(_super) { - - __extends(Switch, _super); - - function Switch(subject, cases, otherwise) { - this.subject = subject; - this.cases = cases; - this.otherwise = otherwise; - } - - Switch.prototype.children = ['subject', 'cases', 'otherwise']; - - Switch.prototype.isStatement = YES; - - Switch.prototype.jumps = function(o) { - var block, conds, _i, _len, _ref2, _ref3, _ref4; - if (o == null) { - o = { - block: true - }; - } - _ref2 = this.cases; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - _ref3 = _ref2[_i], conds = _ref3[0], block = _ref3[1]; - if (block.jumps(o)) return block; - } - return (_ref4 = this.otherwise) != null ? _ref4.jumps(o) : void 0; - }; - - Switch.prototype.makeReturn = function(res) { - var pair, _i, _len, _ref2, _ref3; - _ref2 = this.cases; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - pair = _ref2[_i]; - pair[1].makeReturn(res); - } - if (res) { - this.otherwise || (this.otherwise = new Block([new Literal('void 0')])); - } - if ((_ref3 = this.otherwise) != null) _ref3.makeReturn(res); - return this; - }; - - Switch.prototype.compileNode = function(o) { - var block, body, code, cond, conditions, expr, i, idt1, idt2, _i, _len, _len2, _ref2, _ref3, _ref4, _ref5; - idt1 = o.indent + TAB; - idt2 = o.indent = idt1 + TAB; - code = this.tab + ("switch (" + (((_ref2 = this.subject) != null ? _ref2.compile(o, LEVEL_PAREN) : void 0) || false) + ") {\n"); - _ref3 = this.cases; - for (i = 0, _len = _ref3.length; i < _len; i++) { - _ref4 = _ref3[i], conditions = _ref4[0], block = _ref4[1]; - _ref5 = flatten([conditions]); - for (_i = 0, _len2 = _ref5.length; _i < _len2; _i++) { - cond = _ref5[_i]; - if (!this.subject) cond = cond.invert(); - code += idt1 + ("case " + (cond.compile(o, LEVEL_PAREN)) + ":\n"); - } - if (body = block.compile(o, LEVEL_TOP)) code += body + '\n'; - if (i === this.cases.length - 1 && !this.otherwise) break; - expr = this.lastNonComment(block.expressions); - if (expr instanceof Return || (expr instanceof Literal && expr.jumps() && expr.value !== 'debugger')) { - continue; - } - code += idt2 + 'break;\n'; - } - if (this.otherwise && this.otherwise.expressions.length) { - code += idt1 + ("default:\n" + (this.otherwise.compile(o, LEVEL_TOP)) + "\n"); - } - return code + this.tab + '}'; - }; - - return Switch; - - })(Base); - - exports.If = If = (function(_super) { - - __extends(If, _super); - - function If(condition, body, options) { - this.body = body; - if (options == null) options = {}; - this.condition = options.type === 'unless' ? condition.invert() : condition; - this.elseBody = null; - this.isChain = false; - this.soak = options.soak; - } - - If.prototype.children = ['condition', 'body', 'elseBody']; - - If.prototype.bodyNode = function() { - var _ref2; - return (_ref2 = this.body) != null ? _ref2.unwrap() : void 0; - }; - - If.prototype.elseBodyNode = function() { - var _ref2; - return (_ref2 = this.elseBody) != null ? _ref2.unwrap() : void 0; - }; - - If.prototype.addElse = function(elseBody) { - if (this.isChain) { - this.elseBodyNode().addElse(elseBody); - } else { - this.isChain = elseBody instanceof If; - this.elseBody = this.ensureBlock(elseBody); - } - return this; - }; - - If.prototype.isStatement = function(o) { - var _ref2; - return (o != null ? o.level : void 0) === LEVEL_TOP || this.bodyNode().isStatement(o) || ((_ref2 = this.elseBodyNode()) != null ? _ref2.isStatement(o) : void 0); - }; - - If.prototype.jumps = function(o) { - var _ref2; - return this.body.jumps(o) || ((_ref2 = this.elseBody) != null ? _ref2.jumps(o) : void 0); - }; - - If.prototype.compileNode = function(o) { - if (this.isStatement(o)) { - return this.compileStatement(o); - } else { - return this.compileExpression(o); - } - }; - - If.prototype.makeReturn = function(res) { - if (res) { - this.elseBody || (this.elseBody = new Block([new Literal('void 0')])); - } - this.body && (this.body = new Block([this.body.makeReturn(res)])); - this.elseBody && (this.elseBody = new Block([this.elseBody.makeReturn(res)])); - return this; - }; - - If.prototype.ensureBlock = function(node) { - if (node instanceof Block) { - return node; - } else { - return new Block([node]); - } - }; - - If.prototype.compileStatement = function(o) { - var body, bodyc, child, cond, exeq, ifPart, _ref2; - child = del(o, 'chainChild'); - exeq = del(o, 'isExistentialEquals'); - if (exeq) { - return new If(this.condition.invert(), this.elseBodyNode(), { - type: 'if' - }).compile(o); - } - cond = this.condition.compile(o, LEVEL_PAREN); - o.indent += TAB; - body = this.ensureBlock(this.body); - bodyc = body.compile(o); - if (1 === ((_ref2 = body.expressions) != null ? _ref2.length : void 0) && !this.elseBody && !child && bodyc && cond && -1 === (bodyc.indexOf('\n')) && 80 > cond.length + bodyc.length) { - return "" + this.tab + "if (" + cond + ") " + (bodyc.replace(/^\s+/, '')); - } - if (bodyc) bodyc = "\n" + bodyc + "\n" + this.tab; - ifPart = "if (" + cond + ") {" + bodyc + "}"; - if (!child) ifPart = this.tab + ifPart; - if (!this.elseBody) return ifPart; - return ifPart + ' else ' + (this.isChain ? (o.indent = this.tab, o.chainChild = true, this.elseBody.unwrap().compile(o, LEVEL_TOP)) : "{\n" + (this.elseBody.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}"); - }; - - If.prototype.compileExpression = function(o) { - var alt, body, code, cond; - cond = this.condition.compile(o, LEVEL_COND); - body = this.bodyNode().compile(o, LEVEL_LIST); - alt = this.elseBodyNode() ? this.elseBodyNode().compile(o, LEVEL_LIST) : 'void 0'; - code = "" + cond + " ? " + body + " : " + alt; - if (o.level >= LEVEL_COND) { - return "(" + code + ")"; - } else { - return code; - } - }; - - If.prototype.unfoldSoak = function() { - return this.soak && this; - }; - - return If; - - })(Base); - - Closure = { - wrap: function(expressions, statement, noReturn) { - var args, call, func, mentionsArgs, meth; - if (expressions.jumps()) return expressions; - func = new Code([], Block.wrap([expressions])); - args = []; - if ((mentionsArgs = expressions.contains(this.literalArgs)) || expressions.contains(this.literalThis)) { - meth = new Literal(mentionsArgs ? 'apply' : 'call'); - args = [new Literal('this')]; - if (mentionsArgs) args.push(new Literal('arguments')); - func = new Value(func, [new Access(meth)]); - } - func.noReturn = noReturn; - call = new Call(func, args); - if (statement) { - return Block.wrap([call]); - } else { - return call; - } - }, - literalArgs: function(node) { - return node instanceof Literal && node.value === 'arguments' && !node.asKey; - }, - literalThis: function(node) { - return (node instanceof Literal && node.value === 'this' && !node.asKey) || (node instanceof Code && node.bound); - } - }; - - unfoldSoak = function(o, parent, name) { - var ifn; - if (!(ifn = parent[name].unfoldSoak(o))) return; - parent[name] = ifn.body; - ifn.body = new Value(parent); - return ifn; - }; - - UTILITIES = { - "extends": function() { - return "function(child, parent) { for (var key in parent) { if (" + (utility('hasProp')) + ".call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }"; - }, - bind: function() { - return 'function(fn, me){ return function(){ return fn.apply(me, arguments); }; }'; - }, - indexOf: function() { - return "Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }"; - }, - hasProp: function() { - return 'Object.prototype.hasOwnProperty'; - }, - slice: function() { - return 'Array.prototype.slice'; - } - }; - - LEVEL_TOP = 1; - - LEVEL_PAREN = 2; - - LEVEL_LIST = 3; - - LEVEL_COND = 4; - - LEVEL_OP = 5; - - LEVEL_ACCESS = 6; - - TAB = ' '; - - IDENTIFIER_STR = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*"; - - IDENTIFIER = RegExp("^" + IDENTIFIER_STR + "$"); - - SIMPLENUM = /^[+-]?\d+$/; - - METHOD_DEF = RegExp("^(?:(" + IDENTIFIER_STR + ")\\.prototype(?:\\.(" + IDENTIFIER_STR + ")|\\[(\"(?:[^\\\\\"\\r\\n]|\\\\.)*\"|'(?:[^\\\\'\\r\\n]|\\\\.)*')\\]|\\[(0x[\\da-fA-F]+|\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\]))|(" + IDENTIFIER_STR + ")$"); - - IS_STRING = /^['"]/; - - utility = function(name) { - var ref; - ref = "__" + name; - Scope.root.assign(ref, UTILITIES[name]()); - return ref; - }; - - multident = function(code, tab) { - code = code.replace(/\n/g, '$&' + tab); - return code.replace(/\s+$/, ''); - }; - -}).call(this); - -};require['./coffee-script'] = new function() { - var exports = this; - (function() { - var Lexer, RESERVED, compile, fs, lexer, parser, path, vm, _ref, - __hasProp = Object.prototype.hasOwnProperty; - - fs = require('fs'); - - path = require('path'); - - _ref = require('./lexer'), Lexer = _ref.Lexer, RESERVED = _ref.RESERVED; - - parser = require('./parser').parser; - - vm = require('vm'); - - if (require.extensions) { - require.extensions['.coffee'] = function(module, filename) { - var content; - content = compile(fs.readFileSync(filename, 'utf8'), { - filename: filename - }); - return module._compile(content, filename); - }; - } else if (require.registerExtension) { - require.registerExtension('.coffee', function(content) { - return compile(content); - }); - } - - exports.VERSION = '1.2.0'; - - exports.RESERVED = RESERVED; - - exports.helpers = require('./helpers'); - - exports.compile = compile = function(code, options) { - var merge; - if (options == null) options = {}; - merge = exports.helpers.merge; - try { - return (parser.parse(lexer.tokenize(code))).compile(merge({}, options)); - } catch (err) { - if (options.filename) { - err.message = "In " + options.filename + ", " + err.message; - } - throw err; - } - }; - - exports.tokens = function(code, options) { - return lexer.tokenize(code, options); - }; - - exports.nodes = function(source, options) { - if (typeof source === 'string') { - return parser.parse(lexer.tokenize(source, options)); - } else { - return parser.parse(source); - } - }; - - exports.run = function(code, options) { - var mainModule; - mainModule = require.main; - mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.'; - mainModule.moduleCache && (mainModule.moduleCache = {}); - mainModule.paths = require('module')._nodeModulePaths(path.dirname(options.filename)); - if (path.extname(mainModule.filename) !== '.coffee' || require.extensions) { - return mainModule._compile(compile(code, options), mainModule.filename); - } else { - return mainModule._compile(code, mainModule.filename); - } - }; - - exports.eval = function(code, options) { - var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref2, _ref3, _require; - if (options == null) options = {}; - if (!(code = code.trim())) return; - Script = vm.Script; - if (Script) { - if (options.sandbox != null) { - if (options.sandbox instanceof Script.createContext().constructor) { - sandbox = options.sandbox; - } else { - sandbox = Script.createContext(); - _ref2 = options.sandbox; - for (k in _ref2) { - if (!__hasProp.call(_ref2, k)) continue; - v = _ref2[k]; - sandbox[k] = v; - } - } - sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox; - } else { - sandbox = global; - } - sandbox.__filename = options.filename || 'eval'; - sandbox.__dirname = path.dirname(sandbox.__filename); - if (!(sandbox !== global || sandbox.module || sandbox.require)) { - Module = require('module'); - sandbox.module = _module = new Module(options.modulename || 'eval'); - sandbox.require = _require = function(path) { - return Module._load(path, _module, true); - }; - _module.filename = sandbox.__filename; - _ref3 = Object.getOwnPropertyNames(require); - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - r = _ref3[_i]; - if (r !== 'paths') _require[r] = require[r]; - } - _require.paths = _module.paths = Module._nodeModulePaths(process.cwd()); - _require.resolve = function(request) { - return Module._resolveFilename(request, _module); - }; - } - } - o = {}; - for (k in options) { - if (!__hasProp.call(options, k)) continue; - v = options[k]; - o[k] = v; - } - o.bare = true; - js = compile(code, o); - if (sandbox === global) { - return vm.runInThisContext(js); - } else { - return vm.runInContext(js, sandbox); - } - }; - - lexer = new Lexer; - - parser.lexer = { - lex: function() { - var tag, _ref2; - _ref2 = this.tokens[this.pos++] || [''], tag = _ref2[0], this.yytext = _ref2[1], this.yylineno = _ref2[2]; - return tag; - }, - setInput: function(tokens) { - this.tokens = tokens; - return this.pos = 0; - }, - upcomingInput: function() { - return ""; - } - }; - - parser.yy = require('./nodes'); - -}).call(this); - -};require['./browser'] = new function() { - var exports = this; - (function() { - var CoffeeScript, runScripts; - - CoffeeScript = require('./coffee-script'); - - CoffeeScript.require = require; - - CoffeeScript.eval = function(code, options) { - return eval(CoffeeScript.compile(code, options)); - }; - - CoffeeScript.run = function(code, options) { - if (options == null) options = {}; - options.bare = true; - return Function(CoffeeScript.compile(code, options))(); - }; - - if (typeof window === "undefined" || window === null) return; - - CoffeeScript.load = function(url, callback) { - var xhr; - xhr = new (window.ActiveXObject || XMLHttpRequest)('Microsoft.XMLHTTP'); - xhr.open('GET', url, true); - if ('overrideMimeType' in xhr) xhr.overrideMimeType('text/plain'); - xhr.onreadystatechange = function() { - var _ref; - if (xhr.readyState === 4) { - if ((_ref = xhr.status) === 0 || _ref === 200) { - CoffeeScript.run(xhr.responseText); - } else { - throw new Error("Could not load " + url); - } - if (callback) return callback(); - } - }; - return xhr.send(null); - }; - - runScripts = function() { - var coffees, execute, index, length, s, scripts; - scripts = document.getElementsByTagName('script'); - coffees = (function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = scripts.length; _i < _len; _i++) { - s = scripts[_i]; - if (s.type === 'text/coffeescript') _results.push(s); - } - return _results; - })(); - index = 0; - length = coffees.length; - (execute = function() { - var script; - script = coffees[index++]; - if ((script != null ? script.type : void 0) === 'text/coffeescript') { - if (script.src) { - return CoffeeScript.load(script.src, execute); - } else { - CoffeeScript.run(script.innerHTML); - return execute(); - } - } - })(); - return null; - }; - - if (window.addEventListener) { - addEventListener('DOMContentLoaded', runScripts, false); - } else { - attachEvent('onload', runScripts); - } - -}).call(this); - -}; - return require['./coffee-script']; - }(); - - if (typeof define === 'function' && define.amd) { - // define[NOTE: Added so it doesn't match regex /define\(/](function() { return CoffeeScript; }); - } else { - root.CoffeeScript = CoffeeScript; - } -}(this)); diff --git a/vendor/jasmine-atom-reporter.js b/vendor/jasmine-atom-reporter.js deleted file mode 100644 index dd896b373..000000000 --- a/vendor/jasmine-atom-reporter.js +++ /dev/null @@ -1,190 +0,0 @@ -jasmine.AtomReporter = function(doc) { - this.document = doc || document; - this.suiteDivs = {}; - this.logRunningSpecs = false; -}; - -jasmine.AtomReporter.prototype.createDom = function(type, attrs, childrenVarArgs) { - var el = document.createElement(type); - - for (var i = 2; i < arguments.length; i++) { - var child = arguments[i]; - - if (typeof child === 'string') { - el.appendChild(document.createTextNode(child)); - } else { - if (child) { el.appendChild(child); } - } - } - - for (var attr in attrs) { - if (attr == "className") { - el[attr] = attrs[attr]; - } else { - el.setAttribute(attr, attrs[attr]); - } - } - - return el; -}; - -jasmine.AtomReporter.prototype.reportRunnerStarting = function(runner) { - var showPassed, showSkipped; - - this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' }, - this.createDom('div', { className: 'banner' }, - this.createDom('div', { className: 'logo' }, - this.createDom('span', { className: 'title' }, "Jasmine"), - this.createDom('span', { className: 'version' }, runner.env.versionString())), - this.createDom('div', { className: 'options' }, - "Show ", - showPassed = this.createDom('input', { id: "__jasmine_AtomReporter_showPassed__", type: 'checkbox' }), - this.createDom('label', { "for": "__jasmine_AtomReporter_showPassed__" }, " passed "), - showSkipped = this.createDom('input', { id: "__jasmine_AtomReporter_showSkipped__", type: 'checkbox' }), - this.createDom('label', { "for": "__jasmine_AtomReporter_showSkipped__" }, " skipped") - ) - ), - - this.runnerDiv = this.createDom('div', { className: 'runner running' }, - this.createDom('a', { className: 'run_spec', href: '?' }, "run all"), - this.runnerMessageSpan = this.createDom('span', {}, "Running..."), - this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, "")) - ); - - this.document.body.appendChild(this.outerDiv); - - var suites = runner.suites(); - for (var i = 0; i < suites.length; i++) { - var suite = suites[i]; - var suiteDiv = this.createDom('div', { className: 'suite' }, - this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"), - this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description)); - this.suiteDivs[suite.id] = suiteDiv; - var parentDiv = this.outerDiv; - if (suite.parentSuite) { - parentDiv = this.suiteDivs[suite.parentSuite.id]; - } - parentDiv.appendChild(suiteDiv); - } - - this.startedAt = new Date(); - - var self = this; - showPassed.onclick = function(evt) { - if (showPassed.checked) { - self.outerDiv.className += ' show-passed'; - } else { - self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, ''); - } - }; - - showSkipped.onclick = function(evt) { - if (showSkipped.checked) { - self.outerDiv.className += ' show-skipped'; - } else { - self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, ''); - } - }; -}; - -jasmine.AtomReporter.prototype.reportRunnerResults = function(runner) { - var results = runner.results(); - var className = (results.failedCount > 0) ? "runner failed" : "runner passed"; - this.runnerDiv.setAttribute("class", className); - //do it twice for IE - this.runnerDiv.setAttribute("className", className); - var specs = runner.specs(); - var specCount = 0; - for (var i = 0; i < specs.length; i++) { - if (this.specFilter(specs[i])) { - specCount++; - } - } - var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); - message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"; - this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild); - - this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString())); -}; - -jasmine.AtomReporter.prototype.reportSuiteResults = function(suite) { - var results = suite.results(); - var status = results.passed() ? 'passed' : 'failed'; - if (results.totalCount === 0) { // todo: change this to check results.skipped - status = 'skipped'; - } - this.suiteDivs[suite.id].className += " " + status; -}; - -jasmine.AtomReporter.prototype.reportSpecStarting = function(spec) { - if (this.logRunningSpecs) { - this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...'); - } -}; - -jasmine.AtomReporter.prototype.reportSpecResults = function(spec) { - var results = spec.results(); - var status = results.passed() ? 'passed' : 'failed'; - if (results.skipped) { - status = 'skipped'; - } - var specDiv = this.createDom('div', { className: 'spec ' + status }, - this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), - this.createDom('a', { - className: 'description', - href: '?spec=' + encodeURIComponent(spec.getFullName()), - title: spec.getFullName() - }, spec.description)); - - - var resultItems = results.getItems(); - var messagesDiv = this.createDom('div', { className: 'messages' }); - for (var i = 0; i < resultItems.length; i++) { - var result = resultItems[i]; - - if (result.type == 'log') { - messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString())); - } else if (result.type == 'expect' && result.passed && !result.passed()) { - messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message)); - - if (result.trace.stack) { - messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack)); - } - } - } - - if (messagesDiv.childNodes.length > 0) { - specDiv.appendChild(messagesDiv); - } - - this.suiteDivs[spec.suite.id].appendChild(specDiv); -}; - -jasmine.AtomReporter.prototype.log = function() { - var console = jasmine.getGlobal().console; - if (console && console.log) { - if (console.log.apply) { - console.log.apply(console, arguments); - } else { - console.log(arguments); // ie fix: console.log.apply doesn't exist on ie - } - } -}; - -jasmine.AtomReporter.prototype.getLocation = function() { - return this.document.location; -}; - -jasmine.AtomReporter.prototype.specFilter = function(spec) { - var paramMap = {}; - var params = this.getLocation().search.substring(1).split('&'); - for (var i = 0; i < params.length; i++) { - var p = params[i].split('='); - paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); - } - - if (!paramMap.spec) { - return true; - } - return spec.getFullName().indexOf(paramMap.spec) === 0; -}; diff --git a/vendor/jasmine-console-reporter.js b/vendor/jasmine-console-reporter.js deleted file mode 100644 index 302ec1477..000000000 --- a/vendor/jasmine-console-reporter.js +++ /dev/null @@ -1,47 +0,0 @@ -jasmine.ConsoleReporter = function(doc, logErrors) { - this.logErrors = logErrors == false ? false : true -}; - -jasmine.ConsoleReporter.prototype.reportRunnerStarting = function(runner) { - var showPassed, showSkipped; - var suites = runner.suites(); - this.startedAt = new Date(); -}; - -jasmine.ConsoleReporter.prototype.reportRunnerResults = function(runner) { - var results = runner.results(); - var specs = runner.specs(); - var specCount = specs.legnth; - var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); - message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"; - - $native.exit(results.failedCount > 0 ? 1 : 0) -}; - -jasmine.ConsoleReporter.prototype.reportSuiteResults = function(suite) { -}; - -jasmine.ConsoleReporter.prototype.reportSpecResults = function(spec) { - var results = spec.results(); - var status = results.passed() ? 'passed' : 'failed'; - if (results.skipped) { - status = 'skipped'; - } - var resultItems = results.getItems(); - for (var i = 0; i < resultItems.length; i++) { - var result = resultItems[i]; - if (this.logErrors && result.type == 'expect' && result.passed && !result.passed()) { - console.log("ERROR: " + spec.getFullName()) - if (result.trace.stack) { - console.log(result.trace.stack) - } - else { - console.log(result.message) - } - } - } -}; - -jasmine.ConsoleReporter.prototype.specFilter = function(spec) { - return true; -}; diff --git a/vendor/jasmine-focused.js b/vendor/jasmine-focused.js deleted file mode 100644 index c10b1b976..000000000 --- a/vendor/jasmine-focused.js +++ /dev/null @@ -1,63 +0,0 @@ -var setGlobalFocusPriority = function(priority) { - env = jasmine.getEnv(); - if (!env.focusPriority) env.focusPriority = 1; - if (priority > env.focusPriority) env.focusPriority = priority; -}; - -var fdescribe = function(description, specDefinitions, priority) { - if (!priority) priority = 1; - setGlobalFocusPriority(priority) - var suite = describe(description, specDefinitions); - suite.focusPriority = priority; - return suite; -}; - -var ffdescribe = function(description, specDefinitions) { - fdescribe(description, specDefinitions, 2); -}; - -var fffdescribe = function(description, specDefinitions) { - fdescribe(description, specDefinitions, 3); -}; - -var fit = function(description, definition, priority) { - if (!priority) priority = 1; - setGlobalFocusPriority(priority); - var spec = it(description, definition); - spec.focusPriority = priority; - return spec; -}; - -var ffit = function(description, specDefinitions) { - fit(description, specDefinitions, 2); -}; - -var fffit = function(description, specDefinitions) { - fit(description, specDefinitions, 3); -}; - -var fSpecFilter = function(specOrSuite) { - globalFocusPriority = jasmine.getEnv().focusPriority; - if (!globalFocusPriority) return true; - if (specOrSuite.focusPriority >= globalFocusPriority) return true; - - var parent = specOrSuite.parentSuite || specOrSuite.suite; - if (!parent) return false; - return fSpecFilter(parent); -} - -jasmine.AtomReporter.prototype.specFilter = function(spec) { - var paramMap = {}; - var params = this.getLocation().search.substring(1).split('&'); - for (var i = 0; i < params.length; i++) { - var p = params[i].split('='); - paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); - } - - if (!paramMap.spec && !jasmine.getEnv().focusPriority) { - return true; - } - - return (spec.getFullName().indexOf(paramMap.spec) === 0) || fSpecFilter(spec); -}; - diff --git a/vendor/jasmine-helper.coffee b/vendor/jasmine-helper.coffee deleted file mode 100644 index 9386fafbf..000000000 --- a/vendor/jasmine-helper.coffee +++ /dev/null @@ -1,22 +0,0 @@ -module.exports.runSpecSuite = (specSuite, logErrors=true) -> - {$$} = require 'space-pen' - nakedLoad 'jasmine' - nakedLoad 'jasmine-atom-reporter' - nakedLoad 'jasmine-console-reporter' - nakedLoad 'jasmine-focused' - - $ = require 'jquery' - - $('body').append $$ -> - @div id: 'jasmine-content' - - reporter = if atom.headless - new jasmine.ConsoleReporter(document, logErrors) - else - new jasmine.AtomReporter(document) - - require specSuite - jasmineEnv = jasmine.getEnv() - jasmineEnv.addReporter(reporter) - jasmineEnv.specFilter = (spec) -> reporter.specFilter(spec) - jasmineEnv.execute() diff --git a/vendor/jasmine-jquery.js b/vendor/jasmine-jquery.js deleted file mode 100644 index e1cafb895..000000000 --- a/vendor/jasmine-jquery.js +++ /dev/null @@ -1,177 +0,0 @@ -jQuery = require('jquery'); -jasmine.JQuery = function() {}; - -jasmine.JQuery.browserTagCaseIndependentHtml = function(html) { - return jQuery('
    ').append(html).html(); -}; - -jasmine.JQuery.elementToString = function(element) { - return jQuery('
    ').append(element.clone()).html(); -}; - -jasmine.JQuery.matchersClass = {}; - -(function(namespace) { - var data = { - spiedEvents: {}, - handlers: [] - }; - - namespace.events = { - spyOn: function(selector, eventName) { - var handler = function(e) { - data.spiedEvents[[selector, eventName]] = e; - }; - jQuery(selector).bind(eventName, handler); - data.handlers.push(handler); - }, - - wasTriggered: function(selector, eventName) { - return !!(data.spiedEvents[[selector, eventName]]); - }, - - cleanUp: function() { - data.spiedEvents = {}; - data.handlers = []; - } - } -})(jasmine.JQuery); - -(function(){ - var jQueryMatchers = { - toHaveClass: function(className) { - return this.actual.hasClass(className); - }, - - toBeVisible: function() { - return this.actual.is(':visible'); - }, - - toBeHidden: function() { - return this.actual.is(':hidden'); - }, - - toBeSelected: function() { - return this.actual.is(':selected'); - }, - - toBeChecked: function() { - return this.actual.is(':checked'); - }, - - toBeEmpty: function() { - return this.actual.is(':empty'); - }, - - toExist: function() { - return this.actual.size() > 0; - }, - - toHaveAttr: function(attributeName, expectedAttributeValue) { - return hasProperty(this.actual.attr(attributeName), expectedAttributeValue); - }, - - toHaveId: function(id) { - return this.actual.attr('id') == id; - }, - - toHaveHtml: function(html) { - return this.actual.html() == jasmine.JQuery.browserTagCaseIndependentHtml(html); - }, - - toHaveText: function(text) { - if (text && jQuery.isFunction(text.test)) { - return text.test(this.actual.text()); - } else { - return this.actual.text() == text; - } - }, - - toHaveValue: function(value) { - return this.actual.val() == value; - }, - - toHaveData: function(key, expectedValue) { - return hasProperty(this.actual.data(key), expectedValue); - }, - - toMatchSelector: function(selector) { - return this.actual.is(selector); - }, - - toContain: function(selector) { - return this.actual.find(selector).size() > 0; - }, - - toBeDisabled: function(selector){ - return this.actual.is(':disabled'); - }, - - // tests the existence of a specific event binding - toHandle: function(eventName) { - var events = this.actual.data("events"); - return events && events[eventName].length > 0; - }, - - // tests the existence of a specific event binding + handler - toHandleWith: function(eventName, eventHandler) { - var stack = this.actual.data("events")[eventName]; - var i; - for (i = 0; i < stack.length; i++) { - if (stack[i].handler == eventHandler) { - return true; - } - } - return false; - } - }; - - var hasProperty = function(actualValue, expectedValue) { - if (expectedValue === undefined) { - return actualValue !== undefined; - } - return actualValue == expectedValue; - }; - - var bindMatcher = function(methodName) { - var builtInMatcher = jasmine.Matchers.prototype[methodName]; - - jasmine.JQuery.matchersClass[methodName] = function() { - if (this.actual instanceof jQuery) { - var result = jQueryMatchers[methodName].apply(this, arguments); - this.actual = jasmine.JQuery.elementToString(this.actual); - return result; - } - - if (builtInMatcher) { - return builtInMatcher.apply(this, arguments); - } - - return false; - }; - }; - - for(var methodName in jQueryMatchers) { - bindMatcher(methodName); - } -})(); - -beforeEach(function() { - this.addMatchers(jasmine.JQuery.matchersClass); - this.addMatchers({ - toHaveBeenTriggeredOn: function(selector) { - this.message = function() { - return [ - "Expected event " + this.actual + " to have been triggered on" + selector, - "Expected event " + this.actual + " not to have been triggered on" + selector - ]; - }; - return jasmine.JQuery.events.wasTriggered(selector, this.actual); - } - }) -}); - -afterEach(function() { - jasmine.JQuery.events.cleanUp(); -}); - diff --git a/vendor/jasmine.js b/vendor/jasmine.js deleted file mode 100644 index 2a5b5ad58..000000000 --- a/vendor/jasmine.js +++ /dev/null @@ -1,2542 +0,0 @@ -// Modified line 1769 -// - if (self.blocks[self.index].abort) { -// + if (self.blocks[self.index] && self.blocks[self.index].abort) { - -var isCommonJS = typeof window == "undefined"; - -/** - * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework. - * - * @namespace - */ -var jasmine = {}; -if (isCommonJS) exports.jasmine = jasmine; -/** - * @private - */ -jasmine.unimplementedMethod_ = function() { - throw new Error("unimplemented method"); -}; - -/** - * Use jasmine.undefined instead of undefined, since undefined is just - * a plain old variable and may be redefined by somebody else. - * - * @private - */ -jasmine.undefined = jasmine.___undefined___; - -/** - * Show diagnostic messages in the console if set to true - * - */ -jasmine.VERBOSE = false; - -/** - * Default interval in milliseconds for event loop yields (e.g. to allow network activity or to refresh the screen with the HTML-based runner). Small values here may result in slow test running. Zero means no updates until all tests have completed. - * - */ -jasmine.DEFAULT_UPDATE_INTERVAL = 250; - -/** - * Default timeout interval in milliseconds for waitsFor() blocks. - */ -jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; - -jasmine.getGlobal = function() { - function getGlobal() { - return window; - } - - return getGlobal(); -}; - -/** - * Allows for bound functions to be compared. Internal use only. - * - * @ignore - * @private - * @param base {Object} bound 'this' for the function - * @param name {Function} function to find - */ -jasmine.bindOriginal_ = function(base, name) { - var original = base[name]; - if (original.apply) { - return function() { - return original.apply(base, arguments); - }; - } else { - // IE support - return jasmine.getGlobal()[name]; - } -}; - -jasmine.setTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'setTimeout'); -jasmine.clearTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearTimeout'); -jasmine.setInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'setInterval'); -jasmine.clearInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearInterval'); - -jasmine.MessageResult = function(values) { - this.type = 'log'; - this.values = values; - this.trace = new Error(); // todo: test better -}; - -jasmine.MessageResult.prototype.toString = function() { - var text = ""; - for (var i = 0; i < this.values.length; i++) { - if (i > 0) text += " "; - if (jasmine.isString_(this.values[i])) { - text += this.values[i]; - } else { - text += jasmine.pp(this.values[i]); - } - } - return text; -}; - -jasmine.ExpectationResult = function(params) { - this.type = 'expect'; - this.matcherName = params.matcherName; - this.passed_ = params.passed; - this.expected = params.expected; - this.actual = params.actual; - this.message = this.passed_ ? 'Passed.' : params.message; - - var trace = (params.trace || new Error(this.message)); - this.trace = this.passed_ ? '' : trace; -}; - -jasmine.ExpectationResult.prototype.toString = function () { - return this.message; -}; - -jasmine.ExpectationResult.prototype.passed = function () { - return this.passed_; -}; - -/** - * Getter for the Jasmine environment. Ensures one gets created - */ -jasmine.getEnv = function() { - var env = jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env(); - return env; -}; - -/** - * @ignore - * @private - * @param value - * @returns {Boolean} - */ -jasmine.isArray_ = function(value) { - return jasmine.isA_("Array", value); -}; - -/** - * @ignore - * @private - * @param value - * @returns {Boolean} - */ -jasmine.isString_ = function(value) { - return jasmine.isA_("String", value); -}; - -/** - * @ignore - * @private - * @param value - * @returns {Boolean} - */ -jasmine.isNumber_ = function(value) { - return jasmine.isA_("Number", value); -}; - -/** - * @ignore - * @private - * @param {String} typeName - * @param value - * @returns {Boolean} - */ -jasmine.isA_ = function(typeName, value) { - return Object.prototype.toString.apply(value) === '[object ' + typeName + ']'; -}; - -/** - * Pretty printer for expecations. Takes any object and turns it into a human-readable string. - * - * @param value {Object} an object to be outputted - * @returns {String} - */ -jasmine.pp = function(value) { - var stringPrettyPrinter = new jasmine.StringPrettyPrinter(); - stringPrettyPrinter.format(value); - return stringPrettyPrinter.string; -}; - -/** - * Returns true if the object is a DOM Node. - * - * @param {Object} obj object to check - * @returns {Boolean} - */ -jasmine.isDomNode = function(obj) { - return obj.nodeType > 0; -}; - -/** - * Returns a matchable 'generic' object of the class type. For use in expecations of type when values don't matter. - * - * @example - * // don't care about which function is passed in, as long as it's a function - * expect(mySpy).toHaveBeenCalledWith(jasmine.any(Function)); - * - * @param {Class} clazz - * @returns matchable object of the type clazz - */ -jasmine.any = function(clazz) { - return new jasmine.Matchers.Any(clazz); -}; - -/** - * Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks. - * - * Spies should be created in test setup, before expectations. They can then be checked, using the standard Jasmine - * expectation syntax. Spies can be checked if they were called or not and what the calling params were. - * - * A Spy has the following fields: wasCalled, callCount, mostRecentCall, and argsForCall (see docs). - * - * Spies are torn down at the end of every spec. - * - * Note: Do not call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj. - * - * @example - * // a stub - * var myStub = jasmine.createSpy('myStub'); // can be used anywhere - * - * // spy example - * var foo = { - * not: function(bool) { return !bool; } - * } - * - * // actual foo.not will not be called, execution stops - * spyOn(foo, 'not'); - - // foo.not spied upon, execution will continue to implementation - * spyOn(foo, 'not').andCallThrough(); - * - * // fake example - * var foo = { - * not: function(bool) { return !bool; } - * } - * - * // foo.not(val) will return val - * spyOn(foo, 'not').andCallFake(function(value) {return value;}); - * - * // mock example - * foo.not(7 == 7); - * expect(foo.not).toHaveBeenCalled(); - * expect(foo.not).toHaveBeenCalledWith(true); - * - * @constructor - * @see spyOn, jasmine.createSpy, jasmine.createSpyObj - * @param {String} name - */ -jasmine.Spy = function(name) { - /** - * The name of the spy, if provided. - */ - this.identity = name || 'unknown'; - /** - * Is this Object a spy? - */ - this.isSpy = true; - /** - * The actual function this spy stubs. - */ - this.plan = function() { - }; - /** - * Tracking of the most recent call to the spy. - * @example - * var mySpy = jasmine.createSpy('foo'); - * mySpy(1, 2); - * mySpy.mostRecentCall.args = [1, 2]; - */ - this.mostRecentCall = {}; - - /** - * Holds arguments for each call to the spy, indexed by call count - * @example - * var mySpy = jasmine.createSpy('foo'); - * mySpy(1, 2); - * mySpy(7, 8); - * mySpy.mostRecentCall.args = [7, 8]; - * mySpy.argsForCall[0] = [1, 2]; - * mySpy.argsForCall[1] = [7, 8]; - */ - this.argsForCall = []; - this.calls = []; -}; - -/** - * Tells a spy to call through to the actual implemenatation. - * - * @example - * var foo = { - * bar: function() { // do some stuff } - * } - * - * // defining a spy on an existing property: foo.bar - * spyOn(foo, 'bar').andCallThrough(); - */ -jasmine.Spy.prototype.andCallThrough = function() { - this.plan = this.originalValue; - return this; -}; - -/** - * For setting the return value of a spy. - * - * @example - * // defining a spy from scratch: foo() returns 'baz' - * var foo = jasmine.createSpy('spy on foo').andReturn('baz'); - * - * // defining a spy on an existing property: foo.bar() returns 'baz' - * spyOn(foo, 'bar').andReturn('baz'); - * - * @param {Object} value - */ -jasmine.Spy.prototype.andReturn = function(value) { - this.plan = function() { - return value; - }; - return this; -}; - -/** - * For throwing an exception when a spy is called. - * - * @example - * // defining a spy from scratch: foo() throws an exception w/ message 'ouch' - * var foo = jasmine.createSpy('spy on foo').andThrow('baz'); - * - * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch' - * spyOn(foo, 'bar').andThrow('baz'); - * - * @param {String} exceptionMsg - */ -jasmine.Spy.prototype.andThrow = function(exceptionMsg) { - this.plan = function() { - throw exceptionMsg; - }; - return this; -}; - -/** - * Calls an alternate implementation when a spy is called. - * - * @example - * var baz = function() { - * // do some stuff, return something - * } - * // defining a spy from scratch: foo() calls the function baz - * var foo = jasmine.createSpy('spy on foo').andCall(baz); - * - * // defining a spy on an existing property: foo.bar() calls an anonymnous function - * spyOn(foo, 'bar').andCall(function() { return 'baz';} ); - * - * @param {Function} fakeFunc - */ -jasmine.Spy.prototype.andCallFake = function(fakeFunc) { - this.plan = fakeFunc; - return this; -}; - -/** - * Resets all of a spy's the tracking variables so that it can be used again. - * - * @example - * spyOn(foo, 'bar'); - * - * foo.bar(); - * - * expect(foo.bar.callCount).toEqual(1); - * - * foo.bar.reset(); - * - * expect(foo.bar.callCount).toEqual(0); - */ -jasmine.Spy.prototype.reset = function() { - this.wasCalled = false; - this.callCount = 0; - this.argsForCall = []; - this.calls = []; - this.mostRecentCall = {}; -}; - -jasmine.createSpy = function(name) { - - var spyObj = function() { - spyObj.wasCalled = true; - spyObj.callCount++; - var args = jasmine.util.argsToArray(arguments); - spyObj.mostRecentCall.object = this; - spyObj.mostRecentCall.args = args; - spyObj.argsForCall.push(args); - spyObj.calls.push({object: this, args: args}); - return spyObj.plan.apply(this, arguments); - }; - - var spy = new jasmine.Spy(name); - - for (var prop in spy) { - spyObj[prop] = spy[prop]; - } - - spyObj.reset(); - - return spyObj; -}; - -/** - * Determines whether an object is a spy. - * - * @param {jasmine.Spy|Object} putativeSpy - * @returns {Boolean} - */ -jasmine.isSpy = function(putativeSpy) { - return putativeSpy && putativeSpy.isSpy; -}; - -/** - * Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something - * large in one call. - * - * @param {String} baseName name of spy class - * @param {Array} methodNames array of names of methods to make spies - */ -jasmine.createSpyObj = function(baseName, methodNames) { - if (!jasmine.isArray_(methodNames) || methodNames.length === 0) { - throw new Error('createSpyObj requires a non-empty array of method names to create spies for'); - } - var obj = {}; - for (var i = 0; i < methodNames.length; i++) { - obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]); - } - return obj; -}; - -/** - * All parameters are pretty-printed and concatenated together, then written to the current spec's output. - * - * Be careful not to leave calls to jasmine.log in production code. - */ -jasmine.log = function() { - var spec = jasmine.getEnv().currentSpec; - spec.log.apply(spec, arguments); -}; - -/** - * Function that installs a spy on an existing object's method name. Used within a Spec to create a spy. - * - * @example - * // spy example - * var foo = { - * not: function(bool) { return !bool; } - * } - * spyOn(foo, 'not'); // actual foo.not will not be called, execution stops - * - * @see jasmine.createSpy - * @param obj - * @param methodName - * @returns a Jasmine spy that can be chained with all spy methods - */ -var spyOn = function(obj, methodName) { - return jasmine.getEnv().currentSpec.spyOn(obj, methodName); -}; -if (isCommonJS) exports.spyOn = spyOn; - -/** - * Creates a Jasmine spec that will be added to the current suite. - * - * // TODO: pending tests - * - * @example - * it('should be true', function() { - * expect(true).toEqual(true); - * }); - * - * @param {String} desc description of this specification - * @param {Function} func defines the preconditions and expectations of the spec - */ -var it = function(desc, func) { - return jasmine.getEnv().it(desc, func); -}; -if (isCommonJS) exports.it = it; - -/** - * Creates a disabled Jasmine spec. - * - * A convenience method that allows existing specs to be disabled temporarily during development. - * - * @param {String} desc description of this specification - * @param {Function} func defines the preconditions and expectations of the spec - */ -var xit = function(desc, func) { - return jasmine.getEnv().xit(desc, func); -}; -if (isCommonJS) exports.xit = xit; - -/** - * Starts a chain for a Jasmine expectation. - * - * It is passed an Object that is the actual value and should chain to one of the many - * jasmine.Matchers functions. - * - * @param {Object} actual Actual value to test against and expected value - */ -var expect = function(actual) { - return jasmine.getEnv().currentSpec.expect(actual); -}; -if (isCommonJS) exports.expect = expect; - -/** - * Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs. - * - * @param {Function} func Function that defines part of a jasmine spec. - */ -var runs = function(func) { - jasmine.getEnv().currentSpec.runs(func); -}; -if (isCommonJS) exports.runs = runs; - -/** - * Waits a fixed time period before moving to the next block. - * - * @deprecated Use waitsFor() instead - * @param {Number} timeout milliseconds to wait - */ -var waits = function(timeout) { - jasmine.getEnv().currentSpec.waits(timeout); -}; -if (isCommonJS) exports.waits = waits; - -/** - * Waits for the latchFunction to return true before proceeding to the next block. - * - * @param {Function} latchFunction - * @param {String} optional_timeoutMessage - * @param {Number} optional_timeout - */ -var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { - jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments); -}; -if (isCommonJS) exports.waitsFor = waitsFor; - -/** - * A function that is called before each spec in a suite. - * - * Used for spec setup, including validating assumptions. - * - * @param {Function} beforeEachFunction - */ -var beforeEach = function(beforeEachFunction) { - jasmine.getEnv().beforeEach(beforeEachFunction); -}; -if (isCommonJS) exports.beforeEach = beforeEach; - -/** - * A function that is called after each spec in a suite. - * - * Used for restoring any state that is hijacked during spec execution. - * - * @param {Function} afterEachFunction - */ -var afterEach = function(afterEachFunction) { - jasmine.getEnv().afterEach(afterEachFunction); -}; -if (isCommonJS) exports.afterEach = afterEach; - -/** - * Defines a suite of specifications. - * - * Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared - * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization - * of setup in some tests. - * - * @example - * // TODO: a simple suite - * - * // TODO: a simple suite with a nested describe block - * - * @param {String} description A string, usually the class under test. - * @param {Function} specDefinitions function that defines several specs. - */ -var describe = function(description, specDefinitions) { - return jasmine.getEnv().describe(description, specDefinitions); -}; -if (isCommonJS) exports.describe = describe; - -/** - * Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development. - * - * @param {String} description A string, usually the class under test. - * @param {Function} specDefinitions function that defines several specs. - */ -var xdescribe = function(description, specDefinitions) { - return jasmine.getEnv().xdescribe(description, specDefinitions); -}; -if (isCommonJS) exports.xdescribe = xdescribe; - - -// Provide the XMLHttpRequest class for IE 5.x-6.x: -jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function() { - function tryIt(f) { - try { - return f(); - } catch(e) { - } - return null; - } - - var xhr = tryIt(function() { - return new ActiveXObject("Msxml2.XMLHTTP.6.0"); - }) || - tryIt(function() { - return new ActiveXObject("Msxml2.XMLHTTP.3.0"); - }) || - tryIt(function() { - return new ActiveXObject("Msxml2.XMLHTTP"); - }) || - tryIt(function() { - return new ActiveXObject("Microsoft.XMLHTTP"); - }); - - if (!xhr) throw new Error("This browser does not support XMLHttpRequest."); - - return xhr; -} : XMLHttpRequest; -/** - * @namespace - */ -jasmine.util = {}; - -/** - * Declare that a child class inherit it's prototype from the parent class. - * - * @private - * @param {Function} childClass - * @param {Function} parentClass - */ -jasmine.util.inherit = function(childClass, parentClass) { - /** - * @private - */ - var subclass = function() { - }; - subclass.prototype = parentClass.prototype; - childClass.prototype = new subclass(); -}; - -jasmine.util.formatException = function(e) { - var lineNumber; - if (e.line) { - lineNumber = e.line; - } - else if (e.lineNumber) { - lineNumber = e.lineNumber; - } - - var file; - - if (e.sourceURL) { - file = e.sourceURL; - } - else if (e.fileName) { - file = e.fileName; - } - - var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString(); - - if (file && lineNumber) { - message += ' in ' + file + ' (line ' + lineNumber + ')'; - } - - return message; -}; - -jasmine.util.htmlEscape = function(str) { - if (!str) return str; - return str.replace(/&/g, '&') - .replace(//g, '>'); -}; - -jasmine.util.argsToArray = function(args) { - var arrayOfArgs = []; - for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]); - return arrayOfArgs; -}; - -jasmine.util.extend = function(destination, source) { - for (var property in source) destination[property] = source[property]; - return destination; -}; - -/** - * Environment for Jasmine - * - * @constructor - */ -jasmine.Env = function() { - this.currentSpec = null; - this.currentSuite = null; - this.currentRunner_ = new jasmine.Runner(this); - - this.reporter = new jasmine.MultiReporter(); - - this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL; - this.defaultTimeoutInterval = jasmine.DEFAULT_TIMEOUT_INTERVAL; - this.lastUpdate = 0; - this.specFilter = function() { - return true; - }; - - this.nextSpecId_ = 0; - this.nextSuiteId_ = 0; - this.equalityTesters_ = []; - - // wrap matchers - this.matchersClass = function() { - jasmine.Matchers.apply(this, arguments); - }; - jasmine.util.inherit(this.matchersClass, jasmine.Matchers); - - jasmine.Matchers.wrapInto_(jasmine.Matchers.prototype, this.matchersClass); -}; - - -jasmine.Env.prototype.setTimeout = jasmine.setTimeout; -jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout; -jasmine.Env.prototype.setInterval = jasmine.setInterval; -jasmine.Env.prototype.clearInterval = jasmine.clearInterval; - -/** - * @returns an object containing jasmine version build info, if set. - */ -jasmine.Env.prototype.version = function () { - if (jasmine.version_) { - return jasmine.version_; - } else { - throw new Error('Version not set'); - } -}; - -/** - * @returns string containing jasmine version build info, if set. - */ -jasmine.Env.prototype.versionString = function() { - if (!jasmine.version_) { - return "version unknown"; - } - - var version = this.version(); - var versionString = version.major + "." + version.minor + "." + version.build; - if (version.release_candidate) { - versionString += ".rc" + version.release_candidate; - } - versionString += " revision " + version.revision; - return versionString; -}; - -/** - * @returns a sequential integer starting at 0 - */ -jasmine.Env.prototype.nextSpecId = function () { - return this.nextSpecId_++; -}; - -/** - * @returns a sequential integer starting at 0 - */ -jasmine.Env.prototype.nextSuiteId = function () { - return this.nextSuiteId_++; -}; - -/** - * Register a reporter to receive status updates from Jasmine. - * @param {jasmine.Reporter} reporter An object which will receive status updates. - */ -jasmine.Env.prototype.addReporter = function(reporter) { - this.reporter.addReporter(reporter); -}; - -jasmine.Env.prototype.execute = function() { - this.currentRunner_.execute(); -}; - -jasmine.Env.prototype.describe = function(description, specDefinitions) { - var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite); - - var parentSuite = this.currentSuite; - if (parentSuite) { - parentSuite.add(suite); - } else { - this.currentRunner_.add(suite); - } - - this.currentSuite = suite; - - var declarationError = null; - try { - specDefinitions.call(suite); - } catch(e) { - declarationError = e; - } - - if (declarationError) { - this.it("encountered a declaration exception", function() { - throw declarationError; - }); - } - - this.currentSuite = parentSuite; - - return suite; -}; - -jasmine.Env.prototype.beforeEach = function(beforeEachFunction) { - if (this.currentSuite) { - this.currentSuite.beforeEach(beforeEachFunction); - } else { - this.currentRunner_.beforeEach(beforeEachFunction); - } -}; - -jasmine.Env.prototype.currentRunner = function () { - return this.currentRunner_; -}; - -jasmine.Env.prototype.afterEach = function(afterEachFunction) { - if (this.currentSuite) { - this.currentSuite.afterEach(afterEachFunction); - } else { - this.currentRunner_.afterEach(afterEachFunction); - } - -}; - -jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) { - return { - execute: function() { - } - }; -}; - -jasmine.Env.prototype.it = function(description, func) { - var spec = new jasmine.Spec(this, this.currentSuite, description); - this.currentSuite.add(spec); - this.currentSpec = spec; - - if (func) { - spec.runs(func); - } - - return spec; -}; - -jasmine.Env.prototype.xit = function(desc, func) { - return { - id: this.nextSpecId(), - runs: function() { - } - }; -}; - -jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) { - if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) { - return true; - } - - a.__Jasmine_been_here_before__ = b; - b.__Jasmine_been_here_before__ = a; - - var hasKey = function(obj, keyName) { - return obj !== null && obj[keyName] !== jasmine.undefined; - }; - - for (var property in b) { - if (!hasKey(a, property) && hasKey(b, property)) { - mismatchKeys.push("expected has key '" + property + "', but missing from actual."); - } - } - for (property in a) { - if (!hasKey(b, property) && hasKey(a, property)) { - mismatchKeys.push("expected missing key '" + property + "', but present in actual."); - } - } - for (property in b) { - if (property == '__Jasmine_been_here_before__') continue; - if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) { - mismatchValues.push("'" + property + "' was '" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "' in expected, but was '" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "' in actual."); - } - } - - if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) { - mismatchValues.push("arrays were not the same length"); - } - - delete a.__Jasmine_been_here_before__; - delete b.__Jasmine_been_here_before__; - return (mismatchKeys.length === 0 && mismatchValues.length === 0); -}; - -jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) { - mismatchKeys = mismatchKeys || []; - mismatchValues = mismatchValues || []; - - for (var i = 0; i < this.equalityTesters_.length; i++) { - var equalityTester = this.equalityTesters_[i]; - var result = equalityTester(a, b, this, mismatchKeys, mismatchValues); - if (result !== jasmine.undefined) return result; - } - - if (a === b) return true; - - if (a === jasmine.undefined || a === null || b === jasmine.undefined || b === null) { - return (a == jasmine.undefined && b == jasmine.undefined); - } - - if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) { - return a === b; - } - - if (a instanceof Date && b instanceof Date) { - return a.getTime() == b.getTime(); - } - - if (a instanceof jasmine.Matchers.Any) { - return a.matches(b); - } - - if (b instanceof jasmine.Matchers.Any) { - return b.matches(a); - } - - if (jasmine.isString_(a) && jasmine.isString_(b)) { - return (a == b); - } - - if (jasmine.isNumber_(a) && jasmine.isNumber_(b)) { - return (a == b); - } - - if (typeof a === "object" && typeof b === "object") { - return this.compareObjects_(a, b, mismatchKeys, mismatchValues); - } - - //Straight check - return (a === b); -}; - -jasmine.Env.prototype.contains_ = function(haystack, needle) { - if (jasmine.isArray_(haystack)) { - for (var i = 0; i < haystack.length; i++) { - if (this.equals_(haystack[i], needle)) return true; - } - return false; - } - return haystack.indexOf(needle) >= 0; -}; - -jasmine.Env.prototype.addEqualityTester = function(equalityTester) { - this.equalityTesters_.push(equalityTester); -}; -/** No-op base class for Jasmine reporters. - * - * @constructor - */ -jasmine.Reporter = function() { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.Reporter.prototype.reportRunnerStarting = function(runner) { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.Reporter.prototype.reportRunnerResults = function(runner) { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.Reporter.prototype.reportSuiteResults = function(suite) { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.Reporter.prototype.reportSpecStarting = function(spec) { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.Reporter.prototype.reportSpecResults = function(spec) { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.Reporter.prototype.log = function(str) { -}; - -/** - * Blocks are functions with executable code that make up a spec. - * - * @constructor - * @param {jasmine.Env} env - * @param {Function} func - * @param {jasmine.Spec} spec - */ -jasmine.Block = function(env, func, spec) { - this.env = env; - this.func = func; - this.spec = spec; -}; - -jasmine.Block.prototype.execute = function(onComplete) { - try { - this.func.apply(this.spec); - } catch (e) { - this.spec.fail(e); - } - onComplete(); -}; -/** JavaScript API reporter. - * - * @constructor - */ -jasmine.JsApiReporter = function() { - this.started = false; - this.finished = false; - this.suites_ = []; - this.results_ = {}; -}; - -jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) { - this.started = true; - var suites = runner.topLevelSuites(); - for (var i = 0; i < suites.length; i++) { - var suite = suites[i]; - this.suites_.push(this.summarize_(suite)); - } -}; - -jasmine.JsApiReporter.prototype.suites = function() { - return this.suites_; -}; - -jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) { - var isSuite = suiteOrSpec instanceof jasmine.Suite; - var summary = { - id: suiteOrSpec.id, - name: suiteOrSpec.description, - type: isSuite ? 'suite' : 'spec', - children: [] - }; - - if (isSuite) { - var children = suiteOrSpec.children(); - for (var i = 0; i < children.length; i++) { - summary.children.push(this.summarize_(children[i])); - } - } - return summary; -}; - -jasmine.JsApiReporter.prototype.results = function() { - return this.results_; -}; - -jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) { - return this.results_[specId]; -}; - -//noinspection JSUnusedLocalSymbols -jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) { - this.finished = true; -}; - -//noinspection JSUnusedLocalSymbols -jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) { -}; - -//noinspection JSUnusedLocalSymbols -jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) { - this.results_[spec.id] = { - messages: spec.results().getItems(), - result: spec.results().failedCount > 0 ? "failed" : "passed" - }; -}; - -//noinspection JSUnusedLocalSymbols -jasmine.JsApiReporter.prototype.log = function(str) { -}; - -jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){ - var results = {}; - for (var i = 0; i < specIds.length; i++) { - var specId = specIds[i]; - results[specId] = this.summarizeResult_(this.results_[specId]); - } - return results; -}; - -jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){ - var summaryMessages = []; - var messagesLength = result.messages.length; - for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) { - var resultMessage = result.messages[messageIndex]; - summaryMessages.push({ - text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined, - passed: resultMessage.passed ? resultMessage.passed() : true, - type: resultMessage.type, - message: resultMessage.message, - trace: { - stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined - } - }); - } - - return { - result : result.result, - messages : summaryMessages - }; -}; - -/** - * @constructor - * @param {jasmine.Env} env - * @param actual - * @param {jasmine.Spec} spec - */ -jasmine.Matchers = function(env, actual, spec, opt_isNot) { - this.env = env; - this.actual = actual; - this.spec = spec; - this.isNot = opt_isNot || false; - this.reportWasCalled_ = false; -}; - -// todo: @deprecated as of Jasmine 0.11, remove soon [xw] -jasmine.Matchers.pp = function(str) { - throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!"); -}; - -// todo: @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. [xw] -jasmine.Matchers.prototype.report = function(result, failing_message, details) { - throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs"); -}; - -jasmine.Matchers.wrapInto_ = function(prototype, matchersClass) { - for (var methodName in prototype) { - if (methodName == 'report') continue; - var orig = prototype[methodName]; - matchersClass.prototype[methodName] = jasmine.Matchers.matcherFn_(methodName, orig); - } -}; - -jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) { - return function() { - var matcherArgs = jasmine.util.argsToArray(arguments); - var result = matcherFunction.apply(this, arguments); - - if (this.isNot) { - result = !result; - } - - if (this.reportWasCalled_) return result; - - var message; - if (!result) { - if (this.message) { - message = this.message.apply(this, arguments); - if (jasmine.isArray_(message)) { - message = message[this.isNot ? 1 : 0]; - } - } else { - var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); }); - message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate; - if (matcherArgs.length > 0) { - for (var i = 0; i < matcherArgs.length; i++) { - if (i > 0) message += ","; - message += " " + jasmine.pp(matcherArgs[i]); - } - } - message += "."; - } - } - var expectationResult = new jasmine.ExpectationResult({ - matcherName: matcherName, - passed: result, - expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0], - actual: this.actual, - message: message - }); - this.spec.addMatcherResult(expectationResult); - return jasmine.undefined; - }; -}; - - - - -/** - * toBe: compares the actual to the expected using === - * @param expected - */ -jasmine.Matchers.prototype.toBe = function(expected) { - return this.actual === expected; -}; - -/** - * toNotBe: compares the actual to the expected using !== - * @param expected - * @deprecated as of 1.0. Use not.toBe() instead. - */ -jasmine.Matchers.prototype.toNotBe = function(expected) { - return this.actual !== expected; -}; - -/** - * toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc. - * - * @param expected - */ -jasmine.Matchers.prototype.toEqual = function(expected) { - return this.env.equals_(this.actual, expected); -}; - -/** - * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual - * @param expected - * @deprecated as of 1.0. Use not.toNotEqual() instead. - */ -jasmine.Matchers.prototype.toNotEqual = function(expected) { - return !this.env.equals_(this.actual, expected); -}; - -/** - * Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes - * a pattern or a String. - * - * @param expected - */ -jasmine.Matchers.prototype.toMatch = function(expected) { - return new RegExp(expected).test(this.actual); -}; - -/** - * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch - * @param expected - * @deprecated as of 1.0. Use not.toMatch() instead. - */ -jasmine.Matchers.prototype.toNotMatch = function(expected) { - return !(new RegExp(expected).test(this.actual)); -}; - -/** - * Matcher that compares the actual to jasmine.undefined. - */ -jasmine.Matchers.prototype.toBeDefined = function() { - return (this.actual !== jasmine.undefined); -}; - -/** - * Matcher that compares the actual to jasmine.undefined. - */ -jasmine.Matchers.prototype.toBeUndefined = function() { - return (this.actual === jasmine.undefined); -}; - -/** - * Matcher that compares the actual to null. - */ -jasmine.Matchers.prototype.toBeNull = function() { - return (this.actual === null); -}; - -/** - * Matcher that boolean not-nots the actual. - */ -jasmine.Matchers.prototype.toBeTruthy = function() { - return !!this.actual; -}; - - -/** - * Matcher that boolean nots the actual. - */ -jasmine.Matchers.prototype.toBeFalsy = function() { - return !this.actual; -}; - - -/** - * Matcher that checks to see if the actual, a Jasmine spy, was called. - */ -jasmine.Matchers.prototype.toHaveBeenCalled = function() { - if (arguments.length > 0) { - throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith'); - } - - if (!jasmine.isSpy(this.actual)) { - throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); - } - - this.message = function() { - return [ - "Expected spy " + this.actual.identity + " to have been called.", - "Expected spy " + this.actual.identity + " not to have been called." - ]; - }; - - return this.actual.wasCalled; -}; - -/** @deprecated Use expect(xxx).toHaveBeenCalled() instead */ -jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.prototype.toHaveBeenCalled; - -/** - * Matcher that checks to see if the actual, a Jasmine spy, was not called. - * - * @deprecated Use expect(xxx).not.toHaveBeenCalled() instead - */ -jasmine.Matchers.prototype.wasNotCalled = function() { - if (arguments.length > 0) { - throw new Error('wasNotCalled does not take arguments'); - } - - if (!jasmine.isSpy(this.actual)) { - throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); - } - - this.message = function() { - return [ - "Expected spy " + this.actual.identity + " to not have been called.", - "Expected spy " + this.actual.identity + " to have been called." - ]; - }; - - return !this.actual.wasCalled; -}; - -/** - * Matcher that checks to see if the actual, a Jasmine spy, was called with a set of parameters. - * - * @example - * - */ -jasmine.Matchers.prototype.toHaveBeenCalledWith = function() { - var expectedArgs = jasmine.util.argsToArray(arguments); - if (!jasmine.isSpy(this.actual)) { - throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); - } - this.message = function() { - if (this.actual.callCount === 0) { - // todo: what should the failure message for .not.toHaveBeenCalledWith() be? is this right? test better. [xw] - return [ - "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.", - "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was." - ]; - } else { - return [ - "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall), - "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall) - ]; - } - }; - - return this.env.contains_(this.actual.argsForCall, expectedArgs); -}; - -/** @deprecated Use expect(xxx).toHaveBeenCalledWith() instead */ -jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.prototype.toHaveBeenCalledWith; - -/** @deprecated Use expect(xxx).not.toHaveBeenCalledWith() instead */ -jasmine.Matchers.prototype.wasNotCalledWith = function() { - var expectedArgs = jasmine.util.argsToArray(arguments); - if (!jasmine.isSpy(this.actual)) { - throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); - } - - this.message = function() { - return [ - "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was", - "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was" - ]; - }; - - return !this.env.contains_(this.actual.argsForCall, expectedArgs); -}; - -/** - * Matcher that checks that the expected item is an element in the actual Array. - * - * @param {Object} expected - */ -jasmine.Matchers.prototype.toContain = function(expected) { - return this.env.contains_(this.actual, expected); -}; - -/** - * Matcher that checks that the expected item is NOT an element in the actual Array. - * - * @param {Object} expected - * @deprecated as of 1.0. Use not.toNotContain() instead. - */ -jasmine.Matchers.prototype.toNotContain = function(expected) { - return !this.env.contains_(this.actual, expected); -}; - -jasmine.Matchers.prototype.toBeLessThan = function(expected) { - return this.actual < expected; -}; - -jasmine.Matchers.prototype.toBeGreaterThan = function(expected) { - return this.actual > expected; -}; - -/** - * Matcher that checks that the expected item is equal to the actual item - * up to a given level of decimal precision (default 2). - * - * @param {Number} expected - * @param {Number} precision - */ -jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) { - if (!(precision === 0)) { - precision = precision || 2; - } - var multiplier = Math.pow(10, precision); - var actual = Math.round(this.actual * multiplier); - expected = Math.round(expected * multiplier); - return expected == actual; -}; - -/** - * Matcher that checks that the expected exception was thrown by the actual. - * - * @param {String} expected - */ -jasmine.Matchers.prototype.toThrow = function(expected) { - var result = false; - var exception; - if (typeof this.actual != 'function') { - throw new Error('Actual is not a function'); - } - try { - this.actual(); - } catch (e) { - exception = e; - } - if (exception) { - result = (expected === jasmine.undefined || this.env.equals_(exception.message || exception, expected.message || expected)); - } - - var not = this.isNot ? "not " : ""; - - this.message = function() { - if (exception && (expected === jasmine.undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) { - return ["Expected function " + not + "to throw", expected ? expected.message || expected : "an exception", ", but it threw", exception.message || exception].join(' '); - } else { - return "Expected function to throw an exception."; - } - }; - - return result; -}; - -jasmine.Matchers.Any = function(expectedClass) { - this.expectedClass = expectedClass; -}; - -jasmine.Matchers.Any.prototype.matches = function(other) { - if (this.expectedClass == String) { - return typeof other == 'string' || other instanceof String; - } - - if (this.expectedClass == Number) { - return typeof other == 'number' || other instanceof Number; - } - - if (this.expectedClass == Function) { - return typeof other == 'function' || other instanceof Function; - } - - if (this.expectedClass == Object) { - return typeof other == 'object'; - } - - return other instanceof this.expectedClass; -}; - -jasmine.Matchers.Any.prototype.toString = function() { - return ''; -}; - -/** - * @constructor - */ -jasmine.MultiReporter = function() { - this.subReporters_ = []; -}; -jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter); - -jasmine.MultiReporter.prototype.addReporter = function(reporter) { - this.subReporters_.push(reporter); -}; - -(function() { - var functionNames = [ - "reportRunnerStarting", - "reportRunnerResults", - "reportSuiteResults", - "reportSpecStarting", - "reportSpecResults", - "log" - ]; - for (var i = 0; i < functionNames.length; i++) { - var functionName = functionNames[i]; - jasmine.MultiReporter.prototype[functionName] = (function(functionName) { - return function() { - for (var j = 0; j < this.subReporters_.length; j++) { - var subReporter = this.subReporters_[j]; - if (subReporter[functionName]) { - subReporter[functionName].apply(subReporter, arguments); - } - } - }; - })(functionName); - } -})(); -/** - * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults - * - * @constructor - */ -jasmine.NestedResults = function() { - /** - * The total count of results - */ - this.totalCount = 0; - /** - * Number of passed results - */ - this.passedCount = 0; - /** - * Number of failed results - */ - this.failedCount = 0; - /** - * Was this suite/spec skipped? - */ - this.skipped = false; - /** - * @ignore - */ - this.items_ = []; -}; - -/** - * Roll up the result counts. - * - * @param result - */ -jasmine.NestedResults.prototype.rollupCounts = function(result) { - this.totalCount += result.totalCount; - this.passedCount += result.passedCount; - this.failedCount += result.failedCount; -}; - -/** - * Adds a log message. - * @param values Array of message parts which will be concatenated later. - */ -jasmine.NestedResults.prototype.log = function(values) { - this.items_.push(new jasmine.MessageResult(values)); -}; - -/** - * Getter for the results: message & results. - */ -jasmine.NestedResults.prototype.getItems = function() { - return this.items_; -}; - -/** - * Adds a result, tracking counts (total, passed, & failed) - * @param {jasmine.ExpectationResult|jasmine.NestedResults} result - */ -jasmine.NestedResults.prototype.addResult = function(result) { - if (result.type != 'log') { - if (result.items_) { - this.rollupCounts(result); - } else { - this.totalCount++; - if (result.passed()) { - this.passedCount++; - } else { - this.failedCount++; - } - } - } - this.items_.push(result); -}; - -/** - * @returns {Boolean} True if everything below passed - */ -jasmine.NestedResults.prototype.passed = function() { - return this.passedCount === this.totalCount; -}; -/** - * Base class for pretty printing for expectation results. - */ -jasmine.PrettyPrinter = function() { - this.ppNestLevel_ = 0; -}; - -/** - * Formats a value in a nice, human-readable string. - * - * @param value - */ -jasmine.PrettyPrinter.prototype.format = function(value) { - if (this.ppNestLevel_ > 40) { - throw new Error('jasmine.PrettyPrinter: format() nested too deeply!'); - } - - this.ppNestLevel_++; - try { - if (value === jasmine.undefined) { - this.emitScalar('undefined'); - } else if (value === null) { - this.emitScalar('null'); - } else if (value === jasmine.getGlobal()) { - this.emitScalar(''); - } else if (value instanceof jasmine.Matchers.Any) { - this.emitScalar(value.toString()); - } else if (typeof value === 'string') { - this.emitString(value); - } else if (jasmine.isSpy(value)) { - this.emitScalar("spy on " + value.identity); - } else if (value instanceof RegExp) { - this.emitScalar(value.toString()); - } else if (typeof value === 'function') { - this.emitScalar('Function'); - } else if (typeof value.nodeType === 'number') { - this.emitScalar('HTMLNode'); - } else if (value instanceof Date) { - this.emitScalar('Date(' + value + ')'); - } else if (value.__Jasmine_been_here_before__) { - this.emitScalar(''); - } else if (jasmine.isArray_(value) || typeof value == 'object') { - value.__Jasmine_been_here_before__ = true; - if (jasmine.isArray_(value)) { - this.emitArray(value); - } else { - this.emitObject(value); - } - delete value.__Jasmine_been_here_before__; - } else { - this.emitScalar(value.toString()); - } - } finally { - this.ppNestLevel_--; - } -}; - -jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) { - for (var property in obj) { - if (property == '__Jasmine_been_here_before__') continue; - fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined && - obj.__lookupGetter__(property) !== null) : false); - } -}; - -jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_; -jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_; -jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_; -jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_; - -jasmine.StringPrettyPrinter = function() { - jasmine.PrettyPrinter.call(this); - - this.string = ''; -}; -jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter); - -jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) { - this.append(value); -}; - -jasmine.StringPrettyPrinter.prototype.emitString = function(value) { - this.append("'" + value + "'"); -}; - -jasmine.StringPrettyPrinter.prototype.emitArray = function(array) { - this.append('[ '); - for (var i = 0; i < array.length; i++) { - if (i > 0) { - this.append(', '); - } - this.format(array[i]); - } - this.append(' ]'); -}; - -jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) { - var self = this; - this.append('{ '); - var first = true; - - this.iterateObject(obj, function(property, isGetter) { - if (first) { - first = false; - } else { - self.append(', '); - } - - self.append(property); - self.append(' : '); - if (isGetter) { - self.append(''); - } else { - self.format(obj[property]); - } - }); - - this.append(' }'); -}; - -jasmine.StringPrettyPrinter.prototype.append = function(value) { - this.string += value; -}; -jasmine.Queue = function(env) { - this.env = env; - this.blocks = []; - this.running = false; - this.index = 0; - this.offset = 0; - this.abort = false; -}; - -jasmine.Queue.prototype.addBefore = function(block) { - this.blocks.unshift(block); -}; - -jasmine.Queue.prototype.add = function(block) { - this.blocks.push(block); -}; - -jasmine.Queue.prototype.insertNext = function(block) { - this.blocks.splice((this.index + this.offset + 1), 0, block); - this.offset++; -}; - -jasmine.Queue.prototype.start = function(onComplete) { - this.running = true; - this.onComplete = onComplete; - this.next_(); -}; - -jasmine.Queue.prototype.isRunning = function() { - return this.running; -}; - -jasmine.Queue.LOOP_DONT_RECURSE = true; - -jasmine.Queue.prototype.next_ = function() { - var self = this; - var goAgain = true; - - while (goAgain) { - goAgain = false; - - if (self.index < self.blocks.length && !this.abort) { - var calledSynchronously = true; - var completedSynchronously = false; - - var onComplete = function () { - if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) { - completedSynchronously = true; - return; - } - - if (self.blocks[self.index] && self.blocks[self.index].abort) { - self.abort = true; - } - - self.offset = 0; - self.index++; - - var now = new Date().getTime(); - if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { - self.env.lastUpdate = now; - self.env.setTimeout(function() { - self.next_(); - }, 0); - } else { - if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) { - goAgain = true; - } else { - self.next_(); - } - } - }; - self.blocks[self.index].execute(onComplete); - - calledSynchronously = false; - if (completedSynchronously) { - onComplete(); - } - - } else { - self.running = false; - if (self.onComplete) { - self.onComplete(); - } - } - } -}; - -jasmine.Queue.prototype.results = function() { - var results = new jasmine.NestedResults(); - for (var i = 0; i < this.blocks.length; i++) { - if (this.blocks[i].results) { - results.addResult(this.blocks[i].results()); - } - } - return results; -}; - - -/** - * Runner - * - * @constructor - * @param {jasmine.Env} env - */ -jasmine.Runner = function(env) { - var self = this; - self.env = env; - self.queue = new jasmine.Queue(env); - self.before_ = []; - self.after_ = []; - self.suites_ = []; -}; - -jasmine.Runner.prototype.execute = function() { - var self = this; - if (self.env.reporter.reportRunnerStarting) { - self.env.reporter.reportRunnerStarting(this); - } - self.queue.start(function () { - self.finishCallback(); - }); -}; - -jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) { - beforeEachFunction.typeName = 'beforeEach'; - this.before_.splice(0,0,beforeEachFunction); -}; - -jasmine.Runner.prototype.afterEach = function(afterEachFunction) { - afterEachFunction.typeName = 'afterEach'; - this.after_.splice(0,0,afterEachFunction); -}; - - -jasmine.Runner.prototype.finishCallback = function() { - this.env.reporter.reportRunnerResults(this); -}; - -jasmine.Runner.prototype.addSuite = function(suite) { - this.suites_.push(suite); -}; - -jasmine.Runner.prototype.add = function(block) { - if (block instanceof jasmine.Suite) { - this.addSuite(block); - } - this.queue.add(block); -}; - -jasmine.Runner.prototype.specs = function () { - var suites = this.suites(); - var specs = []; - for (var i = 0; i < suites.length; i++) { - specs = specs.concat(suites[i].specs()); - } - return specs; -}; - -jasmine.Runner.prototype.suites = function() { - return this.suites_; -}; - -jasmine.Runner.prototype.topLevelSuites = function() { - var topLevelSuites = []; - for (var i = 0; i < this.suites_.length; i++) { - if (!this.suites_[i].parentSuite) { - topLevelSuites.push(this.suites_[i]); - } - } - return topLevelSuites; -}; - -jasmine.Runner.prototype.results = function() { - return this.queue.results(); -}; -/** - * Internal representation of a Jasmine specification, or test. - * - * @constructor - * @param {jasmine.Env} env - * @param {jasmine.Suite} suite - * @param {String} description - */ -jasmine.Spec = function(env, suite, description) { - if (!env) { - throw new Error('jasmine.Env() required'); - } - if (!suite) { - throw new Error('jasmine.Suite() required'); - } - var spec = this; - spec.id = env.nextSpecId ? env.nextSpecId() : null; - spec.env = env; - spec.suite = suite; - spec.description = description; - spec.queue = new jasmine.Queue(env); - - spec.afterCallbacks = []; - spec.spies_ = []; - - spec.results_ = new jasmine.NestedResults(); - spec.results_.description = description; - spec.matchersClass = null; -}; - -jasmine.Spec.prototype.getFullName = function() { - return this.suite.getFullName() + ' ' + this.description + '.'; -}; - - -jasmine.Spec.prototype.results = function() { - return this.results_; -}; - -/** - * All parameters are pretty-printed and concatenated together, then written to the spec's output. - * - * Be careful not to leave calls to jasmine.log in production code. - */ -jasmine.Spec.prototype.log = function() { - return this.results_.log(arguments); -}; - -jasmine.Spec.prototype.runs = function (func) { - var block = new jasmine.Block(this.env, func, this); - this.addToQueue(block); - return this; -}; - -jasmine.Spec.prototype.addToQueue = function (block) { - if (this.queue.isRunning()) { - this.queue.insertNext(block); - } else { - this.queue.add(block); - } -}; - -/** - * @param {jasmine.ExpectationResult} result - */ -jasmine.Spec.prototype.addMatcherResult = function(result) { - this.results_.addResult(result); -}; - -jasmine.Spec.prototype.expect = function(actual) { - var positive = new (this.getMatchersClass_())(this.env, actual, this); - positive.not = new (this.getMatchersClass_())(this.env, actual, this, true); - return positive; -}; - -/** - * Waits a fixed time period before moving to the next block. - * - * @deprecated Use waitsFor() instead - * @param {Number} timeout milliseconds to wait - */ -jasmine.Spec.prototype.waits = function(timeout) { - var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this); - this.addToQueue(waitsFunc); - return this; -}; - -/** - * Waits for the latchFunction to return true before proceeding to the next block. - * - * @param {Function} latchFunction - * @param {String} optional_timeoutMessage - * @param {Number} optional_timeout - */ -jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { - var latchFunction_ = null; - var optional_timeoutMessage_ = null; - var optional_timeout_ = null; - - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - switch (typeof arg) { - case 'function': - latchFunction_ = arg; - break; - case 'string': - optional_timeoutMessage_ = arg; - break; - case 'number': - optional_timeout_ = arg; - break; - } - } - - var waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this); - this.addToQueue(waitsForFunc); - return this; -}; - -jasmine.Spec.prototype.fail = function (e) { - var expectationResult = new jasmine.ExpectationResult({ - passed: false, - message: e ? jasmine.util.formatException(e) : 'Exception', - trace: { stack: e.stack } - }); - this.results_.addResult(expectationResult); -}; - -jasmine.Spec.prototype.getMatchersClass_ = function() { - return this.matchersClass || this.env.matchersClass; -}; - -jasmine.Spec.prototype.addMatchers = function(matchersPrototype) { - var parent = this.getMatchersClass_(); - var newMatchersClass = function() { - parent.apply(this, arguments); - }; - jasmine.util.inherit(newMatchersClass, parent); - jasmine.Matchers.wrapInto_(matchersPrototype, newMatchersClass); - this.matchersClass = newMatchersClass; -}; - -jasmine.Spec.prototype.finishCallback = function() { - this.env.reporter.reportSpecResults(this); -}; - -jasmine.Spec.prototype.finish = function(onComplete) { - this.removeAllSpies(); - this.finishCallback(); - if (onComplete) { - onComplete(); - } -}; - -jasmine.Spec.prototype.after = function(doAfter) { - if (this.queue.isRunning()) { - this.queue.add(new jasmine.Block(this.env, doAfter, this)); - } else { - this.afterCallbacks.unshift(doAfter); - } -}; - -jasmine.Spec.prototype.execute = function(onComplete) { - var spec = this; - if (!spec.env.specFilter(spec)) { - spec.results_.skipped = true; - spec.finish(onComplete); - return; - } - - this.env.reporter.reportSpecStarting(this); - - spec.env.currentSpec = spec; - - spec.addBeforesAndAftersToQueue(); - - spec.queue.start(function () { - spec.finish(onComplete); - }); -}; - -jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() { - var runner = this.env.currentRunner(); - var i; - - for (var suite = this.suite; suite; suite = suite.parentSuite) { - for (i = 0; i < suite.before_.length; i++) { - this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this)); - } - } - for (i = 0; i < runner.before_.length; i++) { - this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this)); - } - for (i = 0; i < this.afterCallbacks.length; i++) { - this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this)); - } - for (suite = this.suite; suite; suite = suite.parentSuite) { - for (i = 0; i < suite.after_.length; i++) { - this.queue.add(new jasmine.Block(this.env, suite.after_[i], this)); - } - } - for (i = 0; i < runner.after_.length; i++) { - this.queue.add(new jasmine.Block(this.env, runner.after_[i], this)); - } -}; - -jasmine.Spec.prototype.explodes = function() { - throw 'explodes function should not have been called'; -}; - -jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) { - if (obj == jasmine.undefined) { - throw "spyOn could not find an object to spy upon for " + methodName + "()"; - } - - if (!ignoreMethodDoesntExist && obj[methodName] === jasmine.undefined) { - throw methodName + '() method does not exist'; - } - - if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) { - throw new Error(methodName + ' has already been spied upon'); - } - - var spyObj = jasmine.createSpy(methodName); - - this.spies_.push(spyObj); - spyObj.baseObj = obj; - spyObj.methodName = methodName; - spyObj.originalValue = obj[methodName]; - - obj[methodName] = spyObj; - - return spyObj; -}; - -jasmine.Spec.prototype.removeAllSpies = function() { - for (var i = 0; i < this.spies_.length; i++) { - var spy = this.spies_[i]; - spy.baseObj[spy.methodName] = spy.originalValue; - } - this.spies_ = []; -}; - -/** - * Internal representation of a Jasmine suite. - * - * @constructor - * @param {jasmine.Env} env - * @param {String} description - * @param {Function} specDefinitions - * @param {jasmine.Suite} parentSuite - */ -jasmine.Suite = function(env, description, specDefinitions, parentSuite) { - var self = this; - self.id = env.nextSuiteId ? env.nextSuiteId() : null; - self.description = description; - self.queue = new jasmine.Queue(env); - self.parentSuite = parentSuite; - self.env = env; - self.before_ = []; - self.after_ = []; - self.children_ = []; - self.suites_ = []; - self.specs_ = []; -}; - -jasmine.Suite.prototype.getFullName = function() { - var fullName = this.description; - for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) { - fullName = parentSuite.description + ' ' + fullName; - } - return fullName; -}; - -jasmine.Suite.prototype.finish = function(onComplete) { - this.env.reporter.reportSuiteResults(this); - this.finished = true; - if (typeof(onComplete) == 'function') { - onComplete(); - } -}; - -jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) { - beforeEachFunction.typeName = 'beforeEach'; - this.before_.unshift(beforeEachFunction); -}; - -jasmine.Suite.prototype.afterEach = function(afterEachFunction) { - afterEachFunction.typeName = 'afterEach'; - this.after_.unshift(afterEachFunction); -}; - -jasmine.Suite.prototype.results = function() { - return this.queue.results(); -}; - -jasmine.Suite.prototype.add = function(suiteOrSpec) { - this.children_.push(suiteOrSpec); - if (suiteOrSpec instanceof jasmine.Suite) { - this.suites_.push(suiteOrSpec); - this.env.currentRunner().addSuite(suiteOrSpec); - } else { - this.specs_.push(suiteOrSpec); - } - this.queue.add(suiteOrSpec); -}; - -jasmine.Suite.prototype.specs = function() { - return this.specs_; -}; - -jasmine.Suite.prototype.suites = function() { - return this.suites_; -}; - -jasmine.Suite.prototype.children = function() { - return this.children_; -}; - -jasmine.Suite.prototype.execute = function(onComplete) { - var self = this; - this.queue.start(function () { - self.finish(onComplete); - }); -}; -jasmine.WaitsBlock = function(env, timeout, spec) { - this.timeout = timeout; - jasmine.Block.call(this, env, null, spec); -}; - -jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block); - -jasmine.WaitsBlock.prototype.execute = function (onComplete) { - if (jasmine.VERBOSE) { - this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...'); - } - this.env.setTimeout(function () { - onComplete(); - }, this.timeout); -}; -/** - * A block which waits for some condition to become true, with timeout. - * - * @constructor - * @extends jasmine.Block - * @param {jasmine.Env} env The Jasmine environment. - * @param {Number} timeout The maximum time in milliseconds to wait for the condition to become true. - * @param {Function} latchFunction A function which returns true when the desired condition has been met. - * @param {String} message The message to display if the desired condition hasn't been met within the given time period. - * @param {jasmine.Spec} spec The Jasmine spec. - */ -jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) { - this.timeout = timeout || env.defaultTimeoutInterval; - this.latchFunction = latchFunction; - this.message = message; - this.totalTimeSpentWaitingForLatch = 0; - jasmine.Block.call(this, env, null, spec); -}; -jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block); - -jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 10; - -jasmine.WaitsForBlock.prototype.execute = function(onComplete) { - if (jasmine.VERBOSE) { - this.env.reporter.log('>> Jasmine waiting for ' + (this.message || 'something to happen')); - } - - if (this.latchFunction.length > 0) { this.waitForExplicitCompletion(onComplete); return; } - - var latchFunctionResult; - try { - latchFunctionResult = this.latchFunction.apply(this.spec); - } catch (e) { - this.spec.fail(e); - onComplete(); - return; - } - - if (latchFunctionResult) { - onComplete(); - } else if (this.totalTimeSpentWaitingForLatch >= this.timeout) { - var message = 'timed out after ' + this.timeout + ' msec waiting for ' + (this.message || 'something to happen'); - this.spec.fail({ - name: 'timeout', - message: message - }); - - this.abort = true; - onComplete(); - } else { - this.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT; - var self = this; - this.env.setTimeout(function() { - self.execute(onComplete); - }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT); - } -}; - -jasmine.WaitsForBlock.prototype.waitForExplicitCompletion = function(onComplete) { - var self = this; - var timeoutHandle = this.env.setTimeout(function() { - var message = 'timed out after ' + self.timeout + ' msec waiting for ' + (self.message || 'something to happen'); - self.spec.fail({ - name: 'timeout', - message: message - }); - multiCompletion.cancelled = true; - self.abort = true; - onComplete(); - }, this.timeout); - - var multiCompletion = new jasmine.WaitsForBlock.MultiCompletion(this.latchFunction.length, this.env, onComplete, timeoutHandle); - - try { - this.latchFunction.apply(this.spec, multiCompletion.completionFunctions); - } catch (e) { - this.spec.fail(e); - onComplete(); - return; - } -}; - -jasmine.WaitsForBlock.MultiCompletion = function(count, env, onComplete, timeoutHandle) { - this.count = count; - this.env = env; - this.onComplete = onComplete; - this.timeoutHandle = timeoutHandle; - this.completionStatuses = []; - this.completionFunctions = []; - - for (var i = 0; i < count; i++) { - this.completionStatuses.push(false); - this.completionFunctions.push(this.buildCompletionFunction(i)); - } -}; - -jasmine.WaitsForBlock.MultiCompletion.prototype.attemptCompletion = function() { - if (this.cancelled) return; - for (var j = 0; j < this.count; j++) { - if (!this.completionStatuses[j]) return; - } - this.env.clearTimeout(this.timeoutHandle); - this.onComplete(); -}; - -jasmine.WaitsForBlock.MultiCompletion.prototype.buildCompletionFunction = function(i) { - var self = this; - var spent = false; - return function() { - if (spent) return; - spent = true; - self.completionStatuses[i] = true; - self.attemptCompletion(); - }; -}; - -// Mock setTimeout, clearTimeout -// Contributed by Pivotal Computer Systems, www.pivotalsf.com - -jasmine.FakeTimer = function() { - this.reset(); - - var self = this; - self.setTimeout = function(funcToCall, millis) { - self.timeoutsMade++; - self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false); - return self.timeoutsMade; - }; - - self.setInterval = function(funcToCall, millis) { - self.timeoutsMade++; - self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true); - return self.timeoutsMade; - }; - - self.clearTimeout = function(timeoutKey) { - self.scheduledFunctions[timeoutKey] = jasmine.undefined; - }; - - self.clearInterval = function(timeoutKey) { - self.scheduledFunctions[timeoutKey] = jasmine.undefined; - }; - -}; - -jasmine.FakeTimer.prototype.reset = function() { - this.timeoutsMade = 0; - this.scheduledFunctions = {}; - this.nowMillis = 0; -}; - -jasmine.FakeTimer.prototype.tick = function(millis) { - var oldMillis = this.nowMillis; - var newMillis = oldMillis + millis; - this.runFunctionsWithinRange(oldMillis, newMillis); - this.nowMillis = newMillis; -}; - -jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) { - var scheduledFunc; - var funcsToRun = []; - for (var timeoutKey in this.scheduledFunctions) { - scheduledFunc = this.scheduledFunctions[timeoutKey]; - if (scheduledFunc != jasmine.undefined && - scheduledFunc.runAtMillis >= oldMillis && - scheduledFunc.runAtMillis <= nowMillis) { - funcsToRun.push(scheduledFunc); - this.scheduledFunctions[timeoutKey] = jasmine.undefined; - } - } - - if (funcsToRun.length > 0) { - funcsToRun.sort(function(a, b) { - return a.runAtMillis - b.runAtMillis; - }); - for (var i = 0; i < funcsToRun.length; ++i) { - try { - var funcToRun = funcsToRun[i]; - this.nowMillis = funcToRun.runAtMillis; - funcToRun.funcToCall(); - if (funcToRun.recurring) { - this.scheduleFunction(funcToRun.timeoutKey, - funcToRun.funcToCall, - funcToRun.millis, - true); - } - } catch(e) { - } - } - this.runFunctionsWithinRange(oldMillis, nowMillis); - } -}; - -jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) { - this.scheduledFunctions[timeoutKey] = { - runAtMillis: this.nowMillis + millis, - funcToCall: funcToCall, - recurring: recurring, - timeoutKey: timeoutKey, - millis: millis - }; -}; - -/** - * @namespace - */ -jasmine.Clock = { - defaultFakeTimer: new jasmine.FakeTimer(), - - reset: function() { - jasmine.Clock.assertInstalled(); - jasmine.Clock.defaultFakeTimer.reset(); - }, - - tick: function(millis) { - jasmine.Clock.assertInstalled(); - jasmine.Clock.defaultFakeTimer.tick(millis); - }, - - runFunctionsWithinRange: function(oldMillis, nowMillis) { - jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis); - }, - - scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) { - jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring); - }, - - useMock: function() { - if (!jasmine.Clock.isInstalled()) { - var spec = jasmine.getEnv().currentSpec; - spec.after(jasmine.Clock.uninstallMock); - - jasmine.Clock.installMock(); - } - }, - - installMock: function() { - jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer; - }, - - uninstallMock: function() { - jasmine.Clock.assertInstalled(); - jasmine.Clock.installed = jasmine.Clock.real; - }, - - real: { - setTimeout: jasmine.getGlobal().setTimeout, - clearTimeout: jasmine.getGlobal().clearTimeout, - setInterval: jasmine.getGlobal().setInterval, - clearInterval: jasmine.getGlobal().clearInterval - }, - - assertInstalled: function() { - if (!jasmine.Clock.isInstalled()) { - throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()"); - } - }, - - isInstalled: function() { - return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer; - }, - - installed: null -}; -jasmine.Clock.installed = jasmine.Clock.real; - -//else for IE support -jasmine.getGlobal().setTimeout = function(funcToCall, millis) { - if (jasmine.Clock.installed.setTimeout.apply) { - return jasmine.Clock.installed.setTimeout.apply(this, arguments); - } else { - return jasmine.Clock.installed.setTimeout(funcToCall, millis); - } -}; - -jasmine.getGlobal().setInterval = function(funcToCall, millis) { - if (jasmine.Clock.installed.setInterval.apply) { - return jasmine.Clock.installed.setInterval.apply(this, arguments); - } else { - return jasmine.Clock.installed.setInterval(funcToCall, millis); - } -}; - -jasmine.getGlobal().clearTimeout = function(timeoutKey) { - if (jasmine.Clock.installed.clearTimeout.apply) { - return jasmine.Clock.installed.clearTimeout.apply(this, arguments); - } else { - return jasmine.Clock.installed.clearTimeout(timeoutKey); - } -}; - -jasmine.getGlobal().clearInterval = function(timeoutKey) { - if (jasmine.Clock.installed.clearTimeout.apply) { - return jasmine.Clock.installed.clearInterval.apply(this, arguments); - } else { - return jasmine.Clock.installed.clearInterval(timeoutKey); - } -}; - -jasmine.version_= { - "major": 1, - "minor": 1, - "build": 0, - "revision": 1315677058 -}; diff --git a/vendor/jquery.js b/vendor/jquery.js deleted file mode 100644 index b1df45800..000000000 --- a/vendor/jquery.js +++ /dev/null @@ -1,9244 +0,0 @@ -/*! - * jQuery JavaScript Library v1.7.1 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon Nov 21 21:11:03 2011 -0500 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context ? context.ownerDocument || context : document ); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.7.1", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.add( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.fireWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).off( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery.Callbacks( "once memory" ); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - // A crude way of determining if an object is a window - isWindow: function( obj ) { - return obj && typeof obj === "object" && "setInterval" in obj; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array, i ) { - var len; - - if ( array ) { - if ( indexOf ) { - return indexOf.call( array, elem, i ); - } - - len = array.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in array && array[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, key, value, exec, fn, pass ) { - var length = elems.length; - - // Setting many attributes - if ( typeof key === "object" ) { - for ( var k in key ) { - jQuery.access( elems, k, key[k], exec, fn, value ); - } - return elems; - } - - // Setting one attribute - if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = !pass && exec && jQuery.isFunction(value); - - for ( var i = 0; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - - return elems; - } - - // Getting an attribute - return length ? fn( elems[0], key ) : undefined; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -// String to Object flags format cache -var flagsCache = {}; - -// Convert String-formatted flags into Object-formatted ones and store in cache -function createFlags( flags ) { - var object = flagsCache[ flags ] = {}, - i, length; - flags = flags.split( /\s+/ ); - for ( i = 0, length = flags.length; i < length; i++ ) { - object[ flags[i] ] = true; - } - return object; -} - -/* - * Create a callback list using the following parameters: - * - * flags: an optional list of space-separated flags that will change how - * the callback list behaves - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible flags: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( flags ) { - - // Convert flags from String-formatted to Object-formatted - // (we check in cache first) - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; - - var // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = [], - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Add one or several callbacks to the list - add = function( args ) { - var i, - length, - elem, - type, - actual; - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - // Inspect recursively - add( elem ); - } else if ( type === "function" ) { - // Add if not in unique mode and callback is not in - if ( !flags.unique || !self.has( elem ) ) { - list.push( elem ); - } - } - } - }, - // Fire callbacks - fire = function( context, args ) { - args = args || []; - memory = !flags.memory || [ context, args ]; - firing = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { - memory = true; // Mark as halted - break; - } - } - firing = false; - if ( list ) { - if ( !flags.once ) { - if ( stack && stack.length ) { - memory = stack.shift(); - self.fireWith( memory[ 0 ], memory[ 1 ] ); - } - } else if ( memory === true ) { - self.disable(); - } else { - list = []; - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - var length = list.length; - add( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away, unless previous - // firing was halted (stopOnFalse) - } else if ( memory && memory !== true ) { - firingStart = length; - fire( memory[ 0 ], memory[ 1 ] ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - var args = arguments, - argIndex = 0, - argLength = args.length; - for ( ; argIndex < argLength ; argIndex++ ) { - for ( var i = 0; i < list.length; i++ ) { - if ( args[ argIndex ] === list[ i ] ) { - // Handle firingIndex and firingLength - if ( firing ) { - if ( i <= firingLength ) { - firingLength--; - if ( i <= firingIndex ) { - firingIndex--; - } - } - } - // Remove the element - list.splice( i--, 1 ); - // If we have some unicity property then - // we only need to do this once - if ( flags.unique ) { - break; - } - } - } - } - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - if ( list ) { - var i = 0, - length = list.length; - for ( ; i < length; i++ ) { - if ( fn === list[ i ] ) { - return true; - } - } - } - return false; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory || memory === true ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( stack ) { - if ( firing ) { - if ( !flags.once ) { - stack.push( [ context, args ] ); - } - } else if ( !( flags.once && memory ) ) { - fire( context, args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!memory; - } - }; - - return self; -}; - - - - -var // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - - Deferred: function( func ) { - var doneList = jQuery.Callbacks( "once memory" ), - failList = jQuery.Callbacks( "once memory" ), - progressList = jQuery.Callbacks( "memory" ), - state = "pending", - lists = { - resolve: doneList, - reject: failList, - notify: progressList - }, - promise = { - done: doneList.add, - fail: failList.add, - progress: progressList.add, - - state: function() { - return state; - }, - - // Deprecated - isResolved: doneList.fired, - isRejected: failList.fired, - - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); - return this; - }, - always: function() { - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); - return this; - }, - pipe: function( fnDone, fnFail, fnProgress ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ], - progress: [ fnProgress, "notify" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - obj = promise; - } else { - for ( var key in promise ) { - obj[ key ] = promise[ key ]; - } - } - return obj; - } - }, - deferred = promise.promise({}), - key; - - for ( key in lists ) { - deferred[ key ] = lists[ key ].fire; - deferred[ key + "With" ] = lists[ key ].fireWith; - } - - // Handle state - deferred.done( function() { - state = "resolved"; - }, failList.disable, progressList.lock ).fail( function() { - state = "rejected"; - }, doneList.disable, progressList.lock ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = sliceDeferred.call( arguments, 0 ), - i = 0, - length = args.length, - pValues = new Array( length ), - count = length, - pCount = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(), - promise = deferred.promise(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - deferred.resolveWith( deferred, args ); - } - }; - } - function progressFunc( i ) { - return function( value ) { - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - deferred.notifyWith( promise, pValues ); - }; - } - if ( length > 1 ) { - for ( ; i < length; i++ ) { - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return promise; - } -}); - - - - -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - marginDiv, - fragment, - tds, - events, - eventName, - i, - isSupported, - div = document.createElement( "div" ), - documentElement = document.documentElement; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
    a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - div.innerHTML = ""; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = marginDiv = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - conMarginTop, ptlm, vb, style, html, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"; - vb = "visibility:hidden;border:0;"; - style = "style='" + ptlm + "border:5px solid #000;padding:0;'"; - html = "
    " + - "" + - "
    "; - - container = document.createElement("div"); - container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
    t
    "; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Figure out if the W3C box model works as expected - div.innerHTML = ""; - div.style.width = div.style.paddingLeft = "1px"; - jQuery.boxModel = support.boxModel = div.offsetWidth === 2; - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = ""; - div.innerHTML = "
    "; - support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); - } - - div.style.cssText = ptlm + vb; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - body.removeChild( container ); - div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, attr, name, - data = null; - - if ( typeof key === "undefined" ) { - if ( this.length ) { - data = jQuery.data( this[0] ); - - if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { - attr = this[0].attributes; - for ( var i = 0, l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( this[0], name, data[ name ] ); - } - } - jQuery._data( this[0], "parsedAttrs", true ); - } - } - - return data; - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - // Try to fetch any internally stored data first - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - data = dataAttr( this[0], key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - - } else { - return this.each(function() { - var self = jQuery( this ), - args = [ parts[0], value ]; - - self.triggerHandler( "setData" + parts[1] + "!", args ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + parts[1] + "!", args ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? parseFloat( data ) : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise(); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.attr ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.prop ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - - // See #9699 for explanation of this approach (setting first, then removal) - jQuery.attr( elem, name, "" ); - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( rboolean.test( name ) && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, - rhoverHack = /\bhover(\.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Determine handlers that should run if there are delegated events - // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on.call( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

    "; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
    "; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.POS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( elem.parentNode.firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /", "" ], - legend: [ 1, "
    ", "
    " ], - thead: [ 1, "", "
    " ], - tr: [ 2, "", "
    " ], - td: [ 3, "", "
    " ], - col: [ 2, "", "
    " ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and